old/as.vax/asexpr.c
/*
 *	turn a token type into a string
 */
turn a token type into a string
turn a token type into a string
char *tok_to_name(token)
{
	static	int	fixed = 0;
	static	char	buf[64];
	static	struct	Tok_Desc 	NA = {0, (char *)0, "NOT ASSIGNED"};
		int	i;
		char	*cp;
	if (!fixed){
		for (i = FIRSTTOKEN; i <= LASTTOKEN; i++)
			tok_name[i] = &NA;
		for (i = 0; i <= sizeof(tok_desc)/sizeof(struct Tok_Desc); i++){
			tok_name[tok_desc[i].tok_which] = &tok_desc[i];
		}
		fixed = 1;
	}
	if (FIRSTTOKEN <= token && token <= LASTTOKEN){
		(void)sprintf(buf, "%s %s", tok_name[token]->tok_kind,
			tok_name[token]->tok_name);
		return(buf);
	} else {
		panic("Unknown token number, %d\n", token);
	}
}
char * tok_to_name ( token ) { static int fixed = 0 ; static char buf [ 64 ] ; static struct Tok_Desc NA = { 0 , ( char * ) 0 , " " } ; int i ; char * cp ; if ( ! fixed ) { for ( i = FIRSTTOKEN ; i <= LASTTOKEN ; i ++ ) tok_name [ i ] = & NA ; for ( i = 0 ; i <= sizeof ( tok_desc ) / sizeof ( struct Tok_Desc ) ; i ++ ) { tok_name [ tok_desc [ i ] . tok_which ] = & tok_desc [ i ] ; } fixed = 1 ; } if ( FIRSTTOKEN <= token && token <= LASTTOKEN ) { ( void ) sprintf ( buf , " " , tok_name [ token ] -> tok_kind , tok_name [ token ] -> tok_name ) ; return ( buf ) ; } else { panic ( " \n " , token ) ; } }
turn a token type into a string
turn a token type into a string
/*NOTREACHED*/