1 
2 /* this is Public Domain.
3  fastpass.h defines structures and externals which are needed by the
4  "fast pass" feature. This feature speeds JWasm's assembly significantly
5  if huge header files containing declarations and definitions are used
6  (as it is the case with Win32Inc and Masm32), since the header files are
7  then scanned in pass one only.
8  */
9 
10 #if FASTPASS
11 
12 /* equ_item: used for a linked list of assembly time variables. Any variable
13  which is defined or modified after SaveState() has been called is to be stored
14  here - once! */
15 
16 struct equ_item {
17     struct equ_item *next;
18     struct asym *sym;
19     int lvalue;
20     int hvalue;
21     enum memtype mem_type; /* v2.07: added */
22     bool isdefined;
23 };
24 
25 /* line_item: used for a linked list of preprocessed lines. After SaveState()
26  * has been called, all preprocessed lines are written in pass one and read
27  * in further passes
28  */
29 
30 struct line_item {
31     struct line_item *next;
32     uint_32 lineno:20, srcfile:12;
33     uint_32 list_pos; /* position .LST file */
34     char line[1];
35 };
36 
37 extern struct line_item *LineStoreCurr;
38 
39 /* mod_state: used to store the module state within SaveState()
40  */
41 
42 struct mod_state {
43     bool init;           /* is this struct initialized? */
44     struct {
45         struct equ_item *head; /* the list of modified assembly time variables */
46         struct equ_item *tail;
47     } Equ;
48     unsigned saved_src; /* v2.13: save the current src item */
49     uint_8 modinfo[ sizeof( struct module_info ) - sizeof( struct module_vars ) ];
50 };
51 
52 /* source lines start to be "stored" when one of the following is detected:
53  * - an instruction
54  * - a data item (but not a struct field)
55  * - directives which "generate source": PROC, INVOKE, .IF, .WHILE, .REPEAT
56  * - directives ALIGN and ORG (which emit bytes and/or change $)
57  * - directive END (to ensure that there is at least 1 line)
58  * - directive ASSUME if operand is a forward reference
59  */
60 
61 //extern struct mod_state modstate;
62 extern bool StoreState; /* is 1 if states are to be stored in pass one */
63 
64 /* UseSavedState: is TRUE if preprocessed lines are to be read in pass 2,3,...
65  * Currently, this flag is set DURING pass one! That's bad,
66  * because it means that the flag itself doesn't tell whether
67  * (preprocessed) lines are read.
68  * the fix proposal is: set the flag - conditionally - AFTER pass one.
69  * Also, rename the flag (perhaps UseSavedLines )!
70  */
71 extern bool UseSavedState;
72 
73 //void SaveState( void );
74 void FastpassInit( void );
75 void SegmentSaveState( void );
76 void AssumeSaveState( void );
77 void ContextSaveState( void );
78 void StoreLine( const char *, int, uint_32 );
79 void SkipSavedState( void );
80 struct line_item *RestoreState( void );
81 void SaveVariableState( struct asym *sym );
82 void FreeLineStore( void );
83 
84 #define FStoreLine( flags ) if ( Parse_Pass == PASS_1 ) StoreLine( CurrSource, flags, 0 ); else
85 
86 #else
87 
88 #define FStoreLine( flags )
89 
90 #endif
91 
92