# HG changeset patch
# User Jeroen Demeyer <jdemeyer@cage.ugent.be>
# Date 1303287482 7200
# Node ID b8477bc38e05308185810ad611880b8b0b6db0bf
# Parent 89d2de9441e910b484fab7c2abc8550d443edbab
Define our own PariOUT for Sage
diff r 89d2de9441e9 r b8477bc38e05 sage/libs/pari/decl.pxi
a

b


1569  1569  include 'declinl.pxi' 
1570  1570  
1571  1571  
 1572  cdef extern from *: # paristio.h 
 1573  struct PariOUT: 
 1574  void (*putch)(char) 
 1575  void (*puts)(char*) 
 1576  void (*flush)() 
 1577  extern PariOUT* pariOut 
 1578  
 1579  
1572  1580  cdef extern from 'pari/paripriv.h': 
1573   struct __x: 
 1581  struct pariout_t: 
1574  1582  char format # e,f,g 
1575  1583  long fieldw # 0 (ignored) or field width 
1576  1584  long sigd # 1 (all) or number of significant digits printed */ 
1577  1585  int sp # 0 = suppress whitespace from output */ 
1578  1586  int prettyp # output style: raw, prettyprint, etc */ 
1579  1587  int TeXstyle 
1580   ctypedef __x pariout_t 
1581  1588  
1582   struct __z: 
 1589  struct gp_data: 
1583  1590  jmp_buf env 
1584  1591  pariout_t *fmt 
1585   ctypedef __z gp_data 
1586  1592  extern gp_data* GP_DATA 
1587   
1588   
1589   cdef extern: # paristio.h 
1590   ctypedef struct PariOUT: 
1591   void (*putch)(char) 
1592   void (*puts)(char*) 
1593   void (*flush)() 
diff r 89d2de9441e9 r b8477bc38e05 sage/libs/pari/gen.pyx
a

b


8739  8739  
8740  8740  # Callbacks from PARI to print stuff using sys.stdout.write() instead 
8741  8741  # of C library functions like puts(). 
8742   cdef extern: 
8743   PariOUT defaultOut 
8744   PariOUT defaultErr 
 8742  cdef PariOUT sage_pariOut 
8745  8743  
8746  8744  cdef void sage_putchar(char c): 
8747  8745  cdef char str[2] 
… 
… 

8824  8822  GP_DATA.fmt.sigd = prec_bits_to_dec(53) 
8825  8823  
8826  8824  # Set printing functions 
8827   defaultOut.putch = sage_putchar 
8828   defaultOut.puts = sage_puts 
8829   defaultOut.flush = sage_flush 
 8825  global pariOut 
 8826  pariOut = &sage_pariOut 
 8827  pariOut.putch = sage_putchar 
 8828  pariOut.puts = sage_puts 
 8829  pariOut.flush = sage_flush 
8830  8830  
8831  8831  self.PARI_ZERO = self.new_gen_noclear(gen_0) 
8832  8832  self.PARI_ONE = self.new_gen_noclear(gen_1) 