Trying to untangle the horrible web of file dependencies

This commit is contained in:
rheiny 2007-02-11 11:23:20 +00:00
parent 695d4aaa0e
commit e018632901
5 changed files with 91 additions and 52 deletions

View File

@ -35,57 +35,57 @@
void ParseEA(int x, int argc, char *argv[], ARGPSTRUCT *argsps) void ParseEA(int x, int argc, char *argv[], ARGPSTRUCT *argsps)
{ {
int y=0; int y=0;
do do
{ {
if(!argsps[y].name) if(!argsps[y].name)
{ {
ParseEA(x,argc,argv,(ARGPSTRUCT*)argsps[y].var); ParseEA(x,argc,argv,(ARGPSTRUCT*)argsps[y].var);
y++; y++;
continue; continue;
} }
if(!strcmp(argv[x],argsps[y].name)) // A match. if(!strcmp(argv[x],argsps[y].name)) // A match.
{ {
if(argsps[y].subs) if(argsps[y].subs)
{ {
if((x+1)>=argc) if((x+1)>=argc)
break; break;
if(argsps[y].substype&0x2000) if(argsps[y].substype&0x2000)
{ {
((void (*)(char *))argsps[y].subs)(argv[x+1]); ((void (*)(char *))argsps[y].subs)(argv[x+1]);
} }
else if(argsps[y].substype&0x8000) else if(argsps[y].substype&0x8000)
{ {
*(int *)argsps[y].subs&=~(argsps[y].substype&(~0x8000)); *(int *)argsps[y].subs&=~(argsps[y].substype&(~0x8000));
*(int *)argsps[y].subs|=atoi(argv[x+1])?(argsps[y].substype&(~0x8000)):0; *(int *)argsps[y].subs|=atoi(argv[x+1])?(argsps[y].substype&(~0x8000)):0;
} }
else else
switch(argsps[y].substype&(~0x4000)) switch(argsps[y].substype&(~0x4000))
{ {
case 0: // Integer case 0: // Integer
*(int *)argsps[y].subs=atoi(argv[x+1]); *(int *)argsps[y].subs=atoi(argv[x+1]);
break; break;
case 2: // Double float case 2: // Double float
*(double *)argsps[y].subs=atof(argv[x+1]); *(double *)argsps[y].subs=atof(argv[x+1]);
break; break;
case 1: // String case 1: // String
if(argsps[y].substype&0x4000) if(argsps[y].substype&0x4000)
{ {
if(*(char **)argsps[y].subs) if(*(char **)argsps[y].subs)
free(*(char **)argsps[y].subs); free(*(char **)argsps[y].subs);
if(!( *(char **)argsps[y].subs=(char*)malloc(strlen(argv[x+1])+1) )) if(!( *(char **)argsps[y].subs=(char*)malloc(strlen(argv[x+1])+1) ))
break; break;
} }
strcpy(*(char **)argsps[y].subs,argv[x+1]); strcpy(*(char **)argsps[y].subs,argv[x+1]);
break; break;
} }
} }
if(argsps[y].var) if(argsps[y].var)
*argsps[y].var=1; *argsps[y].var=1;
} }
y++; y++;
} while(argsps[y].var || argsps[y].subs); } while(argsps[y].var || argsps[y].subs);
} }
void ParseArguments(int argc, char *argv[], ARGPSTRUCT *argsps) void ParseArguments(int argc, char *argv[], ARGPSTRUCT *argsps)

View File

@ -18,8 +18,13 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "main.h"
#include "args.h"
#include "common.h"
#include "../common/args.h" #include "../common/args.h"
// TODO: Parsing arguments needs to be improved a lot. A LOT.
/** /**
* Parses commandline arguments * Parses commandline arguments
**/ **/

View File

@ -51,6 +51,7 @@
#include "cdlogger.h" #include "cdlogger.h"
#include "basicbot.h" #include "basicbot.h"
#include "args.h"
// #defines // #defines
@ -102,7 +103,7 @@ void ApplyDefaultCommandMapping(void);
// Internal variables // Internal variables
uint8 *xbsave = NULL; uint8 *xbsave = NULL;
int eoptions=EO_BGRUN | EO_FORCEISCALE; int eoptions = EO_BGRUN | EO_FORCEISCALE;
/** /**
* Handle of the main window. * Handle of the main window.
@ -442,7 +443,6 @@ void DoPriority(void)
#include "video.cpp" #include "video.cpp"
#include "window.cpp" #include "window.cpp"
#include "config.cpp" #include "config.cpp"
#include "args.cpp"
int DriverInitialize() int DriverInitialize()
{ {

4
src/drivers/win/main.h Normal file
View File

@ -0,0 +1,4 @@
static int genie;
static int pal_emulation;
static int status_icon;
extern int eoptions;

View File

@ -694,6 +694,32 @@
<Filter <Filter
Name="win" Name="win"
> >
<File
RelativePath="..\src\drivers\win\args.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\drivers\win\args.h"
>
</File>
<File <File
RelativePath="..\src\drivers\win\aviout.cpp" RelativePath="..\src\drivers\win\aviout.cpp"
> >
@ -854,6 +880,10 @@
RelativePath="..\src\drivers\win\main.cpp" RelativePath="..\src\drivers\win\main.cpp"
> >
</File> </File>
<File
RelativePath="..\src\drivers\win\main.h"
>
</File>
<File <File
RelativePath="..\src\drivers\win\memview.cpp" RelativePath="..\src\drivers\win\memview.cpp"
> >