Changeset 1433ecda in mainline for uspace/lib/pcut/src/preproc.c
- Timestamp:
- 2018-04-04T15:42:37Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2c4e1cc
- Parents:
- 47b2d7e3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/pcut/src/preproc.c
r47b2d7e3 r1433ecda 36 36 static int counter = 0; 37 37 38 static void print_numbered_identifier(int value, FILE *output) { 38 static void print_numbered_identifier(int value, FILE *output) 39 { 39 40 fprintf(output, "pcut_item_%d", value); 40 41 } 41 42 42 static void print_numbered_identifier2(int value, FILE *output) { 43 static void print_numbered_identifier2(int value, FILE *output) 44 { 43 45 fprintf(output, "pcut_item2_%d", value); 44 46 } 45 47 46 static void print_numbered_identifier3(int value, FILE *output) { 48 static void print_numbered_identifier3(int value, FILE *output) 49 { 47 50 fprintf(output, "pcut_item3_%d", value); 48 51 } … … 53 56 } identifier_t; 54 57 55 static void identifier_init(identifier_t *identifier) { 58 static void identifier_init(identifier_t *identifier) 59 { 56 60 identifier->name[0] = 0; 57 61 identifier->length = 0; 58 62 } 59 63 60 static void identifier_add_char(identifier_t *identifier, char c) { 64 static void identifier_add_char(identifier_t *identifier, char c) 65 { 61 66 if (identifier->length + 1 >= MAX_IDENTIFIER_LENGTH) { 62 67 fprintf(stderr, "Identifier %s is too long, aborting!\n", identifier->name); … … 69 74 } 70 75 71 static void identifier_print_or_expand(identifier_t *identifier, FILE *output) { 76 static void identifier_print_or_expand(identifier_t *identifier, FILE *output) 77 { 72 78 const char *name = identifier->name; 73 79 if (strcmp(name, "PCUT_ITEM_NAME") == 0) { … … 86 92 } 87 93 88 static int is_identifier_char(int c, int inside_identifier) {89 return isalpha(c) || (c == '_') 90 94 static int is_identifier_char(int c, int inside_identifier) 95 { 96 return isalpha(c) || (c == '_') || (inside_identifier && isdigit(c)); 91 97 } 92 98 93 int main(int argc, char *argv[]) { 99 int main(int argc, char *argv[]) 100 { 94 101 FILE *input = stdin; 95 102 FILE *output = stdout;
Note:
See TracChangeset
for help on using the changeset viewer.