Debian Codegraph @

terps/tads/tads3/lib/extensions/showTranscript.t

raw
1 #charset "us-ascii"
2
3 #include <adv3.h>
4 #include <en_us.h>
5
6 /*
7 * showTranscript
8 *
9 * by Eric Eve
10 *
11 * version 1.0
12 *
13 * This extension provides a utility routine, showTranscript, to help game
14 * authors inspect the current contents of the transcript (as an alternative
15 * to examining it in the Workbench debugger). It is only intended for
16 * help in writing and debugging code, and will not be included in code
17 * compiled for release.
18 *
19 * The typical use of showTranscript() would be to call it from an
20 * afterActionMain() routine that is meant to be combining reports or
21 * otherwise manipulating the transcript.
22 *
23 * Note that to use this extension your project MUST also include reflect.t
24 */
25
26
27 #ifdef __DEBUG
28
29 showTranscript()
30 {
31 local wasActive = gTranscript.isActive;
32 local len = gTranscript.reports_.length();
33 gTranscript.deactivate();
34 local lf = new RexPattern('<LineFeed>');
35 for(local i=1; i<=len; i++)
36 {
37 local cur = gTranscript.reports_[i];
38 "<b>[<<i>>]:</b> [<<showClassName(cur)>>]:
39 action_ = <<showClassName(cur.action_)>>;
40 messageText_ = '<<rexReplace(lf, cur.messageText_, '', ReplaceAll)>>';
41 dobj_ = <<cur.dobj_== nil ? 'nil' : cur.dobj_.name>> \n";
42
43 }
44
45 if(wasActive)
46 gTranscript.activate();
47 }
48
49
50 showClassName(obj)
51 {
52 if(obj == nil)
53 return 'nil';
54 return reflectionServices.valToSymbol(obj.getSuperclassList[1]);
55 }
56
57 #endif