Commit 7baded1e authored by dcw's avatar dcw
Browse files

added print option stuff.

parent d78291bf
...@@ -20,9 +20,10 @@ ...@@ -20,9 +20,10 @@
#include "struct.h" #include "struct.h"
#include "lexer.h" #include "lexer.h"
#include "parser.h" #include "parser.h"
#include "decs.h"
#define MUSTBE(b) ASSERT(b,("Usage: datadec [-v] outfile [infile]\n")) #define MUSTBE(b) ASSERT(b,("Usage: datadec [-vp] outfile [infile]\n"))
#define NEED_ANOTHER_ARG MUSTBE( IS_ANOTHER_ARG ) #define NEED_ANOTHER_ARG MUSTBE( IS_ANOTHER_ARG )
#define REQUIRE_NO_MORE_ARGS MUSTBE( argc == arg ) #define REQUIRE_NO_MORE_ARGS MUSTBE( argc == arg )
...@@ -33,24 +34,36 @@ main( argc, argv ) int argc; char **argv; ...@@ -33,24 +34,36 @@ main( argc, argv ) int argc; char **argv;
{ {
FILE *cfile, *hfile; FILE *cfile, *hfile;
char tempname[256]; char tempname[256];
char *basename;
char *s;
declnlist declns; declnlist declns;
int len; int len;
char *basename;
BOOL verbose;
int arg; int arg;
arg = 1; arg = 1;
NEED_ANOTHER_ARG; NEED_ANOTHER_ARG;
verbose = FALSE; verbose = FALSE; print = FALSE;
if( strcmp( argv[arg], "-v" )==0 ) while( *(s=argv[arg]) == '-' )
{ {
for( s++; *s; s++ )
{
switch( *s )
{
case 'v':
verbose = TRUE;
break;
case 'p':
print = TRUE;
break;
default:
ABORT( ("datadec: illegal option -%c\n",*s) );
}
}
arg++; arg++;
verbose = TRUE; NEED_ANOTHER_ARG;
} }
NEED_ANOTHER_ARG;
basename = argv[arg++]; basename = argv[arg++];
len = strlen( basename ); len = strlen( basename );
if( !strcmp( basename+len-2, ".c" ) ) if( !strcmp( basename+len-2, ".c" ) )
...@@ -81,7 +94,7 @@ main( argc, argv ) int argc; char **argv; ...@@ -81,7 +94,7 @@ main( argc, argv ) int argc; char **argv;
{ {
if( verbose ) if( verbose )
{ {
printf( "parsed declns: they are:\n\n" ); printf( "datadec: declns are:\n\n" );
print_declnlist( declns ); print_declnlist( declns );
} }
make_declns( declns, cfile, hfile, basename ); make_declns( declns, cfile, hfile, basename );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment