The use of SITE_RC in utils.y is to pass two special parameters needed for
the pycparser_parse function: pycparser_includes and pycparser_undefines,
in a way similar to clang_includes.  Those two parameters cannot be set as
global includes and undefines because my tests led to failure of
gccxml_parse.

I checked several xdress modules and could not find an easy way to pass rc
to pycparser_parse.  I guess the "clang_includes" argument, which is
ignored by gccxml_parse and pycparser_parse, was made special for a similar
reason for the clang_parse function.

The use of SITE_RC can be also useful for clang_includes without making it
a nonuniform, special argument.

Another idea would be to pass rc to all three parse function so that the
function signature would be more uniform, assuming rc is available at the
points these functions are called.  For this approach, rc can have a
default value of parse_global_rc(), which may be called three time when
loading the astparsers module.  So, it may be a good idea even for this
approach to call parse_global_rc() in utils.py and save a copy as
(tentatively SITE_RC) in the main function and for the default values for
the three parse functions.  The reason to have a default value for the rc
argument is to minimize the effort for unit tests.

I don't know whether I explained my reason sufficiently.


On Wed, Feb 26, 2014 at 11:52 PM, Anthony Scopatz
<notifications@github.com>wrote:

> In xdress/utils.py:
>
> > @@ -42,6 +42,8 @@
> >
> >  FORBIDDEN_NAMES = frozenset(['del', 'global'])
> >
> > +SITE_RC = {} # an RunControl instance after parse_global_rc()
>
> Said another way, what problem is this solving that couldn't be solved in
> a plugin?
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/xdress/xdress/pull/197/files#r10112193>
> .
>



-- 
Jinsuo Nie