Notes on rrassman's 98f522 genreplay project: - RJL 2k0419 RJLRef; $CASE/bdelog2ks/genreplayNotes.2k0419 pr_start_log is studied here; function: pr_replay is at end (line 1452+) ------------------------------------------------ remus(165)> pwd /nfs/jupiter/proj3/case/98f/genreplay/rrassman/src remus(166)> grep RFLAG *.c *.h gen_defines.c:345: fprintf(schh_fp," if((tbl)->RFLAG==1 && !PARSE && hcg_log ==1 )\\\n"); gen_defines.c:355: fprintf(schh_fp," if((tbl)->RFLAG==1 && !PARSE && hcg_log ==1 )\\\n"); gen_defines.c:365: fprintf(schh_fp," if((tbl)->RFLAG==1 && !PARSE && hcg_log ==1 )\\\n"); gen_defines.c:379: fprintf(schh_fp," if((tbl)->RFLAG==1 && !PARSE && hcg_log ==1 )\\\n"); gen_structures.c:105: fprintf(schh_fp,"int RFLAG; /* for pr_utility macro log */\n"); remus(167)> -------------------------------------------------------- I found only one use of RFLAG in test applications. Here it is, by rrassman in his test directory $CASE//98f/genreplay/rrassman/enroll/enroll.c: Program enroll calls pr_set* macros and saves this log file: (If a database was pr_loaded, its content should be prefixed below to initialize the internal database correctly. At least the pr_loaded file name should be known or included in enroll.txt (as a pr_load command argument). However, then we risk non-reproducibility if the named file (e.g. enroll.dat) was later modified. ----------- SR PR_SET_STR SE010002 Location Osen PR_SET_INT SE010002 Room 311 PR_SET_STR SE010003 Location GTE Building 2 PR_SET_INT SE010003 Room 102 PR_SET_FLT EN010001 Cost 622.230000 PR_SET_FLT EN010002 Cost 622.230000 PR_SET_FLT EN010003 Cost 622.230000 PR_SET_FLT EN010004 Cost 933.430000 PR_SET_FLT EN010005 Cost 933.430000 PR_SET_FLT EN010006 Cost 1245.560000 WA 1 SP ~ -------------- In rrassman's test of enroll, he uses brute-force: pr_load is called first (line 55), then he sets all RGFLAGs = 1. Enroll has no pr_create pr_set*... pr_add calls which would require cycling RFLAG to 0 and back to 1. He also mentions the PARSE flag, for in-pr_load identification I presume. enroll.c does pr_set_* calls inside a find_parent and nested child_loop. remus(171)> pwd /nfs/jupiter/proj3/case/98f/genreplay/rrassman/enroll remus(172)> grep RFLAG *.c *.h enroll.c:59: /* (1) table attribute RFLAG is set to 1. */ enroll.c:68: /* manually set all record's RFLAG to 1 for testing pr_utility macro */ enroll.c:70: DEcurr->RFLAG = 1; enroll.c:72: COcurr->RFLAG = 1; enroll.c:74: SEcurr->RFLAG = 1; enroll.c:76: ENcurr->RFLAG = 1; enroll.c:78: STcurr->RFLAG = 1; enroll.h:290: if((tbl)->RFLAG==1 && !PARSE && hcg_log ==1 )\ enroll.h:300: if((tbl)->RFLAG==1 && !PARSE && hcg_log ==1 )\ enroll.h:310: if((tbl)->RFLAG==1 && !PARSE && hcg_log ==1 )\ enroll.h:324: if((tbl)->RFLAG==1 && !PARSE && hcg_log ==1 )\ enroll.h:826:int RFLAG; /* for pr_utility macro log */ enroll.h:847:int RFLAG; /* for pr_utility macro log */ enroll.h:870:int RFLAG; /* for pr_utility macro log */ enroll.h:895:int RFLAG; /* for pr_utility macro log */ enroll.h:913:int RFLAG; /* for pr_utility macro log */ ----------------------------------------------------------- Here are the initial comments in enroll.c: ------------------------------------------------------------- /*************************************************************/ /* file : enroll.c */ /* written by: Chong Tian Wang */ /* purpose : test the "pr_set_int", "pr_set_flt and */ /* "pr_set_str" macros with log features */ /* modified by: Rob Rassmann */ /* now tests the pr_replay function */ /*************************************************************/ . . . /***************************************************/ /* pr_utility log initialization */ /* their pr-conditions are the same: */ /* (1) table attribute RFLAG is set to 1. */ /* (2) global veriable PARSE is set to 0. */ /* (3) hcg_logfileptr != NULL, which means */ /* pr_startlog() has been correctly called. */ /* their post-condition are the same: */ /* the pr_set_utility calls are recoreded */ /* in the logged file. */ /***************************************************/ --------------- These lines suggest but do not confirm the logfile name: (Only the pr_set and pr_add macros actually write there.) ------------- /* call pr_startlog to have hcg_logfileptr != NULL */ pr_startlog( "enroll", view_name ); ----------- (The logfile will become enroll.txt) Here are the pr_*.c refs to the log file ptr (spaces compressed): ------------- remus(189)> grep hcg_logfileptr pr*.c pr_load.c:2183: PrintCheck(fprintf(hcg_logfileptr, " %-8s %-30s\n" pr_load.c:2193: PrintCheck(fprintf(hcg_logfileptr, " %-8s %-8s %-30s\n" pr_load.c:2203: PrintCheck(fprintf(hcg_logfileptr, " %-8s %-8s %-3s %-30s %8d\n" pr_load.c:2215: PrintCheck(fprintf(hcg_logfileptr, " %-8s %-8s %-8s %-3s %8.4f\n" pr_load.c:2223: PrintCheck(fprintf(hcg_logfileptr, " %-8s %-8s %-8s %-3s\n" pr_log.c:328: fprintf(hcg_logfileptr, "%s", text); pr_log.c:433: if ((hcg_logfileptr=fopen(temp_file_name, "w")) == NULL) pr_log.c:520: fclose(hcg_logfileptr); remus(190)> ------------------ Here is the source of the file name we are searching for: (inside of int pr_startlog (file_name, viewname){...}) -------------- remus(190)> grep temp_file_name pr*.c pr_log.c:384:char temp_file_name[NAMELENGTH]="\0"; pr_log.c:428: strcpy (temp_file_name, hcg_logfile); pr_log.c:429: strcat (temp_file_name, ".txt"); pr_log.c:433: if ((hcg_logfileptr=fopen(temp_file_name, "w")) == NULL) remus(191)> ----------- Pr_log source code: (1543 SLOC autogenerated by chgen v10log!) -------------------- /******************************************************************************/ /* File : pr_log.c */ /* Schema : enroll.sch */ /* Chgen Version : v10log */ /******************************************************************************/ . . . (in Function pr_startlog, lines 365-457)): After various checks (no nested logging, pr_init called, file OK, etc.), at lines 422-423, file_name is copied to hcg_logfile for opening: (any extension is removed and replaced by .txt. If the input is enroll.dat, the log will be to enroll.txt.) ------------------ if (i<0) /* no extention */ strcpy (hcg_logfile, file_name); else /* remove extention */ strncpy (hcg_logfile, file_name, (i)); strcpy (temp_file_name, hcg_logfile); strcat (temp_file_name, ".txt"); /* check that logfile opened - if not, return without starting log*/ if ((hcg_logfileptr=fopen(temp_file_name, "w")) == NULL) { printf("Error: pr_startlog() cannot open %s\n", file_name); return (-3); } /* Call pr_dump to save a current version of the database */ /* Database saved to name of log file + "DB1" */ strcat (strcpy(logfileDB1_name, hcg_logfile), DB1string); pr_dump (viewname, logfileDB1_name, FALSE, "w" ); /* Initiate logging by setting global hcg_log = 1 */ hcg_log =1; /* Log call to pr_startlog as first record */ logstr("SR\n"); /* Set timer info - to be done */ time_initialize(); return (0); } /* End pr_startlog */ -------------------------