Skip to content
Browse files

Remove FileHandle puts method and fix test and docs

Signed-off-by: Jonathan "Duke" Leto <jonathan@leto.net>
  • Loading branch information...
1 parent 165e732 commit 05a88d8a95cdecf94dbe6e0a11554a0ba88bb614 Sasho committed with leto Dec 17, 2011
View
11 docs/book/pir/ch08_io.pod
@@ -241,17 +241,6 @@ filehandle. The argument can be an integer, number, string, or PMC.
=end PIR_FRAGMENT
-=head3 puts
-
-The C<puts>X<puts method> method is similar to C<print>, but it only
-takes a string argument.
-
-=begin PIR_FRAGMENT
-
- $P0.'puts'('Hello!')
-
-=end PIR_FRAGMENT
-
=head3 read
The C<read>X<read method> method reads a specified number of bytes from the filehandle
View
8 runtime/parrot/library/Archive/Tar.pir
@@ -472,22 +472,22 @@ Write the in-memory archive to disk. The argument is already opened filehandle.
entry = shift $P1
.local string header
header = entry.'_format_tar_entry'()
- fh.'puts'(header)
+ fh.'print'(header)
$S0 = entry.'data'()
- fh.'puts'($S0)
+ fh.'print'($S0)
$I0 = length $S0
$I0 %= BLOCK
unless $I0 goto L1
.local string TAR_PAD
$I0 = BLOCK - $I0
TAR_PAD = repeat "\0", $I0
- fh.'puts'(TAR_PAD)
+ fh.'print'(TAR_PAD)
goto L1
L2:
.local string TAR_END
$I0 = 2 * BLOCK
TAR_END = repeat "\0", $I0
- fh.'puts'(TAR_END)
+ fh.'print'(TAR_END)
.end
.sub '_error' :method
View
28 runtime/parrot/library/Archive/Zip.pir
@@ -282,7 +282,7 @@ to something different than the given 'fileName'.
.sub '_writeLocalFileHeader' :method
.param pmc fh
.const string LOCAL_FILE_HEADER_SIGNATURE = "PK\x03\x04"
- $I0 = fh.'puts'(LOCAL_FILE_HEADER_SIGNATURE)
+ $I0 = fh.'print'(LOCAL_FILE_HEADER_SIGNATURE)
if $I0 goto L1
.tailcall self.'_ioError'('writing local header signature')
L1:
@@ -317,17 +317,17 @@ to something different than the given 'fileName'.
$I0 = length localExtraField
$S0 = self.'pack_v'($I0)
header .= $S0
- $I0 = fh.'puts'(header)
+ $I0 = fh.'print'(header)
if $I0 goto L2
.tailcall self.'_ioError'('writing local header')
L2:
if fileName == '' goto L3
- $I0 = fh.'puts'(fileName)
+ $I0 = fh.'print'(fileName)
if $I0 goto L3
.tailcall self.'_ioError'('writing local header filename')
L3:
if localExtraField == '' goto L4
- $I0 = fh.'puts'(localExtraField)
+ $I0 = fh.'print'(localExtraField)
if $I0 goto L4
.tailcall self.'_ioError'('writing local extra field')
L4:
@@ -337,7 +337,7 @@ to something different than the given 'fileName'.
.sub '_writeCentralDirectoryFileHeader' :method
.param pmc fh
.const string CENTRAL_DIRECTORY_FILE_HEADER_SIGNATURE = "PK\x01\x02"
- $I0 = fh.'puts'(CENTRAL_DIRECTORY_FILE_HEADER_SIGNATURE)
+ $I0 = fh.'print'(CENTRAL_DIRECTORY_FILE_HEADER_SIGNATURE)
if $I0 goto L1
.tailcall self.'_ioError'('writing central directory header signature')
L1:
@@ -394,22 +394,22 @@ to something different than the given 'fileName'.
$P0 = getattribute self, 'writeLocalHeaderRelativeOffset'
$S0 = self.'pack_V'($P0)
header .= $S0
- $I0 = fh.'puts'(header)
+ $I0 = fh.'print'(header)
if $I0 goto L2
.tailcall self.'_ioError'('writing central directory header')
L2:
unless fileNameLength goto L3
- $I0 = fh.'puts'(fileName)
+ $I0 = fh.'print'(fileName)
if $I0 goto L3
.tailcall self.'_ioError'('writing central directory filename')
L3:
unless extraFieldLength goto L4
- $I0 = fh.'puts'(cdExtraField)
+ $I0 = fh.'print'(cdExtraField)
if $I0 goto L4
.tailcall self.'_ioError'('writing central directory extra field')
L4:
unless fileCommentLength goto L5
- $I0 = fh.'puts'(fileComment)
+ $I0 = fh.'print'(fileComment)
if $I0 goto L5
.tailcall self.'_ioError'('writing central directory file comment')
L5:
@@ -455,7 +455,7 @@ to something different than the given 'fileName'.
$I0 = length localExtraField
$S0 = self.'pack_v'($I0)
header .= $S0
- $I0 = fh.'puts'(header)
+ $I0 = fh.'print'(header)
if $I0 goto L2
.tailcall self.'_ioError'('re-writing local header')
L2:
@@ -551,7 +551,7 @@ to something different than the given 'fileName'.
if $I0 == AZ_OK goto L4
.return ($I0)
L4:
- writeFh.'puts'($S0)
+ writeFh.'print'($S0)
$I0 = length $S0
compressedSize += $I0
goto L2
@@ -839,7 +839,7 @@ The second arg tells whether or not to try to seek backwards to re-write headers
.param int CDoffset
.param int EOCDoffset
.const string END_OF_CENTRAL_DIRECTORY_SIGNATURE_STRING = "PK\x05\x06"
- $I0 = fh.'puts'(END_OF_CENTRAL_DIRECTORY_SIGNATURE_STRING)
+ $I0 = fh.'print'(END_OF_CENTRAL_DIRECTORY_SIGNATURE_STRING)
if $I0 goto L1
.tailcall self.'_ioError'('writing EOCD Signature')
L1:
@@ -864,12 +864,12 @@ The second arg tells whether or not to try to seek backwards to re-write headers
header .= $S0
$S0 = self.'pack_v'(zipfileCommentLength)
header .= $S0
- $I0 = fh.'puts'(header)
+ $I0 = fh.'print'(header)
if $I0 goto L2
.tailcall self.'_ioError'('writing EOCD header')
L2:
unless zipfileCommentLength goto L3
- $I0 = fh.'puts'(zipfileComment)
+ $I0 = fh.'print'(zipfileComment)
if $I0 goto L3
.tailcall self.'_ioError'('writing zipfile comment')
L3:
View
2 runtime/parrot/library/Configure/genfile.pir
@@ -97,7 +97,7 @@ Pure PIR, without any dependencies.
push_eh _handler
$P0.'open'(filename, 'w')
pop_eh
- $P0.'puts'(content)
+ $P0.'print'(content)
$P0.'close'()
.return ()
_handler:
View
4 runtime/parrot/library/LWP/Protocol.pir
@@ -451,7 +451,7 @@ see http://search.cpan.org/dist/libwww-perl/
self.'_fixup_header'(request_headers, url, proxy)
$S0 = _format_request(method, fullpath, request_headers)
- sock.'puts'($S0)
+ sock.'print'($S0)
.local pmc response
response = new ['HTTP';'Response']
@@ -461,7 +461,7 @@ see http://search.cpan.org/dist/libwww-perl/
if null pcontent goto L11
content = pcontent
unless content goto L11
- $I1 = sock.'puts'(content)
+ $I1 = sock.'print'(content)
if $I1 >= 0 goto L11
$P0 = box RC_INTERNAL_SERVER_ERROR
setattribute response, 'code', $P0
View
4 runtime/parrot/library/Test/Builder/Output.pir
@@ -108,7 +108,7 @@ unescaped newlines.
.local pmc output
output = self.'output'()
- output.'puts'( message )
+ output.'print'( message )
.end
.sub escape_newlines :method
@@ -192,7 +192,7 @@ unescaped newlines.
WRITE_MESSAGE:
.local pmc diag_output
diag_output = self.'diag_output'()
- .tailcall diag_output.'puts'( message )
+ .tailcall diag_output.'print'( message )
.end
=back
View
8 runtime/parrot/library/osutils.pir
@@ -377,7 +377,7 @@ called as C<cp('foo.txt', 'bar/baz/qux/foo.txt')>.
$P0.'open'(dst, 'w')
pop_eh
- $P0.'puts'($S0)
+ $P0.'print'($S0)
$P0.'close'()
.return ()
@@ -944,7 +944,7 @@ be verbose. If given, the string I<spew C<filename>> will be displayed.
$P0.'open'(filename, 'w')
pop_eh
- $P0.'puts'(content)
+ $P0.'print'(content)
$P0.'close'()
.return ()
@@ -993,7 +993,7 @@ be verbose. If given, the string I<append C<filename>> will be displayed.
$P0.'open'(filename, 'a')
pop_eh
- $P0.'puts'(content)
+ $P0.'print'(content)
$P0.'close'()
.return ()
@@ -1174,7 +1174,7 @@ For more information, see the C<gzip(1)> man page.
$S1 = filename . '.gz'
gh.'open'($S1, 'wb')
- gh.'puts'($S0)
+ gh.'print'($S0)
gh.'close'()
unlink(filename)
View
19 src/pmc/filehandle.pmc
@@ -543,26 +543,11 @@ Print the passed in integer, number, string, or PMC to the filehandle.
METHOD print(PMC *to_print) {
STRING * const string_to_print = VTABLE_get_string(INTERP, to_print);
- Parrot_io_putps(INTERP, SELF, string_to_print);
- }
-
-
-/*
-
-=item C<METHOD puts(STRING *value)>
-
-Print the string to the filehandle.
-
-=cut
-
-*/
-
- METHOD puts(STRING *to_print) {
- const INTVAL status = Parrot_io_putps(INTERP, SELF, to_print);
+ const INTVAL status = Parrot_io_putps(INTERP, SELF, string_to_print);
+
RETURN(INTVAL status);
}
-
/*
=item C<METHOD buffer_type(STRING *new_type :optional)>
View
2 t/compilers/imcc/syn/op.t
@@ -174,7 +174,7 @@
.sub test_x_can
$P0 = new 'FileHandle'
- $I0 = can $P0, "puts"
+ $I0 = can $P0, "print"
is($I0, 1, 'x = can')
.end
View
2 t/dynpmc/gziphandle.t
@@ -60,7 +60,7 @@ Tests the C<GzipHandle> PMC, a zlib wrapper.
.const string filename = 't/dynpmc/gziphandle.t.gz'
$P1 = new 'GzipHandle'
$P1.'open'(filename, 'wb')
- $P1.'puts'($S0)
+ $P1.'print'($S0)
$P1.'print'($S0)
$P1.'close'()
$I1 = stat filename, .STAT_FILESIZE
View
16 t/pmc/io.t
@@ -409,49 +409,49 @@ ok 2
ok 3
OUT
-pir_output_is( <<'CODE', <<'OUTPUT', 'puts method' );
+pir_output_is( <<'CODE', <<'OUTPUT', 'print method' );
.sub main :main
$P0 = getinterp
$P2 = $P0.'stdout_handle'()
- can $I0, $P2, "puts"
+ can $I0, $P2, "print"
if $I0, ok1
print "not "
ok1: print "ok 1\n"
set_args "0,0", $P2, "ok 2\n"
- callmethodcc $P2, "puts"
+ callmethodcc $P2, "print"
.end
CODE
ok 1
ok 2
OUTPUT
-pir_output_is( <<'CODE', <<'OUTPUT', 'puts method - PIR' );
+pir_output_is( <<'CODE', <<'OUTPUT', 'print method - PIR' );
.sub main :main
.local string s
s = "ok 2\n"
.local pmc io
$P0 = getinterp
io = $P0.'stdout_handle'()
- $I0 = can io, "puts"
+ $I0 = can io, "print"
if $I0 goto ok1
print "not "
ok1: print "ok 1\n"
- io."puts"(s)
+ io."print"(s)
.end
CODE
ok 1
ok 2
OUTPUT
-pasm_output_is( <<'CODE', <<'OUTPUT', 'callmethod puts' );
+pasm_output_is( <<'CODE', <<'OUTPUT', 'callmethod print' );
.pcc_sub :main main:
getinterp P0 # invocant
set_args "0", P0
callmethodcc P0, "stderr_handle"
get_results "0", P2 # STDERR
- set S0, "puts" # method
+ set S0, "print" # method
set S5, "ok 1\n" # 2nd param
set_args "0,0", P2, S5
callmethodcc P2, S0
View
2 t/pmc/packfile.t
@@ -380,7 +380,7 @@ load_error:
# $P1 = new ['FileHandle']
# $P1.'open'("/tmp/1.pbc", "w")
- # $P1.'puts'($S0)
+ # $P1.'print'($S0)
# $P1.'close'()
pf = new 'Packfile'
View
10 t/pmc/stringhandle.t
@@ -247,7 +247,7 @@ ok 5 - read integer back from file
ok 6 - read string back from file
OUT
-pir_output_is( <<'CODE', <<'OUT', 'puts' );
+pir_output_is( <<'CODE', <<'OUT', 'print' );
.include 'except_types.pasm'
.sub 'test' :main
.local pmc sh, eh
@@ -257,22 +257,22 @@ pir_output_is( <<'CODE', <<'OUT', 'puts' );
eh.'handle_types'(.EXCEPTION_PIO_ERROR)
push_eh eh
- # puts to SH not opened
+ # print to SH not opened
result = 0
set_label eh, handle1
- sh.'puts'('something')
+ sh.'print'('something')
result = 1
goto done1
handle1:
finalize eh
done1:
say result
- # puts to SH opened for reading
+ # print to SH opened for reading
result = 0
set_label eh, handle2
sh.'open'('mockname', 'r')
- sh.'puts'('something')
+ sh.'print'('something')
result = 1
goto done2
handle2:

0 comments on commit 05a88d8

Please sign in to comment.
Something went wrong with that request. Please try again.