cvsuser     04/07/16 05:50:25

  Modified:    config/gen/makefiles root.in
               ops      python.ops
  Log:
  Togos first patch EVAR - python print ops; - fixed #30711
  
  Courtesy of Togos <[EMAIL PROTECTED]>
  
  ---
  Fixed # 30711
  
  Revision  Changes    Path
  1.228     +3 -3      parrot/config/gen/makefiles/root.in
  
  Index: root.in
  ===================================================================
  RCS file: /cvs/public/parrot/config/gen/makefiles/root.in,v
  retrieving revision 1.227
  retrieving revision 1.228
  diff -u -w -r1.227 -r1.228
  --- root.in   11 Jul 2004 19:05:22 -0000      1.227
  +++ root.in   16 Jul 2004 12:50:22 -0000      1.228
  @@ -1,4 +1,4 @@
  -# $Id: root.in,v 1.227 2004/07/11 19:05:22 nicholas Exp $
  +# $Id: root.in,v 1.228 2004/07/16 12:50:22 leo Exp $
   
   ###############################################################################
   #
  @@ -300,6 +300,7 @@
       $(SRC)/mmd$(O) \
       $(SRC)/mmd_fallback$(O) \
       $(SRC)/extend$(O) \
  +    $(SRC)/py_func$(O)  \
       $(PF)/pf_items$(O) \
       $(OPS)/core_ops$(O) \
       $(OPS)/core_ops_prederef$(O) \
  @@ -312,7 +313,6 @@
   O_FILES = \
       $(INTERP_O_FILES) \
       $(IO_O_FILES) $(CLASS_O_FILES) \
  -    $(SRC)/py_func$(O)  \
       $(ENCODING_O_FILES) \
       $(IMCC_O_FILES)
   
  @@ -781,7 +781,7 @@
   $(SRC)/inter_run$(O) : $(SRC)/inter_run.c $(GENERAL_H_FILES)
   
   $(SRC)/py_func$(O) : $(SRC)/inter_cb.c $(GENERAL_H_FILES) \
  -    $(SRC)/py_func.str
  +    $(SRC)/py_func.str classes/pmc_default.h
   
   io/io$(O) : $(GENERAL_H_FILES) io/io_private.h
   
  
  
  
  1.4       +74 -0     parrot/ops/python.ops
  
  Index: python.ops
  ===================================================================
  RCS file: /cvs/public/parrot/ops/python.ops,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -w -r1.3 -r1.4
  --- python.ops        12 Jul 2004 13:10:18 -0000      1.3
  +++ python.ops        16 Jul 2004 12:50:25 -0000      1.4
  @@ -103,6 +103,80 @@
     goto NEXT();
   }
   
  +=item B<print_item>(in PMC, in INT)
  +
  +=item B<print_item>(in PMC, in NUM)
  +
  +=item B<print_item>(in PMC, in PMC)
  +
  +=item B<print_item>(in PMC, in STR)
  +
  +Print $2 to IO stream object $1. If another C<print_item> follows, a
  +space is inserted.
  +
  +=item B<print_newline>(in PMC)
  +
  +Print a newline char to IO stream object $1.
  +
  +=cut
  +
  +inline op print_item(in PMC, in INT) :base_io {
  +  PMC *io = $1;
  +  if (PIO_softspace(interpreter, io, 0))
  +    PIO_puts(interpreter, io, " ");
  +  PIO_fprintf(interpreter, io, INTVAL_FMT, (INTVAL)$2);
  +  PIO_softspace(interpreter, io, 1);
  +  goto NEXT();
  +}
  +
  +inline op print_item(in PMC, in NUM) :base_io {
  +  PMC *io = $1;
  +  STRING *s;
  +  if (PIO_softspace(interpreter, io, 0))
  +    PIO_puts(interpreter, io, " ");
  +  s = Parrot_sprintf_c(interpreter, "%.12g", (double)$2);
  +  PIO_putps(interpreter, io, s);
  +  if (string_str_index(interpreter, s,
  +     const_string(interpreter, "."), 0) == -1 &&
  +      string_str_index(interpreter, s,
  +     const_string(interpreter, "e"), 0) == -1)
  +    PIO_puts(interpreter, io, ".0");
  +  PIO_softspace(interpreter, io, 1);
  +  goto NEXT();
  +}
  +
  +op print_item(in PMC, in STR) :base_io {
  +  STRING *s = $2;
  +  PMC *io = $1;
  +  if (s && string_length(interpreter, s)) {
  +    if (PIO_softspace(interpreter, io, 0))
  +      PIO_puts(interpreter, io, " ");
  +    PIO_putps(interpreter, io, s);
  +    PIO_softspace(interpreter, io, 1);
  +  }
  +  goto NEXT();
  +}
  +
  +op print_item(in PMC, in PMC) :base_io {
  +  PMC *p = $2;
  +  PMC *io = $1;
  +  STRING *s = (VTABLE_get_string(interpreter, p));
  +  if (s) {
  +    if (PIO_softspace(interpreter, io, 0))
  +      PIO_puts(interpreter, io, " ");
  +    PIO_putps(interpreter, io, s);
  +    PIO_softspace(interpreter, io, 1);
  +  }
  +  goto NEXT();
  +}
  +
  +op print_newline(in PMC) :base_io {
  +  PMC *io = $1;
  +  PIO_puts(interpreter, io, "\n");
  +  PIO_softspace(interpreter, io, 0);
  +  goto NEXT();
  +}
  +
   ########################################
   
   =back
  
  
  

Reply via email to