Changeset 5968 for trunk/AISC_MKPTPS

Show
Ignore:
Timestamp:
30/05/09 17:13:19 (3 years ago)
Author:
westram
Message:
  • new flag -w to aisc_mkpt (add include wrapper)
  • uniform style for several include wrappers
  • removed duplicated includes
  • removed useless nt_concatenate.hxx
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/AISC_MKPTPS/mkptypes.c

    r5707 r5968  
    5656 
    5757 
    58 static int  dostatic            = 0;   /* include static functions? */ 
    59 static int  doinline            = 0;   /* include inline functions? */ 
    60 static int  donum               = 0;   /* print line numbers? */ 
    61 static int  define_macro        = 1;   /* define macro for prototypes? */ 
    62 static int  use_macro           = 1;   /* use a macro for prototypes? */ 
    63 static int  use_main            = 0;   /* add prototype for main? */ 
    64 static int  no_parm_names       = 0;   /* no parm names - only types */ 
    65 static int  print_extern        = 0;   /* use "extern" before function declarations */ 
    66 static int  dont_promote        = 0;   /* don't promote prototypes */ 
    67 static int  promote_lines       = 0;   /* promote 'AISC_MKPT_PROMOTE'-lines */ 
    68 static int  aisc                = 0;   /* aisc compatible output */ 
    69 static int  cansibycplus        = 0;   /* produce extern "C" */ 
    70 static int  promote_extern_c    = 0;   /* produce extern "C" into prototype */ 
    71 static int  extern_c_seen       = 0;   /* true if extern "C" was parsed */ 
    72 static int  search__attribute__ = 0;   /* search for gnu-extension __attribute__(()) ? */ 
    73 static int  search__ATTR__      = 0;   /* search for ARB-__attribute__-macros (__ATTR__) ? */ 
    74 static int  inquote             = 0;   /* in a quote?? */ 
    75 static int  newline_seen        = 1;   /* are we at the start of a line */ 
    76 static int  glastc              = ' '; /* last char. seen by getsym() */ 
     58static int dostatic            = 0;                 /* include static functions? */ 
     59static int doinline            = 0;                 /* include inline functions? */ 
     60static int donum               = 0;                 /* print line numbers? */ 
     61static int define_macro        = 1;                 /* define macro for prototypes? */ 
     62static int use_macro           = 1;                 /* use a macro for prototypes? */ 
     63static int use_main            = 0;                 /* add prototype for main? */ 
     64static int no_parm_names       = 0;                 /* no parm names - only types */ 
     65static int print_extern        = 0;                 /* use "extern" before function declarations */ 
     66static int dont_promote        = 0;                 /* don't promote prototypes */ 
     67static int promote_lines       = 0;                 /* promote 'AISC_MKPT_PROMOTE'-lines */ 
     68static int aisc                = 0;                 /* aisc compatible output */ 
     69static int cansibycplus        = 0;                 /* produce extern "C" */ 
     70static int promote_extern_c    = 0;                 /* produce extern "C" into prototype */ 
     71static int extern_c_seen       = 0;                 /* true if extern "C" was parsed */ 
     72static int search__attribute__ = 0;                 /* search for gnu-extension __attribute__(()) ? */ 
     73static int search__ATTR__      = 0;                 /* search for ARB-__attribute__-macros (__ATTR__) ? */ 
     74 
     75static const char *include_wrapper = NULL;             /* add include wrapper (contains name of header or NULL) */ 
     76 
     77static int inquote      = 0;                        /* in a quote?? */ 
     78static int newline_seen = 1;                        /* are we at the start of a line */ 
     79static int glastc       = ' ';                      /* last char. seen by getsym() */ 
    7780 
    7881static char *current_file   = 0;  /* name of current file */ 
     
    12661269          "\n   -P               promote /*AISC_MKPT_PROMOTE:forHeader*/ to header" 
    12671270          "\n" 
     1271          "\n   -w               add standard include wrapper" 
     1272          "\n" 
    12681273          "\n   -c \"text\"      add text as comment into header" 
    12691274          "\n" 
     
    13231328                break; 
    13241329            } 
     1330            else if (*t == 'w') { 
     1331                t = *argv++; --argc; 
     1332                if (!t) Usage(); 
     1333                include_wrapper = t; 
     1334                break; 
     1335            } 
    13251336            else if (*t == 'F') { 
    13261337                t = *argv++; --argc; 
     
    13471358    } 
    13481359 
     1360    char *include_macro = 0; 
    13491361    if (aisc) { 
    13501362        if (header_comment) { 
     
    13661378              " *\n" 
    13671379              " */\n\n", stdout); 
     1380 
     1381        if (include_wrapper) { 
     1382            int p; 
     1383            include_macro = strdup(include_wrapper); 
     1384            for (p = 0; include_macro[p]; p++) { 
     1385                char c           = include_macro[p]; 
     1386                c                = strchr(".-", c) ? '_' : toupper(c); 
     1387                include_macro[p] = c; 
     1388            } 
     1389 
     1390            printf("#ifndef %s\n" 
     1391                   "#define %s\n" 
     1392                   "\n",  
     1393                   include_macro,  
     1394                   include_macro); 
     1395        } 
    13681396 
    13691397        if (use_macro) { 
     
    14491477            printf("\n#undef %s\n", macro_name);    /* clean up namespace */ 
    14501478        } 
    1451     } 
    1452  
     1479 
     1480        if (include_wrapper) { 
     1481            printf("\n" 
     1482                   "#else\n" 
     1483                   "#error %s included twice\n" 
     1484                   "#endif /* %s */\n", 
     1485                   include_wrapper, 
     1486                   include_macro); 
     1487        } 
     1488    } 
     1489 
     1490    free(include_macro); 
    14531491    freeSymParts(); 
    14541492    free(current_file);