[svn:parrot] r43141 - in trunk: compilers/pct/src/PCT compilers/tge examples/benchmarks examples/library examples/pir examples/sdl runtime/parrot/library runtime/parrot/library/Getopt t/library tools/dev tools/util

tene at svn.parrot.org tene at svn.parrot.org
Fri Dec 18 07:27:24 UTC 2009


Author: tene
Date: Fri Dec 18 07:27:22 2009
New Revision: 43141
URL: https://trac.parrot.org/parrot/changeset/43141

Log:
Fix Getopt::Obj without breaking existing uses.

Modified:
   trunk/compilers/pct/src/PCT/HLLCompiler.pir
   trunk/compilers/tge/tgc.pir
   trunk/examples/benchmarks/array_access.pir
   trunk/examples/library/getopt_demo.pir
   trunk/examples/pir/quine_ord.pir
   trunk/examples/pir/sudoku.pir
   trunk/examples/sdl/mandel.pir
   trunk/runtime/parrot/library/Crow.pir
   trunk/runtime/parrot/library/Getopt/Obj.pir
   trunk/t/library/getopt_obj.t
   trunk/tools/dev/bench_op.pir
   trunk/tools/util/pgegrep

Modified: trunk/compilers/pct/src/PCT/HLLCompiler.pir
==============================================================================
--- trunk/compilers/pct/src/PCT/HLLCompiler.pir	Fri Dec 18 02:44:04 2009	(r43140)
+++ trunk/compilers/pct/src/PCT/HLLCompiler.pir	Fri Dec 18 07:27:22 2009	(r43141)
@@ -771,7 +771,7 @@
     .local string arg0
     arg0 = shift args
     .local pmc getopts
-    getopts = new 'Getopt::Obj'
+    getopts = new ['Getopt';'Obj']
     getopts.'notOptStop'(1)
     $P0 = getattribute self, '@cmdoptions'
     .local pmc it

Modified: trunk/compilers/tge/tgc.pir
==============================================================================
--- trunk/compilers/tge/tgc.pir	Fri Dec 18 02:44:04 2009	(r43140)
+++ trunk/compilers/tge/tgc.pir	Fri Dec 18 07:27:22 2009	(r43141)
@@ -46,7 +46,7 @@
 
     # Process command line options
     .local pmc getopts
-    getopts = new "Getopt::Obj"
+    getopts = new ["Getopt";"Obj"]
     getopts."notOptStop"(1)
     push getopts, "output|o=s"
     push getopts, "help|h"

Modified: trunk/examples/benchmarks/array_access.pir
==============================================================================
--- trunk/examples/benchmarks/array_access.pir	Fri Dec 18 02:44:04 2009	(r43140)
+++ trunk/examples/benchmarks/array_access.pir	Fri Dec 18 07:27:22 2009	(r43141)
@@ -26,7 +26,7 @@
 
     # Specification of command line arguments.
     .local pmc getopts
-    getopts = new [ 'Getopt::Obj' ]
+    getopts = new [ 'Getopt';'Obj' ]
     push getopts, "arr-size=i"
 
     .local pmc opt

Modified: trunk/examples/library/getopt_demo.pir
==============================================================================
--- trunk/examples/library/getopt_demo.pir	Fri Dec 18 02:44:04 2009	(r43140)
+++ trunk/examples/library/getopt_demo.pir	Fri Dec 18 07:27:22 2009	(r43141)
@@ -37,7 +37,7 @@
 
   # Specification of command line arguments.
   .local pmc getopts
-  getopts = new "Getopt::Obj"
+  getopts = new ["Getopt";"Obj"]
   # getopts."notOptStop"(1)
 
   # --version, boolean

Modified: trunk/examples/pir/quine_ord.pir
==============================================================================
--- trunk/examples/pir/quine_ord.pir	Fri Dec 18 02:44:04 2009	(r43140)
+++ trunk/examples/pir/quine_ord.pir	Fri Dec 18 07:27:22 2009	(r43141)
@@ -3512,7 +3512,7 @@
 
     # Specification of command line arguments.
     .local pmc getopts
-    getopts = new "Getopt::Obj"
+    getopts = new ["Getopt";"Obj"]
     push getopts, "print-code-as-data"
 
     # Looking at command line

Modified: trunk/examples/pir/sudoku.pir
==============================================================================
--- trunk/examples/pir/sudoku.pir	Fri Dec 18 02:44:04 2009	(r43140)
+++ trunk/examples/pir/sudoku.pir	Fri Dec 18 07:27:22 2009	(r43141)
@@ -281,7 +281,7 @@
     # Specification of command line arguments.
     # --version, --debug, --inv=nnn, --builtin=name, --nc, --help
     .local pmc getopts
