source: trunk/tools/common/kFileDef.h@ 10367

Last change on this file since 10367 was 9162, checked in by bird, 23 years ago

Parse segments so we can spit out more correct watcom directives.

File size: 4.5 KB
Line 
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 */
23typedef struct _DefSegment
24{
25 char *psz;
26 char *pszName;
27 char *pszClass;
28 char *pszAttr;
29 struct _DefSegment *pNext;
30} DEFSEGMENT, *PDEFSEGMENT;
31
32
33
34/**
35 * Import list entry.
36 */
37typedef 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 */
50typedef struct _DefExport
51{
52 unsigned long ulOrdinal;
53 char *pszName;
54 char *pszIntName;
55 KBOOL fResident;
56 unsigned long cParam;
57 struct _DefExport *pNext;
58} DEFEXPORT, *PDEFEXPORT;
59
60
61/**
62 * Definition files.
63 * TODO: error handling.
64 * @author knut st. osmundsen
65 */
66class kFileDef : public kExportI, public kFileFormatBase, public kModuleI
67{
68 private:
69 /**@cat pointers to different sections */
70 char *pszType;
71 KBOOL fProgram;
72 KBOOL fLibrary;
73 KBOOL fPhysicalDevice;
74 KBOOL fVirtualDevice;
75 KBOOL fInitInstance;
76 KBOOL fTermInstance;
77 KBOOL fInitGlobal;
78 KBOOL fTermGlobal;
79 char *pszModName;
80 char chAppType;
81
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 */
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);
103
104 public:
105 /**@cat Constructor/Destructor */
106 kFileDef(kFile *pFile) throw(kError);
107 virtual ~kFileDef();
108
109 /** @cat Module information methods. */
110 KBOOL moduleGetName(char *pszBuffer, int cchSize = 260);
111
112 /** @cat Export enumeration methods. */
113 KBOOL exportFindFirst(kExportEntry *pExport);
114 KBOOL exportFindNext(kExportEntry *pExport);
115 void exportFindClose(kExportEntry *pExport);
116
117 /** @cat Export Lookup methods */
118 KBOOL exportLookup(unsigned long ulOrdinal, kExportEntry *pExport);
119 KBOOL exportLookup(const char * pszName, kExportEntry *pExport);
120
121 /**@cat queries... */
122 KBOOL isDef() const { return TRUE;}
123 char const *queryModuleName(void) const { return pszModName; }
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; }
135
136 /**@cat Operations */
137 KBOOL makeWatcomLinkFileAddtion(kFile *pFile, int enmOS) throw(kError);
138
139 enum {fullscreen = 0, pmvio = 2, pm = 3, unknown = 255};
140 enum {os2, os2v1, dos, win32, win16, nlm, qnx, elf};
141};
142
143#endif
Note: See TracBrowser for help on using the repository browser.