Comments added
This commit is contained in:
		
							parent
							
								
									5ef24f6923
								
							
						
					
					
						commit
						f1a897cec0
					
				
					 1 changed files with 20 additions and 7 deletions
				
			
		|  | @ -1,14 +1,26 @@ | |||
| #include "decl.h" | ||||
| #include <alloc.h> | ||||
| 
 | ||||
| int quantum = 0, nr_instr, block_saved, first_action, last_action; | ||||
| extern char *malloc(), *realloc(), *Salloc(); | ||||
| char **as_instructions; | ||||
| 
 | ||||
| /* This file contains some routines needed in "pars.g" to handle the  action-
 | ||||
|  * grammarrule. The assembler-instructions are handeld in blocks rather than | ||||
|  * one at a time. So these routines provide saving and removing of assembler- | ||||
|  * instructions. | ||||
|  */ | ||||
| 
 | ||||
| char **as_instructions;	    /* The buffer(?) where the instructions are saved */ | ||||
| 
 | ||||
| int quantum = 0,	    /* Max. nr. of instructions in as_instructions[] */ | ||||
|     nr_instr,		    /* Number of saved instructions */ | ||||
|     first_action,	    /* Is this block of assembler-instr. the first after
 | ||||
| 			     * a '==>' or '::=' ? | ||||
| 			     */ | ||||
|     last_action;	    /* Is this block followed by a '.' ? */ | ||||
| 
 | ||||
| 
 | ||||
| init_as_block() | ||||
| { | ||||
| 	nr_instr = 0; | ||||
| 	block_saved = TRUE; | ||||
| 
 | ||||
| 	if ( quantum == 0) { | ||||
| 		quantum = 16; | ||||
|  | @ -19,6 +31,9 @@ init_as_block() | |||
| 
 | ||||
| save_as( instr) | ||||
| char *instr; | ||||
| 
 | ||||
| /* Save a copy of 'instr'
 | ||||
|  */ | ||||
| { | ||||
| 	if ( nr_instr == quantum) { | ||||
| 		quantum *= 2; | ||||
|  | @ -33,13 +48,11 @@ do_block_assemble() | |||
| { | ||||
| 	int i; | ||||
| 
 | ||||
| 	if ( block_saved) { | ||||
| 	if ( nr_instr > 0) { | ||||
| 		block_assemble( as_instructions, nr_instr, | ||||
| 				first_action, last_action); | ||||
| 
 | ||||
| 		for ( i=0; i<nr_instr; i++) | ||||
| 			free( as_instructions[i]); | ||||
| 		 | ||||
| 		block_saved = FALSE; | ||||
| 	} | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue