src/build/makelist.c
| r13423 | r13424 | |
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 | #define MAX_DRIVERS 65536 |
| 47 | #define MAX_IGNORE 512 |
| 47 | 48 | |
| 48 | 49 | static const char *drivlist[MAX_DRIVERS]; |
| 49 | 50 | static int drivcount; |
| 51 | static const char *ignorelst[MAX_IGNORE]; |
| 52 | static int ignorecount; |
| 50 | 53 | |
| 51 | 54 | |
| 52 | 55 | //------------------------------------------------- |
| r13423 | r13424 | |
| 61 | 64 | return strcmp(*item1, *item2); |
| 62 | 65 | } |
| 63 | 66 | |
| 67 | //------------------------------------------------- |
| 68 | // isignored - return info if item is in ignore |
| 69 | // list or not |
| 70 | //------------------------------------------------- |
| 64 | 71 | |
| 72 | bool isignored(const char *drivname) |
| 73 | { |
| 74 | if (ignorecount>0) { |
| 75 | for(int i=0;i<ignorecount;i++) { |
| 76 | if (strcmp(ignorelst[i],drivname)==0) return true; |
| 77 | } |
| 78 | } |
| 79 | return false; |
| 80 | } |
| 81 | |
| 65 | 82 | //------------------------------------------------- |
| 66 | 83 | // parse_file - parse a single file, may be |
| 67 | 84 | // called recursively |
| r13423 | r13424 | |
| 143 | 160 | parse_file(filename); |
| 144 | 161 | continue; |
| 145 | 162 | } |
| 163 | if (c == '!') |
| 164 | { |
| 165 | char drivname[256]; |
| 166 | drivname[0] = 0; |
| 167 | for (int pos = 0; srcptr < endptr && pos < ARRAY_LENGTH(drivname) - 1 && !isspace(*srcptr); pos++) |
| 168 | { |
| 169 | drivname[pos] = *srcptr++; |
| 170 | drivname[pos+1] = 0; |
| 171 | } |
| 172 | fprintf(stderr, "Place driver '%s' to ignore list\n", drivname); |
| 173 | char *name = (char *)malloc(strlen(drivname) + 1); |
| 174 | strcpy(name, drivname); |
| 175 | ignorelst[ignorecount++] = name; |
| 176 | continue; |
| 177 | } |
| 146 | 178 | |
| 147 | 179 | // otherwise treat as a driver name |
| 148 | 180 | char drivname[32]; |
| r13423 | r13424 | |
| 164 | 196 | } |
| 165 | 197 | |
| 166 | 198 | // add it to the list |
| 167 | | char *name = (char *)malloc(strlen(drivname) + 1); |
| 168 | | strcpy(name, drivname); |
| 169 | | drivlist[drivcount++] = name; |
| 199 | if(!isignored(drivname)) |
| 200 | { |
| 201 | char *name = (char *)malloc(strlen(drivname) + 1); |
| 202 | strcpy(name, drivname); |
| 203 | drivlist[drivcount++] = name; |
| 204 | } |
| 170 | 205 | } |
| 171 | 206 | |
| 172 | 207 | osd_free(buffer); |
| r13423 | r13424 | |
| 196 | 231 | |
| 197 | 232 | // parse the root file, exit early upon failure |
| 198 | 233 | drivcount = 0; |
| 234 | ignorecount = 0; |
| 199 | 235 | if (parse_file(srcfile)) |
| 200 | 236 | return 1; |
| 201 | 237 | |
src/build/makedev.c
| r13423 | r13424 | |
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 | #define MAX_DEVICES 65536 |
| 47 | #define MAX_IGNORE 512 |
| 47 | 48 | |
| 48 | 49 | static const char *devlist[MAX_DEVICES]; |
| 49 | 50 | static int devcount; |
| 51 | static const char *ignorelst[MAX_IGNORE]; |
| 52 | static int ignorecount; |
| 50 | 53 | |
| 51 | 54 | |
| 52 | 55 | //------------------------------------------------- |
| r13423 | r13424 | |
| 61 | 64 | return strcmp(*item1, *item2); |
| 62 | 65 | } |
| 63 | 66 | |
| 67 | //------------------------------------------------- |
| 68 | // isignored - return info if item is in ignore |
| 69 | // list or not |
| 70 | //------------------------------------------------- |
| 64 | 71 | |
| 72 | bool isignored(const char *drivname) |
| 73 | { |
| 74 | if (ignorecount>0) { |
| 75 | for(int i=0;i<ignorecount;i++) { |
| 76 | if (strcmp(ignorelst[i],drivname)==0) return true; |
| 77 | } |
| 78 | } |
| 79 | return false; |
| 80 | } |
| 81 | |
| 65 | 82 | //------------------------------------------------- |
| 66 | 83 | // parse_file - parse a single file, may be |
| 67 | 84 | // called recursively |
| r13423 | r13424 | |
| 143 | 160 | parse_file(filename); |
| 144 | 161 | continue; |
| 145 | 162 | } |
| 163 | if (c == '!') |
| 164 | { |
| 165 | char drivname[256]; |
| 166 | drivname[0] = 0; |
| 167 | for (int pos = 0; srcptr < endptr && pos < ARRAY_LENGTH(drivname) - 1 && !isspace(*srcptr); pos++) |
| 168 | { |
| 169 | drivname[pos] = *srcptr++; |
| 170 | drivname[pos+1] = 0; |
| 171 | } |
| 172 | fprintf(stderr, "Place device '%s' to ignore list\n", drivname); |
| 173 | char *name = (char *)malloc(strlen(drivname) + 1); |
| 174 | strcpy(name, drivname); |
| 175 | ignorelst[ignorecount++] = name; |
| 176 | continue; |
| 177 | } |
| 146 | 178 | |
| 147 | 179 | // otherwise treat as a device name |
| 148 | 180 | char drivname[32]; |
| r13423 | r13424 | |
| 164 | 196 | } |
| 165 | 197 | |
| 166 | 198 | // add it to the list |
| 167 | | char *name = (char *)malloc(strlen(drivname) + 1); |
| 168 | | strcpy(name, drivname); |
| 169 | | devlist[devcount++] = name; |
| 199 | if(!isignored(drivname)) |
| 200 | { |
| 201 | char *name = (char *)malloc(strlen(drivname) + 1); |
| 202 | strcpy(name, drivname); |
| 203 | devlist[devcount++] = name; |
| 204 | } |
| 170 | 205 | } |
| 171 | 206 | |
| 172 | 207 | osd_free(buffer); |