Permalink
Browse files

[pdd22io] Merging the pdd22io_part2 branch into trunk for r32922 to r…

…33687.

git-svn-id: https://svn.parrot.org/parrot/trunk@33695 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent 5a9348e commit 9f9cea2592e20880e6946c17d112ecd58c9f8b6f @allisonrandal allisonrandal committed Dec 9, 2008
Showing with 2,758 additions and 9,865 deletions.
  1. +5 −11 MANIFEST
  2. +2 −2 compilers/imcc/instructions.c
  3. +1 −1 compilers/imcc/main.c
  4. +8 −6 compilers/imcc/parser_util.c
  5. +3 −3 compilers/imcc/pbc.c
  6. +6 −8 compilers/pct/src/PCT/HLLCompiler.pir
  7. +3 −12 config/gen/makefiles/root.in
  8. +9 −0 docs/pdds/pdd22_io.pod
  9. +1 −1 docs/tests.pod
  10. +40 −408 include/parrot/io.h
  11. +1 −0 include/parrot/string_funcs.h
  12. +28 −22 languages/WMLScript/src/wmlsstdlibs.pir
  13. +3 −3 languages/lua/luac2pir.pir
  14. +3 −3 languages/lua/luad.pir
  15. +1 −1 languages/lua/src/lib/luaaux.pir
  16. +2 −2 languages/lua/src/lib/luaperl.pir
  17. +2 −2 languages/perl6/src/classes/Object.pir
  18. +62 −62 src/debug.c
  19. +1 −1 src/dynoplibs/myops.ops
  20. +42 −40 src/embed.c
  21. +2 −2 src/events.c
  22. +7 −7 src/exceptions.c
  23. +5 −5 src/extend.c
  24. +4 −4 src/gc/dod.c
  25. +1 −1 src/gc/register.c
  26. +2 −2 src/global.c
  27. +8 −7 src/inter_create.c
  28. +1 −1 src/interpreter.c
  29. +84 −6 src/io.c
  30. +27 −17 src/io/api.c
  31. +37 −18 src/io/buffer.c
  32. +156 −0 src/io/core.c
  33. +0 −1,602 src/io/io.c
  34. +0 −927 src/io/io_buf.c
  35. +0 −343 src/io/io_layers.c
  36. +0 −653 src/io/io_passdown.c
  37. +6 −400 src/io/io_private.h
  38. +0 −545 src/io/io_stdio.c
  39. +0 −1,288 src/io/io_unix.c
  40. +0 −230 src/io/io_utf8.c
  41. +0 −1,013 src/io/io_win32.c
  42. +226 −0 src/io/socket_api.c
  43. 0 src/io/{unix_socket.c → socket_unix.c}
  44. 0 src/io/{win32_socket.c → socket_win32.c}
  45. +3 −3 src/io/unix.c
  46. +148 −0 src/io/utf8.c
  47. +6 −2 src/io/win32.c
  48. +20 −20 src/jit.c
  49. +19 −19 src/malloc.c
  50. +1 −2 src/multidispatch.c
  51. +1 −1 src/oo.c
  52. +37 −147 src/ops/io.ops
  53. +838 −872 src/ops/ops.num
  54. +53 −53 src/packdump.c
  55. +53 −53 src/packfile.c
  56. +10 −10 src/packfile/pf_items.c
  57. +3 −3 src/packout.c
  58. +23 −23 src/pbc_merge.c
  59. +21 −21 src/pdump.c
  60. +3 −3 src/pmc/coroutine.pmc
  61. +160 −5 src/pmc/filehandle.pmc
  62. +0 −573 src/pmc/parrotio.pmc
  63. +10 −10 src/pmc/pccmethod_test.pmc
  64. +1 −1 src/pmc/sub.pmc
  65. +2 −2 src/pmc/unmanagedstruct.pmc
  66. +8 −8 src/runops_cores.c
  67. +1 −1 src/spf_vtable.c
  68. +5 −5 src/stacks.c
  69. +2 −2 src/stm/backend.c
  70. +1 −1 src/string.c
  71. +1 −1 src/sub.c
  72. +2 −2 src/thread.c
  73. +61 −61 src/trace.c
  74. +5 −5 src/warnings.c
  75. +1 −1 t/compilers/imcc/syn/op.t
  76. +2 −38 t/op/interp.t
  77. +65 −53 t/op/string_cs.t
  78. +83 −63 t/op/stringu.t
  79. +198 −3 t/pmc/filehandle.t
  80. +86 −103 t/pmc/io.t
  81. +10 −10 t/pmc/parrotio.t
  82. +3 −3 t/src/basic.t
  83. +12 −12 t/src/compiler.t
  84. +1 −1 t/src/exit.t
  85. +1 −1 t/src/extend.t
  86. +7 −7 t/src/warnings.t
  87. +2 −2 t/steps/auto_pmc-01.t
