Cosmetic changes and some docs on some symbol functions

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13192 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2012-06-25 18:22:17 +00:00
commit b6c76bcd94

View file

@ -463,6 +463,7 @@ Symtab *Swig_symbol_current(void) {
* Swig_symbol_alias()
*
* Makes an alias for a symbol in the global symbol table.
* Primarily for namespace aliases such as 'namespace X = Y;'.
* ----------------------------------------------------------------------------- */
void Swig_symbol_alias(const_String_or_char_ptr aliasname, Symtab *s) {
@ -482,6 +483,8 @@ void Swig_symbol_alias(const_String_or_char_ptr aliasname, Symtab *s) {
* Swig_symbol_inherit()
*
* Inherit symbols from another scope.
* Primarily for using directives, such as 'using namespace X;'.
* Not for using declarations, such as 'using A;'.
* ----------------------------------------------------------------------------- */
void Swig_symbol_inherit(Symtab *s) {
@ -535,6 +538,7 @@ void Swig_symbol_cadd(const_String_or_char_ptr name, Node *n) {
if (!name)
return;
if (SwigType_istemplate(name)) {
String *cname = NewString(name);
String *dname = Swig_symbol_template_deftype(cname, 0);
@ -880,7 +884,7 @@ Node *Swig_symbol_add(const_String_or_char_ptr symname, Node *n) {
/* Well, we made it this far. Guess we can drop the symbol in place */
Setattr(n, "sym:symtab", current_symtab);
Setattr(n, "sym:name", symname);
/* Printf(stdout,"%s %x\n", Getattr(n,"sym:overname"), current_symtab); */
/* Printf(stdout,"%s %p\n", Getattr(n,"sym:overname"), current_symtab); */
assert(!Getattr(n, "sym:overname"));
overname = NewStringf("__SWIG_%d", pn);
Setattr(n, "sym:overname", overname);
@ -927,7 +931,6 @@ static Node *_symbol_lookup(const String *name, Symtab *symtab, int (*check) (No
return 0;
Setmark(symtab, 1);
n = Getattr(sym, name);
#ifdef SWIG_DEBUG
@ -1084,8 +1087,9 @@ static Node *symbol_lookup_qualified(const_String_or_char_ptr name, Symtab *symt
* Swig_symbol_clookup()
*
* Look up a symbol in the symbol table. This uses the C name, not scripting
* names. Note: If we come across a using a directive, we follow it to
* to get the real node.
* names. Note: If we come across a using declaration, we follow it to
* to get the real node. Any using directives are also followed (but this is
* implemented in symbol_lookup()).
* ----------------------------------------------------------------------------- */
Node *Swig_symbol_clookup(const_String_or_char_ptr name, Symtab *n) {
@ -1226,6 +1230,9 @@ Node *Swig_symbol_clookup_check(const_String_or_char_ptr name, Symtab *n, int (*
/* -----------------------------------------------------------------------------
* Swig_symbol_clookup_local()
*
* Same as Swig_symbol_clookup but parent nodes are not searched, that is, just
* this symbol table is searched.
* ----------------------------------------------------------------------------- */
Node *Swig_symbol_clookup_local(const_String_or_char_ptr name, Symtab *n) {
@ -1446,14 +1453,14 @@ Node *Swig_symbol_isoverloaded(Node *n) {
}
/* -----------------------------------------------------------------------------
* Swig_symbol_type_qualify()
* symbol_template_qualify()
*
* Create a fully qualified type name
* Internal function to create a fully qualified type name for templates
* ----------------------------------------------------------------------------- */
/* This cache produces problems with OSS, don't active it */
/* #define SWIG_TEMPLATE_QUALIFY_CACHE */
static SwigType *Swig_symbol_template_qualify(const SwigType *e, Symtab *st) {
static SwigType *symbol_template_qualify(const SwigType *e, Symtab *st) {
String *tprefix, *tsuffix;
SwigType *qprefix;
List *targs;
@ -1518,10 +1525,16 @@ static SwigType *Swig_symbol_template_qualify(const SwigType *e, Symtab *st) {
}
static int no_constructor(Node *n) {
static int symbol_no_constructor(Node *n) {
return !Checkattr(n, "nodeType", "constructor");
}
/* -----------------------------------------------------------------------------
* Swig_symbol_type_qualify()
*
* Create a fully qualified type name
* ----------------------------------------------------------------------------- */
SwigType *Swig_symbol_type_qualify(const SwigType *t, Symtab *st) {
List *elements;
String *result = NewStringEmpty();
@ -1538,7 +1551,7 @@ SwigType *Swig_symbol_type_qualify(const SwigType *t, Symtab *st) {
for (i = 0; i < len; i++) {
String *e = Getitem(elements, i);
if (SwigType_issimple(e)) {
Node *n = Swig_symbol_clookup_check(e, st, no_constructor);
Node *n = Swig_symbol_clookup_check(e, st, symbol_no_constructor);
if (n) {
String *name = Getattr(n, "name");
Clear(e);
@ -1558,7 +1571,7 @@ SwigType *Swig_symbol_type_qualify(const SwigType *t, Symtab *st) {
Delete(qname);
}
} else if (SwigType_istemplate(e)) {
SwigType *ty = Swig_symbol_template_qualify(e, st);
SwigType *ty = symbol_template_qualify(e, st);
Clear(e);
Append(e, ty);
Delete(ty);