mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-31 08:16:47 +00:00 
			
		
		
		
	git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3785 91177308-0d34-0410-b5e6-96231b3b80d8
		
			
				
	
	
		
			39 lines
		
	
	
		
			525 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			525 B
		
	
	
	
		
			C
		
	
	
	
	
	
| char rcsid_symtab[] = "$Id$";
 | |
| 
 | |
| #include <stdio.h>
 | |
| #include <string.h>
 | |
| #include "b.h"
 | |
| #include "fe.h"
 | |
| 
 | |
| static List symtab;
 | |
| 
 | |
| Symbol
 | |
| newSymbol(name) char *name;
 | |
| {
 | |
| 	Symbol s;
 | |
| 
 | |
| 	s = (Symbol) zalloc(sizeof(struct symbol));
 | |
| 	assert(s);
 | |
| 	s->name = name;
 | |
| 	return s;
 | |
| }
 | |
| 
 | |
| Symbol
 | |
| enter(name, new) char *name; int *new;
 | |
| {
 | |
| 	List l;
 | |
| 	Symbol s;
 | |
| 
 | |
| 	*new = 0;
 | |
| 	for (l = symtab; l; l = l->next) {
 | |
| 		s = (Symbol) l->x;
 | |
| 		if (!strcmp(name, s->name)) {
 | |
| 			return s;
 | |
| 		}
 | |
| 	}
 | |
| 	*new = 1;
 | |
| 	s = newSymbol(name);
 | |
| 	symtab = newList(s, symtab);
 | |
| 	return s;
 | |
| }
 |