Permalink
Browse files

disasm: Print namespace path coming and going

  • Loading branch information...
1 parent d17a7b4 commit 772e06e64e72a956036d3f599cb8f2d88f793118 @Benabik Benabik committed Aug 16, 2012
Showing with 19 additions and 9 deletions.
  1. +19 −9 src/disasm.winxed
View
28 src/disasm.winxed
@@ -153,6 +153,17 @@ function main[main](var argv) {
show_namespace(sub_map, sc_map, packfile.root);
}
+function name_namespace(var path) {
+ // Print the path to the new namespace
+ print('.namespace sc');
+ print(path[0]);
+ for(int i = 1; i < elements(path); ++i) {
+ print(', sc');
+ print(path[i]);
+ }
+ say("\n"); // Yes, two newlines
+}
+
function show_namespace(var sub_map, var sc_map, var ns, var path = []) {
for (string s in ns.contents) {
var v = ns.contents[s];
@@ -163,16 +174,15 @@ function show_namespace(var sub_map, var sc_map, var ns, var path = []) {
say('.end');
say();
break;
+
case 'PACT;Packfile;Namespace':
- push(path, sc_map[s]);
- print('.namespace sc');
- print(path[0]);
- for(int i = 1; i < elements(path); ++i) {
- print(', sc');
- print(path[i]);
- }
- say("\n"); // Yes, two newlines
- show_namespace(sub_map, sc_map, v);
+ push(path, sc_map[s]); // Update and the path
+ name_namespace(path);
+
+ show_namespace(sub_map, sc_map, v, path);
+
+ pop_var(path); // Restore and print the path
+ name_namespace(path);
break;
case 'PACT;Packfile;Multi':

0 comments on commit 772e06e

Please sign in to comment.