Artifact 077c4a85ad3920f00d07e00fda5b427d624d12b894d5f24bc986a8272b44d83e:
- Executable file
r37/lisp/csl/cslbase/mkbytes.red
— part of check-in
[f2fda60abd]
at
2011-09-02 18:13:33
on branch master
— Some historical releases purely for archival purposes
git-svn-id: https://svn.code.sf.net/p/reduce-algebra/code/trunk/historical@1375 2bfe0521-f11c-4a00-b80e-6202646ff360 (user: arthurcnorman@users.sourceforge.net, size: 2832) [annotate] [blame] [check-ins using] [more...]
% Create bytes.h out of opcodes.red % % Run ONCE when opcodes.red is created and then leave as documentation! % Also after generating bytes.h you need to go % filesign -u bytes.h % to get its signature correct. % % This code may be used and modified, and redistributed in binary % or source form, subject to the "CCL Public License", which should % accompany it. This license is a variant on the BSD license, and thus % permits use of code derived from this in either open and commercial % projects: but it does require that updates to this code be made % available back to the originators of the package. % Before merging other code in with this or linking this code % with other packages or libraries please check that the license terms % of the other material are compatible with those of this. % symbolic; global '(s!:opcodelist); if not boundp '!@cslbase then !@cslbase := "../cslbase"; off lower; in "$cslbase/opcodes.red"$ on lower; begin scalar o, oo, n; o := open("$cslbase/bytes.h", 'output); oo := wrs o; printc "/* bytes.h Copyright (C) Codemist 1993-2002 */"; terpri(); printc "/* Signature: 38cd8141 31-Mar-2002 */"; terpri(); printc "/*"; printc " * Bytecode interpreter support."; printc " *"; printc " * April 1993"; printc " */"; terpri(); % printc "#define JUMP_BACK 0x01 /* select direction of jump */"; % printc "#define JUMP_LONG 0x02 /* select 16 vs 8 bit offset */"; % terpri(); n := 0; for each v in s!:opcodelist do << princ "#define OP_"; princ v; ttab 32; princ "0x"; if n < 16 then princ "0"; prinhex n; terpri(); n := n + 1 >>; terpri(); printc "/* end of bytes.h */"; terpri(); wrs oo; close o; o := open("$cslbase/opnames.c", 'output); oo := wrs o; printc "/* opnames.c Copyright (C) Codemist 1993-2002 */"; terpri(); printc "/* Signature: 38cd8141 31-Mar-2002 */"; terpri(); terpri(); printc "static char *opnames[256] ="; printc "{"; n := 0; for each v in s!:opcodelist do << princ " "; princ '!"; princ v; princ '!"; princ ","; ttab 32; princ "/* 0x"; if n < 16 then princ "0"; prinhex n; printc " */"; n := n + 1 >>; while n < 256 do << princ " "; princ '!"; princ "xxxx"; princ '!"; if n neq 255 then princ ","; ttab 32; princ "/* 0x"; if n < 16 then princ "0"; prinhex n; printc " */"; n := n + 1 >>; printc "};"; terpri(); wrs oo; close o; return "bytes.h and opcodes.c made" end; bye;