[824] | 1 | /*
|
---|
| 2 | * kFileDef - Definition files.
|
---|
| 3 | *
|
---|
| 4 | * Copyright (c) 1999 knut st. osmundsen
|
---|
| 5 | *
|
---|
| 6 | */
|
---|
| 7 | #ifndef _kFileDef_h_
|
---|
| 8 | #define _kFileDef_h_
|
---|
| 9 |
|
---|
| 10 | /*******************************************************************************
|
---|
| 11 | * Defined Constants *
|
---|
| 12 | *******************************************************************************/
|
---|
| 13 | #define ORD_START_INTERNAL_FUNCTIONS 1200
|
---|
| 14 |
|
---|
| 15 |
|
---|
| 16 | /*******************************************************************************
|
---|
| 17 | * Structures and Typedefs *
|
---|
| 18 | *******************************************************************************/
|
---|
| 19 |
|
---|
| 20 | /**
|
---|
| 21 | * Segment list entry.
|
---|
| 22 | */
|
---|
| 23 | typedef struct _DefSegment
|
---|
| 24 | {
|
---|
| 25 | char *psz;
|
---|
[9162] | 26 | char *pszName;
|
---|
| 27 | char *pszClass;
|
---|
| 28 | char *pszAttr;
|
---|
[824] | 29 | struct _DefSegment *pNext;
|
---|
| 30 | } DEFSEGMENT, *PDEFSEGMENT;
|
---|
| 31 |
|
---|
| 32 |
|
---|
| 33 |
|
---|
| 34 | /**
|
---|
| 35 | * Import list entry.
|
---|
| 36 | */
|
---|
| 37 | typedef struct _DefImport
|
---|
| 38 | {
|
---|
| 39 | unsigned long ulOrdinal;
|
---|
| 40 | char *pszName;
|
---|
| 41 | char *pszDll;
|
---|
| 42 | char *pszIntName;
|
---|
| 43 | struct _DefImport *pNext;
|
---|
| 44 | } DEFIMPORT, *PDEFIMPORT;
|
---|
| 45 |
|
---|
| 46 |
|
---|
| 47 | /**
|
---|
| 48 | * Export list entry.
|
---|
| 49 | */
|
---|
| 50 | typedef struct _DefExport
|
---|
| 51 | {
|
---|
| 52 | unsigned long ulOrdinal;
|
---|
| 53 | char *pszName;
|
---|
| 54 | char *pszIntName;
|
---|
[8003] | 55 | KBOOL fResident;
|
---|
[4402] | 56 | unsigned long cParam;
|
---|
[824] | 57 | struct _DefExport *pNext;
|
---|
| 58 | } DEFEXPORT, *PDEFEXPORT;
|
---|
| 59 |
|
---|
| 60 |
|
---|
| 61 | /**
|
---|
| 62 | * Definition files.
|
---|
| 63 | * TODO: error handling.
|
---|
| 64 | * @author knut st. osmundsen
|
---|
| 65 | */
|
---|
[5531] | 66 | class kFileDef : public kExportI, public kFileFormatBase, public kModuleI
|
---|
[824] | 67 | {
|
---|
| 68 | private:
|
---|
| 69 | /**@cat pointers to different sections */
|
---|
| 70 | char *pszType;
|
---|
[8003] | 71 | KBOOL fProgram;
|
---|
| 72 | KBOOL fLibrary;
|
---|
| 73 | KBOOL fPhysicalDevice;
|
---|
| 74 | KBOOL fVirtualDevice;
|
---|
| 75 | KBOOL fInitInstance;
|
---|
| 76 | KBOOL fTermInstance;
|
---|
| 77 | KBOOL fInitGlobal;
|
---|
| 78 | KBOOL fTermGlobal;
|
---|
[4402] | 79 | char *pszModName;
|
---|
| 80 | char chAppType;
|
---|
| 81 |
|
---|
[824] | 82 | char *pszBase;
|
---|
| 83 | char *pszCode;
|
---|
| 84 | char *pszData;
|
---|
| 85 | char *pszDescription;
|
---|
| 86 | char *pszExeType;
|
---|
| 87 | char *pszHeapSize;
|
---|
| 88 | char *pszOld;
|
---|
| 89 | char *pszProtmode;
|
---|
| 90 | char *pszStackSize;
|
---|
| 91 | char *pszStub;
|
---|
| 92 |
|
---|
| 93 | /**@cat Lists to multistatement sections */
|
---|
| 94 | PDEFSEGMENT pSegments;
|
---|
| 95 | PDEFIMPORT pImports;
|
---|
| 96 | PDEFEXPORT pExports;
|
---|
| 97 |
|
---|
| 98 | /**@cat internal functions */
|
---|
[8003] | 99 | void read(kFile *pFile) throw (kError);
|
---|
| 100 | char *readln(kFile *pFile, char *pszBuffer, int cbBuffer) throw (kError);
|
---|
| 101 | KBOOL isKeyword(const char *psz);
|
---|
| 102 | KBOOL setModuleName(void);
|
---|
[824] | 103 |
|
---|
| 104 | public:
|
---|
| 105 | /**@cat Constructor/Destructor */
|
---|
[8003] | 106 | kFileDef(kFile *pFile) throw(kError);
|
---|
[21916] | 107 | virtual ~kFileDef() throw (kError);
|
---|
[824] | 108 |
|
---|
[5531] | 109 | /** @cat Module information methods. */
|
---|
[8003] | 110 | KBOOL moduleGetName(char *pszBuffer, int cchSize = 260);
|
---|
[5531] | 111 |
|
---|
| 112 | /** @cat Export enumeration methods. */
|
---|
[8003] | 113 | KBOOL exportFindFirst(kExportEntry *pExport);
|
---|
| 114 | KBOOL exportFindNext(kExportEntry *pExport);
|
---|
[5531] | 115 | void exportFindClose(kExportEntry *pExport);
|
---|
| 116 |
|
---|
| 117 | /** @cat Export Lookup methods */
|
---|
[8003] | 118 | KBOOL exportLookup(unsigned long ulOrdinal, kExportEntry *pExport);
|
---|
| 119 | KBOOL exportLookup(const char * pszName, kExportEntry *pExport);
|
---|
[5531] | 120 |
|
---|
[824] | 121 | /**@cat queries... */
|
---|
[8003] | 122 | KBOOL isDef() const { return TRUE;}
|
---|
[4402] | 123 | char const *queryModuleName(void) const { return pszModName; }
|
---|
[824] | 124 | char const *queryType(void) const { return pszType; }
|
---|
| 125 | char const *queryBase(void) const { return pszBase; }
|
---|
| 126 | char const *queryCode(void) const { return pszCode; }
|
---|
| 127 | char const *queryData(void) const { return pszData; }
|
---|
| 128 | char const *queryDescription(void) const { return pszDescription; }
|
---|
| 129 | char const *queryExeType(void) const { return pszExeType; }
|
---|
| 130 | char const *queryHeapSize(void) const { return pszHeapSize; }
|
---|
| 131 | char const *queryOld(void) const { return pszOld; }
|
---|
| 132 | char const *queryProtmode(void) const { return pszProtmode; }
|
---|
| 133 | char const *queryStackSize(void) const { return pszStackSize; }
|
---|
| 134 | char const *queryStub(void) const { return pszStub; }
|
---|
[4402] | 135 |
|
---|
| 136 | /**@cat Operations */
|
---|
[8360] | 137 | KBOOL makeWatcomLinkFileAddtion(kFile *pFile, int enmOS) throw(kError);
|
---|
[4402] | 138 |
|
---|
| 139 | enum {fullscreen = 0, pmvio = 2, pm = 3, unknown = 255};
|
---|
[9132] | 140 | enum {os2, os2v1, dos, win32, win16, nlm, qnx, elf};
|
---|
[824] | 141 | };
|
---|
| 142 |
|
---|
| 143 | #endif
|
---|