Debian Codegraph @

terps/tads/tads3/vmbt3_d.cpp

raw symbols SCIP
1 #ifdef RCSID
2 static char RCSid[] =
3 "$Header$";
4 #endif
5
6 /*
7 * Copyright (c) 2000, 2002 Michael J. Roberts. All Rights Reserved.
8 *
9 * Please see the accompanying license file, LICENSE.TXT, for information
10 * on using and copying this software.
11 */
12 /*
13 Name
14 vmbt3_d.cpp - T3 VM system interface function set - debugger version
15 Function
16
17 Notes
18
19 Modified
20 03/10/00 MJRoberts - Creation
21 */
22
23 #include "t3std.h"
24 #include "vmtype.h"
25 #include "vmbif.h"
26 #include "vmbift3.h"
27 #include "vmstack.h"
28 #include "vmrun.h"
29 #include "vmdbg.h"
30
31 /*
32 * Debug Trace
33 */
34 void CVmBifT3::debug_trace(VMG_ uint argc)
35 {
36 /* make sure we have at least one argument */
37 if (argc < 1)
38 err_throw(VMERR_WRONG_NUM_OF_ARGS);
39
40 /* pop the flags and see what we're being asked to do */
41 switch(pop_int_val(vmg0_))
42 {
43 case T3DBG_CHECK:
44 /* check arguments */
45 check_argc(vmg_ argc, 1);
46
47 /* we're just being asked if the debugger is present - it is */
48 retval_true(vmg0_);
49 break;
50
51 case T3DBG_BREAK:
52 /* check arguments */
53 check_argc(vmg_ argc, 1);
54
55 /* tell the debugger to activate debug-trace mode */
56 G_debugger->set_debug_trace();
57
58 /* tell the caller we were successful */
59 retval_true(vmg0_);
60 break;
61
62 case T3DBG_LOG:
63 {
64 /* check arguments and retrieve the string */
65 check_argc(vmg_ argc, 2);
66
67 /* get the string in the UI character set */
68 char *str = pop_str_val_ui(vmg_ 0, 0);
69 if (str != 0)
70 {
71 /* display the message in the debugger UI */
72 os_dbg_printf("%s\n", str);
73
74 /* free the string */
75 t3free(str);
76 }
77 }
78
79 /* no return value */
80 retval_nil(vmg0_);
81 break;
82
83 default:
84 /* anything else just returns nil, to allow for future expansion */
85 G_stk->discard(argc - 1);
86 retval_nil(vmg0_);
87 break;
88 }
89 }
90