-    getopts = new "Getopt::Obj"
+    getopts = new ["Getopt";"Obj"]
     push getopts, "version"
     push getopts, "debug"
     push getopts, "pairs"

Modified: trunk/examples/sdl/mandel.pir
==============================================================================
--- trunk/examples/sdl/mandel.pir	Fri Dec 18 02:44:04 2009	(r43140)
+++ trunk/examples/sdl/mandel.pir	Fri Dec 18 07:27:22 2009	(r43141)
@@ -59,7 +59,7 @@
 .sub 'get_opts'
     .param pmc argv
     .local pmc opts, getopts
-    getopts = new 'Getopt::Obj'
+    getopts = new ['Getopt';'Obj']
     push getopts, "quit|q"
     push getopts, "threads"
     $S0 = shift argv

Modified: trunk/runtime/parrot/library/Crow.pir
==============================================================================
--- trunk/runtime/parrot/library/Crow.pir	Fri Dec 18 02:44:04 2009	(r43140)
+++ trunk/runtime/parrot/library/Crow.pir	Fri Dec 18 07:27:22 2009	(r43141)
@@ -12,7 +12,7 @@
     load_bytecode 'Getopt/Obj.pbc'
 
     .local pmc getopts
-    getopts = new 'Getopt::Obj'
+    getopts = new ['Getopt';'Obj']
     getopts.'notOptStop'(1)
 
     getopts = push 'help|h'

Modified: trunk/runtime/parrot/library/Getopt/Obj.pir
==============================================================================
--- trunk/runtime/parrot/library/Getopt/Obj.pir	Fri Dec 18 02:44:04 2009	(r43140)
+++ trunk/runtime/parrot/library/Getopt/Obj.pir	Fri Dec 18 07:27:22 2009	(r43141)
@@ -13,7 +13,7 @@
     prog_name = shift argv
     load_bytecode "Getopt/Obj.pbc"
     .local pmc getopts
-    getopts = new "Getopt::Obj"
+    getopts = new ['Getopt';'Obj']
     getopts."notOptStop"(1)
 
      # these two are identical, with the exception of the call to name
@@ -70,7 +70,7 @@
 =cut
 
 .sub __load :anon :load
-    .local pmc obj, spec
+    .local pmc obj, spec, pns, ns
     obj = newclass "Getopt::Obj"
     addattribute obj, "Specs"
     addattribute obj, "notOptStop"
@@ -81,6 +81,14 @@
     addattribute spec, "short"
     addattribute spec, "type"
     addattribute spec, "optarg"
+
+    ns = get_hll_namespace ["Getopt::Obj"]
+    $P0 = get_hll_namespace
+    pns = $P0.'make_namespace'('Getopt')
+    pns.'add_namespace'('Obj', ns)
+    ns = get_hll_namespace ["Getopt::Obj::Spec"]
+    pns = get_hll_namespace ['Getopt';'Obj']
+    pns.'add_namespace'('Spec', ns)
 .end
 
 =back

Modified: trunk/t/library/getopt_obj.t
==============================================================================
--- trunk/t/library/getopt_obj.t	Fri Dec 18 02:44:04 2009	(r43140)
+++ trunk/t/library/getopt_obj.t	Fri Dec 18 07:27:22 2009	(r43141)
@@ -37,7 +37,7 @@
 
         load_bytecode "Getopt/Obj.pbc"
         .local pmc getopts
-        getopts = new "Getopt::Obj"
+        getopts = new ['Getopt';'Obj']
 
         $P0 = getopts."add"()
         $P0."long"("foo")
@@ -96,7 +96,7 @@
 
         load_bytecode "Getopt/Obj.pbc"
         .local pmc getopts
-        getopts = new "Getopt::Obj"
+        getopts = new ['Getopt';'Obj']
 
         $P0 = getopts."add"()
         $P0."short"("f")
@@ -142,7 +142,7 @@
 
         load_bytecode "Getopt/Obj.pbc"
         .local pmc getopts
-        getopts = new "Getopt::Obj"
+        getopts = new ['Getopt';'Obj']
 
         $P0 = getopts."add"()
         $P0."short"("I")
@@ -176,7 +176,7 @@
 
         load_bytecode "Getopt/Obj.pbc"
         .local pmc getopts
-        getopts = new "Getopt::Obj"
+        getopts = new ['Getopt';'Obj']
 
         $P0 = getopts."add"()
         $P0."long"("include")
@@ -212,7 +212,7 @@
 
         load_bytecode "Getopt/Obj.pbc"
         .local pmc getopts
-        getopts = new "Getopt::Obj"
+        getopts = new ['Getopt';'Obj']
 
         $P0 = getopts."add"()
         $P0."long"("define")
