Beispiel #1
0
static void GetRetInfo( void )
/***************************/
{
    struct {
        bool    f_no8087    : 1;
        bool    f_list      : 1;
        bool    f_struct    : 1;
    } have;

    have.f_no8087 = false;
    have.f_list = false;
    have.f_struct = false;
    AuxInfo.cclass &= ~ NO_8087_RETURNS;
    AuxInfoFlg.f_8087_returns = true;
    for( ;; ) {
        if( !have.f_no8087 && PragRecog( "no8087" ) ) {
            have.f_no8087 = true;
            HW_CTurnOff( AuxInfo.returns, HW_FLTS );
            AuxInfo.cclass |= NO_8087_RETURNS;
        } else if( !have.f_list && PragRegSet() != T_NULL ) {
            have.f_list = true;
            AuxInfo.cclass |= SPECIAL_RETURN;
            AuxInfo.returns = PragRegList();
        } else if( !have.f_struct && PragRecog( "struct" ) ) {
            have.f_struct = true;
            GetSTRetInfo();
        } else {
            break;
        }
    }
}
Beispiel #2
0
static void GetRetInfo(
    void )
{
    struct {
        unsigned f_no8087        : 1;
        unsigned f_list          : 1;
        unsigned f_struct        : 1;
    } have;

    have.f_no8087  = 0;
    have.f_list    = 0;
    have.f_struct  = 0;
    CurrInfo->cclass &= ~ NO_8087_RETURNS;
    for( ;; ) {
        if( !have.f_no8087 && PragRecog( "no8087" ) ) {
            have.f_no8087 = 1;
            HW_CTurnOff( CurrInfo->returns, HW_FLTS );
            CurrInfo->cclass |= NO_8087_RETURNS;
        } else if( !have.f_list && IS_REGSET( CurToken ) ) {
            have.f_list = 1;
            CurrInfo->cclass |= SPECIAL_RETURN;
            CurrInfo->returns = PragRegList();
        } else if( !have.f_struct && PragRecog( "struct" ) ) {
            have.f_struct = 1;
            GetSTRetInfo();
        } else {
            break;
        }
    }
}
Beispiel #3
0
local void GetSaveInfo( void )
/****************************/
{
    struct {
        unsigned    f_exact     : 1;
        unsigned    f_nomemory  : 1;
        unsigned    f_list      : 1;
    } have;

    have.f_exact    = 0;
    have.f_nomemory = 0;
    have.f_list     = 0;
    for( ;; ) {
        if( !have.f_exact && PragRecog( "exact" ) ) {
            AuxInfo.cclass |= MODIFY_EXACT;
            have.f_exact = 1;
        } else if( !have.f_nomemory && PragRecog( "nomemory" ) ) {
            AuxInfo.cclass |= NO_MEMORY_CHANGED;
            have.f_nomemory = 1;
        } else if( !have.f_list && PragRegSet() != T_NULL ) {
            HW_TurnOn( AuxInfo.save, PragRegList() );
            have.f_list = 1;
        } else {
            break;
        }
    }
}
Beispiel #4
0
local void GetRetInfo( void )
/***************************/
{
    struct {
        unsigned f_no8087        : 1;
        unsigned f_list          : 1;
        unsigned f_struct        : 1;
    } have;

    have.f_no8087  = 0;
    have.f_list    = 0;
    have.f_struct  = 0;
    AuxInfo.cclass &= ~ NO_8087_RETURNS;               /* 29-mar-90 */
    AuxInfoFlg.f_8087_returns = 1;
    for( ;; ) {
        if( !have.f_no8087 && PragRecog( "no8087" ) ) {
            have.f_no8087 = 1;
            HW_CTurnOff( AuxInfo.returns, HW_FLTS );
            AuxInfo.cclass |= NO_8087_RETURNS;
        } else if( !have.f_list && PragRegSet() != T_NULL ) {
            have.f_list = 1;
            AuxInfo.cclass |= SPECIAL_RETURN;
            AuxInfo.returns = PragRegList();
        } else if( !have.f_struct && PragRecog( "struct" ) ) {
            have.f_struct = 1;
            GetSTRetInfo();
        } else {
            break;
        }
    }
}
Beispiel #5
0
local void PragSTDCOption( void )
/*******************************/
{
    if( PragRecog( "ON" ) ) {
    } else if( PragRecog( "OFF" ) ) {
    } else if( PragRecog( "DEFAULT" ) ) {
    }
}
Beispiel #6
0
// form:
// #pragma STDC (FP_CONTRACT|FENV_ACCESS|CX_LIMITED_RANGE) (ON|OFF|DEFAULT)
//
static void PragSTDC( void )
/**************************/
{
    if( PragRecog( "FP_CONTRACT" ) ) {
        PragSTDCOption();
    } else if( PragRecog( "FENV_ACCESS" ) ) {
        PragSTDCOption();
    } else if( PragRecog( "CX_LIMITED_RANGE" ) ) {
        PragSTDCOption();
    }
}
Beispiel #7
0
local fix_words FixupKeyword( void )
/**********************************/
{
    if( CurToken == T_FLOAT ) {
        NextToken();                    /* 20-jun-92 */
        return( FIXWORD_FLOAT );
    }
    if( PragRecog( "seg" ) )    return( FIXWORD_SEGMENT );
    if( PragRecog( "offset" ) ) return( FIXWORD_OFFSET );
    if( PragRecog( "reloff" ) ) return( FIXWORD_RELOFF );
    return( FIXWORD_NONE );
}
Beispiel #8
0
static DT_METHOD parseDtorMethod( // PARSE A DESTRUCTOR METHOD
    void )
{
    DT_METHOD method;           // - method specified

    if( PragRecog( "direct" ) ) {
        method = DTM_DIRECT;
    } else if( PragRecog( "small" ) ) {
        method = DTM_TABLE_SMALL;
    } else if( PragRecog( "table" ) ) {
        method = DTM_TABLE;
    } else {
        method = DTM_COUNT;
    }
    return method;
}
Beispiel #9
0
static void PragEnum( void )    // #pragma enum PARSING
/**************************/
{
    if( PragRecog( "int" ) ) {
        PushEnum();
        CompFlags.make_enums_an_int = 1;
    } else if( PragRecog( "minimum" ) ) {
        PushEnum();
        CompFlags.make_enums_an_int = 0;
    } else if( PragRecog( "original" ) ) {
        PushEnum();
        CompFlags.make_enums_an_int = CompFlags.original_enum_setting;
    } else if( PragRecog( "pop" ) ) {
        PopEnum();
    }
}
Beispiel #10
0
static void GetSaveInfo(
    void )
{
    hw_reg_set      modlist;
    hw_reg_set      default_flt_n_seg;
    hw_reg_set      flt_n_seg;

    struct {
        unsigned f_exact        : 1;
        unsigned f_nomemory     : 1;
        unsigned f_list         : 1;
    } have;

    have.f_exact    = 0;
    have.f_nomemory = 0;
    have.f_list     = 0;
    for( ;; ) {
        if( !have.f_exact && PragRecog( "exact" ) ) {
            CurrInfo->cclass |= MODIFY_EXACT;
            have.f_exact = 1;
        } else if( !have.f_nomemory && PragRecog( "nomemory" ) ) {
            CurrInfo->cclass |= NO_MEMORY_CHANGED;
            have.f_nomemory = 1;
        } else if( !have.f_list && IS_REGSET( CurToken ) ) {
            modlist = PragRegList();
            have.f_list = 1;
        } else {
            break;
        }
    }
    if( have.f_list ) {
        HW_Asgn( default_flt_n_seg, DefaultInfo.save );
        HW_CTurnOn( CurrInfo->save, HW_FULL );
        if( !have.f_exact && !CompFlags.save_restore_segregs ) {
            HW_CAsgn( flt_n_seg, HW_FLTS );
            HW_CTurnOn( flt_n_seg, HW_SEGS );
            HW_TurnOff( CurrInfo->save, flt_n_seg );
            HW_OnlyOn( default_flt_n_seg, flt_n_seg );
            HW_TurnOn( CurrInfo->save, default_flt_n_seg );
        }
        HW_TurnOff( CurrInfo->save, modlist );
    }
}
Beispiel #11
0
// forms: #pragma init_seg({compiler|lib|user})
//
//      - compiler (16)
//      - library (32)
//      - user (64)
//
static void pragInitSeg(     // #pragma init_seg ...
    void )
{
    int priority;

    if( ExpectingToken( T_LEFT_PAREN ) ) {
        NextToken();
        if( PragRecog( "compiler" ) ) {
            priority = INIT_PRIORITY_LIBRARY - 1;
        } else if( PragRecog( "lib" ) ) {
            priority = INIT_PRIORITY_LIBRARY;
        } else {
            priority = INIT_PRIORITY_PROGRAM;
            MustRecog( T_ID );
        }
        CompInfo.init_priority = priority;
        MustRecog( T_RIGHT_PAREN );
    }
}
Beispiel #12
0
static fix_words FixupKeyword(
    void )
{
    fix_words retn;             // - return

    if( CurToken == T_FLOAT ) {
        NextToken();
        retn = FIXWORD_FLOAT;
    } else if( PragRecog( "seg" ) ) {
        retn = FIXWORD_SEGMENT;
    } else if( PragRecog( "offset" ) ) {
        retn = FIXWORD_OFFSET;
    } else if( PragRecog( "reloff" ) ) {
        retn = FIXWORD_RELOFF;
    } else {
        retn = FIXWORD_NONE;
    }
    return( retn );
}
Beispiel #13
0
// forms: (1) #pragma enum int
//        (2) #pragma enum minimum
//        (3) #pragma enum original
//        (4) #pragma enum pop
//
// The pragma affects the underlying storage-definition for subsequent
// enum declarations.
//
// (1) make int the underlying storage definition (same as -ei)
// (2) minimize the underlying storage definition (same as no -ei)
// (3) reset back to result of command-line parsing
// (4) restore previous value
//
// 1-3 all push previous value before affecting value
//
static void pragEnum            // #pragma enum PARSING
    ( void )
{
    unsigned make_enums_an_int;

    if( PragRecog( "int" ) ) {
        pushPrag( &HeadEnums, CompFlags.make_enums_an_int );
        CompFlags.make_enums_an_int = 1;
    } else if( PragRecog( "minimum" ) ) {
        pushPrag( &HeadEnums, CompFlags.make_enums_an_int );
        CompFlags.make_enums_an_int = 0;
    } else if( PragRecog( "original" ) ) {
        pushPrag( &HeadEnums, CompFlags.make_enums_an_int );
        CompFlags.make_enums_an_int = CompFlags.original_enum_setting;
    } else if( PragRecog( "pop" ) ) {
        if( popPrag( &HeadEnums, &make_enums_an_int ) ) {
            CompFlags.make_enums_an_int = make_enums_an_int;
        }
    }
}
Beispiel #14
0
local void GetParmInfo( void )
/****************************/
{
    struct {
        unsigned f_pop           : 1;
        unsigned f_reverse       : 1;
        unsigned f_loadds        : 1;
        unsigned f_nomemory      : 1;
        unsigned f_list          : 1;
    } have;

    have.f_pop           = 0;
    have.f_reverse       = 0;
    have.f_loadds        = 0;
    have.f_nomemory      = 0;
    have.f_list          = 0;
    for( ;; ) {
        if( !have.f_pop && PragRecog( "caller" ) ) {
            AuxInfo.cclass |= CALLER_POPS;
            have.f_pop = 1;
        } else if( !have.f_pop && PragRecog( "routine" ) ) {
            AuxInfo.cclass &= ~ CALLER_POPS;
            AuxInfoFlg.f_routine_pops = 1;
            have.f_pop = 1;
        } else if( !have.f_reverse && PragRecog( "reverse" ) ) {
            AuxInfo.cclass |= REVERSE_PARMS;
            have.f_reverse = 1;
        } else if( !have.f_nomemory && PragRecog( "nomemory" ) ) {
            AuxInfo.cclass |= NO_MEMORY_READ;
            have.f_nomemory = 1;
        } else if( !have.f_loadds && PragRecog( "loadds" ) ) {
            AuxInfo.cclass |= LOAD_DS_ON_CALL;
            have.f_loadds = 1;
        } else if( !have.f_list && PragRegSet() != T_NULL ) {
            AuxInfo.parms = PragManyRegSets();
            have.f_list = 1;
        } else {
            break;
        }
    }
}
Beispiel #15
0
// forms: #pragma initialize [before/after]* priority
//
//  where priority is:
//      - number 0 - 255
//      - library (32)
//      - program (64)
//
// The pragma is used to set the initialize priority for the module ( when
// it occurs at file scope) or to specify an initialization function to
// be called (when it occurs within a function).
//
// The function must be previously declared to have no parameters and to
// be static.
//
static void pragInitialize(     // #pragma initialize ...
    void )
{
    int adjust;                 // - before/after adjustment
    unsigned priority;          // - initialization priority
    unsigned test;

    adjust = 0;
    for( ; ; ) {
        /* allow "before before library" */
        if( PragRecog( "after" ) ) {
            ++adjust;
        } else if( PragRecog( "before" ) ) {
            --adjust;
        } else {
            break;
        }
    }
    priority = INIT_PRIORITY_PROGRAM;
    if( CurToken == T_CONSTANT ) {
        test = U32Fetch( Constant64 );
        if( test <= 255 ) {
            priority = test;
        } else {
            CErr1( ERR_PRAG_INITIALIZE_PRIORITY );
        }
    } else if( PragRecog( "library" ) ) {
        priority = INIT_PRIORITY_LIBRARY;
    } else if( PragRecog( "program" ) ) {
        priority = INIT_PRIORITY_PROGRAM;
    } else {
        CErr1( ERR_PRAG_INITIALIZE_PRIORITY );
    }
    NextToken();
    priority += adjust;
    if( priority > 255 ) {
        CErr1( ERR_PRAG_INITIALIZE_PRIORITY );
        priority = INIT_PRIORITY_PROGRAM;
    }
    CompInfo.init_priority = priority;
}
Beispiel #16
0
// #pragma inline_recursion on
// #pragma inline_recursion off
// #pragma inline_recursion(on)         -- MS compatible
// #pragma inline_recursion(off)        -- MS compatible
//
// Used to indicate whether recursive inlining is permitted or not
//
static void pragInlineRecursion( // PROCESS #pragma inline_recusrion
    void )
{
    if( PragRecog( "on" ) ) {
        CgBackSetInlineRecursion( true );
    } else if( PragRecog( "off" ) ) {
        CgBackSetInlineRecursion( false );
    } else {
        if( CurToken == T_LEFT_PAREN ) {
            NextToken();
            if( PragRecog( "on" ) ) {
                CgBackSetInlineRecursion( true );
            } else if( PragRecog( "off" ) ) {
                CgBackSetInlineRecursion( false );
            } else {
                MustRecog( T_ID );
            }
            MustRecog( T_RIGHT_PAREN );
        }
    }
}
Beispiel #17
0
static void GetParmInfo(
    void )
    {
    struct {
        unsigned f_pop           : 1;
        unsigned f_reverse       : 1;
        unsigned f_loadds        : 1;
        unsigned f_nomemory      : 1;
        unsigned f_list          : 1;
    } have;

    have.f_pop           = 0;
    have.f_reverse       = 0;
    have.f_loadds        = 0;
    have.f_nomemory      = 0;
    have.f_list          = 0;
    for( ;; ) {
        if( !have.f_pop && PragRecog( "caller" ) ) {
            CurrInfo->cclass |= CALLER_POPS;
            have.f_pop = 1;
        } else if( !have.f_pop && PragRecog( "routine" ) ) {
            CurrInfo->cclass &= ~ CALLER_POPS;
            have.f_pop = 1;
        } else if( !have.f_reverse && PragRecog( "reverse" ) ) {
            CurrInfo->cclass |= REVERSE_PARMS;
            have.f_reverse = 1;
        } else if( !have.f_nomemory && PragRecog( "nomemory" ) ) {
            CurrInfo->cclass |= NO_MEMORY_READ;
            have.f_nomemory = 1;
        } else if( !have.f_loadds && PragRecog( "loadds" ) ) {
            CurrInfo->cclass |= LOAD_DS_ON_CALL;
            have.f_loadds = 1;
        } else if( !have.f_list && IS_REGSET( CurToken ) ) {
            PragManyRegSets();
            have.f_list = 1;
        } else {
            break;
        }
    }
}
Beispiel #18
0
local void PragComment( void )
/****************************/
{
    if( ExpectingToken( T_LEFT_PAREN ) ) {
        NextToken();
        if( PragRecog( "lib" ) ) {
            if( ExpectingToken( T_COMMA ) ) {
                NextToken();
            }
            GetLibraryNames();
        }
        MustRecog( T_RIGHT_PAREN );
    }
}
Beispiel #19
0
local void GetSTRetInfo( void )
/*****************************/
{
    struct {
        unsigned f_float        : 1;
        unsigned f_struct       : 1;
        unsigned f_allocs       : 1;
        unsigned f_list         : 1;
    } have;

    have.f_float  = 0;
    have.f_struct = 0;
    have.f_allocs = 0;
    have.f_list   = 0;
    for( ;; ) {
        if( !have.f_float && PragRecog( "float" ) ) {
            have.f_float = 1;
            AuxInfo.cclass |= NO_FLOAT_REG_RETURNS;
        } else if( !have.f_struct && PragRecog( "struct" ) ) {
            have.f_struct = 1;
            AuxInfo.cclass |= NO_STRUCT_REG_RETURNS;
        } else if( !have.f_allocs && PragRecog( "routine" ) ) {
            have.f_allocs = 1;
            AuxInfo.cclass |= ROUTINE_RETURN;
        } else if( !have.f_allocs && PragRecog( "caller" ) ) {
            have.f_allocs = 1;
            AuxInfo.cclass &= ~ROUTINE_RETURN;
            AuxInfoFlg.f_caller_return = 1;
        } else if( !have.f_list && PragRegSet() != T_NULL ) {
            have.f_list = 1;
            AuxInfo.cclass |= SPECIAL_STRUCT_RETURN;
            AuxInfo.streturn = PragRegList();
        } else {
            break;
        }
    }
}
Beispiel #20
0
static void GetSTRetInfo(
    void )
{
    struct {
        unsigned f_float        : 1;
        unsigned f_struct       : 1;
        unsigned f_allocs       : 1;
        unsigned f_list         : 1;
    } have;

    have.f_float  = 0;
    have.f_struct = 0;
    have.f_allocs = 0;
    have.f_list   = 0;
    for( ;; ) {
        if( !have.f_float && PragRecog( "float" ) ) {
            have.f_float = 1;
            CurrInfo->cclass |= NO_FLOAT_REG_RETURNS;
        } else if( !have.f_struct && PragRecog( "struct" ) ) {
            have.f_struct = 1;
            CurrInfo->cclass |= NO_STRUCT_REG_RETURNS;
        } else if( !have.f_allocs && PragRecog( "routine" ) ) {
            have.f_allocs = 1;
            CurrInfo->cclass |= ROUTINE_RETURN;
        } else if( !have.f_allocs && PragRecog( "caller" ) ) {
            have.f_allocs = 1;
            CurrInfo->cclass &= ~ROUTINE_RETURN;
        } else if( !have.f_list && IS_REGSET( CurToken ) ) {
            have.f_list = 1;
            CurrInfo->cclass |= SPECIAL_STRUCT_RETURN;
            CurrInfo->streturn = PragRegList();
        } else {
            break;
        }
    }
}
Beispiel #21
0
bool GetPragAuxAlias( void )
{
    bool    isfar16;

    isfar16 = PragRecog( "far16" );
    if( IS_ID_OR_KEYWORD( CurToken ) ) {
        CurrAlias = SearchPragAuxAlias( Buffer );
        NextToken();
    }
    if( CurToken == T_RIGHT_PAREN )
        NextToken();
    if( isfar16 )
        AuxInfo.flags |= AUX_FLAG_FAR16;
    CopyAuxInfo();
    return( true );
}
Beispiel #22
0
static boolean GetAliasInfo(
    void )
{
    char buff[256];
    boolean isfar16;
    boolean retn;

    CurrAlias = &DefaultInfo;
    if( CurToken != T_LEFT_PAREN ) {
        retn = TRUE;
    } else {
        NextToken();
        if( ! PragIdCurToken() ) {
            retn = FALSE;
        } else {
            PragCurrAlias();
            strcpy( buff, Buffer );
            NextToken();
            if( CurToken == T_RIGHT_PAREN ) {
                NextToken();
                retn = TRUE;
            } else if( CurToken == T_COMMA ) {
                NextToken();
                if( ! PragIdCurToken() ) {
                    retn = FALSE;
                } else {
                    isfar16 = PragRecog( "far16" );
                    CreateAux( buff );
                    PragCurrAlias();
                    NextToken();
                    if( CurToken == T_RIGHT_PAREN ) {
                        AuxCopy( CurrInfo, CurrAlias );
                        NextToken();
                    }
                    if( isfar16 ) {
                        CurrInfo->flags |= AUX_FLAG_FAR16;
                    }
                    PragEnding( TRUE );
                    retn = FALSE;
                }
            }
        }
    }
    return retn;
}
Beispiel #23
0
static void pragComment(        // #PRAGMA COMMENT
    void )
{
    if( ExpectingToken( T_LEFT_PAREN ) ) {
        NextToken();
        if( PragRecog( "lib" ) ) {
            PPCTL_ENABLE_MACROS();
            if( ExpectingToken( T_COMMA ) ) {
                NextToken();
            }
            while( IS_ID_OR_KEYWORD( CurToken ) || CurToken == T_STRING ) {
                CgInfoAddUserLib( Buffer );
                NextToken();
            }
            PPCTL_DISABLE_MACROS();
        }
        MustRecog( T_RIGHT_PAREN );
    }
}
Beispiel #24
0
static int GetAliasInfo( void )
/*****************************/
{
    int     isfar16;

    if( CurToken != T_LEFT_PAREN )          // #pragma aux symbol .....
        return( 1 );
    NextToken();
    if( CurToken != T_ID )                  // error
        return( 0 );
    LookAhead();
    if( LAToken == T_RIGHT_PAREN ) {        // #pragma aux (alias) symbol .....
        PragCurrAlias( SavedId );
        AdvanceToken();
        NextToken();
        return( 1 );
    } else if( LAToken == T_COMMA ) {       // #pragma aux (symbol, alias)
        HashValue = SavedHash;
        SetCurrInfo( SavedId );
        AdvanceToken();
        NextToken();
        if( CurToken != T_ID )              // error
            return( 0 );
        isfar16 = PragRecog( "far16" );
        if( CurToken == T_ID ) {
            PragCurrAlias( Buffer );
            NextToken();
        }
        if( CurToken == T_RIGHT_PAREN )
            NextToken();
        if( isfar16 )
            AuxInfo.flags |= AUX_FLAG_FAR16;
        CopyAuxInfo();
        PragEnding();
        return( 0 ); /* process no more! */
    } else {                                // error
        AdvanceToken();
        return( 0 ); // shut up the compiler
    }
}
Beispiel #25
0
static bool GetAliasInfo(
    void )
{
    char buff[256];
    bool isfar16;

    CurrAlias = &DefaultInfo;
    if( CurToken != T_LEFT_PAREN )              // #pragma aux symbol ....
        return( IS_ID_OR_KEYWORD( CurToken ) );
    NextToken();
    if( !IS_ID_OR_KEYWORD( CurToken ) )         // error
        return( FALSE );
    PragCurrAlias();
    strcpy( buff, Buffer );
    NextToken();
    if( CurToken == T_RIGHT_PAREN ) {           // #pragma aux (alias) symbol ....
        NextToken();
        return( IS_ID_OR_KEYWORD( CurToken ) );
    }
    if( CurToken == T_COMMA ) {                 // #pragma aux (alias, symbol)
        NextToken();
        if( IS_ID_OR_KEYWORD( CurToken ) ) {
            isfar16 = PragRecog( "far16" );
            CreateAux( buff );
            PragCurrAlias();
            NextToken();
            if( CurToken == T_RIGHT_PAREN ) {
                AuxCopy( CurrInfo, CurrAlias );
                NextToken();
            }
            if( isfar16 ) {
                CurrInfo->flags |= AUX_FLAG_FAR16;
            }
            PragEnding( TRUE );
        }
    }
    return( FALSE );
}
Beispiel #26
0
void PragAux( void )
/******************/
{
    struct {
        unsigned    f_call   : 1;
        unsigned    f_loadds : 1;
        unsigned    f_rdosdev: 1;
        unsigned    f_export : 1;
        unsigned    f_parm   : 1;
        unsigned    f_value  : 1;
        unsigned    f_modify : 1;
        unsigned    f_frame  : 1;
        unsigned    uses_auto: 1;
    } have;

    InitAuxInfo();
    if( !GetAliasInfo() )
        return;
    if( CurToken != T_ID )
        return;
    SetCurrInfo( Buffer );
    NextToken();
    PragObjNameInfo( &AuxInfo.objname );
    have.f_call   = 0;
    have.f_loadds = 0;
    have.f_rdosdev = 0;
    have.f_export = 0;
    have.f_parm   = 0;
    have.f_value  = 0;
    have.f_modify = 0;
    have.f_frame = 0;
    have.uses_auto = 0; /* BBB - Jan 26, 1994 */
    for( ;; ) {
        if( !have.f_call && CurToken == T_EQUAL ) {
            have.uses_auto = GetByteSeq( &AuxInfo.code );
            have.f_call = 1;
        } else if( !have.f_call && PragRecog( "far" ) ) {
            AuxInfo.cclass |= FAR;
            have.f_call = 1;
        } else if( !have.f_call && PragRecog( "near" ) ) {
            AuxInfo.cclass &= ~FAR;
            AuxInfoFlg.f_near = 1;
            have.f_call = 1;
        } else if( !have.f_loadds && PragRecog( "loadds" ) ) {
            AuxInfo.cclass |= LOAD_DS_ON_ENTRY;
            have.f_loadds = 1;
        } else if( !have.f_rdosdev && PragRecog( "rdosdev" ) ) {
            AuxInfo.cclass |= LOAD_RDOSDEV_ON_ENTRY;
            have.f_rdosdev = 1;
        } else if( !have.f_export && PragRecog( "export" ) ) {
            AuxInfo.cclass |= DLL_EXPORT;
            have.f_export = 1;
        } else if( !have.f_parm && PragRecog( "parm" ) ) {
            GetParmInfo();
            have.f_parm = 1;
        } else if( !have.f_value && PragRecog( "value" ) ) {
            GetRetInfo();
            have.f_value = 1;
        } else if( !have.f_value && PragRecog( "aborts" ) ) {
            AuxInfo.cclass |= SUICIDAL;
            have.f_value = 1;
        } else if( !have.f_modify && PragRecog( "modify" ) ) {
            GetSaveInfo();
            have.f_modify = 1;
        } else if( !have.f_frame && PragRecog( "frame" ) ) {
            AuxInfo.cclass |= GENERATE_STACK_FRAME;
            have.f_frame = 1;
        } else {
            break;
        }
    }
    if( have.uses_auto ) {
        /*
           We want to force the calling routine to set up a [E]BP frame
           for the use of this pragma. This is done by saying the pragma
           modifies the [E]SP register. A kludge, but it works.
        */
        HW_CTurnOn( AuxInfo.save, HW_SP );
    }
    CopyAuxInfo();
    PragEnding();
}
Beispiel #27
0
void PragAux(                   // #PRAGMA AUX ...
    void )
{
    struct {
        unsigned f_call   : 1;
        unsigned f_loadds : 1;
        unsigned f_rdosdev: 1;
        unsigned f_export : 1;
        unsigned f_parm   : 1;
        unsigned f_value  : 1;
        unsigned f_modify : 1;
        unsigned f_frame  : 1;
        unsigned uses_auto: 1;
    } have;

    if( !GetAliasInfo() ) return;
    CurrEntry = NULL;
    if( !IS_ID_OR_KEYWORD( CurToken ) ) return;
    SetCurrInfo();
    NextToken();
    AuxCopy( CurrInfo, CurrAlias );
    PragObjNameInfo();
    have.f_call   = 0;
    have.f_loadds = 0;
    have.f_rdosdev = 0;
    have.f_export = 0;
    have.f_parm   = 0;
    have.f_value  = 0;
    have.f_modify = 0;
    have.f_frame = 0;
    have.uses_auto = 0;
    for( ;; ) {
        if( !have.f_call && CurToken == T_EQUAL ) {
            have.uses_auto = GetByteSeq();
            have.f_call = 1;
        } else if( !have.f_call && PragRecog( "far" ) ) {
            CurrInfo->cclass |= FAR_CALL;
            have.f_call = 1;
        } else if( !have.f_call && PragRecog( "near" ) ) {
            CurrInfo->cclass &= ~FAR_CALL;
            have.f_call = 1;
        } else if( !have.f_loadds && PragRecog( "loadds" ) ) {
            CurrInfo->cclass |= LOAD_DS_ON_ENTRY;
            have.f_loadds = 1;
        } else if( !have.f_rdosdev && PragRecog( "rdosdev" ) ) {
            CurrInfo->cclass |= LOAD_RDOSDEV_ON_ENTRY;
            have.f_rdosdev = 1;
        } else if( !have.f_export && PragRecog( "export" ) ) {
            CurrInfo->cclass |= DLL_EXPORT;
            have.f_export = 1;
        } else if( !have.f_parm && PragRecog( "parm" ) ) {
            GetParmInfo();
            have.f_parm = 1;
        } else if( !have.f_value && PragRecog( "value" ) ) {
            GetRetInfo();
            have.f_value = 1;
        } else if( !have.f_value && PragRecog( "aborts" ) ) {
            CurrInfo->cclass |= SUICIDAL;
            have.f_value = 1;
        } else if( !have.f_modify && PragRecog( "modify" ) ) {
            GetSaveInfo();
            have.f_modify = 1;
        } else if( !have.f_frame && PragRecog( "frame" ) ) {
            CurrInfo->cclass |= GENERATE_STACK_FRAME;
            have.f_frame = 1;
        } else {
            break;
        }
    }
    if( have.uses_auto ) {
        AsmSysUsesAuto();
    }
    PragEnding( TRUE );
}
Beispiel #28
0
void CPragma( void )
/******************/
{
    bool    check_end = TRUE;

    /* Note that the include_alias pragma must always be processed
     * because it's intended for the preprocessor, not the compiler.
     */
    CompFlags.in_pragma = 1;
    NextToken();
    if( PragRecog( "include_alias" ) ) {
        PragIncludeAlias();
    } else if( CompFlags.cpp_output ) {
        PPCTL_ENABLE_MACROS();
        CppPrtf( "#pragma " );
        for( ; CurToken != T_NULL; ) {
            CppPrtToken();
            GetNextToken();
        }
        PPCTL_DISABLE_MACROS();
    } else if( IS_ID_OR_KEYWORD( CurToken ) ) {
        if( PragIdRecog( "on" ) ) {
            PragFlag( 1 );
        } else if( PragIdRecog( "off" ) ) {
            PragFlag( 0 );
        } else if( PragIdRecog( "aux" ) || PragIdRecog( "linkage" ) ) {
            PragAux();
        } else if( PragIdRecog( "library" ) ) {
            PragLibs();
        } else if( PragIdRecog( "comment" ) ) {
            PragComment();
        } else if( PragIdRecog( "pack" ) ) {
            PragPack();
        } else if( PragIdRecog( "alloc_text" ) ) {
            PragAllocText();
        } else if( PragIdRecog( "code_seg" ) ) {
            PragCodeSeg();
        } else if( PragIdRecog( "data_seg" ) ) {
            PragDataSeg();
        } else if( PragIdRecog( "disable_message" ) ) {
            PragEnableDisableMessage( 0 );
        } else if( PragIdRecog( "enable_message" ) ) {
            PragEnableDisableMessage( 1 );
        } else if( PragIdRecog( "include_alias" ) ) {
            PragIncludeAlias();
        } else if( PragIdRecog( "message" ) ) {
            PragMessage();
        } else if( PragIdRecog( "intrinsic" ) ) {
            PragIntrinsic( 1 );
        } else if( PragIdRecog( "function" ) ) {
            PragIntrinsic( 0 );
        } else if( PragIdRecog( "enum" ) ) {
            PragEnum();
        } else if( startPragRecog( "read_only_file" ) ) {
            PragReadOnlyFile();
        } else if( startPragRecog( "read_only_directory" ) ) {
            PragReadOnlyDir();
        } else if( PragIdRecog( "once" ) ) {
            PragOnce();
        } else if( PragIdRecog( "unroll" ) ) {
            PragUnroll();
        } else if( PragIdRecog( "STDC" ) ) {
            PragSTDC();
        } else if( PragIdRecog( "extref" ) ) {
            PragExtRef();
        } else if( PragIdRecog( "alias" ) ) {
            PragAlias();
        } else {
            check_end = FALSE;
        }
    } else {
        check_end = FALSE;
    }
    if( check_end )
        EndOfPragma();
    CompFlags.in_pragma = 0;
}
Beispiel #29
0
void CPragma( void )                  // PROCESS A PRAGMA
{
    bool check_end = true;

    SrcFileGuardStateSig();
    CompFlags.in_pragma = 1;
    NextToken();
    if( PragRecog( "include_alias" ) ) {
        pragIncludeAlias();
    } else if( CompFlags.cpp_output ) {
        PPCTL_ENABLE_MACROS();
        fprintf( CppFile, "#pragma " );
        for( ; CurToken != T_NULL; ) {
            PrtToken();
            GetNextToken();
        }
        PPCTL_DISABLE_MACROS();
    } else if( IS_ID_OR_KEYWORD( CurToken ) ) {
        if( PragIdRecog( "on" ) ) {
            pragFlag( true );
        } else if( PragIdRecog( "off" ) ) {
            pragFlag( false );
        } else if( PragIdRecog( "aux" ) || PragIdRecog( "linkage" ) ) {
            PragAux();
        } else if( PragIdRecog( "library" ) ) {
            pragLibs();
        } else if( PragIdRecog( "once" ) ) {
            pragOnce();
        } else if( PragIdRecog( "extref" ) ) {
            pragExtRef();
        } else if( PragIdRecog( "comment" ) ) {
            pragComment();
        } else if( PragIdRecog( "pack" ) ) {
            pragPack();
        } else if( PragIdRecog( "warning" ) ) {
            if( pragWarning() ) {
                /* ignore #pragma warning */
                check_end = false;  /* skip rest of line */
            }
        } else if( PragIdRecog( "enable_message" ) ) {
            pragEnableMessage();
        } else if( PragIdRecog( "disable_message" ) ) {
            pragDisableMessage();
        } else if( PragIdRecog( "code_seg" ) ) {
            pragCodeSeg();
        } else if( PragIdRecog( "data_seg" ) ) {
            pragDataSeg();
        } else if( PragIdRecog( "initialize" ) ) {
            pragInitialize();
        } else if( PragIdRecog( "init_seg" ) ) {
            pragInitSeg();
        } else if( PragIdRecog( "inline_depth" ) ) {
            pragInlineDepth();
        } else if( PragIdRecog( "template_depth" ) ) {
            pragTemplateDepth();
        } else if( PragIdRecog( "inline_recursion" ) ) {
            pragInlineRecursion();
        } else if( PragIdRecog( "intrinsic" ) ) {
            pragIntrinsic( true );
        } else if( PragIdRecog( "function" ) ) {
            pragIntrinsic( false );
        } else if( PragIdRecog( "destruct" ) ) {
            pragDestruct();
        } else if( PragIdRecog( "enum" ) ) {
            pragEnum();
        } else if( PragIdRecog( "dump_object_model" ) ) {
            pragDumpObjectModel();
        } else if( startPragRecog( "read_only_file" ) ) {
            pragReadOnlyFile();
        } else if( startPragRecog( "read_only_directory" ) ) {
            pragReadOnlyDir();
        } else if( PragIdRecog( "include_alias" ) ) {
            pragIncludeAlias();
        } else if( PragIdRecog( "message" ) ) {
            pragMessage();
        } else if( PragIdRecog( "error" ) ) {
            pragError();
#ifndef NDEBUG
        } else if( PragIdRecog( "break" ) ) {
            pragBreak();
#endif
        } else {                /* unknown pragma */
            check_end = false;  /* skip rest of line */
        }
    } else {                    /* unknown pragma */
        check_end = false;      /* skip rest of line */
    }
    if( check_end ) {
        endOfPragma();
    }
    CompFlags.in_pragma = 0;
}