Dell: 02s592\bdeReplayDesign020427.txt
bde replay architecture Design decisions: (02s592/020423))
keypress event handler (and others from Paul) will call replay_log only if hcg_log == 2. Otherwise it is a no-op to handle keypresses before replay_log ever gets started.
Regardless of filename content, init.cc calls pr_load.c.
Further control flow depends on an "SR" command in filename.
If "SR" is NOT seen by pr_load, then pr_load runs normally to completion, sets HGid and HGcurr to the first HG-row and calls clearobjects, updatedisplaylist and ReDraw.
Thus for normal .dat files, the 'bde filename' command bypasses FileOpen and GraphSelection. The same behavior is expected from the current FileOpen menu and GraphSelection process. In either case, the pr_loaded .dat file has its first HGrow displayed by default.
Later we'll short-cut HG-selection if FileOpen finds only one HG-row.
Note that a HG-row will not beloaded (and may not exist) if "SR" IS seen by pr_load. In this case, pr_load exits and arranges for pr_replay to be called INSTEAD (not a nested call because recursion is possible then).The real file to be loaded then is filenameDB1.dat, constructed by pr_replay.
BEFORE reopening filename.txt for replay, pr_replay builds filenameDB1.dat and calls pr_load on it (or fails returning an error code). pr_replay thus recovers the snapshot taken when logging began.
Then [pr_load or] pr_replay should do what init.cc does:
set HGid and HGcurr to the first HG-row,
call clearobjects, updatedisplaylist and ReDraw.
Finally, pr_replay sets replay_log's replayState to State0. and exits, returning a success code to its caller.
replayState0:
The keypress callback is in fileio.cc. It checks for hcg_log == 2 else is a no-op. Iff hcg_log==2 it calls int replay_log(void).
replay_log also calls updateDisplayList then ReDraw(), after reading and responding to one pr_add/delete/set command from the playback file filename.txt.
Thus for normal .dat files, the 'bde filename'command bypasses FileOpen and GraphSelection. The same behavior is expected from the current FileOpen menu and GraphSelection process. In either case, the pr_loaded .dat file has its first HGrow displayed by default.
Later we'll short-cut HG-selection if FileOpen finds only one HG-row.
Note that a HG-row will not be loaded (and may not exist) if "SR" IS seen by pr_load. In this case, pr_load exits and arranges for pr_replay to be called INSTEAD (not a nested call because recursion is possible then). The real file to be loaded then is filenameDB1.dat, constructed by pr_replay.
BEFORE reopening filename.txt for replay, pr_replay builds filenameDB1.dat and calls pr_load on it (or fails returning an error code).
pr_replay thus recovers the snapshot taken when logging began.
Then [pr_load or] pr_replay should do what init.cc does:
set HGid and HGcurr to the first HG-row,
call clearobjects, updatedisplaylist and ReDraw.
Finally, pr_replay sets replay_log's replayState to State0 and exits, returning a success code to its caller.
The int return value from replayStatus is an error code. A new replay_log error code (7) is needed to report junk after "SP" which ends replay activity.
On Wed, 24 Apr 2002, Bob Lechner wrote:
Subject: Meeting and design decisions tonight
RJLRef: ~/02s522/bdeReplayDesign.020424
To: pkingsto (Paul G Kingston), sjaganat (Sathyanarayan Jaganathan),
zcao (Zhongmin Cao), lechner (Bob Lechner)
Please check out the (above) proposed protocol to find any bugs for different conditions. It is the result of tonight's meeting but another problem intervened before I wrote it so there may be omissions or errors.
Meetings next two Weds. May 1 and May 8. may be the last.(I'll be away May 9 thru 16).
TBD:
(SJ) bde/src changes:
Revise keypress callback in fileio.c (a wrapper which calls int replay_log(void))
Revise init.cc to call XtAddCallback for Keypress event handler whose code calls replay_log. Implement design decisions below re: default file and HGrow selection. CHeck the pr_load/pr_replay interaction in zcao/bde/pr_util.
init.cc now handles bde's runtime -option list and should accept filename as new last arg to bde. It also installs keypress event handler which will call replay_log.
(ZC) pr_util changes:
Revise pr_log.c (remove replay_log)
move replay_log to src/bdeReplay.
fix extern qualifiers as required
No Xt refs or prototype.h needed in pr_util now
(ZC) bde/src changes:
Partition DisplayGraph - make separate function updatedisplaylist callable both from DisplayGraph and from replay_Log in State1.
updatedisplaylist calls clearObjects then updatedisplaylist and ReDraw.
DisplayGraph also calls updatedisplaylist and ReDraw.
(clearobjects is a brute-force solution that calls destructors and constructors again. An incremental update solution is TBD next fall).
(PK) Other callbacks that integrate into this protocol.
These are also wrappers around a call to replay_log, which behaves the same in each context.
TBChecked by Paul: Whether read_next_logfile_command at the beginning of the replayState0 action (not the end) is compatible with a socket connection that
XtAppAddInput supports. We are not sure if X11 gets notified only when the input buffer is already full, so read_next is not blocked (a no-no in X11 event loops). replay_log now does read_next at end of action which would block if the socket is connected to an asynchronous source instead of a file.
=====================================================================
Post-Meeting Progress Reports
============================
From zcao@cs.uml.edu Sat Apr 27 16:06:39 2002
The draft version of bdeReplay.cc is created in directory 02s592/zcao/bde/src.
It contains replay_log() and also the updatedisplaylist(). Meanwhile, the replay_log() has been removed from pr_log.c, the prototype.h is modified to add the declaration of the two routines and in DisplayGraph() of fileio.cc, it calls updatedisplaylist too.
int replay_log(void) now returns 4 values: 0 -3, -5, -7.
This version is subject to test, please let me know if any problems.
============================
From sjaganat@cs.uml.edu Sat Apr 27 13:59:55 2002
I have updated the Bde to use Keypress(...) as its callback. The callback function now calls the void replay_log(void); function, if the key
's' is pressed.
I would like to integrate the new *.cc file that contains the replay_log function as soon as it is available.
Now I'm working on the command line options for bde.
=============================
Final Project Reports:
See .doc files in $CASE/02s592,
and .htm versions in www.cs.uml.edu/~lechner/02s592