* from: putdriver.c,v 2.2 88/09/19 12:55:27 nhall Exp
* This code is such a kludge that I don't want to put my name on it.
* It was a ridiculously fast hack and needs rewriting.
* However it does work...
/* The original idea was to put all the driver code
* in one place so it would be easy to modify
* but as hacks got thrown in it got worse and worse...
* It's to the point where a user would be better off
* writing his own driver and xebec should JUST produce
char Eventshiftstring
[10];
static char statename
[] = {'_', 's', 't', 'a', 't', 'e', 0 };
static char *strings
[] = {
"\n\nstatic struct act_ent {\n",
"\tint a_newstate;\n\tint a_action;\n",
"} statetable[] = { {0,0},\n",
"_driver(p, e)\nregister ",
" *p;\nregister struct ",
"\tregister int index, error=0;\n",
"\tstruct act_ent *a;\n",
"\tstatic struct act_ent erroraction = {0,-1};\n",
"_debug;\n\textern FILE *",
"\n\tindex = inx[1 + e->ev_number][p->",
"];\n\tif(index<0) index=_Xebec_index(e, p);\n",
"\tif (index==0) {\n\t\ta = &erroraction;\n",
"\t} else\n\t\ta = &statetable[index];\n\n",
"_astringfile, \"%15s <-- %15s [%15s] \\n\\t%s\\n\",\n",
"\t\tsstring[a->a_newstate], sstring[p->",
"_state], estring[e->ev_number], astring[a->a_action]);\n\n",
"\t\terror = _Xebec_action( a->a_action, e, p );\n",
"_state = a->a_newstate;\n\treturn error;\n}\n",
"\n_XEBEC_PG int _Xebec_action(a,e,p)\nint a;\nstruct ",
"_protocol_error(e,p);\n",
#define PART10 { 101, 105 }
"_astringfile, \"index 0x%5x\\n\", index);\n",
#define PART5 { 110, 121 }
"\n_XEBEC_PG int\n_Xebec_index( e,p )\n",
" *p;\n{\nswitch( (e->ev_number<<",
#define PART11 {130, 137 }
"\t\ta->a_newstate, p->",
"_state, e->ev_number, a->a_action, 0);\n\n",
#define PART13 {140, 147 }
"_astringfile, \"%15s <-- %15s [%15s] \\n\",\n",
"\t\tsstring[a->a_newstate], sstring[p->",
"_state], estring[e->ev_number]);\n\n",
#define PART14 { 150,150 }
"#define _XEBEC_PG static\n",
#define PART15 { 151,151 }
static struct { int start
; int finish
; } parts
[] = {
for( i
= parts
[x
].start
; i
<= parts
[x
].finish
; i
++)
fprintf(f
, "%s", strings
[i
]);