@@ -252,7 +252,7 @@
 
         load_bytecode "Getopt/Obj.pbc"
         .local pmc getopts
-        getopts = new "Getopt::Obj"
+        getopts = new ['Getopt';'Obj']
 
         $P0 = getopts."add"()
         $P0."short"("a")
@@ -295,7 +295,7 @@
 
         load_bytecode "Getopt/Obj.pbc"
         .local pmc getopts
-        getopts = new "Getopt::Obj"
+        getopts = new ['Getopt';'Obj']
         getopts."notOptStop"(1)
 
         $P0 = getopts."add"()
@@ -330,7 +330,7 @@
 
         load_bytecode "Getopt/Obj.pbc"
         .local pmc getopts
-        getopts = new "Getopt::Obj"
+        getopts = new ['Getopt';'Obj']
 
         $P0 = getopts."add"()
         $P0."long"("foo")
@@ -373,7 +373,7 @@
 
         load_bytecode "Getopt/Obj.pbc"
         .local pmc getopts
-        getopts = new "Getopt::Obj"
+        getopts = new ['Getopt';'Obj']
         getopts."notOptStop"(1)
 
         $P0 = getopts."add"()
@@ -422,7 +422,7 @@
 
         load_bytecode "Getopt/Obj.pbc"
         .local pmc getopts
-        getopts = new "Getopt::Obj"
+        getopts = new ['Getopt';'Obj']
         getopts."notOptStop"(1)
 
         $P0 = getopts."add"()
@@ -476,7 +476,7 @@
 
         load_bytecode "Getopt/Obj.pbc"
         .local pmc getopts
-        getopts = new "Getopt::Obj"
+        getopts = new ['Getopt';'Obj']
 
         $P0 = getopts."add"()
         $P0."long"("foo")
@@ -524,7 +524,7 @@
 
         load_bytecode "Getopt/Obj.pbc"
         .local pmc getopts
-        getopts = new "Getopt::Obj"
+        getopts = new ['Getopt';'Obj']
 
         $P0 = getopts."add"()
         $P0."long"("foo")
@@ -576,7 +576,7 @@
 
         load_bytecode "Getopt/Obj.pbc"
         .local pmc getopts
-        getopts = new "Getopt::Obj"
+        getopts = new ['Getopt';'Obj']
 
         push getopts, 'foo=s'
         push getopts, 'bar|b=s'
@@ -659,7 +659,7 @@
         push argv, '--foo=file'
         load_bytecode "Getopt/Obj.pbc"
         .local pmc getopts
-        getopts = new "Getopt::Obj"
+        getopts = new ['Getopt';'Obj']
         $P1 = getopts."get_options"(argv)
         $S0 = $P1["foo"]
         print "foo is "
@@ -683,7 +683,7 @@
         push argv, '--bar'
         load_bytecode "Getopt/Obj.pbc"
         .local pmc getopts
-        getopts = new "Getopt::Obj"
+        getopts = new ['Getopt';'Obj']
         push getopts, 'foo=s'
         push getopts, 'bar=s'
         $P1 = getopts."get_options"(argv)

Modified: trunk/tools/dev/bench_op.pir
==============================================================================
--- trunk/tools/dev/bench_op.pir	Fri Dec 18 02:44:04 2009	(r43140)
+++ trunk/tools/dev/bench_op.pir	Fri Dec 18 07:27:22 2009	(r43141)
@@ -81,7 +81,7 @@
 
     # Specification of command line arguments.
     .local pmc getopts
-    getopts = new "Getopt::Obj"
+    getopts = new ["Getopt";"Obj"]
     # getopts."notOptStop"(1)
     push getopts, "version"
     push getopts, "verbose=i"

Modified: trunk/tools/util/pgegrep
==============================================================================
--- trunk/tools/util/pgegrep	Fri Dec 18 02:44:04 2009	(r43140)
+++ trunk/tools/util/pgegrep	Fri Dec 18 07:27:22 2009	(r43141)
@@ -88,7 +88,7 @@
 	load_bytecode 'Getopt/Obj.pbc'
 	load_bytecode 'PGE.pbc'
 	.local pmc getopts
-	getopts = new 'Getopt::Obj'
+	getopts = new [ 'Getopt';'Obj' ]
 	getopts.'notOptStop'(1)
 	push getopts, 'with-filename|H'
 	push getopts, 'files-with-matches|l'
@@ -207,7 +207,7 @@
 	lineno = 1
 	matched = 0 # Only used for --files-without-matches
 	line = readline handle
-	linelen = length line 
+	linelen = length line
 
 	.local pmc p6rule_compile, cntrlchar
 	$S0 = '<+cntrl-[\t\r\n]>'


More information about the parrot-commits mailing list