Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1186 | savelij | 1 | #ifndef _ASMMAC_H |
2 | #define _ASMMAC_H |
||
3 | /* asmmac.h */ |
||
4 | /*****************************************************************************/ |
||
5 | /* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only */ |
||
6 | /* */ |
||
7 | /* AS-Portierung */ |
||
8 | /* */ |
||
9 | /* Unterroutinen des Makroprozessors */ |
||
10 | /* */ |
||
11 | /* Historie: 16. 5.1996 Grundsteinlegung */ |
||
12 | /* 2001-12-31 added DoIntLabel flag */ |
||
13 | /* 2002-03-03 added FromFile flag, LineRun pointer to input tag */ |
||
14 | /* */ |
||
15 | /*****************************************************************************/ |
||
16 | |||
17 | #include "errmsg.h" |
||
18 | #include "strcomp.h" |
||
19 | |||
20 | typedef struct _MacroRec |
||
21 | { |
||
22 | char *Name; /* Name des Makros */ |
||
23 | Byte ParamCount; /* Anzahl Parameter */ |
||
24 | StringList FirstLine; /* Zeiger auf erste Zeile */ |
||
25 | StringList ParamNames; /* parameter names, needed for named parameters */ |
||
26 | StringList ParamDefVals; /* default values */ |
||
27 | LongInt UseCounter; /* to limit recursive calls */ |
||
28 | tLstMacroExpMod LstMacroExpMod; /* modify macro expansion list subset */ |
||
29 | Boolean LocIntLabel; /* Label used internally instead at beginning */ |
||
30 | Boolean GlobalSymbols; /* labels not local to macro */ |
||
31 | Boolean UsesNumArgs, /* NUMARGS referenced in macro body */ |
||
32 | UsesAllArgs; /* ALLARGS referenced in macro body */ |
||
33 | } MacroRec, *PMacroRec; |
||
34 | |||
35 | #define BufferArraySize 1024 |
||
36 | |||
37 | struct as_dynstr; |
||
38 | |||
39 | typedef struct _TInputTag |
||
40 | { |
||
41 | struct _TInputTag *Next; |
||
42 | Boolean IsMacro; |
||
43 | Integer IfLevel, IncludeLevel; |
||
44 | Boolean First; |
||
45 | Boolean GlobalSymbols; |
||
46 | tLstMacroExp OrigDoLst; |
||
47 | LongInt StartLine; |
||
48 | Boolean (*Processor)( |
||
49 | #ifdef __PROTOS__ |
||
50 | struct _TInputTag *P, struct as_dynstr *p_dest |
||
51 | #endif |
||
52 | ); |
||
53 | LongInt ParCnt,ParZ; |
||
54 | StringList Params; |
||
55 | LongInt LineCnt, ContLineCnt, LineZ; |
||
56 | StringRecPtr Lines, LineRun; |
||
57 | String SpecNameStr, SaveAttr, SaveLabel, AllArgs; |
||
58 | tStrComp SpecName; |
||
59 | ShortString NumArgs; |
||
60 | Boolean IsEmpty, FromFile, UsesAllArgs, UsesNumArgs; |
||
61 | FILE *Datei; |
||
62 | void *Buffer; |
||
63 | void (*Cleanup)( |
||
64 | #ifdef __PROTOS__ |
||
65 | struct _TInputTag *P |
||
66 | #endif |
||
67 | ); |
||
68 | void (*Restorer)( |
||
69 | #ifdef __PROTOS__ |
||
70 | struct _TInputTag *P |
||
71 | #endif |
||
72 | ); |
||
73 | Boolean (*GetPos)( |
||
74 | #ifdef __PROTOS__ |
||
75 | struct _TInputTag *P, char *Dest, size_t DestSize, Boolean ActGNUErrors |
||
76 | #endif |
||
77 | ); |
||
78 | PMacroRec Macro; |
||
79 | LongInt LocHandle; |
||
80 | } TInputTag, *PInputTag; |
||
81 | |||
82 | typedef struct _TOutputTag |
||
83 | { |
||
84 | struct _TOutputTag *Next; |
||
85 | void (*Processor)( |
||
86 | #ifdef __PROTOS__ |
||
87 | void |
||
88 | #endif |
||
89 | ); |
||
90 | Integer NestLevel; |
||
91 | PInputTag Tag; |
||
92 | PMacroRec Mac; |
||
93 | StringList ParamNames, ParamDefVals; |
||
94 | LongInt PubSect,GlobSect; |
||
95 | Boolean DoExport, DoGlobCopy, UsesNumArgs, UsesAllArgs; |
||
96 | String GName; |
||
97 | tErrorNum OpenErrMsg; |
||
98 | tLstMacroExpMod LstMacroExpMod; |
||
99 | } TOutputTag, *POutputTag; |
||
100 | |||
101 | |||
102 | extern PInputTag FirstInputTag; |
||
103 | extern POutputTag FirstOutputTag; |
||
104 | |||
105 | struct sStrComp; |
||
106 | |||
107 | extern void Preprocess(void); |
||
108 | |||
109 | |||
110 | extern void AddMacro(PMacroRec Neu, LongInt DefSect, Boolean Protest); |
||
111 | |||
112 | extern Boolean FoundMacro(PMacroRec *Erg, const struct sStrComp *p_name); |
||
113 | |||
114 | extern void ClearMacroList(void); |
||
115 | |||
116 | extern void ResetMacroDefines(void); |
||
117 | |||
118 | extern void ClearMacroRec(PMacroRec *Alt, Boolean Complete); |
||
119 | |||
120 | extern void PrintMacroList(void); |
||
121 | |||
122 | |||
123 | extern void PrintDefineList(void); |
||
124 | |||
125 | extern void ClearDefineList(void); |
||
126 | |||
127 | extern void ExpandDefines(char *Line); |
||
128 | |||
129 | |||
130 | extern void asmmac_init(void); |
||
131 | #endif /* _ASMMAC_H */ |