Debian Codegraph @

terps/tads/tads2/bif.h

raw symbols SCIP
1 /*
2 $Header: d:/cvsroot/tads/TADS2/BIF.H,v 1.3 1999/07/11 00:46:29 MJRoberts Exp $
3 */
4
5 /*
6 * Copyright (c) 1991, 2002 Michael J. Roberts. All Rights Reserved.
7 *
8 * Please see the accompanying license file, LICENSE.TXT, for information
9 * on using and copying this software.
10 */
11 /*
12 Name
13 bif.h - built-in functions interface
14 Function
15 interface to run-time intrinsic function implementation
16 Notes
17 None
18 Modified
19 12/16/92 MJRoberts - add TADS/Graphic functions
20 12/26/91 MJRoberts - creation
21 */
22
23 #ifndef BIF_INCLUDED
24 #define BIF_INCLUDED
25
26 #ifndef OS_INCLUDED
27 # include "os.h"
28 #endif
29 #ifndef ERR_INCLUDED
30 # include "err.h"
31 #endif
32 #ifndef RUN_INCLUDED
33 # include "run.h"
34 #endif
35 #ifndef TIO_INCLUDED
36 # include "tio.h"
37 #endif
38 #ifndef REGEX_H
39 #include "regex.h"
40 #endif
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46 /* forward definitions */
47 struct vocidef;
48 struct voccxdef;
49
50 /* maximum number of file handles available */
51 #define BIFFILMAX 10
52
53
54 /* file contexts for the built-in file handling functions */
55 struct biffildef
56 {
57 osfildef *fp; /* underyling system file handle */
58 uint flags; /* flags */
59 #define BIFFIL_F_BINARY 0x01 /* file is binary */
60 };
61 typedef struct biffildef biffildef;
62
63 /* built-in execution context */
64 struct bifcxdef
65 {
66 errcxdef *bifcxerr; /* error-handling context */
67 runcxdef *bifcxrun; /* code execution context */
68 tiocxdef *bifcxtio; /* text I/O context */
69 long bifcxrnd; /* random number seed */
70 int bifcxseed1; /* first seed for new generator */
71 int bifcxseed2; /* second seed for new generator */
72 int bifcxseed3; /* third seed for new generator */
73 int bifcxrndset; /* randomize() has been called */
74 biffildef bifcxfile[BIFFILMAX]; /* file handles for fopen, etc */
75 int bifcxsafetyr; /* file I/O safety level - read */
76 int bifcxsafetyw; /* file I/O safety level - write */
77 char *bifcxsavext; /* saved game extension (null by default) */
78 struct appctxdef *bifcxappctx; /* host application context */
79 re_context bifcxregex; /* regular expression searching context */
80 };
81 typedef struct bifcxdef bifcxdef;
82
83 /*
84 * argument list checking routines - can be disabled for faster
85 * run-time
86 */
87
88 /* check for proper number of arguments */
89 /* void bifcntargs(bifcxdef *ctx, int argcnt) */
90
91 /* check that next argument has proper type */
92 /* void bifchkarg(bifcxdef *ctx, dattyp typ); */
93
94 #ifdef RUNFAST
95 # define bifcntargs(ctx, parmcnt, argcnt)
96 # define bifchkarg(ctx, typ)
97 #else /* RUNFAST */
98 # define bifcntargs(ctx, parmcnt, argcnt) \
99 (parmcnt == argcnt ? DISCARD 0 : \
100 (runsig(ctx->bifcxrun, ERR_BIFARGC), DISCARD 0))
101 # define bifchkarg(ctx, typ) \
102 (runtostyp(ctx->bifcxrun) == typ ? DISCARD 0 : \
103 (runsig(ctx->bifcxrun, ERR_INVTBIF), DISCARD 0))
104 #endif /* RUNFAST */
105
106 /* determine if one object is a subclass of another */
107 int bifinh(struct voccxdef *voc, struct vocidef *v, objnum cls);
108
109
110 /* enumerate the built-in functions */
111 void bifyon(bifcxdef *ctx, int argc); /* yorn - yes or no */
112 void bifsfs(bifcxdef *ctx, int argc); /* setfuse */
113 void bifrfs(bifcxdef *ctx, int argc); /* remfuse */
114 void bifsdm(bifcxdef *ctx, int argc); /* setdaemon */
115 void bifrdm(bifcxdef *ctx, int argc); /* remdaemon */
116 void bifinc(bifcxdef *ctx, int argc); /* incturn */
117 void bifqui(bifcxdef *ctx, int argc); /* quit */
118 void bifsav(bifcxdef *ctx, int argc); /* save */
119 void bifrso(bifcxdef *ctx, int argc); /* restore */
120 void biflog(bifcxdef *ctx, int argc); /* logging */
121 void bifres(bifcxdef *ctx, int argc); /* restart */
122 void bifinp(bifcxdef *ctx, int argc); /* input - get line from kb */
123 void bifnfy(bifcxdef *ctx, int argc); /* notify */
124 void bifunn(bifcxdef *ctx, int argc); /* unnotify */
125 void biftrc(bifcxdef *ctx, int argc); /* trace on/off */
126 void bifsay(bifcxdef *ctx, int argc); /* say */
127 void bifcar(bifcxdef *ctx, int argc); /* car */
128 void bifcdr(bifcxdef *ctx, int argc); /* cdr */
129 void bifcap(bifcxdef *ctx, int argc); /* caps */
130 void biflen(bifcxdef *ctx, int argc); /* length */
131 void biffnd(bifcxdef *ctx, int argc); /* find */
132 void bifsit(bifcxdef *ctx, int argc); /* setit - set current 'it' */
133 void bifsrn(bifcxdef *ctx, int argc); /* randomize: seed rand */
134 void bifrnd(bifcxdef *ctx, int argc); /* rand - get a random number */
135 void bifask(bifcxdef *ctx, int argc); /* askfile */
136 void bifssc(bifcxdef *ctx, int argc); /* setscore */
137 void bifsub(bifcxdef *ctx, int argc); /* substr */
138 void bifcvs(bifcxdef *ctx, int argc); /* cvtstr: convert to string */
139 void bifcvn(bifcxdef *ctx, int argc); /* cvtnum: convert to number */
140 void bifupr(bifcxdef *ctx, int argc); /* upper */
141 void biflwr(bifcxdef *ctx, int argc); /* lower */
142 void biffob(bifcxdef *ctx, int argc); /* firstobj */
143 void bifnob(bifcxdef *ctx, int argc); /* nextobj */
144 void bifsvn(bifcxdef *ctx, int argc); /* setversion */
145 void bifarg(bifcxdef *ctx, int argc); /* getarg */
146 void biftyp(bifcxdef *ctx, int argc); /* datatype */
147 void bifisc(bifcxdef *ctx, int argc); /* isclass */
148 void bifund(bifcxdef *ctx, int argc); /* undo */
149 void bifdef(bifcxdef *ctx, int argc); /* defined */
150 void bifpty(bifcxdef *ctx, int argc); /* proptype */
151 void bifoph(bifcxdef *ctx, int argc); /* outhide */
152 void bifgfu(bifcxdef *ctx, int argc); /* getfuse */
153 void bifruf(bifcxdef *ctx, int argc); /* runfuses */
154 void bifrud(bifcxdef *ctx, int argc); /* rundaemons */
155 void biftim(bifcxdef *ctx, int argc); /* gettime */
156 void bifsct(bifcxdef *ctx, int argc); /* intersect */
157 void bifink(bifcxdef *ctx, int argc); /* inputkey */
158 void bifwrd(bifcxdef *ctx, int argc); /* objwords */
159 void bifadw(bifcxdef *ctx, int argc); /* addword */
160 void bifdlw(bifcxdef *ctx, int argc); /* delword */
161 void bifgtw(bifcxdef *ctx, int argc); /* getwords */
162 void bifnoc(bifcxdef *ctx, int argc); /* nocaps */
163 void bifskt(bifcxdef *ctx, int argc); /* skipturn */
164 void bifcls(bifcxdef *ctx, int argc); /* clearscreen */
165 void bif1sc(bifcxdef *ctx, int argc); /* firstsc */
166 void bifvin(bifcxdef *ctx, int argc); /* verbinfo */
167 void bifcapture(bifcxdef *ctx, int argc); /* outcapture */
168
169 void biffopen(bifcxdef *ctx, int argc); /* fopen */
170 void biffclose(bifcxdef *ctx, int argc); /* fclose */
171 void biffwrite(bifcxdef *ctx, int argc); /* fwrite */
172 void biffread(bifcxdef *ctx, int argc); /* fread */
173 void biffseek(bifcxdef *ctx, int argc); /* fseek */
174 void biffseekeof(bifcxdef *ctx, int argc); /* fseekeof */
175 void bifftell(bifcxdef *ctx, int argc); /* ftell */
176
177 void bifsysinfo(bifcxdef *ctx, int argc); /* systemInfo */
178 void bifmore(bifcxdef *ctx, int argc); /* morePrompt */
179 void bifsetme(bifcxdef *ctx, int argc); /* parserSetMe */
180 void bifgetme(bifcxdef *ctx, int argc); /* parserGetMe */
181
182 void bifresearch(bifcxdef *ctx, int argc); /* reSearch */
183 void bifregroup(bifcxdef *ctx, int argc); /* reGetGroup */
184
185 void bifinpevt(bifcxdef *ctx, int argc); /* inputevent */
186 void bifdelay(bifcxdef *ctx, int argc); /* timeDelay */
187
188 void bifsetoutfilter(bifcxdef *ctx, int argc); /* setOutputFilter */
189 void bifexec(bifcxdef *ctx, int argc); /* execCommand */
190 void bifgetobj(bifcxdef *ctx, int argc); /* parserGetObj */
191 void bifparsenl(bifcxdef *ctx, int argc); /* parserParseNounList */
192 void bifprstok(bifcxdef *ctx, int argc); /* parserTokenize */
193 void bifprstoktyp(bifcxdef *ctx, int argc); /* parserGetTokTypes */
194 void bifprsdict(bifcxdef *ctx, int argc); /* parserDictLookup */
195 void bifprsrslv(bifcxdef *ctx, int argc); /* parserResolveObjects */
196 void bifprsrplcmd(bifcxdef *ctx, int argc); /* parserReplaceCommand */
197 void bifexitobj(bifcxdef *ctx, int argc); /* exitobj */
198 void bifinpdlg(bifcxdef *ctx, int argc); /* inputdialog */
199 void bifresexists(bifcxdef *ctx, int argc); /* resourceExists */
200
201 /*
202 * TADS/graphic functions - these are present in the text system, but
203 * don't do anything.
204 */
205 void bifgrp(bifcxdef *ctx, int argc); /* g_readpic: read picture */
206 void bifgsp(bifcxdef *ctx, int argc); /* g_showpic: show picture */
207 void bifgsh(bifcxdef *ctx, int argc); /* g_sethot: set hot list */
208 void bifgin(bifcxdef *ctx, int argc); /* g_inventory */
209 void bifgco(bifcxdef *ctx, int argc); /* g_compass */
210 void bifgov(bifcxdef *ctx, int argc); /* g_overlay */
211 void bifgmd(bifcxdef *ctx, int argc); /* g_mode */
212 void bifgmu(bifcxdef *ctx, int argc); /* g_music */
213 void bifgpa(bifcxdef *ctx, int argc); /* g_pause */
214 void bifgef(bifcxdef *ctx, int argc); /* g_effect */
215 void bifgsn(bifcxdef *ctx, int argc); /* g_sound */
216
217 #ifdef __cplusplus
218 }
219 #endif
220
221 #endif /* BIF_INCLUDED */