Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1186 | savelij | 1 | /* asmdef.c */ |
2 | /*****************************************************************************/ |
||
3 | /* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only */ |
||
4 | /* */ |
||
5 | /* AS-Portierung */ |
||
6 | /* */ |
||
7 | /* global benutzte Variablen */ |
||
8 | /* */ |
||
9 | /*****************************************************************************/ |
||
10 | |||
11 | #include "stdinc.h" |
||
12 | |||
13 | #include <errno.h> |
||
14 | #include <string.h> |
||
15 | |||
16 | #include "strutil.h" |
||
17 | #include "stringlists.h" |
||
18 | #include "chunks.h" |
||
19 | |||
20 | #include "asmdef.h" |
||
21 | #include "asmsub.h" |
||
22 | #include "errmsg.h" |
||
23 | |||
24 | char SrcSuffix[] = ".asm"; /* Standardendungen: Hauptdatei */ |
||
25 | char IncSuffix[] = ".inc"; /* Includedatei */ |
||
26 | char PrgSuffix[] = ".p"; /* Programmdatei */ |
||
27 | char LstSuffix[] = ".lst"; /* Listingdatei */ |
||
28 | char MacSuffix[] = ".mac"; /* Makroausgabe */ |
||
29 | char PreSuffix[] = ".i"; /* Ausgabe Makroprozessor */ |
||
30 | char LogSuffix[] = ".log"; /* Fehlerdatei */ |
||
31 | char MapSuffix[] = ".map"; /* Debug-Info/Map-Format */ |
||
32 | char OBJSuffix[] = ".obj"; |
||
33 | |||
34 | const char *EnvName = "ASCMD"; /* Environment-Variable fuer Default- |
||
35 | Parameter */ |
||
36 | |||
37 | StringPtr SourceFile; /* Hauptquelldatei */ |
||
38 | |||
39 | StringPtr CursUp; /* " " Cursor hoch */ |
||
40 | |||
41 | LargeWord *PCs; /* Programmzaehler */ |
||
42 | Boolean RelSegs; /* relokatibles Segment ? */ |
||
43 | LargeWord StartAdr; /* Programmstartadresse */ |
||
44 | Boolean StartAdrPresent; /* " definiert? */ |
||
45 | LargeWord AfterBSRAddr; /* address right behind last BSR */ |
||
46 | LargeWord *Phases; /* Verschiebungen */ |
||
47 | Word Grans[SegCountPlusStruct]; /* Groesse der Adressierungselemente */ |
||
48 | Word ListGrans[SegCountPlusStruct]; /* Wortgroesse im Listing */ |
||
49 | ChunkList SegChunks[SegCountPlusStruct]; /* Belegungen */ |
||
50 | as_addrspace_t ActPC; /* gewaehlter Programmzaehler */ |
||
51 | Boolean PCsUsed[SegCountPlusStruct]; /* PCs bereits initialisiert ? */ |
||
52 | LargeWord *SegInits; /* Segmentstartwerte */ |
||
53 | LargeWord *SegLimits; /* Segmentgrenzwerte */ |
||
54 | LongInt ValidSegs; /* erlaubte Segmente */ |
||
55 | Boolean ENDOccured; /* END-Statement aufgetreten ? */ |
||
56 | Boolean Retracted; /* Codes zurueckgenommen ? */ |
||
57 | Boolean ListToStdout, ListToNull; /* Listing auf Konsole/Nulldevice ? */ |
||
58 | |||
59 | unsigned ASSUMERecCnt; |
||
60 | const ASSUMERec *pASSUMERecs; |
||
61 | void (*pASSUMEOverride)(void); |
||
62 | |||
63 | Integer PassNo; /* Durchlaufsnummer */ |
||
64 | Integer JmpErrors; /* Anzahl fraglicher Sprungfehler */ |
||
65 | Boolean ThrowErrors; /* Fehler verwerfen bei Repass ? */ |
||
66 | LongWord MaxErrors; /* terminate upon n errors? */ |
||
67 | Boolean Repass; /* noch ein Durchlauf erforderlich */ |
||
68 | Byte MaxSymPass; /* Pass, nach dem Symbole definiert sein muessen */ |
||
69 | Byte ShareMode; /* 0=kein SHARED,1=Pascal-,2=C-Datei, 3=ASM-Datei */ |
||
70 | DebugType DebugMode; /* Ausgabeformat Debug-Datei */ |
||
71 | Word NoICEMask; /* which symbols to use in NoICE dbg file */ |
||
72 | Byte ListMode; /* 0=kein Listing,1=Konsole,2=auf Datei */ |
||
73 | Byte ListOn; /* Listing erzeugen ? */ |
||
74 | Integer MaxIncludeLevel; /* maximum include nesting level */ |
||
75 | Boolean MakeUseList; /* Belegungsliste ? */ |
||
76 | Boolean MakeCrossList; /* Querverweisliste ? */ |
||
77 | Boolean MakeSectionList; /* Sektionsliste ? */ |
||
78 | Boolean MakeIncludeList; /* Includeliste ? */ |
||
79 | Boolean DefRelaxedMode; /* alle Integer-Syntaxen zulassen ? */ |
||
80 | as_dynstr_t def_int_syntax; /* default integer syntax modifiers */ |
||
81 | Word ListMask; /* Listingmaske */ |
||
82 | Boolean list_macro_handles; /* add macros' symbol handles to listing? */ |
||
83 | ShortInt ExtendErrors; /* erweiterte Fehlermeldungen */ |
||
84 | Integer EnumSegment; /* ENUM state & config */ |
||
85 | LongInt EnumIncrement, EnumCurrentValue; |
||
86 | Boolean NumericErrors; /* Fehlermeldungen mit Nummer */ |
||
87 | Boolean CodeOutput; /* Code erzeugen */ |
||
88 | Boolean MacProOutput; /* Makroprozessorausgabe schreiben */ |
||
89 | Boolean MacroOutput; /* gelesene Makros schreiben */ |
||
90 | Boolean HardRanges; /* Bereichsfehler echte Fehler ? */ |
||
91 | const char *DivideChars; /* Trennzeichen fuer Parameter. Inhalt Read Only! */ |
||
92 | Boolean HasAttrs; /* Opcode hat Attribut */ |
||
93 | const char *AttrChars; /* Zeichen, mit denen Attribut abgetrennt wird */ |
||
94 | Boolean MsgIfRepass; /* Meldungen, falls neuer Pass erforderlich */ |
||
95 | Integer PassNoForMessage; /* falls ja: ab welchem Pass ? */ |
||
96 | Boolean CaseSensitive; /* Gross/Kleinschreibung unterscheiden ? */ |
||
97 | LongInt NestMax; /* max. nesting level of a macro */ |
||
98 | Boolean GNUErrors; /* GNU-error-style messages ? */ |
||
99 | |||
100 | FILE *PrgFile = NULL; /* Codedatei */ |
||
101 | |||
102 | StringPtr ErrorPath, ErrorName; /* Ausgabedatei Fehlermeldungen */ |
||
103 | StringPtr OutName; /* Name Code-Datei */ |
||
104 | Integer CurrIncludeLevel; /* current include nesting level */ |
||
105 | StringPtr CurrFileName; /* mom. bearbeitete Datei */ |
||
106 | LongInt CurrLine; /* virtuelle Position */ |
||
107 | LongInt LineSum; /* Gesamtzahl Quellzeilen */ |
||
108 | LongInt MacLineSum; /* inkl. Makroexpansion */ |
||
109 | |||
110 | LongInt NOPCode; /* Maschinenbefehl NOP zum Stopfen */ |
||
111 | Boolean TurnWords; /* TRUE = Motorola-Wortformat */ |
||
112 | /* FALSE = Intel-Wortformat */ |
||
113 | Byte HeaderID; /* Kennbyte des Codeheaders */ |
||
114 | const char *PCSymbol; /* Symbol, womit Programmzaehler erreicht wird. Inhalt Read Only! */ |
||
115 | Boolean (*SetIsOccupiedFnc)(void), /* TRUE: SET instr, to be parsed by code generator */ |
||
116 | (*SaveIsOccupiedFnc)(void), /* ditto for SAVE */ |
||
117 | (*RestoreIsOccupiedFnc)(void); /* ditto for RESTORE */ |
||
118 | Boolean SwitchIsOccupied, /* TRUE: SWITCH/PAGE/SHIFT ist Prozessorbefehl */ |
||
119 | PageIsOccupied, |
||
120 | ShiftIsOccupied; |
||
121 | Boolean multi_char_le; |
||
122 | #ifdef __PROTOS__ |
||
123 | Boolean (*DecodeAttrPart)(void); /* dissect attribute of instruction */ |
||
124 | void (*MakeCode)(void); /* Codeerzeugungsprozedur */ |
||
125 | Boolean (*ChkPC)(LargeWord Addr); /* ueberprueft Codelaengenueberschreitungen */ |
||
126 | Boolean (*IsDef)(void); /* ist Label nicht als solches zu werten ? */ |
||
127 | void (*SwitchFrom)(void) = NULL; /* bevor von einer CPU weggeschaltet wird */ |
||
128 | void (*InternSymbol)(char *Asc, TempResult *Erg); /* vordefinierte Symbole ? */ |
||
129 | #else |
||
130 | Boolean (*DecodeAttrPart)(); |
||
131 | void (*MakeCode)(); |
||
132 | Boolean (*ChkPC)(); |
||
133 | Boolean (*IsDef)(); |
||
134 | void (*SwitchFrom)(); |
||
135 | void (*InternSymbol)(); |
||
136 | #endif |
||
137 | DissectBitProc DissectBit; |
||
138 | DissectRegProc DissectReg; |
||
139 | as_qualify_quote_fnc_t QualifyQuote; |
||
140 | |||
141 | StringPtr IncludeList; /* Suchpfade fuer Includedateien */ |
||
142 | Integer IncDepth, NextIncDepth, /* Verschachtelungstiefe INCLUDEs */ |
||
143 | MaxIncDepth; |
||
144 | FILE *ErrorFile = NULL; /* Fehlerausgabe */ |
||
145 | FILE *LstFile = NULL; /* Listdatei */ |
||
146 | FILE *ShareFile = NULL; /* Sharefile */ |
||
147 | FILE *MacProFile = NULL; /* Makroprozessorausgabe */ |
||
148 | FILE *MacroFile = NULL; /* Ausgabedatei Makroliste */ |
||
149 | Boolean InMacroFlag; /* momentan wird Makro expandiert */ |
||
150 | StringPtr LstName; /* Name der Listdatei */ |
||
151 | StringPtr MacroName, MacProName; |
||
152 | tLstMacroExp DoLst, NextDoLst; /* Listing an */ |
||
153 | StringPtr ShareName; /* Name des Sharefiles */ |
||
154 | |||
155 | CPUVar MomCPU, MomVirtCPU; /* definierter/vorgegaukelter Prozessortyp */ |
||
156 | StringPtr MomCPUArgs; /* Arguments for Current Processor Type */ |
||
157 | char DefCPU[20]; /* per Kommandozeile vorgegebene CPU */ |
||
158 | char MomCPUIdent[20], /* dessen Name in ASCII */ |
||
159 | MomFPUIdent[20], /* ditto FPU */ |
||
160 | MomPMMUIdent[20]; /* ditto PMMU */ |
||
161 | |||
162 | int OutRadixBase; /* dito fuer Ausgabe */ |
||
163 | int ListRadixBase; /* ditto for listing */ |
||
164 | Boolean ListPCZeroPad; /* PC with leading zeros? */ |
||
165 | const char *pCommentLeadIn; /* list of comment lead-in sequences */ |
||
166 | |||
167 | tStrComp *ArgStr; /* Komponenten der Zeile */ |
||
168 | tStrComp LabPart, CommPart, ArgPart, OpPart, AttrPart; |
||
169 | char AttrSplit; |
||
170 | Boolean oppart_leading_dot; |
||
171 | int ArgCnt; /* Argumentzahl */ |
||
172 | int AllocArgCnt; |
||
173 | as_dynstr_t OneLine; /* eingelesene Zeile */ |
||
174 | #ifdef PROFILE_MEMO |
||
175 | unsigned NumMemo; |
||
176 | unsigned long NumMemoCnt, NumMemoSum; |
||
177 | #endif |
||
178 | |||
179 | Byte LstCounter; /* Zeilenzaehler fuer automatischen Umbruch */ |
||
180 | Word PageCounter[ChapMax + 1]; /* hierarchische Seitenzaehler */ |
||
181 | Byte ChapDepth; /* momentane Kapitelverschachtelung */ |
||
182 | StringPtr ListLine; /* alternative Ausgabe vor Listing fuer EQU */ |
||
183 | Byte PageLength, PageWidth; /* Seitenlaenge/breite in Zeilen/Spalten */ |
||
184 | tLstMacroExpMod LstMacroExpModOverride, /* Override macro expansion ? */ |
||
185 | LstMacroExpModDefault; |
||
186 | Boolean DottedStructs; /* structure elements with dots */ |
||
187 | StringPtr PrtInitString; /* Druckerinitialisierungsstring */ |
||
188 | StringPtr PrtExitString; /* Druckerdeinitialisierungsstring */ |
||
189 | StringPtr PrtTitleString; /* Titelzeile */ |
||
190 | |||
191 | LongInt MomSectionHandle; /* mom. Namensraum */ |
||
192 | PSaveSection SectionStack; /* gespeicherte Sektionshandles */ |
||
193 | tSavePhase *pPhaseStacks[SegCount]; /* saves nested PHASE values */ |
||
194 | |||
195 | tSymbolSize AttrPartOpSize[2]; /* instruction operand size(s) deduced from insn attribute */ |
||
196 | LongWord MaxCodeLen = 0; /* max. length of generated code */ |
||
197 | LongInt CodeLen; /* Laenge des erzeugten Befehls */ |
||
198 | LongWord *DAsmCode; /* Zwischenspeicher erzeugter Code */ |
||
199 | Word *WAsmCode; |
||
200 | Byte *BAsmCode; |
||
201 | |||
202 | Boolean DontPrint; /* Flag:PC veraendert, aber keinen Code erzeugt */ |
||
203 | Word ActListGran; /* uebersteuerte List-Granularitaet */ |
||
204 | |||
205 | Byte StopfZahl; /* Anzahl der im 2.Pass festgestellten |
||
206 | ueberfluessigen Worte, die mit NOP ge- |
||
207 | fuellt werden muessen */ |
||
208 | |||
209 | Boolean SuppWarns; |
||
210 | |||
211 | PTransTable TransTables, /* Liste mit Codepages */ |
||
212 | CurrTransTable; /* aktuelle Codepage */ |
||
213 | |||
214 | PDefinement FirstDefine; /* Liste von Praeprozessor-Defines */ |
||
215 | |||
216 | PSaveState FirstSaveState; /* gesicherte Zustaende */ |
||
217 | |||
218 | Boolean MakeDebug; /* Debugginghilfe */ |
||
219 | FILE *Debug; |
||
220 | |||
221 | Boolean WasIF, WasMACRO; |
||
222 | |||
223 | void AsmDefInit(void) |
||
224 | { |
||
225 | LongInt z; |
||
226 | |||
227 | DoLst = eLstMacroExpAll; |
||
228 | PassNo = 1; |
||
229 | MaxSymPass = 1; |
||
230 | |||
231 | LineSum = 0; |
||
232 | |||
233 | for (z = 0; z <= ChapMax; PageCounter[z++] = 0); |
||
234 | LstCounter = 0; |
||
235 | ChapDepth = 0; |
||
236 | |||
237 | PrtInitString[0] = '\0'; |
||
238 | PrtExitString[0] = '\0'; |
||
239 | PrtTitleString[0] = '\0'; |
||
240 | |||
241 | CurrFileName[0] = '\0'; |
||
242 | |||
243 | FirstDefine = NULL; |
||
244 | FirstSaveState = NULL; |
||
245 | } |
||
246 | |||
247 | void NullProc(void) |
||
248 | { |
||
249 | } |
||
250 | |||
251 | void Default_InternSymbol(char *Asc, TempResult *Erg) |
||
252 | { |
||
253 | UNUSED(Asc); |
||
254 | |||
255 | Erg->Typ = TempNone; |
||
256 | } |
||
257 | |||
258 | void Default_DissectBit(char *pDest, size_t DestSize, LargeWord BitSpec) |
||
259 | { |
||
260 | HexString(pDest, DestSize, BitSpec, 0); |
||
261 | } |
||
262 | |||
263 | static char *GetString(void) |
||
264 | { |
||
265 | return (char*)malloc(STRINGSIZE * sizeof(char)); |
||
266 | } |
||
267 | |||
268 | int SetMaxCodeLen(LongWord NewMaxCodeLen) |
||
269 | { |
||
270 | if (NewMaxCodeLen > MaxCodeLen_Max) |
||
271 | return ENOMEM; |
||
272 | if (NewMaxCodeLen > MaxCodeLen) |
||
273 | { |
||
274 | void *pNewMem; |
||
275 | |||
276 | if (!MaxCodeLen) |
||
277 | pNewMem = (LongWord *) malloc(NewMaxCodeLen); |
||
278 | else |
||
279 | pNewMem = (LongWord *) realloc(DAsmCode, NewMaxCodeLen); |
||
280 | if (!pNewMem) |
||
281 | return ENOMEM; |
||
282 | |||
283 | DAsmCode = (LongWord *)pNewMem; |
||
284 | WAsmCode = (Word *) DAsmCode; |
||
285 | BAsmCode = (Byte *) DAsmCode; |
||
286 | MaxCodeLen = NewMaxCodeLen; |
||
287 | } |
||
288 | return 0; |
||
289 | } |
||
290 | |||
291 | /*!------------------------------------------------------------------------ |
||
292 | * \fn AppendArg(size_t ReqSize) |
||
293 | * \brief extend list of arguments by one more at the end |
||
294 | * \param ReqSize length of argument to store (excluding NUL at end) |
||
295 | * ------------------------------------------------------------------------ */ |
||
296 | |||
297 | /* NOTICE: Due to port from Pascal sources, ArgStr[] is still indexed starting at |
||
298 | one instead of zero: |
||
299 | |||
300 | - ArgStr[0] is unused. |
||
301 | - If ArgCnt == n, ArgStr[1] to ArgStr[n] are used. */ |
||
302 | |||
303 | void AppendArg(size_t ReqSize) |
||
304 | { |
||
305 | if (ArgCnt >= ArgCntMax) |
||
306 | WrXError(ErrNum_InternalError, "MaxArgCnt"); |
||
307 | ++ArgCnt; |
||
308 | |||
309 | if (ArgCnt >= AllocArgCnt) |
||
310 | { |
||
311 | size_t NewArgStrSize = sizeof(*ArgStr) * (ArgCnt + 1); /* one more, [0] is unused */ |
||
312 | int z; |
||
313 | |||
314 | ArgStr = ArgStr ? (tStrComp*)realloc(ArgStr, NewArgStrSize) : (tStrComp*)malloc(NewArgStrSize); |
||
315 | for (z = AllocArgCnt; z <= ArgCnt; z++) |
||
316 | StrCompAlloc(&ArgStr[z], STRINGSIZE); |
||
317 | AllocArgCnt = ArgCnt + 1; |
||
318 | } |
||
319 | |||
320 | if (ArgStr[ArgCnt].str.capacity <= ReqSize) |
||
321 | { |
||
322 | if (as_dynstr_realloc(&ArgStr[ArgCnt].str, as_dynstr_roundup_len(ReqSize))) |
||
323 | WrXError(ErrNum_InternalError, "out of memory"); |
||
324 | } |
||
325 | } |
||
326 | |||
327 | /*!------------------------------------------------------------------------ |
||
328 | * \fn InsertArg(unsigned Index, size_t ReqSize) |
||
329 | * \brief insert one more arg @ given position |
||
330 | * \param Index insertion position |
||
331 | * \param ReqSize requested size of new arg |
||
332 | * ------------------------------------------------------------------------ */ |
||
333 | |||
334 | void InsertArg(int Index, size_t ReqSize) |
||
335 | { |
||
336 | int z; |
||
337 | |||
338 | /* 0 should never be passed... */ |
||
339 | |||
340 | if (Index < 1) |
||
341 | Index = 1; |
||
342 | |||
343 | /* Insertion beyond end means appending */ |
||
344 | |||
345 | if (Index > ArgCnt) |
||
346 | { |
||
347 | AppendArg(ReqSize); |
||
348 | return; |
||
349 | } |
||
350 | |||
351 | /* current last arg dictates length of new last arg */ |
||
352 | |||
353 | AppendArg(strlen(ArgStr[ArgCnt].str.p_str)); |
||
354 | for (z = ArgCnt; z > Index; z--) |
||
355 | { |
||
356 | as_dynstr_copy(&ArgStr[z].str, &ArgStr[z - 1].str); |
||
357 | ArgStr[z].Pos = ArgStr[z - 1].Pos; |
||
358 | } |
||
359 | if (ArgStr[Index].str.capacity < ReqSize + 1) |
||
360 | { |
||
361 | if (as_dynstr_realloc(&ArgStr[Index].str, as_dynstr_roundup_len(ReqSize))) |
||
362 | WrXError(ErrNum_InternalError, "out of memory"); |
||
363 | } |
||
364 | } |
||
365 | |||
366 | /*!------------------------------------------------------------------------ |
||
367 | * \fn memo_set_pseudo(void) |
||
368 | * \brief is the current instruction SET, and the pseudo instruction of that name? |
||
369 | * \return True if yes |
||
370 | * ------------------------------------------------------------------------ */ |
||
371 | |||
372 | Boolean memo_set_pseudo(void) |
||
373 | { |
||
374 | return Memo("SET") && is_set_pseudo(); |
||
375 | } |
||
376 | |||
377 | /*!------------------------------------------------------------------------ |
||
378 | * \fn is_set_pseudo(void) |
||
379 | * \brief is the current (SET) instruction the pseudo instruction of that name? |
||
380 | * \return True if yes |
||
381 | * ------------------------------------------------------------------------ */ |
||
382 | |||
383 | Boolean is_set_pseudo(void) |
||
384 | { |
||
385 | return (oppart_leading_dot |
||
386 | || (!SetIsOccupiedFnc || !SetIsOccupiedFnc())); |
||
387 | } |
||
388 | |||
389 | /*!------------------------------------------------------------------------ |
||
390 | * \fn is_save_pseudo(void) |
||
391 | * \brief is the current (SAVE) instruction the pseudo instruction of that name? |
||
392 | * \return True if yes |
||
393 | * ------------------------------------------------------------------------ */ |
||
394 | |||
395 | Boolean is_save_pseudo(void) |
||
396 | { |
||
397 | return (oppart_leading_dot |
||
398 | || (!SaveIsOccupiedFnc || !SaveIsOccupiedFnc())); |
||
399 | } |
||
400 | |||
401 | /*!------------------------------------------------------------------------ |
||
402 | * \fn is_restore_pseudo(void) |
||
403 | * \brief is the current (RESTORE) instruction the pseudo instruction of that name? |
||
404 | * \return True if yes |
||
405 | * ------------------------------------------------------------------------ */ |
||
406 | |||
407 | Boolean is_restore_pseudo(void) |
||
408 | { |
||
409 | return (oppart_leading_dot |
||
410 | || (!RestoreIsOccupiedFnc || !RestoreIsOccupiedFnc())); |
||
411 | } |
||
412 | |||
413 | /*!------------------------------------------------------------------------ |
||
414 | * \fn memo_switch_pseudo(void) |
||
415 | * \brief is the current instruction SWITCh, and the pseudo instruction of that name? |
||
416 | * \return True if yes |
||
417 | * ------------------------------------------------------------------------ */ |
||
418 | |||
419 | Boolean memo_switch_pseudo(void) |
||
420 | { |
||
421 | return Memo("SWITCH") |
||
422 | && (oppart_leading_dot || !SwitchIsOccupied); |
||
423 | } |
||
424 | |||
425 | /*!------------------------------------------------------------------------ |
||
426 | * \fn memo_shift_pseudo(void) |
||
427 | * \brief is the current instruction SHIFT, and the pseudo instruction of that name? |
||
428 | * \return True if yes |
||
429 | * ------------------------------------------------------------------------ */ |
||
430 | |||
431 | Boolean memo_shift_pseudo(void) |
||
432 | { |
||
433 | return Memo("SHIFT") |
||
434 | && (oppart_leading_dot || !ShiftIsOccupied); |
||
435 | } |
||
436 | |||
437 | /*!------------------------------------------------------------------------ |
||
438 | * \fn is_page_pseudo(void) |
||
439 | * \brief is the current PAGE instruction the pseudo instruction of that name? |
||
440 | * \return True if yes |
||
441 | * ------------------------------------------------------------------------ */ |
||
442 | |||
443 | Boolean is_page_pseudo(void) |
||
444 | { |
||
445 | return oppart_leading_dot || !PageIsOccupied; |
||
446 | } |
||
447 | |||
448 | /*!------------------------------------------------------------------------ |
||
449 | * \fn free_forward_symbol(PForwardSymbol p_symbol) |
||
450 | * \brief free entry from forward symbol list |
||
451 | * \param p_symbol entry to free |
||
452 | * ------------------------------------------------------------------------ */ |
||
453 | |||
454 | void free_forward_symbol(PForwardSymbol p_symbol) |
||
455 | { |
||
456 | free(p_symbol->Name); p_symbol->Name = NULL; |
||
457 | free(p_symbol->pErrorPos); p_symbol->pErrorPos = NULL; |
||
458 | free(p_symbol); |
||
459 | } |
||
460 | |||
461 | void asmdef_init(void) |
||
462 | { |
||
463 | SwitchFrom = NullProc; |
||
464 | InternSymbol = Default_InternSymbol; |
||
465 | DissectBit = Default_DissectBit; |
||
466 | DissectReg = NULL; |
||
467 | QualifyQuote = NULL; |
||
468 | |||
469 | SetMaxCodeLen(MaxCodeLen_Ini); |
||
470 | |||
471 | /* auf diese Weise wird PCSymbol defaultmaessig nicht erreichbar |
||
472 | da das schon von den Konstantenparsern im Formelparser abgefangen |
||
473 | wuerde */ |
||
474 | |||
475 | PCSymbol = "--PC--SYMBOL--"; |
||
476 | *DefCPU = '\0'; |
||
477 | |||
478 | ArgStr = NULL; |
||
479 | AllocArgCnt = 0; |
||
480 | SourceFile = GetString(); |
||
481 | CursUp = GetString(); |
||
482 | ErrorPath = GetString(); |
||
483 | ErrorName = GetString(); |
||
484 | OutName = GetString(); |
||
485 | CurrFileName = GetString(); |
||
486 | IncludeList = GetString(); |
||
487 | LstName = GetString(); |
||
488 | MacroName = GetString(); |
||
489 | MacProName = GetString(); |
||
490 | ShareName = GetString(); |
||
491 | StrCompAlloc(&LabPart, STRINGSIZE); |
||
492 | StrCompAlloc(&OpPart, STRINGSIZE); |
||
493 | StrCompAlloc(&AttrPart, STRINGSIZE); |
||
494 | StrCompAlloc(&ArgPart, STRINGSIZE); |
||
495 | StrCompAlloc(&CommPart, STRINGSIZE); |
||
496 | as_dynstr_ini(&OneLine, STRINGSIZE); |
||
497 | ListLine = GetString(); |
||
498 | PrtInitString = GetString(); |
||
499 | PrtExitString = GetString(); |
||
500 | PrtTitleString = GetString(); |
||
501 | MomCPUArgs = GetString(); |
||
502 | |||
503 | SegInits = (LargeWord*)calloc(SegCount, sizeof(*SegInits)); |
||
504 | SegLimits = (LargeWord*)calloc(SegCount, sizeof(*SegLimits)); |
||
505 | Phases = (LargeWord*)calloc(SegCountPlusStruct, sizeof(*Phases)); |
||
506 | PCs = (LargeWord*)calloc(SegCountPlusStruct, sizeof(*PCs)); |
||
507 | } |