Ignore:
Timestamp:
Feb 21, 2020, 3:36:36 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
c7a900a
Parents:
8c50aed (diff), c744563a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into park_unpark

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/prelude/prototypes.awk

    r8c50aed ra505021  
    1010# Created On       : Sat May 16 07:57:37 2015
    1111# Last Modified By : Peter A. Buhr
    12 # Last Modified On : Thu Jun  6 20:46:28 2019
    13 # Update Count     : 34
     12# Last Modified On : Sat Feb  8 09:46:58 2020
     13# Update Count     : 36
    1414#
    1515
     
    1717
    1818BEGIN {
    19   FS = "[( )]"
     19        FS = "[( )]"
    2020        # order so string search is longest string
    2121        i=-1
     
    8484
    8585/BT_FN/ {
    86         for (i = 1; i <= NF; i++) {
    87           if( match($i, "BT_FN") != 0 ) {
    88                 prototypes[$i] = $i
    89           }
     86        for (i = 1; i <= NF; i += 1 ) {
     87                if ( match($i, "BT_FN") != 0 ) {
     88                        prototypes[$i] = $i
     89                }
    9090        }
    91   }
     91}
    9292
    9393END {
     
    103103
    104104        for ( prototype in prototypes ) {
    105           # printf( "//\"%s\"\n", prototype )
    106           if ( index( "BT_LAST", prototype ) == 1 ) {
    107                 continue
    108           } # if
     105                # printf( "//\"%s\"\n", prototype )
     106                if ( index( "BT_LAST", prototype ) == 1 ) {
     107                        continue
     108                } # if
    109109
    110           printf( "#define %s(NAME) FUNC_SIMPLE(", prototype )
     110                printf( "#define %s(NAME) FUNC_SIMPLE(", prototype )
    111111
    112           if ( sub( "BT_FN_", "", prototype ) == 0 ) {
    113                 printf( "\n********** BAD MACRO NAME \"%s\" **********\n", prototype )
    114                 exit 0
    115           } # if
     112                if ( sub( "BT_FN_", "", prototype ) == 0 ) {
     113                        printf( "\n********** BAD MACRO NAME \"%s\" **********\n", prototype )
     114                        exit 0
     115                } # if
    116116
    117           # generate function return type as macro
    118           for ( t = 0; t < N; t += 1 ) {                                        # find longest match
    119                 type = types[t];
    120                 if ( index( prototype, type ) == 1 ) {          # found match
    121                   printf( "BT_%s, NAME", type )
    122                   sub( type, "", prototype )
    123                   break;
     117                # generate function return type as macro
     118                for ( t = 0; t < N; t += 1 ) {                                  # find longest match
     119                        type = types[t];
     120                        if ( index( prototype, type ) == 1 ) {          # found match
     121                                printf( "BT_%s, NAME", type )
     122                                sub( type, "", prototype )
     123                                break;
     124                        } # if
     125                } # for
     126
     127                # generate function parameter types as macro
     128                if ( index( prototype, "VAR" ) != 2 ) {                 # C-style empty parameters ?
     129                        for ( p = 0; length( prototype ) > 0; p += 1 ) { # until all parameters types are removed
     130                                sub( "_", "", prototype)                                # remove "_"
     131                                printf( ", ", type )
     132                                temp = prototype
     133                                for ( t = 0; t < N; t += 1 ) {                  # find longest match
     134                                        type = types[t];
     135                                        if ( index( prototype, type ) == 1 ) { # found match
     136                                                printf( "BT_%s", type )
     137                                                sub( type, "", prototype )
     138                                                break;
     139                                        } # if
     140                                } # for
     141                                if ( temp == prototype ) {                              # no match found for parameter in macro table
     142                                        printf( "\n********** MISSING TYPE \"%s\" **********\n", prototype )
     143                                        exit 0
     144                                } # if
     145                        } # for
    124146                } # if
    125           } # for
    126 
    127           # generate function parameter types as macro
    128           if ( index( prototype, "VAR" ) != 2 ) {                       # C-style empty parameters ?
    129                 for ( p = 0; length( prototype ) > 0; p += 1 ) { # until all parameters types are removed
    130                   sub( "_", "", prototype)                              # remove "_"
    131                   printf( ", ", type )
    132                   temp = prototype
    133                   for ( t = 0; t < N; t += 1 ) {                        # find longest match
    134                         type = types[t];
    135                         if ( index( prototype, type ) == 1 ) { # found match
    136                           printf( "BT_%s", type )
    137                           sub( type, "", prototype )
    138                           break;
    139                         } # if
    140                   } # for
    141                   if ( temp == prototype ) {                            # no match found for parameter in macro table
    142                         printf( "\n********** MISSING TYPE \"%s\" **********\n", prototype )
    143                         exit 0
    144                   } # if
    145                 } # for
    146           } # if
    147           printf( ")\n" )
     147                printf( ")\n" )
    148148        } # for
    149149
Note: See TracChangeset for help on using the changeset viewer.