Changeset 8360 for trunk/tools/common


Ignore:
Timestamp:
May 1, 2002, 5:58:37 AM (23 years ago)
Author:
bird
Message:

Support for other watcom target OSes.

Location:
trunk/tools/common
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/common/kDef2Wat.cpp

    r8003 r8360  
    1 /* $Id: kDef2Wat.cpp,v 1.3 2002-02-24 02:47:23 bird Exp $
     1/* $Id: kDef2Wat.cpp,v 1.4 2002-05-01 03:58:36 bird Exp $
    22 *
    33 * Converter for IBM/MS linker definition files (.DEF) to Watcom linker directives and options.
     
    2020#include "kFileFormatBase.h"
    2121#include "kFileDef.h"
     22
     23#include <stdio.h>
     24#include <string.h>
    2225
    2326/*******************************************************************************
     
    4245    const char *pszOutput;
    4346    const char *pszAppend;
     47    const char *pszOS;
     48    int         enmOS;
    4449
    4550    /* check arguments */
    46     if (argc != 3 && argc != 4)
     51    if (argc != 4 && argc != 5)
    4752    {
    4853        syntax();
    4954        return -1;
    5055    }
    51     pszInput  = argv[1];
    52     pszOutput = argv[2];
    53     pszAppend = (argc == 4) ? argv[3] : NULL;
     56    pszOS     = argv[1];
     57    pszInput  = argv[2];
     58    pszOutput = argv[3];
     59    pszAppend = (argc == 5) ? argv[4] : NULL;
     60    if (!stricmp(pszOS, "os2"))
     61        enmOS = kFileDef::os2;
     62    else if (!stricmp(pszOS, "dos"))
     63        enmOS = kFileDef::dos;
     64    else if (!stricmp(pszOS, "win32"))
     65        enmOS = kFileDef::win32;
     66    else if (!stricmp(pszOS, "win16"))
     67        enmOS = kFileDef::win16;
     68    else if (!stricmp(pszOS, "nlm"))
     69        enmOS = kFileDef::nlm;
     70    else if (!stricmp(pszOS, "qnx"))
     71        enmOS = kFileDef::qnx;
     72    else if (!stricmp(pszOS, "elf"))
     73        enmOS = kFileDef::elf;
     74    else
     75    {
     76        printf("Invalid os string '%s'.\n", pszOS);
     77        syntax();
     78        return -1;
     79    }
    5480
    5581    /*
     
    6490            OutFile.end();
    6591
    66             def.makeWatcomLinkFileAddtion(&OutFile);
     92            def.makeWatcomLinkFileAddtion(&OutFile, enmOS);
    6793            if (pszAppend)
    6894            {
     
    103129{
    104130    kFile::StdOut.printf(
    105         "kDef2Wat v0.0.0 (untested)\n"
     131        "kDef2Wat v0.0.1\n"
    106132        "\n"
    107         "syntax: kDef2Wat.exe <def-file> <wlink-file> [extra-file]\n"
     133        "syntax: kDef2Wat.exe <os> <def-file> <wlink-file> [extra-file]\n"
    108134        "\n"
    109135        "Where:\n"
     136        "    <os>           Target os. os2, dos, win32, win16, nlm, qnx or elf.\n"
    110137        "    <def-file>     The .DEF file to convert.\n"
    111138        "    <wlink-file>   The WLINK directive and option file.\n"
     
    113140        "                   the wlink-file\n"
    114141        "\n"
    115         "Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)\n"
     142        "Copyright (c) 2000-2002 knut st. osmundsen (bird@anduin.net)\n"
    116143        );
    117144}
  • trunk/tools/common/kFileDef.cpp

    r8003 r8360  
    1 /* $Id: kFileDef.cpp,v 1.8 2002-02-24 02:47:25 bird Exp $
     1/* $Id: kFileDef.cpp,v 1.9 2002-05-01 03:58:36 bird Exp $
    22 *
    33 * kFileDef - Definition files.
     
    644644 * @param   pFile   File which we're to write to (append).
    645645 *                  Appends at current posistion.
     646 * @param   enmOS   The target OS of the link operation.
    646647 * @sketch
    647648 * @status
     
    649650 * @remark
    650651 */
    651 KBOOL kFileDef::makeWatcomLinkFileAddtion(kFile *pOut)
     652KBOOL kFileDef::makeWatcomLinkFileAddtion(kFile *pOut, int enmOS)
    652653{
    653654    PDEFSEGMENT pSeg;
     
    662663
    663664    /* Format - Module type */
    664     pOut->printf("FORMAT OS2 LX %s %s %s\n",
    665                   fLibrary                               ? "DLL" :
    666                     (fProgram ? (chAppType == pm         ? "PM"
    667                               : (chAppType == fullscreen ? "FULLSCREEN"
    668                                                          : "PMCOMPATIBLE"))
    669                     : (fVirtualDevice                    ? "VIRTDEVICE"
    670                                                          : "PHYSDEVICE" )),
    671                   fLibrary ? (fInitGlobal ? "INITGLOBAL" : "INITINSTANCE") : "",
    672                   fLibrary ? (fTermGlobal ? "TERMGLOBAL" : "TERMINSTANCE") : "");
     665    switch (enmOS)
     666    {
     667        case kFileDef::os2:
     668            pOut->printf("FORMAT OS2 LX %s %s %s\n",
     669                          fLibrary                               ? "DLL" :
     670                            (fProgram ? (chAppType == pm         ? "PM"
     671                                      : (chAppType == fullscreen ? "FULLSCREEN"
     672                                                                 : "PMCOMPATIBLE"))
     673                            : (fVirtualDevice                    ? "VIRTDEVICE"
     674                                                                 : "PHYSDEVICE" )),
     675                          fLibrary ? (fInitGlobal ? "INITGLOBAL" : "INITINSTANCE") : "",
     676                          fLibrary ? (fTermGlobal ? "TERMGLOBAL" : "TERMINSTANCE") : "");
     677            break;
     678
     679        case kFileDef::win32:
     680            if (fLibrary)
     681                pOut->printf("FORMAT Window NT DLL %s %s\n"
     682                             "Runtime Windows\n",
     683                             fLibrary ? (fInitGlobal ? "INITGLOBAL" : "INITINSTANCE") : "",
     684                             fLibrary ? (fTermGlobal ? "TERMGLOBAL" : "TERMINSTANCE") : "");
     685            else
     686                pOut->printf("FORMAT Window NT\n"
     687                             "Runtime %s\n",
     688                             fProgram ? chAppType == pm  ? "Windows" : "Console" : "Native");
     689            break;
     690        default:
     691            return FALSE;
     692    }
    673693
    674694
     
    694714
    695715    /* Protected mode */
    696     if (pszProtmode)
     716    if (pszProtmode && (enmOS == kFileDef::os2))
    697717        pOut->printf("OPTION PROTMODE\n", pszProtmode);
    698718
     
    743763        if (pExp->pszIntName)
    744764            pOut->printf("='%s'", pExp->pszIntName);
    745         if (pExp->fResident)
     765        if (pExp->fResident && (enmOS == kFileDef::os2 || enmOS == kFileDef::win16))
    746766            pOut->printf(" RESIDENT");
    747767        if (pExp->cParam != ~0UL)
  • trunk/tools/common/kFileDef.h

    r8003 r8360  
    132132
    133133        /**@cat Operations */
    134         KBOOL       makeWatcomLinkFileAddtion(kFile *pFile) throw(kError);
     134        KBOOL       makeWatcomLinkFileAddtion(kFile *pFile, int enmOS) throw(kError);
    135135
    136136        enum {fullscreen = 0, pmvio = 2, pm = 3, unknown = 255};
     137        enum {os2, dos, win32, win16, nlm, qnx, elf};
    137138};
    138139
Note: See TracChangeset for help on using the changeset viewer.