Skip to content
This repository
Browse code

[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...
commit 9f9cea2592e20880e6946c17d112ecd58c9f8b6f 1 parent 5a9348e
allisonrandal allisonrandal authored

Showing 87 changed files with 2,758 additions and 9,865 deletions. Show diff stats Hide diff stats

  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
16 MANIFEST
@@ -2984,22 +2984,17 @@ src/intlist.c []
2984 2984 src/io.c []
2985 2985 src/io/api.c []
2986 2986 src/io/buffer.c []
2987   -src/io/io.c []
2988   -src/io/io_buf.c []
2989   -src/io/io_layers.c []
  2987 +src/io/core.c []
2990 2988 src/io/io_mmap.c []
2991   -src/io/io_passdown.c []
2992 2989 src/io/io_private.h []
2993   -src/io/io_stdio.c []
2994 2990 src/io/io_string.c []
2995   -src/io/io_unix.c []
2996   -src/io/io_utf8.c []
2997   -src/io/io_win32.c []
2998 2991 src/io/portable.c []
  2992 +src/io/socket_api.c []
  2993 +src/io/socket_unix.c []
  2994 +src/io/socket_win32.c []
2999 2995 src/io/unix.c []
3000   -src/io/unix_socket.c []
  2996 +src/io/utf8.c []
3001 2997 src/io/win32.c []
3002   -src/io/win32_socket.c []
3003 2998 src/jit.c []
3004 2999 src/jit.h []
3005 3000 src/jit/alpha/core.jit []
@@ -3133,7 +3128,6 @@ src/pmc/packfilerawsegment.pmc []
3133 3128 src/pmc/packfilesegment.pmc []
3134 3129 src/pmc/pair.pmc []
3135 3130 src/pmc/parrotinterpreter.pmc []
3136   -src/pmc/parrotio.pmc []
3137 3131 src/pmc/parrotlibrary.pmc []
3138 3132 src/pmc/parrotrunningthread.pmc []
3139 3133 src/pmc/parrotthread.pmc []
4 compilers/imcc/instructions.c
@@ -648,7 +648,7 @@ ins_print(PARROT_INTERP, ARGMOD(FILE *fd), ARGIN(const Instruction *ins))
648 648 int len;
649 649
650 650 #if IMC_TRACE
651   - PIO_eprintf(NULL, "ins_print\n");
  651 + Parrot_io_eprintf(NULL, "ins_print\n");
652 652 #endif
653 653
654 654 /* comments, labels and such */
@@ -811,7 +811,7 @@ e_file_emit(PARROT_INTERP,
811 811 ARGIN(const Instruction *ins))
812 812 {
813 813 #if IMC_TRACE
814   - PIO_eprintf(NULL, "e_file_emit\n");
  814 + Parrot_io_eprintf(NULL, "e_file_emit\n");
815 815 #endif
816 816 if ((ins->type & ITLABEL) || ! *ins->opname)
817 817 ins_print(interp, stdout, ins);
2  compilers/imcc/main.c
@@ -445,7 +445,7 @@ parseflags(PARROT_INTERP, int *argc, char **argv[])
445 445 exit(EX_USAGE);
446 446 break;
447 447 case OPT_RUNTIME_PREFIX:
448   - PIO_printf(interp, "%Ss\n",
  448 + Parrot_io_printf(interp, "%Ss\n",
449 449 Parrot_get_runtime_path(interp));
450 450 exit(EXIT_SUCCESS);
451 451 case 'V':
14 compilers/imcc/parser_util.c
@@ -187,7 +187,7 @@ op_fullname(ARGOUT(char *dest), ARGIN(const char *name),
187 187
188 188 #if IMC_TRACE_HIGH
189 189 char *full = dest;
190   - PIO_eprintf(NULL, "op %s", name);
  190 + Parrot_io_eprintf(NULL, "op %s", name);
191 191 #endif
192 192
193 193 strcpy(dest, name);
@@ -198,7 +198,7 @@ op_fullname(ARGOUT(char *dest), ARGIN(const char *name),
198 198 *dest++ = '_';
199 199 if (args[i]->type == VTADDRESS) {
200 200 #if IMC_TRACE_HIGH
201   - PIO_eprintf(NULL, " (address)%s", args[i]->name);
  201 + Parrot_io_eprintf(NULL, " (address)%s", args[i]->name);
202 202 #endif
203 203 *dest++ = 'i';
204 204 *dest++ = 'c';
@@ -207,7 +207,7 @@ op_fullname(ARGOUT(char *dest), ARGIN(const char *name),
207 207 /* if one ever wants num keys, they go with 'S' */
208 208 if (keyvec & KEY_BIT(i)) {
209 209 #if IMC_TRACE_HIGH
210   - PIO_eprintf(NULL, " (key)%s", args[i]->name);
  210 + Parrot_io_eprintf(NULL, " (key)%s", args[i]->name);
211 211 #endif
212 212 *dest++ = 'k';
213 213 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),
225 225
226 226 if (args[i]->type & (VTCONST|VT_CONSTP)) {
227 227 #if IMC_TRACE_HIGH
228   - PIO_eprintf(NULL, " (%cc)%s", tolower((unsigned char)args[i]->set), args[i]->name);
  228 + Parrot_io_eprintf(NULL, " (%cc)%s",
  229 + tolower((unsigned char)args[i]->set), args[i]->name);
229 230 #endif
230 231 *dest++ = 'c';
231 232 }
232 233 #if IMC_TRACE_HIGH
233 234 else
234   - PIO_eprintf(NULL, " (%c)%s", tolower((unsigned char)args[i]->set), args[i]->name);
  235 + Parrot_io_eprintf(NULL, " (%c)%s",
  236 + tolower((unsigned char)args[i]->set), args[i]->name);
235 237 #endif
236 238 }
237 239 *dest = '\0';
238 240 #if IMC_TRACE_HIGH
239   - PIO_eprintf(NULL, " -> %s\n", full);
  241 + Parrot_io_eprintf(NULL, " -> %s\n", full);
240 242 #endif
241 243 }
242 244
6 compilers/imcc/pbc.c
@@ -1923,7 +1923,7 @@ e_pbc_emit(PARROT_INTERP, SHIM(void *param), ARGIN(const IMC_Unit *unit),
1923 1923 int op, i;
1924 1924
1925 1925 #if IMC_TRACE_HIGH
1926   - PIO_eprintf(NULL, "e_pbc_emit\n");
  1926 + Parrot_io_eprintf(NULL, "e_pbc_emit\n");
1927 1927 #endif
1928 1928
1929 1929 /* first instruction, do initialisation ... */
@@ -1980,7 +1980,7 @@ e_pbc_emit(PARROT_INTERP, SHIM(void *param), ARGIN(const IMC_Unit *unit),
1980 1980 if (ins->symregs[0] && ins->symregs[0]->pcc_sub) {
1981 1981
1982 1982 #if IMC_TRACE
1983   - PIO_eprintf(NULL, "pbc.c: e_pbc_emit (pcc_sub=%s)\n",
  1983 + Parrot_io_eprintf(NULL, "pbc.c: e_pbc_emit (pcc_sub=%s)\n",
1984 1984 ins->symregs[0]->name);
1985 1985 #endif
1986 1986
@@ -2010,7 +2010,7 @@ e_pbc_emit(PARROT_INTERP, SHIM(void *param), ARGIN(const IMC_Unit *unit),
2010 2010 opcode_t last_label = 1;
2011 2011
2012 2012 #if IMC_TRACE_HIGH
2013   - PIO_eprintf(NULL, "emit_pbc: op [%d %s]\n", ins->opnum, ins->opname);
  2013 + Parrot_io_eprintf(NULL, "emit_pbc: op [%d %s]\n", ins->opnum, ins->opname);
2014 2014 #endif
2015 2015
2016 2016 if ((ins->type & ITBRANCH)
14 compilers/pct/src/PCT/HLLCompiler.pir
@@ -537,7 +537,7 @@ specifies the encoding to use for the input (e.g., "utf8").
537 537 encoding = adverbs['encoding']
538 538 if encoding == 'fixed_8' goto interactive_loop
539 539 unless encoding goto interactive_loop
540   - push stdin, encoding
  540 + stdin.'encoding'(encoding)
541 541 interactive_loop:
542 542 .local pmc code
543 543 unless stdin goto interactive_end
@@ -660,13 +660,11 @@ options are passed to the evaluator.
660 660 .local string iname
661 661 .local pmc ifh
662 662 iname = shift iter
663   - ifh = open iname, '<'
664   - unless ifh goto err_infile
665   - if encoding == 'fixed_8' goto iter_loop_1
666   - unless encoding goto iter_loop_1
667   - push ifh, encoding
  663 + ifh = new 'FileHandle'
  664 + unless encoding == 'utf8' goto iter_loop_1
  665 + ifh.'encoding'(encoding)
668 666 iter_loop_1:
669   - $S0 = ifh.'slurp'('')
  667 + $S0 = ifh.'readall'(iname)
670 668 code .= $S0
671 669 close ifh
672 670 goto iter_loop
@@ -783,7 +781,7 @@ Generic method for compilers invoked from a shell command line.
783 781 output = adverbs['output']
784 782 if output == '' goto save_output_1
785 783 if output == '-' goto save_output_1
786   - ofh = open output, '>'
  784 + ofh = open output, 'w'
787 785 unless ofh goto err_output
788 786 save_output_1:
789 787 print ofh, result
15 config/gen/makefiles/root.in
@@ -354,22 +354,14 @@ ENCODING_O_FILES = @TEMP_encoding_o@
354 354
355 355
356 356 IO_O_FILES = \
357   - $(IO_DIR)/io$(O) \
  357 + $(IO_DIR)/core$(O) \
358 358 $(IO_DIR)/api$(O) \
  359 + $(IO_DIR)/utf8$(O) \
359 360 $(IO_DIR)/buffer$(O) \
360 361 $(IO_DIR)/unix$(O) \
361 362 $(IO_DIR)/win32$(O) \
362 363 $(IO_DIR)/portable$(O) \
363   - $(SRC_DIR)/io$(O) \
364   - $(IO_DIR)/io_buf$(O) \
365   - $(IO_DIR)/io_layers$(O) \
366   - $(IO_DIR)/io_unix$(O) \
367   - $(IO_DIR)/io_utf8$(O) \
368   - $(IO_DIR)/io_mmap$(O) \
369   - $(IO_DIR)/io_win32$(O) \
370   - $(IO_DIR)/io_stdio$(O) \
371   - $(IO_DIR)/io_string$(O) \
372   - $(IO_DIR)/io_passdown$(O)
  364 + $(SRC_DIR)/io$(O)
373 365
374 366 INTERP_O_FILES = \
375 367 $(SRC_DIR)/string$(O) \
@@ -590,7 +582,6 @@ STR_FILES = \
590 582 $(SRC_DIR)/inter_cb.str \
591 583 $(SRC_DIR)/inter_create.str \
592 584 $(SRC_DIR)/inter_misc.str \
593   - $(SRC_DIR)/io/io.str \
594 585 $(SRC_DIR)/io/api.str \
595 586 $(SRC_DIR)/key.str \
596 587 $(SRC_DIR)/library.str \
9 docs/pdds/pdd22_io.pod
Source Rendered
@@ -250,6 +250,15 @@ resizing it without flushing would truncate the buffer.
250 250 Accessor (get only) for the I/O stream's read mode. This returns the mode
251 251 string used to open the I/O stream.
252 252
  253 +=item C<encoding>
  254 +
  255 + $S0 = $P1.encoding()
  256 + $P0.encoding($S1)
  257 +
  258 +Accessor (get and set) for the I/O stream's encoding attribute. Currently,
  259 +the only valid value to set is 'utf8' which turns on UTF-8 reading/writing
  260 +mode for the stream. The default behavior is fixed-width 8-bit characters.
  261 +
253 262 =item C<get_fd> [RT #48312]
254 263
255 264 $I0 = $P1.get_fd()
2  docs/tests.pod
Source Rendered
@@ -134,7 +134,7 @@ C source tests are usually located in F<t/src/*.t>. A simple test looks like:
134 134 OUTPUT
135 135
136 136 Note that it's always a good idea to output "done" to confirm that the compiled
137   -code executed completely. When mixing C<printf> and C<PIO_printf> always append
  137 +code executed completely. When mixing C<printf> and C<Parrot_io_printf> always append
138 138 a C<fflush(stdout);> after the former.
139 139
140 140 =head2 Testing Perl5 components
448 include/parrot/io.h
@@ -79,15 +79,6 @@
79 79
80 80 #define PIO_NR_OPEN 256 /* Size of an "IO handle table" */
81 81
82   -/* &gen_from_enum(iotypes.pasm) */
83   -enum {
84   - PIO_TYPE_FILE,
85   - PIO_TYPE_PIPE,
86   - PIO_TYPE_SOCKET,
87   - PIO_TYPE_MAX
88   -};
89   -/* &end_gen */
90   -
91 82 /* This is temporary until subs/code refs are done..*/
92 83 typedef void *DummyCodeRef;
93 84
@@ -110,24 +101,10 @@ typedef long PIOOFF_T;
110 101
111 102 extern PIOOFF_T piooffsetzero;
112 103
113   -typedef struct _ParrotIOLayerAPI ParrotIOLayerAPI;
114   -typedef struct _ParrotIOLayer ParrotIOLayer;
115 104 typedef struct _ParrotIOFilter ParrotIOFilter;
116 105 typedef struct _ParrotIO ParrotIO;
117 106 typedef struct _ParrotIOData ParrotIOData;
118 107
119   -struct _ParrotIOLayer {
120   - void *self; /* Instance specific data */
121   - const char *name;
122   - INTVAL flags;
123   - const ParrotIOLayerAPI *api;
124   - ParrotIOLayer *up;
125   - ParrotIOLayer *down;
126   -};
127   -
128   -#define PIO_DOWNLAYER(x) (x)->down
129   -#define PIO_UPLAYER(x) (x)->up
130   -
131 108 #ifdef _MSC_VER
132 109 /* Win32/MSVC has a deprecation warning about dup() in favor of _dup(). */
133 110 # define Parrot_dup(x) (PIOHANDLE)_dup((int)(x))
@@ -135,392 +112,27 @@ struct _ParrotIOLayer {
135 112 # define Parrot_dup(x) (PIOHANDLE)dup((int)(x))
136 113 #endif /* _MSC_VER */
137 114
138   -/* Others to come */
139   -#ifdef PIO_OS_UNIX
140   -extern ParrotIOLayer pio_unix_layer;
141   -#endif
142   -#ifdef PIO_OS_WIN32
143   -extern ParrotIOLayer pio_win32_layer;
144   -#endif
145   -#ifdef PIO_OS_STDIO
146   -extern ParrotIOLayer pio_stdio_layer;
147   -#endif
148   -extern ParrotIOLayer pio_buf_layer;
149   -extern ParrotIOLayer pio_mmap_layer;
150   -extern ParrotIOLayer pio_string_layer;
151   -
152   -
153   -
154   -
155 115 extern INTVAL pio_errno;
156 116
157   -/* HEADERIZER BEGIN: src/io/io.c */
  117 +/* io/core.c - interpreter initialization/destruction functions */
  118 +/* HEADERIZER BEGIN: src/io/core.c */
158 119 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
159 120
160 121 PARROT_EXPORT
161   -PARROT_WARN_UNUSED_RESULT
162   -PARROT_CANNOT_RETURN_NULL
163   -PMC * new_io_pmc(PARROT_INTERP, ARGIN_NULLOK(ParrotIO *io))
164   - __attribute__nonnull__(1);
165   -
166   -PARROT_EXPORT
167   -void Parrot_IOData_mark(PARROT_INTERP, ARGIN(ParrotIOData *piodata))
168   - __attribute__nonnull__(1)
169   - __attribute__nonnull__(2);
170   -
171   -PARROT_EXPORT
172   -PARROT_WARN_UNUSED_RESULT
173   -PARROT_CAN_RETURN_NULL
174   -PMC * PIO_accept(PARROT_INTERP, ARGMOD(PMC *pmc))
175   - __attribute__nonnull__(1)
176   - __attribute__nonnull__(2)
177   - FUNC_MODIFIES(*pmc);
178   -
179   -PARROT_EXPORT
180   -INTVAL PIO_base_init(SHIM_INTERP, SHIM(ParrotIOLayer *l));
181   -
182   -PARROT_EXPORT
183   -INTVAL PIO_bind(PARROT_INTERP, ARGMOD(PMC *pmc), ARGMOD(STRING *address))
184   - __attribute__nonnull__(1)
185   - __attribute__nonnull__(2)
186   - __attribute__nonnull__(3)
187   - FUNC_MODIFIES(*pmc)
188   - FUNC_MODIFIES(*address);
189   -
190   -PARROT_EXPORT
191   -INTVAL PIO_close(PARROT_INTERP, ARGMOD(PMC *pmc))
192   - __attribute__nonnull__(1)
193   - __attribute__nonnull__(2)
194   - FUNC_MODIFIES(*pmc);
195   -
196   -PARROT_EXPORT
197   -INTVAL PIO_connect(PARROT_INTERP, ARGMOD(PMC *pmc), ARGMOD(STRING *address))
198   - __attribute__nonnull__(1)
199   - __attribute__nonnull__(2)
200   - __attribute__nonnull__(3)
201   - FUNC_MODIFIES(*pmc)
202   - FUNC_MODIFIES(*address);
203   -
204   -PARROT_EXPORT
205   -void PIO_destroy(SHIM_INTERP, ARGMOD(PMC * pmc))
206   - __attribute__nonnull__(2)
207   - FUNC_MODIFIES(* pmc);
208   -
209   -PARROT_EXPORT
210   -PARROT_WARN_UNUSED_RESULT
211   -PARROT_CANNOT_RETURN_NULL
212   -PMC * PIO_dup(PARROT_INTERP, ARGIN(PMC *pmc))
213   - __attribute__nonnull__(1)
214   - __attribute__nonnull__(2);
215   -
216   -PARROT_EXPORT
217   -PARROT_WARN_UNUSED_RESULT
218   -INTVAL PIO_eof(SHIM_INTERP, ARGMOD(PMC *pmc))
219   - __attribute__nonnull__(2)
220   - FUNC_MODIFIES(*pmc);
221   -
222   -PARROT_EXPORT
223   -PARROT_IGNORABLE_RESULT
224   -INTVAL PIO_eprintf(NULLOK(PARROT_INTERP), ARGIN(const char *s), ...)
225   - __attribute__nonnull__(2);
226   -
227   -PARROT_EXPORT
228   -PARROT_WARN_UNUSED_RESULT
229   -PARROT_CANNOT_RETURN_NULL
230   -PMC * PIO_fdopen(PARROT_INTERP,
231   - ARGIN_NULLOK(ParrotIOLayer *layer),
232   - PIOHANDLE fd,
233   - ARGIN(const char *sflags))
234   - __attribute__nonnull__(1)
235   - __attribute__nonnull__(4);
236   -
237   -PARROT_EXPORT
238   -void PIO_finish(PARROT_INTERP)
239   - __attribute__nonnull__(1);
240   -
241   -PARROT_EXPORT
242   -void PIO_flush(PARROT_INTERP, ARGMOD(PMC *pmc))
243   - __attribute__nonnull__(1)
244   - __attribute__nonnull__(2)
245   - FUNC_MODIFIES(*pmc);
246   -
247   -PARROT_EXPORT
248   -INTVAL PIO_fprintf(PARROT_INTERP,
249   - ARGMOD(PMC *pmc),
250   - ARGIN(const char *s),
251   - ...)
252   - __attribute__nonnull__(1)
253   - __attribute__nonnull__(2)
254   - __attribute__nonnull__(3)
255   - FUNC_MODIFIES(*pmc);
256   -
257   -PARROT_EXPORT
258   -PARROT_WARN_UNUSED_RESULT
259   -PIOHANDLE PIO_getfd(SHIM_INTERP, ARGMOD(PMC *pmc))
260   - __attribute__nonnull__(2)
261   - FUNC_MODIFIES(*pmc);
262   -
263   -PARROT_EXPORT
264   -void PIO_init(PARROT_INTERP)
265   - __attribute__nonnull__(1);
266   -
267   -PARROT_EXPORT
268   -INTVAL PIO_init_stacks(PARROT_INTERP)
269   - __attribute__nonnull__(1);
270   -
271   -PARROT_EXPORT
272   -void PIO_internal_shutdown(PARROT_INTERP)
273   - __attribute__nonnull__(1);
274   -
275   -PARROT_EXPORT
276   -PARROT_WARN_UNUSED_RESULT
277   -INTVAL PIO_isatty(SHIM_INTERP, ARGMOD(PMC *pmc))
278   - __attribute__nonnull__(2)
279   - FUNC_MODIFIES(*pmc);
280   -
281   -PARROT_EXPORT
282   -PARROT_WARN_UNUSED_RESULT
283   -INTVAL PIO_listen(PARROT_INTERP, ARGMOD(PMC *pmc), INTVAL backlog)
284   - __attribute__nonnull__(1)
285   - __attribute__nonnull__(2)
286   - FUNC_MODIFIES(*pmc);
287   -
288   -PARROT_EXPORT
289   -PIOOFF_T PIO_make_offset(INTVAL offset);
290   -
291   -PARROT_EXPORT
292   -PARROT_WARN_UNUSED_RESULT
293   -PARROT_CANNOT_RETURN_NULL
294   -ParrotIO * PIO_new(PARROT_INTERP,
295   - NULLOK(INTVAL iotype),
296   - INTVAL flags,
297   - INTVAL mode)
298   - __attribute__nonnull__(1);
299   -
300   -PARROT_EXPORT
301   -PARROT_WARN_UNUSED_RESULT
302   -PARROT_CANNOT_RETURN_NULL
303   -PMC * PIO_open(PARROT_INTERP,
304   - ARGIN_NULLOK(ParrotIOLayer *layer),
305   - ARGIN(const char *spath),
306   - ARGIN(const char *sflags))
307   - __attribute__nonnull__(1)
308   - __attribute__nonnull__(3)
309   - __attribute__nonnull__(4);
310   -
311   -PARROT_EXPORT
312   -PARROT_WARN_UNUSED_RESULT
313   -INTVAL PIO_parse_open_flags(ARGIN_NULLOK(const char *flagstr));
314   -
315   -PARROT_EXPORT
316   -INTVAL PIO_peek(PARROT_INTERP, ARGMOD(PMC *pmc), ARGOUT(STRING **buffer))
317   - __attribute__nonnull__(1)
318   - __attribute__nonnull__(2)
319   - __attribute__nonnull__(3)
320   - FUNC_MODIFIES(*pmc)
321   - FUNC_MODIFIES(*buffer);
322   -
323   -PARROT_EXPORT
324   -INTVAL PIO_pioctl(PARROT_INTERP, ARGMOD(PMC *pmc), INTVAL cmd, INTVAL arg)
325   - __attribute__nonnull__(1)
326   - __attribute__nonnull__(2)
327   - FUNC_MODIFIES(*pmc);
328   -
329   -PARROT_EXPORT
330   -INTVAL PIO_poll(PARROT_INTERP,
331   - ARGMOD(PMC *pmc),
332   - INTVAL which,
333   - INTVAL sec,
334   - INTVAL usec)
335   - __attribute__nonnull__(1)
336   - __attribute__nonnull__(2)
337   - FUNC_MODIFIES(*pmc);
338   -
339   -PARROT_EXPORT
340   -INTVAL PIO_printf(PARROT_INTERP, ARGIN(const char *s), ...)
341   - __attribute__nonnull__(1)
342   - __attribute__nonnull__(2);
343   -
344   -PARROT_EXPORT
345   -INTVAL PIO_putps(PARROT_INTERP, ARGMOD(PMC *pmc), ARGMOD_NULLOK(STRING *s))
346   - __attribute__nonnull__(1)
347   - __attribute__nonnull__(2)
348   - FUNC_MODIFIES(*pmc);
349   -
350   -PARROT_EXPORT
351   -INTVAL PIO_puts(PARROT_INTERP, ARGMOD(PMC *pmc), ARGIN(const char *s))
352   - __attribute__nonnull__(1)
353   - __attribute__nonnull__(2)
354   - __attribute__nonnull__(3)
355   - FUNC_MODIFIES(*pmc);
356   -
357   -PARROT_EXPORT
358   -PARROT_WARN_UNUSED_RESULT
359   -INTVAL PIO_read(PARROT_INTERP,
360   - ARGMOD(PMC *pmc),
361   - ARGIN(char *buffer),
362   - size_t len)
363   - __attribute__nonnull__(1)
364   - __attribute__nonnull__(2)
365   - __attribute__nonnull__(3)
366   - FUNC_MODIFIES(*pmc);
367   -
368   -PARROT_EXPORT
369   -PARROT_WARN_UNUSED_RESULT
370   -PARROT_CANNOT_RETURN_NULL
371   -STRING * PIO_reads(PARROT_INTERP, ARGMOD(PMC *pmc), size_t len)
372   - __attribute__nonnull__(1)
373   - __attribute__nonnull__(2)
374   - FUNC_MODIFIES(*pmc);
375   -
376   -PARROT_EXPORT
377   -INTVAL PIO_recv(PARROT_INTERP, ARGMOD(PMC *pmc), ARGOUT(STRING **buf))
378   - __attribute__nonnull__(1)
379   - __attribute__nonnull__(2)
380   - __attribute__nonnull__(3)
381   - FUNC_MODIFIES(*pmc)
382   - FUNC_MODIFIES(*buf);
383   -
384   -PARROT_EXPORT
385   -PARROT_WARN_UNUSED_RESULT
386   -PIOOFF_T PIO_seek(PARROT_INTERP,
387   - ARGMOD(PMC *pmc),
388   - PIOOFF_T offset,
389   - INTVAL w)
390   - __attribute__nonnull__(1)
391   - __attribute__nonnull__(2)
392   - FUNC_MODIFIES(*pmc);
393   -
394   -PARROT_EXPORT
395   -PARROT_WARN_UNUSED_RESULT
396   -INTVAL PIO_send(PARROT_INTERP, ARGMOD(PMC *pmc), ARGMOD(STRING *buf))
397   - __attribute__nonnull__(1)
398   - __attribute__nonnull__(2)
399   - __attribute__nonnull__(3)
400   - FUNC_MODIFIES(*pmc)
401   - FUNC_MODIFIES(*buf);
402   -
403   -PARROT_EXPORT
404   -INTVAL PIO_setbuf(PARROT_INTERP, ARGMOD(PMC *pmc), size_t bufsize)
405   - __attribute__nonnull__(1)
406   - __attribute__nonnull__(2)
407   - FUNC_MODIFIES(*pmc);
408   -
409   -PARROT_EXPORT
410   -INTVAL PIO_setlinebuf(PARROT_INTERP, ARGMOD(PMC *pmc))
411   - __attribute__nonnull__(1)
412   - __attribute__nonnull__(2)
413   - FUNC_MODIFIES(*pmc);
414   -
415   -PARROT_EXPORT
416   -PARROT_WARN_UNUSED_RESULT
417   -PARROT_CANNOT_RETURN_NULL
418   -PMC * PIO_socket(PARROT_INTERP, INTVAL fam, INTVAL type, INTVAL proto)
  122 +void Parrot_io_finish(PARROT_INTERP)
419 123 __attribute__nonnull__(1);
420 124
421 125 PARROT_EXPORT
422   -PARROT_WARN_UNUSED_RESULT
423   -PARROT_CANNOT_RETURN_NULL
424   -PMC * PIO_STDERR(PARROT_INTERP)
425   - __attribute__nonnull__(1);
426   -
427   -PARROT_EXPORT
428   -PARROT_WARN_UNUSED_RESULT
429   -PARROT_CANNOT_RETURN_NULL
430   -PMC * PIO_STDIN(PARROT_INTERP)
431   - __attribute__nonnull__(1);
432   -
433   -PARROT_EXPORT
434   -PARROT_WARN_UNUSED_RESULT
435   -PARROT_CANNOT_RETURN_NULL
436   -PMC * PIO_STDOUT(PARROT_INTERP)
437   - __attribute__nonnull__(1);
438   -
439   -PARROT_EXPORT
440   -PARROT_WARN_UNUSED_RESULT
441   -PIOOFF_T PIO_tell(PARROT_INTERP, ARGMOD(PMC *pmc))
442   - __attribute__nonnull__(1)
443   - __attribute__nonnull__(2)
444   - FUNC_MODIFIES(*pmc);
445   -
446   -PARROT_EXPORT
447   -PARROT_WARN_UNUSED_RESULT
448   -INTVAL PIO_write(PARROT_INTERP,
449   - ARGMOD(PMC *pmc),
450   - ARGIN(const void *buffer),
451   - size_t len)
452   - __attribute__nonnull__(1)
453   - __attribute__nonnull__(2)
454   - __attribute__nonnull__(3)
455   - FUNC_MODIFIES(*pmc);
456   -
457   -PARROT_WARN_UNUSED_RESULT
458   -PARROT_CANNOT_RETURN_NULL
459   -STRING * PIO_make_io_string(PARROT_INTERP, ARGMOD(STRING **buf), size_t len)
460   - __attribute__nonnull__(1)
461   - __attribute__nonnull__(2)
462   - FUNC_MODIFIES(*buf);
463   -
464   -PIOOFF_T PIO_make_offset32(INTVAL hi, INTVAL lo);
465   -PIOOFF_T PIO_make_offset_pmc(PARROT_INTERP, ARGMOD(PMC *pmc))
466   - __attribute__nonnull__(1)
467   - __attribute__nonnull__(2)
468   - FUNC_MODIFIES(*pmc);
469   -
470   -/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
471   -/* HEADERIZER END: src/io/io.c */
472   -
473   -/* io_layers.c - If you add new layers, register them in init_layers() */
474   -/* HEADERIZER BEGIN: src/io/io_layers.c */
475   -/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
476   -
477   -PARROT_EXPORT
478   -void PIO_base_delete_layer(ARGMOD_NULLOK(ParrotIOLayer *layer));
479   -
480   -PARROT_EXPORT
481   -PARROT_MALLOC
482   -PARROT_CANNOT_RETURN_NULL
483   -ParrotIOLayer * PIO_base_new_layer(ARGIN_NULLOK(const ParrotIOLayer *proto));
484   -
485   -PARROT_EXPORT
486   -PARROT_IGNORABLE_RESULT
487   -PARROT_CANNOT_RETURN_NULL
488   -ParrotIOLayer * PIO_copy_stack(ARGIN_NULLOK(ParrotIOLayer *stack));
489   -
490   -PARROT_EXPORT
491   -PARROT_WARN_UNUSED_RESULT
492   -PARROT_CAN_RETURN_NULL
493   -ParrotIOLayer * PIO_get_layer(PARROT_INTERP, ARGIN(const char *name))
494   - __attribute__nonnull__(1)
495   - __attribute__nonnull__(2);
496   -
497   -PARROT_EXPORT
498   -PARROT_IGNORABLE_RESULT
499   -PARROT_CAN_RETURN_NULL
500   -ParrotIOLayer * PIO_pop_layer(PARROT_INTERP, ARGIN_NULLOK(PMC *pmc))
  126 +void Parrot_io_init(PARROT_INTERP)
501 127 __attribute__nonnull__(1);
502 128
503 129 PARROT_EXPORT
504   -INTVAL PIO_push_layer(PARROT_INTERP,
505   - ARGMOD(PMC *pmc),
506   - ARGMOD_NULLOK(ParrotIOLayer *layer))
507   - __attribute__nonnull__(1)
508   - __attribute__nonnull__(2)
509   - FUNC_MODIFIES(*pmc);
510   -
511   -PARROT_IGNORABLE_RESULT
512   -PARROT_CANNOT_RETURN_NULL
513   -STRING * PIO_pop_layer_str(PARROT_INTERP, ARGIN_NULLOK(PMC *pmc))
514   - __attribute__nonnull__(1);
515   -
516   -void PIO_push_layer_str(PARROT_INTERP,
517   - ARGIN(PMC *pmc),
518   - ARGIN_NULLOK(const STRING *ls))
  130 +void Parrot_IOData_mark(PARROT_INTERP, ARGIN(ParrotIOData *piodata))
519 131 __attribute__nonnull__(1)
520 132 __attribute__nonnull__(2);
521 133
522 134 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
523   -/* HEADERIZER END: src/io/io_layers.c */
  135 +/* HEADERIZER END: src/io/core.c */
524 136
525 137 /* io/api.c - Public API functions */
526 138 /* HEADERIZER BEGIN: src/io/api.c */
@@ -787,6 +399,31 @@ size_t Parrot_io_write_buffer(PARROT_INTERP,
787 399 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
788 400 /* HEADERIZER END: src/io/buffer.c */
789 401
  402 +/* io/utf8.c - UTF-8 functions */
  403 +/* HEADERIZER BEGIN: src/io/utf8.c */
  404 +/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
  405 +
  406 +size_t Parrot_io_read_utf8(PARROT_INTERP,
  407 + ARGMOD(PMC *filehandle),
  408 + ARGMOD(STRING **buf))
  409 + __attribute__nonnull__(1)
  410 + __attribute__nonnull__(2)
  411 + __attribute__nonnull__(3)
  412 + FUNC_MODIFIES(*filehandle)
  413 + FUNC_MODIFIES(*buf);
  414 +
  415 +size_t Parrot_io_write_utf8(PARROT_INTERP,
  416 + ARGMOD(PMC *filehandle),
  417 + ARGMOD(STRING *s))
  418 + __attribute__nonnull__(1)
  419 + __attribute__nonnull__(2)
  420 + __attribute__nonnull__(3)
  421 + FUNC_MODIFIES(*filehandle)
  422 + FUNC_MODIFIES(*s);
  423 +
  424 +/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
  425 +/* HEADERIZER END: src/io/utf8.c */
  426 +
790 427 /* io.c - utility functions shared between all platforms */
791 428 /* HEADERIZER BEGIN: src/io.c */
792 429 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
@@ -839,6 +476,15 @@ PIOHANDLE Parrot_io_get_os_handle(PARROT_INTERP, ARGIN(PMC *filehandle))
839 476
840 477 PARROT_EXPORT
841 478 PARROT_WARN_UNUSED_RESULT
  479 +INTVAL Parrot_io_is_encoding(PARROT_INTERP,
  480 + ARGIN(PMC *filehandle),
  481 + ARGIN(STRING *value))
  482 + __attribute__nonnull__(1)
  483 + __attribute__nonnull__(2)
  484 + __attribute__nonnull__(3);
  485 +
  486 +PARROT_EXPORT
  487 +PARROT_WARN_UNUSED_RESULT
842 488 INTVAL Parrot_io_parse_open_flags(PARROT_INTERP,
843 489 ARGIN_NULLOK(STRING *mode_str))
844 490 __attribute__nonnull__(1);
@@ -947,20 +593,6 @@ extern INTVAL PIO_stdio_getblksize(PIOHANDLE fd);
947 593 # define PIO_getblksize(x) PIO_stdio_getblksize(x)
948 594 #endif
949 595
950   -
951   -/*
952   - * pioctl definitions -- These are mostly for reference
953   - * or C-API writers.
954   - */
955   -/* pioctl command constants */
956   -#define PIOCTL_CMDRESERVED 0
957   -#define PIOCTL_CMDSETRECSEP 1
958   -#define PIOCTL_CMDGETRECSEP 2
959   -#define PIOCTL_CMDSETBUFTYPE 3
960   -#define PIOCTL_CMDGETBUFTYPE 4
961   -#define PIOCTL_CMDSETBUFSIZE 5
962   -#define PIOCTL_CMDGETBUFSIZE 6
963   -
964 596 /*
965 597 * pioctl argument constants. These don't have to
966 598 * be unique across io commands.
1  include/parrot/string_funcs.h
@@ -523,6 +523,7 @@ STRING * int_to_str(PARROT_INTERP,
523 523 __attribute__nonnull__(2)
524 524 FUNC_MODIFIES(*tc);
525 525
  526 +PARROT_INLINE
526 527 void string_free(PARROT_INTERP, ARGIN(STRING *s))
527 528 __attribute__nonnull__(1)
528 529 __attribute__nonnull__(2);
50 languages/WMLScript/src/wmlsstdlibs.pir
@@ -133,11 +133,12 @@ helper for CALL_URL* opcodes.
133 133
134 134 .sub 'load_script'
135 135 .param string filename
136   - .local pmc pio
  136 + .local pmc fh
137 137 .local string content
138   - pio = new 'ParrotIO'
139   - push_eh _handler
140   - content = pio.'slurp'(filename)
  138 + fh = new 'FileHandle'
  139 +# push_eh _handler
  140 + content = fh.'readall'(filename)
  141 +# pop_eh
141 142 if content goto L1
142 143 $S0 = err
143 144 print "Can't slurp '"
@@ -147,7 +148,7 @@ helper for CALL_URL* opcodes.
147 148 print ")\n"
148 149 L1:
149 150 _handler:
150   - .return (content)
  151 + .return(content)
151 152 .end
152 153
153 154 .sub 'save_pbc'
@@ -155,21 +156,23 @@ helper for CALL_URL* opcodes.
155 156 .param string filename
156 157 .local string output
157 158 .local pmc fh
  159 + fh = new 'FileHandle'
158 160 output = concat filename, '.pbc'
159   - fh = open output, '>'
160   - if fh goto L1
161   - $S0 = err
  161 + push_eh _handler
  162 + fh.'open'(output, 'w')
  163 + pop_eh
  164 + fh.'print'(pbc_out)
  165 + fh.'close'()
  166 + .return (output)
  167 + _handler:
  168 + .local pmc e
  169 + .get_results (e)
  170 + $S0 = e
162 171 print "Can't open '"
163 172 print output
164 173 print "' ("
165 174 print $S0
166 175 print ")\n"
167   - goto L2
168   - L1:
169   - print fh, pbc_out
170   - close fh
171   - L2:
172   - .return (output)
173 176 .end
174 177
175 178 .sub 'save_pir'
@@ -177,20 +180,23 @@ helper for CALL_URL* opcodes.
177 180 .param string filename
178 181 .local string output
179 182 .local pmc fh
  183 + fh = new 'FileHandle'
180 184 output = concat filename, '.pir'
181   - fh = open output, '>'
182   - if fh goto L1
183   - $S0 = err
  185 + push_eh _handler
  186 + fh.'open'(output, 'w')
  187 + pop_eh
  188 + fh.'print'(gen_pir)
  189 + fh.'close'()
  190 + .return ()
  191 + _handler:
  192 + .local pmc e
  193 + .get_results (e)
  194 + $S0 = e
184 195 print "Can't open '"
185 196 print output
186 197 print "' ("
187 198 print $S0
188 199 print ")\n"
189   - goto L2
190   - L1:
191   - print fh, gen_pir
192   - close fh
193   - L2:
194 200 .end
195 201
196 202 =back
6 languages/lua/luac2pir.pir
@@ -62,11 +62,11 @@ Francois Perrad.
62 62
63 63 .sub 'load_file' :anon
64 64 .param string filename
65   - .local pmc pio
  65 + .local pmc fh
66 66 .local string content
67   - pio = new 'ParrotIO'
  67 + fh = new 'FileHandle'
68 68 push_eh _handler
69   - content = pio.'slurp'(filename)
  69 + content = fh.'readall'(filename)
70 70 pop_eh
71 71 if content goto L1
72 72 $S0 = err
6 languages/lua/luad.pir
@@ -65,11 +65,11 @@ Francois Perrad.
65 65
66 66 .sub 'load_file'
67 67 .param string filename
68   - .local pmc pio
  68 + .local pmc fh
69 69 .local string content
70   - pio = new 'ParrotIO'
  70 + fh = new 'FileHandle'
71 71 push_eh _handler
72   - content = pio.'slurp'(filename)
  72 + content = fh.'readall'(filename)
73 73 pop_eh
74 74 if content goto L1
75 75 $S0 = err
2  languages/lua/src/lib/luaaux.pir
@@ -654,7 +654,7 @@ This function only loads the chunk; it does not run it.
654 654 f = open filename, '<'
655 655 unless f goto L3
656 656 L2:
657   - $S0 = f.'slurp'('')
  657 + $S0 = f.'readall'()
658 658 if filename == '' goto L4
659 659 close f
660 660 L4:
4 languages/lua/src/lib/luaperl.pir
@@ -75,7 +75,7 @@ It's a temporary work. Waiting for the real PIR compiler/interpreter.
75 75 .local string content
76 76 pio = new 'ParrotIO'
77 77 push_eh _handler
78   - content = pio.'slurp'(filename)
  78 + content = pio.'readall'(filename)
79 79 pop_eh
80 80 if content goto L1
81 81 $S0 = err
@@ -108,7 +108,7 @@ It's a temporary work. Waiting for the real PIR compiler/interpreter.
108 108 pir = load_script($S1)
109 109 if pir goto L1
110 110 $P0 = new 'ParrotIO'
111   - $S0 = $P0.'slurp'(out)
  111 + $S0 = $P0.'readall'(out)
112 112 unlink(out) # cleaning up the temporary file
113 113 die $S0
114 114 L1:
4 languages/perl6/src/classes/Object.pir
@@ -509,7 +509,7 @@ method, and returns undef if there are none.
509 509 # Get all possible methods.
510 510 .local pmc methods
511 511 methods = self.'!MANY_DISPATCH_HELPER'(method_name, pos_args, named_args)
512   -
  512 +
513 513 # Do we have any?
514 514 $I0 = elements methods
515 515 if $I0 goto invoke
@@ -619,7 +619,7 @@ the basis of WALK also. It returns all methods we could possible call.
619 619 # If we're here, found a method. But is it a multi?
620 620 $I0 = isa cur_meth, "Perl6MultiSub"
621 621 if $I0 goto multi_dispatch
622   -
  622 +
623 623 # Single dispatch - add to the result list.
624 624 push result_list, cur_meth
625 625 goto mro_loop
124 src/debug.c
@@ -1116,7 +1116,7 @@ PDB_get_command(PARROT_INTERP)
1116 1116
1117 1117 c = pdb->cur_command;
1118 1118
1119   - PIO_eprintf(pdb->debugger, "\n(pdb) ");
  1119 + Parrot_io_eprintf(pdb->debugger, "\n(pdb) ");
1120 1120
1121 1121 /* skip leading whitespace */
1122 1122 do {
@@ -1212,11 +1212,11 @@ PDB_run_command(PARROT_INTERP, ARGIN(const char *command))
1212 1212 return 0;
1213 1213 }
1214 1214 else {
1215   - PIO_eprintf(pdb->debugger,
  1215 + Parrot_io_eprintf(pdb->debugger,
1216 1216 "Undefined command: \"%s\"", command);
1217 1217 if (pdb->script_file)
1218   - PIO_eprintf(pdb->debugger, " in line %lu", pdb->script_line);
1219   - PIO_eprintf(pdb->debugger, ". Try \"help\".");
  1218 + Parrot_io_eprintf(pdb->debugger, " in line %lu", pdb->script_line);
  1219 + Parrot_io_eprintf(pdb->debugger, ". Try \"help\".");
1220 1220 #if TRACE_DEBUGGER
1221 1221 fprintf(stderr, " (parse_command result: %li)", c);
1222 1222 #endif
@@ -1391,7 +1391,7 @@ PDB_cond(PARROT_INTERP, ARGIN(const char *command))
1391 1391
1392 1392 /* Return if no more arguments */
1393 1393 if (!(command && *command)) {
1394   - PIO_eprintf(interp->pdb->debugger, "No condition specified\n");
  1394 + Parrot_io_eprintf(interp->pdb->debugger, "No condition specified\n");
1395 1395 return NULL;
1396 1396 }
1397 1397
@@ -1406,7 +1406,7 @@ PDB_cond(PARROT_INTERP, ARGIN(const char *command))
1406 1406 auxcmd = ++command;
1407 1407 regleft = (unsigned char)get_uint(&command, 0);
1408 1408 if (auxcmd == command) {
1409   - PIO_eprintf(interp->pdb->debugger, "Invalid register\n");
  1409 + Parrot_io_eprintf(interp->pdb->debugger, "Invalid register\n");
1410 1410 return NULL;
1411 1411 }
1412 1412
@@ -1439,13 +1439,13 @@ PDB_cond(PARROT_INTERP, ARGIN(const char *command))
1439 1439 break;
1440 1440 case '\0':
1441 1441 if (cond_argleft != PDB_cond_str && cond_argleft != PDB_cond_pmc) {
1442   - PIO_eprintf(interp->pdb->debugger, "Invalid null condition\n");
  1442 + Parrot_io_eprintf(interp->pdb->debugger, "Invalid null condition\n");
1443 1443 return NULL;
1444 1444 }
1445 1445 cond_type = PDB_cond_notnull;
1446 1446 break;
1447 1447 default:
1448   -INV_COND: PIO_eprintf(interp->pdb->debugger, "Invalid condition\n");
  1448 +INV_COND: Parrot_io_eprintf(interp->pdb->debugger, "Invalid condition\n");
1449 1449 return NULL;
1450 1450 }
1451 1451
@@ -1459,7 +1459,7 @@ INV_COND: PIO_eprintf(interp->pdb->debugger, "Invalid condition\n");
1459 1459
1460 1460 /* return if no notnull condition and no more arguments */
1461 1461 if (!(command && *command) && (cond_type != PDB_cond_notnull)) {
1462   - PIO_eprintf(interp->pdb->debugger, "Can't compare a register with nothing\n");
  1462 + Parrot_io_eprintf(interp->pdb->debugger, "Can't compare a register with nothing\n");
1463 1463 return NULL;
1464 1464 }
1465 1465
@@ -1476,7 +1476,7 @@ INV_COND: PIO_eprintf(interp->pdb->debugger, "Invalid condition\n");
1476 1476 unsigned short cond_argright = condition_regtype(command);
1477 1477
1478 1478 if (cond_argright != cond_argleft) {
1479   - PIO_eprintf(interp->pdb->debugger, "Register types don't agree\n");
  1479 + Parrot_io_eprintf(interp->pdb->debugger, "Register types don't agree\n");
1480 1480 mem_sys_free(condition);
1481 1481 return NULL;
1482 1482 }
@@ -1485,13 +1485,13 @@ INV_COND: PIO_eprintf(interp->pdb->debugger, "Invalid condition\n");
1485 1485 auxcmd = ++command;
1486 1486 reg_number = (int)get_uint(&command, 0);
1487 1487 if (auxcmd == command) {
1488   - PIO_eprintf(interp->pdb->debugger, "Invalid register\n");
  1488 + Parrot_io_eprintf(interp->pdb->debugger, "Invalid register\n");
1489 1489 mem_sys_free(condition);
1490 1490 return NULL;
1491 1491 }
1492 1492
1493 1493 if (reg_number < 0) {
1494   - PIO_eprintf(interp->pdb->debugger, "Out-of-bounds register\n");
  1494 + Parrot_io_eprintf(interp->pdb->debugger, "Out-of-bounds register\n");
1495 1495 mem_sys_free(condition);
1496 1496 return NULL;
1497 1497 }
@@ -1526,7 +1526,7 @@ INV_COND: PIO_eprintf(interp->pdb->debugger, "Invalid condition\n");
1526 1526 else if (condition->type & PDB_cond_pmc) {
1527 1527 /* RT #46123 Need to figure out what to do in this case.
1528 1528 * For the time being, we just bail. */
1529   - PIO_eprintf(interp->pdb->debugger, "Can't compare PMC with constant\n");
  1529 + Parrot_io_eprintf(interp->pdb->debugger, "Can't compare PMC with constant\n");
1530 1530 mem_sys_free(condition);
1531 1531 return NULL;
1532 1532 }
@@ -1602,7 +1602,7 @@ PDB_set_break(PARROT_INTERP, ARGIN_NULLOK(const char *command))
1602 1602
1603 1603 /* Abort if the line number provided doesn't exist */
1604 1604 if (!line->next) {
1605   - PIO_eprintf(pdb->debugger,
  1605 + Parrot_io_eprintf(pdb->debugger,
1606 1606 "Can't set a breakpoint at line number %li\n", ln);
1607 1607 return;
1608 1608 }
@@ -1614,7 +1614,7 @@ PDB_set_break(PARROT_INTERP, ARGIN_NULLOK(const char *command))
1614 1614 while (line->opcode != pdb->cur_opcode) {
1615 1615 line = line->next;
1616 1616 if (!line) {
1617   - PIO_eprintf(pdb->debugger,
  1617 + Parrot_io_eprintf(pdb->debugger,
1618 1618 "No current line found and no line number specified\n");
1619 1619 return;
1620 1620 }
@@ -1625,7 +1625,7 @@ PDB_set_break(PARROT_INTERP, ARGIN_NULLOK(const char *command))
1625 1625 line = line->next;
1626 1626 /* Abort if the line number provided doesn't exist */
1627 1627 if (!line) {
1628   - PIO_eprintf(pdb->debugger,
  1628 + Parrot_io_eprintf(pdb->debugger,
1629 1629 "Can't set a breakpoint at line number %li\n", ln);
1630 1630 return;
1631 1631 }
@@ -1679,10 +1679,10 @@ PDB_set_break(PARROT_INTERP, ARGIN_NULLOK(const char *command))
1679 1679
1680 1680 /* Show breakpoint position */
1681 1681
1682   - PIO_eprintf(pdb->debugger, "Breakpoint %li at", newbreak->id);
  1682 + Parrot_io_eprintf(pdb->debugger, "Breakpoint %li at", newbreak->id);
1683 1683 if (line)
1684   - PIO_eprintf(pdb->debugger, " line %li", line->number);
1685   - PIO_eprintf(pdb->debugger, " pos %li\n", newbreak->pc - interp->code->base.data);
  1684 + Parrot_io_eprintf(pdb->debugger, " line %li", line->number);
  1685 + Parrot_io_eprintf(pdb->debugger, " pos %li\n", newbreak->pc - interp->code->base.data);
1686 1686 }
1687 1687
1688 1688 /*
@@ -1702,7 +1702,7 @@ PDB_init(PARROT_INTERP, SHIM(const char *command))
1702 1702
1703 1703 /* Restart if we are already running */
1704 1704 if (pdb->state & PDB_RUNNING)
1705   - PIO_eprintf(pdb->debugger, "Restarting\n");
  1705 + Parrot_io_eprintf(pdb->debugger, "Restarting\n");
1706 1706
1707 1707 /* Add the RUNNING state */
1708 1708 pdb->state |= PDB_RUNNING;
@@ -1733,7 +1733,7 @@ PDB_continue(PARROT_INTERP, ARGIN_NULLOK(const char *command))
1733 1733
1734 1734 if (ln != 0) {
1735 1735 if (!pdb->breakpoint) {
1736   - PIO_eprintf(pdb->debugger, "No breakpoints to skip\n");
  1736 + Parrot_io_eprintf(pdb->debugger, "No breakpoints to skip\n");
1737 1737 return;
1738 1738 }
1739 1739
@@ -1789,7 +1789,7 @@ PDB_find_breakpoint(PARROT_INTERP, ARGIN(const char *command))
1789 1789 breakpoint = breakpoint->next;
1790 1790
1791 1791 if (!breakpoint) {
1792   - PIO_eprintf(interp->pdb->debugger, "No breakpoint number %ld", n);
  1792 + Parrot_io_eprintf(interp->pdb->debugger, "No breakpoint number %ld", n);
1793 1793 return NULL;
1794 1794 }
1795 1795
@@ -1798,9 +1798,9 @@ PDB_find_breakpoint(PARROT_INTERP, ARGIN(const char *command))
1798 1798 else {
1799 1799 /* Report an appropriate error */
1800 1800 if (*command)
1801   - PIO_eprintf(interp->pdb->debugger, "Not a valid breakpoint");
  1801 + Parrot_io_eprintf(interp->pdb->debugger, "Not a valid breakpoint");
1802 1802 else
1803   - PIO_eprintf(interp->pdb->debugger, "No breakpoint specified");
  1803 + Parrot_io_eprintf(interp->pdb->debugger, "No breakpoint specified");
1804 1804
1805 1805 return NULL;
1806 1806 }
@@ -1967,7 +1967,7 @@ PDB_program_end(PARROT_INTERP)
1967 1967 /* Remove the RUNNING state */