Changeset ad8e062


Ignore:
Timestamp:
Jan 25, 2015, 11:41:35 AM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
643a2e1
Parents:
9df2dd5
Message:

deal with newer built

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/prototypes.awk

    r9df2dd5 rad8e062  
    11BEGIN {
    22    FS = "("
     3    # order so string search is longest string
    34    types[0]  = "UINTMAX";                      vtypes[0]  = "unsigned long int"
    45    types[1]  = "UINT16";                       vtypes[1]  = "short int"
     
    4647    types[43] = "PID";                          vtypes[43] = "int"
    4748    N = 44
    48 }
     49} # BEGIN
    4950
    5051/^BT_/ { prototypes[$1] = $1 }
     
    5556    printf( "#define BT_LAST(NAME) FUNC_SIMPLE(void, NAME)\n\n" );
    5657
     58    # generate C types for macros names
    5759    for ( i = 0; i < N; i += 1 ) {
    5860        printf( "#define BT_%s %s\n", types[i], vtypes[i] )
    59     }
     61    } # for
    6062    printf( "\n" )
    6163
     
    6365        if ( index( "BT_LAST", prototype ) == 1 ) {
    6466            continue
    65         }
     67        } # if
     68
     69        if ( sub( "BT_FN_", "", prototype ) == 0 ) {
     70            if ( sub( "BT_", "", prototype ) == 0 ) {
     71                printf( "\n********** BAD MACRO NAME \"%s\" **********\n", prototype )
     72                exit 0
     73            } #if
     74        } # if
     75
    6676        printf( "#define %s(NAME) FUNC_SIMPLE(", prototype )
    67            
    68         if ( sub( "BT_FN_", "", prototype) == 0 )
    69             if ( sub( "BT_", "", prototype) == 0 ) {
    70                 printf( "\n********** BAD MACRO NAME **********\n" )
    71                 exit 0
    72             }
    73         for ( t = 0; t < N; t += 1 ) {
     77
     78        # generate function return type as macro
     79        for ( t = 0; t < N; t += 1 ) {                  # find longest match
    7480            type = types[t];
    75             if ( index( prototype, type ) == 1 ) {
     81            if ( index( prototype, type ) == 1 ) {      # found match
    7682                printf( "BT_%s, NAME", type )
    77                 sub( type, "", prototype)
     83                sub( type, "", prototype )
    7884                break;
    79             }
    80         }
    81         if ( index( prototype, "VAR" ) != 2 ) {
    82             for ( p = 0; length( prototype ) > 0; p += 1 ) {
    83                 sub( "_", "", prototype)
     85            } # if
     86        } # for
     87
     88        # generate function parameter types as macro
     89        if ( index( prototype, "VAR" ) != 2 ) {         # C-style empty parameters ?
     90            for ( p = 0; length( prototype ) > 0; p += 1 ) { # until all parameters types are removed
     91                sub( "_", "", prototype)                # remove "_"
    8492                printf( ", ", type )
    8593                temp = prototype
    86                 for ( t = 0; t < N; t += 1 ) {
     94                for ( t = 0; t < N; t += 1 ) {          # find longest match
    8795                    type = types[t];
    88                     if ( index( prototype, type ) == 1 ) {
     96                    if ( index( prototype, type ) == 1 ) { # found match
    8997                        printf( "BT_%s", type )
    90                         sub( type, "", prototype)
     98                        sub( type, "", prototype )
    9199                        break;
    92100                    } # if
    93101                } # for
    94                 if ( temp == prototype ) {
    95                     printf( "\n********** MISSING TYPE **********\n" )
     102                if ( temp == prototype ) {              # no match found for parameter in macro table
     103                    printf( "\n********** MISSING TYPE \"%s\" **********\n", prototype )
    96104                    exit 0
    97105                } # if
     
    99107        } # if
    100108        printf( ")\n" )
    101     }
     109    } # for
    102110
     111    # extras
    103112    printf( "\n#include \"builtins.def\"\n\n" );
    104113    printf( "typedef void ** __builtin_va_list;\n" );
    105114    printf( "extern const char *__PRETTY_FUNCTION__;\n" );
    106115    printf( "typedef int wchar_t;\n" );
    107 }
     116} # END
Note: See TracChangeset for help on using the changeset viewer.