1.1 --- a/bytecode.py Wed Dec 08 23:02:46 2004 +0100
1.2 +++ b/bytecode.py Thu Dec 09 02:17:22 2004 +0100
1.3 @@ -1240,9 +1240,7 @@
1.4 pass
1.5
1.6 def i2c(self, arguments, program):
1.7 - program.load_global("chr") # Stack: value, chr
1.8 - program.rot_two() # Stack: chr, value
1.9 - program.call_function(1) # Stack: result
1.10 + pass
1.11
1.12 def i2d(self, arguments, program):
1.13 program.load_global("float") # Stack: value, float
2.1 --- a/classfile.py Wed Dec 08 23:02:46 2004 +0100
2.2 +++ b/classfile.py Thu Dec 09 02:17:22 2004 +0100
2.3 @@ -58,6 +58,11 @@
2.4 # Useful mix-ins.
2.5
2.6 class PythonMethodUtils:
2.7 + symbol_sep = "___" # was "$"
2.8 + type_sep = "__" # replaces "/"
2.9 + array_sep = "_array_" # was "[]"
2.10 + base_seps = ("_", "_") # was "<" and ">"
2.11 +
2.12 def get_python_name(self):
2.13 name = self.get_name()
2.14 if str(name) == "<init>":
2.15 @@ -66,22 +71,22 @@
2.16 return "__clinit__"
2.17 else:
2.18 name = str(name)
2.19 - return name + "$" + self._get_descriptor_as_name()
2.20 + return name + self.symbol_sep + self._get_descriptor_as_name()
2.21
2.22 def _get_descriptor_as_name(self):
2.23 l = []
2.24 for descriptor_type in self.get_descriptor()[0]:
2.25 l.append(self._get_type_as_name(descriptor_type))
2.26 - return "$".join(l)
2.27 + return self.symbol_sep.join(l)
2.28
2.29 def _get_type_as_name(self, descriptor_type, s=""):
2.30 base_type, object_type, array_type = descriptor_type
2.31 if base_type == "L":
2.32 - return object_type + s
2.33 + return object_type.replace("/", self.type_sep) + s
2.34 elif base_type == "[":
2.35 - return self._get_type_as_name(array_type, s + "[]")
2.36 + return self._get_type_as_name(array_type, s + self.array_sep)
2.37 else:
2.38 - return "<" + base_type + ">" + s
2.39 + return self.base_seps[0] + base_type + self.base_seps[1] + s
2.40
2.41 class PythonNameUtils:
2.42 def get_python_name(self):
3.1 --- a/classhook.py Wed Dec 08 23:02:46 2004 +0100
3.2 +++ b/classhook.py Thu Dec 09 02:17:22 2004 +0100
3.3 @@ -137,7 +137,7 @@
3.4 else:
3.5 archive, archive_path, path = self._get_archive_and_path(dir, name)
3.6
3.7 - print "Processing name", name, "in", dir, "producing", path, "within archive", archive
3.8 + #print "Processing name", name, "in", dir, "producing", path, "within archive", archive
3.9
3.10 if self._find_module_at_path(path, archive):
3.11 if archive is not None:
3.12 @@ -175,7 +175,7 @@
3.13
3.14 def _find_module_at_path(self, path, archive):
3.15 if self.hooks.path_isdir(path, archive):
3.16 - print "Looking in", path, "using archive", archive
3.17 + #print "Looking in", path, "using archive", archive
3.18
3.19 # Look for classes in the directory.
3.20
3.21 @@ -184,7 +184,7 @@
3.22
3.23 # Otherwise permit importing where directories containing classes exist.
3.24
3.25 - print "Filenames are", self.hooks.listdir(path, archive)
3.26 + #print "Filenames are", self.hooks.listdir(path, archive)
3.27 for filename in self.hooks.listdir(path, archive):
3.28 pathname = self.hooks.path_join(path, filename)
3.29 result = self._find_module_at_path(pathname, archive)
3.30 @@ -209,7 +209,7 @@
3.31 if datatype not in (JAVA_PACKAGE, JAVA_ARCHIVE):
3.32 return ihooks.ModuleLoader.load_module(self, name, stuff)
3.33
3.34 - print "Loading", archive, filename, info
3.35 + #print "Loading", archive, filename, info
3.36
3.37 # Set up the module.
3.38
3.39 @@ -229,13 +229,13 @@
3.40 # Get the real filename.
3.41
3.42 filename = self._get_path_in_archive(filename)
3.43 - print "Real filename", filename
3.44 + #print "Real filename", filename
3.45
3.46 # Load the class files.
3.47
3.48 class_files = {}
3.49 for class_filename in self.hooks.matching(filename, os.extsep + "class", archive):
3.50 - print "Loading class", class_filename
3.51 + #print "Loading class", class_filename
3.52 s = self.hooks.read(class_filename, archive)
3.53 class_file = classfile.ClassFile(s)
3.54 class_files[str(class_file.this_class.get_name())] = class_file