Ticket #11230: 11230_pariout.patch

File 11230_pariout.patch, 2.2 KB (added by jdemeyer, 11 years ago)
  • sage/libs/pari/decl.pxi

    # 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  
    15691569include 'declinl.pxi'
    15701570
    15711571
     1572cdef extern from *:   # paristio.h
     1573    struct PariOUT:
     1574        void (*putch)(char)
     1575        void (*puts)(char*)
     1576        void (*flush)()
     1577    extern PariOUT* pariOut
     1578
     1579
    15721580cdef extern from 'pari/paripriv.h':
    1573     struct __x:
     1581    struct pariout_t:
    15741582        char format  # e,f,g
    15751583        long fieldw  # 0 (ignored) or field width
    15761584        long sigd    # -1 (all) or number of significant digits printed */
    15771585        int sp       # 0 = suppress whitespace from output */
    15781586        int prettyp  # output style: raw, prettyprint, etc */
    15791587        int TeXstyle
    1580     ctypedef __x pariout_t
    15811588
    1582     struct __z:
     1589    struct gp_data:
    15831590        jmp_buf env
    15841591        pariout_t *fmt
    1585     ctypedef __z gp_data
    15861592    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)()
  • sage/libs/pari/gen.pyx

    diff -r 89d2de9441e9 -r b8477bc38e05 sage/libs/pari/gen.pyx
    a b  
    87398739
    87408740# Callbacks from PARI to print stuff using sys.stdout.write() instead
    87418741# of C library functions like puts().
    8742 cdef extern:
    8743     PariOUT defaultOut
    8744     PariOUT defaultErr
     8742cdef PariOUT sage_pariOut
    87458743
    87468744cdef void sage_putchar(char c):
    87478745    cdef char str[2]
     
    88248822        GP_DATA.fmt.sigd = prec_bits_to_dec(53)
    88258823
    88268824        # 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
    88308830
    88318831        self.PARI_ZERO = self.new_gen_noclear(gen_0)
    88328832        self.PARI_ONE = self.new_gen_noclear(gen_1)