View
@@ -2984,22 +2984,17 @@ src/intlist.c []
src/io.c []
src/io/api.c []
src/io/buffer.c []
-src/io/io.c []
-src/io/io_buf.c []
-src/io/io_layers.c []
+src/io/core.c []
src/io/io_mmap.c []
-src/io/io_passdown.c []
src/io/io_private.h []
-src/io/io_stdio.c []
src/io/io_string.c []
-src/io/io_unix.c []
-src/io/io_utf8.c []
-src/io/io_win32.c []
src/io/portable.c []
+src/io/socket_api.c []
+src/io/socket_unix.c []
+src/io/socket_win32.c []
src/io/unix.c []
-src/io/unix_socket.c []
+src/io/utf8.c []
src/io/win32.c []
-src/io/win32_socket.c []
src/jit.c []
src/jit.h []
src/jit/alpha/core.jit []
@@ -3133,7 +3128,6 @@ src/pmc/packfilerawsegment.pmc []
src/pmc/packfilesegment.pmc []
src/pmc/pair.pmc []
src/pmc/parrotinterpreter.pmc []
-src/pmc/parrotio.pmc []
src/pmc/parrotlibrary.pmc []
src/pmc/parrotrunningthread.pmc []
src/pmc/parrotthread.pmc []
@@ -648,7 +648,7 @@ ins_print(PARROT_INTERP, ARGMOD(FILE *fd), ARGIN(const Instruction *ins))
int len;
#if IMC_TRACE
- PIO_eprintf(NULL, "ins_print\n");
+ Parrot_io_eprintf(NULL, "ins_print\n");
#endif
/* comments, labels and such */
@@ -811,7 +811,7 @@ e_file_emit(PARROT_INTERP,
ARGIN(const Instruction *ins))
{
#if IMC_TRACE
- PIO_eprintf(NULL, "e_file_emit\n");
+ Parrot_io_eprintf(NULL, "e_file_emit\n");
#endif
if ((ins->type & ITLABEL) || ! *ins->opname)
ins_print(interp, stdout, ins);
View
@@ -445,7 +445,7 @@ parseflags(PARROT_INTERP, int *argc, char **argv[])
exit(EX_USAGE);
break;
case OPT_RUNTIME_PREFIX:
- PIO_printf(interp, "%Ss\n",
+ Parrot_io_printf(interp, "%Ss\n",
Parrot_get_runtime_path(interp));
exit(EXIT_SUCCESS);
case 'V':
@@ -187,7 +187,7 @@ op_fullname(ARGOUT(char *dest), ARGIN(const char *name),
#if IMC_TRACE_HIGH
char *full = dest;
- PIO_eprintf(NULL, "op %s", name);
+ Parrot_io_eprintf(NULL, "op %s", name);
#endif
strcpy(dest, name);
@@ -198,7 +198,7 @@ op_fullname(ARGOUT(char *dest), ARGIN(const char *name),
*dest++ = '_';
if (args[i]->type == VTADDRESS) {
#if IMC_TRACE_HIGH
- PIO_eprintf(NULL, " (address)%s", args[i]->name);
+ Parrot_io_eprintf(NULL, " (address)%s", args[i]->name);
#endif
*dest++ = 'i';
*dest++ = 'c';
@@ -207,7 +207,7 @@ op_fullname(ARGOUT(char *dest), ARGIN(const char *name),
/* if one ever wants num keys, they go with 'S' */
if (keyvec & KEY_BIT(i)) {
#if IMC_TRACE_HIGH
- PIO_eprintf(NULL, " (key)%s", args[i]->name);
+ Parrot_io_eprintf(NULL, " (key)%s", args[i]->name);
#endif
*dest++ = 'k';
if (args[i]->set=='S' || args[i]->set=='N' || args[i]->set=='K') {
@@ -225,18 +225,20 @@ op_fullname(ARGOUT(char *dest), ARGIN(const char *name),
if (args[i]->type & (VTCONST|VT_CONSTP)) {
#if IMC_TRACE_HIGH
- PIO_eprintf(NULL, " (%cc)%s", tolower((unsigned char)args[i]->set), args[i]->name);
+ Parrot_io_eprintf(NULL, " (%cc)%s",
+ tolower((unsigned char)args[i]->set), args[i]->name);
#endif
*dest++ = 'c';
}
#if IMC_TRACE_HIGH
else
- PIO_eprintf(NULL, " (%c)%s", tolower((unsigned char)args[i]->set), args[i]->name);
+ Parrot_io_eprintf(NULL, " (%c)%s",
+ tolower((unsigned char)args[i]->set), args[i]->name);
#endif
}
*dest = '\0';
#if IMC_TRACE_HIGH
- PIO_eprintf(NULL, " -> %s\n", full);
+ Parrot_io_eprintf(NULL, " -> %s\n", full);
#endif
}
View
@@ -1923,7 +1923,7 @@ e_pbc_emit(PARROT_INTERP, SHIM(void *param), ARGIN(const IMC_Unit *unit),
int op, i;
#if IMC_TRACE_HIGH
- PIO_eprintf(NULL, "e_pbc_emit\n");
+ Parrot_io_eprintf(NULL, "e_pbc_emit\n");
#endif
/* first instruction, do initialisation ... */
@@ -1980,7 +1980,7 @@ e_pbc_emit(PARROT_INTERP, SHIM(void *param), ARGIN(const IMC_Unit *unit),
if (ins->symregs[0] && ins->symregs[0]->pcc_sub) {
#if IMC_TRACE
- PIO_eprintf(NULL, "pbc.c: e_pbc_emit (pcc_sub=%s)\n",
+ Parrot_io_eprintf(NULL, "pbc.c: e_pbc_emit (pcc_sub=%s)\n",
ins->symregs[0]->name);
#endif
@@ -2010,7 +2010,7 @@ e_pbc_emit(PARROT_INTERP, SHIM(void *param), ARGIN(const IMC_Unit *unit),
opcode_t last_label = 1;
#if IMC_TRACE_HIGH
- PIO_eprintf(NULL, "emit_pbc: op [%d %s]\n", ins->opnum, ins->opname);
+ Parrot_io_eprintf(NULL, "emit_pbc: op [%d %s]\n", ins->opnum, ins->opname);
#endif
if ((ins->type & ITBRANCH)
@@ -537,7 +537,7 @@ specifies the encoding to use for the input (e.g., "utf8").
encoding = adverbs['encoding']
if encoding == 'fixed_8' goto interactive_loop
unless encoding goto interactive_loop
- push stdin, encoding
+ stdin.'encoding'(encoding)
interactive_loop:
.local pmc code
unless stdin goto interactive_end
@@ -660,13 +660,11 @@ options are passed to the evaluator.
.local string iname
.local pmc ifh
iname = shift iter
- ifh = open iname, '<'
- unless ifh goto err_infile
- if encoding == 'fixed_8' goto iter_loop_1
- unless encoding goto iter_loop_1
- push ifh, encoding
+ ifh = new 'FileHandle'
+ unless encoding == 'utf8' goto iter_loop_1
+ ifh.'encoding'(encoding)
iter_loop_1:
- $S0 = ifh.'slurp'('')
+ $S0 = ifh.'readall'(iname)
code .= $S0
close ifh
goto iter_loop
@@ -783,7 +781,7 @@ Generic method for compilers invoked from a shell command line.
output = adverbs['output']
if output == '' goto save_output_1
if output == '-' goto save_output_1
- ofh = open output, '>'
+ ofh = open output, 'w'
unless ofh goto err_output
save_output_1:
print ofh, result
@@ -354,22 +354,14 @@ ENCODING_O_FILES = @TEMP_encoding_o@
IO_O_FILES = \
- $(IO_DIR)/io$(O) \
+ $(IO_DIR)/core$(O) \
$(IO_DIR)/api$(O) \
+ $(IO_DIR)/utf8$(O) \
$(IO_DIR)/buffer$(O) \
$(IO_DIR)/unix$(O) \
$(IO_DIR)/win32$(O) \
$(IO_DIR)/portable$(O) \
- $(SRC_DIR)/io$(O) \
- $(IO_DIR)/io_buf$(O) \
- $(IO_DIR)/io_layers$(O) \
- $(IO_DIR)/io_unix$(O) \
- $(IO_DIR)/io_utf8$(O) \
- $(IO_DIR)/io_mmap$(O) \
- $(IO_DIR)/io_win32$(O) \
- $(IO_DIR)/io_stdio$(O) \
- $(IO_DIR)/io_string$(O) \
- $(IO_DIR)/io_passdown$(O)
+ $(SRC_DIR)/io$(O)
INTERP_O_FILES = \
$(SRC_DIR)/string$(O) \
@@ -590,7 +582,6 @@ STR_FILES = \
$(SRC_DIR)/inter_cb.str \
$(SRC_DIR)/inter_create.str \
$(SRC_DIR)/inter_misc.str \
- $(SRC_DIR)/io/io.str \
$(SRC_DIR)/io/api.str \
$(SRC_DIR)/key.str \
$(SRC_DIR)/library.str \
View
@@ -250,6 +250,15 @@ resizing it without flushing would truncate the buffer.
Accessor (get only) for the I/O stream's read mode. This returns the mode
string used to open the I/O stream.
+=item C<encoding>
+
+ $S0 = $P1.encoding()
+ $P0.encoding($S1)
+
+Accessor (get and set) for the I/O stream's encoding attribute. Currently,
+the only valid value to set is 'utf8' which turns on UTF-8 reading/writing
+mode for the stream. The default behavior is fixed-width 8-bit characters.
+
=item C<get_fd> [RT #48312]
$I0 = $P1.get_fd()
View
@@ -134,7 +134,7 @@ C source tests are usually located in F<t/src/*.t>. A simple test looks like:
OUTPUT
Note that it's always a good idea to output "done" to confirm that the compiled
-code executed completely. When mixing C<printf> and C<PIO_printf> always append
+code executed completely. When mixing C<printf> and C<Parrot_io_printf> always append
a C<fflush(stdout);> after the former.
=head2 Testing Perl5 components
Oops, something went wrong.

0 comments on commit 9f9cea2

Please sign in to comment.