Ticket #11321: trac_11321-reviewer_part2-support_older_PARI-improve_doc.spkg.patch

File trac_11321-reviewer_part2-support_older_PARI-improve_doc.spkg.patch, 5.2 KB (added by leif, 10 years ago)

SPKG patch. Makes this spkg also work with older PARI versions (prior to 2.4.4), adds some notes to SPKG.txt. Apply on top of "part_1".

  • SPKG.txt

    # HG changeset patch
    # User Leif Leonhardy <not.really@online.de>
    # Date 1311999991 -7200
    # Node ID b258663f3102a1d2ddf07a8c3b4d2db74cb33036
    # Parent  883a63fad1e40bb2e765c78195b79bbb034f4fc2
    #11321 2nd reviewer patch to 1.23.p8: Change a patch to work with PARI <2.4.4 as well; improve documentation.
    
    diff -r 883a63fad1e4 -r b258663f3102 SPKG.txt
    a b  
    3030
    3131== Special Update/Build Instructions ==
    3232
    33  * There is some garbage in the upstream sources:
     33 * There is some garbage in the upstream sources which should be removed:
    3434     src/include/.Lexplicit_formula.h.swp
    3535     src/include/.Lvalue.h.swp
    3636     src/include/._.DS_Store
     
    4444     src/src/.Lcommandline.ggo.swp
    4545     src/src/libLfunction.a
    4646 * Make sure the patches still apply cleanly.
     47 * We (and apparently also upstream) currently don't build Lcalc's tests
     48   (see Makefile), hence there's no spkg-check.
     49   This might change in newer upstream versions.
    4750 * TODO / FIXME:
    4851   The (upstream) Makefile uses $(CC) to compile C++ (also using $(CCFLAGS)),
    4952   which it defines to 'g++', and hardcodes 'g++' when linking the shared
     
    7073   - use $(MAKE) instead of 'make' in the crude build receipts,
    7174   - use CXXFLAG64 when linking the shared library.
    7275 * pari-2.4.4.patch:
    73    Use allocatemem() instead of allocatemoremem() which the new PARI no
    74    longer supports. (The former isn't supported by older versions of PARI
    75    though; cf. #11321.)
     76   (Patches src/src/Lcommandline.cc and src/src/Lcommandline_elliptic.cc.)
     77   Use allocatemem() instead of allocatemoremem() if PARI version >= 2.4.4
     78   because the newer PARI versions no longer support the latter.
     79   (The former function isn't supported by older versions of PARI though,
     80   therefore we use conditional compilation for that; cf. #11321.)
     81   The part which patches Lcommandline_elliptic.cc does not really depend on
     82   the PARI version 2.4.4; it was introduced by #9592 when we upgraded PARI
     83   to 2.4.3 [svn-12577], see also #9343.
     84   (That part of the patch replaces lgeti() by (long)cgeti().)
    7685 * time.h.patch:
     86   (Patches src/include/Lcommandline_numbertheory.h.)
    7787   Include also <time.h> in Lcommandline_numbertheory.h (at least required
    7888   on Cygwin, cf. #9845).
    7989   This should get reported upstream.
  • patches/pari-2.4.4.patch

    diff -r 883a63fad1e4 -r b258663f3102 patches/pari-2.4.4.patch
    a b  
    1 --- src/src/Lcommandline.cc     2010-01-31 16:16:45.000000000 +0100
    2 +++ src/src/Lcommandline.cc     2011-05-10 17:22:10.000000000 +0200
     1--- src/src/Lcommandline.cc     2009-02-25 08:32:44.000000000 +0100
     2+++ patches/Lcommandline.cc     2011-07-30 04:14:38.000000000 +0200
    33@@ -31,6 +31,12 @@
    44 #include "Lcommandline.h"
    55 #include "cmdline.h"
    66 
    77+/* No-operation error recovery routine for PARI.  This is needed for
    8 + * allocatemem(), which calls the error recovery routine (because
    9 + * allocatemem() destroys the PARI stack).
     8+ * PARI >=2.4.4's allocatemem(), which calls the error recovery routine
     9+ * (because allocatemem() destroys the PARI stack).
    1010+ */
    1111+void pari_err_recover_nop(long errnum) {return;}
    1212+
    1313 int main (int argc, char *argv[])
    1414 {
    1515 
    16 @@ -473,7 +479,13 @@
     16@@ -473,7 +479,31 @@
    1717 
    1818 #ifdef INCLUDE_PARI
    1919         if(do_elliptic_curve){
    20 -             allocatemoremem((int) N_terms*16+1000000); //XXXXXXXXX this should depend on whether we're double or long double or mpfr double
    21 +             /* allocatemem() calls the callback function cb_pari_err_recover(),
    22 +              * which we temporarily change to do nothing. */
     20+
     21+#if    !defined(PARI_VERSION_CODE) || !defined(PARI_VERSION)
     22+#error "PARI_VERSION() and/or PARI_VERSION_CODE not defined. \
     23+(These should come from paricfg.h, included by pari.h.)"
     24+#endif
     25+
     26+#if    PARI_VERSION_CODE >= PARI_VERSION(2,4,4)
     27+
     28+             /* PARI >= 2.4.4 no longer supports allocatemoremem(),
     29+              * but provides allocatemem() instead.
     30+              *
     31+              * allocatemem() calls the callback function cb_pari_err_recover(),
     32+              * which we temporarily change to do nothing.
     33+              */
    2334+             void (*saved_err_recover)(long) = cb_pari_err_recover;
    2435+             cb_pari_err_recover = pari_err_recover_nop;
    2536+             allocatemem(N_terms*16 + 1000000); //XXXXXXXXX this should depend on whether we're double or long double or mpfr double
    2637+             cb_pari_err_recover = saved_err_recover;
    2738+
     39+#else  // PARI version < 2.4.4
     40+
     41              allocatemoremem((int) N_terms*16+1000000); //XXXXXXXXX this should depend on whether we're double or long double or mpfr double
     42+
     43+#endif
     44+
    2845              if (my_verbose>0) cout << "Will precompute " << N_terms << " elliptic L-function dirichlet coefficients..." << endl;
    2946              initialize_new_L(a1,a2,a3,a4,a6,N_terms);
    3047         }
    31 --- src/src/Lcommandline_elliptic.cc    2010-01-31 16:16:45.000000000 +0100
    32 +++ src/src/Lcommandline_elliptic.cc    2011-05-10 17:08:10.000000000 +0200
     48--- src/src/Lcommandline_elliptic.cc    2008-09-17 05:41:06.000000000 +0200
     49+++ patches/Lcommandline_elliptic.cc    2011-07-30 04:18:12.000000000 +0200
    3350@@ -121,11 +121,11 @@
    3451 
    3552