opcodes.py revision f3f69e0e8d6a713566e129aa3ab321b1e6b07fbc
# Copyright (c) 2001, Stanford University
# All rights reserved.
#
# See the file LICENSE.txt for information on redistributing this software.
# This script generates include/cr_opcodes.h from the gl_header.parsed file.
import sys;
import cPickle;
import string;
import re;
import apiutil
print ""
print "/* DO NOT EDIT - THIS FILE GENERATED BY THE opcodes.py SCRIPT */"
print ""
print "#ifndef CR_OPCODES_H"
print "#define CR_OPCODES_H"
print ""
print "/* Functions with no return value and input-only parameters */"
print "typedef enum {"
enum_index = 0
print "\tCR_EXTEND_OPCODE=%d," % enum_index
print "\tCR_CMDBLOCKBEGIN_OPCODE=%d," % enum_index
print "\tCR_CMDBLOCKEND_OPCODE=%d," % enum_index
print "\tCR_NOP_OPCODE=255"
if enum_index > 254:
# This would have saved Mike some grief if it had been here earlier.
print "#error -- more than 255 opcodes!"
print "} CROpcode;\n"
# count up number of extended opcode commands
num_extends = 0
num_auto_codes = 0
num_extends += 1
num_auto_codes += 1
# sanity check for compatibility breakage
# we currently have 304
if num_auto_codes != 304:
print >> sys.stderr, "number of auto-generated op-codes should be 304, but is " + str(num_auto_codes)
print "/* Functions with a return value or output parameters */"
print "typedef enum {"
opcode_index = 0
enum_index = 0
chrelopcodes = {}
opcode = -1
if chrelopcode >= 0:
else:
else:
else:
print "} CRExtendOpcode;\n"
print "#endif /* CR_OPCODES_H */"