usr.bin/pascal/pc3/pc3.c
/*
     *	allocate a symbol from the dynamically allocated symbol table.
     */
allocate a symbol from the dynamically allocated symbol table.
allocate a symbol from the dynamically allocated symbol table .
struct symbol *
symbolalloc()
    {
	static struct symbol	*nextsymbol = NIL;
	static long		symbolsleft = 0;
	struct symbol		*newsymbol;
	if ( symbolsleft <= 0 ) {
#	    ifdef SPACEDEBUG
		fprintf( stderr ,
			"[symbolalloc] malloc space for %d symbols\n" ,
			SYMBOLALLOC / sizeof( struct symbol ) );
#	    endif SPACEDEBUG
	    nextsymbol = ( struct symbol * ) malloc( SYMBOLALLOC );
	    if ( nextsymbol == 0 ) {
		error( FATAL , "ran out of memory (symbolalloc)" );
	    }
	    symbolsleft = SYMBOLALLOC / sizeof( struct symbol );
	}
	newsymbol = nextsymbol;
	nextsymbol++;
	symbolsleft--;
	return newsymbol;
    }
struct symbol * symbolalloc ( ) { static struct symbol * nextsymbol = NIL ; static long symbolsleft = 0 ; struct symbol * newsymbol ; if ( symbolsleft <= 0 ) { #	    ifdef SPACEDEBUG fprintf ( stderr , " \n " , SYMBOLALLOC / sizeof ( struct symbol ) ) ; #	    endif SPACEDEBUG nextsymbol = ( struct symbol * ) malloc ( SYMBOLALLOC ) ; if ( nextsymbol == 0 ) { error ( FATAL , " " ) ; } symbolsleft = SYMBOLALLOC / sizeof ( struct symbol ) ; } newsymbol = nextsymbol ; nextsymbol ++ ; symbolsleft -- ; return newsymbol ; }
allocate a symbol from the dynamically allocated symbol table.
allocate a symbol from the dynamically allocated symbol table .