diff -bitw pr_util_nolog/pr_load.c pr_util_log/pr_load.c >pr_load070202.dif saturn.cs.uml.edu(48)> diff -bitw pr_util_nolog/pr_load.c pr_util_log/pr_load.c |wc >> pr_load070202.dif 1,2d0 < // pr_util_nolog/i386-linux/probj/pr_load.c:1759: warning: type mismatch < 24,25c22,32 < *This is equivalent to having two independent 2-state models and states < *hcg_replay toggled by "SR"/"SP", hcg_log toggled by pr_startlog/pr_stoplog. --- > 0---startlog--->1 ---hcg_log ---> > / \ <-stoplog<- / \ | > V ^ V ^ | > SR| |SP SR| |SP |hcg_replay > V ^ V ^ | > \ / \ / | > 2---startlog--->3 V > <-stoplog<- > > *This is equivalent to having two independent 2-state models: state's MSbit > *hcg_replay toggled by "SR"/"SP", LSbit hcg_log toggled by pr_startlog/pr_stoplog. 27c34 < * Tests are defined as isLogging() and isReplay() --- > *(TBD) Tests to be defined as isLogging() and isReplay() 62c69 < extern void strncpy_null (char * , char * , int); --- > extern void strncpy_null (char * , char * , int); //Beware of overflow 126a134,136 > /** Pre-condition not checked: - RJL060227 **/ > /** strlen(a) must be long enough to void overflow **/ > /** Side effect: assert fails if a is not long enough **/ 130a141,142 > //dprintdd("strlen(a)=%d >=? n=%d \n", strlen(a), n); > 138a151 > 150c163 < /******************** (pr_load.c:150-182:) ******************************/ --- > /*********************************************************/ 152,155c165,168 < /* abbrev (first HCG_KEY_SIZE chars of the pkey string). */ < /* On success, global hcg_tbl_idx is set to an int >= 0, and 1 is returned */ < /* Otherwise, hcg_tbl_idx is set to -1, and 0 is returned. */ < /* This search is optimized using a form of caching. If hcg_tbl_idx */ --- > /* abbrev (which is assumed to be the first 2 chars of the pkey param). */ > /* If successful, the global hcg_tbl_idx is set to its idx, and 1 is */ > /* returned. Otherwise, the hcg_tbl_idx is set to 0, and 0 is returned. */ > /* This search is optimized using a form of caching. If the hcg_tbl_idx */ 157c170 < /* If not found, hcg_tbl_idx = -1 and return 0 (changed by RJL 040521) */ --- > /* Not-found case set hcg_tbl_idx to 0 (changed to -1 - RJL 040521) */ 159d171 < /* Side effects: Alters global hcg_tbl_idx; */ 161,162c173,176 < /* ALWAYS check return value PASS = 0 or 1; global hcg_tbl_idx = 0 is valid. */ < /* Arg't can hold ttabbrev or ASCII pkey - only HCG_KEY_SIZE chars are read. */ --- > /* ALWAYS check return value - > * hcg_tbl_idx = 0 is real and mis-leads on fail. RJL040611 */ > /* Bug fix TBD: ?? - assumed 0 was invalid return value */ > /* BUG?:strncpy appends '\0' terminator at a[n] regardless of strlen(a);*/ 164,178c178,182 < int find_tbl_idx(const char *pkey) /* check for comments FIRST!-RJL060730 */ < { /* TBD: ignore comment lines - see pr_init context.-RJL06000730 */ < int PASS = 0; < char tmpabb[HCG_ABBR_SIZE+1]; < EP;strncpy(tmpabb, hcg_table_seq_list[hcg_tbl_idx].ttabbrev, HCG_ABBR_SIZE); < tmpabb[HCG_ABBR_SIZE] = '\0'; /* insure copy/compare termination -RJL070126 */ < dprintdd("HCG_ABBR_SIZE = %d, HCG_NUM_TABLES = %d\n", < HCG_ABBR_SIZE, HCG_NUM_TABLES); < /* check cached value first */ < if (strncmp(pkey,tmpabb,HCG_ABBR_SIZE) == 0) /*strcmp-->strncmp-RJL040522 */ < { < dprintds("find_tbl_idx: old hcg_tbl_idx %d matches pkey %s \n", < hcg_tbl_idx, pkey); < PASS = 1; //return(1); /* current hcg_tbl_idx is valid - skip search */ < } --- > int find_tbl_idx(const char *pkey) > { char tmpabb[HCG_ABBR_SIZE+1]; > strncpy(tmpabb, hcg_table_seq_list[hcg_tbl_idx].ttabbrev, HCG_ABBR_SIZE); > if (strncmp(pkey,tmpabb,HCG_ABBR_SIZE) == 0) > return(1); /* strcmp --> strncmp - RJL 040522 */ 180d183 < else { 182c185 < { --- > { /* strncpy restored inside loop - RJL 040522 */ 184,194c187,188 < if (strncmp(pkey, tmpabb, HCG_ABBR_SIZE) == 0) < { dprintds("find_tbl_idx OK: new hcg_tbl_idx = %d matches pkey %s \n", < hcg_tbl_idx, pkey); < PASS = 1; //return(1); /* hcg_tbl_idx is valid - after search */ < break; < } < } < } /* end search ...*/ < if (PASS==1) { < dprintds("hcg_tbl_idx = %d, pkey = %x \n", hcg_tbl_idx, pkey); < //assert(hcg_tbl_idx == encode_abbrev(tmpabb)); /* invariant? - RJL070126 */ --- > if (strncmp(pkey, tmpabb, HCG_ABBR_SIZE) == 0) { > return(1); 196c190 < else { --- > }/* not found */ 198,201c192,193 < dprintd("find_tbl_idx fails; hcg_tbl_idx <-- %d\n", hcg_tbl_idx); < } < LP;return(PASS); < } /* end find_tbl_idx (:150-186:)*/ --- > return(0); > } /* end find_tbl_idx */ 209c201 < /* Note: clients are pr_init(loads views), load_data (seaqrch views) and pr_replay? */ --- > /* Note: clients are pr_init(loads views),load_data(search views),pr_replay? */ 212,213c204,209 < { char tmpname[MAXVIEWNAMELEN+1];/* '+1' added - RJL060208 */ < /* check for a match at cached hcg_view_idx iff in-range - RJL 040616 */ --- > { char tmpname[MAXVIEWNAMELEN]; > //EP; > //dprintsd("Entered find_view_idx(view=%s, hcg_view_idx = %d)\n", > // viewname, hcg_view_idx); > /* this logic was rewritten - RJL 040616 */ > /* check for a match at cached hcg_view_idx if in-range - RJL 040616 */ 219a216,218 > //DP; dprintsd( > // "viewname %s matched w/o search at hcg_view_idx= %d\n", > // viewname, hcg_view_idx); 225a225,226 > //dprintdd("for_loop iter: hcg_view_idx = %d, hcg_view_list.num_views = %d\n", > // hcg_view_idx, hcg_view_list.num_views); 228a230,232 > //DP; dprintsd( > // "Found match to viewname %s at hcg_view_idx = %d\n", > // viewname, hcg_view_idx); 232c236,242 < hcg_view_idx = -1; /* added-RJL070126 */ --- > //dprintdd( > // "After for_loop: hcg_view_idx = %d, hcg_view_list.num_views = %d\n", > // hcg_view_idx, hcg_view_list.num_views); /* RJL 040622 */ > //DP; > //dprints("for_loop exit: failed to find viewname = %s\n", (char*)tmpname); > //dprintdd("\t hcg_view_idx = %d, hcg_view_list.num_views = %d\n", > // hcg_view_idx, hcg_view_list.num_views); 281c291 < /* read buffer, reads the next line of the file, and then converts any */ --- > /* read buffer, reads the next line at hcg_ascii_fp, and then converts any */ 284d293 < /* RJL070126: limit read to BUFSIZE-1] chars to avoid input overflow? */ 288,289c297,298 < clear_mem(hcg_buffer,BUFSIZE); /* NULL char fill */ < fgets(hcg_buffer,BUFSIZE,hcg_ascii_fp); /* don't over-run last byte */ --- > clear_mem(hcg_buffer,BUFSIZE); > fgets(hcg_buffer,BUFSIZE,hcg_ascii_fp); 304a314 > /* RJL051217: Should s[BUFSIZE-1] = '\0' to avoid input overflow? */ 325d334 < 336,339c345 < /* by tbl_idx). Arg3 is locally renamed. set_version does the actual update. */ < /* RJL070201: fkeys must also be updated - here, tbl_idx is fkey table-type idx.*/ < /* Here, must convert fkey to pass tbl_idx. THIS IS NOT DONE IN CLIENT OR BELOW!*/ < /* This may corrupt dumps and/or loads? -RJL070201 */ --- > /* by tbl_idx). Arg3 locally renamed as is_new_version */ 348,349c354 < printf("Error: Can not set version# at p_key %lx to %d\n", < (unsigned long) p_key, hcg_table_seq_list[tbl_idx].maxver + 1); --- > printf("Error: Can not set version# at p_key %lx to %d\n", (unsigned long) p_key, hcg_table_seq_list[tbl_idx].maxver + 1); 358d362 < /* Changed to HCG_KEY_SIZE and HCG_ABBR_SIZE - RJL060218 */ 360d363 < 376c379 < static int key_len = HCG_KEY_SIZE; --- > static int key_len = HCG_KEY_SIZE; /* == OLD_KEY_LEN or NEW_KEY_LEN */ 392c395 < set_external_key_length( int klen ) --- > set_external_key_length( int klen ) /* has no client users? -RJL060228 */ 428c431 < * If fails, sets ver = empty string and returns -1. --- > * If fails, sets ver = empty string and returns -1 434c437 < if( key_len == OLD_KEY_LEN ) /* 2+2+4 bytes */ --- > if( key_len == OLD_KEY_LEN ) 439c442 < else if( key_len == NEW_KEY_LEN ) /* 4+3+5 bytes */ --- > else if( key_len == NEW_KEY_LEN ) 458c461 < if( key_len == OLD_KEY_LEN ) /* 2+2+4 bytes */ --- > if( key_len == OLD_KEY_LEN ) 462c465 < else if( key_len == NEW_KEY_LEN ) /* 4+3+5 bytes */ --- > else if( key_len == NEW_KEY_LEN ) 476d478 < * - RJL 040521 570c572 < if( klen == OLD_KEY_LEN ) --- > if( klen == OLD_KEY_LEN ) /* if ncp==2 */ 577c579 < else --- > else /* if ncp==4 */ 601,602c603,604 < * Returns NULL ptr if failure. < * Calls decode() to set external_key and return +/-1 --- > * Returns NULL ptr if failure. WARNING: Not re-entrant: extrnal_key is corrupted. > * Calls decode() to set external_key and return 1, else return -1. 608c610 < return ( (status = decode(external_key,k)) == 1 ) ? external_key : NULL; --- > return (( (status = decode(external_key,k)) == 1 ) ? external_key : NULL); 612,613c614,616 < * Decode the encoded key k, return key_string or empty *external_key < * Calls abb_decode, ver_decode, row_decode --- > * Decode the encoded key k, put key_string or '\0' into *external_key array > * Calls abb_decode, ver_decode, row_decode; expects external_key[KEY_SIZE+1]; > * Clients: decode_retstr + others. 617,618c620 < // EP; < char t[HCG_KEY_SIZE+1] = ""; --- > 620,621c622,629 < external_key[0] = '\0'; < if (k == 0) {LP;return -1;}; /* assert !=0 failed 0512, 0601 -RJL */ --- > char t[HCG_KEY_SIZE+1] = ""; /* empty string */ > assert(t[0] == '\0'); > strncpy_null(external_key, t, HCG_KEY_SIZE+1); /* append each key part from t */ > /* external_key is static in client decode_rtnstr(); */ > if (k == 0) > { > LP;return -1; > } 629c637,638 < if ( klen != HCG_ABBR_SIZE) /* RJL060219 */ --- > /*if( ((klen = strlen(t)) != OLD_ABB_LEN) && (klen != NEW_ABB_LEN) )*/ > if (klen != HCG_ABBR_SIZE) /* RJL060218 */ 636c645 < strcat( external_key, t ); /*tttype*/ --- > strcat( external_key, t ); 643c652 < strcat( external_key, t ); /* ttyp+ver*/ --- > strcat( external_key, t ); 649c658 < { /*ttyp+ver+row*/ --- > { 651d659 < assert(strlen(external_key)==HCG_KEY_SIZE); 657c665 < } // end decode --- > } /* end decode */ 664,666c672,674 < if( *(unsigned long*)k1 < *(unsigned long*)k2 ) return -1; < if( *(unsigned long*)k1 == *(unsigned long*)k2 ) return 0; < else return 1; --- > if( *(unsigned long*)k1 < *(unsigned long*)k2 ) {return -1;}; > if( *(unsigned long*)k1 == *(unsigned long*)k2 ){return 0;} > else { return 1;} 763d770 < /* end of gen_pr_utils output to pr_load.c */ 766c773 < /* 747-760: new function to reject comment prefix '/_/' or '/_*' in first token */ --- > /* 772-784: new function to reject comment prefix '/_/' or '/_*' in first token */ 779c786 < }/* end notacomment:pr_load.c:747-760: */ --- > }/* end notacomment:pr_load.c:772-784 */ 780a788 > /* end of gen_pr_utils output to pr_load.c */ 782,783c790 < < /**************** (:770-1098:)******************************************/ --- > /******************************************************************************/ 794c801 < void pr_init ( char *viewdef_filename, char *filelist) /* 781-1098 */ --- > void pr_init ( char *viewdef_filename, char *filelist) /* (799-1194)*/ 808,812c815,820 < char temp_mode[8]; < char temp_command[100]; < char table_abbrev[HCG_ABBR_SIZE+1]; < char temp_verstring[5];//(NOT in schema.h - RJL060512) < char badttabbrv[HCG_ABBR_SIZE+1]; --- > /* Next two HCG_ABBR_SIZE sizes changed from ABBREV_NAME_LENGTH - RJL060204 */ > char temp_mode[8],temp_command[100],table_abbrev[HCG_ABBR_SIZE+1]; > char temp_verstring[HCG_KEY_SIZE], badttabbrv[HCG_ABBR_SIZE+1]; /* was ^^^ -RJL0600204*/ > /* Genlog - 5/7/96: log call to pr_init */ > char log_text[BUFSIZE]; > FILE *logdata_fp; 813a822,832 > if (hcg_log) > { > printf("Warning: pr_init() called during log session"); > printf("may cause unexpected results.\n"); > } > logwait(); > sprintf(log_text, "IN %s %s\n", viewdef_filename, filelist); > logstr(log_text); > > /* End Genlog addition */ > 819c838 < /*in lut.c, bbr_lut_create calls lut_init(p_lut, ABBR_TBL_TYPE); -RJL051127 */ --- > /*in lut.c, abbr_lut_create calls lut_init(p_lut, ABBR_TBL_TYPE); -RJL051127 */ 830a850,865 > /* Added by Genlog 5/7/96 */ > /* For the capture of datafile [logging info?] if NOT in replay session */ > /* THE INTENT OF THIS IS UNCLEAR TO ME - RJL 031019 */ > /* if (hcg_log != 2) { */ > /* why not if(hcg_log == 1) (logging has been activated) */ > /* (independent of hcg_replay?)*/ > > if (hcg_log == 1) { /*try to open file for LATER replay - RJL 040425 */ > if ((logdata_fp = fopen("logdata.txt", "w")) == NULL) { > printf("pr_init(): can not open logdata.txt to WRITE the log data\n"); > exit(2); /* is it safe for pr_init to preserve hcg_log = 1? */ > > } > } > /* End Genlog Addition*/ > 888a924,930 > /* Added by Genlog 5/7/96 to log pr_init */ > /* if (hcg_log != 2) */ > > if (hcg_log == 1) /*logging is on: add Keyword+filename to logdata_fp*/ > // fprintf(logdata_fp, "LogDataFile %s\n", localptr);/* localptr added 040602 -RJL */ > /* End Genlog Addition */ > 891c933,934 < while ( !feof(hcg_ascii_fp) )/* if hcg_log == 1, append infile data rows to logdata.txt */ --- > while ( !feof(hcg_ascii_fp) ) > /* if hcg_log == 1, append infile data rows to logdata.txt */ 894c937,941 < //DP;dprints("hcg_buffer: %s\n", hcg_buffer); --- > /* Genlog 5/7/96: log table rows [to be] copied to logdata_fp file */ > if (hcg_log == 1) /* was != 2 (not in replay) - RJL 040622 */ > fprintf(logdata_fp, "%s\n",hcg_buffer); > /* End Genlog Addition */ > 897,901c944,951 < if (!find_tbl_idx(hcg_t)) /* caches and may alter hcg_tbl_idx - RJL 040622 */ < { /* TBD: skip comments without complaint - RJL060730 */ < strncpy_null(badttabbrv, hcg_t, HCG_ABBR_SIZE); < printf("pr_init Warning: unknown table %s found in scanned datafile %s, ignored.\n", < badttabbrv,scan_filename); --- > > if(strlen(hcg_t) != HCG_KEY_SIZE) /*moved above find_tbl_idx-RJL060228*/ > { > DP;if (notacomment(hcg_t)==1) { > fprintf(stderr, > "pr_init Warning: invalid keysize %d for key %s, must be %d, ignored.\n" > ,(int)strlen(hcg_t), hcg_t, HCG_KEY_SIZE); > } /* else just skip the comment: -RJL060308*/ 905c955,957 < if(strlen(hcg_t) != HCG_KEY_SIZE) --- > > if (!find_tbl_idx(hcg_t)) > /* caches and may alter hcg_tbl_idx - RJL 040622 */ 907,908c959,965 < printf("pr_init Warning: invalid keysize %d for key %s, must be %d, ignored.\n", < (int)strlen(hcg_t), hcg_t, HCG_KEY_SIZE); --- > strncpy_null(badttabbrv, hcg_t, HCG_ABBR_SIZE); > //ABBREV_NAME_LENGTH ---> HCG_ABBR_SIZE - RJL060204 > DP;if (notacomment(hcg_t)==1) { > fprintf(stderr, > "pr_init Warning: unknown tbltype %s found in scanned datafile %s, ignored.\n", > badttabbrv, scan_filename); > } /* else just skip the comment -RJL060308 */ 912c969 < --- > // tbl_idx is valid for pkey hcg_t now: 915,916c972 < < /* copy version digits from pkey at version# offset: */ --- > /* copy version digits from pkey offset: */ 923c979 < exit(0); /* exit closes (hcg_ascii_fp)? */ --- > LP;exit(0); /* exit closes (hcg_ascii_fp)? */ 933c989,990 < /*dprintdd("hcg_row = %d, hcg_version = %d ", hcg_row, hcg_version);DP;*/ --- > /* dprintdd("hcg_row = %d, hcg_version = %d in ", > hcg_row, hcg_version);DP; newline in DP */ 936c993 < /* This reported 1-char pkeys during load of table FO - RJL 040616 */ --- > /* This reported 1-char pkeys only during load of table FO - RJL 040616 */ 943c1000 < //dprintdd("New maxver = %d from key %x\n", hcg_version, hcg_k); --- > dprintdd("New maxver = %d from key %x\n", hcg_version, hcg_k); 946c1003 < } /* end while (!feof(hcg_ascii_fp))*/ --- > } /* while (!feof(hcg_ascii_fp))*/ 953a1011,1038 > if (hcg_log == 1) /* added 040622 - RJL */ > fclose(logdata_fp); /* done copying infiles */ > > /* Added by Genlog 5/7/96 to log pr_init */ > /* if (hcg_log != 2) why? = RK: 04042only 5 - crashed bde below - RJL 040530 */ > /* if (hcg_log == 1) */ > /* This crashed bde 040530:1150 - RJL: */ > /* End Genlog Addition */ > /* filelist is effectively consumed by now. */ > > /*===================read viewdefs===============================*/ > /* shouldn't this have been done earlier ? - RJL 040622 */ > /* (maybe not if scan filelist gets pkey ranges BEFORE pr_load is called?) */ > /* Open viewdef_filename to load view defs : > * filename = *.viewdefs; > * file format: > * These should be 2 meta-schema table types ([DV]---<[VE]) - RJL 040615 > * define_view 94sbdedefaultsView read > * view_element 94sbdedefaultsView GD 0 > * ... > * define_view 94sbdeview update (All highest versions for update) > * view_element 94sbdeview HG 0 > * ... > * NOTE: viewnames MUST be declared before their resp[ective view_elements. > * BUT: view_elements need NOT be placed directly under their define_View parent. > * E.g., ALL viewnames may be declared before ANY view elements > * (due to the redundant viewname prefix to each view_elelement line).- RJL 040622 > */ 975c1060 < /*DP;*/ --- > 983c1068 < if (hcg_view_list.num_views >= MAXVIEWS) --- > if (hcg_view_list.num_views >= MAXVIEWS) /* = 10 */ 985c1070,1071 < printf("Error: Too many views defined (max=%d), next view would have been %s.\n", --- > printf( > "Error: Too many views defined (max=%d), next view would have been %s.\n", 1007c1093 < printf("pr_init:970: added viewname '%s' to viewdefs file.\n", viewname); --- > DP;dprints("pr_init:1076: added viewname '%s' to viewdefs file.\n", viewname); 1019c1105 < /*DP;*/ --- > 1028,1029c1114,1115 < hcg_parse(hcg_buffer,table_abbrev,&idx); //get pkey? < if (!find_tbl_idx(table_abbrev)) /*TBD:ignore commments-RJL060730*/ --- > hcg_parse(hcg_buffer,table_abbrev,&idx); > if (!find_tbl_idx(table_abbrev)) 1034c1120 < hcg_read_next(); /* skip this table type */ --- > hcg_read_next(); 1037,1038c1123,1124 < /* Now can assume valid hcg_tbl_idx - RJL 040616 */ < hcg_parse(hcg_buffer,temp_verstring,&idx);//parse version# only? --- > /* Now can assume valid hcg_table_idx - RJL 040616 */ > hcg_parse(hcg_buffer,temp_verstring,&idx); 1042c1128 < { --- > { /* MAXVERSIONS = 0 now - RJL060308 */ 1045c1131 < hcg_read_next(); /* skip this table type */ --- > hcg_read_next(); 1052c1138 < printf("Error: view %s invoked on table %s as write, MAXVERSION of %d is used\n", --- > printf("Error: view = %s invoked on table %s as write, MAXVERSION = %d is already used\n", 1084c1170 < } /* end if view_element */ --- > } /* end if icmd = define_view or view_element */ 1099c1185 < else /* empty temp_command ==> empty line */ --- > else { /* empty temp_command ==> empty line */ 1101a1188 > } 1106,1107d1192 < printrowcounts("94sbdeview"); /*debug use - RJL060807*/ < printrowcounts("94sbdedefaultsView"); /* tables FO, GD - RJL060807*/ 1109c1194 < hcg_initialized = 1;/* prevent redo of pr_init; enable pr_dump to bde_abort.dat */ --- > hcg_initialized = 1;/* prevent redo of pr_init; enable dump to bde_abort.dat */ 1111c1196 < LP;}/* end pr_init (log:1592:1922)(nolog:781-1098) */ --- > LP;}/* end pr_init (799-1194)*/ 1158c1243 < /* WHY NO dowhile brackets below? - RJL060919 */ --- > /* RJL060309: even if tbl==NULL, tbl##curr=tbl_elt at exit (valid post-cond) */ 1232,1237c1317 < /* children. (ca,pa are ttabbr's, cf,pk,p,c are pfkey fieldnames) */ < /* E.g. in struct GX: hcg_key GXid, CGid; struct CG *CGid_pp; */ < /* struct dummy_type *CGid_fpp; struct GX *next_ptr; */ < /* so macro arg signature is: struct ca, struct pa, and 4 hcg_key types */ < /* and derived ptr types are: struct ca *ca, *ca##curr, *ca##elt, *p_fcp; */ < /* struct pa *pa##curr, *pa##elt, *p##_fpp; dummy_type c##_fpp; */ --- > /* children. Pre-condition: pa##elt is a valid (pa*) ptr. */ 1239d1318 < 1241,1243c1320,1322 < pa##curr = pa##elt;/* invariant */ \ < ca##curr2 = ca; /* first child tbl row ptr */ \ < while(ca##curr2 != NULL) \ --- > pa##curr = pa##elt; \ > ca##curr2 = ca; \ > while(ca##curr2) \ 1246c1325 < { /* insert ca_curr2 as first child */\ --- > { \ 1250c1329 < { /*singleton child */\ --- > { \ 1257,1259c1336 < ca##temp2 = (struct ca *)ca##temp2->p##_fpp);\ < /*empty loop body*/ \ < /*assert(ca##temp2->p##_fpp == (struct dummy_type *)pa##curr;);*/\ --- > ca##temp2 = (struct ca *)(ca##temp2->p##_fpp) ) /*no-op*/; \ 1261,1289c1338 < } \ < ca##temp2 = ca##curr2; \ < } /*endif*/\ < ca##curr2 = (ca##curr2->next_ptr);\ < } /*end while and macro */ < < #if 0 < #define link_child_nobp_m(ca,pa,cf,pk,p,c) \ < pa##curr = pa##elt; \ < ca##curr2 = ca; /* first child tbl row ptr */ \ < while(ca##curr2 != NULL) \ < { \ < if (key_compare(&ca##curr2->cf, &pa##curr->pk) == 0) \ < { /* first child */\ < ca##curr2->p##_pp = pa##curr; \ < ca##curr2->p##_fpp = (struct ca *) pa##curr; \ < if (pa##curr->c##_fcp == (dummy_type) NULL) \ < { /*singleton chld */\ < pa##curr->c##_fcp = (dummy_type) ca##curr2; \ < } \ < else \ < { \ < for (ca##temp2 = pa##curr->c##_fcp; \ < ca##temp2->p##_fpp != (struct ca *)pa##curr; \ < ca##temp2 = ca##temp2->p##_fpp);\ < /*empty loop body*/ \ < assert(ca##temp2->p##_fpp == (struct ca *)pa##curr;);\ < ca##temp2->p##_fpp = ca##curr2; \ < } \ --- > }; \ 1292c1341 < ca##curr2 = (ca##curr2->next_ptr); --- > ca##curr2 = ca##curr2->next_ptr; \ 1294c1343 < #endif --- > 1301c1350,1353 < for (pa##curr2 = pa; (pa##curr2 != NULL) && (key_compare(&pa##curr2->pk,&ca##curr->cf) < 0); pa##curr2 = pa##curr2->next_ptr); \ --- > for (pa##curr2 = pa; \ > (pa##curr2 != NULL) && (key_compare(&pa##curr2->pk,&ca##curr->cf) < 0); \ > pa##curr2 = pa##curr2->next_ptr;\ > ) /*no-op*/; \ 1308c1360 < /******************************************************************************/ --- > /*****************************************************************************/ 1318c1370 < /* calls to link_child_{no}bp are included in the caller (pr_add). */ --- > /* calls to link_child_[no}bp are included in the caller (pr_add). */ 1321d1372 < /* */ 1324,1325d1374 < for (pa##curr2 = pa; (pa##curr2 != NULL) && (key_compare(&pa##curr2->pk,&ca##curr->cf) < 0); pa##curr2 = pa##curr2->next_ptr); \ < if ((pa##curr2 != NULL) && (key_compare(&ca##curr->cf,&pa##curr2->pk) == 0)) \ 1327,1328c1376,1382 < ca##curr->p##_pp = pa##curr2; \ < /*(struct pa *) ca##curr->p##_fpp = pa##curr2;*/ \ --- > for( pa##curr2 = pa; \ > pa##curr2 != NULL && key_compare(&pa##curr2->pk, &ca##curr->cf) < 0; \ > pa##curr2 = pa##curr2->next_ptr \ > ) /* no-op */ ; \ > if (pa##curr2 != NULL && key_compare(&ca##curr->cf,&pa##curr2->pk) == 0 ) \ > { \ > ca##curr->p##_pp = pa##curr2; /* ADDED 060310 */ \ 1335,1337c1389,1393 < (struct pa*) ca##temp2->p##_fpp != pa##curr2; \ < ca##temp2 = (struct ca *)ca##temp2->p##_fpp); \ < /*(struct ca *)*/ ca##temp2->p##_fpp = (struct dummy_type*) ca##curr; \ --- > ca##temp2->p##_fpp != (struct dummy_type*)pa##curr2; \ > ca##temp2 = (struct ca*)(ca##temp2->p##_fpp) \ > ) /*no-op*/ ; \ > ca##temp2->p##_fpp = (struct dummy_type*)ca##curr;/*RJL060310*/ \ > } \ 1339a1396 > /* end macro link_parent_nobp_m */ 1341c1398 < /******************************************************************************/ --- > /*********************** (1350-1418) *********************************/ 1344c1401 < --- > /* expanded first call to link_parent_nobp_m(HN, HG,...) line 1379 to 17 lines */ 1347,1348c1404,1405 < {EP; < dprintd("tbl_encoding = %d\n", tbl_encoding);//RJL060204 --- > { > 1365c1422 < case 3 : /* encoding of HN */ --- > case 3 : /* encoding of HN (1374:1380) */ 1378c1435 < case 5 : /* encoding of HL */ --- > case 5 :/* encoding of HL *//*Pre-cond: valid HNcurr*/ 1382c1439,1465 < link_parent_nobp_m(HL,HN,HNid1,HNid,HNid1,HLid1); --- > /*link_parent_nobp_m(HL,HN,HNid1,HNid,HNid1,HLid1);*/ > //expansion (g++ -E) of link parent HNid1:pr_load:1437-1455 -RJL060309 > assert(HLcurr!= NULL); > { for( HNcurr2 = HN; > HNcurr2!=((void*)0)&&key_compare(&HNcurr2->HNid,&HLcurr->HNid1)<0; > HNcurr2 = HNcurr2->next_ptr ) ; // empty body > if (HNcurr2 != ((void *)0)&&key_compare(&HLcurr->HNid1,&HNcurr2->HNid)==0) > { > HLcurr->HNid1_pp = HNcurr2; /* ADDED 060310 */ \ > HLcurr->HNid1_fpp = (struct dummy_type*)HNcurr2; > DP;fprintf(stderr,"HLcurr = %px, HLcurr->HNid1_fpp = %px\n", > HLcurr,HLcurr->HNid1_fpp); > if (HNcurr2->HLid1_fcp == ((void *)0)) /* no HL-children yet */ > HNcurr2->HLid1_fcp = HLcurr; /* first HL-child */ > else { > for ( HLtemp2 = HNcurr2->HLid1_fcp; > HLtemp2->HNid1_fpp != (struct dummy_type*)HNcurr2; > HLtemp2 = (struct HL*)(HLtemp2->HNid1_fpp));//emptybody > HLtemp2->HNid1_fpp = (struct dummy_type*)HLcurr;/*RJL060310*/ > } > } > else { > DP; fprintf(stderr, "HLtemp2 = %px, HLemp2->HNid1_fpp = %px\n", > HLtemp2,HLtemp2->HNid1_fpp); > } > }; // end link_parent HNid1 > 1409c1492 < LP;} /* end pr_link */ --- > } /* end pr_link ( :1418)(1480 wih expansion)*/ 1414c1497 < --- > /* pre-cond: size is not largr than int */ 1419c1502 < /* This should also set all the keys to null_key() but doesn't right now -- MM */ --- > /* This should also set all keys to null_key() but doesn't right now -- MM */ 1423,1428c1506,1509 < /************************************************************************/ < /* Macro pr_gen_key composes the next available primary key value */ < /* for the specified table, from its last 3 params. */ < /* When pr_gen_pkey calls pr_gen_key, it insures tbl_abbrv is in viewname.*/ < /* When pr_check_fkey calls pr_gen_key, fkeys default to version = row = 0.*/ < /************************************************************************/ --- > /******************************************************************************/ > /* This macro is used to generate the next available primary key value for the*/ > /* specified table, using the specified view. */ > /******************************************************************************/ 1437c1518 < /**************** (pr_load.c:1421-:1444:) *************************************/ --- > /******************************************************************************/ 1439c1520 < /* gets args from hcg_* structs and calls pr_gen_key to concat pkey parts; */ --- > /* gets args from hcg_* structs and calls pr_gen_key to update pkey; */ 1444,1446d1524 < /* bde/pr_util_nolog/94sbde_schema.h:504: */ < /* Added '&&find_tbl_idx(#tbl)' to find_view_idx(viewname) cond'n-RJL060806 */ < /* (does find_tbl_idx check this cached value before looping?) */ 1448d1525 < /* TBD: ignore comments - see pr_init context - RJL060730 */ 1454c1531 < DP;tt##idx = (int) hcg_tbl_idx;\ --- > tt##idx = (int) hcg_tbl_idx;\ 1457,1458c1534 < version_no = 0; /* RJL060808 */\ < /* 0 was (hcg_view_list.view_list[hcg_view_idx].version_list[tt##idx]);*/\ --- > version_no = (hcg_view_list.view_list[hcg_view_idx].version_list[tt##idx]);\ 1461c1537 < } /* end if */\ --- > } \ 1463c1539 < } while (0); /* end pr_gen_pkey (:1421-1444:) */ --- > } while (0); 1466c1542 < /* pr_check_fkey modified: compose and print 32-bit unsigned fkey as hex */ --- > /* pr_check_fkey modified: print 32bit unsigned fkey as hex */ 1486c1562 < /************************************************************************/ --- > /**************************************************************************/ 1489,1491c1565,1567 < /* error at [_log?]pr_load.c:2283: unterminated character constant-RJL040616*/ < /************************************************************************/ < /* [i--] changed to [i] in for-loop which also does i-- - RJL060806 */ --- > /* error at pr_load.c:2283: unterminated character constant - RJL 040616 */ > /**************************************************************************/ > 1497,1498c1573,1574 < "Warning: null %s.%s : expanded to at most '?^ for pkey %ux\n", \ < #tbl_abbr, #fldname, (unsigned int) (tbl_ptr->tbl_abbr##id));\ --- > " Warning: null %s.%s : expanded to at most ??? for pkey %ux\n", \ > #tbl_abbr, #fldname, (unsigned int) tbl_ptr->tbl_abbr##id);\ 1502c1578 < (tbl_ptr)->fldname[i] = (char)'\?';\ --- > (tbl_ptr)->fldname[i--] = (char)'\?';\ 1505a1582,1730 > > /*************************************************************************/ > /* Function : log_pr_add */ > /* */ > /* Abstract : This function is used to log a pr_add transaction */ > /* The tbl indicates which table is having a row added. */ > /* tbl_ptr points to the record to be added. */ > /**************************************************************************/ > /* TBD: Define a macro for all these cases. No need for repetitious code */ > /* Pre-condition: hcg_log == 1 */ > /* Pre-condition: exists FILE* hcg_logfileptr open for output */ > /* Pre-cond failed 040712: pr_startlog was not called to open it */ > /* Why can't dump_row be used to log the row exactly? -RJL060310 */ > //New state model for logging/replay - RJL 040712; (not tested for state 3 yet) > // See preamble to pr_load.c; do log_pr_add iff (hcg_log) > > void log_pr_add (char *tbl, char *viewname, hcg_ptr tbl_ptr) > { > FILE* hcg_logfileptr; // pre-cond: already open (by startllog?)- RJL 040708 > char outkey[3][HCG_KEY_SIZE+1]; // updated by decode(outkey[j], anykeyfield) > int idx; > EP; > /* pre-condition: logging is turned on by startlog(); */ > //assert(hcg_log); /* failed 040713.0130 - RJL 040713 */ > if (!hcg_log) { > dprint("WARNING: log_pr_add call with hcg_log = 0, ignored.\n"); > return; > } > > assert(find_tbl_idx(tbl)); /* alters tbl##curr; exit if NULL */ > if (hcg_log){ > > idx = hcg_tbl_idx; > > /* Write to hcg_logfile based on idx */ > /* TBD: make this a switch on idx = enumerated ttabbrev symbols */ > if (idx==0) > { > FOcurr=(struct FO *) tbl_ptr; > hcg_update_version(&FOcurr->FOid,FO_idx,0); > decode(outkey[0], &FOcurr->FOid); > PrintCheck(fprintf(hcg_logfileptr, > " %-8s %-50s %-50s %-2s %-15s\n", > outkey[0], FOcurr->xfont, FOcurr->psfontname, > FOcurr->psfontsize, FOcurr->bdefont)); > } > if (idx==1) > { > GDcurr=(struct GD *) tbl_ptr; > hcg_update_version(&GDcurr->GDid,GD_idx,0); > decode(outkey[0], &GDcurr->GDid); > PrintCheck(fprintf(hcg_logfileptr, > " %-8s %-10s %8.4f %8.4f %-4s %-25s %-10s %-10s %8.4f %8.4f\n", > outkey[0], GDcurr->shape, GDcurr->width, GDcurr->height, > GDcurr->hsegpattern, GDcurr->txtfont, GDcurr->location, > GDcurr->justify, GDcurr->gcwidth, GDcurr->gcheight)); > } > if (idx==2) > { > HGcurr=(struct HG *) tbl_ptr; > hcg_update_version(&HGcurr->HGid,HG_idx,0); > decode(outkey[0], &HGcurr->HGid); > PrintCheck(fprintf(hcg_logfileptr, " %-8s %-8s %-8s %-12s %-12s %-12s %-60s\n" > , outkey[0], HGcurr->FSid, HGcurr->HNid, HGcurr->HGauthor, HGcurr->HGcreated, HGcurr->HGlastmod > , HGcurr->HGtitle)); > } > if (idx==3) > { > HNcurr=(struct HN *) tbl_ptr; > hcg_update_version(&HNcurr->HNid,HN_idx,0); > decode(outkey[0], &HNcurr->HNid); > hcg_update_version(&HNcurr->HGid,HG_idx,0); > decode(outkey[1], &HNcurr->HGid); > PrintCheck(fprintf(hcg_logfileptr, " %-8s %-8s %-8s %-1s %8.4f %8.4f %8.4f %8.4f %-25s %8.4f %8.4f %8d %8d %-20s\n" > , outkey[0], outkey[1], HNcurr->FSid, HNcurr->shape, HNcurr->centerx, HNcurr->centery > , HNcurr->width, HNcurr->height, HNcurr->txtfont, HNcurr->txtoffsetx, HNcurr->txtoffsety, HNcurr->txtwidth > , HNcurr->txtheight, HNcurr->nodename)); > } > if (idx==4) > { > HAcurr=(struct HA *) tbl_ptr; > hcg_update_version(&HAcurr->HAid,HA_idx,0); > decode(outkey[0], &HAcurr->HAid); > hcg_update_version(&HAcurr->HNid,HN_idx,0); > decode(outkey[1], &HAcurr->HNid); > PrintCheck(fprintf(hcg_logfileptr, " %-8s %-8s %-8s %8.4f %8.4f %8.4f %8d %8d %-25s %-60s\n" > , outkey[0], outkey[1], HAcurr->DAid, HAcurr->txtoffsetx, HAcurr->txtoffsety, HAcurr->HAorigin > , HAcurr->txtwidth, HAcurr->txtheight, HAcurr->txtfont, HAcurr->hlabel)); > } > if (idx==5) > { > HLcurr=(struct HL *) tbl_ptr; > hcg_update_version(&HLcurr->HLid,HL_idx,0); > decode(outkey[0], &HLcurr->HLid); > hcg_update_version(&HLcurr->HNid1,HN_idx,0); > decode(outkey[1], &HLcurr->HNid1); > hcg_update_version(&HLcurr->HNid2,HN_idx,0); > decode(outkey[2], &HLcurr->HNid2); > PrintCheck(fprintf(hcg_logfileptr, " %-8s %-8s %-8s %8d %8d\n" > , outkey[0], outkey[1], outkey[2], HLcurr->HPcount, HLcurr->allvisible)); > } > if (idx==6) > { > HPcurr=(struct HP *) tbl_ptr; > hcg_update_version(&HPcurr->HPid,HP_idx,0); > decode(outkey[0], &HPcurr->HPid); > hcg_update_version(&HPcurr->HLid,HL_idx,0); > decode(outkey[1], &HPcurr->HLid); > PrintCheck(fprintf(hcg_logfileptr, " %-8s %-8s %8.4f %8.4f %8d %-4s\n" > , outkey[0], outkey[1], HPcurr->HPx, HPcurr->HPy, HPcurr->is_visible, HPcurr->hsegpattern)); > } > if (idx==7) > { > HIcurr=(struct HI *) tbl_ptr; > hcg_update_version(&HIcurr->HIid,HI_idx,0); > decode(outkey[0], &HIcurr->HIid); > hcg_update_version(&HIcurr->HLid,HL_idx,0); > decode(outkey[1], &HIcurr->HLid); > PrintCheck(fprintf(hcg_logfileptr, " %-8s %-8s %-8s %8.4f %8.4f %8.4f %8d %8d %-25s %-40s\n" > , outkey[0], outkey[1], HIcurr->DIid, HIcurr->HIorigin, HIcurr->tbeginx, HIcurr->tbeginy > , HIcurr->txtwidth, HIcurr->txtheight, HIcurr->txtfont, HIcurr->hlabel)); > } > if (idx==8) > { > CGcurr=(struct CG *) tbl_ptr; > hcg_update_version(&CGcurr->CGid,CG_idx,0); > decode(outkey[0], &CGcurr->CGid); > hcg_update_version(&CGcurr->HGid,HG_idx,0); > decode(outkey[1], &CGcurr->HGid); > PrintCheck(fprintf(hcg_logfileptr, " %-8s %-8s %8.4f %8.4f %8.4f %8.4f\n" > , outkey[0], outkey[1], CGcurr->CGcenterx, CGcurr->CGcentery, CGcurr->CGwidth, CGcurr->CGheight)); > } > if (idx==9) > { > GXcurr=(struct GX *) tbl_ptr; > hcg_update_version(&GXcurr->GXid,GX_idx,0); > decode(outkey[0], &GXcurr->GXid); > hcg_update_version(&GXcurr->CGid,CG_idx,0); > decode(outkey[1], &GXcurr->CGid); > PrintCheck(fprintf(hcg_logfileptr, " %-8s %-8s %-8s %8.4f %-25s %8.4f %8.4f %8d %8d %-128s\n" > , outkey[0], outkey[1], GXcurr->DAid, GXcurr->GXorigin, GXcurr->txtfont, GXcurr->txtoffsetx > , GXcurr->txtoffsety, GXcurr->txtwidth, GXcurr->txtheight, GXcurr->grphcaption)); > } > } /* end if hcg_log */ > /* RJL040712: log_pr_add is a no-op unless hcg_log==1 */ > } /* end log_pr_add */ > /* end of gen_pr_add output to pr_load.c */ > > 1507c1732 < /******************************************************************************/ --- > /******************* (1727-1910)*********************************************/ 1511a1737,1739 > /* else [a no-op???]. If load_data or replay_log was the client, */ > /* pr_parse already did XXelt = pr_create(XX) and pr_set_ ... field values. */ > /* log_do_pr_add calls fprintf(hcg_logfileptr,"...") iff hcg_log==1-RJL)60217 */ 1513c1741,1742 < /* RJL040712: log_pr_add is a no-op unless hcg_log==1 */ --- > /* #define pr_add(a,b,c) do_pr_add(a,#b,c)? */ > #define TTPRNT dprint("tbl_encoding [0..9] = FO,GD,HG,HN,HA,HL,HP,HI,CG,GX\n") 1517d1745 < #define TTPRNT dprint("tbl_encoding [0..9] = FO,GD,HG,HN,HA,HL,HP,HI,CG,GX\n") 1519d1746 < /*char tempkey[HCG_KEY_SIZE+1];*/ 1521c1748 < char* ttabbrev; /* local var added 051127 - could not decl in asgnmt. */ --- > char* ttabbrev; /* added 051127 - wouldn't permit decl in asgnmt. */ 1523,1526c1750,1754 < /* skip leading whitespace (if any) from tbl_abbrv */ < /* (\t added 060126; was ++tbl_abbrv until 060126 - RJL*/ < while( *tbl_abbrv == ' '||*tbl_abbrv== '\t') tbl_abbrv++;//endwhile < DP;assert(strlen(tbl_abbrv) == HCG_ABBR_SIZE); //2 or 4 - RJL060126 --- > > /* skip leading spaces (if any) from tbl_abbrv */ > > while( *tbl_abbrv == ' ') ++tbl_abbrv; > 1531c1759,1760 < LP;return; --- > /*log_pr_add(tbl_abbrv, viewname, tbl_ptr); */ > return; 1533c1762 < DP; if (!find_view_idx(viewname)) --- > if (!find_view_idx(viewname)) 1536c1765,1766 < LP;return; --- > /*log_pr_add (tbl_abbrv, viewname, tbl_ptr); */ > return; 1540,1541c1770,1772 < strncpy_null(error_table, tbl_abbrv, HCG_ABBR_SIZE); < printf("Warning: unknown table (%s) passed to [do_]pr_add, ignored.\n", --- > strncpy_null(error_table, tbl_abbrv, HCG_ABBR_SIZE+1); > // '+1' added 060204-RJL > printf("Warning: unknown table (%s) passed to pr_add, ignored.\n", 1542a1774 > /*log_pr_add (tbl_abbrv, viewname, tbl_ptr); */ 1546d1777 < 1553c1784 < //bde crashed because following updates were skipped when --- > //bde/pr_util_nolog crashed because following updates were skipped when 1559a1791 > 1563c1795 < dprintds("tbl_encoding=%d,ttabbrev=%s\n", tbl_encoding, ttabbrev); --- > dprintds("tbl_encoding=%d,ttabbrev=\n", tbl_encoding, ttabbrev); 1570c1802 < /* Pre-cond: find_view_idx updated hcg_view_idx; */ --- > /* Pre-cond: find_view_idx updated hcg_view_idx; 1571a1804 > 1582a1816,1817 > assert(strlen(viewname)>0); > log_pr_add ("FO", viewname, FOelt); /* iff hcg_log */ 1593a1829 > log_pr_add ("GD", viewname, GDelt); 1598,1600c1834,1835 < DP;HGelt = (struct HG *) tbl_ptr; < DP;pr_gen_pkey(viewname,HG,HGelt->HGid); < printf("pr_gen_pkey returns %ux\n", (unsigned)HGelt->HGid); --- > HGelt = (struct HG *) tbl_ptr; > pr_gen_pkey(viewname,HG,HGelt->HGid); 1606a1842 > log_pr_add ("HG", viewname, HGelt); 1611c1847 < DP;HNelt = (struct HN *) tbl_ptr; --- > HNelt = (struct HN *) tbl_ptr; 1617a1854 > log_pr_add ("HN", viewname, HNelt); 1627a1865 > log_pr_add ("HA", viewname, HAelt); 1635a1874 > log_pr_add ("HL", viewname, HLelt); 1643a1883 > log_pr_add ("HP", viewname, HPelt); 1653a1894 > log_pr_add ("HI", viewname, HIelt); 1660a1902 > log_pr_add ("CG", viewname, CGelt); 1670a1913 > log_pr_add ("GX", viewname, GXelt); 1673a1917,1919 > default: /* invalid table type */ > DP;fprintf(stderr, "do_pr_add: invalid table type %s\n", ttabbrev); > break; 1677,1678c1923,1925 < LP;return; /* RJL 030811 */ < } /* end do_pr_add */ --- > return; /* RJL 030811 */ > } /* end do_pr_add (1727-1910) */ > /* end of gen_pr_add output to pr_load.c */ 1693c1940 < /* WARNING: make sure clients call hcg_read_next to prime hcg_buffer - RJL 040616 */ --- > /* */ 1697c1944,1945 < int load_data(char *viewname) /* (1606-1740) */ --- > > int load_data(char *viewname) /*(1931-2040)*/ 1698a1947,1948 > /* static char rcsid[] = "$Id:"; */ > /* extern char *logfile; */ 1699a1950 > /* int isLogfile; */ 1701c1952 < int emptyLines = 0; /* counts empty lines skipped */ --- > int emptyLines = 0; /* counts empty lines skipped (firsttokenlength == 0)-RJL040621 */ 1708,1709c1959 < char temp_verstring[5]; /* = 5 in schema.h */ < char char1, char2; --- > char temp_verstring[ABBREV_NAME_LENGTH]; /* abbrev, not version? */ 1710a1961 > //void pr_parse(); /* 93su523 PGEN merge*//*replace by _nolog version: -RJL070219 */ 1713,1715d1963 < < hcg_tbl_idx = 0; < 1716a1965 > hcg_tbl_idx = 0; 1718c1967 < hcg_read_next(); /* added 040616 - RJL */ --- > hcg_read_next(); /* read FIRST line - added 040616 - RJL */ 1721,1722c1970,1971 < //DP; < dprints("load_data at pr_load.c:2664: parsing this hcg_buffer:\n\t'%s'\n", hcg_buffer); --- > > DP;dprints("hcg_parse-ing this hcg_buffer:\n\t'%s'\n", hcg_buffer); 1726,1727d1974 < char1 = (char)(*hcg_t); < char2 = (char)(*(hcg_t+1)); 1729c1976 < { dprint("Empty line found in file %s\n"); --- > { /*dprint("Empty line found in file %s\n");*/ 1737c1984 < dprint("TBD: Load checkpoint *DB1 then replay logfile.\n");//was bug - RA051126 --- > dprint("TBD: Load checkpoint *DB1 then replay logfile.\n"); 1739c1986 < return 1; // TBD: close file, start replay - RJL 040522 --- > DP;return 1; // TBD: close file, start replay - RJL 040522 1741,1743c1988 < else if ((char1 == '/') && ((char2 == '/')||(char2 =='*'))) < { //skip comments < // init():546-550 skips logfile's leading comments - RJL 040429 --- > else if (notacomment(hcg_t) == FALSE) { 1744a1990 > // dprint("skipped a comment introducer line \n"); 1750,1751c1996 < dprintds( < "Warning:load_data:invalid keysize %d for key %s, line ignored.\n", --- > dprintds("Warning:load_data:invalid keysize %d for key %s, line ignored.\n", 1757,1766d2001 < else if (!find_tbl_idx(hcg_t)) /* table type not found for field 1 */ < { /* TBD: ignore comments - see pr_init context.-RJL060730 */ < strncpy_null(temp_verstring, hcg_t, HCG_ABBR_SIZE);/*get ttabbrev*/ < dprints( < "Warning: non-comment, unknown table type:'%s' found in datafile, ignored.\n", < temp_verstring); < rowTypesNotFound++; < hcg_read_next(); < continue; < } 1767a2003 > // non-empty line begins with a non-comment token of length HCG_KEY_SIZE: 1769c2005 < if (hcg_view_list.view_list[hcg_view_idx].version_list[hcg_tbl_idx] == '\0') --- > else if (!find_tbl_idx(hcg_t)) /* if table type not found in view */ 1770a2007,2014 > /* find_tbl_idx sets tmpabb to hcg_table_seq_list[hcg_tbl_idx].ttabbrev,HCG_ABBR_SIZE) > * and returns (strncmp(pkey,tmpabb,HCG_ABBR_SIZE) == 0) and updates hcg_tbl-idx. */ > strncpy_null(temp_verstring, hcg_t, HCG_ABBR_SIZE); > /* init():546-550 skips logfile's leading comments - RJL 040429 */ > dprints( > "Warning: unknown table type:'%s' found in datafile, ignored.\n", > temp_verstring); > rowTypesNotFound++; 1773a2018,2030 > // tbl_idx found in view: check version now: (assume we don't care): > // New 060307: ignore version#; assume all version# chars are either > // '\0' (not in view) or '0' (don't care == latest version). > // else if (hcg_view_list.view_list[hcg_view_idx].version_list[hcg_tbl_idx] == '\0') > // { /* does zero byte mean no version allowed? */ > // hcg_read_next(); > // continue; > // } > // RJL060307: maybe ver_chars (length) could be 0 since don't want to use it any more; > // Later, (TBD) we need namespace scope instead (priority maybe > tbl_idx ?) > // Namespace AND View are now just a list of tabletypes (version_list value ignored) > // tabletypes can overlap across views and across namespaces. > // tabletypes must be unique inside a view and also inside a namespace. 1775,1777c2032 < if (HCG_KEY_SIZE == 8) ver_chars = 2; < else ver_chars = 3; < --- > ver_chars = ( (HCG_KEY_SIZE==8)? 2:((HCG_KEY_SIZE==12)?3:0) ); //-RJL060307 1778a2034 > assert (ver_chars == 2 || ver_chars == 3); 1780c2036 < --- > //detect comments indep of token length first: 1792,1794c2048,2050 < /* The next block skips unwanted table versions < * Alt: why not use meets_view() here? - RJL: 031012 < * Added NEW_VERSION brackets - RJL 031023 --- > /* (:1975-1987:) The next block skips unwanted table versions > * (meets_view depends on pkey as well as new_version = TRUE||FALSE) > * Added NEW_VERSION brackets - RJL 031023; removed this code 060307 1796,1799c2052,2054 < #ifndef NEW_VERSION < if (((char) hcg_version) != < hcg_view_list.view_list[hcg_view_idx].version_list[hcg_tbl_idx]) < { --- > //Replaced NEW_VERSION dependence by ttabbr_in_view test only -RJL060307 > if (hcg_view_list.view_list[hcg_view_idx].version_list[hcg_tbl_idx] == -1) > {// table is not in this view 1804c2059 < #endif --- > //Now have a valid pkey in view at hcg_view_idx. 1806,1807c2061,2063 < hcg_ts_list[hcg_tbl_idx].ts_list[hcg_version].rcount++; < --- > hcg_ts_list[hcg_tbl_idx].ts_list[hcg_version].rcount++;//maybe superfluous > //Before removing the above line, we could assert both rcounts match above. > // Update maxrow to prevent pkey re-use: 1812,1813c2068,2070 < /* idx is cursor during pr_parse below, in while loop */ < --- > /* idx is cursor for during pr_parse below, in while looop */ > //assert (tbl_encoding == hcg_tbl_idx)????????????? > //now get field tokens and build struct XX values: 1816d2072 < 1833,1834c2089,2091 < return 0; // TBD: Client must close file < } /* end load_data (1606-1740) */ --- > LP;return 0; // TBD: Client must close file > } /* end load_data (:1931-2075) */ > /* end of gen_load_data output */ 1846,1853c2103 < /* TBD: call these blocks as XX_parse now, => XX::parse in gencpp - RJL070126*/ < /* Include all of schema.h; gencpp also includes XX_schema.h in XXops.cc? */ < /* Perhaps code-gen can be templatized on TT-->TA metadata? */ < /* Pre-cond: buffer contains a row of the proper table-type */ < /* Where do we check the pre-cond'n tbl_encoding is in viewname? - RJL070126 */ < /* Are all 4 arg'ts really necessary fpr hcg_parse? -RJL070126 */ < /* It looks like hcg_parse only needs args 2,4,5, not args 1,3. */ < /******************* (1848:2057) *********************************************/ --- > /***********************************************************************/ 1856c2106 < { --- > {EP; 1859a2110,2111 > /* TBD: generate tbl_encoding-specific methods and calls for each table type:-RJL070129 */ > /* #include XX_schema.h files in any_schema.h for use below as in gencpp. */ 1862c2114 < case 0: /* FO_parse(buffer,idx,hcg_k): encode FO-row */ --- > case 0 : /* encoding of FO */ 1874c2126 < case 1 : /* GD_parse: encoding of GD */ --- > case 1 : /* encoding of GD */ 2061,2062c2313 < } /* end pr_parse (1847-2056) */ < --- > } /* end pr_parse */ 2064a2316 > 2066c2318 < /******************************************************************************/ --- > /*********************** (2222-2304) ******************************************/ 2081a2334,2344 > /* Added by Genlog 5/8/96 to log pr_load */ > /* extern char *logfile; */ > char log_text[BUFSIZE]; > EP; > if ( hcg_log == 1 ) { > logwait(); > sprintf(log_text,"LD %s %s\n", viewname, file_name); > logstr(log_text); > } > /* End Genlog Addition */ > 2098c2361 < exit(2); --- > LP;exit(2); 2105,2107c2368,2369 < < isLogFile = load_data(viewname); < /* isLogFile=1 iff "SR" command on line 1 */ --- > isLogFile = > load_data(viewname); /* isLogFile=1 iff "SR" command on line 1 */ 2111,2112c2373,2374 < dprints("\nFinished load; fclose %s\n TBD in load_data", file_name); < dprint("pr_load: isLogFile is 1 iff 'SR' at BOF\n"); --- > dprints("\nFinished load; fclose %s\n TBD in load_data; ", file_name); > dprintd("pr_load: isLogFile = %d : == 1 iff 'SR' at BOF\n", isLogFile); 2114,2115d2375 < DP; printrowcounts("94sbdeview"); /*debug use - RJL060807*/ < DP; printrowcounts("94sbdedefaultsView"); /*debug use - RJL060807*/ 2119,2121c2379,2382 < dprints("data file %s contains StartReplay = 'SR' cmd:\n", file_name); < dprint("Rebuild bde with chgen -log option to replay.\n"); < exit(3); /* TBD: Pick error # */ --- > dprints( "load_data found SR cmd - calling pr_replay on file %s\n", > file_name); > dprintdd("hcg_log = %d, hcg_replay = %d\n", hcg_log, hcg_replay); > replayStatus = pr_replay(viewname, file_name, 1, 1); 2124,2125c2385,2386 < /* (This should work because pr_replay is tail-recursive) */ < /* Replay update cmds are done by 's' Keypress callbacks */ --- > /* (This should? work because pr_replay is tail-recursive) */ > /* Replay updates can be done by 's' Keypress callback - one at a time */ 2128,2129c2389 < printf( < "Error: pr_replay returned replayStatus %d = FAIL: aborting bde\n\n", --- > printf("Error: pr_replay returned replayStatus %d = FAIL: aborting bde\n\n", 2131,2134c2391,2394 < exit(3); < } /* end if replayStatus */ < } < else { /* data file, NOT logfile */ --- > LP;exit(3); > }/*if replayStatus!=0*/ > }/* is logfile */ > else { 2138,2140c2398,2400 < < return; < } /* end (void) pr_load (1942-2034- RJL 040616 */ --- > LP;return; > /* see $CASE/03f522/bdeReplayUserGuideR1.031027 for TBD? comments-RJL060227 */ > } /* end (void) pr_load (2942-3017)- RJL 040616 [---> (2222-2304), 060227] */ 2146,2148c2406 < /* Output: none.( it will move table position to the specific row. */ < /* TBD: see load_data: rule out comment introducers FIRST! - RJL060730 */ < /* Invocation conditions: if( tbl##btidx == BTREESEARCH ) */ --- > /* Output: none ( it will move table position to the specific row. */ 2153,2154c2411,2413 < if (!find_tbl_idx(temp1)) /* side effect: updates hcg_tbl_idx */ < { /* TBD: ignore comments - see pr_init context.-RJL060730 */ --- > > if (!find_tbl_idx(temp1)) > { 2185,2188c2444,2445 < if (tempptr1 == NULL) < tempptr1 = tempptr0-1; /* add 1 later */ < DP;printf("%d chars in filename %s\n", < (int)(tempptr1-tempptr0), (char*) tempptr1+1); --- > if (tempptr1 == NULL) tempptr1 = tempptr0-1; /* add 1 later */ > else printf("chars skipped = %d\n", (int)(tempptr1-tempptr0)); 2197d2453 < 1351 6855 55782