1.1 --- a/micropython/cmd.py Wed Mar 03 00:26:00 2010 +0100
1.2 +++ b/micropython/cmd.py Sun Mar 07 01:49:29 2010 +0100
1.3 @@ -43,33 +43,29 @@
1.4
1.5 return ",".join(micropython.Program.supported_optimisations)
1.6
1.7 -def program(filename, path, requested_optimisations, verbose=0):
1.8 +def program(path, requested_optimisations, verbose=0):
1.9
1.10 """
1.11 - Return the program object for the program specified by the given 'filename',
1.12 - module search 'path' and 'requested_optimisations'.
1.13 + Return a program object for the given module search 'path' and
1.14 + 'requested_optimisations'.
1.15 """
1.16
1.17 i = micropython.Importer(path, verbose, requested_optimisations)
1.18 p = micropython.Program(i, requested_optimisations)
1.19
1.20 i.load_from_file("lib/builtins.py", "__builtins__")
1.21 -
1.22 - if filename is not None:
1.23 - i.load_from_file(filename)
1.24 -
1.25 return p
1.26
1.27 # Convenience functions.
1.28
1.29 -def get_program(filename, path, args):
1.30 +def get_program(path, args):
1.31
1.32 """
1.33 - Return the program object for the program specified by the given 'filename',
1.34 - module search 'path' and command 'args'.
1.35 + Return the program object for the given module search 'path' and command
1.36 + 'args'.
1.37 """
1.38
1.39 requested_optimisations = parse_optimisations(args)
1.40 - return program(filename, path, requested_optimisations, "-v" in args)
1.41 + return program(path, requested_optimisations, "-v" in args)
1.42
1.43 # vim: tabstop=4 expandtab shiftwidth=4
2.1 --- a/micropython/inspect.py Wed Mar 03 00:26:00 2010 +0100
2.2 +++ b/micropython/inspect.py Sun Mar 07 01:49:29 2010 +0100
2.3 @@ -383,6 +383,8 @@
2.4 self.dispatch(n)
2.5 return Instance()
2.6
2.7 + # Generic support for classes of operations.
2.8 +
2.9 def _visitUnary(self, node):
2.10
2.11 "Accounting method for the unary operator 'node'."
3.1 --- a/test.py Wed Mar 03 00:26:00 2010 +0100
3.2 +++ b/test.py Sun Mar 07 01:49:29 2010 +0100
3.3 @@ -40,12 +40,15 @@
3.4 # Load the program.
3.5
3.6 try:
3.7 - p = micropython.cmd.get_program(filename, path, args)
3.8 + p = micropython.cmd.get_program(path, args)
3.9 + i = p.get_importer()
3.10 +
3.11 if filename is None:
3.12 print "Loading module micropython ..."
3.13 - m = p.get_importer().load("micropython")
3.14 + m = i.load("micropython")
3.15 else:
3.16 - m = p.get_importer().get_module("__main__")
3.17 + print "Loading from", filename, "..."
3.18 + m = i.load_from_file(filename)
3.19
3.20 # Build the program.
3.21
3.22 @@ -60,7 +63,6 @@
3.23
3.24 ot = p.get_object_table()
3.25 pt = p.get_parameter_table()
3.26 - i = p.get_importer()
3.27
3.28 print "Object table: ot = %r" % ot
3.29 print "Parameter table: pt = %r" % pt