Ticket #9343: pari_spkg.patch
| File pari_spkg.patch, 154.7 KB (added by jdemeyer, 21 months ago) |
|---|
-
.hgignore
diff -r 1a3489aa9dd5 .hgignore
a b 1 1 src/ 2 patches/files -
SPKG.txt
diff -r 1a3489aa9dd5 SPKG.txt
a b 21 21 GPL 22 22 23 23 == SPKG Maintainers == 24 * Robert Bradshaw 24 25 * Craig Citro 25 26 * William Stein 26 27 * David Kirkby 28 * Jeroen Demeyer 27 29 28 30 == Upstream Contact == 29 31 * Karim Belabas, http://www.math.u-bordeaux.fr/~belabas/ 30 32 * pari-dev@list.cr.yp.to 31 33 32 34 == Dependencies == 33 * gmp 35 * MPIR (in place of GMP) 36 * Readline 37 * Termcap 34 38 35 39 == Build Notes == 36 40 37 Here is how to build a new version of the PARI SAGE spkg: 41 Most of the building of a new version of the PARI spkg is automated 42 in the script spkg-make. Normally, the following should work. In case 43 of doubt, have a look at the file spkg-make. 38 44 39 1) Get the latest stable source code from 40 http://pari.math.u-bordeaux.fr/download.html 41 (NOTE -- just like last time, at some point the devel version will be 42 the way to go, since that's where all the bug fixes are. 43 The PARI stable/devel model is complicated.) 45 0) Edit the line "svn update -r 12577" in spkg-make and set the 46 desired SVN version. 44 47 45 2) Extract the above code and make it the directory src in the 46 current directory. 48 1) ./spkg-make 49 This will download the SVN sources to the directory parisvn/ 50 and will also download galdata.tgz and ellsea-small.tgz. 51 Then, a src/ directory will be created and the patches in 52 patches/*.patch will be applied (with the patched files stored 53 in patches/files). 54 WARNING: This script will remove any existing src/ and 55 patches/files/ directories. 56 NOTES: The script ./spkg-make will actually compile PARI/GP, but 57 the compiled files are not used for the spkg. We only need a few 58 files, in particular those created by bison. 59 Running spkg-make should be done on a reasonably standard machine 60 on which PARI/GP compiles out of the box. 47 61 48 3) Type ./spkg-dist in the above directory. 62 2) Check that everything is okay somehow. In particular, look at 63 patches/README.txt 49 64 50 4) Extract the file galdata.tgz from 51 http://pari.math.u-bordeaux.fr/download.html 52 in the directory pari-*/src/ 65 3) rm -rf parisvn 66 The directory parisvn is a temporary SVN copy of the PARI sources. 67 When making this package just for testing, you can keep the parisvn 68 directory. However, it should not be there in a final version. 69 70 4) cd ..; sage -pkg pari-version-name 53 71 54 72 Note from David Kirkby that could be relevant to building on Solaris: 55 73 … … 65 83 66 84 == Changelog == 67 85 68 === pari-2.3.5.p1 (Mike Hansen, May 25th 2010) === 86 === pari-2.4.3.svn-12577.p4 (Jeroen Demeyer, August 22, 2010) === 87 * Change "test -e" to "test -f" for Solaris. 88 * Configure using "#!/usr/bin/env bash" instead of "#!/bin/sh" 89 90 === pari-2.4.3.svn-12577.p3 (Jeroen Demeyer, August 21, 2010) === 91 * Cosmetic changes 92 93 === pari-2.4.3.svn-12577.p2 (Jeroen Demeyer, August 17, 2010) === 94 * Patch get_dlcflags on Darwin 95 96 === pari-2.4.3.svn-12577 (Jeroen Demeyer, August 5, 2010) === 97 98 === pari-2.4.3.svn-12546 (Jeroen Demeyer, July 25, 2010) === 99 * Removed the non-existent get_dlld patching. 100 * Cleaned up patches/README.txt 101 102 === pari-2.4.3.svn.p7 (Jeroen Demeyer, July 23, 2010) === 103 * pari 2.4.3 version svn 12543 104 * Remove patches for get_cc, get_dlcflags, get_kernel, get_dlld 105 106 === pari-2.4.3.svn.p6 (Jeroen Demeyer, July 22, 2010) === 107 * pari 2.4.3 version svn 12541 108 * Added spkg-make script to automate building of this spkg 109 * Changed patch logic in spkg-install 110 * Add patches for PARI bug 1079 111 112 === pari-2.4.3.svn.p5 (John Cremona July 13, 2010) === 113 * pari 2.4.3 version svn 12541 114 * adds spkg-check by David Kirkby 115 116 === pari-2.4.3.svn.p1, p2, p3, p4 (Robert Bradshaw and William Stein, 117 June 26, 2010; John Cremona July 13, 2010) === 118 * Major new version 119 * p4 contains pari 2.4.3 version svn 12534 120 121 === pari-2.3.5.p1 (Mike Hansen, May 25th, 2010) === 69 122 * Do the same fix for Cygwin that we do on Solaris. 70 123 71 124 === pari-2.3.5.p0 (Georg S. Weber, May 2nd, 2010 === -
new file patches/1079_part1.patch
diff -r 1a3489aa9dd5 patches/1079_part1.patch
- + 1 --- src/basemath/base2.c 2 +++ src/basemath/base2.c 3 @@ -3344,10 +3344,7 @@ polcompositum0(GEN A, GEN B, long flall) 4 for (i=1; i<l; i++) 5 { /* invmod possibly very costly */ 6 GEN D = gel(C,i), invH1 = QXQ_inv(H1, D); 7 - if (typ(H0) == t_POL) 8 - a = RgXQ_mul(RgX_neg(H0), invH1, D); 9 - else /* scalar */ 10 - a = RgX_Rg_mul(invH1, gneg(H0)); 11 + a = RgXQ_mul(RgX_neg(H0), invH1, D); 12 b = gadd(pol_x(v), gmulsg(k,a)); 13 gel(C,i) = mkvec4(D, mkpolmod(a,D), mkpolmod(b,D), stoi(-k)); 14 } -
new file patches/1079_part2.patch
diff -r 1a3489aa9dd5 patches/1079_part2.patch
- + 1 --- src/basemath/polarit3.c 2 +++ src/basemath/polarit3.c 3 @@ -2536,6 +2536,8 @@ END: 4 if (plambda) *plambda = lambda; 5 if (LERS) 6 { 7 + if (typ(H0)==t_INT) H0 = scalarpol(H0,vY); 8 + if (typ(H1)==t_INT) H1 = scalarpol(H1,vY); 9 *LERS = mkvec2(H0,H1); 10 gerepileall(av, 2, &H, LERS); 11 return H; -
new file patches/Configure.patch
diff -r 1a3489aa9dd5 patches/Configure.patch
- + 1 Index: Configure 2 =================================================================== 3 --- Configure (revision 12583) 4 +++ Configure (working copy) 5 @@ -1,4 +1,4 @@ 6 -#! /bin/sh 7 +#!/usr/bin/env bash 8 # 9 # This file is part of the PARI/GP package. 10 # -
new file patches/Makefile.SH.patch
diff -r 1a3489aa9dd5 patches/Makefile.SH.patch
- + 1 Index: config/Makefile.SH 2 =================================================================== 3 --- config/Makefile.SH (revision 12583) 4 +++ config/Makefile.SH (working copy) 5 @@ -599,9 +599,9 @@ 6 EOT 7 fi 8 9 -if test -e $TOP/.svn/entries; then 10 +if test -f "$TOP/.svn/entries"; then 11 vcfile="../.svn/entries" 12 -else if test -e $TOP/.git/index; then 13 +else if test -f "$TOP/.git/index"; then 14 vcfile="../.git/index" 15 fi 16 fi -
new file patches/README.txt
diff -r 1a3489aa9dd5 patches/README.txt
- + 1 Details of which source files are patched in spkg-install, and why. 2 See below for information on files which used to be patched but are no 3 longer (do not delete that!) 4 5 ====================================================================== 6 Files patched as of pari-2.4.3.svn-12577.p4: 7 ====================================================================== 8 9 Configuration files: 10 * Configure: use "#!/usr/bin/env bash" instead of "#!/bin/sh" 11 * config/get_ld: cwitty: disable -rpath 12 * config/get_tests: John Cremona: disable testing of ellglobalred in 13 "make test-all" in spkg-check, since it requires 14 the elldata database which we do not include. 15 * config/get_dlcflags: Add -fno-common to DLCFLAGS on Darwin. 16 * config/Makefile.SH: Change "test -e" to "test -f" for Solaris. 17 18 Documentation: 19 * doc/gphelp.in: cwitty: disable TeX; allow bz2 compression 20 21 Header files: 22 * src/headers/paripriv.h: *after* building, on {OS X, SunOS, SYGWIN}, 23 rename "ECHO" 24 25 C files: 26 * src/kernel/gmp/mp.c: needed so that Sage can catch pari's error signals. 27 * src/language/init.c: needed so that Sage can catch pari's error signals. 28 * src/basemath/base2.c and src/basemath/polarit3.c: fix PARI bug 1079. 29 30 ====================================================================== 31 Files previously patched: 32 ====================================================================== 33 34 * config/get_cc: on SunOS only, add "-fPIC" to compiler flags (David Kirkby) 35 This happens not with a patch file, but with a sed command in 36 spkg-install. Now fixed upstream (-fPIC added on all platforms). 37 38 *config/get_dlcflags: mabshoff: To get around problem in PPC 32-bit 39 Linux build. Now fixed upstream (-fPIC added on all platforms). 40 41 * config/get_kernel: pjeremy: fix for FreeBSD: #7825. Supposedly fixed 42 upstream. 43 44 * config/get_dlld: Undocumented patch for Darwin. Removed to see what 45 happens... 46 47 48 * config/get_cc: changed OPTFLAG from "-O3" to "-O1" on Linux because of 49 problems on Fedora 11 (32-bit) with one gcc version (ticket #7092). 50 51 # Minh Van Nguyen: copy over patched get_cc (see ticket #7092). It's 52 # reported that 32-bit Fedora 11 would fail to build otherwise. 53 if [ `uname` = "Linux" ]; then 54 cp "$TOP"/patches/get_cc config/get_cc 55 fi 56 57 * src/headers/paridecl.h: used to need a dummy variable changed from B0 58 to N; now fixed upstream. 59 * src/headers/paripriv.h: used to need a dummy variable changed from B0 60 to N; now fixed upstream. NB There's another patch on this file still 61 in place! 62 -
deleted file patches/get_cc
diff -r 1a3489aa9dd5 patches/get_cc
+ - 1 # Exported variables2 _cc_list="__gnuc__ CC CFLAGS optimization DBGFLAGS OPTFLAGS exe_suff suffix ASMINLINE"3 4 # Which optimization ?5 if test "$fastread" != yes; then6 cat << EOT7 ==========================================================================8 The default is to fully optimize the compilation. You may choose to build9 an executable for debugging or profiling instead. Choose among :10 full debugging profiling11 EOT12 echo $n ..."Which optimization do you prefer ? $c"13 dflt=$optimization; rep='full debugging profiling'; . ./myread14 optimization=$ans15 fi16 17 case "$osname" in18 os2) exe_suff=.exe; extraflag="-Zexe";;19 cygwin|mingw) exe_suff=.exe; extraflag="";;20 # On Darwin, by default, the full library search path is searched for a .dylib21 # before a .a can be considered, preventing users to install their libraries22 # in a simple way (e.g. the readline / Editline conflict). Override this.23 darwin) exe_suff=; extraflag=-Wl,-search_paths_first;;24 *) exe_suff=; extraflag="";;25 esac26 27 if test -z "$CC"; then28 echo Looking for the compilers ...29 # Native Compilers30 cc=`./locate cc '' $pathspace`31 case "$osname" in32 hpux) if test "$cc" = /usr/ccs/bin/cc -a -f /opt/ansic/bin/cc; then33 cc=/opt/ansic/bin/cc; fi ;; # This is a better compiler34 esac35 case "$cc" in ?:/*|/*) echo ..."cc is $cc";;36 *) echo ..."I could not find cc.";; esac37 # GNU Compilers38 gcc=`./locate gcc '' $pathspace`39 if test -z "$gcc"; then40 exe=$osname-$arch-gnu$$41 $cc $extraflag -o $exe gnu.c42 if $RUNTEST $exe; then gcc=$cc; fi; rm -f $exe43 fi44 case "$gcc" in45 ?:/*|/*) echo ..."gcc is $gcc";;46 *) echo ..."I could not find gcc."; gcc=;;47 esac48 if test -n "$gcc"; then49 # avoid internationalization trouble by setting LANG=C50 __gnuc__=`env LANG=C LC_ALL=C LC_MESSAGES=C $gcc -v 2>&1 | sed -n 's/.*version //p'`51 if test -z "$__gnuc__"; then __gnuc__=unknown; fi52 echo GNU compiler version $__gnuc__53 fi54 case "$osname" in55 aix) __gnuc__=;; # Native compilers are faster56 hpux) __gnuc__=;; # versions older than 2.7 cannot build PIC code57 # gp built with recent versions has bugs58 concentrix) case "$__gnuc__" in 2.[78].*);; *)59 __gnuc__=;; esac;;60 esac61 # Choosing the compiler62 if test -n "$__gnuc__"; then CC=$gcc; else CC=$cc; fi63 fi64 65 if test "$fastread" != yes; then66 cat << EOT67 ==========================================================================68 Only ANSI C and C++ compilers are supported. Choosing the GNU compiler69 gcc/g++ enables the inlining of kernel routines (about 20% speedup; if you70 use g++, it is a good idea to include the -fpermissive flag). If you choose71 not to use gcc, the C++ version of Pari will be a little faster because of72 general inlining, but can be used in library mode only with C++ programs.73 We strongly recommand using gcc all the way through.74 EOT75 echo $n ..."Which C compiler shall I use ? $c"76 dflt=$CC; rep=; . ./myread77 CC=$ans78 fi79 80 exe=$osname-$arch-ansi$$81 $CC $CFLAGS $extraflag -o $exe ansi.c 2>/dev/null && $RUNTEST $exe82 if test $? != 0; then cat << EOT83 ###84 ### C compiler does not work. PARI/GP requires an ANSI C compiler! Aborting.85 ###86 ### Compiler was: $CC $CFLAGS $extraflag87 EOT88 exit 1;89 fi90 rm -f $exe $exe$exe_suff91 92 if test "$CC" != "$gcc"; then __gnuc__=; fi93 if test -z "$__gnuc__"; then94 exe=$osname-$arch-gnu$$95 $CC $extraflag -o $exe gnu.c96 if $RUNTEST $exe; then97 # avoid internationalization trouble by setting LANG=C98 __gnuc__=`env LANG=C LC_ALL=C LC_MESSAGES=C $CC -v 2>&1 | sed -n 's/.*version //p'`99 echo GNU compiler version $__gnuc__100 fi101 rm -f $exe $exe$exe_suff102 fi103 104 # Which Flags for Compiler ?105 #106 cflags=107 ASMINLINE=108 if test -n "$__gnuc__"; then109 __GNUC__="-D__GNUC__"110 warn="-Wall"111 # Work around for building on 32-bit Fedora 11. See ticket #7092.112 OPTFLAGS=-O1113 ASMINLINE=yes114 case "$asmarch" in115 alpha)116 case "$__gnuc__" in117 2.95.[3-9]*|[3-9].*) ;;118 *) ASMINLINE=;; # doesn't work with 2.95.2.119 esac120 ;;121 esac122 OPTFLAGS="$OPTFLAGS $warn"123 case "$__gnuc__" in124 2.95.[3-9]*|[3-9].*) OPTFLAGS="$OPTFLAGS -fno-strict-aliasing";;125 esac126 KERNELCFLAGS=-funroll-loops127 128 DBGFLAGS=${DBGFLAGS:-"-g $warn"}129 # Specific optimisations for some architectures130 case "$arch" in131 sparcv8*) cflags=-mv8;;132 i?86|x86_64)133 case "$__gnuc__" in134 4.0.*) cflags=-fno-gcse-after-reload135 esac136 esac137 # problems on some architectures138 case "$osname" in139 os2) cflags="$cflags -Zmt -Zsysv-signals";;140 nextstep) cflags="$cflags -traditional-cpp";;141 darwin) # don't use broken pre-compiled headers on old Darwin142 if ($CC -no-cpp-precomp ansi.c 2>/dev/null); then :143 else144 cflags="$cflags -no-cpp-precomp"145 fi;;146 esac147 148 # omit-frame-pointer incompatible with -pg149 PRFFLAGS="-pg $OPTFLAGS"150 case "$optimization" in151 full) case "$osname" in152 mingw) ;;153 *) OPTFLAGS="$OPTFLAGS -fomit-frame-pointer";;154 esac;;155 esac156 else157 DBGFLAGS=${DBGFLAGS:-'-g'}158 PRFFLAGS='-pg'159 case "$osname-$arch" in160 hpux-*) # -Ae is for ANSI C + defines HPUX_SOURCE161 OPTFLAGS=-O; cflags=-Ae;;162 aix-*) OPTFLAGS='-O2 -qtune=auto -qmaxmem=8192'163 cflags='-qlanglvl=ansi';;164 osf1-*) OPTFLAGS='-O4 -migrate -ifo -Olimit 9999';;165 sunos-*) OPTFLAGS=-fast; PRFFLAGS='-pg -Bstatic';;166 solaris-*) OPTFLAGS='-fast -fsimple=1'; PRFFLAGS=-xpg;167 case "$arch" in168 sparc*) OPTFLAGS="$OPTFLAGS -xalias_level=any";;169 esac;;170 concentrix-*) OPTFLAGS=-Ogi;;171 *) OPTFLAGS=-O;;172 esac173 PRFFLAGS="$PRFFLAGS $OPTFLAGS"174 fi175 176 case "$optimization" in177 full) suffix=; cflags="$OPTFLAGS $cflags";;178 profiling) suffix=.prf; cflags="$PRFFLAGS $cflags";;179 debugging) suffix=.dbg; cflags="-DMEMSTEP=1048576 $DBGFLAGS $cflags";;180 esac181 182 CFLAGS="$cflags $CFLAGS $CPPFLAGS"183 if test "$fastread" != yes; then184 echo $n ..."With which flags ? $c"185 dflt=$CFLAGS; rep=; . ./myread186 CFLAGS=$ans187 fi -
deleted file patches/get_cc.patch
diff -r 1a3489aa9dd5 patches/get_cc.patch
+ - 1 --- ../src/config/get_cc 2007-03-10 07:57:08.000000000 -08002 +++ get_cc 2009-10-03 02:18:29.000000000 -07003 @@ -106,7 +106,8 @@4 if test -n "$__gnuc__"; then5 __GNUC__="-D__GNUC__"6 warn="-Wall"7 - OPTFLAGS=-O38 + # Work around for building on 32-bit Fedora 11. See ticket #7092.9 + OPTFLAGS=-O110 ASMINLINE=yes11 case "$asmarch" in12 alpha) -
deleted file patches/get_dlcflags
diff -r 1a3489aa9dd5 patches/get_dlcflags
+ - 1 _dl_list="DLCFLAGS"2 if test -n "$__gnuc__"; then3 # Some architectures need -fPIC for building dynamic lib4 # *-i?86|*-sparc*|*-powerpc|*-s390|*-mips) DLCFLAGS=5 case "$osname-$arch" in6 *-hppa|*-ia64|*-alpha|*-arm|*-m68k|*linux-ppc) DLCFLAGS=-fPIC ;;7 *-x86_64|*-sparc*|*-amd64) case "$sizeof_long" in8 8) DLCFLAGS=-fPIC;;9 esac;;10 darwin-*) DLCFLAGS=-fno-common;;11 esac12 else13 case "$osname-$arch" in14 hpux-*) DLCFLAGS=+z;;15 solaris-sparc*) case "$sizeof_long" in16 8) DLCFLAGS=-KPIC;; # assume sun cc17 esac;;18 esac19 fi20 21 echo "C compiler is $CC $CFLAGS $DLCFLAGS" -
patches/get_dlcflags.patch
diff -r 1a3489aa9dd5 patches/get_dlcflags.patch
a b 1 --- ../src/config/get_dlcflags 2006-05-15 00:04:51.000000000 -0700 2 +++ get_dlcflags 2010-01-03 23:06:39.000000000 -0800 3 @@ -3,8 +3,8 @@ 4 # Some architectures need -fPIC for building dynamic lib 5 # *-i?86|*-sparc*|*-powerpc|*-s390|*-mips) DLCFLAGS= 6 case "$osname-$arch" in 7 - *-hppa|*-ia64|*-alpha|*-arm|*-m68k) DLCFLAGS=-fPIC ;; 8 - *-x86_64|*-sparc*) case "$sizeof_long" in 9 + *-hppa|*-ia64|*-alpha|*-arm|*-m68k|*linux-ppc) DLCFLAGS=-fPIC ;; 10 + *-x86_64|*-sparc*|*-amd64) case "$sizeof_long" in 11 8) DLCFLAGS=-fPIC;; 12 esac;; 13 darwin-*) DLCFLAGS=-fno-common;; 1 --- config/get_dlcflags 2010-08-05 22:32:03.000000000 +0200 2 +++ config/get_dlcflags 2010-08-17 17:10:20.000000000 +0200 3 @@ -2,6 +2,7 @@ 4 if test -n "$__gnuc__"; then 5 case $osname in 6 cygwin|mingw) DLCFLAGS=;; 7 + darwin) DLCFLAGS="-fPIC -fno-common";; 8 *) DLCFLAGS=-fPIC;; 9 esac 10 else #assume native compiler -
deleted file patches/get_dlld
diff -r 1a3489aa9dd5 patches/get_dlld
+ - 1 # Exported variables2 _dlld_list='DL_DFLT_NAME DLLD DLLDFLAGS EXTRADLLDFLAGS DLSUFFIX soname sodest'3 4 # Which suffix for Dynamic Lib?5 # Some linkers (SunOS 4) need minor and major lib version numbers.6 # Some others (SunOS 5) need a link from a .so7 # Some others (HPUX 09) do not want version numbers.8 DLSUFFIX=so9 soname=.$soname_num10 do_dll=yes11 case "$osname" in12 gnu*|aix|osf1|solaris|linux|freebsd|netbsd)13 case $pari_release_verbose in14 *STABLE*) sodest=.$version.$patch;; # released version15 *DEVELOPMENT*) sodest=.$patch.0.0;; # unstable version16 esac ;;17 sunos) sodest=.$VersionMajor$VersionMinor.$patch18 soname=$sodest;;19 hpux) soname= ; sodest= ; DLSUFFIX=sl;;20 irix) soname= ; sodest= ;;21 os2|cygwin|mingw)soname= ; sodest= ; DLSUFFIX=dll ;;22 darwin)soname= ; sodest= ; DLSUFFIX=dylib;;23 *) do_dll=no ;;24 esac25 26 # dlopen(NULL) should return a handle to the running process.27 # On FreeBSD 2.2.5 (Y. Uchikawa) and Cygwin, this does not work.28 case "$osname" in29 freebsd|cygwin) DL_DFLT_NAME="\\\"\$(LIBPARI_DYN)\\\"" ;;30 mingw) DL_DFLT_NAME="\\\"\$(LIBPARI_SO)\\\"" ;;31 *) DL_DFLT_NAME=NULL ;;32 esac33 34 # if DLLD is defined at this point, respect it, even if do_dll=no35 if test $do_dll = yes -a -z "$DLLD"; then36 if test -n "$__gnuc__" -o "$osname" = "solaris"; then37 DLLD="$CC"38 else39 DLLD=$ld # don't take risks40 fi41 fi42 43 GNUdlld=44 DLLDisGCC=45 if test -n "$DLLD"; then46 # Which Dynamic Lib Linker?47 if test "$fastread" != yes; then48 echo $n ..."Which linker for building dynamic libs? $c"49 dflt="$DLLD"; rep=; . ./myread50 DLLD=$ans51 fi52 53 if test "$DLLD" = "$CC" -a -n "$__gnuc__"; then54 DLLDisGCC=yes;55 GNUdlld=$GNULDused56 else57 case "$DLLD" in58 *ld) if ($DLLD -v 2>&1 | grep GNU > /dev/null); then GNUdlld=yes; fi;;59 esac60 fi61 62 # Which Flags for Dynamic Lib Linker ?63 dlldflags="$DLLDFLAGS"64 DLLDFLAGS=65 if test -n "$GNUdlld"; then66 DLLDFLAGS="-shared -soname=\$(LIBPARI_SONAME)"67 else # DLLD != GNU ld68 case "$osname" in69 aix) DLLDFLAGS='-r' ;;70 darwin) DLLD=gcc; DLLDFLAGS='-flat_namespace -undefined suppress' ;;71 freebsd) DLLDFLAGS='-Bshareable -x' ;;72 hpux) DLLDFLAGS='-b' ;;73 irix) DLLDFLAGS='-shared -elf -no_unresolved -all' ;;74 osf1) DLLDFLAGS='-shared' ;;75 solaris) DLLDFLAGS="-G -h \$(LIBPARI_SONAME)" ;;76 sunos) DLLDFLAGS='-assert nodefinitions' ;;77 os2) ;; # see below78 linux) ;; # for e.g. the Portland Group cc (pgcc)79 *) DLLD=;;80 esac81 fi82 if test -n "$DLLDFLAGS"; then83 DLLDFLAGS=`./ldflags "$DLLDisGCC" $DLLDFLAGS`84 fi85 case "$osname" in86 os2) DLLDFLAGS="$CFLAGS -Zdll" ;; # assume DLLD = gcc87 cygwin) DLLDFLAGS="-Wl,--out-implib=\$(LIBPARI_SO)\$(_A),--export-all-symbols";;88 mingw) DLLDFLAGS="-Wl,--out-implib=\$(LIBPARI_SO)\$(_A)";;89 esac90 if test -n "$DLLDisGCC"; then91 case "$arch" in92 sparc*) extra='-mimpure-text';;93 *) extra=;;94 esac95 case "$osname" in96 darwin) shared=-dynamiclib;;97 *) shared=-shared;;98 esac99 DLLDFLAGS="$shared $extra \$(CFLAGS) \$(DLCFLAGS) $DLLDFLAGS"100 fi101 fi102 case "$osname" in103 # Beware: will run through 'eval' [ hence ${...} instead of \$(...) ]104 gnu*|osf1|freebsd|linux|sunos|solaris) EXTRADLLDFLAGS='-lc ${LIBS}';;105 esac106 107 if test "$fastread" != yes; then108 echo $n ..."Which flags for linker? $c"109 dflt=$DLLDFLAGS; rep=; . ./myread110 DLLDFLAGS=$ans111 fi112 DLLDFLAGS="$DLLDFLAGS $dlldflags"113 fi114 115 if test -z "$DLLD"; then116 echo "No Dynamic Lib"117 else118 echo "Dynamic Lib linker is $DLLD $DLLDFLAGS"119 fi -
deleted file patches/get_dlld.patch
diff -r 1a3489aa9dd5 patches/get_dlld.patch
+ - 1 --- ../src/config/get_dlld 2009-09-19 05:01:14.000000000 -07002 +++ get_dlld 2010-03-05 20:36:54.000000000 -08003 @@ -65,7 +65,7 @@4 else # DLLD != GNU ld5 case "$osname" in6 aix) DLLDFLAGS='-r' ;;7 - darwin) DLLD=; DLLDFLAGS='-dylib -flat_namespace -undefined suppress' ;;8 + darwin) DLLD=gcc; DLLDFLAGS='-flat_namespace -undefined suppress' ;;9 freebsd) DLLDFLAGS='-Bshareable -x' ;;10 hpux) DLLDFLAGS='-b' ;;11 irix) DLLDFLAGS='-shared -elf -no_unresolved -all' ;;12 @@ -88,10 +88,14 @@13 sparc*) extra='-mimpure-text';;14 *) extra=;;15 esac16 - DLLDFLAGS="-shared $extra \$(CFLAGS) \$(DLCFLAGS) $DLLDFLAGS"17 + if test "$osname" = darwin; then18 + DLLDFLAGS="-dynamiclib $extra \$(CFLAGS) \$(DLCFLAGS) $DLLDFLAGS"19 + else20 + DLLDFLAGS="-shared $extra \$(CFLAGS) \$(DLCFLAGS) $DLLDFLAGS"21 + fi22 fi23 case "$osname" in24 - gnu*|cygwin|osf1|freebsd|linux|sunos|solaris) EXTRADLLDFLAGS='-lc ${LIBS}';;25 + gnu*|osf1|freebsd|linux|sunos|solaris) EXTRADLLDFLAGS='-lc ${LIBS}';;26 esac27 28 if test "$fastread" != yes; then -
deleted file patches/get_kernel
diff -r 1a3489aa9dd5 patches/get_kernel
+ - 1 # Testing Architectures. Try uname to provide a default, then ask user.2 #3 case "$arch" in4 sparc) asmarch=sparcv8_micro; prettya=Sparc ;;5 sparcv8_micro) asmarch=$arch; prettya=MicroSparc ;;6 sparcv8_super) asmarch=$arch; prettya=SuperSparc ;;7 sparcv9) case "$sizeof_long" in8 4) asmarch=sparcv8_micro;;9 8) asmarch=none;;10 esac; prettya=UltraSparc ;;11 i?86) case "$sizeof_long" in12 4) asmarch=ix86;;13 8) asmarch=x86_64;;14 esac; prettya=$arch ;;15 x86_64|amd64) case "$sizeof_long" in16 4) asmarch=ix86;;17 8) asmarch=x86_64;;18 esac; prettya='amd64';;19 ia64) case "$sizeof_long" in20 4) asmarch=none;;21 8) asmarch=ia64;;22 esac; prettya=Itanium;;23 hppa) case "$sizeof_long" in24 4) asmarch=hppa; prettya='PA-RISC1.1';;25 8) asmarch=hppa64; prettya='PA-RISC2.0';;26 esac;;27 alpha) asmarch=$arch; prettya=Alpha ;;28 ppc) case "$sizeof_long" in29 4) asmarch=$arch;;30 8) asmarch=ppc64;;31 esac; prettya='PowerPC' ;;32 arm*) asmarch=none; prettya=$arch ;;33 mips) asmarch=none; prettya=MIPS ;;34 m68k) asmarch=m68k; prettya='Motorola 68k';;35 sh3) asmarch=none; prettya=SH-3 ;;36 sh5) asmarch=none; prettya=SH-5 ;;37 vax) asmarch=none; prettya=VAX ;;38 fx2800) asmarch=none; prettya='Alliant FX/2800' ;;39 s390) asmarch=none; prettya='S/390' ;;40 none) asmarch=none; prettya=unknown ;;41 *) asmarch=none; prettya=$arch42 echo " Warning ! architecture $arch not tested";;43 esac44 45 #46 # Modifications for pretty name and asm file47 #48 49 tmp_kern=auto-auto50 if test -n "$kernel"; then51 tmp_kern=$kernel52 else53 if test "$fastread" != yes; then54 cat << EOM55 An optimized Pari kernel is available for these architectures56 ("none" means that we will use the portable C version of GP/PARI)57 ("-gmp" means we will use the GMP library (that needs to be installed))58 EOM59 rep='none sparcv8_super sparcv8_micro ix86 alpha hppa m68k ppc ppc64 x86_6460 none-gmp sparcv8_super-gmp sparcv8_micro-gmp ix86-gmp alpha-gmp hppa-gmp m68k-gmp ppc-gmp ppc64-gmp x86_64-gmp'61 . ./display62 echo $n ..."Which of these apply, if any ? $c"63 dflt=$asmarch; . ./myread;64 kernel=$ans # explicit kernel, needed when checking for gmp in Configure65 tmp_kern=$ans66 cat << EOM67 ==========================================================================68 EOM69 fi70 fi71 if test -z "$without_gmp" ; then72 lvl1=gmp73 else74 lvl1=none75 fi76 tmp_kern=`./kernel-name $tmp_kern $asmarch $lvl1`77 kernlvl0=`echo "$tmp_kern" | sed -e 's/\(.*\)-.*/\1/'`78 kernlvl1=`echo "$tmp_kern" | sed -e 's/.*-\(.*\)/\1/'`79 80 case "$kernlvl0" in81 none) prettyk0="portable C";;82 m68k) prettyk0="m68k";;83 sparcv8_super) prettyk0=SuperSparc;;84 sparcv8_micro) prettyk0=MicroSparc;;85 ix86) prettyk0=ix86;;86 ia64) prettyk0=ia64;;87 hppa) prettyk0=HPPA;;88 hppa64) prettyk0=HPPA64;;89 alpha) prettyk0=Alpha;;90 ppc) prettyk0=PPC;;91 ppc64) prettyk0=PPC64;;92 x86_64) prettyk0="x86-64";;93 *) prettyk0="$kernlvl0";;94 esac95 96 . get_pretty97 98 echo "Building for: $pretty"99 cat << EOM100 ==========================================================================101 EOM -
deleted file patches/get_kernel.patch
diff -r 1a3489aa9dd5 patches/get_kernel.patch
+ - 1 --- ../src/config/get_kernel 2007-03-09 15:49:59.000000000 -08002 +++ get_kernel 2010-01-03 23:07:55.000000000 -08003 @@ -12,7 +12,7 @@4 4) asmarch=ix86;;5 8) asmarch=x86_64;;6 esac; pretty=$arch ;;7 - x86_64) case "$sizeof_long" in8 + x86_64|amd64) case "$sizeof_long" in9 4) asmarch=ix86;;10 8) asmarch=x86_64;;11 esac; pretty='amd64';; -
deleted file patches/get_ld
diff -r 1a3489aa9dd5 patches/get_ld
+ - 1 # Which Executable Linker ?2 #3 _ld_list='LD LDFLAGS LIBS runpathprexix LDneedsWl LDused GNULDused'4 case "$osname" in5 darwin) LIBS= ;;6 osf1) LIBS='-lm -lots';;7 *) LIBS=-lm;;8 esac9 10 if test -z "$LD"; then LD=$CC; fi11 12 if test "$fastread" != yes; then13 echo $n ..."Which linker for building executables ? $c"14 dflt=$LD; rep=; . ./myread15 LD=$ans16 fi17 LDused=$LD18 19 # Which Flags for Executable Linker?20 ldflags=21 GNULDused=22 if test "$LD" = "$CC"; then23 ldflags=$CFLAGS24 if test -n "$__gnuc__"; then25 LDused=`$CC -print-prog-name=ld`26 LDneedsWl=yes27 else28 if test "$osname" = hpux; then LDneedsWl=yes; fi29 fi30 fi31 if ($LDused -v 2>&1 | grep GNU > /dev/null); then GNULDused=yes; fi32 33 tmp=34 if test "$GNULDused" = "yes"; then35 case "$osname" in36 cygwin|mingw) ;; # PE does not support --export-dynamic37 *) tmp=--export-dynamic ;;38 esac39 else40 case "$osname-$arch" in41 aix-*) tmp=-brtl ;; # in case we link against a shared library42 hpux-*) tmp=-E ;;43 esac44 fi45 case "$osname" in46 darwin) tmp=$tmp -search_paths_first;;47 esac48 49 if test -n "$tmp"; then50 tmp=`./ldflags "$LDneedsWl" $tmp`51 ldflags="$ldflags $tmp"52 fi53 54 case "$osname-$arch" in55 os2-*) ldflags="$ldflags -Zexe"56 if test "$optimization" = "full"; then ldflags="$ldflags -s"; fi57 esac58 59 LDFLAGS="$ldflags $LDFLAGS"60 61 if test "$fastread" != yes; then62 echo $n ..."With which flags ? $c"63 dflt=$LDFLAGS; rep=; . ./myread64 LDFLAGS=$ans65 fi66 67 echo "Executable linker is $LD $LDFLAGS"68 69 if test "$GNULDused" = yes; then70 runpathprefix='-rpath '71 else # guess...72 case "$osname" in73 gnu|osf1|linux|cygwin*|freebsd|netbsd) runpathprefix='-rpath ' ;;74 solaris) runpathprefix='-R ' ;;75 hpux) runpathprefix='+b ' ;;76 aix) runpathprefix='-blibpath:' ;;77 esac78 fi79 # We want Sage directories to be relocatable, so rpath is bad. Kill it.80 runpathprefix='' -
patches/get_ld.patch
diff -r 1a3489aa9dd5 patches/get_ld.patch
a b 1 --- ../src/config/get_ld 2006-01-24 13:24:26.000000000 -08002 +++ get_ld 2007-12-26 21:35:54.000000000 -08003 @@ - 64,3 +64,5 @@1 --- config/get_ld (revision 12541) 2 +++ config/get_ld (working copy) 3 @@ -76,3 +76,5 @@ 4 4 aix) runpathprefix='-blibpath:' ;; 5 5 esac 6 6 fi -
new file patches/get_tests.patch
diff -r 1a3489aa9dd5 patches/get_tests.patch
- + 1 --- config/get_tests (revision 12541) 2 +++ config/get_tests (working copy) 3 @@ -4,7 +4,7 @@ 4 _test_list='test_extra_out test_extra test_basic top_test_extra top_dotest_extra' 5 6 # _not_ included in 'make test-all' (annoying) 7 -test_extra_out="ploth" 8 +test_extra_out="ploth ellglobalred" 9 10 # included in 'make bench' 11 test_basic="\ -
deleted file patches/gphelp.in
diff -r 1a3489aa9dd5 patches/gphelp.in
+ - 1 #!@perl@2 #3 # $Id: gphelp.in 12437 2010-06-18 07:59:23Z kb $4 #5 # Copyright (C) 2000 The PARI group.6 #7 # This file is part of the PARI/GP package.8 #9 # PARI/GP is free software; you can redistribute it and/or modify it under the10 # terms of the GNU General Public License as published by the Free Software11 # Foundation. It is distributed in the hope that it will be useful, but WITHOUT12 # ANY WARRANTY WHATSOEVER.13 #14 # Check the License for details. You should have received a copy of it, along15 # with the package; see the file 'COPYING'. If not, write to the Free Software16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.17 18 # Output extended help corresponding to a given GP command. By default,19 # extract relevant information from from the PARI manual, run TeX, then open20 # an xdvi display.21 #22 # The manual can be compressed.23 #24 # Usage: gphelp keyword25 #26 # Command line options:27 # -k: apropos (list of relevant GP functions)28 # -detex (-d): don't use TeX + xdvi (implicit when DISPLAY is not set).29 # -color_help (-ch) <number>: use color "number" (same scheme as in GP)30 # -color_bold (-cb) <number>: display bold in color "number"31 # -color_underline (-cu) <number>: display underlined text in color "number"32 #33 # -raw use internal format for output with @x markers, -detex is implicit34 # (for the TeX-to-pod converter)35 #36 # -to_pod file convert file to POD (should be the only args)37 #38 # -to_dumbpod file same, but without nested formating39 #40 # Granted environment variables (override):41 # GPTMPDIR: where temporary files will go (/tmp by default).42 # GPDOCDIR: where is manual (by default, where make install will put it).43 # GPXDVI: which 'xdvi' program to call (xdvi by default)44 #45 $version= "@version@";46 $datadir= "@datadir@";47 # no expanded material (@key@) below48 $wwwsite= "http://pari.math.u-bordeaux.fr/";49 50 $xdvi = $ENV{GPXDVI} || "xdvi";51 $xdviref = $ENV{GPXDVIREF} || "$xdvi -paper 29.7x21cm";52 $gzip = "gzip";53 $zcat = "$gzip -dc";54 $bzip = "bzip2";55 $bzcat = "$bzip -dc";56 $docdir = &get_docdir();57 58 $refcard = (@ARGV and $ARGV[-1] =~ /refcard/i);59 60 $dumb_pod=1, $ARGV[0] = '-to_pod' if @ARGV && $ARGV[0] eq '-to_dumb_pod';61 &to_pod() if @ARGV == 2 && $ARGV[0] eq '-to_pod';62 63 &options(); &init();64 if ($#ARGV < 0) { &treat($_); cleanexit(); }65 66 &pretex() if (!$detex);67 for (@ARGV) { &treat($_); }68 if ($apropos) { &apropos_final_print(); cleanexit(); }69 &posttex() if (!$detex);70 print "ugly_kludge_done\n" if (!$detex && $fromgp);71 cleanexit();72 73 #74 # Procedures75 #76 sub cleanexit {77 print "\e[0m" unless $to_pod;78 exit 0;79 }80 81 sub help {82 print "Usage: $0 [-k] [-detex] [-ch c1] [-cb c2] [-cu c3] keyword\n";83 print "where c1,c2,c3 denote background, bold and underline color\n";84 exit(1);85 }86 87 sub options {88 $raw = $detex = $fromgp = $apropos = 0;89 $ch = $cb = $cu = '';90 while ($_ = $ARGV[0])91 {92 last if (! /^-[a-z]/);93 shift(@ARGV);94 if ($_ eq "-fromgp")95 { $fromgp = 1; }96 elsif ($_ eq "-k")97 { $apropos = $detex = 1; }98 elsif ($_ eq "-balloon")99 { $balloon = 1; }100 elsif ($_ eq "-detex" || $_ eq "-d")101 { $detex = 1; }102 elsif ($_ eq "-raw")103 { $raw = $detex = 1; }104 elsif ($_ eq "-color_help" || $_ eq "-ch")105 { $ch = &color(shift(@ARGV)); }106 elsif ($_ eq "-color_bold" || $_ eq "-cb")107 { $cb = &color(shift(@ARGV)); }108 elsif ($_ eq "-color_underline" || $_ eq "-cu")109 { $cu = &color(shift(@ARGV)); }110 else111 { &help(); }112 }113 $ch = "\e[m$ch";114 $cu .= $cu ? "\e[1m": "\e[4m";115 $cb .= "\e[1m";116 $detex = 1 if (!$ENV{DISPLAY});117 # Disable TeX for Sage.118 $detex = 1;119 }120 121 sub get_docdir {122 my $d = $ENV{GPDOCDIR} || $ENV{GPHELP_DOCDIR};123 if (!defined $d) {124 # work from TOPDIR/Oarch or TOPDIR too: may be uninstalled yet;125 $d = $0; $d =~ s,/gphelp,,;126 for ("$datadir", '.', '..', $d) {127 my $t = "$_/doc";128 if (-r "$t/translations") { $d = $t; last; }129 }130 $d ||= "$datadir/doc"; # Last resort131 }132 if ($d =~ /^\./) {133 eval { require Cwd;134 $d = Cwd::cwd() . "/$d";135 $d =~ s,doc/\.\./doc,doc,;136 }137 }138 return $d;139 }140 141 sub init {142 &inittr();143 144 $indent = " ";145 # avoid Glob.pm! (for minimal Windows install)146 opendir(DIR, $docdir) || die "$docdir not found";147 @file_list = grep { /^usersch.*tex/ } readdir(DIR);148 closedir(DIR);149 150 chdir($docdir);151 $docfile = "usersch3.tex";152 open(IN,"translations") || die("Could not find translation file, docdir='$docdir'");153 while(<IN>)154 {155 chomp; @_ = split(/ *\@ */);156 $key = shift(@_);157 $transl{$key} = join('@',@_);158 }159 close(IN);160 }161 162 sub not_found {163 my($help) = shift;164 $help =~ s/\\\\/_B#K#S_/g;165 $help =~ s/\\(.)/$1/g;166 $help =~ s/_B#K#S_/\\/g;167 print "'$help' not found !\n";168 }169 170 sub choose_chap {171 while (s/\@([0-9])$//) { $docfile = "usersch$1.tex"; }172 if (-r $docfile) { $pipe = ""; }173 else174 {175 die "Cannot find $docfile"176 if (! -r "$docfile.z" &&177 ! -r "$docfile.gz" &&178 ! -r "$docfile.Z" &&179 ! -r "$docfile.bz2");180 if (-r "$docfile.bz2") {181 $pipe = $bzcat;182 $docfile = "$docfile.bz2";183 } else {184 $pipe = $zcat;185 }186 }187 }188 189 sub safe_setsid {190 eval {191 require POSIX;192 POSIX::setsid(); # detach from terminal (^C will not kill xdvi)193 };194 }195 196 # assume we're in $docdir197 sub open_viewer_then_quit {198 my $F = shift;199 my ($f, $viewer, $redirect);200 my $win32 = ($^O =~ /(cyg|ms)win/);201 202 $f = "$F.dvi";203 $f = "$F.dvi.gz" if (! -f "$f");204 $f = "$F.pdf" if (! -f "$f");205 die "could not find \'$F\'" if (! -f "$f");206 $F = $f;207 $redirect = ' 2>/dev/null >/dev/null &';208 if ($f =~ /\.dvi/)209 { # DVI210 $viewer = ($f =~ /refcard/)? $xdviref: $xdvi;211 }212 elsif ($win32)213 { # PDF Win32214 @_ = split(/"/, `acro.exe`);215 ($viewer = $_[1]) =~ s,\\,/,g;216 217 $redirect = "";218 $F =~ s,/cygdrive/(.),$1:, ; # Reader can't cope with Cygwin paths219 $F = "\"$F\"";220 $viewer = "\"$viewer\"";221 }222 else223 { # PDF generic224 $viewer = "acroread";225 }226 227 print "displaying \'$F\'.";228 print "\n" if (!$fromgp);229 safe_setsid();230 system("$viewer $F$redirect");231 cleanexit();232 }233 234 sub treat {235 my($help);236 $_ = $_[0];237 s/_QUOTE/'/g;238 s/_BACKQUOTE/`/g;239 s/_DOUBQUOTE/"/g;240 s/^ *"(.*)"([^"]*) *$/$1$2/;241 if (s/\@$//)242 {243 $found = 0;244 $searchall = 1;245 $help = $_;246 for (@file_list)247 {248 next if (!/^usersch(.*)\.tex/);249 250 &treat("$help\@$1");251 if ($apropos && $#list > 0 || $#sentence_list > 0)252 {253 print "\nChapter $1:\n";254 print "==========\n";255 &apropos_final_print();256 }257 }258 return not_found($help) if (!$found && !$apropos);259 $searchall = 0;260 $apropos = 0; return;261 }262 &choose_chap;263 264 if (!$apropos)265 {266 $_ = "users" if (/^$/);267 open_viewer_then_quit($_) if (/^(users|tutorial|refcard|libpari)$/);268 }269 270 if (!$apropos && $transl{$_}) { $_ = $transl{$_}; &choose_chap; }271 s/(\W)/\\$1/g;272 s/_/\\\\_/g;273 ($pipe && open(DOC,"$pipe $docfile |"))274 || (!$pipe && open(DOC,"$docfile")) || die "Cannot open $docfile: $!";275 return &apropos($_) if ($apropos);276 277 if (/^\\[<>=!](\\=)?$/ || /^\\\|\\\||\\&\\&$/ || /\\\||&/ || /===/)278 { $_ = 'Comparison and Boolean operators'; }279 $help = $_;280 281 my ($first);282 while (<DOC>)283 {284 if (/^\\(subsubsec[a-z]*|subsec[a-z]*|section|chapter){$help}/)285 { $first = $_; last; }286 }287 if (eof(DOC))288 {289 ¬_found($help) if (!$searchall);290 return;291 }292 $found = 1;293 if (!$detex) { tex($first); }294 else295 {296 &detex(); print "\n" if (!$fromgp);297 # Avoid broken pipe from zcat298 do {local $/; <DOC>} if $^O eq 'os2' and $pipe;299 }300 close(DOC);301 }302 303 #304 # A propos305 #306 307 sub apropos_print_list {308 $current = "";309 @_ = sort(@_);310 for (@_)311 {312 next if ($_ eq $current);313 $current = $_; print "$indent$_\n";314 }315 }316 317 sub apropos_raw_print {318 $indent = "";319 &apropos_print_list(@sentence_list);320 &apropos_print_list(@list);321 }322 323 sub apropos_final_print {324 my($maxlen) = 0;325 my($i,$nbcol,$current);326 my($cols) = ($ENV{'COLUMNS'} || 80) - 1;327 328 if ($raw) { &apropos_raw_print(); return; }329 @list = sort(@list);330 for (@list)331 {332 $i= length($_);333 $maxlen = $i if ($i > $maxlen);334 }335 $maxlen++; $nbcol = $cols / $maxlen;336 $nbcol =~ s/\..*//;337 $nbcol-- if ($nbcol * $maxlen == $cols);338 $nbcol = 1 if (!$nbcol);339 340 $current = ""; $i = 0;341 for (@list)342 {343 next if ($_ eq $current);344 $current = $_; print($_); $i++;345 if ($i >= $nbcol)346 {347 $i=0; print "\n"; next;348 }349 print " " x ($maxlen - length($_));350 }351 print "\n" if ($i);352 if ($#sentence_list > 0)353 {354 print "\nSee also:\n" if ($#list > 0);355 $indent = " ";356 apropos_print_list(@sentence_list);357 }358 }359 360 sub apropos_check {361 my($line, $current) = @_;362 $line =~ s/\n/ /g;363 return if ($line !~ /$help/i);364 365 local($_) = $current;366 s/\\b{(.)}/\\$1/;367 s/\{\}//g;368 s/\\pow/^/;369 s/\\%/%/;370 s/\\bs/\\/;371 s/\\\#/\#/g;372 s,\+\$/\$-,+/-,;373 if (/ /) { push(@sentence_list,$_); } else { push(@list,$_); }374 }375 376 sub apropos {377 my($line,$current,$new);378 $help = $_[0];379 $help='\\\\pow' if ($help eq '\^');380 $help='\\\\til' if ($help eq '\~');381 @sentence_list = @list = "";382 while (<DOC>)383 {384 if (/^\\(subsubsec[a-z]*|subsec[a-z]*|section|chapter){/)385 {386 $new = &get_match($_,'{','}');387 &apropos_check($line, $current);388 $current = $new; $line = "";389 }390 $line .= $_;391 }392 &apropos_check($line, $current);393 }394 395 ##396 ## Tex Part397 ##398 # Actual text is in file TEX. Parimacro + Geometry info goes to WRAP399 sub pretex {400 my ($basedir) = $ENV{GPHELP_TMPDIR} || $ENV{GPTMPDIR} || $ENV{TMPDIR} || "/tmp";401 $tmpdir = "$basedir/gp.help$$";402 mkdir $tmpdir, 0755 || die "Cannot create temporary directory";403 $texfile = "$tmpdir/gp.help";404 405 open(TEX,">$texfile.tex") || die "Couldn't open $texfile.tex";406 }407 408 sub tex { my ($first) = @_;409 print TEX $first;410 while (<DOC>)411 {412 last if /^\\(section|sub[sub]*sec)/i;413 print TEX;414 }415 }416 417 sub posttex {418 my ($wrap) = "$tmpdir/gpwrapper.help";419 my (@goners) = ("$texfile.tex",420 "$wrap.tex", "$wrap.dvi", "$wrap.log", "$wrap.aux");421 if (!$found) { unlink @goners; rmdir("$tmpdir"); cleanexit(); }422 423 open(WRAP, ">$wrap.tex") || die "Couldn't open $wrap.tex";424 if ($balloon) {425 print WRAP '\nopagenumbers\def\fromgphelp{}'426 . "\\input $docdir/parimacro.tex"427 . '\setbox0\vbox{'428 . "\\input $texfile.tex"429 . ' }430 \dimen0=\the\ht0 \advance\dimen0 by \dp0431 \advance\dimen0 by 60pt432 \dimen1=\the\wd0433 \advance\dimen1 by 60pt434 \vsize \dimen0435 \hsize \dimen1436 \advance\voffset 30pt\advance\hoffset 30pt437 \advance\hoffset-1in \advance\voffset-1in438 \special{papersize=\the\dimen1,\the\dimen0}439 \noindent\box0440 \end';441 } else {442 print WRAP '\nopagenumbers\def\fromgphelp{}'443 . "\\input $docdir/parimacro.tex"444 . "\\input $texfile.tex"445 . '\end';446 }447 close(WRAP) || die "Error closing '$wrap.tex': $!";448 close(TEX) || die "Error closing '$texfile.tex': $!";449 450 chdir($tmpdir);451 $out = `tex $wrap.tex 2>&1 < /dev/null`;452 -f "$wrap.dvi"453 || die "could not create '$wrap.dvi': status=$?, $out";454 safe_setsid();455 my ($goners) = join(" ", @goners);456 system("($xdvi $wrap.dvi 2>/dev/null >/dev/null; rm -f $goners; rmdir $tmpdir)&");457 }458 459 #460 # Detex Part461 #462 sub fit_loop {463 my($i);464 return if ($miss > 9);465 while ($miss > 0)466 {467 # print "1:$miss ";print @_;print "\n";468 for (@_) { $miss-- if (s/([?!\.;])$/$1 /);469 return if ($miss == 0);470 }471 # print "2:$miss ";print @_;print "\n";472 for (@_) { $miss-- if (s/([?!\.;]) $/$1 /);473 return if ($miss == 0);474 }475 # print "3:$miss ";print @_;print "\n";476 for (@_) { $miss-- if (s/([\),])$/$1 /);477 return if ($miss == 0);478 }479 # print "4:$miss ";print @_;print "\n";480 $i = 0;481 for (@_)482 {483 if (!$i) { $i = 1; next; }484 $miss-- if (s/^\(/ (/);485 return if ($miss == 0);486 }487 # print "5:$miss "; print @_;print "\n";488 for (@_) { $miss--; s/$/ /;489 return if ($miss == 0);490 }491 }492 }493 494 sub fit_line {495 my($wi, @a);496 my($l) = -1;497 my($rem) = $_[0];498 for (@l)499 {500 $l2 = $l; $l += ($_ + 1);501 last if ($l > $rem);502 $wi++;503 }504 $miss = $rem - $l2;505 splice(@l, 0, $wi);506 @a = splice(@w, 0, $wi-1); &fit_loop(@a);507 push(@a, shift(@w)); return join(' ', @a);508 }509 510 # empty output line511 sub is_void {512 my($in) = shift;513 $in =~ s/\@\[\w+\]//g;514 $in =~ s/\@[012]//g;515 ($in =~ /^\s*$/)? 1: 0;516 }517 518 sub nl { push(@f_text, shift); }519 520 sub format_text {521 my($last_void) = 0;522 my($add_stuff) = 0;523 my($init) = 1;524 my($cols) = ($ENV{'COLUMNS'} || 80) - 1;525 my($first) = $cols - length($indent);526 527 for (@text)528 {529 if (s/^\@1//) # start verbatim530 {531 nl(&fit_line($first)) if (@w);532 nl("") if (!$last_void && !is_void($_)); # add empty line533 nl("$indent$_");534 }535 elsif (s/^\@0//) # verbatim lines536 {537 nl("$indent$_");538 }539 elsif (s/^\@2//) # end verbatim540 {541 nl("$indent$_");542 $last_void = is_void($_);543 }544 elsif (is_void($_)) # line is empty545 {546 next if (!$add_stuff);547 if ($init) {548 nl(&fit_line($first));549 } else {550 nl("") if (!$last_void);551 nl("\@[endbold]$indent" . &fit_line($first));552 }553 while (@w) { nl(&fit_line($cols)); }554 $init = $last_void = $add_stuff = 0;555 }556 else557 {558 $add_stuff = 1; s/^ +//;559 @_ = split(/\s+/, $_);560 for (@_)561 {562 s/\Q$tr{nbrk}/ /g; push(@w, $_);563 # these codes will be replaced by 1 character564 s/\@\[(obr|cbr|ouml|uuml|agrav|eacute|ldollar|pm|lt|gt|\{|\})]/\@/g;565 # the rest will be replaced by zero-width characters566 s/\@\[\w+\]//g; push(@l, length($_));567 }568 }569 }570 }571 572 # argument has the form s1${open}s2${close}s3573 # Return 's2'. Set $remainder to 's3'.574 sub get_match {575 local ($_, $open, $close) = @_;576 my (@tmp, $arg,$parity,$ok);577 my ($obr) = 1;578 $parity = ($open eq $close);579 /$open/; $_ = $'; # remove everything before (and including) first $open580 581 while ($_) {582 @tmp = split(/($open|$close)/);583 while ($#tmp >= 0) {584 $_ = shift(@tmp);585 $obr++ if (/^$open$/);586 if ($parity && $obr == 2) { $ok = 1; last }587 $obr-- if (/^$close$/);588 if (!$obr) { $ok = 1; last }589 $arg .= $_;590 }591 last if ($ok);592 $_ = <DOC>;593 }594 $remainder = join('',@tmp);595 return $arg;596 }597 598 sub detex {599 my($fun,$args);600 # 1: get the function "prototype"601 $fun = &get_match($_,'{','}');602 # name603 $fun = &basic_subst($fun);604 $_ = $remainder;605 # args as $(x)$ in \subsecidx{sin}$(x)$:606 if (/^ *\$/)607 {608 $args = &basic_subst(&get_match($_,'\$','\$'));609 $_ = $remainder;610 }611 $_ = <DOC> if (!&basic_subst($_));612 # dft value as (...) in \subsecidx{echo} (default \kbd{0})613 if (/^ *\(/)614 {615 $args .= ' (' . &basic_subst(&get_match($_,'\(','\)')) . ')';616 $_ = $remainder;617 }618 $args .= ":" if ($args !~ /: *$/ && ($args || $fun !~ /: */));619 620 push(@text, "\@[startbold]$fun\@[endbold]$args");621 push(@text, "");622 # 2: parse the function description623 if ($_) { s/^ *://; &presubst(); }624 while (<DOC>)625 {626 last if /^\\(section|sub[sub]*sec)/i;627 &presubst();628 }629 if ($raw) { print join("\n", @text); return; }630 # for (@text) { print("AA{$_}BB\n"); } # DEBUG631 &format_text();632 for (@f_text) { &TeXprint($_); }633 }634 635 # We use the special char @ to transmit special sequences636 sub inittr {637 @ou = qw( dollar nbrk startbold endbold startcode endcode638 obr cbr uuml ouml agrave eacute639 startpodcode endpodcode startlink endlink640 startbcode endbcode startbi endbi startit endit641 startword endword startlword endlword pm empty gt lt podleader );642 643 @tr{@ou} = map "\@[$_]", @ou;644 $tr{dollar} = '$' if $to_pod;645 646 %pr = ( dollar => '',647 ldollar => '$', # literal dollar648 nbrk => 'S< >',649 startbold => 'B<',650 endbold => '>',651 startcode => 'C<',652 startlink => 'L<',653 endlink => '>',654 endcode => '>',655 obr => '{',656 cbr => '}',657 startpodcode => 'C<',658 endpodcode => '>',659 ( $dumb_pod660 ? (startbcode => 'B<',661 endbcode => '>',662 startbi => 'B<',663 endbi => '>',)664 : (startbcode => 'B<C<',665 endbcode => '>>',666 startbi => 'B<I<',667 endbi => '>>')),668 startit => 'I<',669 endit => '>',670 startword => 'F<',671 endword => '>',672 startlword => ' F<',673 endlword => '> ',674 pm => 'F<+->',675 "gt" => 'E<gt>',676 "lt" => 'E<lt>',677 ouml => 'E<ouml>',678 uuml => 'E<uuml>',679 eacute => 'E<eacute>',680 agrave => 'E<agrave>',681 empty => 'Z<>',682 podleader => '=',683 );684 }685 686 sub indent_equally { my $in = shift; $in =~ s/^[ \t]*/ /mg; $in}687 688 sub basic_subst {689 local($_) = shift;690 691 s/(\S)[ \t]*\n[ \t]+/$1\n/gm;692 s/([^\\])\\\{/$1$tr{obr}/g;693 s/([^\\])\\\}/$1$tr{cbr}/g;694 s/([^\\])\\-/$1/g;695 s/\A\\q?quad(?![a-zA-Z])\s*/$tr{nbrk}$tr{nbrk}/;696 s|\\wwwsite|$wwwsite|g;697 s/^\\def\\.*\{\n.*\n\}//gm;698 s/\\def\\.*//g;699 s(\\footnote\s*\{?\*+\}?\s*\{\s*((?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*)\})700 {$tr{startbold}FOOTNOTE$tr{endbold}$tr{lt}$tr{lt}$tr{lt} $1 $tr{gt}$tr{gt}$tr{gt}}g;701 s/(\{[\w\s]+)\{\}([\s\w]+\})/$1$2/g; # {nf{}init}702 s(\\op(?![a-zA-Z])\s*)({\\it op\\/})g; # {nf{}init}703 s/\\emacs\b//;704 s/\\unix\b//;705 s/\\(leavevmode|strut)(?![a-zA-Z])\s*//g;706 s/ \\funno \s*707 { \s* ((?:[^{}]|\{[^{}]*\})*) } \s*708 { \s* ((?:[^{}]|\{[^{}]*\})*) } \s*709 { \s* ((?:[^{}]|\{[^{}]*\})*) }710 /\\noindent{\\tt $1 \$\\key{$2}\$($3)}/gx;711 s/\\fun\s*\{([^{}]*)\}\s*\{((?:[^{}]|\{[^{}]*\})*)\}\s*\{((?:[^{}]|\{[^{}]*\})*)\}/\\kbd{$1 \\key{$2}($3)}\\sidx{$2}/g;712 713 s/\\\\(?=[a-zA-Z])/\\bs /g;714 s/\\b{}\\b{}/\\bs\\bs /g;715 s/\\\\/\\bs/g;716 s/(\'\'|\`\`)/"/g unless $to_pod; # (english) double quotes717 # asymptotic or isomorphic (~) [beware of ties]718 s/(^|[^\\]) +~/$1~/;719 s/~ */~/;720 s/(^|[^\\])~/$1$tr{nbrk}/g; # ties721 s/\\(simeq|sim|approx)(?![a-zA-Z])/ ~ /g;722 s/\\til(?![a-zA-Z])/~/g; # ~ (transpose)723 s/\\(~|tilde)/~/g;724 725 s/\\(equiv)(?![a-zA-Z])/ = /g;726 s/\\`a/$tr{agrave}/; s/\\`{a}/$tr{agrave}/;727 s/\\"o/$tr{ouml}/; s/\\"{o}/$tr{ouml}/;728 s/\\"u/$tr{uuml}/; s/\\"{u}/$tr{uuml}/;729 s/\\'e/$tr{eacute}/; s/\\'{e}/$tr{eacute}/;730 731 s/(^|[^\\])%.*/$1/g; # comments732 s/\\vadjust\s*\{\s*\\penalty\s*\d+\s*\}//g;733 734 # We do not strip %\n, thus:735 s/\\kbd{\n\s*/\\kbd{/g;736 s/\$\\bf(\b|(?=[\d_]))\s*([^\$]+)\$/\$$tr{startbcode}$1$tr{endbcode}\$/g;737 s/\$/$tr{dollar}/g; # math mode738 s/\t/ /g; s/\\,//g; s/\\[ ;]/ /g; # various spaces739 s/\\\///g; # italic correction740 s/^&+//g; # tab marks741 s/([^\\])&+/$1 /g; # tab marks742 s/\\TeX\{\}/TeX/g;743 s/\\TeX(\W)/TeX$1/g;744 s/ *\\circ\b */ o /g;745 s/\\d?frac{\s*((?:[^{}]|\{[^{}]*\})*)}{\s*((?:[^{}]|\{[^{}]*\})*)}/($1)\/($2)/g;746 s(\\d?frac\s*(\d)\s*(\d))(($1/$2))g;747 s[{\s*(\w)\s*\\over(?![a-zA-Z])\s*(\w)\s*}]{($1/$2)}g;748 s[{\s*((?:[^{}]|\{[^{}]*\})*)\\over(?![a-zA-Z])\s*((?:[^{}]|\{[^{}]*\})*)}][($1)/($2)]g;749 750 # \def\synt#1#2{\syn{#1}{\tt #2}}751 # \def\syn#1#2{\synx{#1}{#2}{#1}}752 s/\\synt?\{\s*((?:[^{}]|\{[^{}]*\})*)\}\{\s*((?:[^{}]|\{[^{}]*\})*)\}/\\synx{$1}{$2}{$1}/g;753 # \def\synx#1#2#3{\sidx{#3}The library syntax is $\key{#1}({#2})$}754 # Often used with embedded {}.755 s/\\synx\{\s*((?:[^{}]|\{[^{}]*\})*)\}\{\s*((?:[^{}]|\{[^{}]*\})*)\}\{((?:[^{}]|\{[^{}]*\})*)\}/\\sidx{$3}The library syntax is $tr{startbold}$1$tr{endbold}$tr{startpodcode}($2)$tr{endpodcode}/;756 757 # May be used with an empty arg758 s/\\typ\{([^\}]*)\}/$tr{startcode}t_$1$tr{endcode}/g;759 760 s/(\\string)?\\_/_/g;761 s/\\([#\$&%|])/$1/g;762 s/\\(hat(?![a-zA-Z])|\^)({\\?\s*})?/^/g;763 s/^(\@\[podleader\]head\d *)\\pow(?![a-zA-z])( *)/$1^$2/gm;764 s/ *\\pow(?![a-zA-z]) */^/g;765 766 s/\\neq?(?![a-zA-Z])/ != /g;767 s/\\enspace(?![a-zA-Z])/ /g;768 s/\\times(?![a-zA-Z]) */ x /g;769 s/\\infty(?![a-zA-Z]) */ oo /g;770 s/ *\\(bmod|mod) */ mod /g;771 s/ *\\pmod(?![a-zA-Z]) *\{\s*((?:[^{}]|\{[^{}]*\})*)\}/ (mod $1)/g;772 s/ *\\cdot(?![a-zA-Z]) */./g; # Maybe " . "?773 s/ *(\\|\@)[lc]?dots(?![a-zA-Z]) */.../g;774 s/\\(Cl|log|sin|cos|lim(proj)?|tan|mod|sqrt|exp|ln|det|Re|Im|deg|wp|cap|oplus)(?![a-zA-Z])/$tr{startlword}$1$tr{endlword}/g;775 s/\\pi(?![a-zA-Z])/$tr{startword}Pi$tr{endword}/g;776 s/\\(Alpha | Beta | Chi | Delta | Epsilon | Phi | Gamma | Eta | Iota777 | vartheta | Kappa | Lambda | Mu | Nu | Omicron | Pi | Theta | Rho778 | Sigma | Tau | Ypsilon | varsigma | Omega | Xi | Psi | Zeta779 | alpha | beta | chi | delta | epsilon | varepsilon | phi | gamma | eta780 | iota | varphi | kappa | lambda | mu | nu | omicron | pi | theta | rho781 | sigma | tau | ypsilon | varpi | omega | xi | psi | zeta782 | int | expr | seq | args | gcd | lcm | sum | prod | Re | infty )783 (?![a-zA-Z])/$tr{startword}$1$tr{endword}/xg;784 s/ *\\in(?![a-zA-Z]) */ belongs to /g;785 s/\\pm(?![a-zA-Z])/$tr{pm}/g;786 s/ *\\mid(?![a-zA-Z]) */ | /g;787 788 s/\\idxtyp\{([^{}]*)\}/\\sidx{t_$1}/g;789 s/\\ref\{([^\}]*)\}/[$tr{startbold}Label: $1$tr{endbold}]/g unless $to_pod;790 s/\\secref\{([^\}]*)\}/Section [$tr{startbold}Label: $1$tr{endbold}]/g unless $to_pod;791 s/\\label\{[^\}]*\}//g unless $to_pod;792 793 s/\\(noindent|medskip|bigskip|smallskip|left|right)(?![a-zA-Z])[ \t]*//g;794 s/\\vfill *(\\eject)?//g;795 s/\\(q|quad)(?![a-zA-Z])\s*/ /g;796 s/\\qquad(?![a-zA-Z])\s*/ /g;797 798 s/\\centerline\s*\{\s*(?:\\tt\b\s*)?(.*(\n[ \t].*)*)\}(?=\s*$)/indent_equally($1)/ge;799 s/\\centerline\s*\{\s*(?:\\tt\b\s*)?((?:[^{}]|\{[^{}]*\})*)\}/ indent_equally($1)/ge;800 801 s/\\big\b//g;802 803 s/\\settabs.*//;804 s/^\\\+/$tr{nbrk}/gm;805 s/\\\+//g;806 s/\\cr(?![a-zA-Z])//g;807 s/\\B(?![a-zA-Z])/\\kbd{BIL}/g;808 809 s/ *([=><]) */ $1 /g;810 s/ *< *([=<]) */ <$1 /g;811 s/ *> *([=>]) */ >$1 /g;812 s/ *([*+-\/^&=|:]) += */ $1= /g;813 s/ *! *= */ != /g;814 815 s/ *\\Rightarrow */ ==$tr{gt} /g;816 s/\\rangle(?![a-zA-Z])\s*/$tr{startcode}$tr{gt}$tr{endcode}/g;817 s/\\langle(?![a-zA-Z])\s*/$tr{startcode}$tr{lt}$tr{endcode}/g;818 s/\\rightarrow(?![a-zA-Z])\s*/$tr{startcode}--$tr{gt}$tr{endcode}/g;819 s/\\longleftrightarrow(?![a-zA-Z])\s*/$tr{startcode}$tr{lt}-----$tr{gt}$tr{endcode}/g;820 s/\\mapsto(?![a-zA-Z])\s*/$tr{startcode}|---$tr{gt}$tr{endcode}/g;821 s/ *\\geq?(?![a-zA-Z]) *([^ ])/ $tr{startcode}$tr{gt}=$tr{endcode} $1/g;822 s/ *\\leq?(?![a-zA-Z]) *([^ ])/ $tr{startcode}$tr{lt}=$tr{endcode} $1/g;823 s/ *\\gg?(?![a-zA-Z]) *([^ ])/ $tr{startcode}$tr{gt}$tr{gt}$tr{endcode} $1/g;824 s/ *\\ll?(?![a-zA-Z]) *([^ ])/ $tr{startcode}$tr{lt}$tr{ll}$tr{endcode} $1/g;825 826 s/\\(vers|PARIversion)(?![a-zA-Z])/$tr{startbold}$version$tr{endbold}/;827 s/\\([QRCFZNapdf])(?![a-zA-Z])/$tr{startbi}$1$tr{endbi}$2/g;828 s/\\([QRCFZN])\1(?![a-zA-Z])/$tr{startbi}$1$tr{endbi}$2/g;829 s/\\Bbb\b\s*(\w)/$tr{startbi}$1$tr{endbi}/g;830 831 s/\\([oc]br)/$tr{$1}/g;832 s/\\quo(?![a-zA-Z])/\"/g;833 s/(^|\s)\{(\w+)\}/$1$2/g;834 835 s/\\p(?![a-zA-Z])/$tr{startbold}p$tr{endbold}$1/g;836 s/\\point\{([^\}]*)\}/$tr{startbold}* $1$tr{endbold}/g;837 s/(\\bullet|\\item)/$tr{startbold}*$tr{endbold}/g;838 s/\\misctitle\{([^\}]*)\}/$tr{startbold}$1.$tr{endbold}/g;839 s/\\subsec\{([^\}]*)\}/$tr{startbold}$1.$tr{endbold}/g unless $to_pod;840 s/\\teb\{([^\}]*)\}/\\sidx{$1}$tr{startbold}$1$tr{endbold}/g;841 s/\\tet\{([^\}]*)\}/\\sidx{$1}$tr{startcode}$1$tr{endcode}/g;842 s/\\tev\{([^\}]*)\}/\\sidx{$1}$tr{startit}$1$tr{endit}/g;843 s/\\\$/$tr{ldollar}/g;844 s/\\kbd\s*\{\s*</\\kbd{$tr{lt}/g if $to_pod;845 s/\\kbd\s*\{\s*>/\\kbd{$tr{gt}/g if $to_pod;846 s/\\kbd\s*\{((?:[^{}]|\{[^{}]*\})*)\}/$tr{startcode}$1$tr{endcode}/g;847 848 s/\\key\{((?:[^{}]|\{[^{}]*\})*)\}/$tr{startbold}$1$tr{endbold}/g unless $refcard;849 s/\\goth\{((?:[^{}]|\{[^{}]*\})*)\}/$tr{startbold}$1$tr{endbold}/g;850 851 if ($refcard) {852 s/\\(?:key|li)\{((?:[^{}]+(?=[{}])|\{[^{}]*\})*)\}\s*\{\}[ \t]*\n/\n\n=back\n\n$1\n\n=over\n\n/g;853 s/\\(?:key|li)\{((?:[^{}]+(?=[{}])|\{[^{}]*\})*)\}\s*\{(([^{}]+(?=[{}])|\{[^{}]*\})*)\}/\n=item $tr{startcode}$2$tr{endcode}\n\n$1\n/g;854 }855 856 s/\\(floor|ceil|round|binom)\{/$1\{/g;857 s/\\(var|emph)\{([^\}]*)\}/$tr{startit}$2$tr{endit}/g;858 s/\\fl(?![a-zA-Z])/$tr{startit}flag$tr{endit}/g;859 s/\\b{([^}]*)}/$tr{startcode}\\$1$tr{endcode}/g;860 s/\\kbdsidx/\\sidx/g;861 s/\\sidx\{[^\}]*\}//g unless $to_pod;862 s/\\[a-zA-Z]*idx\{([^\}]*)\}/$1/g unless $to_pod;863 s/{\\text{(st|nd|th)}}/\\text{$1}/g;864 s/\^\\text{th}/-th/g;865 s/1\^\\text{st}/1st/g;866 s/2\^\\text{nd}/2nd/g;867 868 s/\\(text|hbox|Big)//g;869 s/^([ \t]+)\{ *\\(it|sl|bf|tt)\b/S<$1>{\\$2/gm;870 s/\{ *\\(it|sl) *(([^{}]+(?=[{}])|\{[^{}]*\})*)\}/$tr{startit}$2$tr{endit}/g;871 s/\{ *\\bf *(([^{}]+(?=[{}])|\{[^{}]*\})*)\}/$tr{startbold}$1$tr{endbold}/g;872 s/\{ *\\tt *(([^{}]+(?=[{}])|\{[^{}]*\})*)\}/$tr{startpodcode}$1$tr{endpodcode}/g;873 $seek=1 if (s/\\emph{ */$tr{startit}/g);874 if ($seek) { $seek=0 if (s/\}/$tr{endit}/) }875 s/\\(backslash|bs)\{(\w)\}/\\$2/g;876 s/\\(backslash|bs)(?![a-zA-Z]) */\\/g;877 878 s/\@com(.*)$/$tr{startcode}$1$tr{endcode}/g;879 880 # Last resort:881 s/\\kbd\s*\{(.*?)\}/$tr{startcode}$1$tr{endcode}/g;882 s/^([ \t]{3,})\Q$tr{startcode}\E(.*)\Q$tr{endcode}\E/$1$2/gmo if $to_pod;883 # Last resort:884 s/^([ \t]{3,})\Q$tr{startcode}\E(.*?)\Q$tr{endcode}\E/$1$2/gmso if $to_pod;885 # Remove leading spaces unless have embedded wrapped code:886 s/^[ \t]+//gm if $to_pod and /^\S/ and not /^[ \t]*\n[ \t]/m;887 s/\{ *\}//g; # empty args888 889 s{\Q$tr{startcode}\E((ftp|http)://.*?)\Q$tr{endcode}\E}{$tr{startlink}$1$tr{endlink}}go if $to_pod;890 $_;891 }892 893 sub presubst {894 chomp;895 if ($in_prog && /(\\|\@)eprog/)896 {897 $in_prog = 0;898 $_ = "\@2" . &code_subst($`) . $tr{endcode};899 push(@text, $_);900 $_ = &basic_subst($');901 }902 elsif ($in_prog || s/\\bprog(tabs.*)?//g)903 {904 $in_prog++; # = 1 on the \bprog line905 # code should start on the next line906 $_ = &code_subst($_);907 s/^/\@1$tr{startcode}/ if ($in_prog == 2);908 s/^/\@0/ if ($in_prog > 2);909 }910 else { $_ = &basic_subst($_); }911 push(@text, $_);912 }913 914 sub code_subst {915 my $in = shift;916 $in =~ s/\@dots\b/.../g;917 if ($in =~ /\@com(.*)/)918 {919 if ($to_pod) {920 $in = $` . &basic_subst($1) . code_subst($');921 } else {922 $in = $` . $tr{endcode} . &basic_subst($1) . $tr{startcode} . code_subst($');923 }924 }925 if ($in =~ /\@Ccom(.*)\*\//)926 {927 if ($to_pod) {928 $in = $` . &basic_subst($1) . "*/" . &code_subst($');929 } else {930 $in = $` . $tr{endcode} . &basic_subst($1) . $tr{startcode}931 . "*/" . &code_subst($');932 }933 }934 $in;935 }936 937 sub wrap_code {938 my $in = shift;939 $in =~ s/^[ \t]+$//mg;940 $in = &code_subst($in);941 $in =~ s/^(.)/ $1/mg;942 $in =~ s/\s*\Z//;943 # $in =~ s/\\kbd\{((?:[^{}]|\{[^{}]*\})*)\}/$1/g if $to_pod;944 $in =~ s/\$([^\$\n]*)\$/$1/g if $to_pod;945 "\n\n$in\n\n";946 }947 948 sub indexify {949 my $in = shift;950 $in =~ s/(^|and\s+)(\w+)(\$?\()/$1\\idx{$2}$3/g;951 $in =~ s/^(\\b\{\w+\})(?!\S)/\\idx{$1}/g;952 $in;953 }954 955 sub for_index {956 my $in = shift;957 1 while $in =~ s/\Q$tr{startcode}\E(.*?)\Q$tr{endcode}\E/$1/go;958 $in;959 }960 961 sub strip_trail { my $in = shift; $in =~ s/\s+\Z//; $in }962 963 # This subroutine works in paragraph mode964 sub TeXprint_topod {965 s/\A\s+//;966 s/^\\def\\.*\{\n.*\n\}//gm;967 s/\\def\\.*//g; # Repeated in basic_subst, as the next one968 s/(\{[\w\s]+)\{\}([\s\w]+\})/$1$2/g; # {rnf{}llgram}969 970 s/\\vbox\s*\{\s*\\bprog/\\bprog/g;971 s/([\\\@])eprog\s*\}/$1eprog/g;972 973 # \n is below to prevent splitting on ' '974 # We also remove ':'975 s/\\sectype\{\s*((?:[^{}]|\{[^{}]*\})*)\}\{\s*((?:[^{}]|\{[^{}]*\})*)\}/\\subsec{Type \\typ{$1} (${2}s)}\n\\sidx{$2}/g;976 s/\\sectypeindex\{\s*((?:[^{}]|\{[^{}]*\})*)\}\{\s*((?:[^{}]|\{[^{}]*\})*)\}\{\s*((?:[^{}]|\{[^{}]*\})*)\}/\\subsec{Type \\typ{$1} (${2}s)}\n\\sidx{$3}/g;977 s/\\sectypes\{\s*((?:[^{}]|\{[^{}]*\})*)\}\{\s*((?:[^{}]|\{[^{}]*\})*)\}\{\s*((?:[^{}]|\{[^{}]*\})*)\}/\\subsec{Type \\typ{$1} and \\typ{$1} (${3}s)}\n\\sidx{$3}/g;978 979 # Try to guard \label/\sidx (removing possible '.')980 # This somehow breaks index...981 # s/(\\(?:section|subsec(?:ref|idx|op)?(unix)?)\s*{(?:(?:[^{}]+(?=[{}])|{[^{}]+})+)})\.?\s*\\(label|sidx)/$1\n\\$2/;982 s/(\\(?:section|subsec(?:ref|idx|op)?)\s*{(?:(?:[^{}]+(?=[{}])|{[^{}]+})+)})\.?\s*\\(label|sidx)/$1\n\\$2/;983 984 # last if /\\subsec[\\{}ref]*[\\\${]$help[}\\\$]/o;985 s/\\chapter\s*{((?:[^{}]|\{[^{}]*\})*)}\s*/\n\n$tr{podleader}head1 NAME\n\nlibPARI - $1\n\n$tr{podleader}head1 DESCRIPTION\n\n/;986 s/\\appendix\s*{((?:[^{}]|\{[^{}]*\})*)}\s*/\n\n$tr{podleader}head1 NAME\n\nAppendix - $1\n\n$tr{podleader}head1 DESCRIPTION\n\n/;987 s/\\section\s*{((?:[^{}]|\{[^{}]*\})*)}\s*/"\n\n$tr{podleader}head1 " . indexify($1) . "\n\n"/e;988 989 # Try to delimit by :990 s/\\subsec(?:ref|idx|op)?(?:unix)?\s*{(([^{}]+(?=[{}])|{[^{}]+})+)}((\W*default:)?[^\n:]*):\s*/"\n\n$tr{podleader}head2 " . indexify("$1$3") . "\n\n"/e;991 s/\\subsec(?:ref|idx|op)?(?:unix)?\s*{(([^{}]+(?=[{}])|{[^{}]+})+)}([^\n:]*):\s*/"\n\n$tr{podleader}head2 " . indexify("$1$3") . "\n\n"/e;992 s/\\subsubsec(?:ref|idx|op)?(?:unix)?\s*{(([^{}]+(?=[{}])|{[^{}]+})+)}([^:]*):\s*/"\n\n$tr{podleader}item " . indexify("$1$3") . "\n\n"/e;993 # s/\\subsubsec\s*{(([^{}]+(?=[{}])|{[^{}]+})+)}\s*$/"\n\n$tr{podleader}item " . indexify("$1") . "\n\n"/e;994 s/\\subsubsec\s*{(([^{}]+(?=[{}])|{[^{}]+})+)}(.*)$/"\n\n$tr{podleader}item " . indexify("$1") . "$3\n\n"/me;995 # s/\\subseckbd\s*{(([^{}]+(?=[{}])|{[^{}]+})+)}:\s*/"\n\n$tr{podleader}head2 " . indexify("$1") . "\n\n"/e;996 s/\\subseckbd\s*{(([^{}]+(?=[{}])|{[^{}]+})+)}([^:]*):\s*/"\n\n$tr{podleader}head2 " . indexify("$1$3") . "\n\n"/e;997 # Try to delimit by ' '998 s/\\subsec(?:ref|idx|op)?(?:unix)?\s*{(([^{}]+(?=[{}])|{[^{}]+})+)}(\S*)\s+/"\n\n$tr{podleader}head2 " . indexify("$1$3") . "\n\n"/e;999 s/\\subsec(?:ref|title|idx|op)?(?:unix)?\s*{(([^{}]+(?=[{}])|{[^{}]*})+)}:?\s*/"\n\n$tr{podleader}head2 " . indexify("$1") . "\n\n"/e;1000 1001 # This is to skip preface in refcard:1002 /\Q$tr{podleader}\Ehead1|\\title(?![a-zA-Z])\s*\{/o and $seen_start = 11003 or $seen_start or return; # Skip now!1004 1005 s/\\title\s*\{([^{}\s]*)(\s+([^{}]*))?\}(\s*\\centerline\s*\{([^{}]*)\})?\s*/$tr{podleader}head1 NAME\n\n$1 - $3. $5\n\n/ and $seen_title++1006 unless $seen_title;1007 s/\\title\s*\{([^{}\s]*)(\s+([^{}]*))?\}(\s*\\centerline\s*\{([^{}]*)\})?\s*/\n\n/;1008 s/\\parskip.*/\n/g; # Up to end of the line1009 #s/([A-Z])\</$1 < /g; # Disambiguate with POD...1010 1011 # Duplicate removal of settabs, since they may contain \hskip1012 s/\\settabs.*//;1013 s/^[ \t]*\\hskip\s*\w+/$tr{nbrk}/g;1014 s/[ \t]*\\hskip\s*\w+/\n$tr{nbrk}/g;1015 1 while s/ \\1016 ( (small|big)skip | newcolumn | noindent1017 | (short)?copyrightnotice | hfill | break | par1018 | leavevmode | strut | endgroup | bye1019 )1020 (?![a-zA-Z])[ \t]*(\n\s*)1021 /\n\n/gx;1022 1023 s/'(\W)'/{\\tt '$1'}/g;1024 s/(\\\w+)(\\hbox)/$1 $2/g;1025 s/\\hbox\s*\{(?:\\it\b\s*)?((?:\\[\{\}]|[^{}]|\{[^{}]*\})*)\}/$1/g;1026 1027 # substitute non-verbatim code1028 $acc = '';1029 pos = 0;1030 while ( s/\A(.*?)\\bprog//s ) {1031 $acc .= basic_subst(strip_trail($1));1032 $_ .= <DOC> until /(\\|@)eprog\b/ or eof(DOC);1033 $acc .= wrap_code($1) if s/\A(?:tabs[^\n]*)?(?![a-zA-Z])[ \t]*\n?(.*?)(\\|@)eprog\s*//s;1034 }1035 $_ = $acc . basic_subst($_);1036 1037 # s/\\kbd\{/\{\\tt /g; # startcode1038 # s/\\typ\{/\{\\tt t_/g; # startcode1039 1040 s/\$\s*(\@\[startbi\][A-Z]\@\[endbi\])\s*\$/$1/g;1041 # s/\\p(\b|(?=[\d_]))/B<p>/g;1042 #s/\$\\bf\b\s*([^\$]+)\$/C<B<$1>>/g;1043 1044 @lines = split /^$/m, $_;1045 for (@lines) {1046 s/>/\@[gt]/g unless /^\n*[ \t]/;1047 s/</\@[lt]/g unless /^\n*[ \t]/;1048 }1049 $_ = join '', @lines;1050 1051 s/\$\$(.*?)\$\$\s*/\n\nS< >$tr{startcode}$1$tr{endcode}\n\n/gs;1052 s/\$([^\$]+)\$/$tr{startcode}$1$tr{endcode}/g;1053 1054 s/\\s(?:ref|idx){\s*([^{}]*)}/"X<" . for_index($1) . ">"/ge; #1055 s/\\(?:ref|idx){\s*([^{}]*)}/"X<" . for_index($1) . ">$1"/ge;1056 1057 # Conflict between different versions of PARI and refcard:1058 # s/\\(?:key|li)\s*{(.*)}\s*{(.+)}[ \t]*\n/\n\n=item C<$2>\n\n$1\n\n/msg;1059 # s/\\(?:key|li)\s*{(.*)}\s*{}[ \t]*\n/\n\n=back\n\n$1\n\n=over\n\n/mgs;1060 # s/\\(key|var)(?![a-zA-Z])\s*{(\w+)}/C<$2>/mg;1061 s/\\var\s*{X<(\w+)>(\w+)}/X<$1>$tr{startcode}$2$tr{endcode}/mg;1062 s/\\var\s*{f{}lag}/$tr{startcode}flag$tr{endcode}/mg;1063 1064 s/\\metax(?![a-zA-Z])\s*{(.*)}\s*{\s*(\w+)(?=C\<)(.*)}[ \t]*\n/\n\n=item C<L<$2>$3>\n\n$1\n\n/mg;1065 s/\\metax(?![a-zA-Z])\s*{(.*)}\s*{(.*)}[ \t]*\n/\n\n=item C<$2>\n\n$1\n\n/mg;1066 s/C\<\{\}=/C\<=/g;1067 s/\\fl(?![a-zA-Z])/I<flag>/g;1068 s/\\file(?![a-zA-Z])/F<file>/g;1069 s/\\(unix|emacs)\b\s*(\{?)(\s*\\(no)?indent)?\s*/X<\U$1>$2/g;1070 s/\A\\label\s*\{([\w:.-]*)\}([ \t]*\n\s*(?=[^\s=]))?/X<Label $1>/g;1071 s/\\label\s*\{([\w:.-]*)\}/X<Label $1>/g;1072 s/\\secref\s*\{([\w:.-]*)\}/L<Label $1>/g;1073 s/\\begin(double)?indentedkeys\s*/\n\n=over\n\n/g;1074 s/\\end(double)?indentedkeys\s*/\n\n=back\n\n/g;1075 # begin/end group appear in very special context only1076 s/\\begingroup\W.*//s; # Eat to the end1077 s/\n{3,}/\n\n/g;1078 s/\\subsec\{((?:[^{}]|\{[^{}]*\})+)\}\s*/\n\n=back\n\nB<$1>\n\n=over\n\n/g; # In refcard1079 # for refcard:1080 s/{\\rm(?![a-zA-Z])\s*([^{}]*)}/$1/g;1081 s/\\Z<>/\\/g; # Optimize for readability1082 1083 # Now replace the POD stuff1084 # Start with cosmetic stuff:1085 $in_code = 0;1086 s/(\@\[((start)|end)code\])/ ($3 ? $in_code++ : --$in_code) ? "" : $1 /ge;1087 1088 if ($dumb_pod) {1089 my @stack;1090 s /(\@\[((start)|end)(\w+)\])/1091 if ($3) { # Start1092 push @stack, $4;1093 (@stack > 1 ? "\@[end$stack[-2]]" : '') . $11094 } else { # end1095 pop @stack;1096 $1 . (@stack ? "\@[start$stack[-1]]" : '')1097 }1098 /ge1099 }1100 1 while s/\@\[start(\w+)\](\s*)\@\[end\1\]/$2/g;1101 1102 s/\@\[(\w+)\]/\@!$pr{$1}/g;1103 s/(\\\w+)\@!(\w)/$1 $2/g;1104 s/\@!//g;1105 s/\\([\{\}])/$1/g;1106 1107 # Normalize the spacing1108 s/\n{3,}/\n\n/;1109 s/\A([ \t]*\n)+//;1110 # Single label is not healthy...1111 print "\n" if $last_glued and /\A=/; # POD markup needs a new paragraph1112 $last_glued = s/((\A|\n\n)(X<[^<>]+>)+)[ \t]*\n\n/$1\n/;1113 1114 print;1115 }1116 1117 sub color {1118 my($a);1119 $_ = $_[0];1120 if (/[^0-9]/ || $_ < 0 || $_ > 17)1121 { print "bad color in gphelp: $_\n"; return ""; }1122 if ($_ < 8) { $a = $_ + 30; } else { $a = $_ + 82; }1123 return "\e[0;${a}m";1124 }1125 1126 sub TeXprint {1127 local($_) = $_[0];1128 s/\@\[obr\]/{/g;1129 s/\@\[cbr\]/}/g;1130 s/\@\[ouml\]/"o/g;1131 s/\@\[uuml\]/"u/g;1132 s/\@\[agrave\]/`a/g;1133 s/\@\[eacute\]/'e/g;1134 s/\@\[ldollar\]/\$/g;1135 s/\@\[end(bold|code|bcode|bi|it)\]/$ch/g;1136 s/\@\[start(bold|code|bcode|bi)\]/$cb/g;1137 s/\@\[startit\]/$cu/g;1138 s/\@\[(dollar|empty|endl?word|endpodcode|startl?word|startpodcode)\]//g;1139 s/\@\[pm\]/+\/-/g;1140 s/\@\[lt\]/</g;1141 s/\@\[gt\]/>/g;1142 s/\\([\{\}])/$1/g;1143 s/\@\[nbrk\]/ /g; print "$_\n";1144 }1145 1146 sub to_pod {1147 $to_pod = $ARGV[1];1148 inittr();1149 $parifile = $to_pod;1150 %compress = ('.gz', 'gzip -cd',1151 '.z', 'gzip -cd',1152 '.Z', 'zcat',1153 );1154 foreach $suffix (keys %compress) {1155 ($patt = $suffix) =~ s/(\W)/\\$1/;1156 if ($to_pod =~ /$patt$/) { $pipe = $compress{$suffix}; last; }1157 }1158 if ($pipe) {1159 open(DOC,"$pipe $parifile |") ||1160 die "Cannot open pipe $pipe from $parifile: $!, stopped";1161 } else {1162 open(DOC,$parifile) || die "Cannot find file $parifile: $!, stopped";1163 }1164 $/=''; # Paragraph mode1165 while (<DOC>) {1166 &TeXprint_topod();1167 }1168 if ($pipe) {1169 close(DOC) || die "Cannot close pipe `$pipe $parifile': $!, stopped";1170 } else {1171 close(DOC) || die "Cannot close file $parifile: $!, stopped";1172 }1173 cleanexit();1174 } -
new file patches/gphelp.in.patch
diff -r 1a3489aa9dd5 patches/gphelp.in.patch
- + 1 --- doc/gphelp.in (revision 12541) 2 +++ doc/gphelp.in (working copy) 3 @@ -51,6 +51,8 @@ 4 $xdviref = $ENV{GPXDVIREF} || "$xdvi -paper 29.7x21cm"; 5 $gzip = "gzip"; 6 $zcat = "$gzip -dc"; 7 +$bzip = "bzip2"; 8 +$bzcat = "$bzip -dc"; 9 $docdir = &get_docdir(); 10 11 $refcard = (@ARGV and $ARGV[-1] =~ /refcard/i); 12 @@ -112,6 +114,8 @@ 13 $cu .= $cu ? "\e[1m": "\e[4m"; 14 $cb .= "\e[1m"; 15 $detex = 1 if (!$ENV{DISPLAY}); 16 + # Disable TeX for Sage. 17 + $detex = 1; 18 } 19 20 sub get_docdir { 21 @@ -171,8 +175,14 @@ 22 die "Cannot find $docfile" 23 if (! -r "$docfile.z" && 24 ! -r "$docfile.gz" && 25 - ! -r "$docfile.Z"); 26 - $pipe = $zcat; 27 + ! -r "$docfile.Z" && 28 + ! -r "$docfile.bz2"); 29 + if (-r "$docfile.bz2") { 30 + $pipe = $bzcat; 31 + $docfile = "$docfile.bz2"; 32 + } else { 33 + $pipe = $zcat; 34 + } 35 } 36 } 37 -
deleted file patches/gphelp.patch
diff -r 1a3489aa9dd5 patches/gphelp.patch
+ - 1 --- ../src/doc/gphelp.in 2006-03-06 10:05:00.000000000 -08002 +++ gphelp.in 2007-12-26 21:35:54.000000000 -08003 @@ -51,6 +51,8 @@4 $xdviref = $ENV{GPXDVIREF} || "$xdvi -paper 29.7x21cm";5 $gzip = "gzip";6 $zcat = "$gzip -dc";7 +$bzip = "bzip2";8 +$bzcat = "$bzip -dc";9 $docdir = &get_docdir();10 11 $refcard = (@ARGV and $ARGV[-1] =~ /refcard/i);12 @@ -115,6 +117,8 @@13 $cu .= $cu ? "\e[1m": "\e[4m";14 $cb .= "\e[1m";15 $detex = 1 if (!$detex && !$ENV{DISPLAY});16 + # Disable TeX for Sage.17 + $detex = 1;18 }19 20 sub get_docdir {21 @@ -175,8 +179,14 @@22 die "Cannot find $docfile"23 if (! -r "$docfile.z" &&24 ! -r "$docfile.gz" &&25 - ! -r "$docfile.Z");26 - $pipe = $zcat;27 + ! -r "$docfile.Z" &&28 + ! -r "$docfile.bz2");29 + if (-r "$docfile.bz2") {30 + $pipe = $bzcat;31 + $docfile = "$docfile.bz2";32 + } else {33 + $pipe = $zcat;34 + }35 }36 }37 -
new file patches/init.c.patch
diff -r 1a3489aa9dd5 patches/init.c.patch
- + 1 --- src/language/init.c (revision 12541) 2 +++ src/language/init.c (working copy) 3 @@ -19,6 +19,7 @@ 4 /* */ 5 /*******************************************************************/ 6 #include <string.h> 7 +#include <stdlib.h> /* patch for Sage */ 8 #include "pari.h" 9 #include "paripriv.h" 10 #include "anal.h" 11 @@ -684,6 +685,7 @@ 12 static void 13 pari_exit(void) 14 { 15 + abort(); /* patch for Sage */ 16 fprintferr(" *** Error in the PARI system. End of program.\n"); 17 exit(1); 18 } -
new file patches/mp.c.patch
diff -r 1a3489aa9dd5 patches/mp.c.patch
- + 1 --- src/kernel/gmp/mp.c (revision 12541) 2 +++ src/kernel/gmp/mp.c (working copy) 3 @@ -56,7 +56,9 @@ 4 int pari_kernel_init(void) 5 { 6 /* Use pari_malloc instead of malloc */ 7 + /* patch for Sage 8 mp_set_memory_functions((void *(*)(size_t)) pari_malloc, gmp_realloc, gmp_free); 9 + */ 10 return 0; 11 } 12 -
deleted file patches/paripriv-Solaris.h
diff -r 1a3489aa9dd5 patches/paripriv-Solaris.h
+ - 1 /* $Id: paripriv.h 12463 2010-06-23 21:57:27Z bill $2 3 Copyright (C) 2004 The PARI group.4 5 This file is part of the PARI/GP package.6 7 PARI/GP is free software; you can redistribute it and/or modify it under the8 terms of the GNU General Public License as published by the Free Software9 Foundation. It is distributed in the hope that it will be useful, but WITHOUT10 ANY WARRANTY WHATSOEVER.11 12 Check the License for details. You should have received a copy of it, along13 with the package; see the file 'COPYING'. If not, write to the Free Software14 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */15 16 BEGINEXTERN17 /* hashtables */18 hashtable *hashstr_import_static(hashentry *e, ulong size);19 void hashstr_dbg(hashtable *h);20 21 /* for qsort */22 typedef int (*QSCOMP)(const void *, const void *);23 24 /* for (ulong*) GENs */25 typedef ulong *uGEN;26 #define ucoeff(a,i,j) (((uGEN*)(a))[j][i])27 #define ugel(a,i) ((uGEN*)(a))[i]28 29 /* swap */30 #define lswap(x,y) {long _z=x; x=y; y=_z;}31 #define pswap(x,y) {GEN *_z=x; x=y; y=_z;}32 #define swap(x,y) {GEN _z=x; x=y; y=_z;}33 #define dswap(x,y) { double _t=x; x=y; y=_t; }34 #define pdswap(x,y) { double* _t=x; x=y; y=_t; }35 #define swapspec(x,y, nx,ny) {swap(x,y); lswap(nx,ny);}36 37 /* unused */38 GEN ellheightoo(GEN e, GEN z, long prec);39 void ellprint(GEN e);40 41 /* generic */42 GEN trans_fix_arg(long *prec, GEN *s0, GEN *sig, pari_sp *av, GEN *res);43 GEN transc(GEN (*f) (GEN, long), GEN x, long prec);44 GEN sort_factor_pol(GEN y, int (*cmp)(GEN,GEN));45 46 /* loops */47 GEN incloop(GEN a);48 GEN resetloop(GEN a, GEN b);49 GEN setloop(GEN a);50 51 /* parser */52 void forpari(GEN a, GEN b, GEN node);53 void untilpari(GEN a, GEN b);54 void whilepari(GEN a, GEN b);55 GEN ifpari(GEN g, GEN a, GEN b);56 GEN andpari(GEN a, GEN b);57 GEN orpari(GEN a, GEN b);58 void ifpari_void(GEN g, GEN a, GEN b);59 GEN geval_gp(GEN x, GEN t);60 61 GEN gadde(GEN *x, GEN y);62 GEN gadd1e(GEN *x);63 GEN gdive(GEN *x, GEN y);64 GEN gdivente(GEN *x, GEN y);65 GEN gdivrounde(GEN *x, GEN y);66 GEN gmode(GEN *x, GEN y);67 GEN gmule(GEN *x, GEN y);68 GEN gshiftle(GEN *x, long n);69 GEN gshiftre(GEN *x, long n);70 GEN gstore(GEN *x, GEN y);71 GEN gsube(GEN *x, GEN y);72 GEN gsub1e(GEN *x);73 GEN gshift_right(GEN x, long n);74 75 GEN derivnum0(GEN a, GEN code, long prec);76 GEN derivnum1(GEN code, GEN args, long prec);77 GEN direuler0(GEN a, GEN b, GEN code, GEN c);78 GEN divsum(GEN num, GEN code);79 void fordiv(GEN a, GEN code);80 void forell(long a, long b, GEN code);81 void forprime(GEN a, GEN b, GEN code);82 void forstep(GEN a, GEN b, GEN s, GEN code);83 void forsubgroup(GEN cyc, GEN bound, GEN code);84 void forvec(GEN x, GEN code, long flag);85 GEN intcirc0(GEN a, GEN R, GEN code, GEN tab, long prec);86 GEN intfourcos0(GEN a, GEN b, GEN x, GEN code, GEN tab, long prec);87 GEN intfourexp0(GEN a, GEN b, GEN x, GEN code, GEN tab, long prec);88 GEN intfoursin0(GEN a, GEN b, GEN x, GEN code, GEN tab, long prec);89 GEN intfuncinit0(GEN a, GEN b, GEN code, long flag, long m, long prec);90 GEN intlaplaceinv0(GEN sig, GEN x, GEN code, GEN tab, long prec);91 GEN intmellininv0(GEN sig, GEN x, GEN code, GEN tab, long prec);92 GEN intnum0(GEN a, GEN b, GEN code, GEN tab, long prec);93 GEN intnuminit0(GEN a, GEN b, GEN tab, long prec);94 GEN intnuminitgen0(GEN a, GEN b, GEN code, long m, long flag, long prec);95 GEN intnumromb0(GEN a, GEN b, GEN code, long flag, long prec);96 GEN matrice(GEN nlig, GEN ncol, GEN code);97 GEN prodeuler0(GEN a, GEN b, GEN code, long prec);98 GEN prodinf0(GEN a, GEN code, long flag, long prec);99 GEN produit(GEN a, GEN b, GEN code, GEN x);100 GEN somme(GEN a, GEN b, GEN code, GEN x);101 GEN sumalt0(GEN a, GEN code,long flag, long prec);102 GEN suminf0(GEN a, GEN code, long prec);103 GEN sumnum0(GEN a, GEN sig, GEN code, GEN tab, long flag, long prec);104 GEN sumnumalt0(GEN a, GEN sig, GEN code, GEN tab, long flag, long prec);105 GEN sumnuminit0(GEN a, GEN tab, long sgn, long prec);106 GEN sumpos0(GEN a, GEN code, long flag,long prec);107 GEN vecteursmall(GEN nmax, GEN code);108 GEN vecteur(GEN nmax, GEN n);109 GEN vvecteur(GEN nmax, GEN n);110 GEN zbrent0(GEN a, GEN b, GEN code, long prec);111 112 long loop_break(void);113 114 /* multiprecision */115 GEN addrex01(GEN x);116 int lgcdii(ulong* d, ulong* d1, ulong* u, ulong* u1, ulong* v, ulong* v1, ulong vmax);117 ulong rgcduu(ulong d, ulong d1, ulong vmax, ulong* u, ulong* u1, ulong* v, ulong* v1, long *s);118 ulong xgcduu(ulong d, ulong d1, int f, ulong* v, ulong* v1, long *s);119 ulong xxgcduu(ulong d, ulong d1, int f, ulong* u, ulong* u1, ulong* v, ulong* v1, long *s);120 GEN divgunu(GEN x, ulong i);121 GEN divrunu(GEN x, ulong i);122 GEN init_remiimul(GEN M);123 GEN logagmcx(GEN q, long prec);124 GEN muliispec(GEN x, GEN y, long nx, long ny);125 GEN red_montgomery(GEN T, GEN N, ulong inv);126 GEN remiimul(GEN x, GEN y, GEN invy);127 GEN sqrispec(GEN x, long nx);128 GEN subrex01(GEN x);129 GEN modr_safe(GEN x, GEN y);130 ulong *convi(GEN x, long *l);131 132 int approx_0(GEN x, GEN y);133 GEN bernfrac_using_zeta(long n);134 int OK_bern(long nb, long prec);135 136 /* powers */137 GEN rpowuu(ulong a, ulong n, long prec);138 ulong u_pow10(int n);139 140 /* floats */141 double dabs(double s, double t);142 void dcxlog(double s, double t, double *a, double *b);143 double dnorm(double s, double t);144 double dbllog2(GEN z);145 ulong usqrtsafe(ulong a);146 147 /* "abs" routines for t_REAL ( disregard sign ) */148 int absrnz_egal1(GEN x);149 int absrnz_egal2n(GEN x);150 151 /* hnf */152 GEN hnfadd(GEN m,GEN p,GEN* ptdep,GEN* ptA,GEN* ptC,GEN extramat,GEN extraC);153 GEN hnfadd_i(GEN m,GEN p,GEN* ptdep,GEN* ptA,GEN* ptC,GEN extramat,GEN extraC);154 GEN hnfspec_i(GEN m,GEN p,GEN* ptdep,GEN* ptA,GEN* ptC,long k0);155 GEN hnfspec(GEN m,GEN p,GEN* ptdep,GEN* ptA,GEN* ptC,long k0);156 GEN mathnfspec(GEN x, GEN *ptperm, GEN *ptdep, GEN *ptB, GEN *ptC);157 158 GEN LLL_check_progress(GEN Bnorm, long n0, GEN m, int final, long *ti_LLL);159 GEN extendedgcd(GEN A);160 161 /* miscellaneous linear algebra */162 GEN imagecomplspec(GEN x, long *nlze);163 void rowselect_p(GEN A, GEN B, GEN p, long init);164 165 GEN dim1proj(GEN prh);166 GEN detcyc(GEN cyc, long *L);167 168 GEN merge_factor_i(GEN f, GEN g);169 170 /* integer factorization / discrete log */171 GEN coprime_part(GEN x, GEN f);172 ulong ucoprime_part(ulong x, ulong f);173 ulong is_kth_power(GEN x, ulong p, GEN *pt, byteptr d);174 long ifac_decomp_break(GEN n, long (*B)(GEN,GEN,GEN,GEN), GEN s, long hint);175 long ifac_moebius(GEN n, long hint);176 long ifac_issquarefree(GEN n, long hint);177 long ifac_omega(GEN n, long hint);178 long ifac_bigomega(GEN n, long hint);179 GEN ifac_totient(GEN n, long hint);180 GEN ifac_numdiv(GEN n, long hint);181 GEN ifac_sumdivk(GEN n, long k, long hint);182 GEN mpqs(GEN N);183 ulong gcduodd(ulong x, ulong y);184 long Z_lvalrem_stop(GEN n, ulong p, int *stop);185 long u_lvalrem_stop(ulong *n, ulong p, int *stop);186 187 /* Polynomials */188 /* a) Arithmetic/conversions */189 GEN addmulXn(GEN x, GEN y, long d);190 GEN addshiftpol(GEN x, GEN y, long d);191 GEN lift_if_rational(GEN x);192 GEN monomial(GEN a, long degpol, long v);193 GEN monomialcopy(GEN a, long degpol, long v);194 GEN mulmat_pol(GEN A, GEN x);195 GEN ser2pol_i(GEN x, long lx);196 GEN ser2rfrac_i(GEN x);197 GEN shiftpol_i(GEN x, long v);198 GEN swap_vars(GEN b0, long v);199 GEN RgX_recipspec_shallow(GEN x, long l, long n);200 201 /* b) Modular */202 GEN bezout_lift_fact(GEN T, GEN Tmod, GEN p, long e);203 GEN Kronecker_to_FpXQX(GEN z, GEN pol, GEN p);204 GEN FpX_quad_root(GEN x, GEN p, int unknown);205 long FpX_split_Berlekamp(GEN *t, GEN pp);206 GEN FqX_split_all(GEN z, GEN T, GEN p);207 long FqX_split_by_degree(GEN *pz, GEN u, GEN q, GEN T, GEN p);208 long FqX_split_deg1(GEN *pz, GEN u, GEN q, GEN T, GEN p);209 GEN FqX_split_roots(GEN z, GEN T, GEN p, GEN pol);210 GEN polsym_gen(GEN P, GEN y0, long n, GEN T, GEN N);211 GEN ZXQ_charpoly_sqf(GEN A, GEN B, long *lambda, long v);212 GEN ZX_disc_all(GEN,ulong);213 GEN ZX_resultant_all(GEN A, GEN B, GEN dB, ulong bound);214 /*215 Coment out the following two lines, as they cause problems on216 Solaris. I was originally going to do this on all platforms, not just217 Solaris, but I noticed there was already an altered partpriv-osx.h,218 so this modified version will only be copied over if using Solaris.219 GEN ZY_ZXY_resultant_all(GEN A, GEN B0, long *lambda, GEN *LPRS);220 */221 GEN RgX_gcd_simple(GEN x, GEN y);222 GEN RgX_extgcd_simple(GEN a, GEN b, GEN *pu, GEN *pv);223 GEN RgXQ_minpoly_naive(GEN y, GEN P);224 GEN lift_intern0(GEN x,long v);225 #define lift_intern(x) (lift_intern0((x),-1))226 227 /* c) factorization */228 double cauchy_bound(GEN p);229 GEN chk_factors_get(GEN lt, GEN famod, GEN c, GEN T, GEN N);230 long cmbf_maxK(long nb);231 GEN ZX_DDF(GEN x);232 GEN fact_from_DDF(GEN fa, GEN e, long n);233 GEN initgaloisborne(GEN T, GEN dn, long prec, GEN *pL, GEN *pprep, GEN *pdis);234 GEN logmax_modulus_bound(GEN p);235 GEN polint_i(GEN xa, GEN ya, GEN x, long n, GEN *ptdy);236 GEN quicktrace(GEN x, GEN sym);237 GEN special_pivot(GEN x);238 GEN vandermondeinversemod(GEN L, GEN T, GEN den, GEN mod);239 GEN ZX_monic_factorpadic(GEN f, GEN p, long prec);240 241 /* Finite field */242 243 enum { t_FF_FpXQ = 0, t_FF_Flxq = 1, t_FF_F2xq = 2 };244 245 /* for Buchall_param */246 enum { fupb_NONE, fupb_RELAT, fupb_LARGE, fupb_PRECI };247 248 /* Allocation / gerepile */249 void debug_stack(void);250 void fill_stack(void);251 void init_dalloc(void);252 double *dalloc(size_t n);253 void gerepilecoeffs2(pari_sp av, GEN x, int n, GEN y, int o);254 void minim_alloc(long n, double ***q, GEN *x, double **y, double **z, double **v);255 int pop_entree_block(entree *ep, long loc);256 int pop_val_if_newer(entree *ep, long loc);257 void gclone_refc(GEN x);258 259 /* Interfaces (GP, etc.) */260 pariFILE *pari_last_tmp_file();261 void print_errcontext(const char *msg, const char *s, const char *entry);262 void* get_stack(double fraction, long min);263 void init_graph(void);264 void free_graph(void);265 void initout(int initerr);266 void init80col(void);267 int pari_kernel_init(void);268 int pari_last_was_newline(void);269 void pari_set_last_newline(int last);270 void print_functions_hash(const char *s);271 void print_all_user_fun(int member);272 GEN readbin(const char *name, FILE *f, int *vector);273 void term_color(long c);274 const char *term_get_color(long c);275 int term_height(void);276 int term_width(void);277 void whatnow_new_syntax(const char *f, long n);278 /* gp_colors */279 void decode_color(long n, long *c);280 enum { c_ERR, c_HIST, c_PROMPT, c_INPUT, c_OUTPUT, c_HELP, c_TIME, c_LAST,281 c_NONE = 0xffffUL };282 extern GEN pari_colormap, pari_graphcolors;283 284 /* defaults */285 extern ulong precreal;286 287 /* history */288 typedef struct {289 GEN *res; /* array of previous results, FIFO */290 size_t size; /* # res */291 ulong total; /* # of results computed since big bang */292 } gp_hist;293 294 /* prettyprinter */295 typedef struct {296 pariFILE *file;297 char *cmd;298 } gp_pp;299 300 /* path */301 typedef struct {302 char *PATH;303 char **dirs;304 } gp_path;305 306 /* for output */307 typedef struct {308 char format; /* e,f,g */309 long sigd; /* -1 (all) or number of significant digits printed */310 int sp; /* 0 = suppress whitespace from output */311 int prettyp; /* output style: raw, prettyprint, etc */312 int TeXstyle;313 } pariout_t;314 315 void lim_lines_output(char *s, long n, long max);316 void gen_output(GEN x, pariout_t *T);317 318 void parsestate_reset(void);319 void parsestate_save(struct pari_parsestate *state);320 void parsestate_restore(struct pari_parsestate *state);321 322 void compilestate_reset(void);323 void compilestate_save(struct pari_compilestate *comp);324 void compilestate_restore(struct pari_compilestate *comp);325 326 void evalstate_clone(void);327 void evalstate_reset(void);328 void evalstate_restore(struct pari_evalstate *state);329 void evalstate_save(struct pari_evalstate *state);330 331 /* GP_DATA */332 typedef struct {333 gp_hist *hist;334 gp_pp *pp;335 gp_path *path;336 pariout_t *fmt;337 ulong flags, lim_lines;338 char *help, *prompt, *prompt_cont;339 pari_timer *T;340 } gp_data;341 /* GP_DATA->flags */342 /*343 344 Coment out the following two enum, as it causes problems on345 Solaris. I was originally going to do this on all platforms, not just346 Solaris, but I noticed there was already an altered partpriv-osx.h,347 so this modified version will only be copied over if using Solaris.348 enum { QUIET=1, TEST=2, SIMPLIFY=4, CHRONO=8, ECHO=16, STRICTMATCH=32,349 USE_READLINE=64, SECURE=128, EMACS=256, TEXMACS=512, BREAKLOOP=1024,350 RECOVER=2048};351 */352 353 extern gp_data *GP_DATA;354 355 typedef struct Buffer {356 char *buf;357 ulong len;358 jmp_buf env;359 } Buffer;360 Buffer *new_buffer(void);361 void delete_buffer(Buffer *b);362 void fix_buffer(Buffer *b, long newlbuf);363 364 typedef struct {365 const char *s; /* source */366 char *t, *end; /* target, last char read */367 int in_string, in_comment, more_input, wait_for_brace, downcase;368 Buffer *buf;369 } filtre_t;370 void init_filtre(filtre_t *F, Buffer *buf);371 char *filtre(const char *s, int flag);372 void check_filtre(filtre_t *F);373 374 gp_data *default_gp_data(void);375 GEN gp_history(gp_hist *H, long p, char *old, char *entry);376 377 void delete_dirs(gp_path *p);378 void gp_expand_path(gp_path *p);379 const char *pari_default_path(void);380 const char *expand_prompt(const char *prompt, filtre_t *F);381 382 typedef struct input_method {383 /* mandatory */384 char * (*fgets)(char *,int,FILE*);385 char * (*getline)(char**, int f, struct input_method*, filtre_t *F);386 int free; /* boolean: must we free the output of getline() ? */387 /* for interactive methods */388 const char *prompt, *prompt_cont;389 /* for non-interactive methods */390 FILE *file;391 } input_method;392 393 int input_loop(filtre_t *F, input_method *IM);394 char *file_input(char **s0, int junk, input_method *IM, filtre_t *F);395 char *file_getline(Buffer *b, char **s0, input_method *IM);396 397 /* By files */398 399 /* Flx.c */400 401 GEN FlxX_recipspec(GEN x, long l, long n, long vs);402 GEN FlxX_sub(GEN x, GEN y, ulong p);403 GEN FlxX_subspec(GEN x, GEN y, ulong p, long lx, long ly);404 GEN FlxX_swap(GEN x, long n, long ws);405 GEN zxX_to_Kronecker(GEN P, GEN Q);406 GEN zxX_to_Kronecker_spec(GEN P, long lp, GEN Q);407 GEN Flx_addshift(GEN x, GEN y, ulong p, long d);408 GEN Flx_addspec(GEN x, GEN y, ulong p, long lx, long ly);409 GEN Flx_even_odd_comb(GEN P, ulong u, ulong v, ulong p);410 GEN Flx_mulspec(GEN a, GEN b, ulong p, long na, long nb);411 GEN Flx_negspec(GEN x, ulong p, long l);412 GEN Flx_recipspec(GEN x, long l, long n);413 GEN Flx_sqrspec(GEN a, ulong p, long na);414 GEN Flx_subspec(GEN x, GEN y, ulong p, long lx, long ly);415 GEN Kronecker_to_FlxqX(GEN z, GEN T, ulong p);416 GEN FlxqX_invMontgomery(GEN T, GEN Q, ulong p);417 GEN FlxqX_mulspec(GEN x, GEN y, GEN T, ulong p, long lx, long ly);418 GEN FlxqX_rem_Montgomery(GEN x, GEN mg, GEN T, GEN Q, ulong p);419 420 /* Qfb.c */421 422 GEN redimagsl2(GEN q, GEN *U);423 GEN redrealsl2(GEN V);424 GEN redrealsl2step(GEN A);425 426 /* alglin1.c */427 typedef long (*pivot_fun)(GEN,GEN,long,GEN);428 GEN RgM_pivots(GEN x0, GEN data, long *rr, pivot_fun pivot);429 void vecselect_p(GEN A, GEN B, GEN p, long init, long lB);430 431 /* arith1.c */432 433 GEN bestappr_mod(GEN x, GEN A, GEN B);434 int is_gener_Fp(GEN x, GEN p, GEN p_1, GEN L);435 int is_gener_Fl(ulong x, ulong p, ulong p_1, GEN L);436 437 /* arith2.c */438 439 byteptr initprimes0(ulong maxnum, long *lenp, ulong *lastp);440 long set_optimize(long what, GEN g);441 442 /* base1.c */443 444 void nfbasic_add_disc(nfbasic_t *T);445 void nfbasic_init(GEN x, long flag, GEN fa, nfbasic_t *T);446 GEN nffromhnfbasis(GEN nf, GEN x);447 GEN nftohnfbasis(GEN nf, GEN x);448 449 /* base2.c */450 451 GEN gen_if_principal(GEN bnf, GEN x);452 int nfissquarefree(GEN nf, GEN x);453 GEN nfreducemodpr_i(GEN x, GEN prh);454 GEN polsymmodp(GEN g, GEN p);455 456 /* base3.c */457 458 void check_nfelt(GEN x, GEN *den);459 GEN zk_ei_mul(GEN nf, GEN x, long i);460 461 /* base4.c */462 463 void check_listpr(GEN x);464 GEN extideal_HNF_mul(GEN nf, GEN x, GEN y);465 GEN factor_norm(GEN x);466 GEN factorbackprime(GEN nf, GEN L, GEN e);467 long val_norm(GEN x, GEN p, long *vz);468 469 /* base5.c */470 471 GEN check_and_build_nfabs(GEN rnf);472 GEN check_and_build_norms(GEN rnf);473 GEN checkrnfeq(GEN x);474 475 /* bibli1.c */476 477 GEN plindep(GEN x);478 GEN pslq(GEN x);479 GEN pslqL2(GEN x);480 481 /* buch1.c */482 483 GEN form_to_ideal(GEN x);484 GEN qfbforms(GEN D);485 486 /* buch2.c */487 488 typedef struct GRHcheck_t { double cD, cN; } GRHcheck_t;489 void init_GRHcheck(GRHcheck_t *S, long N, long R1, double LOGD);490 int GRHok(GRHcheck_t *S, double L, double SA, double SB);491 GEN check_and_build_matal(GEN bnf);492 GEN extract_full_lattice(GEN x);493 GEN init_red_mod_units(GEN bnf, long prec);494 GEN isprincipalarch(GEN bnf, GEN col, GEN kNx, GEN e, GEN dx, long *pe);495 GEN red_mod_units(GEN col, GEN z);496 497 /* buch3.c */498 499 GEN minkowski_bound(GEN D, long N, long r2, long prec);500 int subgroup_conductor_ok(GEN H, GEN L);501 GEN subgrouplist_cond_sub(GEN bnr, GEN C, GEN bound);502 503 /* elliptic.c */504 505 GEN CM_CardEFp(GEN E, GEN p);506 GEN weipell0(GEN e, long prec, long PREC);507 508 /* ellsea.c */509 510 void pari_close_seadata(void);511 void pari_init_seadata(void);512 513 /* es.c */514 515 const char * eng_ord(long i);516 char * env_ok(const char *s);517 void killallfiles(void);518 pariFILE* newfile(FILE *f, const char *name, int type);519 int popinfile(void);520 GEN readobj(FILE *f, int *ptc);521 pariFILE* try_pipe(const char *cmd, int flag);522 void writeGEN(GEN x, FILE *f);523 void writenamedGEN(GEN x, const char *s, FILE *f);524 525 /* galconj.c */526 527 GEN galoiscosets(GEN O, GEN perm);528 long intheadlong(GEN x, GEN mod);529 long isomborne(GEN P, GEN den, GEN p);530 GEN listznstarelts(long m, long p);531 GEN matheadlong(GEN W, GEN mod);532 GEN matrixnorm(GEN M, long prec);533 GEN monomorphismlift(GEN P, GEN S, GEN Q, GEN p, long e);534 long polheadlong(GEN P, long n, GEN mod);535 GEN vandermondeinverseprep(GEN L);536 537 /* galois.c */538 539 GEN polgaloisnamesbig(long n, long k);540 541 /* gen1.c */542 543 int ff_poltype(GEN *x, GEN *p, GEN *pol);544 GEN gred_frac2(GEN x1, GEN x2);545 GEN gred_rfrac2(GEN x1, GEN x2);546 GEN gred_rfrac_simple(GEN n, GEN d);547 GEN mulcxI(GEN x);548 GEN mulcxmI(GEN x);549 GEN sqr_ser_part(GEN x, long l1, long l2);550 551 /* gen3.c */552 553 GEN gsubst_expr(GEN pol, GEN from, GEN to);554 GEN poltoser(GEN x, long v, long prec);555 GEN rfractoser(GEN x, long v, long prec);556 557 /* ifactor1.c */558 559 GEN ellfacteur(GEN n, int insist);560 long ifac_decomp(GEN n, long hint);561 GEN ifac_primary_factor(GEN *partial, long *exponent);562 void ifac_realloc(GEN *partial, GEN *where, long new_lg);563 GEN ifac_start(GEN n, long moebius, long hint);564 GEN pollardbrent(GEN n);565 ulong snextpr(ulong p, byteptr *d, long *rcn, long *q, long k);566 GEN squfof(GEN n);567 568 /* prime.c */569 570 long BPSW_psp_nosmalldiv(GEN N);571 int Fl_MR_Jaeschke(ulong n, long k);572 int MR_Jaeschke(GEN n, long k);573 int uisprime_nosmalldiv(ulong n);574 575 /* init.c */576 577 void err_recover(long numerr);578 void pari_init_defaults(void);579 void pari_init_stack(size_t size, size_t old);580 581 /* nffactor.c */582 583 int nfissplit(GEN nf, GEN x);584 585 /* perm.c */586 587 long cosets_perm_search(GEN C, GEN p);588 GEN group_export_GAP(GEN G);589 GEN group_export_MAGMA(GEN G);590 GEN perm_generate(GEN S, GEN H, long o);591 long perm_relorder(GEN p, GEN S);592 GEN perm_to_GAP(GEN p);593 GEN quotient_subgroup_lift(GEN C, GEN H, GEN S);594 595 /* polarit1.c */596 597 GEN F2x_Berlekamp_ker(GEN u);598 GEN Flx_Berlekamp_ker(GEN u, ulong p);599 GEN FpX_Berlekamp_ker(GEN u, GEN p);600 GEN FpX_factcantor(GEN f, GEN pp, long flag);601 GEN FqX_Berlekamp_ker(GEN u, GEN T, GEN q, GEN p);602 GEN FqX_rand(long d1, long v, GEN T, GEN p);603 long FqX_split_Berlekamp(GEN *t, GEN q, GEN T, GEN p);604 GEN Zp_appr(GEN f, GEN a);605 int cmp_padic(GEN x, GEN y);606 GEN factcantor0(GEN f, GEN pp, long flag);607 GEN trivfact(void);608 609 /* polarit2.c */610 611 GEN sylvestermatrix_i(GEN x, GEN y);612 613 /* QX_factor */614 615 GEN DDF_roots(GEN pol, GEN polp, GEN p);616 void factor_quad(GEN x, GEN res, long *ptcnt);617 long logint(GEN B, GEN y, GEN *ptq);618 619 /* FpX.c */620 621 GEN FpX_gcd_check(GEN x, GEN y, GEN p);622 623 /* polarit3.c */624 625 GEN Flm_Frobenius_pow(GEN M, long d, GEN T, ulong p);626 GEN FpM_Frobenius_pow(GEN M, long d, GEN T, GEN p);627 GEN FpXYQQ_pow(GEN x, GEN n, GEN S, GEN T, GEN p);628 GEN FpX_compositum(GEN A, GEN B, GEN p);629 GEN FpX_direct_compositum(GEN A, GEN B, GEN p);630 ulong ZX_ZXY_ResBound(GEN A, GEN B, GEN dB);631 GEN ffinit_Artin_Shreier(GEN ip, long l);632 GEN ffinit_rand(GEN p, long n);633 byteptr init_modular(ulong *p);634 GEN polint_triv(GEN xa, GEN ya);635 636 /* random.c */637 638 void pari_init_rand(void);639 640 /* rootpol.c */641 642 GEN FFT(GEN x, GEN Omega);643 GEN FFTinit(long k, long prec);644 645 /* subcyclo.c */646 647 GEN bnr_to_znstar(GEN bnr, long *complex);648 GEN galoiscyclo(long n, long v);649 GEN polsubcyclo_complex_bound(pari_sp ltop, GEN V, long prec);650 GEN polsubcyclo_complex_roots(long n, long real, long prec);651 GEN polsubcyclo_cyclic(long n, long d, long m, long z, long g, GEN powz, GEN le);652 GEN polsubcyclo_orbits(long n, GEN H, GEN O, GEN powz, GEN le);653 GEN polsubcyclo_roots(long n, GEN zl);654 GEN polsubcyclo_start(long n, long d, long o, GEN borne, long *ptr_val, long *ptr_l);655 GEN znstar_bits(long n, GEN H);656 long znstar_conductor(long n, GEN H);657 GEN znstar_coset_bits(long n, GEN H, long c);658 void znstar_coset_bits_inplace(long n, GEN H, GEN bits, long c);659 void znstar_coset_func(long n, GEN H, void (*func) (void *, long), void *data, long c);660 GEN znstar_cosets(long n, long phi_n, GEN H);661 GEN znstar_elts(long n, GEN H);662 GEN znstar_generate(long n, GEN V);663 GEN znstar_hnf(GEN Z, GEN M);664 GEN znstar_hnf_elts(GEN Z, GEN H);665 GEN znstar_hnf_generators(GEN Z, GEN M);666 GEN znstar_partial_bits(long n, GEN H, long d);667 GEN znstar_partial_coset_bits(long n, GEN H, long d, long c);668 void znstar_partial_coset_bits_inplace(long n, GEN H, GEN bits, long d, long c);669 void znstar_partial_coset_func(long n, GEN H, void (*func) (void *, long), void *data, long d, long c);670 GEN znstar_reduce_modulus(GEN H, long n);671 GEN znstar_small(GEN zn);672 673 /* trans1.c */674 675 void pari_init_floats(void);676 void pari_close_floats(void);677 GEN rootsof1complex(GEN n, long prec);678 GEN rootsof1padic(GEN n, GEN y);679 680 /* trans2.c */681 682 GEN cxpsi(GEN s0, long prec);683 double darg(double s, double t);684 685 /* trans3.c */686 687 GEN bernreal_using_zeta(long n, GEN iz, long prec);688 GEN czeta(GEN s0, long prec);689 GEN inv_szeta_euler(long n, double lba, long prec);690 GEN polylogd0(long m, GEN x, long flag, long prec);691 GEN twistpartialzeta(GEN q, long f, long c, GEN va, GEN cff);692 693 ENDEXTERN -
deleted file patches/paripriv-Solaris.h.patch
diff -r 1a3489aa9dd5 patches/paripriv-Solaris.h.patch
+ - 1 --- paripriv.h.orig Wed Oct 14 11:08:45 20092 +++ paripriv-Solaris.h Wed Oct 14 12:31:52 20093 @@ -255,8 +255,13 @@4 GEN ZX_disc_all(GEN,ulong);5 long ZX_get_prec(GEN x);6 GEN ZX_resultant_all(GEN A, GEN B, GEN dB, ulong bound);7 +/*8 +Coment out the following two lines, as they cause problems on9 +Solaris. I was originally going to do this on all platforms, not just10 +Solaris, but I noticed there was already an altered partpriv-osx.h,11 +so this modified version will only be copied over if using Solaris.12 GEN ZY_ZXY_resultant_all(GEN A, GEN B0, long *lambda, GEN *LPRS);13 -GEN ZY_ZXY_rnfequation(GEN A, GEN B0, long *lambda);14 +GEN ZY_ZXY_rnfequation(GEN A, GEN B0, long *lambda); */15 GEN RgXQ_u_pow(GEN x, ulong n, GEN T);16 GEN RgX_gcd_simple(GEN x, GEN y);17 GEN RgX_extgcd_simple(GEN a, GEN b, GEN *pu, GEN *pv);18 @@ -425,8 +430,15 @@19 pari_timer *T;20 } gp_data;21 /* GP_DATA->flags */22 +/*23 +24 +Coment out the following two enum, as it causes problems on25 +Solaris. I was originally going to do this on all platforms, not just26 +Solaris, but I noticed there was already an altered partpriv-osx.h,27 +so this modified version will only be copied over if using Solaris.28 enum { QUIET=1, TEST=2, SIMPLIFY=4, CHRONO=8, ECHO=16, STRICTMATCH=32,29 USE_READLINE=64, SECURE=128, EMACS=256, TEXMACS=512};30 +*/31 32 extern gp_data *GP_DATA;33 -
deleted file patches/paripriv-osx.h
diff -r 1a3489aa9dd5 patches/paripriv-osx.h
+ - 1 /* $Id: paripriv.h,v 1.60 2005/07/21 00:18:31 kb Exp $2 3 Copyright (C) 2004 The PARI group.4 5 This file is part of the PARI/GP package.6 7 PARI/GP is free software; you can redistribute it and/or modify it under the8 terms of the GNU General Public License as published by the Free Software9 Foundation. It is distributed in the hope that it will be useful, but WITHOUT10 ANY WARRANTY WHATSOEVER.11 12 Check the License for details. You should have received a copy of it, along13 with the package; see the file 'COPYING'. If not, write to the Free Software14 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */15 16 /* for qsort */17 typedef int (*QSCOMP)(const void *, const void *);18 19 /* swap */20 #define lswap(x,y) {long _z=x; x=y; y=_z;}21 #define pswap(x,y) {GEN *_z=x; x=y; y=_z;}22 #define swap(x,y) {GEN _z=x; x=y; y=_z;}23 #define dswap(x,y) { double _t=x; x=y; y=_t; }24 #define pdswap(x,y) { double* _t=x; x=y; y=_t; }25 #define swapspec(x,y, nx,ny) {swap(x,y); lswap(nx,ny);}26 27 /* */28 #define both_odd(x,y) ((x)&(y)&1)29 30 /* generic */31 GEN arith_proto(long f(GEN), GEN x, int do_error);32 GEN arith_proto2(long f(GEN,GEN), GEN x, GEN n);33 GEN arith_proto2gs(long f(GEN,long), GEN x, long y);34 GEN gassoc_proto(GEN f(GEN,GEN),GEN,GEN);35 GEN garith_proto(GEN f(GEN), GEN x, int do_error);36 GEN garith_proto2gs(GEN f(GEN,long), GEN x, long y);37 GEN trans_fix_arg(long *prec, GEN *s0, GEN *sig, pari_sp *av, GEN *res);38 GEN transc(GEN (*f) (GEN, long), GEN x, long prec);39 40 /* loops */41 GEN incloop(GEN a);42 GEN incpos(GEN a);43 GEN resetloop(GEN a, GEN b);44 GEN setloop(GEN a);45 46 /* multiprecision */47 GEN addrex01(GEN x);48 GEN addumului(ulong a, ulong b, GEN Y);49 void affr_fixlg(GEN z, GEN y);50 GEN cxnorm(GEN x);51 GEN quadnorm(GEN x);52 GEN divgsns(GEN x, long i);53 GEN divrsns(GEN x, long i);54 GEN init_remiimul(GEN M);55 ulong invrev(ulong b);56 GEN ishiftr_lg(GEN x, long lx, long n);57 GEN logagmcx(GEN q, long prec);58 GEN muliispec(GEN x, GEN y, long nx, long ny);59 GEN padic_to_Fp(GEN x, GEN Y);60 ulong padic_to_Fl(GEN x, ulong p);61 GEN red_montgomery(GEN T, GEN N, ulong inv);62 GEN remiimul(GEN x, GEN sy);63 GEN sqrispec(GEN x, long nx);64 GEN subrex01(GEN x);65 GEN mulcxI(GEN x);66 GEN mulcxmI(GEN x);67 68 int approx_0(GEN x, GEN y);69 GEN bernfrac_using_zeta(long n);70 int OK_bern(long nb, long prec);71 GEN padic_sqrtn(GEN x, GEN n, GEN *zetan);72 73 /* FIXME: adapt/use mpn_[lr]shift instead */74 #define shift_left(z2,z1,imin,imax,f, sh) {\75 register const ulong _m = BITS_IN_LONG - (sh);\76 shift_left2((z2),(z1),(imin),(imax),(f),(sh),(_m)); }77 78 #define shift_right(z2,z1,imin,imax,f, sh) {\79 register const ulong _m = BITS_IN_LONG - (sh);\80 shift_right2((z2),(z1),(imin),(imax),(f),(sh),(_m)); }81 82 /* powers */83 #define sqrs(b) mulss((b),(b))84 #define sqru(b) muluu((b),(b))85 GEN rpowuu(ulong a, ulong n, long prec);86 GEN powrshalf(GEN x, long s);87 GEN powrfrac(GEN x, long n, long d);88 ulong u_pow10(int n);89 90 /* floats */91 double dabs(double s, double t);92 long dblexpo(double x);93 ulong dblmantissa(double x);94 void dcxlog(double s, double t, double *a, double *b);95 double dnorm(double s, double t);96 double mylog2(GEN z);97 ulong usqrtsafe(ulong a);98 99 /* "abs" routines for t_REAL ( disregard sign ) */100 int absrnz_egal1(GEN x);101 int absrnz_egal2n(GEN x);102 GEN exp1r_abs(GEN x);103 GEN logagmr_abs(GEN q);104 GEN logr_abs(GEN x);105 GEN sqrtr_abs(GEN x);106 107 /* hnf */108 GEN gauss_triangle_i(GEN A, GEN B,GEN t);109 GEN hnfadd(GEN m,GEN p,GEN* ptdep,GEN* ptA,GEN* ptC,GEN extramat,GEN extraC);110 GEN hnfadd_i(GEN m,GEN p,GEN* ptdep,GEN* ptA,GEN* ptC,GEN extramat,GEN extraC);111 GEN hnfall_i(GEN A, GEN *ptB, long remove);112 GEN hnf_gauss(GEN A, GEN B);113 GEN hnf_invimage(GEN A, GEN b);114 GEN hnfmerge_get_1(GEN A, GEN B);115 GEN hnfperm_i(GEN A, GEN *ptU, GEN *ptperm);116 GEN hnfspec_i(long** m,GEN p,GEN* ptdep,GEN* ptA,GEN* ptC,long k0);117 GEN hnfspec(long** m,GEN p,GEN* ptdep,GEN* ptA,GEN* ptC,long k0);118 GEN idealhermite_aux(GEN nf, GEN x);119 GEN mathnfspec(GEN x, GEN *ptperm, GEN *ptdep, GEN *ptB, GEN *ptC);120 121 /* LLL */122 GEN lllint_fp_ip(GEN x, long D);123 GEN lllfp_marked(long *M, GEN x, long D, long flag, long prec, int gram);124 GEN lllint_marked(long *M, GEN x, long D, int g, GEN *h, GEN *f, GEN *B);125 GEN LLL_check_progress(GEN Bnorm, long n0, GEN m, int final, long *ti_LLL);126 GEN extendedgcd(GEN A);127 128 /* miscellaneous linear algebra */129 GEN diagonal_i(GEN x);130 GEN F2V_red_ip(GEN v);131 GEN gauss_realimag(GEN x, GEN y);132 GEN imagecomplspec(GEN x, long *nlze);133 GEN matqpascal(long n, GEN q);134 GEN R_from_QR(GEN x, long prec);135 void rowselect_p(GEN A, GEN B, GEN p, long init);136 GEN split_realimag(GEN x, long r1, long r2);137 GEN sqred1_from_QR(GEN x, long prec);138 GEN supnorm(GEN L, long prec);139 GEN znstar_hnf_elts(GEN Z, GEN H);140 GEN ZV_lincomb(GEN u, GEN v, GEN X, GEN Y);141 GEN vec_setconst(GEN v, GEN x);142 GEN vec_const(long n, GEN x);143 GEN col_const(long n, GEN x);144 145 GEN GS_norms(GEN B, long prec);146 GEN dim1proj(GEN prh);147 GEN detcyc(GEN cyc, long *L);148 GEN close_modinvertible(GEN x, GEN y);149 GEN colreducemodHNF(GEN x, GEN y, GEN *Q);150 GEN col_to_ff(GEN x, long v);151 152 /* famat */153 GEN factorback_i(GEN fa, GEN e, GEN nf, int red);154 GEN factorbackprime(GEN nf, GEN L, GEN e);155 GEN famat_inv(GEN f);156 GEN famat_makecoprime(GEN nf, GEN g, GEN e, GEN pr, GEN prk, GEN EX);157 GEN famat_mul(GEN f, GEN g);158 GEN famat_mul(GEN f, GEN g);159 GEN famat_pow(GEN f, GEN n);160 GEN famat_reduce(GEN fa);161 GEN famat_to_arch(GEN nf, GEN fa, long prec);162 GEN famat_to_nf_modideal_coprime(GEN nf, GEN g, GEN e, GEN id, GEN EX);163 GEN famat_to_nf_modidele(GEN nf, GEN g, GEN e, GEN bid);164 GEN famat_to_nf_modidele(GEN nf, GEN g, GEN e, GEN bid);165 GEN merge_factor_i(GEN f, GEN g);166 GEN to_famat_all(GEN x, GEN y);167 GEN to_famat(GEN g, GEN e);168 GEN trivfact(void);169 GEN vconcat(GEN Q1, GEN Q2);170 171 /* integer factorization / discrete log */172 int BSW_isprime(GEN x);173 int BSW_isprime_small(GEN x);174 GEN coprime_part(GEN x, GEN f);175 GEN decomp_limit(GEN n, GEN limit);176 GEN Fp_PHlog(GEN a, GEN g, GEN p, GEN ord);177 GEN Fp_shanks(GEN x,GEN g0,GEN p, GEN q);178 ulong is_kth_power(GEN x, ulong p, GEN *pt, byteptr d);179 long ifac_decomp_break(GEN n, long (*B)(GEN,GEN,GEN,GEN), GEN s, long hint);180 int miller(GEN n, long k);181 GEN mpqs(GEN N);182 ulong ucarrecomplet(ulong A);183 ulong ugcd(ulong x, ulong y);184 long Z_lvalrem_stop(GEN n, ulong p, int *stop);185 long Z_issquarefree(GEN x);186 187 /* quadratic forms, quadratic numbers */188 long cornacchia(GEN d, GEN p, GEN *px, GEN *py);189 long cornacchia2(GEN d, GEN p, GEN *px, GEN *py);190 GEN primeform_u(GEN x, ulong p);191 GEN qf_disc(GEN x);192 void qfb_comp(GEN z,GEN x,GEN y);193 GEN qfr_to_qfr5(GEN x, long prec);194 GEN qfr3_comp(GEN x, GEN y, GEN D, GEN isqrtD);195 GEN qfr3_pow(GEN x, GEN n, GEN D, GEN isqrtD);196 GEN qfr3_red(GEN x, GEN D, GEN isqrtD);197 GEN qfr3_rho(GEN x, GEN D, GEN isqrtD);198 GEN qfr3_to_qfr(GEN x, GEN z);199 GEN qfr5_dist(GEN e, GEN d, long prec);200 GEN qfr5_comp(GEN x, GEN y, GEN D, GEN sqrtD, GEN isqrtD);201 GEN qfr5_pow(GEN x, GEN n, GEN D, GEN sqrtD, GEN isqrtD);202 GEN qfr5_red(GEN x, GEN D, GEN sqrtD, GEN isqrtD);203 GEN qfr5_rho(GEN x, GEN D, GEN sqrtD, GEN isqrtD);204 GEN qfr_pow(GEN x, GEN n);205 GEN qfr_unit(GEN x);206 GEN qfi_unit(GEN x);207 GEN quad_polmod_conj(GEN x, GEN y);208 GEN quad_polmod_norm(GEN x, GEN y);209 210 /* Polynomials */211 /* a) Arithmetic/conversions */212 GEN addmulXn(GEN x, GEN y, long d);213 GEN addshiftpol(GEN x, GEN y, long d);214 GEN fix_rfrac_if_pol(GEN x, GEN y);215 GEN gmulXn(GEN x, long d);216 GEN lift_if_rational(GEN x);217 GEN monomial(GEN a, int degpol, int v);218 GEN mulmat_pol(GEN A, GEN x);219 long polegal_spec(GEN x, GEN y);220 GEN polrecip_i(GEN x);221 GEN pol_to_monic(GEN pol, GEN *lead);222 GEN revpol(GEN x);223 GEN ser_to_pol_i(GEN x, long lx);224 GEN shiftpol_i(GEN x, long v);225 GEN swap_vars(GEN b0, long v);226 GEN to_polmod(GEN x, GEN mod);227 GEN TR_pol(GEN P, GEN c);228 229 /* b) Modular */230 GEN bezout_lift_fact(GEN T, GEN Tmod, GEN p, long e);231 GEN caractducos(GEN p, GEN x, int v);232 GEN FpXQX_from_Kronecker(GEN z, GEN pol, GEN p);233 GEN FpX_quad_root(GEN x, GEN p, int unknown);234 long FpX_split_Berlekamp(GEN *t, GEN pp);235 long FqX_is_squarefree(GEN P, GEN T, GEN p);236 GEN FqX_split_all(GEN z, GEN T, GEN p);237 long FqX_split_by_degree(GEN *pz, GEN u, GEN q, GEN T, GEN p);238 long FqX_split_deg1(GEN *pz, GEN u, GEN q, GEN T, GEN p);239 GEN FqX_split_roots(GEN z, GEN T, GEN p, GEN pol);240 GEN nfgcd(GEN P, GEN Q, GEN nf, GEN den);241 GEN polratlift(GEN P, GEN mod, GEN amax, GEN bmax, GEN denom);242 GEN polsym_gen(GEN P, GEN y0, long n, GEN T, GEN N);243 GEN ZX_caract_sqf(GEN A, GEN B, long *lambda, long v);244 GEN ZX_disc_all(GEN,ulong);245 long ZX_get_prec(GEN x);246 GEN ZX_resultant_all(GEN A, GEN B, GEN dB, ulong bound);247 /* GEN ZY_ZXY_resultant_all(GEN A, GEN B0, long *lambda, GEN *LPRS);248 GEN ZY_ZXY_resultant(GEN A, GEN B0, long *lambda);249 */250 GEN RgXQ_u_pow(GEN x, ulong n, GEN T);251 GEN RgX_gcd_simple(GEN x, GEN y);252 GEN RgX_extgcd_simple(GEN a, GEN b, GEN *pu, GEN *pv);253 254 /* b') Chinese Remainder Theorem */255 GEN ZM_init_CRT(GEN Hp, ulong p);256 int ZM_incremental_CRT(GEN H, GEN Hp, GEN q, GEN qp, ulong p);257 258 /* c) factorization */259 double cauchy_bound(GEN p);260 GEN chk_factors_get(GEN lt, GEN famod, GEN c, GEN T, GEN N);261 int cmbf_precs(GEN q, GEN A, GEN B, long *a, long *b, GEN *qa, GEN *qb);262 GEN ZX_DDF(GEN x, long hint);263 GEN fact_from_DDF(GEN fa, GEN e, long n);264 GEN initgaloisborne(GEN T, GEN dn, long prec, GEN *pL, GEN *pprep, GEN *pdis);265 GEN logmax_modulus_bound(GEN p);266 GEN polint_i(GEN xa, GEN ya, GEN x, long n, GEN *ptdy);267 GEN quicktrace(GEN x, GEN sym);268 GEN roots_to_pol_intern(GEN L, GEN a, long v, int plus);269 GEN roots_to_pol_r1r2(GEN a, long r1, long v);270 GEN special_pivot(GEN x);271 GEN vandermondeinverse(GEN L, GEN T, GEN den, GEN prep);272 GEN vandermondeinversemod(GEN L, GEN T, GEN den, GEN mod);273 GEN ZX_squff(GEN f, GEN *ex);274 GEN ZX_monic_factorpadic(GEN f, GEN p, long prec);275 276 /* Number fields */277 GEN arch_mul(GEN x, GEN y);278 GEN archstar_full_rk(GEN x, GEN bas, GEN v, GEN gen);279 GEN bnrGetSurj(GEN bnr1, GEN bnr2);280 GEN check_and_build_cycgen(GEN bnf);281 double check_bach(double cbach, double B);282 GEN _checkbnf(GEN bnf);283 GEN _checknf(GEN nf);284 void check_ZKmodule(GEN x, char *s);285 void dbg_rel(long s, GEN col);286 GEN element_mulidid(GEN nf, long i, long j);287 GEN element_powid_mod_p(GEN nf, long I, GEN n, GEN p);288 GEN eltabstorel(GEN x, GEN T, GEN pol, GEN k);289 GEN eltmulid_get_table(GEN nf, long i);290 GEN eltreltoabs(GEN rnfeq, GEN x);291 GEN galoisbig(GEN x, long prec);292 GEN get_arch(GEN nf,GEN x,long prec);293 GEN get_arch_real(GEN nf,GEN x,GEN *emb,long prec);294 GEN get_bas_den(GEN bas);295 GEN get_hnfid(GEN nf, GEN x);296 GEN get_mul_table(GEN x,GEN bas,GEN invbas);297 GEN get_nfindex(GEN bas);298 GEN get_proj_modT(GEN basis, GEN T, GEN p);299 GEN get_roots(GEN x,long r1,long prec);300 GEN get_theta_abstorel(GEN T, GEN pol, GEN k);301 GEN idealaddtoone_i(GEN nf, GEN x, GEN y);302 GEN idealcoprime_fact(GEN nf, GEN x, GEN fy);303 GEN idealhermite_aux(GEN nf, GEN x);304 GEN idealsqrtn(GEN nf, GEN x, GEN gn, int strict);305 GEN init_unif_mod_fZ(GEN L);306 GEN init_units(GEN BNF);307 long int_elt_val(GEN nf, GEN x, GEN p, GEN bp, GEN *t);308 GEN isprincipalfact(GEN bnf,GEN P, GEN e, GEN C, long flag);309 GEN make_integral(GEN nf, GEN L0, GEN f, GEN *listpr);310 GEN maxord_i(GEN p, GEN f, long mf, GEN w, long flag);311 GEN modprM(GEN z, GEN nf,GEN modpr);312 GEN modprV(GEN z, GEN nf,GEN modpr);313 GEN modprX(GEN x, GEN nf,GEN modpr);314 GEN nfpol_to_Flx(GEN nf, GEN pol, ulong *ptp);315 GEN nfreducemodideal_i(GEN x0,GEN ideal);316 GEN nfrootsall_and_pr(GEN nf, GEN pol);317 GEN norm_by_embed(long r1, GEN x);318 GEN perm_to_arch(GEN nf, GEN archp);319 GEN pidealprimeinv(GEN nf, GEN x);320 GEN primedec_apply_kummer(GEN nf,GEN pol,long e,GEN p);321 GEN prodid(GEN nf, GEN I);322 GEN pr_norm(GEN pr);323 GEN quadhilbertreal(GEN D, long prec);324 GEN rnfallbase(GEN nf, GEN pol, GEN *pD, GEN *pd, GEN *pfi);325 GEN _rnfequation(GEN A, GEN B, long *pk, GEN *pLPRS);326 GEN special_anti_uniformizer(GEN nf, GEN pr);327 GEN sqr_by_tab(GEN tab, GEN x);328 GEN subgroupcondlist(GEN cyc, GEN bound, GEN listKer);329 GEN T2_from_embed_norm(GEN x, long r1);330 void testprimes(GEN bnf, ulong bound);331 GEN to_Fp_simple(GEN nf, GEN x, GEN ffproj);332 GEN unif_mod_fZ(GEN pr, GEN F);333 GEN unnf_minus_x(GEN x);334 void wr_rel(GEN col);335 GEN zideallog_sgn(GEN nf, GEN x, GEN sgn, GEN bid);336 GEN zlog_units(GEN nf, GEN U, GEN sgnU, GEN bid);337 GEN zlog_units_noarch(GEN nf, GEN U, GEN bid);338 GEN zsign_from_logarch(GEN Larch, GEN invpi, GEN archp);339 340 /* Dedekind zeta */341 GEN zeta_get_limx(long r1, long r2, long bit);342 long zeta_get_i0(long r1, long r2, long bit, GEN limx);343 long zeta_get_N0(GEN C, GEN limx);344 345 346 /* Allocation / gerepile */347 void init_dalloc();348 double *dalloc(size_t n);349 void gerepilecoeffs2(pari_sp av, GEN x, int n, GEN y, int o);350 void minim_alloc(long n, double ***q, GEN *x, double **y, double **z, double **v);351 int pop_entree_bloc(entree *ep, long loc);352 int pop_val_if_newer(entree *ep, long loc);353 354 /* Interfaces (GP, etc.) */355 void errcontext(char *msg, char *s, char *entry);356 void free_graph(void);357 GEN geni(void);358 void* get_stack(double,int);359 GEN gpreadseq(char *c, int strict);360 void init_defaults(int force);361 void init_graph(void);362 void initout(int initerr);363 char* itostr(GEN x, int minus);364 void kill_from_hashlist(entree *ep, long n);365 void member_err(char *s);366 int pari_kernel_init(void);367 void pari_sig_init(void (*f)(int));368 void print_functions_hash(const char *s);369 void print_fun_list(char **matches, int nbli);370 void print_user_fun(entree *ep);371 void print_user_member(entree *ep);372 void print_all_user_fun(void);373 void print_all_user_member(void);374 int term_width(void);375 void texmacs_completion(char *s, long pos);376 void var_make_safe();377 int whatnow(char *s, int flag);378 void whatnow_new_syntax(char *f, long n);379 380 /* defaults */381 #define is_default(s) setdefault((s),"",d_EXISTS) == gen_1382 enum { d_SILENT, d_ACKNOWLEDGE, d_INITRC, d_RETURN, d_EXISTS };383 extern ulong prec;384 385 GEN sd_TeXstyle(const char *v, int flag);386 GEN sd_colors(char *v, int flag);387 GEN sd_compatible(const char *v, int flag);388 GEN sd_datadir(char *v, int flag);389 GEN sd_debug(const char *v, int flag);390 GEN sd_debugfiles(const char *v, int flag);391 GEN sd_debugmem(const char *v, int flag);392 GEN sd_echo(const char *v, int flag);393 GEN sd_factor_add_primes(char *v, int flag);394 GEN sd_filename(const char *v, int flag, char *s, char **f);395 GEN sd_format(const char *v, int flag);396 GEN sd_help(char *v, int flag);397 GEN sd_histsize(const char *v, int flag);398 GEN sd_lines(const char *v, int flag);399 GEN sd_log(const char *v, int flag);400 GEN sd_logfile(const char *v, int flag);401 GEN sd_new_galois_format(char *v, int flag);402 GEN sd_output(const char *v, int flag);403 GEN sd_parisize(const char *v, int flag);404 GEN sd_path(char *v, int flag);405 GEN sd_prettyprinter(char *v, int flag);406 GEN sd_primelimit(const char *v, int flag);407 GEN sd_prompt(const char *v, int flag);408 GEN sd_prompt_cont(const char *v, int flag);409 GEN sd_psfile(const char *v, int flag);410 GEN sd_realprecision(const char *v, int flag);411 GEN sd_rl(const char *v, int flag);412 GEN sd_secure(const char *v, int flag);413 GEN sd_seriesprecision(const char *v, int flag);414 GEN sd_simplify(const char *v, int flag);415 GEN sd_strictmatch(const char *v, int flag);416 GEN sd_timer(const char *v, int flag);417 GEN setdefault(const char *s, const char *v, int flag);418 419 /* history */420 typedef struct {421 GEN *res; /* array of previous results, FIFO */422 size_t size; /* # res */423 ulong total; /* # of results computed since big bang */424 } gp_hist;425 426 /* prettyprinter */427 typedef struct {428 pariFILE *file;429 char *cmd;430 } gp_pp;431 432 /* path */433 typedef struct {434 char *PATH;435 char **dirs;436 } gp_path;437 438 /* for output */439 typedef struct {440 char format; /* e,f,g */441 long fieldw; /* 0 (ignored) or field width */442 long sigd; /* -1 (all) or number of significant digits printed */443 int sp; /* 0 = suppress whitespace from output */444 int prettyp; /* output style: raw, prettyprint, etc */445 int TeXstyle;446 } pariout_t;447 448 char *GENtostr0(GEN x, pariout_t *T, void (*do_out)(GEN, pariout_t*));449 void lim_lines_output(GEN z, pariout_t *fmt, long n, long max);450 void gen_output(GEN x, pariout_t *T);451 452 /* GP_DATA */453 typedef struct {454 ulong primelimit;455 jmp_buf env;456 gp_hist *hist;457 gp_pp *pp;458 gp_path *path;459 pariout_t *fmt;460 ulong flags, lim_lines;461 char *help, *prompt, *prompt_cont;462 pari_timer *T;463 } gp_data;464 /* GP_DATA->flags */465 /* enum { QUIET=1, TEST=2, SIMPLIFY=4, CHRONO=8, ECHO=16, STRICTMATCH=32,466 USE_READLINE=64, SECURE=128, EMACS=256, TEXMACS=512};467 */468 469 extern gp_data *GP_DATA;470 471 typedef struct Buffer {472 char *buf;473 ulong len;474 jmp_buf env;475 } Buffer;476 Buffer *new_buffer(void);477 void delete_buffer(Buffer *b);478 void fix_buffer(Buffer *b, long newlbuf);479 480 typedef struct {481 char *s, *t, *end; /* source, target, last char read */482 int in_string, in_comment, more_input, wait_for_brace, downcase;483 Buffer *buf;484 } filtre_t;485 void init_filtre(filtre_t *F, Buffer *buf);486 char *filtre(char *s, int flag);487 void check_filtre(filtre_t *F);488 489 gp_data *default_gp_data(void);490 char *color_prompt(char *prompt);491 GEN gp_history(gp_hist *H, long p, char *old, char *entry);492 GEN set_hist_entry(gp_hist *H, GEN x);493 494 void delete_dirs(gp_path *p);495 void gp_expand_path(gp_path *p);496 const char *pari_default_path();497 char *expand_prompt(char *prompt, filtre_t *F);498 499 typedef struct input_method {500 /* mandatory */501 char * (*fgets)(char *,int,FILE*);502 char * (*getline)(char**, int f, struct input_method*, filtre_t *F);503 int free; /* boolean: must we free the output of getline() ? */504 /* for interactive methods */505 char *prompt, *prompt_cont;506 /* for non-interactive methods */507 FILE *file;508 } input_method;509 510 int input_loop(filtre_t *F, input_method *IM);511 char *file_input(char **s0, int junk, input_method *IM, filtre_t *F); -
deleted file patches/paripriv-osx.patch
diff -r 1a3489aa9dd5 patches/paripriv-osx.patch
+ - 1 --- ../src/src/headers/paripriv.h 2007-03-29 01:58:00.000000000 -07002 +++ paripriv-osx.h 2007-12-26 21:35:54.000000000 -08003 @@ -1,4 +1,4 @@4 -/* $Id: paripriv.h,v 1.106.2.2 2007/03/29 08:58:00 kb Exp $5 +/* $Id: paripriv.h,v 1.60 2005/07/21 00:18:31 kb Exp $6 7 Copyright (C) 2004 The PARI group.8 9 @@ -13,8 +13,6 @@10 with the package; see the file 'COPYING'. If not, write to the Free Software11 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */12 13 -BEGINEXTERN14 -15 /* for qsort */16 typedef int (*QSCOMP)(const void *, const void *);17 18 @@ -29,11 +27,6 @@19 /* */20 #define both_odd(x,y) ((x)&(y)&1)21 22 -/* unused */23 -GEN ellheightoo(GEN e, GEN z, long prec);24 -void ellprint(GEN e);25 -GEN mpinv(GEN b);26 -27 /* generic */28 GEN arith_proto(long f(GEN), GEN x, int do_error);29 GEN arith_proto2(long f(GEN,GEN), GEN x, GEN n);30 @@ -43,30 +36,23 @@31 GEN garith_proto2gs(GEN f(GEN,long), GEN x, long y);32 GEN trans_fix_arg(long *prec, GEN *s0, GEN *sig, pari_sp *av, GEN *res);33 GEN transc(GEN (*f) (GEN, long), GEN x, long prec);34 -GEN sort_factor(GEN y, int (*cmp)(GEN,GEN));35 -GEN sort_factor_gen(GEN y, int (*cmp)(GEN,GEN));36 -GEN sort_factor_gen_aux(GEN y, void *data, int (*cmp)(void *,GEN,GEN));37 -GEN sort_vecpol(GEN a, int (*cmp)(GEN,GEN));38 39 /* loops */40 GEN incloop(GEN a);41 +GEN incpos(GEN a);42 GEN resetloop(GEN a, GEN b);43 GEN setloop(GEN a);44 45 /* multiprecision */46 -GEN icopy_spec(GEN x, long nx);47 GEN addrex01(GEN x);48 GEN addumului(ulong a, ulong b, GEN Y);49 void affr_fixlg(GEN z, GEN y);50 GEN cxnorm(GEN x);51 -int lgcdii(ulong* d, ulong* d1, ulong* u, ulong* u1, ulong* v, ulong* v1, ulong vmax);52 -ulong rgcduu(ulong d, ulong d1, ulong vmax, ulong* u, ulong* u1, ulong* v, ulong* v1, long *s);53 -ulong xgcduu(ulong d, ulong d1, int f, ulong* v, ulong* v1, long *s);54 GEN quadnorm(GEN x);55 -ulong xxgcduu(ulong d, ulong d1, int f, ulong* u, ulong* u1, ulong* v, ulong* v1, long *s);56 GEN divgsns(GEN x, long i);57 GEN divrsns(GEN x, long i);58 GEN init_remiimul(GEN M);59 +ulong invrev(ulong b);60 GEN ishiftr_lg(GEN x, long lx, long n);61 GEN logagmcx(GEN q, long prec);62 GEN muliispec(GEN x, GEN y, long nx, long ny);63 @@ -82,6 +68,7 @@64 int approx_0(GEN x, GEN y);65 GEN bernfrac_using_zeta(long n);66 int OK_bern(long nb, long prec);67 +GEN padic_sqrtn(GEN x, GEN n, GEN *zetan);68 69 /* FIXME: adapt/use mpn_[lr]shift instead */70 #define shift_left(z2,z1,imin,imax,f, sh) {\71 @@ -106,7 +93,7 @@72 ulong dblmantissa(double x);73 void dcxlog(double s, double t, double *a, double *b);74 double dnorm(double s, double t);75 -double dbllog2(GEN z);76 +double mylog2(GEN z);77 ulong usqrtsafe(ulong a);78 79 /* "abs" routines for t_REAL ( disregard sign ) */80 @@ -121,12 +108,14 @@81 GEN gauss_triangle_i(GEN A, GEN B,GEN t);82 GEN hnfadd(GEN m,GEN p,GEN* ptdep,GEN* ptA,GEN* ptC,GEN extramat,GEN extraC);83 GEN hnfadd_i(GEN m,GEN p,GEN* ptdep,GEN* ptA,GEN* ptC,GEN extramat,GEN extraC);84 +GEN hnfall_i(GEN A, GEN *ptB, long remove);85 GEN hnf_gauss(GEN A, GEN B);86 GEN hnf_invimage(GEN A, GEN b);87 GEN hnfmerge_get_1(GEN A, GEN B);88 GEN hnfperm_i(GEN A, GEN *ptU, GEN *ptperm);89 GEN hnfspec_i(long** m,GEN p,GEN* ptdep,GEN* ptA,GEN* ptC,long k0);90 GEN hnfspec(long** m,GEN p,GEN* ptdep,GEN* ptA,GEN* ptC,long k0);91 +GEN idealhermite_aux(GEN nf, GEN x);92 GEN mathnfspec(GEN x, GEN *ptperm, GEN *ptdep, GEN *ptB, GEN *ptC);93 94 /* LLL */95 @@ -135,15 +124,13 @@96 GEN lllint_marked(long *M, GEN x, long D, int g, GEN *h, GEN *f, GEN *B);97 GEN LLL_check_progress(GEN Bnorm, long n0, GEN m, int final, long *ti_LLL);98 GEN extendedgcd(GEN A);99 -GEN sqred1intern(GEN a);100 -GEN lllgramintern(GEN x, long alpha, long flag, long prec);101 -GEN lllintern(GEN x, long D, long flag, long prec);102 103 /* miscellaneous linear algebra */104 GEN diagonal_i(GEN x);105 GEN F2V_red_ip(GEN v);106 GEN gauss_realimag(GEN x, GEN y);107 GEN imagecomplspec(GEN x, long *nlze);108 +GEN matqpascal(long n, GEN q);109 GEN R_from_QR(GEN x, long prec);110 void rowselect_p(GEN A, GEN B, GEN p, long init);111 GEN split_realimag(GEN x, long r1, long r2);112 @@ -152,6 +139,8 @@113 GEN znstar_hnf_elts(GEN Z, GEN H);114 GEN ZV_lincomb(GEN u, GEN v, GEN X, GEN Y);115 GEN vec_setconst(GEN v, GEN x);116 +GEN vec_const(long n, GEN x);117 +GEN col_const(long n, GEN x);118 119 GEN GS_norms(GEN B, long prec);120 GEN dim1proj(GEN prh);121 @@ -166,37 +155,34 @@122 GEN famat_inv(GEN f);123 GEN famat_makecoprime(GEN nf, GEN g, GEN e, GEN pr, GEN prk, GEN EX);124 GEN famat_mul(GEN f, GEN g);125 +GEN famat_mul(GEN f, GEN g);126 GEN famat_pow(GEN f, GEN n);127 GEN famat_reduce(GEN fa);128 GEN famat_to_arch(GEN nf, GEN fa, long prec);129 GEN famat_to_nf_modideal_coprime(GEN nf, GEN g, GEN e, GEN id, GEN EX);130 GEN famat_to_nf_modidele(GEN nf, GEN g, GEN e, GEN bid);131 +GEN famat_to_nf_modidele(GEN nf, GEN g, GEN e, GEN bid);132 GEN merge_factor_i(GEN f, GEN g);133 GEN to_famat_all(GEN x, GEN y);134 GEN to_famat(GEN g, GEN e);135 GEN trivfact(void);136 +GEN vconcat(GEN Q1, GEN Q2);137 138 /* integer factorization / discrete log */139 int BSW_isprime(GEN x);140 int BSW_isprime_small(GEN x);141 GEN coprime_part(GEN x, GEN f);142 -GEN Z_factor_limit(GEN n, GEN limit);143 +GEN decomp_limit(GEN n, GEN limit);144 GEN Fp_PHlog(GEN a, GEN g, GEN p, GEN ord);145 GEN Fp_shanks(GEN x,GEN g0,GEN p, GEN q);146 ulong is_kth_power(GEN x, ulong p, GEN *pt, byteptr d);147 long ifac_decomp_break(GEN n, long (*B)(GEN,GEN,GEN,GEN), GEN s, long hint);148 -long ifac_moebius(GEN n, long hint);149 -long ifac_issquarefree(GEN n, long hint);150 -long ifac_omega(GEN n, long hint);151 -long ifac_bigomega(GEN n, long hint);152 -GEN ifac_totient(GEN n, long hint);153 -GEN ifac_numdiv(GEN n, long hint);154 -GEN ifac_sumdiv(GEN n, long hint);155 -GEN ifac_sumdivk(GEN n, long k, long hint);156 int miller(GEN n, long k);157 GEN mpqs(GEN N);158 +ulong ucarrecomplet(ulong A);159 ulong ugcd(ulong x, ulong y);160 long Z_lvalrem_stop(GEN n, ulong p, int *stop);161 +long Z_issquarefree(GEN x);162 163 /* quadratic forms, quadratic numbers */164 long cornacchia(GEN d, GEN p, GEN *px, GEN *py);165 @@ -225,44 +211,45 @@166 /* a) Arithmetic/conversions */167 GEN addmulXn(GEN x, GEN y, long d);168 GEN addshiftpol(GEN x, GEN y, long d);169 +GEN fix_rfrac_if_pol(GEN x, GEN y);170 +GEN gmulXn(GEN x, long d);171 GEN lift_if_rational(GEN x);172 -GEN monomial(GEN a, long degpol, long v);173 -GEN monomialcopy(GEN a, long degpol, long v);174 +GEN monomial(GEN a, int degpol, int v);175 GEN mulmat_pol(GEN A, GEN x);176 long polegal_spec(GEN x, GEN y);177 GEN polrecip_i(GEN x);178 GEN pol_to_monic(GEN pol, GEN *lead);179 GEN revpol(GEN x);180 -GEN ser2pol_i(GEN x, long lx);181 -GEN ser2rfrac_i(GEN x);182 +GEN ser_to_pol_i(GEN x, long lx);183 GEN shiftpol_i(GEN x, long v);184 GEN swap_vars(GEN b0, long v);185 -GEN translate_pol(GEN P, GEN c);186 +GEN to_polmod(GEN x, GEN mod);187 +GEN TR_pol(GEN P, GEN c);188 189 /* b) Modular */190 GEN bezout_lift_fact(GEN T, GEN Tmod, GEN p, long e);191 -GEN caractducos(GEN p, GEN x, long v);192 +GEN caractducos(GEN p, GEN x, int v);193 GEN FpXQX_from_Kronecker(GEN z, GEN pol, GEN p);194 GEN FpX_quad_root(GEN x, GEN p, int unknown);195 long FpX_split_Berlekamp(GEN *t, GEN pp);196 +long FqX_is_squarefree(GEN P, GEN T, GEN p);197 GEN FqX_split_all(GEN z, GEN T, GEN p);198 long FqX_split_by_degree(GEN *pz, GEN u, GEN q, GEN T, GEN p);199 long FqX_split_deg1(GEN *pz, GEN u, GEN q, GEN T, GEN p);200 GEN FqX_split_roots(GEN z, GEN T, GEN p, GEN pol);201 +GEN nfgcd(GEN P, GEN Q, GEN nf, GEN den);202 GEN polratlift(GEN P, GEN mod, GEN amax, GEN bmax, GEN denom);203 GEN polsym_gen(GEN P, GEN y0, long n, GEN T, GEN N);204 GEN ZX_caract_sqf(GEN A, GEN B, long *lambda, long v);205 GEN ZX_disc_all(GEN,ulong);206 long ZX_get_prec(GEN x);207 GEN ZX_resultant_all(GEN A, GEN B, GEN dB, ulong bound);208 -GEN ZY_ZXY_resultant_all(GEN A, GEN B0, long *lambda, GEN *LPRS);209 -GEN ZY_ZXY_rnfequation(GEN A, GEN B0, long *lambda);210 +/* GEN ZY_ZXY_resultant_all(GEN A, GEN B0, long *lambda, GEN *LPRS);211 +GEN ZY_ZXY_resultant(GEN A, GEN B0, long *lambda);212 +*/213 GEN RgXQ_u_pow(GEN x, ulong n, GEN T);214 GEN RgX_gcd_simple(GEN x, GEN y);215 GEN RgX_extgcd_simple(GEN a, GEN b, GEN *pu, GEN *pv);216 -GEN RgXQ_minpoly_naive(GEN y, GEN P);217 -GEN lift_intern0(GEN x,long v);218 -#define lift_intern(x) (lift_intern0((x),-1))219 220 /* b') Chinese Remainder Theorem */221 GEN ZM_init_CRT(GEN Hp, ulong p);222 @@ -281,103 +268,153 @@223 GEN roots_to_pol_intern(GEN L, GEN a, long v, int plus);224 GEN roots_to_pol_r1r2(GEN a, long r1, long v);225 GEN special_pivot(GEN x);226 +GEN vandermondeinverse(GEN L, GEN T, GEN den, GEN prep);227 GEN vandermondeinversemod(GEN L, GEN T, GEN den, GEN mod);228 +GEN ZX_squff(GEN f, GEN *ex);229 GEN ZX_monic_factorpadic(GEN f, GEN p, long prec);230 231 -#include "parinf.h"232 +/* Number fields */233 +GEN arch_mul(GEN x, GEN y);234 +GEN archstar_full_rk(GEN x, GEN bas, GEN v, GEN gen);235 +GEN bnrGetSurj(GEN bnr1, GEN bnr2);236 +GEN check_and_build_cycgen(GEN bnf);237 +double check_bach(double cbach, double B);238 +GEN _checkbnf(GEN bnf);239 +GEN _checknf(GEN nf);240 +void check_ZKmodule(GEN x, char *s);241 +void dbg_rel(long s, GEN col);242 +GEN element_mulidid(GEN nf, long i, long j);243 +GEN element_powid_mod_p(GEN nf, long I, GEN n, GEN p);244 +GEN eltabstorel(GEN x, GEN T, GEN pol, GEN k);245 +GEN eltmulid_get_table(GEN nf, long i);246 +GEN eltreltoabs(GEN rnfeq, GEN x);247 +GEN galoisbig(GEN x, long prec);248 +GEN get_arch(GEN nf,GEN x,long prec);249 +GEN get_arch_real(GEN nf,GEN x,GEN *emb,long prec);250 +GEN get_bas_den(GEN bas);251 +GEN get_hnfid(GEN nf, GEN x);252 +GEN get_mul_table(GEN x,GEN bas,GEN invbas);253 +GEN get_nfindex(GEN bas);254 +GEN get_proj_modT(GEN basis, GEN T, GEN p);255 +GEN get_roots(GEN x,long r1,long prec);256 +GEN get_theta_abstorel(GEN T, GEN pol, GEN k);257 +GEN idealaddtoone_i(GEN nf, GEN x, GEN y);258 +GEN idealcoprime_fact(GEN nf, GEN x, GEN fy);259 +GEN idealhermite_aux(GEN nf, GEN x);260 +GEN idealsqrtn(GEN nf, GEN x, GEN gn, int strict);261 +GEN init_unif_mod_fZ(GEN L);262 +GEN init_units(GEN BNF);263 +long int_elt_val(GEN nf, GEN x, GEN p, GEN bp, GEN *t);264 +GEN isprincipalfact(GEN bnf,GEN P, GEN e, GEN C, long flag);265 +GEN make_integral(GEN nf, GEN L0, GEN f, GEN *listpr);266 +GEN maxord_i(GEN p, GEN f, long mf, GEN w, long flag);267 +GEN modprM(GEN z, GEN nf,GEN modpr);268 +GEN modprV(GEN z, GEN nf,GEN modpr);269 +GEN modprX(GEN x, GEN nf,GEN modpr);270 +GEN nfpol_to_Flx(GEN nf, GEN pol, ulong *ptp);271 +GEN nfreducemodideal_i(GEN x0,GEN ideal);272 +GEN nfrootsall_and_pr(GEN nf, GEN pol);273 +GEN norm_by_embed(long r1, GEN x);274 +GEN perm_to_arch(GEN nf, GEN archp);275 +GEN pidealprimeinv(GEN nf, GEN x);276 +GEN primedec_apply_kummer(GEN nf,GEN pol,long e,GEN p);277 +GEN prodid(GEN nf, GEN I);278 +GEN pr_norm(GEN pr);279 +GEN quadhilbertreal(GEN D, long prec);280 +GEN rnfallbase(GEN nf, GEN pol, GEN *pD, GEN *pd, GEN *pfi);281 +GEN _rnfequation(GEN A, GEN B, long *pk, GEN *pLPRS);282 +GEN special_anti_uniformizer(GEN nf, GEN pr);283 +GEN sqr_by_tab(GEN tab, GEN x);284 +GEN subgroupcondlist(GEN cyc, GEN bound, GEN listKer);285 +GEN T2_from_embed_norm(GEN x, long r1);286 +void testprimes(GEN bnf, ulong bound);287 +GEN to_Fp_simple(GEN nf, GEN x, GEN ffproj);288 +GEN unif_mod_fZ(GEN pr, GEN F);289 +GEN unnf_minus_x(GEN x);290 +void wr_rel(GEN col);291 +GEN zideallog_sgn(GEN nf, GEN x, GEN sgn, GEN bid);292 +GEN zlog_units(GEN nf, GEN U, GEN sgnU, GEN bid);293 +GEN zlog_units_noarch(GEN nf, GEN U, GEN bid);294 +GEN zsign_from_logarch(GEN Larch, GEN invpi, GEN archp);295 +296 +/* Dedekind zeta */297 +GEN zeta_get_limx(long r1, long r2, long bit);298 +long zeta_get_i0(long r1, long r2, long bit, GEN limx);299 +long zeta_get_N0(GEN C, GEN limx);300 +301 302 /* Allocation / gerepile */303 -void debug_stack(void);304 -void fill_stack(void);305 void init_dalloc();306 double *dalloc(size_t n);307 void gerepilecoeffs2(pari_sp av, GEN x, int n, GEN y, int o);308 void minim_alloc(long n, double ***q, GEN *x, double **y, double **z, double **v);309 int pop_entree_bloc(entree *ep, long loc);310 int pop_val_if_newer(entree *ep, long loc);311 -void gclone_refc(GEN x);312 -void free_ep_args(entree *ep);313 -314 -/* naive grow-arrays */315 -typedef struct {316 - void **v;317 - long len; /* len cells allocated */318 - long n; /* first n cells occupied */319 -} __pari_growarray;320 -typedef __pari_growarray growarray[1];321 -322 -growarray *pari_get_modules();323 -growarray *pari_get_oldmodules();324 -void grow_append(growarray A, void *e);325 -void grow_copy(growarray A, growarray B);326 -void grow_init(growarray A);327 -void grow_kill(growarray A);328 329 /* Interfaces (GP, etc.) */330 void errcontext(char *msg, char *s, char *entry);331 +void free_graph(void);332 GEN geni(void);333 -void* get_stack(double fraction, long min);334 +void* get_stack(double,int);335 GEN gpreadseq(char *c, int strict);336 +void init_defaults(int force);337 +void init_graph(void);338 void initout(int initerr);339 -void init80col(long n);340 char* itostr(GEN x, int minus);341 void kill_from_hashlist(entree *ep, long n);342 void member_err(char *s);343 int pari_kernel_init(void);344 -int pari_last_was_newline(void);345 -void pari_set_last_newline(int last);346 +void pari_sig_init(void (*f)(int));347 void print_functions_hash(const char *s);348 +void print_fun_list(char **matches, int nbli);349 void print_user_fun(entree *ep);350 void print_user_member(entree *ep);351 void print_all_user_fun(void);352 void print_all_user_member(void);353 -void pop_val(entree *ep);354 -void push_val(entree *ep, GEN a);355 -GEN readbin(const char *name, FILE *f, int *vector);356 -void recover(int flag);357 -int term_height(void);358 int term_width(void);359 +void texmacs_completion(char *s, long pos);360 void var_make_safe();361 +int whatnow(char *s, int flag);362 void whatnow_new_syntax(char *f, long n);363 364 /* defaults */365 #define is_default(s) setdefault((s),"",d_EXISTS) == gen_1366 enum { d_SILENT, d_ACKNOWLEDGE, d_INITRC, d_RETURN, d_EXISTS };367 -extern ulong precreal;368 +extern ulong prec;369 370 -GEN sd_TeXstyle(const char *v, long flag);371 -GEN sd_colors(char *v, long flag);372 -GEN sd_compatible(const char *v, long flag);373 -GEN sd_datadir(char *v, long flag);374 -GEN sd_debug(const char *v, long flag);375 -GEN sd_debugfiles(const char *v, long flag);376 -GEN sd_debugmem(const char *v, long flag);377 -GEN sd_echo(const char *v, long flag);378 -GEN sd_factor_add_primes(char *v, long flag);379 -GEN sd_filename(const char *v, long flag, char *s, char **f);380 -GEN sd_format(const char *v, long flag);381 -GEN sd_help(char *v, long flag);382 -GEN sd_histsize(const char *v, long flag);383 -GEN sd_lines(const char *v, long flag);384 -GEN sd_log(const char *v, long flag);385 -GEN sd_logfile(const char *v, long flag);386 -GEN sd_new_galois_format(char *v, long flag);387 -GEN sd_output(const char *v, long flag);388 -GEN sd_parisize(const char *v, long flag);389 -GEN sd_path(char *v, long flag);390 -GEN sd_prettyprinter(char *v, long flag);391 -GEN sd_primelimit(const char *v, long flag);392 -GEN sd_prompt(const char *v, long flag);393 -GEN sd_prompt_cont(const char *v, long flag);394 -GEN sd_psfile(const char *v, long flag);395 -GEN sd_realprecision(const char *v, long flag);396 -GEN sd_rl(const char *v, long flag);397 -GEN sd_secure(const char *v, long flag);398 -GEN sd_seriesprecision(const char *v, long flag);399 -GEN sd_simplify(const char *v, long flag);400 -GEN sd_strictmatch(const char *v, long flag);401 -GEN sd_timer(const char *v, long flag);402 -GEN setdefault(const char *s, const char *v, long flag);403 +GEN sd_TeXstyle(const char *v, int flag);404 +GEN sd_colors(char *v, int flag);405 +GEN sd_compatible(const char *v, int flag);406 +GEN sd_datadir(char *v, int flag);407 +GEN sd_debug(const char *v, int flag);408 +GEN sd_debugfiles(const char *v, int flag);409 +GEN sd_debugmem(const char *v, int flag);410 +GEN sd_echo(const char *v, int flag);411 +GEN sd_factor_add_primes(char *v, int flag);412 +GEN sd_filename(const char *v, int flag, char *s, char **f);413 +GEN sd_format(const char *v, int flag);414 +GEN sd_help(char *v, int flag);415 +GEN sd_histsize(const char *v, int flag);416 +GEN sd_lines(const char *v, int flag);417 +GEN sd_log(const char *v, int flag);418 +GEN sd_logfile(const char *v, int flag);419 +GEN sd_new_galois_format(char *v, int flag);420 +GEN sd_output(const char *v, int flag);421 +GEN sd_parisize(const char *v, int flag);422 +GEN sd_path(char *v, int flag);423 +GEN sd_prettyprinter(char *v, int flag);424 +GEN sd_primelimit(const char *v, int flag);425 +GEN sd_prompt(const char *v, int flag);426 +GEN sd_prompt_cont(const char *v, int flag);427 +GEN sd_psfile(const char *v, int flag);428 +GEN sd_realprecision(const char *v, int flag);429 +GEN sd_rl(const char *v, int flag);430 +GEN sd_secure(const char *v, int flag);431 +GEN sd_seriesprecision(const char *v, int flag);432 +GEN sd_simplify(const char *v, int flag);433 +GEN sd_strictmatch(const char *v, int flag);434 +GEN sd_timer(const char *v, int flag);435 +GEN setdefault(const char *s, const char *v, int flag);436 437 /* history */438 typedef struct {439 @@ -425,8 +462,9 @@440 pari_timer *T;441 } gp_data;442 /* GP_DATA->flags */443 -enum { QUIET=1, TEST=2, SIMPLIFY=4, CHRONO=8, ECHO=16, STRICTMATCH=32,444 +/* enum { QUIET=1, TEST=2, SIMPLIFY=4, CHRONO=8, ECHO=16, STRICTMATCH=32,445 USE_READLINE=64, SECURE=128, EMACS=256, TEXMACS=512};446 +*/447 448 extern gp_data *GP_DATA;449 450 @@ -449,6 +487,7 @@451 void check_filtre(filtre_t *F);452 453 gp_data *default_gp_data(void);454 +char *color_prompt(char *prompt);455 GEN gp_history(gp_hist *H, long p, char *old, char *entry);456 GEN set_hist_entry(gp_hist *H, GEN x);457 458 @@ -470,384 +509,3 @@459 460 int input_loop(filtre_t *F, input_method *IM);461 char *file_input(char **s0, int junk, input_method *IM, filtre_t *F);462 -463 -/* By files */464 -465 -/* Flx.c */466 -467 -GEN FlxX_recipspec(GEN x, long l, long n, long vs);468 -GEN FlxX_sub(GEN x, GEN y, ulong p);469 -GEN FlxX_subspec(GEN x, GEN y, ulong p, long lx, long ly);470 -GEN FlxX_swap(GEN x, long n, long ws);471 -GEN FlxX_to_Kronecker(GEN P, GEN Q);472 -GEN FlxX_to_Kronecker_spec(GEN P, long lp, GEN Q);473 -GEN Flx_addshift(GEN x, GEN y, ulong p, long d);474 -GEN Flx_addspec(GEN x, GEN y, ulong p, long lx, long ly);475 -GEN Flx_even_odd_comb(GEN P, ulong u, ulong v, ulong p);476 -GEN Flx_mulspec(GEN a, GEN b, ulong p, long na, long nb);477 -GEN Flx_negspec(GEN x, ulong p, long l);478 -GEN Flx_recipspec(GEN x, long l, long n);479 -GEN Flx_sqrspec(GEN a, ulong p, long na);480 -GEN Flx_subspec(GEN x, GEN y, ulong p, long lx, long ly);481 -GEN FlxqX_from_Kronecker(GEN z, GEN T, ulong p);482 -GEN FlxqX_invmontgomery(GEN T, GEN Q, ulong p);483 -GEN FlxqX_mulspec(GEN x, GEN y, GEN T, ulong p, long lx, long ly);484 -GEN FlxqX_rem_montgomery(GEN x, GEN mg, GEN T, GEN Q, ulong p);485 -486 -/* Qfb.c */487 -488 -GEN powimagraw(GEN x, long n);489 -GEN redimagsl2(GEN q, GEN *U);490 -GEN redrealsl2(GEN V);491 -GEN redrealsl2step(GEN A);492 -GEN sqcompimagraw(GEN x);493 -GEN sqcomprealraw(GEN x);494 -495 -/* RgX.c */496 -497 -GEN RgXQ_matrix_pow(GEN y, long n, long m, GEN P);498 -GEN RgX_copy_spec(GEN x, long nx);499 -GEN zx_copy_spec(GEN x, long nx);500 -501 -/* alglin1.c */502 -503 -GEN Flm_Fl_mul_inplace(GEN y, ulong x, ulong p);504 -GEN gauss_get_col(GEN a, GEN b, GEN p, long li);505 -GEN gauss_intern(GEN a, GEN b);506 -GEN matid_intern(long n,GEN myun,GEN myzero);507 -void vecselect_p(GEN A, GEN B, GEN p, long init, long lB);508 -509 -/* alglin2.c */510 -511 -GEN Frobeniusform(GEN V, long n);512 -GEN ZM_copy(GEN x);513 -GEN ZV_Z_mul(GEN X, GEN c);514 -GEN ZV_copy(GEN x);515 -void ZV_neg_ip(GEN M);516 -GEN hnf0(GEN A, int remove);517 -GEN hnf_special(GEN x, long remove);518 -GEN hnfall0(GEN A, long remove);519 -520 -/* anal.c */521 -522 -long unsigned int parse_option_string(char *arg, char *tmplate, long flag, char **failure, char **failure_arg);523 -GEN readexpr(char *t);524 -525 -/* aprcl.c */526 -527 -GEN aprcl(GEN N);528 -529 -/* arith1.c */530 -531 -GEN Z_chinese_coprime(GEN a, GEN b, GEN A, GEN B, GEN C);532 -GEN bestappr_mod(GEN x, GEN A, GEN B);533 -long hilii(GEN x, GEN y, GEN p);534 -long krouu_s(ulong x, ulong y, long s);535 -536 -/* arith2.c */537 -538 -GEN ibitand(GEN x, GEN y);539 -GEN ibitnegimply(GEN x, GEN y);540 -GEN ibitor(GEN x, GEN y);541 -GEN ibitxor(GEN x, GEN y);542 -byteptr initprimes0(ulong maxnum, long *lenp, ulong *lastp);543 -long set_optimize(long what, GEN g);544 -545 -/* base1.c */546 -547 -void nfbasic_init(GEN x, long flag, GEN fa, nfbasic_t *T);548 -GEN nffromhnfbasis(GEN nf, GEN x);549 -GEN nftohnfbasis(GEN nf, GEN x);550 -GEN polgaloisnames(long a, long b);551 -GEN primitive_pol_to_monic(GEN pol, GEN *ptlead);552 -553 -/* base2.c */554 -555 -long FpX_val(GEN x0, GEN t, GEN p, GEN *py);556 -GEN fast_respm(GEN f, GEN g, GEN p, long M);557 -GEN gen_if_principal(GEN bnf, GEN x);558 -int nfissquarefree(GEN nf, GEN x);559 -GEN nfreducemodpr_i(GEN x, GEN prh);560 -GEN polsymmodp(GEN g, GEN p);561 -GEN respm(GEN x, GEN y, GEN pm);562 -GEN rnfdet0(GEN nf, GEN x, GEN y);563 -564 -/* base3.c */565 -566 -GEN FpXQ_gener(GEN T, GEN p);567 -void check_nfelt(GEN x, GEN *den);568 -GEN ff_PHlog(GEN a, GEN g, GEN T, GEN p);569 -GEN nf_PHlog(GEN nf, GEN a, GEN g, GEN pr);570 -571 -/* base4.c */572 -573 -GEN arch_inv(GEN x);574 -GEN arch_pow(GEN x, GEN n);575 -void check_listpr(GEN x);576 -GEN factor_norm(GEN x);577 -GEN famat_to_nf(GEN nf, GEN f);578 -long val_norm(GEN x, GEN p, long *vz);579 -580 -/* base5.c */581 -582 -GEN check_and_build_nfabs(GEN rnf);583 -GEN check_and_build_norms(GEN rnf);584 -GEN checkrnfeq(GEN x);585 -GEN hnfcenter_ip(GEN M);586 -587 -/* bibli1.c */588 -589 -GEN gscal(GEN x, GEN y);590 -GEN lll_scaled(long MARKED, GEN X0, long D);591 -GEN lllall(GEN x, long D, int gram, long flag);592 -GEN lllintpartialall(GEN m, long flag);593 -GEN plindep(GEN x);594 -GEN pslq(GEN x);595 -GEN pslqL2(GEN x);596 -GEN sqscal(GEN x);597 -598 -/* bibli2.c */599 -600 -long ZV_search(GEN x, GEN y);601 -GEN ZV_sort_uniq(GEN L);602 -GEN gen_vecsort(GEN x, GEN k, long flag);603 -604 -/* buch1.c */605 -606 -GEN buchquad(GEN D, double cbach, double cbach2, long RELSUP, long prec);607 -GEN form_to_ideal(GEN x);608 -GEN getallforms(GEN D, long *pth, GEN *ptz);609 -610 -/* buch2.c */611 -612 -GEN check_and_build_matal(GEN bnf);613 -GEN extract_full_lattice(GEN x);614 -GEN init_red_mod_units(GEN bnf, long prec);615 -GEN isprincipalarch(GEN bnf, GEN col, GEN kNx, GEN e, GEN dx, long *pe);616 -GEN red_mod_units(GEN col, GEN z, long prec);617 -int trunc_error(GEN x);618 -619 -/* buch3.c */620 -621 -GEN minkowski_bound(GEN D, long N, long r2, long prec);622 -623 -/* elliptic.c */624 -625 -GEN CM_CardEFp(GEN E, GEN p);626 -GEN CM_ellap(GEN E, GEN p);627 -GEN apell1(GEN e, GEN p);628 -void checkpt(GEN z);629 -GEN multi_invmod(GEN x, GEN p);630 -GEN ratroot(GEN p);631 -GEN weipell0(GEN e, long prec, long PREC);632 -633 -/* es.c */634 -635 -GEN Str0(GEN g, long flag);636 -void bruti(GEN g, pariout_t *T, int addsign);637 -const char * eng_ord(long i);638 -char * env_ok(char *s);639 -void matbruti(GEN g, pariout_t *T);640 -int pari_is_dir(char *name);641 -GEN readobj(FILE *f, int *ptc);642 -void sori(GEN g, pariout_t *T);643 -void texi(GEN g, pariout_t *T, int addsign);644 -void writeGEN(GEN x, FILE *f);645 -void writenamedGEN(GEN x, char *s, FILE *f);646 -647 -/* galconj.c */648 -649 -GEN fixedfieldfactmod(GEN Sp, GEN p, GEN Tmod);650 -GEN fixedfieldfactor(GEN L, GEN O, GEN perm, GEN M, GEN den, GEN mod, long x, long y);651 -GEN fixedfieldinclusion(GEN O, GEN PL);652 -GEN fixedfieldorbits(GEN O, GEN L);653 -GEN fixedfieldsympol(GEN O, GEN mod, GEN l, GEN p, long v);654 -GEN galoisconj2pol(GEN x, long nbmax, long prec);655 -GEN galoiscosets(GEN O, GEN perm);656 -long intheadlong(GEN x, GEN mod);657 -long isomborne(GEN P, GEN den, GEN p);658 -GEN listznstarelts(long m, long p);659 -GEN matheadlong(GEN W, GEN mod);660 -GEN matrixnorm(GEN M, long prec);661 -GEN monomorphismlift(GEN P, GEN S, GEN Q, GEN p, long e);662 -long polheadlong(GEN P, long n, GEN mod);663 -GEN sympol_aut_evalmod(GEN sym, long g, GEN sigma, GEN Tp, GEN p);664 -GEN sympol_eval(GEN v, GEN NS);665 -GEN vandermondeinverseprep(GEN L);666 -667 -/* galois.c */668 -669 -GEN partitions(long n);670 -GEN polgaloisnamesbig(long n, long k);671 -672 -/* gen1.c */673 -674 -int ff_poltype(GEN *x, GEN *p, GEN *pol);675 -GEN gred_frac2(GEN x1, GEN x2);676 -GEN gred_rfrac2(GEN x1, GEN x2);677 -GEN gred_rfrac_simple(GEN n, GEN d);678 -679 -/* gen2.c */680 -681 -void gopsg2z(GEN (*f) (GEN, GEN), long s, GEN y, GEN z);682 -683 -/* gen3.c */684 -685 -GEN gsubst_expr(GEN pol, GEN from, GEN to);686 -GEN inv_ser(GEN b);687 -GEN mul_real(GEN x, GEN y);688 -GEN poltoser(GEN x, long v, long prec);689 -GEN qfbeval(GEN q, GEN x, GEN y);690 -GEN rfractoser(GEN x, long v, long prec);691 -692 -/* groupid.c */693 -694 -long group_ident_i(GEN G, GEN S);695 -long group_ident_trans(GEN G, GEN S);696 -long groupelts_sumorders(GEN S);697 -GEN vecgroup_idxlist(GEN L, long order);698 -long vecgroup_sumorders(GEN L);699 -700 -/* ifactor1.c */701 -702 -GEN ellfacteur(GEN n, int insist);703 -long ifac_decomp(GEN n, long hint);704 -GEN ifac_primary_factor(GEN *partial, long *exponent);705 -void ifac_realloc(GEN *partial, GEN *where, long new_lg);706 -GEN ifac_start(GEN n, long moebius, long hint);707 -GEN pollardbrent(GEN n);708 -ulong snextpr(ulong p, byteptr *d, long *rcn, long *q, long k);709 -GEN squfof(GEN n);710 -711 -/* init.c */712 -713 -void err_recover(long numerr);714 -GEN gcopy_av(GEN x, GEN *AVMA);715 -int ok_gerepileupto(GEN x);716 -void pari_init_defaults(void);717 -718 -/* nffactor.c */719 -720 -long ZM_get_prec(GEN x);721 -int nfissplit(GEN nf, GEN x);722 -723 -/* perm.c */724 -725 -long cosets_perm_search(GEN C, GEN p);726 -GEN group_export_GAP(GEN G);727 -GEN group_export_MAGMA(GEN G);728 -GEN perm_conj(GEN s, GEN t);729 -GEN perm_generate(GEN S, GEN H, long o);730 -long perm_relorder(GEN p, GEN S);731 -GEN perm_to_GAP(GEN p);732 -GEN quotient_subgroup_lift(GEN C, GEN H, GEN S);733 -734 -/* polarit1.c */735 -736 -GEN Flx_Berlekamp_ker(GEN u, ulong p);737 -GEN FpX_Berlekamp_ker(GEN u, GEN p);738 -GEN FpX_factcantor(GEN f, GEN pp, long flag);739 -GEN FqX_Berlekamp_ker(GEN u, GEN T, GEN q, GEN p);740 -GEN FqX_rand(long d1, long v, GEN T, GEN p);741 -long FqX_split_Berlekamp(GEN *t, GEN q, GEN T, GEN p);742 -GEN Zp_appr(GEN f, GEN a);743 -int cmp_padic(GEN x, GEN y);744 -GEN factcantor0(GEN f, GEN pp, long flag);745 -GEN zrhqr(GEN a, long prec);746 -747 -/* polarit2.c */748 -749 -GEN DDF_roots(GEN pol, GEN polp, GEN p);750 -GEN Q_divmuli_to_int(GEN x, GEN d, GEN n);751 -long checkdeflate(GEN x);752 -void factor_quad(GEN x, GEN res, long *ptcnt);753 -GEN factorback_aux(GEN fa, GEN e, GEN (*_mul) (void *, GEN, GEN), GEN (*_pow) (void *, GEN, GEN), void *data);754 -GEN matratlift(GEN M, GEN mod, GEN amax, GEN bmax, GEN denom);755 -GEN pseudodiv(GEN x, GEN y, GEN *ptr);756 -long s_centermod(long x, ulong pp, ulong pps2);757 -GEN sort_vecpol_gen(GEN a, int (*cmp) (GEN, GEN));758 -GEN sylvestermatrix_i(GEN x, GEN y);759 -760 -/* polarit3.c */761 -762 -GEN Flm_Frobenius_pow(GEN M, long d, GEN T, ulong p);763 -GEN Flxq_matrix_pow(GEN y, long n, long m, GEN P, ulong l);764 -GEN FpM_Frobenius_pow(GEN M, long d, GEN T, GEN p);765 -GEN FpXQ_sqrtl(GEN a, GEN l, GEN T, GEN p, GEN q, long e, GEN r, GEN y, GEN m);766 -GEN FpXYQQ_pow(GEN x, GEN n, GEN S, GEN T, GEN p);767 -GEN FpX_compositum(GEN A, GEN B, GEN p);768 -GEN FpX_direct_compositum(GEN A, GEN B, GEN p);769 -GEN FpX_div_by_X_x(GEN a, GEN x, GEN p, GEN *r);770 -GEN FpX_gcd_check(GEN x, GEN y, GEN p);771 -GEN RgX_to_FpXQX(GEN x, GEN T, GEN p);772 -GEN Rg_to_FpXQ(GEN x, GEN T, GEN p);773 -int ZX_incremental_CRT(GEN *ptH, GEN Hp, GEN q, GEN qp, ulong p);774 -GEN ZX_init_CRT(GEN Hp, ulong p, long v);775 -ulong ZY_ZXY_ResBound(GEN A, GEN B, GEN dB);776 -int Z_incremental_CRT(GEN *H, ulong Hp, GEN q, GEN qp, ulong p);777 -GEN ffinit_Artin_Shreier(GEN ip, long l);778 -GEN ffinit_rand(GEN p, long n);779 -byteptr init_modular(ulong *p);780 -GEN polint_triv(GEN xa, GEN ya);781 -782 -/* rootpol.c */783 -784 -GEN FFT(GEN x, GEN Omega);785 -GEN FFTinit(long k, long prec);786 -787 -/* subcyclo.c */788 -789 -GEN bnr_to_znstar(GEN bnr, long *complex);790 -GEN galoiscyclo(long n, long v);791 -GEN subcyclo_complex_bound(pari_sp ltop, GEN V, long prec);792 -GEN subcyclo_complex_roots(long n, long real, long prec);793 -GEN subcyclo_cyclic(long n, long d, long m, long z, long g, GEN powz, GEN le);794 -GEN subcyclo_orbits(long n, GEN H, GEN O, GEN powz, GEN le);795 -GEN subcyclo_roots(long n, GEN zl);796 -GEN subcyclo_start(long n, long d, long o, GEN borne, long *ptr_val, long *ptr_l);797 -GEN znstar_bits(long n, GEN H);798 -long znstar_conductor(long n, GEN H);799 -GEN znstar_coset_bits(long n, GEN H, long c);800 -void znstar_coset_bits_inplace(long n, GEN H, GEN bits, long c);801 -void znstar_coset_func(long n, GEN H, void (*func) (void *, long), void *data, long c);802 -GEN znstar_cosets(long n, long phi_n, GEN H);803 -GEN znstar_elts(long n, GEN H);804 -GEN znstar_generate(long n, GEN V);805 -GEN znstar_hnf(GEN Z, GEN M);806 -GEN znstar_hnf_generators(GEN Z, GEN M);807 -GEN znstar_partial_bits(long n, GEN H, long d);808 -GEN znstar_partial_coset_bits(long n, GEN H, long d, long c);809 -void znstar_partial_coset_bits_inplace(long n, GEN H, GEN bits, long d, long c);810 -void znstar_partial_coset_func(long n, GEN H, void (*func) (void *, long), void *data, long d, long c);811 -GEN znstar_reduce_modulus(GEN H, long n);812 -813 -/* thue.c */814 -815 -GEN bnfisintnormabs(GEN bnf, GEN a);816 -817 -/* trans1.c */818 -819 -GEN constlog2(long prec);820 -GEN padic_sqrt(GEN x);821 -GEN padic_sqrtn(GEN x, GEN n, GEN *zetan);822 -GEN padic_sqrtn_ram(GEN x, long e);823 -GEN padic_sqrtn_unram(GEN x, GEN n, GEN *zetan);824 -void pari_init_floats(void);825 -GEN rootsof1complex(GEN n, long prec);826 -GEN rootsof1padic(GEN n, GEN y);827 -828 -/* trans2.c */829 -830 -GEN cxpsi(GEN s0, long prec);831 -double darg(double s, double t);832 -833 -/* trans3.c */834 -835 -GEN bernreal_using_zeta(long n, GEN iz, long prec);836 -GEN czeta(GEN s0, long prec);837 -GEN inv_szeta_euler(long n, double lba, long prec);838 -GEN kbesselnew(GEN n, GEN z, long prec);839 -GEN polylogd0(long m, GEN x, long flag, long prec);840 -GEN twistpartialzeta(GEN p, GEN q, long f, long c, GEN va, GEN cff);841 -842 -ENDEXTERN -
new file patches/paripriv.h.patch
diff -r 1a3489aa9dd5 patches/paripriv.h.patch
- + 1 --- src/headers/paripriv.h (revision 12541) 2 +++ src/headers/paripriv.h (working copy) 3 @@ -333,7 +333,11 @@ 4 pari_timer *T; 5 } gp_data; 6 /* GP_DATA->flags */ 7 -enum { QUIET=1, TEST=2, SIMPLIFY=4, CHRONO=8, ECHO=16, STRICTMATCH=32, 8 + 9 +/* The ECHO symbol is already defined in Sage when building on OS X. Since this is paripriv.h, 10 + it's very unlikely that anything in here is used, so this should be safe. */ 11 + 12 +enum { QUIET=1, TEST=2, SIMPLIFY=4, CHRONO=8, xxECHOxx=16, STRICTMATCH=32, 13 USE_READLINE=64, SECURE=128, EMACS=256, TEXMACS=512, BREAKLOOP=1024, 14 RECOVER=2048}; 15 -
new file spkg-check
diff -r 1a3489aa9dd5 spkg-check
- + 1 #!/usr/bin/env bash 2 if [ -z "$SAGE_LOCAL" ]; then 3 echo "SAGE_LOCAL undefined ... exiting"; 4 echo "Maybe run 'sage -sh'?" 5 exit 1 6 fi 7 8 # Let the user chose a flag other than -m64 for 64-bit builds 9 # if needed. 10 if [ -z "$CFLAG64" ] ; then 11 CFLAG64=-m64 12 fi 13 14 if [ "x$SAGE64" = xyes ]; then 15 CFLAGS="$CFLAGS $CFLAG64" 16 CC="$CC $CFLAG64" && export CC 17 fi 18 19 if [ "x$SAGE_DEBUG" = xyes ] ; then 20 CFLAGS="$CFLAGS -O0 -g" # No optimisation. Good for debugging or working around compiler bugs. 21 else 22 CFLAGS="$CFLAGS -O3 -g" # Default optimisation. 23 fi 24 25 export CFLAGS 26 27 cd src 28 29 make test-all 30 31 if [ $? -ne 0 ] ; then 32 echo "Pari failed the self-tests when running 'make test-all'" 33 exit 1 34 fi 35 36 if [ -d ../parisvn ] ; then 37 echo "WARNING: you should delete the parisvn directory before submitting this spkg." 38 fi 39 40 echo "The Pari self-tests all passed" 41 exit 0 42 -
deleted file spkg-dist
diff -r 1a3489aa9dd5 spkg-dist
+ - 1 #!/usr/bin/env python2 3 import os, sys, time4 5 os.chdir('src/')6 7 def cmd(x):8 print x9 if os.system(x):10 print "(Failed.)"11 12 cmd("rm -rf Odos")13 14 # Now modify init.c so we abort instead of exiting, so that15 # Sage can catch errors that PARI raises.16 print "Modifying init.c for Sage usage"17 18 init_c = "src/language/init.c"19 init = open(init_c).read()20 i = init.find('fprintferr(" *** Error in the PARI system.')21 init = init[:i] + "\n\tabort();\n\t" + init[i:]22 i = init.find('msg="unknown signal";')23 init = init[:i] + "\n\tabort();\n\t" + init[i:]24 open(init_c,'w').write(init)25 26 print "Modifying src/kernel/gmp/mp.c"27 mp_file = "src/kernel/gmp/mp.c"28 mp = open(mp_file).read()29 mp = mp.replace('mp_set_memory_functions', 'return 0; mp_set_memory_functions')30 open(mp_file,'w').write(mp)31 32 33 34 -
spkg-install
diff -r 1a3489aa9dd5 spkg-install
a b 1 B1;2000;0c#!/bin/sh1 #!/usr/bin/env bash 2 2 ########################################### 3 3 ## PARI 4 4 ########################################### 5 5 6 if [ -z "$SAGE_LOCAL" ]; then 7 echo "SAGE_LOCAL undefined ... exiting"; 8 echo "Maybe run 'sage -sh'?" 9 exit 1 10 fi 11 6 12 TOP=`pwd` 13 PATCHED="$TOP/patches/files" 7 14 8 # As of PARI 2.3.3, the compiler flag -fPIC is not added on Solaris, but it 9 # needs to be if using gcc. I assume the equivalent will be needed on 10 # other compilers. 11 12 if [ `uname` = "SunOS" ]; then 13 sed 's/-fomit-frame-pointer/-fomit-frame-pointer -fPIC/g' src/config/get_cc > src/config/get_cc.$$ 14 mv src/config/get_cc.$$ src/config/get_cc 15 fi 15 ########################################################### 16 ## patching src files. See patches/README.txt for details 17 ########################################################### 16 18 17 19 cd src 18 20 19 # extract the SEA data file in the appropriate place, so that the build pari will support20 # fast point counting over finite fields 21 tar xf ../seadata.tar21 # These two are needed so that Sage can catch PARI's error signals. 22 cp "$PATCHED/init.c" src/language/init.c 23 cp "$PATCHED/mp.c" src/kernel/gmp/mp.c 22 24 23 #cp "$TOP"/patches/get_dlld config/ 25 # Fix for PARI bug 1079 (jdemeyer: temporary until this is fixed upstream) 26 cp "$PATCHED/base2.c" "$PATCHED/polarit3.c" src/basemath/ 24 27 25 # mabshoff: This patch is to get around problem in PPC 32-bit Linux build26 # (but it is ok on any other machine)27 #cp "$TOP"/patches/get_dlcflags config/28 29 # pjeremy: fix for FreeBSD: #782530 #cp "$TOP"/patches/get_kernel config/31 28 32 29 # cwitty: disable -rpath 33 #cp "$TOP"/patches/get_ldconfig/30 cp "$PATCHED/get_ld" config/ 34 31 35 32 # cwitty: disable TeX; allow bz2 compression 36 #cp "$TOP"/patches/gphelp.indoc/33 cp "$PATCHED/gphelp.in" doc/ 37 34 38 # Minh Van Nguyen: copy over patched get_cc (see ticket #7092). It's 39 # reported that 32-bit Fedora 11 would fail to build otherwise. 40 #if [ `uname` = "Linux" ]; then 41 # cp "$TOP"/patches/get_cc config/get_cc 42 #fi 35 # John Cremona: copy over a lightly patched get_tests, so that make 36 # test-all does not test ellglobalred (which requires the elldata 37 # package Sage does not install). 38 cp "$PATCHED/get_tests" config/ 39 40 # Add -fno-common to DLCFLAGS on Darwin 41 cp "$PATCHED/get_dlcflags" config/ 42 43 # Two configure patches for Solaris 44 cp "$PATCHED/Configure" . 45 cp "$PATCHED/Makefile.SH" config/ 46 43 47 44 48 # This is needed or there are weird locale problems involving rpath 45 49 # with building Sage. … … 51 55 build() 52 56 { 53 57 # add the proper flags for 64-bit build mode on OS X and Open Solaris x64 58 # Setting CFLAGS is not sufficient on Solaris since PARI 2.4.3, as this 59 # flag is not being used when the check for GMP and Readline are made 60 # so the checks for them fail. One must redefine CC and export that. 61 62 # Let the user chose a flag other than -m64 for 64-bit builds 63 # if needed. 64 if [ -z "$CFLAG64" ] ; then 65 CFLAG64=-m64 66 fi 67 54 68 if [ "x$SAGE64" = xyes ]; then 55 CFLAGS="-g -m64 " && export CFLAGS 69 CFLAGS="$CFLAGS $CFLAG64" 70 CC="$CC $CFLAG64" && export CC 56 71 fi 57 72 73 if [ "x$SAGE_DEBUG" = xyes ] ; then 74 CFLAGS="$CFLAGS -O0 -g" # No optimisation. Good for debugging or working around compiler bugs. 75 else 76 CFLAGS="$CFLAGS -O3 -g" # Default optimisation. 77 fi 78 export CFLAGS 79 58 80 CUR=`pwd` 59 81 60 82 # On my systems PARI does *not* build correctly with these set! (and … … 68 90 PARI_EXTRA_OPTS=" --graphic=none " 69 91 fi 70 92 71 ./Configure $PARI_EXTRA_OPTS --prefix=$SAGE_LOCAL --with-readline=$SAGE_LOCAL --with-gmp=$SAGE_LOCAL --kernel=gmp --graphic=none 93 # Allow the user to tune PARI - this is time-consuming, but some may want to do it. 94 # It is also very unreliable 95 if [ "x$SAGE_TUNE_pari" = xyes ] ; then 96 echo "" 97 echo "PARI will be tuned for your system since you set SAGE_TUNE_pari=\"yes\"." 98 echo "This can take a long time." 99 echo "WARNING: Tuning PARI is VERY unreliable. You may find your build" 100 echo "of PARI fails, or PARI does not work properly once built." 101 echo "" 102 ./Configure $PARI_EXTRA_OPTS --prefix=$SAGE_LOCAL --with-readline=$SAGE_LOCAL --with-gmp=$SAGE_LOCAL --kernel=gmp --graphic=none --tune 103 else 104 echo "To minimize Sage build time and to ensure the best relieability, PARI" 105 echo "will not be tuned for your system. Experience shows tuning is" 106 echo "unreliable: see http://trac.sagemath.org/sage_trac/ticket/9343" 107 echo "If you wish to test the tuning code, set the environment variable" 108 echo "SAGE_TUNE_pari=yes by typing the following before building Sage (or at" 109 echo "least before building PARI):" 110 echo "SAGE_TUNE_pari=yes" 111 echo "export SAGE_TUNE_pari" 112 echo "" 113 ./Configure $PARI_EXTRA_OPTS --prefix=$SAGE_LOCAL --with-readline=$SAGE_LOCAL --with-gmp=$SAGE_LOCAL --kernel=gmp --graphic=none 114 fi 72 115 73 116 if [ $? -ne 0 ]; then 74 117 echo "ERROR - configure PARI with readline and gmp failed." … … 140 183 # The following is a hack to get the library installed correctly 141 184 # on OS X. 142 185 if [ $UNAME = "Darwin" ]; then 143 echo "MAC OS X hack -- delete and reinstall libpari.a"144 rm -f Odarwin-ppc/*lib*145 $MAKE install-lib-sta186 echo "MAC OS X hack -- delete and reinstall libpari.a" 187 rm -f Odarwin-ppc/*lib* 188 $MAKE install-lib-sta 146 189 147 190 if [ $? -ne 0 ]; then 148 191 echo "Error Re-installing PARI static libraries (OS X trick)" … … 150 193 fi 151 194 152 195 cd `config/objdir` 153 cp -f libpari* $SAGE_LOCAL/lib196 cp -f libpari* "$SAGE_LOCAL"/lib 154 197 cd "$CUR" 155 198 156 199 # Also another patch since paripriv.h won't compile right on OS X 157 200 # when used by client Sage code. So we replace it by a slightly 158 201 # modified version. 159 cp -pf "$TOP"/patches/paripriv-osx.h $SAGE_LOCAL/include/pari/paripriv.h 202 cp -pf "$PATCHED/paripriv.h" "$SAGE_LOCAL/include/pari/paripriv.h" 160 203 fi 161 204 # Like on OS X (see above), the Sage library would not build 162 205 # without some changes. Though on Solaris the changes are much simpler than … … 165 208 set -e 166 209 echo "Patching include/pari/paripriv.h so it works on Solaris" 167 210 echo "The changes are much smaller than needed on OS X" 168 cp "$ TOP"/patches/paripriv-Solaris.h$SAGE_LOCAL/include/pari/paripriv.h211 cp "$PATCHED/paripriv.h" $SAGE_LOCAL/include/pari/paripriv.h 169 212 set +e 170 213 elif [ "$UNAME" = "CYGWIN" ]; then 171 214 # We need to the same thing on Cygwin that we have to do on Solaris 172 cp "$ TOP"/patches/paripriv-Solaris.h$SAGE_LOCAL/include/pari/paripriv.h215 cp "$PATCHED/paripriv.h" $SAGE_LOCAL/include/pari/paripriv.h 173 216 fi 174 217 175 218 echo "Installing extra Galois groups data." -
new file spkg-make
diff -r 1a3489aa9dd5 spkg-make
- + 1 #!/usr/bin/env bash 2 # 3 # Script to prepare a PARI spkg for Sage. This script is only for the 4 # package maintainer, not for building PARI during a Sage install. 5 # WARNING: This script will delete/overwrite files in this directory 6 # and its subdirectories! 7 # 8 # HOW TO MAKE THE SPKG: 9 # 1) ./spkg-make 10 # 2) rm -rf parisvn (For final distribution, not necessary for testing) 11 # 3) cd ..; sage -pkg pari-2.4.3.whatever_the_name_of_the_package_is 12 # 13 # If something goes wrong, try rm -rf parisvn and try again. 14 # 15 # This script does the following: 16 # * If the directory ./parisvn/ exists, it is assumed to be a SVN 17 # repository of the PARI sources. If it does not exist, the SVN 18 # sources are automatically downloaded. In any case, the SVN sources 19 # are updated to a specific version. 20 # * If the file parisvn/galdata.tgz does not exist, it is downloaded. 21 # * The same for the file parisvn/seadata-small.tgz 22 # * PARI is configured and built in the parisvn directory. The built 23 # executables are not needed, but some files generated in the 24 # process (using bison for example) are needed. 25 # * The necessary files are copied from parisvn/ to src/ using a 26 # mechanism very similar to "make svnsnapshot" from PARI. 27 # * The files parisvn/galdata.tgz and parisvn/seadata-small.tgz are 28 # extracted. 29 # * The patches in patches/*.patch are applied and the complete patched 30 # files are copied to patches/files 31 # 32 # AUTHOR: Jeroen Demeyer (July 2010) 33 34 35 # Sanity check: must be run from current directory 36 if ! [ -f spkg-make ]; then 37 echo >&2 "This script must be run from its own source directory!" 38 exit 1 39 fi 40 41 42 # Clean an existing src/ directory 43 rm -rf src 44 mkdir src 45 46 47 # Download SVN sources to parisvn/ 48 if ! [ -d parisvn ]; then 49 svn checkout svn://pari.math.u-bordeaux.fr/pari/trunk parisvn 50 fi 51 52 53 # Download galdata.tgz and seadata-small.tgz 54 [ -f parisvn/galdata.tgz ] || wget -O parisvn/galdata.tgz \ 55 http://pari.math.u-bordeaux.fr/pub/pari/packages/galdata.tgz 56 [ -f parisvn/seadata-small.tgz ] || wget -O parisvn/seadata-small.tgz \ 57 http://pari.math.u-bordeaux.fr/pub/pari/packages/seadata-small.tgz 58 59 60 # Use the specified SVN version 61 cd parisvn 62 svn update -r 12577 63 64 65 # make pari (must run bison, etc...) 66 ./Configure || exit 67 make gp doc || exit 68 69 70 # Copy the needed files to src using a tar pipe. This is based on code 71 # from config/settar. 72 tar c `config/get_MANIFEST` | ( cd ../src && tar xv ) 73 74 # Save svn version (see config/settar) 75 svnversion >../src/config/svnversion 76 77 78 # Extract the tgz files 79 for tgzfile in galdata.tgz seadata-small.tgz; do 80 ( cd ../src && tar xvz ) < "$tgzfile" 81 done 82 83 84 # Run through the patches in patches/*.patch and prepare the patched 85 # files in patches/files 86 rm -rf ../patches/files 87 mkdir ../patches/files 88 for patch in ../patches/*.patch; do 89 # Check that every patch file changes only one file 90 numfilesinpatch=`grep -c -e '^+++ ' "$patch"` 91 if [ "$numfilesinpatch" != "1" ]; then 92 echo "Bad patch file $patch. It must patch exactly one file." 93 fi 94 95 srcfile=`sed -n 's|^+++ \([^\t]*\)\(\t.*\)\?|\1|p' "$patch"` 96 outfile="../patches/files/`basename $srcfile`" 97 patch -o "$outfile" -p0 <"$patch" || exit 98 chmod "--reference=$srcfile" "$outfile" 99 done 100 101 102 # We're done! 103 cd .. 104 echo "======================================================" 105 echo "Done downloading PARI and creating the src/ directory." 106 echo "If everything looks okay, proceed as follows:" 107 echo " rm -rf parisvn" 108 echo " cd .." 109 echo -n " sage -pkg "; basename `pwd`
