See defines.h for _ and __.
Thank you for the pointer. I found the defines.
#ifdef __cplusplus
ifndef HAVE_PROTOTYPES
define HAVE_PROTOTYPES 1
endif
ifndef HAVE_STDARG_PROTOTYPES
define HAVE_STDARG_PROTOTYPES 1
endif
#endif
#undef _ #ifdef HAVE_PROTOTYPES
define _(args) args
#else
define _(args) ()
#endif
#undef __ #ifdef HAVE_STDARG_PROTOTYPES
define __(args) args
#else
define __(args) ()
#endif
It looks like if __cplusplus is not defined, an empty argument field is
outputted. If __cplusplus is defined, the arguments are outputted by the
preprocessor.
Ruby source and extensions are not good as a tutorial.
I’m trying to find out where the File name and line number of methods
are
stored. So far my search has lead me to look in the backtrace function
in
eval.c: line 6094.
If you have any pointers to lead me in the right direction, I would
appreciate it very much.
Of course, looking at the ruby c source requires me to learn some c.
I’m trying to find out where the File name and line number of methods are
stored. So far my search has lead me to look in the backtrace function in
eval.c: line 6094.
Would there be a way to access the Node struct from a Ruby object?
My objective is to find all of the file and line numbers of the class,
module, and method definitions.
To me, it looks like it would require significant rewriting of the Ruby
core
to easily achieve this.
The reason is I’m looking at #define NEW_METHOD(n,x) NEW_NODE(NODE_METHOD,x,n,0)
… #define NEW_CLASS(n,b,s) NEW_NODE(NODE_CLASS #define NEW_SCLASS(r,b)
NEW_NODE(NODE_SCLASS,r,NEW_SCOPE(b),0),n,NEW_SCOPE(b),(s)) #define NEW_MODULE(n,b) NEW_NODE(NODE_MODULE,n,NEW_SCOPE(b),0)
in node.h
They are all called in parse.y, parse.c, class.c, and eval.c
It looks like set_trace_func is the best way to achieve this goal.