| | 1 | /* |
| | 2 | $Header: d:/cvsroot/tads/TADS2/SUP.H,v 1.2 1999/05/17 02:52:13 MJRoberts Exp $ |
| | 3 | */ |
| | 4 | |
| | 5 | /* |
| | 6 | * Copyright (c) 1992, 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 | sup.h - definitions for post-compilation setup |
| | 14 | Function |
| | 15 | does post-compilation setup, such as setting up contents lists |
| | 16 | Notes |
| | 17 | none |
| | 18 | Modified |
| | 19 | 03/28/92 MJRoberts - creation |
| | 20 | */ |
| | 21 | |
| | 22 | #ifndef SUP_INCLUDED |
| | 23 | #define SUP_INCLUDED |
| | 24 | |
| | 25 | #ifndef TOK_INCLUDED |
| | 26 | #include "tok.h" |
| | 27 | #endif |
| | 28 | #ifndef MCM_INCLUDED |
| | 29 | #include "mcm.h" |
| | 30 | #endif |
| | 31 | #ifndef OBJ_INCLUDED |
| | 32 | #include "obj.h" |
| | 33 | #endif |
| | 34 | #ifndef PRP_INCLUDED |
| | 35 | #include "prp.h" |
| | 36 | #endif |
| | 37 | #ifndef VOC_INCLUDED |
| | 38 | #include "voc.h" |
| | 39 | #endif |
| | 40 | |
| | 41 | /* setup context */ |
| | 42 | struct supcxdef |
| | 43 | { |
| | 44 | errcxdef *supcxerr; |
| | 45 | mcmcxdef *supcxmem; /* memory manager client context */ |
| | 46 | voccxdef *supcxvoc; /* player command parsing context */ |
| | 47 | tokthdef *supcxtab; /* top-level symbol table */ |
| | 48 | runcxdef *supcxrun; /* execution context */ |
| | 49 | uchar *supcxbuf; /* space for building a list */ |
| | 50 | ushort supcxlen; /* size of buffer */ |
| | 51 | }; |
| | 52 | typedef struct supcxdef supcxdef; |
| | 53 | |
| | 54 | /* set up contents list for one object for demand-on-load */ |
| | 55 | void supcont(void *ctx, objnum obj, prpnum prp); |
| | 56 | |
| | 57 | /* set up inherited vocabulary (called before executing game) */ |
| | 58 | void supivoc(supcxdef *ctx); |
| | 59 | |
| | 60 | /* find required objects/functions */ |
| | 61 | void supfind(errcxdef *ctx, tokthdef *tab, voccxdef *voc, |
| | 62 | objnum *preinit, int warnlevel, int casefold); |
| | 63 | |
| | 64 | /* set up reserved words */ |
| | 65 | void suprsrv(supcxdef *sup, void (*bif[])(struct bifcxdef *, int), |
| | 66 | toktdef *tab, int fncntmax, int v1compat, char *new_do, |
| | 67 | int casefold); |
| | 68 | |
| | 69 | /* set up built-in functions without symbol table (for run-time) */ |
| | 70 | void supbif(supcxdef *sup, void (*bif[])(struct bifcxdef *, int), |
| | 71 | int bifsiz); |
| | 72 | |
| | 73 | /* log an undefined-object error */ |
| | 74 | void sup_log_undefobj(mcmcxdef *mctx, errcxdef *ec, int err, |
| | 75 | char *sym_name, int sym_name_len, objnum objn); |
| | 76 | |
| | 77 | /* set up inherited vocabulary for a particular object */ |
| | 78 | void supivoc1(supcxdef *sup, voccxdef *ctx, vocidef *v, objnum target, |
| | 79 | int inh_from_obj, int flags); |
| | 80 | |
| | 81 | /* get name of an object out of symbol table */ |
| | 82 | void supgnam(char *buf, tokthdef *tab, objnum objn); |
| | 83 | |
| | 84 | /* table of built-in functions */ |
| | 85 | typedef struct supbidef supbidef; |
| | 86 | struct supbidef |
| | 87 | { |
| | 88 | char *supbinam; /* name of function */ |
| | 89 | void (*supbifn)(struct bifcxdef *, int); /* C routine to call */ |
| | 90 | }; |
| | 91 | |
| | 92 | /* external definition for special token table */ |
| | 93 | extern tokldef supsctab[]; |
| | 94 | |
| | 95 | #endif /* SUP_INCLUDED */ |