| 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;
|
|---|
| 26 | struct _DefSegment *pNext;
|
|---|
| 27 | } DEFSEGMENT, *PDEFSEGMENT;
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 | /**
|
|---|
| 32 | * Import list entry.
|
|---|
| 33 | */
|
|---|
| 34 | typedef struct _DefImport
|
|---|
| 35 | {
|
|---|
| 36 | unsigned long ulOrdinal;
|
|---|
| 37 | char *pszName;
|
|---|
| 38 | char *pszDll;
|
|---|
| 39 | char *pszIntName;
|
|---|
| 40 | struct _DefImport *pNext;
|
|---|
| 41 | } DEFIMPORT, *PDEFIMPORT;
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 | /**
|
|---|
| 45 | * Export list entry.
|
|---|
| 46 | */
|
|---|
| 47 | typedef struct _DefExport
|
|---|
| 48 | {
|
|---|
| 49 | unsigned long ulOrdinal;
|
|---|
| 50 | char *pszName;
|
|---|
| 51 | char *pszIntName;
|
|---|
| 52 | BOOL fResident;
|
|---|
| 53 | unsigned long cParam;
|
|---|
| 54 | struct _DefExport *pNext;
|
|---|
| 55 | } DEFEXPORT, *PDEFEXPORT;
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 | /**
|
|---|
| 59 | * Definition files.
|
|---|
| 60 | * TODO: error handling.
|
|---|
| 61 | * @author knut st. osmundsen
|
|---|
| 62 | */
|
|---|
| 63 | class kFileDef : public kExportI, public kFileFormatBase, public kModuleI
|
|---|
| 64 | {
|
|---|
| 65 | private:
|
|---|
| 66 | /**@cat pointers to different sections */
|
|---|
| 67 | char *pszType;
|
|---|
| 68 | BOOL fProgram;
|
|---|
| 69 | BOOL fLibrary;
|
|---|
| 70 | BOOL fPhysicalDevice;
|
|---|
| 71 | BOOL fVirtualDevice;
|
|---|
| 72 | BOOL fInitInstance;
|
|---|
| 73 | BOOL fTermInstance;
|
|---|
| 74 | BOOL fInitGlobal;
|
|---|
| 75 | BOOL fTermGlobal;
|
|---|
| 76 | char *pszModName;
|
|---|
| 77 | char chAppType;
|
|---|
| 78 |
|
|---|
| 79 | char *pszBase;
|
|---|
| 80 | char *pszCode;
|
|---|
| 81 | char *pszData;
|
|---|
| 82 | char *pszDescription;
|
|---|
| 83 | char *pszExeType;
|
|---|
| 84 | char *pszHeapSize;
|
|---|
| 85 | char *pszOld;
|
|---|
| 86 | char *pszProtmode;
|
|---|
| 87 | char *pszStackSize;
|
|---|
| 88 | char *pszStub;
|
|---|
| 89 |
|
|---|
| 90 | /**@cat Lists to multistatement sections */
|
|---|
| 91 | PDEFSEGMENT pSegments;
|
|---|
| 92 | PDEFIMPORT pImports;
|
|---|
| 93 | PDEFEXPORT pExports;
|
|---|
| 94 |
|
|---|
| 95 | /**@cat internal functions */
|
|---|
| 96 | void read(kFile *pFile) throw (int);
|
|---|
| 97 | char *readln(kFile *pFile, char *pszBuffer, int cbBuffer) throw (int);
|
|---|
| 98 | BOOL isKeyword(const char *psz);
|
|---|
| 99 | BOOL setModuleName(void);
|
|---|
| 100 |
|
|---|
| 101 | public:
|
|---|
| 102 | /**@cat Constructor/Destructor */
|
|---|
| 103 | kFileDef(kFile *pFile) throw(int);
|
|---|
| 104 | virtual ~kFileDef();
|
|---|
| 105 |
|
|---|
| 106 | /** @cat Module information methods. */
|
|---|
| 107 | BOOL moduleGetName(char *pszBuffer, int cchSize = 260);
|
|---|
| 108 |
|
|---|
| 109 | /** @cat Export enumeration methods. */
|
|---|
| 110 | BOOL exportFindFirst(kExportEntry *pExport);
|
|---|
| 111 | BOOL exportFindNext(kExportEntry *pExport);
|
|---|
| 112 | void exportFindClose(kExportEntry *pExport);
|
|---|
| 113 |
|
|---|
| 114 | /** @cat Export Lookup methods */
|
|---|
| 115 | BOOL exportLookup(unsigned long ulOrdinal, kExportEntry *pExport);
|
|---|
| 116 | BOOL exportLookup(const char * pszName, kExportEntry *pExport);
|
|---|
| 117 |
|
|---|
| 118 | /**@cat queries... */
|
|---|
| 119 | BOOL isDef() const { return TRUE;}
|
|---|
| 120 | char const *queryModuleName(void) const { return pszModName; }
|
|---|
| 121 | char const *queryType(void) const { return pszType; }
|
|---|
| 122 | char const *queryBase(void) const { return pszBase; }
|
|---|
| 123 | char const *queryCode(void) const { return pszCode; }
|
|---|
| 124 | char const *queryData(void) const { return pszData; }
|
|---|
| 125 | char const *queryDescription(void) const { return pszDescription; }
|
|---|
| 126 | char const *queryExeType(void) const { return pszExeType; }
|
|---|
| 127 | char const *queryHeapSize(void) const { return pszHeapSize; }
|
|---|
| 128 | char const *queryOld(void) const { return pszOld; }
|
|---|
| 129 | char const *queryProtmode(void) const { return pszProtmode; }
|
|---|
| 130 | char const *queryStackSize(void) const { return pszStackSize; }
|
|---|
| 131 | char const *queryStub(void) const { return pszStub; }
|
|---|
| 132 |
|
|---|
| 133 | /**@cat Operations */
|
|---|
| 134 | BOOL makeWatcomLinkFileAddtion(kFile *pFile) throw(int);
|
|---|
| 135 |
|
|---|
| 136 | enum {fullscreen = 0, pmvio = 2, pm = 3, unknown = 255};
|
|---|
| 137 | };
|
|---|
| 138 |
|
|---|
| 139 | #endif
|
|---|