From: William F. <wsf...@us...> - 2006-11-01 23:55:25
|
Update of /cvsroot/swig/SWIG/Source/CParse In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23967/CParse Modified Files: cparse.h cscanner.c templ.c util.c Log Message: beautify/format source code with gnu indent Index: cscanner.c =================================================================== RCS file: /cvsroot/swig/SWIG/Source/CParse/cscanner.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** cscanner.c 28 Sep 2006 06:45:46 -0000 1.38 --- cscanner.c 1 Nov 2006 23:54:49 -0000 1.39 *************** *** 19,56 **** typedef struct InFile { DOHFile *f; ! int line_number; ! char *in_file; struct InFile *prev; } InFile; ! static InFile *in_head; DOHFile *LEX_in = 0; [...2588 lines suppressed...] ! return (WARN); ! } ! /* Have an unknown identifier, as a last step, we'll do a typedef lookup on it. */ ! ! /* Need to fix this */ ! if (check_typedef) { ! if (SwigType_istypedef(yytext)) { ! yylval.type = NewString(yytext); ! return (TYPE_TYPEDEF); ! } } + yylval.id = Swig_copy_string(yytext); + last_id = 1; + return (ID); + case POUND: + return yylex(); + default: + return (l); + } } Index: util.c =================================================================== RCS file: /cvsroot/swig/SWIG/Source/CParse/util.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** util.c 6 Mar 2006 22:50:56 -0000 1.19 --- util.c 1 Nov 2006 23:54:49 -0000 1.20 *************** *** 22,35 **** void Swig_cparse_replace_descriptor(String *s) { ! char tmp[512]; String *arg = 0; SwigType *t; char *c = 0; ! while ((c = strstr(Char(s),"$descriptor("))) { char *d = tmp; ! int level = 0; while (*c) { ! if (*c == '(') level++; if (*c == ')') { level--; --- 22,36 ---- void Swig_cparse_replace_descriptor(String *s) { ! char tmp[512]; String *arg = 0; SwigType *t; char *c = 0; ! while ((c = strstr(Char(s), "$descriptor("))) { char *d = tmp; ! int level = 0; while (*c) { ! if (*c == '(') ! level++; if (*c == ')') { level--; *************** *** 43,47 **** } *d = 0; ! arg = NewString(tmp+12); t = Swig_cparse_type(arg); Delete(arg); --- 44,48 ---- } *d = 0; ! arg = NewString(tmp + 12); t = Swig_cparse_type(arg); Delete(arg); *************** *** 51,67 **** String *mangle; String *descriptor; ! mangle = SwigType_manglestr(t); ! descriptor = NewStringf("SWIGTYPE%s",mangle); SwigType_remember(t); *d = ')'; d++; *d = 0; ! Replace(s,tmp,descriptor,DOH_REPLACE_ANY); Delete(mangle); Delete(descriptor); Delete(t); } else { ! Swig_error(Getfile(s),Getline(s),"Bad $descriptor() macro.\n"); break; } --- 52,68 ---- String *mangle; String *descriptor; ! mangle = SwigType_manglestr(t); ! descriptor = NewStringf("SWIGTYPE%s", mangle); SwigType_remember(t); *d = ')'; d++; *d = 0; ! Replace(s, tmp, descriptor, DOH_REPLACE_ANY); Delete(mangle); Delete(descriptor); Delete(t); } else { ! Swig_error(Getfile(s), Getline(s), "Bad $descriptor() macro.\n"); break; } *************** *** 77,90 **** void cparse_normalize_void(Node *n) { ! String *decl = Getattr(n,k_decl); ! Parm *parms = Getattr(n,k_parms); if (SwigType_isfunction(decl)) { ! if ((ParmList_len(parms) == 1) && (SwigType_type(Getattr(parms,k_type)) == T_VOID)) { ! Replaceall(decl,"f(void).","f()."); ! Delattr(n,k_parms); } } } - - --- 78,89 ---- void cparse_normalize_void(Node *n) { ! String *decl = Getattr(n, k_decl); ! Parm *parms = Getattr(n, k_parms); if (SwigType_isfunction(decl)) { ! if ((ParmList_len(parms) == 1) && (SwigType_type(Getattr(parms, k_type)) == T_VOID)) { ! Replaceall(decl, "f(void).", "f()."); ! Delattr(n, k_parms); } } } Index: templ.c =================================================================== RCS file: /cvsroot/swig/SWIG/Source/CParse/templ.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** templ.c 23 Sep 2006 22:36:22 -0000 1.32 --- templ.c 1 Nov 2006 23:54:49 -0000 1.33 *************** *** 19,24 **** String *baselists[3]; ! void SwigType_template_init() ! { baselists[0] = k_baselist; baselists[1] = k_protectedbaselist; --- 19,23 ---- String *baselists[3]; ! void SwigType_template_init() { [...1144 lines suppressed...] ! } ! /* repeat until we find a match with correct number of templated parameters */ ! n = Getattr(n, k_symnextSibling); } ! if (!n) { ! Swig_error(cparse_file, cparse_line, "Template '%s' undefined.\n", name); } if ((template_debug) && (n)) { ! Printf(stdout, "Templated function found: %p\n", n); ! Swig_print_node(n); } } *************** *** 666,668 **** return n; } - --- 664,665 ---- Index: cparse.h =================================================================== RCS file: /cvsroot/swig/SWIG/Source/CParse/cparse.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** cparse.h 6 Mar 2006 22:50:56 -0000 1.19 --- cparse.h 1 Nov 2006 23:54:49 -0000 1.20 *************** *** 21,74 **** /* cscanner.c */ ! extern char *cparse_file; ! extern int cparse_line; ! extern int cparse_cplusplus; ! extern int cparse_start_line; ! extern void Swig_cparse_cplusplus(int); ! extern void scanner_file(File *); ! extern void scanner_next_token(int); ! extern void skip_balanced(int startchar, int endchar); ! extern void skip_decl(void); ! extern void scanner_check_typedef(void); ! extern void scanner_ignore_typedef(void); ! extern void scanner_last_id(int); ! extern void scanner_clear_rename(void); ! extern void start_inline(char *, int); ! extern String *scanner_ccode; ! extern int yylex(); /* parser.y */ ! extern SwigType *Swig_cparse_type(String *); ! extern Node *Swig_cparse(File *); ! extern Hash *Swig_cparse_features(); ! extern void SWIG_cparse_set_compact_default_args(int defargs); ! extern int SWIG_cparse_template_reduce(int treduce); /* util.c */ ! extern void Swig_cparse_replace_descriptor(String *s); ! extern void cparse_normalize_void(Node *); ! extern Parm *Swig_cparse_parm(String *s); ! extern ParmList *Swig_cparse_parms(String *s); /* templ.c */ ! extern int Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab *tscope); ! extern Node *Swig_cparse_template_locate(String *name, ParmList *tparms, Symtab *tscope); ! extern void Swig_cparse_debug_templates(int); #ifdef __cplusplus } #endif - #define SWIG_WARN_NODE_BEGIN(Node) \ { \ String *wrnfilter = Node ? Getattr(Node,"feature:warnfilter") : 0; \ ! if (wrnfilter) Swig_warnfilter(wrnfilter,1) ! #define SWIG_WARN_NODE_END(Node) \ if (wrnfilter) Swig_warnfilter(wrnfilter,0); \ } - - #endif --- 21,70 ---- /* cscanner.c */ ! extern char *cparse_file; ! extern int cparse_line; ! extern int cparse_cplusplus; ! extern int cparse_start_line; ! extern void Swig_cparse_cplusplus(int); ! extern void scanner_file(File *); ! extern void scanner_next_token(int); ! extern void skip_balanced(int startchar, int endchar); ! extern void skip_decl(void); ! extern void scanner_check_typedef(void); ! extern void scanner_ignore_typedef(void); ! extern void scanner_last_id(int); ! extern void scanner_clear_rename(void); ! extern void start_inline(char *, int); ! extern String *scanner_ccode; ! extern int yylex(); /* parser.y */ ! extern SwigType *Swig_cparse_type(String *); ! extern Node *Swig_cparse(File *); ! extern Hash *Swig_cparse_features(); ! extern void SWIG_cparse_set_compact_default_args(int defargs); ! extern int SWIG_cparse_template_reduce(int treduce); /* util.c */ ! extern void Swig_cparse_replace_descriptor(String *s); ! extern void cparse_normalize_void(Node *); ! extern Parm *Swig_cparse_parm(String *s); ! extern ParmList *Swig_cparse_parms(String *s); /* templ.c */ ! extern int Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab *tscope); ! extern Node *Swig_cparse_template_locate(String *name, ParmList *tparms, Symtab *tscope); ! extern void Swig_cparse_debug_templates(int); #ifdef __cplusplus } #endif #define SWIG_WARN_NODE_BEGIN(Node) \ { \ String *wrnfilter = Node ? Getattr(Node,"feature:warnfilter") : 0; \ ! if (wrnfilter) Swig_warnfilter(wrnfilter,1) #define SWIG_WARN_NODE_END(Node) \ if (wrnfilter) Swig_warnfilter(wrnfilter,0); \ } #endif |