develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34560 - in trunk: docs/book examples/io examples/library examples/pasm examples/pir examples/tge/branch languages/Zcode languages/befunge languages/bf languages/lazy-k languages/m4/src languages/pipp/src/common languages/regex languages/unla

From:
chromatic
Date:
December 29, 2008 00:07
Subject:
[svn:parrot] r34560 - in trunk: docs/book examples/io examples/library examples/pasm examples/pir examples/tge/branch languages/Zcode languages/befunge languages/bf languages/lazy-k languages/m4/src languages/pipp/src/common languages/regex languages/unla
Message ID:
20081229080741.4F3EBCB9FA@x12.develooper.com
Author: chromatic
Date: Mon Dec 29 00:07:39 2008
New Revision: 34560

Modified:
   trunk/docs/book/ch05_pasm.pod
   trunk/docs/book/ch13_reference.pod
   trunk/examples/io/httpd.pir
   trunk/examples/library/ncurses_life.pir
   trunk/examples/pasm/xml_parser.pasm
   trunk/examples/pir/pirric.pir
   trunk/examples/pir/quine_ord.pir
   trunk/examples/pir/sudoku.pir
   trunk/examples/tge/branch/transform.pir
   trunk/languages/Zcode/z3main.pir
   trunk/languages/befunge/load.pasm
   trunk/languages/bf/bf.pasm
   trunk/languages/bf/bfc.pir
   trunk/languages/bf/bfco.pir
   trunk/languages/lazy-k/lazy.pir
   trunk/languages/m4/src/freeze.pir
   trunk/languages/pipp/src/common/php_file.pir
   trunk/languages/regex/regex-compiler.pir
   trunk/languages/unlambda/unl.pir
   trunk/runtime/parrot/include/DWIM.pir
   trunk/runtime/parrot/library/Config/JSON.pir
   trunk/runtime/parrot/library/Crow.pir
   trunk/runtime/parrot/library/HTTP/Daemon.pir
   trunk/tools/dev/bench_op.pir

Log:
[src] Converted several old file modes to new form (patch by Geraud
CONTINSOUZAS).

Modified: trunk/docs/book/ch05_pasm.pod
==============================================================================
--- trunk/docs/book/ch05_pasm.pod	(original)
+++ trunk/docs/book/ch05_pasm.pod	Mon Dec 29 00:07:39 2008
@@ -1024,11 +1024,11 @@
 success and a C<Undef>X<Undef PMC> X<I/O;failure> object on
 failure. The C<ParrotIO> object hides OS-specific details.
 
-  open P0, "people.txt", "<"
+  open P0, "people.txt", "r"
 
 The modestring specifies whether the file is opened in read-only
-(C<E<lt>>), write-only (C<E<gt>>), read-write (C<+E<lt>>), or append
-mode (C<E<gt>E<gt>>).
+(C<r>), write-only (C<w>), read-write (C<rw>), or append
+mode (C<wa>).
 
 The C<close>X<close opcode (PASM)> opcode closes a C<ParrotIO> object:
 

Modified: trunk/docs/book/ch13_reference.pod
==============================================================================
--- trunk/docs/book/ch13_reference.pod	(original)
+++ trunk/docs/book/ch13_reference.pod	Mon Dec 29 00:07:39 2008
@@ -1771,7 +1771,7 @@
   open R<DEST>, R<FILENAME>
   open R<DEST>, R<FILENAME>, R<MODE>
 
-Open a file in the specified mode ("E<lt>", "E<gt>", etc.) and return
+Open a file in the specified mode ("r", "w", etc.) and return
 a filehandle. Without the mode it defaults to read/write.
 
 I<Arguments: P, S, S or P, S>

Modified: trunk/examples/io/httpd.pir
==============================================================================
--- trunk/examples/io/httpd.pir	(original)
+++ trunk/examples/io/httpd.pir	Mon Dec 29 00:07:39 2008
@@ -207,7 +207,7 @@
 SERVE_file:
     # try to open the file in url
     concat url, doc_root, url
