Ejemplo n.º 1
0
static void do_init_stuff( char **cmdline )
/*****************************************/
{
    char        *env;
    char        buff[80];

    if( !MsgInit() )
        exit(1);

    AsmInit( -1, -1, -1, -1 );                // initialize hash table
    strcpy( buff, "__WASM__=" BANSTR( _BANVER ) );
    add_constant( buff );
    ForceInclude = getenv( "FORCE" );
    do_envvar_cmdline( "WASM" );
    parse_cmdline( cmdline );
    set_build_target();
    get_os_include();
    env = getenv( "INCLUDE" );
    if( env != NULL )
        AddStringToIncludePath( env );
    if( !Options.quiet && !Options.banner_printed ) {
        Options.banner_printed = TRUE;
        trademark();
    }
    open_files();
    PushLineQueue();
    AsmLookup( "$" );    // create "$" symbol for current segment counter
}
Ejemplo n.º 2
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__=" BANSTR( _BANVER ) );
    PreDefineStringMacro( "__WATCOM_CPLUSPLUS__=" BANSTR( _BANVER ) );
    // #if __WATCOM_REVISION__ >= 8
    PreDefineStringMacro( "__WATCOM_REVISION__=8" );
    if( ! PragToggle.check_stack ) {
        DefSwitchMacro( "S" );
    }
    RingNameFree( &undef_names );
}
Ejemplo n.º 3
0
static void do_init_stuff( char **cmdline )
/*****************************************/
{
    char        *env;

    if( !MsgInit() )
        exit(1);

    add_constant( "WASM=" BANSTR( _BANVER ), true );
    ForceInclude = AsmStrDup( getenv( "FORCE" ) );
    do_envvar_cmdline( "WASM" );
    parse_cmdline( cmdline );
    set_build_target();
    set_cpu_mode();
    set_fpu_mode();
    get_os_include();
    env = getenv( "INCLUDE" );
    if( env != NULL )
        AddItemToIncludePath( env, NULL );
    PrintBanner();
    open_files();
    PushLineQueue();
}
Ejemplo n.º 4
0
extern bool OptionsInit( int argc, char **argv ) {
//************************************************

    char        *s;

#ifdef AS_ALPHA
    s = "__WASAXP__=" BANSTR( _BANVER ) ;
#elif defined( AS_PPC )
    s = "__WASPPC__=" BANSTR( _BANVER ) ;
#elif defined( AS_MIPS )
    s = "__WASMPS__=" BANSTR( _BANVER ) ;
#endif
    maxNumPredefines = argc + 2; // version macro and extra null at the end
    if( !optionsPredefine( s ) )
        goto errInvalid;

    while( *argv ) {
        if( argv[0][0] == '-' || argv[0][0] == '/' ) {
            s = &argv[0][2];
            switch( argv[0][1] ) {
            case 'b':
            case 'B':
                // ignore the -bt=NT crap
                break;
            case 'd':
            case 'D':
                if( isdigit( *s ) ) {
                    DebugLevel = strtoul( s, &s, 10 );
                } else if( !optionsPredefine( s ) ) {
                    goto errInvalid;
                }
                break;
            case 'e':
                if( *s == '\0' ) goto errInvalid;
                ErrorLimit = strtoul( s, &s, 10 );
                if( *s != '\0' ) goto errInvalid;
                break;
            case 'f':
            case 'F':
                switch( *s ) {
                case 'o':
                    ++s;
                    if( *s == '=' ) ++s;
                    if( *s == '\0' ) goto errInvalid;
                    ObjSetObjFile( s );
                    break;
                default:
                    goto errInvalid;
                }
                break;
            case 'h':
            case '?':
                _SetOption( PRINT_HELP );
                break;
            case 'i':
            case 'I':
                if( *s == '=' ) {
                    ++s;
                }
                if( *s == '\0' ) break;
                if( AsIncPath ) { // Additional /i switch
                    AsIncPath = MemRealloc( AsIncPath, strlen( AsIncPath ) +
                        strlen( s ) + 2 );      // for ';' and EOL
                    strcat( AsIncPath, ";" );
                    strcat( AsIncPath, s );
                } else { // First /i switch
                    AsIncPath = MemAlloc( strlen( s ) + 1 );
                    strcpy( AsIncPath, s );
                }
                break;
            case 'o':
                switch( *s ) {
                case 'c':
                    _SetOption( OBJ_COFF );
                    break;
                case 'e': // ELF
                    _UnsetOption( OBJ_COFF );
                    break;
                default:
                    goto errInvalid;
                }
                if( *++s != '\0' ) goto errInvalid;
                break;
            case 'q':
                _SetOption( BE_QUIET );
                break;
            case 'w':
                if( isdigit( *s ) ) {
                    WarningLevel = strtoul( s, &s, 10 );
                } else {
                    switch( *s ) {
                    case 'e':
                        _SetOption( WARNING_ERROR );
                        break;
                    default:
                        goto errInvalid;
                    }
                }
                break;
            case 'z':
                switch( *s ) {
                case 'q':
                    _SetOption( BE_QUIET );
                    break;
                default:
                    goto errInvalid;
                }
                break;
#ifndef NDEBUG
            case 'v':
                while( *s ) {
                    switch( *s ) {
                    case 'p':
                        _SetOption( DUMP_PARSE_TREE );
                        break;
                    case 't':
                        _SetOption( DUMP_INS_TABLE );
                        break;
                    case 'i':
                        _SetOption( DUMP_INSTRUCTIONS );
                        break;
                    case 's':
                        _SetOption( DUMP_SYMBOL_TABLE );
                        break;
                    case 'l':
                        _SetOption( DUMP_LEXER_BUFFER );
                        break;
                    case 'd':
                        _SetOption( DUMP_DEBUG_MSGS );
                        break;
                    default:
                        goto errInvalid;
                    }
                    s++;
                }
                break;
#endif
            default:
            errInvalid:
                Banner();
                AsOutMessage( stderr, AS_MSG_ERROR );
                AsOutMessage( stderr, INVALID_OPTION, *argv );
                fputc( '\n', stderr );
                return( FALSE );
                break;
            }
            memcpy( argv, argv+1, sizeof( *argv ) * argc );
        } else {
            argv++;
        }
        argc--;
        maxNumPredefines--;
    }
    return( TRUE );
}