1 //	Copyright (C) 1999-2012 Core Technologies.
2 //
3 //	This file is part of tpasm.
4 //
5 //	tpasm is free software; you can redistribute it and/or modify
6 //	it under the terms of the tpasm LICENSE AGREEMENT.
7 //
8 //	tpasm is distributed in the hope that it will be useful,
9 //	but WITHOUT ANY WARRANTY; without even the implied warranty of
10 //	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 //	tpasm LICENSE AGREEMENT for more details.
12 //
13 //	You should have received a copy of the tpasm LICENSE AGREEMENT
14 //	along with tpasm; see the file "LICENSE.TXT".
15 
16 
17 // global variables
18 
19 #include	"include.h"
20 
21 unsigned int
22 	numAllocatedPointers;						// used to track memory leaks
23 const char
24 	*programName;								// name of this program (used during error reports)
25 const char
26 	*sourceFileName;							// name of the control file
27 const char
28 	*listFileName;
29 FILE
30 	*listFile;
31 const char
32 	*defaultProcessorName;						// which processor to use by default
33 bool
34 	infoOnly;									// set by command line options which report information and abort assembly
35 
36 unsigned int
37 	includeDepth;								// keep track of number of includes deep
38 unsigned int
39 	passCount;									// remembers how many passed have been performed
40 unsigned int
41 	maxPasses;									// describes maximum number of passes the assembler will make before giving up
42 unsigned int
43 	numUnresolvedLabels,
44 	numModifiedLabels;
45 bool
46 	intermediatePass;							// true on everything but the last pass
47 unsigned int
48 	numBytesGenerated;							// number of bytes generated by assembly of a given line
49 char
50 	scope[MAX_STRING];							// keeps last non-local program label (so we can create absolute labels out of local ones)
51 unsigned int
52 	scopeCount;									// keeps count of number of references within this scope (allows macros to have their own local variable scope)
53 unsigned int
54 	scopeValue;									// based on scope-count, keeps the current scope value
55 
56 unsigned int
57 	blockDepth;									// keep track of number of blocks deep
58 
59 CONTEXT_RECORD
60 	*contextStack;								// keeps track of the assembly context stack (NULL means use default context)
61 
62 TEXT_BLOCK
63 	*collectingBlock;							// pointer to block of text being collected currently, NULL if none
64 
65 ALIAS_RECORD
66 	*aliasesHead;								// list of operand aliases
67 
68 MACRO_RECORD
69 	*macrosHead;								// head of list of macros collected during assembly (the actual macro being built if in macro context)
70 
71 SYM_TABLE
72 	*fileNameSymbols;							// collected list of all file names encountered during assembly
73 
74 SYM_TABLE_NODE
75 	*currentFile,								// pointer to the current file being assembled
76 	*currentVirtualFile;						// pointer to the file which contained the line of the text which is currently being assembled (as in a macro expansion)
77 
78 LABEL_RECORD
79 	*labelsHead;								// keeps track of all the labels which have been defined
80 
81 unsigned int
82 	currentFileLine;							// tells which line of the current file is being assembled
83 unsigned int
84 	currentVirtualFileLine;						// tells which line of the virtual file contained the text currently being assembled
85 
86 bool
87 	strictPseudo;								// tells if assembler should limit pseudo-ops to those that start with a dot
88 
89 unsigned int
90 	errorCount,									// number of errors reported
91 	warningCount;								// number of warnings reported
92 bool
93 	displayWarnings,							// tells if warnings should be displayed
94 	displayDiagnostics;							// tells if diagnostics should be displayed
95 
96 bool
97 	stopParsing;								// used to tell us to stop assembling (when end statement is encountered)
98 bool
99 	outputListing;								// true if listing is to be generated, false otherwise
100 bool
101 	outputListingExpansions;					// true if macro and repeat expansions should be present in the listing, false if not
102 
103 SEGMENT_RECORD
104 	*currentSegment,							// tells which segment is currently being assembled into
105 	*segmentsHead,								// pointer to the head of the list of segments
106 	*segmentsTail;								// pointer to the tail of the list of segments
107