int CmdScanLowerChar( // SCAN THE NEXT CHARACTER, IN LOWER CASE void ) { int ch; // - character scanned ch = CmdScanChar(); ch = tolower( ch ); return( ch ); }
bool CmdRecogEquals( // SKIP EQUALCHAR IN COMMAND LINE void ) { switch( CmdPeekChar() ) { case '=': case '#': CmdScanChar(); return( true ); break; } return( false ); }
bool CmdRecogChar( // RECOGNIZE A CHARACTER int recog ) // - character to be recognized { bool retn; // - true ==> got it if( recog == CmdScanChar() ) { retn = true; } else { CmdScanUngetChar(); retn = false; } return( retn ); }
bool CmdPathDelim( // SKIP EQUALCHAR # or ' ' IN COMMAND LINE void ) { switch( CmdPeekChar() ) { case ' ': CmdScanWhiteSpace(); CmdScanUngetChar(); return( true ); case '=': case '#': CmdScanChar(); return( true ); } return( false ); }
void AddUndefName() // SAVE A #UNDEF NAME { int len; // - length of option char const *opt; // - option char *mac_name; // - macro name CmdScanChar(); len = CmdScanId( &opt ); if( len == 0 ) { CompFlags.undefine_all_macros = true; } else { mac_name = RingNameAllocVct( &undef_names, opt, len ); MacroCmdLnUndef( mac_name, len ); } }
bool OPT_GET_ID // PARSE: ID ( OPT_STRING **p ) // - target { size_t len; char const *id; CmdRecogEquals(); CmdScanChar(); len = CmdScanId( &id ); if( len != 0 ) { addString( p, id, len ); return( TRUE ); } BadCmdLineId(); return( FALSE ); }
void CmdLnCtxInfo( // PRINT CONTEXT INFO void ) { CTX_CL* entry; // - current entry VBUF buf; // - buffer VbufInit( &buf ); for( entry = VstkTop( &cmdLnContexts ) ; entry != NULL ; entry = VstkNext( &cmdLnContexts, entry ) ) { VbufRewind( &buf ); switch( entry->base.ctx_type ) { case CTX_CLTYPE_ENV : VbufConcChr( &buf, '@' ); VbufConcStr( &buf, entry->env.var ); break; case CTX_CLTYPE_FC : VbufConcStr( &buf, "batch file of commands, line " ); VbufConcDecimal( &buf, CompInfo.fc_file_line ); break; case CTX_CLTYPE_PGM : VbufConcStr( &buf, "command line" ); break; case CTX_CLTYPE_FILE : VbufConcStr( &buf, SrcFileFullName( entry->file.source ) ); break; DbgDefault( "bad command-line context" ); } if( entry->base.sw_ptr != NULL ) { size_t size; char const * not_used; char const* old = CmdScanAddr(); CmdScanInit( entry->base.sw_ptr ); CmdScanChar(); size = CmdScanOption( ¬_used ) + 1; CmdScanInit( old ); VbufConcStr( &buf, ", switch: " ); for( old = entry->base.sw_ptr; size > 0; ++old, --size ) { VbufConcChr( &buf, *old ); } } InfMsgPtr( INF_SWITCH, VbufString( &buf ) ); } VbufFree( &buf ); }
bool OPT_GET_CHAR // PARSE: CHAR ( int *p ) // - target { int c; if( !CmdDelimitChar() ) { CmdRecogEquals(); if( !CmdDelimitChar() ) { c = CmdScanChar(); if( isprint( c ) ) { *p = c; return( TRUE ); } } } BadCmdLineChar(); return( FALSE ); }
static bool scanFBIopts // SCAN FBI/FBX OPTIONS ( FBI_KIND* a_kind // - addr[ option kinds ] , FBI_KIND def_kind ) // - default kind { bool retn; // - return: 1 ==> ok, 0 ==> error FBI_KIND kind; // - options scanned kind = 0; CmdRecogEquals(); for( ; ; ) { if( CmdScanSwEnd() || CmdPeekChar() == '-' ) { if( 0 == kind ) { kind = def_kind; } retn = TRUE; break; } switch( CmdScanChar() ) { case 'v' : kind |= FBI_VAR; continue; case 't' : kind |= FBI_TYPE; continue; case 'f' : kind |= FBI_FUN; continue; case 'm' : kind |= FBI_MEMB_DATA; continue; case 'p' : kind |= FBI_MACRO; continue; default : BadCmdLine( ERR_INVALID_OPTION ); retn = FALSE; break; } break; } *a_kind = kind; return( retn ); }
static void nextSwitch( // POSITION FOR NEXT SWITCH void ) { for( CmdScanChar(); ! CmdScanSwEnd(); CmdScanChar() ); }