mirror of
https://github.com/holub/mame
synced 2025-05-17 11:15:06 +03:00
Support for ignoring item in lst files (no whatsnew)
This commit is contained in:
parent
df8e76c055
commit
4234c6f993
@ -44,9 +44,12 @@
|
||||
|
||||
|
||||
#define MAX_DEVICES 65536
|
||||
#define MAX_IGNORE 512
|
||||
|
||||
static const char *devlist[MAX_DEVICES];
|
||||
static int devcount;
|
||||
static const char *ignorelst[MAX_IGNORE];
|
||||
static int ignorecount;
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -61,6 +64,20 @@ int sort_callback(const void *elem1, const void *elem2)
|
||||
return strcmp(*item1, *item2);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// isignored - return info if item is in ignore
|
||||
// list or not
|
||||
//-------------------------------------------------
|
||||
|
||||
bool isignored(const char *drivname)
|
||||
{
|
||||
if (ignorecount>0) {
|
||||
for(int i=0;i<ignorecount;i++) {
|
||||
if (strcmp(ignorelst[i],drivname)==0) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// parse_file - parse a single file, may be
|
||||
@ -143,6 +160,21 @@ int parse_file(const char *srcfile)
|
||||
parse_file(filename);
|
||||
continue;
|
||||
}
|
||||
if (c == '!')
|
||||
{
|
||||
char drivname[256];
|
||||
drivname[0] = 0;
|
||||
for (int pos = 0; srcptr < endptr && pos < ARRAY_LENGTH(drivname) - 1 && !isspace(*srcptr); pos++)
|
||||
{
|
||||
drivname[pos] = *srcptr++;
|
||||
drivname[pos+1] = 0;
|
||||
}
|
||||
fprintf(stderr, "Place device '%s' to ignore list\n", drivname);
|
||||
char *name = (char *)malloc(strlen(drivname) + 1);
|
||||
strcpy(name, drivname);
|
||||
ignorelst[ignorecount++] = name;
|
||||
continue;
|
||||
}
|
||||
|
||||
// otherwise treat as a device name
|
||||
char drivname[32];
|
||||
@ -164,9 +196,12 @@ int parse_file(const char *srcfile)
|
||||
}
|
||||
|
||||
// add it to the list
|
||||
char *name = (char *)malloc(strlen(drivname) + 1);
|
||||
strcpy(name, drivname);
|
||||
devlist[devcount++] = name;
|
||||
if(!isignored(drivname))
|
||||
{
|
||||
char *name = (char *)malloc(strlen(drivname) + 1);
|
||||
strcpy(name, drivname);
|
||||
devlist[devcount++] = name;
|
||||
}
|
||||
}
|
||||
|
||||
osd_free(buffer);
|
||||
|
@ -44,9 +44,12 @@
|
||||
|
||||
|
||||
#define MAX_DRIVERS 65536
|
||||
#define MAX_IGNORE 512
|
||||
|
||||
static const char *drivlist[MAX_DRIVERS];
|
||||
static int drivcount;
|
||||
static const char *ignorelst[MAX_IGNORE];
|
||||
static int ignorecount;
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -61,6 +64,20 @@ int sort_callback(const void *elem1, const void *elem2)
|
||||
return strcmp(*item1, *item2);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// isignored - return info if item is in ignore
|
||||
// list or not
|
||||
//-------------------------------------------------
|
||||
|
||||
bool isignored(const char *drivname)
|
||||
{
|
||||
if (ignorecount>0) {
|
||||
for(int i=0;i<ignorecount;i++) {
|
||||
if (strcmp(ignorelst[i],drivname)==0) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// parse_file - parse a single file, may be
|
||||
@ -143,6 +160,21 @@ int parse_file(const char *srcfile)
|
||||
parse_file(filename);
|
||||
continue;
|
||||
}
|
||||
if (c == '!')
|
||||
{
|
||||
char drivname[256];
|
||||
drivname[0] = 0;
|
||||
for (int pos = 0; srcptr < endptr && pos < ARRAY_LENGTH(drivname) - 1 && !isspace(*srcptr); pos++)
|
||||
{
|
||||
drivname[pos] = *srcptr++;
|
||||
drivname[pos+1] = 0;
|
||||
}
|
||||
fprintf(stderr, "Place driver '%s' to ignore list\n", drivname);
|
||||
char *name = (char *)malloc(strlen(drivname) + 1);
|
||||
strcpy(name, drivname);
|
||||
ignorelst[ignorecount++] = name;
|
||||
continue;
|
||||
}
|
||||
|
||||
// otherwise treat as a driver name
|
||||
char drivname[32];
|
||||
@ -164,9 +196,12 @@ int parse_file(const char *srcfile)
|
||||
}
|
||||
|
||||
// add it to the list
|
||||
char *name = (char *)malloc(strlen(drivname) + 1);
|
||||
strcpy(name, drivname);
|
||||
drivlist[drivcount++] = name;
|
||||
if(!isignored(drivname))
|
||||
{
|
||||
char *name = (char *)malloc(strlen(drivname) + 1);
|
||||
strcpy(name, drivname);
|
||||
drivlist[drivcount++] = name;
|
||||
}
|
||||
}
|
||||
|
||||
osd_free(buffer);
|
||||
@ -196,6 +231,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// parse the root file, exit early upon failure
|
||||
drivcount = 0;
|
||||
ignorecount = 0;
|
||||
if (parse_file(srcfile))
|
||||
return 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user