1.1 --- a/test.py Fri Dec 12 00:59:44 2008 +0100
1.2 +++ b/test.py Fri Jan 16 00:52:04 2009 +0100
1.3 @@ -8,16 +8,16 @@
1.4
1.5 code = None
1.6
1.7 -def show(importer, with_builtins=0):
1.8 - make(importer, with_builtins)
1.9 +def show(program, with_builtins=0):
1.10 + make(program, with_builtins)
1.11 show_code(code)
1.12
1.13 -def make(importer, with_builtins=0):
1.14 +def make(program, with_builtins=0):
1.15 global code
1.16 - code = importer.get_image(with_builtins)
1.17 + code = program.get_image(with_builtins)
1.18
1.19 -def raw(importer, with_builtins=0):
1.20 - return importer.get_raw_image()
1.21 +def raw(program, with_builtins=0):
1.22 + return program.get_raw_image()
1.23
1.24 def show_code(code):
1.25 for i, x in enumerate(code):
1.26 @@ -29,21 +29,21 @@
1.27 print "%6d" % (len(table_slice) - table_slice.count(None)), \
1.28 "".join(entry and "#" or "_" for entry in table_slice)
1.29
1.30 -def machine(importer, with_builtins=0, debug=0):
1.31 +def machine(program, with_builtins=0, debug=0):
1.32 print "Making the image..."
1.33 - make(importer, with_builtins)
1.34 + make(program, with_builtins)
1.35 print "Getting raw structures..."
1.36 - ot = importer.get_object_table()
1.37 - pt = importer.get_parameter_table()
1.38 + ot = program.get_object_table()
1.39 + pt = program.get_parameter_table()
1.40 objlist = ot.as_list()
1.41 paramlist = pt.as_list()
1.42 attr_error = objlist.access("__builtins__", "AttributeError").value.location
1.43 type_error = objlist.access("__builtins__", "TypeError").value.location
1.44 print "Getting raw image..."
1.45 - rc = importer.get_raw_image()
1.46 + rc = program.get_raw_image()
1.47 print "Initialising the machine..."
1.48 rm = rsvp.RSVPMachine(rc, objlist.as_raw(), paramlist.as_raw(), attr_error, type_error, debug=debug)
1.49 - rm.pc = importer.code_location
1.50 + rm.pc = program.code_location
1.51 return rm
1.52
1.53 def attrs(obj):
1.54 @@ -61,7 +61,7 @@
1.55 program = None
1.56
1.57 if "-omax" in args:
1.58 - requested_optimisations = micropython.Importer.supported_optimisations
1.59 + requested_optimisations = micropython.Program.supported_optimisations
1.60 else:
1.61 requested_optimisations = []
1.62 for arg in args:
1.63 @@ -69,7 +69,8 @@
1.64 for arg_part in arg[2:].split(","):
1.65 requested_optimisations.append(arg_part)
1.66
1.67 - i = micropython.Importer(path, requested_optimisations, "-v" in args)
1.68 + i = micropython.Importer(path, "-v" in args, requested_optimisations)
1.69 + p = micropython.Program(i, requested_optimisations)
1.70
1.71 try:
1.72 builtins = i.load_from_file("lib/builtins.py", "__builtins__")
1.73 @@ -84,7 +85,7 @@
1.74 if "-tb" in args:
1.75 raise
1.76 else:
1.77 - ot = i.get_object_table()
1.78 - pt = i.get_parameter_table()
1.79 + ot = p.get_object_table()
1.80 + pt = p.get_parameter_table()
1.81
1.82 # vim: tabstop=4 expandtab shiftwidth=4