Skip to content

Commit

Permalink
as: change RISC assemblers to use generated command line parser
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalak committed May 31, 2024
1 parent 9c229db commit b157527
Show file tree
Hide file tree
Showing 5 changed files with 374 additions and 217 deletions.
22 changes: 14 additions & 8 deletions bld/as/c/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ int main( int argc, char **argv )
//*******************************
{
static char *fname;
OPT_STORAGE data;
OPT_STRING *files;
OPT_STRING *src;

#ifndef __WATCOMC__
_argv = argv;
Expand All @@ -71,24 +74,25 @@ int main( int argc, char **argv )
Usage();
} else {
PP_Init( '#', PPSPEC_AS );
if( OptionsInit( --argc, ++argv ) ) {
OPT_INIT( &data );
files = NULL;
if( OptionsInit( --argc, ++argv, &data, &files ) ) {
Banner();
if( _IsOption( PRINT_HELP ) ) {
Usage();
} else if( *argv == NULL ) {
} else if( files == NULL ) {
AsOutMessage( stderr, AS_MSG_ERROR );
AsOutMessage( stderr, NO_FILENAME_SPECIFIED );
fputc( '\n', stderr );
} else {
OptionsPPInclude();
while( *argv != NULL ) {
fname = MakeAsmFilename( *argv );
argv++;
OptionsPPInclude( &data );
for( src = files; src != NULL; src = src->next ) {
fname = MakeAsmFilename( src->data );
if( PP_FileInit( fname, PPFLAG_ASM_COMMENT | PPFLAG_EMIT_LINE | PPFLAG_TRUNCATE_FILE_NAME ) != 0 ) {
AsOutMessage( stderr, UNABLE_TO_OPEN, fname );
fputc( '\n', stderr );
} else {
OptionsPPDefine();
OptionsPPDefine( &data );
SymInit();
InsInit();
DirInit();
Expand All @@ -112,7 +116,7 @@ int main( int argc, char **argv )
DirFini();
InsFini();
SymFini();
if( *argv != NULL ) {
if( src->next != NULL ) {
PP_MacrosFini();
PP_MacrosInit();
}
Expand All @@ -121,7 +125,9 @@ int main( int argc, char **argv )
}
}
}
OPT_CLEAN_STRING( &files );
OptionsFini();
OPT_FINI( &data );
PP_Fini();
}
AsMsgFini();
Expand Down
Loading

0 comments on commit b157527

Please sign in to comment.