示例#1
0
文件: voca.c 项目: drv5455/sdes_music
void setVoca( void )
{
    char token1[ SYMBOL_LEN ];
    char token2[ SYMBOL_LEN ];

    int virgin = 1;
    int bodynum = 0;
    BODY *bodyList = NULL;

    FILE *fp;
    char identifier[ SYMBOL_LEN ] = "";

    if( (fp = fopen( VocaFile, "r" )) == NULL ){
	errMes( "Can't open vocabulary file\"%s\"", VocaFile );
    }
    if( !SW_Quiet ){
	newLineAdjust();
	fputs( "Now parsing vocabulary file\n", stderr );
    }

    while( 1 ){
	static char line[ 1000 ];
	char *ptr = line;
	if( fgets( line, 1000, fp ) == NULL ){
	    entryTerm( identifier, bodyList, bodynum );
	    break;
	}
	if( line[ 0 ] == '\0' ) continue;
	if( line[ 0 ] == '#' ){
	    if( (ptr = gettoken( ptr, token1 )) == NULL ) continue;
	    if( !virgin ){
		entryTerm( identifier, bodyList, bodynum );
		bodyList = NULL;
		bodynum = 0;
	    } else {
		virgin = 0;
	    }
	    strcpy( identifier, token1 + 1 );
	    continue;
	} else {
	    ptr = gettoken( ptr, token1 );
	    if( ptr == NULL ) continue;
	    ptr = gettoken( ptr, token2 );
	    if( ptr == NULL ){
		bodyList = appendTerm( bodyList, token1 );
	    } else {
		bodyList = appendTerm( bodyList, token2 );
	    }
	    bodynum++;
	}
    }
}
示例#2
0
文件: schur2.cpp 项目: pzinn/M2
void schur_poly::append(iterator &first, iterator &last)
{
  for ( ; first != last; ++first)
    appendTerm(first.getCoefficient(), first.getMonomial());
}