Esempio n. 1
0
static void setWindowsSystem( void )
{
#if _CPU == 8086
    PreDefineStringMacro( "__WINDOWS__" );
    PreDefineStringMacro( "_WINDOWS" );
    TargetSwitches |= WINDOWS | CHEAP_WINDOWS;
    TargetSwitches &= ~ FLOATING_DS;
#else
    PreDefineStringMacro( "__WINDOWS_386__" );
    TargetSwitches |= FLOATING_FS;
    SET_FPU_INLINE( CpuSwitches );
#endif
}
Esempio n. 2
0
static void defineFeatureMacros( void )
{
    char        *end_watcom;
    char        *end_feature;
    const char  **p;
    auto char   buff[128];
    static const char *feature[] = {
        "BOOL",
        "MUTABLE",
        "RTTI",
        "EXPLICIT",
        "NAMESPACE",
        "NEW_CASTS",
        "INT64",
        "TYPENAME",
        NULL
    };

    end_watcom = stxpcpy( buff, "__WATCOM_" );
    for( p = feature; *p != NULL; ++p ) {
        end_feature = stxpcpy( end_watcom, *p );
        strcpy( end_feature, "__" );
        PreDefineStringMacro( buff );
    }
    defineStringMacro( "_PUSHPOP_SUPPORTED" );
}
Esempio n. 3
0
void MiscMacroDefs(             // PREDEFINE MISCELLANEOUS MACROS
    void )
{
    if( CompFlags.inline_intrinsics ) {
        // this is the only place 'inline_intrinsics' is checked
        // the mechanism works as follows:
        // (1) user sets -ox or -oi
        // (2) macro __INLINE_FUNCTIONS__ is defined
        // (3) user includes <header.h>
        // (4) various prototypes are marked as "intrinsic"
        // (5) fns marked 'intrinsic' will be looked up in code burst tables
        // (6) code for fn will be generated inline
        defineStringMacro( "__INLINE_FUNCTIONS__" );
    }
    if( !CompFlags.extensions_enabled ) {
        defineStringMacro( "NO_EXT_KEYS" );
    }
    if( CompFlags.oldmacros_enabled ) {
        defineKeywordMacros();
    }
    defineStringMacro( "_WCHAR_T_DEFINED" );
    defineStringMacro( "_STDWCHAR_T_DEFINED" );
    if( CompFlags.signed_char ) {
        defineStringMacro( "__CHAR_SIGNED__" );              /* 20-apr-90 */
    }
    if( CompFlags.excs_enabled ) {
        defineStringMacro( "_CPPUNWIND" );
    }
    if( CompFlags.rtti_enabled ) {
        defineStringMacro( "_CPPRTTI" );
    }
    defineFeatureMacros();
    if( !CompFlags.no_alternative_tokens ) {
        DefineAlternativeTokens();
    }
    PreDefineStringMacro( "__WATCOMC__=" _MACROSTR( _BLDVER ) );
    PreDefineStringMacro( "__WATCOM_CPLUSPLUS__=" _MACROSTR( _BLDVER ) );
    // #if __WATCOM_REVISION__ >= 8
    PreDefineStringMacro( "__WATCOM_REVISION__=8" );
    if( !PragToggle.check_stack ) {
        DefSwitchMacro( "S" );
    }
    RingNameFree( &undef_names );
}
Esempio n. 4
0
void DefSwitchMacro( char *n )
/****************************/
{
    char *p;
    char buff[64];

    p = stpcpy( buff, "__SW_" );
    strcpy( p, n );
    PreDefineStringMacro( buff );
}
Esempio n. 5
0
static void defineKeywordMacros(   // PREDEFINE KEYWORD MACROS
    void )
{
    static const char *mac_table[] = { // - predefined macros
      "near=__near"
    , "far=__far"
    , "huge=__huge"
    , "cdecl=__cdecl"
    , "pascal=__pascal"
    , "fortran=__fortran"
    , "interrupt=__interrupt"
    , "_near=__near"
    , "_far=__far"
    , "_far16=__far16"
    , "_huge=__huge"
    , "_cdecl=__cdecl"
    , "_pascal=__pascal"
    , "_fortran=__fortran"
    , "_interrupt=__interrupt"
    , "_export=__export"
    , "_loadds=__loadds"
    , "_saveregs=__saveregs"
    , "_based=__based"
    , "_self=__self"
    , "_segname=__segname"
    , "_segment=__segment"
    , "_syscall=__syscall"
    , "_inline=__inline"
    , "_stdcall=__stdcall"
    , "_fastcall=__fastcall"
    , "_asm=__asm"
    , "_emit=__emit"
    , NULL
    };

    const char  **mac;                  // - current macro

    for( mac = mac_table; *mac != NULL; ++ mac ) {
        PreDefineStringMacro( *mac );
    }
}
Esempio n. 6
0
static void miscAnalysis( OPT_STORAGE *data )
{
#if _CPU == 8086
    if( data->bd || data->zu ) {
        if( TargetSwitches & SMART_WINDOWS ) {
            CErr1( ERR_ZWS_MUST_HAVE_SS_DS_SAME );
        }
    }
#endif
    if( GET_CPU( CpuSwitches ) < CPU_386 ) {
        /* issue warning message if /zf[f|p] or /zg[f|p] spec'd? */
        TargetSwitches &= ~( FLOATING_FS | FLOATING_GS );
    }
    if( ! CompFlags.save_restore_segregs ) {
        if( TargetSwitches & FLOATING_DS ) {
            HW_CTurnOff( WatcallInfo.save, HW_DS );
        }
        if( TargetSwitches & FLOATING_ES ) {
            HW_CTurnOff( WatcallInfo.save, HW_ES );
        }
        if( TargetSwitches & FLOATING_FS ) {
            HW_CTurnOff( WatcallInfo.save, HW_FS );
        }
        if( TargetSwitches & FLOATING_GS ) {
            HW_CTurnOff( WatcallInfo.save, HW_GS );
        }
    }
    if( GET_FPU( CpuSwitches ) > FPU_NONE ) {
        PreDefineStringMacro( "__FPI__" );
    }
#if _CPU == 386
    if( ! CompFlags.register_conventions ) {
        SetAuxStackConventions();
    }
#endif
    if( data->zx ) {
        HW_CTurnOff( WatcallInfo.save, HW_FLTS );
    }
}
Esempio n. 7
0
static void defineM_IX86Macro( void )
{
    unsigned cpu;
    char buff[32];

    strcpy( buff, "_M_IX86=" );
#if _CPU == 8086
    cpu = 0;
#else
    cpu = 3;
#endif
    switch( GET_CPU( CpuSwitches ) ) {
    case CPU_86:        cpu = 0; break;
    case CPU_186:       cpu = 1; break;
    case CPU_286:       cpu = 2; break;
    case CPU_386:       cpu = 3; break;
    case CPU_486:       cpu = 4; break;
    case CPU_586:       cpu = 5; break;
    case CPU_686:       cpu = 6; break;
    }
    ConcatBase10( buff, cpu * 100 );
    PreDefineStringMacro( buff );
}
Esempio n. 8
0
static void macroDefs( void )
{
    if( TargetSwitches & I_MATH_INLINE ) {
        DefSwitchMacro( "OM" );
    }
    switch( TargetSwitches & (BIG_DATA|BIG_CODE|CHEAP_POINTER|FLAT_MODEL) ) {
    case CHEAP_POINTER:
        DefSwitchMacro( "MS" );
        break;
    case BIG_CODE|CHEAP_POINTER:
        DefSwitchMacro( "MM" );
        break;
    case BIG_DATA|CHEAP_POINTER:
        DefSwitchMacro( "MC" );
        break;
    case BIG_CODE|BIG_DATA|CHEAP_POINTER:
        DefSwitchMacro( "ML" );
        break;
    case BIG_CODE|BIG_DATA:
        DefSwitchMacro( "MH" );
        break;
    case FLAT_MODEL|CHEAP_POINTER:
        DefSwitchMacro( "MF" );
        break;
    }
    if( TargetSwitches & FLOATING_FS ) {
        DefSwitchMacro( "ZFF" );
    } else {
        DefSwitchMacro( "ZFP" );
    }
    if( TargetSwitches & FLOATING_GS ) {
        DefSwitchMacro( "ZGF" );
    } else {
        DefSwitchMacro( "ZGP" );
    }
    if( TargetSwitches & FLOATING_DS ) {
        DefSwitchMacro( "ZDF" );
    } else {
        DefSwitchMacro( "ZDP" );
    }
    if( TargetSwitches & FLOATING_SS ) {
        DefSwitchMacro( "ZU" );
    }
    if( TargetSwitches & INDEXED_GLOBALS ) {
        DefSwitchMacro( "XGV" );
    }
    if( TargetSwitches & WINDOWS ) {
        DefSwitchMacro( "ZW" );
    }
    if( TargetSwitches & SMART_WINDOWS ) {
        DefSwitchMacro( "ZWS" );
    }
    if( TargetSwitches & NO_CALL_RET_TRANSFORM ) {
        DefSwitchMacro( "OC" );
    }
    if( TargetSwitches & NEED_STACK_FRAME ) {
        DefSwitchMacro( "OF" );
    }
    if( GenSwitches & NO_OPTIMIZATION ) {
        DefSwitchMacro( "OD" );
    }
    if( GenSwitches & RELAX_ALIAS ) {
        DefSwitchMacro( "OA" );
    }
    if( GenSwitches & BRANCH_PREDICTION ) {
        DefSwitchMacro( "OB" );
    }
    if( GenSwitches & LOOP_OPTIMIZATION ) {
        DefSwitchMacro( "OL" );
    }
    if( GenSwitches & INS_SCHEDULING ) {
        DefSwitchMacro( "OR" );
    }
    if( GenSwitches & FPU_ROUNDING_INLINE ) {
        DefSwitchMacro( "ZRI" );
    }
    if( GenSwitches & FPU_ROUNDING_OMIT ) {
        DefSwitchMacro( "ZRO" );
    }
    if( TargetSwitches & GEN_FWAIT_386 ) {
        DefSwitchMacro( "ZFW" );
    }
    if( CompFlags.signed_char ) {
        DefSwitchMacro( "J" );
    }
    if( CompFlags.use_pcheaders ) {
        DefSwitchMacro( "FH" );
    }
    if( CompFlags.no_pch_warnings ) {
        DefSwitchMacro( "FHQ" );
    }
    if( CompFlags.inline_intrinsics ) {
        DefSwitchMacro( "OI" );
    }
    if( CompFlags.zu_switch_used ) {
        DefSwitchMacro( "ZU" );
    }
    if( CompFlags.unique_functions ) {
        DefSwitchMacro( "OU" );
    }
#if _CPU == 386
    if( CompFlags.register_conventions ) {
        DefSwitchMacro( "3R" );
    } else {
        DefSwitchMacro( "3S" );
    }
#endif
    if( CompFlags.emit_names ) {
        DefSwitchMacro( "EN" );
    }
    if( CompFlags.save_restore_segregs ) {
        DefSwitchMacro( "R" );
    }
    if( CompFlags.zc_switch_used ) {
        DefSwitchMacro( "ZC" );
    }
    if( CompFlags.use_unicode ) {
        DefSwitchMacro( "ZK" );
    }
    if( CompFlags.sg_switch_used ) {
        DefSwitchMacro( "SG" );
    }
    if( CompFlags.st_switch_used ) {
        DefSwitchMacro( "ST" );
    }
    if( CompFlags.bm_switch_used ) {
        PreDefineStringMacro( "_MT" );
        DefSwitchMacro( "BM" );
    }
    if( CompFlags.bd_switch_used ) {
        DefSwitchMacro( "BD" );
    }
    if( CompFlags.br_switch_used ) {
        PreDefineStringMacro( "_DLL" );
        DefSwitchMacro( "BR" );
    }
    if( CompFlags.bw_switch_used ) {
        DefSwitchMacro( "BW" );
    }
    if( CompFlags.zm_switch_used ) {
        DefSwitchMacro( "ZM" );
    }
    if( CompFlags.ep_switch_used ) {
        DefSwitchMacro( "EP" );
    }
    if( CompFlags.ee_switch_used ) {
        DefSwitchMacro( "EE" );
    }
    switch( CompInfo.dt_method_speced ) {
      case DTM_DIRECT :
        DefSwitchMacro( "XDT" );
        DefSwitchMacro( "XD" );
        break;
      case DTM_DIRECT_SMALL :
        DefSwitchMacro( "XDS" );
        break;
      case DTM_TABLE :
        DefSwitchMacro( "XS" );
        break;
      case DTM_DIRECT_TABLE :
        DefSwitchMacro( "XST" );
        break;
      case DTM_TABLE_SMALL :
        DefSwitchMacro( "XSS" );
        break;
      DbgDefault( "macroDefs -- invalid exception switch" );
    }
    switch( GET_CPU( CpuSwitches ) ) {
    case CPU_86:
        DefSwitchMacro( "0" );
        break;
    case CPU_186:
        DefSwitchMacro( "1" );
        break;
    case CPU_286:
        DefSwitchMacro( "2" );
        break;
    case CPU_386:
        DefSwitchMacro( "3" );
        break;
    case CPU_486:
        DefSwitchMacro( "4" );
        break;
    case CPU_586:
        DefSwitchMacro( "5" );
        break;
    case CPU_686:
        DefSwitchMacro( "6" );
        break;
    }
    switch( GET_FPU_LEVEL( CpuSwitches ) ) {
    case FPU_NONE:
        CompFlags.op_switch_used = 0;
        DefSwitchMacro( "FPC" );
        break;
    case FPU_87:
        DefSwitchMacro( "FP287" );
        defEmu();
        break;
    case FPU_387:
        DefSwitchMacro( "FP387" );
        defEmu();
        break;
    case FPU_586:
        DefSwitchMacro( "FP5" );
        defEmu();
        break;
    case FPU_686:
        DefSwitchMacro( "FP6" );
        defEmu();
        break;
    }
    if( CompFlags.op_switch_used ) {
        DefSwitchMacro( "OP" );
    }
    PreDefineStringMacro( "_INTEGRAL_MAX_BITS=64" );
#if _CPU == 386
    PreDefineStringMacro( "_STDCALL_SUPPORTED" );
#endif
    if( CompFlags.oldmacros_enabled ) {
#if _CPU == 8086
        if( TargetSwitches & WINDOWS ) {
            PreDefineStringMacro( "SOMLINK=__cdecl" );
            PreDefineStringMacro( "SOMDLINK=__far" );
        }
#else
        PreDefineStringMacro( "SOMLINK=_Syscall" );
        PreDefineStringMacro( "SOMDLINK=_Syscall" );
#endif
    }
}
Esempio n. 9
0
static void setMemoryModel( OPT_STORAGE *data, mem_model_control control )
{
    char model;
    unsigned bit;

    if( data->mem_model == OPT_mem_model_default ) {
#if _CPU == 8086
        data->mem_model = OPT_mem_model_ms;
#else
        data->mem_model = OPT_mem_model_mf;
#endif
    }
#if _CPU == 386
    if( control & MMC_NETWARE ) {
        data->mem_model = OPT_mem_model_ms;
    }
#endif
    bit = 0;
    if( CompFlags.oldmacros_enabled ) {
        switch( data->mem_model ) {
        case OPT_mem_model_ms:
            PreDefineStringMacro( "M_" MM_ARCH "SM" );
            break;
        case OPT_mem_model_mm:
            PreDefineStringMacro( "M_" MM_ARCH "MM" );
            break;
        case OPT_mem_model_ml:
            PreDefineStringMacro( "M_" MM_ARCH "LM" );
            break;
        case OPT_mem_model_mc:
            PreDefineStringMacro( "M_" MM_ARCH "CM" );
            break;
#if _CPU == 8086
        case OPT_mem_model_mh:
            PreDefineStringMacro( "M_" MM_ARCH "HM" );
            break;
#else
        case OPT_mem_model_mfi:
        case OPT_mem_model_mf:
            PreDefineStringMacro( "M_" MM_ARCH "FM" );
            break;
#endif
        default:
            break;
        }
    }
    DataPtrSize = TARGET_POINTER;
    CodePtrSize = TARGET_POINTER;
    switch( data->mem_model ) {
    case OPT_mem_model_ms:
        model = 's';
        PreDefineStringMacro( "_M_" MM_ARCH "SM" );
        PreDefineStringMacro( "__SMALL__" );
        CompFlags.strings_in_code_segment = 0;
        TargetSwitches &= ~CONST_IN_CODE;
        bit |= CHEAP_POINTER;
        break;
    case OPT_mem_model_mm:
        model = 'm';
        WatcallInfo.cclass |= FAR_CALL;
        CodePtrSize = TARGET_FAR_POINTER;
        PreDefineStringMacro( "_M_" MM_ARCH "MM" );
        PreDefineStringMacro( "__MEDIUM__" );
        CompFlags.strings_in_code_segment = 0;
        TargetSwitches &= ~CONST_IN_CODE;
        bit |= BIG_CODE | CHEAP_POINTER;
        break;
    case OPT_mem_model_mc:
        model = 'c';
        PreDefineStringMacro( "_M_" MM_ARCH "CM" );
        PreDefineStringMacro( "__COMPACT__" );
        DataPtrSize = TARGET_FAR_POINTER;
        bit |= BIG_DATA | CHEAP_POINTER;
        break;
    case OPT_mem_model_ml:
        model = 'l';
        PreDefineStringMacro( "_M_" MM_ARCH "LM" );
        PreDefineStringMacro( "__LARGE__" );
        WatcallInfo.cclass |= FAR_CALL;
        CodePtrSize = TARGET_FAR_POINTER;
        DataPtrSize = TARGET_FAR_POINTER;
        bit |= BIG_CODE | BIG_DATA | CHEAP_POINTER;
        break;
#if _CPU == 8086
    case OPT_mem_model_mh:
        model = 'h';
        PreDefineStringMacro( "_M_" MM_ARCH "HM" );
        PreDefineStringMacro( "__HUGE__" );
        WatcallInfo.cclass |= FAR_CALL;
        CodePtrSize = TARGET_FAR_POINTER;
        DataPtrSize = TARGET_FAR_POINTER;
        bit |= BIG_CODE | BIG_DATA;
        break;
#else
    case OPT_mem_model_mfi:
        CompFlags.mfi_switch_used = 1;
        /* fall thru */
    case OPT_mem_model_mf:
        model = 's';
        PreDefineStringMacro( "_M_" MM_ARCH "FM" );
        PreDefineStringMacro( "__FLAT__" );
        bit |= FLAT_MODEL | CHEAP_POINTER;
        break;
#endif
    default:
        DbgNever();
    }
// setup default "floating" segment registers
#if _CPU == 8086
    bit |= FLOATING_ES;
#else
    // 386 flat model needs at least one floating segment register
    bit |= FLOATING_GS;
    if( (bit & FLAT_MODEL) == 0 ) {
        bit |= FLOATING_ES;
    }
#endif
    if( bit & BIG_DATA ) {
        bit |= FLOATING_DS;
    }
    if( control & ( MMC_DS | MMC_WIN ) ) {
        bit &= ~FLOATING_DS;
    } else {
        TargetSwitches &= ~ FLOATING_DS;
    }
    if( control & MMC_FS ) {
        bit &= ~FLOATING_FS;
    } else {
        TargetSwitches &= ~ FLOATING_FS;
    }
    if( control & MMC_GS ) {
        bit &= ~FLOATING_GS;
    } else {
        TargetSwitches &= ~ FLOATING_GS;
    }
    TargetSwitches &= ~( FLAT_MODEL | BIG_CODE | BIG_DATA | CHEAP_POINTER | FLOATING_ES );
    TargetSwitches |= bit;
#if _CPU == 8086
    if( data->bm ) { // .DLL
        strcpy( DLL_CLIB_Name, "2clibmt?" );
    } else {
        if( control & MMC_WIN ) {
            strcpy( DLL_CLIB_Name, "2clib?" );
        } else {
            strcpy( DLL_CLIB_Name, "2clibdl?" );
        }
    }
    if( data->bm ) {
        strcpy( CLIB_Name, "2clibmt?" );
    } else if( data->bd ) {
        if( control & MMC_WIN ) {
            strcpy( CLIB_Name, "2clib?" );
        } else {
            strcpy( CLIB_Name, "2clibdl?" );
        }
    } else {
        strcpy( CLIB_Name, "2clib?" );
    }
    if( CompFlags.excs_enabled ) {
        if( data->bm ) { // .DLL
            strcpy( DLL_WCPPLIB_Name, "4plbxmt?" );
        } else {
            if( control & MMC_WIN ) {
                strcpy( DLL_WCPPLIB_Name, "4plbx?" );
            } else {
                strcpy( DLL_WCPPLIB_Name, "4plbxmt?" );
            }
        }
        if( data->bm ) {
            strcpy( WCPPLIB_Name, "4plbxmt?" );
        } else if( data->bd ) {
            if( control & MMC_WIN ) {
                strcpy( WCPPLIB_Name, "4plbx?" );
            } else {
                strcpy( WCPPLIB_Name, "4plbxmt?" );
            }
        } else {
            strcpy( WCPPLIB_Name, "4plbx?" );
        }
    } else {
        if( data->bm ) { // .DLL
            strcpy( DLL_WCPPLIB_Name, "4plibmt?" );
        } else {
            if( control & MMC_WIN ) {
                strcpy( DLL_WCPPLIB_Name, "4plib?" );
            } else {
                strcpy( DLL_WCPPLIB_Name, "4plibmt?" );
            }
        }
        if( data->bm ) {
            strcpy( WCPPLIB_Name, "4plibmt?" );
        } else if( data->bd ) {
            if( control & MMC_WIN ) {
                strcpy( WCPPLIB_Name, "4plib?" );
            } else {
                strcpy( WCPPLIB_Name, "4plibmt?" );
            }
        } else {
            strcpy( WCPPLIB_Name, "4plib?" );
        }
    }
    if( GET_FPU_EMU( CpuSwitches ) ) {
        strcpy( MATHLIB_Name, "7math87?" );
        EmuLib_Name = "8emu87";
    } else if( GET_FPU_LEVEL( CpuSwitches ) == FPU_NONE ) {
        strcpy( MATHLIB_Name, "5math?" );
        EmuLib_Name = NULL;
    } else {
        strcpy( MATHLIB_Name, "7math87?" );
        EmuLib_Name = "8noemu87";
    }
#else
    if( CompFlags.register_conventions ) {
        model = 'r';
        PreDefineStringMacro( "__3R__" );
    } else {
        model = 's';
        PreDefineStringMacro( "__3S__" );
    }
    strcpy( CDLL_Name, "1clb?dll" );
    strcpy( CLIB_Name, "2clib3?" );
    strcpy( DLL_CLIB_Name, "2clib3?" );
    if( CompFlags.excs_enabled ) {
        strcpy( WCPPDLL_Name, "3plb?dllx" );
        if( data->bm ) { // .DLL
            strcpy( DLL_WCPPLIB_Name, "4plbxmt3?" );
        } else {
            if( control & MMC_WIN ) {
                strcpy( DLL_WCPPLIB_Name, "4plbx3?" );
            } else {
                strcpy( DLL_WCPPLIB_Name, "4plbxmt3?" );
            }
        }
        if( data->bm ) {
            strcpy( WCPPLIB_Name, "4plbxmt3?" );
        } else if( data->bd ) {
            if( control & MMC_WIN ) {
                strcpy( WCPPLIB_Name, "4plbx3?" );
            } else {
                strcpy( WCPPLIB_Name, "4plbxmt3?" );
            }
        } else {
            strcpy( WCPPLIB_Name, "4plbx3?" );
        }
    } else {
        strcpy( WCPPDLL_Name, "3plb?dll" );
        if( data->bm ) { // .DLL
            strcpy( DLL_WCPPLIB_Name, "4plibmt3?" );
        } else {
            if( control & MMC_WIN ) {
                strcpy( DLL_WCPPLIB_Name, "4plib3?" );
            } else {
                strcpy( DLL_WCPPLIB_Name, "4plibmt3?" );
            }
        }
        if( data->bm ) {
            strcpy( WCPPLIB_Name, "4plibmt3?" );
        } else if( data->bd ) {
            if( control & MMC_WIN ) {
                strcpy( WCPPLIB_Name, "4plib3?" );
            } else {
                strcpy( WCPPLIB_Name, "4plibmt3?" );
            }
        } else {
            strcpy( WCPPLIB_Name, "4plib3?" );
        }
    }
    if( GET_FPU_EMU( CpuSwitches ) ) {
        if( data->br ) {
            strcpy( MATHLIB_Name, "7mt7?dll" );
        } else {
            strcpy( MATHLIB_Name, "7math387?" );
        }
        EmuLib_Name = "8emu387";
    } else if( GET_FPU_LEVEL( CpuSwitches ) == FPU_NONE ) {
        if( data->br ) {
            strcpy( MATHLIB_Name, "5mth?dll" );
        } else {
            strcpy( MATHLIB_Name, "5math3?" );
        }
        EmuLib_Name = NULL;
    } else {
        if( data->br ) {
            strcpy( MATHLIB_Name, "7mt7?dll" );
        } else {
            strcpy( MATHLIB_Name, "7math387?" );
        }
        EmuLib_Name = "8noemu387";
    }
    *strchr( CDLL_Name, '?' ) = model;
    *strchr( WCPPDLL_Name, '?' ) = model;
#endif
    *strchr( CLIB_Name, '?' ) = model;
    *strchr( MATHLIB_Name, '?' ) = model;
    *strchr( WCPPLIB_Name, '?' ) = model;
    *strchr( DLL_CLIB_Name, '?' ) = model;
    *strchr( DLL_WCPPLIB_Name, '?' ) = model;
}
Esempio n. 10
0
static void setFinalTargetSystem( OPT_STORAGE *data, char *target_name )
{
    char buff[128];

    TargetSystem = TS_OTHER;
    if( CompFlags.oldmacros_enabled ) {
#if _CPU == 8086
        PreDefineStringMacro( "M_I86" );
#else
        PreDefineStringMacro( "M_I386" );
#endif
    }
#if _CPU == 8086
    PreDefineStringMacro( "_M_I86" );
    PreDefineStringMacro( "__I86__" );
#else
    PreDefineStringMacro( "_M_I386" );
    PreDefineStringMacro( "__386__" );
#endif
    PreDefineStringMacro( "__X86__" );
    PreDefineStringMacro( "_X86_" );
    if( target_name == NULL ) {
#if defined( __OSI__ )
        switch( __OS ) {
        case OS_DOS:
        case OS_WIN:
            SetTargetLiteral( &target_name, "DOS" );
            break;
        case OS_OS2:
            SetTargetLiteral( &target_name, "OS2" );
            break;
        case OS_NT:
            SetTargetLiteral( &target_name, "NT" );
            break;
        }
#elif defined( __QNX__ )
        SetTargetLiteral( &target_name, "QNX" );
#elif defined( __LINUX__ )
        SetTargetLiteral( &target_name, "LINUX" );
#elif defined( __OSX__ ) || defined( __APPLE__ )
        SetTargetLiteral( &target_name, "OSX" );
#elif defined( __SOLARIS__ ) || defined( __SUN__ )
        SetTargetLiteral( &target_name, "SOLARIS" );
#elif defined( __OS2__ )
        SetTargetLiteral( &target_name, "OS2" );
#elif defined( __NT__ )
        SetTargetLiteral( &target_name, "NT" );
#elif defined( __DOS__ )
        SetTargetLiteral( &target_name, "DOS" );
#elif defined( __BSD__ )
        SetTargetLiteral( &target_name, "BSD" );
#else
        #error "Target System not defined"
#endif
    }
    if( 0 == strcmp( target_name, "DOS" ) ) {
        TargetSystem = TS_DOS;
        if( CompFlags.oldmacros_enabled ) {
            PreDefineStringMacro( "MSDOS" );
        }
        PreDefineStringMacro( "__DOS__" );
        PreDefineStringMacro( "_DOS" );
#if _CPU == 386
    } else if( 0 == strcmp( target_name, "NETWARE" ) ) {
        TargetSystem = TS_NETWARE;
        PreDefineStringMacro( "__NETWARE_386__" );
    } else if( 0 == strcmp( target_name, "NETWARE5" ) ) {
        TargetSystem = TS_NETWARE5;
        PreDefineStringMacro( "__NETWARE_386__" );
        PreDefineStringMacro( "__NETWARE__" );
        /* can get away with this because "netware5" is longer */
        strcpy( target_name, "NETWARE" );
    } else if( 0 == strcmp( target_name, "NT" ) ) {
        PreDefineStringMacro( "_WIN32" );
        TargetSystem = TS_NT;
    } else if( 0 == strcmp( target_name, "OS2" ) ) {
        TargetSystem = TS_OS2;
    } else if( 0 == strcmp( target_name, "QNX" ) ) {
        TargetSystem = TS_QNX;
        PreDefineStringMacro( "__QNX__" );
        PreDefineStringMacro( "__UNIX__" );
    } else if( 0 == strcmp( target_name, "LINUX" ) ) {
        TargetSystem = TS_LINUX;
        PreDefineStringMacro( "__LINUX__" );
        PreDefineStringMacro( "__UNIX__" );
#endif
    } else if( 0 == strcmp( target_name, "WINDOWS" ) ) {
        TargetSystem = TS_WINDOWS;
        setWindowsSystem();
    } else if( 0 == strcmp( target_name, "CHEAP_WINDOWS" ) ) {
#if _CPU == 8086
        TargetSystem = TS_CHEAP_WINDOWS;
#else
        TargetSystem = TS_WINDOWS;
#endif
        /* can get away with this because "cheap_windows" is longer */
        strcpy( target_name, "WINDOWS" );
        setWindowsSystem();
    } else {
        TargetSystem = TS_OTHER;
    }
    strcpy( buff, "__" );
    strcat( buff, target_name );
    strcat( buff, "__" );
    PreDefineStringMacro( buff );

    /*
    //  Note the hacks for windows/cheap_windows & netware/netware5, above.
    */
    strcpy( buff, target_name );
    strcat( buff, "_INCLUDE" );
    MergeIncludeFromEnv( buff );

    MergeIncludeFromEnv( "INCLUDE" );
    CMemFree( target_name );
    if( data->bm ) {
        CompFlags.target_multi_thread = 1;
    }
    if( data->bd ) {
        switch( TargetSystem ) {
        case TS_WINDOWS:
#if _CPU == 8086
        case TS_CHEAP_WINDOWS:
#endif
            break;
        default:
            CompFlags.target_multi_thread = 1;
        }
    }
}