agrep.c
void reinit_value()
{
        int i, j;

	/* Added on 7th Oct 1994 */
	
	if (AParse) {
		if (AComplexBoolean) destroy_tree(AParse);
		AComplexBoolean = 0;
		AParse = 0;
		PAT_BUFFER = 0;
		if (multibuf != NULL) free(multibuf);	/* this was allocated for arbit booleans, not multipattern search */
		multibuf = NULL;
		multilen = 0;
		/* Cannot free multifd here since that is always allocated for multipattern search */
	}
	for (i=0; i<anum_terminals; i++) {
		free(aterminals[i].data.leaf.value);
		memset(&aterminals[i], '\0', sizeof(ParseTree));
	}
	anum_terminals = 0;

        Bit[WORD] = 1;
        for (i = WORD - 1; i > 0  ; i--)  Bit[i] = Bit[i+1] << 1;
        for (i=0; i< MAXSYM; i++) Mask[i] = 0;

        /* bg: new things added on Mar 13 94 */
	
        Init1 = 0;
        NO_ERR_MASK = 0;
        memset(Init, '\0', MaxError * sizeof(unsigned));
        memset(Next, '\0', MaxNext * sizeof(unsigned));
        memset(Next1, '\0', MaxNext * sizeof(unsigned));
        wildmask = endposition = D_endpos = 0;
        for (i=0; i<WORD; i++)
                for (j=0; j<WORD; j++)
                        table[i][j] = 0;

        strcpy(D_pattern, original_D_pattern);
        D_length = original_D_length;
        strcpy(old_D_pat, original_old_D_pat);

	/* Changed on Dec 26th: bg */
	FASTREGEX = REGEX = 0;
	HEAD = TAIL = ON;	/* were off initially */
	RE_ERR = 0;
	AND = 0;
	M = 0;
	pos_cnt = 0;	/* added 31 Jan 95 */

	reinit_value_partial();
}
/* This must be called before every agrep_search to reset agrep globals */
This must be called before every agrep_search to reset agrep globals
This must be called before every agrep_search to reset agrep globals
void reinit_value()
{
        int i, j;
	if (AParse) {
		if (AComplexBoolean) destroy_tree(AParse);
		AComplexBoolean = 0;
		AParse = 0;
		PAT_BUFFER = 0;
		if (multibuf != NULL) free(multibuf);	
		multibuf = NULL;
		multilen = 0;
	}
	for (i=0; i<anum_terminals; i++) {
		free(aterminals[i].data.leaf.value);
		memset(&aterminals[i], '\0', sizeof(ParseTree));
	}
	anum_terminals = 0;
        Bit[WORD] = 1;
        for (i = WORD - 1; i > 0  ; i--)  Bit[i] = Bit[i+1] << 1;
        for (i=0; i< MAXSYM; i++) Mask[i] = 0;
        Init1 = 0;
        NO_ERR_MASK = 0;
        memset(Init, '\0', MaxError * sizeof(unsigned));
        memset(Next, '\0', MaxNext * sizeof(unsigned));
        memset(Next1, '\0', MaxNext * sizeof(unsigned));
        wildmask = endposition = D_endpos = 0;
        for (i=0; i<WORD; i++)
                for (j=0; j<WORD; j++)
                        table[i][j] = 0;
        strcpy(D_pattern, original_D_pattern);
        D_length = original_D_length;
        strcpy(old_D_pat, original_old_D_pat);
	FASTREGEX = REGEX = 0;
	HEAD = TAIL = ON;	
	RE_ERR = 0;
	AND = 0;
	M = 0;
	pos_cnt = 0;	
	reinit_value_partial();
}
void reinit_value ( ) { int i , j ; if ( AParse ) { if ( AComplexBoolean ) destroy_tree ( AParse ) ; AComplexBoolean = 0 ; AParse = 0 ; PAT_BUFFER = 0 ; if ( multibuf != NULL ) free ( multibuf ) ; multibuf = NULL ; multilen = 0 ; } for ( i = 0 ; i < anum_terminals ; i ++ ) { free ( aterminals [ i ] . data . leaf . value ) ; memset ( & aterminals [ i ] , ' \0 ' , sizeof ( ParseTree ) ) ; } anum_terminals = 0 ; Bit [ WORD ] = 1 ; for ( i = WORD - 1 ; i > 0 ; i -- ) Bit [ i ] = Bit [ i + 1 ] << 1 ; for ( i = 0 ; i < MAXSYM ; i ++ ) Mask [ i ] = 0 ; Init1 = 0 ; NO_ERR_MASK = 0 ; memset ( Init , ' \0 ' , MaxError * sizeof ( unsigned ) ) ; memset ( Next , ' \0 ' , MaxNext * sizeof ( unsigned ) ) ; memset ( Next1 , ' \0 ' , MaxNext * sizeof ( unsigned ) ) ; wildmask = endposition = D_endpos = 0 ; for ( i = 0 ; i < WORD ; i ++ ) for ( j = 0 ; j < WORD ; j ++ ) table [ i ] [ j ] = 0 ; strcpy ( D_pattern , original_D_pattern ) ; D_length = original_D_length ; strcpy ( old_D_pat , original_old_D_pat ) ; FASTREGEX = REGEX = 0 ; HEAD = TAIL = ON ; RE_ERR = 0 ; AND = 0 ; M = 0 ; pos_cnt = 0 ; reinit_value_partial ( ) ; }
This must be called before every agrep_search to reset agrep globals
This must be called before every agrep_search to reset agrep globals
/* Added on 7th Oct 1994 */ /* this was allocated for arbit booleans, not multipattern search */ /* Cannot free multifd here since that is always allocated for multipattern search */ /* bg: new things added on Mar 13 94 */ /* Changed on Dec 26th: bg */ /* were off initially */ /* added 31 Jan 95 */