|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T e
Length: 4171 (0x104b)
Types: TextFile
Names: »exec.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/General/Abermud/exec.c«
/*
** The executive to drive the tables
*/
#include "kernel.h"
#include <setjmp.h>
#include "condact.h"
#ifdef RCSID
static char RCS[] =
"$Header: exec.c,v 1.1 89/03/13 09:36:08 rsalz Exp $";
#endif /* RCSID */
static jmp_buf escape_bf; /* Table escape */
static int ct; /* Offset Counter */
static LINE *crlin; /* Current Line */
static int doing_table; /* True if doing table */
static int matchq;
jumpaway()
{
longjmp(escape_bf, 1);
}
/*
* Routine to execute a table
*/
exectable(v)
LINE *v;
{
char dbuf[40];
matchq = 0;
if (setjmp(escape_bf)) {
doing_table = 0;
return matchq;
}
if (debug_mode) {
sprintf(dbuf, "***%d:[%d|%d]:[%d:%d]\n", verbcode, pl1, ob1, pl2, ob2);
bprintf(dbuf);
}
for (doing_table = 1; ; v++) {
crlin = v;
if (debug_mode)
bprintf("#");
if (v->verb == -1)
break;
if (v->verb && v->verb != verbcode)
continue;
if (v->item1 >= 0) {
if (v->item1 > 9999) {
if (v->item1 != P(pl1))
continue;
}
else if (v->item1 != ob1)
continue;
}
else {
switch (v->item1) {
case PL:
if (pl1 == -1)
continue;
break;
case OB:
if (ob1 == -1)
continue;
break;
case NONE:
if (pl1 != -1 || ob1 != -1)
continue;
}
}
if (v->item2 >= 0) {
if (v->item2 > 9999) {
if (v->item2 != P(pl2))
continue;
}
else if (v->item2 != ob2)
continue;
}
else {
switch (v->item2) {
case PL:
if (pl2 == -1)
continue;
break;
case OB:
if (ob2 == -1)
continue;
break;
case NONE:
if (pl2 != -1 || ob2 != -1)
continue;
}
}
/* The item matches on vocab */
matchq = 1;
if (debug_mode)
bprintf("**MATCH\n");
for (ct = 0, pptr = 0; ct < 6; ct++) {
if (debug_mode)
bprintf("%d~%d~",
v->conditions[ct].cnd_code,
v->conditions[ct].cnd_data);
if (!condeval(v->conditions[ct].cnd_code,
v->conditions[ct].cnd_data))
break;
if (debug_mode)
bprintf("T");
}
if (ct < 6)
continue;
if (debug_mode)
bprintf("**EXEC RUN\n");
pptr = 0;
matchq = 2;
if (debug_mode)
bprintf("^%d", v->actions[0]);
stdaction(v->actions[0]);
if (debug_mode)
bprintf("^%d", v->actions[1]);
stdaction(v->actions[1]);
if (debug_mode)
bprintf("^%d", v->actions[2]);
stdaction(v->actions[2]);
if (debug_mode)
bprintf("^%d", v->actions[3]);
stdaction(v->actions[3]);
if (debug_mode)
bprintf("[rnvr]\n");
}
doing_table = 0;
return matchq;
}
getnext()
{
return ct == 6 ? 0 : prmmod(crlin->conditions[++ct].cnd_data);
}
getpar()
{
switch (parameters[pptr++]) {
case 20000:
return pl1;
case 20001:
return pl2;
case 20002:
return ob1;
case 20003:
return ob2;
case 20004:
return ploc(mynum);
case 20005:
return prep;
case 20006:
return plev(mynum);
case 20007:
return pstr(mynum);
case 20008:
return psex(mynum);
case 20009:
return pscore(mynum);
case 20011:
return mynum;
}
pptr--;
if (parameters[pptr] > 9999)
return globaldata[parameters[pptr++] - 10000];
return parameters[pptr++];
}
prmmod(p)
int p;
{
switch (p) {
case 20000:
return pl1;
case 20001:
return pl2;
case 20002:
return ob1;
case 20003:
return ob2;
case 20004:
return ploc(mynum);
case 20005:
return prep;
case 20006:
return plev(mynum);
case 20007:
return pstr(mynum);
case 20008:
return psex(mynum);
case 20009:
return pscore(mynum);
case 20011:
return mynum;
}
return p > 9999 ? globaldata[p - 10000] : p;
}
getparnz()
{
int a;
if ((a = getpar()) == 0) {
mudlog("zero operand trap");
crapup("Everything dissolves in a haze of chaos....");
}
return a;
}
tables(v)
int v;
{
parse_2(v);
exectable(event);
return matchq;
}
error()
{
if (doing_table)
jumpaway();
}
erreval()
{
if (matchq == 1)
bprintf("You can't do that now.\n");
else if (randperc() > 50)
bprintf("I don't understand that.\n");
else
bprintf("Pardon?\n");
}
dostatus()
{
exectable(status);
}
dointerrupt()
{
exectable(inter);
}