Hello.
I want to search within the C code for certain functions that meet a
signature
criteria, etc. For this kind of search it is suitable to use the CIL
interpreted
deconstructors (eventually with placeholders).
More exactly I used to search in the C code the following deconstructors:
- "void * const (*)(int x)" - matches function: void * const
my_wait(int x) (BTW, it
means void pointer where the pointer is const), also const void * const
my_wait(int x),
but does NOT match const void *my_wait(int x)
- "void (*)(int)" - matches function: void my_wait(int sec)
Note however that the deconstructor:
void (*)(int sec) - matches also function: void my_wait(int sec)
void (*)(int secBla) - does NOT match function: void
my_wait(int sec)
- "void (*)(int, int)"
- "void (*)(%F:t)"
Note that the id after semilcolon (:t in this case) is not relevant
- we can
use any other correct name instead (e.g., as var name).
- "void my_wait(int seconds)"
This deconstructor gives parsing error:
<string>[1:5-12] : syntax error
Error: Parsing error: void my_wait(int seconds)
<string>[1:5-12] : syntax error
Error: Parsing error: void my_wait(int seconds)
<string>[1:5-12] : syntax error
Error: Parsing error: void my_wait(int seconds)
- "void printf(%F:t)"
This deconstructor gives parsing error:
string>[1:5-11] : syntax error
Error: Parsing error: void printf(%F:t)
<string>[1:5-11] : syntax error
Error: Parsing error: void printf(%F:t)
<string>[1:5-11] : syntax error
Error: Parsing error: void printf(%F:t)
Given the above examples, I would like to have a few extensions to the CIL
deconstructors:
- specify names of functions - currently adding real function names to
deconstructors gives parse error
- maybe specify partial names of formal arguments for functions, or
maybe even use
some reg-expressions.
Did anybody attempt such extensions (or maybe I am even missing something
you would
want to share)?
As mentioned in cil.pdf, Section 6.2, the one responsible for
(de)constructors is
formatcil.ml (method doParse, etc). I did a strange hack in this direction, but
I'm
thinking to add these extensions within the formatcil.ml.
Best regards.
Alex
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
CIL-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cil-users