nesasm/source/symbol.c
/* ----
 * colsym()
 * ----
 * collect a symbol from prlnbuf into symbol[],
 * leaves prlnbuf pointer at first invalid symbol character,
 * returns 0 if no symbol collected
 */
colsym()

collect a symbol from prlnbuf into symbol[],
leaves prlnbuf pointer at first invalid symbol character,
returns 0 if no symbol collected
colsym () collect a symbol from prlnbuf into symbol [] leaves prlnbuf pointer at first invalid symbol character returns 0 if no symbol collected
int
colsym(int *ip)
{
	int  err = 0;
	int	 i = 0;
	char c;
	for (;;) {
		c = prlnbuf[*ip];
		if (isdigit(c) && (i == 0))
			break;
		if ((!isalnum(c)) && (c != '_') && (c != '.'))
			break;
		if (i < (SBOLSZ - 1))
			symbol[++i] = c;
		(*ip)++;
	}
	symbol[0] = i;
	symbol[i+1] = '\0';
	if (i == 1) {
		switch (toupper(symbol[1])) {
		case 'A':
		case 'X':
		case 'Y':
			err = 1;
			break;
		}
	}
	if (check_keyword())
		err = 1;
	if (err) {
		fatal_error("Reserved symbol!");
		return (0);
	}	
	return (i);
}
int colsym ( int * ip ) { int err = 0 ; int i = 0 ; char c ; for ( ; ; ) { c = prlnbuf [ * ip ] ; if ( isdigit ( c ) && ( i == 0 ) ) break ; if ( ( ! isalnum ( c ) ) && ( c != ' ' ) && ( c != ' ' ) ) break ; if ( i < ( SBOLSZ - 1 ) ) symbol [ ++ i ] = c ; ( * ip ) ++ ; } symbol [ 0 ] = i ; symbol [ i + 1 ] = ' \0 ' ; if ( i == 1 ) { switch ( toupper ( symbol [ 1 ] ) ) { case ' ' : case ' ' : case ' ' : err = 1 ; break ; } } if ( check_keyword ( ) ) err = 1 ; if ( err ) { fatal_error ( " " ) ; return ( 0 ) ; } return ( i ) ; }
colsym()
 
 collect a symbol from prlnbuf into symbol[],
 leaves prlnbuf pointer at first invalid symbol character,
 returns 0 if no symbol collected
colsym () collect a symbol from prlnbuf into symbol [] leaves prlnbuf pointer at first invalid symbol character returns 0 if no symbol collected
/* get the symbol */ /* check if it's a reserved symbol */ /* error */ //		symbol[0] = 0;
 //		symbol[1] = '\0';
 /* ok */