-    fp = open url, "<"
+    fp = open url, 'r'
     unless fp goto SERVE_404
     len = stat url, .STAT_FILESIZE
     read file_content, fp, len

Modified: trunk/examples/library/ncurses_life.pir
==============================================================================
--- trunk/examples/library/ncurses_life.pir	(original)
+++ trunk/examples/library/ncurses_life.pir	Mon Dec 29 00:07:39 2008
@@ -579,7 +579,7 @@
     err  = "File not found " . file
 
     .local pmc io
-    open io, file, "<"
+    open io, file, 'r'
     $I0 = defined io
     unless $I0 goto nok
     null err

Modified: trunk/examples/pasm/xml_parser.pasm
==============================================================================
--- trunk/examples/pasm/xml_parser.pasm	(original)
+++ trunk/examples/pasm/xml_parser.pasm	Mon Dec 29 00:07:39 2008
@@ -371,7 +371,7 @@
 	# SMALL FILES ONLY.  SMALL.  SMALL.  SMALL.  Parrots I/O
 	# GC does not play nice with read().
 	set S10, ""
-	open P0, "examples/pasm/small.xml", "<"
+	open P0, "examples/pasm/small.xml", 'r'
 	if P0, READ
 	print "Couldn't open small.xml\n"
 	exit 1

Modified: trunk/examples/pir/pirric.pir
==============================================================================
--- trunk/examples/pir/pirric.pir	(original)
+++ trunk/examples/pir/pirric.pir	Mon Dec 29 00:07:39 2008
@@ -2339,7 +2339,7 @@
 
     #say filename
 
-    open file, filename, '<'
+    open file, filename, 'r'
 
     linecount = 0
 nextline:
@@ -2377,7 +2377,7 @@
     .local pmc file
     .local pmc program
 
-    open file, filename, '>'
+    open file, filename, 'w'
 
     self.'list'(0, 0, file)
 

Modified: trunk/examples/pir/quine_ord.pir
==============================================================================
--- trunk/examples/pir/quine_ord.pir	(original)
+++ trunk/examples/pir/quine_ord.pir	Mon Dec 29 00:07:39 2008
@@ -1433,9 +1433,9 @@
 push code_as_data, 101
 push code_as_data, 44
 push code_as_data, 32
-push code_as_data, 34
-push code_as_data, 60
-push code_as_data, 34
+push code_as_data, 39
+push code_as_data, 114 
+push code_as_data, 39
 push code_as_data, 10
 push code_as_data, 32
 push code_as_data, 32
@@ -3532,7 +3532,7 @@
     .local pmc code_fh
     .local int size
     size = stat program_name, .STAT_FILESIZE
-    code_fh = open program_name, "<"
+    code_fh = open program_name, 'r'
     .local string code
     code = read code_fh, size
 

Modified: trunk/examples/pir/sudoku.pir
==============================================================================
--- trunk/examples/pir/sudoku.pir	(original)
+++ trunk/examples/pir/sudoku.pir	Mon Dec 29 00:07:39 2008
@@ -237,7 +237,7 @@
     .local string line, result, c
     .local int i, len
     result = ""
-    io = open file_name, "<"
+    io = open file_name, 'r'
     $I0 = defined io
     unless $I0 goto err
 loop:

Modified: trunk/examples/tge/branch/transform.pir
==============================================================================
--- trunk/examples/tge/branch/transform.pir	(original)
+++ trunk/examples/tge/branch/transform.pir	Mon Dec 29 00:07:39 2008
@@ -108,7 +108,7 @@
   fromfile:
     # Read in the source file
     filename = argv[1]
-    filehandle = open filename, "<"
+    filehandle = open filename, 'r'
 
   grabline:
     $S1 = read filehandle, 65535

Modified: trunk/languages/Zcode/z3main.pir
==============================================================================
--- trunk/languages/Zcode/z3main.pir	(original)
+++ trunk/languages/Zcode/z3main.pir	Mon Dec 29 00:07:39 2008
@@ -97,7 +97,7 @@
   setattribute self, "Zmachine\0file", pfile
   .include "stat.pasm"
   $I0 = stat file, .STAT_FILESIZE
