Changeset 8360 for trunk/tools
- Timestamp:
- May 1, 2002, 5:58:37 AM (23 years ago)
- 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:23bird Exp $1 /* $Id: kDef2Wat.cpp,v 1.4 2002-05-01 03:58:36 bird Exp $ 2 2 * 3 3 * Converter for IBM/MS linker definition files (.DEF) to Watcom linker directives and options. … … 20 20 #include "kFileFormatBase.h" 21 21 #include "kFileDef.h" 22 23 #include <stdio.h> 24 #include <string.h> 22 25 23 26 /******************************************************************************* … … 42 45 const char *pszOutput; 43 46 const char *pszAppend; 47 const char *pszOS; 48 int enmOS; 44 49 45 50 /* check arguments */ 46 if (argc != 3 && argc != 4)51 if (argc != 4 && argc != 5) 47 52 { 48 53 syntax(); 49 54 return -1; 50 55 } 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 } 54 80 55 81 /* … … 64 90 OutFile.end(); 65 91 66 def.makeWatcomLinkFileAddtion(&OutFile );92 def.makeWatcomLinkFileAddtion(&OutFile, enmOS); 67 93 if (pszAppend) 68 94 { … … 103 129 { 104 130 kFile::StdOut.printf( 105 "kDef2Wat v0.0. 0 (untested)\n"131 "kDef2Wat v0.0.1\n" 106 132 "\n" 107 "syntax: kDef2Wat.exe < def-file> <wlink-file> [extra-file]\n"133 "syntax: kDef2Wat.exe <os> <def-file> <wlink-file> [extra-file]\n" 108 134 "\n" 109 135 "Where:\n" 136 " <os> Target os. os2, dos, win32, win16, nlm, qnx or elf.\n" 110 137 " <def-file> The .DEF file to convert.\n" 111 138 " <wlink-file> The WLINK directive and option file.\n" … … 113 140 " the wlink-file\n" 114 141 "\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" 116 143 ); 117 144 } -
trunk/tools/common/kFileDef.cpp
r8003 r8360 1 /* $Id: kFileDef.cpp,v 1. 8 2002-02-24 02:47:25bird Exp $1 /* $Id: kFileDef.cpp,v 1.9 2002-05-01 03:58:36 bird Exp $ 2 2 * 3 3 * kFileDef - Definition files. … … 644 644 * @param pFile File which we're to write to (append). 645 645 * Appends at current posistion. 646 * @param enmOS The target OS of the link operation. 646 647 * @sketch 647 648 * @status … … 649 650 * @remark 650 651 */ 651 KBOOL kFileDef::makeWatcomLinkFileAddtion(kFile *pOut )652 KBOOL kFileDef::makeWatcomLinkFileAddtion(kFile *pOut, int enmOS) 652 653 { 653 654 PDEFSEGMENT pSeg; … … 662 663 663 664 /* 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 } 673 693 674 694 … … 694 714 695 715 /* Protected mode */ 696 if (pszProtmode )716 if (pszProtmode && (enmOS == kFileDef::os2)) 697 717 pOut->printf("OPTION PROTMODE\n", pszProtmode); 698 718 … … 743 763 if (pExp->pszIntName) 744 764 pOut->printf("='%s'", pExp->pszIntName); 745 if (pExp->fResident )765 if (pExp->fResident && (enmOS == kFileDef::os2 || enmOS == kFileDef::win16)) 746 766 pOut->printf(" RESIDENT"); 747 767 if (pExp->cParam != ~0UL) -
trunk/tools/common/kFileDef.h
r8003 r8360 132 132 133 133 /**@cat Operations */ 134 KBOOL makeWatcomLinkFileAddtion(kFile *pFile ) throw(kError);134 KBOOL makeWatcomLinkFileAddtion(kFile *pFile, int enmOS) throw(kError); 135 135 136 136 enum {fullscreen = 0, pmvio = 2, pm = 3, unknown = 255}; 137 enum {os2, dos, win32, win16, nlm, qnx, elf}; 137 138 }; 138 139
Note:
See TracChangeset
for help on using the changeset viewer.