Exemple #1
0
int CmdScanLowerChar(           // SCAN THE NEXT CHARACTER, IN LOWER CASE
    void )
{
    int ch;                     // - character scanned

    ch = CmdScanChar();
    ch = tolower( ch );
    return( ch );
}
Exemple #2
0
bool CmdRecogEquals(            // SKIP EQUALCHAR IN COMMAND LINE
    void )
{
    switch( CmdPeekChar() ) {
    case '=':
    case '#':
        CmdScanChar();
        return( true );
        break;
    }
    return( false );
}
Exemple #3
0
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 );
}
Exemple #4
0
bool CmdPathDelim(              // SKIP EQUALCHAR # or ' ' IN COMMAND LINE
    void )
{
    switch( CmdPeekChar() ) {
    case ' ':
        CmdScanWhiteSpace();
        CmdScanUngetChar();
        return( true );
    case '=':
    case '#':
        CmdScanChar();
        return( true );
    }
    return( false );
}
Exemple #5
0
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 );
    }
}
Exemple #6
0
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 );
}
Exemple #7
0
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( &not_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 );
}
Exemple #8
0
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 );
}
Exemple #9
0
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 );
}
Exemple #10
0
static void nextSwitch(         // POSITION FOR NEXT SWITCH
    void )
{
    for( CmdScanChar(); ! CmdScanSwEnd(); CmdScanChar() );
}