-  io = open file, "<"
+  io = open file, 'r'
   $S0 = read io, $I0
   close io
   im = new 'String'

Modified: trunk/languages/befunge/load.pasm
==============================================================================
--- trunk/languages/befunge/load.pasm	(original)
+++ trunk/languages/befunge/load.pasm	Mon Dec 29 00:07:39 2008
@@ -8,7 +8,7 @@
 # ordinal values of the content of the file, 80x25.
 LOAD:
         restore S0              # Fetch the filename
-        open P0, S0, "<"
+        open P0, S0, 'r'
         set S1, ""              # S1 = accumulator
 
 # Read the file.

Modified: trunk/languages/bf/bf.pasm
==============================================================================
--- trunk/languages/bf/bf.pasm	(original)
+++ trunk/languages/bf/bf.pasm	Mon Dec 29 00:07:39 2008
@@ -23,7 +23,7 @@
   set I3, 1     # optimize switch
   set S0, P5[2]
 no_o:
-  open P1, S0, "<"
+  open P1, S0, 'r'
   defined I0, P1
   unless I0, usage
 SOURCE_LOOP:

Modified: trunk/languages/bf/bfc.pir
==============================================================================
--- trunk/languages/bf/bfc.pir	(original)
+++ trunk/languages/bf/bfc.pir	Mon Dec 29 00:07:39 2008
@@ -32,7 +32,7 @@
 
   # Read the file into S1
 SOURCE:
-  open $P1, filename, "<"
+  open $P1, filename, 'r'
   defined $I0, $P1
   if $I0, SOURCE_LOOP
   print filename

Modified: trunk/languages/bf/bfco.pir
==============================================================================
--- trunk/languages/bf/bfco.pir	(original)
+++ trunk/languages/bf/bfco.pir	Mon Dec 29 00:07:39 2008
@@ -36,7 +36,7 @@
 
   # Read the file into S1
 SOURCE:
-  open $P1, filename, "<"
+  open $P1, filename, 'r'
   defined $I0, $P1
   if $I0, SOURCE_LOOP
   print filename

Modified: trunk/languages/lazy-k/lazy.pir
==============================================================================
--- trunk/languages/lazy-k/lazy.pir	(original)
+++ trunk/languages/lazy-k/lazy.pir	Mon Dec 29 00:07:39 2008
@@ -50,7 +50,7 @@
     goto run
 open_file:
     $S0 = argv[1]
-    in = open $S0, "<"
+    in = open $S0, 'r'
     $I0 = defined in
     if $I0 goto run
     printerr "can't open '"

Modified: trunk/languages/m4/src/freeze.pir
==============================================================================
--- trunk/languages/m4/src/freeze.pir	(original)
+++ trunk/languages/m4/src/freeze.pir	Mon Dec 29 00:07:39 2008
@@ -40,7 +40,7 @@
   .local string    text
 
   .local pmc frozen_fh
-  frozen_fh = open frozen_file, ">"
+  frozen_fh = open frozen_file, 'w'
   .local pmc iterator
   iterator = new 'Iterator', symtab
   iterator = .ITERATE_FROM_START
@@ -86,7 +86,7 @@
   .local string content
   # TODO: M4PATH
   .local pmc frozen_fh
-  frozen_fh = open frozen_file, "<"
+  frozen_fh = open frozen_file, 'r'
   if frozen_fh goto READ_CONTENT
     printerr "'"
     printerr frozen_file

Modified: trunk/languages/pipp/src/common/php_file.pir
==============================================================================
--- trunk/languages/pipp/src/common/php_file.pir	(original)
+++ trunk/languages/pipp/src/common/php_file.pir	Mon Dec 29 00:07:39 2008
@@ -574,7 +574,7 @@
     unless use_include_path goto L2
     $I0 |= USE_PATH
   L2:
-    stream = stream_open(filename, '<', $I0, context)
+    stream = stream_open(filename, 'r', $I0, context)
     unless stream goto L3
     $I0 = stream_passthru(stream)
     close stream

