more testing and add traceon/traceoff to the builtins

This commit is contained in:
Bill Currie 2001-06-27 22:56:52 +00:00
parent 59ff35558f
commit dfdff6cc59
3 changed files with 31 additions and 1 deletions

View file

@ -100,6 +100,18 @@ bi_seek (progs_t *pr) // FIXME: make INT when qc int
G_FLOAT (pr, OFS_RETURN) = lseek (handle, pos, whence);
}
static void
bi_traceon (progs_t *pr)
{
pr->pr_trace = true;
}
static void
bi_traceoff (progs_t *pr)
{
pr->pr_trace = false;
}
builtin_t builtins[] = {
bi_fixme,
bi_print,
@ -111,6 +123,8 @@ builtin_t builtins[] = {
bi_read,
bi_write,
bi_seek,
bi_traceon,
bi_traceoff,
};
void

View file

@ -8,10 +8,15 @@ string (float handle, float count) read = #7; // FIXME: cf read_result
float (float handle, string buffer, float count) write = #8;
float (float handle, float pos, float whence) seek = #9;
void() traceon = #10; // turns statment trace on
void() traceoff = #11;
float time;
entity self;
float read_result; // FIXME: hacky (cf read)
.float nextthink;
.float think;
.void() think;
.float frame;
.vector origin;

View file

@ -2,6 +2,8 @@ float foo = 1;
float bar = 1;
float snafu = 2;
void () eek;
float () main =
{
local float handle;
@ -21,6 +23,7 @@ float () main =
print (buffer);
} while (read_result == 1024);
close (handle);
eek ();
return 0;
};
@ -51,3 +54,11 @@ void () blarg =
if (bar = foo);
foo = 2;
};
void () eek =
{
traceon();
self.origin = '0 0 0';
self.origin = self.origin + '1 2 3';
traceoff();
};