Пример #1
0
void ActionInit( cmdline_t *cmd ) {
/*******************************/
    act_grp_t   *cur;
    int         os2_specific;

/**/myassert( cmd != NULL && cmd->action != NULL );
    cur = cmd->action;
    cmdLine.quiet = cmdLine.action->quiet;
    os2_specific = 0;
    switch( cur->omf_generator ) {
    case OGEN_NULL:
        cmd->need_output = 0;
        break;
    case OGEN_MICROSOFT_OS2:
        os2_specific = 1;
        /* fall through */
    case OGEN_MICROSOFT:
        GenMSOmfInit();
        cmd->need_output = 1;
        break;
    case OGEN_PHARLAP:
        GenPharInit();
        cmd->need_output = 1;
        break;
    default:
/**/    never_reach();
    }
    switch( cur->dbg_generator ) {
    case DGEN_NULL:
        break;
    case DGEN_TXT:
        Can2TxtInit();
        break;
    case DGEN_MICROSOFT:
        Can2MsInit( 0, os2_specific );
        break;
    case DGEN_METAWARE:
        Can2MsInit( 1, os2_specific );
        break;
    case DGEN_TURBO:
        Can2TDInit();
        break;
    default:
/**/    never_reach();
    }
    if( cur->deflib ) {
        DefLibInit();
    }
    switch( cur->dbg_parser ) {
    case PARSE_NULL:                            break;
    case PARSE_WATCOM:      Wat2CanInit( 0 );   break;
    case PARSE_WATCOM_70:   Wat2CanInit( 1 );   break;
    default:
/**/    never_reach();
    }
}
Пример #2
0
void ActionFini( cmdline_t *cmd ) {
/*******************************/

    act_grp_t   *cur;
    act_grp_t   *next;
    size_t      file_num;
    size_t      num_files;

/**/myassert( cmd != NULL && cmd->action != NULL );
    cur = cmd->action;
    switch( cur->dbg_parser ) {
    case PARSE_NULL:                            break;
    case PARSE_WATCOM:      Wat2CanFini();      break;
    case PARSE_WATCOM_70:   Wat2CanFini();      break;
    default:
/**/    never_reach();
    }
    if( cur->deflib ) {
        DefLibFini();
    }
    switch( cur->dbg_generator ) {
    case DGEN_NULL:                             break;
    case DGEN_TXT:          Can2TxtFini();      break;
    case DGEN_MICROSOFT:    Can2MsFini();       break;
    case DGEN_METAWARE:     Can2MsFini();       break;
    case DGEN_TURBO:        Can2TDFini();       break;
    default:
/**/    never_reach();
    }
    switch( cur->omf_generator ) {
    case OGEN_NULL:                             break;
    case OGEN_MICROSOFT_OS2:GenMSOmfFini();     break;
    case OGEN_MICROSOFT:    GenMSOmfFini();     break;
    case OGEN_PHARLAP:      GenPharFini();      break;
    default:
/**/    never_reach();
    }
    if( cur->output != NULL ) {
        MemFree( cur->output );
    }
    num_files = cur->num_files;
    for( file_num = 0; file_num < num_files; ++file_num ) {
        MemFree( cur->files[ file_num ] );
    }
    next = cur->next;
    MemFree( cur );
    cmd->action = next;
}
Пример #3
0
STATIC int writeSegdef( obj_rec *objr, pobj_state *state ) {

    OBJ_WFILE   *out;
    int         is32;
    uint_8      acbp;
    uint_8      align;
#if ( _WOMP_OPT & _WOMP_NASM )
    obj_offset  patch;
#endif

    /**/myassert( objr != NULL );
    /**/myassert( objr->command == CMD_SEGDEF );
    /**/myassert( state != NULL );
    /**/myassert( state->pass == POBJ_WRITE_PASS );
    out = state->file_out;
#if ( _WOMP_OPT & _WOMP_WATFOR ) == 0
    is32 = objr->d.segdef.use_32 != 0;
#else
#ifdef _WOMP_WATFOR_8086
    is32 = 0;
#else
    is32 = 1;
#endif
#endif
    ObjWBegRec( out, is32 ? CMD_SEGD32 : CMD_SEGDEF );
    acbp = objr->d.segdef.combine << 2;
    if( is32 ) {
        acbp |= 1;
    }
    align = objr->d.segdef.align;
    switch( align ) {
    case SEGDEF_ALIGN_ABS:
        acbp |= ALIGN_ABS << 5;
        break;
    case SEGDEF_ALIGN_BYTE:
        acbp |= ALIGN_BYTE << 5;
        break;
    case SEGDEF_ALIGN_WORD:
        acbp |= ALIGN_WORD << 5;
        break;
    case SEGDEF_ALIGN_PARA:
        acbp |= ALIGN_PARA << 5;
        break;
    case SEGDEF_ALIGN_PAGE:
        acbp |= ALIGN_PAGE << 5;
        break;
    case SEGDEF_ALIGN_DWORD:
        acbp |= ALIGN_DWORD << 5;
        break;
    case SEGDEF_ALIGN_4KPAGE:
        acbp |= ALIGN_PAGE;
#if _WOMP_OPT & _WOMP_EXTRAS
        PrtMsg( WRN|MSG_MS386_NO_4KPAGE );
#endif
        break;
    default:
        /**/
        never_reach();
    }
    if( !is32 && objr->d.segdef.seg_length == 0x10000 ) {
        acbp |= 0x02;   /* BIG bit */ /* FIXME no support for 2**32 */
    }
    ObjWrite8( out, acbp );
#if ( _WOMP_OPT & _WOMP_WATFOR ) == 0
    if( align == SEGDEF_ALIGN_ABS ) {
        // absolut segment has frame=word and offset=byte
        // it isn't fixupp physical reference
        // and don't depend on segment size (16/32bit)
        ObjWrite16( out, objr->d.segdef.abs.frame );
        ObjWrite8( out, (uint_8)objr->d.segdef.abs.offset );
    }
#endif
    if( is32 ) {
#if ( _WOMP_OPT & _WOMP_NASM )
        patch = ObjWSkip32( out );
#else
        ObjWrite32( out, objr->d.segdef.seg_length );
#endif
    } else {
#if ( _WOMP_OPT & _WOMP_NASM )
        patch = ObjWSkip16( out );
#else
        ObjWrite16( out, (uint_16)objr->d.segdef.seg_length );
#endif
    }
#if ( _WOMP_OPT & _WOMP_NASM )
    /**/myassert( objr->data != NULL );
    memcpy( objr->data, &patch, sizeof patch);
#endif
    ObjWriteIndex( out, objr->d.segdef.seg_name_idx );
    ObjWriteIndex( out, objr->d.segdef.class_name_idx );
#if ( _WOMP_OPT & _WOMP_WATFOR ) == 0
    ObjWriteIndex( out, objr->d.segdef.ovl_name_idx );
#if ( _WOMP_OPT & _WOMP_EXTRAS )
    if( objr->d.segdef.access_valid ) {
        PrtMsg( MSG_MS386_NO_ACCESS );
    }
#endif
#else
    ObjWriteIndex( out, 1 );
#endif
    ObjWEndRec( out );
    return( 0 );
}