> > - print INTERP "\tx[$opcodes{$name}{CODE}] = (void*)$name; \\\n";
> > -}
> > -print INTERP "} while (0);\n";
> > + printf INTERP " { (void *)%-12s, %-14s, %d, { ",
> > + $name, "\"$name\"", $opcodes{$name}{ARGS};
>
> This is so much more confusing. :(
It may be a little less clear to read the code, but the output is so much
more readable in the generated file. A good trade-off in my book (my book
allows printf :-)
> > +#define DO_OP(PC,INTERP) PC = ((INTERP->opcode_info)[*PC].func)(PC,INTERP);
>
> I'm highly unconvinced that this is as portable as you'd like to think it is.
Yeah. I'm not a portability guru. Obviously the meaning is the same to a
human C programmer and we remove the (explicit) temporaries. I think this
is more *redable*, but I can't speek to whether it is equally
*compilable*. I don't see any reason why it wouldn't be, but as I said,
I don't know all there is to know about portability when it comes to stuff
like this. I'm hoping to learn, though, if someone tries it and they tell
me how it barfs.
> > + /* TODO: Why not 'op_info_table_t
>opcode_info'? */
>
> Because we want to keep our developers sane.
The comment is there because it doesn't compile. I don't know what the
developer sanity effects would be if it did compile.
Regards,
-- Gregor