/* @(#)gen_rr_matrix.c 2.1 93/05/19 */ /******************************************************************************/ /* function : gen_rr_matrix.c */ /* */ /* subsystem : chgen */ /* */ /* input : */ /* */ /* output : (fills store_into_matrix) */ /* */ /* returns : void */ /* */ /* author : Cheng */ /* */ /* created : July, 1991 */ /* */ /* revisions : 93s523: Changed to work with variable size table abbrevs. */ /* 11/30/00 : kmiu : NT port: included prototypes.h */ /* 11/30/00 : kmiu : Removed unreferenced variables */ /* */ /* description : This routine initializes the PINDEX matrix, sets up an */ /* initial path_history, and invokes gen_path. */ /* */ /******************************************************************************/ #include #include #include "chgen_define.h" #include "chgen_externs.h" #include "prototypes.h" void gen_rr_matrix ( ) { static char rcsid[] = "$Id: gen_rr_matrix.c,v 1.2.4.1 1999/05/04 17:00:04 jkarner Exp $"; char parent_abbrev[ABBREV_NAME_LENGTH],child_abbrev[ABBREV_NAME_LENGTH]; char path_history[TABLE_NO_LIMIT * 4 + 1] ; /* multiply 4 because each tab_abbrev_name can be 4 char,ex "AAAA". plus 1 , for the null char of path_history. */ struct rr_type *curr_ptr ; int i , j , x , y ,m,n; /* initialize PINDEX */ for ( i = 0 ; i < MAXTABLES ; i++) for( j = 0 ; j < MAXTABLES ; j++ ) { PINDEX[i][j].PathIsUnique = 0 ; } curr_ptr = cp_table ; while (curr_ptr != NULL) { for(m=0;m < hcg_abbr_size; m++) path_history[m] = curr_ptr->firstid[m]; for(n=0; n < hcg_abbr_size; n++, m++) path_history[m] = curr_ptr->secondid[n]; path_history[m] = '\0'; /* mark the end of path history */ /* save child_name and parent_name used later as parameters for gen_path */ strncpy_null(child_abbrev, curr_ptr->firstid, hcg_abbr_size); strncpy_null(parent_abbrev, curr_ptr->secondid, hcg_abbr_size); /* get the matrix index x and y */ TXindex = encoding ( child_abbrev ) ; x = TINDEX[TXindex].TTindex ; TXindex = encoding ( parent_abbrev ) ; y = TINDEX[TXindex].TTindex ; store_into_matrix(x, y, 1, path_history); gen_path ( path_history, child_abbrev, parent_abbrev ) ; curr_ptr = curr_ptr->next_ptr ; } return; }