Modified: trunk/languages/regex/regex-compiler.pir
==============================================================================
--- trunk/languages/regex/regex-compiler.pir	(original)
+++ trunk/languages/regex/regex-compiler.pir	Mon Dec 29 00:07:39 2008
@@ -48,7 +48,7 @@
         .local string result
         .local string buffer
         result = ""
-        file = open filename, "<"
+        file = open filename, 'r'
 loop:   buffer = read file, 65536
         $I0 = length buffer
         le $I0, 0, done

Modified: trunk/languages/unlambda/unl.pir
==============================================================================
--- trunk/languages/unlambda/unl.pir	(original)
+++ trunk/languages/unlambda/unl.pir	Mon Dec 29 00:07:39 2008
@@ -28,7 +28,7 @@
     goto run
 open_file:
     $S0 = argv[1]
-    in = open $S0, "<"
+    in = open $S0, 'r'
     $I0 = defined in
     if $I0 goto run
     printerr "can't open '"

Modified: trunk/runtime/parrot/include/DWIM.pir
==============================================================================
--- trunk/runtime/parrot/include/DWIM.pir	(original)
+++ trunk/runtime/parrot/include/DWIM.pir	Mon Dec 29 00:07:39 2008
@@ -51,7 +51,7 @@
     .param pmc ar
     #concat me, "x"         # test output is in source.pirx
     .local pmc file
-    open file, me, ">"
+    open file, me, 'w'
     unless file, err_write
     .local pmc iter
     iter = new 'Iterator', ar
@@ -204,7 +204,7 @@
 .sub _read          # read in source code of script
     .param string me
     .local pmc file
-    open file, me, "<"
+    open file, me, 'r'
     unless file, err_open
     .local pmc ar
     .local string line

Modified: trunk/runtime/parrot/library/Config/JSON.pir
==============================================================================
--- trunk/runtime/parrot/library/Config/JSON.pir	(original)
+++ trunk/runtime/parrot/library/Config/JSON.pir	Mon Dec 29 00:07:39 2008
@@ -22,7 +22,7 @@
     .local string text
     .local pmc fh
 
-    fh = open filename, '<'
+    fh = open filename, 'r'
     if fh goto slurp_file
     $P0 = new 'Exception'
     $S0 = concat "can't open file: ", filename
@@ -72,7 +72,7 @@
     output = _json( config, expanded )
 
     # write out the file..
-    $P1 = open filename, '>'
+    $P1 = open filename, 'w'
     print $P1, output
     close $P1
 

Modified: trunk/runtime/parrot/library/Crow.pir
==============================================================================
--- trunk/runtime/parrot/library/Crow.pir	(original)
+++ trunk/runtime/parrot/library/Crow.pir	Mon Dec 29 00:07:39 2008
@@ -62,7 +62,7 @@
     .local pmc newsfile
     .local string buf, news, start
 
-    newsfile = open 'NEWS', '<'
+    newsfile = open 'NEWS', 'r'
 
     ## find the start of the news item for this version
     start    = concat 'New in ', version

Modified: trunk/runtime/parrot/library/HTTP/Daemon.pir
==============================================================================
--- trunk/runtime/parrot/library/HTTP/Daemon.pir	(original)
+++ trunk/runtime/parrot/library/HTTP/Daemon.pir	Mon Dec 29 00:07:39 2008
@@ -714,7 +714,7 @@
 
 SERVE_file:
     # try to open the file in url
-    fp = open url, "<"
+    fp = open url, 'r'
     unless fp goto SERVE_404
     len = stat url, .STAT_FILESIZE
     read file_content, fp, len

Modified: trunk/tools/dev/bench_op.pir
==============================================================================
--- trunk/tools/dev/bench_op.pir	(original)
+++ trunk/tools/dev/bench_op.pir	Mon Dec 29 00:07:39 2008
@@ -156,7 +156,7 @@
 no_v1:
     # op may be a file or an opcode - try to open it
     .local pmc F
-    open F, op, "<"
+    open F, op, 'r'
     .local int def
     def = defined F
     unless def goto op_is_op



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About