You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(63) |
May
(23) |
Jun
|
Jul
|
Aug
(3) |
Sep
(26) |
Oct
(20) |
Nov
(221) |
Dec
(44) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(48) |
Feb
(57) |
Mar
(45) |
Apr
(51) |
May
(61) |
Jun
(25) |
Jul
|
Aug
(9) |
Sep
(14) |
Oct
(22) |
Nov
(15) |
Dec
|
2006 |
Jan
(37) |
Feb
(55) |
Mar
(40) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(5) |
Oct
(6) |
Nov
(4) |
Dec
(7) |
2007 |
Jan
(3) |
Feb
(3) |
Mar
(12) |
Apr
(4) |
May
(9) |
Jun
(5) |
Jul
(1) |
Aug
|
Sep
(8) |
Oct
(12) |
Nov
(6) |
Dec
(3) |
2008 |
Jan
(1) |
Feb
(7) |
Mar
(10) |
Apr
(4) |
May
(3) |
Jun
(3) |
Jul
(2) |
Aug
|
Sep
(1) |
Oct
(10) |
Nov
(1) |
Dec
(2) |
2009 |
Jan
(18) |
Feb
(8) |
Mar
(7) |
Apr
(6) |
May
(5) |
Jun
(7) |
Jul
(1) |
Aug
|
Sep
(2) |
Oct
(1) |
Nov
(1) |
Dec
(2) |
2010 |
Jan
(3) |
Feb
(4) |
Mar
(5) |
Apr
|
May
|
Jun
(3) |
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
From: <pa...@us...> - 2011-11-18 13:07:18
|
Revision: 782 http://xcas.svn.sourceforge.net/xcas/?rev=782&view=rev Author: parisse Date: 2011-11-18 13:07:01 +0000 (Fri, 18 Nov 2011) Log Message: ----------- Added Paths: ----------- trunk/giac-xcas/giac-0.9.5/ trunk/giac-xcas/giac-0.9.5/ABOUT-NLS trunk/giac-xcas/giac-0.9.5/AUTHORS trunk/giac-xcas/giac-0.9.5/COPYING trunk/giac-xcas/giac-0.9.5/ChangeLog trunk/giac-xcas/giac-0.9.5/INSTALACION trunk/giac-xcas/giac-0.9.5/INSTALL trunk/giac-xcas/giac-0.9.5/Init.scm trunk/giac-xcas/giac-0.9.5/LEAME.WIN trunk/giac-xcas/giac-0.9.5/LEAME.ipaq trunk/giac-xcas/giac-0.9.5/Makefile.am trunk/giac-xcas/giac-0.9.5/Makefile.in trunk/giac-xcas/giac-0.9.5/NEWS trunk/giac-xcas/giac-0.9.5/README trunk/giac-xcas/giac-0.9.5/README.MACOSX trunk/giac-xcas/giac-0.9.5/README.visualcpp trunk/giac-xcas/giac-0.9.5/TODO trunk/giac-xcas/giac-0.9.5/TROUBLES trunk/giac-xcas/giac-0.9.5/acinclude.m4 trunk/giac-xcas/giac-0.9.5/aclocal.m4 trunk/giac-xcas/giac-0.9.5/addu.cc trunk/giac-xcas/giac-0.9.5/build_for_iphoneos trunk/giac-xcas/giac-0.9.5/changeversion trunk/giac-xcas/giac-0.9.5/check/ trunk/giac-xcas/giac-0.9.5/check/Makefile.am trunk/giac-xcas/giac-0.9.5/check/Makefile.in trunk/giac-xcas/giac-0.9.5/check/README trunk/giac-xcas/giac-0.9.5/check/TP00-sol.cas trunk/giac-xcas/giac-0.9.5/check/TP00-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/TP01-sol.cas trunk/giac-xcas/giac-0.9.5/check/TP01-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/TP02-sol.cas trunk/giac-xcas/giac-0.9.5/check/TP02-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/TP03-sol.cas trunk/giac-xcas/giac-0.9.5/check/TP03-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/TP04-sol.cas trunk/giac-xcas/giac-0.9.5/check/TP04-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/TP05-sol.cas trunk/giac-xcas/giac-0.9.5/check/TP05-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/TP06-sol.cas trunk/giac-xcas/giac-0.9.5/check/TP06-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/TP07-sol.cas trunk/giac-xcas/giac-0.9.5/check/TP07-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/TP08-sol.cas trunk/giac-xcas/giac-0.9.5/check/TP08-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/TP08_2007-sol.cas trunk/giac-xcas/giac-0.9.5/check/TP08_2007-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/TP09-sol.cas trunk/giac-xcas/giac-0.9.5/check/TP09-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/TP10-sol.cas trunk/giac-xcas/giac-0.9.5/check/TP10-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/TP11-sol.cas trunk/giac-xcas/giac-0.9.5/check/TP11-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/TP12-sol.cas trunk/giac-xcas/giac-0.9.5/check/TP12-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/TP13-sol.cas trunk/giac-xcas/giac-0.9.5/check/TP13-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/TP14-sol.cas trunk/giac-xcas/giac-0.9.5/check/TP14-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/TP15-sol.cas trunk/giac-xcas/giac-0.9.5/check/TP15-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/TP16-sol.cas trunk/giac-xcas/giac-0.9.5/check/TP16-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/TP17-sol.cas trunk/giac-xcas/giac-0.9.5/check/TP17-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/TP18-sol.cas trunk/giac-xcas/giac-0.9.5/check/TP18-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/TP19-sol.cas trunk/giac-xcas/giac-0.9.5/check/TP19-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/TP20-sol.cas trunk/giac-xcas/giac-0.9.5/check/TP20-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/TP21-sol.cas trunk/giac-xcas/giac-0.9.5/check/TP21-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/TPO8_2007-sol.cas trunk/giac-xcas/giac-0.9.5/check/TPO8_2007-sol.cas.out1 trunk/giac-xcas/giac-0.9.5/check/cas.out trunk/giac-xcas/giac-0.9.5/check/chk_cas trunk/giac-xcas/giac-0.9.5/check/chk_factor trunk/giac-xcas/giac-0.9.5/check/chk_fhan trunk/giac-xcas/giac-0.9.5/check/chk_fhan0 trunk/giac-xcas/giac-0.9.5/check/chk_fhan1 trunk/giac-xcas/giac-0.9.5/check/chk_fhan10 trunk/giac-xcas/giac-0.9.5/check/chk_fhan11 trunk/giac-xcas/giac-0.9.5/check/chk_fhan12 trunk/giac-xcas/giac-0.9.5/check/chk_fhan13 trunk/giac-xcas/giac-0.9.5/check/chk_fhan14 trunk/giac-xcas/giac-0.9.5/check/chk_fhan15 trunk/giac-xcas/giac-0.9.5/check/chk_fhan16 trunk/giac-xcas/giac-0.9.5/check/chk_fhan17 trunk/giac-xcas/giac-0.9.5/check/chk_fhan18 trunk/giac-xcas/giac-0.9.5/check/chk_fhan19 trunk/giac-xcas/giac-0.9.5/check/chk_fhan2 trunk/giac-xcas/giac-0.9.5/check/chk_fhan20 trunk/giac-xcas/giac-0.9.5/check/chk_fhan21 trunk/giac-xcas/giac-0.9.5/check/chk_fhan3 trunk/giac-xcas/giac-0.9.5/check/chk_fhan4 trunk/giac-xcas/giac-0.9.5/check/chk_fhan5 trunk/giac-xcas/giac-0.9.5/check/chk_fhan6 trunk/giac-xcas/giac-0.9.5/check/chk_fhan7 trunk/giac-xcas/giac-0.9.5/check/chk_fhan8 trunk/giac-xcas/giac-0.9.5/check/chk_fhan9 trunk/giac-xcas/giac-0.9.5/check/chk_geo trunk/giac-xcas/giac-0.9.5/check/chk_integrate trunk/giac-xcas/giac-0.9.5/check/chk_limit trunk/giac-xcas/giac-0.9.5/check/chk_morley_demo trunk/giac-xcas/giac-0.9.5/check/chk_normalize trunk/giac-xcas/giac-0.9.5/check/chk_partfrac trunk/giac-xcas/giac-0.9.5/check/chk_xavier trunk/giac-xcas/giac-0.9.5/check/factor.out trunk/giac-xcas/giac-0.9.5/check/flanex trunk/giac-xcas/giac-0.9.5/check/geo.out trunk/giac-xcas/giac-0.9.5/check/integrate.out trunk/giac-xcas/giac-0.9.5/check/limit.out trunk/giac-xcas/giac-0.9.5/check/morley_demo.cas trunk/giac-xcas/giac-0.9.5/check/morley_demo.out trunk/giac-xcas/giac-0.9.5/check/morley_demo.tst trunk/giac-xcas/giac-0.9.5/check/normalize.out trunk/giac-xcas/giac-0.9.5/check/partfrac.out trunk/giac-xcas/giac-0.9.5/check/testcas trunk/giac-xcas/giac-0.9.5/check/testfactor trunk/giac-xcas/giac-0.9.5/check/testgeo trunk/giac-xcas/giac-0.9.5/check/testintegrate trunk/giac-xcas/giac-0.9.5/check/testlimit trunk/giac-xcas/giac-0.9.5/check/testnormalize trunk/giac-xcas/giac-0.9.5/check/testpartfrac trunk/giac-xcas/giac-0.9.5/check/xavier.cas trunk/giac-xcas/giac-0.9.5/check/xavier.out trunk/giac-xcas/giac-0.9.5/check/xavier.tst trunk/giac-xcas/giac-0.9.5/compile.mingw trunk/giac-xcas/giac-0.9.5/compte trunk/giac-xcas/giac-0.9.5/config/ trunk/giac-xcas/giac-0.9.5/config/config.guess trunk/giac-xcas/giac-0.9.5/config/config.rpath trunk/giac-xcas/giac-0.9.5/config/config.sub trunk/giac-xcas/giac-0.9.5/config/depcomp trunk/giac-xcas/giac-0.9.5/config/install-sh trunk/giac-xcas/giac-0.9.5/config/ltmain.sh trunk/giac-xcas/giac-0.9.5/config/missing trunk/giac-xcas/giac-0.9.5/config/mkinstalldirs trunk/giac-xcas/giac-0.9.5/config/texinfo.tex trunk/giac-xcas/giac-0.9.5/config/ylwrap trunk/giac-xcas/giac-0.9.5/config.h.in trunk/giac-xcas/giac-0.9.5/config.h.iphone trunk/giac-xcas/giac-0.9.5/config.h.win trunk/giac-xcas/giac-0.9.5/configure trunk/giac-xcas/giac-0.9.5/configure.in trunk/giac-xcas/giac-0.9.5/debian/ trunk/giac-xcas/giac-0.9.5/debian/Makefile.am trunk/giac-xcas/giac-0.9.5/debian/Makefile.in trunk/giac-xcas/giac-0.9.5/debian/README.debian trunk/giac-xcas/giac-0.9.5/debian/changelog trunk/giac-xcas/giac-0.9.5/debian/control trunk/giac-xcas/giac-0.9.5/debian/copyright trunk/giac-xcas/giac-0.9.5/debian/files trunk/giac-xcas/giac-0.9.5/debian/giac-doc-nonfree.files trunk/giac-xcas/giac-0.9.5/debian/giac-doc.files trunk/giac-xcas/giac-0.9.5/debian/giac.1 trunk/giac-xcas/giac-0.9.5/debian/giac.mime trunk/giac-xcas/giac-0.9.5/debian/giac.sharedmimeinfo trunk/giac-xcas/giac-0.9.5/debian/info trunk/giac-xcas/giac-0.9.5/debian/libgiac0-dev.files trunk/giac-xcas/giac-0.9.5/debian/libgiac0.files trunk/giac-xcas/giac-0.9.5/debian/menu trunk/giac-xcas/giac-0.9.5/debian/rules trunk/giac-xcas/giac-0.9.5/debian/rules.no.pari trunk/giac-xcas/giac-0.9.5/debian/rules.pari trunk/giac-xcas/giac-0.9.5/debian/watch trunk/giac-xcas/giac-0.9.5/debianold/ trunk/giac-xcas/giac-0.9.5/debianold/Makefile.am trunk/giac-xcas/giac-0.9.5/debianold/Makefile.in trunk/giac-xcas/giac-0.9.5/debianold/README.debian trunk/giac-xcas/giac-0.9.5/debianold/aide.1 trunk/giac-xcas/giac-0.9.5/debianold/changelog trunk/giac-xcas/giac-0.9.5/debianold/control trunk/giac-xcas/giac-0.9.5/debianold/copyright trunk/giac-xcas/giac-0.9.5/debianold/dirs trunk/giac-xcas/giac-0.9.5/debianold/docs trunk/giac-xcas/giac-0.9.5/debianold/giac.1 trunk/giac-xcas/giac-0.9.5/debianold/giac.mime trunk/giac-xcas/giac-0.9.5/debianold/giac.sharedmimeinfo trunk/giac-xcas/giac-0.9.5/debianold/icas.1 trunk/giac-xcas/giac-0.9.5/debianold/info trunk/giac-xcas/giac-0.9.5/debianold/menu trunk/giac-xcas/giac-0.9.5/debianold/rules trunk/giac-xcas/giac-0.9.5/debianold/watch trunk/giac-xcas/giac-0.9.5/debianold/xcas.1 trunk/giac-xcas/giac-0.9.5/examples/ trunk/giac-xcas/giac-0.9.5/examples/Exemples/ trunk/giac-xcas/giac-0.9.5/examples/Exemples/analyse/ trunk/giac-xcas/giac-0.9.5/examples/Exemples/analyse/newton.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/analyse/ode.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/analyse/series_alt.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/analyse/toile.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/arit/ trunk/giac-xcas/giac-0.9.5/examples/Exemples/arit/bezout.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/arit/crible.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/arit/diviseur.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/arit/estprem.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/arit/potence.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/arit/powmod.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/arit/premier.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/capes2006/ trunk/giac-xcas/giac-0.9.5/examples/Exemples/capes2006/0107.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/capes2006/0207.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/capes2006/0307.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/capes2006/0707.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/capes2006/0807.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/capes2006/1407.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/capes2006/1707.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/capes2006/2007.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/capes2006/2107.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/capes2006/2906.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/capes2006/3006.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/climat/ trunk/giac-xcas/giac-0.9.5/examples/Exemples/climat/co2.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/climat/co2t150.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/climat/edc.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/climat/energie.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/climat/glace.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/climat/global_temp.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/climat/insol.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/climat/soleil.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/climat/terre.jpg trunk/giac-xcas/giac-0.9.5/examples/Exemples/climat/terre.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/climat/vostok.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/crypto/ trunk/giac-xcas/giac-0.9.5/examples/Exemples/crypto/cesar.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/crypto/codage.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/crypto/reed_s.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/crypto/rsa.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/demo/ trunk/giac-xcas/giac-0.9.5/examples/Exemples/demo/anniversaire.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/demo/apmep.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/demo/arit.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/demo/calcform.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/demo/milieu.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/demo/milieux.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/demo/napoleon.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/demo/oct06.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/demo/polylogo.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/geo3d/ trunk/giac-xcas/giac-0.9.5/examples/Exemples/geo3d/animcube.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/geo3d/circon3d.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/geo3d/cone.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/geometrie/ trunk/giac-xcas/giac-0.9.5/examples/Exemples/geometrie/animpav.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/geometrie/astroide.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/geometrie/atelier.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/geometrie/capes.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/geometrie/hexagone.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/geometrie/lieu_s05.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/geometrie/morley_demo.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/geometrie/morley_puzzle.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/geometrie/napoleon.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/geometrie/rouepoly.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/geometrie/simson.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/logo/ trunk/giac-xcas/giac-0.9.5/examples/Exemples/logo/fleur.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/logo/jeu.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/logo/neige.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/logo/poule.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/logo/sapin.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/logo/tulipe.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/opengl/ trunk/giac-xcas/giac-0.9.5/examples/Exemples/opengl/sphere.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/opengl/surface.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/poly/ trunk/giac-xcas/giac-0.9.5/examples/Exemples/poly/berle.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/poly/cardan.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/poly/hensel.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/poly/horner.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/poly/pgcd.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/poly/racine.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/poly/reed_sol.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/poly/yun.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/prog/ trunk/giac-xcas/giac-0.9.5/examples/Exemples/prog/arbre.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/prog/conformal.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/prog/exemple.xws trunk/giac-xcas/giac-0.9.5/examples/Exemples/prog/gauss_jordan.xws trunk/giac-xcas/giac-0.9.5/examples/Makefile.am trunk/giac-xcas/giac-0.9.5/examples/Makefile.in trunk/giac-xcas/giac-0.9.5/examples/arit/ trunk/giac-xcas/giac-0.9.5/examples/arit/codage.cas trunk/giac-xcas/giac-0.9.5/examples/arit/estpremier trunk/giac-xcas/giac-0.9.5/examples/arit/horner trunk/giac-xcas/giac-0.9.5/examples/arit/inpg.cas trunk/giac-xcas/giac-0.9.5/examples/arit/nbrediviseur trunk/giac-xcas/giac-0.9.5/examples/arit/numeration trunk/giac-xcas/giac-0.9.5/examples/arit/puissancerapide trunk/giac-xcas/giac-0.9.5/examples/arit/rsa.cxx trunk/giac-xcas/giac-0.9.5/examples/codage/ trunk/giac-xcas/giac-0.9.5/examples/codage/chiffrementaffine trunk/giac-xcas/giac-0.9.5/examples/codage/group2lettres trunk/giac-xcas/giac-0.9.5/examples/codage/julescesar trunk/giac-xcas/giac-0.9.5/examples/codage/rsa trunk/giac-xcas/giac-0.9.5/examples/demo/ trunk/giac-xcas/giac-0.9.5/examples/demo/algos_integrale.cxx trunk/giac-xcas/giac-0.9.5/examples/demo/bezout.cxx trunk/giac-xcas/giac-0.9.5/examples/demo/bissectrice.cxx trunk/giac-xcas/giac-0.9.5/examples/demo/e05.tex trunk/giac-xcas/giac-0.9.5/examples/demo/inpg.cas trunk/giac-xcas/giac-0.9.5/examples/demo/mediane.cxx trunk/giac-xcas/giac-0.9.5/examples/demo/napoleon.cxx trunk/giac-xcas/giac-0.9.5/examples/demo/orthocentre.cxx trunk/giac-xcas/giac-0.9.5/examples/demo/pgcd.cc trunk/giac-xcas/giac-0.9.5/examples/demo/pgcd.cpp trunk/giac-xcas/giac-0.9.5/examples/demo/random.tab trunk/giac-xcas/giac-0.9.5/examples/demo/simpson.cas trunk/giac-xcas/giac-0.9.5/examples/geo/ trunk/giac-xcas/giac-0.9.5/examples/geo/Ngone.cas trunk/giac-xcas/giac-0.9.5/examples/geo/bezier trunk/giac-xcas/giac-0.9.5/examples/geo/bissectrice.cxx trunk/giac-xcas/giac-0.9.5/examples/geo/carres.cxx trunk/giac-xcas/giac-0.9.5/examples/geo/conj_harmonic1.cas trunk/giac-xcas/giac-0.9.5/examples/geo/conj_harmonic2.cas trunk/giac-xcas/giac-0.9.5/examples/geo/conj_harmonic3.cas trunk/giac-xcas/giac-0.9.5/examples/geo/demomorley.cxx trunk/giac-xcas/giac-0.9.5/examples/geo/demomorley2 trunk/giac-xcas/giac-0.9.5/examples/geo/envelop3t trunk/giac-xcas/giac-0.9.5/examples/geo/envelopl trunk/giac-xcas/giac-0.9.5/examples/geo/envelopp trunk/giac-xcas/giac-0.9.5/examples/geo/enveloppe trunk/giac-xcas/giac-0.9.5/examples/geo/enveloppe3 trunk/giac-xcas/giac-0.9.5/examples/geo/envelopt trunk/giac-xcas/giac-0.9.5/examples/geo/equimorley trunk/giac-xcas/giac-0.9.5/examples/geo/feuerbach.cxx trunk/giac-xcas/giac-0.9.5/examples/geo/geo1 trunk/giac-xcas/giac-0.9.5/examples/geo/geo10 trunk/giac-xcas/giac-0.9.5/examples/geo/geo11 trunk/giac-xcas/giac-0.9.5/examples/geo/geo12 trunk/giac-xcas/giac-0.9.5/examples/geo/geo13 trunk/giac-xcas/giac-0.9.5/examples/geo/geo2 trunk/giac-xcas/giac-0.9.5/examples/geo/geo3 trunk/giac-xcas/giac-0.9.5/examples/geo/geo4 trunk/giac-xcas/giac-0.9.5/examples/geo/geo5 trunk/giac-xcas/giac-0.9.5/examples/geo/geo6 trunk/giac-xcas/giac-0.9.5/examples/geo/geo7 trunk/giac-xcas/giac-0.9.5/examples/geo/geo8 trunk/giac-xcas/giac-0.9.5/examples/geo/geo9 trunk/giac-xcas/giac-0.9.5/examples/geo/lieu1 trunk/giac-xcas/giac-0.9.5/examples/geo/lieu2 trunk/giac-xcas/giac-0.9.5/examples/geo/lieu3 trunk/giac-xcas/giac-0.9.5/examples/geo/lieu4 trunk/giac-xcas/giac-0.9.5/examples/geo/lieu5 trunk/giac-xcas/giac-0.9.5/examples/geo/mediane.cxx trunk/giac-xcas/giac-0.9.5/examples/geo/mediatrice.cxx trunk/giac-xcas/giac-0.9.5/examples/geo/minimum.cxx trunk/giac-xcas/giac-0.9.5/examples/geo/morley1.fig trunk/giac-xcas/giac-0.9.5/examples/geo/morley108 trunk/giac-xcas/giac-0.9.5/examples/geo/morley18 trunk/giac-xcas/giac-0.9.5/examples/geo/morley2.fig trunk/giac-xcas/giac-0.9.5/examples/geo/morleydess18 trunk/giac-xcas/giac-0.9.5/examples/geo/morleylem trunk/giac-xcas/giac-0.9.5/examples/geo/morleypara trunk/giac-xcas/giac-0.9.5/examples/geo/morleypuzzel trunk/giac-xcas/giac-0.9.5/examples/geo/morleytri6 trunk/giac-xcas/giac-0.9.5/examples/geo/morphing trunk/giac-xcas/giac-0.9.5/examples/geo/napoleon trunk/giac-xcas/giac-0.9.5/examples/geo/napoleon.cxx trunk/giac-xcas/giac-0.9.5/examples/geo/orbite.cas trunk/giac-xcas/giac-0.9.5/examples/geo/orthocentre.cxx trunk/giac-xcas/giac-0.9.5/examples/geo/pantalon trunk/giac-xcas/giac-0.9.5/examples/geo/pantalon2 trunk/giac-xcas/giac-0.9.5/examples/geo/pointmorph trunk/giac-xcas/giac-0.9.5/examples/geo/puissance.cas trunk/giac-xcas/giac-0.9.5/examples/geo/puissance2.cas trunk/giac-xcas/giac-0.9.5/examples/geo/simpson.cxx trunk/giac-xcas/giac-0.9.5/examples/geo/terre.cas trunk/giac-xcas/giac-0.9.5/examples/groebner/ trunk/giac-xcas/giac-0.9.5/examples/groebner/cyclic3 trunk/giac-xcas/giac-0.9.5/examples/groebner/cyclic4 trunk/giac-xcas/giac-0.9.5/examples/groebner/cyclic5 trunk/giac-xcas/giac-0.9.5/examples/groebner/cyclic6 trunk/giac-xcas/giac-0.9.5/examples/lewisw/ trunk/giac-xcas/giac-0.9.5/examples/lewisw/fermat_gcd_1var trunk/giac-xcas/giac-0.9.5/examples/lewisw/fermat_gcd_4var trunk/giac-xcas/giac-0.9.5/examples/lewisw/fermat_gcd_mod_1var trunk/giac-xcas/giac-0.9.5/examples/lewisw/fermat_gcd_mod_4var trunk/giac-xcas/giac-0.9.5/examples/lewisw/lw4 trunk/giac-xcas/giac-0.9.5/examples/lewisw/lwA trunk/giac-xcas/giac-0.9.5/examples/lewisw/lwB trunk/giac-xcas/giac-0.9.5/examples/lewisw/lwC trunk/giac-xcas/giac-0.9.5/examples/lewisw/lwD trunk/giac-xcas/giac-0.9.5/examples/lewisw/lwE trunk/giac-xcas/giac-0.9.5/examples/lewisw/lwF trunk/giac-xcas/giac-0.9.5/examples/lewisw/lwG trunk/giac-xcas/giac-0.9.5/examples/lewisw/lwHL trunk/giac-xcas/giac-0.9.5/examples/lewisw/lwM trunk/giac-xcas/giac-0.9.5/examples/lewisw/lwM2 trunk/giac-xcas/giac-0.9.5/examples/lewisw/lwN trunk/giac-xcas/giac-0.9.5/examples/lewisw/lwN1 trunk/giac-xcas/giac-0.9.5/examples/lewisw/lwO trunk/giac-xcas/giac-0.9.5/examples/lewisw/lwPQ trunk/giac-xcas/giac-0.9.5/examples/lewisw/lwX trunk/giac-xcas/giac-0.9.5/examples/linalg/ trunk/giac-xcas/giac-0.9.5/examples/linalg/gaussjordan_noyau.cas trunk/giac-xcas/giac-0.9.5/examples/linalg/gaussjordan_noyau1.cas trunk/giac-xcas/giac-0.9.5/examples/morley/ trunk/giac-xcas/giac-0.9.5/examples/morley/calcul18 trunk/giac-xcas/giac-0.9.5/examples/morley/demomorley1 trunk/giac-xcas/giac-0.9.5/examples/morley/demonfig2 trunk/giac-xcas/giac-0.9.5/examples/morley/dessinlem trunk/giac-xcas/giac-0.9.5/examples/morley/equimore trunk/giac-xcas/giac-0.9.5/examples/morley/figure1 trunk/giac-xcas/giac-0.9.5/examples/morley/figure2 trunk/giac-xcas/giac-0.9.5/examples/morley/fiqure1 trunk/giac-xcas/giac-0.9.5/examples/morley/morley trunk/giac-xcas/giac-0.9.5/examples/morley/morley108 trunk/giac-xcas/giac-0.9.5/examples/morley/morley18 trunk/giac-xcas/giac-0.9.5/examples/morley/morleynum trunk/giac-xcas/giac-0.9.5/examples/morley/morleypara trunk/giac-xcas/giac-0.9.5/examples/morley/puzzel trunk/giac-xcas/giac-0.9.5/examples/morley/trisectfig trunk/giac-xcas/giac-0.9.5/examples/polyfact/ trunk/giac-xcas/giac-0.9.5/examples/polyfact/zimmer1 trunk/giac-xcas/giac-0.9.5/examples/polyfact/zimmer2 trunk/giac-xcas/giac-0.9.5/examples/polyfact/zimmer3 trunk/giac-xcas/giac-0.9.5/examples/polyfact/zimmer4 trunk/giac-xcas/giac-0.9.5/examples/polyfact/zimmer5 trunk/giac-xcas/giac-0.9.5/examples/polyfact/zimmer6 trunk/giac-xcas/giac-0.9.5/examples/polyfact/zimmer7 trunk/giac-xcas/giac-0.9.5/examples/recur/ trunk/giac-xcas/giac-0.9.5/examples/recur/autres.cxx trunk/giac-xcas/giac-0.9.5/examples/recur/carre.cxx trunk/giac-xcas/giac-0.9.5/examples/recur/dragon.cxx trunk/giac-xcas/giac-0.9.5/examples/recur/flocon.cxx trunk/giac-xcas/giac-0.9.5/examples/recur/peano.cxx trunk/giac-xcas/giac-0.9.5/examples/recur/peanoarc.cas trunk/giac-xcas/giac-0.9.5/examples/recur/permutation.cxx trunk/giac-xcas/giac-0.9.5/examples/recur/plantes.cxx trunk/giac-xcas/giac-0.9.5/examples/recur/polygone.cxx trunk/giac-xcas/giac-0.9.5/examples/recur/session.cxx trunk/giac-xcas/giac-0.9.5/examples/recur/sphinx.cxx trunk/giac-xcas/giac-0.9.5/examples/recur/sphynx.cxx trunk/giac-xcas/giac-0.9.5/examples/recur/triangle.cxx trunk/giac-xcas/giac-0.9.5/examples/recur/trisierpinski.cas trunk/giac-xcas/giac-0.9.5/examples/simulation/ trunk/giac-xcas/giac-0.9.5/examples/simulation/deplacement trunk/giac-xcas/giac-0.9.5/examples/simulation/pains trunk/giac-xcas/giac-0.9.5/examples/tortue/ trunk/giac-xcas/giac-0.9.5/examples/tortue/arbre.cxx trunk/giac-xcas/giac-0.9.5/examples/tortue/dragon.cxx trunk/giac-xcas/giac-0.9.5/examples/tortue/gosper.cxx trunk/giac-xcas/giac-0.9.5/examples/tortue/hilbert.cxx trunk/giac-xcas/giac-0.9.5/examples/tortue/koch.cxx trunk/giac-xcas/giac-0.9.5/examples/tortue/peano.cxx trunk/giac-xcas/giac-0.9.5/examples/tortue/sapin.cxx trunk/giac-xcas/giac-0.9.5/fltk.1.1.changes trunk/giac-xcas/giac-0.9.5/giac.specs trunk/giac-xcas/giac-0.9.5/giac.specs32 trunk/giac-xcas/giac-0.9.5/inst trunk/giac-xcas/giac-0.9.5/intl/ trunk/giac-xcas/giac-0.9.5/intl/ChangeLog trunk/giac-xcas/giac-0.9.5/intl/Makefile.in trunk/giac-xcas/giac-0.9.5/intl/VERSION trunk/giac-xcas/giac-0.9.5/intl/bindtextdom.c trunk/giac-xcas/giac-0.9.5/intl/config.charset trunk/giac-xcas/giac-0.9.5/intl/dcgettext.c trunk/giac-xcas/giac-0.9.5/intl/dcigettext.c trunk/giac-xcas/giac-0.9.5/intl/dcngettext.c trunk/giac-xcas/giac-0.9.5/intl/dgettext.c trunk/giac-xcas/giac-0.9.5/intl/dngettext.c trunk/giac-xcas/giac-0.9.5/intl/eval-plural.h trunk/giac-xcas/giac-0.9.5/intl/explodename.c trunk/giac-xcas/giac-0.9.5/intl/finddomain.c trunk/giac-xcas/giac-0.9.5/intl/gettext.c trunk/giac-xcas/giac-0.9.5/intl/gettextP.h trunk/giac-xcas/giac-0.9.5/intl/gmo.h trunk/giac-xcas/giac-0.9.5/intl/hash-string.h trunk/giac-xcas/giac-0.9.5/intl/intl-compat.c trunk/giac-xcas/giac-0.9.5/intl/l10nflist.c trunk/giac-xcas/giac-0.9.5/intl/langprefs.c trunk/giac-xcas/giac-0.9.5/intl/libgnuintl.h.in trunk/giac-xcas/giac-0.9.5/intl/loadinfo.h trunk/giac-xcas/giac-0.9.5/intl/loadmsgcat.c trunk/giac-xcas/giac-0.9.5/intl/localcharset.c trunk/giac-xcas/giac-0.9.5/intl/localcharset.h trunk/giac-xcas/giac-0.9.5/intl/locale.alias trunk/giac-xcas/giac-0.9.5/intl/localealias.c trunk/giac-xcas/giac-0.9.5/intl/localename.c trunk/giac-xcas/giac-0.9.5/intl/log.c trunk/giac-xcas/giac-0.9.5/intl/ngettext.c trunk/giac-xcas/giac-0.9.5/intl/os2compat.c trunk/giac-xcas/giac-0.9.5/intl/os2compat.h trunk/giac-xcas/giac-0.9.5/intl/osdep.c trunk/giac-xcas/giac-0.9.5/intl/plural-exp.c trunk/giac-xcas/giac-0.9.5/intl/plural-exp.h trunk/giac-xcas/giac-0.9.5/intl/plural.c trunk/giac-xcas/giac-0.9.5/intl/plural.y trunk/giac-xcas/giac-0.9.5/intl/printf-args.c trunk/giac-xcas/giac-0.9.5/intl/printf-args.h trunk/giac-xcas/giac-0.9.5/intl/printf-parse.c trunk/giac-xcas/giac-0.9.5/intl/printf-parse.h trunk/giac-xcas/giac-0.9.5/intl/printf.c trunk/giac-xcas/giac-0.9.5/intl/ref-add.sin trunk/giac-xcas/giac-0.9.5/intl/ref-del.sin trunk/giac-xcas/giac-0.9.5/intl/relocatable.c trunk/giac-xcas/giac-0.9.5/intl/relocatable.h trunk/giac-xcas/giac-0.9.5/intl/textdomain.c trunk/giac-xcas/giac-0.9.5/intl/vasnprintf.c trunk/giac-xcas/giac-0.9.5/intl/vasnprintf.h trunk/giac-xcas/giac-0.9.5/intl/vasnwprintf.h trunk/giac-xcas/giac-0.9.5/intl/wprintf-parse.h trunk/giac-xcas/giac-0.9.5/intl/xsize.h trunk/giac-xcas/giac-0.9.5/m4/ trunk/giac-xcas/giac-0.9.5/m4/codeset.m4 trunk/giac-xcas/giac-0.9.5/m4/gettext.m4 trunk/giac-xcas/giac-0.9.5/m4/glibc2.m4 trunk/giac-xcas/giac-0.9.5/m4/glibc21.m4 trunk/giac-xcas/giac-0.9.5/m4/iconv.m4 trunk/giac-xcas/giac-0.9.5/m4/intdiv0.m4 trunk/giac-xcas/giac-0.9.5/m4/intmax.m4 trunk/giac-xcas/giac-0.9.5/m4/inttypes-pri.m4 trunk/giac-xcas/giac-0.9.5/m4/inttypes.m4 trunk/giac-xcas/giac-0.9.5/m4/inttypes_h.m4 trunk/giac-xcas/giac-0.9.5/m4/isc-posix.m4 trunk/giac-xcas/giac-0.9.5/m4/lcmessage.m4 trunk/giac-xcas/giac-0.9.5/m4/lib-ld.m4 trunk/giac-xcas/giac-0.9.5/m4/lib-link.m4 trunk/giac-xcas/giac-0.9.5/m4/lib-prefix.m4 trunk/giac-xcas/giac-0.9.5/m4/libtool.m4 trunk/giac-xcas/giac-0.9.5/m4/longdouble.m4 trunk/giac-xcas/giac-0.9.5/m4/longlong.m4 trunk/giac-xcas/giac-0.9.5/m4/ltoptions.m4 trunk/giac-xcas/giac-0.9.5/m4/ltsugar.m4 trunk/giac-xcas/giac-0.9.5/m4/ltversion.m4 trunk/giac-xcas/giac-0.9.5/m4/lt~obsolete.m4 trunk/giac-xcas/giac-0.9.5/m4/nls.m4 trunk/giac-xcas/giac-0.9.5/m4/po.m4 trunk/giac-xcas/giac-0.9.5/m4/printf-posix.m4 trunk/giac-xcas/giac-0.9.5/m4/progtest.m4 trunk/giac-xcas/giac-0.9.5/m4/signed.m4 trunk/giac-xcas/giac-0.9.5/m4/size_max.m4 trunk/giac-xcas/giac-0.9.5/m4/stdint_h.m4 trunk/giac-xcas/giac-0.9.5/m4/uintmax_t.m4 trunk/giac-xcas/giac-0.9.5/m4/ulonglong.m4 trunk/giac-xcas/giac-0.9.5/m4/wchar_t.m4 trunk/giac-xcas/giac-0.9.5/m4/wint_t.m4 trunk/giac-xcas/giac-0.9.5/m4/xsize.m4 trunk/giac-xcas/giac-0.9.5/mkdebian trunk/giac-xcas/giac-0.9.5/mkdebian2 trunk/giac-xcas/giac-0.9.5/mkinstalldirs trunk/giac-xcas/giac-0.9.5/mkiphone trunk/giac-xcas/giac-0.9.5/mkosx trunk/giac-xcas/giac-0.9.5/pariinl.h trunk/giac-xcas/giac-0.9.5/path.h.in trunk/giac-xcas/giac-0.9.5/path.iphone trunk/giac-xcas/giac-0.9.5/po/ trunk/giac-xcas/giac-0.9.5/po/ChangeLog trunk/giac-xcas/giac-0.9.5/po/Makefile.in.in trunk/giac-xcas/giac-0.9.5/po/Makevars trunk/giac-xcas/giac-0.9.5/po/POTFILES.in trunk/giac-xcas/giac-0.9.5/po/Rules-quot trunk/giac-xcas/giac-0.9.5/po/boldquot.sed trunk/giac-xcas/giac-0.9.5/po/el.gmo trunk/giac-xcas/giac-0.9.5/po/el.po trunk/giac-xcas/giac-0.9.5/po/en.gmo trunk/giac-xcas/giac-0.9.5/po/en.po trunk/giac-xcas/giac-0.9.5/po/en@boldquot.header trunk/giac-xcas/giac-0.9.5/po/en@quot.header trunk/giac-xcas/giac-0.9.5/po/es.gmo trunk/giac-xcas/giac-0.9.5/po/es.po trunk/giac-xcas/giac-0.9.5/po/fr.gmo trunk/giac-xcas/giac-0.9.5/po/fr.po trunk/giac-xcas/giac-0.9.5/po/giac.pot trunk/giac-xcas/giac-0.9.5/po/insert-header.sin trunk/giac-xcas/giac-0.9.5/po/it.gmo trunk/giac-xcas/giac-0.9.5/po/it.po trunk/giac-xcas/giac-0.9.5/po/pt.gmo trunk/giac-xcas/giac-0.9.5/po/pt.po trunk/giac-xcas/giac-0.9.5/po/quot.sed trunk/giac-xcas/giac-0.9.5/po/remove-potcdate.sin trunk/giac-xcas/giac-0.9.5/po/stamp-po trunk/giac-xcas/giac-0.9.5/po/zh.gmo trunk/giac-xcas/giac-0.9.5/po/zh.po trunk/giac-xcas/giac-0.9.5/setup trunk/giac-xcas/giac-0.9.5/simupath.iphone trunk/giac-xcas/giac-0.9.5/src/ trunk/giac-xcas/giac-0.9.5/src/.gdbinit trunk/giac-xcas/giac-0.9.5/src/COPYING trunk/giac-xcas/giac-0.9.5/src/Cfg.cc trunk/giac-xcas/giac-0.9.5/src/Cfg.h trunk/giac-xcas/giac-0.9.5/src/Editeur.cc trunk/giac-xcas/giac-0.9.5/src/Editeur.h trunk/giac-xcas/giac-0.9.5/src/Equation.cc trunk/giac-xcas/giac-0.9.5/src/Equation.h trunk/giac-xcas/giac-0.9.5/src/Fl_GDI_Printer.cxx trunk/giac-xcas/giac-0.9.5/src/Fl_Gl_Choice.H trunk/giac-xcas/giac-0.9.5/src/Fl_PS_Printer.cxx trunk/giac-xcas/giac-0.9.5/src/Flv_CStyle.H trunk/giac-xcas/giac-0.9.5/src/Flv_CStyle.cc trunk/giac-xcas/giac-0.9.5/src/Flv_Data_Source.H trunk/giac-xcas/giac-0.9.5/src/Flv_Data_Source.cc trunk/giac-xcas/giac-0.9.5/src/Flv_List.H trunk/giac-xcas/giac-0.9.5/src/Flv_List.cc trunk/giac-xcas/giac-0.9.5/src/Flv_Style.H trunk/giac-xcas/giac-0.9.5/src/Flv_Style.cc trunk/giac-xcas/giac-0.9.5/src/Flv_Table.H trunk/giac-xcas/giac-0.9.5/src/Flv_Table.cc trunk/giac-xcas/giac-0.9.5/src/Flve_Check_Button.H trunk/giac-xcas/giac-0.9.5/src/Flve_Check_Button.cc trunk/giac-xcas/giac-0.9.5/src/Flve_Combo.H trunk/giac-xcas/giac-0.9.5/src/Flve_Combo.cc trunk/giac-xcas/giac-0.9.5/src/Flve_Input.H trunk/giac-xcas/giac-0.9.5/src/Flve_Input.cc trunk/giac-xcas/giac-0.9.5/src/Graph.cc trunk/giac-xcas/giac-0.9.5/src/Graph.h trunk/giac-xcas/giac-0.9.5/src/Graph3d.cc trunk/giac-xcas/giac-0.9.5/src/Graph3d.h trunk/giac-xcas/giac-0.9.5/src/Help1.cc trunk/giac-xcas/giac-0.9.5/src/Help1.h trunk/giac-xcas/giac-0.9.5/src/History.cc trunk/giac-xcas/giac-0.9.5/src/History.h trunk/giac-xcas/giac-0.9.5/src/Input.cc trunk/giac-xcas/giac-0.9.5/src/Input.h trunk/giac-xcas/giac-0.9.5/src/Makefile.64 trunk/giac-xcas/giac-0.9.5/src/Makefile.O3 trunk/giac-xcas/giac-0.9.5/src/Makefile.am trunk/giac-xcas/giac-0.9.5/src/Makefile.android trunk/giac-xcas/giac-0.9.5/src/Makefile.fast trunk/giac-xcas/giac-0.9.5/src/Makefile.in trunk/giac-xcas/giac-0.9.5/src/Makefile.ipaq trunk/giac-xcas/giac-0.9.5/src/Makefile.iphone trunk/giac-xcas/giac-0.9.5/src/Makefile.osx trunk/giac-xcas/giac-0.9.5/src/Makefile.rpm trunk/giac-xcas/giac-0.9.5/src/Makefile.vcc trunk/giac-xcas/giac-0.9.5/src/Makefile.win trunk/giac-xcas/giac-0.9.5/src/Makefile.wince trunk/giac-xcas/giac-0.9.5/src/Makefilenew.ipaq trunk/giac-xcas/giac-0.9.5/src/Print.cc trunk/giac-xcas/giac-0.9.5/src/Print.h trunk/giac-xcas/giac-0.9.5/src/README trunk/giac-xcas/giac-0.9.5/src/README.WIN trunk/giac-xcas/giac-0.9.5/src/README.ipaq trunk/giac-xcas/giac-0.9.5/src/TODO trunk/giac-xcas/giac-0.9.5/src/Tableur.cc trunk/giac-xcas/giac-0.9.5/src/Tableur.h trunk/giac-xcas/giac-0.9.5/src/TmpFGLM.C trunk/giac-xcas/giac-0.9.5/src/TmpFGLM.H trunk/giac-xcas/giac-0.9.5/src/TmpLESystemSolver.C trunk/giac-xcas/giac-0.9.5/src/TmpLESystemSolver.H trunk/giac-xcas/giac-0.9.5/src/Xcas1.cc trunk/giac-xcas/giac-0.9.5/src/Xcas1.h trunk/giac-xcas/giac-0.9.5/src/aide.cc trunk/giac-xcas/giac-0.9.5/src/alg_ext.cc trunk/giac-xcas/giac-0.9.5/src/alg_ext.h trunk/giac-xcas/giac-0.9.5/src/all_global_var trunk/giac-xcas/giac-0.9.5/src/blaswrap.h trunk/giac-xcas/giac-0.9.5/src/cas2.cc trunk/giac-xcas/giac-0.9.5/src/cas2html.cc trunk/giac-xcas/giac-0.9.5/src/casce.cc trunk/giac-xcas/giac-0.9.5/src/casctrl.cc trunk/giac-xcas/giac-0.9.5/src/clapack.h trunk/giac-xcas/giac-0.9.5/src/cocoa.cc trunk/giac-xcas/giac-0.9.5/src/cocoa.h trunk/giac-xcas/giac-0.9.5/src/compile_android trunk/giac-xcas/giac-0.9.5/src/config.h trunk/giac-xcas/giac-0.9.5/src/config.h.android trunk/giac-xcas/giac-0.9.5/src/config.h.iphone trunk/giac-xcas/giac-0.9.5/src/config.h.vcc trunk/giac-xcas/giac-0.9.5/src/csturm.cc trunk/giac-xcas/giac-0.9.5/src/csturm.h trunk/giac-xcas/giac-0.9.5/src/derive.cc trunk/giac-xcas/giac-0.9.5/src/derive.h trunk/giac-xcas/giac-0.9.5/src/desolve.cc trunk/giac-xcas/giac-0.9.5/src/desolve.h trunk/giac-xcas/giac-0.9.5/src/dispatch.h trunk/giac-xcas/giac-0.9.5/src/dvips.bat trunk/giac-xcas/giac-0.9.5/src/ezgcd.cc trunk/giac-xcas/giac-0.9.5/src/ezgcd.h trunk/giac-xcas/giac-0.9.5/src/f2c.h trunk/giac-xcas/giac-0.9.5/src/factor.cc trunk/giac-xcas/giac-0.9.5/src/find_global_var.cc trunk/giac-xcas/giac-0.9.5/src/first.cc trunk/giac-xcas/giac-0.9.5/src/first.h trunk/giac-xcas/giac-0.9.5/src/fraction.h trunk/giac-xcas/giac-0.9.5/src/gauss.cc trunk/giac-xcas/giac-0.9.5/src/gauss.h trunk/giac-xcas/giac-0.9.5/src/gausspol.cc trunk/giac-xcas/giac-0.9.5/src/gausspol.h trunk/giac-xcas/giac-0.9.5/src/gen.cc trunk/giac-xcas/giac-0.9.5/src/gen.h trunk/giac-xcas/giac-0.9.5/src/gen_user trunk/giac-xcas/giac-0.9.5/src/giac.h trunk/giac-xcas/giac-0.9.5/src/giac.pl trunk/giac-xcas/giac-0.9.5/src/giacPCH.h trunk/giac-xcas/giac-0.9.5/src/giac_oo.cpp trunk/giac-xcas/giac-0.9.5/src/giacintl.h trunk/giac-xcas/giac-0.9.5/src/giaclib.vcproj trunk/giac-xcas/giac-0.9.5/src/gl2ps.c trunk/giac-xcas/giac-0.9.5/src/gl2ps.h trunk/giac-xcas/giac-0.9.5/src/global.cc trunk/giac-xcas/giac-0.9.5/src/global.h trunk/giac-xcas/giac-0.9.5/src/gmp_replacements.h trunk/giac-xcas/giac-0.9.5/src/help.cc trunk/giac-xcas/giac-0.9.5/src/help.h trunk/giac-xcas/giac-0.9.5/src/hist.cxx trunk/giac-xcas/giac-0.9.5/src/hist.fl trunk/giac-xcas/giac-0.9.5/src/hist.h trunk/giac-xcas/giac-0.9.5/src/hist.menus trunk/giac-xcas/giac-0.9.5/src/icas.cc trunk/giac-xcas/giac-0.9.5/src/identificateur.cc trunk/giac-xcas/giac-0.9.5/src/identificateur.h trunk/giac-xcas/giac-0.9.5/src/ifactor.cc trunk/giac-xcas/giac-0.9.5/src/ifactor.h trunk/giac-xcas/giac-0.9.5/src/index.cc trunk/giac-xcas/giac-0.9.5/src/index.h trunk/giac-xcas/giac-0.9.5/src/input_lexer.cc trunk/giac-xcas/giac-0.9.5/src/input_lexer.h trunk/giac-xcas/giac-0.9.5/src/input_lexer.ll trunk/giac-xcas/giac-0.9.5/src/input_parser.cc trunk/giac-xcas/giac-0.9.5/src/input_parser.h trunk/giac-xcas/giac-0.9.5/src/input_parser.yy trunk/giac-xcas/giac-0.9.5/src/integrate.cc trunk/giac-xcas/giac-0.9.5/src/intg.cc trunk/giac-xcas/giac-0.9.5/src/intg.h trunk/giac-xcas/giac-0.9.5/src/intgab.cc trunk/giac-xcas/giac-0.9.5/src/intgab.h trunk/giac-xcas/giac-0.9.5/src/ipaq_usr.tgz trunk/giac-xcas/giac-0.9.5/src/isom.cc trunk/giac-xcas/giac-0.9.5/src/isom.h trunk/giac-xcas/giac-0.9.5/src/latex.bat trunk/giac-xcas/giac-0.9.5/src/lexer.h trunk/giac-xcas/giac-0.9.5/src/lexer_tab_int.h trunk/giac-xcas/giac-0.9.5/src/lin.cc trunk/giac-xcas/giac-0.9.5/src/lin.h trunk/giac-xcas/giac-0.9.5/src/maple.cc trunk/giac-xcas/giac-0.9.5/src/maple.h trunk/giac-xcas/giac-0.9.5/src/mathml.cc trunk/giac-xcas/giac-0.9.5/src/mathml.h trunk/giac-xcas/giac-0.9.5/src/misc.cc trunk/giac-xcas/giac-0.9.5/src/misc.h trunk/giac-xcas/giac-0.9.5/src/mkaout trunk/giac-xcas/giac-0.9.5/src/mkgcas trunk/giac-xcas/giac-0.9.5/src/mkhist trunk/giac-xcas/giac-0.9.5/src/mkmingw trunk/giac-xcas/giac-0.9.5/src/mkstat trunk/giac-xcas/giac-0.9.5/src/mkwcas trunk/giac-xcas/giac-0.9.5/src/mkxcas trunk/giac-xcas/giac-0.9.5/src/modfactor.cc trunk/giac-xcas/giac-0.9.5/src/modfactor.h trunk/giac-xcas/giac-0.9.5/src/modpoly.cc trunk/giac-xcas/giac-0.9.5/src/modpoly.h trunk/giac-xcas/giac-0.9.5/src/monomial.h trunk/giac-xcas/giac-0.9.5/src/moyal.cc trunk/giac-xcas/giac-0.9.5/src/moyal.h trunk/giac-xcas/giac-0.9.5/src/normalize.cc trunk/giac-xcas/giac-0.9.5/src/pari.cc trunk/giac-xcas/giac-0.9.5/src/pari.h trunk/giac-xcas/giac-0.9.5/src/partfrac.cc trunk/giac-xcas/giac-0.9.5/src/path.h trunk/giac-xcas/giac-0.9.5/src/permu.cc trunk/giac-xcas/giac-0.9.5/src/permu.h trunk/giac-xcas/giac-0.9.5/src/pgiac trunk/giac-xcas/giac-0.9.5/src/plot.cc trunk/giac-xcas/giac-0.9.5/src/plot.h trunk/giac-xcas/giac-0.9.5/src/plot3d.cc trunk/giac-xcas/giac-0.9.5/src/plot3d.h trunk/giac-xcas/giac-0.9.5/src/poly.h trunk/giac-xcas/giac-0.9.5/src/prime.table trunk/giac-xcas/giac-0.9.5/src/prog.cc trunk/giac-xcas/giac-0.9.5/src/prog.h trunk/giac-xcas/giac-0.9.5/src/quater.cc trunk/giac-xcas/giac-0.9.5/src/quater.h trunk/giac-xcas/giac-0.9.5/src/readme.doc trunk/giac-xcas/giac-0.9.5/src/renee.cc trunk/giac-xcas/giac-0.9.5/src/renee.h trunk/giac-xcas/giac-0.9.5/src/risch.cc trunk/giac-xcas/giac-0.9.5/src/risch.h trunk/giac-xcas/giac-0.9.5/src/rpn.cc trunk/giac-xcas/giac-0.9.5/src/rpn.h trunk/giac-xcas/giac-0.9.5/src/series.cc trunk/giac-xcas/giac-0.9.5/src/series.h trunk/giac-xcas/giac-0.9.5/src/softmath.cc trunk/giac-xcas/giac-0.9.5/src/softmath.h trunk/giac-xcas/giac-0.9.5/src/solve.cc trunk/giac-xcas/giac-0.9.5/src/solve.h trunk/giac-xcas/giac-0.9.5/src/static.h trunk/giac-xcas/giac-0.9.5/src/static_extern.h trunk/giac-xcas/giac-0.9.5/src/static_help.h trunk/giac-xcas/giac-0.9.5/src/static_init trunk/giac-xcas/giac-0.9.5/src/static_lexer.h trunk/giac-xcas/giac-0.9.5/src/static_lexer_.h trunk/giac-xcas/giac-0.9.5/src/subst.cc trunk/giac-xcas/giac-0.9.5/src/subst.h trunk/giac-xcas/giac-0.9.5/src/sym2poly.cc trunk/giac-xcas/giac-0.9.5/src/sym2poly.h trunk/giac-xcas/giac-0.9.5/src/symbolic.cc trunk/giac-xcas/giac-0.9.5/src/symbolic.h trunk/giac-xcas/giac-0.9.5/src/tex.cc trunk/giac-xcas/giac-0.9.5/src/tex.h trunk/giac-xcas/giac-0.9.5/src/threaded.cc trunk/giac-xcas/giac-0.9.5/src/threaded.h trunk/giac-xcas/giac-0.9.5/src/ti89.cc trunk/giac-xcas/giac-0.9.5/src/ti89.h trunk/giac-xcas/giac-0.9.5/src/tinymt32.cc trunk/giac-xcas/giac-0.9.5/src/tinymt32.h trunk/giac-xcas/giac-0.9.5/src/tinymt32_license.h trunk/giac-xcas/giac-0.9.5/src/unary.cc trunk/giac-xcas/giac-0.9.5/src/unary.h trunk/giac-xcas/giac-0.9.5/src/update.bat trunk/giac-xcas/giac-0.9.5/src/update.sh trunk/giac-xcas/giac-0.9.5/src/usual.cc trunk/giac-xcas/giac-0.9.5/src/usual.h trunk/giac-xcas/giac-0.9.5/src/vecteur.cc trunk/giac-xcas/giac-0.9.5/src/vecteur.h trunk/giac-xcas/giac-0.9.5/src/vector.h trunk/giac-xcas/giac-0.9.5/src/xcas.cc trunk/giac-xcas/giac-0.9.5/src/xcas.cxx trunk/giac-xcas/giac-0.9.5/src/xcasce.cc trunk/giac-xcas/giac-0.9.5/src/xcasctrl.cc trunk/giac-xcas/giac-0.9.5/src/xcasen.sh trunk/giac-xcas/giac-0.9.5/src/xcases.bat trunk/giac-xcas/giac-0.9.5/src/xcases.sh trunk/giac-xcas/giac-0.9.5/src/xcasfr.bat trunk/giac-xcas/giac-0.9.5/src/xcasfr.sh trunk/giac-xcas/giac-0.9.5/src/xdvi.bat trunk/giac-xcas/giac-0.9.5/src/xgiac trunk/giac-xcas/giac-0.9.5/win2unix.cc trunk/giac-xcas/giac-0.9.5/xcas.applications trunk/giac-xcas/giac-0.9.5/xcas.desktop trunk/giac-xcas/giac-0.9.5/xcas.nsi trunk/giac-xcas/giac-0.9.5/xcas.xpm Property changes on: trunk/giac-xcas/giac-0.9.5 ___________________________________________________________________ Added: bugtraq:number + true Added: trunk/giac-xcas/giac-0.9.5/ABOUT-NLS =================================================================== --- trunk/giac-xcas/giac-0.9.5/ABOUT-NLS (rev 0) +++ trunk/giac-xcas/giac-0.9.5/ABOUT-NLS 2011-11-18 13:07:01 UTC (rev 782) @@ -0,0 +1,996 @@ +1 Notes on the Free Translation Project +*************************************** + +Free software is going international! The Free Translation Project is +a way to get maintainers of free software, translators, and users all +together, so that free software will gradually become able to speak many +languages. A few packages already provide translations for their +messages. + + If you found this `ABOUT-NLS' file inside a distribution, you may +assume that the distributed package does use GNU `gettext' internally, +itself available at your nearest GNU archive site. But you do _not_ +need to install GNU `gettext' prior to configuring, installing or using +this package with messages translated. + + Installers will find here some useful hints. These notes also +explain how users should proceed for getting the programs to use the +available translations. They tell how people wanting to contribute and +work on translations can contact the appropriate team. + + When reporting bugs in the `intl/' directory or bugs which may be +related to internationalization, you should tell about the version of +`gettext' which is used. The information can be found in the +`intl/VERSION' file, in internationalized packages. + +1.1 Quick configuration advice +============================== + +If you want to exploit the full power of internationalization, you +should configure it using + + ./configure --with-included-gettext + +to force usage of internationalizing routines provided within this +package, despite the existence of internationalizing capabilities in the +operating system where this package is being installed. So far, only +the `gettext' implementation in the GNU C library version 2 provides as +many features (such as locale alias, message inheritance, automatic +charset conversion or plural form handling) as the implementation here. +It is also not possible to offer this additional functionality on top +of a `catgets' implementation. Future versions of GNU `gettext' will +very likely convey even more functionality. So it might be a good idea +to change to GNU `gettext' as soon as possible. + + So you need _not_ provide this option if you are using GNU libc 2 or +you have installed a recent copy of the GNU gettext package with the +included `libintl'. + +1.2 INSTALL Matters +=================== + +Some packages are "localizable" when properly installed; the programs +they contain can be made to speak your own native language. Most such +packages use GNU `gettext'. Other packages have their own ways to +internationalization, predating GNU `gettext'. + + By default, this package will be installed to allow translation of +messages. It will automatically detect whether the system already +provides the GNU `gettext' functions. If not, the included GNU +`gettext' library will be used. This library is wholly contained +within this package, usually in the `intl/' subdirectory, so prior +installation of the GNU `gettext' package is _not_ required. +Installers may use special options at configuration time for changing +the default behaviour. The commands: + + ./configure --with-included-gettext + ./configure --disable-nls + +will, respectively, bypass any pre-existing `gettext' to use the +internationalizing routines provided within this package, or else, +_totally_ disable translation of messages. + + When you already have GNU `gettext' installed on your system and run +configure without an option for your new package, `configure' will +probably detect the previously built and installed `libintl.a' file and +will decide to use this. This might not be desirable. You should use +the more recent version of the GNU `gettext' library. I.e. if the file +`intl/VERSION' shows that the library which comes with this package is +more recent, you should use + + ./configure --with-included-gettext + +to prevent auto-detection. + + The configuration process will not test for the `catgets' function +and therefore it will not be used. The reason is that even an +emulation of `gettext' on top of `catgets' could not provide all the +extensions of the GNU `gettext' library. + + Internationalized packages usually have many `po/LL.po' files, where +LL gives an ISO 639 two-letter code identifying the language. Unless +translations have been forbidden at `configure' time by using the +`--disable-nls' switch, all available translations are installed +together with the package. However, the environment variable `LINGUAS' +may be set, prior to configuration, to limit the installed set. +`LINGUAS' should then contain a space separated list of two-letter +codes, stating which languages are allowed. + +1.3 Using This Package +====================== + +As a user, if your language has been installed for this package, you +only have to set the `LANG' environment variable to the appropriate +`LL_CC' combination. Here `LL' is an ISO 639 two-letter language code, +and `CC' is an ISO 3166 two-letter country code. For example, let's +suppose that you speak German and live in Germany. At the shell +prompt, merely execute `setenv LANG de_DE' (in `csh'), +`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash'). +This can be done from your `.login' or `.profile' file, once and for +all. + + You might think that the country code specification is redundant. +But in fact, some languages have dialects in different countries. For +example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The +country code serves to distinguish the dialects. + + The locale naming convention of `LL_CC', with `LL' denoting the +language and `CC' denoting the country, is the one use on systems based +on GNU libc. On other systems, some variations of this scheme are +used, such as `LL' or `LL_CC.ENCODING'. You can get the list of +locales supported by your system for your country by running the command +`locale -a | grep '^LL''. + + Not all programs have translations for all languages. By default, an +English message is shown in place of a nonexistent translation. If you +understand other languages, you can set up a priority list of languages. +This is done through a different environment variable, called +`LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG' +for the purpose of message handling, but you still need to have `LANG' +set to the primary language; this is required by other parts of the +system libraries. For example, some Swedish users who would rather +read translations in German than English for when Swedish is not +available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'. + + Special advice for Norwegian users: The language code for Norwegian +bokma*l changed from `no' to `nb' recently (in 2003). During the +transition period, while some message catalogs for this language are +installed under `nb' and some older ones under `no', it's recommended +for Norwegian users to set `LANGUAGE' to `nb:no' so that both newer and +older translations are used. + + In the `LANGUAGE' environment variable, but not in the `LANG' +environment variable, `LL_CC' combinations can be abbreviated as `LL' +to denote the language's main dialect. For example, `de' is equivalent +to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT' +(Portuguese as spoken in Portugal) in this context. + +1.4 Translating Teams +===================== + +For the Free Translation Project to be a success, we need interested +people who like their own language and write it well, and who are also +able to synergize with other translators speaking the same language. +Each translation team has its own mailing list. The up-to-date list of +teams can be found at the Free Translation Project's homepage, +`http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams" +area. + + If you'd like to volunteer to _work_ at translating messages, you +should become a member of the translating team for your own language. +The subscribing address is _not_ the same as the list itself, it has +`-request' appended. For example, speakers of Swedish can send a +message to `sv-...@li...', having this message body: + + subscribe + + Keep in mind that team members are expected to participate +_actively_ in translations, or at solving translational difficulties, +rather than merely lurking around. If your team does not exist yet and +you want to start one, or if you are unsure about what to do or how to +get started, please write to `tra...@ir...' to reach the +coordinator for all translator teams. + + The English team is special. It works at improving and uniformizing +the terminology in use. Proven linguistic skill are praised more than +programming skill, here. + +1.5 Available Packages +====================== + +Languages are not equally supported in all packages. The following +matrix shows the current state of internationalization, as of May 2005. +The matrix shows, in regard of each package, for which languages PO +files have been submitted to translation coordination, with a +translation percentage of at least 50%. + + Ready PO files af am ar az be bg bs ca cs cy da de el en en_GB + +-------------------------------------------------+ + GNUnet | | + a2ps | [] [] [] [] [] | + aegis | () | + ant-phone | () | + anubis | [] | + ap-utils | | + aspell | [] [] [] [] | + bash | [] [] | + batchelor | [] | + bfd | | + bibshelf | [] | + binutils | [] | + bison | [] [] | + bluez-pin | [] [] [] [] | + clisp | [] [] | + console-tools | [] [] | + coreutils | [] [] [] [] | + cpio | | + cpplib | [] [] [] | + darkstat | [] () [] | + dialog | [] [] [] [] [] [] | + diffutils | [] [] [] [] [] | + doodle | [] | + e2fsprogs | [] [] | + enscript | [] [] [] [] | + error | [] [] [] [] | + fetchmail | [] [] () [] | + fileutils | [] [] | + findutils | [] [] [] | + flex | [] [] [] | + fslint | [] | + gas | | + gawk | [] [] [] | + gbiff | [] | + gcal | [] | + gcc | [] | + gettext-examples | [] [] [] [] | + gettext-runtime | [] [] [] [] | + gettext-tools | [] [] | + gimp-print | [] [] [] [] | + gip | | + gliv | [] | + glunarclock | | + gmult | [] [] | + gnubiff | () | + gnucash | [] () () [] | + gnucash-glossary | [] () | + gpe-aerial | [] [] | + gpe-beam | [] [] | + gpe-calendar | [] [] | + gpe-clock | [] [] | + gpe-conf | [] [] | + gpe-contacts | | + gpe-edit | [] | + gpe-go | [] | + gpe-login | [] [] | + gpe-ownerinfo | [] [] | + gpe-sketchbook | [] [] | + gpe-su | [] [] | + gpe-taskmanager | [] [] | + gpe-timesheet | [] | + gpe-today | [] [] | + gpe-todo | [] [] | + gphoto2 | [] [] [] [] | + gprof | [] [] | + gpsdrive | () () | + gramadoir | [] [] | + grep | [] [] [] [] [] [] | + gretl | | + gsasl | [] | + gss | | + gst-plugins | [] [] [] [] [] [] | + gstreamer | [] [] [] [] [] | + gtick | [] () | + gtkspell | [] [] [] | + hello | [] [] [] [] | + id-utils | [] [] | + impost | | + indent | [] [] | + iso_3166 | | + iso_3166_1 | [] [] [] [] [] | + iso_3166_2 | | + iso_3166_3 | [] | + iso_4217 | | + iso_639 | | + jpilot | [] | + jtag | | + jwhois | | + kbd | [] [] [] [] | + latrine | () | + ld | [] | + libc | [] [] [] [] [] | + libextractor | | + libgpewidget | [] [] [] | + libgphoto2 | [] | + libgphoto2_port | [] | + libgsasl | | + libiconv | [] [] [] [] [] | + libidn | | + lifelines | [] () | + lilypond | [] | + lingoteach | | + lynx | [] [] [] [] | + m4 | [] [] [] [] | + mailutils | [] | + make | [] [] | + man-db | [] () [] [] | + minicom | [] [] | + mysecretdiary | [] [] | + nano | [] () [] | + nano_1_0 | [] () [] [] | + opcodes | [] | + parted | [] [] [] [] | + psmisc | | + ptx | [] [] [] | + pwdutils | | + python | | + radius | [] | + recode | [] [] [] [] [] | + rpm | [] [] | + screem | ... [truncated message content] |
From: <pa...@us...> - 2010-09-28 13:28:15
|
Revision: 781 http://xcas.svn.sourceforge.net/xcas/?rev=781&view=rev Author: parisse Date: 2010-09-28 13:06:05 +0000 (Tue, 28 Sep 2010) Log Message: ----------- Added Paths: ----------- trunk/giac-xcas/ Removed Paths: ------------- trunk/giac-xcas/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2010-07-29 14:40:27
|
Revision: 780 http://xcas.svn.sourceforge.net/xcas/?rev=780&view=rev Author: parisse Date: 2010-07-29 14:40:18 +0000 (Thu, 29 Jul 2010) Log Message: ----------- Modified Paths: -------------- trunk/giac-xcas/giac/src/Editeur.cc trunk/giac-xcas/giac/src/Equation.cc trunk/giac-xcas/giac/src/Graph.cc trunk/giac-xcas/giac/src/Graph.h trunk/giac-xcas/giac/src/Graph3d.cc trunk/giac-xcas/giac/src/Help1.cc trunk/giac-xcas/giac/src/History.cc trunk/giac-xcas/giac/src/Input.cc trunk/giac-xcas/giac/src/Input.h trunk/giac-xcas/giac/src/Print.cc trunk/giac-xcas/giac/src/Tableur.cc trunk/giac-xcas/giac/src/Xcas1.cc trunk/giac-xcas/giac/src/alg_ext.cc trunk/giac-xcas/giac/src/alg_ext.h trunk/giac-xcas/giac/src/cocoa.cc trunk/giac-xcas/giac/src/csturm.cc trunk/giac-xcas/giac/src/derive.cc trunk/giac-xcas/giac/src/derive.h trunk/giac-xcas/giac/src/desolve.cc trunk/giac-xcas/giac/src/dispatch.h trunk/giac-xcas/giac/src/ezgcd.cc trunk/giac-xcas/giac/src/first.h trunk/giac-xcas/giac/src/gauss.cc trunk/giac-xcas/giac/src/gausspol.cc trunk/giac-xcas/giac/src/gausspol.h trunk/giac-xcas/giac/src/gen.cc trunk/giac-xcas/giac/src/gen.h trunk/giac-xcas/giac/src/global.cc trunk/giac-xcas/giac/src/global.h trunk/giac-xcas/giac/src/help.cc trunk/giac-xcas/giac/src/hist.cxx trunk/giac-xcas/giac/src/hist.fl trunk/giac-xcas/giac/src/icas.cc trunk/giac-xcas/giac/src/identificateur.cc trunk/giac-xcas/giac/src/ifactor.cc trunk/giac-xcas/giac/src/index.cc trunk/giac-xcas/giac/src/index.h trunk/giac-xcas/giac/src/input_lexer.cc trunk/giac-xcas/giac/src/input_lexer.h trunk/giac-xcas/giac/src/input_lexer.ll trunk/giac-xcas/giac/src/input_parser.cc trunk/giac-xcas/giac/src/input_parser.yy trunk/giac-xcas/giac/src/intg.cc trunk/giac-xcas/giac/src/intg.h trunk/giac-xcas/giac/src/intgab.cc trunk/giac-xcas/giac/src/intgab.h trunk/giac-xcas/giac/src/isom.cc trunk/giac-xcas/giac/src/lin.cc trunk/giac-xcas/giac/src/maple.cc trunk/giac-xcas/giac/src/mathml.cc trunk/giac-xcas/giac/src/misc.cc trunk/giac-xcas/giac/src/modfactor.cc trunk/giac-xcas/giac/src/modpoly.cc trunk/giac-xcas/giac/src/monomial.h trunk/giac-xcas/giac/src/moyal.cc trunk/giac-xcas/giac/src/pari.cc trunk/giac-xcas/giac/src/permu.cc trunk/giac-xcas/giac/src/plot.cc trunk/giac-xcas/giac/src/plot.h trunk/giac-xcas/giac/src/plot3d.cc trunk/giac-xcas/giac/src/plot3d.h trunk/giac-xcas/giac/src/poly.h trunk/giac-xcas/giac/src/prog.cc trunk/giac-xcas/giac/src/quater.cc trunk/giac-xcas/giac/src/risch.cc trunk/giac-xcas/giac/src/risch.h trunk/giac-xcas/giac/src/rpn.cc trunk/giac-xcas/giac/src/series.cc trunk/giac-xcas/giac/src/series.h trunk/giac-xcas/giac/src/solve.cc trunk/giac-xcas/giac/src/subst.cc trunk/giac-xcas/giac/src/sym2poly.cc trunk/giac-xcas/giac/src/sym2poly.h trunk/giac-xcas/giac/src/symbolic.cc trunk/giac-xcas/giac/src/tex.cc trunk/giac-xcas/giac/src/threaded.cc trunk/giac-xcas/giac/src/threaded.h trunk/giac-xcas/giac/src/ti89.cc trunk/giac-xcas/giac/src/unary.cc trunk/giac-xcas/giac/src/usual.cc trunk/giac-xcas/giac/src/usual.h trunk/giac-xcas/giac/src/vecteur.cc trunk/giac-xcas/giac/src/vecteur.h Modified: trunk/giac-xcas/giac/src/Editeur.cc =================================================================== --- trunk/giac-xcas/giac/src/Editeur.cc 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/Editeur.cc 2010-07-29 14:40:18 UTC (rev 780) @@ -794,8 +794,11 @@ if (Fl_Input * the_input =dynamic_cast<Fl_Input *>(widget)){ string t(the_input->value()); size_t sel1=the_input->position(),sel2=the_input->mark(); - if (sel1>sel2) - std::swap<size_t>(sel1,sel2); + if (sel1>sel2){ + size_t tmp=sel1; + sel1=sel2; + sel2=tmp; + } string t_before=t.substr(0,sel1); string t_selected=t.substr(sel1,sel2-sel1); string t_after=t.substr(sel2,t.size()-sel2); Modified: trunk/giac-xcas/giac/src/Equation.cc =================================================================== --- trunk/giac-xcas/giac/src/Equation.cc 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/Equation.cc 2010-07-29 14:40:18 UTC (rev 780) @@ -1215,7 +1215,7 @@ if (end_sel>=0) sel1=min(end_sel,css); if (sel0>sel1) - std::swap<int>(sel0,sel1); + giac::swapint(sel0,sel1); return cs.substr(sel0,sel1-sel0); } @@ -1274,7 +1274,7 @@ if (end_sel>=0) sel1=min(end_sel+1,css); if (sel0>sel1) - std::swap<int>(sel0,sel1); + giac::swapint(sel0,sel1); int deltax=int(fl_width(cs.substr(0,sel0).c_str())); cs=cs.substr(sel0,sel1-sel0); int dx=int(fl_width(cs.c_str())); @@ -1846,8 +1846,8 @@ if (g._EQWptr->g.type==_STRNG){ // compute begin/end_sel if (y1<y2){ - std::swap<int>(y1,y2); - std::swap<int>(x1,x2); + giac::swapint(y1,y2); + giac::swapint(x1,x2); } eq->begin_sel=Equation_binary_search_pos(*g._EQWptr,x1,y1); eq->end_sel=Equation_binary_search_pos(*g._EQWptr,x2,y2); @@ -1873,8 +1873,8 @@ bool selectall=true,find_first_sel=false,find_last_sel=false; if (itend->type==_EQW && itend->_EQWptr->g==at_multistring){ if (y1<y2){ - std::swap<int>(y1,y2); - std::swap<int>(x1,x2); + giac::swapint(y1,y2); + giac::swapint(x1,x2); } find_first_sel=true; selectall=false; @@ -2974,7 +2974,7 @@ if (eq->end_sel>=0) end_sel=min(eq->end_sel,ss); if (end_sel<begin_sel) - std::swap<int>(begin_sel,end_sel); + giac::swapint(begin_sel,end_sel); if (end_sel<ss) s = s.substr(0,begin_sel)+s.substr(end_sel,ss-end_sel); else Modified: trunk/giac-xcas/giac/src/Graph.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph.cc 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/Graph.cc 2010-07-29 14:40:18 UTC (rev 780) @@ -1034,6 +1034,22 @@ } } + static void cb_Graph_Graphon(Fl_Widget * m , void*) { + Graph2d3d * gr = find_graph2d3d(m); + if (gr){ + gr->display_mode |= 0x1; // set bit 0 + gr->redraw(); + } + } + + static void cb_Graph_Graphoff(Fl_Widget * m , void*) { + Graph2d3d * gr = find_graph2d3d(m); + if (gr){ + gr->display_mode &= (0xffff ^ 0x1); // clear bit 0 + gr->redraw(); + } + } + static void cb_Graph2d3d_Frameoff(Fl_Widget * m , void*) { Graph2d3d * gr = find_graph2d3d(m); if (gr){ @@ -1053,12 +1069,12 @@ static void cb_Graph_Animate(Fl_Widget * m , void*) { Graph2d3d * gr = find_graph2d3d(m); if (gr){ - const char * ch=fl_input("Frames?","10"); + const char * ch=fl_input(gettext("Frames number? (>0 forward, <0 forward+backward)"),"10"); if (ch){ int n=atoi(ch); - if (n<2) - n=2; gr->animation_instructions=gr->animate(n); + if (gr->animation_instructions.empty()) + fl_alert(gettext("Figure must depend on a parameter (Edit->Add parameter)")); gr->paused=false; gr->animation_dt=0.1; gr->display_mode |= 0x2; // set bit 1 @@ -1105,6 +1121,8 @@ {gettext("Slower (2x)"), 0, (Fl_Callback*)cb_Graph2d3d_Slower, 0, 0, 0, 0, 14, 56}, {gettext("Build animation"), 0, (Fl_Callback *) cb_Graph_Animate, 0, 0, 0, 0, 14, 56}, {gettext("Unanimate"), 0, (Fl_Callback *) cb_Graph_Unanimate, 0, 0, 0, 0, 14, 56}, + {gettext("Graph on"), 0, (Fl_Callback *) cb_Graph_Graphon, 0, 0, 0, 0, 14, 56}, + {gettext("Graph off"), 0, (Fl_Callback *) cb_Graph_Graphoff, 0, 0, 0, 0, 14, 56}, {0}, {gettext("3-d"), 0, 0, 0, 64, 0, 0, 14, 56}, {gettext("Mouse plan equation"), 0, (Fl_Callback*)cb_Graph2d3d_mouse_plan, 0, 0, 0, 0, 14, 56}, @@ -3365,7 +3383,7 @@ } if (event==FL_PUSH){ if (swapargs) - swap<gen>(args_tmp[0],args_tmp[1]); + swapgen(args_tmp[0],args_tmp[1]); args_push=tmp_push; if (npoints==1) args_tmp.push_back(tmp); @@ -6306,8 +6324,13 @@ vecteur Graph2d3d::animate(int nframes){ int n=param_group->children(); vecteur res; - if (!n || nframes<2 || !hp) + if (!n || !hp) return res; + bool back=nframes<0; + if (back) + nframes=-nframes; + if (nframes<2) + nframes=2; Gen_Value_Slider * last=0; for (int i=0;i<nframes;++i){ for (int j=n-1;j>=0;--j){ @@ -6352,6 +6375,10 @@ } res.push_back(resi); } + if (back){ + for (int i=nframes-1;i>=0;i--) + res.push_back(res[i]); + } return res; } @@ -6662,6 +6689,11 @@ l->ed->editor->insert_position(l->ed->editor->buffer()->length()); l->ed->editor->insert(s.c_str()); } + else { + string logs(gettext("Not registered\n")); + logs += gettext("Parse error line ")+giac::print_INT_(giac::first_error_line(contextptr))+ gettext(" at ") +giac::error_token_name(contextptr); + fl_alert(logs.c_str()); + } } else s = "// "+s+'\n'; Modified: trunk/giac-xcas/giac/src/Graph.h =================================================================== --- trunk/giac-xcas/giac/src/Graph.h 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/Graph.h 2010-07-29 14:40:18 UTC (rev 780) @@ -27,7 +27,7 @@ #ifdef HAVE_LC_MESSAGES #include <locale.h> #endif -#include <libintl.h> +#include <giacintl.h> #include "Xcas1.h" #include "Input.h" #include "Editeur.h" Modified: trunk/giac-xcas/giac/src/Graph3d.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph3d.cc 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/Graph3d.cc 2010-07-29 14:40:18 UTC (rev 780) @@ -725,12 +725,12 @@ } void tran4(double * colmat){ - swap<double>(colmat[1],colmat[4]); - swap<double>(colmat[2],colmat[8]); - swap<double>(colmat[3],colmat[12]); - swap<double>(colmat[6],colmat[9]); - swap<double>(colmat[7],colmat[13]); - swap<double>(colmat[11],colmat[14]); + giac::swapdouble(colmat[1],colmat[4]); + giac::swapdouble(colmat[2],colmat[8]); + giac::swapdouble(colmat[3],colmat[12]); + giac::swapdouble(colmat[6],colmat[9]); + giac::swapdouble(colmat[7],colmat[13]); + giac::swapdouble(colmat[11],colmat[14]); } void get_texture(const gen & attrv1,Fl_Image * & texture){ Modified: trunk/giac-xcas/giac/src/Help1.cc =================================================================== --- trunk/giac-xcas/giac/src/Help1.cc 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/Help1.cc 2010-07-29 14:40:18 UTC (rev 780) @@ -168,7 +168,7 @@ if (o == button0) { // view help file int tmp=br->value(); if (tmp) { - if (use_external_browser && !system((browser_command(v[tmp-1])).c_str())) + if (use_external_browser && !system_browser_command(v[tmp-1])) ; else { use_external_browser=false; Modified: trunk/giac-xcas/giac/src/History.cc =================================================================== --- trunk/giac-xcas/giac/src/History.cc 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/History.cc 2010-07-29 14:40:18 UTC (rev 780) @@ -3212,7 +3212,7 @@ g=extractmatricefromsheet(ptr->selected); if (Fl_Input_ * ptr=dynamic_cast<Fl_Input *>(Fl::focus())){ int i=ptr->position(),j=ptr->mark(); - if (i>j) std::swap<int>(i,j); + if (i>j) swapint(i,j); s=ptr->value(); s=s.substr(i,j-i); g=giac::gen(s,contextptr); Modified: trunk/giac-xcas/giac/src/Input.cc =================================================================== --- trunk/giac-xcas/giac/src/Input.cc 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/Input.cc 2010-07-29 14:40:18 UTC (rev 780) @@ -96,6 +96,14 @@ else { cerr << "// Using help file " << helpfile << endl; giac::xcasroot=giac::xcasroot_dir((char *) progname.c_str()); + /* patch for gsview TEMP, but does not work + if (!getenv("TEMP")){ + if (giac::is_file_available("/tmp")) + setenv("TEMP","/tmp",1); + else + setenv("TEMP",giac::xcasroot.c_str(),1); + } + */ cerr << "// root dir " << giac::xcasroot << endl; giac::html_help_init((char *) progname.c_str(),language); giac::update_completions(); @@ -308,7 +316,7 @@ vector<string> v=giac::html_help(giac::html_mtt,s); if (!v.empty()){ if (use_external_browser) - system_browser(giac::browser_command(v.front().c_str())); + giac::system_browser_command(v.front()); else { Xcas_help_window->load(v.front().c_str()); if (!xcas::Xcas_help_window->visible()) @@ -1114,7 +1122,7 @@ string v(value()); int pos1=position(),pos2=mark(); if (pos1>pos2) - std::swap<int>(pos1,pos2); + giac::swapint(pos1,pos2); value((v.substr(0,pos1)+history[count]+v.substr(pos2,v.size()-pos2)).c_str()); position(pos1,pos1+history[count].size()); } @@ -1418,7 +1426,7 @@ if (url.size()<7 || (url.substr(0,7)!="http://" && url.substr(0,7)!="file://")) url="http://"+url; } - system(giac::browser_command(url).c_str()); + giac::system_browser_command(url); // break; } } Modified: trunk/giac-xcas/giac/src/Input.h =================================================================== --- trunk/giac-xcas/giac/src/Input.h 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/Input.h 2010-07-29 14:40:18 UTC (rev 780) @@ -27,7 +27,7 @@ #ifdef HAVE_LC_MESSAGES #include <locale.h> #endif -#include <libintl.h> +#include <giacintl.h> #ifndef NO_NAMESPACE_XCAS namespace xcas { Modified: trunk/giac-xcas/giac/src/Print.cc =================================================================== --- trunk/giac-xcas/giac/src/Print.cc 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/Print.cc 2010-07-29 14:40:18 UTC (rev 780) @@ -533,11 +533,14 @@ // Preview if (ps_preview!="no" && preview){ #ifdef WIN32 + system_browser_command(fname); + /* string fn=absolute_path(fname); if (system((((ps_preview+" ")+fn)+" &").c_str())){ cerr << (("cygstart.exe '"+remove_extension(fname)+".jpg' &").c_str()) << endl; system((xcasroot+"cygstart.exe '"+remove_extension(fname)+".jpg' &").c_str()); } + */ #else system((((ps_preview+" ")+fname)+" &").c_str()); #endif Modified: trunk/giac-xcas/giac/src/Tableur.cc =================================================================== --- trunk/giac-xcas/giac/src/Tableur.cc 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/Tableur.cc 2010-07-29 14:40:18 UTC (rev 780) @@ -399,7 +399,7 @@ if (R0<0 || R0>=r) R0=R; if (R0<R) - swap<int>(R0,R); + giac::swapint(R0,R); for (;R<=R0;++R){ vecteur & v=*m[R]._VECTptr; gen g=v[C]; @@ -419,7 +419,7 @@ if (C0<0 || C0>=c) C0=C; if (C0<C) - swap<int>(C0,C); + giac::swapint(C0,C); for (;C<=C0;++C){ gen g=m[R][C]; for (int i=R+1;i<r;++i){ @@ -439,9 +439,9 @@ return; gen g=m[r][c]; if (r<R) - swap<int>(r,R); + giac::swapint(r,R); if (c<C) - swap<int>(c,C); + giac::swapint(c,C); R=max(R,0); C=max(C,0); r=min(r,rows()-1); c=min(c,cols()-1); for (int i=R;i<=r;++i){ vecteur & v=*m[i]._VECTptr; @@ -993,9 +993,9 @@ if (!iscell(f._VECTptr->front(),c1,r1,contextptr) || !iscell(f._VECTptr->back(),c2,r2,contextptr)) return ""; if (r1>r2) - std::swap<int>(r1,r2); + giac::swapint(r1,r2); if (c1>c2) - std::swap<int>(c1,c2); + giac::swapint(c1,c2); // search for an empty cell for (int j=c2+1;j<maxc;++j){ for (int i=0;i<maxr;++i){ @@ -2191,11 +2191,11 @@ if (!iscell(f._VECTptr->front(),c1,r1,contextptr) || !iscell(f._VECTptr->back(),c2,r2,contextptr)) return; if (r1>r2) - std::swap<int>(r1,r2); + giac::swapint(r1,r2); r2=min(r2+1,spread_ptr->rows()); r1=max(r1,0); if (c1>c2) - std::swap<int>(c1,c2); + giac::swapint(c1,c2); c2=min(c2+1,spread_ptr->cols()); c1=max(c1,0); gen formula(formulas,contextptr); @@ -2685,9 +2685,9 @@ if (r1==r2) return; if (r1>r2) - std::swap<int>(r1,r2); + giac::swapint(r1,r2); if (c1>c2) - std::swap<int>(c1,c2); + giac::swapint(c1,c2); // keep only rows r1->r2 and cols c1->c2 m=mtran(matrice(m.begin()+r1,m.begin()+r2+1)); m=mtran(matrice(m.begin()+c1,m.begin()+c2+1)); @@ -3290,13 +3290,13 @@ if (!iscell(f._VECTptr->front(),c1,r1,contextptr) || !iscell(f._VECTptr->back(),c2,r2,contextptr)) return 0; if (r1>r2) - std::swap<int>(r1,r2); + giac::swapint(r1,r2); r2=min(r2+1,m.size()); r1=max(r1,0); mselect=vecteur(m.begin()+r1,m.begin()+r2); mselect=mtran(mselect); if (c1>c2) - std::swap<int>(c1,c2); + giac::swapint(c1,c2); c2=min(c2+1,m.size()); c1=max(c1,0); mselect=vecteur(mselect.begin()+c1,mselect.begin()+c2); @@ -3336,7 +3336,7 @@ return 0; } r2=max(min(r2+1,m.size()),0); - if (r2<r1) swap<int>(r1,r2); + if (r2<r1) giac::swapint(r1,r2); } // full columns selection matrice mt(mtran(m)); @@ -3359,8 +3359,8 @@ return 0; if (!iscell(w[1],cb,rb,contextptr)) return 0; - if (ca>cb) swap<int>(ca,cb); - if (ra>rb) swap<int>(ra,rb); + if (ca>cb) giac::swapint(ca,cb); + if (ra>rb) giac::swapint(ra,rb); if (ra!=r1 || rb+1!=r2) return 0; for (int c=ca;c<=cb;++c){ Modified: trunk/giac-xcas/giac/src/Xcas1.cc =================================================================== --- trunk/giac-xcas/giac/src/Xcas1.cc 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/Xcas1.cc 2010-07-29 14:40:18 UTC (rev 780) @@ -868,7 +868,7 @@ help_output(s,language); if (!giac::html_vtt.empty()){ if (use_external_browser) - system((giac::browser_command(giac::html_vtt.front())).c_str()); + giac::system_browser_command(giac::html_vtt.front()); else { if (xcas::Xcas_help_window){ xcas::Xcas_help_window->load(giac::html_vtt.front().c_str()); @@ -2044,6 +2044,7 @@ #endif int taille; is >> taille; + l->ed->editor->buffer()->remove(0,l->ed->editor->buffer()->length()); l->ed->editor->buffer()->insert(0,s.substr(i,taille).c_str()); // cb_Editeur_Exec_All(l->ed->editor,0); i += taille ; Modified: trunk/giac-xcas/giac/src/alg_ext.cc =================================================================== --- trunk/giac-xcas/giac/src/alg_ext.cc 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/alg_ext.cc 2010-07-29 14:40:18 UTC (rev 780) @@ -1,4 +1,7 @@ // -*- mode:C++ ; compile-command: "g++-3.4 -I.. -g -c alg_ext.cc -Wall" -*- +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "first.h" /* * Copyright (C) 2000,7 B. Parisse, Institut Fourier, 38402 St Martin d'Heres @@ -165,8 +168,8 @@ if (p.dim!=2) setsizeerr("alg_ext.cc/polynome2vecteur"); vector< monomial<gen> >::const_iterator it=p.coord.begin(),itend=p.coord.end(); for (;it!=itend;++it){ - i=it->index.riptr->i.front(); - j=it->index.riptr->i.back(); + i=it->index.front(); + j=it->index.back(); v[nb*(na-i-1)+nb-j-1]=it->value; } } Modified: trunk/giac-xcas/giac/src/alg_ext.h =================================================================== --- trunk/giac-xcas/giac/src/alg_ext.h 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/alg_ext.h 2010-07-29 14:40:18 UTC (rev 780) @@ -27,7 +27,7 @@ namespace giac { #endif // ndef NO_NAMESPACE_GIAC class gen; - class unary_function_ptr; + struct unary_function_ptr; struct symbolic; gen select_root(const vecteur & v,GIAC_CONTEXT); Modified: trunk/giac-xcas/giac/src/cocoa.cc =================================================================== --- trunk/giac-xcas/giac/src/cocoa.cc 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/cocoa.cc 2010-07-29 14:40:18 UTC (rev 780) @@ -106,7 +106,7 @@ vector<monomial<gen> >::const_iterator it=p.coord.begin(),itend=p.coord.end(); for (;it!=itend;++it){ CoCoA::RingElem tmp(gen2ZZ(it->value)*power(x[0],0)); - index_t::const_iterator jt=it->index.riptr->i.begin(),jtend=it->index.riptr->i.end(); + index_t::const_iterator jt=it->index.begin(),jtend=it->index.end(); for (int i=0;jt!=jtend;++jt,++i) tmp *= power(x[i],*jt); res += tmp; @@ -199,7 +199,7 @@ vector<monomial<gen> >::iterator it=p.coord.begin(),itend=p.coord.end(); int n; for (;it!=itend;++it){ - index_t i=it->index.riptr->i; + index_t i=it->index.iref(); n=total_degree(i); i.push_back(deg-n); it->index=i; @@ -221,7 +221,7 @@ void unhomogeneize(polynome & p){ vector<monomial<gen> >::iterator it=p.coord.begin(),itend=p.coord.end(); for (;it!=itend;++it){ - index_t i=it->index.riptr->i; + index_t i=it->index.iref(); i.pop_back(); it->index=i; } Modified: trunk/giac-xcas/giac/src/csturm.cc =================================================================== --- trunk/giac-xcas/giac/src/csturm.cc 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/csturm.cc 2010-07-29 14:40:18 UTC (rev 780) @@ -1,4 +1,7 @@ // -*- mode:C++ ; compile-command: "g++ -I.. -I../include -g -c -Wall -DHAVE_CONFIG_H -DIN_GIAC csturm.cc" -*- +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "first.h" /* * Copyright (C) 2000,7 B. Parisse, Institut Fourier, 38402 St Martin d'Heres @@ -110,7 +113,7 @@ aden=a._FRACptr->den; } for (;it!=itend;++it){ - pui=it->index.riptr->i.front(); + pui=it->index.front(); if (oldpui){ res = res * pow(anum,oldpui-pui,context0); den = den * pow(aden,oldpui-pui,context0); @@ -347,7 +350,7 @@ int signe=1; if (is_strictly_greater(t0,t1,contextptr)){ signe=-1; - std::swap<gen>(t0,t1); + swapgen(t0,t1); } const modpoly & R=*seq[2]._VECTptr; const modpoly & S=*seq[3]._VECTptr; @@ -457,8 +460,8 @@ void ab2a0b0a1b1(const gen & a,const gen & b,gen & a0,gen & b0,gen & a1,gen & b1,GIAC_CONTEXT){ a0=re(a,contextptr); b0=im(a,contextptr); a1=re(b,contextptr); b1=im(b,contextptr); - if (ck_is_greater(a0,a1,contextptr)) std::swap<gen>(a0,a1); - if (ck_is_greater(b0,b1,contextptr)) std::swap<gen>(b0,b1); + if (ck_is_greater(a0,a1,contextptr)) swapgen(a0,a1); + if (ck_is_greater(b0,b1,contextptr)) swapgen(b0,b1); } // find 2* number of roots of P inside the square of vertex of affixes a,b @@ -887,9 +890,9 @@ } gen a0=re(A,contextptr),b0=im(A,contextptr),a1=re(B,contextptr),b1=im(B,contextptr); if (is_greater(a0,a1,contextptr)) - std::swap<gen>(a0,a1); + swapgen(a0,a1); if (is_greater(b0,b1,contextptr)) - std::swap<gen>(b0,b1); + swapgen(b0,b1); if (p.type==_VECT) return complex_roots(*p._VECTptr,a0,b0,a1,b1,complexe,eps); vecteur l; Modified: trunk/giac-xcas/giac/src/derive.cc =================================================================== --- trunk/giac-xcas/giac/src/derive.cc 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/derive.cc 2010-07-29 14:40:18 UTC (rev 780) @@ -1,4 +1,7 @@ /* -*- mode:C++ ; compile-command: "g++-3.4 -DHAVE_CONFIG_H -I. -I.. -DIN_GIAC -g -c derive.cc" -*- */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "first.h" /* * Copyright (C) 2000,7 B. Parisse, Institut Fourier, 38402 St Martin d'Heres Modified: trunk/giac-xcas/giac/src/derive.h =================================================================== --- trunk/giac-xcas/giac/src/derive.h 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/derive.h 2010-07-29 14:40:18 UTC (rev 780) @@ -24,7 +24,7 @@ #ifndef NO_NAMESPACE_GIAC namespace giac { #endif // ndef NO_NAMESPACE_GIAC - class unary_function_ptr; + struct unary_function_ptr; gen derive(const gen & e,const identificateur & i,GIAC_CONTEXT); gen derive(const gen & e,const gen & vars,GIAC_CONTEXT); gen derive(const gen & e,const gen & vars,const gen & nderiv,GIAC_CONTEXT); Modified: trunk/giac-xcas/giac/src/desolve.cc =================================================================== --- trunk/giac-xcas/giac/src/desolve.cc 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/desolve.cc 2010-07-29 14:40:18 UTC (rev 780) @@ -1,4 +1,7 @@ /* -*- mode:C++ ; compile-command: "g++-3.4 -I.. -g -c desolve.cc -DHAVE_CONFIG_H -DIN_GIAC" -*- */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "first.h" /* * Copyright (C) 2000, 2007 B. Parisse, Institut Fourier, 38402 St Martin d'Heres @@ -68,7 +71,7 @@ int n=0; if (ffden.type==_POLY){ polynome & ffdenp = *ffden._POLYptr; - if (!ffdenp.coord.empty() && (n=ffdenp.coord.back().index.riptr->i.front()) ){ + if (!ffdenp.coord.empty() && (n=ffdenp.coord.back().index.front()) ){ // multiply by (-1)^n*x^n, do laplace, then integrate n times answer index_t idxt(v.size()); idxt.front()=-n; @@ -78,7 +81,7 @@ f=-f; } } - assume_t_in_ab(t,0,plus_inf,true,true,contextptr); + assume_t_in_ab(t,plus_inf,plus_inf,true,true,contextptr); gen res=_integrate(gen(makevecteur(f*exp(-t*x,contextptr),x,0,plus_inf),_SEQ__VECT),contextptr); for (int i=1;i<=n;++i){ res = _integrate(gen(makevecteur(res,t,0,t),_SEQ__VECT),contextptr); @@ -118,7 +121,7 @@ polynome cstcoeff(const polynome & p){ vector< monomial<gen> >::const_iterator it=p.coord.begin(),itend=p.coord.end(); for (;it!=itend;++it){ - if (it->index.riptr->i[0]==0) + if (it->index.front()==0) break; } return polynome(p.dim,vector< monomial<gen> >(it,itend)); Modified: trunk/giac-xcas/giac/src/dispatch.h =================================================================== --- trunk/giac-xcas/giac/src/dispatch.h 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/dispatch.h 2010-07-29 14:40:18 UTC (rev 780) @@ -188,7 +188,8 @@ _SORTED__VECT=19, _POINT__VECT=20, _POLYEDRE__VECT=21, - _RGBA__VECT=22 + _RGBA__VECT=22, + _LIST__VECT=23 } ; enum symb_subtypes { Modified: trunk/giac-xcas/giac/src/ezgcd.cc =================================================================== --- trunk/giac-xcas/giac/src/ezgcd.cc 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/ezgcd.cc 2010-07-29 14:40:18 UTC (rev 780) @@ -1,4 +1,7 @@ /* -*- mode:C++ ; compile-command: "g++-3.4 -I. -I.. -I../include -g -c ezgcd.cc -DHAVE_CONFIG_H -DIN_GIAC" -*- */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "first.h" /* Multivariate GCD for large data not covered by the heuristic GCD algo * Copyright (C) 2000,7 B. Parisse, Institut Fourier, 38402 St Martin d'Heres @@ -34,7 +37,7 @@ #endif // ndef NO_NAMESPACE_GIAC void add_dim(monomial<gen> & m,int d){ - index_t i(m.index.riptr->i); + index_t i(m.index.iref()); for (int j=0;j<d;++j) i.push_back(0); m.index=i; @@ -45,8 +48,7 @@ if (p.dim>=dim){ p.dim=dim; for (;it!=itend;++it){ - index_t & i=it->index.riptr->i; - it->index=index_t(i.begin(),i.begin()+dim); + it->index=index_t(it->index.begin(),it->index.begin()+dim); } return; } @@ -67,7 +69,7 @@ polynome res(p.dim); vector< monomial<gen> >::const_iterator it=p.coord.begin(),itend=p.coord.end(); for (;it!=itend;++it){ - if (total_degree(it->index.riptr->i)<degree) + if (total_degree(it->index)<degree) res.coord.push_back(*it); } return res; @@ -103,8 +105,8 @@ index_t::const_iterator jt,jtend; int otherdeg; for (;it!=itend;++it){ - jt=it->index.riptr->i.begin()+1; - jtend=it->index.riptr->i.end(); + jt=it->index.begin()+1; + jtend=it->index.end(); for (otherdeg=0;jt!=jtend;++jt){ otherdeg += *jt; } @@ -114,7 +116,7 @@ } else { for (;it!=itend;){ - int d=it->index.riptr->i.front(); + int d=it->index.front(); polynome tmp(Tnextcoeff<gen>(it,itend)); res=res+reduce(tmp,v,degree).untrunc1(d); } @@ -162,7 +164,7 @@ rem=a; if ( ! (a_max>=b_max) ){ // test that the first power of a_max is < to that of b_max - return (a_max.riptr->i.front()<b_max.riptr->i.front()); + return (a_max.front()<b_max.front()); } gen b(other.coord.front().value); while (a_max >= b_max){ @@ -193,7 +195,7 @@ // if ( (a.dim<=1) || (a.coord.empty()) ) return reduce_divrem2(a,other,v,n,quo,rem); std::vector< monomial<gen> >::const_iterator it=other.coord.begin(); - int bdeg=it->index.riptr->i.front(),rdeg; + int bdeg=it->index.front(),rdeg; tensor<gen> b0(Tnextcoeff<gen>(it,other.coord.end())); tensor<gen> r(a),q(b0.dim); while ( (rdeg=r.lexsorted_degree()) >=bdeg){ @@ -241,10 +243,10 @@ pcurx1x2.dim=dim; vector< monomial<gen> >::const_iterator it=pcur.coord.begin(),itend=pcur.coord.end(); for (;it!=itend;++it){ - index_t & i = it->index.riptr->i; int j=k; - for (;j<dim;++j){ - if (i[j]) + index_t::const_iterator i = it->index.begin()+j; + for (;j<dim;++j,++i){ + if (*i) break; } if (j==dim) @@ -256,8 +258,7 @@ void truncate_xk_xn(polynome & pcur,int k){ vector< monomial<gen> >::iterator it=pcur.coord.begin(),itend=pcur.coord.end(); for (;it!=itend;++it){ - index_t & i = it->index.riptr->i; - it->index=index_t(i.begin(),i.begin()+k); + it->index=index_t(it->index.begin(),it->index.begin()+k); } pcur.dim=k; } @@ -266,7 +267,7 @@ vector< monomial<gen> >::iterator it=pcur.coord.begin(),itend=pcur.coord.end(); for (;it!=itend;++it){ index_t i (dim); - i=it->index.riptr->i; + i=it->index.iref(); for (int j=i.size();j<dim;++j) i.push_back(0); it->index = i; @@ -312,9 +313,9 @@ for (vit=v.begin();vit!=vitend;++vit){ const polynome & fact = vit->fact; vector< monomial<gen> >::const_iterator it=fact.coord.begin(),itend=fact.coord.end(); - gen Pi=lc*pow(mainvar,it->index.riptr->i.front()); + gen Pi=lc*pow(mainvar,it->index.front()); for (++it;it!=itend;++it){ - Pi += la[pos]*pow(mainvar,it->index.riptr->i.front()); + Pi += la[pos]*pow(mainvar,it->index.front()); ++pos; } Pis.push_back(Pi); @@ -361,7 +362,7 @@ } // subst la values Pis=subst(Pis,la,la_val,false,context0); - for (int i=0;i<Pis.size();++i){ + for (unsigned int i=0;i<Pis.size();++i){ gen tmp=sym2r(Pis[i],lv,context0),num,den; fxnd(tmp,num,den); if (num.type!=_POLY) @@ -376,7 +377,7 @@ int dim=pcur.dim; int s=v0.size(); polynome lcp(Tfirstcoeff(pcur)); - if (lcp.coord.back().index.riptr->i.back()!=0) + if (lcp.coord.back().index.back()!=0) return false; gen lcpb=lcp.coord.back().value; vector<polynome> lcoeffs(s,lcp); @@ -497,6 +498,9 @@ vector<polynome> P(s),P0(s),U(s); vecteur b(pcur_adjusted.dim-1); for (int i=0;i<s;++i){ + U[i].dim=pcur_adjusted.dim; + P[i].dim=pcur_adjusted.dim; + P0[i].dim=pcur_adjusted.dim; modpoly::const_iterator it=F0fact[i].begin(),itend=F0fact[i].end(); int deg=itend-it-1; P[i]=lcoeffs[i].trunc1().untrunc1(deg); @@ -740,7 +744,7 @@ std::vector< monomial<gen> >::const_iterator it=p.coord.begin(); std::vector< monomial<gen> >::const_iterator itend=p.coord.end(); for (;it!=itend;){ - i[0]=it->index.riptr->i.front(); + i[0]=it->index.front(); polynome pactuel(Tnextcoeff<gen>(it,itend)); gen g(peval(pactuel,v,mod)); if ( (g.type==_POLY) && (g._POLYptr->dim==0) ) @@ -778,6 +782,7 @@ i.front()=it->u/var; P.coord.push_back(monomial<gen>(gen(it->g),i)); } + return true; } // return true if a good eval point has been found Modified: trunk/giac-xcas/giac/src/first.h =================================================================== --- trunk/giac-xcas/giac/src/first.h 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/first.h 2010-07-29 14:40:18 UTC (rev 780) @@ -21,6 +21,15 @@ #ifndef _GIAC_FIRST_H_ #define _GIAC_FIRST_H_ +#ifndef __x86_64__ +#ifdef SMARTPTR64 +#undef SMARTPTR64 +#endif +#ifdef _I386_ +#undef _I386_ +#endif +#endif // __x86_64__ + #ifdef USE_GMP_REPLACEMENTS #include "gmp_replacements.h" #else @@ -42,6 +51,8 @@ typedef long pid_t; typedef __int64 longlong ; typedef unsigned __int64 ulonglong ; +// #define _HAS_ITERATOR_DEBUGGING 0 +// #define _SECURE_SCL 0 #else typedef long long longlong; typedef unsigned long long ulonglong; Modified: trunk/giac-xcas/giac/src/gauss.cc =================================================================== --- trunk/giac-xcas/giac/src/gauss.cc 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/gauss.cc 2010-07-29 14:40:18 UTC (rev 780) @@ -1,4 +1,7 @@ // -*- mode:C++ ; compile-command: "g++-3.4 -I.. -g -c gauss.cc -Wall" -*- +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "first.h" /* * Copyright (C) 2001,7 R. De Graeve, Institut Fourier, 38402 St Martin d'Heres Modified: trunk/giac-xcas/giac/src/gausspol.cc =================================================================== --- trunk/giac-xcas/giac/src/gausspol.cc 2010-06-30 09:29:34 UTC (rev 779) +++ trunk/giac-xcas/giac/src/gausspol.cc 2010-07-29 14:40:18 UTC (rev 780) @@ -1,4 +1,7 @@ /* -*- mode:C++ ; compile-command: "g++-3.4 -I.. -I../include -g -c gausspol.cc -D_I386_ -DHAVE_CONFIG_H -DIN_GIAC" -*- */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "first.h" /* * This file implements several functions that work on univariate and @@ -216,7 +219,7 @@ gen tmp; for (;it!=itend;++it){ u=0; - itit=it->index.riptr->i.begin(); + itit=it->index.begin(); for (dit=ditbeg;dit!=ditend;++itit,++dit) u=u*U(*dit)+U(*itit); gu.u=u; @@ -398,13 +401,13 @@ } - template <class T> - void convert(const vector< T_unsigned<T,unsigned> > & source,vector< T_unsigned<gen,unsigned> > & target){ + template <class T,class U> + void convert(const vector< T_unsigned<T,U> > & source,vector< T_unsigned<gen,U> > & target){ target.clear(); - typename vector< T_unsigned<T,unsigned> >::const_iterator it=source.begin(),itend=source.end(); + typename vector< T_unsigned<T,U> >::const_iterator it=source.begin(),itend=source.end(); target.reserve(itend-it); for (;it!=itend;++it) - target.push_back(T_unsigned<gen,unsigned>(it->g,it->u)); + target.push_back(T_unsigned<gen,U>(it->g,it->u)); } gen ichrem_smod(mpz_t * Az,mpz_t * Bz,mpz_t * iz,mpz_t * tmpz,const gen & i,const gen & j){ @@ -604,13 +607,14 @@ mpz_clear(z2); } - void smod(const vector< T_unsigned<longlong,unsigned> > & source,vector< T_unsigned<longlong,unsigned> > & target,int prime){ + template<class U> + void smod(const vector< T_unsigned<longlong,U> > & source,vector< T_unsigned<longlong,U> > & target,int prime){ if (&target==&source){ - vector< T_unsigned<longlong,unsigned> >::iterator it=target.begin(),itend=target.end(); + typename vector< T_unsigned<longlong,U> >::iterator it=target.begin(),itend=target.end(); for (;it!=itend;++it){ it->g %= prime; if (!it->g){ - vector< T_unsigned<longlong,unsigned> > copie(target); + vector< T_unsigned<longlong,U> > copie(target); smod(copie,target,prime); break; } @@ -618,13 +622,13 @@ return; } target.clear(); - vector< T_unsigned<longlong,unsigned> >::const_iterator it=source.begin(),itend=source.end(); + typename vector< T_unsigned<longlong,U> >::const_iterator it=source.begin(),itend=source.end(); target.reserve(itend-it); longlong res; for (;it!=itend;++it){ res=it->g % prime; if (res) - target.push_back(T_unsigned<longlong,unsigned>(res,it->u)); + target.push_back(T_unsigned<longlong,U>(res,it->u)); } } @@ -716,7 +720,7 @@ // Modular multiplication, convert everything to integers vector< int_unsigned > p1,p2,p; if (convert(th,d,p1,reduce.val) && convert(other,d,p2,reduce.val)){ - if (10*lagrtime<double(c1)*c2*std::log(max(c1,c2))) + if (10*lagrtime<double(c1)*c2*std::log(double(max(c1,c2)))) smallmulpoly_interpolate(p1,p2,p,d,reduce.val); else smallmult(p1,p2,p,reduce.val,c1c2); @@ -724,7 +728,7 @@ return ; } } - if (is_zero(reduce) && 10*lagrtime<double(c1)*c2*std::log(max(c1,c2))){ + if (is_zero(reduce) && 10*lagrtime<double(c1)*c2*std::log(double(max(c1,c2)))){ vector< T_unsigned<gen,unsigned> > p1,p2,p; convert<gen,unsigned>(th,d,p1); convert<gen,unsigned>(other,d,p2); @@ -756,10 +760,11 @@ convert_int128(p2d,p2D); if (th.dim==1 || !threadmult<int128_t,unsigned>(p1D,p2D,pD,ans/d[0],0,c1c2)) smallmult<int128_t,unsigned>(p1D,p2D,pD,0,c1c2); + if (debug_infolevel>5) cerr << clock () << " end int128 mult " << endl; unsigned pds=pD.size(); res_size=double(minc1c2)*maxp1p2/std::pow(2.0,127); if (res_size<1){ - convert_from<int128_t,unsigned>(pD,d,res); + convert_from<int128_t,unsigned>(pD,d,res,false); return; } vector< T_unsigned<gen,unsigned> > target; @@ -785,7 +790,7 @@ prime2=prevprime(prime2-2).val; } if (debug_infolevel>5) cerr << clock() << endl; - convert_from<gen,unsigned>(target,d,res); + convert_from<gen,unsigned>(target,d,res,true); if (debug_infolevel>5) cerr << clock() << endl; return; } @@ -803,7 +808,7 @@ if(debug_infolevel>5) cerr << "End smallmult " << clock() << endl; unsigned pds=pd.size(); if ( res_size< 1 ){ - convert_from<longlong,unsigned>(pd,d,res); + convert_from<longlong,unsigned>(pd,d,res,false); return; } // /* @@ -851,7 +856,7 @@ if (debug_infolevel>5) cerr << clock () << " ichrem end" << endl; } if (debug_infolevel>5) cerr << clock() << endl; - convert_from<gen,unsigned>(target,d,res); + convert_from<gen,unsigned>(target,d,res,true); if (debug_infolevel>5) cerr << clock() << endl; return; } // end else (some primes are required) @@ -885,7 +890,7 @@ if (th.dim==1 || !threadmult<longlong,unsigned>(p1d,p2d,pd,ans/d[0],modulo.val,c1c2)) smallmult(p1d,p2d,pd,modulo.val,c1c2); } - convert_from<longlong,unsigned>(pd,d,res); + convert_from<longlong,unsigned>(pd,d,res,false); // modularize gen g=makemod(res,modulo); if (g.type==_POLY) @@ -901,7 +906,7 @@ if (convert_double(th,d,p1d) && convert_double(other,d,p2d) ){ if (th.dim==1 || !threadmult<double,unsigned>(p1d,p2d,pd,ans/d[0],0,c1c2)) smallmult<double,unsigned>(p1d,p2d,pd,0,c1c2); - convert_from<double,unsigned>(pd,d,res); + convert_from<double,unsigned>(pd,d,res,true); return; } } @@ -913,11 +918,12 @@ if (convert_myint(th,d,p1d) && convert_myint(other,d,p2d) ){ if (debug_infolevel>1) cerr << "mpz mult begin " << clock() << endl; - if (th.dim==1 || !threadmult<myint,unsigned>(p1d,p2d,pd,ans/d[0],0,c1c2)) + // threadmult is slow for heap allocated data because of malloc lock + // if (th.dim==1 || !threadmult<myint,unsigned>(p1d,p2d,pd,ans/d[0],0,c1c2)) smallmult<myint,unsigned>(p1d,p2d,pd,0,c1c2); if (debug_infolevel>1) cerr << "mpz mult end " << clock() << endl; - convert_from<myint,unsigned>(pd,d,res); + convert_from<myint,unsigned>(pd,d,res,false); return; } } @@ -929,7 +935,7 @@ convert<gen,unsigned>(other,d,p2); if (debug_infolevel>1) cerr << clock() << "gen mult begin " << clock() << endl; - // threadmult<gen,.> does not work on multi-CPU (malloc error with GMP data structures) + // threadmult<gen,.> does not work on multi-CPU (malloc error with GMP data structures) and it would be slow anyway because of malloc locks // if (th.dim==1 || !threadmult<gen,unsigned>(p1,p2,p,ans/d[0],0,c1c2)) smallmult<gen,unsigned>(p1,p2,p,0,c1c2); if (debug_infolevel>1) @@ -968,6 +974,51 @@ double res_size=double(minc1c2)*maxp1p2; // Check number of required primes: res_size /= un63; + double nprimes=std::ceil(std::log(res_size)/std::log(2147483647.)); + if (debug_infolevel>5) cerr << clock () << " primes required " << nprimes << endl; +#ifdef INT128 + if (nprimes>0 && nprimes<10){ + // using multiplications with int128 + vector< T_unsigned<int128_t,ulonglong> > p1D,p2D,pD; + convert_int128(p1d,p1D); + convert_int128(p2d,p2D); + if (th.dim==1 || !threadmult<int128_t,ulonglong>(p1D,p2D,pD,ans/d[0],0,c1c2)) + smallmult<int128_t,ulonglong>(p1D,p2D,pD,0,c1c2); + if (debug_infolevel>5) cerr << clock () << " end int128 mult " << endl; + unsigned pds=pD.size(); + res_size=double(minc1c2)*maxp1p2/std::pow(2.0,127); + if (res_size<1){ + convert_from<int128_t,ulonglong>(pD,d,res,false); + return; + } + vector< T_unsigned<gen,ulonglong> > target; + convert(pD,target); + double primed=3037000499.; // floor(2^31.5) + primed /= std::sqrt(double(max(minc1c2,4))); + gen targetprime = pow(plus_two,128); + int prime2=prevprime(int(std::floor(primed))).val; + for (;res_size>=1;){ + if (debug_infolevel>5) + cerr << "prime used " << prime2 << endl; + // the product of the two poly mod prime2 can be computed + // without mod computation + vector< T_unsigned<longlong,ulonglong> > p1add,p2add,add; + smod(p1d,p1add,prime2); + smod(p2d,p2add,prime2); + if (th.dim==1 || !threadmult<longlong,ulonglong>(p1add,p2add,add,ans/d[0],0,pds)) + smallmult(p1add,p2add,add,0,pds); + smod(add,add,prime2); + if (debug_infolevel>5) cerr << clock () << " ichrem longlong" << endl; + ichrem(add,prime2,pd,target,targetprime); // pd is not used at all here + res_size /= prime2; + prime2=prevprime(prime2-2).val; + } + if (debug_infolevel>5) cerr << clock() << endl; + convert_from<gen,ulonglong>(target,d,res,false); + if (debug_infolevel>5) cerr << clock() << endl; + return; + } +#endif if ( res_size< 1 ){ if (debug_infolevel>1) cerr << clock() << "longlong mult ulonglong begin " << clock() << endl; @@ -975,7 +1026,7 @@ smallmult<longlong,ulonglong>(p1d,p2d,pd,0,c1c2); if (debug_infolevel>1) cerr << clock() << "longlong mult ulonglong end " << clock() << endl; - convert_from<longlong,ulonglong>(pd,d,res); + convert_from<longlong,ulonglong>(pd,d,res,false); if (debug_infolevel>1) cerr << clock() << "longlong mult ulonglong convert end " << clock() << endl; return; @@ -987,7 +1038,7 @@ if (convert_double(th,d,p1d) && convert_double(other,d,p2d) ){ if (th.dim==1 || !threadmult<double,ulonglong>(p1d,p2d,pd,ans/d[0],0,c1c2)) smallmult<double,ulonglong>(p1d,p2d,pd,0,c1c2); - convert_from<double,ulonglong>(pd,d,res); + convert_from<double,ulonglong>(pd,d,res,true); return; } } @@ -1129,7 +1180,7 @@ smallmult<myint,unsigned>(p1,p2,p,0,c1c2); p1=p; } - convert_from<myint,unsigned>(p,d,res); + convert_from<myint,unsigned>(p,d,res,false); return; } } @@ -1165,7 +1216,11 @@ return res; } +#define QUO_ONLY 1 // exactquo==2 means we know that b divides a and we search the cofactor + // exactquo==1 means we want to check that b divides a + // exactquo==-1 means compute quotient first using heap div then r=a-b*quo + // exactquo==-2 means compute quotient only using heap div bool divrem1(const polynome & a,const polynome & b,polynome & quo,polynome & r,int exactquo) { quo.coord.clear(); quo.dim=a.dim; @@ -1173,11 +1228,11 @@ r.coord.clear(); int bs=b.coord.size(); if ( b.dim<=1 || bs==1 || a.coord.empty() ){ - return a.TDivRem(b,quo,r,false) && (exactquo?r.coord.empty():true) ; + return a.TDivRem(b,quo,r,false) && (exactquo>0?r.coord.empty():true) ; } - int bdeg=b.coord.front().index.riptr->i.front(),rdeg=a.lexsorted_degree(),ddeg=rdeg-bdeg; + int bdeg=b.coord.front().index.front(),rdeg=a.lexsorted_degree(),ddeg=rdeg-bdeg; if (ddeg>3){ - index_t d1=a.degree(),d2=b.degree(),d3=b.coord.front().index.riptr->i,d(a.dim); + index_t d1=a.degree(),d2=b.degree(),d3=b.coord.front().index.iref(),d(a.dim); // i-th degrees of th / other in quotient and remainder // are <= i-th degree of th + ddeg*(i-th degree of other - i-th degree of lcoeff of other) double ans=1; @@ -1220,8 +1275,8 @@ hashdivrem<int,unsigned>(p132,p232,quot32,remain32,vars,0,RAND_MAX/double(maxp2)/p2.size(),false,exactquo)==1){ if (debug_infolevel>1) std::cerr << "hashdivrem1 int32 success " << clock() << " maxp1=" << maxp1 << " maxp2=" << maxp2 << " ddeg=" << ddeg << std::endl; - convert_from(quot32,d,quo); - convert_from(remain32,d,r); + convert_from(quot32,d,quo,true); + convert_from(remain32,d,r,true); return true; } } @@ -1230,8 +1285,8 @@ if (hashdivrem<longlong,unsigned>(p1,p2,quot,remain,vars,/* reduce*/0,RAND_MAX/double(maxp2)/p2.size()*RAND_MAX,false,exactquo)==1){ if (debug_infolevel>1) std::cerr << "hashdivrem1 longlong end " << clock() << std::endl; - convert_from(quot,d,quo); - convert_from(remain,d,r); + convert_from(quot,d,quo,false); + convert_from(remain,d,r,false); return true; } doit=false; @@ -1250,8 +1305,8 @@ if (hashdivrem<myint,unsigned>(p1,p2,quot,remain,vars,/* reduce */ 0,/* no size check */0.0,false,exactquo)==1){ if (debug_infolevel>1) std::cerr << "hashdivrem1mpz end " << clock() << std::endl; - convert_from(quot,d,quo); - convert_from(remain,d,r); + convert_from(quot,d,quo,false); + convert_from(remain,d,r,false); return true; } } @@ -1282,8 +1337,8 @@ if (hashdivrem<longlong,ulonglong>(p1,p2,quot,remain,vars,/* reduce */0,RAND_MAX/double(maxp2)/p2.size()*RAND_MAX,false,exactquo)==1){ if (debug_infolevel>1) std::cerr << "hashdivrem1 longlong ulonglong end " << clock() << std::endl; - convert_from(quot,d,quo); - convert_from(remain,d,r); + convert_from(quot,d,quo,false); + convert_from(remain,d,r,false); return true; } } @@ -1302,8 +1357,8 @@ if (hashdivrem<myint,ulonglong>(p1,p2,quot,remain,vars,/* reduce */ 0,/* no size check */0.0,false,exactquo)==1){ if (debug_infolevel>1) std::cerr << "hashdivrem1 ulonglong end " << clock() << std::endl; - convert_from(quot,d,quo); - convert_from(remain,d,r); + convert_from(quot,d,quo,false); + convert_from(remain,d,r,false); return true; } } @@ -1311,7 +1366,7 @@ #endif } } - return a.TDivRem1(b,quo,r,false,exactquo); + return a.TDivRem1(b,quo,r,false,exactquo>0); } polynome operator / (const polynome & th,const polynome & other) { @@ -1392,7 +1447,7 @@ v.reserve(current_deg+1); vector< monomial<gen> >::const_iterator it=pp.coord.begin(),itend=pp.coord.end(); for (;it!=itend;--current_deg){ - if (it->index.riptr->i.front()==current_deg){ + if (it->index.front()==current_deg){ if (p.dim==1){ v.push_back(it->value); ++it; @@ -1415,12 +1470,14 @@ // like polynome2poly1 for univariate p vecteur polynome12poly1(const polynome & p){ + if (p.dim>1) + return polynome2poly1(p,1); int current_deg=p.lexsorted_degree(); vecteur v; v.reserve(current_deg+1); vector< monomial<gen> >::const_iterator it=p.coord.begin(),itend=p.coord.end(); for (;it!=itend;--current_deg){ - if (it->index.riptr->i.front()==current_deg){ + if (it->index.front()==current_deg){ v.push_back(it->value); ++it; } @@ -1433,12 +1490,14 @@ } vecteur polynome2poly1(const polynome & p){ + if (p.dim>1) + return polynome2poly1(p,1); vecteur v; int current_deg=p.lexsorted_degree(); v.reserve(current_deg+1); vector< monomial<gen> >::const_iterator it=p.coord.begin(),itend=p.coord.end(); for (;it!=itend;--current_deg){ - if (it->index.riptr->i.front()==current_deg){ + if (it->index.front()==current_deg){ v.push_back(it->value); ++it; } @@ -1636,7 +1695,7 @@ rem=th; if ( ! (a_max>=b_max) ){ // test that the first power of a_max is < to that of b_max - return (a_max.riptr->i.front()<b_max.riptr->i.front()); + return (a_max.front()<b_max.front()); } // bool mult=is_cinteger(other.coord.front().value); gen b=invmod(other.coord.front().value,modulo); @@ -1666,7 +1725,7 @@ } if (os==1){ // Check for a division by 1 - if (is_one(other.coord.front().value) && is_zero(other.coord.front().index.riptr->i)){ + if (is_one(other.coord.front().value) && other.coord.front().index.is_zero()){ quo=th; r.coord.clear(); return true; @@ -1675,11 +1734,11 @@ } std::vector< monomial<gen> >::const_iterator it=other.coord.begin(); - int bdeg=it->index.riptr->i.front(),rdeg=th.lexsorted_degree(),ddeg=rdeg-bdeg; + int bdeg=it->index.front(),rdeg=th.lexsorted_degree(),ddeg=rdeg-bdeg; if (//false && ddeg>2 && os>10 ){ - index_t d1=th.degree(),d2=other.degree(),d3=other.coord.front().index.riptr->i,d(th.dim); + index_t d1=th.degree(),d2=other.degree(),d3=other.coord.front().index.iref(),d(th.dim); // i-th degrees of th / other in quotient and remainder // are <= i-th degree of th + ddeg*(i-th degree of other - i-th degree of lcoeff of other) double ans=1; @@ -1833,7 +1892,7 @@ if (pgcd.coord.empty()){ index_m i; for (int j=0;j<p.dim;j++) - i.riptr->i.push_back(0); + i.push_back(0); pgcd.coord.push_back(monomial<gen>(gen(1),i)); } else @@ -1848,9 +1907,8 @@ polynome res(outer_dim); vector< monomial<gen> >::const_iterator it=p.coord.begin(),itend=p.coord.end(); for (; it!=itend;++it){ - index_t cur_index=it->index.riptr->i; - index_t outer_index(cur_index.begin()+inner_dim,cur_index.end()); - index_t inner_index(cur_index.begin(),cur_index.begin()+inner_dim); + index_t outer_index(it->index.begin()+inner_dim,it->index.end()); + index_t inner_index(it->index.begin(),it->index.begin()+inner_dim); cur_inner=polynome(monomial<gen>(it->value,inner_index)); res=res+polynome(monomial<gen>(cur_inner,outer_index)); } @@ -1886,9 +1944,9 @@ // int outer_dim=p.dim-inner_dim; vector< monomial<gen> >::const_iterator it=p.coord.begin(),itend=p.coord.end(); for (; it!=itend;++it){ - index_t cur_index= it->index.riptr->i; - index_t outer_index(cur_index.begin()+inner_dim,cur_index.end()); - index_t inner_index(cur_index.begin(),cur_index.begin()+inner_dim); + index_t cur_index= it->index.iref(); + index_t outer_index(it->index.begin()+inner_dim,it->index.end()); + index_t inner_index(it->index.begin(),it->index.begin()+inner_dim); map_index_t_polynome::iterator jt=res.find(outer_index),jtend=res.end(); if (jt==jtend){ if (is_zero(inner_index)) @@ -1907,9 +1965,9 @@ vector< monomial<gen> >::const_iterator it=p.coord.begin(),itend=p.coord.end(); if (it==itend) return 0; - index_t i= it->index.riptr->i; + index_t i= it->index.iref(); for (;it!=itend;++it){ - index_t & j= it->index.riptr->i; + const index_t & j= it->index.iref(); i[dim-1]=j[dim-1]; if (i!=j) break; @@ -1925,9 +1983,9 @@ // int outer_dim=p.dim-inner_dim; polynome cur_inner(inner_dim); vector< monomial<gen> >::const_iterator it=p.coord.begin(),itend=p.coord.end(); - index_t::const_iterator jt0 = it->index.riptr->i.begin(),jtend=it->index.riptr->i.end(),jt,kt0,kt; + index_t::const_iterator jt0 = it->index.begin(),jtend=it->index.end(),jt,kt0,kt; for (; it!=itend;++it){ - kt0 = it->index.riptr->i.begin(); + kt0 = it->index.begin(); for (jt=jt0+inner_dim,kt=kt0+inner_dim;jt!=jtend;++kt,++jt){ if (*kt<*jt) break; @@ -1949,7 +2007,7 @@ if (p.coord.empty()) setsizeerr(); if (p.coord.size()==1){ - int n=p.coord.front().index.riptr->i.front(); + int n=p.coord.front().index.front(); polynome c(monomial<gen>(p.coord.front().value,index_t(1,n))); if (setdim) change_dim(c,p.dim); @@ -1965,14 +2023,14 @@ c=it->second; else { for (;c0 && it!=itend;++it){ - if (!it->second.coord.empty() && (i0=it->second.coord.front().index.riptr->i.front())<c0){ + if (!it->second.coord.empty() && (i0=it->second.coord.front().index.front())<c0){ c=it->second; c0=i0; } } it=m.begin(); for (;it!=itend;++it){ - if (!c.coord.empty() &&c.coord.front().index.riptr->i.front()==0 ){ + if (!c.coord.empty() &&c.coord.front().index.front()==0 ){ c=polynome(plus_one,1); break; } @@ -2013,11 +2071,11 @@ vector< monomial<gen> >::const_iterator it=p.coord.begin(),itend=p.coord.end(); if (it==itend) return 0; - int old_deg=it->index.riptr->i.front(),cur_deg=0; + int old_deg=it->index.front(),cur_deg=0; int nzeros=0; res.push_back(1); for (;it!=itend;++it){ - cur_deg=it->index.riptr->i.front(); + cur_deg=it->index.front(); if (cur_deg!=old_deg){ nzeros += old_deg - cur_deg -1 ; for (int i=old_deg-cur_deg;i>1;--i) @@ -2557,7 +2615,7 @@ for (monomial_v::const_iterator it=p.coord.begin();it!=p.coord.end();++it){ i.clear(); i.push_back(0); - for (index_t::const_iterator iti=it->index.riptr->i.begin();iti!=it->index.riptr->i.end();++iti) + for (index_t::const_iterator iti=it->index.begin();iti!=it->index.end();++iti) i.push_back(*iti); gen k=it->value; for (int j=0;!is_zero(k);j++){ @@ -2612,10 +2670,10 @@ vector< monomial<gen> >::const_iterator it=p.coord.begin(),itend=p.coord.end(); index_t::iterator iit,iitend; for (;it!=itend && !i.empty();++it){ - index_t & j=it->index.riptr->i; + index_t::const_iterator j=it->index.begin(); iit=i.begin(); iitend=i.end(); for (;iit!=iitend;++iit){ - if (j[*iit]){ // non-0 power in monomial + if (*(j+*iit)){ // non-0 power in monomial i.erase(iit); iit=i.begin(); --iit; @@ -2652,8 +2710,8 @@ index_m i(p.dim-s); piit=piitbeg; vit=vitbeg; - iit=i.riptr->i.begin(); - iti=it->index.riptr->i.begin(); + iit=i.begin(); + iti=it->index.begin(); vp_pos=0; // construct new index without constant variables // and find value of index inside vp @@ -2705,12 +2763,16 @@ vectpoly vp,vq; int i; if ( (i=extract_monomials(p,pi,vp)) ){ + if (i<0) + return false; pi=index_t(pi.begin(),pi.begin()+i); i=extract_monomials(p,pi,vp); if (i<0) return false; } if ( (i=extract_monomials(q,pi,vq)) ){ + if (i<0) + return false; pi=index_t(pi.begin(),pi.begin()+i); extract_monomials(p,pi,vp); i=extract_monomials(q,pi,vq); @@ -2730,16 +2792,16 @@ int j; for (;dt!=dtend;++dt){ index_m newi; - newi.riptr->i.reserve(p.dim); + newi.reserve(p.dim); piit=piitbeg; - dtit=dt->index.riptr->i.begin(); + dtit=dt->index.begin(); for (j=0;j<p.dim;++j){ if (piit!=piitend && j==*piit){ - newi.riptr->i.push_back(0); + newi.push_back(0); ++piit; } else { - newi.riptr->i.push_back(*dtit); + newi.push_back(*dtit); ++dtit; } } @@ -2892,7 +2954,7 @@ if ( debug_infolevel>=20-p_simp.dim ) cerr << "//Gcdheu exact division failed! " << clock() << endl; if (p_simp.coord.size()==1){ - index_t i=index_gcd(p_simp.coord.front().index.riptr->i,q_simp.gcddeg()); + index_t i=index_gcd(p_simp.coord.front().index.iref(),q_simp.gcddeg()); d=polynome(monomial<gen>(plus_one,i)); if (i!=index_t(i.size())){ i=-i; @@ -2918,7 +2980,7 @@ if ( debug_infolevel>=20-p_simp.dim ) cerr << "//Gcdheu exact division failed! " << clock() << endl; if (q_simp.coord.size()==1){ - index_t i=index_gcd(q_simp.coord.front().index.riptr->i,p_simp.gcddeg()); + index_t i=index_gcd(q_simp.coord.front().index.iref(),p_simp.gcddeg()); d=polynome(monomial<gen>(plus_one,i)); if (i!=index_t(i.size())){ i=-i; @@ -3280,7 +3342,7 @@ index_t::const_iterator itit; bool add; for (;it!=itend;++it){ - itit=it->index.riptr->i.begin(); + itit=it->index.begin(); add=true; for (i=0,total=0;i<n;++i,++itit){ total += *itit; @@ -3537,7 +3599,7 @@ delta=polynome(a.dim); return true; } - if (it->index.riptr->i.front()==1) + if (it->index.front()==1) b=Tnextcoeff<gen>(it,itend); else b=polynome(a.dim); @@ -3812,13 +3874,13 @@ monomial_v::const_iterator it=pcur.coord.begin(); monomial_v::const_iterator itend=pcur.coord.end(); polynome curanpow(pow(an,0)); - int savpow=it->index.riptr->i.front(); + int savpow=it->index.front(); unitaryp=pow(polynome(monomial<gen>(gen(1),1,pcur.dim)),savpow); savpow--; int newpow; ++it; for (;it!=itend;){ - newpow=it->index.riptr->i.front(); + newpow=it->index.front(); polynome an_1=Tnextcoeff<gen>(it,itend); curanpow=curanpow*pow(an,savpow-newpow); unitaryp=unitaryp+(an_1*curanpow).untrunc1(newpow); @@ -3834,7 +3896,7 @@ int curpow; polynome ppush(unitaryp.dim); for (;it!=itend;){ - curpow=it->index.riptr->i.front(); + curpow=it->index.front(); polynome an_1=Tnextcoeff<gen>(it,itend); ppush=ppush+(an_1*pow(an,curpow)).untrunc1(curpow); } @@ -4010,7 +4072,7 @@ if (*(p_it->value._EXTptr+1)!=*(e._EXTptr+1)) setsizeerr("Factor: Only one algebraic extension allowed"); // convert the polynomial of the algebraic extension generator - index_t ii=p_it->index.riptr->i; + index_t ii=p_it->index.iref(); ii.insert(ii.begin(),0); p_y=p_y+poly1_2_polynome(*(p_it->value._EXTptr->_VECTptr),p_y.dim).shift(ii); } @@ -4056,7 +4118,7 @@ index_t inner_index,outer_index; vector< monomial<gen> >::const_iterator it=p.coord.begin(),itend=p.coord.end(); for (;it!=itend;++it){ - outer_index=it->index.riptr->i; + outer_index=it->index.iref(); if (it->value.type!=_POLY){ for (int j=0;j<inner_dim;++j) outer_index.push_back(0); @@ -4065,7 +4127,7 @@ else { vector< monomial<gen> >::const_iterator jt=it->value._POLYptr->coord.begin(),jtend=it->value._POLYptr->coord.end(); for (;jt!=jtend;++jt){ - inner_index= jt->index.riptr->i; + inner_index= jt->index.iref(); res.coord.push_back(monomial<gen>(jt->value,mergeindex(outer_index,inner_index))); } } @@ -4082,9 +4144,8 @@ polynome res(outer_dim); vector< monomial<gen> >::const_iterator it=p.coord.begin(),itend=p.coord.end(); for (; it!=itend;++it){ - index_t cur_index= it->index.riptr->i; - index_t outer_index(cur_index.begin(),cur_index.begin()+outer_dim); - index_t inner_index(cur_index.begin()+outer_dim,cur_index.end()); + index_t outer_index(it->index.begin(),it->index.begin()+outer_dim); + index_t inner_index(it->index.begin()+outer_dim,it->index.end()); if (outer_index!=cur_outer){ if (!is_zero(cur_inner)) res.coord.push_back(monomial<gen>(cur_inner,cur_outer)); @@ -4173,7 +4234,7 @@ // and search for a variable such that one degree is not divisible by n vector< monomial<gen> >::const_iterator It=c.coord.begin(),Itend=c.coord.end(); for (;It!=Itend;++It){ - const index_t & i=It->index.riptr->i; + const index_t &i=It->index.iref(); for (int j=0;j<c.dim;++j){ if (i[j]%n){ if (j==0) @@ -4370,7 +4431,7 @@ vector< monomial<gen> >::const_iterator ppit=p.coord.begin(); vector< monomial<gen> >::const_iterator ppitend=p.coord.end(); for (;ppit!=ppitend;++ppit){ - int newpow=ppit->index.riptr->i.front(); + int newpow=ppit->index.front(); for (;curpow>newpow;--curpow) v.push_back(0); if (ppit->value.type==_INT_) @@ -4512,10 +4573,10 @@ return true; } // extract powers of indeterminates - index_t mindeg=p_primit.coord.back().index.ript... [truncated message content] |
From: <pa...@us...> - 2010-06-30 09:29:41
|
Revision: 779 http://xcas.svn.sourceforge.net/xcas/?rev=779&view=rev Author: parisse Date: 2010-06-30 09:29:34 +0000 (Wed, 30 Jun 2010) Log Message: ----------- Modified Paths: -------------- trunk/giac-xcas/giac/src/Graph.cc trunk/giac-xcas/giac/src/Tableur.cc trunk/giac-xcas/giac/src/ezgcd.cc trunk/giac-xcas/giac/src/gausspol.cc trunk/giac-xcas/giac/src/gen.cc trunk/giac-xcas/giac/src/input_lexer.cc trunk/giac-xcas/giac/src/input_lexer.ll trunk/giac-xcas/giac/src/input_parser.yy trunk/giac-xcas/giac/src/misc.cc trunk/giac-xcas/giac/src/plot.cc trunk/giac-xcas/giac/src/poly.h trunk/giac-xcas/giac/src/threaded.cc trunk/giac-xcas/giac/src/vecteur.cc Modified: trunk/giac-xcas/giac/src/Graph.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph.cc 2010-06-22 08:35:38 UTC (rev 778) +++ trunk/giac-xcas/giac/src/Graph.cc 2010-06-30 09:29:34 UTC (rev 779) @@ -4068,7 +4068,7 @@ gen & f0=f[0]._SYMBptr->feuille; if (f0.type==_VECT && !f0._VECTptr->empty()){ gen & f1 = f0._VECTptr->front(); - if (f1.type==_VECT && f1._VECTptr->size()>4 && !is_zero((*f1._VECTptr)[4])){ + if (f1.type==_VECT && f1._VECTptr->size()>4 && (!is_zero((*f1._VECTptr)[4]) || (iptr->show_names & 2)) ){ gen legende=f1._VECTptr->front(); gen var=(*f1._VECTptr)[1]; gen r=re(legende,contextptr),i=im(legende,contextptr),a,b; @@ -6597,42 +6597,44 @@ void cb_Logo_button(No_Focus_Button * b,void *){ if (!Fl::focus()) return; + context * contextptr=get_context(b); + int l=language(contextptr); string text; if (b->label()==gettext("av")) - text="avance "; + text=localize("avance ",l); if (b->label()==gettext("re")) - text="recule "; + text=localize("recule ",l); if (b->label()==gettext("td")) - text="tourne_droite "; + text=localize("tourne_droite ",l); if (b->label()==gettext("tg")) - text="tourne_gauche "; + text=localize("tourne_gauche ",l); if (b->label()==gettext("pc")) - text="pas_de_cote "; + text=localize("pas_de_cote ",l); if (b->label()==gettext("sa")) - text="saute "; + text=localize("saute ",l); if (b->label()==gettext("cr")){ context * contextptr=get_context(b); - text="crayon "; + text=localize("crayon ",l); int col = turtle(contextptr).color; col=fl_show_colormap((Fl_Color) col); string s=col<1000?print_INT_(col):""; text += s; - b->color(col); + // b->color(col); } if (b->label()==gettext("ro")) - text="rond "; + text=localize("rond ",l); if (b->label()==gettext("di")) - text="disque "; + text=localize("disque ",l); if (b->label()==gettext("rp")) - text="rectangle_plein "; + text=localize("rectangle_plein ",l); if (b->label()==gettext("tp")) - text="triangle_plein "; + text=localize("triangle_plein ",l); if (b->label()==gettext("ef")) - text="efface "; + text=localize("efface ",l); if (b->label()==gettext("ec")) - text="ecris "; + text=localize("ecris ",l); if (b->label()==gettext("sg")) - text="signe "; + text=localize("signe ",l); Fl::focus(Xcas_input_focus); if (!text.empty()) help_output(text.substr(0,text.size()-1),language(get_context(Fl::focus()))); Modified: trunk/giac-xcas/giac/src/Tableur.cc =================================================================== --- trunk/giac-xcas/giac/src/Tableur.cc 2010-06-22 08:35:38 UTC (rev 778) +++ trunk/giac-xcas/giac/src/Tableur.cc 2010-06-30 09:29:34 UTC (rev 779) @@ -217,7 +217,7 @@ delete filename; filename = new string(tmp.print(contextptr)+".tab"); if (filename){ - prefix_filename="Save "+ * filename; + prefix_filename="Save "+ remove_path(* filename); if (Tableur_Group * gr=dynamic_cast<Tableur_Group *>(parent())){ gr->fname->label(prefix_filename.c_str()); gr->fname->show(); @@ -1308,8 +1308,19 @@ void cb_Tableur_Graph3d(Fl_Widget* m , void*) { Flv_Table_Gen * tg=find_table_brother(m); - if (tg && tg->graph2d) - tg->graph3d->window()->show(); + if (tg){ + if (tg->win3){ + delete tg->graph3d; + delete tg->win3; + } + tg->win3=new Fl_Window(tg->x()+10,tg->y()+10,2*tg->w()/3,2*tg->h()/3); + tg->graph3d = new Graph3d(0,0,tg->win3->w(),tg->win3->h(),"",0); + tg->graph3d->ylegende=1.5; + tg->win3->end(); + tg->win3->resizable(tg->win3); + tg->win3->show(); + tg->update_spread_graph(); + } } void cb_Tableur_Save_as(Fl_Widget* m , void*) { @@ -1328,7 +1339,7 @@ tg->name=tmp; tg->update_name(); } - tg->prefix_filename="Save "+*tg->filename; + tg->prefix_filename="Save "+remove_path(*tg->filename); if (Tableur_Group * gr=dynamic_cast<Tableur_Group *>(tg->parent())){ gr->fname->label(tg->prefix_filename.c_str()); gr->fname->show(); @@ -3232,10 +3243,12 @@ if (graph){ sheet2pnt(m,graph->plot_instructions); graph2d->plot_instructions=graph->plot_instructions; - graph3d->plot_instructions=graph->plot_instructions; + if (graph3d){ + graph3d->plot_instructions=graph->plot_instructions; + graph3d->redraw(); + } graph->redraw(); graph2d->redraw(); - graph3d->redraw(); } } @@ -3479,14 +3492,7 @@ table->win2->end(); table->win2->resizable(table->win2); table->win2->hide(); - table->win3=new Fl_Window(X,Y,2*W/3,2*H/3); - if (!table->graph3d){ - table->graph3d = new Graph3d(X,Y,2*W/3,2*H/3,"",0); - table->graph3d->ylegende=1.5; - } - table->win3->end(); - table->win3->resizable(table->win3); - table->win3->hide(); + table->win3=0; resize2(); // handle(FL_FOCUS); } Modified: trunk/giac-xcas/giac/src/ezgcd.cc =================================================================== --- trunk/giac-xcas/giac/src/ezgcd.cc 2010-06-22 08:35:38 UTC (rev 778) +++ trunk/giac-xcas/giac/src/ezgcd.cc 2010-06-30 09:29:34 UTC (rev 779) @@ -515,7 +515,7 @@ U[i].coord.push_back(monomial<gen>(*it,deg-n,1,pcur_adjusted.dim)); } } - polynome quo,rem,tmp; + polynome quo(dim),rem(dim),tmp(dim); // we have now pcur_adjusted = product P_i + O(total_degree>=1) int Total=pcur_adjusted.total_degree(); // lift to pcur_adjusted = product P_i + O(total_degree>=k+1) Modified: trunk/giac-xcas/giac/src/gausspol.cc =================================================================== --- trunk/giac-xcas/giac/src/gausspol.cc 2010-06-22 08:35:38 UTC (rev 778) +++ trunk/giac-xcas/giac/src/gausspol.cc 2010-06-30 09:29:34 UTC (rev 779) @@ -1597,9 +1597,9 @@ return th.TDivRem(other,quo,rem,allowrational); } - bool exactquotient(const polynome & a,const polynome & b,polynome & quo){ + bool exactquotient(const polynome & a,const polynome & b,polynome & quo,bool allowrational=true){ clock_t beg=clock(),delta; - bool res= a.Texactquotient(b,quo,true); + bool res= a.Texactquotient(b,quo,allowrational); delta=clock()-beg; if (delta && debug_infolevel) // a.dim>=inspectdim cerr << "exactquo end " << delta << " " << res << endl; @@ -2833,7 +2833,10 @@ cerr << "Gcdheu end ppz" << clock() << " " << np_simp << " " << nq_simp << endl; d_content=gcd(np_simp,nq_simp); // type may have changed by ppz simplification, recheck - pt=coefftype(p_simp,coefft),qt=coefftype(q_simp,coeffqt); + if (!is_integer(np_simp)) + pt=coefftype(p_simp,coefft); + if (!is_integer(nq_simp)) + qt=coefftype(q_simp,coeffqt); if (pt>=_EXT && qt>=_EXT && pt!=qt) setsizeerr("Incompatible coeff type"); if (pt<_EXT && qt>=_EXT){ @@ -2872,9 +2875,10 @@ // gcd in Z[X] return gcd_modular(p_simp,q_simp,d,p_simp,q_simp,compute_cofactors); } + bool allowrational = pt>=_POLY || qt>=_POLY; if (!(p_deg>q_deg)){ polynome quo(p_simp.dim); - if (exactquotient(q_simp,p_simp,quo)){ + if (exactquotient(q_simp,p_simp,quo,allowrational)){ d=p_simp; q_simp=quo; p_simp=polynome(monomial<gen>(plus_one,0,p_simp.dim)); @@ -2900,7 +2904,7 @@ } if (!(q_deg>p_deg) ) { polynome quo(p_simp.dim); - if (exactquotient(p_simp,q_simp,quo)){ + if (exactquotient(p_simp,q_simp,quo,allowrational)){ d=q_simp; p_simp=quo; q_simp=polynome(monomial<gen>(plus_one,0,p_simp.dim)); Modified: trunk/giac-xcas/giac/src/gen.cc =================================================================== --- trunk/giac-xcas/giac/src/gen.cc 2010-06-22 08:35:38 UTC (rev 778) +++ trunk/giac-xcas/giac/src/gen.cc 2010-06-30 09:29:34 UTC (rev 779) @@ -6863,6 +6863,13 @@ else return undef; } + if (is_inf(a)){ + if (is_inf(b)) + return undef; + if (is_zero(b)) + return unsigned_inf; + return a*b; + } if (is_inf(b)){ if (is_inf(a)) return undef; Modified: trunk/giac-xcas/giac/src/input_lexer.cc =================================================================== --- trunk/giac-xcas/giac/src/input_lexer.cc 2010-06-22 08:35:38 UTC (rev 778) +++ trunk/giac-xcas/giac/src/input_lexer.cc 2010-06-30 09:29:34 UTC (rev 779) @@ -2568,8 +2568,8 @@ * Note Maple input should be processed replacing # with // and { } for set * This file must be processed with flex. */ /* - * Early version modified from GiNaC by B. Parisse (C) 2001, 7 - * GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany + * Copyright (C) 2001,10 B. Parisse, Institut Fourier, 38402 St Martin d'Heres + * The very first version was inspired by GiNaC lexer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/giac-xcas/giac/src/input_lexer.ll =================================================================== --- trunk/giac-xcas/giac/src/input_lexer.ll 2010-06-22 08:35:38 UTC (rev 778) +++ trunk/giac-xcas/giac/src/input_lexer.ll 2010-06-30 09:29:34 UTC (rev 779) @@ -6,8 +6,8 @@ * This file must be processed with flex. */ /* - * Early version modified from GiNaC by B. Parisse (C) 2001, 7 - * GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany + * Copyright (C) 2001,10 B. Parisse, Institut Fourier, 38402 St Martin d'Heres + * The very first version was inspired by GiNaC lexer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/giac-xcas/giac/src/input_parser.yy =================================================================== --- trunk/giac-xcas/giac/src/input_parser.yy 2010-06-22 08:35:38 UTC (rev 778) +++ trunk/giac-xcas/giac/src/input_parser.yy 2010-06-30 09:29:34 UTC (rev 779) @@ -4,8 +4,8 @@ * This file must be processed with yacc/bison. */ /* - * Early version modified from GiNaC by B. Parisse (C) 2000, 2007 - * GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany + * Copyright (C) 2001,10 B. Parisse, Institut Fourier, 38402 St Martin d'Heres + * The very first version was inspired by GiNaC parser * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: trunk/giac-xcas/giac/src/misc.cc =================================================================== --- trunk/giac-xcas/giac/src/misc.cc 2010-06-22 08:35:38 UTC (rev 778) +++ trunk/giac-xcas/giac/src/misc.cc 2010-06-30 09:29:34 UTC (rev 779) @@ -3926,7 +3926,10 @@ res.insert(res.begin(),a); res.insert(res.begin(),b); res.push_back(b); - attributs[1]=_romberg(gen(makevecteur(v[0],v[1]),_SEQ__VECT),contextptr); + int nd=decimal_digits(contextptr); + decimal_digits(3,contextptr); + attributs[1]=string2gen(_romberg(gen(makevecteur(v[0],v[1]),_SEQ__VECT),contextptr).print(contextptr),false); + decimal_digits(nd,contextptr); return pnt_attrib(gen(res,_GROUP__VECT),attributs,contextptr); } // end s==2 if (s>=3) @@ -3973,7 +3976,10 @@ res.push_back(b+fxf*cst_i); } res.push_back(b); - attributs[1]=A; + int nd=decimal_digits(contextptr); + decimal_digits(3,contextptr); + attributs[1]=string2gen(A.print(contextptr),false); + decimal_digits(nd,contextptr); return gen(makevecteur(pnt_attrib(res,attributs,contextptr),graph),_SEQ__VECT); } // end if (s>=3) } // end polyg.type==_VECT Modified: trunk/giac-xcas/giac/src/plot.cc =================================================================== --- trunk/giac-xcas/giac/src/plot.cc 2010-06-22 08:35:38 UTC (rev 778) +++ trunk/giac-xcas/giac/src/plot.cc 2010-06-30 09:29:34 UTC (rev 779) @@ -7735,7 +7735,7 @@ } decimal_digits(contextptr)=save_digits; gen position=v[0]; - if (position.type==_VECT) + if (position.type==_VECT && position._VECTptr->size()==2) return symb_pnt(symbolic(at_legende,makevecteur(position,string2gen(s,false),couleur)),couleur,contextptr); position=remove_at_pnt(v[0]); if (position.type==_SYMB) { @@ -10118,7 +10118,6 @@ angle=tmp._DOUBLE_val; double pi=M_PI; angle=angle-std::floor(angle/pi)*pi; - std::cout<<angle << endl; if (fabs(angle)<epsilon(contextptr) || fabs(pi-angle)<epsilon(contextptr)) setsizeerr(); } @@ -10144,8 +10143,8 @@ //if (!kstep) kstep=20;deltay=(ymax-ymin)/kstep; } - deltax=(xmax-xmin)/std::floor(fabs((xmax-xmin)/deltax)); - deltay=(ymax-ymin)/std::floor(fabs((ymax-ymin)/deltay)); + // deltax=(xmax-xmin)/std::floor(fabs((xmax-xmin)/deltax)); + // deltay=(ymax-ymin)/std::floor(fabs((ymax-ymin)/deltay)); if (quadrillage==2){ int color=attributs[0].val; color = (color & 0xffff )| (7<<25) | (1 << 19); @@ -12055,6 +12054,26 @@ const unary_function_eval __Oy_2d_unit_vector(&giac::_Oy_2d_unit_vector,_Oy_2d_unit_vector_s); const unary_function_ptr at_Oy_2d_unit_vector (&__Oy_2d_unit_vector,0,true); + // 2-d frame + gen _frame_2d(const gen & args,GIAC_CONTEXT){ + vecteur v=makevecteur(_point(makevecteur(0,0),contextptr),_point(makevecteur(1,0),contextptr)); + if (args.type==_VECT) + v=mergevecteur(v,*args._VECTptr); + else + v.push_back(args); + vecteur res(1,_vector(gen(v,_SEQ__VECT),contextptr)); + v=makevecteur(_point(makevecteur(0,0),contextptr),_point(makevecteur(0,1),contextptr)); + if (args.type==_VECT) + v=mergevecteur(v,*args._VECTptr); + else + v.push_back(args); + res.push_back(_vector(gen(v,_SEQ__VECT),contextptr)); + return gen(res,_SEQ__VECT); + } + const char _frame_2d_s []="frame_2d"; + const unary_function_eval __frame_2d(&giac::_frame_2d,_frame_2d_s); + const unary_function_ptr at_frame_2d (&__frame_2d,0,true); + // 3-d unit_vector gen _Ox_3d_unit_vector(const gen & args,GIAC_CONTEXT){ vecteur v=makevecteur(_point(makevecteur(0,0,0),contextptr),_point(makevecteur(1,0,0),contextptr)); @@ -12094,6 +12113,32 @@ const unary_function_eval __Oz_3d_unit_vector(&giac::_Oz_3d_unit_vector,_Oz_3d_unit_vector_s); const unary_function_ptr at_Oz_3d_unit_vector (&__Oz_3d_unit_vector,0,true); + // 3-d frame + gen _frame_3d(const gen & args,GIAC_CONTEXT){ + vecteur v=makevecteur(_point(makevecteur(0,0,0),contextptr),_point(makevecteur(1,0,0),contextptr)); + if (args.type==_VECT) + v=mergevecteur(v,*args._VECTptr); + else + v.push_back(args); + vecteur res(1,_vector(gen(v,_SEQ__VECT),contextptr)); + v=makevecteur(_point(makevecteur(0,0,0),contextptr),_point(makevecteur(0,1,0),contextptr)); + if (args.type==_VECT) + v=mergevecteur(v,*args._VECTptr); + else + v.push_back(args); + res.push_back(_vector(gen(v,_SEQ__VECT),contextptr)); + v=makevecteur(_point(makevecteur(0,0,0),contextptr),_point(makevecteur(0,0,1),contextptr)); + if (args.type==_VECT) + v=mergevecteur(v,*args._VECTptr); + else + v.push_back(args); + res.push_back(_vector(gen(v,_SEQ__VECT),contextptr)); + return gen(res,_SEQ__VECT); + } + const char _frame_3d_s []="frame_3d"; + const unary_function_eval __frame_3d(&giac::_frame_3d,_frame_3d_s); + const unary_function_ptr at_frame_3d (&__frame_3d,0,true); + const unary_function_ptr plot_sommets[]={at_pnt,at_parameter,at_cercle,at_curve,at_animation,0}; const unary_function_ptr not_point_sommets[]={at_cercle,at_curve,at_hyperplan,at_hypersphere,at_hypersurface,0}; const unary_function_ptr notexprint_plot_sommets[]={at_funcplot,at_paramplot,at_polarplot,at_implicitplot,at_contourplot,at_odeplot,at_interactive_odeplot,at_fieldplot,at_seqplot,at_ellipse,at_hyperbole,at_parabole,0}; Modified: trunk/giac-xcas/giac/src/poly.h =================================================================== --- trunk/giac-xcas/giac/src/poly.h 2010-06-22 08:35:38 UTC (rev 778) +++ trunk/giac-xcas/giac/src/poly.h 2010-06-30 09:29:34 UTC (rev 779) @@ -1061,6 +1061,14 @@ quo=tensor<T>(1,dim); return true; } + if (dim>1 && !allowrational && lexsorted_degree()==b.lexsorted_degree()){ + if (!Tfirstcoeff(*this).trunc1().Texactquotient(Tfirstcoeff(b).trunc1(),quo,allowrational)) + return false; + quo=quo.untrunc1(); + if (is_one(quo)) + return false; // already tested above + return *this==quo*b; + } tensor<T> r(b.dim); return this->TDivRem1(b,quo,r,allowrational,1); } Modified: trunk/giac-xcas/giac/src/threaded.cc =================================================================== --- trunk/giac-xcas/giac/src/threaded.cc 2010-06-22 08:35:38 UTC (rev 778) +++ trunk/giac-xcas/giac/src/threaded.cc 2010-06-30 09:29:34 UTC (rev 779) @@ -56,7 +56,7 @@ const unary_function_eval __heap_mult(&_heap_mult,_heap_mult_s); const unary_function_ptr at_heap_mult (&__heap_mult,0,true); - double modgcd_cachesize=40000; + double modgcd_cachesize=6291456; gen _modgcd_cachesize(const gen & g0,GIAC_CONTEXT){ gen g=evalf_double(g0,1,contextptr); if (g.type!=_DOUBLE_) @@ -499,15 +499,19 @@ hashgcd_U u,u0,var=varsn.back(),var2=vars.back(); short int shiftvar=find_shift(var),shiftvar2=find_shift(var2); unsigned degxn = degree_xn(p,shiftvar,shiftvar2); - vector<size_t> nterms(degxn+1); // number of non constant terms + vector<int> nterms(degxn+1); + vector<bool> nonzero(degxn+1,false); // number of non constant terms + int pos; for (it=p.begin();it!=itend;++it){ u = it->u; + pos = (u%var) >> shiftvar2; + nonzero[pos]=true; if (u>>shiftvar) - ++nterms[(u%var) >> shiftvar2]; + ++nterms[pos]; } vector< vector< T_unsigned<T,hashgcd_U> > > vp(degxn+1); for (int i=degxn;i>=0;--i){ - if (!nterms[i]) // all terms would be constant in vp[i] + if (!nterms[i] && nonzero[i]) // all terms would be constant in vp[i] return true; vp[i].reserve(nterms[i]+1); } @@ -1859,9 +1863,9 @@ return true; } + /* template<class T> - void divided_differences(const vector<int> & x,const vector< vector< T_unsigned<T,hashgcd_U> > > & y,vector< vector< T_unsigned<T,hashgcd_U> > > & res,int modulo){ - res=y; + void divided_differences(const vector<int> & x,vector< vector< T_unsigned<T,hashgcd_U> > > & res,int modulo){ int s=x.size(); int fact; for (int k=1;k<s;++k){ @@ -1873,17 +1877,33 @@ } } } + */ - // Lagrange interpolation at x/y template<class T> - void interpolate(const vector<int> & x,const vector< vector< T_unsigned<T,hashgcd_U> > > & y,vector< T_unsigned<T,hashgcd_U> > & res,hashgcd_U varx,int modulo){ - vector< vector< T_unsigned<T,hashgcd_U> > > diff; - divided_differences(x,y,diff,modulo); + void divided_differences(const vector<int> & x,vector< vector< T_unsigned<T,hashgcd_U> > > & res,int modulo){ + int s=x.size(); + int fact; + vector< T_unsigned<T,hashgcd_U> > tmp; + for (int k=1;k<s;++k){ + for (int j=s-1;j>=k;--j){ + smallsub(res[j],res[j-1],tmp,modulo); + swap(tmp,res[j]); + fact=invmod(x[j]-x[j-k],modulo); + if (fact!=1) + smallmult(fact,res[j],res[j],modulo); + } + } + } + +// Lagrange interpolation at x/y + template<class T> + void interpolate(const vector<int> & x,vector< vector< T_unsigned<T,hashgcd_U> > > & diff,vector< T_unsigned<T,hashgcd_U> > & res,hashgcd_U varx,int modulo){ + divided_differences(x,diff,modulo); int s=diff.size(); vector<int> interp(1,1); res=diff.front(); int alpha; - vector< T_unsigned<T,hashgcd_U> > tmp; + vector< T_unsigned<T,hashgcd_U> > tmp,tmp2; for (int j=1;j<s;++j){ alpha=x[j-1]; interp.push_back(smod(-longlong(alpha)*interp[j-1],modulo)); @@ -1891,7 +1911,8 @@ interp[i]=smod(-longlong(alpha)*interp[i-1]+interp[i],modulo); } distmult(diff[j],interp,tmp,varx,modulo); - smalladd(res,tmp,res,modulo); + smalladd(res,tmp,tmp2,modulo); + swap(tmp2,res); } /* res=diff[s-1]; @@ -1906,8 +1927,7 @@ */ } - void divided_differences(const vector<int> & x,const vector< vector<int> > & y,vector< vector<int> > & res,int modulo){ - res=y; + void divided_differences(const vector<int> & x,vector< vector<int> > & res,int modulo){ int s=x.size(); int fact; for (int k=1;k<s;++k){ @@ -1924,9 +1944,8 @@ } // Lagrange interpolation at x/y - void interpolate(const vector<int> & x,const vector< vector<int> > & y,vector< vector<int> > & res,int modulo){ - vector< vector<int> > diff; - divided_differences(x,y,diff,modulo); + void interpolate(const vector<int> & x,vector< vector<int> > & diff,vector< vector<int> > & res,int modulo){ + divided_differences(x,diff,modulo); // cerr << "end diff div " << clock() << endl; res.clear(); int s=diff.size(),alpha; @@ -1995,7 +2014,7 @@ } } - void interpolate(const vector<int> & x,const vector< vector<int> > & y,vector< T_unsigned<int,hashgcd_U> > & res,int varxn,int var2,int modulo){ + void interpolate(const vector<int> & x,vector< vector<int> > & y,vector< T_unsigned<int,hashgcd_U> > & res,int varxn,int var2,int modulo){ vector< vector<int> > tmp; interpolate(x,y,tmp,modulo); convert_back(tmp,varxn,var2,res); @@ -2272,6 +2291,14 @@ int dbdeg=db.size()-1; if (!dbdeg){ d=dcont; + if (compute_pcofactor){ + smallmult(pcofactor,p,pcofactor,modulo,0); + smallmult(smod(longlong(p_orig.front().g)*invmod(pcofactor.front().g,modulo),modulo),pcofactor,pcofactor,modulo); + } + if (compute_qcofactor){ + smallmult(qcofactor,q,qcofactor,modulo,0); + smallmult(smod(longlong(q_orig.front().g)*invmod(qcofactor.front().g,modulo),modulo),qcofactor,qcofactor,modulo); + } return true; } if (!essai){ // 1st gcd test @@ -2408,12 +2435,14 @@ gcd_par.compute_qcofactor=compute_qcofactor; gcd_par.dim2=dim2; gcd_par.modulo=modulo; - if (dim>3 && sumsize > modgcd_cachesize ){ + if (dim>3 || (dim==3 && sumsize*ptotaldeg*4 > modgcd_cachesize )){ gcd_par.nthreads=nthreads; nthreads=1; } else - gcd_par.nthreads=1; + gcd_par.nthreads=1; + if (debug_infolevel>20 && nthreads>1) + cerr << "nthreads " << nthreads << " dim " << dim << " " << sumsize << " " << sumsize*ptotaldeg << endl; if (nthreads>gcddeg_plus_delta) nthreads=gcddeg_plus_delta+1; if (nthreads>1){ @@ -4649,6 +4678,19 @@ int dbdeg=db.size()-1; if (!dbdeg){ d=dcont; + if (compute_pcofactor){ + smallmult(p,pcofactor,pcofactor,pminmodulo,0); + vector<int> tmp(invmod(pcofactor.front().g,pminmodulo)); + mulext(tmp,p_orig.front().g,pmin,modulo); + smallmult(tmp,pcofactor,pcofactor,pminmodulo); + } + if (compute_qcofactor){ + smallmult(q,qcofactor,qcofactor,pminmodulo,0); + vector<int> tmp(invmod(qcofactor.front().g,pminmodulo)); + mulext(tmp,q_orig.front().g,pmin,modulo); + smallmult(tmp,qcofactor,qcofactor,pminmodulo); + } + return true; } if (!essai){ // 1st gcd test Modified: trunk/giac-xcas/giac/src/vecteur.cc =================================================================== --- trunk/giac-xcas/giac/src/vecteur.cc 2010-06-22 08:35:38 UTC (rev 778) +++ trunk/giac-xcas/giac/src/vecteur.cc 2010-06-30 09:29:34 UTC (rev 779) @@ -1417,19 +1417,19 @@ // addvecteur is different from addmodpoly if a and b have != sizes // because it always start adding at the beginning of a and b void addvecteur(const vecteur & a,const vecteur & b,vecteur & res){ - if (b.begin()==res.begin() && b.begin()!=a.begin()){ + if (&b==&res && &b!=&a){ addvecteur(b,a,res); return ; } vecteur::const_iterator itb=b.begin(), itbend=b.end(); - if (a.begin()==res.begin()){ // in-place addition + if (&a==&res){ // in-place addition vecteur::iterator ita=res.begin(), itaend=res.end(); for (;(ita!=itaend)&&(itb!=itbend);++ita,++itb){ *ita=*ita+*itb; } - return; for (;itb!=itbend;++itb) res.push_back(*itb); + return; } vecteur::const_iterator ita=a.begin(), itaend=a.end(); res.clear(); @@ -1446,7 +1446,7 @@ // subvecteur is different from submodpoly if a and b have != sizes // because it always start substr. at the beginning of a and b void subvecteur(const vecteur & a,const vecteur & b,vecteur & res){ - if (b.begin()==res.begin()){ + if (&b==&res){ vecteur::const_iterator ita=a.begin(), itaend=a.end(); vecteur::iterator itb=res.begin(), itbend=res.end(); for (;(ita!=itaend)&&(itb!=itbend);++ita,++itb){ @@ -1457,7 +1457,7 @@ return; } vecteur::const_iterator itb=b.begin(), itbend=b.end(); - if (a.begin()==res.begin()){ // in-place addition + if (&a==&res){ // in-place substract vecteur::iterator ita=res.begin(), itaend=res.end(); for (;(ita!=itaend)&&(itb!=itbend);++ita,++itb){ *ita=*ita+*itb; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2010-06-22 08:35:45
|
Revision: 778 http://xcas.svn.sourceforge.net/xcas/?rev=778&view=rev Author: parisse Date: 2010-06-22 08:35:38 +0000 (Tue, 22 Jun 2010) Log Message: ----------- Modified Paths: -------------- trunk/giac-xcas/giac/src/Makefile.am trunk/giac-xcas/giac/src/ezgcd.cc trunk/giac-xcas/giac/src/ezgcd.h trunk/giac-xcas/giac/src/gausspol.cc trunk/giac-xcas/giac/src/gen.cc trunk/giac-xcas/giac/src/gen.h trunk/giac-xcas/giac/src/global.cc trunk/giac-xcas/giac/src/global.h trunk/giac-xcas/giac/src/help.cc trunk/giac-xcas/giac/src/index.cc trunk/giac-xcas/giac/src/index.h trunk/giac-xcas/giac/src/input_lexer.cc trunk/giac-xcas/giac/src/input_lexer.ll trunk/giac-xcas/giac/src/intg.cc trunk/giac-xcas/giac/src/modpoly.cc trunk/giac-xcas/giac/src/plot.cc trunk/giac-xcas/giac/src/poly.h trunk/giac-xcas/giac/src/usual.cc trunk/giac-xcas/giac/src/vecteur.cc Modified: trunk/giac-xcas/giac/src/Makefile.am =================================================================== --- trunk/giac-xcas/giac/src/Makefile.am 2010-06-11 08:45:45 UTC (rev 777) +++ trunk/giac-xcas/giac/src/Makefile.am 2010-06-22 08:35:38 UTC (rev 778) @@ -22,7 +22,8 @@ solve.h quater.h subst.h usual.h intg.h intgab.h risch.h lin.h series.h \ vecteur.h csturm.h moyal.h tex.h global.h \ ifactor.h alg_ext.h gauss.h isom.h plot.h plot3d.h rpn.h prog.h \ -pari.h cocoa.h giac.h first.h maple.h help.h static.h static_lexer.h static_extern.h +pari.h cocoa.h giac.h first.h maple.h help.h \ +static.h static_lexer.h static_extern.h static_lexer.h static_help.h noinst_LTLIBRARIES = libxcas.la libxcas_la_LIBADD = libgiac.la $(GUI_LIBS) Modified: trunk/giac-xcas/giac/src/ezgcd.cc =================================================================== --- trunk/giac-xcas/giac/src/ezgcd.cc 2010-06-11 08:45:45 UTC (rev 777) +++ trunk/giac-xcas/giac/src/ezgcd.cc 2010-06-22 08:35:38 UTC (rev 778) @@ -24,6 +24,10 @@ #include "gausspol.h" #include "time.h" #include "modpoly.h" +#include "monomial.h" +#include "derive.h" +#include "subst.h" +#include "solve.h" #ifndef NO_NAMESPACE_GIAC namespace giac { @@ -91,21 +95,42 @@ return quo*y+rem.untrunc1(); } + void reduce_poly(const polynome & p,const vecteur & v,int degree,polynome & res){ + res.coord.clear(); + res.dim=p.dim; + vector< monomial<gen> >::const_iterator it=p.coord.begin(),itend=p.coord.end(); + if (is_zero(v)){ + index_t::const_iterator jt,jtend; + int otherdeg; + for (;it!=itend;++it){ + jt=it->index.riptr->i.begin()+1; + jtend=it->index.riptr->i.end(); + for (otherdeg=0;jt!=jtend;++jt){ + otherdeg += *jt; + } + if (otherdeg<degree) + res.coord.push_back(*it); + } + } + else { + for (;it!=itend;){ + int d=it->index.riptr->i.front(); + polynome tmp(Tnextcoeff<gen>(it,itend)); + res=res+reduce(tmp,v,degree).untrunc1(d); + } + } + } + // Same as reduce but do it for every coefficient of p with // respect to the main variable polynome reduce_poly(const polynome & p,const vecteur & v,int degree){ - vector< monomial<gen> >::const_iterator it=p.coord.begin(),itend=p.coord.end(); polynome res(p.dim); - for (;it!=itend;){ - int d=it->index.riptr->i.front(); - polynome tmp(Tnextcoeff<gen>(it,itend)); - res=res+reduce(tmp,v,degree).untrunc1(d); - } + reduce_poly(p,v,degree,res); return res; } // reduce_divrem does a mixed division: euclidean w.r.t. the first var - // and ascending power of X-b for the other vars + // and ascending power of X-v for the other vars // FIXME: this implementation does not work currently, except if other // depends only on the first var bool reduce_divrem2(const polynome & a,const polynome & other,const vecteur & v,int n,polynome & quo,polynome & rem,bool allowrational=false) { @@ -150,7 +175,8 @@ } // end error trapping quo.coord.push_back(monomial<gen>(q,a_max-b_max)); - tensor<gen> temp=reduce_poly(other.shift(a_max-b_max,q),v,n); + tensor<gen> temp; + reduce_poly(other.shift(a_max-b_max,q),v,n,temp); rem = rem-temp; if (rem.coord.size()) a_max=rem.coord.front().index; @@ -185,6 +211,404 @@ return true; } + // increment last index in v up to k, + // if last index is k-1 + // while index[size-pos] is k-pos increment pos + // if pos reaches size return false (not possible anymore) + // else increment index[size-pos] and set following ones to prev+1 + bool next(vector<int> & v,int dim,int k){ + ++v.back(); + if (v.back()!=k) + return true; + int pos=2; + for (;pos<=dim;++pos){ + if (v[dim-pos]!=k-pos) + break; + } + if (pos>dim) + return false; + ++v[dim-pos]; + for (--pos;pos>0;--pos){ + v[dim-pos]=v[dim-pos-1]+1; + } + return true; + } + + // pcur(x1,...,xk,0,...,0) + void peval_xk_xn_zero(const polynome & pcur,int k,polynome & pcurx1x2){ + pcurx1x2.coord.clear(); + int dim=pcur.dim; + pcurx1x2.dim=dim; + vector< monomial<gen> >::const_iterator it=pcur.coord.begin(),itend=pcur.coord.end(); + for (;it!=itend;++it){ + index_t & i = it->index.riptr->i; + int j=k; + for (;j<dim;++j){ + if (i[j]) + break; + } + if (j==dim) + pcurx1x2.coord.push_back(*it); + } + } + + // pcur(x1,...,xk,0,...,0) + void truncate_xk_xn(polynome & pcur,int k){ + vector< monomial<gen> >::iterator it=pcur.coord.begin(),itend=pcur.coord.end(); + for (;it!=itend;++it){ + index_t & i = it->index.riptr->i; + it->index=index_t(i.begin(),i.begin()+k); + } + pcur.dim=k; + } + + void untruncate_xk_xn(polynome & pcur,int dim){ + vector< monomial<gen> >::iterator it=pcur.coord.begin(),itend=pcur.coord.end(); + for (;it!=itend;++it){ + index_t i (dim); + i=it->index.riptr->i; + for (int j=i.size();j<dim;++j) + i.push_back(0); + it->index = i; + } + pcur.dim=dim; + } + + gen _coeff(const gen &,GIAC_CONTEXT); + + bool try_sparse_factor(const polynome & pcur,const factorization & v,int mult,factorization & f){ + /* Try sparse factorization + lcoeff(pcur,x1)^#factors-1 * pcur = product_#factors P_i + where P_i has lcoeff(pcur,x1) as leading coeff in x1 + and same non zeros coeffs pattern as the factors of Fb + */ + // count number of unknowns + factorization::const_iterator vit=v.begin(),vitend=v.end(); + int unknowns=0; + for (;vit!=vitend;++vit){ + if (vit->mult>1) + break; + unknowns += vit->fact.coord.size()-1; // lcoeff is known + } + if (unknowns>=pcur.lexsorted_degree()/2 || unknowns==0) + return false; + polynome lcp(Tfirstcoeff(pcur)); + int dim=pcur.dim; + vecteur lv(dim); + for (int i=0;i<dim;++i){ + lv[i]=identificateur("x"+print_INT_(i)); + } + gen mainvar(lv.front()); + gen lc=r2sym(lcp,lv,context0); + vecteur la(unknowns); + for (int i=0;i<unknowns;++i){ + la[i]=identificateur("a"+print_INT_(i)); + } + vecteur la_val(la); + int pos=0; + // build product(P_i) + gen product(1); + vecteur Pis; + for (vit=v.begin();vit!=vitend;++vit){ + const polynome & fact = vit->fact; + vector< monomial<gen> >::const_iterator it=fact.coord.begin(),itend=fact.coord.end(); + gen Pi=lc*pow(mainvar,it->index.riptr->i.front()); + for (++it;it!=itend;++it){ + Pi += la[pos]*pow(mainvar,it->index.riptr->i.front()); + ++pos; + } + Pis.push_back(Pi); + product = product * Pi; + } + product=product-r2sym(pcur,lv,context0)*pow(lc,Pis.size()-1,context0); + // solve equation wrt la + gen systemeg=_coeff(gen(makevecteur(product,mainvar),_SEQ__VECT),context0); + if (systemeg.type!=_VECT) + return false; + vecteur syst; + const_iterateur it=systemeg._VECTptr->begin(),itend=systemeg._VECTptr->end(); + for (++it;it!=itend;++it){ + if (!is_zero(*it)) + syst.push_back(*it); + } + // to solve syst wrt la, we search all linear equations + // if none return false, otherwise solve system, subst + while (!syst.empty()){ + int N=syst.size(); + vecteur linear; + for (int i=0;i<N;++i){ + if (is_zero(derive(derive(syst[i],la,context0),la,context0))) + linear.push_back(syst[i]); + } + if (linear.empty()) + return false; + vecteur indet(lv); + lvar(linear,indet); + indet=vecteur(indet.begin()+lv.size(),indet.end()); + vecteur sols=linsolve(linear,indet,context0); + if (sols.size()!=indet.size()) + return false; + la_val=subst(la_val,indet,sols,false,context0); + gen tmp=recursive_normal(subst(syst,indet,sols,false,context0),context0); + if (tmp.type!=_VECT) + return false; + syst.clear(); + const_iterateur it=tmp._VECTptr->begin(),itend=tmp._VECTptr->end(); + for (;it!=itend;++it){ + if (!is_zero(*it)) + syst.push_back(*it); + } + } + // subst la values + Pis=subst(Pis,la,la_val,false,context0); + for (int i=0;i<Pis.size();++i){ + gen tmp=sym2r(Pis[i],lv,context0),num,den; + fxnd(tmp,num,den); + if (num.type!=_POLY) + return false; + const polynome & N=*num._POLYptr; + f.push_back(facteur<polynome>(N/lgcd(N),mult)); + } + return true; + } + + bool try_hensel_lift_factor(const polynome & pcur,const polynome & F0,const factorization & v0,int mult,factorization & f){ + int dim=pcur.dim; + int s=v0.size(); + polynome lcp(Tfirstcoeff(pcur)); + if (lcp.coord.back().index.riptr->i.back()!=0) + return false; + gen lcpb=lcp.coord.back().value; + vector<polynome> lcoeffs(s,lcp); + bool lcoeff_known=false; + factorization::const_iterator F0it=v0.begin(),F0itend=v0.end(); + vector<modpoly> F0fact; + for (;F0it!=F0itend;++F0it){ + if (F0it->mult>1) + break; + F0fact.push_back(modularize(F0it->fact,0,0)); + } + if (pcur.dim>2 && lcp.coord.size()>1){ + // try bivariate factorization to compute a priori the leadings coefficients + // that is factor pcur(x1,x2,0,...,0) = product p_i(x1,x2) + // then factor lcoeff(pcur)(x2,x3,..,xn) = product q_j(x2,..,xn) + // the lcoeff(pcur) corresponding to lcoeff(p_i)(x2) divides + // the product of the q_j such that either q_j(x2,0,...,0) is constant + // or gcd(q_j(x2,0,...,0),lcoeff(p_i)(x2)) is not constant + // then we know multiples of the lcoeffs, we can therefore replace s, F0it, F0itend, lcoeffs + polynome pcurx1x2; + peval_xk_xn_zero(pcur,2,pcurx1x2); + factorization fx1x2,flcoeff; + vector<polynome> flcoeff0; + polynome pcurx1x2cont=lgcd(pcurx1x2); + if (1 || is_one(pcurx1x2cont)){ + truncate_xk_xn(pcurx1x2,2); + if (!factor(pcurx1x2,pcurx1x2cont,fx1x2,true,false,false)) + return false; + // now find factorization of lcoeff(pcur) + polynome pcur_lcoeff(Tfirstcoeff(pcur)),pcur_lcoeffcont; + if (!factor(pcur_lcoeff.trunc1(),pcur_lcoeffcont,flcoeff,false,false,false)) + return false; + factorization::iterator jt=flcoeff.begin(),jtend=flcoeff.end(); + polynome constante(pcur_lcoeffcont.untrunc1()*pcurx1x2cont),tmp; + for (;jt!=jtend;++jt){ + jt->fact=jt->fact.untrunc1(); + peval_xk_xn_zero(jt->fact,2,tmp); // should only depend on x2 + if (Tis_constant(tmp)) + constante=constante*pow(jt->fact,jt->mult); + else + flcoeff0.push_back(tmp); + } + F0it=fx1x2.begin(); + F0itend=fx1x2.end(); + s=F0itend-F0it; + F0fact.clear(); + lcoeffs.clear(); + modpoly piF(1,1); + for (;F0it!=F0itend;++F0it){ + if (F0it->mult>1) + break; + polynome p (F0it->fact); // depends on x1 and x2 + untruncate_xk_xn(p,dim); + peval_xk_xn_zero(p,1,tmp); // make x2=0 + truncate_xk_xn(tmp,1); + modpoly Fi(modularize(tmp,0,0)); + if (gcd(piF,Fi,0).size()>1) + return false; + piF=piF*Fi; + F0fact.push_back(Fi); + // corresponding lcoeff + p=Tfirstcoeff(p); + polynome tmp2=constante; + for (jt=flcoeff.begin(),jtend=flcoeff.end();jt!=jtend;++jt){ + for (int m=jt->mult;m>0;--m){ + polynome G(flcoeff0[jt-flcoeff.begin()]); + if (Tis_constant(simplify(p,G))) + break; + else + tmp2 = tmp2 * jt->fact; + } + } + lcoeffs.push_back(tmp2); + } + lcoeff_known=true; + } + } + if (F0it!=F0itend) + return false; + // ok each factor of F0=pcur|0 is square free, they are prime together + // if lcp has too much terms it will take too long, because + // we must multiply by product(lcoeffs)/lcp + if (!lcoeff_known && std::pow(double(lcp.coord.size()),s-1)>100) + return false; + // we will lift pcur*product(lcoeffs)/lcp = product_i F0fact[i]*lcoeffs[i](b)/lcoeff(F0fact[i]) + for (int i=0;i<s;++i){ + gen lcoeff=F0fact[i].front(); + mulmodpoly(F0fact[i],lcoeffs[i].coord.back().value/lcoeff,F0fact[i]); + } + polynome pcur_adjusted(pcur); + if (!is_one(lcp)){ + if (lcoeff_known){ + polynome temp(lcoeffs[0]); + for (int i=1;i<s;++i){ + temp = temp * lcoeffs[i]; + } + temp = temp / lcp; + pcur_adjusted = pcur_adjusted * temp; + } + else { + for (int i=1;i<s;++i){ + pcur_adjusted =pcur_adjusted*lcoeffs[i]; + } + } + } + vector<modpoly> u; + egcd(F0fact,0,u); // sum_j U_j * product_{i \neq j} F0fact_i = 1 + // factor out common deno + // sum_j U_j * product_{i \neq j} F0fact_i = D + vecteur den(s); + gen D(1); + for (int i=0;i<s;++i){ + lcmdeno(u[i],den[i],context0); + D=lcm(D,den[i]); + } + for (int i=0;i<s;++i) + mulmodpoly(u[i],D/den[i],u[i]); + vector<polynome> P(s),P0(s),U(s); + vecteur b(pcur_adjusted.dim-1); + for (int i=0;i<s;++i){ + modpoly::const_iterator it=F0fact[i].begin(),itend=F0fact[i].end(); + int deg=itend-it-1; + P[i]=lcoeffs[i].trunc1().untrunc1(deg); + for (int n=0;it!=itend;++it,++n){ + if (!is_zero(*it)){ + if (n) + P[i].coord.push_back(monomial<gen>(*it,deg-n,1,pcur_adjusted.dim)); + P0[i].coord.push_back(monomial<gen>(*it,deg-n,1,pcur_adjusted.dim)); + } + } + U[i].dim=pcur_adjusted.dim; + it=u[i].begin(); itend=u[i].end(); + deg=itend-it-1; + for (int n=0;it!=itend;++it,++n){ + if (!is_zero(*it)) + U[i].coord.push_back(monomial<gen>(*it,deg-n,1,pcur_adjusted.dim)); + } + } + polynome quo,rem,tmp; + // we have now pcur_adjusted = product P_i + O(total_degree>=1) + int Total=pcur_adjusted.total_degree(); + // lift to pcur_adjusted = product P_i + O(total_degree>=k+1) + // for deg from 1 to total_degree(pcur_adjusted) + // P_i += (pcur_adjusted-product P_i) * U_j mod total_degree(k+1) + for (int deg=1;deg<=Total;++deg){ + polynome prod(P[0]); + for (int i=1;i<s;++i){ + // reduce_poly(prod * P[i],b,deg+1,prod); // keep up to deg + tmp.coord.clear(); + mulpoly(prod,P[i],tmp,0); + reduce_poly(tmp,b,deg+1,prod); + } + prod = reduce_poly(pcur_adjusted,b,deg+1) - prod; + if (prod.coord.empty()){ + // check total degrees + int tdeg=0; + for (int i=0;i<s;++i) + tdeg += P[i].total_degree(); + if (tdeg==Total){ + if (deg!=Total){ + prod=P[0]; + for (int i=1;i<s;++i){ + // prod = prod * P[i]; + tmp.coord.clear(); + mulpoly(prod,P[i],tmp,0); + swap(tmp,prod); + } + if (prod==pcur_adjusted) + deg=Total; + } + if (deg==Total){ + for (int i=0;i<s;++i){ + f.push_back(facteur<polynome>(P[i]/lgcd(P[i]),mult)); + } + return true; + } + } + continue; + } + for (int i=0;i<s;++i){ + mulpoly(prod,U[i],rem,0); + if (!divrem1(rem,P0[i],quo,tmp,0) && !rem.TDivRem1(P0[i],quo,tmp,true,0)) + return false; + reduce_poly(tmp,b,deg+1,rem); + // divide by D + vector< monomial<gen> >::const_iterator r1=rem.coord.begin(),r2=rem.coord.end(); + Div<gen>(r1,r2,D,rem.coord); + P[i] = P[i] + rem; + } + } + // FIXME combine factors + if (s==2){ + f.push_back(facteur<polynome>(pcur,mult)); + return true; + } + int nfact=s; + index_t pcur_deg(pcur_adjusted.degree()); + vector<int> test(1); + for (int k=1;k<=nfact/2;){ + if (debuglevel) + cout << clock() << "Testing combination of " << k << " factors" << endl; + // FIXME check on cst coeff + if (1){ + polynome prodP(P[test[0]]); + for (int i=1;i<k;++i){ + mulpoly(prodP,P[test[i]],rem,0); + reduce_poly(rem,b,Total+1,prodP); + } + if (divrem1(pcur_adjusted,prodP,quo,rem,1) && rem.coord.empty()){ + // factor found + pcur_adjusted=quo; + f.push_back(facteur<polynome>(prodP/lgcd(prodP),mult)); + for (int i=k-1;i>=0;--i){ + P.erase(P.begin()+test[i]); + } + nfact -= k; + for (int i=0;i<k;++i) + test[i]=i; + continue; + } + } + if (!next(test,k,nfact)){ + ++k; + test=vector<int>(k); + for (int i=0;i<k;++i) + test[i]=i; + } + } + f.push_back(facteur<polynome>(pcur_adjusted/lgcd(pcur_adjusted),mult)); + return true; + } + // Hensel linear or quadratic lift // FIXME Quadratic lift currently works only if lcp is constant // Lift the equality p(b)=qb*rb [where b is a vecteur like for peval Modified: trunk/giac-xcas/giac/src/ezgcd.h =================================================================== --- trunk/giac-xcas/giac/src/ezgcd.h 2010-06-11 08:45:45 UTC (rev 777) +++ trunk/giac-xcas/giac/src/ezgcd.h 2010-06-22 08:35:38 UTC (rev 778) @@ -40,6 +40,20 @@ bool find_good_eval(const polynome & F,const polynome & G,polynome & Fb,polynome & Gb,vecteur & b,bool debuglog=false,const gen & mod=zero); polynome peval_1(const polynome & p,const vecteur &v,const gen & mod); + // reduce_divrem does a mixed division: euclidean w.r.t. the first var + // and ascending power of X-v for the other vars + // FIXME: this implementation does not work currently, except if other + // depends only on the first var + bool reduce_divrem(const polynome & a,const polynome & other,const vecteur & v,int n,polynome & quo,polynome & rem) ; + + // find the "remainder of p mod (X-v)^degree" + // dim(p) = size(v)+1 (reduction for all variables of p except the main var) + polynome reduce_poly(const polynome & p,const vecteur & v,int degree); + + bool try_sparse_factor(const polynome & pcur,const factorization & v0,int mult,factorization & f); + + bool try_hensel_lift_factor(const polynome & pcur,const polynome & F0,const factorization & v0,int mult,factorization & f); + // max_gcddeg is used when ezgcd was not successfull to find // the gcd even with 2 evaluations leading to the same gcd degree // in this case ezgcd calls itself with a bound on the gcd degree Modified: trunk/giac-xcas/giac/src/gausspol.cc =================================================================== --- trunk/giac-xcas/giac/src/gausspol.cc 2010-06-11 08:45:45 UTC (rev 777) +++ trunk/giac-xcas/giac/src/gausspol.cc 2010-06-22 08:35:38 UTC (rev 778) @@ -2803,7 +2803,6 @@ d=gcdmod(pmod,qmod,m); if (debug_infolevel) cerr << "gcdmod end " << clock() << endl; - modularize(d,m); if (compute_cofactors){ polynome pmodd,qmodd,tmp; divremmod(pmod,d,m,pmodd,tmp); @@ -2814,6 +2813,7 @@ q_simp=qmodd; modularize(q_simp,m); } + modularize(d,m); return true; } if (pt==_USER){ @@ -4112,8 +4112,8 @@ // Yun algorithm in finite field of characteristic n // Must be called recursively since it will not detect powers multiple of n - factorization partialsquarefree_fp(const polynome & p,unsigned n,polynome & c){ - factorization v; + void partialsquarefree_fp(const polynome & p,unsigned n,polynome & c,factorization & v){ + v.clear(); polynome y(p.derivative()),w(p); c=simplify(w,y); // If p=p_1*p_2^2*...*p_n^n, @@ -4138,7 +4138,6 @@ } if (!Tis_one(w)) v.push_back(facteur< polynome >(w,k)); - return v; // at the end c contains Pi_{i} p_i^{i-(i%n)} } @@ -4159,13 +4158,35 @@ if (Tis_one(p)) return res; polynome c(p.dim); - res=partialsquarefree_fp(p,n,c); + partialsquarefree_fp(p,n,c,res); if (Tis_one(c)) return res; - int lp=c.gcddeg(0); - if (lp%n) - setsizeerr("Mod factor bug!"); - polynome b(c.dividedegrees(n)); + if (Tis_constant(c)){ + // res.push_back(facteur<polynome>(c,1)); + return res; + } + // Check that all first degrees are divisible by n + // and search for a variable such that one degree is not divisible by n + vector< monomial<gen> >::const_iterator It=c.coord.begin(),Itend=c.coord.end(); + for (;It!=Itend;++It){ + const index_t & i=It->index.riptr->i; + for (int j=0;j<c.dim;++j){ + if (i[j]%n){ + if (j==0) + setsizeerr("Square free factor mod bug"+c.print()); + // call complete factorization after reordering + c.reorder(transposition(0,j,c.dim)); + factorization cf(squarefree_fp(c,n,exposant)); + factorization::iterator jt=cf.begin(),jtend=cf.end(); + for (;jt!=jtend;++jt){ + jt->fact.reorder(transposition(0,j,c.dim)); + res.push_back(*jt); + } + return res; + } + } + } + polynome b(c.dividealldegrees(n)); if (exposant!=1){ // replace all coeffs of b by coeff^(p^(n-1)) // since in F_{p^n} we have a=(a^(p^(n-1)))^p which is not a^p @@ -4211,8 +4232,71 @@ factorization::const_iterator it=sqff_f.begin(),itend=sqff_f.end(); for (;it!=itend;++it){ const facteur<polynome> & fp=*it; + const polynome & itfact = it->fact; + if (itfact.lexsorted_degree()<=1){ + f.push_back(*it); + continue; + } + if (itfact.dim>1){ + vecteur b(itfact.dim-1); + polynome Fb,Gb; + if (find_good_eval(itfact,itfact,Fb,Gb,b,(debug_infolevel>=2))){ + if (is_zero(b)){ + factorization sqff_F0(squarefree_fp(Fb,n,1)),v0; + sqff_ffield_factor(sqff_F0,n,env,v0); + if (try_hensel_lift_factor(itfact,Fb,v0,it->mult,f)) + continue; + } + int essaimax=10; + for (int essai=0;essai<essaimax;++essai){ + // try to translate + int b0d=itfact.dim; + vecteur vb0(b0d),vb1(b0d),lv(b0d); + lv[0]=gen("x0",context0); + // int hasard=rand()/(RAND_MAX/env->modulo.val); + int hasard=0; + vb0[0]=sym2r(lv[0]+hasard,lv,context0); + vb1[0]=sym2r(lv[0]-hasard,lv,context0); + for (int i=1;i<b0d;i++){ + int hasard1=0; // rand()/(RAND_MAX/env->modulo.val); + int hasard2=rand()/(RAND_MAX/env->modulo.val); + lv[i]=gen("x"+print_INT_(i),context0); + vb0[i]=sym2r(lv[i]+hasard1*lv[0]+hasard2,lv,context0); + vb1[i]=sym2r(lv[i]-hasard1*lv[0]-hasard2,lv,context0); + } + gen pb=peval(unmodularize(itfact),vb0,env->modulo,false),num,den; + fxnd(pb,num,den); + if (num.type!=_POLY) + setsizeerr(); + polynome ptrans=*num._POLYptr; + modularize(ptrans,env->modulo); + factorization ftrans,v0; + b=vecteur(ptrans.dim-1); + find_good_eval(ptrans,ptrans,Fb,Gb,b,(debug_infolevel>=2)); + if (is_zero(b)){ + factor(Fb,Gb,v0,false,false,false); + if (try_hensel_lift_factor(ptrans,Fb,v0,it->mult,ftrans)){ + factorization::const_iterator it=ftrans.begin(),itend=ftrans.end(); + for (;it!=itend;++it){ + pb=peval(unmodularize(it->fact),vb1,env->modulo,false); + fxnd(pb,num,den); + if (num.type!=_POLY) + setsizeerr(); + polynome tmp(*num._POLYptr); + modularize(tmp,env->modulo); + f.push_back(facteur<polynome>(tmp,it->mult)); + } + essaimax=0; + } + } + } // end for essai<essaimax + if (essaimax==0) + continue; + } + setsizeerr("Multivariate finite field factorzation expects a unitary polynomial regular at 0. Try to translate with respect to one variable"); + } // convert to vector - modpoly Qtry(modularize(env->moduloon?unmodularize(it->fact):it->fact,n,env)); + modpoly Qtry(modularize(env->moduloon?unmodularize(itfact):it->fact,n,env)); // and call sqff mod factor vector< facteur<modpoly> > wf; vector<modpoly> qmat; @@ -4230,6 +4314,14 @@ f.push_back(facteur<polynome>(*gtmp._POLYptr,it->mult)); } } + // cleanup, set first coeff to 1 + factorization::iterator jt=f.begin(),jtend=f.end(); + for (;jt!=jtend;++jt){ + gen coeff=jt->fact.coord.front().value; + if (coeff.type==_MOD) + coeff = inv(coeff,context0); + jt->fact = coeff * jt->fact; + } } factorization squarefree_fp(const polynome & p,unsigned n,unsigned exposant){ @@ -4244,8 +4336,6 @@ env.moduloon = true; env.modulo=n; env.pn=n; - if (p_orig.dim!=1) - return false; // FIXME implement multivariate fact // Check that all coeff are mod polynome p(p_orig); vector< monomial<gen> >::iterator pit=p.coord.begin(),pitend=p.coord.end(); @@ -4263,7 +4353,7 @@ #ifdef HAVE_LIBPTHREAD int locked=pthread_mutex_trylock(&ntl_mutex); #endif // HAVE_LIBPTHREAD - if (!locked){ + if (p.dim==1 && !locked){ bool res=true; try { vecteur v; @@ -4325,6 +4415,14 @@ // sqff factorization sqff_f(squarefree_fp(p,n,1)); sqff_ffield_factor(sqff_f,n,&env,f); + // cleanup cst coeff + gen coeff(1); + factorization::iterator it=f.begin(),itend=f.end(); + for (;it!=itend;++it){ + coeff=coeff*pow(it->fact.coord.front().value,it->mult,context0); + } + coeff=p.coord.front().value/coeff; + p_content=coeff*p_content; return true; } @@ -4409,27 +4507,50 @@ sqff_evident(p_primit,f,with_sqrt,complexmode); return true; } - // first square-free factorization - factorization fsqff=sqff(p_primit); + // extract powers of indeterminates + index_t mindeg=p_primit.coord.back().index.riptr->i; + vector< monomial<gen> >::const_iterator pt=p_primit.coord.begin(),ptend=p_primit.coord.end(); + for (;pt!=ptend;++pt){ + mindeg=index_min(mindeg,pt->index.riptr->i); + if (is_zero(mindeg)) + break; + } + // square-free factorization + factorization fsqff; + if (!is_zero(mindeg)){ + p_primit=p_primit.shift(-mindeg); + fsqff=sqff(p_primit); + for (int i=0;i<p.dim;++i){ + if (mindeg[i]) + f.push_back(facteur<polynome>(monomial<gen>(1,i+1,p.dim),mindeg[i])); + } + } + else + fsqff=sqff(p_primit); // factorization of each factor of fsqff factorization::const_iterator it=fsqff.begin(),itend=fsqff.end(); for (;it!=itend;++it){ polynome pcur=it->fact; int mult=it->mult; if (has_num_coeff(pcur)){ - f.push_back(facteur<polynome>(pcur,1)); + f.push_back(facteur<polynome>(pcur,mult)); continue; } // try first 2 good evaluations in case pcur is irreducible - vecteur b(pcur.dim-1); - factorization v; - polynome Fb(1),Gb(1); + vecteur b(pcur.dim-1),b0; + factorization v,v0; + polynome Fb(1),Gb(1),F0; int essai; for (essai=0;essai<2;++essai){ if (essai) b=vranm(pcur.dim-1,0,0); // find another random point find_good_eval(pcur,pcur,Fb,Gb,b,(debug_infolevel>=2)); factor(Fb,Gb,v,false,false,false); + if (!essai){ + F0=Fb; + v0=v; + b0=b; + } if ( (v.size()==1) && (v.front().mult==1) ) break; } @@ -4437,6 +4558,59 @@ f.push_back(facteur<polynome>(pcur,mult)); continue; } + if (try_sparse_factor(pcur,v,mult,f)) + continue; + /* Try Hensel lift factorization */ + gen lm; + if (!listmax(p,lm)) + lm=100; + if (p.dim>2 && !is_zero(b0) && is_greater(lm,10,context0)){ + int b0d=b0.size(); + // search a smaller b + for (int essai=0;essai<3;++essai){ + for (int i=0;i<b0d;++i){ + b[i]=1+iquo(rand(),RAND_MAX/3); + } + if (find_good_eval(pcur,pcur,Fb,Gb,b,(debug_infolevel>=2))){ + b0=b; + break; + } + } + // translate + vecteur vb0(b0d+1),vb1(b0d+1),lv(b0d+1); + lv[0]=gen("x0",context0); + vb0[0]=sym2r(lv[0],lv,context0); + vb1[0]=vb0[0]; + for (int i=1;i<=b0d;i++){ + lv[i]=gen("x"+print_INT_(i),context0); + vb0[i]=sym2r(lv[i]+b0[i-1],lv,context0); + vb1[i]=sym2r(lv[i]-b0[i-1],lv,context0); + } + gen pb=peval(pcur,vb0,0,false),num,den; + fxnd(pb,num,den); + if (num.type!=_POLY) + setsizeerr(); + polynome ptrans=*num._POLYptr; + factorization ftrans; + b=vecteur(b.size()); + find_good_eval(ptrans,ptrans,Fb,Gb,b,(debug_infolevel>=2)); + if (is_zero(b)){ + factor(Fb,Gb,v0,false,false,false); + if (try_hensel_lift_factor(ptrans,Fb,v0,mult,ftrans)){ + factorization::const_iterator it=ftrans.begin(),itend=ftrans.end(); + for (;it!=itend;++it){ + pb=peval(it->fact,vb1,0,false); + fxnd(pb,num,den); + if (num.type!=_POLY) + setsizeerr(); + f.push_back(facteur<polynome>(*num._POLYptr,it->mult)); + } + continue; + } + } + } + if (is_zero(b0) && try_hensel_lift_factor(pcur,F0,v0,mult,f)) + continue; /* Now try heuristic factorization then call unitaryfactor on each found factor */ vectpoly fz; @@ -4472,6 +4646,14 @@ } } } + // adjust lcoeff + if (!p_content.coord.empty()){ + gen lc(1); + for (it=f.begin(),itend=f.end();it!=itend;++it){ + lc=lc*pow(it->fact.coord.front().value,it->mult,context0); + } + p_content = p.coord.front().value/(p_content.coord.front().value*lc)*p_content; + } return true; } Modified: trunk/giac-xcas/giac/src/gen.cc =================================================================== --- trunk/giac-xcas/giac/src/gen.cc 2010-06-11 08:45:45 UTC (rev 777) +++ trunk/giac-xcas/giac/src/gen.cc 2010-06-22 08:35:38 UTC (rev 778) @@ -918,7 +918,11 @@ } gen::gen(const gen & e) { - if (e.type>_DOUBLE_ && e.type!=_FUNC) { + if (e.type>_DOUBLE_ +#ifndef SMARTPTR64 + && e.type!=_FUNC +#endif + ) { if ( #ifdef SMARTPTR64 (*((longlong *) &e) >> 16) @@ -1447,8 +1451,7 @@ gen::gen(const unary_function_ptr & f,int nargs){ #ifdef SMARTPTR64 - * ((longlong * ) this) = longlong(f) << 16; - // * ((longlong * ) this) = longlong(new ref_unary_function_ptr(f)) << 16; + * ((longlong * ) this) = longlong(new ref_unary_function_ptr(f)) << 16; #else _FUNC_ = unsigned(* (unsigned *) &f); // __FUNCptr= new ref_unary_function_ptr(f); @@ -1458,7 +1461,11 @@ } gen::~gen() { - if ( type>_DOUBLE_ && type!=_FUNC ){ + if ( type>_DOUBLE_ +#ifndef SMARTPTR64 + && type!=_FUNC +#endif + ){ if (!--ref_count()){ switch (type) { #ifdef SMARTPTR64 @@ -1501,11 +1508,11 @@ case _STRNG: delete (ref_string *) (* ((longlong * ) this) >> 16); break; - /* +#ifdef SMARTPTR64 case _FUNC: delete (ref_unary_function_ptr *) (* ((longlong * ) this) >> 16); break; - */ +#endif case _MAP: delete (ref_gen_map *) (* ((longlong * ) this) >> 16); break; @@ -1560,11 +1567,11 @@ case _STRNG: delete __STRNGptr; break; - /* +#ifdef SMARTPTR64 case _FUNC: delete __FUNCptr; break; - */ +#endif case _MAP: delete __MAPptr; break; @@ -2186,11 +2193,11 @@ } gen & gen::operator = (const gen & a) { - if (a.type>_DOUBLE_ && a.type!=_FUNC + if (a.type>_DOUBLE_ #ifdef SMARTPTR64 && (*((longlong *) &a) >> 16) #else - && a.__ZINTptr + && a.type!=_FUNC && a.__ZINTptr #endif ) ++a.ref_count(); // increase ref count @@ -2219,7 +2226,11 @@ #endif type=a.type; // Now we delete the target - if ( type_save>_DOUBLE_ && type_save!=_FUNC ){ + if ( type_save>_DOUBLE_ +#ifndef SMARTPTR64 + && type_save!=_FUNC +#endif + ){ control_c(); if (!--(ptr_save->ref_count)){ switch (type_save) { @@ -2262,11 +2273,11 @@ case _STRNG: delete (ref_string *) ptr_save; break; - /* +#ifdef SMARTPTR64 case _FUNC: delete (ref_unary_function_ptr *) ptr_save; break; - */ +#endif case _MAP: delete (ref_gen_map *) ptr_save; break; Modified: trunk/giac-xcas/giac/src/gen.h =================================================================== --- trunk/giac-xcas/giac/src/gen.h 2010-06-11 08:45:45 UTC (rev 777) +++ trunk/giac-xcas/giac/src/gen.h 2010-06-22 08:35:38 UTC (rev 778) @@ -1018,8 +1018,7 @@ inline polynome * gen::ref_POLYptr() const { return &((ref_polynome*)(* (longlong *) this >> 16))->t; } inline identificateur * gen::ref_IDNTptr() const {return &((ref_identificateur*)(* (longlong *) this >> 16))->i; } inline symbolic * gen::ref_SYMBptr() const { return &((ref_symbolic*)(* (longlong *) this >> 16))->s; } - inline unary_function_ptr * gen::ref_FUNCptr() const { return &((unary_function_ptr*)(* (longlong *) this >> 16)); } - // inline unary_function_ptr * gen::ref_FUNCptr() const { return &((ref_unary_function_ptr*)(* (longlong *) this >> 16))->u; } + inline unary_function_ptr * gen::ref_FUNCptr() const { return &((ref_unary_function_ptr*)(* (longlong *) this >> 16))->u; } #else // SMARTPTR64 inline mpz_t * gen::ref_ZINTptr() const { return &__ZINTptr->z; } inline real_object * gen::ref_REALptr() const { return &__REALptr->r; } Modified: trunk/giac-xcas/giac/src/global.cc =================================================================== --- trunk/giac-xcas/giac/src/global.cc 2010-06-11 08:45:45 UTC (rev 777) +++ trunk/giac-xcas/giac/src/global.cc 2010-06-22 08:35:38 UTC (rev 778) @@ -1044,6 +1044,7 @@ int threads=sysconf (_SC_NPROCESSORS_ONLN); #endif string cas_suffixe(".cas"); + bool CAN_USE_LAPACK = true; int LIST_SIZE_LIMIT = 100000000 ; int FACTORIAL_SIZE_LIMIT = 10000000 ; int NEWTON_DEFAULT_ITERATION=20; @@ -2650,7 +2651,8 @@ struct tms tmp1,tmp2; times(&tmp1); // int beg=clock(); - gen g = giac::protecteval((*v)[0],(*v)[1].val,contextptr); + gen g = (*v)[0]; + g = giac::protecteval(g,(*v)[1].val,contextptr); times(&tmp2); // int end=clock(); // (*v)[4]=end-beg; Modified: trunk/giac-xcas/giac/src/global.h =================================================================== --- trunk/giac-xcas/giac/src/global.h 2010-06-11 08:45:45 UTC (rev 777) +++ trunk/giac-xcas/giac/src/global.h 2010-06-22 08:35:38 UTC (rev 778) @@ -126,6 +126,7 @@ extern int debug_infolevel; extern int threads; + extern bool CAN_USE_LAPACK; extern int FACTORIAL_SIZE_LIMIT; extern int LIST_SIZE_LIMIT; extern int NEWTON_DEFAULT_ITERATION; Modified: trunk/giac-xcas/giac/src/help.cc =================================================================== --- trunk/giac-xcas/giac/src/help.cc 2010-06-11 08:45:45 UTC (rev 777) +++ trunk/giac-xcas/giac/src/help.cc 2010-06-22 08:35:38 UTC (rev 778) @@ -41,6 +41,7 @@ #endif // ndef NO_NAMESPACE_GIAC const int HELP_LANGUAGES=4; + struct static_help_t { const char * cmd_name; const char * cmd_howto[HELP_LANGUAGES]; @@ -49,7 +50,7 @@ const char * cmd_examples; }; - static_help_t static_help[]={ + const static_help_t static_help[]={ #include "static_help.h" }; @@ -64,15 +65,17 @@ if (lang<=0) lang=2; if (lang>HELP_LANGUAGES) - return false; + lang=2; string s=unlocalize(cmd_name); int l=s.size(); if ( (l>2) && (s[0]=='\'') && (s[l-1]=='\'') ) s=s.substr(1,l-2); static_help_t h={s.c_str(),0,0,0,0}; - std::pair<static_help_t *,static_help_t *> p=equal_range(static_help,static_help+static_help_size,h,static_help_sort); + std::pair<const static_help_t *,const static_help_t *> p=equal_range(static_help,static_help+static_help_size,h,static_help_sort); if (p.first!=p.second && p.first!=static_help+static_help_size){ howto=p.first->cmd_howto[lang-1]; + if (!howto) + howto=p.first->cmd_howto[1]; syntax=p.first->cmd_syntax; related=p.first->cmd_related; examples=p.first->cmd_examples; @@ -96,7 +99,7 @@ return res; } - bool output_static_help(vector<aide> & v){ + bool output_static_help(vector<aide> & v,const vector<int> & langv){ ofstream of("static_help.h"); vector<aide>::iterator it=v.begin(),itend=v.end(); for (;it!=itend;){ @@ -107,12 +110,10 @@ int bs=blabla.size(); of << "{"; for (int i=0;i<HELP_LANGUAGES;i++){ - of << '"'; - if (i<bs) - of << output_quote(blabla[i].chaine) ; + if (i<bs && equalposcomp(langv,i+1)) + of << '"' << output_quote(blabla[i].chaine) << '"' ; else of << 0 ; - of << '"' ; if (i==HELP_LANGUAGES-1) of << '}'; else @@ -286,7 +287,7 @@ std::cerr << "Help file " << f_name << " not found" << endl; return ; } - v.reserve(1600); + // v.reserve(1600); ifstream f(f_name); char fs[HELP_MAXLENSIZE+1]; vector<localized_string> current_blabla; @@ -388,8 +389,14 @@ count++; } sort(v.begin(),v.end(),alpha_order); - if (debug_infolevel==-2) - output_static_help(v); + if (debug_infolevel==-2){ + vector<int> langv; + langv.push_back(1); + langv.push_back(2); + // langv.push_back(3); + // langv.push_back(4); + output_static_help(v,langv); + } } aide add_synonyme_name_to_examples(const aide & a){ Modified: trunk/giac-xcas/giac/src/index.cc =================================================================== --- trunk/giac-xcas/giac/src/index.cc 2010-06-11 08:45:45 UTC (rev 777) +++ trunk/giac-xcas/giac/src/index.cc 2010-06-22 08:35:38 UTC (rev 778) @@ -469,7 +469,7 @@ } - int total_degree(const index_m & v1){ + int sum_degree(const index_m & v1){ int i=0; for (index_t::const_iterator it=v1.riptr->i.begin();it!=v1.riptr->i.end();++it) i=i+(*it); @@ -539,8 +539,8 @@ */ bool i_total_lex_is_greater(const index_m & v1, const index_m & v2){ - int d1=total_degree(v1); - int d2=total_degree(v2); + int d1=sum_degree(v1); + int d2=sum_degree(v2); if (d1!=d2){ if (d1>d2) return(true); @@ -551,8 +551,8 @@ } bool i_total_revlex_is_greater(const index_m & v1, const index_m & v2){ - int d1=total_degree(v1); - int d2=total_degree(v2); + int d1=sum_degree(v1); + int d2=sum_degree(v2); if (d1!=d2){ if (d1>d2) return(true); Modified: trunk/giac-xcas/giac/src/index.h =================================================================== --- trunk/giac-xcas/giac/src/index.h 2010-06-11 08:45:45 UTC (rev 777) +++ trunk/giac-xcas/giac/src/index.h 2010-06-22 08:35:38 UTC (rev 778) @@ -303,7 +303,8 @@ bool operator != (const index_m & i1, const index_m & i2); bool operator >= (const index_m & a, const index_m & b); bool operator <= (const index_m & a, const index_m & b); - int total_degree(const index_m & v1); + int sum_degree(const index_m & v1); + inline int total_degree(const index_m & v1){ return sum_degree(v1); } bool i_lex_is_greater(const index_m & v1, const index_m & v2); bool i_lex_is_strictly_greater(const index_m & v1, const index_m & v2); bool i_total_revlex_is_greater(const index_m & v1, const index_m & v2); Modified: trunk/giac-xcas/giac/src/input_lexer.cc =================================================================== --- trunk/giac-xcas/giac/src/input_lexer.cc 2010-06-11 08:45:45 UTC (rev 777) +++ trunk/giac-xcas/giac/src/input_lexer.cc 2010-06-22 08:35:38 UTC (rev 778) @@ -350,8 +350,8 @@ *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 875 -#define YY_END_OF_BUFFER 876 +#define YY_NUM_RULES 873 +#define YY_END_OF_BUFFER 874 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -359,403 +359,403 @@ flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[3595] = +static yyconst flex_int16_t yy_accept[3593] = { 0, 0, 0, 23, 23, 0, 0, 0, 0, 0, 0, - 876, 874, 1, 2, 430, 3, 872, 394, 459, 437, - 31, 343, 344, 446, 431, 341, 442, 448, 454, 858, - 858, 34, 32, 339, 392, 340, 29, 404, 871, 871, - 871, 518, 871, 871, 871, 871, 39, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 345, 346, 467, 30, 16, 871, 871, 871, 871, - 519, 871, 871, 871, 37, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 871, 361, 416, 362, 38, 871, 871, 871, 871, + 874, 872, 1, 2, 430, 3, 870, 394, 459, 437, + 31, 343, 344, 446, 431, 341, 442, 448, 454, 856, + 856, 34, 32, 339, 392, 340, 29, 404, 869, 869, + 869, 518, 869, 869, 869, 869, 39, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, + 869, 345, 346, 467, 30, 16, 869, 869, 869, 869, + 519, 869, 869, 869, 37, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 361, 416, 362, 38, 869, 869, 869, 869, - 23, 25, 24, 875, 873, 875, 15, 6, 5, 875, + 23, 25, 24, 873, 871, 873, 15, 6, 5, 873, 18, 17, 19, 1, 379, 0, 0, 0, 0, 0, 0, 0, 0, 395, 460, 353, 354, 347, 348, 41, 40, 0, 363, 364, 410, 449, 450, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 469, 447, 432, 433, 342, 434, 375, 435, 374, - 451, 436, 443, 427, 456, 869, 470, 22, 0, 455, - 868, 858, 0, 0, 0, 0, 0, 36, 35, 398, + 451, 436, 443, 427, 456, 867, 470, 22, 0, 455, + 866, 856, 0, 0, 0, 0, 0, 36, 35, 398, 0, 0, 0, 369, 386, 381, 402, 376, 401, 390, - 370, 403, 405, 871, 871, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 517, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 871, 553, 871, 671, 871, 871, 871, 871, 871, - 871, 871, 871, 422, 593, 594, 46, 871, 871, 45, - 871, 871, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 633, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 871, 0, 0, 0, 0, 0, 0, 0, 798, - 0, 818, 827, 0, 0, 0, 742, 750, 0, 761, - 0, 0, 777, 787, 0, 792, 0, 797, 0, 0, + 370, 403, 405, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 517, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 553, 869, 669, 869, 869, 869, 869, 869, + 869, 869, 869, 422, 46, 869, 869, 45, 869, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 631, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, + 0, 0, 0, 0, 0, 0, 0, 796, 0, 816, + 825, 0, 0, 0, 740, 748, 0, 759, 0, 0, + 775, 785, 0, 790, 0, 795, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 835, 843, 0, 0, 0, - 871, 871, 871, 871, 871, 871, 492, 871, 871, 871, - 871, 871, 871, 501, 871, 871, 871, 871, 871, 871, - 871, 871, 516, 871, 871, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 549, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 552, 560, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 871, 871, 583, 584, 586, 419, 871, 871, 871, - 43, 871, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 871, 871, + 0, 0, 0, 833, 841, 0, 0, 0, 869, 869, + 869, 869, 869, 869, 492, 869, 869, 869, 869, 869, + 869, 501, 869, 869, 869, 869, 869, 869, 869, 869, + 516, 869, 869, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 549, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 552, 560, 869, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, + 869, 583, 584, 586, 419, 869, 869, 869, 43, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, - 871, 871, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 632, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 871, 417, 33, 438, - 439, 54, 871, 871, 871, 44, 871, 871, 871, 871, - 23, 24, 24, 26, 0, 873, 15, 4, 14, 7, - 8, 12, 13, 9, 11, 10, 18, 0, 0, 860, - 861, 859, 863, 862, 864, 461, 355, 356, 349, 350, - 365, 366, 42, 0, 396, 462, 0, 452, 440, 444, - 0, 457, 0, 387, 0, 0, 393, 0, 389, 0, - 408, 0, 471, 0, 0, 0, 0, 0, 0, 0, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 630, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 869, 417, 33, 438, 439, 54, + 869, 869, 869, 44, 869, 869, 869, 869, 23, 24, + 24, 26, 0, 871, 15, 4, 14, 7, 8, 12, + 13, 9, 11, 10, 18, 0, 0, 858, 859, 857, + 861, 860, 862, 461, 355, 356, 349, 350, 365, 366, + 42, 0, 396, 462, 0, 452, 440, 444, 0, 457, + 0, 387, 0, 0, 393, 0, 389, 0, 408, 0, + 471, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 21, 868, - 0, 0, 870, 0, 866, 865, 867, 0, 0, 0, - 0, 412, 871, 871, 871, 871, 871, 703, 871, 871, - 871, 871, 871, 871, 475, 871, 871, 871, 871, 871, - 871, 871, 524, 871, 871, 871, 871, 871, 547, 683, - 871, 871, 871, 871, 871, 871, 871, 697, 871, 871, - 466, 871, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 602, 871, 871, 871, 871, 871, 702, 616, 871, - 871, 623, 871, 871, 871, 871, 871, 871, 871, 690, - 871, 871, 871, 871, 426, 0, 0, 758, 793, 0, + 0, 0, 0, 0, 0, 0, 21, 866, 0, 0, + 868, 0, 864, 863, 865, 0, 0, 0, 0, 412, + 869, 869, 869, 869, 869, 701, 869, 869, 869, 869, + 869, 869, 475, 869, 869, 869, 869, 869, 869, 869, + 524, 869, 869, 869, 869, 869, 547, 681, 869, 869, + 869, 869, 869, 869, 869, 695, 869, 869, 466, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 600, + 869, 869, 869, 869, 869, 700, 614, 869, 869, 621, + 869, 869, 869, 869, 869, 869, 869, 688, 869, 869, + 869, 869, 426, 0, 0, 756, 791, 0, 0, 729, - 0, 731, 0, 0, 0, 0, 737, 0, 0, 834, - 0, 853, 0, 0, 0, 0, 0, 0, 0, 747, - 0, 0, 0, 754, 0, 706, 0, 848, 0, 759, - 762, 0, 0, 0, 765, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 769, 0, 774, 707, 0, 781, - 0, 0, 0, 730, 786, 0, 788, 558, 789, 739, - 0, 0, 0, 0, 0, 800, 0, 0, 0, 0, - 805, 0, 809, 0, 0, 0, 0, 0, 421, 814, - 819, 0, 0, 821, 0, 0, 0, 823, 0, 0, - 826, 0, 828, 0, 0, 0, 832, 0, 0, 0, + 0, 0, 0, 0, 735, 0, 0, 832, 0, 851, + 0, 0, 0, 0, 0, 0, 0, 745, 0, 0, + 0, 752, 0, 704, 0, 846, 0, 757, 760, 0, + 0, 0, 763, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 767, 0, 772, 705, 0, 779, 0, 0, + 0, 728, 784, 0, 786, 558, 787, 737, 0, 0, + 0, 0, 0, 798, 0, 0, 0, 0, 803, 0, + 807, 0, 0, 0, 0, 0, 421, 812, 817, 0, + 0, 819, 0, 0, 0, 821, 0, 0, 824, 0, + 826, 0, 0, 0, 830, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 842, 0, 0, 844, 845, - 749, 871, 484, 871, 411, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 523, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 871, 871, 546, 871, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 49, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 570, 871, 871, 871, 871, 463, 578, 871, 871, + 0, 0, 0, 840, 0, 0, 842, 843, 747, 869, + 484, 869, 411, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 869, 523, 869, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, + 869, 546, 869, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 49, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 570, + 869, 869, 869, 869, 463, 578, 869, 869, 869, 869, - 871, 871, 577, 871, 871, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 468, 871, - 871, 871, 871, 871, 601, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 871, 613, 871, 871, - 871, 871, 871, 871, 303, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 639, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 871, 871, 423, 871, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 871, 7, 8, 0, + 577, 869, 869, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 468, 869, 869, 869, + 869, 869, 599, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 869, 611, 869, 869, 869, 869, + 869, 869, 303, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 637, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, + 869, 423, 869, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 869, 7, 8, 0, 0, 0, - 0, 0, 0, 0, 357, 358, 351, 352, 367, 368, - 380, 413, 428, 399, 384, 382, 377, 391, 406, 0, - 0, 557, 0, 0, 0, 0, 0, 585, 420, 0, - 0, 0, 418, 0, 869, 0, 0, 0, 868, 0, - 0, 20, 0, 0, 0, 871, 871, 871, 503, 512, - 871, 871, 871, 871, 871, 474, 871, 871, 871, 871, - 871, 693, 871, 521, 871, 673, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 871, 679, - 871, 664, 699, 551, 555, 871, 566, 871, 871, 680, - 576, 581, 316, 478, 871, 871, 871, 871, 871, 660, + 0, 0, 357, 358, 351, 352, 367, 368, 380, 413, + 428, 399, 384, 382, 377, 391, 406, 0, 0, 557, + 0, 0, 0, 0, 0, 585, 420, 0, 0, 0, + 418, 0, 867, 0, 0, 0, 866, 0, 0, 20, + 0, 0, 0, 869, 869, 869, 503, 512, 869, 869, + 869, 869, 869, 474, 869, 869, 869, 869, 869, 691, + 869, 521, 869, 671, 869, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 869, 677, 869, 662, + 697, 551, 555, 869, 566, 869, 869, 678, 576, 581, + 316, 478, 869, 869, 869, 869, 869, 658, 869, 869, - 871, 871, 476, 871, 871, 871, 871, 622, 473, 871, - 630, 638, 653, 672, 871, 871, 649, 871, 871, 0, - 755, 0, 771, 776, 0, 708, 740, 0, 0, 0, - 738, 720, 0, 0, 415, 0, 0, 746, 751, 752, - 852, 0, 714, 756, 0, 760, 0, 763, 0, 0, - 764, 716, 0, 770, 0, 0, 0, 0, 0, 0, - 0, 784, 0, 0, 0, 0, 794, 0, 796, 713, - 799, 801, 0, 803, 0, 850, 0, 0, 804, 728, - 0, 806, 0, 0, 465, 0, 726, 812, 0, 0, - 0, 0, 0, 813, 580, 0, 0, 816, 820, 0, + 476, 869, 869, 869, 869, 620, 473, 869, 628, 636, + 651, 670, 869, 869, 647, 869, 869, 0, 753, 0, + 769, 774, 0, 706, 738, 0, 0, 0, 736, 718, + 0, 0, 415, 0, 0, 744, 749, 750, 850, 0, + 712, 754, 0, 758, 0, 761, 0, 0, 762, 714, + 0, 768, 0, 0, 0, 0, 0, 0, 0, 782, + 0, 0, 0, 0, 792, 0, 794, 711, 797, 799, + 0, 801, 0, 848, 0, 0, 802, 726, 0, 804, + 0, 0, 465, 0, 724, 810, 0, 0, 0, 0, + 0, 811, 580, 0, 0, 814, 818, 0, 0, 0, - 0, 0, 822, 0, 729, 0, 0, 0, 830, 829, - 831, 0, 0, 0, 0, 0, 849, 846, 837, 0, - 847, 839, 0, 0, 0, 424, 871, 871, 871, 871, - 871, 871, 871, 871, 487, 871, 209, 871, 871, 309, - 871, 871, 496, 871, 871, 871, 502, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 871, 522, 520, 0, 871, 871, 871, 871, 871, - 871, 871, 539, 871, 871, 871, 871, 871, 871, 543, - 871, 871, 871, 871, 871, 219, 871, 548, 871, 665, - 871, 871, 871, 871, 871, 871, 871, 871, 871, 871, + 820, 0, 727, 0, 0, 0, 828, 827, 829, 0, + 0, 0, 0, 0, 847, 844, 835, 0, 845, 837, + 0, 0, 0, 424, 869, 869, 869, 869, 869, 869, + 869, 869, 487, 869, 209, 869, 869, 309, 869, 869, + 496, 869, 869, 869, 502, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, + 522, 520, 0, 869, 869, 869, 869, 869, 869, 869, + 539, 869, 869, 869, 869, 869, 869, 543, 869, 869, + 869, 869, 869, 219, 869, 548, 869, 663, 869, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, - 871, 871, 871, 871, 285, 286, 287, 871, 871, 871, - 698, 871, 871, 871, 871, 871, 554, 871, 871, 871, - 565, 871, 871, 871, 871, 871, 871, 871, 871, 304, - 871, 871, 871, 871, 871, 871, 871, 871, 575, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 318, 871, 871, 329, 871, 871, 871, 871, 871, - 596, 871, 871, 871, 871, 871, 603, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 612, 871, - 614, 871, 871, 871, 871, 871, 322, 323, 871, 871, - 871, 871, 871, 871, 871, 871, 621, 871, 624, 871, + 869, 869, 285, 286, 287, 869, 869, 869, 696, 869, + 869, 869, 869, 869, 554, 869, 869, 869, 565, 869, + 869, 869, 869, 869, 869, 869, 869, 304, 869, 869, + 869, 869, 869, 869, 869, 869, 575, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 318, + 869, 869, 329, 869, 869, 869, 869, 869, 594, 869, + 869, 869, 869, 869, 601, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 610, 869, 612, 869, + 869, 869, 869, 869, 322, 323, 869, 869, 869, 869, + 869, 869, 869, 869, 619, 869, 622, 869, 869, 626, - 871, 628, 319, 629, 871, 871, 871, 871, 871, 871, - 871, 871, 871, 306, 636, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 233, 871, 637, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 7, 0, 0, 359, - 360, 414, 0, 0, 0, 0, 464, 579, 0, 0, - 425, 0, 868, 0, 663, 659, 666, 498, 500, 871, - 689, 513, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 538, 871, - 871, 871, 871, 871, 674, 871, 871, 871, 871, 871, + 319, 627, 869, 869, 869, 869, 869, 869, 869, 869, + 869, 306, 634, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 233, 869, 635, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 7, 0, 0, 359, 360, 414, + 0, 0, 0, 0, 464, 579, 0, 0, 425, 0, + 866, 0, 661, 657, 664, 498, 500, 869, 687, 513, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 538, 869, 869, 869, + 869, 869, 672, 869, 869, 869, 869, 869, 869, 673, - 871, 675, 871, 871, 871, 871, 544, 561, 569, 670, - 599, 694, 655, 871, 871, 871, 871, 477, 871, 871, - 871, 619, 871, 657, 647, 652, 686, 0, 0, 857, - 0, 0, 0, 0, 743, 0, 0, 745, 0, 0, - 753, 0, 0, 0, 0, 0, 768, 0, 0, 773, - 0, 775, 779, 0, 782, 783, 0, 0, 0, 790, - 0, 795, 0, 0, 0, 388, 0, 810, 807, 0, - 0, 811, 741, 0, 732, 719, 718, 453, 817, 815, - 723, 441, 0, 824, 0, 727, 0, 0, 0, 833, - 0, 836, 854, 0, 0, 0, 0, 841, 0, 0, + 869, 869, 869, 869, 544, 561, 569, 668, 597, 692, + 653, 869, 869, 869, 869, 477, 869, 869, 869, 617, + 869, 655, 645, 650, 684, 0, 0, 855, 0, 0, + 0, 0, 741, 0, 0, 743, 0, 0, 751, 0, + 0, 0, 0, 0, 766, 0, 0, 771, 0, 773, + 777, 0, 780, 781, 0, 0, 0, 788, 0, 793, + 0, 0, 0, 388, 0, 808, 805, 0, 0, 809, + 739, 0, 730, 717, 716, 453, 815, 813, 721, 441, + 0, 822, 0, 725, 0, 0, 0, 831, 0, 834, + 852, 0, 0, 0, 0, 839, 0, 0, 869, 869, - 871, 871, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 871, 497, 871, 499, 871, 871, 871, 871, 504, - 506, 871, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 0, 0, 0, 871, 871, - 871, 871, 871, 871, 871, 871, 535, 537, 536, 871, - 871, 307, 871, 871, 542, 871, 871, 871, 65, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 183, 871, 871, 871, 871, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, + 497, 869, 499, 869, 869, 869, 869, 504, 506, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 869, 0, 0, 0, 869, 869, 869, 869, + 869, 869, 869, 869, 535, 537, 536, 869, 869, 307, + 869, 869, 542, 869, 869, 869, 65, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, + 869, 869, 869, 183, 869, 869, 869, 869, 869, 869, - 871, 871, 871, 871, 871, 871, 871, 871, 696, 871, - 871, 871, 326, 871, 871, 567, 871, 871, 871, 572, - 871, 871, 871, 871, 871, 871, 212, 871, 871, 871, - 871, 871, 871, 871, 590, 871, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 597, 871, 871, 871, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 338, 871, - 871, 611, 871, 871, 871, 871, 871, 871, 871, 871, - ... [truncated message content] |
From: <pa...@us...> - 2010-06-11 08:45:55
|
Revision: 777 http://xcas.svn.sourceforge.net/xcas/?rev=777&view=rev Author: parisse Date: 2010-06-11 08:45:45 +0000 (Fri, 11 Jun 2010) Log Message: ----------- Modified Paths: -------------- trunk/giac-xcas/giac/src/Editeur.cc trunk/giac-xcas/giac/src/Equation.cc trunk/giac-xcas/giac/src/Graph.cc trunk/giac-xcas/giac/src/Graph.h trunk/giac-xcas/giac/src/Graph3d.cc trunk/giac-xcas/giac/src/History.cc trunk/giac-xcas/giac/src/Input.cc trunk/giac-xcas/giac/src/Makefile.am trunk/giac-xcas/giac/src/Print.cc trunk/giac-xcas/giac/src/Tableur.cc trunk/giac-xcas/giac/src/Xcas1.cc trunk/giac-xcas/giac/src/alg_ext.cc trunk/giac-xcas/giac/src/alg_ext.h trunk/giac-xcas/giac/src/csturm.cc trunk/giac-xcas/giac/src/derive.cc trunk/giac-xcas/giac/src/derive.h trunk/giac-xcas/giac/src/desolve.cc trunk/giac-xcas/giac/src/desolve.h trunk/giac-xcas/giac/src/ezgcd.cc trunk/giac-xcas/giac/src/ezgcd.h trunk/giac-xcas/giac/src/first.cc trunk/giac-xcas/giac/src/first.h trunk/giac-xcas/giac/src/gauss.cc trunk/giac-xcas/giac/src/gauss.h trunk/giac-xcas/giac/src/gausspol.cc trunk/giac-xcas/giac/src/gen.cc trunk/giac-xcas/giac/src/gen.h trunk/giac-xcas/giac/src/global.cc trunk/giac-xcas/giac/src/global.h trunk/giac-xcas/giac/src/help.cc trunk/giac-xcas/giac/src/help.h trunk/giac-xcas/giac/src/hist.cxx trunk/giac-xcas/giac/src/hist.fl trunk/giac-xcas/giac/src/hist.h trunk/giac-xcas/giac/src/icas.cc trunk/giac-xcas/giac/src/identificateur.cc trunk/giac-xcas/giac/src/identificateur.h trunk/giac-xcas/giac/src/ifactor.cc trunk/giac-xcas/giac/src/ifactor.h trunk/giac-xcas/giac/src/input_lexer.cc trunk/giac-xcas/giac/src/input_lexer.h trunk/giac-xcas/giac/src/input_lexer.ll trunk/giac-xcas/giac/src/input_parser.cc trunk/giac-xcas/giac/src/input_parser.h trunk/giac-xcas/giac/src/input_parser.yy trunk/giac-xcas/giac/src/intg.cc trunk/giac-xcas/giac/src/intg.h trunk/giac-xcas/giac/src/intgab.cc trunk/giac-xcas/giac/src/isom.cc trunk/giac-xcas/giac/src/isom.h trunk/giac-xcas/giac/src/lin.cc trunk/giac-xcas/giac/src/lin.h trunk/giac-xcas/giac/src/maple.cc trunk/giac-xcas/giac/src/maple.h trunk/giac-xcas/giac/src/mathml.cc trunk/giac-xcas/giac/src/mathml.h trunk/giac-xcas/giac/src/misc.cc trunk/giac-xcas/giac/src/misc.h trunk/giac-xcas/giac/src/modpoly.cc trunk/giac-xcas/giac/src/modpoly.h trunk/giac-xcas/giac/src/moyal.cc trunk/giac-xcas/giac/src/moyal.h trunk/giac-xcas/giac/src/pari.cc trunk/giac-xcas/giac/src/permu.cc trunk/giac-xcas/giac/src/permu.h trunk/giac-xcas/giac/src/plot.cc trunk/giac-xcas/giac/src/plot.h trunk/giac-xcas/giac/src/plot3d.cc trunk/giac-xcas/giac/src/plot3d.h trunk/giac-xcas/giac/src/prog.cc trunk/giac-xcas/giac/src/prog.h trunk/giac-xcas/giac/src/quater.cc trunk/giac-xcas/giac/src/quater.h trunk/giac-xcas/giac/src/risch.cc trunk/giac-xcas/giac/src/risch.h trunk/giac-xcas/giac/src/rpn.cc trunk/giac-xcas/giac/src/rpn.h trunk/giac-xcas/giac/src/series.cc trunk/giac-xcas/giac/src/series.h trunk/giac-xcas/giac/src/solve.cc trunk/giac-xcas/giac/src/solve.h trunk/giac-xcas/giac/src/subst.cc trunk/giac-xcas/giac/src/subst.h trunk/giac-xcas/giac/src/sym2poly.cc trunk/giac-xcas/giac/src/sym2poly.h trunk/giac-xcas/giac/src/symbolic.cc trunk/giac-xcas/giac/src/symbolic.h trunk/giac-xcas/giac/src/tex.cc trunk/giac-xcas/giac/src/tex.h trunk/giac-xcas/giac/src/threaded.cc trunk/giac-xcas/giac/src/threaded.h trunk/giac-xcas/giac/src/ti89.cc trunk/giac-xcas/giac/src/ti89.h trunk/giac-xcas/giac/src/unary.cc trunk/giac-xcas/giac/src/unary.h trunk/giac-xcas/giac/src/usual.cc trunk/giac-xcas/giac/src/usual.h trunk/giac-xcas/giac/src/vecteur.cc trunk/giac-xcas/giac/src/vecteur.h Modified: trunk/giac-xcas/giac/src/Editeur.cc =================================================================== --- trunk/giac-xcas/giac/src/Editeur.cc 2010-03-24 15:40:53 UTC (rev 776) +++ trunk/giac-xcas/giac/src/Editeur.cc 2010-06-11 08:45:45 UTC (rev 777) @@ -1289,12 +1289,25 @@ string s=ch; free(ch); gen g; - try { g=gen(s,contextptr); } catch (std::runtime_error & e){ cerr << e.what() << endl; } - if (!is_context_busy(l->hp->contextptr)){ - thread_eval(g,eval_level(l->hp->contextptr),l->hp->contextptr); + try { + g=gen(s,contextptr); + } + catch (std::runtime_error & e){ cerr << e.what() << endl; } + if (giac::first_error_line(contextptr)){ + int pos1=e->editor->buffer()->skip_lines(0,giac::first_error_line(contextptr)-1); + int pos2=e->editor->buffer()->skip_lines(pos1,1); + e->editor->buffer()->select(pos1,pos2); + e->editor->show_insert_position(); + e->editor->redraw(); + fl_alert((gettext("Parse error line ")+print_INT_(giac::first_error_line(contextptr))+ gettext(" at ") +giac::error_token_name(contextptr)).c_str()); } - l->t->redraw(); - e->editor->insert_position(s.size()); + else { + if (!is_context_busy(l->hp->contextptr)){ + thread_eval(g,eval_level(l->hp->contextptr),l->hp->contextptr); + } + l->t->redraw(); + e->editor->insert_position(s.size()); + } return; } // Not a logo, try to run it inside focus @@ -1717,7 +1730,7 @@ {gettext("Indent line (Esc)"), 0, (Fl_Callback *) cb_Editeur_Indent_line, 0, 0, 0, 0, 14, 56}, {gettext("Indent all"), 0, (Fl_Callback *) cb_Editeur_Indent_all, 0, 0, 0, 0, 14, 56}, {gettext("Parse"), 0, (Fl_Callback *) cb_Editeur_Test, 0, 0, 0, 0, 14, 56}, - {gettext("Exec all"), 0, (Fl_Callback *) cb_Editeur_Exec_All, 0, 0, 0, 0, 14, 56}, + {gettext("Exec all"), 0xffc4, (Fl_Callback *) cb_Editeur_Exec_All, 0, 0, 0, 0, 14, 56}, {0}, // end Edit {gettext("Add"), 0, 0, 0, 64, 0, 0, 14, 56}, {gettext("Func"), 0, 0, 0, 64, 0, 0, 14, 56}, @@ -2104,7 +2117,7 @@ int Xcas_Text_Editor::handle(int event){ if (Fl::focus()!=this && event==FL_MOUSEWHEEL) return 0; - if (event==FL_FOCUS) + if (event==FL_FOCUS || event==FL_PUSH) Xcas_input_focus=this; if (Editeur * ed =dynamic_cast<Editeur *>(parent())){ if (ed->linenumber){ Modified: trunk/giac-xcas/giac/src/Equation.cc =================================================================== --- trunk/giac-xcas/giac/src/Equation.cc 2010-03-24 15:40:53 UTC (rev 776) +++ trunk/giac-xcas/giac/src/Equation.cc 2010-06-11 08:45:45 UTC (rev 777) @@ -548,7 +548,7 @@ iterateur it=v.begin(),itend=v.end(); for (;it!=itend;++it){ if ( (it->type==_SYMB) && (it->_SYMBptr->sommet==at_makevector) ) - *it=_makevector(it->_SYMBptr->feuille); + *it=_makevector(it->_SYMBptr->feuille,contextptr); } return Equation_compute_size(v,a,windowhsize,contextptr); } @@ -590,11 +590,11 @@ int llp=int(fl_width("(")); int lrp=int(fl_width(")")); int lc=int(fl_width(",")); - string us=u.ptr->s; + string us=u.ptr()->s; fl_font(cst_greek_translate(us),a.fontsize); int ls=int(fl_width(us.c_str())); fl_font(FL_HELVETICA,a.fontsize); - if (isalpha(u.ptr->s[0])) + if (isalpha(u.ptr()->s[0])) ls += 2; // special cases first int, sigma, /, ^ // and if printed as printsommetasoperator @@ -837,8 +837,8 @@ v.push_back(eqwdata(x,h,0,y,a,u,0)); return gen(v,_SEQ__VECT); } - bool binaryop= (u.ptr->printsommet==&printsommetasoperator) || equalposcomp(binary_op_tab,u); - if ( u!=at_sto && u.ptr->printsommet!=NULL && !binaryop ){ + bool binaryop= (u.ptr()->printsommet==&printsommetasoperator) || equalposcomp(binary_op_tab(),u); + if ( u!=at_sto && u.ptr()->printsommet!=NULL && !binaryop ){ gen tmp=string2gen(g.print(contextptr),false); return Equation_compute_size(symbolic(at_expr,gen(makevecteur(tmp,xcas_mode(contextptr)),_SEQ__VECT)),a,windowhsize,contextptr); } @@ -855,10 +855,11 @@ else gtmp=*it; // unary op, shift arg position horizontally - x=ls+llp; eqwdata vv=Equation_total_size(gtmp); + bool paren = u!=at_neg || (vv.g!=at_prod && need_parenthesis(vv.g)) ; + x=ls+(paren?llp:0); gen tmp=gtmp; Equation_translate(tmp,x,0); - x=x+vv.dx+lrp; + x=x+vv.dx+(paren?lrp:0); Equation_vertical_adjust(vv.dy,vv.y,h,y); return gen(makevecteur(tmp,eqwdata(x,h,0,y,a,u,0)),_EQW__VECT); } @@ -1454,7 +1455,7 @@ fontsize=varg2.eqw_attributs.fontsize; fl_font(FL_HELVETICA,fontsize); if (varg2.x+varg2.dx<rightx) - check_fl_draw(",",eqx+varg2.x+varg2.dx-x,eqy+y-varg2.baseline,equat->clip_x,equat->clip_y,equat->clip_w,equat->clip_h,0,0); + check_fl_draw(",",eqx+varg2.x+varg2.dx-x+1,eqy+y-varg2.baseline,equat->clip_x,equat->clip_y,equat->clip_w,equat->clip_h,0,0); } return; } @@ -1479,6 +1480,17 @@ check_fl_line(eqx+x0-x-1,eqy+y-y0+1,eqx+x0-x-fontsize/4,eqy+y-y0+1,equat->clip_x,equat->clip_y,equat->clip_w,equat->clip_h,0,0); check_fl_line(eqx+x0-x-1,eqy+y-y1+1,eqx+x0-x-fontsize/4,eqy+y-y1+1,equat->clip_x,equat->clip_y,equat->clip_w,equat->clip_h,0,0); } + } // end if oper.subtype!=SEQ__VECT + if (oper.subtype!=_MATRIX__VECT){ + // print commas between args + it=v.begin(),itend=v.end()-2; + for (;it!=itend;++it){ + eqwdata varg2=Equation_total_size(*it); + fontsize=varg2.eqw_attributs.fontsize; + fl_font(FL_HELVETICA,fontsize); + if (varg2.x+varg2.dx<rightx) + check_fl_draw(",",eqx+varg2.x+varg2.dx-x+1,eqy+y-varg2.baseline,equat->clip_x,equat->clip_y,equat->clip_w,equat->clip_h,0,0); + } } return; } @@ -1577,8 +1589,8 @@ } bool parenthesis=true; string opstring(","); - if (u.ptr->printsommet==&printsommetasoperator || equalposcomp(binary_op_tab,u) ) - opstring=u.ptr->s.c_str(); + if (u.ptr()->printsommet==&printsommetasoperator || equalposcomp(binary_op_tab(),u) ) + opstring=u.ptr()->s; else { if (u==at_sto) opstring=":="; @@ -1599,7 +1611,7 @@ check_fl_draw(")",eqx+tmp.x-x+tmp.dx,eqy+y-tmp.baseline,equat->clip_x,equat->clip_y,equat->clip_w,equat->clip_h,0,0); } if (w.x<rightx) - check_fl_draw(u.ptr->s.c_str(),eqx+w.x-x,eqy+y-w.baseline,equat->clip_x,equat->clip_y,equat->clip_w,equat->clip_h,0,0); + check_fl_draw(u.ptr()->s,eqx+w.x-x,eqy+y-w.baseline,equat->clip_x,equat->clip_y,equat->clip_w,equat->clip_h,0,0); return; } // write first open parenthesis @@ -1630,7 +1642,7 @@ } ++it; if (it==itend){ - if (u.ptr->printsommet==&printsommetasoperator || u==at_sto || equalposcomp(binary_op_tab,u)) + if (u.ptr()->printsommet==&printsommetasoperator || u==at_sto || equalposcomp(binary_op_tab(),u)) return; else break; @@ -1671,7 +1683,7 @@ } } // end for (;;) if (w.x<rightx){ - s = u.ptr->s; + s = u.ptr()->s; fl_font(cst_greek_translate(s),fontsize); s += '('; check_fl_draw(s.c_str(),eqx+w.x-x,eqy+y-w.baseline,equat->clip_x,equat->clip_y,equat->clip_w,equat->clip_h,0,0); @@ -3376,7 +3388,9 @@ active_pos=pos; int toend=s.size()-pos; s=s.substr(0,active_pos)+paste_s+s.substr(active_pos,toend); - gen g=string2gen(s,false); + gen g(s,contextptr); + if (giac::first_error_line(contextptr)) + g=string2gen(s,false); if (!needmulti){ if (replace_selection(g,1)) active_pos = pos+paste_s.size(); @@ -3413,7 +3427,9 @@ if (it->type==_EQW && it->_EQWptr->g.type==_STRNG) s += '\n'+*it->_EQWptr->g._STRNGptr; } - g=string2gen(s,false); + g=gen(s,contextptr); + if (giac::first_error_line(contextptr)) + g=string2gen(s,false); desactivate_and_select(); // count newline in paste_s, add to n, activate this line, cursor // at end of this line - the value of toend @@ -3441,7 +3457,9 @@ return false; } // remove selection and replace - gen g=string2gen(paste_s,false); + gen g(paste_s,contextptr); + if (giac::first_error_line(contextptr)) + g=string2gen(paste_s,false); if (needmulti) g=symbolic(at_expr,g); replace_selection(g); @@ -3498,9 +3516,9 @@ eqwdata & e=*it->_EQWptr; if (e.x>x || e.x+e.dx<x || e.y>y || e.y+e.dy<y) return -1; - if ((eq && !eq->output_equation) && e.g.type==_FUNC && !e.g._FUNCptr->ptr->printsommet && e.g!=at_makesuite && e.g!=at_makelist && e.g!=at_makevector ){ + if ((eq && !eq->output_equation) && e.g.type==_FUNC && !e.g._FUNCptr->ptr()->printsommet && e.g!=at_makesuite && e.g!=at_makelist && e.g!=at_makevector ){ eqwdata f(e); - f.g=string2gen(e.g._FUNCptr->ptr->s,false); + f.g=string2gen(e.g._FUNCptr->ptr()->s,false); int pos=Equation_binary_search_pos(f,x,y); string ans,debut=f.g._STRNGptr->substr(0,pos); if (handle_tab(debut,*giac::vector_completions_ptr,eq->h()/2,eq->w()/2,pos,ans)){ @@ -3990,6 +4008,13 @@ redraw(); return 1; } + else { + gen g=get_selection(); + replace_selection(string2gen(g.print(),false)); + deselect_and_activate(); + need_active_parse=true; + return 1; + } } sel_changed=handle_key(ch,act); } // end if (modifiable) @@ -4128,6 +4153,24 @@ cb_Equation_Function(m,at_simplify); } + + static void cb_Equation_Editselection(Fl_Menu_* m , void*) { + if (m){ + Equation * eq = dynamic_cast<Equation *>(m->parent()); + if (eq){ + Fl::focus(eq); + Xcas_input_focus=eq; + eq->save_data(); + xcas::History_Pack * hp=get_history_pack(eq); + giac::context * cptr=hp?hp->contextptr:0; + gen g=eq->get_selection(); + eq->replace_selection(string2gen(g.print(),false)); + eq->deselect_and_activate(); + eq->need_active_parse=true; + } + } + } + static void cb_Equation_Normal(Fl_Menu_* m , void*) { cb_Equation_Function(m,at_normal); } @@ -4159,10 +4202,11 @@ Fl_Menu_Item Equation_menu[] = { {gettext("M"), 0, 0, 0, 64, 0, 0, 14, 56}, {gettext("Select all"), 0, (Fl_Callback*)cb_Equation_Select, 0, 0, 0, 0, 14, 56}, - {gettext("Normal"), 0, (Fl_Callback*)cb_Equation_Normal, 0, 0, 0, 0, 14, 56}, - {gettext("Simplify"), 0, (Fl_Callback*)cb_Equation_Simplify, 0, 0, 0, 0, 14, 56}, - {gettext("Factor"), 0, (Fl_Callback*)cb_Equation_Factor, 0, 0, 0, 0, 14, 56}, - {gettext("Evalf"), 0, (Fl_Callback*)cb_Equation_Evalf, 0, 0, 0, 0, 14, 56}, + {gettext("Edit selection"), 0, (Fl_Callback*)cb_Equation_Editselection, 0, 0, 0, 0, 14, 56}, + {gettext("normal"), 0, (Fl_Callback*)cb_Equation_Normal, 0, 0, 0, 0, 14, 56}, + {gettext("simplify"), 0, (Fl_Callback*)cb_Equation_Simplify, 0, 0, 0, 0, 14, 56}, + {gettext("factor"), 0, (Fl_Callback*)cb_Equation_Factor, 0, 0, 0, 0, 14, 56}, + {gettext("evalf"), 0, (Fl_Callback*)cb_Equation_Evalf, 0, 0, 0, 0, 14, 56}, {gettext("Back"), 0, (Fl_Callback*)cb_Equation_Back, 0, 0, 0, 0, 14, 56}, {gettext("Forward"), 0, (Fl_Callback*)cb_Equation_Forward, 0, 0, 0, 0, 14, 56}, {0}, Modified: trunk/giac-xcas/giac/src/Graph.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph.cc 2010-03-24 15:40:53 UTC (rev 776) +++ trunk/giac-xcas/giac/src/Graph.cc 2010-06-11 08:45:45 UTC (rev 777) @@ -2729,7 +2729,7 @@ pt3->show_pnt(true); pt3->show_line(false); x+=pt3->w(); - pt4=new Line_Type(x,2*dy/lignes,dx/10,dy/lignes,_POINT_WIDTH_3); + pt4=new Line_Type(x,2*dy/lignes,dx/10,dy/lignes,_POINT_INVISIBLE | _POINT_WIDTH_3); pt4->show_pnt(true); pt4->show_line(false); x+=pt4->w(); @@ -2786,9 +2786,6 @@ ltres->show_pnt(true); ltres->show_poly(true); button_color = new Fl_Button(dx/5+2,2+4*dy/lignes,dx/5-4,dy/lignes-4); - button_approx=new Fl_Check_Button(3*dx/5+2,2+4*dy/lignes,dx/5-4,dy/lignes-4); - button_approx->label("~"); - button_approx->tooltip(gettext("Check if mouse clicks in approx mode")); button_formel=new Fl_Check_Button(2*dx/5+2,2+4*dy/lignes,dx/5-4,dy/lignes-4); button_formel->label("symb"); button_formel->tooltip(gettext("Make point symbolic")); @@ -2839,11 +2836,6 @@ static string titlestr; titlestr=gettext("Object attributs ")+title; w->label(titlestr.c_str()); - if (show_approx) - button_approx->show(); - else - button_approx->hide(); - button_approx->value(approx); int r=-1; int lt=(res & 0x01c00000); int pt=(res & 0x0e000000); @@ -2906,7 +2898,6 @@ w->hide(); if (!r){ res=newcol; - approx=button_approx->value(); if (formel){ formel=button_formel->value(); untranslate=button_untranslate->value(); @@ -3228,7 +3219,7 @@ if (event==FL_RELEASE){ string args=autoname(contextptr)+":="; if (function_final.type==_FUNC) - args += function_final._FUNCptr->ptr->s; + args += function_final._FUNCptr->ptr()->s; args +="("; if (function_final==at_plotode) args += fcnfield + "," + fcnvars + "," +tmp.print(contextptr) + ",plan)"; @@ -4203,6 +4194,8 @@ ensemble_attributs = mpz_get_si(*style.front()._ZINTptr); hidden_name=true; } + else + hidden_name=ensemble_attributs<0; int width =(ensemble_attributs & 0x00070000) >> 16; // 3 bits int epaisseur_point =(ensemble_attributs & 0x00380000) >> 19; // 3 bits int type_line =(ensemble_attributs & 0x01c00000) >> 22; // 3 bits @@ -4959,7 +4952,7 @@ if ( (!newfile) || (!*newfile)) return; s=newfile; // remove_path(newfile); - s=remove_extension(s.substr(0,1000).c_str())+".cas"; + s=remove_path(remove_extension(s.substr(0,1000).c_str()))+".cas"; if (access(s.c_str(),R_OK)) break; int i=fl_ask((s+gettext(": file exists. Overwrite?")).c_str()); @@ -5739,6 +5732,12 @@ fig->redraw(); } + static void cb_Figure_Approx(Fl_Button * b , void*) { + Figure * fig=find_figure(b); + if (!fig) return; + fig->geo->approx=b->value(); + } + static void cb_Figure_Autoeval(Fl_Button * b , void*) { static string s; Figure * f=find_figure(b); @@ -6144,8 +6143,8 @@ {gettext("inter (list of points)"), 0, (Fl_Callback *) cb_Inter, 0, 0, 0, 0, 14, 56}, {0}, // end intersections {gettext("tangent"), 0, (Fl_Callback *) cb_Tangent, 0, 0, 0, 0, 14, 56}, - {gettext("Exact"), 0, (Fl_Callback *) cb_Exact, 0, 0, 0, 0, 14, 56}, - {gettext("Approx"), 0, (Fl_Callback *) cb_Approx, 0, 0, 0, 0, 14, 56}, + // {gettext("Exact"), 0, (Fl_Callback *) cb_Exact, 0, 0, 0, 0, 14, 56}, + // {gettext("Approx"), 0, (Fl_Callback *) cb_Approx, 0, 0, 0, 0, 14, 56}, {0}, // end Menu }; @@ -6246,11 +6245,16 @@ checkb->tooltip(gettext("Check for step evaluation")); checkb->callback((Fl_Callback *) cb_Figure_Autoeval); x += checkb->w(); - Fl_Check_Button * checkdisp = new Fl_Check_Button(x,Y,3*l,l,"Landscape"); + checkdisp = new Fl_Check_Button(x,Y,6*l,l,"Landscape"); checkdisp->value(false); checkdisp->tooltip(gettext("Check for landscape")); checkdisp->callback((Fl_Callback *) cb_Figure_Disposition); - x += checkb->w(); + x += checkdisp->w(); + Fl_Check_Button * checkex = new Fl_Check_Button(x,Y,l,l,"~"); + checkex->value(true); + checkex->tooltip(gettext("Check if mouse clicks in approx mode")); + checkex->callback((Fl_Callback *) cb_Figure_Approx); + x += checkex->w(); name = new Fl_Button(x,Y,W+X-x,l,"<Save figure as text>"); name->callback((Fl_Callback *) cb_Figure_Save); name->tooltip(gettext("Save current figure commands independently of the session")); @@ -6276,12 +6280,14 @@ } barre->resize(X,Y,W,l); if (disposition==1){ + checkdisp->value(true); double dgeomp=dgeo+dmp; geo->resize(X,Y+l,max(W-5*l,int(W*dgeo/dgeomp+.5)),int(H*dgeomp+.5)); geo->mouse_param_group->resize(X+geo->w(),Y+l,W-geo->w(),geo->h()); s->resize(X,geo->y()+geo->h(),W,H-geo->h()-l); } else { + checkdisp->value(false); int sw=s->w(),gw=geo->w(),mw=geo->mouse_param_group->w(); int dw= W-(sw+gw+mw); sw += dw; @@ -6383,19 +6389,21 @@ fl_rectf(deltax, deltay, w(), h()); if (maillage){ fl_color(FL_BLACK); + double xdecal=std::floor(turtlex/10)*10; + double ydecal=std::floor(turtley/10)*10; if (maillage==1){ - for (int i=0;i<w();i+=10){ - for (int j=0;j<h();j+=10){ - fl_point(deltax+i,deltay+h()-j); + for (double i=xdecal;i<w()+xdecal;i+=10){ + for (double j=ydecal;j<h()+ydecal;j+=10){ + fl_point(deltax+int((i-turtlex)*turtlezoom+.5),deltay+h()-int((j-turtley)*turtlezoom+.5)); } } } else { - double dj=std::sqrt(3.0)*10,i0=0; - for (double j=0;j<h();j+=dj){ - int J=deltay+int(h()-j); - for (int i=int(i0);i<w();i+=10){ - fl_point(deltax+i,J); + double dj=std::sqrt(3.0)*10,i0=xdecal; + for (double j=ydecal;j<h()+ydecal;j+=dj){ + int J=deltay+int(h()-(j-turtley)*turtlezoom); + for (double i=i0;i<w()+xdecal;i+=10){ + fl_point(deltax+int((i-turtlex)*turtlezoom+.5),J); } i0 += dj; while (i0>=10) @@ -6510,35 +6518,72 @@ } int Turtle::handle(int event){ + // cerr << event << endl; if ( (event==FL_ENTER) || (event==FL_LEAVE) ){ redraw_cap_only=false; redraw(); return 1; } - int current_i=Fl::event_x()-x(),current_j=Fl::event_y()-y(); + if (event==FL_FOCUS){ + Fl::focus(this); + return 1; + } + if (event==FL_PUSH){ + push_x=Fl::event_x()-x(); + push_y=Fl::event_y()-y(); + Fl::focus(this); + return 1; + } + int current_x=Fl::event_x()-x(),current_y=Fl::event_y()-y(); int horizontal_pixels=w(); - if (event==FL_RELEASE){ - if ( current_i>horizontal_pixels && current_j<COORD_SIZE){ // zoom out - turtlezoom *= .707; + if (event== FL_MOUSEWHEEL ){ + if (Fl::e_dy<0) + turtlezoom *= 0.707 ; + else + turtlezoom *= 1.414 ; + redraw(); + return 1; + } + if (event==FL_RELEASE || event==FL_DRAG){ + if (current_y!=push_y){ + turtley += int((current_y-push_y)); redraw(); } - if (current_j<8){ // up - turtley += int(h()/(5*turtlezoom)); + if (current_x!=push_x){ + turtlex += int((push_x-current_x)); redraw(); } - if (current_j+8>h()){ // down - turtley -= int(h()/(5*turtlezoom)); + push_y=current_y; + push_x=current_x; + return 1; + } + if (event==FL_KEYBOARD){ + switch (Fl::event_key()){ + case FL_Left: + turtlex += 10; redraw(); - } - if (current_i<8){ // left - turtlex -= int(w()/(5*turtlezoom)); + return 1; + case FL_Up: + turtley -= 10; redraw(); - } - if (current_i+8>w()){ // right - turtlex += int(w()/(5*turtlezoom)); + return 1; + case FL_Right: + turtlex -= 10; redraw(); + return 1; + case FL_Down: + turtley += 10; + redraw(); + return 1; + case '+': + turtlezoom *= 1.414 ; + redraw(); + return 1; + case '-': + turtlezoom *= 0.707 ; + redraw(); + return 1; } - return 1; } return 0; } @@ -6565,8 +6610,15 @@ text="pas_de_cote "; if (b->label()==gettext("sa")) text="saute "; - if (b->label()==gettext("cr")) + if (b->label()==gettext("cr")){ + context * contextptr=get_context(b); text="crayon "; + int col = turtle(contextptr).color; + col=fl_show_colormap((Fl_Color) col); + string s=col<1000?print_INT_(col):""; + text += s; + b->color(col); + } if (b->label()==gettext("ro")) text="rond "; if (b->label()==gettext("di")) @@ -6581,6 +6633,7 @@ text="ecris "; if (b->label()==gettext("sg")) text="signe "; + Fl::focus(Xcas_input_focus); if (!text.empty()) help_output(text.substr(0,text.size()-1),language(get_context(Fl::focus()))); Fl::e_text= (char *) text.c_str(); @@ -6600,9 +6653,13 @@ if (dynamic_cast<Multiline_Input_tab *>(i)){ if (!s.empty() && s[s.size()-1]!=';') s += ";\n"; + else + s += '\n'; gen g(s,contextptr); - if (!giac::first_error_line(contextptr)) + if (!giac::first_error_line(contextptr)){ + l->ed->editor->insert_position(l->ed->editor->buffer()->length()); l->ed->editor->insert(s.c_str()); + } } else s = "// "+s+'\n'; @@ -6698,13 +6755,69 @@ fl_message(s.c_str()); } + static void cb_Logo_Zoomin(Fl_Menu_* m , void*) { + Turtle * gr = find_turtle(m); + if (gr){ + gr->turtlezoom*=1.414; + gr->redraw(); + } + } + + static void cb_Logo_Zoomout(Fl_Menu_* m , void*) { + Turtle * gr = find_turtle(m); + if (gr){ + gr->turtlezoom*=0.707; + gr->redraw(); + } + } + + static void cb_Logo_Right(Fl_Menu_* m , void*) { + Turtle * gr = find_turtle(m); + if (gr){ + gr->turtlex -= 10 ; + gr->redraw(); + } + } + + static void cb_Logo_Left(Fl_Menu_* m , void*) { + Turtle * gr = find_turtle(m); + if (gr){ + gr->turtlex += 10 ; + gr->redraw(); + } + } + + static void cb_Logo_Up(Fl_Menu_* m , void*) { + Turtle * gr = find_turtle(m); + if (gr){ + gr->turtley -= 10 ; + gr->redraw(); + } + } + + static void cb_Logo_Down(Fl_Menu_* m , void*) { + Turtle * gr = find_turtle(m); + if (gr){ + gr->turtley += 10 ; + gr->redraw(); + } + } + Fl_Menu_Item Logo_menu[] = { - {gettext("Menu"), 0, 0, 0, 64, 0, 0, 14, 56}, + {gettext("M"), 0, 0, 0, 64, 0, 0, 14, 56}, {gettext("Maillage"), 0, 0, 0, 64, 0, 0, 14, 56}, {gettext("None"), 0, (Fl_Callback*)cb_Logo_None, 0, 0, 0, 0, 14, 56}, {gettext("Square"), 0, (Fl_Callback*)cb_Logo_Square, 0, 0, 0, 0, 14, 56}, {gettext("Triangle"), 0, (Fl_Callback*)cb_Logo_Triangle, 0, 0, 0, 0, 14, 56}, {0}, + {gettext("View"), 0, 0, 0, 64, 0, 0, 14, 56}, + {gettext("Zoom in"), 0, (Fl_Callback*)cb_Logo_Zoomin, 0, 0, 0, 0, 14, 56}, + {gettext("Zoom out"), 0, (Fl_Callback*)cb_Logo_Zoomout, 0, 0, 0, 0, 14, 56}, + {gettext("Right"), 0, (Fl_Callback*)cb_Logo_Right, 0, 0, 0, 0, 14, 56}, + {gettext("Left"), 0, (Fl_Callback*)cb_Logo_Left, 0, 0, 0, 0, 14, 56}, + {gettext("Up"), 0, (Fl_Callback*)cb_Logo_Up, 0, 0, 0, 0, 14, 56}, + {gettext("Down"), 0, (Fl_Callback*)cb_Logo_Down, 0, 0, 0, 0, 14, 56}, + {0}, {gettext("Export/Print"), 0, 0, 0, 64, 0, 0, 14, 56}, {gettext("EPS/PNG and preview"), 0, (Fl_Callback*)cb_Logo_Preview, 0, 0, 0, 0, 14, 56}, {gettext("Print"), 0, (Fl_Callback*)cb_Logo_Print, 0, 0, 0, 0, 14, 56}, @@ -6737,6 +6850,7 @@ t = new Turtle(X+W/4,Y,W/2,H-L); t->labelsize(L); t->turtleptr=&giac::turtle_stack(context0); + t->turtlezoom=2; int bw=(W/2-5*L/2)/14; button_group = new Fl_Group(X+W/4,Y+H-L,bw*14,L); int bx=button_group->x(),by=button_group->y(); @@ -6816,8 +6930,11 @@ for (int i=0;i<ls;++i) *(menuitem+i)=*(Logo_menu+i); menubar->menu (menuitem); + menubar->tooltip(gettext("Turtle menu")); ed = new Editeur(X+W/4+W/2,Y,W/4,H); ed->extension="tor"; + ed->editor->buffer()->insert(0,"efface ;\n"); + ed->editor->insert_position(9); hp->add_entry(-1); hp->resize(); parent_redraw(this); @@ -6869,9 +6986,9 @@ return os; } - gen fltk_fl_widget_unarchive_function(istream & os,const vecteur & l){ + gen fltk_fl_widget_unarchive_function(istream & os){ // FIXME GIAC_CONTEXT - gen gplot=unarchive(os,l,context0),gparam=unarchive(os,l,context0); + gen gplot=unarchive(os,context0),gparam=unarchive(os,context0); if (gplot.type!=_VECT || gparam.type!=_VECT || gparam._VECTptr->size()<8) return 0; vecteur v=*gparam._VECTptr; Modified: trunk/giac-xcas/giac/src/Graph.h =================================================================== --- trunk/giac-xcas/giac/src/Graph.h 2010-03-24 15:40:53 UTC (rev 776) +++ trunk/giac-xcas/giac/src/Graph.h 2010-06-11 08:45:45 UTC (rev 777) @@ -22,6 +22,7 @@ #include <FL/Fl_Text_Editor.H> #include <FL/Fl_Value_Slider.H> #include <FL/Fl_Counter.H> +#include <FL/Fl_Check_Button.H> #endif #ifdef HAVE_LC_MESSAGES #include <locale.h> @@ -290,6 +291,7 @@ Line_Type * lt; Fl_Group * barre; xcas::HScroll * s; + Fl_Check_Button * checkdisp; int disposition; Figure(int X,int Y,int W,int H,int L,bool dim3=false); void save_figure_as(const std::string & s); @@ -327,6 +329,7 @@ double turtlezoom; // Zoom factor for turtle screen int maillage; // 0 (none), 1 (square), 2 (triangle) bool redraw_cap_only; + int push_x,push_y; Turtle(int x,int y,int w,int h,const char * l=0): Fl_Widget(x,y,w,h,l),turtleptr(0),legende_size(giac::LEGENDE_SIZE),turtlex(0),turtley(0),turtlezoom(1),maillage(1),redraw_cap_only(false) {}; std::string latex_save_figure(); const char * latex(const char * filename_) const ; @@ -350,7 +353,7 @@ std::ostream & fltk_fl_widget_archive_function(std::ostream & os,void * ptr); - giac::gen fltk_fl_widget_unarchive_function(std::istream & os,const giac::vecteur & l); + giac::gen fltk_fl_widget_unarchive_function(std::istream & os); std::string fltk_fl_widget_texprint_function(void * ptr); giac::gen fltk_fl_widget_updatepict_function(const giac::gen &g); Modified: trunk/giac-xcas/giac/src/Graph3d.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph3d.cc 2010-03-24 15:40:53 UTC (rev 776) +++ trunk/giac-xcas/giac/src/Graph3d.cc 2010-06-11 08:45:45 UTC (rev 777) @@ -786,7 +786,14 @@ vecteur style(get_style(v,legende)); int styles=style.size(); // color + bool hidden_name = false; int ensemble_attributs=style.front().val; + if (style.front().type==_ZINT){ + ensemble_attributs = mpz_get_si(*style.front()._ZINTptr); + hidden_name=true; + } + else + hidden_name=ensemble_attributs<0; int couleur=ensemble_attributs & 0x0000ff; int width =(ensemble_attributs & 0x00070000) >> 16; // 3 bits int epaisseur_point =((ensemble_attributs & 0x00380000) >> 19)+1; // 3 bits @@ -794,7 +801,6 @@ int type_point =(ensemble_attributs & 0x0e000000) >> 25; // 3 bits int labelpos =(ensemble_attributs & 0x30000000) >> 28; // 2 bits bool fill_polygon =(ensemble_attributs & 0x40000000) >> 30; - bool hidden_name =(ensemble_attributs & 0x80000000); hidden_name = hidden_name || legende.empty(); Fl_Image * texture=0; glLineWidth(width+1); @@ -2146,6 +2152,10 @@ if (!is_zero(title_tmp) && function_final.type==_FUNC) mytitle=gen(symbolic(*function_final._FUNCptr,title_tmp)).print(contextptr); draw_string(mytitle); + glRasterPos3d(-1,-1,depth-0.001); + if (!args_help.empty() && args_tmp.size()<= args_help.size()){ + draw_string(gettext("Click ")+args_help[max(1,args_tmp.size())-1]); + } glRasterPos3d(-0.98,0.87,depth-0.001); if (show_axes){ string tmps=gettext("mouse plan ")+giac::print_DOUBLE_(normal_a,3)+"x+"+giac::print_DOUBLE_(normal_b,3)+"y+"+giac::print_DOUBLE_(normal_c,3)+"z="+ giac::print_DOUBLE_(plan_t0,3); Modified: trunk/giac-xcas/giac/src/History.cc =================================================================== --- trunk/giac-xcas/giac/src/History.cc 2010-03-24 15:40:53 UTC (rev 776) +++ trunk/giac-xcas/giac/src/History.cc 2010-06-11 08:45:45 UTC (rev 777) @@ -1399,7 +1399,12 @@ string tmp="Save worksheet "; if (ch) tmp += ch; - char * newfile = fl_file_chooser(tmp.c_str(), "*.xws", "session.xws"); + string fname; + if (url) + fname=remove_extension(*url)+"_.xws"; + else + fname="session.xws"; + char * newfile = fl_file_chooser(tmp.c_str(), "*.xws", fname.c_str()); if (wid) Fl::focus(wid); // check filename @@ -1467,7 +1472,10 @@ if (History_Fold * hf=dynamic_cast<History_Fold *>(parent_skip_scroll(this))) hf->autosave_rm(); } - focus(pos,true); + if (Xcas_input_focus) + Fl::focus(Xcas_input_focus); + else + focus(pos,true); if (scroller){ #ifdef _HAVE_FL_UTF8_HDR_ scroller->scroll_to(0,yscrollerpos); @@ -2519,7 +2527,7 @@ if (o){ o->pack->set_sel_begin(xcas::Xcas_input_focus); int pos=o->pack->_sel_begin; - Fl_Widget * e=new_logo(max(o->pack->w()-o->pack->_printlevel_w,1),o->h()/2,o->pack); + Fl_Widget * e=new_logo(max(o->pack->w()-o->pack->_printlevel_w,1),2*o->h()/3,o->pack); change_group_fontsize(e,o->labelsize()); o->pack->add_entry(pos,e); } @@ -3271,7 +3279,7 @@ if (current_status){ string mode_s="Config "; if (pack->url) - mode_s += *pack->url; + mode_s += remove_path(*pack->url); mode_s += " :"; #ifdef IPAQ if (giac::approx_mode(ptr)) Modified: trunk/giac-xcas/giac/src/Input.cc =================================================================== --- trunk/giac-xcas/giac/src/Input.cc 2010-03-24 15:40:53 UTC (rev 776) +++ trunk/giac-xcas/giac/src/Input.cc 2010-06-11 08:45:45 UTC (rev 777) @@ -829,8 +829,9 @@ return 1; } } + if (event==FL_FOCUS || event==FL_PUSH || event==FL_KEYBOARD) + Xcas_input_focus=this; if (event==FL_FOCUS){ - Xcas_input_focus=this; // Fl::focus(this); // redraw(); return Fl_Multiline_Input::handle(event); @@ -1068,6 +1069,7 @@ redraw(); g->_sel_begin=-1; int pos=g->set_sel_begin(this); + g->_sel_begin=-1; --pos; if (pos>=0) g->focus(pos,true); @@ -1082,6 +1084,7 @@ redraw(); g->_sel_begin=-1; int pos=g->set_sel_begin(this)+1; + g->_sel_begin=-1; g->focus(pos,true); return 1; } Modified: trunk/giac-xcas/giac/src/Makefile.am =================================================================== --- trunk/giac-xcas/giac/src/Makefile.am 2010-03-24 15:40:53 UTC (rev 776) +++ trunk/giac-xcas/giac/src/Makefile.am 2010-06-11 08:45:45 UTC (rev 777) @@ -1,17 +1,17 @@ lib_LTLIBRARIES = libgiac.la -libgiac_la_SOURCES = sym2poly.cc gausspol.cc threaded.cc \ +libgiac_la_SOURCES = input_lexer.ll sym2poly.cc gausspol.cc threaded.cc \ moyal.cc maple.cc ti89.cc mathml.cc\ misc.cc permu.cc quater.cc desolve.cc input_parser.yy \ symbolic.cc index.cc modpoly.cc modfactor.cc \ ezgcd.cc derive.cc solve.cc intg.cc intgab.cc risch.cc lin.cc series.cc \ subst.cc vecteur.cc csturm.cc tex.cc global.cc \ ifactor.cc alg_ext.cc gauss.cc isom.cc plot.cc plot3d.cc rpn.cc prog.cc \ - pari.cc cocoa.cc unary.cc usual.cc identificateur.cc gen.cc input_lexer.ll first.cc \ + pari.cc cocoa.cc unary.cc usual.cc identificateur.cc gen.cc first.cc \ TmpLESystemSolver.C TmpFGLM.C \ TmpFGLM.H TmpLESystemSolver.H \ path.h lexer.h \ input_lexer.h input_parser.h threaded.h \ - help.cc help.h # Ugh.. + help.cc # Ugh.. libgiac_la_LIBADD = $(NTL_LIBS) $(COCOA_LIBS) $(PARI_LIBS) $(GSL_LIBS) @@ -22,7 +22,7 @@ solve.h quater.h subst.h usual.h intg.h intgab.h risch.h lin.h series.h \ vecteur.h csturm.h moyal.h tex.h global.h \ ifactor.h alg_ext.h gauss.h isom.h plot.h plot3d.h rpn.h prog.h \ -pari.h cocoa.h giac.h first.h maple.h +pari.h cocoa.h giac.h first.h maple.h help.h static.h static_lexer.h static_extern.h noinst_LTLIBRARIES = libxcas.la libxcas_la_LIBADD = libgiac.la $(GUI_LIBS) @@ -54,19 +54,19 @@ AM_YFLAGS = -p giac_yy -d EXTRA_DIST = .gdbinit xgiac pgiac prime.table gen_user \ input_parser.h softmath.h giacintl.h softmath.cc\ - mkxcas mkwcas mkgcas mkaout Makefile.wince\ + mkxcas mkwcas mkgcas mkaout Makefile.wince Makefile.osx\ Makefile.rpm Makefile.ipaq Makefilenew.ipaq ipaq_usr.tgz \ - Makefile.fast Makefilenew.win Makefile.O3 Makefile.64 \ + Makefile.fast Makefile.win Makefile.O3 Makefile.64 \ normalize.cc integrate.cc partfrac.cc factor.cc xcas.cc \ hist.fl hist.h hist.cxx \ - progfr.cc renee.cc renee.h cas2.cc README.ipaq README.WIN \ + renee.cc renee.h cas2.cc README.ipaq README.WIN \ readme.doc latex.bat xdvi.bat dvips.bat xcasfr.bat xcases.bat \ - xcasfr.sh xcases.sh xcasen.sh mkstat mkhist updatecas update.bat \ + xcasfr.sh xcases.sh xcasen.sh mkstat mkhist update.sh update.bat \ giac.pl cas2html.cc all_global_var find_global_var.cc static_init \ - Fl_GDI_Printer.cxx Fl_PS_Printer.cxx \ + Fl_GDI_Printer.cxx Fl_PS_Printer.cxx Fl_Gl_Choice.H \ casce.cc xcasce.cc xcasctrl.cc casctrl.cc Makefile.vcc config.h.vcc giac_oo.cpp giaclib.vcproj -bin_SCRIPTS = xgiac pgiac updatecas +bin_SCRIPTS = xgiac pgiac install-exec-hook: ln -sf aide $(DESTDIR)$(bindir)/cas_help Modified: trunk/giac-xcas/giac/src/Print.cc =================================================================== --- trunk/giac-xcas/giac/src/Print.cc 2010-03-24 15:40:53 UTC (rev 776) +++ trunk/giac-xcas/giac/src/Print.cc 2010-06-11 08:45:45 UTC (rev 777) @@ -484,6 +484,20 @@ delete p; } fclose(f); //we need close file here + if (getenv("GIAC_PREVIEW")) + ps_preview=getenv("GIAC_PREVIEW"); +#ifdef WIN32 + if (ps_preview=="!"){ + ps_preview="/cygdrive/c/"; + if (getenv("XCAS_ROOT")){ + string s(getenv("XCAS_ROOT")); + if (s.substr(0,10)=="/cygdrive/") + ps_preview[10]=s[10]; + } + ps_preview +="Program\\ Files/Ghostgum/gsview/gsview32.exe"; + } + pngpdf |= 0x4; +#endif // translate into png, (inside GIMP Image->Transform->rotate, not anymore) // inside latex use includegraphics[width=\textwidth{filename} // FIXME add pstopnm pnmtopng libnetpbm to the window mac distributions @@ -497,32 +511,33 @@ if (pngpdf & 0x4) system(("convert "+fname+" "+remove_extension(fname)+".jpg &").c_str()); #else +#ifdef WIN32 + if (pngpdf & 0x4) + system((xcasroot+"pstopnm -stdout -portrait '"+fname+"' | "+xcasroot+"pnmtojpeg > '"+remove_extension(fname)+".jpg'").c_str()); if (pngpdf & 0x1) + system((xcasroot+"pstopnm -stdout -portrait '"+fname+"' | "+xcasroot+"pnmtopng > '"+remove_extension(fname)+".png' &").c_str()); + if (pngpdf & 0x2){ + // epstopdf is a perl script, it won't work wo perl + system(("cp -f '"+fname+"' tmpeps.eps && epstopdf tmpeps.eps && cp -f tmpeps.pdf '"+remove_extension(fname)+".pdf' &").c_str()); + } +#else + if (pngpdf & 0x1) system(("pstopnm -stdout -portrait "+fname+" | pnmtopng > "+remove_extension(fname)+".png &").c_str()); if (pngpdf & 0x2) system(("epstopdf "+fname+" &").c_str()); if (pngpdf & 0x4) system(("pstopnm -stdout -portrait "+fname+" | pnmtojpeg > "+remove_extension(fname)+".jpg &").c_str()); #endif +#endif } // Preview -#ifdef WIN32 - if (ps_preview=="!"){ - ps_preview="/cygdrive/c/"; - if (getenv("XCAS_ROOT")){ - string s(getenv("XCAS_ROOT")); - if (s.substr(0,10)=="/cygdrive/") - ps_preview[10]=s[10]; - } - ps_preview +="Program\\ Files/Ghostgum/gsview/gsview32.exe"; - } -#endif - if (getenv("GIAC_PREVIEW")) - ps_preview=getenv("GIAC_PREVIEW"); if (ps_preview!="no" && preview){ #ifdef WIN32 string fn=absolute_path(fname); - system((((ps_preview+" ")+fn)+" &").c_str()); + if (system((((ps_preview+" ")+fn)+" &").c_str())){ + cerr << (("cygstart.exe '"+remove_extension(fname)+".jpg' &").c_str()) << endl; + system((xcasroot+"cygstart.exe '"+remove_extension(fname)+".jpg' &").c_str()); + } #else system((((ps_preview+" ")+fname)+" &").c_str()); #endif Modified: trunk/giac-xcas/giac/src/Tableur.cc =================================================================== --- trunk/giac-xcas/giac/src/Tableur.cc 2010-03-24 15:40:53 UTC (rev 776) +++ trunk/giac-xcas/giac/src/Tableur.cc 2010-06-11 08:45:45 UTC (rev 777) @@ -1449,7 +1449,7 @@ return ""; ifstream inf(newfile); const giac::context * contextptr = get_context(tg); - gen value(read1arg_from_stream(inf,list_one_letter__IDNT,contextptr)); + gen value(read1arg_from_stream(inf,contextptr)); if (!ckmatrix(value,true)) return ""; spread_ck(*value._VECTptr); // in place modifications of value @@ -2384,7 +2384,7 @@ if (absolu || mselect.front()._VECTptr->size()!=vc.size() || (inside?absolu2:name.type!=_IDNT) ){ tmp=extractmatricefromsheet(mselect); if (transpose) - tmp=_tran(tmp); + tmp=_tran(tmp,contextptr); } else { if (inside){ Modified: trunk/giac-xcas/giac/src/Xcas1.cc =================================================================== --- trunk/giac-xcas/giac/src/Xcas1.cc 2010-03-24 15:40:53 UTC (rev 776) +++ trunk/giac-xcas/giac/src/Xcas1.cc 2010-06-11 08:45:45 UTC (rev 777) @@ -863,7 +863,7 @@ if (f.type==giac::_SYMB) f=f._SYMBptr->sommet; if (f.type==giac::_FUNC) - s=f._FUNCptr->ptr->s; + s=f._FUNCptr->ptr()->s; giac::html_vtt=giac::html_help(giac::html_mtt,s); help_output(s,language); if (!giac::html_vtt.empty()){ @@ -2564,15 +2564,18 @@ w->resize(w->x(),w->y(),taillew,tailleh); } Fl_Group::current(w); - static Fl_Button * button0 = new Fl_Button(2+(2*taillew)/3, tailleh-30, taillew/4, 20); + static Fl_Button * button0 = new Fl_Button(2+(2*taillew)/3, 0, taillew/4, 20); button0->shortcut("^["); + button0->resize(2+(2*taillew)/3, 0, taillew/4, 20); button0->label(gettext("Cancel")); - static Fl_Button * button1 = new Fl_Return_Button(2+taillew/3, tailleh-30, taillew/4, 20); + static Fl_Button * button1 = new Fl_Return_Button(2+taillew/3, 0, taillew/4, 20); button1->label(gettext("OK")); - static Fl_Button * button2 = new Fl_Button(2, tailleh-30, taillew/4, 20); + button1->resize(2+taillew/3, 0, taillew/4, 20); + static Fl_Button * button2 = new Fl_Button(2, 0, taillew/4, 20); button2->label(gettext("STOP")); + button2->resize(2, 0, taillew/4, 20); // Now parse v - int current_y=0; + int current_y=22; vector<Fl_Input *> vinput; vector<Fl_Output *> voutput; vector<string *> labels; @@ -2710,6 +2713,7 @@ } } Xcas_Main_Window->redraw(); + w->Fl_Widget::resize(w->x(),w->y(),taillew,current_y); w->resizable(w); w->set_modal(); w->show(); Modified: trunk/giac-xcas/giac/src/alg_ext.cc =================================================================== --- trunk/giac-xcas/giac/src/alg_ext.cc 2010-03-24 15:40:53 UTC (rev 776) +++ trunk/giac-xcas/giac/src/alg_ext.cc 2010-06-11 08:45:45 UTC (rev 777) @@ -694,16 +694,16 @@ gen a=e._VECTptr->front(),b=e._VECTptr->back(); return alg_evalf(a,b,contextptr); } - gen d1_rootof(const gen & args){ + gen d1_rootof(const gen & args,GIAC_CONTEXT){ settypeerr(); return zero; } - gen d2_rootof(const gen & args){ + gen d2_rootof(const gen & args,GIAC_CONTEXT){ settypeerr(); return zero; } - unary_function_ptr D1_rootof(unary_function_unary(&d1_rootof,"")); - unary_function_ptr D2_rootof(unary_function_unary(&d2_rootof,"")); + unary_function_ptr D1_rootof(new unary_function_eval(&d1_rootof,"")); + unary_function_ptr D2_rootof(new unary_function_eval(&d2_rootof,"")); unary_function_ptr d_rootof(int i){ if (i==1) return D1_rootof; @@ -713,9 +713,9 @@ return 0; } partial_derivative_multiargs D_rootof(&d_rootof); - const string _rootof_s("rootof"); - unary_function_eval __rootof(&giac::rootof,&D_rootof,_rootof_s); - unary_function_ptr at_rootof (&__rootof,0,true); + const char _rootof_s []="rootof"; + const unary_function_eval __rootof(&giac::rootof,&D_rootof,_rootof_s); + const unary_function_ptr at_rootof (&__rootof,0,true); vecteur sturm(const gen & g){ if (g.type!=_POLY) @@ -777,7 +777,8 @@ // ignoring zeros // The function modifies a sign variable according to the sign first // non-zero element of v - int number_of_sign_changes(const vecteur & v,const gen & a,int & global_sign,GIAC_CONTEXT){ + int number_of_sign_changes(const vecteur & v,const gen & a0,int & global_sign,GIAC_CONTEXT){ + gen a=exact(a0,contextptr); gen w=normal(apply1st(v,a,horner),contextptr); int previous_sign=0,current_sign,res=0; const_iterateur it=w._VECTptr->begin(),itend=w._VECTptr->end(); @@ -837,9 +838,9 @@ } return sturmab(P,x,a,b,contextptr); } - const string _sturmab_s("sturmab"); - unary_function_eval __sturmab(&giac::_sturmab,_sturmab_s); - unary_function_ptr at_sturmab (&__sturmab,0,true); + const char _sturmab_s []="sturmab"; + const unary_function_eval __sturmab(&giac::_sturmab,_sturmab_s); + const unary_function_ptr at_sturmab (&__sturmab,0,true); gen _sturm(const gen & g,GIAC_CONTEXT){ if (g.type!=_VECT || (g.type==_VECT && g.subtype!=_SEQ__VECT) ) @@ -867,17 +868,17 @@ setdimerr(); return 0; } - const string _sturm_s("sturm"); - unary_function_eval __sturm(&giac::_sturm,_sturm_s); - unary_function_ptr at_sturm (&__sturm,0,true); + const char _sturm_s []="sturm"; + const unary_function_eval __sturm(&giac::_sturm,_sturm_s); + const unary_function_ptr at_sturm (&__sturm,0,true); gen _sturmseq(const gen & g,GIAC_CONTEXT){ // should return in the same format as maple return _sturm(g,contextptr); } - const string _sturmseq_s("sturmseq"); - unary_function_eval __sturmseq(&giac::_sturmseq,_sturmseq_s); - unary_function_ptr at_sturmseq (&__sturmseq,0,true); + const char _sturmseq_s []="sturmseq"; + const unary_function_eval __sturmseq(&giac::_sturmseq,_sturmseq_s); + const unary_function_ptr at_sturmseq (&__sturmseq,0,true); void recompute_minmax(const vecteur & w,const vecteur & range,const gen & expr,const gen & var,gen & resmin,gen & resmax,vecteur & xmin,vecteur & xmax,int direction,GIAC_CONTEXT){ const_iterateur it=w.begin(),itend=w.end(); Modified: trunk/giac-xcas/giac/src/alg_ext.h =================================================================== --- trunk/giac-xcas/giac/src/alg_ext.h 2010-03-24 15:40:53 UTC (rev 776) +++ trunk/giac-xcas/giac/src/alg_ext.h 2010-06-11 08:45:45 UTC (rev 777) @@ -44,8 +44,7 @@ gen inv_EXT(const gen & a); gen symb_rootof(const gen & p,const gen &pmin,GIAC_CONTEXT); gen rootof(const gen & e,GIAC_CONTEXT); - extern const std::string _rootof_s; - extern unary_function_ptr at_rootof ; + extern const unary_function_ptr at_rootof ; vecteur min_pol(gen & a); // Return the signed subresultant Sturm sequence for a rational @@ -56,8 +55,7 @@ // polynomials (also coded as vecteur) // The content of the numerator and denominator are returned as well vecteur sturm(const gen &g,const gen & x,GIAC_CONTEXT); - extern const std::string _sturm_s; - extern unary_function_ptr at_sturm ; + extern const unary_function_ptr at_sturm ; // Number of sign changes of g when x is inside the ]a,b[ interval // Zeros of g of even multiplicities are not counted // Zeros of g of odd multiplicites are counted once @@ -66,8 +64,7 @@ // If sturmab returns 0, then the sign is constant positive // If sturmab returns -1, the sign is constant negative int sturmab(const gen & g,const gen &x,const gen & a,const gen & b,GIAC_CONTEXT); - extern const std::string _sturmab_s; - extern unary_function_ptr at_sturmab ; + extern const unary_function_ptr at_sturmab ; int sturmsign(const gen & a,GIAC_CONTEXT); // find extremals values of g void find_range(const gen & g,vecteur & a,GIAC_CONTEXT); Modified: trunk/giac-xcas/giac/src/csturm.cc =================================================================== --- trunk/giac-xcas/giac/src/csturm.cc 2010-03-24 15:40:53 UTC (rev 776) +++ trunk/giac-xcas/giac/src/csturm.cc 2010-06-11 08:45:45 UTC (rev 777) @@ -99,11 +99,40 @@ } // end while loop } + gen csturm_horner(const modpoly & p,const gen & a){ + if (p.size()==1 && p.front().type==_POLY && p.front()._POLYptr->dim==1){ + // patch for "sparse modpoly" + vector< monomial<gen> >::const_iterator it=p.front()._POLYptr->coord.begin(),itend=p.front()._POLYptr->coord.end(); + gen res=0,anum=a,aden=1,den=1; + int oldpui=0,pui; + if (a.type==_FRAC){ + anum=a._FRACptr->num; + aden=a._FRACptr->den; + } + for (;it!=itend;++it){ + pui=it->index.riptr->i.front(); + if (oldpui){ + res = res * pow(anum,oldpui-pui,context0); + den = den * pow(aden,oldpui-pui,context0); + } + res += it->value*den; + oldpui=pui; + } + if (oldpui){ + res = res *pow(a,oldpui,context0); + den = den *pow(a,oldpui,context0); + } + return res/den; + } + else + return horner(p,a); + } + int csturm_vertex_ab(const modpoly & r0,const modpoly & r1,const vecteur & listquo,const vecteur & coeffP, const vecteur & coeffR,const gen & a,int start,GIAC_CONTEXT){ int n=listquo.size(),j,k,res=0; vecteur R(n+2); - R[0]=horner(r0,a); - R[1]=horner(r1,a); + R[0]=csturm_horner(r0,a); + R[1]=csturm_horner(r1,a); for (j=0;j<n;j++) R[j+2]=(-coeffP[j]*R[j]+R[j+1]*horner(listquo[j],a))/coeffR[j]; // signes @@ -112,7 +141,9 @@ } for (k=j+1;k<n+2;k++){ if (is_zero(R[k])) continue; - if (is_positive(-R[j]*R[k],contextptr)){ + if (fastsign(R[j],context0)*fastsign(R[k],context0)<0 + // is_positive(-R[j]*R[k],contextptr) + ){ res++; j=k; } @@ -171,21 +202,23 @@ int n=(n2-n1); if (!eps || !n) return n; + /* disabled localization of roots, do isolation of roots instead if (is_strictly_greater(eps,(t1-t0)*abs(b,contextptr),contextptr)){ realroots.push_back(makevecteur(makevecteur(a+t0*b,a+t1*b),n)); return n; } + */ if (n==1){ gen T0=t0,T1=t1,T2; - int s0=fastsign(horner(R,T0),contextptr); - int s1=fastsign(horner(R,T1),contextptr),s2; + int s0=fastsign(csturm_horner(R,T0),contextptr); + int s1=fastsign(csturm_horner(R,T1),contextptr),s2; gen delta=evalf_double(log((T1-T0)*abs(b,contextptr)/eps,contextptr)/log(2.,contextptr),1,contextptr); if (delta.type!=_DOUBLE_) settypeerr(); int nstep=int(delta._DOUBLE_val+1); for (int step=0;step<nstep;++step){ T2=(T0+T1)/2; - s2=fastsign(horner(R,T2),contextptr); + s2=fastsign(csturm_horner(R,T2),contextptr); if (!s2){ realroots.push_back(makevecteur(a+T2*b,n)); return n; @@ -198,9 +231,19 @@ realroots.push_back(makevecteur(makevecteur(a+T0*b,a+T1*b),n)); return n; } - gen t01=(t0+t1)/2; - csturm_realroots(S,R,listquo,coeffP,coeffR,a,b,t0,t01,realroots,eps,contextptr); - csturm_realroots(S,R,listquo,coeffP,coeffR,a,b,t01,t1,realroots,eps,contextptr); + gen T0=t0,T1=t1,t01; + for (;;){ + t01=(T0+T1)/2; + int n01=csturm_vertex_ab(S,R,listquo,coeffP,coeffR,t01,1,contextptr); + if (n01!=n1 && n01!=n2) + break; + if (n01==n1) + T0=t01; + else + T1=t01; + } + csturm_realroots(S,R,listquo,coeffP,coeffR,a,b,T0,t01,realroots,eps,contextptr); + csturm_realroots(S,R,listquo,coeffP,coeffR,a,b,t01,T1,realroots,eps,contextptr); return n; } @@ -643,9 +686,9 @@ return false; gen x0=(a0+a1)/2+cst_i*(b0+b1)/2; modpoly Pprime=derivative(P); - int n=int(-std::log(eps)/std::log(2)+.5); // for rounding + int n=int(-std::log(eps)/std::log(2.0)+.5); // for rounding gen eps2=pow(2,-(n+1),context0); - for (int i=0;i<n;i++){ + for (int ii=0;ii<n;ii++){ gen Pprimex0=horner(Pprime,x0); if (is_zero(Pprimex0,context0)) return false; @@ -810,6 +853,11 @@ modpoly S=derivative(R); vecteur listquo,coeffP,coeffR; csturm_seq(S,R,listquo,coeffP,coeffR,context0); + // sparse polynomial patch + if (pp.coord.size()<p.size()/10.){ + R=vecteur(1,poly12polynome(R,1,1)); + S=vecteur(1,poly12polynome(S,1,1)); + } csturm_realroots(S,R,listquo,coeffP,coeffR,0,1,A0,A1,roots,eps,context0); return roots; } @@ -822,9 +870,11 @@ gen complexroot(const gen & g,bool complexe,GIAC_CONTEXT){ - if (g.type!=_VECT || (g._VECTptr->size()<2) ) + vecteur v=gen2vecteur(g); + if (v.empty()) setsizeerr(); - vecteur & v(*g._VECTptr); + if (v.size()<2) + v.push_back(epsilon(contextptr)); gen p=v.front(),prec=evalf_double(v[1],1,contextptr); if (prec.type!=_DOUBLE_) settypeerr(); @@ -869,16 +919,16 @@ gen _complexroot(const gen & g,GIAC_CONTEXT){ return complexroot(g,true,contextptr); } - const string _complexroot_s("complexroot"); - unary_function_eval __complexroot(&giac::_complexroot,_complexroot_s); - unary_function_ptr at_complexroot (&__complexroot,0,true); + const char _complexroot_s []="complexroot"; + const unary_function_eval __complexroot(&giac::_complexroot,_complexroot_s); + const unary_function_ptr at_complexroot (&__complexroot,0,true); gen _realroot(const gen & g,GIAC_CONTEXT){ return complexroot(g,false,contextptr); } - const string _realroot_s("realroot"); - unary_function_eval __realroot(&giac::_realroot,_realroot_s); - unary_function_ptr at_realroot (&__realroot,0,true); + const char _realroot_s []="realroot"; + const unary_function_eval __realroot(&giac::_realroot,_realroot_s); + const unary_function_ptr at_realroot (&__realroot,0,true); vecteur crationalroot(const gen & g0,bool complexe){ gen g(g0),a,b; @@ -921,16 +971,16 @@ gen _crationalroot(const gen & g,GIAC_CONTEXT){ return crationalroot(g,true); } - const string _crationalroot_s("crationalroot"); - unary_function_eval __crationalroot(&giac::_crationalroot,_crationalroot_s); - unary_function_ptr at_crationalroot (&__crationalroot,0,true); + const char _crationalroot_s []="crationalroot"; + const unary_function_eval __crationalroot(&giac::_crationalroot,_crationalroot_s); + const unary_function_ptr at_crationalroot (&__crationalroot,0,true); gen _rationalroot(const gen & g,GIAC_CONTEXT){ return crationalroot(g,false); } - const string _rationalroot_s("rationalroot"); - unary_function_eval __rationalroot(&giac::_rationalroot,_rationalroot_s); - unary_function_ptr at_rationalroot (&__rationalroot,0,true); + const char _rationalroot_s []="rationalroot"; + const unary_function_eval __rationalroot(&giac::_rationalroot,_rationalroot_s); + const unary_function_ptr at_rationalroot (&__rationalroot,0,true); #ifndef NO_NAMESPACE_GIAC } // namespace giac Modified: trunk/giac-xcas/giac/src/derive.cc =================================================================== --- trunk/giac-xcas/giac/src/derive.cc 2010-03-24 15:40:53 UTC (rev 776) +++ trunk/giac-xcas/giac/src/derive.cc 2010-06-11 08:45:45 UTC (rev 777) @@ -114,6 +114,9 @@ } return rdiv(-derive(s.feuille,i,contextptr),pow(s.feuille,2)); } + if (s.sommet==at_program){ + setsizeerr("Expecting an expression, not a function"); + } if (s.sommet==at_ln){ if (s.feuille.is_symb_of_sommet(at_abs) ) return rdiv(derive(s.feuille._SYMBptr->feuille,i,contextptr),s.feuille._SYMBptr->feuille); @@ -147,9 +150,9 @@ } } // now look at other operators, first onearg operator - if (s.sommet.ptr->D){ + if (s.sommet.ptr()->D){ if (s.feuille.type!=_VECT) - return (*s.sommet.ptr->D)(1)(s.feuille,contextptr)*derive(s.feuille,i,contextptr); + return (*s.sommet.ptr()->D)(1)(s.feuille,contextptr)*derive(s.feuille,i,contextptr); // multiargs operators int taille=s.feuille._VECTptr->size(); vecteur v; @@ -159,7 +162,7 @@ for (int j=1;iti!=itend;++iti,++j){ e=derive(*iti,i,contextptr); if (!is_zero(e)) - v.push_back(e*(*s.sommet.ptr->D)(j)(s.feuille,contextptr)); + v.push_back(e*(*s.sommet.ptr()->D)(j)(s.feuille,contextptr)); } if (v.size()==1) return v.front(); @@ -388,33 +391,33 @@ return gen(derivative(*v[0]._VECTptr),_POLY1__VECT); return derive(v[0],v[1],contextptr); } - if ((s==3) && (v[2].type==_INT_ || v[2].type==_VECT) ) + if (s==3 && (v[2].type==_INT_ || (v[2].type==_VECT && v[2].subtype!=_SEQ__VECT)) ) return derive( v[0],v[1],v[2],contextptr); if (s<3) setsizeerr(); const_iterateur it=v.begin()+1,itend=v.end(); gen res(v[0]); for (;it!=itend;++it) - res=ratnormal(derive(res,*it,contextptr)); + res=ratnormal(_derive(gen(makevecteur(res,*it),_SEQ__VECT),contextptr)); return res; } - const string _derive_s("diff"); + const char _derive_s []="diff"; string texprintasderive(const gen & feuille,const string & sommetstr,GIAC_CONTEXT){ if (feuille.type!=_VECT) return gen2tex(feuille,contextptr)+"'"; return "\\frac{\\partial \\left("+gen2tex(feuille._VECTptr->front(),contextptr)+"\\right)}{\\partial "+gen2tex(feuille._VECTptr->back(),contextptr)+"}"; } - unary_function_eval __derive(&_derive,_derive_s,0,texprintasderive); - unary_function_ptr at_derive (&__derive,_QUOTE_ARGUMENTS,true); + const unary_function_eval __derive(&_derive,_derive_s,0,texprintasderive); + const unary_function_ptr at_derive (&__derive,_QUOTE_ARGUMENTS,true); gen _grad(const gen & args,GIAC_CONTEXT){ if (args.type!=_VECT || args._VECTptr->size()!=2) setsizeerr(); return _derive(args,contextptr); } - const string _grad_s("grad"); - unary_function_eval __grad(&_grad,_grad_s); - unary_function_ptr at_grad (&__grad,_QUOTE_ARGUMENTS,true); + const char _grad_s []="grad"; + const unary_function_eval __grad(&_grad,_grad_s); + const unary_function_ptr at_grad (&__grad,_QUOTE_ARGUMENTS,true); // FIXME: This should not use any temporary identifier // Should define the identity operator and write again all rules here @@ -448,13 +451,13 @@ } return symbolic(at_function_diff,g); } - const string _function_diff_s("function_diff"); - unary_function_eval __function_diff(&_function_diff,_function_diff_s); - unary_function_ptr at_function_diff (&__function_diff,0,true); + const char _function_diff_s []="function_diff"; + const unary_function_eval __function_diff(&_function_diff,_function_diff_s); + const unary_function_ptr at_function_diff (&__function_diff,0,true); - const string _fonction_derivee_s("fonction_derivee"); - unary_function_eval __fonction_derivee(&_function_diff,_fonction_derivee_s); - unary_function_ptr at_fonction_derivee (&__fonction_derivee,0,true); + const char _fonction_derivee_s []="fonction_derivee"; + const unary_function_eval __fonction_derivee(&_function_diff,_fonction_derivee_s); + const unary_function_ptr at_fonction_derivee (&__fonction_derivee,0,true); #ifndef NO_NAMESPACE_GIAC } // namespace giac Modified: trunk/giac-xcas/giac/src/derive.h =================================================================== --- trunk/giac-xcas/giac/src/derive.h 2010-03-24 15:40:53 UTC (rev 776) +++ trunk/giac-xcas/giac/src/derive.h 2010-06-11 08:45:45 UTC (rev 777) @@ -29,9 +29,9 @@ gen derive(const gen & e,const gen & vars,GIAC_CONTEXT); gen derive(const gen & e,const gen & vars,const gen & nderiv,GIAC_CONTEXT); gen _derive(const gen & args,GIAC_CONTEXT); - extern unary_function_ptr at_derive ; - extern unary_function_ptr at_grad ; - extern unary_function_ptr at_function_diff ; + extern const unary_function_ptr at_derive ; + extern const unary_function_ptr at_grad ; + extern const unary_function_ptr at_function_diff ; symbolic symb_derive(const gen & a,const gen & b); gen symb_derive(const gen & a,const gen & b,const gen &c); gen _function_diff(const gen & g,GIAC_CONTEXT); Modified: trunk/giac-xcas/giac/src/desolve.cc =================================================================== --- trunk/giac-xcas/giac/src/desolve.cc 2010-03-24 15:40:53 UTC (rev 776) +++ trunk/giac-xcas/giac/src/desolve.cc 2010-06-11 08:45:45 UTC (rev 777) @@ -111,9 +111,9 @@ setsizeerr(); return laplace( v[0],v[1],v[2],contextptr); } - const string _laplace_s("laplace"); - unary_function_eval __laplace(&_laplace,_laplace_s); - unary_function_ptr at_laplace (&__laplace,0,true); + const char _laplace_s []="laplace"; + const unary_function_eval __laplace(&_laplace,_laplace_s); + const unary_function_ptr at_laplace (&__laplace,0,true); polynome cstcoeff(const polynome & p){ vector< monomial<gen> >::const_iterator it=p.coord.begin(),itend=p.coord.end(); @@ -278,13 +278,13 @@ setsizeerr(); return ilaplace( v[0],v[1],v[2],contextptr); } - const string _ilaplace_s("ilaplace"); - unary_function_eval __ilaplace(&_ilaplace,_ilaplace_s); - unary_function_ptr at_ilaplace (&__ilaplace,0,true); + const char _ilaplace_s []="ilaplace... [truncated message content] |
From: <pa...@us...> - 2010-03-24 15:41:07
|
Revision: 776 http://xcas.svn.sourceforge.net/xcas/?rev=776&view=rev Author: parisse Date: 2010-03-24 15:40:53 +0000 (Wed, 24 Mar 2010) Log Message: ----------- Modified Paths: -------------- trunk/giac-xcas/giac/src/Graph.cc trunk/giac-xcas/giac/src/History.cc trunk/giac-xcas/giac/src/Input.cc trunk/giac-xcas/giac/src/Xcas1.cc trunk/giac-xcas/giac/src/csturm.cc trunk/giac-xcas/giac/src/gausspol.cc trunk/giac-xcas/giac/src/gen.cc trunk/giac-xcas/giac/src/help.cc trunk/giac-xcas/giac/src/hist.cxx trunk/giac-xcas/giac/src/hist.fl trunk/giac-xcas/giac/src/hist.h trunk/giac-xcas/giac/src/intgab.cc trunk/giac-xcas/giac/src/maple.cc trunk/giac-xcas/giac/src/maple.h trunk/giac-xcas/giac/src/plot.cc trunk/giac-xcas/giac/src/prog.cc trunk/giac-xcas/giac/src/rpn.cc trunk/giac-xcas/giac/src/threaded.cc Modified: trunk/giac-xcas/giac/src/Graph.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph.cc 2010-03-15 14:04:21 UTC (rev 775) +++ trunk/giac-xcas/giac/src/Graph.cc 2010-03-24 15:40:53 UTC (rev 776) @@ -32,6 +32,8 @@ #include <FL/Fl_Check_Button.H> #include <FL/fl_show_colormap.H> #include <FL/Fl_Tiled_Image.H> +#include <FL/Fl_Image.H> +#include <FL/Fl_Shared_Image.H> #include <fstream> #include <vector> #include <algorithm> @@ -205,22 +207,75 @@ return os << q.w << "+" << q.x << "i+" << q.y << "j+" << q.z << "k"; } + bool readrgb(const string & s,int W,int H,gen & res){ + Fl_Image * image=Fl_Shared_Image::get(s.c_str()); + if (image && W && H) + image=image->copy(W,H); + if (!image || image->count()!=1) + return false; + const char * data = image->data()[0]; + unsigned ih=image->h(),iw=image->w(),id=image->d(); + gen tmpr=vecteur(ih),tmpg=vecteur(ih),tmpb=vecteur(ih),tmpa=vecteur(ih); + // alpha is returned before blue because red==1, green==2, blue==4 + res=gen(makevecteur(makevecteur(4,int(ih),int(iw)),tmpr,tmpg,tmpa,tmpb),_RGBA__VECT); + vecteur & vr=*tmpr._VECTptr; + vecteur & vg=*tmpg._VECTptr; + vecteur & vb=*tmpb._VECTptr; + vecteur & va=*tmpa._VECTptr; + unsigned l=0; + for (unsigned i=0;i<ih;++i){ + if (debug_infolevel) + cerr << "readrgb, reading row " << i << endl; + vr[i]=vecteur(iw); + vg[i]=vecteur(iw); + vb[i]=vecteur(iw); + va[i]=vecteur(iw,255); + vecteur & wr = *vr[i]._VECTptr; + vecteur & wg = *vg[i]._VECTptr; + vecteur & wb = *vb[i]._VECTptr; + vecteur & wa = *va[i]._VECTptr; + for (unsigned j=0;j<iw;++j){ + for (unsigned k=0;k<id;++k,++l){ + unsigned u=data[l] & 0xff; + switch(k){ + case 0: + wr[j]=int(u); + break; + case 1: + wg[j]=int(u); + break; + case 2: + wb[j]=int(u); + break; + case 3: + wa[j]=int(u); + break; + } + } + } + } + return true; + } + // Locales initialization, should be done before history.o is loaded #ifdef HAVE_LC_MESSAGES std::string xcas_locale(getenv("XCAS_LOCALE")?getenv("XCAS_LOCALE"):giac_locale_location); +#endif class objet_bidon{ public: objet_bidon(){ // localization code + giac::readrgb_ptr=readrgb; +#ifdef HAVE_LC_MESSAGES cerr << "// Using locale " << xcas_locale << endl; cerr << "// " << setlocale (LC_MESSAGES, "") << endl; cerr << "// " << bindtextdomain (PACKAGE, xcas_locale.c_str()) << endl; cerr << "// " << textdomain (PACKAGE) << endl; cerr << "// " << bind_textdomain_codeset (PACKAGE, "UTF-8") << endl; +#endif }; }; objet_bidon mon_objet_bidon; -#endif // New buttons/menus: // row1: z+ up_y up_z @@ -1660,7 +1715,7 @@ std::swap(window_zmin,window_zmax); Figure * fig=dynamic_cast<Figure *>(parent()); if (fig){ - landscape->show(); + // landscape->show(); landscape->value(fig->disposition); } else @@ -3313,7 +3368,7 @@ } } redraw(); - if (event!=FL_RELEASE) + if (event!=FL_RELEASE || (abs(push_i-current_i)<=5 && abs(push_j-current_j)<=5)) return 1; } } @@ -3335,6 +3390,7 @@ if (event==FL_RELEASE){ int s=args_tmp.size(); args_tmp_push_size=s; + int save_undo_position=hp->undo_position; if (mode>1 && s>=mode){ if (s>mode){ args_tmp=vecteur(args_tmp.begin(),args_tmp.begin()+mode); @@ -3428,6 +3484,7 @@ } // if res.type==_VECT } autoname_plus_plus(); + // hp->undo_position=save_undo_position; hp->update(pos0); } args_tmp.clear(); @@ -3595,12 +3652,15 @@ // patch so that we move element and not the curve int p=findfirstpoint(selection2vecteur(selected)); if (p>0){ + /* gen g=hp->parse(selected[p]); if (g.is_symb_of_sommet(at_sto) && g._SYMBptr->feuille.type==_VECT ){ vecteur & v = *g._SYMBptr->feuille._VECTptr; if (v.size()>1 && v[0].is_symb_of_sommet(at_element)) pos=p; } + */ + pos=p; } } else @@ -5670,6 +5730,15 @@ } } + static void cb_Figure_Disposition(Fl_Button * b , void*) { + Figure * fig=find_figure(b); + if (!fig) return; + fig->disposition=b->value(); + fig->resize(fig->x(),fig->y(),fig->w(),fig->h()); + fig->geo->orthonormalize(); + fig->redraw(); + } + static void cb_Figure_Autoeval(Fl_Button * b , void*) { static string s; Figure * f=find_figure(b); @@ -5797,12 +5866,16 @@ cb_set_mode(m,at_segment,at_inter,2,gettext("Curve1,Curve2")); } + static void cb_Inter_3(Fl_Widget * m , void*) { + cb_set_mode(m,at_polygone_ouvert,at_inter,3,gettext("Curve1,Curve2,Point")); + } + static void cb_Tangent(Fl_Widget * m , void*) { cb_set_mode(m,at_segment,at_tangent,2,gettext("Curve,Point")); } static void cb_Segment(Fl_Widget * m , void*) { - cb_set_mode(m,0,at_point,1,gettext("Segment")); + cb_set_mode(m,at_segment,at_segment,2,gettext("Point1,Point2")); } static void cb_Vector(Fl_Widget * m , void*) { @@ -5860,13 +5933,17 @@ } static void cb_Inversion(Fl_Widget * m , void*) { - cb_set_mode(m,at_segment,at_inversion,2,gettext("Center,Object")); + cb_set_mode(m,at_segment,at_inversion,3,gettext("Center,Ratio,Object")); } static void cb_Projection(Fl_Widget * m , void*) { cb_set_mode(m,at_segment,at_projection,2,gettext("Curve,Object")); } + static void cb_Reciprocation(Fl_Widget * m , void*) { + cb_set_mode(m,at_segment,at_polaire_reciproque,2,gettext("Circle,Object")); + } + static void cb_Rotation(Fl_Widget * m , void*) { cb_set_mode(m,at_polygone_ouvert,at_rotation,3,gettext("Center,Angle,Object")); } @@ -5986,8 +6063,8 @@ {gettext("Delete selected levels"), 0, (Fl_Callback *) cb_Delete, 0, 0, 0, 0, 14, 56}, {gettext("Portrait"), 0, (Fl_Callback *) cb_Figure_Portrait, 0, 0, 0, 0, 14, 56}, {gettext("Landscape"), 0, (Fl_Callback *) cb_Figure_Landscape, 0, 0, 0, 0, 14, 56}, - {gettext("Undo"), 0, (Fl_Callback *) History_cb_Undo, 0, 0, 0, 0, 14, 56}, - {gettext("Redo"), 0, (Fl_Callback *) History_cb_Redo, 0, 0, 0, 0, 14, 56}, + {gettext("Undo"), 0x4007a, (Fl_Callback *) History_cb_Undo, 0, 0, 0, 0, 14, 56}, + {gettext("Redo"), 0x40079, (Fl_Callback *) History_cb_Redo, 0, 0, 0, 0, 14, 56}, {0}, // end Edit {gettext("Graph"), 0, 0, 0, 64, 0, 0, 14, 56}, {gettext("Function"), 0, (Fl_Callback *) cb_Figure_Function, 0, 0, 0, 0, 14, 56}, @@ -6059,9 +6136,11 @@ {gettext("homothety"), 0, (Fl_Callback *) cb_Homothetie, 0, 0, 0, 0, 14, 56}, {gettext("similarity"), 0, (Fl_Callback *) cb_Similitude, 0, 0, 0, 0, 14, 56}, {gettext("inversion"), 0, (Fl_Callback *) cb_Inversion, 0, 0, 0, 0, 14, 56}, + {gettext("reciprocation"), 0, (Fl_Callback *) cb_Reciprocation, 0, 0, 0, 0, 14, 56}, {0}, // end transformations {gettext("Intersections"), 0, 0, 0, 64, 0, 0, 14, 56}, {gettext("inter_unique (1 point)"), 0, (Fl_Callback *) cb_Inter_Unique, 0, 0, 0, 0, 14, 56}, + {gettext("inter (close to a point)"), 0, (Fl_Callback *) cb_Inter_3, 0, 0, 0, 0, 14, 56}, {gettext("inter (list of points)"), 0, (Fl_Callback *) cb_Inter, 0, 0, 0, 0, 14, 56}, {0}, // end intersections {gettext("tangent"), 0, (Fl_Callback *) cb_Tangent, 0, 0, 0, 0, 14, 56}, @@ -6139,6 +6218,7 @@ x += mode->w(); mode->value(gettext("Frame")); Fl_Menu_Button * menubut = new Fl_Menu_Button(x,Y,(4*W)/60,l); + menubut->tooltip(gettext("Set mode for mouse constructions")); #ifndef IPAQ menubut->label("Mode"); #endif @@ -6161,11 +6241,16 @@ lt->tooltip(gettext("Line style used for next mouse drawings")); lt->callback((Fl_Callback *) cb_Figure_Line_Type); x += l; - Fl_Check_Button * checkb = new Fl_Check_Button(x,Y,2*l,l,"Step"); + Fl_Check_Button * checkb = new Fl_Check_Button(x,Y,3*l,l,"Step"); checkb->value(false); checkb->tooltip(gettext("Check for step evaluation")); checkb->callback((Fl_Callback *) cb_Figure_Autoeval); x += checkb->w(); + Fl_Check_Button * checkdisp = new Fl_Check_Button(x,Y,3*l,l,"Landscape"); + checkdisp->value(false); + checkdisp->tooltip(gettext("Check for landscape")); + checkdisp->callback((Fl_Callback *) cb_Figure_Disposition); + x += checkb->w(); name = new Fl_Button(x,Y,W+X-x,l,"<Save figure as text>"); name->callback((Fl_Callback *) cb_Figure_Save); name->tooltip(gettext("Save current figure commands independently of the session")); @@ -6192,7 +6277,7 @@ barre->resize(X,Y,W,l); if (disposition==1){ double dgeomp=dgeo+dmp; - geo->resize(X,Y+l,int(W*dgeo/dgeomp+.5),int(H*dgeomp+.5)); + geo->resize(X,Y+l,max(W-5*l,int(W*dgeo/dgeomp+.5)),int(H*dgeomp+.5)); geo->mouse_param_group->resize(X+geo->w(),Y+l,W-geo->w(),geo->h()); s->resize(X,geo->y()+geo->h(),W,H-geo->h()-l); } Modified: trunk/giac-xcas/giac/src/History.cc =================================================================== --- trunk/giac-xcas/giac/src/History.cc 2010-03-15 14:04:21 UTC (rev 775) +++ trunk/giac-xcas/giac/src/History.cc 2010-03-24 15:40:53 UTC (rev 776) @@ -973,10 +973,18 @@ remove_selected_levels(false); return 1; } - if (ch==22 || ch==25){ // Ctrl-V + if (ch==22){ // Ctrl-V Fl::paste(*this, 1); return 1; } + if (ch==25){ + History_cb_Redo(this,0); + return 1; + } + if (ch==26){ + History_cb_Undo(this,0); + return 1; + } } if (Fl::event_button()== FL_MIDDLE_MOUSE ){ if (event==FL_RELEASE){ @@ -2983,11 +2991,33 @@ } } + void synchronize(const History_Pack * hp,Graph2d3d * geo){ + geo->clear(); + int s=hp->children(); + for (int i=0;i<s;++i){ + Fl_Widget * wid=hp->child(i); + if (Fl_Group * gr=dynamic_cast<Fl_Group *>(wid)){ + if (gr->children()>=3){ + wid=gr->child(2); + if (Fl_Scroll * scroll = dynamic_cast<Fl_Scroll *>(wid)) + wid=scroll->child(0); + if (Gen_Output * out=dynamic_cast<Gen_Output *>(wid)){ + geo->add(out->value()); + continue; + } + } + } + geo->add(undef); + } + } + void History_cb_Undo(Fl_Widget* m , void*) { if (m && m->parent()){ Figure * f=find_figure(m); - if (f && f->geo) + if (f && f->geo){ f->geo->hp->restore(-1); + synchronize(f->geo->hp,f->geo); + } else { History_Pack * o = get_history_pack(m); if (o){ @@ -3004,8 +3034,10 @@ void History_cb_Redo(Fl_Widget* m , void*) { if (m && m->parent()){ Figure * f=find_figure(m); - if (f && f->geo) + if (f && f->geo){ f->geo->hp->restore(1); + synchronize(f->geo->hp,f->geo); + } else { History_Pack * o = get_history_pack(m); if (o){ Modified: trunk/giac-xcas/giac/src/Input.cc =================================================================== --- trunk/giac-xcas/giac/src/Input.cc 2010-03-15 14:04:21 UTC (rev 775) +++ trunk/giac-xcas/giac/src/Input.cc 2010-03-24 15:40:53 UTC (rev 776) @@ -176,6 +176,7 @@ return res+ajout; debut += l+1; } + return res; } void update_examples(const string & s,Fl_Browser * examples,Fl_Browser * related,Fl_Browser * syns,Fl_Output * output,Fl_Input ** argtab,int language){ @@ -1091,7 +1092,7 @@ redraw(); return 1; } - if (!Fl::event_state(FL_SHIFT | FL_CTRL | FL_ALT)) + if (!Fl::event_state(FL_CTRL | FL_ALT)) return 0; // not handled by the input, use history int s=history.size(); @@ -1373,6 +1374,51 @@ change_focus=-1; if (hp && ( (key==FL_Down && line_end(position())==size()) || key==FL_Page_Down || key==FL_Enter)) change_focus=1; + if (key==FL_Enter){ + string s=value(); + s+=' '; + // search in s for a word with ., check if it's an existing filename or URL + int ss=s.size(); + for (int i=0;i<ss;++i){ + if (s[i]==' ') + continue; + int wordbegin=i; + bool haspoint=false; + // begin of word + for (++i;i<ss;++i){ + if (s[i]=='.' && + i<ss-1 && s[i+1]>='a' && s[i+1]<='z' && + i && (isalpha(s[i-1]) || (s[i-1]>='0' && s[i-1]<='9')) + ) + haspoint=true; + if (s[i]==' ') + break; + } + if (!haspoint) + continue; + string url; + if (i>wordbegin+7 && (s.substr(wordbegin,7)=="http://" || s.substr(wordbegin,7)=="file://")){ + url=s.substr(wordbegin,i-wordbegin); + } + else { + if (s[wordbegin]=='@'){ + url=s.substr(wordbegin+1,i-wordbegin-1); + } + } + if (url.empty()) + continue; + if (giac::is_file_available(url.c_str())){ + if (url[0]!='/') + url=*giac::_pwd(0,0)._STRNGptr+"/"+url; + } + else { + if (url.size()<7 || (url.substr(0,7)!="http://" && url.substr(0,7)!="file://")) + url="http://"+url; + } + system(giac::browser_command(url).c_str()); + // break; + } + } if (change_focus && hp){ hp->_sel_begin=-1; int pos=hp->set_sel_begin(this); Modified: trunk/giac-xcas/giac/src/Xcas1.cc =================================================================== --- trunk/giac-xcas/giac/src/Xcas1.cc 2010-03-15 14:04:21 UTC (rev 775) +++ trunk/giac-xcas/giac/src/Xcas1.cc 2010-03-24 15:40:53 UTC (rev 776) @@ -1341,10 +1341,18 @@ res += '\n'+print_INT_(s.size())+" ,\n"+s; return res; } + if (const Gen_Output * i=dynamic_cast<const Gen_Output *>(o)){ + res += '\n'; + string s=i->value().print(contextptr); + s=unlocalize(s); + res += replace(s,'\n','\xA3'); + // res += '"'; + return res + '\n'; + } if (const Fl_Input_ * i=dynamic_cast<const Fl_Input_ *>(o)){ res += '\n'; string s=i->value(); - if ( dynamic_cast<const Multiline_Input_tab *>(i) || dynamic_cast<const Gen_Output *>(i) ) + if ( dynamic_cast<const Multiline_Input_tab *>(i) ) s=unlocalize(s); res += replace(s,'\n','\xA3'); // res += '"'; Modified: trunk/giac-xcas/giac/src/csturm.cc =================================================================== --- trunk/giac-xcas/giac/src/csturm.cc 2010-03-15 14:04:21 UTC (rev 775) +++ trunk/giac-xcas/giac/src/csturm.cc 2010-03-24 15:40:53 UTC (rev 776) @@ -75,8 +75,12 @@ if (!n) { // if b is constant, gcd=1 return 1; } - if (ddeg%2) // ddeg should be even if b0 is a _POLY1 - b0=b.front(); + b0=b.front(); + if (b.front().type==_VECT) { + // ddeg should be even if b0 is a _POLY1 + if (ddeg%2==0) + *logptr(contextptr) << "Singular parametric Sturm sequence " << a << "/" << b << endl; + } else b0=abs(b.front(),contextptr); coeffP.push_back(pow(b0,ddeg+1)); Modified: trunk/giac-xcas/giac/src/gausspol.cc =================================================================== --- trunk/giac-xcas/giac/src/gausspol.cc 2010-03-15 14:04:21 UTC (rev 775) +++ trunk/giac-xcas/giac/src/gausspol.cc 2010-03-24 15:40:53 UTC (rev 776) @@ -2709,6 +2709,8 @@ } return true; } + // np_simp=(pt!=_EXT)?ppz(p_simp):1; + // nq_simp=(qt!=_EXT)?ppz(q_simp):1; np_simp=ppz(p_simp); nq_simp=ppz(q_simp); if (debug_infolevel>=20-p_simp.dim) Modified: trunk/giac-xcas/giac/src/gen.cc =================================================================== --- trunk/giac-xcas/giac/src/gen.cc 2010-03-15 14:04:21 UTC (rev 775) +++ trunk/giac-xcas/giac/src/gen.cc 2010-03-24 15:40:53 UTC (rev 776) @@ -305,7 +305,7 @@ if (m<0) m=-m; r = r % m; - register int tmp= r+r; + longlong tmp= longlong(r)+r; if (tmp>m) return r-m; if (tmp<=-m) @@ -705,7 +705,7 @@ return; } if (g.type==_FRAC){ - gen tmp=g._FRACptr->num/real_object(g._FRACptr->den,precision); + gen tmp=real_object(g._FRACptr->num,precision)/real_object(g._FRACptr->den,precision); if (tmp.type==_REAL){ #ifdef HAVE_LIBMPFR mpfr_init2(inf,mpfr_get_prec(tmp._REALptr->inf)); @@ -6733,7 +6733,7 @@ else return zero; } - if (a==b) + if (a==b && a.type!=_REAL) return chkmod(plus_one,a); if (a.is_approx()){ gen b1; @@ -9540,7 +9540,7 @@ bool has_denominator(const gen & n){ switch (n.type ) { - case _INT_: case _ZINT: case _CPLX: case _DOUBLE_: case _IDNT: case _EXT: case _POLY: case _MOD: case _USER: case _REAL: + case _INT_: case _ZINT: case _CPLX: case _DOUBLE_: case _IDNT: case _EXT: case _POLY: case _MOD: case _USER: case _REAL: case _VECT: return false; case _SYMB: case _FRAC: return true; Modified: trunk/giac-xcas/giac/src/help.cc =================================================================== --- trunk/giac-xcas/giac/src/help.cc 2010-03-15 14:04:21 UTC (rev 775) +++ trunk/giac-xcas/giac/src/help.cc 2010-03-24 15:40:53 UTC (rev 776) @@ -370,9 +370,9 @@ } // find index nodes in file file - void find_index(const std::string & current_dir,const std::string & file,multimap<std::string,std::string>&mtt,multimap<std::string,std::string>&mall,bool is_index=false,bool warn=false){ + bool find_index(const std::string & current_dir,const std::string & file,multimap<std::string,std::string>&mtt,multimap<std::string,std::string>&mall,bool is_index=false,bool warn=false){ if (access(file.c_str(),R_OK)) - return; + return false; ifstream i(file.c_str()); // Skip navigation panel #ifdef VISUALC @@ -389,6 +389,57 @@ if (s=="<!--End of Navigation Panel-->") break; int t=s.size(); + if (t>24 && s.substr(t-24,24)=="<LI CLASS=\"li-indexenv\">"){ + // hevea file contains index + for (;i && !i.eof(); ){ + i.getline(buf,BUFFER_SIZE,'\n'); + s=buf; + t=s.size(); + if (t>29 && s.substr(0,29)=="</LI><LI CLASS=\"li-indexenv\">"){ + s=s.substr(29,s.size()-29); + t=s.size(); + if (!t || s[0]=='<') // skip index words with special color/font + continue; + int endcmd=s.find("<"); // position of end of commandname + if (endcmd>2 && endcmd<t){ + string cmdname=s.substr(0,endcmd-2); + s=s.substr(endcmd,t-endcmd); // s has all the links + vector<string> hrefs; + for (;;){ + t=s.size(); + endcmd=s.find("<A HREF=\""); + if (endcmd<0 || endcmd+9>=t) + break; + s=s.substr(endcmd+9,s.size()-endcmd-9); + t=s.size(); + endcmd=s.find("\""); + if (endcmd<0 || endcmd+2>=t) + break; + string link=s.substr(0,endcmd); + if (link[0]=='#') + link = file + link; + else + link = current_dir + link; + s=s.substr(endcmd+2,s.size()-endcmd-2); + t=s.size(); + if (t<3) + break; + if (s.substr(0,3)=="<B>") + hrefs.insert(hrefs.begin(),link); + else + hrefs.push_back(link); + } + vector<string>::const_iterator it=hrefs.begin(),itend=hrefs.end(); + for (;it!=itend;++it){ + if (it==hrefs.begin()) + mtt.insert(pair<string,string>(cmdname,*it)); + mall.insert(pair<string,string>(cmdname,*it)); + } + } // if (endcmd>2 && endcmd<t) + } // if (t>29 &&... + } // end of file + return true; + } if (t>14 && s.substr(t-14,14)=="Index</A></B> "){ // look in the corresponding index file instead int t1=s.find("HREF")+6; @@ -397,7 +448,7 @@ if (warn) cerr << "Using index " << s << endl; find_index(current_dir,current_dir+s,mtt,mall,true,warn); - return; + return true; } } } @@ -511,6 +562,7 @@ } } // end else is_index } + return false; } string subdir_strings[]={"cascmd","casgeo","casrouge","cassim","castor","tutoriel","casinter","casexo","cascas"}; @@ -604,22 +656,31 @@ int n; n = scandir (subdir.c_str(), &eps, dir_select, alphasort); if (n >= 0){ + bool index_done=false; int cnt; - for (cnt = 0; cnt < n; ++cnt){ - string s(eps[cnt]->d_name); + for (cnt = -1; cnt < n; ++cnt){ + string s; + if (cnt==-1) + s="index.html"; + else + s=eps[cnt]->d_name; s= subdir+s; #ifdef WIN32 int t=s.size(); if (s[t-1]=='\\') find_all_index(s+"/",mtt,mall); - else - find_index(subdir,s,mtt,mall); + else { + if (!index_done) + index_done=find_index(subdir,s,mtt,mall); + } #else - unsigned char type=eps[cnt]->d_type; + unsigned char type=cnt>=0?eps[cnt]->d_type:0; if (type==DT_DIR || equalposcomp(subdir_strings,s)) find_all_index(s+"/",mtt,mall); - else - find_index(subdir,s,mtt,mall); + else { + if (!index_done) + index_done=find_index(subdir,s,mtt,mall); + } #endif } } @@ -916,7 +977,7 @@ return res; } - static char otherchars[]="_.~\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"; + // static char otherchars[]="_.~\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"; bool isalphan(char ch){ if (ch>='0' && ch<='9') Modified: trunk/giac-xcas/giac/src/hist.cxx =================================================================== --- trunk/giac-xcas/giac/src/hist.cxx 2010-03-15 14:04:21 UTC (rev 775) +++ trunk/giac-xcas/giac/src/hist.cxx 2010-03-24 15:40:53 UTC (rev 776) @@ -1530,6 +1530,14 @@ xcas::History_cb_New_Equation(Xcas_current_session(),0); } +static void cb_Xcas_help_i(Fl_Menu_*, void*) { + int mode=giac::xcas_mode(Xcas_get_context()); if (mode==1 || mode==2) xcas::in_Xcas_input_char(xcas::Xcas_input_focus,"I",'I'); else xcas::in_Xcas_input_char(xcas::Xcas_input_focus,"i",'i'); +} + +static void cb_Xcas_help_e(Fl_Menu_*, void*) { + int mode=giac::xcas_mode(Xcas_get_context()); if (mode==1 || mode==2) xcas::in_Xcas_input_char(xcas::Xcas_input_focus,"exp(1)",'e'); else xcas::in_Xcas_input_char(xcas::Xcas_input_focus,"e",'e'); +} + static void cb_Xcas_Add_Program(Fl_Menu_*, void*) { xcas::History_cb_New_Program(Xcas_current_session(),0); } @@ -1884,7 +1892,11 @@ {gettext("New expression"), 0x80065, (Fl_Callback*)cb_Xcas_Add_Expression, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, {0,0,0,0,0,0,0,0,0}, {gettext("Cmds"), 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0}, + {gettext("Constants"), 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0}, + {gettext("i: sqrt(-1)"), 0, (Fl_Callback*)cb_Xcas_help_i, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, + {gettext("e: exp(1)"), 0, (Fl_Callback*)cb_Xcas_help_e, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, {0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0}, {gettext("Prg"), 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0}, {gettext("New program"), 0x80070, (Fl_Callback*)cb_Xcas_Add_Program, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, {gettext("debug: debug a program"), 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, Modified: trunk/giac-xcas/giac/src/hist.fl =================================================================== --- trunk/giac-xcas/giac/src/hist.fl 2010-03-15 14:04:21 UTC (rev 775) +++ trunk/giac-xcas/giac/src/hist.fl 2010-03-24 15:40:53 UTC (rev 776) @@ -967,7 +967,7 @@ } { Fl_Window Xcas_Main_Window_ { label {Xcas New Interface} open - xywh {332 226 775 615} type Single resizable visible + xywh {330 224 775 615} type Single resizable visible } { Fl_Menu_Bar Xcas_main_menu {open xywh {0 0 775 25} @@ -1697,10 +1697,8 @@ } { MenuItem Xcas_help_forum { label Forum - callback { - const giac::context * contextptr = xcas::get_context(xcas::Xcas_input_focus); - xcas::system_browser((giac::browser_command(giac::language(contextptr)==4?"http://www.inf.uth.gr/xcas/":"http://pcm1.e.ujf-grenoble.fr/XCAS")).c_str()); -} + callback {const giac::context * contextptr = xcas::get_context(xcas::Xcas_input_focus); + xcas::system_browser((giac::browser_command(giac::language(contextptr)==4?"http://www.inf.uth.gr/xcas/":"http://pcm1.e.ujf-grenoble.fr/XCAS")).c_str());} xywh {15 15 100 20} } MenuItem Xcas_help_connan { @@ -1867,19 +1865,19 @@ } { MenuItem Xcas_help_simplify { label {simplify: Simplify expression} - xywh {35 35 100 20} + xywh {35 35 100 20} } MenuItem Xcas_help_normal { label {normal: Simplify rational and algebraic expression} - xywh {35 35 100 20} + xywh {35 35 100 20} } MenuItem Xcas_help_ratnormal { label {ratnormal: Simplify rational expressions} - xywh {35 35 100 20} + xywh {35 35 100 20} } MenuItem Xcas_help_factor { label {factor: Factorization} - xywh {35 35 100 20} + xywh {35 35 100 20} } MenuItem Xcas_help_cfactor { label {cfactor: Factorization over C} @@ -2058,7 +2056,23 @@ Submenu Xcas_help_allcmds { label Cmds open xywh {85 85 100 20} - } {} + } { + Submenu Xcas_help_constants { + label Constants open + xywh {15 15 100 20} + } { + MenuItem Xcas_help_i { + label {i: sqrt(-1)} + callback {int mode=giac::xcas_mode(Xcas_get_context()); if (mode==1 || mode==2) xcas::in_Xcas_input_char(xcas::Xcas_input_focus,"I",'I'); else xcas::in_Xcas_input_char(xcas::Xcas_input_focus,"i",'i');} + xywh {35 35 100 20} + } + MenuItem Xcas_help_e { + label {e: exp(1)} + callback {int mode=giac::xcas_mode(Xcas_get_context()); if (mode==1 || mode==2) xcas::in_Xcas_input_char(xcas::Xcas_input_focus,"exp(1)",'e'); else xcas::in_Xcas_input_char(xcas::Xcas_input_focus,"e",'e');} selected + xywh {35 35 100 20} + } + } + } Submenu Xcas_help_prog { label Prg xywh {55 55 100 20} @@ -3217,7 +3231,7 @@ Fl_Group Xcas_Bandeau_Keys {open xywh {0 515 455 30} } { - Fl_Group Xcas_Bandeau_Keys_Group {selected + Fl_Group Xcas_Bandeau_Keys_Group { xywh {0 515 420 30} } { Fl_Button Xcas_PREV_Key { Modified: trunk/giac-xcas/giac/src/hist.h =================================================================== --- trunk/giac-xcas/giac/src/hist.h 2010-03-15 14:04:21 UTC (rev 775) +++ trunk/giac-xcas/giac/src/hist.h 2010-03-24 15:40:53 UTC (rev 776) @@ -414,48 +414,51 @@ #define Xcas_help_expression (menu_Xcas_main_menu+199) #define Xcas_Add_Expression (menu_Xcas_main_menu+200) #define Xcas_help_allcmds (menu_Xcas_main_menu+202) -#define Xcas_help_prog (menu_Xcas_main_menu+204) -#define Xcas_Add_Program (menu_Xcas_main_menu+205) -#define Xcas_help_debug (menu_Xcas_main_menu+206) -#define Xcas_help_graph (menu_Xcas_main_menu+208) -#define Xcas_help_attributs (menu_Xcas_main_menu+209) -#define Xcas_help_curves (menu_Xcas_main_menu+210) -#define Xcas_help_plot (menu_Xcas_main_menu+211) -#define Xcas_help_plotparam2d (menu_Xcas_main_menu+212) -#define Xcas_help_plotpolar (menu_Xcas_main_menu+213) -#define Xcas_help_plotarea (menu_Xcas_main_menu+214) -#define Xcas_help_plotimplicit (menu_Xcas_main_menu+215) -#define Xcas_help_plotcontour (menu_Xcas_main_menu+216) -#define Xcas_help_plotdensity (menu_Xcas_main_menu+217) -#define Xcas_help_graph_surfaces (menu_Xcas_main_menu+219) -#define Xcas_help_plot3d (menu_Xcas_main_menu+220) -#define Xcas_help_plotparam3d (menu_Xcas_main_menu+221) -#define Xcas_help_graph_suite (menu_Xcas_main_menu+223) -#define Xcas_help_plotseq (menu_Xcas_main_menu+224) -#define Xcas_help_plotlist (menu_Xcas_main_menu+225) -#define Xcas_help_graph_ode (menu_Xcas_main_menu+227) -#define Xcas_help_plotfield (menu_Xcas_main_menu+228) -#define Xcas_help_plotode (menu_Xcas_main_menu+229) -#define Xcas_help_iplotode (menu_Xcas_main_menu+230) -#define Xcas_help_graph_stats (menu_Xcas_main_menu+232) -#define Xcas_help_camembert (menu_Xcas_main_menu+233) -#define Xcas_help_histogram (menu_Xcas_main_menu+234) -#define Xcas_help_moustache (menu_Xcas_main_menu+235) -#define Xcas_help_scatterplot (menu_Xcas_main_menu+236) -#define Xcas_help_polygonscatterplot (menu_Xcas_main_menu+237) -#define Xcas_help_linear_regression_plot (menu_Xcas_main_menu+238) -#define Xcas_help_geo (menu_Xcas_main_menu+241) -#define Xcas_new_figure (menu_Xcas_main_menu+242) -#define Xcas_Add_Figure (menu_Xcas_main_menu+243) -#define Xcas_Add_Figure3d (menu_Xcas_main_menu+244) -#define Xcas_Add_Figurex (menu_Xcas_main_menu+245) -#define Xcas_Add_Figure3dx (menu_Xcas_main_menu+246) -#define Xcas_help_tableur (menu_Xcas_main_menu+249) -#define Xcas_Add_Tableur (menu_Xcas_main_menu+250) -#define Xcas_help_phys (menu_Xcas_main_menu+252) -#define Xcas_help_scolaire (menu_Xcas_main_menu+254) -#define Xcas_help_tortue (menu_Xcas_main_menu+256) -#define Xcas_Add_Logo (menu_Xcas_main_menu+257) +#define Xcas_help_constants (menu_Xcas_main_menu+203) +#define Xcas_help_i (menu_Xcas_main_menu+204) +#define Xcas_help_e (menu_Xcas_main_menu+205) +#define Xcas_help_prog (menu_Xcas_main_menu+208) +#define Xcas_Add_Program (menu_Xcas_main_menu+209) +#define Xcas_help_debug (menu_Xcas_main_menu+210) +#define Xcas_help_graph (menu_Xcas_main_menu+212) +#define Xcas_help_attributs (menu_Xcas_main_menu+213) +#define Xcas_help_curves (menu_Xcas_main_menu+214) +#define Xcas_help_plot (menu_Xcas_main_menu+215) +#define Xcas_help_plotparam2d (menu_Xcas_main_menu+216) +#define Xcas_help_plotpolar (menu_Xcas_main_menu+217) +#define Xcas_help_plotarea (menu_Xcas_main_menu+218) +#define Xcas_help_plotimplicit (menu_Xcas_main_menu+219) +#define Xcas_help_plotcontour (menu_Xcas_main_menu+220) +#define Xcas_help_plotdensity (menu_Xcas_main_menu+221) +#define Xcas_help_graph_surfaces (menu_Xcas_main_menu+223) +#define Xcas_help_plot3d (menu_Xcas_main_menu+224) +#define Xcas_help_plotparam3d (menu_Xcas_main_menu+225) +#define Xcas_help_graph_suite (menu_Xcas_main_menu+227) +#define Xcas_help_plotseq (menu_Xcas_main_menu+228) +#define Xcas_help_plotlist (menu_Xcas_main_menu+229) +#define Xcas_help_graph_ode (menu_Xcas_main_menu+231) +#define Xcas_help_plotfield (menu_Xcas_main_menu+232) +#define Xcas_help_plotode (menu_Xcas_main_menu+233) +#define Xcas_help_iplotode (menu_Xcas_main_menu+234) +#define Xcas_help_graph_stats (menu_Xcas_main_menu+236) +#define Xcas_help_camembert (menu_Xcas_main_menu+237) +#define Xcas_help_histogram (menu_Xcas_main_menu+238) +#define Xcas_help_moustache (menu_Xcas_main_menu+239) +#define Xcas_help_scatterplot (menu_Xcas_main_menu+240) +#define Xcas_help_polygonscatterplot (menu_Xcas_main_menu+241) +#define Xcas_help_linear_regression_plot (menu_Xcas_main_menu+242) +#define Xcas_help_geo (menu_Xcas_main_menu+245) +#define Xcas_new_figure (menu_Xcas_main_menu+246) +#define Xcas_Add_Figure (menu_Xcas_main_menu+247) +#define Xcas_Add_Figure3d (menu_Xcas_main_menu+248) +#define Xcas_Add_Figurex (menu_Xcas_main_menu+249) +#define Xcas_Add_Figure3dx (menu_Xcas_main_menu+250) +#define Xcas_help_tableur (menu_Xcas_main_menu+253) +#define Xcas_Add_Tableur (menu_Xcas_main_menu+254) +#define Xcas_help_phys (menu_Xcas_main_menu+256) +#define Xcas_help_scolaire (menu_Xcas_main_menu+258) +#define Xcas_help_tortue (menu_Xcas_main_menu+260) +#define Xcas_Add_Logo (menu_Xcas_main_menu+261) extern Fl_Menu_Item menu_Xcas_Level[]; #define Xcas_CAS_level (menu_Xcas_Level+0) #define Xcas_Prog_level (menu_Xcas_Level+1) Modified: trunk/giac-xcas/giac/src/intgab.cc =================================================================== --- trunk/giac-xcas/giac/src/intgab.cc 2010-03-15 14:04:21 UTC (rev 775) +++ trunk/giac-xcas/giac/src/intgab.cc 2010-03-24 15:40:53 UTC (rev 776) @@ -440,9 +440,9 @@ if (a==unsigned_inf || b==unsigned_inf) setsizeerr("Please use +infinity or -infinity since infinity is unsigned"); if (is_strictly_greater(a,b,contextptr)){ - bool b=intgab(g0,x,b,a,res,contextptr); + bool bo=intgab(g0,x,b,a,res,contextptr); res=-res; - return b; + return bo; } if (equalposcomp(lidnt(a),x) || equalposcomp(lidnt(b),x)) return false; @@ -928,6 +928,7 @@ } vecteur v=lvarx(g,*x._IDNTptr); v=lop(v,sincostan_v); + bool est_reel=testi?!has_i(g):true; if (!v.empty()){ gen w=trig2exp(v,contextptr); vecteur vexp; @@ -938,7 +939,7 @@ ++it; // it -> on the arg of the exp that must be linear gen axb=coeff*symbolic(at_exp,*it); ++it; - if (!sumab(axb,*x._IDNTptr,a_orig,b_orig,tmp,false,contextptr)){ + if (!sumab(axb,*x._IDNTptr,a_orig,b_orig,tmp,!est_reel,contextptr)){ return false; } res += tmp; @@ -948,7 +949,6 @@ v.clear(); polynome p,q,r; gen a(a_orig),b(b_orig); - bool est_reel=testi?!has_i(g):true; if (!est_reel){ bool b=complex_mode(contextptr); complex_mode(contextptr)=false; Modified: trunk/giac-xcas/giac/src/maple.cc =================================================================== --- trunk/giac-xcas/giac/src/maple.cc 2010-03-15 14:04:21 UTC (rev 775) +++ trunk/giac-xcas/giac/src/maple.cc 2010-03-24 15:40:53 UTC (rev 776) @@ -48,10 +48,6 @@ #include "lin.h" #include "derive.h" #include "ti89.h" -#ifdef HAVE_LIBFLTK -#include <FL/Fl_Image.H> -#include <FL/Fl_Shared_Image.H> -#endif #ifndef NO_NAMESPACE_GIAC namespace giac { @@ -1425,61 +1421,7 @@ unary_function_eval __writergb(&_writergb,_writergb_s); unary_function_ptr at_writergb (&__writergb,0,true); -#ifdef HAVE_LIBFLTK - bool readrgb(const string & s,int W,int H,gen & res){ - Fl_Image * image=Fl_Shared_Image::get(s.c_str()); - if (image && W && H) - image=image->copy(W,H); - if (!image || image->count()!=1) - return false; - const char * data = image->data()[0]; - unsigned ih=image->h(),iw=image->w(),id=image->d(); - gen tmpr=vecteur(ih),tmpg=vecteur(ih),tmpb=vecteur(ih),tmpa=vecteur(ih); - // alpha is returned before blue because red==1, green==2, blue==4 - res=gen(makevecteur(makevecteur(4,int(ih),int(iw)),tmpr,tmpg,tmpa,tmpb),_RGBA__VECT); - vecteur & vr=*tmpr._VECTptr; - vecteur & vg=*tmpg._VECTptr; - vecteur & vb=*tmpb._VECTptr; - vecteur & va=*tmpa._VECTptr; - unsigned l=0; - for (unsigned i=0;i<ih;++i){ - if (debug_infolevel) - cerr << "readrgb, reading row " << i << endl; - vr[i]=vecteur(iw); - vg[i]=vecteur(iw); - vb[i]=vecteur(iw); - va[i]=vecteur(iw,255); - vecteur & wr = *vr[i]._VECTptr; - vecteur & wg = *vg[i]._VECTptr; - vecteur & wb = *vb[i]._VECTptr; - vecteur & wa = *va[i]._VECTptr; - for (unsigned j=0;j<iw;++j){ - for (unsigned k=0;k<id;++k,++l){ - unsigned u=data[l] & 0xff; - switch(k){ - case 0: - wr[j]=int(u); - break; - case 1: - wg[j]=int(u); - break; - case 2: - wb[j]=int(u); - break; - case 3: - wa[j]=int(u); - break; - } - } - } - } - return true; - } -#else // HAVE_LIBFLTK - bool readrgb(const string & s,int W,int H,gen & res){ - return false; - } -#endif + bool (* readrgb_ptr)(const std::string & s,int W,int H,gen & res)=0; gen _readrgb(const gen & g,GIAC_CONTEXT){ vecteur v(gen2vecteur(g)); @@ -1487,10 +1429,12 @@ setsizeerr(); int s=v.size(); gen res; - bool ok= readrgb(*v[0]._STRNGptr, - ( (s>2 && v[1].type==_INT_) ?v[1].val:0), - ( (s>2 && v[2].type==_INT_) ?v[2].val:0), - res); + bool ok= false; + if (readrgb_ptr) + ok = readrgb_ptr(*v[0]._STRNGptr, + ( (s>2 && v[1].type==_INT_) ?v[1].val:0), + ( (s>2 && v[2].type==_INT_) ?v[2].val:0), + res); if (!ok) setsizeerr("File not found or unrecognized image file format"); return res; Modified: trunk/giac-xcas/giac/src/maple.h =================================================================== --- trunk/giac-xcas/giac/src/maple.h 2010-03-15 14:04:21 UTC (rev 775) +++ trunk/giac-xcas/giac/src/maple.h 2010-03-24 15:40:53 UTC (rev 776) @@ -50,6 +50,8 @@ #ifdef HAVE_LIBPNG int write_png(const char *file_name, png_bytep *rows, int w, int h, int colortype, int bitdepth); #endif + extern bool (* readrgb_ptr)(const std::string & s,int W,int H,gen & res); + #ifndef NO_NAMESPACE_GIAC } // namespace giac Modified: trunk/giac-xcas/giac/src/plot.cc =================================================================== --- trunk/giac-xcas/giac/src/plot.cc 2010-03-15 14:04:21 UTC (rev 775) +++ trunk/giac-xcas/giac/src/plot.cc 2010-03-24 15:40:53 UTC (rev 776) @@ -2784,8 +2784,11 @@ int s=read_attributs(v,attributs,contextptr); // find diametre gen e=eval(v.front(),contextptr),diametre; - if (s==1) + if (s==1){ + v.front()=e; + e=gen(v,_SEQ__VECT); return _plotimplicit(e,contextptr); + } int narg=0; if ( (e.type==_SYMB) && (e._SYMBptr->sommet==at_pnt)){ gen f=e._SYMBptr->feuille._VECTptr->front(); @@ -9278,6 +9281,8 @@ vecteur v(*args._VECTptr); if (v.size()<2) setsizeerr(); + if (v[1].is_symb_of_sommet(at_equal) && v[1]._SYMBptr->feuille._VECTptr->front()==at_display) + v.insert(v.begin()+1,makevecteur(x__IDNT_e,y__IDNT_e)); if ( v[1].type==_VECT) { if (v[1]._VECTptr->size()==2 ){ v.insert(v.begin()+2,v[1]._VECTptr->back()); @@ -10966,28 +10971,31 @@ //renvoie un point (resp une droite) pole (resp polaire) de D/ cercle C //parametre C (ou param du cercle C), droite D (resp point D) gen _polaire_reciproque(const gen & args,GIAC_CONTEXT){ - gen a; - if (args.type==_VECT && !args._VECTptr->empty()) { - a=args._VECTptr->back(); - if (a.type==_VECT){ - const vecteur & v=*a._VECTptr; - const_iterateur it=v.begin(),itend=v.end(); - vecteur argsbegin(*args._VECTptr),res; - int s=argsbegin.size(); - res.reserve(s); - for (--s;it!=itend;++it){ - argsbegin[s]=*it; - res.push_back(_polaire_reciproque(argsbegin,contextptr)); - } - return gen(res,a.subtype); + vecteur w(gen2vecteur(args)); + vecteur attributs(1,default_color(contextptr)); + int s=read_attributs(w,attributs,contextptr); + if (w.empty() || s!=2) + setsizeerr("reciprocation"); + gen c=w[0],a=w[1]; + if (a.type==_VECT){ + const vecteur v=*a._VECTptr; + const_iterateur it=v.begin(),itend=v.end(); + vecteur res; + for (;it!=itend;++it){ + a=*it; + a=remove_at_pnt(a); + if (a.type==_VECT) + res.push_back(put_attributs(_pole(gen(makevecteur(c,a),_SEQ__VECT),contextptr),attributs,contextptr)); + else + res.push_back(put_attributs(_polaire(gen(makevecteur(c,a),_SEQ__VECT),contextptr),attributs,contextptr)); } - a=remove_at_pnt(a); - if (a.type==_VECT) - return _pole(args,contextptr); - return _polaire(args,contextptr); + return gen(res,a.subtype); } - return symbolic(at_polaire_reciproque,args); - } + a=remove_at_pnt(a); + if (a.type==_VECT) + return put_attributs(_pole(gen(makevecteur(c,a),_SEQ__VECT),contextptr),attributs,contextptr); + return put_attributs(_polaire(gen(makevecteur(c,a),_SEQ__VECT),contextptr),attributs,contextptr); + } const string _polaire_reciproque_s("reciprocation"); unary_function_eval __polaire_reciproque(&giac::_polaire_reciproque,_polaire_reciproque_s); unary_function_ptr at_polaire_reciproque (&__polaire_reciproque,0,true); @@ -11607,9 +11615,9 @@ unary_function_ptr notexprint_plot_sommets[]={at_funcplot,at_paramplot,at_polarplot,at_implicitplot,at_contourplot,at_odeplot,at_interactive_odeplot,at_fieldplot,at_seqplot,at_ellipse,at_hyperbole,at_parabole,0}; unary_function_ptr implicittex_plot_sommets[]={at_plot,at_plot3d,at_plotfunc,at_plotparam,at_plotpolar,at_plotimplicit,at_plotcontour,at_DrawInv,at_DrawFunc,at_DrawParm,at_DrawPol,at_DrwCtour,at_plotode,at_plotfield,at_interactive_plotode,at_plotseq,at_Graph,0}; unary_function_ptr point_sommet_tab_op[]={at_point,at_element,at_inter_unique,at_centre,at_isobarycentre,at_barycentre,0}; - unary_function_ptr nosplit_polygon_function[]={at_inter_unique,at_inter,at_distanceatraw,at_distanceat,at_rotation,at_projection,at_symetrie,at_areaat,at_areaatraw,at_perimeterat,at_perimeteratraw,at_slopeat,at_slopeatraw,at_tangent,at_cercle,0}; + unary_function_ptr nosplit_polygon_function[]={at_inter_unique,at_inter,at_distanceatraw,at_distanceat,at_rotation,at_projection,at_symetrie,at_polaire_reciproque,at_areaat,at_areaatraw,at_perimeterat,at_perimeteratraw,at_slopeat,at_slopeatraw,at_tangent,at_cercle,0}; unary_function_ptr measure_functions[]={at_angleat,at_angleatraw,at_areaat,at_areaatraw,at_perimeterat,at_perimeteratraw,at_slopeat,at_slopeatraw,at_distanceat,at_distanceatraw,0}; - unary_function_ptr transformation_functions[]={at_projection,at_rotation,at_translation,at_homothetie,at_similitude,at_inversion,at_symetrie,0}; + unary_function_ptr transformation_functions[]={at_projection,at_rotation,at_translation,at_homothetie,at_similitude,at_inversion,at_symetrie,at_polaire_reciproque,0}; #ifndef NO_NAMESPACE_GIAC } // namespace giac Modified: trunk/giac-xcas/giac/src/prog.cc =================================================================== --- trunk/giac-xcas/giac/src/prog.cc 2010-03-15 14:04:21 UTC (rev 775) +++ trunk/giac-xcas/giac/src/prog.cc 2010-03-24 15:40:53 UTC (rev 776) @@ -2727,10 +2727,25 @@ vecteur attributs(1,default_color(contextptr)); vecteur v(seq2vecteur(args)); int s=read_attributs(v,attributs,contextptr); - if (s!=2) + if (s!=2 && s!=3) setdimerr(); gen a=v[0],b=v[1]; - a=gen(inter(a,b,contextptr),_GROUP__VECT); + vecteur w=inter(a,b,contextptr); + if (s==3 && !w.empty()){ + int ws=w.size(); + a=w[0]; + gen c=v[2]; + gen d=distance2pp(a,c,contextptr); + for (int i=1;i<ws;++i){ + gen dcur=distance2pp(w[i],c,contextptr); + if (is_strictly_greater(d,dcur,contextptr)){ + d=dcur; + a=w[i]; + } + } + } + else + a=gen(w,_GROUP__VECT); return put_attributs(a,attributs,contextptr); } const string _inter_s("inter"); Modified: trunk/giac-xcas/giac/src/rpn.cc =================================================================== --- trunk/giac-xcas/giac/src/rpn.cc 2010-03-15 14:04:21 UTC (rev 775) +++ trunk/giac-xcas/giac/src/rpn.cc 2010-03-24 15:40:53 UTC (rev 776) @@ -30,6 +30,7 @@ #ifdef HAVE_UNISTD_H #include <unistd.h> #include <dirent.h> +#include <pwd.h> #endif #include "input_lexer.h" #include "plot.h" Modified: trunk/giac-xcas/giac/src/threaded.cc =================================================================== --- trunk/giac-xcas/giac/src/threaded.cc 2010-03-15 14:04:21 UTC (rev 775) +++ trunk/giac-xcas/giac/src/threaded.cc 2010-03-24 15:40:53 UTC (rev 776) @@ -3411,6 +3411,69 @@ DivRem(tmp,pmin,modulo,q,res); } + gen mulextaux2(const gen & a,const gen & b,int modulo){ + // FIXME fractions + gen res= a*b; + if (res.type!=_FRAC) + return res; + gen n=res._FRACptr->num,d=res._FRACptr->den; + if (n.type!=_POLY) + return res; + if (d.type==_INT_) + return invmod(d.val,modulo)*n; + if (d.type!=_POLY) + return res; + polynome np=*n._POLYptr,dp=*d._POLYptr,tmp,quo,rem; + tmp=gcdmod(np,dp,modulo); + divremmod(np,tmp,modulo,quo,rem); + np=quo; + divremmod(dp,tmp,modulo,quo,rem); + dp=quo; + if (is_one(dp)) + return np; + return fraction(np,dp); + } + + void mulextaux(const modpoly & a,const modpoly &b,int modulo,modpoly & new_coord){ + control_c(); + modpoly::const_iterator ita=a.begin(),ita_end=a.end(),itb=b.begin(),itb_end=b.end(); + new_coord.clear(); + ita=a.begin(); itb=b.begin(); + if (ita==ita_end || itb==itb_end) + return; + modpoly::const_iterator ita_begin=ita; + for ( ; ita!=ita_end; ++ita ){ + modpoly::const_iterator ita_cur=ita,itb_cur=itb; + gen res; + for (;;) { + res += mulextaux2(*ita_cur,*itb_cur,modulo); // res = res + (*ita_cur) * (*itb_cur); + if (ita_cur==ita_begin) + break; + --ita_cur; + ++itb_cur; + if (itb_cur==itb_end) + break; + } + new_coord.push_back(res); + } + --ita; + ++itb; + for ( ; itb!=itb_end;++itb){ + modpoly::const_iterator ita_cur=ita,itb_cur=itb; + gen res; + for (;;) { + res += mulextaux2(*ita_cur,*itb_cur,modulo); // res = res + (*ita_cur) * (*itb_cur); + if (ita_cur==ita_begin) + break; + --ita_cur; + ++itb_cur; + if (itb_cur==itb_end) + break; + } + new_coord.push_back(res); + } + } + void mulext(const vecteur & a,const vecteur & b,const vecteur & pmin,int modulo,vecteur & res){ if (b.empty()){ res.clear(); @@ -3424,7 +3487,8 @@ environment env; env.modulo=modulo; env.moduloon=true; - operator_times(a,b,0,tmp); + mulextaux(a,b,modulo,tmp); + // operator_times(a,b,0,tmp); // bug if a and b contains fraction DivRem(tmp,pmin,&env,q,res); } @@ -3835,13 +3899,22 @@ } // clear deno gen den(ppcm,_POLY1__VECT); + environment env; + env.modulo=modulo; + env.moduloon=true; if (ppcm.size()>1){ gen adjust=invmod(ppcm.front(),modulo); for (kt=p.begin();kt!=ktend;++kt){ iterateur it=kt->g.begin(),itend=kt->g.end(); for (;it!=itend;++it){ - if (it->type==_FRAC) - *it = smod(adjust*(it->_FRACptr->num * (den / (it->_FRACptr->den))),modulo); + if (it->type==_FRAC){ + if (it->_FRACptr->den.type!=_VECT) + setsizeerr(); + modpoly quot,rest; + if (!DivRem(ppcm,*it->_FRACptr->den._VECTptr,&env,quot,rest,false) || !rest.empty()) + setsizeerr(); + *it = smod(adjust*(it->_FRACptr->num * gen(quot,_POLY1__VECT)),modulo); + } else { if (it->type==_POLY){ vector< monomial<gen> >::iterator jt=it->_POLYptr->coord.begin(),jtend=it->_POLYptr->coord.end(); @@ -4111,7 +4184,7 @@ map<pair<hashgcd_U,index_t>,ext_gcd_t> m; // index is obtained by taking lcoeff with respect to outer var // (hashgcd_U) and inner var (index_t) - vector< T_unsigned<vecteur,hashgcd_U> > p0tk,q0tk,dtk,pcoftk,qcoftk,nouveau,test,tmprem; + vector< T_unsigned<vecteur,hashgcd_U> > p0tk,q0tk,dtk,pcoftk,qcoftk,nouveau,test,prevtest,tmprem; for (;;){ int tk=giac_rand(context0) % modulo; gen pmintk; @@ -4188,12 +4261,19 @@ // ?CHECK? clean lcoeff so that it is 1 wrt extension variable z // trial division, if success return 1 else continue // ?FIXME? use pseudo-division test - if (hashdivrem(p0,test,Pcof,tmprem,vars,pminmodulo,0,true)==1 && tmprem.empty()){ + if (debug_infolevel) + cerr << clock() << " algmodgcd hashdivrem" << endl; + if (test==prevtest && hashdivrem(p0,test,Pcof,tmprem,vars,pminmodulo,0,true)==1 && tmprem.empty()){ if (hashdivrem(q0,test,Qcof,tmprem,vars,pminmodulo,0,true)==1 && tmprem.empty()){ + if (debug_infolevel) + cerr << clock() << " algmodgcd hashdivrem sucess" << endl; D=test; return 1; } } + prevtest=test; + if (debug_infolevel) + cerr << clock() << " algmodgcd hashdivrem failure" << endl; } } // end extension.type==_POLY int dim=vars.size(); @@ -5286,6 +5366,7 @@ } } // begin loop on modulo + vector< T_unsigned<gen,hashgcd_U> > dtestold; for (int n=0;;n++){ m=nextprime(m+1); if (m.type!=_INT_) @@ -5396,7 +5477,9 @@ return true; } } - if (hashdivrem(p_orig,dtest,pquo,rem,vars,0 /* reduce */,0/*qmax*/,true)==1 && rem.empty()){ + // This division might take a very long time if not successfull + // Make it only when we are sure (might be improved) + if (dtest==dtestold && hashdivrem(p_orig,dtest,pquo,rem,vars,0 /* reduce */,0/*qmax*/,true)==1 && rem.empty()){ if (hashdivrem(q_orig,dtest,qquo,rem,vars,0 /* reduce */,0/*qmax*/,true)==1 && rem.empty()){ swap(pcofactor,pquo); swap(qcofactor,qquo); @@ -5404,7 +5487,7 @@ return true; } } - + dtestold=dtest; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2010-03-15 14:04:34
|
Revision: 775 http://xcas.svn.sourceforge.net/xcas/?rev=775&view=rev Author: parisse Date: 2010-03-15 14:04:21 +0000 (Mon, 15 Mar 2010) Log Message: ----------- Modified Paths: -------------- trunk/giac-xcas/giac/src/Graph.cc trunk/giac-xcas/giac/src/plot.cc trunk/giac-xcas/giac/src/plot.h trunk/giac-xcas/giac/src/subst.cc trunk/giac-xcas/giac/src/threaded.cc Modified: trunk/giac-xcas/giac/src/Graph.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph.cc 2010-03-12 10:30:24 UTC (rev 774) +++ trunk/giac-xcas/giac/src/Graph.cc 2010-03-15 14:04:21 UTC (rev 775) @@ -3057,7 +3057,7 @@ round3(newy,window_ymin,window_ymax); if (gr3d) round3(newz,window_zmin,window_zmax); - tmp=geometry_round(newx,newy,newz,eps,tmp2,pos,mode==0); + tmp=geometry_round(newx,newy,newz,eps,tmp2,pos,mode==0 || (args_tmp.size()==mode && function_final.type==_FUNC && equalposcomp(transformation_functions,*function_final._FUNCptr))); if (tmp.type==_VECT && tmp._VECTptr->size()==3){ tmp.subtype=_SEQ__VECT; tmp=symbolic(at_point,tmp); @@ -3363,7 +3363,23 @@ objname=gen(autoname(hp->contextptr),hp->contextptr); } } - tmp_plot=symbolic(*ptr,gen( (*ptr==(gr3d?at_sphere:at_cercle) && !args_tmp.back().is_symb_of_sommet(at_extract_measure)) ?makevecteur(args_tmp.front(),args_tmp.back()-args_tmp.front()):args_tmp,_SEQ__VECT)); + vecteur argv=args_tmp; + if (*ptr==(gr3d?at_sphere:at_cercle)){ + gen argv1; + try { + argv1=evalf(args_tmp.back(),1,contextptr); + argv1=evalf_double(argv1,1,contextptr); + } + catch (std::runtime_error & e){ + argv1=undef; + } + if (argv1.is_symb_of_sommet(at_pnt) ||argv1.type==_IDNT){ + argv1=remove_at_pnt(argv1); + if ( (argv1.type==_VECT && argv1.subtype==_POINT__VECT) || argv1.type==_CPLX || argv1.type==_IDNT) + argv.back()=args_tmp.back()-args_tmp.front(); + } + } + tmp_plot=symbolic(*ptr,gen(argv,_SEQ__VECT)); try { res=evalf(tmp_plot,1,hp->contextptr); } @@ -3381,15 +3397,35 @@ vecteur l; if (res._VECTptr->back()==res._VECTptr->front()) --ns; - if (ns>=mode) - ns=mode; - for (int i=1;i<=ns;++i){ - tmp_plot=symbolic(at_segment,makevecteur(args_tmp[i-1],args_tmp[i%ns])); - hp->set_gen_value(hp_pos,symbolic(at_sto,makevecteur(add_attributs(tmp_plot,couleur),gen(autoname(hp->contextptr)+print_INT_(ns+i),hp->contextptr))),false); - hp->add_entry(hp_pos+1); - ++hp_pos; + if (function_final.type==_FUNC && equalposcomp(transformation_functions,*function_final._FUNCptr)){ + vecteur argv; + gen objn,som=symbolic(at_sommets,objname); + for (int i=1;i<=ns;++i){ + tmp_plot=symbolic(at_at,gen(makevecteur(som,i-1),_SEQ__VECT)); + objn=gen(autoname(hp->contextptr)+print_INT_(i),hp->contextptr); + argv.push_back(objn); + hp->set_gen_value(hp_pos,symbolic(at_sto,gen(makevecteur(tmp_plot,objn),_SEQ__VECT)),false); + hp->add_entry(hp_pos+1); + ++hp_pos; + } + for (int i=1;i<=ns;++i){ + tmp_plot=symbolic(at_segment,makevecteur(argv[i-1],argv[i%ns])); + hp->set_gen_value(hp_pos,symbolic(at_sto,makevecteur(add_attributs(tmp_plot,couleur),gen(autoname(hp->contextptr)+print_INT_(ns+i),hp->contextptr))),false); + hp->add_entry(hp_pos+1); + ++hp_pos; + } } - } + else { + if (ns>=mode) + ns=mode; + for (int i=1;i<=ns;++i){ + tmp_plot=symbolic(at_segment,makevecteur(args_tmp[i-1],args_tmp[i%ns])); + hp->set_gen_value(hp_pos,symbolic(at_sto,makevecteur(add_attributs(tmp_plot,couleur),gen(autoname(hp->contextptr)+print_INT_(ns+i),hp->contextptr))),false); + hp->add_entry(hp_pos+1); + ++hp_pos; + } + } + } // if res.type==_VECT } autoname_plus_plus(); hp->update(pos0); @@ -4495,8 +4531,21 @@ if (function.type==_FUNC){ bool dim2=dynamic_cast<Graph2d *>(this); vecteur args2=args_tmp; - if ( *function._FUNCptr==(dim2?at_cercle:at_sphere) && !args_tmp.back().is_symb_of_sommet(at_extract_measure)) - args2=makevecteur(args_tmp.front(),args_tmp.back()-args_tmp.front()); + if ( *function._FUNCptr==(dim2?at_cercle:at_sphere)){ + gen argv1; + try { + argv1=evalf(args_tmp.back(),1,contextptr); + argv1=evalf_double(argv1,1,contextptr); + } + catch (std::runtime_error & e){ + argv1=undef; + } + if (argv1.is_symb_of_sommet(at_pnt) ||argv1.type==_IDNT){ + argv1=remove_at_pnt(argv1); + if ( (argv1.type==_VECT && argv1.subtype==_POINT__VECT) || argv1.type==_CPLX || argv1.type==_IDNT) + args2.back()=args_tmp.back()-args_tmp.front(); + } + } if (function==at_ellipse) ; title_tmp=gen(args2,_SEQ__VECT); @@ -5748,6 +5797,10 @@ cb_set_mode(m,at_segment,at_inter,2,gettext("Curve1,Curve2")); } + static void cb_Tangent(Fl_Widget * m , void*) { + cb_set_mode(m,at_segment,at_tangent,2,gettext("Curve,Point")); + } + static void cb_Segment(Fl_Widget * m , void*) { cb_set_mode(m,0,at_point,1,gettext("Segment")); } @@ -5987,16 +6040,16 @@ {gettext("sphere"), 0, (Fl_Callback *) cb_sphere, 0, 0, 0, 0, 14, 56}, {0}, // end Surfaces {gettext("Measures"), 0, 0, 0, 64, 0, 0, 14, 56}, - {gettext("distance"), 0, (Fl_Callback *) cb_DistanceAB, 0, 0, 0, 0, 14, 56}, - {gettext("angle"), 0, (Fl_Callback *) cb_AngleABC, 0, 0, 0, 0, 14, 56}, - {gettext("area"), 0, (Fl_Callback *) cb_Area, 0, 0, 0, 0, 14, 56}, - {gettext("perimeter"), 0, (Fl_Callback *) cb_Perimeter, 0, 0, 0, 0, 14, 56}, - {gettext("slope"), 0, (Fl_Callback *) cb_Slope, 0, 0, 0, 0, 14, 56}, - {gettext("distance (raw)"), 0, (Fl_Callback *) cb_DistanceABraw, 0, 0, 0, 0, 14, 56}, - {gettext("angle (raw)"), 0, (Fl_Callback *) cb_AngleABCraw, 0, 0, 0, 0, 14, 56}, - {gettext("area (raw)"), 0, (Fl_Callback *) cb_Arearaw, 0, 0, 0, 0, 14, 56}, - {gettext("perimeter (raw)"), 0, (Fl_Callback *) cb_Perimeterraw, 0, 0, 0, 0, 14, 56}, - {gettext("slope (raw)"), 0, (Fl_Callback *) cb_Sloperaw, 0, 0, 0, 0, 14, 56}, + {gettext("distanceat"), 0, (Fl_Callback *) cb_DistanceAB, 0, 0, 0, 0, 14, 56}, + {gettext("angleat"), 0, (Fl_Callback *) cb_AngleABC, 0, 0, 0, 0, 14, 56}, + {gettext("areaat"), 0, (Fl_Callback *) cb_Area, 0, 0, 0, 0, 14, 56}, + {gettext("perimeterat"), 0, (Fl_Callback *) cb_Perimeter, 0, 0, 0, 0, 14, 56}, + {gettext("slopeat"), 0, (Fl_Callback *) cb_Slope, 0, 0, 0, 0, 14, 56}, + {gettext("distanceatraw"), 0, (Fl_Callback *) cb_DistanceABraw, 0, 0, 0, 0, 14, 56}, + {gettext("angleatraw"), 0, (Fl_Callback *) cb_AngleABCraw, 0, 0, 0, 0, 14, 56}, + {gettext("areaatraw"), 0, (Fl_Callback *) cb_Arearaw, 0, 0, 0, 0, 14, 56}, + {gettext("perimeteratraw"), 0, (Fl_Callback *) cb_Perimeterraw, 0, 0, 0, 0, 14, 56}, + {gettext("slopeatraw"), 0, (Fl_Callback *) cb_Sloperaw, 0, 0, 0, 0, 14, 56}, {0}, // end measures {gettext("Transformations"), 0, 0, 0, 64, 0, 0, 14, 56}, {gettext("reflection"), 0, (Fl_Callback *) cb_Symetrie, 0, 0, 0, 0, 14, 56}, @@ -6007,8 +6060,11 @@ {gettext("similarity"), 0, (Fl_Callback *) cb_Similitude, 0, 0, 0, 0, 14, 56}, {gettext("inversion"), 0, (Fl_Callback *) cb_Inversion, 0, 0, 0, 0, 14, 56}, {0}, // end transformations - {gettext("Intersection"), 0, (Fl_Callback *) cb_Inter_Unique, 0, 0, 0, 0, 14, 56}, - {gettext("Intersection list"), 0, (Fl_Callback *) cb_Inter, 0, 0, 0, 0, 14, 56}, + {gettext("Intersections"), 0, 0, 0, 64, 0, 0, 14, 56}, + {gettext("inter_unique (1 point)"), 0, (Fl_Callback *) cb_Inter_Unique, 0, 0, 0, 0, 14, 56}, + {gettext("inter (list of points)"), 0, (Fl_Callback *) cb_Inter, 0, 0, 0, 0, 14, 56}, + {0}, // end intersections + {gettext("tangent"), 0, (Fl_Callback *) cb_Tangent, 0, 0, 0, 0, 14, 56}, {gettext("Exact"), 0, (Fl_Callback *) cb_Exact, 0, 0, 0, 0, 14, 56}, {gettext("Approx"), 0, (Fl_Callback *) cb_Approx, 0, 0, 0, 0, 14, 56}, {0}, // end Menu Modified: trunk/giac-xcas/giac/src/plot.cc =================================================================== --- trunk/giac-xcas/giac/src/plot.cc 2010-03-12 10:30:24 UTC (rev 774) +++ trunk/giac-xcas/giac/src/plot.cc 2010-03-15 14:04:21 UTC (rev 775) @@ -2807,8 +2807,18 @@ gen f=eval(v[1],contextptr); if ((f.type==_SYMB) && (f._SYMBptr->sommet==at_pnt)){ gen g=remove_at_pnt(f); - g=get_point(g,0,contextptr); - diametre=gen(makevecteur(e,g),_GROUP__VECT); + if (g.type==_VECT && g._VECTptr->size()==2){ + // e=center, g=line, project e on g + gen g1=g._VECTptr->front(); + gen g2=g._VECTptr->back(); + gen t=projection(g1,g2,e,contextptr); + g=g1+t*(g2-g1); // this is the projection + diametre=gen(makevecteur(e+(e-g),g),_GROUP__VECT); + } + else { + g=get_point(g,0,contextptr); + diametre=gen(makevecteur(e,g),_GROUP__VECT); + } } else { while (f.type==_VECT){ @@ -4274,7 +4284,7 @@ t=projection(a,b,c,contextptr); gen pr=t*b+(1-t)*a; // projection of the center c gen d2=abs_norm2(pr-c,contextptr); - gen r2=r*r; + gen r2=r*conj(r,contextptr); if (is_strictly_greater(d2,r2,contextptr)) return pow(sqrt(d2,contextptr)-sqrt(r2,contextptr),2); return 0; @@ -4379,7 +4389,7 @@ else res += im(cote2,contextptr)*re(cote1,contextptr)-re(cote2,contextptr)*im(cote1,contextptr); } - return res/2; + return recursive_normal(res/2,contextptr); } const string _aire_s("area"); unary_function_eval __aire(&giac::_aire,_aire_s); @@ -7647,9 +7657,10 @@ } if (v[i].is_symb_of_sommet(at_equal)){ gen & f = v[i]._SYMBptr->feuille; - if (f.type==_VECT && f._VECTptr->size()==2 && f._VECTptr->back().type==_INT_){ - if (f._VECTptr->front()==at_couleur || f._VECTptr->front()==at_display){ - couleur |= f._VECTptr->back().val; + if (f.type==_VECT && f._VECTptr->size()==2){ + gen f2=evalf_double(f._VECTptr->back(),1,contextptr); + if ( f2.type==_DOUBLE_ && (f._VECTptr->front()==at_couleur || f._VECTptr->front()==at_display)){ + couleur |= int(f2._DOUBLE_val); continue; } } @@ -7750,11 +7761,8 @@ gen l=_aire(eval(v[0],eval_level(contextptr),contextptr),contextptr); int save_digits=decimal_digits(contextptr); decimal_digits(contextptr)=3; -#ifdef WIN32 string ss="a"+v[0].print(contextptr)+"="+l.print(contextptr)+" "; -#else - string ss="◼"+v[0].print(contextptr)+"="+l.print(contextptr)+" "; -#endif + // string ss="◼"+v[0].print(contextptr)+"="+l.print(contextptr)+" "; decimal_digits(contextptr)=save_digits; l=gen('"'+ss+'"',false); vecteur w=makevecteur(v[1],l); @@ -7793,7 +7801,8 @@ gen l=_slope(eval(v[0],eval_level(contextptr),contextptr),contextptr); int save_digits=decimal_digits(contextptr); decimal_digits(contextptr)=3; - string ss="∡"+v[0].print(contextptr)+"="+l.print(contextptr)+" "; + // string ss="∡"+v[0].print(contextptr)+"="+l.print(contextptr)+" "; + string ss="s"+v[0].print(contextptr)+"="+l.print(contextptr)+" "; decimal_digits(contextptr)=save_digits; l=gen('"'+ss+'"',false); vecteur w=makevecteur(v[1],l); @@ -7815,11 +7824,8 @@ gen l=_perimetre(eval(v[0],eval_level(contextptr),contextptr),contextptr); int save_digits=decimal_digits(contextptr); decimal_digits(contextptr)=3; -#ifdef WIN32 string ss="p"+v[0].print(contextptr)+"="+l.print(contextptr)+" "; -#else - string ss="◻"+v[0].print(contextptr)+"="+l.print(contextptr)+" "; -#endif + // string ss="◻"+v[0].print(contextptr)+"="+l.print(contextptr)+" "; decimal_digits(contextptr)=save_digits; l=gen('"'+ss+'"',false); vecteur w=makevecteur(v[1],l); @@ -7883,7 +7889,8 @@ gen l=_angle(gen(makevecteur(eval(v[0],eval_level(contextptr),contextptr),eval(v[1],eval_level(contextptr),contextptr),eval(v[2],eval_level(contextptr),contextptr)),_SEQ__VECT),contextptr); int save_digits=decimal_digits(contextptr); decimal_digits(contextptr)=3; - string ss="∡"+v[0].print(contextptr)+"="+l.print(contextptr)+" "; + string ss="α"+v[0].print(contextptr)+"="+l.print(contextptr)+" "; + // string ss="∡"+v[0].print(contextptr)+"="+l.print(contextptr)+" "; decimal_digits(contextptr)=save_digits; l=gen('"'+ss+'"',false); vecteur w=makevecteur(v[3],l); @@ -11600,10 +11607,10 @@ unary_function_ptr notexprint_plot_sommets[]={at_funcplot,at_paramplot,at_polarplot,at_implicitplot,at_contourplot,at_odeplot,at_interactive_odeplot,at_fieldplot,at_seqplot,at_ellipse,at_hyperbole,at_parabole,0}; unary_function_ptr implicittex_plot_sommets[]={at_plot,at_plot3d,at_plotfunc,at_plotparam,at_plotpolar,at_plotimplicit,at_plotcontour,at_DrawInv,at_DrawFunc,at_DrawParm,at_DrawPol,at_DrwCtour,at_plotode,at_plotfield,at_interactive_plotode,at_plotseq,at_Graph,0}; unary_function_ptr point_sommet_tab_op[]={at_point,at_element,at_inter_unique,at_centre,at_isobarycentre,at_barycentre,0}; - unary_function_ptr nosplit_polygon_function[]={at_inter_unique,at_rotation,at_projection,at_symetrie,at_areaat,at_areaatraw,at_perimeterat,at_perimeteratraw,at_slopeat,at_slopeatraw,0}; + unary_function_ptr nosplit_polygon_function[]={at_inter_unique,at_inter,at_distanceatraw,at_distanceat,at_rotation,at_projection,at_symetrie,at_areaat,at_areaatraw,at_perimeterat,at_perimeteratraw,at_slopeat,at_slopeatraw,at_tangent,at_cercle,0}; unary_function_ptr measure_functions[]={at_angleat,at_angleatraw,at_areaat,at_areaatraw,at_perimeterat,at_perimeteratraw,at_slopeat,at_slopeatraw,at_distanceat,at_distanceatraw,0}; + unary_function_ptr transformation_functions[]={at_projection,at_rotation,at_translation,at_homothetie,at_similitude,at_inversion,at_symetrie,0}; - #ifndef NO_NAMESPACE_GIAC } // namespace giac #endif // ndef NO_NAMESPACE_GIAC Modified: trunk/giac-xcas/giac/src/plot.h =================================================================== --- trunk/giac-xcas/giac/src/plot.h 2010-03-12 10:30:24 UTC (rev 774) +++ trunk/giac-xcas/giac/src/plot.h 2010-03-15 14:04:21 UTC (rev 775) @@ -761,6 +761,7 @@ extern unary_function_ptr point_sommet_tab_op[]; extern unary_function_ptr nosplit_polygon_function[]; extern unary_function_ptr measure_functions[]; + extern unary_function_ptr transformation_functions[]; /* following obsolete declaration that will be remove in the future when all fork/child etc. will be removed */ extern vecteur plot_instructions; Modified: trunk/giac-xcas/giac/src/subst.cc =================================================================== --- trunk/giac-xcas/giac/src/subst.cc 2010-03-12 10:30:24 UTC (rev 774) +++ trunk/giac-xcas/giac/src/subst.cc 2010-03-15 14:04:21 UTC (rev 775) @@ -792,7 +792,7 @@ } // tan(x+pi/2)=-1/tan(x) gen shift_tan(const gen & x,GIAC_CONTEXT){ - return plus_one/symb_tan(ratnormal(x+cst_pi_over_2)); + return minus_one/symb_tan(ratnormal(x+cst_pi_over_2)); } gen shift_phase(const gen & e,GIAC_CONTEXT){ vector< gen_op_context > shift_phase_v; Modified: trunk/giac-xcas/giac/src/threaded.cc =================================================================== --- trunk/giac-xcas/giac/src/threaded.cc 2010-03-12 10:30:24 UTC (rev 774) +++ trunk/giac-xcas/giac/src/threaded.cc 2010-03-15 14:04:21 UTC (rev 775) @@ -144,9 +144,11 @@ if (g.type==_VECT && g._VECTptr->size()==2){ context * cptr=(giac::context *)newcontextptr; if (cptr){ +#ifdef HAVE_LIBPTHREAD pthread_mutex_lock(cptr->globalptr->_mutex_eval_status_ptr); sto(g._VECTptr->back(),g._VECTptr->front(),cptr); pthread_mutex_unlock(cptr->globalptr->_mutex_eval_status_ptr); +#endif } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2010-03-12 10:30:52
|
Revision: 774 http://xcas.svn.sourceforge.net/xcas/?rev=774&view=rev Author: parisse Date: 2010-03-12 10:30:24 +0000 (Fri, 12 Mar 2010) Log Message: ----------- Modified Paths: -------------- trunk/giac-xcas/giac/src/Graph.cc trunk/giac-xcas/giac/src/Graph3d.cc trunk/giac-xcas/giac/src/History.cc trunk/giac-xcas/giac/src/first.cc trunk/giac-xcas/giac/src/first.h trunk/giac-xcas/giac/src/gausspol.cc trunk/giac-xcas/giac/src/gen.cc trunk/giac-xcas/giac/src/plot.cc trunk/giac-xcas/giac/src/plot.h trunk/giac-xcas/giac/src/prog.cc trunk/giac-xcas/giac/src/sym2poly.cc Modified: trunk/giac-xcas/giac/src/Graph.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph.cc 2010-03-10 11:46:06 UTC (rev 773) +++ trunk/giac-xcas/giac/src/Graph.cc 2010-03-12 10:30:24 UTC (rev 774) @@ -3347,7 +3347,6 @@ hp->update_pos=hp_pos; int pos0=hp_pos; unary_function_ptr * ptr=function_final._FUNCptr; - unary_function_ptr measure_functions[]={at_angleat,at_angleatraw,at_areaatraw,at_perimeteratraw,at_slopeatraw,at_longueurat,at_longueuratraw,0}; int ifinal=mode; if (equalposcomp(measure_functions,*ptr)) ifinal--; @@ -3548,7 +3547,7 @@ geometry_round(x,y,z,eps,tmp,contextptr); if (selected.empty()) return tmp; - if (function_final==at_areaatraw || function_final==at_perimeteratraw){ + if (function_final==at_areaatraw || function_final==at_areaat || function_final==at_perimeteratraw || function_final==at_perimeterat){ int p=findfirstclosedcurve(selection2vecteur(selected)); if (p>0){ pos=p; @@ -5745,6 +5744,10 @@ cb_set_mode(m,at_segment,at_inter_unique,2,gettext("Curve1,Curve2")); } + static void cb_Inter(Fl_Widget * m , void*) { + cb_set_mode(m,at_segment,at_inter,2,gettext("Curve1,Curve2")); + } + static void cb_Segment(Fl_Widget * m , void*) { cb_set_mode(m,0,at_point,1,gettext("Segment")); } @@ -5762,10 +5765,10 @@ } static void cb_DistanceAB(Fl_Widget * m , void*) { - cb_set_mode(m,at_segment,at_longueurat,3,gettext("Object1,Object2,Position")); + cb_set_mode(m,at_segment,at_distanceat,3,gettext("Object1,Object2,Position")); } static void cb_DistanceABraw(Fl_Widget * m , void*) { - cb_set_mode(m,at_segment,at_longueuratraw,3,gettext("Object1,Object2,Position")); + cb_set_mode(m,at_segment,at_distanceatraw,3,gettext("Object1,Object2,Position")); } static void cb_AngleABC(Fl_Widget * m , void*) { @@ -5779,14 +5782,26 @@ cb_set_mode(m,at_areaatraw,at_areaatraw,2,gettext("Object,Position")); } + static void cb_Area(Fl_Widget * m , void*) { + cb_set_mode(m,at_areaat,at_areaat,2,gettext("Object,Position")); + } + static void cb_Perimeterraw(Fl_Widget * m , void*) { cb_set_mode(m,at_perimeteratraw,at_perimeteratraw,2,gettext("Object,Position")); } + static void cb_Perimeter(Fl_Widget * m , void*) { + cb_set_mode(m,at_perimeterat,at_perimeterat,2,gettext("Object,Position")); + } + static void cb_Sloperaw(Fl_Widget * m , void*) { cb_set_mode(m,at_slopeatraw,at_slopeatraw,2,gettext("Object,Position")); } + static void cb_Slope(Fl_Widget * m , void*) { + cb_set_mode(m,at_slopeat,at_slopeat,2,gettext("Object,Position")); + } + static void cb_Symetrie(Fl_Widget * m , void*) { cb_set_mode(m,at_segment,at_symetrie,2,gettext("Symetry_center_axis,Object")); } @@ -5973,8 +5988,11 @@ {0}, // end Surfaces {gettext("Measures"), 0, 0, 0, 64, 0, 0, 14, 56}, {gettext("distance"), 0, (Fl_Callback *) cb_DistanceAB, 0, 0, 0, 0, 14, 56}, + {gettext("angle"), 0, (Fl_Callback *) cb_AngleABC, 0, 0, 0, 0, 14, 56}, + {gettext("area"), 0, (Fl_Callback *) cb_Area, 0, 0, 0, 0, 14, 56}, + {gettext("perimeter"), 0, (Fl_Callback *) cb_Perimeter, 0, 0, 0, 0, 14, 56}, + {gettext("slope"), 0, (Fl_Callback *) cb_Slope, 0, 0, 0, 0, 14, 56}, {gettext("distance (raw)"), 0, (Fl_Callback *) cb_DistanceABraw, 0, 0, 0, 0, 14, 56}, - {gettext("angle"), 0, (Fl_Callback *) cb_AngleABC, 0, 0, 0, 0, 14, 56}, {gettext("angle (raw)"), 0, (Fl_Callback *) cb_AngleABCraw, 0, 0, 0, 0, 14, 56}, {gettext("area (raw)"), 0, (Fl_Callback *) cb_Arearaw, 0, 0, 0, 0, 14, 56}, {gettext("perimeter (raw)"), 0, (Fl_Callback *) cb_Perimeterraw, 0, 0, 0, 0, 14, 56}, @@ -5990,6 +6008,7 @@ {gettext("inversion"), 0, (Fl_Callback *) cb_Inversion, 0, 0, 0, 0, 14, 56}, {0}, // end transformations {gettext("Intersection"), 0, (Fl_Callback *) cb_Inter_Unique, 0, 0, 0, 0, 14, 56}, + {gettext("Intersection list"), 0, (Fl_Callback *) cb_Inter, 0, 0, 0, 0, 14, 56}, {gettext("Exact"), 0, (Fl_Callback *) cb_Exact, 0, 0, 0, 0, 14, 56}, {gettext("Approx"), 0, (Fl_Callback *) cb_Approx, 0, 0, 0, 0, 14, 56}, {0}, // end Menu Modified: trunk/giac-xcas/giac/src/Graph3d.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph3d.cc 2010-03-10 11:46:06 UTC (rev 773) +++ trunk/giac-xcas/giac/src/Graph3d.cc 2010-03-12 10:30:24 UTC (rev 774) @@ -1840,40 +1840,46 @@ glVertex3d(0,0,0); glVertex3d(1,0,0); } - glVertex3d(window_xmin,window_ymin,window_zmin); - glVertex3d(window_xmax,window_ymin,window_zmin); - glVertex3d(window_xmin,window_ymax,window_zmin); - glVertex3d(window_xmax,window_ymax,window_zmin); - glVertex3d(window_xmin,window_ymin,window_zmax); - glVertex3d(window_xmax,window_ymin,window_zmax); - glVertex3d(window_xmin,window_ymax,window_zmax); - glVertex3d(window_xmax,window_ymax,window_zmax); + if (show_axes && !printing){ + glVertex3d(window_xmin,window_ymin,window_zmin); + glVertex3d(window_xmax,window_ymin,window_zmin); + glVertex3d(window_xmin,window_ymax,window_zmin); + glVertex3d(window_xmax,window_ymax,window_zmin); + glVertex3d(window_xmin,window_ymin,window_zmax); + glVertex3d(window_xmax,window_ymin,window_zmax); + glVertex3d(window_xmin,window_ymax,window_zmax); + glVertex3d(window_xmax,window_ymax,window_zmax); + } glColor3f(0,1,0); if (show_axes){ glVertex3d(0,0,0); glVertex3d(0,1,0); } - glVertex3d(window_xmin,window_ymin,window_zmin); - glVertex3d(window_xmin,window_ymax,window_zmin); - glVertex3d(window_xmax,window_ymin,window_zmin); - glVertex3d(window_xmax,window_ymax,window_zmin); - glVertex3d(window_xmin,window_ymin,window_zmax); - glVertex3d(window_xmin,window_ymax,window_zmax); - glVertex3d(window_xmax,window_ymin,window_zmax); - glVertex3d(window_xmax,window_ymax,window_zmax); + if (show_axes && !printing){ + glVertex3d(window_xmin,window_ymin,window_zmin); + glVertex3d(window_xmin,window_ymax,window_zmin); + glVertex3d(window_xmax,window_ymin,window_zmin); + glVertex3d(window_xmax,window_ymax,window_zmin); + glVertex3d(window_xmin,window_ymin,window_zmax); + glVertex3d(window_xmin,window_ymax,window_zmax); + glVertex3d(window_xmax,window_ymin,window_zmax); + glVertex3d(window_xmax,window_ymax,window_zmax); + } glColor3f(0,0,1); if (show_axes){ glVertex3d(0,0,0); glVertex3d(0,0,1); } - glVertex3d(window_xmin,window_ymin,window_zmin); - glVertex3d(window_xmin,window_ymin,window_zmax); - glVertex3d(window_xmax,window_ymax,window_zmin); - glVertex3d(window_xmax,window_ymax,window_zmax); - glVertex3d(window_xmin,window_ymax,window_zmin); - glVertex3d(window_xmin,window_ymax,window_zmax); - glVertex3d(window_xmax,window_ymin,window_zmin); - glVertex3d(window_xmax,window_ymin,window_zmax); + if (show_axes && !printing){ + glVertex3d(window_xmin,window_ymin,window_zmin); + glVertex3d(window_xmin,window_ymin,window_zmax); + glVertex3d(window_xmax,window_ymax,window_zmin); + glVertex3d(window_xmax,window_ymax,window_zmax); + glVertex3d(window_xmin,window_ymax,window_zmin); + glVertex3d(window_xmin,window_ymax,window_zmax); + glVertex3d(window_xmax,window_ymin,window_zmin); + glVertex3d(window_xmax,window_ymin,window_zmax); + } glEnd(); if( show_axes){ // maillage glColor3f(1,0,0); Modified: trunk/giac-xcas/giac/src/History.cc =================================================================== --- trunk/giac-xcas/giac/src/History.cc 2010-03-10 11:46:06 UTC (rev 773) +++ trunk/giac-xcas/giac/src/History.cc 2010-03-12 10:30:24 UTC (rev 774) @@ -1775,6 +1775,7 @@ } Fl_Widget * new_question_multiline_input(int W,int H){ + Fl_Group::current(0); Multiline_Input_tab * w=new Multiline_Input_tab(0,0,W,H); w->when(FL_WHEN_ENTER_KEY|FL_WHEN_NOT_CHANGED); w->callback(History_Pack_cb_eval,0); @@ -1784,6 +1785,7 @@ } Fl_Widget * new_question_equation(int W,int H){ + Fl_Group::current(0); Equation * w=new Equation(0,0,W,H,"",0); w->output_equation=false; w->select(); @@ -1822,6 +1824,7 @@ } Fl_Widget * new_comment_input(int W,int H){ + Fl_Group::current(0); Comment_Multiline_Input * w=new Comment_Multiline_Input(0,0,W,H,""); w->textcolor(Xcas_comment_color); w->color(Xcas_comment_background_color); Modified: trunk/giac-xcas/giac/src/first.cc =================================================================== --- trunk/giac-xcas/giac/src/first.cc 2010-03-10 11:46:06 UTC (rev 773) +++ trunk/giac-xcas/giac/src/first.cc 2010-03-12 10:30:24 UTC (rev 774) @@ -20,6 +20,7 @@ #endif #include "first.h" int init_gmp_memory::refcount = 0; +init_gmp_memory init_gmp_memory_instance; #ifdef HAVE_LIBGC #include <new> Modified: trunk/giac-xcas/giac/src/first.h =================================================================== --- trunk/giac-xcas/giac/src/first.h 2010-03-10 11:46:06 UTC (rev 773) +++ trunk/giac-xcas/giac/src/first.h 2010-03-12 10:30:24 UTC (rev 774) @@ -36,7 +36,7 @@ init_gmp_memory(); ~init_gmp_memory(); }; -static init_gmp_memory init_gmp_memory_instance; +extern init_gmp_memory init_gmp_memory_instance; #ifdef __VISUALC__ // Visual C++? typedef long pid_t; Modified: trunk/giac-xcas/giac/src/gausspol.cc =================================================================== --- trunk/giac-xcas/giac/src/gausspol.cc 2010-03-10 11:46:06 UTC (rev 773) +++ trunk/giac-xcas/giac/src/gausspol.cc 2010-03-12 10:30:24 UTC (rev 774) @@ -3575,7 +3575,11 @@ // first make p primitive polynome pp=p/lgcd(p); // then square-free factorization - factorization sqff_f(sqff(pp)); + factorization sqff_f; + if (has_num_coeff(p)) + sqff_f.push_back(facteur< polynome >(p,1)); + else + sqff_f=sqff(pp); f.clear(); if (p.dim!=1){ f=sqff_f; Modified: trunk/giac-xcas/giac/src/gen.cc =================================================================== --- trunk/giac-xcas/giac/src/gen.cc 2010-03-10 11:46:06 UTC (rev 773) +++ trunk/giac-xcas/giac/src/gen.cc 2010-03-12 10:30:24 UTC (rev 774) @@ -8259,6 +8259,7 @@ return "with_f5"; } } + return print_INT_(val); } string gen::print(GIAC_CONTEXT) const{ Modified: trunk/giac-xcas/giac/src/plot.cc =================================================================== --- trunk/giac-xcas/giac/src/plot.cc 2010-03-10 11:46:06 UTC (rev 773) +++ trunk/giac-xcas/giac/src/plot.cc 2010-03-12 10:30:24 UTC (rev 774) @@ -4406,9 +4406,9 @@ for (int i=0;i<s-1;++i){ res = res + sqrt(distance2pp(v[i],v[i+1],contextptr),contextptr); } - return res; + return recursive_normal(res,contextptr); } - const string _perimetre_s("perimetre"); + const string _perimetre_s("perimeter"); unary_function_eval __perimetre(&giac::_perimetre,_perimetre_s); unary_function_ptr at_perimetre (&__perimetre,0,true); @@ -6983,8 +6983,8 @@ if (find_curve_parametrization(curve,m,vf[1],T,tmin,tmax,false,contextptr)){ vf[0]=m; } + gen eq; try { - gen eq; if (iscircle){ gen centre,rayon; centre_rayon(circle,centre,rayon,false,contextptr); // don't care about radius sign @@ -7014,6 +7014,7 @@ res[i]=symb_pnt(subst(vf[0],vf[1],res[i],false,contextptr),contextptr); return res; } catch (std::runtime_error & error){ + *logptr(contextptr) << "Unable to solve intersection equation " << eq << endl; return makevecteur(symbolic(at_inter,makevecteur(curve,circle))); } } @@ -7683,7 +7684,7 @@ unary_function_eval __legende(&giac::_legende,_legende_s); unary_function_ptr at_legende (&__legende,_QUOTE_ARGUMENTS,true); - gen _longueurat(const gen & args,GIAC_CONTEXT){ + gen _distanceat(const gen & args,GIAC_CONTEXT){ if ( args.type!=_VECT ) settypeerr(); vecteur v = *args._VECTptr; @@ -7701,11 +7702,11 @@ w.push_back(v[i]); return _legende(gen(w,_SEQ__VECT),contextptr); } - const string _longueurat_s("longueurat"); - unary_function_eval __longueurat(&_longueurat,_longueurat_s); - unary_function_ptr at_longueurat (&__longueurat,_QUOTE_ARGUMENTS,true); + const string _distanceat_s("distanceat"); + unary_function_eval __distanceat(&_distanceat,_distanceat_s); + unary_function_ptr at_distanceat (&__distanceat,_QUOTE_ARGUMENTS,true); - gen _longueuratraw(const gen & args,GIAC_CONTEXT){ + gen _distanceatraw(const gen & args,GIAC_CONTEXT){ if ( args.type!=_VECT ) settypeerr(); vecteur v = *args._VECTptr; @@ -7718,9 +7719,9 @@ w.push_back(v[i]); return _legende(gen(w,_SEQ__VECT),contextptr); } - const string _longueuratraw_s("longueuratraw"); - unary_function_eval __longueuratraw(&_longueuratraw,_longueuratraw_s); - unary_function_ptr at_longueuratraw (&__longueuratraw,0,true); + const string _distanceatraw_s("distanceatraw"); + unary_function_eval __distanceatraw(&_distanceatraw,_distanceatraw_s); + unary_function_ptr at_distanceatraw (&__distanceatraw,0,true); gen _areaatraw(const gen & args,GIAC_CONTEXT){ if ( args.type!=_VECT ) @@ -7739,6 +7740,32 @@ unary_function_eval __areaatraw(&_areaatraw,_areaatraw_s); unary_function_ptr at_areaatraw (&__areaatraw,0,true); + gen _areaat(const gen & args,GIAC_CONTEXT){ + if ( args.type!=_VECT ) + settypeerr(); + vecteur v = *args._VECTptr; + int s=v.size(); + if (s<2) + settypeerr(); + gen l=_aire(eval(v[0],eval_level(contextptr),contextptr),contextptr); + int save_digits=decimal_digits(contextptr); + decimal_digits(contextptr)=3; +#ifdef WIN32 + string ss="a"+v[0].print(contextptr)+"="+l.print(contextptr)+" "; +#else + string ss="◼"+v[0].print(contextptr)+"="+l.print(contextptr)+" "; +#endif + decimal_digits(contextptr)=save_digits; + l=gen('"'+ss+'"',false); + vecteur w=makevecteur(v[1],l); + for (int i=2; i<s;++i) + w.push_back(v[i]); + return _legende(gen(w,_SEQ__VECT),contextptr); + } + const string _areaat_s("areaat"); + unary_function_eval __areaat(&_areaat,_areaat_s); + unary_function_ptr at_areaat (&__areaat,_QUOTE_ARGUMENTS,true); + gen _slopeatraw(const gen & args,GIAC_CONTEXT){ if ( args.type!=_VECT ) settypeerr(); @@ -7756,6 +7783,54 @@ unary_function_eval __slopeatraw(&_slopeatraw,_slopeatraw_s); unary_function_ptr at_slopeatraw (&__slopeatraw,0,true); + gen _slopeat(const gen & args,GIAC_CONTEXT){ + if ( args.type!=_VECT ) + settypeerr(); + vecteur v = *args._VECTptr; + int s=v.size(); + if (s<2) + settypeerr(); + gen l=_slope(eval(v[0],eval_level(contextptr),contextptr),contextptr); + int save_digits=decimal_digits(contextptr); + decimal_digits(contextptr)=3; + string ss="∡"+v[0].print(contextptr)+"="+l.print(contextptr)+" "; + decimal_digits(contextptr)=save_digits; + l=gen('"'+ss+'"',false); + vecteur w=makevecteur(v[1],l); + for (int i=2; i<s;++i) + w.push_back(v[i]); + return _legende(gen(w,_SEQ__VECT),contextptr); + } + const string _slopeat_s("slopeat"); + unary_function_eval __slopeat(&_slopeat,_slopeat_s); + unary_function_ptr at_slopeat (&__slopeat,_QUOTE_ARGUMENTS,true); + + gen _perimeterat(const gen & args,GIAC_CONTEXT){ + if ( args.type!=_VECT ) + settypeerr(); + vecteur v = *args._VECTptr; + int s=v.size(); + if (s<2) + settypeerr(); + gen l=_perimetre(eval(v[0],eval_level(contextptr),contextptr),contextptr); + int save_digits=decimal_digits(contextptr); + decimal_digits(contextptr)=3; +#ifdef WIN32 + string ss="p"+v[0].print(contextptr)+"="+l.print(contextptr)+" "; +#else + string ss="◻"+v[0].print(contextptr)+"="+l.print(contextptr)+" "; +#endif + decimal_digits(contextptr)=save_digits; + l=gen('"'+ss+'"',false); + vecteur w=makevecteur(v[1],l); + for (int i=2; i<s;++i) + w.push_back(v[i]); + return _legende(gen(w,_SEQ__VECT),contextptr); + } + const string _perimeterat_s("perimeterat"); + unary_function_eval __perimeterat(&_perimeterat,_perimeterat_s); + unary_function_ptr at_perimeterat (&__perimeterat,_QUOTE_ARGUMENTS,true); + gen _perimeteratraw(const gen & args,GIAC_CONTEXT){ if ( args.type!=_VECT ) settypeerr(); @@ -7808,7 +7883,7 @@ gen l=_angle(gen(makevecteur(eval(v[0],eval_level(contextptr),contextptr),eval(v[1],eval_level(contextptr),contextptr),eval(v[2],eval_level(contextptr),contextptr)),_SEQ__VECT),contextptr); int save_digits=decimal_digits(contextptr); decimal_digits(contextptr)=3; - string ss="α"+v[0].print(contextptr)+"="+l.print(contextptr)+" "; + string ss="∡"+v[0].print(contextptr)+"="+l.print(contextptr)+" "; decimal_digits(contextptr)=save_digits; l=gen('"'+ss+'"',false); vecteur w=makevecteur(v[3],l); @@ -11525,7 +11600,8 @@ unary_function_ptr notexprint_plot_sommets[]={at_funcplot,at_paramplot,at_polarplot,at_implicitplot,at_contourplot,at_odeplot,at_interactive_odeplot,at_fieldplot,at_seqplot,at_ellipse,at_hyperbole,at_parabole,0}; unary_function_ptr implicittex_plot_sommets[]={at_plot,at_plot3d,at_plotfunc,at_plotparam,at_plotpolar,at_plotimplicit,at_plotcontour,at_DrawInv,at_DrawFunc,at_DrawParm,at_DrawPol,at_DrwCtour,at_plotode,at_plotfield,at_interactive_plotode,at_plotseq,at_Graph,0}; unary_function_ptr point_sommet_tab_op[]={at_point,at_element,at_inter_unique,at_centre,at_isobarycentre,at_barycentre,0}; - unary_function_ptr nosplit_polygon_function[]={at_inter_unique,at_rotation,at_projection,at_symetrie,at_areaatraw,at_perimeteratraw,at_slopeatraw,0}; + unary_function_ptr nosplit_polygon_function[]={at_inter_unique,at_rotation,at_projection,at_symetrie,at_areaat,at_areaatraw,at_perimeterat,at_perimeteratraw,at_slopeat,at_slopeatraw,0}; + unary_function_ptr measure_functions[]={at_angleat,at_angleatraw,at_areaat,at_areaatraw,at_perimeterat,at_perimeteratraw,at_slopeat,at_slopeatraw,at_distanceat,at_distanceatraw,0}; #ifndef NO_NAMESPACE_GIAC Modified: trunk/giac-xcas/giac/src/plot.h =================================================================== --- trunk/giac-xcas/giac/src/plot.h 2010-03-10 11:46:06 UTC (rev 773) +++ trunk/giac-xcas/giac/src/plot.h 2010-03-12 10:30:24 UTC (rev 774) @@ -481,13 +481,16 @@ extern const std::string _legende_s; gen _legende(const gen & args,GIAC_CONTEXT); extern unary_function_ptr at_legende; - extern unary_function_ptr at_longueurat; - extern unary_function_ptr at_longueuratraw; + extern unary_function_ptr at_distanceat; + extern unary_function_ptr at_distanceatraw; extern unary_function_ptr at_angleat; extern unary_function_ptr at_angleatraw; extern unary_function_ptr at_areaatraw; + extern unary_function_ptr at_areaat; extern unary_function_ptr at_perimeteratraw; + extern unary_function_ptr at_perimeterat; extern unary_function_ptr at_slopeatraw; + extern unary_function_ptr at_slopeat; extern unary_function_ptr at_extract_measure; extern const std::string _couleur_s; @@ -757,6 +760,7 @@ extern unary_function_ptr point_sommet_tab_op[]; extern unary_function_ptr nosplit_polygon_function[]; + extern unary_function_ptr measure_functions[]; /* following obsolete declaration that will be remove in the future when all fork/child etc. will be removed */ extern vecteur plot_instructions; Modified: trunk/giac-xcas/giac/src/prog.cc =================================================================== --- trunk/giac-xcas/giac/src/prog.cc 2010-03-10 11:46:06 UTC (rev 773) +++ trunk/giac-xcas/giac/src/prog.cc 2010-03-12 10:30:24 UTC (rev 774) @@ -4032,13 +4032,21 @@ return 0; // a way to add the current path to the search if (libname[0]!='/'){ + if (libname.size()<3 || libname.substr(0,3)!="lib") + libname = "lib"+libname; gen pwd=_pwd(0,contextptr); if (pwd.type==_STRNG){ string libname1 = *pwd._STRNGptr+'/'+libname; + if (libname1.size()<3 || libname1.substr(libname1.size()-3,3)!=".so") + libname1 += ".so"; if (is_file_available(libname1.c_str())) libname=libname1; } } +#ifndef WIN32 + if (libname.size()<3 || libname.substr(libname.size()-3,3)!=".so") + libname += ".so"; +#endif modules_tab::const_iterator i = giac_modules_tab.find(libname); if (i!=giac_modules_tab.end()) return plus_two; // still registered Modified: trunk/giac-xcas/giac/src/sym2poly.cc =================================================================== --- trunk/giac-xcas/giac/src/sym2poly.cc 2010-03-10 11:46:06 UTC (rev 773) +++ trunk/giac-xcas/giac/src/sym2poly.cc 2010-03-12 10:30:24 UTC (rev 774) @@ -2417,9 +2417,7 @@ if (f.type==_VECT && f._VECTptr->size()==2 && f._VECTptr->front().type==_MOD) v.back()=f._VECTptr->back(); } - if (v.back().type!=_IDNT) - setsizeerr(); - identificateur x=*v.back()._IDNTptr; + gen x=v.back(); vecteur l; l.push_back(x); l=vecteur(1,l); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2010-03-10 11:46:47
|
Revision: 773 http://xcas.svn.sourceforge.net/xcas/?rev=773&view=rev Author: parisse Date: 2010-03-10 11:46:06 +0000 (Wed, 10 Mar 2010) Log Message: ----------- Modified Paths: -------------- trunk/giac-xcas/giac/src/gen.cc Modified: trunk/giac-xcas/giac/src/gen.cc =================================================================== --- trunk/giac-xcas/giac/src/gen.cc 2010-03-10 08:43:12 UTC (rev 772) +++ trunk/giac-xcas/giac/src/gen.cc 2010-03-10 11:46:06 UTC (rev 773) @@ -1951,7 +1951,7 @@ return true; case _FRAC: if (decimal_digits(contextptr)<=14) - evaled=set_precision(re(contextptr),17).evalf_double(1,contextptr)+cst_i*set_precision(im(contextptr),17).evalf_double(1,contextptr); + evaled=set_precision(re(contextptr),60).evalf_double(1,contextptr)+cst_i*set_precision(im(contextptr),60).evalf_double(1,contextptr); else evaled=rdiv(_FRACptr->num.evalf(level,contextptr),_FRACptr->den.evalf(level,contextptr)); return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2010-03-10 08:44:03
|
Revision: 772 http://xcas.svn.sourceforge.net/xcas/?rev=772&view=rev Author: parisse Date: 2010-03-10 08:43:12 +0000 (Wed, 10 Mar 2010) Log Message: ----------- Modified Paths: -------------- trunk/giac-xcas/giac/src/Equation.cc trunk/giac-xcas/giac/src/Graph.cc trunk/giac-xcas/giac/src/Graph3d.cc trunk/giac-xcas/giac/src/History.cc trunk/giac-xcas/giac/src/Input.cc trunk/giac-xcas/giac/src/Tableur.cc trunk/giac-xcas/giac/src/Xcas1.cc trunk/giac-xcas/giac/src/Xcas1.h trunk/giac-xcas/giac/src/gen.cc trunk/giac-xcas/giac/src/global.cc trunk/giac-xcas/giac/src/global.h trunk/giac-xcas/giac/src/hist.cxx trunk/giac-xcas/giac/src/hist.fl trunk/giac-xcas/giac/src/input_lexer.cc trunk/giac-xcas/giac/src/input_lexer.ll trunk/giac-xcas/giac/src/intg.cc trunk/giac-xcas/giac/src/intgab.cc trunk/giac-xcas/giac/src/misc.cc trunk/giac-xcas/giac/src/plot.cc trunk/giac-xcas/giac/src/plot.h trunk/giac-xcas/giac/src/prog.cc trunk/giac-xcas/giac/src/series.cc trunk/giac-xcas/giac/src/subst.cc trunk/giac-xcas/giac/src/usual.cc trunk/giac-xcas/giac/src/usual.h Modified: trunk/giac-xcas/giac/src/Equation.cc =================================================================== --- trunk/giac-xcas/giac/src/Equation.cc 2010-02-22 14:57:32 UTC (rev 771) +++ trunk/giac-xcas/giac/src/Equation.cc 2010-03-10 08:43:12 UTC (rev 772) @@ -3702,6 +3702,8 @@ if (event==FL_FOCUS) return 1; } + if (event==FL_KEYBOARD) + Xcas_input_focus=this; bool is_history=(data.type==_VECT && data.subtype==_HIST__VECT); bool complete_level_selected=false; eqwdata data_eqwdata=Equation_total_size(data); @@ -4084,6 +4086,7 @@ const giac::context * contextptr = get_context(eq); if (eq){ Fl::focus(eq); + Xcas_input_focus=eq; string s =eq->get_data().print(contextptr); Fl::selection(*eq,s.c_str(),s.size()); eq->select(); @@ -4099,6 +4102,7 @@ Equation * eq = dynamic_cast<Equation *>(wid); if (!eq) return; + Xcas_input_focus=eq; eq->replace_selection_wo_save(evaled_g); } @@ -4107,6 +4111,7 @@ Equation * eq = dynamic_cast<Equation *>(m->parent()); if (eq){ Fl::focus(eq); + Xcas_input_focus=eq; eq->save_data(); xcas::History_Pack * hp=get_history_pack(eq); giac::context * cptr=hp?hp->contextptr:0; @@ -4135,6 +4140,7 @@ if (m){ Equation * eq = dynamic_cast<Equation *>(m->parent()); if (eq){ + Xcas_input_focus=eq; eq->rcl_data(-1); } } @@ -4144,6 +4150,7 @@ if (m){ Equation * eq = dynamic_cast<Equation *>(m->parent()); if (eq){ + Xcas_input_focus=eq; eq->rcl_data(1); } } Modified: trunk/giac-xcas/giac/src/Graph.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph.cc 2010-02-22 14:57:32 UTC (rev 771) +++ trunk/giac-xcas/giac/src/Graph.cc 2010-03-10 08:43:12 UTC (rev 772) @@ -66,6 +66,8 @@ namespace xcas { #endif // ndef NO_NAMESPACE_XCAS + + bool do_helpon=true; std::map<std::string,std::pair<Fl_Image *,Fl_Image *> *> texture2d_cache; @@ -2064,7 +2066,7 @@ vecteur & v = *e._SYMBptr->feuille._VECTptr; if (v.size()==3 && v.back().type==_STRNG){ string newauto=*v.back()._STRNGptr; - if (newauto.size()>=1 && newauto>=autoname(contextptr)){ + if (newauto.size()>=1 && v[1].type!=_VECT && newauto>=autoname(contextptr)){ autoname(contextptr)=newauto; autoname_plus_plus(); } @@ -2520,7 +2522,7 @@ if (event==FL_PUSH ){ if (this!=Fl::focus()){ Fl::focus(this); - handle(FL_FOCUS); + in_handle(FL_FOCUS); } pushed=true; push_i=current_i; @@ -3060,9 +3062,11 @@ tmp.subtype=_SEQ__VECT; tmp=symbolic(at_point,tmp); } - else - if (tmp.type!=_IDNT) + else { + if (tmp.type!=_IDNT && !tmp.is_symb_of_sommet(at_extract_measure)){ tmp=symbolic(at_point,makevecteur(re(tmp,contextptr),im(tmp,contextptr))); + } + } } double newx,newy,newz; if (gr2d){ @@ -3251,7 +3255,7 @@ gen tmpval=remove_at_pnt(tmp.eval(1,contextptr)); gen somm=symbolic(at_sommets,tmp); int npoints=1; - if (function_final!=at_inter_unique){ + if (!equalposcomp(nosplit_polygon_function,*function_final._FUNCptr)){ if (tmpval.type==_VECT && tmpval.subtype==_GROUP__VECT) npoints=tmpval._VECTptr->size(); if (tmpval.is_symb_of_sommet(at_cercle)) @@ -3264,11 +3268,41 @@ args_tmp_push_size=args_size; args_tmp.erase(args_tmp.begin()+args_tmp_push_size,args_tmp.end()); } + unsigned new_args_size=args_tmp.size(); + gen tmp_push=tmp; + bool swapargs=false; + if (npoints==2 && (new_args_size==2 || new_args_size==1) && (function_final==at_angleat || function_final==at_angleatraw) ){ + // search if args_tmp[0] or args_tmp[1] is a vertex of tmp + gen tmp2=remove_at_pnt(evalf(tmp,1,contextptr)); + gen somm=symbolic(at_sommets,tmp); + if (tmp2.type==_VECT && tmp2._VECTptr->size()==2){ + gen tmpa=remove_at_pnt(evalf(args_tmp[0],1,contextptr)); + gen tmpb=new_args_size==2?remove_at_pnt(evalf(args_tmp[1],1,contextptr)):undef; + if (npoints==2 && tmpa==tmp2._VECTptr->front() && tmpb!=tmp2._VECTptr->back()){ + tmp=symbolic(at_at,gen(makevecteur(somm,1),_SEQ__VECT)); + npoints=1; + } + if (npoints==2 && tmpa==tmp2._VECTptr->back() && tmpb!=tmp2._VECTptr->front()){ + tmp=symbolic(at_at,gen(makevecteur(somm,0),_SEQ__VECT)); + npoints=1; + } + if (npoints==2 && tmpb==tmp2._VECTptr->front() && tmpa!=tmp2._VECTptr->back() ){ + swapargs=true; + tmp=symbolic(at_at,gen(makevecteur(somm,1),_SEQ__VECT)); + npoints=1; + } + if (npoints==2 && tmpb==tmp2._VECTptr->back() && tmpa!=tmp2._VECTptr->front()){ + swapargs=true; + tmp=symbolic(at_at,gen(makevecteur(somm,0),_SEQ__VECT)); + npoints=1; + } + } + } if (npoints+args_tmp.size()>mode) npoints=1; if (event==FL_MOVE || event==FL_DRAG || event==FL_RELEASE){ mouse_position->redraw(); - if (args_size && args_tmp_push_size && args_push!=tmp){ + if (args_size && args_tmp_push_size && args_push!=tmp_push){ // replace by current mouse position if (npoints==1) args_tmp.push_back(tmp); @@ -3284,7 +3318,9 @@ } } if (event==FL_PUSH){ - args_push=tmp; + if (swapargs) + swap<gen>(args_tmp[0],args_tmp[1]); + args_push=tmp_push; if (npoints==1) args_tmp.push_back(tmp); else { @@ -3306,18 +3342,37 @@ } gen tmp_plot; if (in_area && function_final.type==_FUNC) { + gen res,objname=gen(autoname(hp->contextptr),hp->contextptr); + hp_pos=hp->children()-1; + hp->update_pos=hp_pos; + int pos0=hp_pos; unary_function_ptr * ptr=function_final._FUNCptr; - tmp_plot=symbolic(*ptr,gen( (*ptr==(gr3d?at_sphere:at_cercle)) ?makevecteur(args_tmp.front(),args_tmp.back()-args_tmp.front()):args_tmp,_SEQ__VECT)); - gen res,objname=gen(autoname(hp->contextptr),hp->contextptr); + unary_function_ptr measure_functions[]={at_angleat,at_angleatraw,at_areaatraw,at_perimeteratraw,at_slopeatraw,at_longueurat,at_longueuratraw,0}; + int ifinal=mode; + if (equalposcomp(measure_functions,*ptr)) + ifinal--; + // first replace points in args_tmp by assignations + for (int i=0;i<ifinal;++i){ + tmp_plot=args_tmp[i]; + if (tmp_plot.is_symb_of_sommet(at_point)){ + tmp_plot=symbolic(at_sto,makevecteur(add_attributs(tmp_plot,couleur),objname)); + args_tmp[i]=objname; + hp->set_gen_value(hp_pos,tmp_plot,false); + hp->add_entry(hp_pos+1); + ++hp_pos; + autoname_plus_plus(); + objname=gen(autoname(hp->contextptr),hp->contextptr); + } + } + tmp_plot=symbolic(*ptr,gen( (*ptr==(gr3d?at_sphere:at_cercle) && !args_tmp.back().is_symb_of_sommet(at_extract_measure)) ?makevecteur(args_tmp.front(),args_tmp.back()-args_tmp.front()):args_tmp,_SEQ__VECT)); try { res=evalf(tmp_plot,1,hp->contextptr); } catch (std::runtime_error & err){ res=undef; } - hp_pos=hp->children()-1; - int pos0=hp_pos; - hp->set_gen_value(hp_pos,symbolic(at_sto,makevecteur(add_attributs(tmp_plot,couleur),objname)),false); + tmp_plot=symbolic(at_sto,makevecteur(add_attributs(tmp_plot,couleur),objname)); + hp->set_gen_value(hp_pos,tmp_plot,false); hp->add_entry(hp_pos+1); ++hp_pos; if (res.is_symb_of_sommet(at_pnt)){ @@ -3327,15 +3382,10 @@ vecteur l; if (res._VECTptr->back()==res._VECTptr->front()) --ns; + if (ns>=mode) + ns=mode; for (int i=1;i<=ns;++i){ - tmp_plot=symbolic(at_at,gen(makevecteur(symbolic(at_sommets,objname),i-1),_SEQ__VECT)); - l.push_back(gen(autoname(hp->contextptr)+print_INT_(i),hp->contextptr)); - hp->set_gen_value(hp_pos,symbolic(at_sto,makevecteur(tmp_plot,l.back())),false); - hp->add_entry(hp_pos+1); - ++hp_pos; - } - for (int i=1;i<=ns;++i){ - tmp_plot=symbolic(at_segment,makevecteur(l[i-1],l[i%ns])); + tmp_plot=symbolic(at_segment,makevecteur(args_tmp[i-1],args_tmp[i%ns])); hp->set_gen_value(hp_pos,symbolic(at_sto,makevecteur(add_attributs(tmp_plot,couleur),gen(autoname(hp->contextptr)+print_INT_(ns+i),hp->contextptr))),false); hp->add_entry(hp_pos+1); ++hp_pos; @@ -3358,7 +3408,22 @@ if (no_handle) return 0; context * contextptr=hp?hp->contextptr:get_context(this); +#ifdef HAVE_LIBPTHREAD + // cerr << "handle lock" << endl; + int locked=pthread_mutex_trylock(&interactive_mutex); + if (locked) + return 0; +#endif + no_handle=true; + bool b=io_graph(contextptr); + io_graph(false,contextptr); int res=in_handle(event); + io_graph(b,contextptr); + no_handle=false; +#ifdef HAVE_LIBPTHREAD + pthread_mutex_unlock(&interactive_mutex); + // cerr << "handle unlock" << endl; +#endif return res; } @@ -3455,6 +3520,21 @@ return res; } + int findfirstclosedcurve(const vecteur & v){ + int s=v.size(); + for (int i=0;i<s;++i){ + gen g=remove_at_pnt(v[i]); + if (g.is_symb_of_sommet(at_cercle)) + return i; + if (g.type==_VECT && g.subtype==_GROUP__VECT){ + vecteur & w=*g._VECTptr; + if (!w.empty() && w.front()==w.back()) + return i; + } + } + return -1; + } + // find nearest point of x+i*y, returns position in history and either // a numeric value or the point name gen Graph2d3d::geometry_round(double x,double y,double z,double eps,gen & original,int & pos,bool selectfirstlevel) { @@ -3468,18 +3548,55 @@ geometry_round(x,y,z,eps,tmp,contextptr); if (selected.empty()) return tmp; - if (selectfirstlevel) - sort(selected.begin(),selected.end()); - else - pos=findfirstpoint(selection2vecteur(selected)); + if (function_final==at_areaatraw || function_final==at_perimeteratraw){ + int p=findfirstclosedcurve(selection2vecteur(selected)); + if (p>0){ + pos=p; + } + } + if (pos==-1){ + if (selectfirstlevel){ + sort(selected.begin(),selected.end()); + // patch so that we move element and not the curve + int p=findfirstpoint(selection2vecteur(selected)); + if (p>0){ + gen g=hp->parse(selected[p]); + if (g.is_symb_of_sommet(at_sto) && g._SYMBptr->feuille.type==_VECT ){ + vecteur & v = *g._SYMBptr->feuille._VECTptr; + if (v.size()>1 && v[0].is_symb_of_sommet(at_element)) + pos=p; + } + } + } + else + pos=findfirstpoint(selection2vecteur(selected)); + } gen g=hp->parse( (pos<0)?(pos=selected.front()):(pos=selected[pos]) ); if (pos>=0) hp->_sel_begin=hp->_sel_end=pos; + if (g.is_symb_of_sommet(at_plus) && g._SYMBptr->feuille.type==_VECT && !g._SYMBptr->feuille._VECTptr->empty()) + g=g._SYMBptr->feuille._VECTptr->front(); if (g.is_symb_of_sommet(at_sto) && g._SYMBptr->feuille.type==_VECT ){ vecteur & v = *g._SYMBptr->feuille._VECTptr; if (v.size()==2){ original = v[0]; tmp = v[1]; + if (tmp.type==_IDNT){ + gen valeur=protecteval(original,1,contextptr); + if (valeur.is_symb_of_sommet(at_pnt)){ + gen & valf = valeur._SYMBptr->feuille; + if (valf.type==_VECT){ + vecteur & valv = *valf._VECTptr; + int s=v.size(); + if (s>1){ + gen valv1=valv[1]; + if (valv1.type==_VECT && valv1._VECTptr->size()>2){ + tmp=symbolic(at_extract_measure,v[1]); + } + } + } + } + } } } return tmp; @@ -3661,15 +3778,20 @@ if (!hp) hp=geo_find_history_pack(this); context * contextptr = hp?hp->contextptr:0; + int locked=0; #ifdef HAVE_LIBPTHREAD - // cerr << "geo2d lock" << endl; - pthread_mutex_lock(&interactive_mutex); - bool b=io_graph(contextptr); - io_graph(contextptr)=false; + // cerr << "geo2d draw lock" << endl; + locked=pthread_mutex_trylock(&interactive_mutex); #endif + bool b,block; + if (!locked){ + b=io_graph(contextptr); + io_graph(contextptr)=false; + block=block_signal; + block_signal=true; + } int clip_x,clip_y,clip_w,clip_h; - bool block=block_signal; - block_signal=true; + // cerr << "geo2d draw block signal " << this << endl; fl_clip_box(x(),y(),w(),h(),clip_x,clip_y,clip_w,clip_h); fl_push_clip(clip_x,clip_y,clip_w,clip_h); int vertical_pixels; @@ -3686,12 +3808,15 @@ } fl_pop_clip(); ++animation_instructions_pos; - block_signal=block; + if (!locked){ + block_signal=block; + // cerr << "geo2d draw unblock signal " << this << endl; + io_graph(contextptr)=b; #ifdef HAVE_LIBPTHREAD - // cerr << "geo2d unlock" << endl; - pthread_mutex_unlock(&interactive_mutex); - io_graph(contextptr)=b; + pthread_mutex_unlock(&interactive_mutex); + // cerr << "geo2d draw unlock" << endl; #endif + } } inline void swapint(int & i0,int & i1){ @@ -4371,7 +4496,7 @@ if (function.type==_FUNC){ bool dim2=dynamic_cast<Graph2d *>(this); vecteur args2=args_tmp; - if ( *function._FUNCptr==(dim2?at_cercle:at_sphere) ) + if ( *function._FUNCptr==(dim2?at_cercle:at_sphere) && !args_tmp.back().is_symb_of_sommet(at_extract_measure)) args2=makevecteur(args_tmp.front(),args_tmp.back()-args_tmp.front()); if (function==at_ellipse) ; @@ -4381,8 +4506,25 @@ approx_mode(true,contextptr); plot_tmp=symbolic(*function._FUNCptr,title_tmp); if (!lidnt(title_tmp).empty()) - cerr << plot_tmp << endl; + ; // cerr << plot_tmp << endl; + bool bb=io_graph(contextptr); + int locked=0; + if (bb){ +#ifdef HAVE_LIBPTHREAD + // cerr << "plot title lock" << endl; + locked=pthread_mutex_trylock(&interactive_mutex); +#endif + if (!locked) + io_graph(false,contextptr); + } plot_tmp=protecteval(plot_tmp,1,contextptr); + if (bb && !locked){ + io_graph(bb,contextptr); +#ifdef HAVE_LIBPTHREAD + pthread_mutex_unlock(&interactive_mutex); + // cerr << "plot title unlock" << endl; +#endif + } if (!b) approx_mode(false,contextptr); } // end function.type==_FUNC @@ -4459,7 +4601,11 @@ gen plot_tmp=*jt; if (plot_tmp.is_symb_of_sommet(at_pnt) && plot_tmp._SYMBptr->feuille.type==_VECT && !plot_tmp._SYMBptr->feuille._VECTptr->empty()){ vecteur & v=*plot_tmp._SYMBptr->feuille._VECTptr; - plot_tmp=symbolic(at_pnt,makevecteur(v[0],v[1].val | _DOT_LINE | _LINE_WIDTH_2)); + // cerr << v << endl; + if (v[1].type==_INT_) + plot_tmp=symbolic(at_pnt,makevecteur(v[0],v[1].val | _DOT_LINE | _LINE_WIDTH_2)); + else + plot_tmp=symbolic(at_pnt,v); try { fltk_draw(*this,-1,plot_tmp,x_scale,y_scale,clip_x,clip_y,clip_w,clip_h); } @@ -4579,12 +4725,16 @@ hp=geo_find_history_pack(this); context * contextptr = hp?hp->contextptr:0; #ifdef HAVE_LIBPTHREAD - pthread_mutex_lock(&interactive_mutex); + // cerr << "graph2d draw lock" << endl; + int locked=pthread_mutex_trylock(&interactive_mutex); + if (locked) + return; +#endif bool b=io_graph(contextptr); io_graph(false,contextptr); -#endif bool block=block_signal; block_signal=true; + // cerr << "graph2d draw " << this << " block_signal" << endl; fl_clip_box(x(),y(),w(),h(),clip_x,clip_y,clip_w,clip_h); fl_push_clip(clip_x,clip_y,clip_w,clip_h); int horizontal_pixels=w()-(show_axes?int(ylegende*labelsize()):0); @@ -4599,10 +4749,12 @@ fl_pop_clip(); if (!paused) ++animation_instructions_pos; + // cerr << "graph2d draw " << this << " restore block_signal" << endl; block_signal=block; + io_graph(b,contextptr); #ifdef HAVE_LIBPTHREAD pthread_mutex_unlock(&interactive_mutex); - io_graph(b,contextptr); + // cerr << "graph2d draw unlock" << endl; #endif } @@ -5393,7 +5545,7 @@ if (dim3) fl_alert("Not a 3-d graph"); else { - if (f && tablefunc_dialog(f,arg,true,0,gettext("Shade area under a curve"))){ + if (f && tablefunc_dialog(f,arg,true,2,gettext("Shade area under a curve"))){ History_Pack * hp=f->geo->hp; int pos; if (hp!=get_history_pack(wid,pos)) @@ -5545,6 +5697,26 @@ } } + static void cb_NumericalEdit(Fl_Widget * b , void*) { + Figure * f=find_figure(b); + if (!f) return; + if (!f->geo->hp) + return; + if (f && f->geo && f->geo->hp){ + History_Pack * hp =f->geo->hp; + const char * ch=fl_input(gettext("Real number?"),"1"); + static string s; + if (ch){ + double n=atof(ch); + gen g=symbolic(at_legende,makevecteur(gen(f->geo->window_xmin+(f->geo->window_xmax-f->geo->window_xmin)/20,f->geo->window_ymin+(f->geo->window_ymax-f->geo->window_ymin)/20),n)); + gen pntname(autoname(hp->contextptr),hp->contextptr); + g=symbolic(at_sto,gen(makevecteur(g,pntname),_SEQ__VECT)); + f->geo->autoname_plus_plus(); + f->geo->hp->set_gen_value(-1,g); + } + } + } + bool dim3(Fl_Widget * m){ Figure * f=find_figure(m); if (f && f->geo) @@ -5589,6 +5761,77 @@ cb_set_mode(m,at_droite,at_droite,2,gettext("Point1,Point2")); } + static void cb_DistanceAB(Fl_Widget * m , void*) { + cb_set_mode(m,at_segment,at_longueurat,3,gettext("Object1,Object2,Position")); + } + static void cb_DistanceABraw(Fl_Widget * m , void*) { + cb_set_mode(m,at_segment,at_longueuratraw,3,gettext("Object1,Object2,Position")); + } + + static void cb_AngleABC(Fl_Widget * m , void*) { + cb_set_mode(m,at_triangle,at_angleat,4,gettext("Angle_vertex,Direction1,Direction2,Position")); + } + static void cb_AngleABCraw(Fl_Widget * m , void*) { + cb_set_mode(m,at_triangle,at_angleatraw,4,gettext("Angle_vertex,Direction1,Direction2,Position")); + } + + static void cb_Arearaw(Fl_Widget * m , void*) { + cb_set_mode(m,at_areaatraw,at_areaatraw,2,gettext("Object,Position")); + } + + static void cb_Perimeterraw(Fl_Widget * m , void*) { + cb_set_mode(m,at_perimeteratraw,at_perimeteratraw,2,gettext("Object,Position")); + } + + static void cb_Sloperaw(Fl_Widget * m , void*) { + cb_set_mode(m,at_slopeatraw,at_slopeatraw,2,gettext("Object,Position")); + } + + static void cb_Symetrie(Fl_Widget * m , void*) { + cb_set_mode(m,at_segment,at_symetrie,2,gettext("Symetry_center_axis,Object")); + } + + static void cb_Inversion(Fl_Widget * m , void*) { + cb_set_mode(m,at_segment,at_inversion,2,gettext("Center,Object")); + } + + static void cb_Projection(Fl_Widget * m , void*) { + cb_set_mode(m,at_segment,at_projection,2,gettext("Curve,Object")); + } + + static void cb_Rotation(Fl_Widget * m , void*) { + cb_set_mode(m,at_polygone_ouvert,at_rotation,3,gettext("Center,Angle,Object")); + } + + static void cb_Homothetie(Fl_Widget * m , void*) { + cb_set_mode(m,at_polygone_ouvert,at_homothetie,3,gettext("Center,Ratio,Object")); + } + + static void cb_Translation(Fl_Widget * m , void*) { + cb_set_mode(m,at_segment,at_translation,2,gettext("Vector,Object")); + } + + static void cb_Similitude(Fl_Widget * m , void*) { + cb_set_mode(m,at_polygone_ouvert,at_similitude,4,gettext("Center,Ratio,Angle,Object")); + } + + static void cb_Polygone(Fl_Widget * m , void*) { + const char * ch=fl_input(gettext("Number of vertices?"),"5"); + static string s; + if (ch){ + int n=atoi(ch); + s=""; + if (n>=2){ + for (int i=1;i<=n;++i){ + s+=gettext("Point")+print_INT_(i); + if (i<n) + s+=","; + } + cb_set_mode(m,at_polygone_ouvert,at_polygone,n,s); + } + } + } + static void cb_Triangle(Fl_Widget * m , void*) { cb_set_mode(m,at_segment,at_triangle,3,gettext("Point1,Point2,Point3")); } @@ -5667,6 +5910,7 @@ {0}, // end file {gettext("Edit"), 0, 0, 0, 64, 0, 0, 14, 56}, {gettext("Add parameter"), 0, (Fl_Callback *) cb_Figure_Parameter, 0, 0, 0, 0, 14, 56}, + {gettext("Add numerical value"), 0, (Fl_Callback *) cb_NumericalEdit, 0, 0, 0, 0, 14, 56}, {gettext("Add new entry"), 0x8006e, (Fl_Callback *) cb_New_Input, 0, 0, 0, 0, 14, 56}, {gettext("Add an object trace"), 0, (Fl_Callback *) cb_Graph_Traceobject, 0, 0, 0, 0, 14, 56}, {gettext("Change selection attribut"), 0, (Fl_Callback *) cb_Figure_Change_Attributs, 0, 0, 0, 0, 14, 56}, @@ -5710,6 +5954,7 @@ {gettext("equilateral_triangle"), 0, (Fl_Callback *) cb_Triangle_Equilateral, 0, 0, 0, 0, 14, 56}, {gettext("square"), 0, (Fl_Callback *) cb_Carre, 0, 0, 0, 0, 14, 56}, {gettext("quadrilateral"), 0, (Fl_Callback *) cb_Quadrilatere, 0, 0, 0, 0, 14, 56}, + {gettext("polygon"), 0, (Fl_Callback *) cb_Polygone, 0, 0, 0, 0, 14, 56}, {0}, // end Triangle {gettext("Circles"), 0, 0, 0, 64, 0, 0, 14, 56}, {gettext("circle"), 0, (Fl_Callback *) cb_Circle, 0, 0, 0, 0, 14, 56}, @@ -5726,6 +5971,24 @@ {gettext("plane"), 0, (Fl_Callback *) cb_plan, 0, 0, 0, 0, 14, 56}, {gettext("sphere"), 0, (Fl_Callback *) cb_sphere, 0, 0, 0, 0, 14, 56}, {0}, // end Surfaces + {gettext("Measures"), 0, 0, 0, 64, 0, 0, 14, 56}, + {gettext("distance"), 0, (Fl_Callback *) cb_DistanceAB, 0, 0, 0, 0, 14, 56}, + {gettext("distance (raw)"), 0, (Fl_Callback *) cb_DistanceABraw, 0, 0, 0, 0, 14, 56}, + {gettext("angle"), 0, (Fl_Callback *) cb_AngleABC, 0, 0, 0, 0, 14, 56}, + {gettext("angle (raw)"), 0, (Fl_Callback *) cb_AngleABCraw, 0, 0, 0, 0, 14, 56}, + {gettext("area (raw)"), 0, (Fl_Callback *) cb_Arearaw, 0, 0, 0, 0, 14, 56}, + {gettext("perimeter (raw)"), 0, (Fl_Callback *) cb_Perimeterraw, 0, 0, 0, 0, 14, 56}, + {gettext("slope (raw)"), 0, (Fl_Callback *) cb_Sloperaw, 0, 0, 0, 0, 14, 56}, + {0}, // end measures + {gettext("Transformations"), 0, 0, 0, 64, 0, 0, 14, 56}, + {gettext("reflection"), 0, (Fl_Callback *) cb_Symetrie, 0, 0, 0, 0, 14, 56}, + {gettext("rotation"), 0, (Fl_Callback *) cb_Rotation, 0, 0, 0, 0, 14, 56}, + {gettext("translation"), 0, (Fl_Callback *) cb_Translation, 0, 0, 0, 0, 14, 56}, + {gettext("projection"), 0, (Fl_Callback *) cb_Projection, 0, 0, 0, 0, 14, 56}, + {gettext("homothety"), 0, (Fl_Callback *) cb_Homothetie, 0, 0, 0, 0, 14, 56}, + {gettext("similarity"), 0, (Fl_Callback *) cb_Similitude, 0, 0, 0, 0, 14, 56}, + {gettext("inversion"), 0, (Fl_Callback *) cb_Inversion, 0, 0, 0, 0, 14, 56}, + {0}, // end transformations {gettext("Intersection"), 0, (Fl_Callback *) cb_Inter_Unique, 0, 0, 0, 0, 14, 56}, {gettext("Exact"), 0, (Fl_Callback *) cb_Exact, 0, 0, 0, 0, 14, 56}, {gettext("Approx"), 0, (Fl_Callback *) cb_Approx, 0, 0, 0, 0, 14, 56}, Modified: trunk/giac-xcas/giac/src/Graph3d.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph3d.cc 2010-02-22 14:57:32 UTC (rev 771) +++ trunk/giac-xcas/giac/src/Graph3d.cc 2010-03-10 08:43:12 UTC (rev 772) @@ -2212,7 +2212,6 @@ // if printing is true, we call gl2ps to make an eps file void Graph3d::draw(){ // cerr << "graph3d" << endl; - bool save_block_signal = block_signal; int clip_x,clip_y,clip_w,clip_h; #ifdef __APPLE__ if (!find_clip_box(this,clip_x,clip_y,clip_w,clip_h)) @@ -2234,22 +2233,36 @@ if (!hp) hp=geo_find_history_pack(this); context * contextptr = hp?hp->contextptr:0; + int locked=0; #ifdef HAVE_LIBPTHREAD - pthread_mutex_lock(&interactive_mutex); - bool b=io_graph(contextptr); - io_graph(contextptr)=false; + locked=pthread_mutex_trylock(&interactive_mutex); #endif + bool b,block; + if (!locked){ + b=io_graph(contextptr); + io_graph(contextptr)=false; + block=block_signal; + block_signal=true; + } #ifdef __APPLE__ GLContext context; if (!glcontext){ // create context GLContext shared_ctx = 0; context = aglCreateContext( gl_choice->pixelformat, shared_ctx); - if (!context) return ; + if (!context){ + if (!locked){ + block_signal=block; + io_graph(contextptr)=b; +#ifdef HAVE_LIBPTHREAD + pthread_mutex_unlock(&interactive_mutex); +#endif + } + return ; + } glcontext = (void *) context; } else context = (GLContext) glcontext; - block_signal=true; GLint rect[] = { clip_x, win->h()-clip_y-clip_h, clip_w, clip_h}; aglSetInteger( (GLContext)context, AGL_BUFFER_RECT, rect ); aglEnable( (GLContext)context, AGL_BUFFER_RECT ); @@ -2263,7 +2276,6 @@ glViewport(0,0,w(),h()); // glDrawBuffer(GL_FRONT); #else - block_signal=true; gl_start(); glEnable(GL_SCISSOR_TEST); glScissor(clip_x, win->h()-clip_y-clip_h, clip_w, clip_h); // lower left @@ -2280,11 +2292,13 @@ if (!paused) ++animation_instructions_pos; //fl_pop_clip(); - block_signal=save_block_signal; + if (!locked){ + block_signal=block; + io_graph(contextptr)=b; #ifdef HAVE_LIBPTHREAD - pthread_mutex_unlock(&interactive_mutex); - io_graph(contextptr)=b; + pthread_mutex_unlock(&interactive_mutex); #endif + } } const char * Graph3d::latex(const char * filename_){ Modified: trunk/giac-xcas/giac/src/History.cc =================================================================== --- trunk/giac-xcas/giac/src/History.cc 2010-02-22 14:57:32 UTC (rev 771) +++ trunk/giac-xcas/giac/src/History.cc 2010-03-10 08:43:12 UTC (rev 772) @@ -337,6 +337,7 @@ const giac::context * contextptr = get_context(w); if (Fl_Input_ * i = dynamic_cast<Fl_Input_ *>(w)){ i->value(g.print(contextptr).c_str()); + i->position(0,0); if (Multiline_Input_tab * m = dynamic_cast<Multiline_Input_tab *>(i)){ m->_g=g; i->clear_changed(); @@ -402,6 +403,7 @@ context * contextptr=get_context(w); if (Fl_Input_ * i = dynamic_cast<Fl_Input_ *>(w)){ i->value(s.c_str()); + i->position(0,0); i->set_changed(); if (exec) i->do_callback(); @@ -1429,7 +1431,10 @@ _saving = false; return false; } - int savepos=_sel_begin,pos; + int savepos=_sel_begin,pos,yscrollerpos; + Fl_Scroll * scroller = dynamic_cast<Fl_Scroll *>(parent()); + if (scroller) + yscrollerpos=scroller->yposition(); set_sel_begin(Xcas_input_focus); pos=_sel_begin; if (pos<0) @@ -1455,6 +1460,13 @@ hf->autosave_rm(); } focus(pos,true); + if (scroller){ +#ifdef _HAVE_FL_UTF8_HDR_ + scroller->scroll_to(0,yscrollerpos); +#else + scroller->position(0,yscrollerpos); +#endif + } return true; } Modified: trunk/giac-xcas/giac/src/Input.cc =================================================================== --- trunk/giac-xcas/giac/src/Input.cc 2010-02-22 14:57:32 UTC (rev 771) +++ trunk/giac-xcas/giac/src/Input.cc 2010-03-10 08:43:12 UTC (rev 772) @@ -1136,6 +1136,7 @@ string s(value()),ans; if (position()<int(s.size())) s=s.substr(0,position()); + s=motclef(s); int remove; if (int ii=handle_tab(s,*completion_tab,window()->w(),window()->h()/3,remove,ans)){ window()->show(); Modified: trunk/giac-xcas/giac/src/Tableur.cc =================================================================== --- trunk/giac-xcas/giac/src/Tableur.cc 2010-02-22 14:57:32 UTC (rev 771) +++ trunk/giac-xcas/giac/src/Tableur.cc 2010-03-10 08:43:12 UTC (rev 772) @@ -928,6 +928,7 @@ } Flv_Table_Gen::~Flv_Table_Gen(){ + if (Xcas_input_focus==this) Xcas_input_focus=0; contextptr=get_context(this); if (evaled_table(contextptr)==this) evaled_table(contextptr)=0; @@ -1721,20 +1722,62 @@ return false; } - // type 1= plotfunc 3d, 0 plotfunc 2d, + int xcas_integration_method=0; + Fl_Output * Xcas_Methodes_Output=0; + void cb_Xcas_Methodes_builtin(Fl_Menu_* m , void*) { + xcas_integration_method=0; + if (Xcas_Methodes_Output) + Xcas_Methodes_Output->value(gettext("builtin integration")); + } + + void cb_Xcas_Methodes_right_rectangle(Fl_Menu_* m , void*) { + xcas_integration_method=1; + if (Xcas_Methodes_Output) + Xcas_Methodes_Output->value(gettext("right rectangle")); + } + + void cb_Xcas_Methodes_left_rectangle(Fl_Menu_* m , void*) { + xcas_integration_method=2; + if (Xcas_Methodes_Output) + Xcas_Methodes_Output->value(gettext("left rectangle")); + } + + void cb_Xcas_Methodes_middle_point(Fl_Menu_* m , void*) { + xcas_integration_method=3; + if (Xcas_Methodes_Output) + Xcas_Methodes_Output->value(gettext("middle point")); + } + + void cb_Xcas_Methodes_trapezoid(Fl_Menu_* m , void*) { + xcas_integration_method=4; + if (Xcas_Methodes_Output) + Xcas_Methodes_Output->value(gettext("trapezoid")); + } + + Fl_Menu_Item Xcas_Menu_Methodes[] = { + {gettext("builtin integration"), 0, (Fl_Callback*)cb_Xcas_Methodes_builtin, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, + {gettext("right_rectangle"), 0, (Fl_Callback*)cb_Xcas_Methodes_right_rectangle, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, + {gettext("left_rectangle"), 0, (Fl_Callback*)cb_Xcas_Methodes_left_rectangle, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, + {gettext("middle_point"), 0, (Fl_Callback*)cb_Xcas_Methodes_middle_point, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, + {gettext("trapezoid"), 0, (Fl_Callback*)cb_Xcas_Methodes_trapezoid, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, + {0,0,0,0,0,0,0,0,0} + }; + + // type 1= plotfunc 3d, 0 plotfunc 2d, 2 plotarea bool tablefunc_dialog(Fl_Widget * spread_ptr,std::string & arg,bool plot,int type,const string & title){ static Fl_Window * w = 0; static Fl_Input *fcn=0, *fcn3d=0,* varname=0, * varnamey=0,*target=0; static Fl_Value_Input * xmin=0,*xstep=0,*xmax=0; static Fl_Value_Input * ymin=0,*ystep=0,*ymax=0; static Fl_Return_Button * button0 = 0 ; + static Fl_Menu_Button * methode=0; static Fl_Button * button1 =0; static Line_Type * ltres=0; if (!w){ #ifdef IPAQ int dx=240,dy=300; #else - int dx=(spread_ptr?15*spread_ptr->labelsize():240), + int dx=(spread_ptr?20*spread_ptr->labelsize():400), dy=spread_ptr?8*spread_ptr->labelsize():300; #endif int lignes=5; @@ -1774,6 +1817,10 @@ ymax = new Fl_Value_Input(5*dx/6,2+3*dy/lignes,dx/6-2,dy/lignes-4,gettext("ymax")); ymax->value(4); ymax->step(0.5); + methode = new Fl_Menu_Button(0,2+3*dy/lignes,dx/3-2,dy/lignes-4,gettext("Choose")); + methode->menu(Xcas_Menu_Methodes); + Xcas_Methodes_Output = new Fl_Output(4*dx/6,2+3*dy/lignes,dx/3-2,dy/lignes-4,gettext("int. method")); + Xcas_Methodes_Output->value(gettext("builtin integration")); button0 = new Fl_Return_Button(2,2+4*dy/lignes,dx/2-4,dy/lignes-4); button0->shortcut(0xff0d); button0->label(gettext("OK")); @@ -1794,6 +1841,14 @@ else { target->show(); } + if (type==2){ + methode->show(); + Xcas_Methodes_Output->show(); + } + else { + methode->hide(); + Xcas_Methodes_Output->hide(); + } if (type==1){ ymax->show(); ymin->show(); @@ -1840,7 +1895,7 @@ } tbl->col(r); } - arg=(type?fcn3d:fcn)->value(); + arg=(type==1?fcn3d:fcn)->value(); gen cell; if (has_cell(arg,cell,context0)){ fl_alert(("Expression contains a cell name "+cell.print()).c_str()); @@ -1851,8 +1906,29 @@ if (type==1){ arg += "["+string(varname->value())+"="+print_DOUBLE_(xmin->value())+".."+print_DOUBLE_(xmax->value()) + string(",")+varnamey->value()+string("=")+print_DOUBLE_(ymin->value())+".."+print_DOUBLE_(ymax->value())+"],xstep="+print_DOUBLE_(xstep->value())+",ystep="+print_DOUBLE_(ystep->value())+",display="+print_color(ltres->line_type()); } - else - arg += string(varname->value())+"="+print_DOUBLE_(xmin->value())+".."+print_DOUBLE_(xmax->value())+",xstep="+print_DOUBLE_(xstep->value())+",display="+print_color(ltres->line_type()); + else { + arg += string(varname->value())+"="+print_DOUBLE_(xmin->value())+".."+print_DOUBLE_(xmax->value()); + if (type==2 && xcas_integration_method){ + arg += ","+print_INT_(int((xmax->value()-xmin->value())/xstep->value())); + switch (xcas_integration_method){ + case 1: + arg += ",right_rectangle"; + break; + case 2: + arg += ",left_rectangle"; + break; + case 3: + arg += ",middle_point"; + break; + case 4: + arg += ",trapezoid"; + break; + } + } + else + arg += ",xstep="+print_DOUBLE_(xstep->value()); + arg += ",display="+print_color(ltres->line_type()); + } } else arg += string(varname->value())+","+print_DOUBLE_(xmin->value())+","+print_DOUBLE_(xstep->value())+","+print_DOUBLE_(xmax->value())+",display="+print_color(ltres->line_type()); @@ -2129,6 +2205,7 @@ string arg,u0param; if (spread_ptr && tableseq_dialog(spread_ptr,arg,false,gettext("Table of value of a recurrent sequence"),u0param)){ arg="tableseq("+arg+")"; + spread_ptr->input->value(""); tableur_insert_replace(spread_ptr,arg); Tableur_Group * gr = dynamic_cast<Tableur_Group *>(spread_ptr->parent()); if (gr && !(gr->disposition & 2) && !spread_ptr->graph2d->window()->visible()){ Modified: trunk/giac-xcas/giac/src/Xcas1.cc =================================================================== --- trunk/giac-xcas/giac/src/Xcas1.cc 2010-02-22 14:57:32 UTC (rev 771) +++ trunk/giac-xcas/giac/src/Xcas1.cc 2010-03-10 08:43:12 UTC (rev 772) @@ -484,10 +484,13 @@ } if (Xcas_DispG_Window){ if (show_xcas_dispg){ - if (show_xcas_dispg==2){ + if (show_xcas_dispg & 2){ if (!Xcas_DispG_Window->visible()) Xcas_DispG->autoscale(); - Xcas_DispG_Window->show(); + if (show_xcas_dispg & 1) + Xcas_DispG_Window->iconize(); + else + Xcas_DispG_Window->show(); } else Xcas_DispG_Window->hide(); @@ -1048,9 +1051,9 @@ #ifdef HAVE_LIBPTHREAD // cerr << "geo2d lock" << endl; pthread_mutex_lock(&interactive_mutex); +#endif bool b=io_graph(contextptr); io_graph(contextptr)=false; -#endif bool block=block_signal; block_signal=true; // int m=gr->children(); @@ -1114,20 +1117,19 @@ aplatir(resgraph->plot_instructions,v2); if (v1!=v2){ if (Xcas_DispG_Cancel) Xcas_DispG_Cancel->hide(); - show_xcas_dispg=2; + show_xcas_dispg=3; } } else { if (Xcas_DispG_Cancel) Xcas_DispG_Cancel->hide(); - show_xcas_dispg=2; + show_xcas_dispg=3; } } } block_signal=block; + io_graph(contextptr)=b; #ifdef HAVE_LIBPTHREAD - // cerr << "geo2d unlock" << endl; pthread_mutex_unlock(&interactive_mutex); - io_graph(contextptr)=b; #endif // if hp has eval_below, call callback on next widget if (hp->eval_below) @@ -1152,10 +1154,9 @@ i->value("No_output"); hp->resize(); block_signal=block; + io_graph(contextptr)=b; #ifdef HAVE_LIBPTHREAD - // cerr << "geo2d unlock" << endl; pthread_mutex_unlock(&interactive_mutex); - io_graph(contextptr)=b; #endif } } @@ -2404,16 +2405,14 @@ return 1; } - pthread_mutex_t interactive_mutex = PTHREAD_MUTEX_INITIALIZER; - giac::gen Xcas_fltk_interactive(const giac::gen & g,GIAC_CONTEXT){ #ifdef HAVE_LIBPTHREAD // cerr << "xcas lock" << g << endl; pthread_mutex_lock(&interactive_mutex); #endif if (block_signal){ + cerr << "blocked " << g << endl; #ifdef HAVE_LIBPTHREAD - // cerr << "xcas unlock" << endl; pthread_mutex_unlock(&interactive_mutex); #endif return zero; Modified: trunk/giac-xcas/giac/src/Xcas1.h =================================================================== --- trunk/giac-xcas/giac/src/Xcas1.h 2010-02-22 14:57:32 UTC (rev 771) +++ trunk/giac-xcas/giac/src/Xcas1.h 2010-03-10 08:43:12 UTC (rev 772) @@ -57,10 +57,6 @@ extern Fl_Double_Window * Xcas_Debug_Window; extern int xcas_dispg_entries; -#ifdef HAVE_LIBPTHREAD - extern pthread_mutex_t interactive_mutex; -#endif - bool stream_copy(std::istream & in,std::ostream & out); extern bool interrupt_button; std::string print_DOUBLE_(double d); Modified: trunk/giac-xcas/giac/src/gen.cc =================================================================== --- trunk/giac-xcas/giac/src/gen.cc 2010-02-22 14:57:32 UTC (rev 771) +++ trunk/giac-xcas/giac/src/gen.cc 2010-03-10 08:43:12 UTC (rev 772) @@ -4008,15 +4008,18 @@ return symbolic(u,e); gen a0(w[0]); gen a1(w[1]); + if ( a1.type==_VECT && a1._VECTptr->size()==3 ) + return symbolic(u,gen(makenewvecteur(a0,a1,a1._VECTptr->back()),_PNT__VECT)); if ( a1.type==_VECT && a1._VECTptr->size()==2 ){ if (project){ // we must project a0 gen param=a1._VECTptr->back(); // v= [ pnt() t ] - if (param.type!=_VECT) setsizeerr("gen.cc/symbolic_plot_makevecteur"); - vecteur v=*param._VECTptr; - v[1]=projection(v[0],a0,contextptr); - a0=remove_at_pnt(parameter2point(v,contextptr)); // same - a1=makenewvecteur(a1._VECTptr->front(),v); + if (param.type==_VECT){ + vecteur v=*param._VECTptr; + v[1]=projection(v[0],a0,contextptr); + a0=remove_at_pnt(parameter2point(v,contextptr)); // same + a1=makenewvecteur(a1._VECTptr->front(),v); + } } else a1=a1._VECTptr->front(); Modified: trunk/giac-xcas/giac/src/global.cc =================================================================== --- trunk/giac-xcas/giac/src/global.cc 2010-02-22 14:57:32 UTC (rev 771) +++ trunk/giac-xcas/giac/src/global.cc 2010-03-10 08:43:12 UTC (rev 772) @@ -91,6 +91,9 @@ // FIXME: threads allowed curently disabled // otherwise fermat_gcd_mod_2var crashes at puccini bool threads_allowed=false,mpzclass_allowed=true; +#ifdef HAVE_LIBPTHREAD + pthread_mutex_t interactive_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif std::vector<aide> * vector_aide_ptr= new std::vector<aide>; std::vector<std::string> * vector_completions_ptr = new std::vector<std::string>; @@ -2621,8 +2624,11 @@ // (*v)[4]=end-beg; double dt=delta_tms(tmp1,tmp2); total_time(contextptr) += dt; - (*v)[4]=dt; - (*v)[5]=g; + try { + (*v)[4]=dt; + (*v)[5]=g; + } catch (std::runtime_error & e){ + } thread_eval_status(0,contextptr); pthread_exit(0); } Modified: trunk/giac-xcas/giac/src/global.h =================================================================== --- trunk/giac-xcas/giac/src/global.h 2010-02-22 14:57:32 UTC (rev 771) +++ trunk/giac-xcas/giac/src/global.h 2010-03-10 08:43:12 UTC (rev 772) @@ -626,6 +626,8 @@ // Check this in wait_001 function if you don't want the main thread to // be blocked by a call to thread_eval inside wait_001 pthread_mutex_t * mutexptr(GIAC_CONTEXT); + extern pthread_mutex_t interactive_mutex; + #endif // Check if a thread_eval is active bool is_context_busy(GIAC_CONTEXT); Modified: trunk/giac-xcas/giac/src/hist.cxx =================================================================== --- trunk/giac-xcas/giac/src/hist.cxx 2010-02-22 14:57:32 UTC (rev 771) +++ trunk/giac-xcas/giac/src/hist.cxx 2010-03-10 08:43:12 UTC (rev 772) @@ -1583,7 +1583,7 @@ int pos; std::string arg; xcas::History_Pack * f=xcas::get_history_pack(xcas::Xcas_input_focus,pos); -if (f && tablefunc_dialog(f,arg,true,0,gettext("Area under curve"))){ +if (f && tablefunc_dialog(f,arg,true,2,gettext("Area under curve"))){ f->add_entry(pos); arg="plotarea(" +arg+")"; f->set_value(pos,arg,true); Modified: trunk/giac-xcas/giac/src/hist.fl =================================================================== --- trunk/giac-xcas/giac/src/hist.fl 2010-02-22 14:57:32 UTC (rev 771) +++ trunk/giac-xcas/giac/src/hist.fl 2010-03-10 08:43:12 UTC (rev 772) @@ -2135,7 +2135,7 @@ callback {int pos; std::string arg; xcas::History_Pack * f=xcas::get_history_pack(xcas::Xcas_input_focus,pos); -if (f && tablefunc_dialog(f,arg,true,0,gettext("Area under curve"))){ +if (f && tablefunc_dialog(f,arg,true,2,gettext("Area under curve"))){ f->add_entry(pos); arg="plotarea(" +arg+")"; f->set_value(pos,arg,true); Modified: trunk/giac-xcas/giac/src/input_lexer.cc =================================================================== --- trunk/giac-xcas/giac/src/input_lexer.cc 2010-02-22 14:57:32 UTC (rev 771) +++ trunk/giac-xcas/giac/src/input_lexer.cc 2010-03-10 08:43:12 UTC (rev 772) @@ -8162,6 +8162,8 @@ l--; */ string ss; for (int i=0;i<l;++i){ + if (i && (unsigned char)s[i]==0xc2) + ss += ' '; if (s[i]=='.'){ if ( i && (i<l-1) && (s[i-1]!=' ') && (s[i+1]=='.') ){ ss+= " .."; Modified: trunk/giac-xcas/giac/src/input_lexer.ll =================================================================== --- trunk/giac-xcas/giac/src/input_lexer.ll 2010-02-22 14:57:32 UTC (rev 771) +++ trunk/giac-xcas/giac/src/input_lexer.ll 2010-03-10 08:43:12 UTC (rev 772) @@ -1248,6 +1248,8 @@ l--; */ string ss; for (int i=0;i<l;++i){ + if (i && (unsigned char)s[i]==0xc2) + ss += ' '; if (s[i]=='.'){ if ( i && (i<l-1) && (s[i-1]!=' ') && (s[i+1]=='.') ){ ss+= " .."; Modified: trunk/giac-xcas/giac/src/intg.cc =================================================================== --- trunk/giac-xcas/giac/src/intg.cc 2010-02-22 14:57:32 UTC (rev 771) +++ trunk/giac-xcas/giac/src/intg.cc 2010-03-10 08:43:12 UTC (rev 772) @@ -3379,6 +3379,8 @@ vstart=3; } else { // expression,t=tmin..tmax,y,y0 + if (vs<4) + settypeerr(); y0=v[3]; gen t=readvar(v[1]); f=makevecteur(v[0],t,v[2]); Modified: trunk/giac-xcas/giac/src/intgab.cc =================================================================== --- trunk/giac-xcas/giac/src/intgab.cc 2010-02-22 14:57:32 UTC (rev 771) +++ trunk/giac-xcas/giac/src/intgab.cc 2010-03-10 08:43:12 UTC (rev 772) @@ -838,7 +838,7 @@ somme_residues = somme_residues + residue(gof,x,w[i],contextptr); } } - res = normal((b-a)/alpha*cst_i,contextptr)*somme_residues; + res = normal(periode*cst_two_pi/alpha*cst_i,contextptr)*somme_residues; return true; } } Modified: trunk/giac-xcas/giac/src/misc.cc =================================================================== --- trunk/giac-xcas/giac/src/misc.cc 2010-02-22 14:57:32 UTC (rev 771) +++ trunk/giac-xcas/giac/src/misc.cc 2010-03-10 08:43:12 UTC (rev 772) @@ -3928,6 +3928,8 @@ attributs[1]=_romberg(gen(makevecteur(v[0],v[1]),_SEQ__VECT),contextptr); return pnt_attrib(gen(res,_GROUP__VECT),attributs,contextptr); } // end s==2 + if (s>=3) + v[2]=_floor(v[2],contextptr); if (s>=3 && v[2].type==_INT_){ int n=v[2].val; if (n<1) Modified: trunk/giac-xcas/giac/src/plot.cc =================================================================== --- trunk/giac-xcas/giac/src/plot.cc 2010-02-22 14:57:32 UTC (rev 771) +++ trunk/giac-xcas/giac/src/plot.cc 2010-03-10 08:43:12 UTC (rev 772) @@ -239,10 +239,35 @@ gen remove_at_pnt(const gen & e){ - if ((e.type==_SYMB) && (e._SYMBptr->sommet==at_pnt)) - return e._SYMBptr->feuille._VECTptr->front(); - else - return e; + if (e.type==_SYMB && e._SYMBptr->sommet==at_pnt){ + gen & f = e._SYMBptr->feuille; + if (f.type==_VECT){ + vecteur & v = *f._VECTptr; + int s=v.size(); + if (s){ + /* + if (s>1 && v[1].type==_VECT){ + gen & v1=v[1]; + if (v1.type==_VECT && v1._VECTptr->size()>1){ + gen v12=(*v1._VECTptr)[1]; + if (v12.type<=_CPLX) + return v12; + if (v12.type==_STRNG){ + string s=*v12._STRNGptr; + if (!s.empty() && s[s.size()-1]==' '){ + gen g(s,context0); + if (g.is_symb_of_sommet(at_equal)) + return g._SYMBptr->feuille._VECTptr->back(); + } + } + } + } + */ + return v.front(); + } + } + } + return e; } gen unsubtype(const gen & g){ @@ -4334,7 +4359,7 @@ if (g.is_symb_of_sommet(at_cercle)){ gen centre,rayon; centre_rayon(g,centre,rayon,false,contextptr); - return cst_pi*pow(rayon,2); + return cst_pi*ratnormal(rayon*conj(rayon,contextptr)); } if (g.type!=_VECT) return undef; @@ -4494,10 +4519,13 @@ unary_function_eval __angle(&giac::_angle,_angle_s); unary_function_ptr at_angle (&__angle,0,true); - bool is_near(const gen & a,const gen & b,double eps,GIAC_CONTEXT){ + bool is_near(const gen & a,const gen & b0,double eps,GIAC_CONTEXT){ + gen b=b0; if (b.is_symb_of_sommet(at_hyperplan) || b.is_symb_of_sommet(at_animation)) return false; if (b.type==_VECT){ + if (b.subtype==_VECTOR__VECT) + b.subtype=0; if (b.subtype==_POLYEDRE__VECT){ const_iterateur it=b._VECTptr->begin(),itend=b._VECTptr->end(); for (;it!=itend;++it){ @@ -4600,7 +4628,7 @@ ofstream child_out(cas_sortie_name().c_str()); archive(child_out,symbolic(at_signal,args),contextptr); archive(child_out,args_evaled,contextptr); - child_out << messages_to_print << '\xA4' ; + child_out << messages_to_print << "ÿ" ; child_out.close(); // cerr << "Signal reads " << res << endl; return wait_parent(); @@ -4649,9 +4677,9 @@ archive(child_out,e,contextptr); archive(child_out,e,contextptr); if ( (args.type==_VECT) && (args._VECTptr->empty()) ) - child_out << "User input requested\n" << '\xA4' ; + child_out << "User input requested\n" << "ÿ" ; else - child_out << args << '\xA4' ; + child_out << args << "ÿ" ; child_out.close(); kill_and_wait_sigusr2(); ifstream child_in(cas_entree_name().c_str()); @@ -6252,8 +6280,8 @@ double i,j,oldi,oldj,entrei,entrej; double t=function_tmin; int nstep=int((function_tmax-function_tmin)/function_tstep+.5); - bool old_io_graph=io_graph(contextptr); - io_graph(false,contextptr); + // bool old_io_graph=io_graph(contextptr); + // io_graph(false,contextptr); for (int count=0;count<=nstep;++count,t+= function_tstep){ local_sto_double(t,*vars._IDNTptr,newcontextptr); // vars._IDNTptr->localvalue->back()._DOUBLE_val =t; @@ -6320,7 +6348,7 @@ if (!chemin.empty()) res.push_back(symb_pnt(symb_curve(gen(makevecteur(f,vars,function_tmin,function_tmax),_PNT__VECT),gen(chemin,_GROUP__VECT)),attribut,contextptr)); leave(protect,localvar,newcontextptr); - io_graph(old_io_graph,contextptr); + // io_graph(old_io_graph,contextptr); #ifndef WIN32 if (child_id) plot_instructions.push_back(res); #endif // WIN32 @@ -7645,12 +7673,170 @@ if ( (position.type==_VECT) && (position._VECTptr->size()==2) ){ position=rdiv(position._VECTptr->front()+position._VECTptr->back(),plus_two); } - return symb_pnt_name(position+decal,couleur+_POINT_POINT,string2gen(s,false),contextptr); + gen sg=string2gen(s,false); + if (v.size()<2) + return symb_pnt_name(position+decal,couleur+_POINT_POINT,sg,contextptr); + else + return symb_pnt_name(position+decal,makevecteur(couleur+_POINT_POINT,v[1],sg),sg,contextptr); } const string _legende_s("legend"); unary_function_eval __legende(&giac::_legende,_legende_s); unary_function_ptr at_legende (&__legende,_QUOTE_ARGUMENTS,true); + gen _longueurat(const gen & args,GIAC_CONTEXT){ + if ( args.type!=_VECT ) + settypeerr(); + vecteur v = *args._VECTptr; + int s=v.size(); + if (s<3) + settypeerr(); + gen l=sqrt(_longueur2(gen(makevecteur(eval(v[0],eval_level(contextptr),contextptr),eval(v[1],eval_level(contextptr),contextptr)),_SEQ__VECT),contextptr),contextptr); + int save_digits=decimal_digits(contextptr); + decimal_digits(contextptr)=3; + string ss=v[0].print(contextptr)+v[1].print(contextptr)+"="+l.print(contextptr)+" "; + decimal_digits(contextptr)=save_digits; + l=gen('"'+ss+'"',false); + vecteur w=makevecteur(v[2],l); + for (int i=3; i<s;++i) + w.push_back(v[i]); + return _legende(gen(w,_SEQ__VECT),contextptr); + } + const string _longueurat_s("longueurat"); + unary_function_eval __longueurat(&_longueurat,_longueurat_s); + unary_function_ptr at_longueurat (&__longueurat,_QUOTE_ARGUMENTS,true); + + gen _longueuratraw(const gen & args,GIAC_CONTEXT){ + if ( args.type!=_VECT ) + settypeerr(); + vecteur v = *args._VECTptr; + int s=v.size(); + if (s<3) + settypeerr(); + gen l=sqrt(_longueur2(gen(makevecteur(v[0],v[1]),_SEQ__VECT),contextptr),contextptr); + vecteur w=makevecteur(v[2],l); + for (int i=3; i<s;++i) + w.push_back(v[i]); + return _legende(gen(w,_SEQ__VECT),contextptr); + } + const string _longueuratraw_s("longueuratraw"); + unary_function_eval __longueuratraw(&_longueuratraw,_longueuratraw_s); + unary_function_ptr at_longueuratraw (&__longueuratraw,0,true); + + gen _areaatraw(const gen & args,GIAC_CONTEXT){ + if ( args.type!=_VECT ) + settypeerr(); + vecteur v = *args._VECTptr; + int s=v.size(); + if (s<2) + settypeerr(); + gen l=_aire(v[0],contextptr); + vecteur w=makevecteur(v[1],l); + for (int i=2; i<s;++i) + w.push_back(v[i]); + return _legende(gen(w,_SEQ__VECT),contextptr); + } + const string _areaatraw_s("areaatraw"); + unary_function_eval __areaatraw(&_areaatraw,_areaatraw_s); + unary_function_ptr at_areaatraw (&__areaatraw,0,true); + + gen _slopeatraw(const gen & args,GIAC_CONTEXT){ + if ( args.type!=_VECT ) + settypeerr(); + vecteur v = *args._VECTptr; + int s=v.size(); + if (s<2) + settypeerr(); + gen l=_slope(v[0],contextptr); + vecteur w=makevecteur(v[1],l); + for (int i=2; i<s;++i) + w.push_back(v[i]); + return _legende(gen(w,_SEQ__VECT),contextptr); + } + const string _slopeatraw_s("slopeatraw"); + unary_function_eval __slopeatraw(&_slopeatraw,_slopeatraw_s); + unary_function_ptr at_slopeatraw (&__slopeatraw,0,true); + + gen _perimeteratraw(const gen & args,GIAC_CONTEXT){ + if ( args.type!=_VECT ) + settypeerr(); + vecteur v = *args._VECTptr; + int s=v.size(); + if (s<2) + settypeerr(); + gen l=_perimetre(v[0],contextptr); + vecteur w=makevecteur(v[1],l); + for (int i=2; i<s;++i) + w.push_back(v[i]); + return _legende(gen(w,_SEQ__VECT),contextptr); + } + const string _perimeteratraw_s("perimeteratraw"); + unary_function_eval __perimeteratraw(&_perimeteratraw,_perimeteratraw_s); + unary_function_ptr at_perimeteratraw (&__perimeteratraw,0,true); + + gen _extract_measure(const gen & valeur,GIAC_CONTEXT){ + gen tmp=valeur; + if (valeur.is_symb_of_sommet(at_pnt)){ + gen & valf = valeur._SYMBptr->feuille; + if (valf.type==_VECT){ + vecteur & valv = *valf._VECTptr; + int s=valv.size(); + if (s>1){ + gen valv1=valv[1]; + if (valv1.type==_VECT && valv1._VECTptr->size()>2){ + tmp=(*valv1._VECTptr)[1]; + if (tmp.type==_STRNG) + tmp=gen(*tmp._STRNGptr,contextptr); + if (tmp.is_symb_of_sommet(at_equal)) + tmp=tmp._SYMBptr->feuille._VECTptr->back(); + } + } + } + } + return tmp; + } + const string _extract_measure_s("extract_measure"); + unary_function_eval __extract_measure(&_extract_measure,_extract_measure_s); + unary_function_ptr at_extract_measure (&__extract_measure,0,true); + + gen _angleat(const gen & args,GIAC_CONTEXT){ + if ( args.type!=_VECT ) + settypeerr(); + vecteur v = *args._VECTptr; + int s=v.size(); + if (s<4) + settypeerr(); + gen l=_angle(gen(makevecteur(eval(v[0],eval_level(contextptr),contextptr),eval(v[1],eval_level(contextptr),contextptr),eval(v[2],eval_level(contextptr),contextptr)),_SEQ__VECT),contextptr); + int save_digits=decimal_digits(contextptr); + decimal_digits(contextptr)=3; + string ss="α"+v[0].print(contextptr)+"="+l.print(contextptr)+" "; + decimal_digits(contextptr)=save_digits; + l=gen('"'+ss+'"',false); + vecteur w=makevecteur(v[3],l); + for (int i=4; i<s;++i) + w.push_back(v[i]); + return _legende(gen(w,_SEQ__VECT),contextptr); + } + const string _angleat_s("angleat"); + unary_function_eval __angleat(&_angleat,_angleat_s); + unary_function_ptr at_angleat (&__angleat,_QUOTE_ARGUMENTS,true); + + gen _angleatraw(const gen & args,GIAC_CONTEXT){ + if ( args.type!=_VECT ) + settypeerr(); + vecteur v = *args._VECTptr; + int s=v.size(); + if (s<4) + settypeerr(); + gen l=_angle(gen(makevecteur(v[0],v[1],v[2]),_SEQ__VECT),contextptr); + vecteur w=makevecteur(v[3],l); + for (int i=4; i<s;++i) + w.push_back(v[i]); + return _legende(gen(w,_SEQ__VECT),contextptr); + } + const string _angleatraw_s("angleatraw"); + unary_function_eval __angleatraw(&_angleatraw,_angleatraw_s); + unary_function_ptr at_angleatraw (&__angleatraw,0,true); + gen _couleur(const gen & a,GIAC_CONTEXT){ if (a.type==_INT_){ int i=default_color(contextptr); @@ -7701,11 +7887,16 @@ unary_function_ptr at_parameter (&__parameter,0,true); gen plotfield(const gen & xp,const gen & yp,const gen & x,const gen & y,double xmin,double xmax,double xstep,double ymin,double ymax,double ystep,double scaling,vecteur & attributs,bool normalize,const context * contextptr){ -#ifndef WIN32 bool old_iograph=io_graph(contextptr); - if (thread_eval_status(contextptr)!=1) + if (old_iograph){ +#ifdef HAVE_LIBPTHREAD + pthread_mutex_lock(&interactive_mutex); +#endif io_graph(false,contextptr); +#ifdef HAVE_LIBPTHREAD + pthread_mutex_unlock(&interactive_mutex); #endif + } vecteur xy_v; xy_v.push_back(x); xy_v.push_back(y); @@ -7734,9 +7925,18 @@ } } } -#ifndef WIN32 - io_graph(old_iograph,contextptr); + if (old_iograph){ +#ifdef HAVE_LIBPTHREAD + pthread_mutex_lock(&interactive_mutex); #endif + io_graph(true,contextptr); +#ifdef HAVE_LIBPTHREAD + pthread_mutex_unlock(&interactive_mutex); +#endif + iterateur it=res.begin(),itend=res.end(); + for (;it!=itend;++it) + __interactive.op(*it,contextptr); + } return gen(res,_GROUP__VECT); } @@ -7874,7 +8074,7 @@ int vs=v.size(); for (int i=3;i<vs;++i){ if (readvar(v[i])==vars[0]){ - if (readrange(v[i],gnuplot_xmin,gnuplot_xmax,v[i],ym[0],ym[1],contextptr)){ + if (readrange(v[i],gnuplot_xmin,gnuplot_xmax,v[i],ym[0],yM[0],contextptr)){ ymin=ym; ymax=yM; v.erase(v.begin()+i); @@ -7882,7 +8082,7 @@ } } if (readvar(v[i])==vars[1]){ - if (readrange(v[i],gnuplot_xmin,gnuplot_xmax,v[i],yM[0],yM[1],contextptr)){ + if (readrange(v[i],gnuplot_xmin,gnuplot_xmax,v[i],ym[1],yM[1],contextptr)){ ymin=ym; ymax=yM; v.erase(v.begin()+i); @@ -7954,8 +8154,11 @@ #endif identificateur tt(" t"); gen t(tt); - vecteur vars=makevecteur(tt,x,y); + vecteur vars=makevecteur(t,x,y); + // if (is_one(xp)) vars[0]=symb_equal(t,symb_interval(xmin,xmax)); vecteur f(makevecteur(xp,yp)); + gen xminmax=symb_equal(x,symb_interval(xmin,xmax)); + gen yminmax=symb_equal(y,symb_interval(ymin,ymax)); for (;;){ gen localisation=__click.op(vecteur(0),contextptr).evalf_double(1,contextptr); double x0,y0; @@ -7974,12 +8177,12 @@ } } #ifdef WIN32 - res.push_back(_plotode(gen(makevecteur(f,vars,makevecteur(0,x0,y0),at_plan),_SEQ__VECT),contextptr)); + res.push_back(_plotode(gen(makevecteur(f,vars,makevecteur(0,x0,y0),xminmax,yminmax,at_plan),_SEQ__VECT),contextptr)); #else if (thread_eval_status(contextptr)==1) - res.push_back(_plotode(gen(makevecteur(f,vars,makevecteur(0,x0,y0),at_plan),_SEQ__VECT),contextptr)); + res.push_back(_plotode(gen(makevecteur(f,vars,makevecteur(0,x0,y0),xminmax,yminmax,at_plan),_SEQ__VECT),contextptr)); else - res.push_back(_signal(_plotode(gen(makevecteur(f,vars,makevecteur(0,x0,y0),at_plan),_SEQ__VECT),contextptr),contextptr)); + res.push_back(_signal(_plotode(gen(makevecteur(f,vars,makevecteur(0,x0,y0),xminmax,yminmax,at_plan),_SEQ__VECT),contextptr),contextptr)); #endif } return res; @@ -8258,7 +8461,8 @@ } ostream & archive(ostream & os,const gen & e,GIAC_CONTEXT){ - unsigned et=e.type,es=e.subtype; + unsigned et=e.type; + signed es=e.subtype; switch (et){ case _INT_: return os << et << " " << e.val << " " << es << endl; @@ -11115,6 +11319,7 @@ w.push_back(eval(symb_sto(d,v[3]),contextptr)); return gen(w,_GROUP__VECT); setsizeerr("div-harmonique)"); + return 0; } const string _div_harmonique_s("harmonic_division"); unary_function_eval __div_harmonique(&giac::_div_harmonique,_div_harmonique_s); @@ -11320,6 +11525,7 @@ unary_function_ptr notexprint_plot_sommets[]={at_funcplot,at_paramplot,at_polarplot,at_implicitplot,at_contourplot,at_odeplot,at_interactive_odeplot,at_fieldplot,at_seqplot,at_ellipse,at_hyperbole,at_parabole,0}; unary_function_ptr implicittex_plot_sommets[]={at_plot,at_plot3d,at_plotfunc,at_plotparam,at_plotpolar,at_plotimplicit,at_plotcontour,at_DrawInv,at_DrawFunc,at_DrawParm,at_DrawPol,at_DrwCtour,at_plotode,at_plotfield,at_interactive_plotode,at_plotseq,at_Graph,0}; unary_function_ptr point_sommet_tab_op[]={at_point,at_element,at_inter_unique,at_centre,at_isobarycentre,at_barycentre,0}; + unary_function_ptr nosplit_polygon_function[]={at_inter_unique,at_rotation,at_projection,at_symetrie,at_areaatraw,at_perimeteratraw,at_slopeatraw,0}; #ifndef NO_NAMESPACE_GIAC Modified: trunk/giac-xcas/giac/src/plot.h =================================================================== --- trunk/giac-xcas/giac/src/plot.h 2010-02-22 14:57:32 UTC (rev 771) +++ trunk/giac-xcas/giac/src/plot.h 2010-03-10 08:43:12 UTC (rev 772) @@ -481,6 +481,14 @@ extern const std::string _legende_s; gen _legende(const gen & args,GIAC_CONTEXT); extern unary_function_ptr at_legende; + extern unary_function_ptr at_longueurat; + extern unary_function_ptr at_longueuratraw; + extern unary_function_ptr at_angleat; + extern unary_function_ptr at_angleatraw; + extern unary_function_ptr at_areaatraw; + extern unary_function_ptr at_perimeteratraw; + extern unary_function_ptr at_slopeatraw; + extern unary_function_ptr at_extract_measure; extern const std::string _couleur_s; gen _couleur(const gen & args,GIAC_CONTEXT); @@ -748,7 +756,7 @@ extern unary_function_ptr at_vector; extern unary_function_ptr point_sommet_tab_op[]; - + extern unary_function_ptr nosplit_polygon_function[]; /* following obsolete declaration that will be remove in the future when all fork/child etc. will be removed */ extern vecteur plot_instructions; Modified: trunk/giac-xcas/giac/src/prog.cc =================================================================== --- trunk/giac-xcas/giac/src/prog.cc 2010-02-22 14:57:32 UTC (rev 771) +++ trunk/giac-xcas/giac/src/prog.cc 2010-03-10 08:43:12 UTC (rev 772) @@ -272,23 +272,23 @@ return addvars; } // res1= list of assignation with =, res2= list of non-local vars - void check_local_assign(const gen & g,vecteur & vars,vecteur & res1,vecteur & res2,GIAC_CONTEXT){ + void check_local_assign(const gen & g,vecteur & vars,vecteur & res1,vecteur & res2,bool testequal,GIAC_CONTEXT){ if (g.is_symb_of_sommet(at_local)){ gen &f=g._SYMBptr->feuille; if (f.type!=_VECT || f._VECTptr->size()!=2) return; vecteur addvars(rm_checktype(gen2vecteur(f._VECTptr->front()))); vecteur newvars(mergevecteur(vars,addvars)); - check_local_assign(f._VECTptr->back(),newvars,res1,res2,contextptr); + check_local_assign(f._VECTptr->back(),newvars,res1,res2,testequal,contextptr); return; } if (g.is_symb_of_sommet(at_bloc) || g.is_symb_of_sommet(at_for) || g.is_symb_of_sommet(at_ifte)){ - check_local_assign(g._SYMBptr->feuille,vars,res1,res2,contextptr); + check_local_assign(g.... [truncated message content] |
From: <pa...@us...> - 2010-02-22 14:58:24
|
Revision: 771 http://xcas.svn.sourceforge.net/xcas/?rev=771&view=rev Author: parisse Date: 2010-02-22 14:57:32 +0000 (Mon, 22 Feb 2010) Log Message: ----------- Modified Paths: -------------- trunk/giac-xcas/giac/src/Editeur.cc trunk/giac-xcas/giac/src/Graph3d.cc trunk/giac-xcas/giac/src/Tableur.cc trunk/giac-xcas/giac/src/gausspol.cc trunk/giac-xcas/giac/src/gen.cc trunk/giac-xcas/giac/src/ifactor.cc trunk/giac-xcas/giac/src/plot.cc trunk/giac-xcas/giac/src/plot3d.cc trunk/giac-xcas/giac/src/series.cc trunk/giac-xcas/giac/src/solve.cc trunk/giac-xcas/giac/src/tex.cc trunk/giac-xcas/giac/src/threaded.cc trunk/giac-xcas/giac/src/usual.cc Modified: trunk/giac-xcas/giac/src/Editeur.cc =================================================================== --- trunk/giac-xcas/giac/src/Editeur.cc 2010-02-17 15:12:16 UTC (rev 770) +++ trunk/giac-xcas/giac/src/Editeur.cc 2010-02-22 14:57:32 UTC (rev 771) @@ -2114,8 +2114,9 @@ } giac::context * contextptr = get_context(this); History_Pack * hp=get_history_pack(this); + if (event==FL_KEYBOARD){ + Xcas_input_focus=this; #ifndef __APPLE__ - if (event==FL_KEYBOARD){ static string toolt; if (Fl::event_text()[0]=='('){ int pos=insert_position(); Modified: trunk/giac-xcas/giac/src/Graph3d.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph3d.cc 2010-02-17 15:12:16 UTC (rev 770) +++ trunk/giac-xcas/giac/src/Graph3d.cc 2010-02-22 14:57:32 UTC (rev 771) @@ -1361,7 +1361,7 @@ const_iterateur it=vv0.begin(),itend=vv0.end(); for (;it!=itend;++it){ if (it->type==_VECT){ - w = * it->_VECTptr; + w = *evalf_double(*it,1,contextptr)._VECTptr; int s=w.size(); if (s<3) continue; @@ -1422,7 +1422,7 @@ int s=vv0.size(); if (s==2 && check3dpoint(vv0.front()) && check3dpoint(vv0.back()) ){ // segment, half-line, vector or line - vecteur A(*vv0.front()._VECTptr),B(*vv0.back()._VECTptr); + vecteur A(*evalf_double(vv0.front(),1,contextptr)._VECTptr),B(*evalf_double(vv0.back(),1,contextptr)._VECTptr); vecteur dir(subvecteur(B,A)); double lambda=1,nu; double d1=evalf_double(dir[0],1,contextptr)._DOUBLE_val; Modified: trunk/giac-xcas/giac/src/Tableur.cc =================================================================== --- trunk/giac-xcas/giac/src/Tableur.cc 2010-02-17 15:12:16 UTC (rev 770) +++ trunk/giac-xcas/giac/src/Tableur.cc 2010-02-22 14:57:32 UTC (rev 771) @@ -558,6 +558,7 @@ return 0; last_event=event; if (event==FL_KEYBOARD){ + Xcas_input_focus=this; // int mode=Fl::event_state(FL_CTRL); if (Fl::event_key()==FL_Escape){ editing=false; @@ -636,10 +637,12 @@ return 1; } if ( event==FL_UNFOCUS || event==FL_HIDE || event==FL_SHOW ){ + /* if (event==FL_UNFOCUS){ selected.clear(); selected_1.clear(); } + */ return res; } if (res){ Modified: trunk/giac-xcas/giac/src/gausspol.cc =================================================================== --- trunk/giac-xcas/giac/src/gausspol.cc 2010-02-17 15:12:16 UTC (rev 770) +++ trunk/giac-xcas/giac/src/gausspol.cc 2010-02-22 14:57:32 UTC (rev 771) @@ -1369,7 +1369,7 @@ return res; } if (e.type==_FRAC) - return fraction(untrunc(e._FRACptr->num,degree,dimension),untrunc(e._FRACptr->den,degree,dimension)); + return fraction(untrunc(e._FRACptr->num,degree,dimension),untrunc(e._FRACptr->den,0,dimension)); return tensor<gen>(monomial<gen>(e,degree,1,dimension)); } Modified: trunk/giac-xcas/giac/src/gen.cc =================================================================== --- trunk/giac-xcas/giac/src/gen.cc 2010-02-17 15:12:16 UTC (rev 770) +++ trunk/giac-xcas/giac/src/gen.cc 2010-02-22 14:57:32 UTC (rev 771) @@ -9213,6 +9213,18 @@ res=gen(v,a_orig.subtype); return true; } + if (a_orig.type==_POLY){ + vector< monomial<gen> >::const_iterator it=a_orig._POLYptr->coord.begin(),itend=a_orig._POLYptr->coord.end(); + polynome v(a_orig._POLYptr->dim); + v.coord.reserve(itend-it); + for (;it!=itend;++it){ + if (!fracmod(it->value,modulo,res)) + return false; + v.coord.push_back(monomial<gen>(res,it->index)); + } + res=gen(v); + return true; + } if (a_orig.type==_CPLX){ gen reres,imres; if ( !fracmod(*a_orig._CPLXptr,modulo,reres) || !fracmod(*(a_orig._CPLXptr+1),modulo,imres) ) Modified: trunk/giac-xcas/giac/src/ifactor.cc =================================================================== --- trunk/giac-xcas/giac/src/ifactor.cc 2010-02-17 15:12:16 UTC (rev 770) +++ trunk/giac-xcas/giac/src/ifactor.cc 2010-02-22 14:57:32 UTC (rev 771) @@ -169,6 +169,8 @@ int p,i; vecteur v(2); vecteur u; + if (is_zero(n)) + return u; for (i=0;i<1229;++i){ if (n==1) break; Modified: trunk/giac-xcas/giac/src/plot.cc =================================================================== --- trunk/giac-xcas/giac/src/plot.cc 2010-02-17 15:12:16 UTC (rev 770) +++ trunk/giac-xcas/giac/src/plot.cc 2010-02-22 14:57:32 UTC (rev 771) @@ -6728,8 +6728,10 @@ aden=r2e(aden,v,contextptr); gen eq2=anum-y*aden; gen res=_resultant(makevecteur(eq1,eq2,t),contextptr); - if (approx) + if (approx){ res=evalf(res,1,contextptr); + res=normal(res/_lcoeff(res,contextptr),contextptr); + } return res; } Modified: trunk/giac-xcas/giac/src/plot3d.cc =================================================================== --- trunk/giac-xcas/giac/src/plot3d.cc 2010-02-17 15:12:16 UTC (rev 770) +++ trunk/giac-xcas/giac/src/plot3d.cc 2010-02-22 14:57:32 UTC (rev 771) @@ -1186,6 +1186,14 @@ return res; } + gen inter_solve(const gen & args,GIAC_CONTEXT){ + bool b=all_trig_sol(contextptr); + all_trig_sol(false,contextptr); + gen res=_solve(args,contextptr); + all_trig_sol(b,contextptr); + return res; + } + // a=hypersurface, b=hypersurface vecteur inter2hypersurface(const gen & a,const gen &b,GIAC_CONTEXT){ gen & af=a._SYMBptr->feuille; @@ -1214,7 +1222,7 @@ // that should give us t,u,v as a function of s // then we will draw the parametric curve A with respect to s (t replaced) vecteur veq(makevecteur(A[0]-B[0],A[1]-B[1],A[2]-B[2])); - gen sol=_solve(gen(makevecteur(veq,makevecteur(t,u,v)),_SEQ__VECT),contextptr); + gen sol=inter_solve(gen(makevecteur(veq,makevecteur(t,u,v)),_SEQ__VECT),contextptr); if (sol.type!=_VECT) setsizeerr(); // for each element of sol, get the first component t, subst in A @@ -1236,12 +1244,12 @@ bool swapped=is_zero(derive(curveeq,t,contextptr)); if (swapped) std::swap(s,t); - gen sol=_solve(gen(makevecteur(curveeq,t),_SEQ__VECT),contextptr); + gen sol=inter_solve(gen(makevecteur(curveeq,t),_SEQ__VECT),contextptr); if (sol.type!=_VECT) setsizeerr(); if (!swapped && sol._VECTptr->empty()){ std::swap(s,t); - sol=_solve(gen(makevecteur(curveeq,t),_SEQ__VECT),contextptr); + sol=inter_solve(gen(makevecteur(curveeq,t),_SEQ__VECT),contextptr); if (sol.type!=_VECT) setsizeerr(); } Modified: trunk/giac-xcas/giac/src/series.cc =================================================================== --- trunk/giac-xcas/giac/src/series.cc 2010-02-17 15:12:16 UTC (rev 770) +++ trunk/giac-xcas/giac/src/series.cc 2010-02-22 14:57:32 UTC (rev 771) @@ -180,6 +180,8 @@ } } + gen remove_lnexp(const gen & e,GIAC_CONTEXT); + void padd(const sparse_poly1 & a,const sparse_poly1 &b, sparse_poly1 & res,GIAC_CONTEXT){ // Series addition if (a.empty()){ @@ -240,7 +242,7 @@ gen sum=a_cur->coeff+b_cur->coeff; if (res.empty() || (series_flags(contextptr) & 0x1) ){ //cerr << sum << " "; - sum=recursive_normal(sum,contextptr); + sum=recursive_normal(remove_lnexp(sum,contextptr),contextptr); //cerr << sum << endl; } // gen sum=(a_cur->coeff+b_cur->coeff); Modified: trunk/giac-xcas/giac/src/solve.cc =================================================================== --- trunk/giac-xcas/giac/src/solve.cc 2010-02-17 15:12:16 UTC (rev 770) +++ trunk/giac-xcas/giac/src/solve.cc 2010-02-22 14:57:32 UTC (rev 771) @@ -1165,7 +1165,7 @@ return v; } solve(expr,x,v,isolate_mode,contextptr); - if (!(isolate_mode & 2)){ + if (!(isolate_mode & 2) && !has_num_coeff(v)){ // check solutions if there is a tan inside for (int i=0;i<s;++i){ if (lv[i].is_symb_of_sommet(at_tan)){ @@ -1579,7 +1579,7 @@ toofewargs("fsolve"); gen v0=remove_equal(v[0]); if (s==2 && v[1].type==_IDNT){ - gen v00=v0; + gen v00=evalf(v0,1,contextptr); // no initial guess, check for poly-like equation vecteur lv(lvar(v00)); int lvs=lv.size(); Modified: trunk/giac-xcas/giac/src/tex.cc =================================================================== --- trunk/giac-xcas/giac/src/tex.cc 2010-02-17 15:12:16 UTC (rev 770) +++ trunk/giac-xcas/giac/src/tex.cc 2010-02-22 14:57:32 UTC (rev 771) @@ -1030,7 +1030,7 @@ return opstring+gen2tex(feu,contextptr) ; return opstring+string("\\left(") + gen2tex(feu,contextptr) +string("\\right)"); } - if (mys.sommet==at_inv || feu._SYMBptr->sommet==at_prod){ + if (mys.sommet==at_inv || feu.is_symb_of_sommet(at_prod) ){ return string("\\frac{1}{") + gen2tex(feu,contextptr) +string("}"); } return opstring + "\\left(" + gen2tex(feu,contextptr) +"\\right)" ; Modified: trunk/giac-xcas/giac/src/threaded.cc =================================================================== --- trunk/giac-xcas/giac/src/threaded.cc 2010-02-17 15:12:16 UTC (rev 770) +++ trunk/giac-xcas/giac/src/threaded.cc 2010-02-22 14:57:32 UTC (rev 771) @@ -3422,7 +3422,7 @@ environment env; env.modulo=modulo; env.moduloon=true; - mulmodpoly(a,b,&env,tmp); + operator_times(a,b,0,tmp); DivRem(tmp,pmin,&env,q,res); } @@ -3508,7 +3508,7 @@ vecteur invmod(const vecteur & a,const Modred & R){ if (a.size()==1) return vecteur(1,invmod(a.front(),R.modulo)); - // should not occur since division test is done with lcoeff=1 + // should not occur if division test is done with lcoeff=1 vecteur ainv,v,d; environment env; env.modulo=R.modulo; @@ -3834,21 +3834,22 @@ // clear deno gen den(ppcm,_POLY1__VECT); if (ppcm.size()>1){ + gen adjust=invmod(ppcm.front(),modulo); for (kt=p.begin();kt!=ktend;++kt){ iterateur it=kt->g.begin(),itend=kt->g.end(); for (;it!=itend;++it){ if (it->type==_FRAC) - *it = it->_FRACptr->num * (den / (it->_FRACptr->den)); + *it = smod(adjust*(it->_FRACptr->num * (den / (it->_FRACptr->den))),modulo); else { if (it->type==_POLY){ vector< monomial<gen> >::iterator jt=it->_POLYptr->coord.begin(),jtend=it->_POLYptr->coord.end(); for (;jt!=jtend;++jt){ if (jt->value.type==_FRAC) - jt->value = den * jt->value ; + jt->value = smod(adjust*(den * jt->value),modulo) ; } } else - *it = den * (*it); + *it = smod(adjust*den * (*it),modulo); } } } @@ -3963,6 +3964,7 @@ // return false if the lcoeff is 0 bool horner_back_ext(const vector< T_unsigned<vecteur,hashgcd_U> > & g,int x,int modulo,vector< T_unsigned<vecteur,hashgcd_U> > & res){ gen tmp; + res.clear(); vector< T_unsigned<vecteur,hashgcd_U> >::const_iterator it=g.begin(),itend=g.end(); bool b=true; for (;it!=itend;++it){ Modified: trunk/giac-xcas/giac/src/usual.cc =================================================================== --- trunk/giac-xcas/giac/src/usual.cc 2010-02-17 15:12:16 UTC (rev 770) +++ trunk/giac-xcas/giac/src/usual.cc 2010-02-22 14:57:32 UTC (rev 771) @@ -1208,7 +1208,7 @@ return -asin(-e,contextptr); if (is_equal(e)) return apply_to_equal(e,asin,contextptr); - if (is_positive(e*e-1,contextptr)) + if (lidnt(e).empty() && is_positive(e*e-1,contextptr)) return asinasln(e,contextptr); return symb_asin(e); } @@ -4948,7 +4948,7 @@ // asymptotic expansion at infinity of int(exp(-t^2),t=x..inf) // z=1/x // z*exp(-x^2)*(1/2 - 1/4 z^2 +3/8 z^4-15/16 z^6 + ...) - long double z=1/x._DOUBLE_val,z2=z*z/2,res=0,pi=0.5; + long double z=1/absx,z2=z*z/2,res=0,pi=0.5; for (int n=0;;++n){ res += pi; pi = -pi*(2*n+1)*z2; @@ -4956,12 +4956,12 @@ break; } erfc=2/std::sqrt(M_PI)*double(std::exp(-1/z/z)*z*res); - return 1-erfc; + return sign(x,contextptr)*(1-erfc); } // a:=convert(series(erfc(x)*exp(x^2),x=X,24),polynom):; b:=subst(a,x=X+h):; if (absx>3 && absx<=5){ // Digits:=30; evalf(symb2poly(subst(b,X,4),h)) - long double Zl=x._DOUBLE_val-4,res=0; + long double Zl=absx-4,res=0; long double taberf[]={0.9323573505930262336910814663629e-18,-0.5637770672346891132663122366369e-17,0.3373969923698176600796949171416e-16,-0.1997937342757611758805760309387e-15,0.1170311628709846086671746844320e-14,-0.6779078623355796103927587022047e-14,0.3881943235655598141099274338263e-13,-0.2196789805508621713379735090290e-12,0.1228090799753488475137690971599e-11,-0.6779634525816110746734938098109e-11,0.3694326453071165814527058450923e-10,-0.1986203171147991823844885265211e-9,0.1053084120195192127202221248092e-8,-0.5503368542058483880654875851859e-8,0.2833197888944711586737808090450e-7,-0.1435964425391227330876779173688e-6,0.7160456646037012951391007806358e-6,-0.3510366649840828060143659147374e-5,0.1690564925777814684043808381146e-4,-0.7990888030555549397777128848414e-4,0.3703524689955564311420527395424e-3,-0.1681182076746114476323671722330e-2,0.7465433244975570766528102818814e-2,-0.3238350609502145478059791886069e-1,0.1369994576250613898894451230325}; unsigned N=sizeof(taberf)/sizeof(long double); for (unsigned i=0;i<N;i++){ @@ -4969,11 +4969,11 @@ res += taberf[i]; } erfc = double(std::exp(-absx*absx)*res); - return 1-erfc; + return sign(x,contextptr)*(1-erfc); } if (absx>5 && absx<=6.5){ // Digits:=30; evalf(symb2poly(subst(b,X,5.75),h)) - long double Zl=x._DOUBLE_val-5.75,res=0; + long double Zl=absx-5.75,res=0; long double taberf[]={-0.3899077949952308336341205103240e-12,0.2064555746398182434172952813760e-13,-0.7079917646274828801231710613009e-12,-0.2043006626755557967429543230042e-12,-0.2664588032913413248313045028978e-11,-0.3182230691773937386262907009549e-11,-0.4508687162250923186571888867300e-12,-0.2818971742901571639195611759894e-11,-0.4771270499789446447101554995178e-11,0.2345376254096117543212461524786e-11,-0.6529305258174487397807156793042e-11,0.9817004987916722489154147719630e-12,0.2085292084663647123257426988484e-10,-0.1586500138272075839895787048265e-9,0.1056533982771769784560244626854e-8,-0.6964568016562765632682760517056e-8,0.4530411628438409475101496352516e-7,-0.2918364042864784155554051827879e-6,0.1859299481340192895158490699981e-5,-0.1171241494503672776195474661763e-4,0.7292428889065898343608897828825e-4,-0.4485956983428598110336671805311e-3,0.2725273842847326036320664185043e-2,-0.1634321814380709002113440890281e-1,0.9669877816971385564543076482100e-1}; unsigned N=sizeof(taberf)/sizeof(long double); for (unsigned i=0;i<N;i++){ @@ -4981,7 +4981,7 @@ res += taberf[i]; } erfc = double(std::exp(-absx*absx)*res); - return 1-erfc; + return sign(x,contextptr)*(1-erfc); } } gen z=evalf_double(abs(x,contextptr),1,contextptr); @@ -5067,6 +5067,8 @@ gen erfc_; if (x.type==_DOUBLE_ || x.type==_CPLX || x.type==_REAL){ erf0(x,erfc_,contextptr); + if (x.type==_DOUBLE_ && x._DOUBLE_val<-3) + erfc_=2-erfc_; return erfc_; } return 1-symbolic(at_erf,x); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2010-02-17 15:13:02
|
Revision: 770 http://xcas.svn.sourceforge.net/xcas/?rev=770&view=rev Author: parisse Date: 2010-02-17 15:12:16 +0000 (Wed, 17 Feb 2010) Log Message: ----------- Modified Paths: -------------- trunk/giac-xcas/giac/src/Editeur.cc trunk/giac-xcas/giac/src/Editeur.h trunk/giac-xcas/giac/src/Graph.cc trunk/giac-xcas/giac/src/Help1.cc trunk/giac-xcas/giac/src/History.cc trunk/giac-xcas/giac/src/Xcas1.cc trunk/giac-xcas/giac/src/gauss.cc trunk/giac-xcas/giac/src/gen.cc trunk/giac-xcas/giac/src/gen.h trunk/giac-xcas/giac/src/global.cc trunk/giac-xcas/giac/src/hist.fl trunk/giac-xcas/giac/src/input_lexer.cc trunk/giac-xcas/giac/src/input_lexer.ll trunk/giac-xcas/giac/src/input_parser.cc trunk/giac-xcas/giac/src/input_parser.yy trunk/giac-xcas/giac/src/intg.cc trunk/giac-xcas/giac/src/intgab.cc trunk/giac-xcas/giac/src/intgab.h trunk/giac-xcas/giac/src/moyal.cc trunk/giac-xcas/giac/src/pari.cc trunk/giac-xcas/giac/src/plot.cc trunk/giac-xcas/giac/src/prog.cc trunk/giac-xcas/giac/src/solve.cc trunk/giac-xcas/giac/src/sym2poly.cc trunk/giac-xcas/giac/src/ti89.cc trunk/giac-xcas/giac/src/usual.cc trunk/giac-xcas/giac/src/usual.h Modified: trunk/giac-xcas/giac/src/Editeur.cc =================================================================== --- trunk/giac-xcas/giac/src/Editeur.cc 2010-02-04 14:37:51 UTC (rev 769) +++ trunk/giac-xcas/giac/src/Editeur.cc 2010-02-17 15:12:16 UTC (rev 770) @@ -1213,6 +1213,21 @@ } } + static void cb_Editeur_Gotoline(Fl_Widget* m , void*) { + Fl_Text_Editor * e = find_editor(m); + if (e){ + Fl::focus(e); + Fl_Value_Input * in = dynamic_cast<Fl_Value_Input *>(m); + if (in){ + double l=in->value(); + if (l<1) + l=1; + int newpos=e->buffer()->skip_lines(0,int(l)-1); + e->insert_position(newpos); + } + } + } + static void cb_Editeur_Indent_line(Fl_Widget* m , void*) { Fl_Text_Editor * e = find_editor(m); if (e){ @@ -1776,12 +1791,17 @@ *(menuitem+i)=*(Editeur_menu+i); menubar->menu (menuitem); change_menu_fontsize(menuitem,3,labelsize()); // 3=#submenus + linenumber=0; if (!logo){ nxt_button = new Fl_Button(x+w/3,y,w/12,L); nxt_button->labelsize(labelsize()); nxt_button->label(gettext("nxt")); nxt_button->tooltip(gettext("Find next occurence (defined by Edit->Search)")); nxt_button->callback((Fl_Callback *) cb_Editeur_Next); + linenumber = new Fl_Value_Input(x+w/3-w/12,y,w/12,L); + linenumber->tooltip(gettext("Line number")); + linenumber->callback((Fl_Callback *)cb_Editeur_Gotoline); + linenumber->when(FL_WHEN_ENTER_KEY|FL_WHEN_NOT_CHANGED); if (parent()==window()){ exec_button = new Save_Focus_Button(x+w/3-w/12,y,w/12,L); exec_button->callback((Fl_Callback *)cb_Editeur_Exec); @@ -2086,6 +2106,12 @@ return 0; if (event==FL_FOCUS) Xcas_input_focus=this; + if (Editeur * ed =dynamic_cast<Editeur *>(parent())){ + if (ed->linenumber){ + int n=buffer()->count_lines(0,insert_position())+1; + ed->linenumber->value(n); + } + } giac::context * contextptr = get_context(this); History_Pack * hp=get_history_pack(this); #ifndef __APPLE__ Modified: trunk/giac-xcas/giac/src/Editeur.h =================================================================== --- trunk/giac-xcas/giac/src/Editeur.h 2010-02-04 14:37:51 UTC (rev 769) +++ trunk/giac-xcas/giac/src/Editeur.h 2010-02-17 15:12:16 UTC (rev 770) @@ -35,6 +35,7 @@ #ifdef HAVE_LIBFLTK #include <FL/Fl_Double_Window.H> #include <FL/Fl_Button.H> +#include <FL/Fl_Value_Input.H> #include <FL/fl_draw.H> #include <FL/fl_message.H> #endif @@ -74,6 +75,7 @@ Fl_Menu_Bar * menubar; Fl_Button * button,*save_button,*nxt_button; Save_Focus_Button * exec_button; + Fl_Value_Input * linenumber; giac::context * contextptr; std::string extension; std::string search; Modified: trunk/giac-xcas/giac/src/Graph.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph.cc 2010-02-04 14:37:51 UTC (rev 769) +++ trunk/giac-xcas/giac/src/Graph.cc 2010-02-17 15:12:16 UTC (rev 770) @@ -2289,10 +2289,12 @@ } void Graph2d3d::resize(int X,int Y,int W,int H){ + /* if (parent() && !dynamic_cast<Figure *>(parent()) && !dynamic_cast<Tableur_Group *>(parent()) && mouse_param_group){ if (parent()->w()!=w()+mouse_param_group->w()) resize_mouse_param_group(parent()->w()-w()); } + */ Fl_Widget::resize(X,Y,W,H); } @@ -3489,7 +3491,7 @@ void Graph2d::geometry_round(double x,double y,double z,double eps,gen & tmp,GIAC_CONTEXT) { tmp= geometry_round_numeric(x,y,eps,approx); try { - selected=nearest_point(plot_instructions,tmp,eps,contextptr); + selected=nearest_point(plot_instructions,geometry_round_numeric(x,y,eps,true),eps,contextptr); // bug bonux: when a figure is saved, plot_instructions is saved // if there are sequences in plot_instructions // they are not put back in an individual level @@ -4377,7 +4379,10 @@ bool b=approx_mode(contextptr); if (!b) approx_mode(true,contextptr); - plot_tmp=protecteval(symbolic(*function._FUNCptr,title_tmp),1,contextptr); + plot_tmp=symbolic(*function._FUNCptr,title_tmp); + if (!lidnt(title_tmp).empty()) + cerr << plot_tmp << endl; + plot_tmp=protecteval(plot_tmp,1,contextptr); if (!b) approx_mode(false,contextptr); } // end function.type==_FUNC @@ -4576,7 +4581,7 @@ #ifdef HAVE_LIBPTHREAD pthread_mutex_lock(&interactive_mutex); bool b=io_graph(contextptr); - io_graph(contextptr)=false; + io_graph(false,contextptr); #endif bool block=block_signal; block_signal=true; @@ -4597,7 +4602,7 @@ block_signal=block; #ifdef HAVE_LIBPTHREAD pthread_mutex_unlock(&interactive_mutex); - io_graph(contextptr)=b; + io_graph(b,contextptr); #endif } @@ -4613,25 +4618,22 @@ if (pos>=0){ // Check if we need to update from pos or pos+1 if ( (last_event=FL_DRAG || last_event==FL_RELEASE) && pack->children()>pos){ Gen_Value_Slider * gs=dynamic_cast<Gen_Value_Slider *>(Fl::belowmouse()); - if (gs){ - ++pos; + if (gs){ // last handle required by a cursor? + Fl_Widget * wid=pack->child(pos),*wid1; + Fl_Tile * t=dynamic_cast<Fl_Tile *>(wid); + if (t && t->children()>=3) + wid=t->child(2); + Fl_Scroll * s =dynamic_cast<Fl_Scroll *>(wid); + if (s) + wid=s->child(0); + if (const Gen_Output * go = dynamic_cast<const Gen_Output *>(wid)){ + if (go->value().is_symb_of_sommet(at_parameter)) + ++pos; + } // cerr << clock() << " ++pos " << pos << " " << last_event << endl; } else ; // cerr << clock() << " =pos " << pos << " " << last_event << endl; - /* - Fl_Widget * wid=pack->child(pos),*wid1; - Fl_Tile * t=dynamic_cast<Fl_Tile *>(wid); - if (t && t->children()>=3) - wid=t->child(2); - Fl_Scroll * s =dynamic_cast<Fl_Scroll *>(wid); - if (s) - wid=s->child(0); - if (const Gen_Output * go = dynamic_cast<const Gen_Output *>(wid)){ - if (go->value().is_symb_of_sommet(at_parameter)) - ++pos; - } - */ } } else @@ -5215,8 +5217,8 @@ } static void cb_Figure_Function(Fl_Widget * m , void*) { - Figure * f=find_figure(m); - Fl_Widget * wid=Fl::focus(); + Fl_Widget * wid=Xcas_input_focus; + Figure * f=find_figure(wid); if (f){ string arg; bool dim3=dynamic_cast<Graph3d *>(f->geo); @@ -5229,13 +5231,14 @@ arg=autoname(hp->contextptr)+(dim3?":= plotfunc(":":=plot(")+arg+")"; f->geo->autoname_plus_plus(); hp->set_value(pos,arg,true); - } + } + else Fl::focus(wid); } } static void cb_Figure_helpon(Fl_Widget * m ,const string & cmd) { - Fl_Widget * wid=Fl::focus(); - Figure * f=find_figure(m); + Fl_Widget * wid=Xcas_input_focus; + Figure * f=find_figure(wid); if (f){ string ans; int remove=0; @@ -5256,6 +5259,7 @@ hp->add_entry(pos); hp->set_value(pos,ans,false); } + else Fl::focus(wid); } } @@ -5265,8 +5269,8 @@ } static void cb_Figure_Implicit(Fl_Widget * m , void*) { - Figure * f=find_figure(m); - Fl_Widget * wid=Fl::focus(); + Fl_Widget * wid=Xcas_input_focus; + Figure * f=find_figure(wid); if (f){ if (!f->geo->hp) return; @@ -5284,14 +5288,15 @@ arg=autoname(hp->contextptr)+":=plotimplicit("+arg+")"; f->geo->autoname_plus_plus(); hp->set_value(pos,arg,true); - } + } + else Fl::focus(wid); } } } static void cb_Figure_Plotfield(Fl_Widget * m , void*) { - Figure * f=find_figure(m); - Fl_Widget * wid=Fl::focus(); + Fl_Widget * wid=Xcas_input_focus; + Figure * f=find_figure(wid); if (f){ if (!f->geo->hp) return; @@ -5313,7 +5318,8 @@ } cb_set_mode(f,0,at_plotode,1,gettext("Point_on_ode_curve")); fl_message(gettext("Click initials conditions in graphic window. Change mode when finished.")); - } + } + else Fl::focus(wid); } } } @@ -5329,8 +5335,8 @@ } static void cb_Figure_Param(Fl_Widget * m , void*) { - Figure * f=find_figure(m); - Fl_Widget * wid=Fl::focus(); + Fl_Widget * wid=Xcas_input_focus; + Figure * f=find_figure(wid); if (f){ if (!f->geo->hp) return; @@ -5345,13 +5351,14 @@ arg=autoname(hp->contextptr)+":=plotparam("+arg+")"; f->geo->autoname_plus_plus(); hp->set_value(pos,arg,true); - } + } + else Fl::focus(wid); } } static void cb_Figure_Polar(Fl_Widget * m , void*) { - Figure * f=find_figure(m); - Fl_Widget * wid=Fl::focus(); + Fl_Widget * wid=Xcas_input_focus; + Figure * f=find_figure(wid); if (f){ if (!f->geo->hp) return; @@ -5370,13 +5377,14 @@ f->geo->autoname_plus_plus(); hp->set_value(pos,arg,true); } + else Fl::focus(wid); } } } static void cb_Figure_Plotarea(Fl_Widget * m , void*) { - Figure * f=find_figure(m); - Fl_Widget * wid=Fl::focus(); + Fl_Widget * wid=Xcas_input_focus; + Figure * f=find_figure(wid); if (f){ if (!f->geo->hp) return; @@ -5393,14 +5401,15 @@ hp->add_entry(pos); arg="plotarea("+arg+")"; hp->set_value(pos,arg,true); - } + } + else Fl::focus(wid); } } } static void cb_Figure_Sequence(Fl_Widget * m , void*) { - Fl_Widget * wid=Fl::focus(); - Figure * f=find_figure(m); + Fl_Widget * wid=Xcas_input_focus; + Figure * f=find_figure(wid); if (f){ if (!f->geo->hp) return; @@ -5419,7 +5428,8 @@ hp->set_value(pos,arg,false); hp->add_entry(pos); hp->set_value(pos,u0param,true); - } + } + else Fl::focus(wid); } } } Modified: trunk/giac-xcas/giac/src/Help1.cc =================================================================== --- trunk/giac-xcas/giac/src/Help1.cc 2010-02-04 14:37:51 UTC (rev 769) +++ trunk/giac-xcas/giac/src/Help1.cc 2010-02-17 15:12:16 UTC (rev 770) @@ -168,9 +168,10 @@ if (o == button0) { // view help file int tmp=br->value(); if (tmp) { - if (use_external_browser) - system((browser_command(v[tmp-1])).c_str()); + if (use_external_browser && !system((browser_command(v[tmp-1])).c_str())) + ; else { + use_external_browser=false; if (Xcas_help_window){ Xcas_help_window->load((v[tmp-1]).c_str()); xcas::Xcas_help_window->show(); Modified: trunk/giac-xcas/giac/src/History.cc =================================================================== --- trunk/giac-xcas/giac/src/History.cc 2010-02-04 14:37:51 UTC (rev 769) +++ trunk/giac-xcas/giac/src/History.cc 2010-02-17 15:12:16 UTC (rev 770) @@ -194,18 +194,19 @@ if (Fl_Scroll * s = dynamic_cast<Fl_Scroll *>(parent())){ int spos=s->yposition(); int chpos=ch->y()-y(); + int sh=s->h()-10; if (chpos<spos) #ifdef _HAVE_FL_UTF8_HDR_ - s->scroll_to(0,max(0,min(chpos,h()-s->h()))); + s->scroll_to(0,max(0,min(chpos,h()-sh))); #else - s->position(0,max(0,min(chpos,h()-s->h()))); + s->position(0,max(0,min(chpos,h()-sh))); #endif else { - if (chpos+gr->h()>spos+s->h()) + if (chpos+gr->h()>spos+sh) #ifdef _HAVE_FL_UTF8_HDR_ - s->scroll_to(0,chpos+gr->h()-s->h()); + s->scroll_to(0,chpos+gr->h()-sh); #else - s->position(0,chpos+gr->h()-s->h()); + s->position(0,chpos+gr->h()-sh); #endif else #ifdef _HAVE_FL_UTF8_HDR_ Modified: trunk/giac-xcas/giac/src/Xcas1.cc =================================================================== --- trunk/giac-xcas/giac/src/Xcas1.cc 2010-02-04 14:37:51 UTC (rev 769) +++ trunk/giac-xcas/giac/src/Xcas1.cc 2010-02-17 15:12:16 UTC (rev 770) @@ -288,17 +288,20 @@ o->textcolor(4); } { Fl_Group* o = Xcas_debug_buttons = new Fl_Group(0,7*dy/11,dx,dy/11); - { Fl_Button* o = Xcas_sst_button = new Fl_Button(0,7*dy/11,dx/8,dy/11, gettext("sst")); + { Fl_Button* o = Xcas_sst_button = new Fl_Button(0,7*dy/11,dx/8,dy/11, gettext("sst F5")); o->tooltip(gettext("Execute current line, skip function")); o->callback((Fl_Callback*)cb_Xcas_sst_button); + o->shortcut(0xffc2); } - { Fl_Button* o = Xcas_sst_in_button = new Fl_Button(dx/8,7*dy/11, dx/8, dy/11, gettext("in")); + { Fl_Button* o = Xcas_sst_in_button = new Fl_Button(dx/8,7*dy/11, dx/8, dy/11, gettext("in F6")); o->tooltip(gettext("Execute current line, step in function")); o->callback((Fl_Callback*)cb_Xcas_sst_in_button); + o->shortcut(0xffc3); } - { Fl_Button* o = Xcas_cont_button = new Fl_Button(2*dx/8,7*dy/11, dx/8, dy/11, gettext("cont")); + { Fl_Button* o = Xcas_cont_button = new Fl_Button(2*dx/8,7*dy/11, dx/8, dy/11, gettext("cont F7")); o->tooltip(gettext("Continue execution until next breakpoint")); o->callback((Fl_Callback*)cb_Xcas_cont_button); + o->shortcut(0xffc4); } { Fl_Button* o = Xcas_kill_button = new Fl_Button(3*dx/8,7*dy/11, dx/8, dy/11, gettext("kill")); o->tooltip(gettext("Kill current program")); @@ -1498,6 +1501,7 @@ } void graphic_load(Graph2d3d * res,const std::string & s,int L,string & line,int & i){ + /* if (res->mouse_param_group && !dynamic_cast<Figure *>(res->parent())){ int X=res->x(); int Y=res->y(); @@ -1509,6 +1513,7 @@ res->resize(X,Y,W-l,H); res->resize_mouse_param_group(l); } + */ next_line_nonl(s,L,line,i); if (s[i]=='\n') ++i; @@ -2080,7 +2085,7 @@ if (pos<=0 || pos>=tmps) pos= tmp.find("Graphic"); if (pos>0 && pos<tmps){ - Graph2d * res = new Graph2d(x,y,w+giac::LEGENDE_SIZE,h,0); + Graph2d * res = new Graph2d(x,y,w,h,0); res->labelfont(police); graphic_load(res,s,L,line,i); return res; @@ -2096,7 +2101,7 @@ } pos= tmp.find("Graph3d"); if (pos>0 && pos<tmps){ - Graph3d * res = new Graph3d(x,y,w+giac::LEGENDE_SIZE,h,"",0); + Graph3d * res = new Graph3d(x,y,w,h,"",0); res->labelfont(police); graphic_load(res,s,L,line,i); return res; @@ -2226,7 +2231,7 @@ Fl_Widget * o; for (;i<L;++before_position){ if (i+7<L && s.substr(i,7)=="// fltk"){ - if ( (o=widget_load(s,L,i,contextptr,pack->w()) )){ + if ( (o=widget_load(s,L,i,contextptr,pack->w()-pack->_printlevel_w) )){ if (Fl_Group * g=dynamic_cast<Fl_Group *>(o)) pack->add_entry(before_position,g); else @@ -2296,6 +2301,10 @@ if (Xcas_DispG) Xcas_DispG->add(g); return 1; } + if (u==at_equal){ + if (Xcas_DispG) Xcas_DispG->add(g); + return 1; + } if (u==at_erase){ // Xcas_DispG_Window->show(); // Xcas_Main_Window->show(); Modified: trunk/giac-xcas/giac/src/gauss.cc =================================================================== --- trunk/giac-xcas/giac/src/gauss.cc 2010-02-04 14:37:51 UTC (rev 769) +++ trunk/giac-xcas/giac/src/gauss.cc 2010-02-17 15:12:16 UTC (rev 770) @@ -578,7 +578,8 @@ // => x+i*y = x0+i*y0 + V0*(x[0]+i*y[0]) gen tmp=vp0*symb_cos(t)+cst_i*vp1*symb_sin(t); tmp=z0+zV0*tmp; - param_curves.push_back(makevecteur(tmp,t,0,cst_two_pi,cst_two_pi/60)); + bool rad=angle_radian(contextptr); + param_curves.push_back(makevecteur(tmp,t,0,rad?cst_two_pi:360,rad?cst_two_pi/60:6)); } else { if (is_zero(coeffcst)){ // 2 secant lines at (x0,y0) Modified: trunk/giac-xcas/giac/src/gen.cc =================================================================== --- trunk/giac-xcas/giac/src/gen.cc 2010-02-04 14:37:51 UTC (rev 769) +++ trunk/giac-xcas/giac/src/gen.cc 2010-02-17 15:12:16 UTC (rev 770) @@ -705,7 +705,7 @@ return; } if (g.type==_FRAC){ - gen tmp=real_object(g._FRACptr->num,precision)/real_object(g._FRACptr->den,precision); + gen tmp=g._FRACptr->num/real_object(g._FRACptr->den,precision); if (tmp.type==_REAL){ #ifdef HAVE_LIBMPFR mpfr_init2(inf,mpfr_get_prec(tmp._REALptr->inf)); @@ -1951,7 +1951,7 @@ return true; case _FRAC: if (decimal_digits(contextptr)<=14) - evaled=set_precision(*this,17).evalf_double(1,context0); + evaled=set_precision(re(contextptr),17).evalf_double(1,contextptr)+cst_i*set_precision(im(contextptr),17).evalf_double(1,contextptr); else evaled=rdiv(_FRACptr->num.evalf(level,contextptr),_FRACptr->den.evalf(level,contextptr)); return true; @@ -7662,456 +7662,615 @@ return res; } - string gen::print(GIAC_CONTEXT) const{ - switch (type ) { - case _INT_: - if (subtype==_INT_SOLVER){ - switch (val){ - case _UNFACTORED: - return "unfactored"; - case _BISECTION_SOLVER: - return "bisection_solver"; - case _FALSEPOS_SOLVER: - return "falsepos_solver"; - case _BRENT_SOLVER: - return "brent_solver"; - case _NEWTON_SOLVER: - return "newton_solver"; - case _DNEWTON_SOLVER: - return "dnewton_solver"; - case _NEWTONJ_SOLVER: - return "newtonj_solver"; - case _SECANT_SOLVER: - return "secant_solver"; - case _STEFFENSON_SOLVER: - return "steffenson_solver"; - case _HYBRIDSJ_SOLVER: - return "hybridsj_solver"; - case _HYBRIDJ_SOLVER: - return "hybridj_solver"; - case _HYBRIDS_SOLVER: - return "hybrids_solver"; - case _HYBRID_SOLVER: - return "hybrid_solver"; - case _GOLUB_REINSCH_DECOMP: - return "golub_reinsch_decomp"; - case _GOLUB_REINSCH_MOD_DECOMP: - return "golub_reinsch_mode_decomp"; - case _JACOBI_DECOMP: - return "jacobi_decomp"; - case _MINOR_DET: - return "minor_det"; - case _HESSENBERG_PCAR: - return "hessenberg_pcar"; - case _RATIONAL_DET: - return "rational_det"; - case _KEEP_PIVOT: - return "keep_pivot"; - case _FADEEV: - return "fadeev"; - case _BAREISS: - return "bareiss"; - default: - return print_INT_(val); - } + string printint32(int val,int subtype,GIAC_CONTEXT){ + if (subtype==_INT_TYPE) + return print_the_type(val,contextptr); + + if (subtype==_INT_SOLVER){ + switch (val){ + case _UNFACTORED: + return "unfactored"; + case _BISECTION_SOLVER: + return "bisection_solver"; + case _FALSEPOS_SOLVER: + return "falsepos_solver"; + case _BRENT_SOLVER: + return "brent_solver"; + case _NEWTON_SOLVER: + return "newton_solver"; + case _DNEWTON_SOLVER: + return "dnewton_solver"; + case _NEWTONJ_SOLVER: + return "newtonj_solver"; + case _SECANT_SOLVER: + return "secant_solver"; + case _STEFFENSON_SOLVER: + return "steffenson_solver"; + case _HYBRIDSJ_SOLVER: + return "hybridsj_solver"; + case _HYBRIDJ_SOLVER: + return "hybridj_solver"; + case _HYBRIDS_SOLVER: + return "hybrids_solver"; + case _HYBRID_SOLVER: + return "hybrid_solver"; + case _GOLUB_REINSCH_DECOMP: + return "golub_reinsch_decomp"; + case _GOLUB_REINSCH_MOD_DECOMP: + return "golub_reinsch_mode_decomp"; + case _JACOBI_DECOMP: + return "jacobi_decomp"; + case _MINOR_DET: + return "minor_det"; + case _HESSENBERG_PCAR: + return "hessenberg_pcar"; + case _RATIONAL_DET: + return "rational_det"; + case _KEEP_PIVOT: + return "keep_pivot"; + case _FADEEV: + return "fadeev"; + case _BAREISS: + return "bareiss"; + default: + return print_INT_(val); } - if (subtype==_INT_BOOLEAN){ - if (xcas_mode(contextptr)==2){ - if (val) - return "TRUE"; - else - return "FALSE"; - } - else { - if (val) - return "true"; - else - return "false"; - } + } + if (subtype==_INT_BOOLEAN){ + if (xcas_mode(contextptr)==2){ + if (val) + return "TRUE"; + else + return "FALSE"; } - if (subtype==_INT_COLOR){ - switch (language(contextptr)){ - case 1: - switch (val){ - case _BLACK: - return "noir"; - case _RED: - return "rouge"; - case _GREEN: - return "vert"; - case _YELLOW: - return "jaune"; - case _BLUE: - return "bleu"; - case _MAGENTA: - return "magenta"; - case _CYAN: - return "cyan"; - case _WHITE: - return "blanc"; - } - break; - default: - switch (val){ - case _BLACK: - return "black"; - case _RED: - return "red"; - case _GREEN: - return "green"; - case _YELLOW: - return "yellow"; - case _BLUE: - return "blue"; - case _MAGENTA: - return "magenta"; - case _CYAN: - return "cyan"; - case _WHITE: - return "white"; - } + else { + if (val) + return "true"; + else + return "false"; + } + } + if (subtype==_INT_COLOR){ + switch (language(contextptr)){ + case 1: + switch (val){ + case _BLACK: + return "noir"; + case _RED: + return "rouge"; + case _GREEN: + return "vert"; + case _YELLOW: + return "jaune"; + case _BLUE: + return "bleu"; + case _MAGENTA: + return "magenta"; + case _CYAN: + return "cyan"; + case _WHITE: + return "blanc"; + case _FILL_POLYGON: + return "rempli"; + case _QUADRANT2: + return "quadrant2"; + case _QUADRANT3: + return "quadrant3"; + case _QUADRANT4: + return "quadrant4"; + case _POINT_LOSANGE: + return "point_losange"; + case _POINT_CARRE: + return "point_carre"; + case _POINT_PLUS: + return "point_plus"; + case _POINT_TRIANGLE: + return "point_triangle"; + case _POINT_ETOILE: + return "point_etoile"; + case _POINT_POINT: + return "point_point"; + case _POINT_INVISIBLE: + return "point_invisible"; + case 49: + return "gomme"; + case _LINE_WIDTH_2: + return "epaisseur_ligne_2"; + case _LINE_WIDTH_3: + return "epaisseur_ligne_3"; + case _LINE_WIDTH_4: + return "epaisseur_ligne_4"; + case _LINE_WIDTH_5: + return "epaisseur_ligne_5"; + case _LINE_WIDTH_6: + return "epaisseur_ligne_6"; + case _LINE_WIDTH_7: + return "epaisseur_ligne_7"; + case _LINE_WIDTH_8: + return "epaisseur_ligne_8"; + case _POINT_WIDTH_2: + return "epaisseur_point_2"; + case _POINT_WIDTH_3: + return "epaisseur_point_3"; + case _POINT_WIDTH_4: + return "epaisseur_point_4"; + case _POINT_WIDTH_5: + return "epaisseur_point_5"; + case _POINT_WIDTH_6: + return "epaisseur_point_6"; + case _POINT_WIDTH_7: + return "epaisseur_point_7"; + case _POINT_WIDTH_8: + return "epaisseur_point_8"; + case _HIDDEN_NAME: + return "nom_cache"; + case _DASH_LINE: + return "ligne_tiret"; + case _DOT_LINE: + return "ligne_point"; + case _DASHDOT_LINE: + return "ligne_tiret_point"; + case _DASHDOTDOT_LINE: + return "ligne_tiret_pointpoint"; + case _CAP_FLAT_LINE: + return "ligne_chapeau_plat"; + case _CAP_ROUND_LINE: + return "ligne_chapeau_rond"; + case _CAP_SQUARE_LINE: + return "ligne_chapeau_carre"; } + break; + case 4: switch (val){ - case _FILL_POLYGON: - return "rempli"; - case _QUADRANT2: - return "quadrant2"; - case _QUADRANT3: - return "quadrant3"; - case _QUADRANT4: - return "quadrant4"; - case _POINT_LOSANGE: - return "point_losange"; - case _POINT_CARRE: - return "point_carre"; - case _POINT_PLUS: - return "point_plus"; - case _POINT_TRIANGLE: - return "point_triangle"; - case _POINT_ETOILE: - return "point_etoile"; - case _POINT_POINT: - return "point_point"; - case _POINT_INVISIBLE: - return "point_invisible"; - case 49: - return "gomme"; - case _LINE_WIDTH_2: - return "line_width_2"; - case _LINE_WIDTH_3: - return "line_width_3"; - case _LINE_WIDTH_4: - return "line_width_4"; - case _LINE_WIDTH_5: - return "line_width_5"; - case _LINE_WIDTH_6: - return "line_width_6"; - case _LINE_WIDTH_7: - return "line_width_7"; - case _LINE_WIDTH_8: - return "line_width_8"; - case _POINT_WIDTH_2: - return "point_width_2"; - case _POINT_WIDTH_3: - return "point_width_3"; - case _POINT_WIDTH_4: - return "point_width_4"; - case _POINT_WIDTH_5: - return "point_width_5"; - case _POINT_WIDTH_6: - return "point_width_6"; - case _POINT_WIDTH_7: - return "point_width_7"; - case _POINT_WIDTH_8: - return "point_width_8"; + case _BLACK: + return "black"; + case _RED: + return "red"; + case _GREEN: + return "green"; + case _YELLOW: + return "yellow"; + case _BLUE: + return "blue"; + case _MAGENTA: + return "magenta"; + case _CYAN: + return "cyan"; + case _WHITE: + return "white"; + case _FILL_POLYGON: + return "filled"; + case _QUADRANT2: + return "quadrant2"; + case _QUADRANT3: + return "quadrant3"; + case _QUADRANT4: + return "quadrant4"; + case _POINT_LOSANGE: + return "ρομβοειδές_σημείο"; + case _POINT_CARRE: + return "τετραγωνικό_σημείο"; + case _POINT_PLUS: + return "σταυροειδές_σημείο"; + case _POINT_TRIANGLE: + return "τριγωνικό_σημείο"; + case _POINT_ETOILE: + return "αστροειδές_σημείο"; + case _POINT_POINT: + return "point_point"; + case _POINT_INVISIBLE: + return "αόρατο_σημείο"; + case 49: + return "gomme"; + case _LINE_WIDTH_2: + return "εύρος_γραμμής_2"; + case _LINE_WIDTH_3: + return "εύρος_γραμμής_3"; + case _LINE_WIDTH_4: + return "εύρος_γραμμής_4"; + case _LINE_WIDTH_5: + return "εύρος_γραμμής_5"; + case _LINE_WIDTH_6: + return "εύρος_γραμμής_6"; + case _LINE_WIDTH_7: + return "εύρος_γραμμής_7"; + case _LINE_WIDTH_8: + return "εύρος_γραμμής_8"; + case _POINT_WIDTH_2: + return "εύρος_σημείου_2"; + case _POINT_WIDTH_3: + return "εύρος_σημείου_3"; + case _POINT_WIDTH_4: + return "εύρος_σημείου_4"; + case _POINT_WIDTH_5: + return "εύρος_σημείου_5"; + case _POINT_WIDTH_6: + return "εύρος_σημείου_6"; + case _POINT_WIDTH_7: + return "εύρος_σημείου_7"; + case _POINT_WIDTH_8: + return "εύρος_σημείου_8"; case _HIDDEN_NAME: return "hidden_name"; - case _DASH_LINE: - return "dash_line"; - case _DOT_LINE: - return "dot_line"; - case _DASHDOT_LINE: - return "dashdot_line"; - case _DASHDOTDOT_LINE: - return "dashdotdot_line"; - case _CAP_FLAT_LINE: - return "cap_flat_line"; - case _CAP_ROUND_LINE: - return "cap_round_line"; - case _CAP_SQUARE_LINE: - return "cap_square_line"; + case _DASH_LINE: + return "γραμμή_διακεκομμένη"; + case _DOT_LINE: + return "παύλα_τελεία"; + case _DASHDOT_LINE: + return "γραμμή_παύλα_τελεία"; + case _DASHDOTDOT_LINE: + return "γραμμή_παύλα_τελείατελεία"; + case _CAP_FLAT_LINE: + return "γραμμή_επίπεδο_καβούκι"; + case _CAP_ROUND_LINE: + return "γραμμή_στρογγυλό_καβούκι"; + case _CAP_SQUARE_LINE: + return "γραμμή_τετράγωνο_καβούκι"; } - } - if (subtype==_INT_PLOT){ - switch(val){ - case _ADAPTIVE: - return "adaptive"; - case _AXES: - return "axes"; - case _COLOR: - return "color"; - case _FILLED: + default: + switch (val){ + case _BLACK: + return "black"; + case _RED: + return "red"; + case _GREEN: + return "green"; + case _YELLOW: + return "yellow"; + case _BLUE: + return "blue"; + case _MAGENTA: + return "magenta"; + case _CYAN: + return "cyan"; + case _WHITE: + return "white"; + case _FILL_POLYGON: return "filled"; - case _FONT: - return "font"; - case _LABELS: - return "labels"; - case _LEGEND: - return "legend"; - case _LINESTYLE: - return "linestyle"; - case _RESOLUTION: - return "resolution"; - case _SAMPLE: - return "sample"; - case _SCALING: - return "scaling"; - case _STYLE: - return "style"; - case _SYMBOL: - return "symbol"; - case _SYMBOLSIZE: - return "symbolsize"; - case _THICKNESS: - return "thickness"; - case _TITLE: - return "title"; - case _TITLEFONT: - return "titlefont"; - case _VIEW: - return "view"; - case _AXESFONT: - return "axesfont"; - case _COORDS: - return "coords"; - case _LABELFONT: - return "labelfont"; - case _LABELDIRECTIONS: - return "labeldirections"; - case _NUMPOINTS: - return "numpoints"; - case _TICKMARKS: - return "tickmarks"; - case _XTICKMARKS: - return "xtickmarks"; - case _NSTEP: - return "nstep"; - case _XSTEP: - return "xstep"; - case _YSTEP: - return "ystep"; - case _ZSTEP: - return "zstep"; - case _TSTEP: - return "tstep"; - case _USTEP: - return "ustep"; - case _VSTEP: - return "vstep"; - case _FRAMES: - return "frames"; - case _GL_TEXTURE: - return "gl_texture"; - case _GL_LIGHT0: - return "gl_light0"; - case _GL_LIGHT1: - return "gl_light1"; - case _GL_LIGHT2: - return "gl_light2"; - case _GL_LIGHT3: - return "gl_light3"; - case _GL_LIGHT4: - return "gl_light4"; - case _GL_LIGHT5: - return "gl_light5"; - case _GL_LIGHT6: - return "gl_light6"; - case _GL_LIGHT7: - return "gl_light7"; - case _GL_AMBIENT: - return "gl_ambient"; - case _GL_SPECULAR: - return "gl_specular"; - case _GL_DIFFUSE: - return "gl_diffuse"; - case _GL_POSITION: - return "gl_position"; - case _GL_SPOT_DIRECTION: - return "gl_spot_direction"; - case _GL_SPOT_EXPONENT: - return "gl_spot_exponent"; - case _GL_SPOT_CUTOFF: - return "gl_spot_cutoff"; - case _GL_CONSTANT_ATTENUATION: - return "gl_constant_attenuation"; - case _GL_LINEAR_ATTENUATION: - return "gl_linear_attenuation"; - case _GL_QUADRATIC_ATTENUATION: - return "gl_quadratic_attenuation"; - case _GL_OPTION: - return "gl_option"; - case _GL_SMOOTH: - return "gl_smooth"; - case _GL_FLAT: - return "gl_flat"; - case _GL_SHININESS: - return "gl_shininess"; - case _GL_FRONT: - return "gl_front"; - case _GL_BACK: - return "gl_back"; - case _GL_FRONT_AND_BACK: - return "gl_front_and_back"; - case _GL_AMBIENT_AND_DIFFUSE: - return "gl_ambient_and_diffuse"; - case _GL_EMISSION: - return "gl_emission"; - case _GL_LIGHT_MODEL_AMBIENT: - return "gl_light_model_ambient"; - case _GL_LIGHT_MODEL_LOCAL_VIEWER: - return "gl_light_model_local_viewer"; - case _GL_LIGHT_MODEL_TWO_SIDE: - return "gl_light_model_two_side"; - case _GL_LIGHT_MODEL_COLOR_CONTROL: - return "gl_light_model_color_control"; - case _GL_BLEND: - return "gl_blend"; - case _GL_SRC_ALPHA: - return "gl_src_alpha"; - case _GL_ONE_MINUS_SRC_ALPHA: - return "gl_one_minus_src_alpha"; - case _GL_SEPARATE_SPECULAR_COLOR: - return "gl_separate_specular_color"; - case _GL_SINGLE_COLOR: - return "gl_single_color"; - case _GL_MATERIAL: - return "gl_material"; - case _GL_COLOR_INDEXES: - return "gl_color_indexes"; - case _GL_LIGHT: - return "gl_light"; - case _GL_PERSPECTIVE: - return "gl_perspective"; - case _GL_ORTHO: - return "gl_ortho"; - case _GL_QUATERNION: - return "gl_quaternion"; - case _GL_ROTATION_AXIS: - return "gl_rotation_axis"; - case _GL_X: - return "gl_x"; - case _GL_Y: - return "gl_y"; - case _GL_Z: - return "gl_z"; - case _GL_XTICK: - return "gl_xtick"; - case _GL_YTICK: - return "gl_ytick"; - case _GL_ZTICK: - return "gl_ztick"; - case _GL_ANIMATE: - return "gl_animate"; - case _GL_SHOWAXES: - return "gl_showaxes"; - case _GL_SHOWNAMES: - return "gl_shownames"; - case _GL_X_AXIS_NAME: - return "gl_x_axis_name"; - case _GL_Y_AXIS_NAME: - return "gl_y_axis_name"; - case _GL_Z_AXIS_NAME: - return "gl_z_axis_name"; - case _GL_X_AXIS_UNIT: - return "gl_x_axis_unit"; - case _GL_Y_AXIS_UNIT: - return "gl_y_axis_unit"; - case _GL_Z_AXIS_UNIT: - return "gl_z_axis_unit"; + case _QUADRANT2: + return "quadrant2"; + case _QUADRANT3: + return "quadrant3"; + case _QUADRANT4: + return "quadrant4"; + case _POINT_LOSANGE: + return "rhombus_point"; + case _POINT_CARRE: + return "square_point"; + case _POINT_PLUS: + return "plus_point"; + case _POINT_TRIANGLE: + return "triangle_point"; + case _POINT_ETOILE: + return "star_point"; + case _POINT_POINT: + return "point_point"; + case _POINT_INVISIBLE: + return "invisible_point"; + case 49: + return "gomme"; + case _LINE_WIDTH_2: + return "line_width_2"; + case _LINE_WIDTH_3: + return "line_width_3"; + case _LINE_WIDTH_4: + return "line_width_4"; + case _LINE_WIDTH_5: + return "line_width_5"; + case _LINE_WIDTH_6: + return "line_width_6"; + case _LINE_WIDTH_7: + return "line_width_7"; + case _LINE_WIDTH_8: + return "line_width_8"; + case _POINT_WIDTH_2: + return "point_width_2"; + case _POINT_WIDTH_3: + return "point_width_3"; + case _POINT_WIDTH_4: + return "point_width_4"; + case _POINT_WIDTH_5: + return "point_width_5"; + case _POINT_WIDTH_6: + return "point_width_6"; + case _POINT_WIDTH_7: + return "point_width_7"; + case _POINT_WIDTH_8: + return "point_width_8"; + case _HIDDEN_NAME: + return "hidden_name"; + case _DASH_LINE: + return "dash_line"; + case _DOT_LINE: + return "dot_line"; + case _DASHDOT_LINE: + return "dashdot_line"; + case _DASHDOTDOT_LINE: + return "dashdotdot_line"; + case _CAP_FLAT_LINE: + return "cap_flat_line"; + case _CAP_ROUND_LINE: + return "cap_round_line"; + case _CAP_SQUARE_LINE: + return "cap_square_line"; } } - if (subtype==_INT_MAPLELIB){ - switch (val){ - case _LINALG: - return "linalg"; - case _NUMTHEORY: - return "numtheory"; - case _GROEBNER: - return "groebner"; - } + switch (val){ } - if (subtype==_INT_MAPLECONVERSION){ - switch (val){ - case _MAPLE_LIST: - return "list"; - case _SET__VECT: - return "set"; - case _MATRIX__VECT: - return "matrix"; - case _POLY1__VECT: - return "polynom"; - case _TRIG: - return "trig"; - case _EXPLN: - return "expln"; - case _PARFRAC: - return "parfrac"; - case _FULLPARFRAC: - return "fullparfrac"; - case _CONFRAC: - return "confrac"; - case _BASE: - return "base"; - case _POSINT: - return "posint"; - case _NEGINT: - return "negint"; - case _NONPOSINT: - return "nonposint"; - case _NONNEGINT: - return "nonnegint"; - } + } + if (subtype==_INT_PLOT){ + switch(val){ + case _ADAPTIVE: + return "adaptive"; + case _AXES: + return "axes"; + case _COLOR: + return "color"; + case _FILLED: + return "filled"; + case _FONT: + return "font"; + case _LABELS: + return "labels"; + case _LEGEND: + return "legend"; + case _LINESTYLE: + return "linestyle"; + case _RESOLUTION: + return "resolution"; + case _SAMPLE: + return "sample"; + case _SCALING: + return "scaling"; + case _STYLE: + return "style"; + case _SYMBOL: + return "symbol"; + case _SYMBOLSIZE: + return "symbolsize"; + case _THICKNESS: + return "thickness"; + case _TITLE: + return "title"; + case _TITLEFONT: + return "titlefont"; + case _VIEW: + return "view"; + case _AXESFONT: + return "axesfont"; + case _COORDS: + return "coords"; + case _LABELFONT: + return "labelfont"; + case _LABELDIRECTIONS: + return "labeldirections"; + case _NUMPOINTS: + return "numpoints"; + case _TICKMARKS: + return "tickmarks"; + case _XTICKMARKS: + return "xtickmarks"; + case _NSTEP: + return "nstep"; + case _XSTEP: + return "xstep"; + case _YSTEP: + return "ystep"; + case _ZSTEP: + return "zstep"; + case _TSTEP: + return "tstep"; + case _USTEP: + return "ustep"; + case _VSTEP: + return "vstep"; + case _FRAMES: + return "frames"; + case _GL_TEXTURE: + return "gl_texture"; + case _GL_LIGHT0: + return "gl_light0"; + case _GL_LIGHT1: + return "gl_light1"; + case _GL_LIGHT2: + return "gl_light2"; + case _GL_LIGHT3: + return "gl_light3"; + case _GL_LIGHT4: + return "gl_light4"; + case _GL_LIGHT5: + return "gl_light5"; + case _GL_LIGHT6: + return "gl_light6"; + case _GL_LIGHT7: + return "gl_light7"; + case _GL_AMBIENT: + return "gl_ambient"; + case _GL_SPECULAR: + return "gl_specular"; + case _GL_DIFFUSE: + return "gl_diffuse"; + case _GL_POSITION: + return "gl_position"; + case _GL_SPOT_DIRECTION: + return "gl_spot_direction"; + case _GL_SPOT_EXPONENT: + return "gl_spot_exponent"; + case _GL_SPOT_CUTOFF: + return "gl_spot_cutoff"; + case _GL_CONSTANT_ATTENUATION: + return "gl_constant_attenuation"; + case _GL_LINEAR_ATTENUATION: + return "gl_linear_attenuation"; + case _GL_QUADRATIC_ATTENUATION: + return "gl_quadratic_attenuation"; + case _GL_OPTION: + return "gl_option"; + case _GL_SMOOTH: + return "gl_smooth"; + case _GL_FLAT: + return "gl_flat"; + case _GL_SHININESS: + return "gl_shininess"; + case _GL_FRONT: + return "gl_front"; + case _GL_BACK: + return "gl_back"; + case _GL_FRONT_AND_BACK: + return "gl_front_and_back"; + case _GL_AMBIENT_AND_DIFFUSE: + return "gl_ambient_and_diffuse"; + case _GL_EMISSION: + return "gl_emission"; + case _GL_LIGHT_MODEL_AMBIENT: + return "gl_light_model_ambient"; + case _GL_LIGHT_MODEL_LOCAL_VIEWER: + return "gl_light_model_local_viewer"; + case _GL_LIGHT_MODEL_TWO_SIDE: + return "gl_light_model_two_side"; + case _GL_LIGHT_MODEL_COLOR_CONTROL: + return "gl_light_model_color_control"; + case _GL_BLEND: + return "gl_blend"; + case _GL_SRC_ALPHA: + return "gl_src_alpha"; + case _GL_ONE_MINUS_SRC_ALPHA: + return "gl_one_minus_src_alpha"; + case _GL_SEPARATE_SPECULAR_COLOR: + return "gl_separate_specular_color"; + case _GL_SINGLE_COLOR: + return "gl_single_color"; + case _GL_MATERIAL: + return "gl_material"; + case _GL_COLOR_INDEXES: + return "gl_color_indexes"; + case _GL_LIGHT: + return "gl_light"; + case _GL_PERSPECTIVE: + return "gl_perspective"; + case _GL_ORTHO: + return "gl_ortho"; + case _GL_QUATERNION: + return "gl_quaternion"; + case _GL_ROTATION_AXIS: + return "gl_rotation_axis"; + case _GL_X: + return "gl_x"; + case _GL_Y: + return "gl_y"; + case _GL_Z: + return "gl_z"; + case _GL_XTICK: + return "gl_xtick"; + case _GL_YTICK: + return "gl_ytick"; + case _GL_ZTICK: + return "gl_ztick"; + case _GL_ANIMATE: + return "gl_animate"; + case _GL_SHOWAXES: + return "gl_showaxes"; + case _GL_SHOWNAMES: + return "gl_shownames"; + case _GL_X_AXIS_NAME: + return "gl_x_axis_name"; + case _GL_Y_AXIS_NAME: + return "gl_y_axis_name"; + case _GL_Z_AXIS_NAME: + return "gl_z_axis_name"; + case _GL_X_AXIS_UNIT: + return "gl_x_axis_unit"; + case _GL_Y_AXIS_UNIT: + return "gl_y_axis_unit"; + case _GL_Z_AXIS_UNIT: + return "gl_z_axis_unit"; } - if (subtype==_INT_MUPADOPERATOR){ - switch (val){ - case _DELETE_OPERATOR: - return "Delete"; - case _PREFIX_OPERATOR: - return "Prefix"; - case _POSTFIX_OPERATOR: - return "Postfix"; - case _BINARY_OPERATOR: - return "Binary"; - case _NARY_OPERATOR: - return "Nary"; - } + } + if (subtype==_INT_MAPLELIB){ + switch (val){ + case _LINALG: + return "linalg"; + case _NUMTHEORY: + return "numtheory"; + case _GROEBNER: + return "groebner"; } - if (subtype==_INT_GROEBNER){ - switch (val){ - case _REVLEX_ORDER: - return "revlex"; - case _PLEX_ORDER: - return "plex"; - case _TDEG_ORDER: - return "tdeg"; - case _WITH_COCOA: - return "with_cocoa"; - case _WITH_F5: - return "with_f5"; - } + } + if (subtype==_INT_MAPLECONVERSION){ + switch (val){ + case _MAPLE_LIST: + return "list"; + case _SET__VECT: + return "set"; + case _MATRIX__VECT: + return "matrix"; + case _POLY1__VECT: + return "polynom"; + case _TRIG: + return "trig"; + case _EXPLN: + return "expln"; + case _PARFRAC: + return "parfrac"; + case _FULLPARFRAC: + return "fullparfrac"; + case _CONFRAC: + return "confrac"; + case _BASE: + return "base"; + case _POSINT: + return "posint"; + case _NEGINT: + return "negint"; + case _NONPOSINT: + return "nonposint"; + case _NONNEGINT: + return "nonnegint"; } - if (subtype!=_INT_TYPE){ - int format=integer_format(contextptr); - switch (format){ - case 16: - return hexa_print_INT_(val); - case 8: - return octal_print_INT_(val); - default: - return print_INT_(val); - } + } + if (subtype==_INT_MUPADOPERATOR){ + switch (val){ + case _DELETE_OPERATOR: + return "Delete"; + case _PREFIX_OPERATOR: + return "Prefix"; + case _POSTFIX_OPERATOR: + return "Postfix"; + case _BINARY_OPERATOR: + return "Binary"; + case _NARY_OPERATOR: + return "Nary"; } - return print_the_type(val,contextptr); + } + if (subtype==_INT_GROEBNER){ + switch (val){ + case _REVLEX_ORDER: + return "revlex"; + case _PLEX_ORDER: + return "plex"; + case _TDEG_ORDER: + return "tdeg"; + case _WITH_COCOA: + return "with_cocoa"; + case _WITH_F5: + return "with_f5"; + } + } + } + + string gen::print(GIAC_CONTEXT) const{ + switch (type ) { + case _INT_: + if (subtype) + return localize(printint32(val,subtype,contextptr),language(contextptr)); + switch (integer_format(contextptr)){ + case 16: + return hexa_print_INT_(val); + case 8: + return octal_print_INT_(val); + default: + return print_INT_(val); + } case _DOUBLE_: return print_DOUBLE_(_DOUBLE_val,contextptr); case _ZINT: @@ -8401,8 +8560,11 @@ return !(a==b); } - gen equal(const gen & a,const gen &b){ - return new ref_symbolic(symbolic(at_equal,makenewvecteur(a,b))); + gen equal(const gen & a,const gen &b,GIAC_CONTEXT){ + gen res=symbolic(at_equal,makenewvecteur(a,b)); + if (a.type==_INT_ && a.subtype==_INT_PLOT && io_graph(contextptr)) + __interactive.op(res,contextptr); + return res; } gen sign(const gen & a,GIAC_CONTEXT){ Modified: trunk/giac-xcas/giac/src/gen.h =================================================================== --- trunk/giac-xcas/giac/src/gen.h 2010-02-04 14:37:51 UTC (rev 769) +++ trunk/giac-xcas/giac/src/gen.h 2010-02-17 15:12:16 UTC (rev 770) @@ -608,7 +608,7 @@ bool operator ==(const gen & a,const gen & b); bool operator_equal(const gen & a,const gen & b,GIAC_CONTEXT); bool operator !=(const gen & a,const gen & b); - gen equal(const gen & a,const gen &b); + gen equal(const gen & a,const gen &b,GIAC_CONTEXT); gen operator !(const gen & a); Modified: trunk/giac-xcas/giac/src/global.cc =================================================================== --- trunk/giac-xcas/giac/src/global.cc 2010-02-04 14:37:51 UTC (rev 769) +++ trunk/giac-xcas/giac/src/global.cc 2010-02-17 15:12:16 UTC (rev 770) @@ -524,7 +524,8 @@ _show_axes_=b; } - bool _io_graph_=true; + bool _io_graph_=false; + // DO NOT SET TO true WITH non-zero contexts or fix symadd when points are added bool & io_graph(GIAC_CONTEXT){ if (contextptr && contextptr->globalptr ) return contextptr->globalptr->_io_graph_; Modified: trunk/giac-xcas/giac/src/hist.fl =================================================================== --- trunk/giac-xcas/giac/src/hist.fl 2010-02-04 14:37:51 UTC (rev 769) +++ trunk/giac-xcas/giac/src/hist.fl 2010-02-17 15:12:16 UTC (rev 770) @@ -1867,19 +1867,19 @@ } { MenuItem Xcas_help_simplify { label {simplify: Simplify expression} - xywh {35 35 100 20} + xywh {35 35 100 20} } MenuItem Xcas_help_normal { label {normal: Simplify rational and algebraic expression} - xywh {35 35 100 20} + xywh {35 35 100 20} } MenuItem Xcas_help_ratnormal { label {ratnormal: Simplify rational expressions} - xywh {35 35 100 20} + xywh {35 35 100 20} } MenuItem Xcas_help_factor { label {factor: Factorization} - xywh {35 35 100 20} + xywh {35 35 100 20} } MenuItem Xcas_help_cfactor { label {cfactor: Factorization over C} Modified: trunk/giac-xcas/giac/src/input_lexer.cc =================================================================== --- trunk/giac-xcas/giac/src/input_lexer.cc 2010-02-04 14:37:51 UTC (rev 769) +++ trunk/giac-xcas/giac/src/input_lexer.cc 2010-02-17 15:12:16 UTC (rev 770) @@ -350,8 +350,8 @@ *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 743 -#define YY_END_OF_BUFFER 744 +#define YY_NUM_RULES 757 +#define YY_END_OF_BUFFER 758 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -359,335 +359,380 @@ flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[2981] = +static yyconst flex_int16_t yy_accept[3387] = { 0, 0, 0, 23, 23, 0, 0, 0, 0, 0, 0, - 744, 742, 1, 2, 415, 3, 740, 379, 444, 422, - 31, 328, 329, 431, 416, 326, 427, 433, 439, 726, - 726, 34, 32, 324, 377, 325, 29, 389, 739, 739, - 739, 501, 739, 739, 739, 739, 39, 739, 739, 739, - 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, - 739, 330, 331, 450, 30, 16, 739, 739, 739, 739, - 502, 739, 739, 739, 37, 739, 739, 739, 739, 739, - 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, - 739, 739, 346, 401, 347, 38, 739, 739, 739, 23, + 758, 756, 1, 2, 430, 3, 754, 394, 459, 437, + 31, 343, 344, 446, 431, 341, 442, 448, 454, 740, + 740, 34, 32, 339, 392, 340, 29, 404, 753, 753, + 753, 516, 753, 753, 753, 753, 39, 753, 753, 753, + 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, + 753, 345, 346, 465, 30, 16, 753, 753, 753, 753, + 517, 753, 753, 753, 37, 753, 753, 753, 753, 753, + 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, + 753, 753, 361, 416, 362, 38, 753, 753, 753, 753, - 25, 24, 743, 741, 743, 15, 6, 5, 743, 18, - 17, 19, 1, 364, 0, 0, 0, 0, 0, 0, - 0, 0, 380, 0, 338, 339, 332, 333, 41, 40, - 0, 348, 349, 395, 434, 435, 0, 0, 0, 0, + 23, 25, 24, 757, 755, 757, 15, 6, 5, 757, + 18, 17, 19, 1, 379, 0, 0, 0, 0, 0, + 0, 0, 0, 395, 0, 353, 354, 347, 348, 41, + 40, 0, 363, 364, 410, 449, 450, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 452, 432, 417, 418, 327, 419, 360, 420, 359, 436, - 421, 428, 412, 441, 737, 453, 22, 0, 440, 736, - 726, 0, 0, 0, 0, 0, 36, 35, 383, 0, - 0, 0, 354, 371, 366, 387, 361, 386, 375, 355, + 0, 467, 447, 432, 433, 342, 434, 375, 435, 374, + 451, 436, 443, 427, 456, 751, 468, 22, 0, 455, + 750, 740, 0, 0, 0, 0, 0, 36, 35, 398, + 0, 0, 0, 369, 386, 381, 402, 376, 401, 390, - 388, 390, 739, 739, 739, 739, 739, 739, 739, 739, - 739, 739, 739, 500, 739, 739, 739, 739, 739, 739, - 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, - 739, 536, 739, 655, 739, 739, 739, 739, 739, 739, - 739, 739, 407, 577, 578, 46, 739, 739, 45, 739, - 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, - 617, 739, 739, 739, 739, 739, 739, 739, 739, 739, - 739, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 370, 403, 405, 753, 753, 753, 753, 753, 753, 753, + 753, 753, 753, 753, 515, 753, 753, 753, 753, 753, + 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, + 753, 753, 551, 753, 669, 753, 753, 753, 753, 753, + 753, 753, 753, 422, 591, 592, 46, 753, 753, 45, + 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, + 753, 631, 753, 753, 753, 753, 753, 753, 753, 753, + 753, 753, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 739, 739, 739, + 0, 0, 0, 0, 0, 0, 0, 0, 753, 753, - 739, 739, 739, 475, 739, 739, 739, 739, 739, 739, - 484, 739, 739, 739, 739, 739, 739, 739, 739, 739, - 499, 739, 739, 739, 739, 739, 739, 739, 739, 739, - 739, 739, 532, 739, 739, 739, 739, 739, 739, 739, - 739, 739, 739, 535, 543, 739, 739, 739, 739, 739, - 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, - 739, 739, 567, 568, 570, 404, 739, 739, 739, 43, - 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, - 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, - 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, + 753, 753, 753, 753, 490, 753, 753, 753, 753, 753, + 753, 499, 753, 753, 753, 753, 753, 753, 753, 753, + 514, 753, 753, 753, 753, 753, 753, 753, 753, 753, + 753, 753, 547, 753, 753, 753, 753, 753, 753, 753, + 753, 753, 550, 558, 753, 753, 753, 753, 753, 753, + 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, + 753, 581, 582, 584, 419, 753, 753, 753, 43, 753, + 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, + 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, + 753, 753, 753, 753, 753, 753, 753, 753, 753, 630, - 616, 739, 739, 739, 739, 739, 739, 739, 739, 739, - 739, 739, 739, 739, 739, 739, 739, 402, 33, 423, - 424, 54, 44, 23, 24, 24, 26, 0, 741, 15, - 4, 14, 7, 8, 12, 13, 9, 11, 10, 18, - 0, 0, 728, 729, 727, 731, 730, 732, 0, 340, - 341, 334, 335, 350, 351, 42, 0, 381, 445, 0, - 437, 425, 429, 0, 442, 0, 372, 0, 0, 378, - 0, 374, 0, 393, 0, 454, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 21, 736, 0, 0, 738, 0, 734, 733, 735, + 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, + 753, 753, 753, 753, 753, 417, 33, 438, 439, 54, + 753, 753, 753, 44, 753, 753, 753, 753, 23, 24, + 24, 26, 0, 755, 15, 4, 14, 7, 8, 12, + 13, 9, 11, 10, 18, 0, 0, 742, 743, 741, + 745, 744, 746, 0, 355, 356, 349, 350, 365, 366, + 42, 0, 396, 460, 0, 452, 440, 444, 0, 457, + 0, 387, 0, 0, 393, 0, 389, 0, 408, 0, + 469, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 21, 750, 0, 0, - 0, 0, 0, 0, 397, 739, 739, 739, 739, 739, - 687, 739, 739, 739, 739, 739, 739, 458, 739, 739, - 739, 739, 739, 739, 739, 507, 739, 739, 739, 739, - 739, 530, 667, 739, 739, 739, 739, 739, 739, 739, - 681, 739, 739, 449, 739, 739, 739, 739, 739, 739, - 739, 739, 739, 739, 586, 739, 739, 739, 739, 739, - 686, 600, 739, 739, 607, 739, 739, 739, 739, 739, - 739, 739, 674, 739, 739, 739, 739, 411, 0, 715, - 0, 0, 721, 0, 0, 0, 0, 0, 0, 0, - 0, 690, 0, 0, 0, 0, 0, 0, 691, 714, + 752, 0, 748, 747, 749, 0, 0, 0, 0, 412, + 753, 753, 753, 753, 753, 701, 753, 753, 753, 753, + 753, 753, 473, 753, 753, 753, 753, 753, 753, 753, + 522, 753, 753, 753, 753, 753, 545, 681, 753, 753, + 753, 753, 753, 753, 753, 695, 753, 753, 464, 753, + 753, 753, 753, 753, 753, 753, 753, 753, 753, 600, + 753, 753, 753, 753, 753, 700, 614, 753, 753, 621, + 753, 753, 753, 753, 753, 753, 753, 688, 753, 753, + 753, 753, 426, 0, 729, 0, 0, 735, 0, 0, + 0, 0, 0, 0, 0, 0, 704, 0, 0, 0, - 0, 541, 725, 723, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 406, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 739, 467, 739, 396, 739, - 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, - 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, - 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, - 739, 739, 739, 506, 739, 739, 739, 739, 739, 739, - 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, - 739, 529, 739, 739, 739, 739, 739, 739, 739, 739, - 739, 739, 739, 739, 739, 739, 739, 739, 49, 739, + 0, 0, 0, 705, 728, 0, 556, 739, 737, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 421, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 753, 482, 753, 411, 753, 753, 753, 753, 753, 753, + 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, + 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, + 753, 753, 753, 753, 521, 753, 753, 753, 753, 753, + 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, + 753, 753, 544, 753, 753, 753, 753, 753, 753, 753, + 753, 753, 753, 753, 753, 753, 753, 49, 753, 753, - 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, - 739, 739, 554, 739, 739, 739, 739, 739, 446, 562, - 739, 739, 739, 739, 739, 739, 561, 739, 739, 739, - 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, - 739, 739, 451, 739, 739, 739, 739, 739, 585, 739, - 739, 165, 739, 739, 739, 739, 739, 739, 739, 739, - 739, 739, 739, 597, 739, 739, 739, 739, 739, 739, - 288, 739, 739, 739, 739, 739, 739, 739, 739, 739, - 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, - 739, 739, 623, 739, 739, 739, 739, 739, 739, 739, + 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, + 568, 753, 753, 753, 753, 461, 576, 753, 753, 753, + 753, 575, 753, 753, 753, 753, 753, 753, 753, 753, + 753, 753, 753, 753, 753, 753, 753, 466, 753, 753, + 753, 753, 753, 599, 753, 753, 753, 753, 753, 753, + 753, 753, 753, 753, 753, 753, 611, 753, 753, 753, + 753, 753, 753, 303, 753, 753, 753, 753, 753, 753, + 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, + 753, 753, 753, 753, 753, 637, 753, 753, 753, 753, + 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, - 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, - 408, 739, 739, 739, 739, 739, 7, 8, 0, 0, - 0, 0, 0, 342, 343, 336, 337, 352, 353, 365, - 398, 413, 384, 369, 367, 362, 376, 391, 0, 0, - 540, 0, 0, 0, 0, 0, 569, 405, 0, 0, - 0, 403, 0, 737, 0, 0, 0, 736, 0, 0, - 20, 0, 0, 0, 739, 739, 739, 486, 495, 739, - 739, 739, 739, 739, 457, 739, 739, 739, 739, 739, - 677, 739, 504, 739, 657, 739, 739, 739, 739, 739, - 739, 739, 739, 739, 739, 739, 739, 739, 663, 739, + 753, 753, 423, 753, 753, 753, 753, 753, 753, 753, + 753, 753, 753, 753, 753, 753, 7, 8, 0, 0, + 0, 0, 0, 357, 358, 351, 352, 367, 368, 380, + 413, 428, 399, 384, 382, 377, 391, 406, 0, 0, + 555, 0, 0, 0, 0, 0, 583, 420, 0, 0, + 0, 418, 0, 751, 0, 0, 0, 750, 0, 0, + 20, 0, 0, 0, 753, 753, 753, 501, 510, 753, + 753, 753, 753, 753, 472, 753, 753, 753, 753, 753, + 691, 753, 519, 753, 671, 753, 753, 753, 753, 753, + 753, 753, 753, 753, 753, 753, 753, 753, 677, 753, - 648, 683, 534, 538, 739, 550, 739, 739, 664, 560, - 565, 301, 461, 739, 739, 739, 739, 739, 644, 739, - 739, 459, 739, 739, 739, 739, 606, 456, 739, 614, - 622, 637, 656, 739, 739, 633, 739, 739, 0, 692, - 724, 0, 0, 722, 704, 0, 400, 0, 698, 0, - 0, 0, 700, 0, 0, 0, 0, 697, 0, 0, - 0, 712, 0, 448, 710, 0, 0, 0, 0, 0, - 564, 0, 0, 0, 713, 0, 0, 0, 0, 0, - 0, 0, 0, 409, 739, 739, 739, 739, 739, 739, - 739, 739, 470, 739, 194, 739, 739, 294, 739, 739, + 662, 697, 549, 553, 753, 564, 753, 753, 678, 574, + 579, 316, 476, 753, 753, 753, 753, 753, 658, 753, + 753, 474, 753, 753, 753, 753, 620, 471, 753, 628, + 636, 651, 670, 753, 753, 647, 753, 753, 0, 706, + 738, 0, 0, 736, 718, 0, 415, 0, 712, 0, + 0, 0, 714, 0, 0, 0, 0, 711, 0, 0, + 0, 726, 0, 463, 724, 0, 0, 0, 0, 0, + 578, 0, 0, 0, 727, 0, 0, 0, 0, 0, + 0, 0, 0, 424, 753, 753, 753, 753, 753, 753, + 753, 753, 485, 753, 209, 753, 753, 309, 753, 753, - 739, 739, 172, 479, 171, 739, 739, 739, 485, 739, - 739, 739, 739, 739, 739, 739, 739, 739, 174, 739, - 739, 739, 739, 739, 739, 505, 503, 0, 739, 739, - 739, 739, 739, 739, 739, 522, 739, 739, 739, 739, - 739, 739, 526, 739, 739, 739, 739, 739, 204, 739, - 531, 739, 649, 739, 739, 739, 739, 739, 739, 739, - 739, 739, 739, 739, 739, 739, 739, 270, 271, 272, - 739, 739, 739, 682, 739, 739, 739, 739, 739, 739, - 739, 537, 739, 739, 739, 549, 739, 739, 739, 739, - 739, 739, 739, 739, 739, 289, 739, 739, 739, 739, + 494, 753, 753, 753, 500, 753, 753, 753, 753, 753, + 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, + 520, 518, 0, 753, 753, 753, 753, 753, 753, 753, + 537, 753, 753, 753, 753, 753, 753, 541, 753, 753, + 753, 753, 753, 219, 753, 546, 753, 663, 753, 753, + 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, + 753, 753, 285, 286, 287, 753, 753, 753, 696, 753, + 753, 753, 753, 753, 552, 753, 753, 753, 563, 753, + 753, 753, 753, 753, 753, 753, 753, 304, 753, 753, + 753, 753, 753, 753, 753, 753, 573, 753, 753, 753, - 739, 739, 739, 739, 739, 559, 164, 739, 739, 739, - 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, - 303, 739, 739, 314, 739, 739, 739, 739, 739, 580, - 739, 739, 739, 739, 739, 587, 739, 739, 739, 739, - 739, 739, 739, 739, 739, 739, 739, 596, 739, 739, - 598, 739, 739, 739, 739, 739, 307, 308, 739, 739, - 739, 739, 739, 739, 739, 739, 605, 739, 608, 739, - 739, 612, 304, 613, 739, 739, 739, 739, 739, 739, - 739, 739, 739, 291, 620, 739, 739, 739, 739, 739, - 739, 739, 739, 739, 739, 739, 168, 218, 739, 621, + 753, 753, 753, 753, 753, 753, 753, 753, 753, 318, + 753, 753, 329, 753, 753, 753, 753, 753, 594, 753, + 753, 753, 753, 753, 601, 753, 753, 753, 753, 753, + 753, 753, 753, 753, 753, 753, 610, 753, 612, 753, + 753, 753, 753, 753, 322, 323, 753, 753, 753, 753, + 753, 753, 753, 753, 619, 753, 622, 753, 753, 626, + 319, 627, 753, 753, 753, 753, 753, 753, 753, 753, + 753, 306, 634, 753, 7... [truncated message content] |
From: <pa...@us...> - 2010-02-04 14:38:32
|
Revision: 769 http://xcas.svn.sourceforge.net/xcas/?rev=769&view=rev Author: parisse Date: 2010-02-04 14:37:51 +0000 (Thu, 04 Feb 2010) Log Message: ----------- Modified Paths: -------------- trunk/giac-xcas/giac/src/desolve.cc trunk/giac-xcas/giac/src/gausspol.cc trunk/giac-xcas/giac/src/help.cc Modified: trunk/giac-xcas/giac/src/desolve.cc =================================================================== --- trunk/giac-xcas/giac/src/desolve.cc 2010-02-03 12:07:50 UTC (rev 768) +++ trunk/giac-xcas/giac/src/desolve.cc 2010-02-04 14:37:51 UTC (rev 769) @@ -516,7 +516,7 @@ gen i=simplify(exp(integrate_without_lnabs(rdiv(b,a),x,contextptr),contextptr),contextptr); gen C=integrate_without_lnabs(rdiv(-c,a)*i,x,contextptr); parameters.push_back(diffeq_constante(0,contextptr)); - return ratnormal((C+parameters.front())/i); + return ratnormal(_lin((C+parameters.front())/i,contextptr)); } // cst coeff? gen cst=v.back(); Modified: trunk/giac-xcas/giac/src/gausspol.cc =================================================================== --- trunk/giac-xcas/giac/src/gausspol.cc 2010-02-03 12:07:50 UTC (rev 768) +++ trunk/giac-xcas/giac/src/gausspol.cc 2010-02-04 14:37:51 UTC (rev 769) @@ -2714,6 +2714,36 @@ if (debug_infolevel>=20-p_simp.dim) cerr << "Gcdheu end ppz" << clock() << " " << np_simp << " " << nq_simp << endl; d_content=gcd(np_simp,nq_simp); + // type may have changed by ppz simplification, recheck + pt=coefftype(p_simp,coefft),qt=coefftype(q_simp,coeffqt); + if (pt>=_EXT && qt>=_EXT && pt!=qt) + setsizeerr("Incompatible coeff type"); + if (pt<_EXT && qt>=_EXT){ + pt=qt; + coefft=coeffqt; + } + if (!pt){ + pt=qt; + coefft=coeffqt; + } + if (qt==_POLY && pt<_POLY){ + pt=qt; + coefft=coeffqt; + } + if (pt==_POLY){ + if (coefft.type!=_POLY) + setsizeerr(); + int innerdim=coefft._POLYptr->dim; + polynome pmulti=unsplitmultivarpoly(p_simp,innerdim); + polynome qmulti=unsplitmultivarpoly(q_simp,innerdim); + d=gcd(pmulti,qmulti); + d=splitmultivarpoly(d,innerdim); + if (compute_cofactors){ + p_simp=p_simp/d; + q_simp=q_simp/d; + } + return true; + } if (Tis_constant(p_simp) || Tis_constant(q_simp)){ if (debug_infolevel>=2) cerr << "//Gcdheu p constant!" << endl; Modified: trunk/giac-xcas/giac/src/help.cc =================================================================== --- trunk/giac-xcas/giac/src/help.cc 2010-02-03 12:07:50 UTC (rev 768) +++ trunk/giac-xcas/giac/src/help.cc 2010-02-04 14:37:51 UTC (rev 769) @@ -943,17 +943,33 @@ std::string res,tmp; int ss=s.size(); std::map<std::string,std::string>::const_iterator it,itend=lexer_localization_map().end(); + int mode=0; // 1 if inside a string for (int i=0;;++i){ - if (i<ss && isalphan(s[i])) - tmp += s[i]; + char ch=s[i]; + if (mode){ + if (ch=='"'){ + if (res.empty() || res[res.size()-1]!='\\') + mode=0; + } + res += ch; + if (i==ss) + break; + continue; + } + if (i<ss && isalphan(ch)) + tmp += ch; else { // search if tmp is in lexer_localization_map it=lexer_localization_map().find(tmp); if (it!=itend) tmp = it->second; // it is -> we must translate to giac res += tmp; tmp = ""; + if (ch=='"'){ + if (res.empty() || res[res.size()-1]!='\\') + mode=1; + } if (i<ss) - res += s[i]; + res += ch; else break; } @@ -964,8 +980,20 @@ std::string localize(const std::string & s,int language){ std::string res,tmp; int ss=s.size(); + int mode=0; // 1 if inside a string std::multimap<std::string,localized_string>::const_iterator it0,it,itend,backend=back_lexer_localization_map.end(); for (int i=0;;++i){ + char ch=s[i]; + if (mode){ + if (ch=='"'){ + if (res.empty() || res[res.size()-1]!='\\') + mode=0; + } + res += ch; + if (i==ss) + break; + continue; + } if (i<ss && isalphan(s[i])) tmp += s[i]; else { // search if tmp is in back_lexer_localization_map @@ -983,6 +1011,10 @@ } res += tmp; tmp = ""; + if (ch=='"'){ + if (res.empty() || res[res.size()-1]!='\\') + mode=1; + } if (i<ss) res += s[i]; else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2010-02-03 12:08:48
|
Revision: 768 http://xcas.svn.sourceforge.net/xcas/?rev=768&view=rev Author: parisse Date: 2010-02-03 12:07:50 +0000 (Wed, 03 Feb 2010) Log Message: ----------- Modified Paths: -------------- trunk/giac-xcas/giac/src/Graph.cc trunk/giac-xcas/giac/src/Graph.h trunk/giac-xcas/giac/src/Help1.cc trunk/giac-xcas/giac/src/History.cc trunk/giac-xcas/giac/src/Xcas1.cc trunk/giac-xcas/giac/src/Xcas1.h trunk/giac-xcas/giac/src/csturm.cc trunk/giac-xcas/giac/src/gen.cc trunk/giac-xcas/giac/src/global.h trunk/giac-xcas/giac/src/hist.cxx trunk/giac-xcas/giac/src/hist.fl trunk/giac-xcas/giac/src/intg.cc trunk/giac-xcas/giac/src/modpoly.cc trunk/giac-xcas/giac/src/solve.cc trunk/giac-xcas/giac/src/threaded.cc trunk/giac-xcas/giac/src/ti89.cc trunk/giac-xcas/giac/src/ti89.h Modified: trunk/giac-xcas/giac/src/Graph.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph.cc 2010-01-27 13:25:19 UTC (rev 767) +++ trunk/giac-xcas/giac/src/Graph.cc 2010-02-03 12:07:50 UTC (rev 768) @@ -6110,6 +6110,12 @@ return 0; } + Turtle::~Turtle(){ + context * contextptr=get_context(this); + if (turtle(contextptr).widget==this) + turtle(contextptr).widget=0; + } + void cb_Logo_button(No_Focus_Button * b,void *){ if (!Fl::focus()) return; Modified: trunk/giac-xcas/giac/src/Graph.h =================================================================== --- trunk/giac-xcas/giac/src/Graph.h 2010-01-27 13:25:19 UTC (rev 767) +++ trunk/giac-xcas/giac/src/Graph.h 2010-02-03 12:07:50 UTC (rev 768) @@ -330,6 +330,7 @@ Turtle(int x,int y,int w,int h,const char * l=0): Fl_Widget(x,y,w,h,l),turtleptr(0),legende_size(giac::LEGENDE_SIZE),turtlex(0),turtley(0),turtlezoom(1),maillage(1),redraw_cap_only(false) {}; std::string latex_save_figure(); const char * latex(const char * filename_) const ; + ~Turtle(); }; class Editeur; Modified: trunk/giac-xcas/giac/src/Help1.cc =================================================================== --- trunk/giac-xcas/giac/src/Help1.cc 2010-01-27 13:25:19 UTC (rev 767) +++ trunk/giac-xcas/giac/src/Help1.cc 2010-02-03 12:07:50 UTC (rev 768) @@ -167,8 +167,16 @@ else { if (o == button0) { // view help file int tmp=br->value(); - if (tmp) - system((browser_command(v[tmp-1])).c_str()); + if (tmp) { + if (use_external_browser) + system((browser_command(v[tmp-1])).c_str()); + else { + if (Xcas_help_window){ + Xcas_help_window->load((v[tmp-1]).c_str()); + xcas::Xcas_help_window->show(); + } + } + } else { if (!br->size()) in->do_callback(); Modified: trunk/giac-xcas/giac/src/History.cc =================================================================== --- trunk/giac-xcas/giac/src/History.cc 2010-01-27 13:25:19 UTC (rev 767) +++ trunk/giac-xcas/giac/src/History.cc 2010-02-03 12:07:50 UTC (rev 768) @@ -1428,7 +1428,13 @@ _saving = false; return false; } - fprintf(f,"// xcas version=%s fontsize=%i font=%i\n",VERSION,labelsize(),labelfont()); + int savepos=_sel_begin,pos; + set_sel_begin(Xcas_input_focus); + pos=_sel_begin; + if (pos<0) + pos=update_pos; + _sel_begin=savepos; + fprintf(f,"// xcas version=%s fontsize=%i font=%i currentlevel=%i\n",VERSION,labelsize(),labelfont(),pos); fprintf(f,"%s",chs); if (savecontext){ string tmps=archive_session(false,contextptr); @@ -1447,6 +1453,7 @@ if (History_Fold * hf=dynamic_cast<History_Fold *>(parent_skip_scroll(this))) hf->autosave_rm(); } + focus(pos,true); return true; } @@ -1611,6 +1618,7 @@ unsigned ss=s.size(); bool exec=false; int fontsize=labelsize(); + int newpos=-1; Fl_Font police=FL_HELVETICA; if (ss>7 && s.substr(0,8)=="// xcas "){ unsigned pos=s.find('\n'); @@ -1639,6 +1647,13 @@ fontsize = atoi(optvalue.c_str()); if (optname=="font") police = Fl_Font(atoi(optvalue.c_str())); + if (optname=="xcas_mode") + xcas_mode(contextptr)=atoi(optvalue.c_str()); + if (optname=="currentlevel"){ + newpos=atoi(optvalue.c_str()); + if (before_position>0) + newpos += before_position; + } } optname=""; afterequal=false; @@ -1677,6 +1692,7 @@ History_Pack_cb_eval(g->child(0),0); } } + focus(newpos,true); labelfont(police); change_group_fontsize(this,max(8,fontsize)); return res; @@ -1838,7 +1854,8 @@ Fl_Group::current(0); Logo * t = new Logo(0,0,W,H,pack->labelsize()); t->hp->contextptr=pack->contextptr; - t->t->turtleptr=&giac::turtle_stack(pack->contextptr); + t->t->turtleptr=&giac::turtle_stack(pack->contextptr); + turtle(pack->contextptr).widget = t->t; set_colors(t); return t; } Modified: trunk/giac-xcas/giac/src/Xcas1.cc =================================================================== --- trunk/giac-xcas/giac/src/Xcas1.cc 2010-01-27 13:25:19 UTC (rev 767) +++ trunk/giac-xcas/giac/src/Xcas1.cc 2010-02-03 12:07:50 UTC (rev 768) @@ -96,7 +96,7 @@ void (* menu2rpn_callback)(Fl_Widget *,void *)=0; Enlargable_Multiline_Output *Xcas_help_output =0 ; xcas::Graph2d *Xcas_DispG=0; - int show_xcas_dispg=0; + int show_xcas_dispg=0,redraw_turtle=0; std::string xcas_paused=""; int xcas_dispg_entries=0; Fl_Window * Xcas_DispG_Window=0; @@ -2019,6 +2019,7 @@ next_line(s,L,line,i); // should be [\n widget_group_load(l->hp,s,L,i,contextptr); l->hp->resize(); + turtle(contextptr).widget = l->t; next_line_nonl(s,L,line,i); // should be Editeur next_line_nonl(s,L,line,i); // read size @@ -2291,6 +2292,7 @@ if (u==at_pnt){ // Xcas_DispG_Window->show(); // Xcas_Main_Window->show(); + redraw_turtle=1; if (Xcas_DispG) Xcas_DispG->add(g); return 1; } @@ -2424,14 +2426,21 @@ return -ch; } - giac::gen Xcas_fltk_getKey(const giac::gen & g){ + giac::gen Xcas_fltk_getKey(const giac::gen & g,GIAC_CONTEXT){ if (block_signal){ return zero; } - Fl::lock(); - gen res=in_Xcas_fltk_getKey(g,0); + gen res; + if (is_minus_one(g)){ + Fl::lock(); + res=in_Xcas_fltk_getKey(g,0); + Fl::unlock(); + } + else + res=Xcas_fltk_input(makevecteur(at_getKey,g),contextptr); // FIXME change interactive for context, like input - Fl::unlock(); + if (is_inf(res)) + setsizeerr(); return res; } @@ -2457,6 +2466,65 @@ fl_message(eval(v.front()._SYMBptr->feuille,contextptr).print(contextptr).c_str()); return plus_one; } + if (!v.empty() && v.front()==at_getKey){ + Fl_Widget * foc=Fl::focus(); + static Fl_Window * getkeywin=0; + static Fl_Button * getkeybut = 0; + static Fl_Input * getkeyin = 0; + static Fl_Multiline_Output * getkeyout = 0; + if (!getkeywin){ + getkeywin=new Fl_Window(50,50,200,200); + getkeywin->label(gettext("Press a key")); + getkeyout= new Fl_Multiline_Output(2,24,196,170); + getkeybut=new Fl_Button(2,2,96,20); + getkeybut->label(gettext("Cancel")); + getkeybut->shortcut("^["); + getkeyin = new Fl_Input(102,2,96,20); + getkeyin->when(FL_WHEN_CHANGED); + getkeywin->end(); + getkeywin->resizable(getkeywin); + } + string msg(gettext("Press a key\n")); + int vs=v.size(); + for (int i=1;i<vs;++i){ + if (v[i].type==_STRNG) + msg += *v[i]._STRNGptr; + else + msg += v[i].print(contextptr); + if (i==vs-1) + break; + msg += '\n'; + } + getkeyout->value(msg.c_str()); + getkeyin->value(""); + getkeywin->show(); + getkeywin->set_modal(); + Fl::focus(getkeyin); + if (Xcas_Main_Window){ + Xcas_Main_Window->redraw(); + } + Fl::flush(); + gen res=undef; + for (;;){ + Fl_Widget *o = Fl::readqueue(); + if (!o) Fl::wait(); + if (o==getkeybut) + res=unsigned_inf; + if (o==getkeybut || o==getkeywin){ + break; + } + if (o==getkeyin){ + int l=strlen(getkeyin->value()); + if (l){ + res=getkeyin->value()[l-1]; + break; + } + } + } + getkeywin->hide(); + Fl::focus(foc); + return res; + } int initw,inith; if (Xcas_input_focus && Xcas_input_focus->window()){ initw=(Xcas_input_focus->window()->w()*3)/4; Modified: trunk/giac-xcas/giac/src/Xcas1.h =================================================================== --- trunk/giac-xcas/giac/src/Xcas1.h 2010-01-27 13:25:19 UTC (rev 767) +++ trunk/giac-xcas/giac/src/Xcas1.h 2010-02-03 12:07:50 UTC (rev 768) @@ -106,7 +106,7 @@ void change_group_fontsize(Fl_Widget * g,int labelfontsize); // Giac interactive functions fltk implementation giac::gen Xcas_fltk_interactive(const giac::gen & g,const giac::context * contextptr); - giac::gen Xcas_fltk_getKey(const giac::gen & g); + giac::gen Xcas_fltk_getKey(const giac::gen & g,const giac::context * contextptr); giac::gen Xcas_fltk_input(const giac::gen & arg,const giac::context * contextptr); giac::gen Xcas_fltk_inputform(const giac::gen & arg,const giac::context * contextptr); giac::gen makeform(const giac::vecteur & v,const giac::context * contextptr); // interface for inputforms Modified: trunk/giac-xcas/giac/src/csturm.cc =================================================================== --- trunk/giac-xcas/giac/src/csturm.cc 2010-01-27 13:25:19 UTC (rev 767) +++ trunk/giac-xcas/giac/src/csturm.cc 2010-02-03 12:07:50 UTC (rev 768) @@ -1,4 +1,4 @@ -// -*- mode:C++ ; compile-command: "g++ -I.. -I../include -g -c -Wall csturm.cc" -*- +// -*- mode:C++ ; compile-command: "g++ -I.. -I../include -g -c -Wall -DHAVE_CONFIG_H -DIN_GIAC csturm.cc" -*- #include "first.h" /* * Copyright (C) 2000,7 B. Parisse, Institut Fourier, 38402 St Martin d'Heres @@ -171,6 +171,29 @@ realroots.push_back(makevecteur(makevecteur(a+t0*b,a+t1*b),n)); return n; } + if (n==1){ + gen T0=t0,T1=t1,T2; + int s0=fastsign(horner(R,T0),contextptr); + int s1=fastsign(horner(R,T1),contextptr),s2; + gen delta=evalf_double(log((T1-T0)*abs(b,contextptr)/eps,contextptr)/log(2.,contextptr),1,contextptr); + if (delta.type!=_DOUBLE_) + settypeerr(); + int nstep=int(delta._DOUBLE_val+1); + for (int step=0;step<nstep;++step){ + T2=(T0+T1)/2; + s2=fastsign(horner(R,T2),contextptr); + if (!s2){ + realroots.push_back(makevecteur(a+T2*b,n)); + return n; + } + if (s2==s0) + T0=T2; + else + T1=T2; + } + realroots.push_back(makevecteur(makevecteur(a+T0*b,a+T1*b),n)); + return n; + } gen t01=(t0+t1)/2; csturm_realroots(S,R,listquo,coeffP,coeffR,a,b,t0,t01,realroots,eps,contextptr); csturm_realroots(S,R,listquo,coeffP,coeffR,a,b,t01,t1,realroots,eps,contextptr); @@ -460,20 +483,211 @@ complex_roots(g,a0,b0,a1,b1,realroots,complexroots,eps); } + // check that arg is >=pi/8 (assumes im(g)>=0) + bool arg_geq_pi_8(const gen & g){ + gen gr=re(g,context0),gi=im(g,context0); + if (is_positive(-gr,context0)) + return true; + // ? gi/gr>=sqrt(2)-1 + gen r=gi/gr+1; + if (is_positive(r*r-2,context0)) + return true; + return false; + } + + // is im(b/a)>=0, tested without quotient + bool arg_in_0_pi(const gen & a,const gen & b){ + gen A(a),B(b); + if (A.type==_FRAC && is_integer(A._FRACptr->den) && is_positive(A._FRACptr->den,context0)) + A=A._FRACptr->num; + if (B.type==_FRAC && is_integer(B._FRACptr->den) && is_positive(B._FRACptr->den,context0)) + B=B._FRACptr->num; + gen c=re(A,context0)*im(B,context0)+re(B,context0)*im(A,context0); + return is_positive(c,context0); + } + + gen hornerarg(const modpoly & p,const gen & x){ + if (p.empty()) + return 0; + if (x.type!=_FRAC || !is_integer(x._FRACptr->den)) + return horner(p,x); + fraction & f =*x._FRACptr; + gen num=f.num,den=f.den,d=den; + if (is_positive(-f.den,context0)){ + num=-num; den=-den; d=den; + } + modpoly::const_iterator it=p.begin(),itend=p.end(); + gen res(*it); + ++it; + if (it==itend) + return res; + for (;;){ + res=res*num+(*it)*d; + ++it; + if (it==itend) + break; + d=d*den; + } + return res; + } + + // Find one complex root inside a0,b0->a1,b1, return false if not found + bool complex_1root(const modpoly & P,const gen & a0,const gen & b0,const gen & a1,const gen & b1,vecteur & complexroots,double eps){ + return false; // disabled since it is not faster!! + int step,nstep =int(evalf_double(log(max(a1-a0,b1-b0,context0)/eps,context0)/log(2.0,context0),1,context0)._DOUBLE_val+0.5); + if (nstep<4) + return false; + // First compute P at the 4 vertex and check whether P[vertex_n+1]/P[vertex_n] is in C^+ + gen P0=hornerarg(P,a0+cst_i*b0),P2=hornerarg(P,a1+cst_i*b0), + P4=hornerarg(P,a1+cst_i*b1),P6=hornerarg(P,a0+cst_i*b1); + if (!(arg_in_0_pi(P0,P2) && arg_in_0_pi(P2,P4) && arg_in_0_pi(P4,P6) && arg_in_0_pi(P6,P0))) + return false; + gen A0(a0),A2(a1),B0(b0),B2(b1),A1,B1; + for (step=0;step<2*nstep;step++){ + A1=(A0+A2)/2; + B1=(B0+B2)/2; + gen P1=hornerarg(P,A1+cst_i*B0),P7=hornerarg(P,A0+cst_i*B1),P8=hornerarg(P,A1+cst_i*B1),P3,P5; + bool found=false; + /* + P6(A0,B2) - P5(A1,B2) - P4(A2,B2) + | | | + P7(A0,B1) - P8(A1,B1) - P3(A2,B1) + | | | + P0(A0,B0) - P1(A1,B0) - P2(A2,B0) + */ + // ? P0, P1, P8, P7 + if (arg_in_0_pi(P0,P1) && arg_in_0_pi(P1,P8) && arg_in_0_pi(P8,P7) && arg_in_0_pi(P7,P0)){ + A2=A1; + B2=B1; + P2=P1; + P4=P8; + P6=P7; + if (step<nstep) + continue; + found=true; + } + if (!found){ + P3=hornerarg(P,A2+cst_i*B1); + // ? P1, P2, P3, P8 + if (arg_in_0_pi(P1,P2) && arg_in_0_pi(P2,P3) && arg_in_0_pi(P3,P8) && arg_in_0_pi(P8,P1)){ + A0=A1; + B2=B1; + P0=P1; + P4=P3; + P6=P8; + if (step<nstep) + continue; + found=true; + } + } + if (!found){ + // P8, P3, P4, P5 + P5=hornerarg(P,A1+cst_i*B2); + if (arg_in_0_pi(P8,P3) && arg_in_0_pi(P3,P4) && arg_in_0_pi(P4,P5) && arg_in_0_pi(P5,P8)){ + A0=A1; + B0=B1; + P0=P8; + P2=P3; + P6=P5; + if (step<nstep) + continue; + found=true; + } + } + if (!found){ + // P7 P8 P5 P6 + if (arg_in_0_pi(P7,P8) && arg_in_0_pi(P8,P5) && arg_in_0_pi(P5,P6) && arg_in_0_pi(P6,P7)){ + A2=A1; + B0=B1; + P0=P7; + P2=P8; + P4=P5; + if (step<nstep) + continue; + found=true; + } + } + if (!found) + return false; + // Final check that there is indeed a root inside rectangle + // args must be >= pi/8 and degree of (P)*max square length/distance to original square <= pi/8 + gen dist=min(min(A0-a0,a1-A2,context0),min(B0-b0,b1-B2,context0),context0); + if (is_zero(dist)) + continue; + gen max_sq=max(A2-A0,B2-B0,context0); + if (is_greater((P.size()-2)*max_sq/dist,cst_pi/8,context0)) + continue; + gen r1=P2/P0, r2=P4/P2, r3=P6/P4, r4=P0/P6; + if (arg_geq_pi_8(r1) && arg_geq_pi_8(r2) && arg_geq_pi_8(r3) && arg_geq_pi_8(r4)){ + complexroots.push_back(makevecteur(makevecteur(A0+cst_i*B0,A2+cst_i*B2),1)); + return true; + } + } + return false; + } + + void round2(gen & x,int n){ + gen deuxn=pow(plus_two,n,context0); + x=_floor(x*deuxn+plus_one_half,context0)/deuxn; + } + + // Find one complex root inside a0,b0->a1,b1, return false if not found + // algo: Newton method in exact mode starting from center + bool newton_complex_1root(const modpoly & P,const gen & a0,const gen & b0,const gen & a1,const gen & b1,vecteur & complexroots,double eps){ + if (is_positive(a1-a0-0.01,context0) || + is_positive(b1-b0-0.01,context0)) + return false; + gen x0=(a0+a1)/2+cst_i*(b0+b1)/2; + modpoly Pprime=derivative(P); + int n=int(-std::log(eps)/std::log(2)+.5); // for rounding + gen eps2=pow(2,-(n+1),context0); + for (int i=0;i<n;i++){ + gen Pprimex0=horner(Pprime,x0); + if (is_zero(Pprimex0,context0)) + return false; + gen dx=horner(P,x0)/Pprimex0; + gen absdx=dx*conj(dx,context0); + x0=x0-dx; + gen r=re(x0,context0),i=im(x0,context0); + if (is_positive(a0-r,context0) || is_positive(r-a1,context0) || + is_positive(b0-i,context0) || is_positive(i-b1,context0)) + return false; + round2(r,n+4); + round2(i,n+4); + x0=r+cst_i*i; + if (is_positive(absdx-eps2*eps2,context0)) + continue; + // make a small square around x0 + // and check that there is indeed a root inside + gen A0=r-eps2; + gen A1=r+eps2; + gen B0=i-eps2; + gen B1=i+eps2; + gen tmp; + if (csturm_square(P,A0+cst_i*B0,A1+cst_i*B1,tmp,context0)==2){ + complexroots.push_back(makevecteur(makevecteur(A0+cst_i*B0,A1+cst_i*B1),1)); + return true; + } + } + return false; + } + // Find complex roots of P in a0,b0 -> a1,b1 - void complex_roots(const modpoly & P,const gen & a0,const gen & b0,const gen & a1,const gen & b1,const vecteur & seq1,const vecteur & seq2,const vecteur & seq3,const vecteur & seq4,vecteur & realroots,vecteur & complexroots,double eps,vecteur & horiz_sturm,vecteur & vert_sturm){ + int complex_roots(const modpoly & P,const gen & a0,const gen & b0,const gen & a1,const gen & b1,const vecteur & seq1,const vecteur & seq2,const vecteur & seq3,const vecteur & seq4,vecteur & realroots,vecteur & complexroots,double eps,vecteur & horiz_sturm,vecteur & vert_sturm){ int n=csturm_square(P,a0,b0,a1,b1,seq1,seq2,seq3,seq4,context0); if (debug_infolevel && n) cerr << a0 << "," << b0 << ".." << a1 << "," << b1 << ":" << n/2 << endl; if (!n) - return; + return 0; if (eps<=0) setsizeerr("Bad precision "+print_DOUBLE_(eps,14)); if (is_strictly_greater(eps,a1-a0,context0) && is_strictly_greater(eps,b1-b0,context0)){ gen r(makevecteur(a0+cst_i*b0,a1+cst_i*b1)); complexroots.push_back(makevecteur(r,gen(n)/2)); - return; + return n; } + if (n==2 && newton_complex_1root(P,a0,b0,a1,b1,complexroots,eps)) + return n; gen a01=(a0+a1)/2,b01=(b0+b1)/2,pgcd; vecteur seqvert,seqhoriz; gen A=a0+cst_i*b01,B=a1+cst_i*b01; @@ -486,7 +700,7 @@ } if (!is_one(pgcd)){ complex_roots_split(P,pgcd,a0,b0,a1,b1,realroots,complexroots,eps); - return; + return n; } /* (a0,b1) - (a01,b1) - (a1,b1) seq3 seq3 @@ -495,10 +709,17 @@ | n1 | n2 | seq4 n1 seqvert n2 seq2 (a0,b0) - (a01,b0) - (a1,b0) seq1 seq1 */ - complex_roots(P,a0,b0,a01,b01,seq1,seqvert,seqhoriz,seq4,realroots,complexroots,eps,horiz_sturm,vert_sturm); - complex_roots(P,a01,b0,a1,b01,seq1,seq2,seqhoriz,seqvert,realroots,complexroots,eps,horiz_sturm,vert_sturm); - complex_roots(P,a01,b01,a1,b1,seqhoriz,seq2,seq3,seqvert,realroots,complexroots,eps,horiz_sturm,vert_sturm); - complex_roots(P,a0,b01,a01,b1,seqhoriz,seqvert,seq3,seq4,realroots,complexroots,eps,horiz_sturm,vert_sturm); + int n1=complex_roots(P,a0,b0,a01,b01,seq1,seqvert,seqhoriz,seq4,realroots,complexroots,eps,horiz_sturm,vert_sturm); + if (n1==n) + return n; + n1 += complex_roots(P,a01,b0,a1,b01,seq1,seq2,seqhoriz,seqvert,realroots,complexroots,eps,horiz_sturm,vert_sturm); + if (n1==n) + return n; + n1 += complex_roots(P,a01,b01,a1,b1,seqhoriz,seq2,seq3,seqvert,realroots,complexroots,eps,horiz_sturm,vert_sturm); + if (n1==n) + return n; + n1 += complex_roots(P,a0,b01,a01,b1,seqhoriz,seqvert,seq3,seq4,realroots,complexroots,eps,horiz_sturm,vert_sturm); + return n; } // Find complex roots of P in a0,b0 -> a1,b1 Modified: trunk/giac-xcas/giac/src/gen.cc =================================================================== --- trunk/giac-xcas/giac/src/gen.cc 2010-01-27 13:25:19 UTC (rev 767) +++ trunk/giac-xcas/giac/src/gen.cc 2010-02-03 12:07:50 UTC (rev 768) @@ -1950,7 +1950,10 @@ evaled=_SYMBptr->evalf(level,contextptr); return true; case _FRAC: - evaled=rdiv(_FRACptr->num.evalf(level,contextptr),_FRACptr->den.evalf(level,contextptr)); + if (decimal_digits(contextptr)<=14) + evaled=set_precision(*this,17).evalf_double(1,context0); + else + evaled=rdiv(_FRACptr->num.evalf(level,contextptr),_FRACptr->den.evalf(level,contextptr)); return true; case _FUNC: case _MOD: case _ROOT: return false; // replace in RPN mode @@ -8432,6 +8435,8 @@ if (a._DOUBLE_val<-eps) return -1.0; return 0.0; + case _FRAC: + return sign(a._FRACptr->num,contextptr)*sign(a._FRACptr->den,contextptr); } gen b=evalf_double(a,1,contextptr); if (b.type==_DOUBLE_){ Modified: trunk/giac-xcas/giac/src/global.h =================================================================== --- trunk/giac-xcas/giac/src/global.h 2010-01-27 13:25:19 UTC (rev 767) +++ trunk/giac-xcas/giac/src/global.h 2010-02-03 12:07:50 UTC (rev 768) @@ -284,10 +284,11 @@ // bit 0-8=radius, bit9-17 angle1, bit 18-26 angle2, bit 27=1 filled or 0 // <0 fill a polygon from previous turtle positions std::string s; + void * widget; #ifdef IPAQ - logo_turtle(): x(70),y(70),theta(0),visible(true),mark(true),color(0),turtle_length(10),radius(0) {} + logo_turtle(): x(70),y(70),theta(0),visible(true),mark(true),color(0),turtle_length(10),radius(0),widget(0) {} #else - logo_turtle(): x(150),y(150),theta(0),visible(true),mark(true),color(0),turtle_length(10),radius(0) {} + logo_turtle(): x(150),y(150),theta(0),visible(true),mark(true),color(0),turtle_length(10),radius(0),widget(0) {} #endif }; Modified: trunk/giac-xcas/giac/src/hist.cxx =================================================================== --- trunk/giac-xcas/giac/src/hist.cxx 2010-01-27 13:25:19 UTC (rev 767) +++ trunk/giac-xcas/giac/src/hist.cxx 2010-02-03 12:07:50 UTC (rev 768) @@ -561,7 +561,7 @@ if (w->pack->url){ delete w->pack->url; w->pack->url=0; } w->label("Unnamed"); } - w->pack->focus(0,true); + // w->pack->focus(0,true); Xcas_Main_Tab->add(w); Xcas_Main_Tab->value(Xcas_Main_Tab->child(Xcas_Main_Tab->children()-1)); Xcas_resize_mainwindow(); @@ -1443,7 +1443,8 @@ } static void cb_Xcas_help_forum(Fl_Menu_*, void*) { - xcas::system_browser((giac::browser_command("http://pcm1.e.ujf-grenoble.fr/XCAS")).c_str()); + const giac::context * contextptr = xcas::get_context(xcas::Xcas_input_focus); + xcas::system_browser((giac::browser_command(giac::language(contextptr)==4?"http://www.inf.uth.gr/xcas/":"http://pcm1.e.ujf-grenoble.fr/XCAS")).c_str()); } static void cb_Xcas_help_connan(Fl_Menu_*, void*) { Modified: trunk/giac-xcas/giac/src/hist.fl =================================================================== --- trunk/giac-xcas/giac/src/hist.fl 2010-01-27 13:25:19 UTC (rev 767) +++ trunk/giac-xcas/giac/src/hist.fl 2010-02-03 12:07:50 UTC (rev 768) @@ -637,7 +637,7 @@ if (w->pack->url){ delete w->pack->url; w->pack->url=0; } w->label("Unnamed"); } - w->pack->focus(0,true); + // w->pack->focus(0,true); Xcas_Main_Tab->add(w); Xcas_Main_Tab->value(Xcas_Main_Tab->child(Xcas_Main_Tab->children()-1)); Xcas_resize_mainwindow(); @@ -1697,7 +1697,10 @@ } { MenuItem Xcas_help_forum { label Forum - callback {xcas::system_browser((giac::browser_command("http://pcm1.e.ujf-grenoble.fr/XCAS")).c_str());} + callback { + const giac::context * contextptr = xcas::get_context(xcas::Xcas_input_focus); + xcas::system_browser((giac::browser_command(giac::language(contextptr)==4?"http://www.inf.uth.gr/xcas/":"http://pcm1.e.ujf-grenoble.fr/XCAS")).c_str()); +} xywh {15 15 100 20} } MenuItem Xcas_help_connan { Modified: trunk/giac-xcas/giac/src/intg.cc =================================================================== --- trunk/giac-xcas/giac/src/intg.cc 2010-01-27 13:25:19 UTC (rev 767) +++ trunk/giac-xcas/giac/src/intg.cc 2010-02-03 12:07:50 UTC (rev 768) @@ -1849,7 +1849,10 @@ tmpres=complex_subst(tmpres,x,tanxsur2,contextptr); tmprem=complex_subst(tmprem,x,tanxsur2,contextptr); } - remains_to_integrate = rdiv(plus_two,coeff_trig)*tmprem; + if (tmpres==0) + remains_to_integrate = e; + else + remains_to_integrate = rdiv(plus_two,coeff_trig)*tmprem*(1+pow(tanxsur2,2)); return rdiv(plus_two,coeff_trig)*tmpres; } Modified: trunk/giac-xcas/giac/src/modpoly.cc =================================================================== --- trunk/giac-xcas/giac/src/modpoly.cc 2010-01-27 13:25:19 UTC (rev 767) +++ trunk/giac-xcas/giac/src/modpoly.cc 2010-02-03 12:07:50 UTC (rev 768) @@ -812,6 +812,7 @@ mpz_t prod; mpz_init(prod); new_coord.clear(); + if (ita0==ita_end || itb0==itb_end) return; modpoly::const_iterator ita_begin=ita0,ita=ita0,itb=itb0; for ( ; ita!=ita_end; ++ita ){ ref_mpz_t * res = new ref_mpz_t; @@ -915,6 +916,7 @@ inline void Muldensemodpolysmall(const modpoly::const_iterator & ita0,const modpoly::const_iterator & ita_end,const modpoly::const_iterator & itb0,const modpoly::const_iterator & itb_end,environment * env,modpoly & new_coord){ new_coord.clear(); + if (ita0==ita_end || itb0==itb_end) return; modpoly::const_iterator ita_begin=ita0,ita=ita0,itb=itb0; for ( ; ita!=ita_end; ++ita ){ modpoly::const_iterator ita_cur=ita,itb_cur=itb; @@ -1838,6 +1840,8 @@ int *asave=new int[as], *a=asave,*aend=a+as; int *bsave=new int[bs], *b=bsave,*bend=b+bs,*qcur=0; #else + if (as>1000000 || bs>1000000) + setdimerr(); int asave[as], *a=asave,*aend=a+as; int bsave[bs], *b=bsave,*bend=b+bs,*qcur=0; #endif @@ -1868,6 +1872,8 @@ return false; bool promote = m>=46340; int as=p.lexsorted_degree()+1,bs=q.lexsorted_degree()+1; + if (as>1000000 || bs>1000000) + return false; #ifdef VISUALC int *asave = new int[as], *a=asave,*aend=a+as,*qcur=0; int *Asave = new int[as], *A=Asave,*Aend=A+as; Modified: trunk/giac-xcas/giac/src/solve.cc =================================================================== --- trunk/giac-xcas/giac/src/solve.cc 2010-01-27 13:25:19 UTC (rev 767) +++ trunk/giac-xcas/giac/src/solve.cc 2010-02-03 12:07:50 UTC (rev 768) @@ -565,12 +565,16 @@ if (!n){ *logptr(contextptr) << "Warning! Algebraic extension not implemented yet for poly " << r2sym(w,lv,contextptr) << endl; if (has_num_coeff(evalf(w,1,contextptr))){ - if (complexmode) - newv=proot(w,epsilon(contextptr)); - else - newv=real_proot(w,epsilon(contextptr),contextptr); - solve_ckrange(x,newv,isolate_mode,contextptr); - v=mergevecteur(v,newv); + try { + if (complexmode) + newv=proot(w,epsilon(contextptr)); + else + newv=real_proot(w,epsilon(contextptr),contextptr); + solve_ckrange(x,newv,isolate_mode,contextptr); + v=mergevecteur(v,newv); + } + catch (std::runtime_error & e){ + } return; } return; @@ -1371,7 +1375,9 @@ #endif // DEBUG_SUPPORT gen & f=params._VECTptr->front(); gen & x=params._VECTptr->back(); - gen res=evalf_double(subst(f,x,x0,false,context0),1,context0); + gen res=evalf(subst(f,x,x0,false,context0),1,context0); + if (res.type==_REAL) + res=evalf_double(res,1,context0); if (res.type>_IDNT) setsizeerr(); if (res.type!=_DOUBLE_) Modified: trunk/giac-xcas/giac/src/threaded.cc =================================================================== --- trunk/giac-xcas/giac/src/threaded.cc 2010-01-27 13:25:19 UTC (rev 767) +++ trunk/giac-xcas/giac/src/threaded.cc 2010-02-03 12:07:50 UTC (rev 768) @@ -5157,6 +5157,8 @@ // min poly mod modulo, coeffs should not contain i==sqrt(-1) if (is_zero(smod(pmin0,modulo))) continue; + if (debug_infolevel>shift_vars.size()) + cerr << "Modular algebraic extension gcd " << modulo << endl; vecteur pmin; pmin.reserve(pminv.size()); const_iterateur it=pminv.begin(),itend=pminv.end(); @@ -5285,6 +5287,8 @@ if (m.type!=_INT_) return false; int modulo=m.val; + if (debug_infolevel>shift_vars.size()) + cerr << "Modular algebraic extension gcd " << modulo << endl; // min poly mod modulo if (is_zero(smod(pmin0,modulo))) continue; Modified: trunk/giac-xcas/giac/src/ti89.cc =================================================================== --- trunk/giac-xcas/giac/src/ti89.cc 2010-01-27 13:25:19 UTC (rev 767) +++ trunk/giac-xcas/giac/src/ti89.cc 2010-02-03 12:07:50 UTC (rev 768) @@ -1410,14 +1410,14 @@ unary_function_eval __Output(&_Output,_Output_s,&printastifunction); unary_function_ptr at_Output (&__Output,0,T_RETURN); - gen _getKey(const gen & g){ + gen _getKey(const gen & g,GIAC_CONTEXT){ char ch; cerr << "Waiting for a keystroke in konsole screen" << endl; cin >> ch; return int(ch); } const string _getKey_s("getKey"); - unary_function_unary __getKey(&_getKey,_getKey_s); + unary_function_eval __getKey(&_getKey,_getKey_s); unary_function_ptr at_getKey (&__getKey,0,true); gen _DelFold(const gen & g,GIAC_CONTEXT){ Modified: trunk/giac-xcas/giac/src/ti89.h =================================================================== --- trunk/giac-xcas/giac/src/ti89.h 2010-01-27 13:25:19 UTC (rev 767) +++ trunk/giac-xcas/giac/src/ti89.h 2010-02-03 12:07:50 UTC (rev 768) @@ -35,7 +35,8 @@ extern unary_function_ptr at_InputStr; gen _Prompt(const gen & args,GIAC_CONTEXT); extern unary_function_ptr at_Prompt; - extern unary_function_unary __getKey; + extern unary_function_eval __getKey; + extern unary_function_ptr at_getKey; extern unary_function_ptr at_numer; gen _ClrIO(const gen & args,GIAC_CONTEXT); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2010-01-27 13:26:16
|
Revision: 767 http://xcas.svn.sourceforge.net/xcas/?rev=767&view=rev Author: parisse Date: 2010-01-27 13:25:19 +0000 (Wed, 27 Jan 2010) Log Message: ----------- fix for CoCoA 0.9935 Modified Paths: -------------- trunk/giac-xcas/giac/src/Graph.cc trunk/giac-xcas/giac/src/Input.cc trunk/giac-xcas/giac/src/Xcas1.cc trunk/giac-xcas/giac/src/cocoa.cc trunk/giac-xcas/giac/src/derive.cc trunk/giac-xcas/giac/src/hist.cxx trunk/giac-xcas/giac/src/hist.fl trunk/giac-xcas/giac/src/usual.cc Modified: trunk/giac-xcas/giac/src/Graph.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph.cc 2010-01-20 14:50:44 UTC (rev 766) +++ trunk/giac-xcas/giac/src/Graph.cc 2010-01-27 13:25:19 UTC (rev 767) @@ -41,6 +41,9 @@ #include <stdio.h> #include <dirent.h> #include <sys/stat.h> // auto-recovery function +#ifdef HAVE_SYS_TIME_H +#include <sys/time.h> +#endif #include "path.h" #ifndef IN_GIAC #include <giac/plot.h> Modified: trunk/giac-xcas/giac/src/Input.cc =================================================================== --- trunk/giac-xcas/giac/src/Input.cc 2010-01-20 14:50:44 UTC (rev 766) +++ trunk/giac-xcas/giac/src/Input.cc 2010-01-27 13:25:19 UTC (rev 767) @@ -936,6 +936,7 @@ ostringstream warnings ; ostream * old=giac::logptr(contextptr); logptr(&warnings,contextptr); + giac::first_error_line(contextptr)=0; try { val=warn_equal(giac::gen(value(),contextptr),contextptr); } Modified: trunk/giac-xcas/giac/src/Xcas1.cc =================================================================== --- trunk/giac-xcas/giac/src/Xcas1.cc 2010-01-20 14:50:44 UTC (rev 766) +++ trunk/giac-xcas/giac/src/Xcas1.cc 2010-01-27 13:25:19 UTC (rev 767) @@ -57,6 +57,9 @@ #include <string.h> #include <dirent.h> #include <sys/stat.h> // auto-recovery function +#ifdef HAVE_SYS_TIME_H +#include <sys/time.h> +#endif #ifdef HAVE_LIBPTHREAD #include <semaphore.h> #endif @@ -2415,7 +2418,10 @@ giac::gen in_Xcas_fltk_getKey(const giac::gen & g,giac::context * contextptr){ int ch=Fl::event_key(); - return ch; + if (Fl::event_key(ch)) + return ch; + else + return -ch; } giac::gen Xcas_fltk_getKey(const giac::gen & g){ @@ -2466,7 +2472,7 @@ Fl_Window * w = Plotfltk_w ; w->end(); int taillew=w->w(),tailleh=w->h(); - if (taillew<100 | tailleh<100){ + if (taillew<100 || tailleh<100){ if (taillew<100) taillew=100; if (tailleh<100) Modified: trunk/giac-xcas/giac/src/cocoa.cc =================================================================== --- trunk/giac-xcas/giac/src/cocoa.cc 2010-01-20 14:50:44 UTC (rev 766) +++ trunk/giac-xcas/giac/src/cocoa.cc 2010-01-27 13:25:19 UTC (rev 767) @@ -81,7 +81,7 @@ case _INT_: return CoCoA::ZZ(g.val); case _ZINT: - return CoCoA::ZZ(*g._ZINTptr); + return CoCoA::ZZ(CoCoA::CopyFromMPZ,*g._ZINTptr); default: setsizeerr("Invalid giac gen -> CoCoA ZZ conversion"+g.print()); return CoCoA::ZZ(0); Modified: trunk/giac-xcas/giac/src/derive.cc =================================================================== --- trunk/giac-xcas/giac/src/derive.cc 2010-01-20 14:50:44 UTC (rev 766) +++ trunk/giac-xcas/giac/src/derive.cc 2010-01-27 13:25:19 UTC (rev 767) @@ -1,4 +1,4 @@ -/* -*- mode:C++ ; compile-command: "g++-3.4 -I.. -g -c derive.cc" -*- */ +/* -*- mode:C++ ; compile-command: "g++-3.4 -DHAVE_CONFIG_H -I. -I.. -DIN_GIAC -g -c derive.cc" -*- */ #include "first.h" /* * Copyright (C) 2000,7 B. Parisse, Institut Fourier, 38402 St Martin d'Heres @@ -149,7 +149,7 @@ // now look at other operators, first onearg operator if (s.sommet.ptr->D){ if (s.feuille.type!=_VECT) - return (*s.sommet.ptr->D)(1)(s.feuille,0)*derive(s.feuille,i,contextptr); + return (*s.sommet.ptr->D)(1)(s.feuille,contextptr)*derive(s.feuille,i,contextptr); // multiargs operators int taille=s.feuille._VECTptr->size(); vecteur v; @@ -159,7 +159,7 @@ for (int j=1;iti!=itend;++iti,++j){ e=derive(*iti,i,contextptr); if (!is_zero(e)) - v.push_back(e*(*s.sommet.ptr->D)(j)(s.feuille,0)); + v.push_back(e*(*s.sommet.ptr->D)(j)(s.feuille,contextptr)); } if (v.size()==1) return v.front(); Modified: trunk/giac-xcas/giac/src/hist.cxx =================================================================== --- trunk/giac-xcas/giac/src/hist.cxx 2010-01-20 14:50:44 UTC (rev 766) +++ trunk/giac-xcas/giac/src/hist.cxx 2010-01-27 13:25:19 UTC (rev 767) @@ -3356,7 +3356,7 @@ Xcas_Diese_key->align(Fl_Align(FL_ALIGN_CENTER)); Xcas_Diese_key->when(FL_WHEN_RELEASE); } // xcas::No_Focus_Button* Xcas_Diese_key - { Xcas_Pi_key = new xcas::No_Focus_Button(230, 490, 25, 25, gettext("\317\200")); + { Xcas_Pi_key = new xcas::No_Focus_Button(230, 490, 25, 25, gettext("\316\240")); Xcas_Pi_key->box(FL_UP_BOX); Xcas_Pi_key->color((Fl_Color)10); Xcas_Pi_key->selection_color(FL_BACKGROUND_COLOR); Modified: trunk/giac-xcas/giac/src/hist.fl =================================================================== --- trunk/giac-xcas/giac/src/hist.fl 2010-01-20 14:50:44 UTC (rev 766) +++ trunk/giac-xcas/giac/src/hist.fl 2010-01-27 13:25:19 UTC (rev 767) @@ -2677,7 +2677,7 @@ class {xcas::No_Focus_Button} } Fl_Button Xcas_Pi_key { - label {π} + label {Π} xywh {230 490 25 25} color 10 labelsize 10 class {xcas::No_Focus_Button} } Modified: trunk/giac-xcas/giac/src/usual.cc =================================================================== --- trunk/giac-xcas/giac/src/usual.cc 2010-01-20 14:50:44 UTC (rev 766) +++ trunk/giac-xcas/giac/src/usual.cc 2010-01-27 13:25:19 UTC (rev 767) @@ -3579,6 +3579,8 @@ unary_function_ptr at_rem (&__rem,0,true); gen double2gen(double d){ + if (my_isinf(d)) + return d; ref_mpz_t * m= new ref_mpz_t; mpz_set_d(m->z,d); return m; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2010-01-20 14:52:10
|
Revision: 766 http://xcas.svn.sourceforge.net/xcas/?rev=766&view=rev Author: parisse Date: 2010-01-20 14:50:44 +0000 (Wed, 20 Jan 2010) Log Message: ----------- Modified Paths: -------------- trunk/giac-xcas/giac/src/Help1.cc trunk/giac-xcas/giac/src/History.cc trunk/giac-xcas/giac/src/Xcas1.cc trunk/giac-xcas/giac/src/plot.cc Modified: trunk/giac-xcas/giac/src/Help1.cc =================================================================== --- trunk/giac-xcas/giac/src/Help1.cc 2010-01-15 14:23:46 UTC (rev 765) +++ trunk/giac-xcas/giac/src/Help1.cc 2010-01-20 14:50:44 UTC (rev 766) @@ -64,21 +64,21 @@ string motif=s.substr(i,pos-i); i=pos; if (motif=="é") - res += "\xE9"; + res += "e"; if (motif=="è") - res += "\xE8"; + res += "e"; if (motif=="ê") - res += "\xEA"; + res += "e"; if (motif=="à") - res += "\xE0"; + res += "a"; if (motif=="ô") - res += "\xF4"; + res += "o"; if (motif=="ö") res += "o"; if (motif=="É") res += "E"; if (motif=="î") - res += "\xEE"; + res += "i"; } } } Modified: trunk/giac-xcas/giac/src/History.cc =================================================================== --- trunk/giac-xcas/giac/src/History.cc 2010-01-15 14:23:46 UTC (rev 765) +++ trunk/giac-xcas/giac/src/History.cc 2010-01-20 14:50:44 UTC (rev 766) @@ -1942,7 +1942,7 @@ } // bool computing=false; if (Fl_Output * out =dynamic_cast<Fl_Output *>(a)){ - if (strcmp(out->value(),gettext("Unable to launch thread"))==0) + if (strcmp(out->value(),gettext("Unable to launch thread. Press STOP to interrupt."))==0) output_resize_parent(otmp); } p->resize(); Modified: trunk/giac-xcas/giac/src/Xcas1.cc =================================================================== --- trunk/giac-xcas/giac/src/Xcas1.cc 2010-01-15 14:23:46 UTC (rev 765) +++ trunk/giac-xcas/giac/src/Xcas1.cc 2010-01-20 14:50:44 UTC (rev 766) @@ -1206,7 +1206,7 @@ delete res; res=out; } - out->value(ok?gettext("Computing..."):gettext("Unable to launch thread")); + out->value(ok?gettext("Computing..."):gettext("Unable to launch thread. Press STOP to interrupt.")); return res; } Modified: trunk/giac-xcas/giac/src/plot.cc =================================================================== --- trunk/giac-xcas/giac/src/plot.cc 2010-01-15 14:23:46 UTC (rev 765) +++ trunk/giac-xcas/giac/src/plot.cc 2010-01-20 14:50:44 UTC (rev 766) @@ -2700,20 +2700,22 @@ gen _coordonnees_polaires(const gen & args,GIAC_CONTEXT){ gen c=args.is_symb_of_sommet(at_pnt)?_coordonnees(args,contextptr):args; - if (c.type!=_VECT || c._VECTptr->size()!=2) + if (c.type==_VECT && c._VECTptr->size()==2){ + gen a=c._VECTptr->front(); + gen b=c._VECTptr->back(); + if (a.type==_VECT && b.type==_VECT){ + gen tmp=a-b; + if (tmp.type!=_VECT || tmp._VECTptr->size()!=2) + setsizeerr(); + a=tmp._VECTptr->front(); + b=tmp._VECTptr->back(); + } + c=a+cst_i*b; + } + if (c.type==_VECT) setsizeerr(); - gen a=c._VECTptr->front(); - gen b=c._VECTptr->back(); - if (a.type==_VECT && b.type==_VECT){ - gen tmp=a-b; - if (tmp.type!=_VECT || tmp._VECTptr->size()!=2) - setsizeerr(); - a=tmp._VECTptr->front(); - b=tmp._VECTptr->back(); - } - c=a+cst_i*b; - a=abs(c,contextptr); - b=arg(c,contextptr); + gen a=abs(c,contextptr); + gen b=arg(c,contextptr); return makevecteur(a,b); } const string _coordonnees_polaires_s("polar_coordinates"); @@ -2723,7 +2725,9 @@ gen _coordonnees_rectangulaires(const gen & args,GIAC_CONTEXT){ if (args.is_symb_of_sommet(at_pnt)) return _coordonnees(args,contextptr); - if (args.type!=_VECT || args._VECTptr->size()!=2) + if (args.type!=_VECT) + return makevecteur(re(args,contextptr),im(args,contextptr)); + if (args._VECTptr->size()!=2) setsizeerr(); gen a=args._VECTptr->front(); gen b=args._VECTptr->back(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2010-01-15 14:24:43
|
Revision: 765 http://xcas.svn.sourceforge.net/xcas/?rev=765&view=rev Author: parisse Date: 2010-01-15 14:23:46 +0000 (Fri, 15 Jan 2010) Log Message: ----------- Modified Paths: -------------- trunk/giac-xcas/giac/src/Graph.cc trunk/giac-xcas/giac/src/Graph.h trunk/giac-xcas/giac/src/History.cc trunk/giac-xcas/giac/src/History.h trunk/giac-xcas/giac/src/Input.cc trunk/giac-xcas/giac/src/Tableur.cc trunk/giac-xcas/giac/src/Xcas1.cc trunk/giac-xcas/giac/src/Xcas1.h trunk/giac-xcas/giac/src/alg_ext.cc trunk/giac-xcas/giac/src/desolve.cc trunk/giac-xcas/giac/src/global.cc trunk/giac-xcas/giac/src/help.cc trunk/giac-xcas/giac/src/hist.cxx trunk/giac-xcas/giac/src/hist.fl trunk/giac-xcas/giac/src/hist.h trunk/giac-xcas/giac/src/icas.cc trunk/giac-xcas/giac/src/input_lexer.cc trunk/giac-xcas/giac/src/input_lexer.ll trunk/giac-xcas/giac/src/plot.cc trunk/giac-xcas/giac/src/prog.cc trunk/giac-xcas/giac/src/series.cc trunk/giac-xcas/giac/src/solve.cc trunk/giac-xcas/giac/src/subst.cc trunk/giac-xcas/giac/src/symbolic.cc trunk/giac-xcas/giac/src/usual.cc Modified: trunk/giac-xcas/giac/src/Graph.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph.cc 2009-12-17 14:23:08 UTC (rev 764) +++ trunk/giac-xcas/giac/src/Graph.cc 2010-01-15 14:23:46 UTC (rev 765) @@ -63,6 +63,8 @@ namespace xcas { #endif // ndef NO_NAMESPACE_XCAS + bool do_helpon=true; + std::map<std::string,std::pair<Fl_Image *,Fl_Image *> *> texture2d_cache; void get_texture2d(const string & s,std::pair<Fl_Image *,Fl_Image *> * & texture){ @@ -3048,7 +3050,7 @@ round3(newy,window_ymin,window_ymax); if (gr3d) round3(newz,window_zmin,window_zmax); - tmp=geometry_round(newx,newy,newz,eps,tmp2,pos); + tmp=geometry_round(newx,newy,newz,eps,tmp2,pos,mode==0); if (tmp.type==_VECT && tmp._VECTptr->size()==3){ tmp.subtype=_SEQ__VECT; tmp=symbolic(at_point,tmp); @@ -3222,7 +3224,7 @@ round3(newx,window_xmin,window_xmax); round3(newy,window_ymin,window_ymax); gen t=projection(evalf(tmp2,1,hp->contextptr),gen(newx,newy),hp->contextptr); - gen tmp3=symbolic(at_element,(t.type<_IDNT?gen(makevecteur(tmp,t),_SEQ__VECT):tmp)); + gen tmp3=symbolic(at_element,( (t.type<_IDNT || t.type==_VECT)?gen(makevecteur(tmp,t),_SEQ__VECT):tmp)); tmp3=symbolic(at_sto,makevecteur(add_attributs(tmp3,couleur),gen(autoname(hp->contextptr),hp->contextptr))); hp->set_gen_value(-1,tmp3,false); if (hp_pos<0) hp_pos=hp->children()-1; @@ -3257,6 +3259,8 @@ args_tmp_push_size=args_size; args_tmp.erase(args_tmp.begin()+args_tmp_push_size,args_tmp.end()); } + if (npoints+args_tmp.size()>mode) + npoints=1; if (event==FL_MOVE || event==FL_DRAG || event==FL_RELEASE){ mouse_position->redraw(); if (args_size && args_tmp_push_size && args_push!=tmp){ @@ -3298,10 +3302,43 @@ gen tmp_plot; if (in_area && function_final.type==_FUNC) { unary_function_ptr * ptr=function_final._FUNCptr; - hp_pos=-1; tmp_plot=symbolic(*ptr,gen( (*ptr==(gr3d?at_sphere:at_cercle)) ?makevecteur(args_tmp.front(),args_tmp.back()-args_tmp.front()):args_tmp,_SEQ__VECT)); - do_handle(symbolic(at_sto,makevecteur(add_attributs(tmp_plot,couleur),gen(autoname(hp->contextptr),hp->contextptr)))); + gen res,objname=gen(autoname(hp->contextptr),hp->contextptr); + try { + res=evalf(tmp_plot,1,hp->contextptr); + } + catch (std::runtime_error & err){ + res=undef; + } + hp_pos=hp->children()-1; + int pos0=hp_pos; + hp->set_gen_value(hp_pos,symbolic(at_sto,makevecteur(add_attributs(tmp_plot,couleur),objname)),false); + hp->add_entry(hp_pos+1); + ++hp_pos; + if (res.is_symb_of_sommet(at_pnt)){ + res=remove_at_pnt(res); + int ns=0; + if (res.type==_VECT && res.subtype==_GROUP__VECT && (ns=res._VECTptr->size())>2){ + vecteur l; + if (res._VECTptr->back()==res._VECTptr->front()) + --ns; + for (int i=1;i<=ns;++i){ + tmp_plot=symbolic(at_at,gen(makevecteur(symbolic(at_sommets,objname),i-1),_SEQ__VECT)); + l.push_back(gen(autoname(hp->contextptr)+print_INT_(i),hp->contextptr)); + hp->set_gen_value(hp_pos,symbolic(at_sto,makevecteur(tmp_plot,l.back())),false); + hp->add_entry(hp_pos+1); + ++hp_pos; + } + for (int i=1;i<=ns;++i){ + tmp_plot=symbolic(at_segment,makevecteur(l[i-1],l[i%ns])); + hp->set_gen_value(hp_pos,symbolic(at_sto,makevecteur(add_attributs(tmp_plot,couleur),gen(autoname(hp->contextptr)+print_INT_(ns+i),hp->contextptr))),false); + hp->add_entry(hp_pos+1); + ++hp_pos; + } + } + } autoname_plus_plus(); + hp->update(pos0); } args_tmp.clear(); args_tmp_push_size=0; @@ -3415,7 +3452,7 @@ // find nearest point of x+i*y, returns position in history and either // a numeric value or the point name - gen Graph2d3d::geometry_round(double x,double y,double z,double eps,gen & original,int & pos) { + gen Graph2d3d::geometry_round(double x,double y,double z,double eps,gen & original,int & pos,bool selectfirstlevel) { if (!hp) return undef; context * contextptr=hp?hp->contextptr:get_context(this); @@ -3426,7 +3463,10 @@ geometry_round(x,y,z,eps,tmp,contextptr); if (selected.empty()) return tmp; - pos=findfirstpoint(selection2vecteur(selected)); + if (selectfirstlevel) + sort(selected.begin(),selected.end()); + else + pos=findfirstpoint(selection2vecteur(selected)); gen g=hp->parse( (pos<0)?(pos=selected.front()):(pos=selected[pos]) ); if (pos>=0) hp->_sel_begin=hp->_sel_end=pos; @@ -5196,7 +5236,13 @@ if (f){ string ans; int remove=0; - int r=handle_tab(cmd,*giac::vector_completions_ptr,2*f->w()/3,2*f->h()/3,remove,ans); + int r; + if (do_helpon) + r=handle_tab(cmd,*giac::vector_completions_ptr,2*f->w()/3,2*f->h()/3,remove,ans); + else { + ans=cmd+"()"; + r=1; + } if (r){ if (!f->geo->hp) return; @@ -6065,33 +6111,33 @@ if (!Fl::focus()) return; string text; - if (b->label()=="av") + if (b->label()==gettext("av")) text="avance "; - if (b->label()=="re") + if (b->label()==gettext("re")) text="recule "; - if (b->label()=="td") + if (b->label()==gettext("td")) text="tourne_droite "; - if (b->label()=="tg") + if (b->label()==gettext("tg")) text="tourne_gauche "; - if (b->label()=="pc") + if (b->label()==gettext("pc")) text="pas_de_cote "; - if (b->label()=="sa") + if (b->label()==gettext("sa")) text="saute "; - if (b->label()=="cr") + if (b->label()==gettext("cr")) text="crayon "; - if (b->label()=="ro") + if (b->label()==gettext("ro")) text="rond "; - if (b->label()=="di") + if (b->label()==gettext("di")) text="disque "; - if (b->label()=="rp") + if (b->label()==gettext("rp")) text="rectangle_plein "; - if (b->label()=="tp") + if (b->label()==gettext("tp")) text="triangle_plein "; - if (b->label()=="ef") + if (b->label()==gettext("ef")) text="efface "; - if (b->label()=="ec") + if (b->label()==gettext("ec")) text="ecris "; - if (b->label()=="sg") + if (b->label()==gettext("sg")) text="signe "; if (!text.empty()) help_output(text.substr(0,text.size()-1),language(get_context(Fl::focus()))); @@ -6253,73 +6299,73 @@ button_group = new Fl_Group(X+W/4,Y+H-L,bw*14,L); int bx=button_group->x(),by=button_group->y(); No_Focus_Button * avance = new No_Focus_Button(bx,by,bw,L); - avance->label("av"); - avance->tooltip("La tortue avance de n pas"); + avance->label(gettext("av")); + avance->tooltip(gettext("La tortue avance de n pas")); avance->callback((Fl_Callback *) cb_Logo_button); bx += bw; No_Focus_Button * recule = new No_Focus_Button(bx,by,bw,L); - recule->label("re"); - recule->tooltip("La tortue recule de n pas"); + recule->label(gettext("re")); + recule->tooltip(gettext("La tortue recule de n pas")); recule->callback((Fl_Callback *) cb_Logo_button); bx += bw; No_Focus_Button * td = new No_Focus_Button(bx,by,bw,L); - td->label("td"); - td->tooltip("La tortue tourne a droite de n degres"); + td->label(gettext("td")); + td->tooltip(gettext("La tortue tourne a droite de n degres")); td->callback((Fl_Callback *) cb_Logo_button); bx += bw; No_Focus_Button * tg = new No_Focus_Button(bx,by,bw,L); - tg->label("tg"); - tg->tooltip("La tortue tourne a gauche de n degres"); + tg->label(gettext("tg")); + tg->tooltip(gettext("La tortue tourne a gauche de n degres")); tg->callback((Fl_Callback *) cb_Logo_button); bx += bw; No_Focus_Button * pc = new No_Focus_Button(bx,by,bw,L); - pc->label("pc"); - pc->tooltip("Pas de cote a gauche de n pas"); + pc->label(gettext("pc")); + pc->tooltip(gettext("Pas de cote a gauche de n pas")); pc->callback((Fl_Callback *) cb_Logo_button); bx += bw; No_Focus_Button * sa = new No_Focus_Button(bx,by,bw,L); - sa->label("sa"); - sa->tooltip("Saute de n pas"); + sa->label(gettext("sa")); + sa->tooltip(gettext("Saute de n pas")); sa->callback((Fl_Callback *) cb_Logo_button); bx += bw; No_Focus_Button * cr = new No_Focus_Button(bx,by,bw,L); - cr->label("cr"); - cr->tooltip("Change la couleur du crayon"); + cr->label(gettext("cr")); + cr->tooltip(gettext("Change la couleur du crayon")); cr->callback((Fl_Callback *) cb_Logo_button); bx += bw; No_Focus_Button * ro = new No_Focus_Button(bx,by,bw,L); - ro->label("ro"); - ro->tooltip("Arc de cercle"); + ro->label(gettext("ro")); + ro->tooltip(gettext("Arc de cercle")); ro->callback((Fl_Callback *) cb_Logo_button); bx += bw; No_Focus_Button * di = new No_Focus_Button(bx,by,bw,L); - di->label("di"); - di->tooltip("Arc de cercle rempli"); + di->label(gettext("di")); + di->tooltip(gettext("Arc de cercle rempli")); di->callback((Fl_Callback *) cb_Logo_button); bx += bw; No_Focus_Button * rp = new No_Focus_Button(bx,by,bw,L); - rp->label("rp"); - rp->tooltip("Rectangle plein"); + rp->label(gettext("rp")); + rp->tooltip(gettext("Rectangle plein")); rp->callback((Fl_Callback *) cb_Logo_button); bx += bw; No_Focus_Button * tp = new No_Focus_Button(bx,by,bw,L); - tp->label("tp"); - tp->tooltip("Triangle plein"); + tp->label(gettext("tp")); + tp->tooltip(gettext("Triangle plein")); tp->callback((Fl_Callback *) cb_Logo_button); bx += bw; No_Focus_Button * ec = new No_Focus_Button(bx,by,bw,L); - ec->label("ec"); - ec->tooltip("Ecrire a la droite de la tortue"); + ec->label(gettext("ec")); + ec->tooltip(gettext("Ecrire a la droite de la tortue")); ec->callback((Fl_Callback *) cb_Logo_button); bx += bw; No_Focus_Button * sg = new No_Focus_Button(bx,by,bw,L); - sg->label("sg"); - sg->tooltip("Signer le dessin de la tortue"); + sg->label(gettext("sg")); + sg->tooltip(gettext("Signer le dessin de la tortue")); sg->callback((Fl_Callback *) cb_Logo_button); bx += bw; No_Focus_Button * ef = new No_Focus_Button(bx,by,bw,L); - ef->label("ef"); - ef->tooltip("Efface tout"); + ef->label(gettext("ef")); + ef->tooltip(gettext("Efface tout")); ef->callback((Fl_Callback *) cb_Logo_button); button_group->end(); menubar = new Fl_Menu_Bar(button_group->x()+button_group->w(),button_group->y(),W/2-button_group->w(),L); Modified: trunk/giac-xcas/giac/src/Graph.h =================================================================== --- trunk/giac-xcas/giac/src/Graph.h 2009-12-17 14:23:08 UTC (rev 764) +++ trunk/giac-xcas/giac/src/Graph.h 2010-01-15 14:23:46 UTC (rev 765) @@ -46,6 +46,8 @@ std::string printstring(const giac::gen & g,const giac::context * contextptr); void round3(double & x,double xmin,double xmax); + extern bool do_helpon;// true if Xcas_automatic_completion_browser enabled + enum extended_colors { dark_blue_color=0x0f, dark_green_color =0x3d, @@ -203,7 +205,7 @@ virtual int in_handle(int); int geo_handle(int event); virtual const char * latex(const char * filename); - giac::gen geometry_round(double x,double y,double z,double eps,giac::gen & original,int & pos) ; + giac::gen geometry_round(double x,double y,double z,double eps,giac::gen & original,int & pos,bool selectfirstlevel=false) ; virtual void geometry_round(double x,double y,double z,double eps,giac::gen & tmp,const giac::context *) ; giac::vecteur selection2vecteur(const std::vector<int> & v); void set_mode(const giac::gen & f_tmp,const giac::gen & f_final,int m); Modified: trunk/giac-xcas/giac/src/History.cc =================================================================== --- trunk/giac-xcas/giac/src/History.cc 2009-12-17 14:23:08 UTC (rev 764) +++ trunk/giac-xcas/giac/src/History.cc 2010-01-15 14:23:46 UTC (rev 765) @@ -1703,6 +1703,7 @@ int addh=1; Fl_Group::current(0); Fl_Tile * g = new Fl_Tile(q->x(),q->y(),q->w(),q->h()+addh); + g->labelfont(q->labelfont()); g->end(); g->add(q); Log_Output * lg = new Log_Output(q->x(),q->y()+q->h(),q->w(),addh); @@ -1803,6 +1804,8 @@ Fl_Widget * new_tableur(int W,int H,const History_Pack * pack){ Fl_Group::current(0); Tableur_Group * t = new Tableur_Group(0,0,W,H,pack->labelsize(),0); + t->labelfont(pack->labelfont()); + t->table->labelfont(pack->labelfont()); if (t && t->table) Fl::focus(t->table->input); set_colors(t); @@ -1812,6 +1815,7 @@ Fl_Widget * new_program(int W,int H,const History_Pack * pack){ Fl_Group::current((Fl_Group *)pack); Editeur * t = new Editeur(0,0,W,H); + t->labelfont(pack->labelfont()); t->callback(History_Pack_cb_eval,0); set_colors(t); return t; @@ -1820,6 +1824,8 @@ Fl_Group * new_figure(int W,int H,const History_Pack * pack,bool dim3,bool approx){ Fl_Group::current(0); Figure * t = new Figure(0,0,W,H,pack->labelsize(),dim3); + t->labelfont(pack->labelfont()); + t->geo->hp->labelfont(pack->labelfont()); t->geo->approx=approx; t->geo->hp->contextptr=pack->contextptr; if (dim3) @@ -3652,6 +3658,22 @@ redraw(); // since children have been modified } + int DispG_Window::handle(int event){ + int res=Fl_Window::handle(event); + if (event==FL_HIDE){ + int n=children(); + for (int i=0;i<n;++i){ + Fl_Group * t = dynamic_cast<Fl_Group *>(child(i)); + if (t && t->children()){ + Graph2d3d * gr=dynamic_cast<Graph2d3d *>(t->child(0)); + if (gr) + gr->clear(); + } + } + } + return res; + } + // Implementation of widget output stream owstream::owstream(Fl_Output * wid,context * ptr, int bsize):ostream(new widgetbuf(wid, bsize)),output(wid),contextptr(ptr) {} Modified: trunk/giac-xcas/giac/src/History.h =================================================================== --- trunk/giac-xcas/giac/src/History.h 2009-12-17 14:23:08 UTC (rev 764) +++ trunk/giac-xcas/giac/src/History.h 2010-01-15 14:23:46 UTC (rev 765) @@ -323,6 +323,13 @@ // resize all its childrens to the same size }; + class DispG_Window:public Fl_Window { + public: + DispG_Window(int x,int y,int w,int h,const char * l=0):Fl_Window(x,y,w,h,l){} + DispG_Window(int x,int y,const char * l=0):Fl_Window(x,y,l){} + virtual int handle(int); + }; + // new_question widget creator Fl_Widget * new_question_multiline_input(int W,int H); Fl_Widget * new_question_equation(int W,int H); Modified: trunk/giac-xcas/giac/src/Input.cc =================================================================== --- trunk/giac-xcas/giac/src/Input.cc 2009-12-17 14:23:08 UTC (rev 764) +++ trunk/giac-xcas/giac/src/Input.cc 2010-01-15 14:23:46 UTC (rev 765) @@ -59,7 +59,7 @@ #define TAB_ARGS 6 -#ifdef __APPLE__ +#if defined __APPLE__ || defined WIN32 bool use_external_browser = true ; #else bool use_external_browser = getenv("BROWSER") ; @@ -152,6 +152,32 @@ return s; } + std::string split(const std::string & s,Fl_Widget * w){ + fl_font(w->labelfont(),w->labelsize()); + string res,ajout; + int fin=s.size(),debut=0; + int taille=w->w(); + for (;debut<fin;){ + int l=fin-debut; + ajout=s.substr(debut,l); + if (fl_width(ajout.c_str())<=taille) + return res+ajout; + for (--l;l>0;--l){ + if (s[debut+l]==' '){ + ajout=s.substr(debut,l); + if (fl_width(ajout.c_str())<=taille){ + res += ajout; + res += '\n'; + break; + } + } + } + if (l==0) + return res+ajout; + debut += l+1; + } + } + void update_examples(const string & s,Fl_Browser * examples,Fl_Browser * related,Fl_Browser * syns,Fl_Output * output,Fl_Input ** argtab,int language){ help_output(s,language); if (output->label()) @@ -212,7 +238,7 @@ vector<giac::localized_string>::const_iterator it=cur_aide.blabla.begin(),itend=cur_aide.blabla.end(); for (;it!=itend;++it){ if (it->language==language){ - result = it->chaine +'\n'+result ; + result = split(it->chaine,output) +'\n'+result ; break; } } @@ -371,7 +397,7 @@ input->when(FL_WHEN_CHANGED |FL_WHEN_ENTER_KEY |FL_WHEN_NOT_CHANGED); // input->label("?"); input->tooltip(gettext("Show commandnames starting from this text")); - output = new Fl_Multiline_Output(2,input->y()+input->h(),dx-4,2*L+6); + output = new Fl_Multiline_Output(2,input->y()+input->h(),dx-4,3*L+9); output->tooltip(gettext("Command short description and syntax")); // arguments int ypos=output->y()+output->h(); @@ -929,7 +955,7 @@ curline += ch; if (ch=='\n' || i==warns){ debutline=curline.substr(0,min(size_t(10),curline.size())); - if (debutline!="// Parsing" && debutline!="// Success") + if (debutline!=gettext("// Parsing") && debutline!=gettext("// Success")) warn += curline; *old << curline; curline=""; Modified: trunk/giac-xcas/giac/src/Tableur.cc =================================================================== --- trunk/giac-xcas/giac/src/Tableur.cc 2009-12-17 14:23:08 UTC (rev 764) +++ trunk/giac-xcas/giac/src/Tableur.cc 2010-01-15 14:23:46 UTC (rev 765) @@ -63,7 +63,7 @@ #ifdef IPAQ int Flv_Table_Gen::def_rows=10,Flv_Table_Gen::def_cols=4; #else - int Flv_Table_Gen::def_rows=33,Flv_Table_Gen::def_cols=10; + int Flv_Table_Gen::def_rows=40,Flv_Table_Gen::def_cols=10; #endif vecteur fillsheet(bool is_spreadsheet){ @@ -2347,7 +2347,7 @@ void cb_Tableur_SetRows(Fl_Menu_* m , void*) { Flv_Table_Gen * tg=find_table_brother(m); if (!tg) return; - const char * ch=fl_input("New row number",print_INT_(tg->rows()).c_str()); + const char * ch=fl_input(gettext("New row number"),print_INT_(tg->rows()).c_str()); if (ch){ int i=atoi(ch); if (i<tg->rows()){ @@ -2363,7 +2363,7 @@ void cb_Tableur_SetCols(Fl_Menu_* m , void*) { Flv_Table_Gen * tg=find_table_brother(m); if (!tg) return; - const char * ch=fl_input("New col number",print_INT_(tg->cols()).c_str()); + const char * ch=fl_input(gettext("New col number"),print_INT_(tg->cols()).c_str()); if (ch){ int i=atoi(ch); if (i<tg->cols()){ Modified: trunk/giac-xcas/giac/src/Xcas1.cc =================================================================== --- trunk/giac-xcas/giac/src/Xcas1.cc 2009-12-17 14:23:08 UTC (rev 764) +++ trunk/giac-xcas/giac/src/Xcas1.cc 2010-01-15 14:23:46 UTC (rev 765) @@ -94,6 +94,7 @@ Enlargable_Multiline_Output *Xcas_help_output =0 ; xcas::Graph2d *Xcas_DispG=0; int show_xcas_dispg=0; + std::string xcas_paused=""; int xcas_dispg_entries=0; Fl_Window * Xcas_DispG_Window=0; Fl_Window * Xcas_Main_Window=0; @@ -487,6 +488,10 @@ show_xcas_dispg=0; } } + if (xcas_paused!=""){ + fl_message(xcas_paused.c_str()); + xcas_paused=""; + } ++initialized; if (initialized % 5){ Fl::unlock(); @@ -1112,6 +1117,12 @@ } } } + block_signal=block; +#ifdef HAVE_LIBPTHREAD + // cerr << "geo2d unlock" << endl; + pthread_mutex_unlock(&interactive_mutex); + io_graph(contextptr)=b; +#endif // if hp has eval_below, call callback on next widget if (hp->eval_below) hp->next(hp_pos); @@ -1129,18 +1140,18 @@ } hp->focus(hp_pos+1,false); } - } + } // if (res) else { // res==0 no output if (Fl_Input_ * i=dynamic_cast<Fl_Input_ * >(wid)) i->value("No_output"); hp->resize(); - } - block_signal=block; + block_signal=block; #ifdef HAVE_LIBPTHREAD - // cerr << "geo2d unlock" << endl; - pthread_mutex_unlock(&interactive_mutex); - io_graph(contextptr)=b; + // cerr << "geo2d unlock" << endl; + pthread_mutex_unlock(&interactive_mutex); + io_graph(contextptr)=b; #endif + } } Fl_Widget * Xcas_eval(Fl_Widget * w,const giac::gen & g){ @@ -2314,7 +2325,15 @@ return 1; } if (u==at_Pause){ - fl_message("Paused"); + if (f.type==_STRNG) + xcas_paused=*f._STRNGptr; + else + xcas_paused="Paused"; + for (int i=0;i<360000;++i){ + if (xcas_paused.empty()) + break; + usleep(10000); + } return 1; } if (u==at_ClrIO){ @@ -2832,9 +2851,13 @@ reading_file=read_file(g); if (g.type==_SYMB && g._SYMBptr->feuille.type==giac::_STRNG) filename=reading_file?*g._SYMBptr->feuille._STRNGptr:""; - if (g.type==_SYMB && reading_file) - g=quote_read(g._SYMBptr->feuille,contextptr); - if (g.type==giac::_VECT){ + if (g.type==_SYMB && reading_file){ + if (g._SYMBptr->feuille.type!=giac::_STRNG) + g=g._SYMBptr->feuille; + else + g=quote_read(g._SYMBptr->feuille,contextptr); + } + if (g.type==giac::_VECT && !filename.empty()){ // patch to handle spreadsheet[ correctly FILE * inf=fopen(filename.c_str(),"r"); if (inf){ @@ -2918,7 +2941,7 @@ // open a FLTK window, that will be printed to filename when closed // return false if FLTK not avail - bool fltk_view(const giac::gen & g,const giac::gen & ge,const std::string & filename,const std::string & figure_filename,int file_type,const giac::context *contextptr){ + bool fltk_view(const giac::gen & g,giac::gen & ge,const std::string & filename,std::string & figure_filename,int file_type,const giac::context *contextptr){ #ifdef __APPLE__ return false; #endif @@ -2926,6 +2949,10 @@ // FIXME GIAC_CONTEXT // const giac::context * contextptr = get_context(Fl_Group::current()); bool geometry=!figure_filename.empty(); + if (file_type==4 && figure_filename.empty()){ + figure_filename="table.tab"; + geometry=true; + } static Fl_Window * w=0; static Fl_Return_Button * button0 = 0 ; static Fl_Button * button1 =0,*button2=0; @@ -3033,14 +3060,14 @@ Fl::remove_idle(xcas::Xcas_idle_function,0); if (!fltk_return_value){ if (xcas::Figure * fig=dynamic_cast<xcas::Figure *>(wid)){ - if (fig->geo->hp->_modified){ + if (fig->geo->hp->_modified && !figure_filename.empty()){ int i=fl_ask("Figure modified. Save?"); if (i) fig->save_figure_as(figure_filename); } } if (xcas::Tableur_Group * t=dynamic_cast<xcas::Tableur_Group * >(wid)){ - if (t->table->changed_){ + if (t->table->changed_ && !t->table->filename->empty()){ int i=fl_ask("Sheet modified. Save?"); if (i){ ofstream of(t->table->filename->c_str()); @@ -3051,6 +3078,10 @@ of.close(); } } + else { + ge=t->table->m; + ge.subtype=giac::_SPREAD__VECT; + } } // now try to print the widget if (!print_wid) @@ -3059,7 +3090,7 @@ if (xcas::Figure * fig=dynamic_cast<xcas::Figure *>(wid)){ fig->geo->orthonormalize(); } - if (!filename.empty()) + if (!filename.empty() && !figure_filename.empty()) xcas::widget_ps_print(print_wid,filename,true,0,false); } w->hide(); Modified: trunk/giac-xcas/giac/src/Xcas1.h =================================================================== --- trunk/giac-xcas/giac/src/Xcas1.h 2009-12-17 14:23:08 UTC (rev 764) +++ trunk/giac-xcas/giac/src/Xcas1.h 2010-01-15 14:23:46 UTC (rev 765) @@ -142,7 +142,7 @@ #endif - bool fltk_view(const giac::gen & g,const giac::gen & ge,const std::string & filename,const std::string & figure_filename,int file_type,const giac::context *); + bool fltk_view(const giac::gen & g,giac::gen & ge,const std::string & filename,std::string & figure_filename,int file_type,const giac::context *); void icas_eval(giac::gen & g,giac::gen & gg,int & reading_file,std::string &filename,giac::context * contextptr); Modified: trunk/giac-xcas/giac/src/alg_ext.cc =================================================================== --- trunk/giac-xcas/giac/src/alg_ext.cc 2009-12-17 14:23:08 UTC (rev 764) +++ trunk/giac-xcas/giac/src/alg_ext.cc 2010-01-15 14:23:46 UTC (rev 765) @@ -283,34 +283,39 @@ // this implies computing approx value of theta1 and theta2 // vecteur rac=real_proot(v1,1e-12,contextptr); - gen theta1=_max(rac,contextptr); - // replace _EXT in vb by r1 and evaluate numerically - vecteur v2=replace_ext(vb,va,theta1,contextptr); - // find largest root (i.e. theta2) - if (is_fully_numeric(v2)){ - gen theta2=_max(real_proot(v2,1e-12,contextptr),contextptr); - int racs=rac.size(); - for (int i=0;i<racs;++i){ - gen r1=rac[i],K; - if (r1==theta1) - continue; - v2=replace_ext(vb,va,r1,contextptr); - try { - gen r2=_max(real_proot(v2,1e-12,contextptr),contextptr); - K=(r2-theta2)/(theta1-r1); // must be <= k - } - catch (std::runtime_error & err){ - K=0; - } - // so that r2-theta2 <= k*theta1-k*r1 - // or k*r1+r2 <= k*theta1+theta2 - K=_floor(K,0)+1; - if (is_positive(K,contextptr) && K.type!=_INT_) - setsizeerr("Unable to find common minimal polynomial"); - k_init=std::max(k_init,K.val); + if (!rac.empty()){ + gen theta1=_max(rac,contextptr); + // replace _EXT in vb by r1 and evaluate numerically + vecteur v2=replace_ext(vb,va,theta1,contextptr); + // find largest root (i.e. theta2) + if (is_fully_numeric(v2)){ + vecteur rac2=real_proot(v2,1e-12,contextptr); + if (!rac2.empty()){ + gen theta2=_max(rac2,contextptr); + int racs=rac.size(); + for (int i=0;i<racs;++i){ + gen r1=rac[i],K; + if (r1==theta1) + continue; + v2=replace_ext(vb,va,r1,contextptr); + try { + gen r2=_max(real_proot(v2,1e-12,contextptr),contextptr); + K=(r2-theta2)/(theta1-r1); // must be <= k + } + catch (std::runtime_error & err){ + K=0; + } + // so that r2-theta2 <= k*theta1-k*r1 + // or k*r1+r2 <= k*theta1+theta2 + K=_floor(K,0)+1; + if (is_positive(K,contextptr) && K.type!=_INT_) + setsizeerr("Unable to find common minimal polynomial"); + k_init=std::max(k_init,K.val); + } + } // !rac2.empty } - } - } + } // if !rac.empty() + } // fully_numeric } else ++k_init; // start with k=1 if theta2 does not depend on theta1 Modified: trunk/giac-xcas/giac/src/desolve.cc =================================================================== --- trunk/giac-xcas/giac/src/desolve.cc 2009-12-17 14:23:08 UTC (rev 764) +++ trunk/giac-xcas/giac/src/desolve.cc 2010-01-15 14:23:46 UTC (rev 765) @@ -823,7 +823,7 @@ vecteur vnum; polynome2poly1(it->num,1,vnum); for (int i=0;i<mult;++i){ - res0 += r2e(vnum[i],lprime,contextptr)*symb_when(s-i,1,0); + res0 += r2e(vnum[i],lprime,contextptr)*symbolic(at_Dirac,s-i); } res += res0/B; } Modified: trunk/giac-xcas/giac/src/global.cc =================================================================== --- trunk/giac-xcas/giac/src/global.cc 2009-12-17 14:23:08 UTC (rev 764) +++ trunk/giac-xcas/giac/src/global.cc 2010-01-15 14:23:46 UTC (rev 765) @@ -887,10 +887,21 @@ std::string _autoname_("A"); std::string & autoname(GIAC_CONTEXT){ + std::string * res; if (contextptr && contextptr->globalptr ) - return contextptr->globalptr->_autoname_; + res=&contextptr->globalptr->_autoname_; else - return _autoname_; + res=&_autoname_; + for (;;){ + gen tmp(*res,contextptr); + if (tmp.type==_IDNT){ + gen tmp1=eval(tmp,1,contextptr); + if (tmp==tmp1) + break; + } + autoname_plus_plus(*res); + } + return *res; } std::string _format_double_(""); @@ -1999,8 +2010,9 @@ if (debug_infolevel) cerr << s << endl; #ifdef WIN32 + bool with_firefox=false; + /* string firefox="/cygdrive/c/Program Files/Mozilla Firefox/firefox.exe"; - bool with_firefox=false; if (getenv("BROWSER")){ string tmp=getenv("BROWSER"); if (tmp=="firefox" || tmp=="mozilla"){ @@ -2011,6 +2023,7 @@ } } } + */ if (!url && (file.substr(0,10)=="/cygdrive/" || (file[0]!='/' && file[1]!=':')) ){ string s1=xcasroot; if (file.substr(0,10)=="/cygdrive/") @@ -2037,9 +2050,20 @@ } } cerr << "s2=" << s2 << endl; - s="file:"+s2; + s=s2; + // s="file:"+s2; // s = s.substr(0,5)+"C:\\\\xcas\\\\"+s2; } + // Remove # trailing part of URL + int ss=s.size(); + for (--ss;ss>0;--ss){ + if (s[ss]=='#' || s[ss]=='.' || s[ss]=='/' ) + break; + } + if (ss && s[ss]!='.') + s=s.substr(0,ss); + s="cygstart.exe '"+s+"' &"; + /* if (with_firefox){ s="'"+firefox+"' '"+s+"' &"; } @@ -2049,6 +2073,7 @@ else s="'/cygdrive/c/Program Files/Internet Explorer/IEXPLORE.EXE' '"+s+"' &"; } + */ #else string browser; if (getenv("BROWSER")) @@ -2171,6 +2196,11 @@ lexer_localization_vector.push_back(i); update_lexer_localization(lexer_localization_vector,lexer_localization_map(),back_lexer_localization_map); if (vector_aide_ptr){ + // add locale command description + int count; + string filename=giac_aide_dir()+find_doc_prefix(i)+"aide_cas"; + readhelp(*vector_aide_ptr,filename.c_str(),count,true); + // add synonyms multimap<string,localized_string>::iterator it,backend=back_lexer_localization_map.end(),itend; vector<aide>::iterator jt = vector_aide_ptr->begin(),jtend=vector_aide_ptr->end(); for (;jt!=jtend;++jt){ Modified: trunk/giac-xcas/giac/src/help.cc =================================================================== --- trunk/giac-xcas/giac/src/help.cc 2009-12-17 14:23:08 UTC (rev 764) +++ trunk/giac-xcas/giac/src/help.cc 2010-01-15 14:23:46 UTC (rev 765) @@ -204,7 +204,7 @@ current_examples.clear(); current_related.clear(); vposition.clear(); - current_aide.cmd_name=current.substr(2,current.size()-2); + current_aide.cmd_name=current.size()>2?current.substr(2,current.size()-2):""; // search if cmd_name is already present in v // if so set vposition, current_blabla/examples/related accordingly vector<localized_string> current_synonymes=find_synonymes(current_aide.cmd_name); @@ -212,8 +212,16 @@ vector<aide>::iterator itpos; for (it=itbeg;it!=itend;++it){ itpos=lower_bound(v.begin(),v.end(),current_aide,alpha_order); - if (itpos!=v.end() && itpos->cmd_name==it->chaine) - vposition.push_back(it-itbeg); + if (itpos!=v.begin()){ + --itpos; + if (itpos->cmd_name==it->chaine){ // already documented + current_synonymes=itpos->synonymes; + current_blabla=itpos->blabla; + current_examples=itpos->examples; + current_related=itpos->related; + vposition.push_back(itpos-v.begin()); + } + } } continue; } @@ -251,12 +259,14 @@ current_examples.push_back(current); } } // end reading help from file - current_aide.synonymes=vector<localized_string>(1,localized_string(0,current_aide.cmd_name)); - current_aide.blabla=current_blabla; - current_aide.examples=current_examples; - current_aide.related=current_related; - v.push_back(current_aide); - count++; + if (!current_aide.cmd_name.empty()){ + current_aide.synonymes=vector<localized_string>(1,localized_string(0,current_aide.cmd_name)); + current_aide.blabla=current_blabla; + current_aide.examples=current_examples; + current_aide.related=current_related; + v.push_back(current_aide); + count++; + } sort(v.begin(),v.end(),alpha_order); } Modified: trunk/giac-xcas/giac/src/hist.cxx =================================================================== --- trunk/giac-xcas/giac/src/hist.cxx 2009-12-17 14:23:08 UTC (rev 764) +++ trunk/giac-xcas/giac/src/hist.cxx 2010-01-15 14:23:46 UTC (rev 765) @@ -306,6 +306,10 @@ Xcas_Script_Window->labelfont(Xcas_Main_Window_->labelfont()); xcas::change_group_fontsize(Xcas_Script_Window,i); } + Fl_Menu_Bar * menu = dynamic_cast<Fl_Menu_Bar *>(Xcas_Main_Window_->child(0)); + if (menu) + menu->labelfont(Xcas_Main_Window_->labelfont()); + xcas::change_group_fontsize(menu,i); int n=xcas::styletable_n; for (int k=0;k<n;++k) xcas::styletable[k].size=i; @@ -334,6 +338,14 @@ f=w[1].val; if (ws>1 && w[1].type==giac::_DOUBLE_) f=int(w[1]._DOUBLE_val); + if (ws>2 && w[2].type==giac::_INT_){ + xcas::Flv_Table_Gen::def_rows=giac::absint(w[2].val); + Xcas_default_rows->value(giac::absint(w[2].val)); + } + if (ws>3 && w[3].type==giac::_INT_){ + xcas::Flv_Table_Gen::def_cols=giac::absint(w[3].val); + Xcas_default_cols->value(giac::absint(w[3].val)); + } } if (s>1 && v[1].type==giac::_INT_) x=v[1].val; @@ -359,6 +371,7 @@ if (s>6 && v[6].type==giac::_INT_){ // Arg 6 was used for number of windows, now for auto-help Xcas_automatic_help_browser->value(v[6].val % 2); Xcas_automatic_completion_browser->value( (v[6].val/2) %2); + xcas::do_helpon=Xcas_automatic_completion_browser->value(); Xcas_tooltip_disabled->value( (v[6].val/4) %2); Xcas_disable_try_parse_test_i->value(v[6].val/8); Fl_Tooltip::enable(!Xcas_tooltip_disabled->value()); @@ -491,6 +504,9 @@ if (!w->pack->children()) w->add_entry(-1); w->pack->clear_modified(); +std::cerr << Xcas_Main_Window_->labelfont() << std::endl; +w->labelfont(Xcas_Main_Window_->labelfont()); +w->pack->labelfont(Xcas_Main_Window_->labelfont()); xcas::change_group_fontsize(w,Xcas_Main_Window_->labelsize()); Xcas_Main_Tab->add(w); Xcas_Main_Tab->value(Xcas_Main_Tab->child(Xcas_Main_Tab->children()-1)); @@ -514,6 +530,9 @@ } w->pack->clear_modified(); w->pack->focus(0,true); +std::cerr << Xcas_Main_Window_->labelfont() << std::endl; +w->labelfont(Xcas_Main_Window_->labelfont()); +w->pack->labelfont(Xcas_Main_Window_->labelfont()); xcas::change_group_fontsize(w,w->pack->labelsize()); Xcas_Main_Tab->add(w); Xcas_Main_Tab->value(Xcas_Main_Tab->child(Xcas_Main_Tab->children()-1)); @@ -698,7 +717,7 @@ std::string configname=giac::home_directory()+giac::xcasrc; #endif // if (!giac::is_file_available(configname.c_str())){ - Xcas_widget_size(giac::makevecteur(18,100,50,900,600,0,0,1)); + Xcas_widget_size(giac::makevecteur(14,100,50,900,600,0,0,1)); FILE * f =fopen(configname.c_str(),"w"); if (f){ fclose(f); @@ -711,14 +730,14 @@ #ifdef IPAQ // default with bandeau std::string configs="widget_size(12,1,1,300,240,1,2,1,"; #else // ifndef IPAQ, - std::string configs="widget_size(18,100,50,900,600,"+giac::print_INT_(n!=0)+",2,0,"; + std::string configs="widget_size(14,100,50,900,600,"+giac::print_INT_(n!=0)+",2,0,"; #endif // IPAQ configs += '7'; configs += ','; configs += '"'; -#ifndef WIN32 +// #ifndef WIN32 configs += Xcas_browser_name(); -#endif +// #endif configs += '"' ; configs += ','; // end BROWSER configs+=giac::print_INT_(mm+1); @@ -768,7 +787,7 @@ load_filename(v[i].s.c_str(),true); unlink(v[i].s.c_str()); } - fl_message("Autorecover files have been loaded. Geometry and spreadsheet were not reevaled"); + fl_message(gettext("Autorecover files have been loaded. Geometry and spreadsheet were not reevaled")); } } @@ -786,7 +805,10 @@ std::string Xcas_browser_name() { #ifdef __APPLE__ // return "open"; -#endif // +#endif // apple +#ifdef WIN32 // + return "cygstart.exe"; +#endif // win32 if (getenv("BROWSER")) return getenv("BROWSER"); std::string tmp; @@ -835,7 +857,7 @@ #else std::ofstream of((giac::home_directory()+giac::xcasrc).c_str()); #endif // - of << "widget_size([" << giac::print_INT_(Xcas_Main_Window_->labelfont()) << "," << giac::print_INT_(Xcas_Main_Window_->labelsize()) << "]," << Xcas_Main_Window_->x() << "," << Xcas_Main_Window_->y() << "," << Xcas_Main_Window_->w() << "," << Xcas_Main_Window_->h() << "," ; + of << "widget_size([" << giac::print_INT_(Xcas_Main_Window_->labelfont()) << "," << giac::print_INT_(Xcas_Main_Window_->labelsize()) << "," << giac::print_INT_(xcas::Flv_Table_Gen::def_rows) << "," << giac::print_INT_(xcas::Flv_Table_Gen::def_cols) << "]," << Xcas_Main_Window_->x() << "," << Xcas_Main_Window_->y() << "," << Xcas_Main_Window_->w() << "," << Xcas_Main_Window_->h() << "," ; of << Xcas_Keyboard_Group->visible()+2*Xcas_Bandeau_Keys->visible() <<","; of << Xcas_automatic_help_browser->value()+2*Xcas_automatic_completion_browser->value()+4*Xcas_tooltip_disabled->value() + 8*Xcas_disable_try_parse_test_i->value(); of << "," << Xcas_Messages->visible() ; @@ -1170,6 +1192,12 @@ giac::html_help_init("aide_cas",1); } +static void cb_Xcas_index_Greek(Fl_Menu_*, void*) { + const giac::context * contextptr=Xcas_get_context(); +doc_prefix=giac::set_language(4,contextptr); +giac::html_help_init("aide_cas",1); +} + static void cb_Xcas_background_color_item(Fl_Menu_*, void*) { Fl_Color c=fl_show_colormap(xcas::Xcas_background_color); xcas::Xcas_background_color=c; @@ -1734,6 +1762,7 @@ {gettext("francais"), 0, (Fl_Callback*)cb_Xcas_index_Francais, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, {gettext("english"), 0, (Fl_Callback*)cb_Xcas_index_English, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, {gettext("espanol"), 0, (Fl_Callback*)cb_Xcas_index_Espanol, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, + {gettext("greek"), 0, (Fl_Callback*)cb_Xcas_index_Greek, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, {0,0,0,0,0,0,0,0,0}, {gettext("Colors"), 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0}, {gettext("default background"), 0, (Fl_Callback*)cb_Xcas_background_color_item, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, @@ -2757,6 +2786,10 @@ Fl_Check_Button *Xcas_automatic_completion_browser=(Fl_Check_Button *)0; +static void cb_Xcas_automatic_completion_browser(Fl_Check_Button*, void*) { + xcas::do_helpon=Xcas_automatic_completion_browser->value(); +} + Fl_Check_Button *Xcas_down_compatibility=(Fl_Check_Button *)0; static void cb_Xcas_down_compatibility(Fl_Check_Button*, void*) { @@ -2777,7 +2810,7 @@ Fl_Double_Window *Xcas_Script_Window=(Fl_Double_Window *)0; -Fl_Double_Window *Xcas_DispG_Window_=(Fl_Double_Window *)0; +xcas::DispG_Window *Xcas_DispG_Window_=(xcas::DispG_Window *)0; Fl_Menu_Bar *Xcas_DispG_Menu=(Fl_Menu_Bar *)0; @@ -4483,7 +4516,7 @@ Xcas_default_cols->tooltip(gettext("Number of columns for new->spreadsheet")); Xcas_default_cols->maximum(100); Xcas_default_cols->step(1); - Xcas_default_cols->value(6); + Xcas_default_cols->value(10); Xcas_default_cols->callback((Fl_Callback*)cb_Xcas_default_cols); Xcas_default_cols->align(Fl_Align(68)); } // Fl_Value_Input* Xcas_default_cols @@ -4530,6 +4563,7 @@ { Xcas_automatic_completion_browser = new Fl_Check_Button(180, 105, 125, 25, gettext("Auto index help")); Xcas_automatic_completion_browser->tooltip(gettext("Selecting a menu item displays short index help")); Xcas_automatic_completion_browser->down_box(FL_DOWN_BOX); + Xcas_automatic_completion_browser->callback((Fl_Callback*)cb_Xcas_automatic_completion_browser); Xcas_automatic_completion_browser->align(Fl_Align(68|FL_ALIGN_INSIDE)); } // Fl_Check_Button* Xcas_automatic_completion_browser { Xcas_down_compatibility = new Fl_Check_Button(180, 245, 125, 25, gettext("Xcas < 0.8.1 compatible")); @@ -4557,7 +4591,16 @@ Xcas_Script_Window->end(); Xcas_Script_Window->resizable(Xcas_Script_Window); } // Fl_Double_Window* Xcas_Script_Window - { Xcas_DispG_Window_ = new Fl_Double_Window(540, 350, gettext("Xcas DispG Window")); + { Xcas_DispG_Window_ = new xcas::DispG_Window(540, 350, gettext("Xcas DispG Window")); + Xcas_DispG_Window_->box(FL_FLAT_BOX); + Xcas_DispG_Window_->color(FL_BACKGROUND_COLOR); + Xcas_DispG_Window_->selection_color(FL_BACKGROUND_COLOR); + Xcas_DispG_Window_->labeltype(FL_NO_LABEL); + Xcas_DispG_Window_->labelfont(0); + Xcas_DispG_Window_->labelsize(14); + Xcas_DispG_Window_->labelcolor(FL_FOREGROUND_COLOR); + Xcas_DispG_Window_->align(Fl_Align(FL_ALIGN_TOP)); + Xcas_DispG_Window_->when(FL_WHEN_RELEASE); { Xcas_DispG_Menu = new Fl_Menu_Bar(0, 0, 95, 25); Xcas_DispG_Menu->align(Fl_Align(FL_ALIGN_CLIP)); Xcas_DispG_Menu->menu(menu_Xcas_DispG_Menu); @@ -4589,7 +4632,7 @@ } // Fl_Button* Xcas_DispG_ClrGraph Xcas_DispG_Window_->end(); Xcas_DispG_Window_->resizable(Xcas_DispG_Window_); - } // Fl_Double_Window* Xcas_DispG_Window_ + } // xcas::DispG_Window* Xcas_DispG_Window_ xcas::Xcas_Main_Window=Xcas_Main_Window_; xcas::Xcas_DispG=Xcas_DispG_; xcas::Xcas_DispG_Window=Xcas_DispG_Window_; @@ -4884,7 +4927,9 @@ } int main(int argc,char ** argv) { - if (getenv("XCAS_AUTOSAVE_FOLDER")){ + if (argc==2 && strlen(argv[1])==0) + argc=1; +if (getenv("XCAS_AUTOSAVE_FOLDER")){ xcas::autosave_folder=getenv("XCAS_AUTOSAVE_FOLDER"); if (!xcas::autosave_folder.empty() && xcas::autosave_folder[xcas::autosave_folder.size()-1]!='/') xcas::autosave_folder += '/'; Modified: trunk/giac-xcas/giac/src/hist.fl =================================================================== --- trunk/giac-xcas/giac/src/hist.fl 2009-12-17 14:23:08 UTC (rev 764) +++ trunk/giac-xcas/giac/src/hist.fl 2010-01-15 14:23:46 UTC (rev 765) @@ -378,6 +378,10 @@ Xcas_Script_Window->labelfont(Xcas_Main_Window_->labelfont()); xcas::change_group_fontsize(Xcas_Script_Window,i); } + Fl_Menu_Bar * menu = dynamic_cast<Fl_Menu_Bar *>(Xcas_Main_Window_->child(0)); + if (menu) + menu->labelfont(Xcas_Main_Window_->labelfont()); + xcas::change_group_fontsize(menu,i); int n=xcas::styletable_n; for (int k=0;k<n;++k) xcas::styletable[k].size=i; @@ -407,6 +411,14 @@ f=w[1].val; if (ws>1 && w[1].type==giac::_DOUBLE_) f=int(w[1]._DOUBLE_val); + if (ws>2 && w[2].type==giac::_INT_){ + xcas::Flv_Table_Gen::def_rows=giac::absint(w[2].val); + Xcas_default_rows->value(giac::absint(w[2].val)); + } + if (ws>3 && w[3].type==giac::_INT_){ + xcas::Flv_Table_Gen::def_cols=giac::absint(w[3].val); + Xcas_default_cols->value(giac::absint(w[3].val)); + } } if (s>1 && v[1].type==giac::_INT_) x=v[1].val; @@ -432,6 +444,7 @@ if (s>6 && v[6].type==giac::_INT_){ // Arg 6 was used for number of windows, now for auto-help Xcas_automatic_help_browser->value(v[6].val % 2); Xcas_automatic_completion_browser->value( (v[6].val/2) %2); + xcas::do_helpon=Xcas_automatic_completion_browser->value(); Xcas_tooltip_disabled->value( (v[6].val/4) %2); Xcas_disable_try_parse_test_i->value(v[6].val/8); Fl_Tooltip::enable(!Xcas_tooltip_disabled->value()); @@ -565,6 +578,9 @@ if (!w->pack->children()) w->add_entry(-1); w->pack->clear_modified(); +std::cerr << Xcas_Main_Window_->labelfont() << std::endl; +w->labelfont(Xcas_Main_Window_->labelfont()); +w->pack->labelfont(Xcas_Main_Window_->labelfont()); xcas::change_group_fontsize(w,Xcas_Main_Window_->labelsize()); Xcas_Main_Tab->add(w); Xcas_Main_Tab->value(Xcas_Main_Tab->child(Xcas_Main_Tab->children()-1)); @@ -589,6 +605,9 @@ } w->pack->clear_modified(); w->pack->focus(0,true); +std::cerr << Xcas_Main_Window_->labelfont() << std::endl; +w->labelfont(Xcas_Main_Window_->labelfont()); +w->pack->labelfont(Xcas_Main_Window_->labelfont()); xcas::change_group_fontsize(w,w->pack->labelsize()); Xcas_Main_Tab->add(w); Xcas_Main_Tab->value(Xcas_Main_Tab->child(Xcas_Main_Tab->children()-1)); @@ -775,7 +794,7 @@ std::string configname=giac::home_directory()+giac::xcasrc; \#endif // if (!giac::is_file_available(configname.c_str())){ - Xcas_widget_size(giac::makevecteur(18,100,50,900,600,0,0,1)); + Xcas_widget_size(giac::makevecteur(14,100,50,900,600,0,0,1)); FILE * f =fopen(configname.c_str(),"w"); if (f){ fclose(f); @@ -788,14 +807,14 @@ \#ifdef IPAQ // default with bandeau std::string configs="widget_size(12,1,1,300,240,1,2,1,"; \#else // ifndef IPAQ, - std::string configs="widget_size(18,100,50,900,600,"+giac::print_INT_(n!=0)+",2,0,"; + std::string configs="widget_size(14,100,50,900,600,"+giac::print_INT_(n!=0)+",2,0,"; \#endif // IPAQ configs += '7'; configs += ','; configs += '"'; -\#ifndef WIN32 +// \#ifndef WIN32 configs += Xcas_browser_name(); -\#endif +// \#endif configs += '"' ; configs += ','; // end BROWSER configs+=giac::print_INT_(mm+1); @@ -845,7 +864,7 @@ load_filename(v[i].s.c_str(),true); unlink(v[i].s.c_str()); } - fl_message("Autorecover files have been loaded. Geometry and spreadsheet were not reevaled"); + fl_message(gettext("Autorecover files have been loaded. Geometry and spreadsheet were not reevaled")); }} {} } @@ -865,7 +884,10 @@ } { code {\#ifdef __APPLE__ // return "open"; -\#endif // +\#endif // apple +\#ifdef WIN32 // + return "cygstart.exe"; +\#endif // win32 if (getenv("BROWSER")) return getenv("BROWSER"); std::string tmp; @@ -917,7 +939,7 @@ \#else std::ofstream of((giac::home_directory()+giac::xcasrc).c_str()); \#endif // - of << "widget_size([" << giac::print_INT_(Xcas_Main_Window_->labelfont()) << "," << giac::print_INT_(Xcas_Main_Window_->labelsize()) << "]," << Xcas_Main_Window_->x() << "," << Xcas_Main_Window_->y() << "," << Xcas_Main_Window_->w() << "," << Xcas_Main_Window_->h() << "," ; + of << "widget_size([" << giac::print_INT_(Xcas_Main_Window_->labelfont()) << "," << giac::print_INT_(Xcas_Main_Window_->labelsize()) << "," << giac::print_INT_(xcas::Flv_Table_Gen::def_rows) << "," << giac::print_INT_(xcas::Flv_Table_Gen::def_cols) << "]," << Xcas_Main_Window_->x() << "," << Xcas_Main_Window_->y() << "," << Xcas_Main_Window_->w() << "," << Xcas_Main_Window_->h() << "," ; of << Xcas_Keyboard_Group->visible()+2*Xcas_Bandeau_Keys->visible() <<","; of << Xcas_automatic_help_browser->value()+2*Xcas_automatic_completion_browser->value()+4*Xcas_tooltip_disabled->value() + 8*Xcas_disable_try_parse_test_i->value(); of << "," << Xcas_Messages->visible() ; @@ -945,7 +967,7 @@ } { Fl_Window Xcas_Main_Window_ { label {Xcas New Interface} open - xywh {334 228 775 615} type Single resizable visible + xywh {332 226 775 615} type Single resizable visible } { Fl_Menu_Bar Xcas_main_menu {open xywh {0 0 775 25} @@ -1375,6 +1397,13 @@ giac::html_help_init("aide_cas",1);} xywh {0 0 100 20} } + MenuItem Xcas_index_Greek { + label greek + callback {const giac::context * contextptr=Xcas_get_context(); +doc_prefix=giac::set_language(4,contextptr); +giac::html_help_init("aide_cas",1);} + xywh {0 0 100 20} + } } Submenu Xcas_Colors { label Colors open @@ -3185,7 +3214,7 @@ Fl_Group Xcas_Bandeau_Keys {open xywh {0 515 455 30} } { - Fl_Group Xcas_Bandeau_Keys_Group { + Fl_Group Xcas_Bandeau_Keys_Group {selected xywh {0 515 420 30} } { Fl_Button Xcas_PREV_Key { @@ -3352,8 +3381,7 @@ if (strlen(ch) && strcmp(ch,"builtin")){ setenv("BROWSER",ch,1); xcas::use_external_browser=true; - } - } + }} xywh {100 75 195 25} align 68 when 8 } Fl_Value_Input Xcas_default_rows { @@ -3364,7 +3392,7 @@ Fl_Value_Input Xcas_default_cols { label cols callback {xcas::Flv_Table_Gen::def_cols=int(Xcas_default_cols->value());} - tooltip {Number of columns for new->spreadsheet} xywh {245 210 55 30} align 68 maximum 100 step 1 value 6 + tooltip {Number of columns for new->spreadsheet} xywh {245 210 55 30} align 68 maximum 100 step 1 value 10 } Fl_Return_Button Xcas_general_setup_save { label Save @@ -3447,6 +3475,7 @@ } Fl_Check_Button Xcas_automatic_completion_browser { label {Auto index help} + callback {xcas::do_helpon=Xcas_automatic_completion_browser->value();} tooltip {Selecting a menu item displays short index help} xywh {180 105 125 25} down_box DOWN_BOX align 84 } Fl_Check_Button Xcas_down_compatibility { @@ -3455,13 +3484,13 @@ tooltip {If not checked, save context information, incompatible with Xcas < 0.8.1} xywh {180 245 125 25} down_box DOWN_BOX align 84 } Fl_Check_Button Xcas_tooltip_disabled { - label {Disable tooltips} selected - callback { Fl_Tooltip::enable(!Xcas_tooltip_disabled->value());} + label {Disable tooltips} + callback {Fl_Tooltip::enable(!Xcas_tooltip_disabled->value());} tooltip {Check box to disable tooltips} xywh {180 145 125 25} down_box DOWN_BOX align 84 } Fl_Check_Button Xcas_disable_try_parse_test_i { label {Disable test i} - callback {giac::try_parse_test_i=!Xcas_disable_try_parse_test_i->value();} selected + callback {giac::try_parse_test_i=!Xcas_disable_try_parse_test_i->value();} tooltip {Check to disable replacement of i inside loop by a variable} xywh {15 45 110 20} down_box DOWN_BOX align 84 } } @@ -3471,7 +3500,8 @@ } {} Fl_Window Xcas_DispG_Window_ { label {Xcas DispG Window} open - xywh {483 217 540 350} type Double resizable visible + xywh {483 217 540 350} type Double resizable + class {xcas::DispG_Window} visible } { Fl_Menu_Bar Xcas_DispG_Menu { xywh {0 0 95 25} align 64 @@ -3821,7 +3851,9 @@ Function {main(int argc,char ** argv)} {open return_type int } { - code {if (getenv("XCAS_AUTOSAVE_FOLDER")){ + code {if (argc==2 && strlen(argv[1])==0) + argc=1; +if (getenv("XCAS_AUTOSAVE_FOLDER")){ xcas::autosave_folder=getenv("XCAS_AUTOSAVE_FOLDER"); if (!xcas::autosave_folder.empty() && xcas::autosave_folder[xcas::autosave_folder.size()-1]!='/') xcas::autosave_folder += '/'; Modified: trunk/giac-xcas/giac/src/hist.h =================================================================== --- trunk/giac-xcas/giac/src/hist.h 2009-12-17 14:23:08 UTC (rev 764) +++ trunk/giac-xcas/giac/src/hist.h 2010-01-15 14:23:46 UTC (rev 765) @@ -226,7 +226,7 @@ extern Fl_Check_Button *Xcas_tooltip_disabled; extern Fl_Check_Button *Xcas_disable_try_parse_test_i; extern Fl_Double_Window *Xcas_Script_Window; -extern Fl_Double_Window *Xcas_DispG_Window_; +extern xcas::DispG_Window *Xcas_DispG_Window_; extern Fl_Menu_Bar *Xcas_DispG_Menu; extern Fl_Button *Xcas_DispG_Cancel_; #include <FL/Fl_Tile.H> @@ -307,154 +307,155 @@ #define Xcas_index_Francais (menu_Xcas_main_menu+79) #define Xcas_index_English (menu_Xcas_main_menu+80) #define Xcas_index_Espanol (menu_Xcas_main_menu+81) -#define Xcas_Colors (menu_Xcas_main_menu+83) -#define Xcas_background_color_item (menu_Xcas_main_menu+84) -#define Xcas_input_text_color (menu_Xcas_main_menu+85) -#define Xcas_input_text_background_color (menu_Xcas_main_menu+86) -#define Xcas_comment_color_item (menu_Xcas_main_menu+87) -#define Xcas_comment_background_color_item (menu_Xcas_main_menu+88) -#define Xcas_log_color_item (menu_Xcas_main_menu+89) -#define Xcas_log_background_color_item (menu_Xcas_main_menu+90) -#define Xcas_equation_color_item (menu_Xcas_main_menu+91) -#define Xcas_equation_background_color_item (menu_Xcas_main_menu+92) -#define Xcas_editor_color_item (menu_Xcas_main_menu+93) -#define Xcas_editor_background_color_item (menu_Xcas_main_menu+94) -#define Xcas_change_current_fontsize (menu_Xcas_main_menu+96) -#define Xcas_change_fontsize (menu_Xcas_main_menu+97) -#define Xcas_browser (menu_Xcas_main_menu+98) -#define Save_config (menu_Xcas_main_menu+99) -#define Xcas_help_menu (menu_Xcas_main_menu+101) -#define Xcas_help_index (menu_Xcas_main_menu+102) -#define Xcas_help_find (menu_Xcas_main_menu+103) -#define Xcas_help_casinter (menu_Xcas_main_menu+104) -#define Xcas_help_manuals (menu_Xcas_main_menu+105) -#define Xcas_help_CAS (menu_Xcas_main_menu+106) -#define Xcas_help_algo (menu_Xcas_main_menu+107) -#define Xcas_help_Geo (menu_Xcas_main_menu+108) -#define Xcas_help_Prog (menu_Xcas_main_menu+109) -#define Xcas_help_Tableur (menu_Xcas_main_menu+110) -#define Xcas_help_Tortue (menu_Xcas_main_menu+111) -#define Xcas_help_Exercices (menu_Xcas_main_menu+112) -#define Xcas_help_Amusement (menu_Xcas_main_menu+113) -#define Xcas_help_PARI (menu_Xcas_main_menu+114) -#define Xcas_help_internet (menu_Xcas_main_menu+116) -#define Xcas_help_forum (menu_Xcas_main_menu+117) -#define Xcas_help_connan (menu_Xcas_main_menu+118) -#define Xcas_help_bacs (menu_Xcas_main_menu+119) -#define Xcas_help_agreg (menu_Xcas_main_menu+120) -#define Xcas_help_load (menu_Xcas_main_menu+121) -#define Xcas_help_start (menu_Xcas_main_menu+123) -#define Xcas_help_tutorial (menu_Xcas_main_menu+124) -#define Xcas_help_solution (menu_Xcas_main_menu+125) -#define Xcas_help_make_index (menu_Xcas_main_menu+127) -#define Xcas_a_propos (menu_Xcas_main_menu+128) -#define Xcas_help_CASmenu (menu_Xcas_main_menu+130) -#define Xcas_Add_Entry (menu_Xcas_main_menu+131) -#define Xcas_Add_Comment (menu_Xcas_main_menu+132) -#define Xcas_help_equations (menu_Xcas_main_menu+133) -#define Xcas_help_solve (menu_Xcas_main_menu+134) -#define Xcas_help_fsolve (menu_Xcas_main_menu+135) -#define Xcas_help_proot (menu_Xcas_main_menu+136) -#define Xcas_help_linsolve (menu_Xcas_main_menu+137) -#define Xcas_help_desolve (menu_Xcas_main_menu+138) -#define Xcas_help_calculus (menu_Xcas_main_menu+140) -#define Xcas_help_int (menu_Xcas_main_menu+141) -#define Xcas_help_diff (menu_Xcas_main_menu+142) -#define Xcas_help_limit (menu_Xcas_main_menu+143) -#define Xcas_help_series (menu_Xcas_main_menu+144) -#define Xcas_help_sum (menu_Xcas_main_menu+145) -#define Xcas_help_laplace (menu_Xcas_main_menu+146) -#define Xcas_help_ilaplace (menu_Xcas_main_menu+147) -#define Xcas_help_Simplify (menu_Xcas_main_menu+149) -#define Xcas_help_simplify (menu_Xcas_main_menu+150) -#define Xcas_help_normal (menu_Xcas_main_menu+151) -#define Xcas_help_ratnormal (menu_Xcas_main_menu+152) -#define Xcas_help_factor (menu_Xcas_main_menu+153) -#define Xcas_help_cfactor (menu_Xcas_main_menu+154) -#define Xcas_help_partfrac (menu_Xcas_main_menu+155) -#define Xcas_help_cpartfrac (menu_Xcas_main_menu+156) -#define Xcas_help_sep1 (menu_Xcas_main_menu+157) -#define Xcas_help_subst (menu_Xcas_main_menu+158) -#define Xcas_help_reorder (menu_Xcas_main_menu+159) -#define Xcas_help_sep2 (menu_Xcas_main_menu+160) -#define Xcas_help_lin (menu_Xcas_main_menu+161) -#define Xcas_help_tlin (menu_Xcas_main_menu+162) -#define Xcas_help_texpand (menu_Xcas_main_menu+163) -#define Xcas_help_lncollect (menu_Xcas_main_menu+164) -#define Xcas_help_exp2pow (menu_Xcas_main_menu+165) -#define Xcas_help_exp2trig (menu_Xcas_main_menu+166) -#define Xcas_help_trig2exp (menu_Xcas_main_menu+167) -#define Xcas_help_arit (menu_Xcas_main_menu+169) -#define Xcas_help_isprime (menu_Xcas_main_menu+170) -#define Xcas_help_ifactor (menu_Xcas_main_menu+171) -#define Xcas_help_iquo (menu_Xcas_main_menu+172) -#define Xcas_help_irem (menu_Xcas_main_menu+173) -#define Xcas_help_iabcuv (menu_Xcas_main_menu+174) -#define Xcas_help_ichinrem (menu_Xcas_main_menu+175) -#define Xcas_help_sep3 (menu_Xcas_main_menu+176) -#define Xcas_help_gcd (menu_Xcas_main_menu+177) -#define Xcas_help_lcm (menu_Xcas_main_menu+178) -#define Xcas_help_powmod (menu_Xcas_main_menu+179) -#define Xcas_help_sep4 (menu_Xcas_main_menu+180) -#define Xcas_help_quo (menu_Xcas_main_menu+181) -#define Xcas_help_rem (menu_Xcas_main_menu+182) -#define Xcas_help_abcuv (menu_Xcas_main_menu+183) -#define Xcas_help_chinrem (menu_Xcas_main_menu+184) -#define Xcas_help_linal (menu_Xcas_main_menu+186) -#define Xcas_help_matrix (menu_Xcas_main_menu+187) -#define Xcas_help_tran (menu_Xcas_main_menu+188) -#define Xcas_help_ker (menu_Xcas_main_menu+189) -#define Xcas_help_image (menu_Xcas_main_menu+190) -#define Xcas_help_inverse (menu_Xcas_main_menu+191) -#define Xcas_help_det (menu_Xcas_main_menu+192) -#define Xcas_help_charpoly (menu_Xcas_main_menu+193) -#define Xcas_help_egv (menu_Xcas_main_menu+194) -#define Xcas_help_egvl (menu_Xcas_main_menu+195) -#define Xcas_help_expression (menu_Xcas_main_menu+198) -#define Xcas_Add_Expression (menu_Xcas_main_menu+199) -#define Xcas_help_allcmds (menu_Xcas_main_menu+201) -#define Xcas_help_prog (menu_Xcas_main_menu+203) -#define Xcas_Add_Program (menu_Xcas_main_menu+204) -#define Xcas_help_debug (menu_Xcas_main_menu+205) -#define Xcas_help_graph (menu_Xcas_main_menu+207) -#define Xcas_help_attributs (menu_Xcas_main_menu+208) -#define Xcas_help_curves (menu_Xcas_main_menu+209) -#define Xcas_help_plot (menu_Xcas_main_menu+210) -#define Xcas_help_plotparam2d (menu_Xcas_main_menu+211) -#define Xcas_help_plotpolar (menu_Xcas_main_menu+212) -#define Xcas_help_plotarea (menu_Xcas_main_menu+213) -#define Xcas_help_plotimplicit (menu_Xcas_main_menu+214) -#define Xcas_help_plotcontour (menu_Xcas_main_menu+215) -#define Xcas_help_plotdensity (menu_Xcas_main_menu+216) -#define Xcas_help_graph_surfaces (menu_Xcas_main_menu+218) -#define Xcas_help_plot3d (menu_Xcas_main_menu+219) -#define Xcas_help_plotparam3d (menu_Xcas_main_menu+220) -#define Xcas_help_graph_suite (menu_Xcas_main_menu+222) -#define Xcas_help_plotseq (menu_Xcas_main_menu+223) -#define Xcas_help_plotlist (menu_Xcas_main_menu+224) -#define Xcas_help_graph_ode (menu_Xcas_main_menu+226) -#define Xcas_help_plotfield (menu_Xcas_main_menu+227) -#define Xcas_help_plotode (menu_Xcas_main_menu+228) -#define Xcas_help_iplotode (menu_Xcas_main_menu+229) -#define Xcas_help_graph_stats (menu_Xcas_main_menu+231) -#define Xcas_help_camembert (menu_Xcas_main_menu+232) -#define Xcas_help_histogram (menu_Xcas_main_menu+233) -#define Xcas_help_moustache (menu_Xcas_main_menu+234) -#define Xcas_help_scatterplot (menu_Xcas_main_menu+235) -#define Xcas_help_polygonscatterplot (menu_Xcas_main_menu+236) -#define Xcas_help_linear_regression_plot (menu_Xcas_main_menu+237) -#define Xcas_help_geo (menu_Xcas_main_menu+240) -#define Xcas_new_figure (menu_Xcas_main_menu+241) -#define Xcas_Add_Figure (menu_Xcas_main_menu+242) -#define Xcas_Add_Figure3d (menu_Xcas_main_menu+243) -#define Xcas_Add_Figurex (menu_Xcas_main_menu+244) -#define Xcas_Add_Figure3dx (menu_Xcas_main_menu+245) -#define Xcas_help_tableur (menu_Xcas_main_menu+248) -#define Xcas_Add_Tableur (menu_Xcas_main_menu+249) -#define Xcas_help_phys (menu_Xcas_main_menu+251) -#define Xcas_help_scolaire (menu_Xcas_main_menu+253) -#define Xcas_help_tortue (menu_Xcas_main_menu+255) -#define Xcas_Add_Logo (menu_Xcas_main_menu+256) +#define Xcas_index_Greek (menu_Xcas_main_menu+82) +#define Xcas_Colors (menu_Xcas_main_menu+84) +#define Xcas_background_color_item (menu_Xcas_main_menu+85) +#define Xcas_input_text_color (menu_Xcas_main_menu+86) +#define Xcas_input_text_background_color (menu_Xcas_main_menu+87) +#define Xcas_comment_color_item (menu_Xcas_main_menu+88) +#define Xcas_comment_background_color_item (menu_Xcas_main_menu+89) +#define Xcas_log_color_item (menu_Xcas_main_menu+90) +#define Xcas_log_background_color_item (menu_Xcas_main_menu+91) +#define Xcas_equation_color_item (menu_Xcas_main_menu+92) +#define Xcas_equation_background_color_item (menu_Xcas_main_menu+93) +#define Xcas_editor_color_item (menu_Xcas_main_menu+94) +#define Xcas_editor_background_color_item (menu_Xcas_main_menu+95... [truncated message content] |
From: <pa...@us...> - 2009-12-17 14:23:48
|
Revision: 764 http://xcas.svn.sourceforge.net/xcas/?rev=764&view=rev Author: parisse Date: 2009-12-17 14:23:08 +0000 (Thu, 17 Dec 2009) Log Message: ----------- Modified Paths: -------------- trunk/giac-xcas/giac/src/Cfg.cc trunk/giac-xcas/giac/src/Editeur.cc trunk/giac-xcas/giac/src/Equation.cc trunk/giac-xcas/giac/src/Graph.cc trunk/giac-xcas/giac/src/Graph3d.cc trunk/giac-xcas/giac/src/History.cc trunk/giac-xcas/giac/src/Input.cc trunk/giac-xcas/giac/src/Input.h trunk/giac-xcas/giac/src/Print.cc trunk/giac-xcas/giac/src/Print.h trunk/giac-xcas/giac/src/Tableur.cc trunk/giac-xcas/giac/src/Xcas1.cc trunk/giac-xcas/giac/src/gen.cc trunk/giac-xcas/giac/src/gen.h trunk/giac-xcas/giac/src/gl2ps.c trunk/giac-xcas/giac/src/gl2ps.h trunk/giac-xcas/giac/src/global.cc trunk/giac-xcas/giac/src/global.h trunk/giac-xcas/giac/src/hist.cxx trunk/giac-xcas/giac/src/hist.fl trunk/giac-xcas/giac/src/hist.h trunk/giac-xcas/giac/src/input_lexer.cc trunk/giac-xcas/giac/src/input_lexer.ll trunk/giac-xcas/giac/src/plot.cc trunk/giac-xcas/giac/src/prog.cc trunk/giac-xcas/giac/src/sym2poly.cc trunk/giac-xcas/giac/src/usual.cc trunk/giac-xcas/giac/src/vecteur.cc Modified: trunk/giac-xcas/giac/src/Cfg.cc =================================================================== --- trunk/giac-xcas/giac/src/Cfg.cc 2009-12-04 08:43:37 UTC (rev 763) +++ trunk/giac-xcas/giac/src/Cfg.cc 2009-12-17 14:23:08 UTC (rev 764) @@ -197,6 +197,11 @@ giac::set_decimal_digits(int(Xcas_Set_Digits->value()),contextptr); if (Xcas_update_mode_ptr) Xcas_update_mode_ptr(); + History_Fold * hf=get_history_fold(Xcas_input_focus); + if (hf){ + hf->update_status_count=-1; + hf->update_status(); + } } static void cb_Xcas_cas_setup_OKSave(Fl_Button*, void* userdata) { Modified: trunk/giac-xcas/giac/src/Editeur.cc =================================================================== --- trunk/giac-xcas/giac/src/Editeur.cc 2009-12-04 08:43:37 UTC (rev 763) +++ trunk/giac-xcas/giac/src/Editeur.cc 2009-12-17 14:23:08 UTC (rev 764) @@ -2099,7 +2099,8 @@ const aide & help=helpon(s,*giac::vector_aide_ptr,giac::language(hp?hp->contextptr:0),giac::vector_aide_ptr->size()); toolt=writehelp(help,giac::language(hp?hp->contextptr:0)); tooltip(toolt.c_str()); - Fl_Tooltip::enter_area(this,0,0,0,0,toolt.c_str()); + int hh=height(toolt.c_str(),Fl_Tooltip::size()); + Fl_Tooltip::enter_area(this,0,-hh,0,0,toolt.c_str()); } } if (Fl::event_text()[0]==')'){ Modified: trunk/giac-xcas/giac/src/Equation.cc =================================================================== --- trunk/giac-xcas/giac/src/Equation.cc 2009-12-04 08:43:37 UTC (rev 763) +++ trunk/giac-xcas/giac/src/Equation.cc 2009-12-17 14:23:08 UTC (rev 764) @@ -769,13 +769,13 @@ res.push_back(eqwdata(vv.dx+a.fontsize,vv.dy+4,vv.x,vv.y,a,at_sqrt,0)); return gen(res,_SEQ__VECT); } - if (vv.g.type==_FUNC) + if (vv.g.type==_FUNC || vv.g.is_symb_of_sommet(at_pow)) x=llp; Equation_translate(varg,x,0); Equation_vertical_adjust(vv.dy,vv.y,h,y); vecteur res(1,varg); // 2nd arg translated - if (vv.g.type==_FUNC) + if (vv.g.type==_FUNC || vv.g.is_symb_of_sommet(at_pow)) x+=vv.dx+lrp; else x+=vv.dx+1; @@ -1190,6 +1190,8 @@ } if (g.type!=_SYMB){ string s=g.print(contextptr); + if (s.size()>2000) + s=s.substr(0,2000)+"..."; fl_font(cst_greek_translate(s),a.fontsize); int i=int(fl_width(s.c_str())); gen tmp=eqwdata(i,a.fontsize,0,0,a,g); @@ -1290,6 +1292,8 @@ string s=gg.print(contextptr); if (gg.type==_IDNT && !s.empty() && s[0]=='_') s=s.substr(1,s.size()-1); + if (s.size()>2000) + s=s.substr(0,2000)+"..."; fl_font(cst_greek_translate(s),fontsize); // cerr << s.size() << endl; check_fl_draw(s.c_str(),eq->x()+e.x-x,eq->y()+y-e.y,eq->clip_x,eq->clip_y,eq->clip_w,eq->clip_h,0,0); @@ -1486,8 +1490,12 @@ x0=w.x-x; y0=y-w.baseline; if (u==at_pow){ - if (!need_parenthesis(tmp.g)) + if (!need_parenthesis(tmp.g)&& tmp.g!=at_pow) return; + if (tmp.g==at_pow){ + fontsize=tmp.eqw_attributs.fontsize+2; + fl_font(FL_HELVETICA,fontsize); + } if (tmp.x-lpsize<rightx) check_fl_draw("(",eqx+tmp.x-x-lpsize,eqy+y-tmp.baseline,equat->clip_x,equat->clip_y,equat->clip_w,equat->clip_h,0,0); if (tmp.x+tmp.dx<rightx) Modified: trunk/giac-xcas/giac/src/Graph.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph.cc 2009-12-04 08:43:37 UTC (rev 763) +++ trunk/giac-xcas/giac/src/Graph.cc 2009-12-17 14:23:08 UTC (rev 764) @@ -3315,6 +3315,7 @@ int Graph2d3d::handle(int event){ if (no_handle) return 0; + context * contextptr=hp?hp->contextptr:get_context(this); int res=in_handle(event); return res; } @@ -3419,8 +3420,10 @@ return undef; context * contextptr=hp?hp->contextptr:get_context(this); gen tmp; + pos=-1; + if (block_signal || is_context_busy(contextptr)) + return undef; geometry_round(x,y,z,eps,tmp,contextptr); - pos=-1; if (selected.empty()) return tmp; pos=findfirstpoint(selection2vecteur(selected)); Modified: trunk/giac-xcas/giac/src/Graph3d.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph3d.cc 2009-12-04 08:43:37 UTC (rev 763) +++ trunk/giac-xcas/giac/src/Graph3d.cc 2009-12-17 14:23:08 UTC (rev 764) @@ -84,6 +84,9 @@ string command="pngtopnm "+filename+" | pnmtops > "+remove_extension(filename)+".ps &"; cerr << command << endl; system(command.c_str()); + command="pngtopnm "+filename+" | pnmtojpeg > "+remove_extension(filename)+".jpg &"; + cerr << command << endl; + system(command.c_str()); } #else return -1; Modified: trunk/giac-xcas/giac/src/History.cc =================================================================== --- trunk/giac-xcas/giac/src/History.cc 2009-12-04 08:43:37 UTC (rev 763) +++ trunk/giac-xcas/giac/src/History.cc 2009-12-17 14:23:08 UTC (rev 764) @@ -1884,7 +1884,7 @@ int deltalog=0; if (!otmp){ Fl_Group::current(0); - otmp = new Log_Output(q->x(),q->y()+q->h(),q->w(),q->labelsize()+3); + otmp = new Log_Output(q->x(),q->y()+q->h(),q->w(),2*q->labelsize()+8); deltalog=otmp->h(); g->Fl_Widget::resize(g->x(),g->y(),g->w(),g->h()+deltalog); otmp->labelsize(q->labelsize()); @@ -1899,7 +1899,7 @@ deltalog=otmp->h(); otmp->value(""); // resize otmp - otmp->resize(otmp->x(),otmp->y(),otmp->w(),otmp->labelsize()+3); + otmp->resize(otmp->x(),otmp->y(),otmp->w(),2*otmp->labelsize()+8); deltalog = otmp->h()-deltalog; g->Fl_Widget::resize(g->x(),g->y(),g->w(),g->h()+deltalog); g->insert(*otmp,1); @@ -2006,6 +2006,8 @@ } Fl_Group * parent_skip_scroll(const Fl_Widget * g){ + if (!g) + return 0; Fl_Group * res = g->parent(); if (res){ if (Fl_Scroll * s = dynamic_cast<Fl_Scroll *>(res)) @@ -2655,9 +2657,11 @@ system((xcasroot+"xdvi.bat "+s+" &").c_str()); cerr << xcasroot+"xdvi.bat "+s+" &" << endl; #else - system(("latex "+s+" ").c_str()); - system(("xdvi "+s+" &").c_str()); - system(("dvips "+s+" -o "+s+".ps && pstopnm -stdout "+s+" | pnmtopng > "+s+".png").c_str()); + string path=get_path(s); + s=remove_path(s); + system(("cd "+path+" ; latex "+s+" ").c_str()); + system(("cd "+path+" ; xdvi "+s+" &").c_str()); + system(("cd "+path+" ; dvips "+s+" -o "+s+".ps && pstopnm -stdout "+s+" | pnmtopng > "+s+".png").c_str()); fl_message(("->"+s+".tex/.dvi/.ps/.png").c_str()); #endif // } @@ -2667,8 +2671,11 @@ system((xcasroot+"latex.bat "+remove_extension(name)).c_str()); system((xcasroot+"dvips.bat "+remove_extension(name)+" &").c_str()); #else - system(("latex "+remove_extension(name)+" ").c_str()); - system(("dvips "+remove_extension(name)+" &").c_str()); + string s=remove_extension(name); + string path=get_path(s); + s=remove_path(s); + system(("cd "+path+" ; latex "+s+" ").c_str()); + system(("cd "+path+" ; dvips "+s+" -o "+s+".ps && pstopnm -stdout "+s+" | pnmtopng > "+s+".png").c_str()); #endif // } @@ -3157,14 +3164,16 @@ if (xcas::interrupt_button){ xcas::History_Pack * hp =xcas::get_history_fold(b)->pack; std::cerr << "STOP pressed" << std::endl; - giac::ctrl_c=true; - for (int j=0;j<100;j++){ - if (!giac::ctrl_c){ - return; + if (!Fl::event_state(FL_SHIFT)){ + giac::ctrl_c=true; + for (int j=0;j<100;j++){ + if (!giac::ctrl_c){ + return; + } + usleep(10000); } - usleep(10000); + giac::ctrl_c=false; } - giac::ctrl_c=false; if (giac::is_context_busy(hp?hp->contextptr:0)){ giac::kill_thread(true,hp?hp->contextptr:0); return; @@ -3178,7 +3187,13 @@ stop_button->activate(); else { ++update_status_count; - if (!stop_button->active() && (update_status_count%64) ) + if (!stop_button->active() && +#ifdef WIN32 + (update_status_count%64) +#else + (update_status_count%64) +#endif + ) return; stop_button->deactivate(); } @@ -3300,6 +3315,7 @@ save_button->color(Xcas_save_saved_color); save_button->callback((Fl_Callback*) History_cb_save_button); save_button->tooltip(gettext("Save current session")); + save_button->align(Fl_Align(68|FL_ALIGN_INSIDE)); #ifdef IPAQ bnd_button = new No_Focus_Button(X+8*L,Y+1,2*L,L-2,"bnd"); bnd_button->callback((Fl_Callback*) History_cb_tex_button); @@ -3320,9 +3336,9 @@ stop_button->labelcolor(FL_RED); stop_button->tooltip(gettext("Interrupt current computation")); xcas::Xcas_Cancel=stop_button; // FIXME when history fold destroyed - keyboard_button = new No_Focus_Button(stop_button->x()+stop_button->w(),Y+1,3*L,L-2,"Kbd"); + keyboard_button = new No_Focus_Button(stop_button->x()+stop_button->w(),Y+1,3*L,L-2,gettext("Kbd")); keyboard_button->callback((Fl_Callback*) History_cb_keyboard_button); - keyboard_button->tooltip("Switch keyboard on or off"); + keyboard_button->tooltip(gettext("Switch keyboard on or off")); // msg_button = new No_Focus_Button(keyboard_button->x()+keyboard_button->w(),Y+1,2*L,L-2,"Msg"); // msg_button->callback((Fl_Callback*) History_cb_msg_button); // msg_button->tooltip("Show messages line"); @@ -3441,6 +3457,9 @@ return false; } int s1=_sel_begin, s2= _sel_end; + if (s1<0 || s2<0){ + fl_alert(gettext("First select level(s):\nclick on the level numbers near the left border")); + } if (s1>=0 && s2>=0){ int m=min(s1,s2),M=max(s1,s2); update_pos=m; @@ -3649,7 +3668,7 @@ int maxh = ptr?(ptr->h()/3):400; const char * ch=output->value(); int n=strlen(ch); - int h0=output->labelsize()+1,res=n?h0+3:1; + int h0=output->labelsize()+4,res=n?h0+2:1; for (int i=0;i<n-1;++i,++ch){ if (*ch=='\n'){ res += h0; Modified: trunk/giac-xcas/giac/src/Input.cc =================================================================== --- trunk/giac-xcas/giac/src/Input.cc 2009-12-04 08:43:37 UTC (rev 763) +++ trunk/giac-xcas/giac/src/Input.cc 2009-12-17 14:23:08 UTC (rev 764) @@ -773,6 +773,20 @@ return lw>w()+20; } + int height(const char * ch,int labelsize){ + int n=strlen(ch); + int h0=labelsize+4,res=n?h0+2:1; + int maxh=300; + for (int i=0;i<n-1;++i,++ch){ + if (*ch=='\n'){ + res += h0; + if (res>maxh) + break; + } + } + return res; + } + int Multiline_Input_tab::in_handle(int event){ History_Pack * g=get_history_pack(this); if (g && event==FL_MOUSEWHEEL){ @@ -823,6 +837,12 @@ static string toolt; string str; int key=Fl::event_key(); + if (g && key==FL_F+9){ + History_Fold * hf = get_history_fold(g); + if (!hf) return 0; + hf->eval(); + return 1; + } if (Fl::event_text()){ int i=Fl::event_text()[0]; switch (i){ @@ -867,7 +887,8 @@ if (!str.empty()){ toolt=writehelp(helpon(str,*giac::vector_aide_ptr,giac::language(g?g->contextptr:0),giac::vector_aide_ptr->size()),giac::language(g?g->contextptr:0)); tooltip(toolt.c_str()); - Fl_Tooltip::enter_area(this,0,0,0,0,toolt.c_str()); + int hh=height(toolt.c_str(),Fl_Tooltip::size()); + Fl_Tooltip::enter_area(this,0,-hh,0,0,toolt.c_str()); } break; case ')': Modified: trunk/giac-xcas/giac/src/Input.h =================================================================== --- trunk/giac-xcas/giac/src/Input.h 2009-12-04 08:43:37 UTC (rev 763) +++ trunk/giac-xcas/giac/src/Input.h 2009-12-17 14:23:08 UTC (rev 764) @@ -53,6 +53,8 @@ // Help window for the application, return 0 if cancel, 1 if add () or 2 if no () int handle_tab(const std::string & s,const std::vector<std::string> & v,int dx,int dy,int & remove,std::string & ans); + int height(const char *,int); + class Flv_Table_Gen ; void Multiline_default_callback(Fl_Widget * w,void *); Modified: trunk/giac-xcas/giac/src/Print.cc =================================================================== --- trunk/giac-xcas/giac/src/Print.cc 2009-12-04 08:43:37 UTC (rev 763) +++ trunk/giac-xcas/giac/src/Print.cc 2009-12-17 14:23:08 UTC (rev 764) @@ -494,11 +494,15 @@ system(("convert "+fname+" "+remove_extension(fname)+".png &").c_str()); if (pngpdf & 0x2) system(("convert "+fname+" "+remove_extension(fname)+".pdf &").c_str()); + if (pngpdf & 0x4) + system(("convert "+fname+" "+remove_extension(fname)+".jpg &").c_str()); #else if (pngpdf & 0x1) system(("pstopnm -stdout -portrait "+fname+" | pnmtopng > "+remove_extension(fname)+".png &").c_str()); if (pngpdf & 0x2) system(("epstopdf "+fname+" &").c_str()); + if (pngpdf & 0x4) + system(("pstopnm -stdout -portrait "+fname+" | pnmtojpeg > "+remove_extension(fname)+".jpg &").c_str()); #endif } // Preview Modified: trunk/giac-xcas/giac/src/Print.h =================================================================== --- trunk/giac-xcas/giac/src/Print.h 2009-12-04 08:43:37 UTC (rev 763) +++ trunk/giac-xcas/giac/src/Print.h 2009-12-17 14:23:08 UTC (rev 764) @@ -42,7 +42,7 @@ extern bool printer_landscape; extern double pixel_scale; // size of 1 pixel on a page for printing - void widget_ps_print(Fl_Widget * widget,const std::string & fname0,bool eps=false,int pngpdf=3,bool preview=true); + void widget_ps_print(Fl_Widget * widget,const std::string & fname0,bool eps=false,int pngpdf=7,bool preview=true); void widget_print(Fl_Widget * widget); #endif Modified: trunk/giac-xcas/giac/src/Tableur.cc =================================================================== --- trunk/giac-xcas/giac/src/Tableur.cc 2009-12-04 08:43:37 UTC (rev 763) +++ trunk/giac-xcas/giac/src/Tableur.cc 2009-12-17 14:23:08 UTC (rev 764) @@ -515,6 +515,7 @@ if (tmp.type==_VECT && tmp._VECTptr->size()==3) tmp=tmp._VECTptr->front(); input->value(tmp.print(contextptr).c_str()); + input->position(0,strlen(input->value())); } } Modified: trunk/giac-xcas/giac/src/Xcas1.cc =================================================================== --- trunk/giac-xcas/giac/src/Xcas1.cc 2009-12-04 08:43:37 UTC (rev 763) +++ trunk/giac-xcas/giac/src/Xcas1.cc 2009-12-17 14:23:08 UTC (rev 764) @@ -1034,6 +1034,14 @@ Fl_Group * gr = wid->parent(); if (!hp || !gr) return; +#ifdef HAVE_LIBPTHREAD + // cerr << "geo2d lock" << endl; + pthread_mutex_lock(&interactive_mutex); + bool b=io_graph(contextptr); + io_graph(contextptr)=false; +#endif + bool block=block_signal; + block_signal=true; // int m=gr->children(); // reset output logptr(&std::cerr,contextptr); @@ -1093,11 +1101,15 @@ vecteur dispgv=vecteur(Xcas_DispG->plot_instructions.begin()+xcas_dispg_entries,Xcas_DispG->plot_instructions.end()),v1,v2; aplatir(dispgv,v1); aplatir(resgraph->plot_instructions,v2); - if (v1!=v2) + if (v1!=v2){ + if (Xcas_DispG_Cancel) Xcas_DispG_Cancel->hide(); show_xcas_dispg=2; + } } - else + else { + if (Xcas_DispG_Cancel) Xcas_DispG_Cancel->hide(); show_xcas_dispg=2; + } } } // if hp has eval_below, call callback on next widget @@ -1123,6 +1135,12 @@ i->value("No_output"); hp->resize(); } + block_signal=block; +#ifdef HAVE_LIBPTHREAD + // cerr << "geo2d unlock" << endl; + pthread_mutex_unlock(&interactive_mutex); + io_graph(contextptr)=b; +#endif } Fl_Widget * Xcas_eval(Fl_Widget * w,const giac::gen & g){ @@ -2429,11 +2447,13 @@ Fl_Window * w = Plotfltk_w ; w->end(); int taillew=w->w(),tailleh=w->h(); - if (taillew<100) - taillew=100; - if (tailleh<100) - tailleh=100; - w->resize(w->x(),w->y(),taillew,tailleh); + if (taillew<100 | tailleh<100){ + if (taillew<100) + taillew=100; + if (tailleh<100) + tailleh=100; + w->resize(w->x(),w->y(),taillew,tailleh); + } Fl_Group::current(w); static Fl_Button * button0 = new Fl_Button(2+(2*taillew)/3, tailleh-30, taillew/4, 20); button0->shortcut("^["); Modified: trunk/giac-xcas/giac/src/gen.cc =================================================================== --- trunk/giac-xcas/giac/src/gen.cc 2009-12-04 08:43:37 UTC (rev 763) +++ trunk/giac-xcas/giac/src/gen.cc 2009-12-17 14:23:08 UTC (rev 764) @@ -1145,13 +1145,62 @@ int giac_yyparse(void * scanner); + bool try_parse_test_i = true; + int try_parse(const string & s,GIAC_CONTEXT){ int res; try { void * scanner; YY_BUFFER_STATE state=set_lexer_string(s,scanner,contextptr); + if (xcas_mode(contextptr)==0 && try_parse_test_i) + i_sqrt_minus1(0,contextptr); res=giac_yyparse(scanner); delete_lexer_string(state,scanner); + // if xcas_mode(contextptr)<=0 scan for i:=something, if not present replace i by sqrt(-1) + if (xcas_mode(contextptr)==0 && try_parse_test_i){ + const gen& p = parsed_gen(contextptr); + if (1) { // p.type==_SYMB || p.type==_VECT){ + vecteur v(rlvarx(p,i__IDNT)); + if (!v.empty()){ + vecteur w=lop(v,at_program); + int i,vs=w.size(); + for (i=0;i<vs;i++){ + gen & args = w[i]._SYMBptr->feuille; + if (args.type!=_VECT || args._VECTptr->empty()) + continue; + if (contains(args._VECTptr->front(),i__IDNT_e)) + return res; + } + w=lop(v,at_local); + vs=w.size(); + for (i=0;i<vs;i++){ + gen & args = w[i]._SYMBptr->feuille; + if (args.type!=_VECT || args._VECTptr->empty()) + continue; + if (contains(args._VECTptr->front(),i__IDNT_e)) + return res; + } + v=lop(v,at_sto); + vs=v.size(); + for (i=0;i<vs;i++){ + if (v[i]._SYMBptr->feuille[1]==i__IDNT_e){ + *logptr(contextptr) << "Warning, i is usually sqrt(-1), I'm using a symbolic variable instead but you should check your input" << endl; + break; + } + } + if (i==vs){ + std::ostream * log = logptr(contextptr); + logptr(0,contextptr); + i_sqrt_minus1(1,contextptr); + void * scanner2; + YY_BUFFER_STATE state2=set_lexer_string(s,scanner2,contextptr); + res=giac_yyparse(scanner2); + logptr(log,contextptr); + delete_lexer_string(state2,scanner2); + } + } + } + } // end if (xcas_mode(contextptr)==0 ... } catch (std::runtime_error & error){ cerr << "Error " << error.what() << endl; @@ -2479,21 +2528,31 @@ return; } } - // FIXME, should check that the rootof is really real, see also for im if (u==at_rootof && f.type==_VECT && f._VECTptr->size()==2){ vecteur tmp=*f._VECTptr; - reim(tmp[0],r,i,contextptr); - r=algtrim(r); - if (r.type==_VECT){ - tmp[0]=r; - r=new ref_symbolic(symbolic(u,gen(tmp,f.subtype))); + // check that the rootof is really real + if (tmp[1].type==_VECT){ + int nrealposroot=1; + if (lidnt(tmp[1]).empty()){ + vecteur w=*tmp[1]._VECTptr; + gen pol(symb_horner(w,vx_var)); + nrealposroot=sturmab(pol,vx_var,0,plus_inf,contextptr); + } + if (nrealposroot>0){ + reim(tmp[0],r,i,contextptr); + r=algtrim(r); + if (r.type==_VECT){ + tmp[0]=r; + r=new ref_symbolic(symbolic(u,gen(tmp,f.subtype))); + } + i=algtrim(i); + if (i.type==_VECT){ + tmp[0]=i; + i=new ref_symbolic(symbolic(u,gen(tmp,f.subtype))); + } + return; + } } - i=algtrim(i); - if (i.type==_VECT){ - tmp[0]=i; - i=new ref_symbolic(symbolic(u,gen(tmp,f.subtype))); - } - return; } gen ref,imf; reim(f,ref,imf,contextptr); @@ -2728,14 +2787,6 @@ return s; } } - // FIXME, should check that the rootof is really real, see also for im - if (u==at_rootof && f.type==_VECT && f._VECTptr->size()==2){ - vecteur tmp=*f._VECTptr; - tmp[0]=algtrim(re(tmp[0],contextptr)); - if (tmp[0].type!=_VECT) - return tmp[0]; - return new ref_symbolic(symbolic(u,gen(tmp,f.subtype))); - } if (u==at_ln) // FIXME?? might recurse return ln(abs(f,contextptr),contextptr); gen r,i; @@ -2854,13 +2905,6 @@ return zero; } } - if (u==at_rootof && f.type==_VECT && f._VECTptr->size()==2){ - vecteur tmp=*f._VECTptr; - tmp[0]=algtrim(im(tmp[0],contextptr)); - if (tmp[0].type!=_VECT) - return tmp[0]; - return new ref_symbolic(symbolic(u,gen(tmp,f.subtype))); - } if (u==at_ln) return arg(f,contextptr); gen r,i; Modified: trunk/giac-xcas/giac/src/gen.h =================================================================== --- trunk/giac-xcas/giac/src/gen.h 2009-12-04 08:43:37 UTC (rev 763) +++ trunk/giac-xcas/giac/src/gen.h 2009-12-17 14:23:08 UTC (rev 764) @@ -66,6 +66,8 @@ namespace giac { #endif // ndef NO_NAMESPACE_GIAC + extern bool try_parse_test_i; + class gen ; // errors void settypeerr(GIAC_CONTEXT0); Modified: trunk/giac-xcas/giac/src/gl2ps.c =================================================================== --- trunk/giac-xcas/giac/src/gl2ps.c 2009-12-04 08:43:37 UTC (rev 763) +++ trunk/giac-xcas/giac/src/gl2ps.c 2009-12-17 14:23:08 UTC (rev 764) @@ -1,7 +1,6 @@ -/* $Id: gl2ps.c,v 1.225 2006/02/14 19:09:30 geuzaine Exp $ */ /* * GL2PS, an OpenGL to PostScript Printing Library - * Copyright (C) 1999-2006 Christophe Geuzaine <ge...@ge...> + * Copyright (C) 1999-2009 C. Geuzaine * * This program is free software; you can redistribute it and/or * modify it under the terms of either: @@ -28,33 +27,11 @@ * library in the file named "COPYING.GL2PS"; if not, I will be glad * to provide one. * - * Contributors: - * Michael Sweet <mi...@ea...> - * Marc Ume <mar...@di...> - * Jean-Francois Remacle <re...@gc...> - * Bart Kaptein <B.L...@lu...> - * Quy Nguyen-Dai <qu...@ng...> - * Sam Buss <sb...@uc...> - * Shane Hill <Sha...@ds...> - * Romain Boman <r_...@ya...> - * Rouben Rostamian <ros...@um...> - * Diego Santa Cruz <Die...@ep...> - * Shahzad Muzaffar <Sha...@ce...> - * Lassi Tuura <las...@ce...> - * Guy Barrand <ba...@la...> - * Prabhu Ramachandran <pr...@ae...> - * Micha Bieber <bi...@tr...> - * Olivier Couet <co...@ma...> - * Shai Ayal <sh...@gm...> - * Fabian Wenzel <we...@tu...> + * For the latest info about gl2ps and a full list of contributors, + * see http://www.geuz.org/gl2ps/. * - * For the latest info about gl2ps, see http://www.geuz.org/gl2ps/. * Please report all bugs and problems to <gl...@ge...>. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#ifdef HAVE_LIBFLTK #include "gl2ps.h" @@ -65,6 +42,14 @@ #include <time.h> #include <float.h> +#if defined(GL2PS_HAVE_ZLIB) +#include <zlib.h> +#endif + +#if defined(GL2PS_HAVE_LIBPNG) +#include <png.h> +#endif + /********************************************************************* * * Private definitions, data structures and prototypes @@ -82,7 +67,7 @@ /* Primitive types */ -#define GL2PS_NOTYPE -1 +#define GL2PS_NO_TYPE -1 #define GL2PS_TEXT 1 #define GL2PS_POINT 2 #define GL2PS_LINE 3 @@ -92,6 +77,7 @@ #define GL2PS_IMAGEMAP 7 #define GL2PS_IMAGEMAP_WRITTEN 8 #define GL2PS_IMAGEMAP_VISIBLE 9 +#define GL2PS_SPECIAL 10 /* BSP tree primitive comparison */ @@ -106,21 +92,23 @@ #define GL2PS_POINT_INFRONT 1 #define GL2PS_POINT_BACK 2 -/* Pass through options */ +/* Internal feedback buffer pass-through tokens */ -#define GL2PS_BEGIN_POLYGON_OFFSET_FILL 1 -#define GL2PS_END_POLYGON_OFFSET_FILL 2 -#define GL2PS_BEGIN_POLYGON_BOUNDARY 3 -#define GL2PS_END_POLYGON_BOUNDARY 4 -#define GL2PS_BEGIN_LINE_STIPPLE 5 -#define GL2PS_END_LINE_STIPPLE 6 -#define GL2PS_SET_POINT_SIZE 7 -#define GL2PS_SET_LINE_WIDTH 8 -#define GL2PS_BEGIN_BLEND 9 -#define GL2PS_END_BLEND 10 -#define GL2PS_SRC_BLEND 11 -#define GL2PS_DST_BLEND 12 -#define GL2PS_DRAW_IMAGEMAP_TOKEN 13 +#define GL2PS_BEGIN_OFFSET_TOKEN 1 +#define GL2PS_END_OFFSET_TOKEN 2 +#define GL2PS_BEGIN_BOUNDARY_TOKEN 3 +#define GL2PS_END_BOUNDARY_TOKEN 4 +#define GL2PS_BEGIN_STIPPLE_TOKEN 5 +#define GL2PS_END_STIPPLE_TOKEN 6 +#define GL2PS_POINT_SIZE_TOKEN 7 +#define GL2PS_LINE_WIDTH_TOKEN 8 +#define GL2PS_BEGIN_BLEND_TOKEN 9 +#define GL2PS_END_BLEND_TOKEN 10 +#define GL2PS_SRC_BLEND_TOKEN 11 +#define GL2PS_DST_BLEND_TOKEN 12 +#define GL2PS_IMAGEMAP_TOKEN 13 +#define GL2PS_DRAW_PIXELS_TOKEN 14 +#define GL2PS_TEXT_TOKEN 15 typedef enum { T_UNDEFINED = -1, @@ -167,15 +155,17 @@ typedef struct { GLshort fontsize; char *str, *fontname; + /* Note: for a 'special' string, 'alignment' holds the format + (PostScript, PDF, etc.) of the special string */ GLint alignment; GLfloat angle; } GL2PSstring; -/* FIXME: in the case of an image map, "type" indicates if this image - map has already been written to the PostScript file or not, and - "format" indicates if this image map is visible or not */ typedef struct { GLsizei width, height; + /* Note: for an imagemap, 'type' indicates if it has already been + written to the file or not, and 'format' indicates if it is + visible or not */ GLenum format, type; GLfloat *pixels; } GL2PSimage; @@ -201,7 +191,7 @@ } GL2PSprimitive; typedef struct { -#ifdef GL2PS_HAVE_ZLIB +#if defined(GL2PS_HAVE_ZLIB) Bytef *dest, *src, *start; uLongf destLen, srcLen; #else @@ -224,7 +214,8 @@ GLint viewport[4], blendfunc[2], lastfactor; GL2PSrgba *colormap, lastrgba, threshold, bgcolor; GLushort lastpattern; - GL2PSlist *primitives; + GL2PSvertex lastvertex; + GL2PSlist *primitives, *auxprimitives; FILE *stream; GL2PScompress *compress; GLboolean header; @@ -255,11 +246,12 @@ } GL2PScontext; typedef struct { - void (*header)(void); - void (*footer)(void); + void (*printHeader)(void); + void (*printFooter)(void); void (*beginViewport)(GLint viewport[4]); GLint (*endViewport)(void); void (*printPrimitive)(void *data); + void (*printFinalPrimitive)(void); const char *file_extension; const char *description; } GL2PSbackend; @@ -269,7 +261,7 @@ static GL2PScontext *gl2ps = NULL; -/* Need to forward declare this one */ +/* Need to forward-declare this one */ static GLint gl2psPrintPrimitives(void); @@ -279,7 +271,7 @@ * *********************************************************************/ -static void gl2psMsg(GLint level, char *fmt, ...) +static void gl2psMsg(GLint level, const char *fmt, ...) { va_list args; @@ -301,24 +293,24 @@ { void *ptr; - if(!size) return(NULL); + if(!size) return NULL; ptr = malloc(size); if(!ptr){ gl2psMsg(GL2PS_ERROR, "Couldn't allocate requested memory"); - exit(1); + return NULL; } - return(ptr); + return ptr; } static void *gl2psRealloc(void *ptr, size_t size) { - if(!size) return(NULL); + if(!size) return NULL; ptr = realloc(ptr, size); if(!ptr){ gl2psMsg(GL2PS_ERROR, "Couldn't reallocate requested memory"); - exit(1); + return NULL; } - return(ptr); + return ptr; } static void gl2psFree(void *ptr) @@ -327,9 +319,19 @@ free(ptr); } +static size_t gl2psWriteBigEndian(unsigned long data, size_t bytes) +{ + size_t i; + size_t size = sizeof(unsigned long); + for(i = 1; i <= bytes; ++i){ + fputc(0xff & (data >> (size-i) * 8), gl2ps->stream); + } + return bytes; +} + /* zlib compression helper routines */ -#ifdef GL2PS_HAVE_ZLIB +#if defined(GL2PS_HAVE_ZLIB) static void gl2psSetupCompress(void) { @@ -415,7 +417,7 @@ int ret; va_list args; -#ifdef GL2PS_HAVE_ZLIB +#if defined(GL2PS_HAVE_ZLIB) unsigned int oldsize = 0; static char buf[1000]; if(gl2ps->options & GL2PS_COMPRESS){ @@ -432,74 +434,70 @@ va_start(args, fmt); ret = vfprintf(gl2ps->stream, fmt, args); va_end(args); -#ifdef GL2PS_HAVE_ZLIB +#if defined(GL2PS_HAVE_ZLIB) } #endif return ret; } -static size_t gl2psWriteBigEndian(unsigned long data, size_t bytes) +static void gl2psPrintGzipHeader() { - size_t i; - size_t size = sizeof(unsigned long); - for(i = 1; i <= bytes; ++i){ - fputc(0xff & (data >> (size-i) * 8), gl2ps->stream); +#if defined(GL2PS_HAVE_ZLIB) + char tmp[10] = {'\x1f', '\x8b', /* magic numbers: 0x1f, 0x8b */ + 8, /* compression method: Z_DEFLATED */ + 0, /* flags */ + 0, 0, 0, 0, /* time */ + 2, /* extra flags: max compression */ + '\x03'}; /* OS code: 0x03 (Unix) */ + + if(gl2ps->options & GL2PS_COMPRESS){ + gl2psSetupCompress(); + /* add the gzip file header */ + fwrite(tmp, 10, 1, gl2ps->stream); } - return bytes; +#endif } -static void gl2psAssignTriangleProperties(GL2PStriangle *t) +static void gl2psPrintGzipFooter() { - /* int i; */ +#if defined(GL2PS_HAVE_ZLIB) + int n; + uLong crc, len; + char tmp[8]; - t->prop = T_VAR_COLOR; - - /* Uncommenting the following lines activates an even more fine - grained distinction between triangle types - please don't delete, - a remarkable amount of PDF handling code inside this file depends - on it if activated */ - /* - t->prop = T_CONST_COLOR; - for(i = 0; i < 3; ++i){ - if(!GL2PS_ZERO(t->vertex[0].rgba[i] - t->vertex[1].rgba[i]) || - !GL2PS_ZERO(t->vertex[1].rgba[i] - t->vertex[2].rgba[i])){ - t->prop = T_VAR_COLOR; - break; + if(gl2ps->options & GL2PS_COMPRESS){ + if(Z_OK != gl2psDeflate()){ + gl2psMsg(GL2PS_ERROR, "Zlib deflate error"); } + else{ + /* determine the length of the header in the zlib stream */ + n = 2; /* CMF+FLG */ + if(gl2ps->compress->dest[1] & (1<<5)){ + n += 4; /* DICTID */ + } + /* write the data, without the zlib header and footer */ + fwrite(gl2ps->compress->dest+n, gl2ps->compress->destLen-(n+4), + 1, gl2ps->stream); + /* add the gzip file footer */ + crc = crc32(0L, gl2ps->compress->start, gl2ps->compress->srcLen); + for(n = 0; n < 4; ++n){ + tmp[n] = (char)(crc & 0xff); + crc >>= 8; + } + len = gl2ps->compress->srcLen; + for(n = 4; n < 8; ++n){ + tmp[n] = (char)(len & 0xff); + len >>= 8; + } + fwrite(tmp, 8, 1, gl2ps->stream); + } + gl2psFreeCompress(); + gl2psFree(gl2ps->compress); + gl2ps->compress = NULL; } - */ - - if(!GL2PS_ZERO(t->vertex[0].rgba[3] - t->vertex[1].rgba[3]) || - !GL2PS_ZERO(t->vertex[1].rgba[3] - t->vertex[2].rgba[3])){ - t->prop |= T_VAR_ALPHA; - } - else{ - if(t->vertex[0].rgba[3] < 1) - t->prop |= T_ALPHA_LESS_1; - else - t->prop |= T_ALPHA_1; - } +#endif } -static void gl2psFillTriangleFromPrimitive(GL2PStriangle *t, GL2PSprimitive *p, - GLboolean assignprops) -{ - t->vertex[0] = p->verts[0]; - t->vertex[1] = p->verts[1]; - t->vertex[2] = p->verts[2]; - if(GL_TRUE == assignprops) - gl2psAssignTriangleProperties(t); -} - -static void gl2psInitTriangle(GL2PStriangle *t) -{ - int i; - GL2PSvertex vertex = { {-1.0F, -1.0F, -1.0F}, {-1.0F, -1.0F, -1.0F, -1.0F} }; - for(i = 0; i < 3; i++) - t->vertex[i] = vertex; - t->prop = T_UNDEFINED; -} - /* The list handling routines */ static void gl2psListRealloc(GL2PSlist *list, GLint n) @@ -535,7 +533,7 @@ list->n = 0; list->array = NULL; gl2psListRealloc(list, n); - return(list); + return list; } static void gl2psListReset(GL2PSlist *list) @@ -566,7 +564,7 @@ { if(!list) return 0; - return(list->n); + return list->n; } static void *gl2psListPointer(GL2PSlist *list, GLint index) @@ -579,7 +577,7 @@ gl2psMsg(GL2PS_ERROR, "Wrong list index in gl2psListPointer"); return NULL; } - return(&list->array[index * list->size]); + return &list->array[index * list->size]; } static void gl2psListSort(GL2PSlist *list, @@ -608,8 +606,136 @@ } } -/* Helper for pixmaps and strings */ +#if defined(GL2PS_HAVE_LIBPNG) +static void gl2psListRead(GL2PSlist *list, int index, void *data) +{ + if((index < 0) || (index >= list->n)) + gl2psMsg(GL2PS_ERROR, "Wrong list index in gl2psListRead"); + memcpy(data, &list->array[index * list->size], list->size); +} + +static void gl2psEncodeBase64Block(unsigned char in[3], unsigned char out[4], int len) +{ + static const char cb64[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + + out[0] = cb64[ in[0] >> 2 ]; + out[1] = cb64[ ((in[0] & 0x03) << 4) | ((in[1] & 0xf0) >> 4) ]; + out[2] = (len > 1) ? cb64[ ((in[1] & 0x0f) << 2) | ((in[2] & 0xc0) >> 6) ] : '='; + out[3] = (len > 2) ? cb64[ in[2] & 0x3f ] : '='; +} + +static void gl2psListEncodeBase64(GL2PSlist *list) +{ + unsigned char *buffer, in[3], out[4]; + int i, n, index, len; + + n = list->n * list->size; + buffer = (unsigned char*)gl2psMalloc(n * sizeof(unsigned char)); + memcpy(buffer, list->array, n * sizeof(unsigned char)); + gl2psListReset(list); + + index = 0; + while(index < n) { + len = 0; + for(i = 0; i < 3; i++) { + if(index < n){ + in[i] = buffer[index]; + len++; + } + else{ + in[i] = 0; + } + index++; + } + if(len) { + gl2psEncodeBase64Block(in, out, len); + for(i = 0; i < 4; i++) + gl2psListAdd(list, &out[i]); + } + } + gl2psFree(buffer); +} + +#endif + +/* Helpers for rgba colors */ + +static GLboolean gl2psSameColor(GL2PSrgba rgba1, GL2PSrgba rgba2) +{ + if(!GL2PS_ZERO(rgba1[0] - rgba2[0]) || + !GL2PS_ZERO(rgba1[1] - rgba2[1]) || + !GL2PS_ZERO(rgba1[2] - rgba2[2])) + return GL_FALSE; + return GL_TRUE; +} + +static GLboolean gl2psVertsSameColor(const GL2PSprimitive *prim) +{ + int i; + + for(i = 1; i < prim->numverts; i++){ + if(!gl2psSameColor(prim->verts[0].rgba, prim->verts[i].rgba)){ + return GL_FALSE; + } + } + return GL_TRUE; +} + +static GLboolean gl2psSameColorThreshold(int n, GL2PSrgba rgba[], + GL2PSrgba threshold) +{ + int i; + + if(n < 2) return GL_TRUE; + + for(i = 1; i < n; i++){ + if(fabs(rgba[0][0] - rgba[i][0]) > threshold[0] || + fabs(rgba[0][1] - rgba[i][1]) > threshold[1] || + fabs(rgba[0][2] - rgba[i][2]) > threshold[2]) + return GL_FALSE; + } + + return GL_TRUE; +} + +static void gl2psSetLastColor(GL2PSrgba rgba) +{ + int i; + for(i = 0; i < 3; ++i){ + gl2ps->lastrgba[i] = rgba[i]; + } +} + +static GLfloat gl2psGetRGB(GL2PSimage *im, GLuint x, GLuint y, + GLfloat *red, GLfloat *green, GLfloat *blue) +{ + + GLsizei width = im->width; + GLsizei height = im->height; + GLfloat *pixels = im->pixels; + GLfloat *pimag; + + /* OpenGL image is from down to up, PS image is up to down */ + switch(im->format){ + case GL_RGBA: + pimag = pixels + 4 * (width * (height - 1 - y) + x); + break; + case GL_RGB: + default: + pimag = pixels + 3 * (width * (height - 1 - y) + x); + break; + } + *red = *pimag; pimag++; + *green = *pimag; pimag++; + *blue = *pimag; pimag++; + + return (im->format == GL_RGBA) ? *pimag : 1.0F; +} + +/* Helper routines for pixmaps */ + static GL2PSimage *gl2psCopyPixmap(GL2PSimage *im) { int size; @@ -644,6 +770,117 @@ gl2psFree(im); } +#if defined(GL2PS_HAVE_LIBPNG) + +#if !defined(png_jmpbuf) +# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf) +#endif + +static void gl2psUserWritePNG(png_structp png_ptr, png_bytep data, png_size_t length) +{ + unsigned int i; + GL2PSlist *png = (GL2PSlist*)png_get_io_ptr(png_ptr); + for(i = 0; i < length; i++) + gl2psListAdd(png, &data[i]); +} + +static void gl2psUserFlushPNG(png_structp png_ptr) +{ +} + +static void gl2psConvertPixmapToPNG(GL2PSimage *pixmap, GL2PSlist *png) +{ + png_structp png_ptr; + png_infop info_ptr; + unsigned char *row_data; + GLfloat dr, dg, db; + int row, col; + + if(!(png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL))) + return; + + if(!(info_ptr = png_create_info_struct(png_ptr))){ + png_destroy_write_struct(&png_ptr, NULL); + return; + } + + if(setjmp(png_jmpbuf(png_ptr))) { + png_destroy_write_struct(&png_ptr, &info_ptr); + return; + } + + png_set_write_fn(png_ptr, (void *)png, gl2psUserWritePNG, gl2psUserFlushPNG); + png_set_compression_level(png_ptr, Z_DEFAULT_COMPRESSION); + png_set_IHDR(png_ptr, info_ptr, pixmap->width, pixmap->height, 8, + PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, + PNG_FILTER_TYPE_BASE); + png_write_info(png_ptr, info_ptr); + + row_data = (unsigned char*)gl2psMalloc(3 * pixmap->width * sizeof(unsigned char)); + for(row = 0; row < pixmap->height; row++){ + for(col = 0; col < pixmap->width; col++){ + gl2psGetRGB(pixmap, col, row, &dr, &dg, &db); + row_data[3*col] = (unsigned char)(255. * dr); + row_data[3*col+1] = (unsigned char)(255. * dg); + row_data[3*col+2] = (unsigned char)(255. * db); + } + png_write_row(png_ptr, (png_bytep)row_data); + } + gl2psFree(row_data); + + png_write_end(png_ptr, info_ptr); + png_destroy_write_struct(&png_ptr, &info_ptr); +} + +#endif + +/* Helper routines for text strings */ + +static GLint gl2psAddText(GLint type, const char *str, const char *fontname, + GLshort fontsize, GLint alignment, GLfloat angle) +{ + GLfloat pos[4]; + GL2PSprimitive *prim; + GLboolean valid; + + if(!gl2ps || !str || !fontname) return GL2PS_UNINITIALIZED; + + if(gl2ps->options & GL2PS_NO_TEXT) return GL2PS_SUCCESS; + + glGetBooleanv(GL_CURRENT_RASTER_POSITION_VALID, &valid); + if(GL_FALSE == valid) return GL2PS_SUCCESS; /* the primitive is culled */ + + glGetFloatv(GL_CURRENT_RASTER_POSITION, pos); + + prim = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); + prim->type = type; + prim->boundary = 0; + prim->numverts = 1; + prim->verts = (GL2PSvertex*)gl2psMalloc(sizeof(GL2PSvertex)); + prim->verts[0].xyz[0] = pos[0]; + prim->verts[0].xyz[1] = pos[1]; + prim->verts[0].xyz[2] = pos[2]; + prim->culled = 0; + prim->offset = 0; + prim->pattern = 0; + prim->factor = 0; + prim->width = 1; + glGetFloatv(GL_CURRENT_RASTER_COLOR, prim->verts[0].rgba); + prim->data.text = (GL2PSstring*)gl2psMalloc(sizeof(GL2PSstring)); + prim->data.text->str = (char*)gl2psMalloc((strlen(str)+1)*sizeof(char)); + strcpy(prim->data.text->str, str); + prim->data.text->fontname = (char*)gl2psMalloc((strlen(fontname)+1)*sizeof(char)); + strcpy(prim->data.text->fontname, fontname); + prim->data.text->fontsize = fontsize; + prim->data.text->alignment = alignment; + prim->data.text->angle = angle; + + gl2psListAdd(gl2ps->auxprimitives, &prim); + glPassThrough(GL2PS_TEXT_TOKEN); + + return GL2PS_SUCCESS; +} + static GL2PSstring *gl2psCopyText(GL2PSstring *t) { GL2PSstring *text = (GL2PSstring*)gl2psMalloc(sizeof(GL2PSstring)); @@ -667,6 +904,97 @@ gl2psFree(text); } +/* Helpers for blending modes */ + +static GLboolean gl2psSupportedBlendMode(GLenum sfactor, GLenum dfactor) +{ + /* returns TRUE if gl2ps supports the argument combination: only two + blending modes have been implemented so far */ + + if( (sfactor == GL_SRC_ALPHA && dfactor == GL_ONE_MINUS_SRC_ALPHA) || + (sfactor == GL_ONE && dfactor == GL_ZERO) ) + return GL_TRUE; + return GL_FALSE; +} + +static void gl2psAdaptVertexForBlending(GL2PSvertex *v) +{ + /* Transforms vertex depending on the actual blending function - + currently the vertex v is considered as source vertex and his + alpha value is changed to 1.0 if source blending GL_ONE is + active. This might be extended in the future */ + + if(!v || !gl2ps) + return; + + if(gl2ps->options & GL2PS_NO_BLENDING || !gl2ps->blending){ + v->rgba[3] = 1.0F; + return; + } + + switch(gl2ps->blendfunc[0]){ + case GL_ONE: + v->rgba[3] = 1.0F; + break; + default: + break; + } +} + +static void gl2psAssignTriangleProperties(GL2PStriangle *t) +{ + /* int i; */ + + t->prop = T_VAR_COLOR; + + /* Uncommenting the following lines activates an even more fine + grained distinction between triangle types - please don't delete, + a remarkable amount of PDF handling code inside this file depends + on it if activated */ + /* + t->prop = T_CONST_COLOR; + for(i = 0; i < 3; ++i){ + if(!GL2PS_ZERO(t->vertex[0].rgba[i] - t->vertex[1].rgba[i]) || + !GL2PS_ZERO(t->vertex[1].rgba[i] - t->vertex[2].rgba[i])){ + t->prop = T_VAR_COLOR; + break; + } + } + */ + + if(!GL2PS_ZERO(t->vertex[0].rgba[3] - t->vertex[1].rgba[3]) || + !GL2PS_ZERO(t->vertex[1].rgba[3] - t->vertex[2].rgba[3])){ + t->prop |= T_VAR_ALPHA; + } + else{ + if(t->vertex[0].rgba[3] < 1) + t->prop |= T_ALPHA_LESS_1; + else + t->prop |= T_ALPHA_1; + } +} + +static void gl2psFillTriangleFromPrimitive(GL2PStriangle *t, GL2PSprimitive *p, + GLboolean assignprops) +{ + t->vertex[0] = p->verts[0]; + t->vertex[1] = p->verts[1]; + t->vertex[2] = p->verts[2]; + if(GL_TRUE == assignprops) + gl2psAssignTriangleProperties(t); +} + +static void gl2psInitTriangle(GL2PStriangle *t) +{ + int i; + GL2PSvertex vertex = { {-1.0F, -1.0F, -1.0F}, {-1.0F, -1.0F, -1.0F, -1.0F} }; + for(i = 0; i < 3; i++) + t->vertex[i] = vertex; + t->prop = T_UNDEFINED; +} + +/* Miscellaneous helper routines */ + static GL2PSprimitive *gl2psCopyPrimitive(GL2PSprimitive *p) { GL2PSprimitive *prim; @@ -694,6 +1022,7 @@ prim->data.image = gl2psCopyPixmap(p->data.image); break; case GL2PS_TEXT : + case GL2PS_SPECIAL : prim->data.text = gl2psCopyText(p->data.text); break; default: @@ -703,98 +1032,15 @@ return prim; } -/* Helpers for rgba colors and PDF blending */ - -static GLboolean gl2psSameColor(GL2PSrgba rgba1, GL2PSrgba rgba2) +static GLboolean gl2psSamePosition(GL2PSxyz p1, GL2PSxyz p2) { - if(!GL2PS_ZERO(rgba1[0] - rgba2[0]) || - !GL2PS_ZERO(rgba1[1] - rgba2[1]) || - !GL2PS_ZERO(rgba1[2] - rgba2[2])) + if(!GL2PS_ZERO(p1[0] - p2[0]) || + !GL2PS_ZERO(p1[1] - p2[1]) || + !GL2PS_ZERO(p1[2] - p2[2])) return GL_FALSE; return GL_TRUE; } - -static GLboolean gl2psVertsSameColor(const GL2PSprimitive *prim) -{ - int i; - for(i = 1; i < prim->numverts; i++){ - if(!gl2psSameColor(prim->verts[0].rgba, prim->verts[i].rgba)){ - return GL_FALSE; - } - } - return GL_TRUE; -} - -static void gl2psSetLastColor(GL2PSrgba rgba) -{ - int i; - for(i = 0; i < 3; ++i){ - gl2ps->lastrgba[i] = rgba[i]; - } -} - -/* returns TRUE if gl2ps supports the argument combination: only two - blending modes have been implemented so far */ - -static GLboolean gl2psSupportedBlendMode(GLenum sfactor, GLenum dfactor) -{ - if( (sfactor == GL_SRC_ALPHA && dfactor == GL_ONE_MINUS_SRC_ALPHA) || - (sfactor == GL_ONE && dfactor == GL_ZERO) ) - return GL_TRUE; - return GL_FALSE; -} - -/* Transforms vertex depending on the actual blending function - - currently the vertex v is considered as source vertex and his alpha - value is changed to 1.0 if source blending GL_ONE is active. This - might be extended in the future */ - -static void gl2psAdaptVertexForBlending(GL2PSvertex *v) -{ - if(!v || !gl2ps) - return; - - if(gl2ps->options & GL2PS_NO_BLENDING || !gl2ps->blending){ - v->rgba[3] = 1.0F; - return; - } - - switch(gl2ps->blendfunc[0]){ - case GL_ONE: - v->rgba[3] = 1.0F; - break; - default: - break; - } -} - -static GLfloat gl2psGetRGB(GL2PSimage *im, GLuint x, GLuint y, - GLfloat *red, GLfloat *green, GLfloat *blue) -{ - - GLsizei width = im->width; - GLsizei height = im->height; - GLfloat *pixels = im->pixels; - GLfloat *pimag; - - /* OpenGL image is from down to up, PS image is up to down */ - switch(im->format){ - case GL_RGBA: - pimag = pixels + 4 * (width * (height - 1 - y) + x); - break; - case GL_RGB: - default: - pimag = pixels + 3 * (width * (height - 1 - y) + x); - break; - } - *red = *pimag; pimag++; - *green = *pimag; pimag++; - *blue = *pimag; pimag++; - - return (im->format == GL_RGBA) ? *pimag : 1.0F; -} - /********************************************************************* * * 3D sorting routines @@ -803,15 +1049,15 @@ static GLfloat gl2psComparePointPlane(GL2PSxyz point, GL2PSplane plane) { - return(plane[0] * point[0] + - plane[1] * point[1] + - plane[2] * point[2] + - plane[3]); + return (plane[0] * point[0] + + plane[1] * point[1] + + plane[2] * point[2] + + plane[3]); } static GLfloat gl2psPsca(GLfloat *a, GLfloat *b) { - return(a[0]*b[0] + a[1]*b[1] + a[2]*b[2]); + return (a[0]*b[0] + a[1]*b[1] + a[2]*b[2]); } static void gl2psPvec(GLfloat *a, GLfloat *b, GLfloat *c) @@ -837,9 +1083,9 @@ c[2] = c[2] / norm; } else{ - /* FIXME: the plane is still wrong, despite our tests in - gl2psGetPlane... Let's return a dummy value for now (this is a - hack: we should do more tests in GetPlane) */ + /* The plane is still wrong despite our tests in gl2psGetPlane. + Let's return a dummy value for now (this is a hack: we should + do more intelligent tests in GetPlane) */ c[0] = c[1] = 0.0F; c[2] = 1.0F; } @@ -895,6 +1141,7 @@ case GL2PS_POINT : case GL2PS_PIXMAP : case GL2PS_TEXT : + case GL2PS_SPECIAL : case GL2PS_IMAGEMAP: plane[0] = plane[1] = 0.0F; plane[2] = 1.0F; @@ -912,14 +1159,17 @@ GL2PSvertex *c) { GL2PSxyz v; - GLfloat sect; + GLfloat sect, psca; v[0] = b->xyz[0] - a->xyz[0]; v[1] = b->xyz[1] - a->xyz[1]; v[2] = b->xyz[2] - a->xyz[2]; - sect = - gl2psComparePointPlane(a->xyz, plane) / gl2psPsca(plane, v); - + if(!GL2PS_ZERO(psca = gl2psPsca(plane, v))) + sect = -gl2psComparePointPlane(a->xyz, plane) / psca; + else + sect = 0.0F; + c->xyz[0] = a->xyz[0] + v[0] * sect; c->xyz[1] = a->xyz[1] + v[1] * sect; c->xyz[2] = a->xyz[2] + v[2] * sect; @@ -950,7 +1200,7 @@ case 2 : child->type = GL2PS_LINE; break; case 3 : child->type = GL2PS_TRIANGLE; break; case 4 : child->type = GL2PS_QUADRANGLE; break; - default: child->type = GL2PS_NOTYPE; break; + default: child->type = GL2PS_NO_TYPE; break; } } @@ -990,7 +1240,7 @@ static GLshort gl2psGetIndex(GLshort i, GLshort num) { - return(i < num-1) ? i+1 : 0; + return (i < num - 1) ? i + 1 : 0; } static GLint gl2psTestSplitPrimitive(GL2PSprimitive *prim, GL2PSplane plane) @@ -1105,7 +1355,7 @@ (*t2)->verts[0] = quad->verts[0]; (*t2)->verts[1] = quad->verts[2]; (*t2)->verts[2] = quad->verts[3]; - (*t1)->boundary = ((quad->boundary & 4) ? 2 : 0) | ((quad->boundary & 4) ? 2 : 0); + (*t2)->boundary = ((quad->boundary & 4) ? 2 : 0) | ((quad->boundary & 4) ? 2 : 0); } static int gl2psCompareDepth(const void *a, const void *b) @@ -1129,10 +1379,10 @@ diff = dq - dw; if(diff > 0.){ - return 1; + return -1; } else if(diff < 0.){ - return -1; + return 1; } else{ return 0; @@ -1145,7 +1395,7 @@ q = *(GL2PSprimitive**)a; w = *(GL2PSprimitive**)b; - return(q->type < w->type ? 1 : -1); + return (q->type < w->type ? 1 : -1); } static GLint gl2psFindRoot(GL2PSlist *primitives, GL2PSprimitive **root) @@ -1193,7 +1443,8 @@ } } -static void gl2psFreeImagemap(GL2PSimagemap *list){ +static void gl2psFreeImagemap(GL2PSimagemap *list) +{ GL2PSimagemap *next; while(list != NULL){ next = list->next; @@ -1210,7 +1461,7 @@ q = *(GL2PSprimitive**)data; gl2psFree(q->verts); - if(q->type == GL2PS_TEXT){ + if(q->type == GL2PS_TEXT || q->type == GL2PS_SPECIAL){ gl2psFreeText(q->data.text); } else if(q->type == GL2PS_PIXMAP){ @@ -1417,17 +1668,22 @@ (prim->verts[2].xyz[1] - prim->verts[1].xyz[1]) - (prim->verts[2].xyz[0] - prim->verts[1].xyz[0]) * (prim->verts[1].xyz[1] - prim->verts[0].xyz[1]); - dZdX = - (prim->verts[2].xyz[1] - prim->verts[1].xyz[1]) * - (prim->verts[1].xyz[2] - prim->verts[0].xyz[2]) - - (prim->verts[1].xyz[1] - prim->verts[0].xyz[1]) * - (prim->verts[2].xyz[2] - prim->verts[1].xyz[2]) / area; - dZdY = - (prim->verts[1].xyz[0] - prim->verts[0].xyz[0]) * - (prim->verts[2].xyz[2] - prim->verts[1].xyz[2]) - - (prim->verts[2].xyz[0] - prim->verts[1].xyz[0]) * - (prim->verts[1].xyz[2] - prim->verts[0].xyz[2]) / area; - maxdZ = (GLfloat)sqrt(dZdX * dZdX + dZdY * dZdY); + if(!GL2PS_ZERO(area)){ + dZdX = + ((prim->verts[2].xyz[1] - prim->verts[1].xyz[1]) * + (prim->verts[1].xyz[2] - prim->verts[0].xyz[2]) - + (prim->verts[1].xyz[1] - prim->verts[0].xyz[1]) * + (prim->verts[2].xyz[2] - prim->verts[1].xyz[2])) / area; + dZdY = + ((prim->verts[1].xyz[0] - prim->verts[0].xyz[0]) * + (prim->verts[2].xyz[2] - prim->verts[1].xyz[2]) - + (prim->verts[2].xyz[0] - prim->verts[1].xyz[0]) * + (prim->verts[1].xyz[2] - prim->verts[0].xyz[2])) / area; + maxdZ = (GLfloat)sqrt(dZdX * dZdX + dZdY * dZdY); + } + else{ + maxdZ = 0.0F; + } dZ = factor * maxdZ + units; prim->verts[0].xyz[2] += dZ; prim->verts[1].xyz[2] += dZ; @@ -1493,6 +1749,10 @@ GL2PSbsptree2d *head = NULL, *cur = NULL; if((*tree == NULL) && (prim->numverts > 2)){ + /* don't cull if transparent + for(i = 0; i < prim->numverts - 1; i++) + if(prim->verts[i].rgba[3] < 1.0F) return; + */ head = (GL2PSbsptree2d*)gl2psMalloc(sizeof(GL2PSbsptree2d)); for(i = 0; i < prim->numverts-1; i++){ if(!gl2psGetPlaneFromPoints(prim->verts[i].xyz, @@ -1616,7 +1876,7 @@ case 2 : child->type = GL2PS_LINE; break; case 3 : child->type = GL2PS_TRIANGLE; break; case 4 : child->type = GL2PS_QUADRANGLE; break; - default: child->type = GL2PS_NOTYPE; break; /* FIXME */ + default: child->type = GL2PS_NO_TYPE; break; /* FIXME */ } } child->boundary = 0; /* FIXME: not done! */ @@ -1656,7 +1916,7 @@ if(v1 == prim->numverts){ if(prim->numverts < 3) break; v1 = 0; - v2 = prim->numverts-1; + v2 = prim->numverts - 1; cur = prev0; } else if(flag){ @@ -1699,10 +1959,8 @@ front_count++; front_list = (GL2PSvertex*)gl2psRealloc(front_list, sizeof(GL2PSvertex)*front_count); - gl2psCutEdge(&prim->verts[v2], - &prim->verts[v1], - plane, - &front_list[front_count-1]); + gl2psCutEdge(&prim->verts[v2], &prim->verts[v1], + plane, &front_list[front_count-1]); back_count++; back_list = (GL2PSvertex*)gl2psRealloc(back_list, sizeof(GL2PSvertex)*back_count); @@ -1725,7 +1983,9 @@ /* FIXME: until we consider the actual extent of text strings and pixmaps, never cull them. Otherwise the whole string/pixmap gets culled as soon as the reference point is hidden */ - if(prim->type == GL2PS_PIXMAP || prim->type == GL2PS_TEXT){ + if(prim->type == GL2PS_PIXMAP || + prim->type == GL2PS_TEXT || + prim->type == GL2PS_SPECIAL){ return 1; } @@ -1934,7 +2194,7 @@ char flag; GLushort pattern = 0; GLboolean boundary; - GLint i, sizeoffloat, count, v, vtot, offset = 0, factor = 0; + GLint i, sizeoffloat, count, v, vtot, offset = 0, factor = 0, auxindex = 0; GLfloat lwidth = 1.0F, psize = 1.0F; GLfloat *current; GL2PSvertex vertices[3]; @@ -2011,14 +2271,14 @@ break; case GL_PASS_THROUGH_TOKEN : switch((GLint)current[1]){ - case GL2PS_BEGIN_POLYGON_OFFSET_FILL : offset = 1; break; - case GL2PS_END_POLYGON_OFFSET_FILL : offset = 0; break; - case GL2PS_BEGIN_POLYGON_BOUNDARY : boundary = GL_TRUE; break; - case GL2PS_END_POLYGON_BOUNDARY : boundary = GL_FALSE; break; - case GL2PS_END_LINE_STIPPLE : pattern = factor = 0; break; - case GL2PS_BEGIN_BLEND : gl2ps->blending = GL_TRUE; break; - case GL2PS_END_BLEND : gl2ps->blending = GL_FALSE; break; - case GL2PS_BEGIN_LINE_STIPPLE : + case GL2PS_BEGIN_OFFSET_TOKEN : offset = 1; break; + case GL2PS_END_OFFSET_TOKEN : offset = 0; break; + case GL2PS_BEGIN_BOUNDARY_TOKEN : boundary = GL_TRUE; break; + case GL2PS_END_BOUNDARY_TOKEN : boundary = GL_FALSE; break; + case GL2PS_END_STIPPLE_TOKEN : pattern = factor = 0; break; + case GL2PS_BEGIN_BLEND_TOKEN : gl2ps->blending = GL_TRUE; break; + case GL2PS_END_BLEND_TOKEN : gl2ps->blending = GL_FALSE; break; + case GL2PS_BEGIN_STIPPLE_TOKEN : current += 2; used -= 2; pattern = (GLushort)current[1]; @@ -2026,27 +2286,27 @@ used -= 2; factor = (GLint)current[1]; break; - case GL2PS_SRC_BLEND : + case GL2PS_SRC_BLEND_TOKEN : current += 2; used -= 2; gl2ps->blendfunc[0] = (GLint)current[1]; break; - case GL2PS_DST_BLEND : + case GL2PS_DST_BLEND_TOKEN : current += 2; used -= 2; gl2ps->blendfunc[1] = (GLint)current[1]; break; - case GL2PS_SET_POINT_SIZE : + case GL2PS_POINT_SIZE_TOKEN : current += 2; used -= 2; psize = current[1]; break; - case GL2PS_SET_LINE_WIDTH : + case GL2PS_LINE_WIDTH_TOKEN : current += 2; used -= 2; lwidth = current[1]; break; - case GL2PS_DRAW_IMAGEMAP_TOKEN : + case GL2PS_IMAGEMAP_TOKEN : prim = (GL2PSprimitive *)gl2psMalloc(sizeof(GL2PSprimitive)); prim->type = GL2PS_IMAGEMAP; prim->boundary = 0; @@ -2078,8 +2338,8 @@ node->image->width = (GLint)current[2]; current += 2; used -= 2; node->image->height = (GLint)current[2]; - prim->verts[0].xyz[0] = prim->verts[0].xyz[0] - (int)(node->image->width / 2) + 0.5; - prim->verts[0].xyz[1] = prim->verts[0].xyz[1] - (int)(node->image->height / 2) + 0.5; + prim->verts[0].xyz[0] = prim->verts[0].xyz[0] - (int)(node->image->width / 2) + 0.5F; + prim->verts[0].xyz[1] = prim->verts[0].xyz[1] - (int)(node->image->height / 2) + 0.5F; for(i = 1; i < 4; i++){ for(v = 0; v < 3; v++){ prim->verts[i].xyz[v] = prim->verts[0].xyz[v]; @@ -2095,7 +2355,7 @@ sizeoffloat = sizeof(GLfloat); v = 2 * sizeoffloat; vtot = node->image->height + node->image->height * - ((node->image->width-1)/8); + ((node->image->width - 1) / 8); node->image->pixels = (GLfloat*)gl2psMalloc(v + vtot); node->image->pixels[0] = prim->verts[0].xyz[0]; node->image->pixels[1] = prim->verts[0].xyz[1]; @@ -2110,6 +2370,14 @@ current++; used--; gl2psListAdd(gl2ps->primitives, &prim); break; + case GL2PS_DRAW_PIXELS_TOKEN : + case GL2PS_TEXT_TOKEN : + if(auxindex < gl2psListNbr(gl2ps->auxprimitives)) + gl2psListAdd(gl2ps->primitives, + gl2psListPointer(gl2ps->auxprimitives, auxindex++)); + else + gl2psMsg(GL2PS_ERROR, "Wrong number of auxiliary tokens in buffer"); + break; } current += 2; used -= 2; @@ -2121,6 +2389,8 @@ break; } } + + gl2psListReset(gl2ps->auxprimitives); } /********************************************************************* @@ -2145,7 +2415,8 @@ GLuint width = (GLuint)im->width; GLuint height = (GLuint)im->height; - /* FIXME: should we define an option for these? */ + /* FIXME: should we define an option for these? Or just keep the + 8-bit per component case? */ int greyscale = 0; /* set to 1 to output greyscale image */ int nbit = 8; /* number of bits per color compoment (2, 4 or 8) */ @@ -2164,7 +2435,7 @@ for(row = 0; row < height; row++){ for(col = 0; col < width; col++){ gl2psGetRGB(im, col, row, &dr, &dg, &db); - fgrey = (0.30 * dr + 0.59 * dg + 0.11 * db); + fgrey = (0.30F * dr + 0.59F * dg + 0.11F * db); grey = (unsigned char)(255. * fgrey); gl2psWriteByte(grey); } @@ -2176,7 +2447,7 @@ else if(nbit == 2){ /* color, 2 bits for r and g and b; rgbs following each other */ nrgb = width * 3; nbits = nrgb * nbit; - nbyte = nbits/8; + nbyte = nbits / 8; if((nbyte * 8) != nbits) nbyte++; gl2psPrintf("/rgbstr %d string def\n", nbyte); gl2psPrintf("%d %d %d\n", width, height, nbit); @@ -2263,7 +2534,7 @@ else if(nbit == 4){ /* color, 4 bits for r and g and b; rgbs following each other */ nrgb = width * 3; nbits = nrgb * nbit; - nbyte = nbits/8; + nbyte = nbits / 8; if((nbyte * 8) != nbits) nbyte++; gl2psPrintf("/rgbstr %d string def\n", nbyte); gl2psPrintf("%d %d %d\n", width, height, nbit); @@ -2343,7 +2614,7 @@ if((width <= 0) || (height <= 0)) return; - size = height + height * (width-1)/8; + size = height + height * (width - 1) / 8; gl2psPrintf("gsave\n"); gl2psPrintf("%.2f %.2f translate\n", x, y); @@ -2360,25 +2631,11 @@ { time_t now; -#ifdef GL2PS_HAVE_ZLIB - /* since compression is not part of the PostScript standard, we - simply generate a gzipped PostScript file ("ps.gz" or - "eps.gz") */ - - char tmp[10] = {'\x1f', '\x8b', /* magic numbers: 0x1f, 0x8b */ - 8, /* compression method: Z_DEFLATED */ - 0, /* flags */ - 0, 0, 0, 0, /* time */ - 2, /* extra flags: max compression */ - '\x03'}; /* OS code: 0x03 (Unix) */ + /* Since compression is not part of the PostScript standard, + compressed PostScript files are just gzipped PostScript files + ("ps.gz" or "eps.gz") */ + gl2psPrintGzipHeader(); - if(gl2ps->options & GL2PS_COMPRESS){ - gl2psSetupCompress(); - /* add the gzip file header */ - fwrite(tmp, 10, 1, gl2ps->stream); - } -#endif - time(&now); if(gl2ps->format == GL2PS_PS){ @@ -2389,13 +2646,14 @@ } gl2psPrintf("%%%%Title: %s\n" - "%%%%Creator: GL2PS %d.%d.%d, (C) 1999-2006 Christophe Geuzaine <ge...@ge...>\n" + "%%%%Creator: GL2PS %d.%d.%d%s, %s\n" "%%%%For: %s\n" "%%%%CreationDate: %s" "%%%%LanguageLevel: 3\n" "%%%%DocumentData: Clean7Bit\n" "%%%%Pages: 1\n", - gl2ps->title, GL2PS_MAJOR_VERSION, GL2PS_MINOR_VERSION, GL2PS_PATCH_VERSION, + gl2ps->title, GL... [truncated message content] |
From: <pa...@us...> - 2009-12-04 08:44:22
|
Revision: 763 http://xcas.svn.sourceforge.net/xcas/?rev=763&view=rev Author: parisse Date: 2009-12-04 08:43:37 +0000 (Fri, 04 Dec 2009) Log Message: ----------- Modified Paths: -------------- trunk/giac-xcas/giac/src/Editeur.cc trunk/giac-xcas/giac/src/Editeur.h trunk/giac-xcas/giac/src/Equation.cc trunk/giac-xcas/giac/src/Help1.cc trunk/giac-xcas/giac/src/History.cc trunk/giac-xcas/giac/src/Input.cc trunk/giac-xcas/giac/src/Input.h trunk/giac-xcas/giac/src/Tableur.cc trunk/giac-xcas/giac/src/Xcas1.cc trunk/giac-xcas/giac/src/Xcas1.h trunk/giac-xcas/giac/src/gen.cc trunk/giac-xcas/giac/src/global.cc trunk/giac-xcas/giac/src/global.h trunk/giac-xcas/giac/src/help.cc trunk/giac-xcas/giac/src/hist.cxx trunk/giac-xcas/giac/src/hist.fl trunk/giac-xcas/giac/src/hist.h trunk/giac-xcas/giac/src/ifactor.cc trunk/giac-xcas/giac/src/ifactor.h trunk/giac-xcas/giac/src/intg.cc trunk/giac-xcas/giac/src/maple.cc trunk/giac-xcas/giac/src/plot.cc trunk/giac-xcas/giac/src/plot3d.cc trunk/giac-xcas/giac/src/poly.h trunk/giac-xcas/giac/src/prog.cc trunk/giac-xcas/giac/src/sym2poly.cc trunk/giac-xcas/giac/src/symbolic.cc trunk/giac-xcas/giac/src/tex.cc trunk/giac-xcas/giac/src/tex.h trunk/giac-xcas/giac/src/threaded.cc trunk/giac-xcas/giac/src/ti89.cc trunk/giac-xcas/giac/src/usual.cc Modified: trunk/giac-xcas/giac/src/Editeur.cc =================================================================== --- trunk/giac-xcas/giac/src/Editeur.cc 2009-11-24 10:21:38 UTC (rev 762) +++ trunk/giac-xcas/giac/src/Editeur.cc 2009-12-04 08:43:37 UTC (rev 763) @@ -25,6 +25,7 @@ #include <FL/fl_ask.H> #include <FL/Fl_File_Chooser.H> #include <FL/Fl_Return_Button.H> +#include <FL/Fl_Tooltip.H> #include <fstream> #include <vector> #include <algorithm> @@ -57,7 +58,7 @@ { FL_BLACK, FL_COURIER, 14 }, // A - Plain { FL_DARK_GREEN, FL_COURIER_ITALIC, 14 }, // B - Line comments { FL_DARK_GREEN, FL_COURIER_ITALIC, 14 }, // C - Block comments - { FL_BLUE, FL_COURIER, 14 }, // D - Strings + { FL_CYAN, FL_COURIER, 14 }, // D - Strings { FL_DARK_RED, FL_COURIER, 14 }, // E - Directives { FL_DARK_RED, FL_COURIER_BOLD, 14 }, // F - Types { FL_BLUE, FL_COURIER_BOLD, 14 } // G - Keywords @@ -2083,9 +2084,28 @@ int Xcas_Text_Editor::handle(int event){ if (Fl::focus()!=this && event==FL_MOUSEWHEEL) return 0; + if (event==FL_FOCUS) + Xcas_input_focus=this; giac::context * contextptr = get_context(this); History_Pack * hp=get_history_pack(this); +#ifndef __APPLE__ if (event==FL_KEYBOARD){ + static string toolt; + if (Fl::event_text()[0]=='('){ + int pos=insert_position(); + int wbeg=buffer()->line_start(pos); + string s(motclef(buffer()->text_range(wbeg,pos))),ans; + if (!s.empty()){ + const aide & help=helpon(s,*giac::vector_aide_ptr,giac::language(hp?hp->contextptr:0),giac::vector_aide_ptr->size()); + toolt=writehelp(help,giac::language(hp?hp->contextptr:0)); + tooltip(toolt.c_str()); + Fl_Tooltip::enter_area(this,0,0,0,0,toolt.c_str()); + } + } + if (Fl::event_text()[0]==')'){ + tooltip(""); + } +#endif if (Fl::event_text()[0]==6){ cb_Editeur_Search(this,0); return 1; @@ -2094,42 +2114,43 @@ cb_Editeur_Next(this,0); return 1; } - if (Fl::event_text()[0]==9 || Fl::event_key()==FL_Escape){ + if (Fl::event_key()==FL_F+1){ int pos=insert_position(); - if (Fl::event_text()[0]==9){ - if (pos) - --pos; - char car=buffer()->character(pos); - if (car=='\n'){ - ++pos; - car=buffer()->character(pos); - } - if (isalphan(car)){ - int wbeg=buffer()->word_start(pos); - int wend=buffer()->word_end(pos); - pos=wend; - string s(buffer()->text_range(wbeg,wend)),ans; - int remove; - if (int ii=handle_tab(s,*giac::vector_completions_ptr,window()->w(),window()->h()/3,remove,ans)){ - window()->show(); - Fl::focus(this); - handle(FL_FOCUS); - pos=wend-remove; - buffer()->remove(pos,wend); - if (ii==1){ - buffer()->insert(pos,(ans+"()").c_str()); - insert_position(pos+ans.size()+1); - } - else { - buffer()->insert(pos,ans.c_str()); - insert_position(pos+ans.size()); - } - if (parent()) - parent_redraw(parent()); + if (pos) + --pos; + char car=buffer()->character(pos); + if (car=='\n'){ + ++pos; + car=buffer()->character(pos); + } + if (isalphan(car)){ + int wbeg=buffer()->word_start(pos); + int wend=buffer()->word_end(pos); + pos=wend; + string s(buffer()->text_range(wbeg,wend)),ans; + int remove; + if (int ii=handle_tab(s,*giac::vector_completions_ptr,window()->w(),window()->h()/3,remove,ans)){ + window()->show(); + Fl::focus(this); + handle(FL_FOCUS); + pos=wend-remove; + buffer()->remove(pos,wend); + if (ii==1){ + buffer()->insert(pos,(ans+"()").c_str()); + insert_position(pos+ans.size()+1); } - return 1; + else { + buffer()->insert(pos,ans.c_str()); + insert_position(pos+ans.size()); + } + if (parent()) + parent_redraw(parent()); } + return 1; } + } + if (Fl::event_text()[0]==9 || Fl::event_key()==FL_Escape){ + int pos=insert_position(); indent(pos); return 1; } // end if (...) tabulation test @@ -2151,8 +2172,10 @@ int res=Fl_Text_Editor::handle(event); if (event==FL_KEYBOARD) match(); - if (hp && changed()) + if (hp && changed()){ hp->modified(false); + clear_changed(); + } return res; } Modified: trunk/giac-xcas/giac/src/Editeur.h =================================================================== --- trunk/giac-xcas/giac/src/Editeur.h 2009-11-24 10:21:38 UTC (rev 762) +++ trunk/giac-xcas/giac/src/Editeur.h 2009-12-04 08:43:37 UTC (rev 763) @@ -58,6 +58,7 @@ public: Fl_Text_Buffer * stylebuf; Xcas_Text_Editor(int X, int Y, int W, int H, Fl_Text_Buffer * b,const char* l = 0); + virtual ~Xcas_Text_Editor() { if (Xcas_input_focus==this) Xcas_input_focus=0;} virtual int handle(int event); virtual void draw(); int indent(int pos); // indent current line, return new cursor position Modified: trunk/giac-xcas/giac/src/Equation.cc =================================================================== --- trunk/giac-xcas/giac/src/Equation.cc 2009-11-24 10:21:38 UTC (rev 762) +++ trunk/giac-xcas/giac/src/Equation.cc 2009-12-04 08:43:37 UTC (rev 763) @@ -3689,6 +3689,7 @@ const giac::context * contextptr = get_context(this); if (event==FL_FOCUS || event==FL_PUSH){ redraw(); + Xcas_input_focus=this; Fl::focus(this); if (event==FL_FOCUS) return 1; @@ -4257,6 +4258,8 @@ } Equation::~Equation(){ + if (Xcas_input_focus==this) + Xcas_input_focus=0; remove(hscroll); remove(vscroll); remove(menubar); Modified: trunk/giac-xcas/giac/src/Help1.cc =================================================================== --- trunk/giac-xcas/giac/src/Help1.cc 2009-11-24 10:21:38 UTC (rev 762) +++ trunk/giac-xcas/giac/src/Help1.cc 2009-12-04 08:43:37 UTC (rev 763) @@ -126,10 +126,10 @@ #else int dx=460,dy=260,l=20; #endif - if (Fl::focus() && Fl::focus()->window()){ - dx=max(dx,2*Fl::focus()->window()->w()/3); - dy=max(dy,2*Fl::focus()->window()->h()/3); - l=Fl::focus()->window()->labelsize(); + if (xcas::Xcas_input_focus && xcas::Xcas_input_focus->window()){ + dx=max(dx,2*xcas::Xcas_input_focus->window()->w()/3); + dy=max(dy,2*xcas::Xcas_input_focus->window()->h()/3); + l=xcas::Xcas_input_focus->window()->labelsize(); } l += 6; w = new Fl_Window(dx,dy); Modified: trunk/giac-xcas/giac/src/History.cc =================================================================== --- trunk/giac-xcas/giac/src/History.cc 2009-11-24 10:21:38 UTC (rev 762) +++ trunk/giac-xcas/giac/src/History.cc 2009-12-04 08:43:37 UTC (rev 763) @@ -451,7 +451,7 @@ } History_Fold * get_history_fold_focus(const Fl_Widget * wid){ - History_Fold * f=get_history_fold(Fl::focus()); + History_Fold * f=get_history_fold(xcas::Xcas_input_focus); return f?f:get_history_fold(wid); } @@ -1383,7 +1383,7 @@ bool History_Pack::save_as(const char * ch){ if (!_select) return false; - Fl_Widget * wid = Fl::focus(); + Fl_Widget * wid = xcas::Xcas_input_focus; // get filename string tmp="Save worksheet "; if (ch) @@ -1414,7 +1414,7 @@ _saving = true; FILE * f(fopen(filename,"w")); if (!f){ - string message=string("Unable to open file ")+filename; + string message=string(gettext("Unable to open file "))+filename; if (warn_user) fl_alert(message.c_str()); cerr << message << endl; @@ -1423,7 +1423,7 @@ url=0; } if (History_Fold * hf=get_history_fold(this)){ - hf->label("Unnammed"); + hf->label(gettext("Unnamed")); } _saving = false; return false; @@ -1551,7 +1551,7 @@ out.close(); History_Fold * o = get_history_fold(this); if (o){ - o->pack->set_sel_begin(Fl::focus()); + o->pack->set_sel_begin(xcas::Xcas_input_focus); int pos=o->pack->_sel_begin; Fl_Widget * e=new_program(max(o->pack->w()-o->pack->_printlevel_w,1),o->h()/2,o->pack); change_group_fontsize(e,o->labelsize()); @@ -1769,7 +1769,7 @@ History_Pack * hp=get_history_pack(q); if (hp){ hp->_sel_begin=-1; - hp->set_sel_begin(Fl::focus()); + hp->set_sel_begin(xcas::Xcas_input_focus); if (hp->_sel_begin<hp->children()-1){ Fl_Widget * w=hp->child(hp->_sel_begin+1); if (Fl_Group * g=dynamic_cast<Fl_Group *>(w)){ @@ -1804,7 +1804,7 @@ Fl_Group::current(0); Tableur_Group * t = new Tableur_Group(0,0,W,H,pack->labelsize(),0); if (t && t->table) - Fl::focus(t->table); + Fl::focus(t->table->input); set_colors(t); return t; } @@ -1878,6 +1878,8 @@ // add an entry if none are below or focus on next entry int N=p->find(g),M=p->children(); // Search in g->children if there is a Log_Output available + if (Xcas_DispG) + xcas_dispg_entries=Xcas_DispG->plot_instructions.size(); Log_Output * otmp=find_log_output(g); int deltalog=0; if (!otmp){ @@ -2248,7 +2250,7 @@ if (m && m->parent()){ History_Pack * hp = dynamic_cast<History_Pack *>(Fl::focus()); if (!hp) - hp=get_history_pack(Fl::focus()); + hp=get_history_pack(xcas::Xcas_input_focus); if (hp){ int a=hp->_sel_begin,b= hp->_sel_end; if (a>=0 && b>=0){ @@ -2286,7 +2288,7 @@ } void cb_New_Input(Fl_Widget* m , void*) { - Fl_Widget * w = Fl::focus(); + Fl_Widget * w = xcas::Xcas_input_focus; if (!dynamic_cast<Fl_Group *>(w)) w=parent_skip_scroll(parent_skip_scroll(w)); History_Pack * hp=dynamic_cast<History_Pack *>(w); @@ -2299,7 +2301,7 @@ } if (hp){ // hp->_sel_begin=-1; - hp->set_sel_begin(Fl::focus()); + hp->set_sel_begin(xcas::Xcas_input_focus); hp->add_entry(hp->_sel_begin); } } @@ -2308,7 +2310,7 @@ if (m && m->parent()){ History_Fold * o = get_history_fold_focus(m); if (o){ - o->pack->set_sel_begin(Fl::focus()); + o->pack->set_sel_begin(xcas::Xcas_input_focus); Fl_Widget * e=new_question_equation(max(o->pack->w()-o->pack->_printlevel_w,1),o->pack->labelsize()*3+10); change_group_fontsize(e,o->labelsize()); if (Equation * eq=dynamic_cast<Equation *>(e)) @@ -2324,7 +2326,7 @@ if (m && m->parent()){ History_Fold * o = get_history_fold_focus(m); if (o){ - o->pack->set_sel_begin(Fl::focus()); + o->pack->set_sel_begin(xcas::Xcas_input_focus); int pos=o->pack->_sel_begin; Fl_Widget * e=new_tableur(max(o->pack->w()-o->pack->_printlevel_w,1),max(o->h()-4*o->labelsize(),200),o->pack); change_group_fontsize(e,o->labelsize()); @@ -2377,7 +2379,7 @@ if (m && m->parent()){ History_Fold * o = get_history_fold_focus(m); if (o){ - o->pack->set_sel_begin(Fl::focus()); + o->pack->set_sel_begin(xcas::Xcas_input_focus); Fl_Widget * e=new_comment_input(max(o->pack->w()-o->pack->_printlevel_w,1),o->labelsize()+10); change_group_fontsize(e,o->labelsize()); o->pack->add_entry(o->pack->_sel_begin,e); @@ -2389,7 +2391,7 @@ if (m && m->parent()){ History_Fold * o = get_history_fold_focus(m); if (o){ - o->pack->set_sel_begin(Fl::focus()); + o->pack->set_sel_begin(xcas::Xcas_input_focus); int pos=o->pack->_sel_begin; Fl_Widget * e=new_program(max(o->pack->w()-o->pack->_printlevel_w,1),o->h()/2,o->pack); change_group_fontsize(e,o->labelsize()); @@ -2423,7 +2425,7 @@ if (m && m->parent()){ History_Fold * o = get_history_fold_focus(m); if (o){ - o->pack->set_sel_begin(Fl::focus()); + o->pack->set_sel_begin(xcas::Xcas_input_focus); int pos=o->pack->_sel_begin; Fl_Widget * e=new_figure(max(o->pack->w()-o->pack->_printlevel_w,1),max(4*o->h()/5,340),o->pack,dim3,approx); change_group_fontsize(e,o->labelsize()); @@ -2466,7 +2468,7 @@ if (m && m->parent()){ History_Fold * o = get_history_fold_focus(m); if (o){ - o->pack->set_sel_begin(Fl::focus()); + o->pack->set_sel_begin(xcas::Xcas_input_focus); int pos=o->pack->_sel_begin; Fl_Widget * e=new_logo(max(o->pack->w()-o->pack->_printlevel_w,1),o->h()/2,o->pack); change_group_fontsize(e,o->labelsize()); @@ -2479,7 +2481,7 @@ if (m && m->parent()){ History_Fold * o = get_history_fold_focus(m); if (o){ - o->pack->set_sel_begin(Fl::focus()); + o->pack->set_sel_begin(xcas::Xcas_input_focus); int pos=o->pack->_sel_begin; Fl_Group::current(o->pack); History_Fold * e=new History_Fold(0,0,max(o->pack->w()-o->pack->_printlevel_w,1),4*o->labelsize()); @@ -2591,7 +2593,7 @@ if (o ){ int n=o->pack->children(),i=n; o->pack->eval_below=true; - Fl_Widget * w =Fl::focus(); + Fl_Widget * w =xcas::Xcas_input_focus; for (;w;){ i=o->pack->find(w); if (i!=n) @@ -2621,7 +2623,7 @@ History_Fold * o = get_history_fold_focus(m); if (o ){ int n=o->pack->children(),i=n; - Fl_Widget * w =Fl::focus(); + Fl_Widget * w =xcas::Xcas_input_focus; for (;w;){ if (w->parent()==o->pack){ i=o->pack->find(w); @@ -2920,7 +2922,7 @@ Fl::e_text= petit_buffer; Fl::e_length=1; Fl::e_keysym='\n'; - fl_handle(Fl::focus()); + fl_handle(xcas::Xcas_input_focus); } @@ -3096,7 +3098,7 @@ if (!wid) return; int remove,ii; - Fl_Widget * w=Fl::focus(); + Fl_Widget * w=xcas::Xcas_input_focus; Fl_Window * wd=wid->window(); if ( (ii=xcas::handle_tab("",(*giac::vector_completions_ptr),wd->w()/3,wd->h()/3,remove,ans)) ){ @@ -3155,6 +3157,14 @@ if (xcas::interrupt_button){ xcas::History_Pack * hp =xcas::get_history_fold(b)->pack; std::cerr << "STOP pressed" << std::endl; + giac::ctrl_c=true; + for (int j=0;j<100;j++){ + if (!giac::ctrl_c){ + return; + } + usleep(10000); + } + giac::ctrl_c=false; if (giac::is_context_busy(hp?hp->contextptr:0)){ giac::kill_thread(true,hp?hp->contextptr:0); return; @@ -3247,7 +3257,7 @@ History_Fold::History_Fold(int X,int Y,int W,int H,int showmenu,const char*l):Fl_Group(X,Y,W,H,l),_folded(false),mode(0) { end(); if (!l) - label("Unnamed"); + label(gettext("Unnamed")); if (parent()){ labelsize(parent()->labelsize()); labelfont(parent()->labelfont()); @@ -3285,15 +3295,15 @@ group = new Fl_Group(X,Y+2,W,L-2); help_button = new No_Focus_Button(X,Y+1,L,L-2,"?"); help_button->callback((Fl_Callback*) History_cb_help_button); - help_button->tooltip("Online help and command completion"); - save_button = new Fl_Button(X+L,Y+1,3*L,L-2,"Save"); + help_button->tooltip(gettext("Online help and command completion")); + save_button = new Fl_Button(X+L,Y+1,3*L,L-2,gettext("Save")); save_button->color(Xcas_save_saved_color); save_button->callback((Fl_Callback*) History_cb_save_button); - save_button->tooltip("Save current session"); + save_button->tooltip(gettext("Save current session")); #ifdef IPAQ bnd_button = new No_Focus_Button(X+8*L,Y+1,2*L,L-2,"bnd"); bnd_button->callback((Fl_Callback*) History_cb_tex_button); - bnd_button->tooltip("Switch bandeau on or off"); + bnd_button->tooltip(gettext("Switch bandeau on or off")); current_status = new Fl_Button(X+6*L,Y+1,max(W-14*L,0),L-2); current_status->align(FL_ALIGN_LEFT|FL_ALIGN_CLIP |FL_ALIGN_INSIDE); #else @@ -3303,12 +3313,12 @@ current_status->label(""); current_status->labelfont(FL_HELVETICA_ITALIC); current_status->callback((Fl_Callback*) History_cb_current_status); - current_status->tooltip("Current CAS status. Click to modify"); + current_status->tooltip(gettext("Current CAS status. Click to modify")); stop_button = new No_Focus_Button(current_status->x()+current_status->w(),current_status->y(),3*L,L-2); stop_button->label("STOP"); stop_button->callback((Fl_Callback*) History_cb_stop_button); stop_button->labelcolor(FL_RED); - stop_button->tooltip("Interrupt current computation"); + stop_button->tooltip(gettext("Interrupt current computation")); xcas::Xcas_Cancel=stop_button; // FIXME when history fold destroyed keyboard_button = new No_Focus_Button(stop_button->x()+stop_button->w(),Y+1,3*L,L-2,"Kbd"); keyboard_button->callback((Fl_Callback*) History_cb_keyboard_button); @@ -3320,7 +3330,7 @@ close_button = new Fl_Button(keyboard_button->x()+keyboard_button->w()+L,stop_button->y(),L,L-2); close_button->label("X"); close_button->callback((Fl_Callback*) hf_Kill); - close_button->tooltip("Close current session"); + close_button->tooltip(gettext("Close current session")); group->end(); group->resizable(current_status); Fl_Group::add(group); Modified: trunk/giac-xcas/giac/src/Input.cc =================================================================== --- trunk/giac-xcas/giac/src/Input.cc 2009-11-24 10:21:38 UTC (rev 762) +++ trunk/giac-xcas/giac/src/Input.cc 2009-12-04 08:43:37 UTC (rev 763) @@ -33,6 +33,7 @@ #include <FL/Fl_File_Chooser.H> #include <FL/Fl_Hold_Browser.H> #include <FL/Fl_Return_Button.H> +#include <FL/Fl_Tooltip.H> #include "Input.h" #include "History.h" #include "Xcas1.h" @@ -67,11 +68,13 @@ int Multiline_Input_tab::count=0; Fl_Help_Dialog * Xcas_help_window = new Fl_Help_Dialog(); + Fl_Widget * Xcas_input_focus=0; void system_browser(const string & s){ int i=system(s.c_str()); if (i!=0){ - fl_alert(("Error running browser command "+s).c_str()); + fl_alert(("Switching to internal browser, error running browser command "+s).c_str()); + use_external_browser=false; } } @@ -100,6 +103,22 @@ } } + // return the last keyword of s + std::string motclef(const std::string & s){ + int l=s.size(); + int i=l-1; + for (;i>=0;i--){ + if (giac::isalphan(s[i])) + break; + } + l=i+1; + for (;i>=0;i--){ + if (!giac::isalphan(s[i])) + return s.substr(i+1,l-1-i); + } + return s.substr(0,l); + } + string findtooltip(const giac::gen & g){ string s,s1,s2; static const char * tooltip_tab[]={"Integer","Expression","Variable","Matrix","Function","String","Polynom","Vector","Point","List","List of point","List of reals","List of integers","Sequence of variables","Command",}; @@ -292,11 +311,11 @@ static Fl_Input * argtab[TAB_ARGS]={0,0,0,0,0,0}; int L=16; const giac::context * contextptr=giac::context0; - if (Fl::focus() && Fl::focus()->window()){ - dx=4*Fl::focus()->window()->w()/5; - dy=4*Fl::focus()->window()->h()/5; - L=Fl::focus()->labelsize()+2; - contextptr=get_context(Fl::focus()); + if (xcas::Xcas_input_focus && xcas::Xcas_input_focus->window()){ + dx=4*xcas::Xcas_input_focus->window()->w()/5; + dy=4*xcas::Xcas_input_focus->window()->h()/5; + L=xcas::Xcas_input_focus->labelsize()+2; + contextptr=get_context(xcas::Xcas_input_focus); } else { if (dx>500) @@ -769,8 +788,15 @@ return 1; } } - if (event==FL_FOCUS) - redraw(); + if (event==FL_FOCUS){ + Xcas_input_focus=this; + // Fl::focus(this); + // redraw(); + return Fl_Multiline_Input::handle(event); + } + if (event==FL_UNFOCUS){ + return Fl_Multiline_Input::handle(event); + } if (event==FL_PUSH && tableur) tableur->editing=true; if (g && event==FL_PASTE){ @@ -794,6 +820,8 @@ } } if (event==FL_KEYBOARD) { + static string toolt; + string str; int key=Fl::event_key(); if (Fl::event_text()){ int i=Fl::event_text()[0]; @@ -831,6 +859,21 @@ resize_nl(); return 1; } + break; +#ifndef __APPLE__ + case '(': + // Fl::belowmouse(this); + str=motclef(string(value()).substr(0,position())); + if (!str.empty()){ + toolt=writehelp(helpon(str,*giac::vector_aide_ptr,giac::language(g?g->contextptr:0),giac::vector_aide_ptr->size()),giac::language(g?g->contextptr:0)); + tooltip(toolt.c_str()); + Fl_Tooltip::enter_area(this,0,0,0,0,toolt.c_str()); + } + break; + case ')': + tooltip(""); + break; +#endif } } if (key==FL_Enter || key==FL_KP_Enter){ @@ -1027,7 +1070,7 @@ return 1; } } - if (!completion_tab || event!=FL_KEYBOARD || Fl::event_text()[0]!=9 ){ + if (!completion_tab || event!=FL_KEYBOARD || (Fl::event_text()[0]!=9 && Fl::event_key()!=FL_F+1)){ const char * ch = value(); unsigned l=strlen(ch); unsigned p=position(); @@ -1048,8 +1091,6 @@ int remove; if (int ii=handle_tab(s,*completion_tab,window()->w(),window()->h()/3,remove,ans)){ window()->show(); - Fl::focus(this); - handle(FL_FOCUS); cut(-remove); if (ii==1){ insert((ans+"()").c_str()); @@ -1062,6 +1103,8 @@ if (parent()) parent_redraw(parent()); } + Fl::focus(this); + handle(FL_FOCUS); return 1; } @@ -1248,8 +1291,15 @@ } int Comment_Multiline_Input::in_handle(int event){ - if (event==FL_FOCUS) - redraw(); + if (event==FL_FOCUS){ + Xcas_input_focus=this; + // Fl::focus(this); + // redraw(); + return Fl_Multiline_Input::handle(event); + } + if (event==FL_UNFOCUS){ + return Fl_Multiline_Input::handle(event); + } if (event==FL_KEYBOARD){ redraw(); int key=Fl::event_key(); Modified: trunk/giac-xcas/giac/src/Input.h =================================================================== --- trunk/giac-xcas/giac/src/Input.h 2009-11-24 10:21:38 UTC (rev 762) +++ trunk/giac-xcas/giac/src/Input.h 2009-12-04 08:43:37 UTC (rev 763) @@ -39,6 +39,8 @@ // alert if the command is not successfull void system_browser(const std::string & s); + // return the last keyword of s + std::string motclef(const std::string & s); #ifdef HAVE_LIBFLTK @@ -55,6 +57,8 @@ void Multiline_default_callback(Fl_Widget * w,void *); + extern Fl_Widget * Xcas_input_focus; + class Multiline_Input_tab:public Fl_Multiline_Input { static int count; static std::vector<std::string> history; @@ -71,6 +75,7 @@ void set_g(const giac::gen & g); void match(); // Show matching parenthesis, [ , etc. region Multiline_Input_tab(int x,int y,int w,int h,const char * l= 0); + virtual ~Multiline_Input_tab() { if (Xcas_input_focus==this) Xcas_input_focus=0;} void resize_nl(); // resize input and parents according to number of lines bool need_nl(); // return true if current line up to position is too large to be displayed @@ -100,6 +105,7 @@ Comment_Multiline_Input(int x,int y,int w,int h,const char * l=0); virtual FL_EXPORT int handle(int); virtual FL_EXPORT int in_handle(int); + virtual ~Comment_Multiline_Input() { if (Xcas_input_focus==this) Xcas_input_focus=0;} }; // Convert a pnt to a user-readable string Modified: trunk/giac-xcas/giac/src/Tableur.cc =================================================================== --- trunk/giac-xcas/giac/src/Tableur.cc 2009-11-24 10:21:38 UTC (rev 762) +++ trunk/giac-xcas/giac/src/Tableur.cc 2009-12-04 08:43:37 UTC (rev 763) @@ -233,6 +233,7 @@ } update_status(); } + Fl::focus(input); } void Flv_Table_Gen::spread_erase(int nrows,int ncols){ @@ -2439,7 +2440,7 @@ Flv_Table_Gen * tg=find_table_brother(m); if (!tg) return; const giac::context * contextptr = get_context(tg); - tg->set_graphic(gen("diagramme_batons",contextptr),gettext("Batons: column 1: legends, column 2: data")); + tg->set_graphic(gen("bar_plot",contextptr),gettext("Bar_plot: column 1: legends, column 2: data")); } void cb_Tableur_Scatterplot(Fl_Menu_* m , void*) { @@ -2899,7 +2900,7 @@ {gettext("Random values"), 0, (Fl_Callback *) cb_Tableur_ranm, 0, 0, 0, 0, 14, 56}, {gettext("Sequences"), 0, 0, 0, 64, 0, 0, 14, 56}, {gettext("Recurrent sequence"), 0, (Fl_Callback *) cb_Tableur_Tableseq, 0, 0, 0, 0, 14, 56}, - {gettext("batons"), 0, (Fl_Callback *) cb_Tableur_batons, 0, 0, 0, 0, 14, 56}, + {gettext("bar_plot"), 0, (Fl_Callback *) cb_Tableur_batons, 0, 0, 0, 0, 14, 56}, {gettext("plotlist"), 0, (Fl_Callback *) cb_Tableur_plotlist, 0, 0, 0, 0, 14, 56}, {gettext("Polygonscatterplot"), 0, (Fl_Callback *) cb_Tableur_Polygonscatterplot, 0, 0, 0, 0, 14, 56}, {gettext("Scatterplot"), 0, (Fl_Callback *) cb_Tableur_Scatterplot, 0, 0, 0, 0, 14, 56}, @@ -2907,7 +2908,7 @@ {0}, {gettext("1-d stats"), 0, 0, 0, 64, 0, 0, 14, 56}, {gettext("camembert"), 0, (Fl_Callback *) cb_Tableur_camembert, 0, 0, 0, 0, 14, 56}, - {gettext("batons"), 0, (Fl_Callback *) cb_Tableur_batons, 0, 0, 0, 0, 14, 56}, + {gettext("bar_plot"), 0, (Fl_Callback *) cb_Tableur_batons, 0, 0, 0, 0, 14, 56}, {gettext("plotlist"), 0, (Fl_Callback *) cb_Tableur_plotlist, 0, 0, 0, 0, 14, 56}, {gettext("Boxwhisker"), 0, (Fl_Callback *) cb_Tableur_Boxwhisker, 0, 0, 0, 0, 14, 56}, {gettext("Classes (data or data,eff)"), 0, (Fl_Callback *) cb_Tableur_Classes, 0, 0, 0, 0, 14, 56}, @@ -3026,6 +3027,7 @@ row_style[-1].align(FL_ALIGN_CLIP); col_style[-1].align(FL_ALIGN_CLIP); update_status(); + Fl::focus(input); } void Flv_Table_Gen::draw_cell( int Offset, int &X, int &Y, int &W, int &H, int R, int C ){ Modified: trunk/giac-xcas/giac/src/Xcas1.cc =================================================================== --- trunk/giac-xcas/giac/src/Xcas1.cc 2009-11-24 10:21:38 UTC (rev 762) +++ trunk/giac-xcas/giac/src/Xcas1.cc 2009-12-04 08:43:37 UTC (rev 763) @@ -94,6 +94,7 @@ Enlargable_Multiline_Output *Xcas_help_output =0 ; xcas::Graph2d *Xcas_DispG=0; int show_xcas_dispg=0; + int xcas_dispg_entries=0; Fl_Window * Xcas_DispG_Window=0; Fl_Window * Xcas_Main_Window=0; Fl_Button *Xcas_DispG_Cancel=0; @@ -196,7 +197,7 @@ bool find_fold_autosave_function(bool warn_user){ History_Fold * hf=0; - Fl_Widget * w = Fl::focus(); + Fl_Widget * w = xcas::Xcas_input_focus; for (;w;){ if ( (hf=dynamic_cast<History_Fold *>(w)) ) break; @@ -246,9 +247,9 @@ if (status==2){ if (!Xcas_Debug_Window){ int dx,dy; - if (Fl::focus() && Fl::focus()->window()){ - dx=8*(2*Fl::focus()->window()->w()/24); - dy=11*(2*Fl::focus()->window()->h()/30); + if (xcas::Xcas_input_focus && xcas::Xcas_input_focus->window()){ + dx=8*(2*xcas::Xcas_input_focus->window()->w()/24); + dy=11*(2*xcas::Xcas_input_focus->window()->h()/30); } else { dx=400; @@ -476,8 +477,11 @@ } if (Xcas_DispG_Window){ if (show_xcas_dispg){ - if (show_xcas_dispg==2) + if (show_xcas_dispg==2){ + if (!Xcas_DispG_Window->visible()) + Xcas_DispG->autoscale(); Xcas_DispG_Window->show(); + } else Xcas_DispG_Window->hide(); show_xcas_dispg=0; @@ -1081,6 +1085,21 @@ if (Logo * logo=dynamic_cast<Logo *>(group)){ logo->redraw(); } + // show DispG? + if (hp->pretty_output && !Xcas_DispG_Window->visible()){ + int entries=Xcas_DispG->plot_instructions.size(); + if (entries>xcas_dispg_entries){ + if (resgraph){ + vecteur dispgv=vecteur(Xcas_DispG->plot_instructions.begin()+xcas_dispg_entries,Xcas_DispG->plot_instructions.end()),v1,v2; + aplatir(dispgv,v1); + aplatir(resgraph->plot_instructions,v2); + if (v1!=v2) + show_xcas_dispg=2; + } + else + show_xcas_dispg=2; + } + } // if hp has eval_below, call callback on next widget if (hp->eval_below) hp->next(hp_pos); @@ -2395,20 +2414,34 @@ fl_message(eval(v.front()._SYMBptr->feuille,contextptr).print(contextptr).c_str()); return plus_one; } - static Fl_Window * Plotfltk_w = new Fl_Window(240,300); + int initw,inith; + if (Xcas_input_focus && Xcas_input_focus->window()){ + initw=(Xcas_input_focus->window()->w()*3)/4; + inith=(Xcas_input_focus->window()->h()*3)/4; + } + else { + initw = 240; + inith = 320; + } + static Fl_Window * Plotfltk_w = new Fl_Window(initw,inith); int r; vecteur res; Fl_Window * w = Plotfltk_w ; w->end(); + int taillew=w->w(),tailleh=w->h(); + if (taillew<100) + taillew=100; + if (tailleh<100) + tailleh=100; + w->resize(w->x(),w->y(),taillew,tailleh); Fl_Group::current(w); - int taillew=w->w(); - if (taillew<100) - w->resize(w->x(),w->y(),100,w->h()); - static Fl_Button * button0 = new Fl_Button(160, 270, 70, 20); + static Fl_Button * button0 = new Fl_Button(2+(2*taillew)/3, tailleh-30, taillew/4, 20); button0->shortcut("^["); button0->label(gettext("Cancel")); - static Fl_Button * button1 = new Fl_Return_Button(70, 270, 70, 20); + static Fl_Button * button1 = new Fl_Return_Button(2+taillew/3, tailleh-30, taillew/4, 20); button1->label(gettext("OK")); + static Fl_Button * button2 = new Fl_Button(2, tailleh-30, taillew/4, 20); + button2->label(gettext("STOP")); // Now parse v int current_y=0; vector<Fl_Input *> vinput; @@ -2557,6 +2590,7 @@ else { if (o == button0) {r = 0; break;} if (o == button1) {r = 1; break;} + if (o == button2) {r = 2; break;} if (o == w) { r=0; break; } } } @@ -2672,7 +2706,9 @@ // delete button1; // delete button0; // delete w; - if (!r) + if (r==2) + return 0; + if (r==0) return undef; else return res; Modified: trunk/giac-xcas/giac/src/Xcas1.h =================================================================== --- trunk/giac-xcas/giac/src/Xcas1.h 2009-11-24 10:21:38 UTC (rev 762) +++ trunk/giac-xcas/giac/src/Xcas1.h 2009-12-04 08:43:37 UTC (rev 763) @@ -55,6 +55,7 @@ extern Fl_Button *Xcas_DispG_Cancel; extern Fl_Button *Xcas_Cancel; extern Fl_Double_Window * Xcas_Debug_Window; + extern int xcas_dispg_entries; #ifdef HAVE_LIBPTHREAD extern pthread_mutex_t interactive_mutex; Modified: trunk/giac-xcas/giac/src/gen.cc =================================================================== --- trunk/giac-xcas/giac/src/gen.cc 2009-11-24 10:21:38 UTC (rev 762) +++ trunk/giac-xcas/giac/src/gen.cc 2009-12-04 08:43:37 UTC (rev 763) @@ -68,12 +68,39 @@ // bool is_inevalf=false; - // FIXME GIAC_CONTEXT string last_evaled_function(GIAC_CONTEXT){ std::vector<const std::string *> & last =last_evaled_function_name(contextptr); if (last.empty() || !last.back()) return ""; - return *last.back()+" "; + string res= *last.back()+"("; + vecteur & lastarg= last_evaled_arg(contextptr); + if (!lastarg.empty()) + res += lastarg.back().print(contextptr); + res += ")"; + debug_struct * dbg = debug_ptr(contextptr); + if (!dbg->sst_at_stack.empty()){ + res += " in "; + gen pos=dbg->args_stack.back(); + string tmp; + if (pos.type==_VECT && pos._VECTptr->size()>=2){ + vecteur v(pos._VECTptr->begin()+1,pos._VECTptr->end()); + if (v.size()==1){ + if (v.front().type==_VECT && v.front()._VECTptr->empty()) + tmp=pos._VECTptr->front().print(contextptr)+"()"; + else + tmp=pos._VECTptr->front().print(contextptr)+"("+v.front().print(contextptr)+")"; + } + else + tmp = pos._VECTptr->front().print(contextptr)+"("+gen(v,_SEQ__VECT).print(contextptr)+")"; + } + else + tmp = pos.print(contextptr); + res += tmp; + res += " instruction #"; + res += print_INT_(dbg->current_instruction); + res += " error, try debug("+tmp+")"; + } + return res+"\n"; } void settypeerr(GIAC_CONTEXT){ Modified: trunk/giac-xcas/giac/src/global.cc =================================================================== --- trunk/giac-xcas/giac/src/global.cc 2009-11-24 10:21:38 UTC (rev 762) +++ trunk/giac-xcas/giac/src/global.cc 2009-12-04 08:43:37 UTC (rev 763) @@ -110,6 +110,14 @@ return _last_evaled_function_name_; } + vecteur _last_evaled_arg_; + vecteur & last_evaled_arg(GIAC_CONTEXT){ + if (contextptr && contextptr->globalptr ) + return contextptr->globalptr->_last_evaled_arg_; + else + return _last_evaled_arg_; + } + int _language_=0; int & language(GIAC_CONTEXT){ if (contextptr && contextptr->globalptr ) @@ -2108,6 +2116,9 @@ case 3: return "es/"; break; + case 4: + return "el/"; + break; default: return "local/"; } @@ -2124,6 +2135,9 @@ case 3: return "doc/es/"; break; + case 4: + return "doc/el/"; + break; default: return "doc/local/"; } @@ -2213,6 +2227,8 @@ return 2; if (s=="sp" || s=="es") return 3; + if (s=="el") + return 4; return 0; } @@ -2748,6 +2764,36 @@ delete debug_localvars; } + debug_struct & debug_struct::operator =(const debug_struct & dbg){ + indent_spaces=dbg.indent_spaces; + args_stack=dbg.args_stack; + debug_breakpoint=dbg.debug_breakpoint; + debug_watch=dbg.debug_watch ; + debug_mode=dbg.debug_mode; + sst_mode=dbg.sst_mode ; + sst_in_mode=dbg.sst_in_mode ; + debug_allowed=dbg.debug_allowed; + current_instruction_stack=dbg.current_instruction_stack; + current_instruction=dbg.current_instruction; + sst_at_stack=dbg.sst_at_stack; + sst_at=dbg.sst_at; + if (debug_info_ptr) + delete debug_info_ptr; + debug_info_ptr=new gen(dbg.debug_info_ptr?*dbg.debug_info_ptr:0) ; + if (fast_debug_info_ptr) + delete fast_debug_info_ptr; + fast_debug_info_ptr= new gen(dbg.fast_debug_info_ptr?*dbg.fast_debug_info_ptr:0); + if (debug_prog_name) + delete debug_prog_name; + debug_prog_name=new gen(dbg.debug_prog_name?*dbg.debug_prog_name:0); + if (debug_localvars) + delete debug_localvars; + debug_localvars=new gen(dbg.debug_localvars?*dbg.debug_localvars:0); + debug_refresh=dbg.debug_refresh; + debug_contextptr=dbg.debug_contextptr; + return *this; + } + debug_struct _debug_data; debug_struct * debug_ptr(GIAC_CONTEXT){ Modified: trunk/giac-xcas/giac/src/global.h =================================================================== --- trunk/giac-xcas/giac/src/global.h 2009-11-24 10:21:38 UTC (rev 762) +++ trunk/giac-xcas/giac/src/global.h 2009-12-04 08:43:37 UTC (rev 763) @@ -235,6 +235,7 @@ context * debug_contextptr; debug_struct(); ~debug_struct(); + debug_struct & operator =(const debug_struct & dbg); }; typedef void (* giac_callback)(const giac::gen & ,void * ); @@ -334,6 +335,7 @@ #endif int _language_; std::vector<const std::string *> _last_evaled_function_name_; + vecteur _last_evaled_arg_; int _max_sum_sqrt_; int _max_sum_add_; logo_turtle _turtle_; @@ -376,6 +378,7 @@ extern std::vector<context *> context_list; std::vector<const std::string *> & last_evaled_function_name(GIAC_CONTEXT); + vecteur & last_evaled_arg(GIAC_CONTEXT); bool make_thread(const giac::gen & g,int level,const giac_callback & f,void * f_param,const context * contextptr); Modified: trunk/giac-xcas/giac/src/help.cc =================================================================== --- trunk/giac-xcas/giac/src/help.cc 2009-11-24 10:21:38 UTC (rev 762) +++ trunk/giac-xcas/giac/src/help.cc 2009-12-04 08:43:37 UTC (rev 763) @@ -95,6 +95,7 @@ int score(const string & s,const string & t){ int ls=s.size(),lt=t.size(); + if (!ls) return -1; vector<int> cur_l, new_l(lt+1,0); for (int j=0;j<=lt;++j) cur_l.push_back(-j); Modified: trunk/giac-xcas/giac/src/hist.cxx =================================================================== --- trunk/giac-xcas/giac/src/hist.cxx 2009-11-24 10:21:38 UTC (rev 762) +++ trunk/giac-xcas/giac/src/hist.cxx 2009-12-04 08:43:37 UTC (rev 763) @@ -121,7 +121,7 @@ s += "Java interface: Loic Le Coq\n"; s += "OpenOffice interface: Christophe Devalland, Serge Moutou\n"; s += "Tutorial (dxcas) with B. Ycart\n"; - s += "Greek localization, Alkiviadis Akritas et al.\n"; + s += "Greek localization, Alkiviadis Akritas, Eugenia Kelepesi-Akritas, George Nasopoulos\n"; s += "Spanish localization, J. Manrique Lopez\n"; s += "Debian package: Carlos Enrique Carleos Artime\n"; s += "Mac OS X port thanks to Jean-Yves Avenard and IREM Grenoble\n"; @@ -160,7 +160,7 @@ void rpn_button(xcas::No_Focus_Button * wid,int i) { unsigned si=rpn_menu_page*6+i; giac::gen e; - const giac::context * contextptr = xcas::get_context(Fl::focus()); + const giac::context * contextptr = xcas::get_context(xcas::Xcas_input_focus); if (rpn_menu.size()>si){ e=rpn_menu[si]; if ( (e.type==giac::_VECT) && (e._VECTptr->size()==2)) @@ -183,7 +183,7 @@ } catch (std::runtime_error & err) { } - xcas::Equation * eqwptr=dynamic_cast<xcas::Equation *> (Fl::focus()); + xcas::Equation * eqwptr=dynamic_cast<xcas::Equation *> (xcas::Xcas_input_focus); xcas::History_Pack * hp=get_history_pack(eqwptr); const giac::context * cptr=hp?hp->contextptr:0; if (eqwptr && e.is_symb_of_sommet(giac::at_program) ){ @@ -202,14 +202,14 @@ return; } if (e.subtype) - xcas::in_Xcas_input_1arg(Fl::focus(),e._FUNCptr->ptr->s.c_str(),false); + xcas::in_Xcas_input_1arg(xcas::Xcas_input_focus,e._FUNCptr->ptr->s.c_str(),false); else - xcas::in_Xcas_input_1arg(Fl::focus(),(e._FUNCptr->ptr->s+" ").c_str(),false); + xcas::in_Xcas_input_1arg(xcas::Xcas_input_focus,(e._FUNCptr->ptr->s+" ").c_str(),false); return; } // end e.type==FUNC std::string s=e.print(); if (!s.empty()) - xcas::in_Xcas_input_char(Fl::focus(),s.c_str(),s[0]); + xcas::in_Xcas_input_char(xcas::Xcas_input_focus,s.c_str(),s[0]); } void show_rpn_menu(unsigned i) { @@ -614,7 +614,7 @@ menu_buffer = m->text(); int pos=menu_buffer.find(':'); if (pos>0 && pos<menu_buffer.size()) menu_buffer=menu_buffer.substr(0,pos); - Fl_Widget * f = Fl::focus(); + Fl_Widget * f = xcas::Xcas_input_focus; const giac::context * contextptr = xcas::get_context(f); giac::gen tmp(menu_buffer,contextptr); if (Xcas_automatic_help_browser->value()) @@ -662,7 +662,7 @@ if (pos>0 && pos<menu_buffer.size()) menu_buffer=menu_buffer.substr(0,pos); static std::string ans; int remove,ii; - Fl_Widget * w=Fl::focus(); + Fl_Widget * w=xcas::Xcas_input_focus; Fl_Window * wd=wid->window(); if ( (ii=xcas::handle_tab(menu_buffer,(*giac::vector_completions_ptr),wd->w()/3,wd->h()/3,remove,ans)) ){ @@ -985,11 +985,11 @@ } static void cb_Xcas_Undo(Fl_Menu_*, void*) { - if (xcas::get_history_pack(Fl::focus())) xcas::History_cb_Undo(Fl::focus(),0); else xcas::History_cb_Undo(Xcas_current_session(),0); + if (xcas::get_history_pack(xcas::Xcas_input_focus)) xcas::History_cb_Undo(xcas::Xcas_input_focus,0); else xcas::History_cb_Undo(Xcas_current_session(),0); } static void cb_Xcas_Redo(Fl_Menu_*, void*) { - if (xcas::get_history_pack(Fl::focus())) xcas::History_cb_Redo(Fl::focus(),0); else xcas::History_cb_Redo(Xcas_current_session(),0); + if (xcas::get_history_pack(xcas::Xcas_input_focus)) xcas::History_cb_Redo(xcas::Xcas_input_focus,0); else xcas::History_cb_Redo(Xcas_current_session(),0); } static void cb_Xcas_Paste(Fl_Menu_*, void*) { @@ -1002,13 +1002,13 @@ static void cb_Xcas_Tex_Selection(Fl_Menu_*, void*) { static std::string s; giac::gen g; - const giac::context * contextptr=xcas::get_context(Fl::focus()); + const giac::context * contextptr=xcas::get_context(xcas::Xcas_input_focus); try { - if (xcas::Equation * ptr=dynamic_cast<xcas::Equation *> (Fl::focus())) + if (xcas::Equation * ptr=dynamic_cast<xcas::Equation *> (xcas::Xcas_input_focus)) g=ptr->get_selection(); - if (xcas::Flv_Table_Gen * ptr=dynamic_cast<xcas::Flv_Table_Gen *> (Fl::focus())) + if (xcas::Flv_Table_Gen * ptr=dynamic_cast<xcas::Flv_Table_Gen *> (xcas::Xcas_input_focus)) g=extractmatricefromsheet(ptr->selected); - if (Fl_Input_ * ptr=dynamic_cast<Fl_Input *>(Fl::focus())){ + if (Fl_Input_ * ptr=dynamic_cast<Fl_Input *>(xcas::Xcas_input_focus)){ int i=ptr->position(),j=ptr->mark(); if (i>j) std::swap<int>(i,j); s=ptr->value(); @@ -1033,10 +1033,10 @@ static void cb_Xcas_Add_Parameter(Fl_Menu_*, void*) { std::string tmp,name; double tmin,tmax,tcur,tstep; -Fl_Widget * wid = Fl::focus(); +Fl_Widget * wid = xcas::Xcas_input_focus; int pos; xcas::History_Pack * hp=xcas::get_history_pack(wid,pos); -if (hp && xcas::figure_param_dialog(Fl::focus(),false,tmin,tmax,tcur,tstep,name,false,tmp)){ +if (hp && xcas::figure_param_dialog(xcas::Xcas_input_focus,false,tmin,tmax,tcur,tstep,name,false,tmp)){ if (hp){ hp->add_entry(pos); hp->set_value(pos,tmp,true); @@ -1274,7 +1274,7 @@ static void cb_Xcas_help_index(Fl_Menu_*, void*) { static std::string ans; int remove,ii; - Fl_Widget * w=Fl::focus(); + Fl_Widget * w=xcas::Xcas_input_focus; if ( (ii=xcas::handle_tab("",(*giac::vector_completions_ptr),Xcas_Main_Window_->w()/3,Xcas_Main_Window_->h()/3,remove,ans)) ){ if (ii==1) @@ -1483,14 +1483,18 @@ xcas::History_cb_New_Comment_Input(Xcas_current_session(),0); } -static void cb_Xcas_Add_Tableur(Fl_Menu_*, void*) { - xcas::History_cb_New_Tableur(Xcas_current_session(),0); +static void cb_Xcas_Add_Expression(Fl_Menu_*, void*) { + xcas::History_cb_New_Equation(Xcas_current_session(),0); } +static void cb_Xcas_Add_Program(Fl_Menu_*, void*) { + xcas::History_cb_New_Program(Xcas_current_session(),0); +} + static void cb_Xcas_help_attributs(Fl_Menu_*, void*) { static int res=0; bool untranslate=false,approx=false,formel=false; -Fl_Widget * w=Fl::focus(); +Fl_Widget * w=xcas::Xcas_input_focus; Fl_Input_ * i=dynamic_cast<Fl_Input_*>(w); if (i && xcas::change_line_type(res,false,approx,"Attributs",false,formel,untranslate,false, Xcas_Main_Window_->labelsize())!=1){ @@ -1502,7 +1506,7 @@ static void cb_Xcas_help_plot(Fl_Menu_*, void*) { int pos; std::string arg; -xcas::History_Pack * f=xcas::get_history_pack(Fl::focus(),pos); +xcas::History_Pack * f=xcas::get_history_pack(xcas::Xcas_input_focus,pos); if (f && tablefunc_dialog(f,arg,true,0,gettext("Graph of a function"))){ f->add_entry(pos); arg="plotfunc(" +arg+")"; @@ -1513,7 +1517,7 @@ static void cb_Xcas_help_plotparam2d(Fl_Menu_*, void*) { int pos; std::string arg; -xcas::History_Pack * f=xcas::get_history_pack(Fl::focus(),pos); +xcas::History_Pack * f=xcas::get_history_pack(xcas::Xcas_input_focus,pos); if (f && plotparam_dialog(f,arg,0)){ f->add_entry(pos); arg="plotparam(" +arg+")"; @@ -1524,7 +1528,7 @@ static void cb_Xcas_help_plotpolar(Fl_Menu_*, void*) { int pos; std::string arg; -xcas::History_Pack * f=xcas::get_history_pack(Fl::focus(),pos); +xcas::History_Pack * f=xcas::get_history_pack(xcas::Xcas_input_focus,pos); if (f && plotparam_dialog(f,arg,-1)){ f->add_entry(pos); arg="plotpolar(" +arg+")"; @@ -1535,7 +1539,7 @@ static void cb_Xcas_help_plotarea(Fl_Menu_*, void*) { int pos; std::string arg; -xcas::History_Pack * f=xcas::get_history_pack(Fl::focus(),pos); +xcas::History_Pack * f=xcas::get_history_pack(xcas::Xcas_input_focus,pos); if (f && tablefunc_dialog(f,arg,true,0,gettext("Area under curve"))){ f->add_entry(pos); arg="plotarea(" +arg+")"; @@ -1546,7 +1550,7 @@ static void cb_Xcas_help_plotimplicit(Fl_Menu_*, void*) { int pos; std::string arg; -xcas::History_Pack * f=xcas::get_history_pack(Fl::focus(),pos); +xcas::History_Pack * f=xcas::get_history_pack(xcas::Xcas_input_focus,pos); if (f && plotparam_dialog(f,arg,3)){ f->add_entry(pos); arg="plotimplicit(" +arg+")"; @@ -1557,7 +1561,7 @@ static void cb_Xcas_help_plot3d(Fl_Menu_*, void*) { int pos; std::string arg; -xcas::History_Pack * f=xcas::get_history_pack(Fl::focus(),pos); +xcas::History_Pack * f=xcas::get_history_pack(xcas::Xcas_input_focus,pos); if (f && tablefunc_dialog(f,arg,true,1,gettext("Graph of a function"))){ f->add_entry(pos); arg="plotfunc(" +arg+")"; @@ -1568,7 +1572,7 @@ static void cb_Xcas_help_plotparam3d(Fl_Menu_*, void*) { int pos; std::string arg; -xcas::History_Pack * f=xcas::get_history_pack(Fl::focus(),pos); +xcas::History_Pack * f=xcas::get_history_pack(xcas::Xcas_input_focus,pos); if (f && plotparam_dialog(f,arg,1)){ f->add_entry(pos); arg="plotparam(" +arg+")"; @@ -1579,7 +1583,7 @@ static void cb_Xcas_help_plotseq(Fl_Menu_*, void*) { int pos; std::string arg,u0param; -xcas::History_Pack * f=xcas::get_history_pack(Fl::focus(),pos); +xcas::History_Pack * f=xcas::get_history_pack(xcas::Xcas_input_focus,pos); if (f && tableseq_dialog(f,arg,true,gettext("Graph of a recurrent sequence"),u0param)){ f->add_entry(pos); arg=u0param+"; plotseq(" +arg+")"; @@ -1590,7 +1594,7 @@ static void cb_Xcas_help_plotfield(Fl_Menu_*, void*) { int pos; std::string arg; -xcas::History_Pack * f=xcas::get_history_pack(Fl::focus(),pos); +xcas::History_Pack * f=xcas::get_history_pack(xcas::Xcas_input_focus,pos); if (f && plotparam_dialog(f,arg,2)){ f->add_entry(pos); arg="plotfield(" +arg+")"; @@ -1601,7 +1605,7 @@ static void cb_Xcas_help_iplotode(Fl_Menu_*, void*) { int pos; std::string arg; -xcas::History_Pack * f=xcas::get_history_pack(Fl::focus(),pos); +xcas::History_Pack * f=xcas::get_history_pack(xcas::Xcas_input_focus,pos); if (f && plotparam_dialog(f,arg,2)){ f->add_entry(pos); arg="interactive_plotode(" +arg+")"; @@ -1625,14 +1629,10 @@ xcas::History_cb_New_Figure3dx(Xcas_current_session(),0); } -static void cb_Xcas_Add_Program(Fl_Menu_*, void*) { - xcas::History_cb_New_Program(Xcas_current_session(),0); +static void cb_Xcas_Add_Tableur(Fl_Menu_*, void*) { + xcas::History_cb_New_Tableur(Xcas_current_session(),0); } -static void cb_Xcas_Add_Expression(Fl_Menu_*, void*) { - xcas::History_cb_New_Equation(Xcas_current_session(),0); -} - static void cb_Xcas_Add_Logo(Fl_Menu_*, void*) { xcas::History_cb_New_Logo(Xcas_current_session(),0); } @@ -1836,9 +1836,15 @@ {gettext("egvl: Eigenvalues of a matrix"), 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, - {gettext("Spreadsheet"), 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0}, - {gettext("New spreadsheet"), 0x80074, (Fl_Callback*)cb_Xcas_Add_Tableur, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, + {gettext("Expression"), 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0}, + {gettext("New expression"), 0x80065, (Fl_Callback*)cb_Xcas_Add_Expression, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, {0,0,0,0,0,0,0,0,0}, + {gettext("Cmds"), 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0}, + {0,0,0,0,0,0,0,0,0}, + {gettext("Prg"), 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0}, + {gettext("New program"), 0x80070, (Fl_Callback*)cb_Xcas_Add_Program, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, + {gettext("debug: debug a program"), 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, + {0,0,0,0,0,0,0,0,0}, {gettext("Graphic"), 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0}, {gettext("Attributs"), 0, (Fl_Callback*)cb_Xcas_help_attributs, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, {gettext("Curves"), 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0}, @@ -1880,15 +1886,9 @@ {gettext("geo3d exact"), 0, (Fl_Callback*)cb_Xcas_Add_Figure3dx, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, - {gettext("Prg"), 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0}, - {gettext("New program"), 0x80070, (Fl_Callback*)cb_Xcas_Add_Program, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, - {gettext("debug: debug a program"), 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, + {gettext("Spreadsheet"), 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0}, + {gettext("New spreadsheet"), 0x80074, (Fl_Callback*)cb_Xcas_Add_Tableur, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, {0,0,0,0,0,0,0,0,0}, - {gettext("Expression"), 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0}, - {gettext("New expression"), 0x80065, (Fl_Callback*)cb_Xcas_Add_Expression, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, - {0,0,0,0,0,0,0,0,0}, - {gettext("Cmds"), 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0}, - {0,0,0,0,0,0,0,0,0}, {gettext("Phys"), 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0}, {0,0,0,0,0,0,0,0,0}, {gettext("Highschool"), 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0}, @@ -2259,7 +2259,7 @@ xcas::No_Focus_Button *Xcas_Racine_carree=(xcas::No_Focus_Button *)0; static void cb_Xcas_Racine_carree(xcas::No_Focus_Button*, void*) { - xcas::in_Xcas_input_1arg(Fl::focus(),"sqrt",true); + xcas::in_Xcas_input_1arg(xcas::Xcas_input_focus,"sqrt",true); } Fl_Group *Rewrite_keyboard=(Fl_Group *)0; @@ -2267,25 +2267,25 @@ xcas::No_Focus_Button *Xcas_approx_key=(xcas::No_Focus_Button *)0; static void cb_Xcas_approx_key(xcas::No_Focus_Button*, void*) { - xcas::in_Xcas_input_1arg(Fl::focus(),"approx",true); + xcas::in_Xcas_input_1arg(xcas::Xcas_input_focus,"approx",true); } xcas::No_Focus_Button *Xcas_simplify_key=(xcas::No_Focus_Button *)0; static void cb_Xcas_simplify_key(xcas::No_Focus_Button*, void*) { - xcas::in_Xcas_input_1arg(Fl::focus(),"simplify",true); + xcas::in_Xcas_input_1arg(xcas::Xcas_input_focus,"simplify",true); } xcas::No_Focus_Button *Xcas_factor_key=(xcas::No_Focus_Button *)0; static void cb_Xcas_factor_key(xcas::No_Focus_Button*, void*) { - xcas::in_Xcas_input_1arg(Fl::focus(),"factor",true); + xcas::in_Xcas_input_1arg(xcas::Xcas_input_focus,"factor",true); } xcas::No_Focus_Button *Xcas_convert_key=(xcas::No_Focus_Button *)0; static void cb_Xcas_convert_key(xcas::No_Focus_Button*, void*) { - xcas::in_Xcas_input_1arg(Fl::focus(),"convert",false); + xcas::in_Xcas_input_1arg(xcas::Xcas_input_focus,"convert",false); } Fl_Group *Xcas_calculus_group=(Fl_Group *)0; @@ -2406,7 +2406,7 @@ Fl::e_length=0; Fl::e_text=petit_buffer; Fl::e_keysym=FL_Escape; -xcas::fl_handle(Fl::focus()); +xcas::fl_handle(xcas::Xcas_input_focus); } xcas::No_Focus_Button *Xcas_Alpha=(xcas::No_Focus_Button *)0; @@ -2464,7 +2464,7 @@ Fl::e_length=0; Fl::e_text=petit_buffer; Fl::e_keysym=FL_BackSpace; - xcas::fl_handle(Fl::focus()); + xcas::fl_handle(xcas::Xcas_input_focus); } xcas::No_Focus_Button *Xcas_main_paste_button=(xcas::No_Focus_Button *)0; @@ -2481,7 +2481,7 @@ Fl::e_length=0; Fl::e_text=petit_buffer; Fl::e_keysym=FL_Enter; - xcas::fl_handle(Fl::focus()); + xcas::fl_handle(xcas::Xcas_input_focus); } Fl_Group *Xcas_Bandeau_Keys=(Fl_Group *)0; @@ -2795,6 +2795,12 @@ xcas::Graph2d *Xcas_DispG_=(xcas::Graph2d *)0; +Fl_Button *Xcas_DispG_ClrGraph=(Fl_Button *)0; + +static void cb_Xcas_DispG_ClrGraph(Fl_Button*, void*) { + Xcas_DispG_->clear(0); +} + Fl_Window* Xcas_run(int argc,char ** argv) { { Xcas_Main_Window_ = new Fl_Window(775, 615, gettext("Xcas New Interface")); { Xcas_main_menu = new Fl_Menu_Bar(0, 0, 775, 25); @@ -4491,7 +4497,8 @@ Xcas_DispG_Menu->align(Fl_Align(FL_ALIGN_CLIP)); Xcas_DispG_Menu->menu(menu_Xcas_DispG_Menu); } // Fl_Menu_Bar* Xcas_DispG_Menu - { Xcas_DispG_Cancel_ = new Fl_Button(95, 0, 445, 25, gettext("Click in graph or here to cancel")); + { Xcas_DispG_Cancel_ = new Fl_Button(220, 0, 365, 25, gettext("Click or Cancel")); + Xcas_DispG_Cancel_->tooltip(gettext("Click in graph or here to cancel")); Xcas_DispG_Cancel_->callback((Fl_Callback*)cb_Xcas_DispG_Cancel_); Xcas_DispG_Cancel_->align(Fl_Align(FL_ALIGN_CLIP)); } // Fl_Button* Xcas_DispG_Cancel_ @@ -4510,6 +4517,11 @@ } // xcas::Graph2d* Xcas_DispG_ Xcas_DispG_Tile->end(); } // Fl_Tile* Xcas_DispG_Tile + { Xcas_DispG_ClrGraph = new Fl_Button(95, 0, 125, 25, gettext("ClrGraph")); + Xcas_DispG_ClrGraph->tooltip(gettext("Clear DispG graphic")); + Xcas_DispG_ClrGraph->callback((Fl_Callback*)cb_Xcas_DispG_ClrGraph); + Xcas_DispG_ClrGraph->align(Fl_Align(FL_ALIGN_CLIP)); + } // Fl_Button* Xcas_DispG_ClrGraph Xcas_DispG_Window_->end(); Xcas_DispG_Window_->resizable(Xcas_DispG_Window_); } // Fl_Double_Window* Xcas_DispG_Window_ Modified: trunk/giac-xcas/giac/src/hist.fl =================================================================== --- trunk/giac-xcas/giac/src/hist.fl 2009-11-24 10:21:38 UTC (rev 762) +++ trunk/giac-xcas/giac/src/hist.fl 2009-12-04 08:43:37 UTC (rev 763) @@ -189,7 +189,7 @@ s += "Java interface: Loic Le Coq\\n"; s += "OpenOffice interface: Christophe Devalland, Serge Moutou\\n"; s += "Tutorial (dxcas) with B. Ycart\\n"; - s += "Greek localization, Alkiviadis Akritas et al.\\n"; + s += "Greek localization, Alkiviadis Akritas, Eugenia Kelepesi-Akritas, George Nasopoulos\\n"; s += "Spanish localization, J. Manrique Lopez\\n"; s += "Debian package: Carlos Enrique Carleos Artime\\n"; s += "Mac OS X port thanks to Jean-Yves Avenard and IREM Grenoble\\n"; @@ -229,7 +229,7 @@ } { code {unsigned si=rpn_menu_page*6+i; giac::gen e; - const giac::context * contextptr = xcas::get_context(Fl::focus()); + const giac::context * contextptr = xcas::get_context(xcas::Xcas_input_focus); if (rpn_menu.size()>si){ e=rpn_menu[si]; if ( (e.type==giac::_VECT) && (e._VECTptr->size()==2)) @@ -252,7 +252,7 @@ } catch (std::runtime_error & err) { } - xcas::Equation * eqwptr=dynamic_cast<xcas::Equation *> (Fl::focus()); + xcas::Equation * eqwptr=dynamic_cast<xcas::Equation *> (xcas::Xcas_input_focus); xcas::History_Pack * hp=get_history_pack(eqwptr); const giac::context * cptr=hp?hp->contextptr:0; if (eqwptr && e.is_symb_of_sommet(giac::at_program) ){ @@ -271,14 +271,14 @@ return; } if (e.subtype) - xcas::in_Xcas_input_1arg(Fl::focus(),e._FUNCptr->ptr->s.c_str(),false); + xcas::in_Xcas_input_1arg(xcas::Xcas_input_focus,e._FUNCptr->ptr->s.c_str(),false); else - xcas::in_Xcas_input_1arg(Fl::focus(),(e._FUNCptr->ptr->s+" ").c_str(),false); + xcas::in_Xcas_input_1arg(xcas::Xcas_input_focus,(e._FUNCptr->ptr->s+" ").c_str(),false); return; } // end e.type==FUNC std::string s=e.print(); if (!s.empty()) - xcas::in_Xcas_input_char(Fl::focus(),s.c_str(),s[0]);} {} + xcas::in_Xcas_input_char(xcas::Xcas_input_focus,s.c_str(),s[0]);} {} } Function {show_rpn_menu(unsigned i)} {return_type void @@ -690,7 +690,7 @@ menu_buffer = m->text(); int pos=menu_buffer.find(':'); if (pos>0 && pos<menu_buffer.size()) menu_buffer=menu_buffer.substr(0,pos); - Fl_Widget * f = Fl::focus(); + Fl_Widget * f = xcas::Xcas_input_focus; const giac::context * contextptr = xcas::get_context(f); giac::gen tmp(menu_buffer,contextptr); if (Xcas_automatic_help_browser->value()) @@ -738,7 +738,7 @@ if (pos>0 && pos<menu_buffer.size()) menu_buffer=menu_buffer.substr(0,pos); static std::string ans; int remove,ii; - Fl_Widget * w=Fl::focus(); + Fl_Widget * w=xcas::Xcas_input_focus; Fl_Window * wd=wid->window(); if ( (ii=xcas::handle_tab(menu_buffer,(*giac::vector_completions_ptr),wd->w()/3,wd->h()/3,remove,ans)) ){ @@ -931,7 +931,7 @@ } { Fl_Window Xcas_Main_Window_ { label {Xcas New Interface} open - xywh {212 85 775 615} type Single resizable visible + xywh {204 77 775 615} type Single resizable visible } { Fl_Menu_Bar Xcas_main_menu {open xywh {0 0 775 25} @@ -952,7 +952,7 @@ } MenuItem Xcas_open_recovery { label {Open (recovery mode)} - callback {xcas::recovery_mode=true; load_history(0); xcas::recovery_mode=false;} selected + callback {xcas::recovery_mode=true; load_history(0); xcas::recovery_mode=false;} xywh {10 10 100 20} } Submenu Xcas_Import { @@ -1137,12 +1137,12 @@ } MenuItem Xcas_Undo { label Undo - callback {if (xcas::get_history_pack(Fl::focus())) xcas::History_cb_Undo(Fl::focus(),0); else xcas::History_cb_Undo(Xcas_current_session(),0);} + callback {if (xcas::get_history_pack(xcas::Xcas_input_focus)) xcas::History_cb_Undo(xcas::Xcas_input_focus,0); else xcas::History_cb_Undo(Xcas_current_session(),0);} xywh {230 230 100 20} shortcut 0x4007a } MenuItem Xcas_Redo { label Redo - callback {if (xcas::get_history_pack(Fl::focus())) xcas::History_cb_Redo(Fl::focus(),0); else xcas::History_cb_Redo(Xcas_current_session(),0);} + callback {if (xcas::get_history_pack(xcas::Xcas_input_focus)) xcas::History_cb_Redo(xcas::Xcas_input_focus,0); else xcas::History_cb_Redo(Xcas_current_session(),0);} xywh {240 240 100 20} shortcut 0x40079 } MenuItem Xcas_Paste { @@ -1158,13 +1158,13 @@ MenuItem Xcas_Tex_Selection { label {selection -> LaTeX} callback {static std::string s; giac::gen g; - const giac::context * contextptr=xcas::get_context(Fl::focus()); + const giac::context * contextptr=xcas::get_context(xcas::Xcas_input_focus); try { - if (xcas::Equation * ptr=dynamic_cast<xcas::Equation *> (Fl::focus())) + if (xcas::Equation * ptr=dynamic_cast<xcas::Equation *> (xcas::Xcas_input_focus)) g=ptr->get_selection(); - if (xcas::Flv_Table_Gen * ptr=dynamic_cast<xcas::Flv_Table_Gen *> (Fl::focus())) + if (xcas::Flv_Table_Gen * ptr=dynamic_cast<xcas::Flv_Table_Gen *> (xcas::Xcas_input_focus)) g=extractmatricefromsheet(ptr->selected); - if (Fl_Input_ * ptr=dynamic_cast<Fl_Input *>(Fl::focus())){ + if (Fl_Input_ * ptr=dynamic_cast<Fl_Input *>(xcas::Xcas_input_focus)){ int i=ptr->position(),j=ptr->mark(); if (i>j) std::swap<int>(i,j); s=ptr->value(); @@ -1191,10 +1191,10 @@ label {New parameter} callback {std::string tmp,name; double tmin,tmax,tcur,tstep; -Fl_Widget * wid = Fl::focus(); +Fl_Widget * wid = xcas::Xcas_input_focus; int pos; xcas::History_Pack * hp=xcas::get_history_pack(wid,pos); -if (hp && xcas::figure_param_dialog(Fl::focus(),false,tmin,tmax,tcur,tstep,name,false,tmp)){ +if (hp && xcas::figure_param_dialog(xcas::Xcas_input_focus,false,tmin,tmax,tcur,tstep,name,false,tmp)){ if (hp){ hp->add_entry(pos); hp->set_value(pos,tmp,true); @@ -1507,7 +1507,7 @@ label Index callback {static std::string ans; int remove,ii; - Fl_Widget * w=Fl::focus(); + Fl_Widget * w=xcas::Xcas_input_focus; if ( (ii=xcas::handle_tab("",(*giac::vector_completions_ptr),Xcas_Main_Window_->w()/3,Xcas_Main_Window_->h()/3,remove,ans)) ){ if (ii==1) @@ -1999,25 +1999,43 @@ } } } - Submenu Xcas_help_tableur { - label Spreadsheet - xywh {30 30 100 20} + Submenu Xcas_help_expression { + label Expression + xywh {40 40 100 20} } { - MenuItem Xcas_Add_Tableur { - label {New spreadsheet} - callback {xcas::History_cb_New_Tableur(Xcas_current_session(),0);} - xywh {60 60 100 20} shortcut 0x80074 + MenuItem Xcas_Add_Expression { + label {New expression} + callback {xcas::History_cb_New_Equation(Xcas_current_session(),0);} + xywh {125 125 100 20} shortcut 0x80065 } } + Submenu Xcas_help_allcmds { + label Cmds open + xywh {85 85 100 20}... [truncated message content] |
From: <pa...@us...> - 2009-11-24 10:22:40
|
Revision: 762 http://xcas.svn.sourceforge.net/xcas/?rev=762&view=rev Author: parisse Date: 2009-11-24 10:21:38 +0000 (Tue, 24 Nov 2009) Log Message: ----------- UTF8 Modified Paths: -------------- trunk/giac-xcas/giac/src/Editeur.cc trunk/giac-xcas/giac/src/Editeur.h trunk/giac-xcas/giac/src/Equation.cc trunk/giac-xcas/giac/src/Graph.cc trunk/giac-xcas/giac/src/Graph3d.cc trunk/giac-xcas/giac/src/History.cc trunk/giac-xcas/giac/src/History.h trunk/giac-xcas/giac/src/Input.cc trunk/giac-xcas/giac/src/Print.cc trunk/giac-xcas/giac/src/Tableur.cc trunk/giac-xcas/giac/src/Xcas1.cc trunk/giac-xcas/giac/src/Xcas1.h trunk/giac-xcas/giac/src/alg_ext.cc trunk/giac-xcas/giac/src/desolve.cc trunk/giac-xcas/giac/src/first.h trunk/giac-xcas/giac/src/gen.cc trunk/giac-xcas/giac/src/gen.h trunk/giac-xcas/giac/src/global.cc trunk/giac-xcas/giac/src/global.h trunk/giac-xcas/giac/src/help.cc trunk/giac-xcas/giac/src/help.h trunk/giac-xcas/giac/src/hist.cxx trunk/giac-xcas/giac/src/hist.fl trunk/giac-xcas/giac/src/hist.h trunk/giac-xcas/giac/src/icas.cc trunk/giac-xcas/giac/src/identificateur.cc trunk/giac-xcas/giac/src/index.cc trunk/giac-xcas/giac/src/index.h trunk/giac-xcas/giac/src/input_lexer.cc trunk/giac-xcas/giac/src/input_lexer.ll trunk/giac-xcas/giac/src/input_parser.cc trunk/giac-xcas/giac/src/input_parser.yy trunk/giac-xcas/giac/src/intg.cc trunk/giac-xcas/giac/src/intgab.cc trunk/giac-xcas/giac/src/maple.cc trunk/giac-xcas/giac/src/plot.cc trunk/giac-xcas/giac/src/prog.cc trunk/giac-xcas/giac/src/prog.h trunk/giac-xcas/giac/src/series.cc trunk/giac-xcas/giac/src/symbolic.cc trunk/giac-xcas/giac/src/tex.cc trunk/giac-xcas/giac/src/tex.h trunk/giac-xcas/giac/src/ti89.cc trunk/giac-xcas/giac/src/usual.cc trunk/giac-xcas/giac/src/vecteur.cc Modified: trunk/giac-xcas/giac/src/Editeur.cc =================================================================== --- trunk/giac-xcas/giac/src/Editeur.cc 2009-10-06 13:06:56 UTC (rev 761) +++ trunk/giac-xcas/giac/src/Editeur.cc 2009-11-24 10:21:38 UTC (rev 762) @@ -1,5 +1,6 @@ // -*- mode:C++ ; compile-command: "g++ -I. -I.. -I../include -I../../giac/include -g -c Editeur.cc" -*- #include "Editeur.h" +#include "Input.h" /* * Copyright (C) 2000 B. Parisse, Institut Fourier, 38402 St Martin d'Heres * @@ -122,6 +123,7 @@ "jusqua", "jusque", "label", + "local", "non", "not", "od", @@ -133,6 +135,7 @@ "proc", "repeat", "repeter", + "retourne", "return", "si", "sinon", @@ -148,32 +151,7 @@ "while", "xor" }; - const char *code_types[] = { // List of known giac types... - "DOM_COMPLEX", - "DOM_FLOAT", - "DOM_FUNC", - "DOM_IDENT", - "DOM_INT", - "DOM_LIST", - "DOM_MATRIX", - "DOM_RAT", - "DOM_STRING", - "DOM_SYMBOLIC", - "algebraic", - "array", - "complex", - "double", - "float", - "integer", - "local", - "negint", - "nonnegint", - "nonposint", - "posint", - "rational" - }; - // // 'compare_keywords()' - Compare two keywords... // @@ -201,7 +179,7 @@ const char *temp; for (current = *style, col = 0, last = 0; length > 0; length --, text ++) { - if (current == 'B') current = 'A'; + if (current == 'B' || current>='E') current = 'A'; if (current == 'A') { // Check for directives, comments, strings, and keywords... if (col == 0 && *text == '#') { @@ -235,27 +213,25 @@ bufptr = buf; - if (bsearch(&bufptr, code_types, - sizeof(code_types) / sizeof(code_types[0]), - sizeof(code_types[0]), compare_keywords)) { + if (bsearch(&bufptr, code_keywords, + sizeof(code_keywords) / sizeof(code_keywords[0]), + sizeof(code_keywords[0]), compare_keywords)) { current='A'; while (text < temp) { - *style++ = 'F'; + *style++ = 'G'; text ++; length --; col ++; } - text --; - length ++; - last = 1; - continue; - } else if (bsearch(&bufptr, code_keywords, - sizeof(code_keywords) / sizeof(code_keywords[0]), - sizeof(code_keywords[0]), compare_keywords)) { + text --; + length ++; + last = 1; + continue; + } else if (giac::vector_completions_ptr && binary_search(giac::vector_completions_ptr->begin(),giac::vector_completions_ptr->end(),bufptr)) { current='A'; while (text < temp) { - *style++ = 'G'; + *style++ = 'F'; text ++; length --; col ++; @@ -302,12 +278,12 @@ else *style++ = current; col ++; - last = isalnum(*text) || *text == '.'; + last = isalphan(*text) || *text == '.'; if (*text == '\n') { // Reset column and possibly reset the style col = 0; - if (current == 'B' || current == 'E') current = 'A'; + if (current == 'B' || current >= 'E') current = 'A'; } } } @@ -1225,7 +1201,7 @@ } } - static void cb_Editeur_Test(Fl_Menu_* m , void*) { + static void cb_Editeur_Test(Fl_Widget* m , void*) { Fl_Text_Editor * e = find_editor(m); if (e){ Fl::focus(e); @@ -1236,7 +1212,29 @@ } } - static void cb_Editeur_Next(Fl_Menu_* m , void*) { + static void cb_Editeur_Indent_line(Fl_Widget* m , void*) { + Fl_Text_Editor * e = find_editor(m); + if (e){ + Fl::focus(e); + Editeur * ed = dynamic_cast<Editeur *>(m->parent()); + if (ed){ + ed->editor->indent(e->insert_position()); + } + } + } + + static void cb_Editeur_Indent_all(Fl_Widget* m , void*) { + Fl_Text_Editor * e = find_editor(m); + if (e){ + Fl::focus(e); + Editeur * ed = dynamic_cast<Editeur *>(m->parent()); + if (ed){ + ed->editor->indent(); + } + } + } + + static void cb_Editeur_Next(Fl_Widget * m , void*) { Editeur * e = dynamic_cast<Editeur *>(m->parent()); if (e && e->editor){ Fl_Text_Editor * ed=e->editor; @@ -1308,10 +1306,10 @@ } } - static void cb_Editeur_Search(Fl_Menu_* m , void*) { + static void cb_Editeur_Search(Fl_Widget* m , void*) { static Fl_Window * w = 0; static Fl_Input * i1=0, * i2=0; // i1=search, i2=replace - static Fl_Return_Button * button0 = 0 ; // cancel + static Fl_Button * button0 = 0 ; // cancel static Fl_Button * button1 =0; // next static Fl_Button * button2 =0; // replace + next static Fl_Button * button3 =0; // replace all @@ -1328,7 +1326,7 @@ i2=new Fl_Input((2*dx)/3,2,dx/3-2,dy/3-4,"Replace"); i2->tooltip(gettext("Replace by")); i2->when(FL_WHEN_ENTER_KEY|FL_WHEN_NOT_CHANGED); - button0 = new Fl_Return_Button(2,2+(2*dy/3),dx/2-4,dy/3-4); + button0 = new Fl_Button(2,2+(2*dy/3),dx/2-4,dy/3-4); button0->shortcut(0xff0d); button0->label(gettext("Cancel")); button1 = new Fl_Button(dx/2+2,2+(2*dy)/3,dx/2-4,dy/3-4); @@ -1443,15 +1441,15 @@ giac::context * contextptr = get_context(ed); switch (xcas_mode(contextptr)){ case 0: - ed->buffer()->insert(i,"\nf(x,y):=\n {\n local z;\n\n }\n"); + ed->buffer()->insert(i,"\nf(x,y):={\n local z;\n\n}\n"); ed->insert_position(i+2); break; case 1: - ed->buffer()->insert(i,"\nf:=proc(x,y)\nlocal z;\n\nend;\n"); + ed->buffer()->insert(i,"\nf:=proc(x,y)\n local z;\n\nend;\n"); ed->insert_position(i+2); break; case 2: - ed->buffer()->insert(i,"\nf:=proc(x,y)\nlocal z;\nbegin\n\nend_proc;\n"); + ed->buffer()->insert(i,"\nf:=proc(x,y)\nlocal z;\n begin\n\nend_proc;\n"); ed->insert_position(i+2); break; case 3: @@ -1699,8 +1697,11 @@ {0}, // end File {gettext("Edit"), 0, 0, 0, 64, 0, 0, 14, 56}, {gettext("Paste"), 0, (Fl_Callback *) cb_Paste, 0, 0, 0, 0, 14, 56}, - {gettext("Search"), 0, (Fl_Callback *) cb_Editeur_Search, 0, 0, 0, 0, 14, 56}, - {gettext("Execute tout"), 0, (Fl_Callback *) cb_Editeur_Exec_All, 0, 0, 0, 0, 14, 56}, + {gettext("Search (Ctrl-F)"), 0, (Fl_Callback *) cb_Editeur_Search, 0, 0, 0, 0, 14, 56}, + {gettext("Indent line (Esc)"), 0, (Fl_Callback *) cb_Editeur_Indent_line, 0, 0, 0, 0, 14, 56}, + {gettext("Indent all"), 0, (Fl_Callback *) cb_Editeur_Indent_all, 0, 0, 0, 0, 14, 56}, + {gettext("Parse"), 0, (Fl_Callback *) cb_Editeur_Test, 0, 0, 0, 0, 14, 56}, + {gettext("Exec all"), 0, (Fl_Callback *) cb_Editeur_Exec_All, 0, 0, 0, 0, 14, 56}, {0}, // end Edit {gettext("Add"), 0, 0, 0, 64, 0, 0, 14, 56}, {gettext("Func"), 0, 0, 0, 64, 0, 0, 14, 56}, @@ -1789,10 +1790,10 @@ } button = new Fl_Button(x+w/3+w/12,y,w/12,L); button->labelsize(labelsize()); - button->label("OK (Esc)"); + button->label("OK (F9)"); button->tooltip(gettext("Parse current program")); button->callback((Fl_Callback *) cb_Editeur_Test); - button->shortcut(0xff1b); // FIXME: quick fix, otherwise Esc leaves xcas + button->shortcut(0xffc6); // FIXME: quick fix, otherwise Esc leaves xcas } save_button = new Fl_Button(x+w/2,y,w/5,L); save_button->labelsize(labelsize()); @@ -1920,124 +1921,216 @@ fl_pop_clip(); } - int Xcas_Text_Editor::handle(int event){ + const char * motscleftab[] = { + "{", + "Else", + "ElseIf", + "EndDlog", + "EndFor", + "EndFunc", + "EndIf", + "EndLoop", + "EndPrgm", + "EndTry", + "EndWhile", + "Exit", + "Func", + "Then", + "alors", + "and", + "break", + "by", + "case", + "catch", + "continue", + "de", + "default", + "do", + "downto", + "elif", + "else", + "end", + "end_case", + "end_for", + "end_if", + "end_proc", + "end_while", + "et", + "faire", + "ffaire", + "fi", + "fpour", + "from", + "fsi", + "ftantque", + "jusqu_a", + "jusqua", + "jusque", + "non", + "not", + "od", + "or", + "ou", + "pas", + "sinon", + "step", + "then", + "to", + "until", + "xor" + }; + + const std::vector<string> motsclef(motscleftab,motscleftab+sizeof(motscleftab)/sizeof(motscleftab[0])); + + // indent current line at position pos, return new current position + int Xcas_Text_Editor::indent(int pos){ + int debut_ligne=buffer()->line_start(pos),indent=0; + // Tab pressed -> indent current line + char Lastchar; + if (debut_ligne){ + char * ch_ = buffer()->line_text(pos-1),*ch=ch_; + bool empty_line=true; + int position=buffer()->line_start(debut_ligne-2); + indent = 2; + while (1){ + free(ch_); + ch_ = buffer()->line_text(position); + ch=ch_; + int save_indent=indent; + // Count spaces in ch + for (;*ch;++ch,++indent){ + if (*ch=='/' && *(ch+1)=='/') + break; + if (*ch!=' '){ + empty_line=false; + break; + } + } + if (position<2 || !empty_line) + break; + // line was empty, restore indent and go one line above + indent = save_indent; + position=buffer()->line_start(position-2); + } + if (empty_line) + indent = 0; + else { + int firstchar=*ch,lastchar = *ch,prevlast=0; + if (lastchar ==';' && !*(ch+1)) + indent -= 2; + // Add spaces for each open (, open {, open [, + // remove spaces for ] } ) + for (;*ch;++ch){ + switch (*ch){ + case '(': case '[': case '{': + indent += 2; + break; + case ')': case ']': case '}': + indent -=2; + break; + } + if (*ch!=' '){ + prevlast=lastchar; + lastchar=*ch; + } + } + Lastchar=lastchar; + // Last non space should be { or ; + if (lastchar=='{' || (lastchar=='}' && firstchar!='}') || (lastchar==';' && prevlast!='}' ) ) + indent -=2; + free(ch_); + } + } + // Now indent line + char * ch_ = buffer()->line_text(pos), *ch=ch_; + int delta=0; + for (;*ch;++ch,--delta){ + if (*ch!=' ') + break; + } + if (*ch=='}') + indent -= 2; + string mot; + mot += *ch; + for(char * ch1=ch+1;*ch1;++ch1){ + if (!isalpha(*ch1)) + break; + mot += *ch1; + } + if (Lastchar!='}' && (equalposcomp(motsclef,mot))) + indent -=2; + indent=max(indent,0); + delta += indent; + string s(indent,' '); + s += ch; + free(ch_); + int fin=buffer()->line_end(pos); + buffer()->remove(debut_ligne,fin); + buffer()->insert(debut_ligne,s.c_str()); + insert_position(pos+delta); + redraw(); + return pos+delta; + } + + void Xcas_Text_Editor::indent(){ + int pos=0; + for (;pos<buffer()->length();){ + pos=indent(pos); + pos=buffer()->line_end(pos)+1; + } + } + + int Xcas_Text_Editor::handle(int event){ if (Fl::focus()!=this && event==FL_MOUSEWHEEL) return 0; giac::context * contextptr = get_context(this); History_Pack * hp=get_history_pack(this); if (event==FL_KEYBOARD){ - if (Fl::event_text()[0]==9 ){ + if (Fl::event_text()[0]==6){ + cb_Editeur_Search(this,0); + return 1; + } + if (Fl::event_text()[0]==14){ + cb_Editeur_Next(this,0); + return 1; + } + if (Fl::event_text()[0]==9 || Fl::event_key()==FL_Escape){ int pos=insert_position(); - if (pos) - --pos; - char car=buffer()->character(pos); - if (car=='\n'){ - ++pos; - car=buffer()->character(pos); - } - if (isalphan(car)){ - int wbeg=buffer()->word_start(pos); - int wend=buffer()->word_end(pos); - pos=wend; - string s(buffer()->text_range(wbeg,wend)),ans; - int remove; - if (int ii=handle_tab(s,*giac::vector_completions_ptr,window()->w(),window()->h()/3,remove,ans)){ - window()->show(); - Fl::focus(this); - handle(FL_FOCUS); - pos=wend-remove; - buffer()->remove(pos,wend); - if (ii==1){ - buffer()->insert(pos,(ans+"()").c_str()); - insert_position(pos+ans.size()+1); - } - else { - buffer()->insert(pos,ans.c_str()); - insert_position(pos+ans.size()); - } - if (parent()) - parent_redraw(parent()); + if (Fl::event_text()[0]==9){ + if (pos) + --pos; + char car=buffer()->character(pos); + if (car=='\n'){ + ++pos; + car=buffer()->character(pos); } - return 1; - } - int debut_ligne=buffer()->line_start(pos),indent=0; - // Tab pressed -> indent current line - if (xcas_mode(contextptr)){ - fl_message(gettext("Indentation works only in Xcas programming mode")); - return 1; - } - if (debut_ligne){ - char * ch_ = buffer()->line_text(pos-1),*ch=ch_; - bool empty_line=true; - int position=buffer()->line_start(debut_ligne-2); - indent = 2; - while (1){ - free(ch_); - ch_ = buffer()->line_text(position); - ch=ch_; - int save_indent=indent; - // Count spaces in ch - for (;*ch;++ch,++indent){ - if (*ch=='/' && *(ch+1)=='/') - break; - if (*ch!=' '){ - empty_line=false; - break; + if (isalphan(car)){ + int wbeg=buffer()->word_start(pos); + int wend=buffer()->word_end(pos); + pos=wend; + string s(buffer()->text_range(wbeg,wend)),ans; + int remove; + if (int ii=handle_tab(s,*giac::vector_completions_ptr,window()->w(),window()->h()/3,remove,ans)){ + window()->show(); + Fl::focus(this); + handle(FL_FOCUS); + pos=wend-remove; + buffer()->remove(pos,wend); + if (ii==1){ + buffer()->insert(pos,(ans+"()").c_str()); + insert_position(pos+ans.size()+1); } - } - if (position<2 || !empty_line) - break; - // line was empty, restore indent and go one line above - indent = save_indent; - position=buffer()->line_start(position-2); - } - if (empty_line) - indent = 0; - else { - int firstchar=*ch,lastchar = *ch,prevlast=0; - if (lastchar ==';' && !*(ch+1)) - indent -= 2; - // Add spaces for each open (, open {, open [, - // remove spaces for ] } ) - for (;*ch;++ch){ - switch (*ch){ - case '(': case '[': case '{': - indent += 2; - break; - case ')': case ']': case '}': - indent -=2; - break; + else { + buffer()->insert(pos,ans.c_str()); + insert_position(pos+ans.size()); } - if (*ch!=' '){ - prevlast=lastchar; - lastchar=*ch; - } + if (parent()) + parent_redraw(parent()); } - // Last non space should be { or ; - if (lastchar=='{' || (lastchar=='}' && firstchar!='}') || (lastchar==';' && prevlast!='}' ) ) - indent -=2; - free(ch_); + return 1; } } - // Now indent line - char * ch_ = buffer()->line_text(pos), *ch=ch_; - int delta=0; - for (;*ch;++ch,--delta){ - if (*ch!=' ') - break; - } - if (*ch=='}') - indent -= 2; - indent=max(indent,0); - delta += indent; - string s(indent,' '); - s += ch; - free(ch_); - int fin=buffer()->line_end(pos); - buffer()->remove(debut_ligne,fin); - buffer()->insert(debut_ligne,s.c_str()); - insert_position(pos+delta); - redraw(); + indent(pos); return 1; } // end if (...) tabulation test int key=Fl::event_key(); Modified: trunk/giac-xcas/giac/src/Editeur.h =================================================================== --- trunk/giac-xcas/giac/src/Editeur.h 2009-10-06 13:06:56 UTC (rev 761) +++ trunk/giac-xcas/giac/src/Editeur.h 2009-11-24 10:21:38 UTC (rev 762) @@ -60,6 +60,8 @@ Xcas_Text_Editor(int X, int Y, int W, int H, Fl_Text_Buffer * b,const char* l = 0); virtual int handle(int event); virtual void draw(); + int indent(int pos); // indent current line, return new cursor position + void indent(); // indent all void match(); }; Modified: trunk/giac-xcas/giac/src/Equation.cc =================================================================== --- trunk/giac-xcas/giac/src/Equation.cc 2009-10-06 13:06:56 UTC (rev 761) +++ trunk/giac-xcas/giac/src/Equation.cc 2009-11-24 10:21:38 UTC (rev 762) @@ -65,9 +65,169 @@ string s=s0.substr(0,j+1),sadd; if (j<n-1) sadd=s0.substr(j+1,n-1-j); +#ifdef _HAVE_FL_UTF8_HDR_ switch (s.size()){ case 2: if (s=="mu"){ + s0="μ"+sadd; + return FL_HELVETICA; + } + if (s=="nu"){ + s0="ν"+sadd; + return FL_HELVETICA; + } + if (s=="pi"){ + s0="π"+sadd; + return FL_HELVETICA; + } + if (s=="xi"){ + s0="ξ"+sadd; + return FL_HELVETICA; + } + if (s=="Xi"){ + s0="Ξ"+sadd; + return FL_HELVETICA; + } + break; + case 3: + if (s=="chi"){ + s0="χ"+sadd; + return FL_HELVETICA; + } + if (s=="phi"){ + s0="φ"+sadd; + return FL_HELVETICA; + } + if (s=="Phi"){ + s0="Φ"+sadd; + return FL_HELVETICA; + } + if (s=="eta"){ + s0="η"+sadd; + return FL_HELVETICA; + } + if (s=="rho"){ + s0="ρ"+sadd; + return FL_HELVETICA; + } + if (s=="tau"){ + s0="τ"+sadd; + return FL_HELVETICA; + } + if (s=="psi"){ + s0="ψ"+sadd; + return FL_HELVETICA; + } + if (s=="Psi"){ + s0="Ψ"+sadd; + return FL_HELVETICA; + } + break; + case 4: + if (s=="beta"){ + s0="β"+sadd; + return FL_HELVETICA; + } + if (s=="Beta"){ + s0="β"+sadd; + return FL_HELVETICA; + } + if (s=="zeta"){ + s0="ζ"+sadd; + return FL_HELVETICA; + } + if (s=="Zeta"){ + s0="ζ"+sadd; + return FL_HELVETICA; + } + break; + case 5: + if (s=="alpha"){ + s0="α"+sadd; + return FL_HELVETICA; + } + if (s=="delta"){ + s0="δ"+sadd; + return FL_HELVETICA; + } + if (s=="Delta"){ + s0="Δ"+sadd; + return FL_HELVETICA; + } + if (s=="gamma"){ + s0="γ"+sadd; + return FL_HELVETICA; + } + if (s=="Gamma"){ + s0="Γ"+sadd; + return FL_HELVETICA; + } + if (s=="kappa"){ + s0="κ"+sadd; + return FL_HELVETICA; + } + if (s=="theta"){ + s0="θ"+sadd; + return FL_HELVETICA; + } + if (s=="Theta"){ + s0="Θ"+sadd; + return FL_HELVETICA; + } + if (s=="sigma"){ + s0="σ"+sadd; + return FL_HELVETICA; + } + if (s=="Sigma"){ + s0="Σ"+sadd; + return FL_HELVETICA; + } + if (s=="Omega"){ + s0="Ω"+sadd; + return FL_HELVETICA; + } + if (s=="omega"){ + s0="ω"+sadd; + return FL_HELVETICA; + } + break; + case 6: + if (s=="lambda"){ + s0="l"+sadd; + return FL_HELVETICA; + } + if (s=="Lambda"){ + s0="λ"+sadd; + return FL_HELVETICA; + } + break; + case 7: + if (s=="epsilon"){ + s0="ε"+sadd; + return FL_HELVETICA; + } + if (s=="product"){ + s0="Π"+sadd; + return FL_HELVETICA; + } + break; + case 8: + if (s=="infinity"){ + s0="oo"+sadd; + return FL_HELVETICA; + } + break; + case 11: + if (s=="euler_gamma"){ + s0="ϒ"+sadd; + return FL_HELVETICA; + } + break; + } +#else + switch (s.size()){ + case 2: + if (s=="mu"){ s0="m"+sadd; return FL_SYMBOL; } @@ -88,11 +248,11 @@ return FL_SYMBOL; } if (s=="im"){ - s0="\xC1"+sadd; + s0="Á"+sadd; return FL_SYMBOL; } if (s=="re"){ - s0="\xC2"+sadd; + s0="Â"+sadd; return FL_SYMBOL; } break; @@ -198,7 +358,7 @@ return FL_SYMBOL; } if (s=="aleph"){ - s0="\xC0"+sadd; + s0="À"+sadd; return FL_SYMBOL; } break; @@ -212,7 +372,7 @@ return FL_SYMBOL; } if (s=="approx"){ - s0="\xBB"+sadd; + s0="»"+sadd; return FL_SYMBOL; } break; @@ -228,7 +388,7 @@ break; case 8: if (s=="infinity"){ - s0="\xA5"+sadd; + s0="¥"+sadd; return FL_SYMBOL; } break; @@ -239,6 +399,7 @@ } break; } +#endif return FL_HELVETICA; } Modified: trunk/giac-xcas/giac/src/Graph.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph.cc 2009-10-06 13:06:56 UTC (rev 761) +++ trunk/giac-xcas/giac/src/Graph.cc 2009-11-24 10:21:38 UTC (rev 762) @@ -209,6 +209,7 @@ cerr << "// " << setlocale (LC_MESSAGES, "") << endl; cerr << "// " << bindtextdomain (PACKAGE, xcas_locale.c_str()) << endl; cerr << "// " << textdomain (PACKAGE) << endl; + cerr << "// " << bind_textdomain_codeset (PACKAGE, "UTF-8") << endl; }; }; objet_bidon mon_objet_bidon; @@ -379,7 +380,7 @@ show_axes=optvalue.val; if (optname.val==_GL_SHOWNAMES && optvalue.type==_INT_) show_names=optvalue.val; - if (optname.val>=_GL_X_AXIS_NAME && optname.val<=_GL_Y_AXIS_NAME && optvalue.type==_STRNG){ + if (optname.val>=_GL_X_AXIS_NAME && optname.val<=_GL_Z_AXIS_UNIT && optvalue.type==_STRNG){ if (optname.val==_GL_X_AXIS_NAME) x_axis_name=*optvalue._STRNGptr; if (optname.val==_GL_Y_AXIS_NAME) y_axis_name=*optvalue._STRNGptr; if (optname.val==_GL_Z_AXIS_NAME) z_axis_name=*optvalue._STRNGptr; @@ -2109,13 +2110,15 @@ vector<double> vx,vy,vz; int s; context * contextptr=hp?hp->contextptr:get_context(this); - autoscaleg(plot_instructions,vx,vy,vz,contextptr); + bool ortho=autoscaleg(plot_instructions,vx,vy,vz,contextptr); autoscaleminmax(vx,window_xmin,window_xmax); zoomx(1.0); autoscaleminmax(vy,window_ymin,window_ymax); zoomy(1.0); autoscaleminmax(vz,window_zmin,window_zmax); zoomz(1.0); + if (ortho) + orthonormalize(); } find_ylegende(); y_tick=find_tick(window_ymax-window_ymin); @@ -2869,7 +2872,7 @@ case _FRAC: return is_numeric(a._FRACptr->num) && is_numeric(a._FRACptr->den); case _SYMB: - if (a.is_symb_of_sommet(at_prod) || a.is_symb_of_sommet(at_inv) || a.is_symb_of_sommet(at_neg)) + if (a.is_symb_of_sommet(at_prod) || a.is_symb_of_sommet(at_inv) || a.is_symb_of_sommet(at_neg) || a.is_symb_of_sommet(at_plus)) return is_numeric(a._SYMBptr->feuille); default: return false; @@ -2940,6 +2943,11 @@ v3s=v3.size(); if (v3s>3) v3s=3; + if (v3s==1){ + v3.push_back(im(v3[0],contextptr)); + v3[0]=re(v3[0],contextptr); + v3s=2; + } if (v3s>0){ savev.push_back(makevecteur(v3[0],window_xmin,window_xmax)); v3[0]=gen(pntname.print(contextptr)+"x",hp->contextptr); @@ -3001,7 +3009,7 @@ } return eps; } - + int Graph2d3d::geo_handle(int event){ Graph3d * gr3d = dynamic_cast<Graph3d *>(this); Graph2d * gr2d = dynamic_cast<Graph2d *>(this); @@ -3074,7 +3082,7 @@ else decal=in_area?geometry_round_numeric(newx,newy,eps,approx):0; // cerr << in_area << " " << decal << endl; - if (event==FL_RELEASE && Fl::event_button()== FL_RIGHT_MOUSE && is_zero(decal)){ + if (event==FL_RELEASE && Fl::event_button()== FL_RIGHT_MOUSE && (is_zero(decal)) ){ pushed=moving=moving_frame=false; change_attributs(); args_tmp.clear(); @@ -3554,7 +3562,7 @@ context * contextptr=f->geo->hp?f->geo->hp->contextptr:0; f->geo->set_mode(f_tmp,f_final,mode); f->geo->args_help.clear(); - if (mode!=0){ + if (mode!=0 && mode!=255){ gen g(help,contextptr); if (g.type==_VECT){ const_iterateur it = g._VECTptr->begin(),itend=g._VECTptr->end(); @@ -3588,7 +3596,7 @@ // cerr << event << " " << mode << endl; int res=common_in_handle(event); if (Fl::event_button()==FL_RIGHT_MOUSE && res && mode==255) - return res; + return res; // right click desactivated if (event==FL_UNFOCUS){ return 1; } @@ -3604,6 +3612,13 @@ void Geo2d::draw(){ if (!hp) hp=geo_find_history_pack(this); + context * contextptr = hp?hp->contextptr:0; +#ifdef HAVE_LIBPTHREAD + // cerr << "geo2d lock" << endl; + pthread_mutex_lock(&interactive_mutex); + bool b=io_graph(contextptr); + io_graph(contextptr)=false; +#endif int clip_x,clip_y,clip_w,clip_h; bool block=block_signal; block_signal=true; @@ -3624,6 +3639,11 @@ fl_pop_clip(); ++animation_instructions_pos; block_signal=block; +#ifdef HAVE_LIBPTHREAD + // cerr << "geo2d unlock" << endl; + pthread_mutex_unlock(&interactive_mutex); + io_graph(contextptr)=b; +#endif } inline void swapint(int & i0,int & i1){ @@ -4504,6 +4524,14 @@ void Graph2d::draw(){ int clip_x,clip_y,clip_w,clip_h; + if (!hp) + hp=geo_find_history_pack(this); + context * contextptr = hp?hp->contextptr:0; +#ifdef HAVE_LIBPTHREAD + pthread_mutex_lock(&interactive_mutex); + bool b=io_graph(contextptr); + io_graph(contextptr)=false; +#endif bool block=block_signal; block_signal=true; fl_clip_box(x(),y(),w(),h(),clip_x,clip_y,clip_w,clip_h); @@ -4521,6 +4549,10 @@ if (!paused) ++animation_instructions_pos; block_signal=block; +#ifdef HAVE_LIBPTHREAD + pthread_mutex_unlock(&interactive_mutex); + io_graph(contextptr)=b; +#endif } void Graph2d3d::autoname_plus_plus(){ @@ -5407,7 +5439,7 @@ if (f){ int i=f->lt->line_type(); bool formel=false,untranslate=false; - change_line_type(i,true,f->geo->approx,"",(dynamic_cast<Graph3d *>(f->geo)),formel,untranslate,false,f->geo->labelsize()); + change_line_type(i,true,f->geo->approx," (next mouse created objects)",(dynamic_cast<Graph3d *>(f->geo)),formel,untranslate,false,f->geo->labelsize()); Fl_Color col = Fl_Color(i&0xffff); f->couleur->color(col); Fl_Color col2=Fl_Color(contrast(col)); @@ -5460,11 +5492,11 @@ } static void cb_Frame(Fl_Widget * m , void*) { - cb_set_mode(m,0,0,255,"right_modif_attrib"); + cb_set_mode(m,0,0,255," object_selects_level"); } static void cb_Pointer(Fl_Widget * m , void*) { - cb_set_mode(m,0,0,0,""); + cb_set_mode(m,0,0,0," point_to_move"); } static void cb_Point(Fl_Widget * m , void*) { @@ -5508,11 +5540,11 @@ } static void cb_Perpendiculaire(Fl_Widget * m , void*) { - cb_set_mode(m,at_segment,at_perpendiculaire,3,gettext("Point,Line")); + cb_set_mode(m,at_segment,at_perpendiculaire,2,gettext("Point,Line")); } static void cb_Parallele(Fl_Widget * m , void*) { - cb_set_mode(m,at_segment,at_parallele,3,gettext("Point,Line")); + cb_set_mode(m,at_segment,at_parallele,2,gettext("Point,Line")); } static void cb_Mediane(Fl_Widget * m , void*) { @@ -6304,7 +6336,11 @@ Fl_Tile::draw(); if (scroll_position>0 && hp){ if (Fl_Scroll * scroll = dynamic_cast<Fl_Scroll *>(hp->parent())){ +#ifdef _HAVE_FL_UTF8_HDR_ + scroll->scroll_to(0,scroll_position); +#else scroll->position(0,scroll_position); +#endif scroll_position=-1; Fl_Tile::draw(); } @@ -6434,7 +6470,7 @@ if (ff.type==_VECT && !ff._VECTptr->empty()) ff = ff._VECTptr->front(); // Change gt value with parameter - ff = symbolic(at_element,makevecteur(ff,value())); + ff = symbolic(at_element,makevecteur(ff,value(),Fl_Valuator::step())); gt=symbolic(at_sto,makevecteur(ff,gt._SYMBptr->feuille._VECTptr->back())); do_cb=true; } @@ -6482,7 +6518,22 @@ hp->update_pos=position; if (pos==-2) hp->eval_below=true; - hp->set_gen_value(position,gt,eval_hp); + // check how to update (parameter in a figure or in history) + Fl_Group * gr = hp->widget_group(position); + if (gr && gr->children()>=3){ + if (dynamic_cast<Fl_Output*>(gr->child(2))){ + hp->update_pos=position; + hp->set_gen_value(position,gt,true); + return; + } + } + hp->set_gen_value(position,gt,false); + protecteval(gt,1,hp->contextptr); + if (eval_hp && hp->children()>position+1){ + hp->update_pos=position+1; + gt=hp->parse(position+1); + hp->set_gen_value(position+1,gt,true); + } } // end do_cb } // end if gvs->pos<children() } // end if history_pack hp Modified: trunk/giac-xcas/giac/src/Graph3d.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph3d.cc 2009-10-06 13:06:56 UTC (rev 761) +++ trunk/giac-xcas/giac/src/Graph3d.cc 2009-11-24 10:21:38 UTC (rev 762) @@ -1873,6 +1873,15 @@ glVertex3d(window_xmax,window_ymin,window_zmax); glEnd(); if( show_axes){ // maillage + glColor3f(1,0,0); + glRasterPos3d(1,0,0); + draw_string(x_axis_name.empty()?"x":x_axis_name); + glColor3f(0,1,0); + glRasterPos3d(0,1,0); + draw_string(y_axis_name.empty()?"y":y_axis_name); + glColor3f(0,0,1); + glRasterPos3d(0,0,1); + draw_string(z_axis_name.empty()?"z":z_axis_name); double xmin,dx,x,ymin,dy,y,zmin,dz,z; find_xmin_dx(window_xmin,window_xmax,xmin,dx); find_xmin_dx(window_ymin,window_ymax,ymin,dy); @@ -1907,7 +1916,7 @@ glVertex3d(x,window_ymin,window_zmin); glEnd(); glRasterPos3d(x,window_ymin,window_zmin); - string tmps=giac::print_DOUBLE_(x,2); + string tmps=giac::print_DOUBLE_(x,2)+x_axis_unit; draw_string(tmps); } for (y=ymin;y<=window_ymax;y+=dy){ @@ -1916,7 +1925,7 @@ glVertex3d(window_xmin,y,window_zmin); glEnd(); glRasterPos3d(window_xmin,y,window_zmin); - string tmps=giac::print_DOUBLE_(y,2); + string tmps=giac::print_DOUBLE_(y,2)+y_axis_unit; draw_string(tmps); } for (z=zmin;z<=window_zmax;z+=dz){ @@ -1925,7 +1934,7 @@ glVertex3d(window_xmin,window_ymin,z); glEnd(); glRasterPos3d(window_xmin,window_ymin,z); - string tmps=giac::print_DOUBLE_(z,2); + string tmps=giac::print_DOUBLE_(z,2)+z_axis_unit; draw_string(tmps); } } @@ -2219,6 +2228,14 @@ Fl_Window * win = window(); if (!win) return; + if (!hp) + hp=geo_find_history_pack(this); + context * contextptr = hp?hp->contextptr:0; +#ifdef HAVE_LIBPTHREAD + pthread_mutex_lock(&interactive_mutex); + bool b=io_graph(contextptr); + io_graph(contextptr)=false; +#endif #ifdef __APPLE__ GLContext context; if (!glcontext){ // create context @@ -2261,6 +2278,10 @@ ++animation_instructions_pos; //fl_pop_clip(); block_signal=save_block_signal; +#ifdef HAVE_LIBPTHREAD + pthread_mutex_unlock(&interactive_mutex); + io_graph(contextptr)=b; +#endif } const char * Graph3d::latex(const char * filename_){ Modified: trunk/giac-xcas/giac/src/History.cc =================================================================== --- trunk/giac-xcas/giac/src/History.cc 2009-10-06 13:06:56 UTC (rev 761) +++ trunk/giac-xcas/giac/src/History.cc 2009-11-24 10:21:38 UTC (rev 762) @@ -195,12 +195,24 @@ int spos=s->yposition(); int chpos=ch->y()-y(); if (chpos<spos) +#ifdef _HAVE_FL_UTF8_HDR_ + s->scroll_to(0,max(0,min(chpos,h()-s->h()))); +#else s->position(0,max(0,min(chpos,h()-s->h()))); +#endif else { if (chpos+gr->h()>spos+s->h()) +#ifdef _HAVE_FL_UTF8_HDR_ + s->scroll_to(0,chpos+gr->h()-s->h()); +#else s->position(0,chpos+gr->h()-s->h()); +#endif else +#ifdef _HAVE_FL_UTF8_HDR_ + s->scroll_to(0,spos); +#else s->position(0,spos); +#endif } s->redraw(); } @@ -372,6 +384,19 @@ } } + Fl_Group * History_Pack::widget_group(int n){ + int m=children(); + if (n<0 || n>=m) + return 0; + Fl_Widget * wid = child(n); + if (Fl_Scroll * s=dynamic_cast<Fl_Scroll *>(wid)) + if(s->children()) + wid=s->child(0); + if (Fl_Group * g=dynamic_cast<Fl_Group *>(wid)) + return g; + return 0; + } + bool set_value(Fl_Widget * w,const std::string & s,bool exec){ context * contextptr=get_context(w); if (Fl_Input_ * i = dynamic_cast<Fl_Input_ *>(w)){ @@ -459,7 +484,13 @@ context * get_context(const Fl_Widget * w){ const History_Pack * hp = get_history_pack2(w); - return hp?hp->contextptr:0; + if (hp) + return hp->contextptr; + if (const Flv_Table_Gen * t=dynamic_cast<const Flv_Table_Gen *>(w)) + return t->contextptr; + if (const Tableur_Group * gr = dynamic_cast<const Tableur_Group *>(w)) + return gr->table->contextptr; + return 0; } void set_context(Fl_Widget * w,giac::context * contextptr){ @@ -691,7 +722,13 @@ } // H -= _spacing; // New horizontal size is therefore _printlevel_w+W - int newh=min(max(H,1),1<<14); + int newh=min(max(H,1), +#ifdef _HAVE_FL_UTF8_HDR_ + 1<<30 +#else + 1<<14 +#endif + ); if (newh<H){ cerr << "Too many large widgets. Compressing" << endl; double ratio=double(newh)/H; @@ -960,9 +997,17 @@ if (Fl_Scroll * s=dynamic_cast<Fl_Scroll *>(parent())){ int mousey=my-y(),Y=s->yposition(),dh=h()-s->h(); if (mousey>Y+s->h() && dh>Y) +#ifdef _HAVE_FL_UTF8_HDR_ + s->scroll_to(s->xposition(),min(mousey-s->h(),dh)); +#else s->position(s->xposition(),min(mousey-s->h(),dh)); +#endif if (mousey<Y && Y>0) +#ifdef _HAVE_FL_UTF8_HDR_ + s->scroll_to(s->xposition(),max(0,mousey)); +#else s->position(s->xposition(),max(0,mousey)); +#endif } } int n=children(); @@ -1898,7 +1943,9 @@ ah = g->child(2)->h(); Fl_Widget * wid=g->child(2); g->remove(wid); - delete wid; + if (!dynamic_cast<Gen_Value_Slider *>(wid)){ + delete wid; // must not delete a slider because we are in it's callback + } } a->resize(q->x(),otmp->y()+otmp->h(),g->w(),a->h()); g->Fl_Widget::resize(g->x(),g->y(),g->w(),g->h()+a->h()-ah); @@ -1942,7 +1989,11 @@ s1=p->child(N+1)->y()+2*p->labelsize()-p->y()-s->h(); } s1=min(p->h()-s->h(),s1); +#ifdef _HAVE_FL_UTF8_HDR_ + s->scroll_to(0,max(0,s1)); +#else s->position(0,max(0,s1)); +#endif if (!p->doing_eval && s->parent()) s->parent()->redraw(); } @@ -2158,8 +2209,7 @@ if (m && m->parent()){ History_Fold * o = get_history_fold(m); if (o){ - if (!o->pack->insert_before(o->pack->_sel_begin)) - o->close(); + o->pack->insert_before(o->pack->_sel_begin); } } } @@ -3184,7 +3234,7 @@ */ mode_s += ' '; // mode_s += label(); - if (mode_s!= current_status->label()){ + if (!current_status->label() || mode_s!= current_status->label()){ if (mode) delete [] mode; mode = new char[mode_s.size()+1]; @@ -3623,7 +3673,11 @@ if (Fl_Scroll * s = dynamic_cast<Fl_Scroll *>(hp->parent())){ int spos=s->yposition(); if (spos+s->h()>hp->h()){ +#ifdef _HAVE_FL_UTF8_HDR_ + s->scroll_to(0,max(min(hp->h()-s->h(),spos+dhlog),0)); +#else s->position(0,max(min(hp->h()-s->h(),spos+dhlog),0)); +#endif } s->redraw(); } Modified: trunk/giac-xcas/giac/src/History.h =================================================================== --- trunk/giac-xcas/giac/src/History.h 2009-10-06 13:06:56 UTC (rev 761) +++ trunk/giac-xcas/giac/src/History.h 2009-11-24 10:21:38 UTC (rev 762) @@ -188,6 +188,7 @@ giac::gen parse(int n); // return the gen value of the n-th entry std::string value(int n) const; // return the string value of the n-th entry void set_gen_value(int n,const giac::gen & g,bool exec=true); // set n-th entry value + Fl_Group * widget_group(int n); // group corresponding to position n void set_value(int n,const std::string & s,bool exec=true); bool remove_entry(int n,bool check=true); // does not update, call resize() and update() bool remove_selected_levels(bool check_in_history_fold); Modified: trunk/giac-xcas/giac/src/Input.cc =================================================================== --- trunk/giac-xcas/giac/src/Input.cc 2009-10-06 13:06:56 UTC (rev 761) +++ trunk/giac-xcas/giac/src/Input.cc 2009-11-24 10:21:38 UTC (rev 762) @@ -761,7 +761,11 @@ int scy=sc->yposition()+labelsize()*Fl::e_dy; if (scy<0) scy=0; +#ifdef _HAVE_FL_UTF8_HDR_ + sc->scroll_to(sc->xposition(),scy); +#else sc->position(sc->xposition(),scy); +#endif return 1; } } Modified: trunk/giac-xcas/giac/src/Print.cc =================================================================== --- trunk/giac-xcas/giac/src/Print.cc 2009-10-06 13:06:56 UTC (rev 761) +++ trunk/giac-xcas/giac/src/Print.cc 2009-11-24 10:21:38 UTC (rev 762) @@ -310,10 +310,18 @@ for (;ypos<h;){ if (ypos) print_newpage(p); +#ifdef _HAVE_FL_UTF8_HDR_ + s->scroll_to(0,0); +#else s->position(0,0); +#endif newpos=scan(g,ypos+hp,hp); s->resize(0,0,wp,newpos-ypos); +#ifdef _HAVE_FL_UTF8_HDR_ + s->scroll_to(0,ypos); +#else s->position(0,ypos); +#endif p->place(0.0,0, margin,margin, pixel_scale); fl_draw(s); ypos = newpos; Modified: trunk/giac-xcas/giac/src/Tableur.cc =================================================================== --- trunk/giac-xcas/giac/src/Tableur.cc 2009-10-06 13:06:56 UTC (rev 761) +++ trunk/giac-xcas/giac/src/Tableur.cc 2009-11-24 10:21:38 UTC (rev 762) @@ -994,7 +994,7 @@ for (int j=c2+1;j<maxc;++j){ for (int i=0;i<maxr;++i){ gen tmp=ptr->m[i][j][0]; - if (is_zero(tmp)|| (tmp.type==_STRNG && tmp._STRNGptr->empty())){ + if (is_zero(tmp,contextptr)|| (tmp.type==_STRNG && tmp._STRNGptr->empty())){ int pr1=printcell_current_row(contextptr),pc1=printcell_current_col(contextptr); printcell_current_row(contextptr)=printcell_current_col(contextptr)=0; string s=printcell(makevecteur(vecteur(1,i),vecteur(1,j)),contextptr); Modified: trunk/giac-xcas/giac/src/Xcas1.cc =================================================================== --- trunk/giac-xcas/giac/src/Xcas1.cc 2009-10-06 13:06:56 UTC (rev 761) +++ trunk/giac-xcas/giac/src/Xcas1.cc 2009-11-24 10:21:38 UTC (rev 762) @@ -84,6 +84,7 @@ bool interrupt_button = true ; bool geo_run=false; bool sheet_run=false; + bool recovery_mode=false; int fonts_available=1; void (*initialize_function)()=0; @@ -92,6 +93,7 @@ void (* menu2rpn_callback)(Fl_Widget *,void *)=0; Enlargable_Multiline_Output *Xcas_help_output =0 ; xcas::Graph2d *Xcas_DispG=0; + int show_xcas_dispg=0; Fl_Window * Xcas_DispG_Window=0; Fl_Window * Xcas_Main_Window=0; Fl_Button *Xcas_DispG_Cancel=0; @@ -472,6 +474,15 @@ else return; } + if (Xcas_DispG_Window){ + if (show_xcas_dispg){ + if (show_xcas_dispg==2) + Xcas_DispG_Window->show(); + else + Xcas_DispG_Window->hide(); + show_xcas_dispg=0; + } + } ++initialized; if (initialized % 5){ Fl::unlock(); @@ -1058,7 +1069,11 @@ if (Fl_Scroll * s = dynamic_cast<Fl_Scroll *>(hp->parent())){ int spos=s->yposition(); if (spos+s->h()>hp->h()){ +#ifdef _HAVE_FL_UTF8_HDR_ + s->scroll_to(0,max(min(hp->h()-s->h(),spos+dy),0)); +#else s->position(0,max(min(hp->h()-s->h(),spos+dy),0)); +#endif } s->redraw(); } @@ -1353,7 +1368,11 @@ int ypos=0; if (Fl_Scroll * s=(Fl_Scroll *) dynamic_cast<const Fl_Scroll *>(g)){ ypos=s->yposition(); +#ifdef _HAVE_FL_UTF8_HDR_ + s->scroll_to(s->xposition(),0); +#else s->position(s->xposition(),0); +#endif } // call widget_sprint on children int n=g->children(); @@ -1366,12 +1385,16 @@ } res += "]\n"; if (Fl_Scroll * s=(Fl_Scroll *) dynamic_cast<const Fl_Scroll *>(g)){ +#ifdef _HAVE_FL_UTF8_HDR_ + s->scroll_to(s->xposition(),ypos); +#else s->position(s->xposition(),ypos); +#endif } return res; } if (const Gen_Value_Slider *g=dynamic_cast<const Gen_Value_Slider *>(o)){ - res += "\n" + giac::print_INT_(g->pos)+" "+print_DOUBLE_(g->minimum())+" "+print_DOUBLE_(g->maximum())+" "+print_DOUBLE_(g->value())+" "+string(g->label())+"\n"; + res += "\n" + giac::print_INT_(g->pos)+" "+print_DOUBLE_(g->minimum())+" "+print_DOUBLE_(g->maximum())+" "+print_DOUBLE_(g->value())+" "+string(g->label())+" "+print_DOUBLE_(g->Fl_Valuator::step())+"\n"; return res; } return res + "\n[]\n"; @@ -2088,13 +2111,17 @@ #else istrstream is(line.c_str()); #endif - double m,M,val; + double m,M,val,step=0.1; int pos; string name; // is >> name ; // this is not the name but //, name is read below - is >> pos >> m >> M >> val >> name; + try { + is >> pos >> m >> M >> val >> name >> step; + } catch(std::runtime_error & e) { + } Gen_Value_Slider * res=new Gen_Value_Slider(x+3*lsize,y,w-3*lsize,h,pos,m,M,(M-m)/100.,name,name.c_str()); res->value(val); + res->step(step); res->label(name.c_str()); res->labelfont(police); res->labelsize(lsize); @@ -2168,7 +2195,8 @@ if (nchar<=L-i-1){ string tmps=s.substr(i+1,nchar); gen replace; - unarchive_session_string(tmps,-1,replace,contextptr); + if (!recovery_mode) + unarchive_session_string(tmps,-1,replace,contextptr); i+=nchar+2; continue; } @@ -2204,7 +2232,7 @@ } giac::gen in_Xcas_fltk_interactive(const giac::gen & g,const giac::context * contextptr){ - if (is_zero(g)) + if (is_zero(g,contextptr)) return Xcas_DispG?Xcas_DispG->plot_instructions:undef; if (g.type==_SYMB){ unary_function_ptr & u=g._SYMBptr->sommet; @@ -2257,14 +2285,14 @@ return 1; } if (u==at_DispG){ + if (Xcas_DispG_Window) show_xcas_dispg=2; #ifndef WIN32 - if (Xcas_DispG_Window) Xcas_DispG_Window->show(); if (Xcas_Main_Window) Xcas_Main_Window->show(); #endif return 1; } if (u==at_DispHome){ - if (Xcas_DispG_Window) Xcas_DispG_Window->hide(); + if (Xcas_DispG_Window) show_xcas_dispg=1; return 1; } /* @@ -2306,14 +2334,26 @@ return 1; } + pthread_mutex_t interactive_mutex = PTHREAD_MUTEX_INITIALIZER; + giac::gen Xcas_fltk_interactive(const giac::gen & g,GIAC_CONTEXT){ +#ifdef HAVE_LIBPTHREAD + // cerr << "xcas lock" << g << endl; + pthread_mutex_lock(&interactive_mutex); +#endif if (block_signal){ +#ifdef HAVE_LIBPTHREAD + // cerr << "xcas unlock" << endl; + pthread_mutex_unlock(&interactive_mutex); +#endif return zero; } - Fl::lock(); gen res=in_Xcas_fltk_interactive(g,contextptr); // FIXME change interactive for context, like input - Fl::unlock(); +#ifdef HAVE_LIBPTHREAD + // cerr << "xcas unlock" << endl; + pthread_mutex_unlock(&interactive_mutex); +#endif return res; } @@ -2361,6 +2401,9 @@ Fl_Window * w = Plotfltk_w ; w->end(); Fl_Group::current(w); + int taillew=w->w(); + if (taillew<100) + w->resize(w->x(),w->y(),100,w->h()); static Fl_Button * button0 = new Fl_Button(160, 270, 70, 20); button0->shortcut("^["); button0->label(gettext("Cancel")); @@ -2383,9 +2426,9 @@ string * l=new string (it->print(contextptr)); labels.push_back(l); int taille=4+int(fl_width(l->c_str())); - if (taille>180) - taille=180; - o=new Fl_Input(taille,current_y,240-taille,20,l->c_str()); + if (taille>taillew/2) + taille=taillew/2; + o=new Fl_Input(taille,current_y,taillew-taille,20,l->c_str()); vinput.push_back(o); if (!focused){ focused=true; @@ -2399,9 +2442,9 @@ string * l=new string (it->print(contextptr)); labels.push_back(l); int taille=4+int(fl_width(l->c_str())); - if (taille>180) - taille=180; - o=new Fl_Input(taille,current_y,240-taille,20,l->c_str()); + if (taille>taillew/2) + taille=taillew/2; + o=new Fl_Input(taille,current_y,taillew-taille,20,l->c_str()); ++it; vinput.push_back(o); if (!focused){ @@ -2423,9 +2466,9 @@ string * l=new string (vg[0].eval(eval_level(contextptr),contextptr).print(contextptr)); labels.push_back(l); int taille=4+int(fl_width(l->c_str())); - if (taille>180) - taille=180; - o=new Fl_Input(taille,current_y,240-taille,20,l->c_str()); + if (taille>taillew/2) + taille=taillew/2; + o=new Fl_Input(taille,current_y,taillew-taille,20,l->c_str()); if (vg.size()>1&& u!=at_Request) o->value(vg[1].eval(eval_level(contextptr),contextptr).print(contextptr).c_str()); vinput.push_back(o); @@ -2442,11 +2485,11 @@ if (u==at_Title){ string * l=new string (g.print(contextptr)); labels.push_back(l); - o=new Fl_Output(200,current_y,0,20,l->c_str()); + o=new Fl_Output(taillew-40,current_y,0,20,l->c_str()); o->value(""); } else { - o=new Fl_Output(40,current_y,180,20,""); + o=new Fl_Output(40,current_y,taillew-60,20,""); o->value(g.print(contextptr).c_str()); } voutput.push_back(o); @@ -2672,7 +2715,7 @@ vecteur v(inputform_pre_analysis(arg,contextptr)); if (v.empty()){ Fl::lock(); - if (Xcas_DispG_Window) Xcas_DispG_Window->show(); + if (Xcas_DispG_Window) show_xcas_dispg=2; if (Xcas_DispG_Cancel) Xcas_DispG_Cancel->show(); if (Xcas_DispG) Xcas_DispG->waiting_click=true; Fl::unlock(); @@ -2741,8 +2784,10 @@ if (inf){ char ch[13]; ch[12]=0; - if (fread(ch,1,12,inf)==12 && !strcmp(ch,"spreadsheet[")) + if (fread(ch,1,12,inf)==12 && !strcmp(ch,"spreadsheet[")){ + giac::makespreadsheetmatrice(*g._VECTptr,0); g.subtype=giac::_SPREAD__VECT; + } fclose(inf); } } @@ -2817,13 +2862,13 @@ // open a FLTK window, that will be printed to filename when closed // return false if FLTK not avail - bool fltk_view(const giac::gen & g,const giac::gen & ge,const std::string & filename,const std::string & figure_filename,int file_type){ + bool fltk_view(const giac::gen & g,const giac::gen & ge,const std::string & filename,const std::string & figure_filename,int file_type,const giac::context *contextptr){ #ifdef __APPLE__ return false; #endif #ifdef HAVE_LIBFLTK // FIXME GIAC_CONTEXT - const giac::context * contextptr = get_context(Fl_Group::current()); + // const giac::context * contextptr = get_context(Fl_Group::current()); bool geometry=!figure_filename.empty(); static Fl_Window * w=0; static Fl_Return_Button * button0 = 0 ; @@ -2860,6 +2905,7 @@ giac::gen tmp=giac::gen(giac::remove_path(giac::remove_extension(figure_filename)),contextptr); if (tmp.type==giac::_IDNT) t->table->name=tmp; + t->table->contextptr=(giac::context *) contextptr; if (giac::ckmatrix(ge,true) && ge.subtype==giac::_SPREAD__VECT){ t->table->set_matrix(*ge._VECTptr,true,false); // don't reeval! // t->table->paste(*ge._VECTptr,false); // don't reeval! @@ -3052,9 +3098,10 @@ strcpy(label, gettext("What a nice font")); int i = strlen(label); uchar c; - for (c = ' '+1; c < 127; c++) {if (!(c&0x1f)) label[i++]='\n'; label[i++]=c;} - label[i++] = '\n'; - for (c = 0xA1; c; c++) {if (!(c&0x1f)) label[i++]='\n'; label[i++]=c;} + label[i++] = char(10); + for (c = ' '+1; c < 127; c++,i++) {if (!(c&0x1f)) label[i]=' '; else label[i]=c;} + label[i++] = char(10); + for (c = 0xA1; c; c++,i++) {if (!(c&0x1f)) label[i]=' '; else label[i]=c;} label[i] = 0; button0 = new Fl_Return_Button(100,10,100,20); button0->shortcut(0xff0d); @@ -3122,6 +3169,15 @@ return true; } + /* + void test_alert(){ + string s; + for (int i=0;i<256;i++) + s+=char(i); + fl_alert(s.c_str()); + } + */ + #endif // HAVE_LIBFLTK #ifndef NO_NAMESPACE_XCAS Modified: trunk/giac-xcas/giac/src/Xcas1.h =================================================================== --- trunk/giac-xcas/giac/src/Xcas1.h 2009-10-06 13:06:56 UTC (rev 761) +++ trunk/giac-xcas/giac/src/Xcas1.h 2009-11-24 10:21:38 UTC (rev 762) @@ -39,6 +39,8 @@ extern bool geo_run; // when true a sheet is reevaled after load extern bool sheet_run; + // when true context is not restored + extern bool recovery_mode; // number of fonts available extern int fonts_available; // save format is compatible with Xcas < 0.8.1 @@ -54,6 +56,9 @@ extern Fl_Button *Xcas_Cancel; extern Fl_Double_Window * Xcas_Debug_Window; +#ifdef HAVE_LIBPTHREAD + extern pthread_mutex_t interactive_mutex; +#endif bool stream_copy(std::istream & in,std::ostream & out); extern bool interrupt_button; @@ -136,7 +141,7 @@ #endif - bool fltk_view(const giac::gen & g,const giac::gen & ge,const std::string & filename,const std::string & figure_filename,int file_type); + bool fltk_view(const giac::gen & g,const giac::gen & ge,const std::string & filename,const std::string & figure_filename,int file_type,const giac::context *); void icas_eval(giac::gen & g,giac::gen & gg,int & reading_file,std::string &filename,giac::context * contextptr); Modified: trunk/giac-xcas/giac/src/alg_ext.cc =================================================================== --- trunk/giac-xcas/giac/src/alg_ext.cc 2009-10-06 13:06:56 UTC (rev 761) +++ trunk/giac-xcas/giac/src/alg_ext.cc 2009-11-24 10:21:38 UTC (rev 762) @@ -369,7 +369,7 @@ // 0 0 ... ? * * * // with ? != 0, we check ?, if it is zero we try another value k vecteur v(m[na*nb-1]._VECTptr->begin(),m[na*nb-1]._VECTptr->end()-1); - if (!is_zero__VECT(v)) + if (!is_zero__VECT(v,contextptr)) break; } mdividebypivot(m); @@ -973,7 +973,13 @@ recompute_minmax(vecteur(1,range[0]),range,expr,var,resmin,resmax,xmin,xmax,1,contextptr); recompute_minmax(vecteur(1,range[1]),range,expr,var,resmin,resmax,xmin,xmax,-1,contextptr); // Singularities - w=find_singularities(v[0],*var._IDNTptr,0,contextptr); + vecteur ws=find_singularities(v[0],*var._IDNTptr,0,contextptr); + int wss=ws.size(); + w.clear(); + for (int i=0;i<wss;++i){ + if (ws[i]!=range[0] && ws[i]!=range[1]) + w.push_back(ws[i]); + } recompute_minmax(w,range,expr,var,resmin,resmax,xmin,xmax,1,contextptr); recompute_minmax(w,range,expr,var,resmin,resmax,xmin,xmax,-1,contextptr); if (minmax/3){ @@ -998,7 +1004,7 @@ gen g2=g._IDNTptr->eval(1,g,contextptr); if ((g2.type==_VECT) && (g2.subtype==_ASSUME__VECT)){ vecteur v=*g2._VECTptr; - if ( (v.size()==3) && (v.front()==_DOUBLE_) && (v[1].type==_VECT)){ + if ( (v.size()==3) && (v.front()==vecteur(0) || v.front()==_DOUBLE_ || v.front()==_ZINT) && (v[1].type==_VECT)){ a=*v[1]._VECTptr; return; } Modified: trunk/giac-xcas/giac/src/desolve.cc =================================================================== --- trunk/giac-xcas/giac/src/desolve.cc 2009-10-06 13:06:56 UTC (rev 761) +++ trunk/giac-xcas/giac/src/desolve.cc 2009-11-24 10:21:38 UTC (rev 762) @@ -287,7 +287,7 @@ unary_function_ptr at_invlaplace (&__invlaplace,0,true); void unable_to_solve_diffeq(){ - setsizeerr("Unable to solve diff eq"); + setsizeerr("Unable to solve differential equation"); } gen diffeq_constante(int i,GIAC_CONTEXT){ Modified: trunk/giac-xcas/giac/src/first.h =================================================================== --- trunk/giac-xcas/giac/src/first.h 2009-10-06 13:06:56 UTC (rev 761) +++ trunk/giac-xcas/giac/src/first.h 2009-11-24 10:21:38 UTC (rev 762) @@ -15,9 +15,18 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#undef max +#undef min + #ifndef _GIAC_FIRST_H_ #define _GIAC_FIRST_H_ + +#ifdef USE_GMP_REPLACEMENTS +#include "gmp_replacements.h" +#else #include <gmp.h> +#endif + #include <cassert> class init_gmp_memory Modified: trunk/giac-xcas/giac/src/gen.cc =================================================================== --- trunk/giac-xcas/giac/src/gen.cc 2009-10-06 13:06:56 UTC (rev 761) +++ trunk/giac-xcas/giac/src/gen.cc 2009-11-24 10:21:38 UTC (rev 762) @@ -27,6 +27,7 @@ #include <list> #include <errno.h> #include <string.h> +#include <iomanip> #include "gen.h" #include "gausspol.h" #include "identificateur.h" @@ -55,7 +56,11 @@ namespace giac { #endif // ndef NO_NAMESPACE_GIAC + /* unsigned control_c_counter=0; + unsigned control_c_counter_mask=0xff; + */ + #ifdef HAVE_LIBPTHREAD pthread_mutex_t mpfr_mutex = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t locale_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -119,6 +124,10 @@ throw(std::runtime_error(last_evaled_function(contextptr)+"Max order ("+gen(max_series_expansion_order).print(contextptr)+") exceeded or non unidirectional series")); } + void setstabilityerr(GIAC_CONTEXT){ + throw(std::runtime_error(last_evaled_function(contextptr)+"calculation size limit exceeded")); + } + void swap(int & a,int & b){ int t=a; a=b; @@ -304,6 +313,8 @@ } gen factorial(unsigned long int i){ + if (i>FACTORIAL_SIZE_LIMIT) + setstabilityerr(); ref_mpz_t * e = new ref_mpz_t; //mpz_t * e=new_mpz_t(); mpz_fac_ui(e->z,i); @@ -311,6 +322,8 @@ } gen comb(unsigned long int i,unsigned long j){ + if (i>FACTORIAL_SIZE_LIMIT || j>FACTORIAL_SIZE_LIMIT) + setstabilityerr(); ref_mpz_t * e = new ref_mpz_t; if (i<j) return e; @@ -320,12 +333,14 @@ mpz_t tmp; mpz_init(tmp); mpz_fac_ui(tmp,j); - mpz_div(e->z,e->z,tmp); + mpz_fdiv_q(e->z,e->z,tmp); mpz_clear(tmp); return e; } gen perm(unsigned long int i,unsigned long j){ + if (i>FACTORIAL_SIZE_LIMIT || j>FACTORIAL_SIZE_LIMIT) + setstabilityerr(); ref_mpz_t * e = new ref_mpz_t; if (i<j) return e; @@ -340,6 +355,9 @@ } gen::gen(longlong i) { +#ifdef COMPILE_FOR_STABILITY + control_c(); +#endif val=i; // longlong temp=val; if (val==i && val!=1<<31){ @@ -389,6 +407,9 @@ } gen::gen(const mpz_t & m) { +#ifdef COMPILE_FOR_STABILITY + control_c(); +#endif #ifdef SMARTPTR64 * ((longlong * ) this) = longlong(new ref_mpz_t(m)) << 16; #else @@ -421,6 +442,9 @@ #endif gen::gen(const identificateur & s){ +#ifdef COMPILE_FOR_STABILITY + control_c(); +#endif #ifdef SMARTPTR64 * ((longlong * ) this) = longlong(new ref_identificateur(s)) << 16; #else @@ -453,6 +477,9 @@ } gen::gen(const symbolic & s){ +#ifdef COMPILE_FOR_STABILITY + control_c(); +#endif #ifdef SMARTPTR64 * ((longlong * ) this) = longlong(new ref_symbolic(s)) << 16; #else @@ -675,7 +702,7 @@ gen accurate_evalf(const gen & g,int nbits){ gen r(g.re(context0)),i(g.im(context0)); // only called for numeric values - if (is_zero(i)) + if (is_zero(i,context0)) return set_precision(r,nbits); else return gen(set_precision(r,nbits),set_precision(i,nbits)); @@ -806,14 +833,16 @@ } gen::gen(const gen & e) { - if (e.type>_DOUBLE_ + if (e.type>_DOUBLE_) { + if ( #ifdef SMARTPTR64 - && (*((longlong *) &e) >> 16) + (*((longlong *) &e) >> 16) #else - && e.__ZINTptr + e.__ZINTptr #endif ) - ++(e.ref_count()); + ++(e.ref_count()); + } #ifdef DOUBLEVAL _DOUBLE_val = e._DOUBLE_val; #else @@ -868,7 +897,7 @@ gen::gen(const gen & a,const gen & b) { // a and b must be type <2! if ( (a.type>=_CPLX) || (b.type>=_CPLX) ) settypeerr("complex constructor"); - if (is_zero(b)){ + if (is_zero(b,context0)){ type=a.type; switch (type ) { case _INT_: @@ -969,17 +998,19 @@ return res; int base=0; if (s[0]=='#' || s[0]=='0') { - if (s[1]=='x'){ + if (s[1]=='x' || s[1]=='X'){ s[0]='0'; + s[1]='0'; base=16; } - if (s[1]=='o'){ + if (s[1]=='o' || s[1]=='O'){ s[0]='0'; s[1]='0'; base=8; } } - if (s[1]=='b'){ + if (s[1]=='b' || s[1]=='B'){ + s[0]='0'; s[1]='0'; base=2; } @@ -989,7 +1020,7 @@ errno = 0; #endif char * endchar; - long ll=strtol(s,&endchar,base); + longlong ll=strtoll(s,&endchar,base); int l =strlen(s); if (*endchar) {// non integer if (decimal_digits(contextptr)>13){ @@ -1041,7 +1072,13 @@ return gen(d); } if (!errno ){ - if (ll==int(ll)) + // this converts 0xFFFFFFFF to -1, because we want two's complement, if possible + // it makes positive numbers 0x80000000 to 0xFFFFFFFF unavailable (only in base-2 notation), + // but I am aware of that + if (ll==int(ll) || + ( (base == 2 ||base == 8 || base == 16) && + ll == (unsigned int)(ll) ) + ) return gen ( int(ll)); else return gen(longlong(ll)); @@ -1062,7 +1099,7 @@ } else { ref_mpz_t * ptr= new ref_mpz_t; - mpz_set_str(ptr->z,s,0); + mpz_set_str(ptr->z,s,base); res= gen(ptr); return res; } @@ -1655,7 +1692,7 @@ res.coord.reserve(itend-it); for (;it!=itend;++it){ gen tmp(f(it->value)); - if (!is_zero(tmp)) + if (!is_zero(tmp,context0)) res.coord.push_back(monomial<gen>(tmp,it->index)); } return res; @@ -1667,7 +1704,7 @@ res.coord.reserve(itend-it); for (;it!=itend;++it){ gen tmp(f(it->value,contextptr)); - if (!is_zero(tmp)) + if (!is_zero(tmp,contextptr)) res.coord.push_back(monomial<gen>(tmp,it->index)); } return res; @@ -2119,11 +2156,11 @@ case _INT_: case _DOUBLE_: case _ZINT: case _REAL: return true; case _CPLX: - return (is_zero(*(_CPLXptr+1))); + return (is_zero(*(_CPLXptr+1),contextptr)); case _POLY: return poly_is_real(*_POLYptr); default: - return is_zero(im(contextptr)); + return is_zero(im(contextptr),contextptr); } } @@ -2221,7 +2258,7 @@ case _IDNT: if (!complex_variables(contextptr)) return *this; - /* if ( (_IDNTptr->value) && (is_zero(_IDNTptr->value->im())) ) + /* if ( (_IDNTptr->value) && (is_zero(_IDNTptr->value->im(),contextptr)) ) return *this; */ return new ref_symbolic(symbolic(at_conj,*this)); case _SYMB: @@ -2357,11 +2394,11 @@ reim(e,r,i,contextptr); if (n==1) return ; - if (is_zero(i)){ + if (is_zero(i,contextptr)){ r=pow(r,n); return; } - if (is_zero(r)){ + if (is_zero(r,contextptr)){ if (n%2){ r=zero; i=pow(i,n); @@ -2403,7 +2440,7 @@ i=new ref_symbolic(symbolic(at_plus,sommei)); return ; } // end integer exponent - if ( is_zero(im(expo,contextptr)) && is_zero(im(e,contextptr)) ){ + if ( is_zero(im(expo,contextptr),contextptr) && is_zero(im(e,contextptr),contextptr) ){ if (!is_integer(expo) && is_positive(-e,contextptr)){ r=pow(-e,expo,contextptr)*cos(cst_pi*expo,contextptr); i=pow(-e,expo,contextptr)*sin(cst_pi*expo,contextptr); @@ -2433,7 +2470,7 @@ } gen ref,imf; reim(f,ref,imf,contextptr); - if (is_zero(imf) && equalposcomp(reim_op,u)){ + if (is_zero(imf,contextptr) && equalposcomp(reim_op,u)){ r=s; i=0; return; } if (u==at_ln){ // FIXME?? might recurse @@ -2449,7 +2486,7 @@ reim(rdiv(sinh(f,contextptr),cosh(f,contextptr)),r,i,contextptr); return; } - if ((u==at_asin || u==at_acos) && is_zero(imf) && is_greater(1,f,contextptr) && is_greater(f,-1,contextptr)){ + if ((u==at_a... [truncated message content] |
From: <pa...@us...> - 2009-10-06 13:07:43
|
Revision: 761 http://xcas.svn.sourceforge.net/xcas/?rev=761&view=rev Author: parisse Date: 2009-10-06 13:06:56 +0000 (Tue, 06 Oct 2009) Log Message: ----------- Modified Paths: -------------- trunk/giac-xcas/giac/src/Cfg.cc trunk/giac-xcas/giac/src/Editeur.cc trunk/giac-xcas/giac/src/Graph.cc trunk/giac-xcas/giac/src/Graph.h trunk/giac-xcas/giac/src/Graph3d.cc trunk/giac-xcas/giac/src/Input.cc trunk/giac-xcas/giac/src/Xcas1.cc trunk/giac-xcas/giac/src/derive.cc trunk/giac-xcas/giac/src/desolve.cc trunk/giac-xcas/giac/src/dispatch.h trunk/giac-xcas/giac/src/gen.cc trunk/giac-xcas/giac/src/hist.cxx trunk/giac-xcas/giac/src/hist.fl trunk/giac-xcas/giac/src/hist.h trunk/giac-xcas/giac/src/input_lexer.cc trunk/giac-xcas/giac/src/input_lexer.ll trunk/giac-xcas/giac/src/intg.cc trunk/giac-xcas/giac/src/intgab.cc trunk/giac-xcas/giac/src/intgab.h trunk/giac-xcas/giac/src/plot.cc trunk/giac-xcas/giac/src/prog.cc trunk/giac-xcas/giac/src/prog.h trunk/giac-xcas/giac/src/risch.cc trunk/giac-xcas/giac/src/series.cc trunk/giac-xcas/giac/src/solve.cc trunk/giac-xcas/giac/src/subst.cc trunk/giac-xcas/giac/src/subst.h trunk/giac-xcas/giac/src/tex.cc trunk/giac-xcas/giac/src/ti89.cc trunk/giac-xcas/giac/src/usual.cc trunk/giac-xcas/giac/src/usual.h Modified: trunk/giac-xcas/giac/src/Cfg.cc =================================================================== --- trunk/giac-xcas/giac/src/Cfg.cc 2009-09-18 10:33:24 UTC (rev 760) +++ trunk/giac-xcas/giac/src/Cfg.cc 2009-10-06 13:06:56 UTC (rev 761) @@ -188,7 +188,7 @@ giac::scientific_format(do_scientific_format,contextptr); giac::integer_format(do_integer_format,contextptr); giac::MAX_RECURSION_LEVEL=do_max_recursion_level; - giac::DEFAULT_EVAL_LEVEL=do_eval_level; + giac::eval_level(contextptr)= giac::DEFAULT_EVAL_LEVEL=do_eval_level; giac::prog_eval_level_val(int(Xcas_prog_eval_level->value()),contextptr); giac::NEWTON_DEFAULT_ITERATION==max(giac::absint(int(Xcas_Newton->value())),20); giac::debug_infolevel=do_debug_infolevel; @@ -440,7 +440,7 @@ } do_max_recursion_level=giac::MAX_RECURSION_LEVEL; Xcas_recursion_level->value(do_max_recursion_level); - do_eval_level=giac::DEFAULT_EVAL_LEVEL; + do_eval_level=giac::DEFAULT_EVAL_LEVEL=giac::eval_level(contextptr); Xcas_eval_level->value(do_eval_level); Xcas_prog_eval_level->value(giac::prog_eval_level_val(contextptr)); do_debug_infolevel=giac::debug_infolevel; Modified: trunk/giac-xcas/giac/src/Editeur.cc =================================================================== --- trunk/giac-xcas/giac/src/Editeur.cc 2009-09-18 10:33:24 UTC (rev 760) +++ trunk/giac-xcas/giac/src/Editeur.cc 2009-10-06 13:06:56 UTC (rev 761) @@ -100,6 +100,7 @@ "downto", "elif", "else", + "end", "end_case", "end_for", "end_if", @@ -108,6 +109,7 @@ "et", "faire", "false", + "ffaire", "fi", "for", "fpour", @@ -116,6 +118,8 @@ "ftantque", "goto", "if", + "jusqu_a", + "jusqua", "jusque", "label", "non", @@ -128,6 +132,7 @@ "pour", "proc", "repeat", + "repeter", "return", "si", "sinon", @@ -1094,6 +1099,17 @@ if (ed && ed->log){ ed->log->value((gettext("Parse error line ")+print_INT_(giac::first_error_line(contextptr))+ gettext(" at ") +giac::error_token_name(contextptr)).c_str()); ed->log->redraw(); + Fl_Group * gr=ed->log->parent(); + if (gr->children()>2){ + int ah = gr->child(2)->h(); + Fl_Widget * wid=gr->child(2); + gr->remove(wid); + delete wid; + gr->Fl_Widget::resize(gr->x(),gr->y(),gr->w(),gr->h()-ah); + History_Pack * hp=get_history_pack(gr); + if (hp) + hp->redraw(); + } } nextline=false; } @@ -1161,6 +1177,14 @@ if (log){ logs+=gettext("Parse error line ")+print_INT_(giac::first_error_line(contextptr))+ gettext(" at ") +giac::error_token_name(contextptr); log->value(logs.c_str()); + Fl_Group * gr=log->parent(); + if (gr->children()>2){ + int ah = gr->child(2)->h(); + Fl_Widget * wid=gr->child(2); + gr->remove(wid); + delete wid; + gr->Fl_Widget::resize(gr->x(),gr->y(),gr->w(),gr->h()-ah); + } // if (Parse_error_output) // Parse_error_output->value(logs.c_str()); output_resize_parent(log); @@ -1470,20 +1494,60 @@ break; case 1: ed->buffer()->insert(i,"\nif then else fi;\n"); - ed->insert_position(i+5); + ed->insert_position(i+4); break; case 2: ed->buffer()->insert(i,"\nif then else end_if;\n"); - ed->insert_position(i+5); + ed->insert_position(i+4); break; case 3: ed->buffer()->insert(i,"\n:If Then\n:Else \n:EndIf;\n"); - ed->insert_position(i+5); + ed->insert_position(i+4); break; } } } + static void cb_prg_sialorssinon(Fl_Menu_* m , void*) { + Fl_Text_Editor * ed = find_editor(m); + if (ed){ + giac::context * contextptr = get_context(ed); + int i=ed->insert_position(); + ed->buffer()->insert(i,"\nsi alors sinon fsi;\n"); + ed->insert_position(i+4); + } + } + + static void cb_prg_pour(Fl_Menu_* m , void*) { + Fl_Text_Editor * ed = find_editor(m); + if (ed){ + giac::context * contextptr = get_context(ed); + int i=ed->insert_position(); + ed->buffer()->insert(i,"\npour de jusque faire\n\nfpour;\n"); + ed->insert_position(i+6); + } + } + + static void cb_prg_tantque(Fl_Menu_* m , void*) { + Fl_Text_Editor * ed = find_editor(m); + if (ed){ + giac::context * contextptr = get_context(ed); + int i=ed->insert_position(); + ed->buffer()->insert(i,"\ntantque faire\n\nftantque;\n"); + ed->insert_position(i+9); + } + } + + static void cb_prg_repeter(Fl_Menu_* m , void*) { + Fl_Text_Editor * ed = find_editor(m); + if (ed){ + giac::context * contextptr = get_context(ed); + int i=ed->insert_position(); + ed->buffer()->insert(i,"\nrepeter\n\njusqu_a ;\n"); + ed->insert_position(i+9); + } + } + static void cb_prg_ifthen(Fl_Menu_* m , void*) { Fl_Text_Editor * ed = find_editor(m); if (ed){ @@ -1496,15 +1560,15 @@ break; case 1: ed->buffer()->insert(i,"\nif then fi;\n"); - ed->insert_position(i+5); + ed->insert_position(i+4); break; case 2: ed->buffer()->insert(i,"\nif then end_if;\n"); - ed->insert_position(i+5); + ed->insert_position(i+4); break; case 3: ed->buffer()->insert(i,"\n:If Then\n:EndIf\n"); - ed->insert_position(i+5); + ed->insert_position(i+4); break; } } @@ -1645,12 +1709,16 @@ {gettext("return"), 0, (Fl_Callback *) cb_prg_return, 0, 0, 0, 0, 14, 56}, {0}, // end Func {gettext("Test"), 0, 0, 0, 64, 0, 0, 14, 56}, + {gettext("si alors sinon"), 0, (Fl_Callback *) cb_prg_sialorssinon, 0, 0, 0, 0, 14, 56}, {gettext("if [then] else"), 0, (Fl_Callback *) cb_prg_ifthenelse, 0, 0, 0, 0, 14, 56}, {gettext("if [then]"), 0, (Fl_Callback *) cb_prg_ifthen, 0, 0, 0, 0, 14, 56}, {gettext("switch"), 0, (Fl_Callback *) cb_prg_switch, 0, 0, 0, 0, 14, 56}, {gettext("try catch"), 0, (Fl_Callback *) cb_prg_trycatch, 0, 0, 0, 0, 14, 56}, {0}, // end Test {gettext("Loop"), 0, 0, 0, 64, 0, 0, 14, 56}, + {gettext("pour"), 0, (Fl_Callback *) cb_prg_pour, 0, 0, 0, 0, 14, 56}, + {gettext("tantque"), 0, (Fl_Callback *) cb_prg_tantque, 0, 0, 0, 0, 14, 56}, + {gettext("repeter jusqu_a"), 0, (Fl_Callback *) cb_prg_repeter, 0, 0, 0, 0, 14, 56}, {gettext("for"), 0, (Fl_Callback *) cb_prg_for, 0, 0, 0, 0, 14, 56}, {gettext("while"), 0, (Fl_Callback *) cb_prg_while, 0, 0, 0, 0, 14, 56}, {gettext("break"), 0, (Fl_Callback *) cb_prg_break, 0, 0, 0, 0, 14, 56}, @@ -1721,7 +1789,7 @@ } button = new Fl_Button(x+w/3+w/12,y,w/12,L); button->labelsize(labelsize()); - button->label("OK"); + button->label("OK (Esc)"); button->tooltip(gettext("Parse current program")); button->callback((Fl_Callback *) cb_Editeur_Test); button->shortcut(0xff1b); // FIXME: quick fix, otherwise Esc leaves xcas Modified: trunk/giac-xcas/giac/src/Graph.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph.cc 2009-09-18 10:33:24 UTC (rev 760) +++ trunk/giac-xcas/giac/src/Graph.cc 2009-10-06 13:06:56 UTC (rev 761) @@ -337,6 +337,12 @@ } if (optname.val==_GL_ORTHO && optvalue==1) orthonormalize(); + if (optname.val==_GL_X_AXIS_COLOR && optvalue.type==_INT_) + x_axis_color=optvalue.val; + if (optname.val==_GL_Y_AXIS_COLOR && optvalue.type==_INT_) + y_axis_color=optvalue.val; + if (optname.val==_GL_Z_AXIS_COLOR && optvalue.type==_INT_) + z_axis_color=optvalue.val; if (optname.val>=_GL_X && optname.val<=_GL_Z && optvalue.is_symb_of_sommet(at_interval)){ gen optvf=evalf_double(optvalue._SYMBptr->feuille,1,contextptr); if (optvf.type==_VECT && optvf._VECTptr->size()==2){ @@ -965,6 +971,22 @@ } } + static void cb_Graph2d3d_Frameoff(Fl_Widget * m , void*) { + Graph2d3d * gr = find_graph2d3d(m); + if (gr){ + gr->display_mode |= 0x80; // set bit 6 + gr->redraw(); + } + } + + static void cb_Graph2d3d_Frameon(Fl_Widget * m , void*) { + Graph2d3d * gr = find_graph2d3d(m); + if (gr){ + gr->display_mode &= (0xffff ^ 0x80);; // clear bit 6 + gr->redraw(); + } + } + static void cb_Graph_Animate(Fl_Widget * m , void*) { Graph2d3d * gr = find_graph2d3d(m); if (gr){ @@ -1000,6 +1022,8 @@ {gettext("Orthonormalize (2-d)"), 0, (Fl_Callback*)cb_Graph2d3d_Orthonormalize, 0, 0, 0, 0, 14, 56}, {gettext("Zoom in"), 0, (Fl_Callback*)cb_Graph2d3d_Zoomin, 0, 0, 0, 0, 14, 56}, {gettext("Zoom out"), 0, (Fl_Callback*)cb_Graph2d3d_Zoomout, 0, 0, 0, 0, 14, 56}, + {gettext("Frame move on"), 0, (Fl_Callback*)cb_Graph2d3d_Frameon, 0, 0, 0, 0, 14, 56}, + {gettext("Frame move off"), 0, (Fl_Callback*)cb_Graph2d3d_Frameoff, 0, 0, 0, 0, 14, 56}, {gettext("Previous"), 0, (Fl_Callback*)cb_Graph2d3d_Previous, 0, 0, 0, 0, 14, 56}, {gettext("Next"), 0, (Fl_Callback*)cb_Graph2d3d_Next, 0, 0, 0, 0, 14, 56}, {gettext("Config"), 0, (Fl_Callback*)cb_Graph2d3d_Config, 0, 0, 0, 0, 14, 56}, @@ -1057,24 +1081,24 @@ bzoomin->tooltip(gettext("Zoom in")); bzoomin->callback(cb_graph_buttons); Fl_Button * bup = new Fl_Button(bx+bw,by,bw,bh,"@-18"); - bup->color(dark_green_color); + bup->color(y_axis_color); bup->tooltip(gettext("Increase y")); bup->callback(cb_graph_buttons); Fl_Button * bupright = new Fl_Button(bx+2*bw,by,bw,bh,"@-18"); - bupright->color(FL_BLUE); + bupright->color(z_axis_color); bupright->tooltip(gettext("Increase z (3-d)/Zoom in for y (2-d)")); bupright->callback(cb_graph_buttons); by += bh; Fl_Button * bleft = new Fl_Button(bx,by,bw,bh,"@-1<-"); bleft->when(FL_WHEN_RELEASE); - bleft->color(FL_ROUGE_PALE); + bleft->color(x_axis_color); bleft->tooltip(gettext("Decrease x")); bleft->callback(cb_graph_buttons); Fl_Button * bortho = new Fl_Button(bx+bw,by,bw,bh,"_|_"); bortho->tooltip(gettext(is3d?"Hide or show below depth":"Orthonormalize")); bortho->callback(cb_graph_buttons); Fl_Button * bright = new Fl_Button(bx+2*bw,by,bw,bh,"@-1->"); - bright->color(FL_ROUGE_PALE); + bright->color(x_axis_color); bright->tooltip(gettext("Increase x")); bright->callback(cb_graph_buttons); by += bh; @@ -1082,11 +1106,11 @@ bzoomout->tooltip(gettext("Zoom out")); bzoomout->callback(cb_graph_buttons); Fl_Button * bdown = new Fl_Button(bx+bw,by,bw,bh,"@-12"); - bdown->color(dark_green_color); + bdown->color(y_axis_color); bdown->tooltip(gettext("Decrease y")); bdown->callback(cb_graph_buttons); Fl_Button * bdownright = new Fl_Button(bx+2*bw,by,bw,bh,"@-12"); - bdownright->color(FL_BLUE); + bdownright->color(z_axis_color); bdownright->tooltip(gettext("Decrease z (3-d)/Zoom out in y (2-d)")); bdownright->callback(cb_graph_buttons); by += bh; @@ -1146,6 +1170,9 @@ struct timezone tz; gettimeofday(&animation_last,&tz); legende_size=giac::LEGENDE_SIZE; + x_axis_color=FL_RED; + y_axis_color=dark_green_color; + z_axis_color=FL_BLUE; } Graph2d3d::Graph2d3d(int x,int y,int w,int h,const char * l,History_Pack * hp_): @@ -1171,6 +1198,9 @@ struct timezone tz; gettimeofday(&animation_last,&tz); push_cfg(); + x_axis_color=FL_RED; + y_axis_color=dark_green_color; + z_axis_color=FL_BLUE; } Graph2d3d::~Graph2d3d(){ @@ -1443,30 +1473,30 @@ int y_=2; wxmin=new Fl_Value_Input(dx/6,y_,dx/6-2,dh-4,"WX-"); wxmin->tooltip(gettext("Xmin for visualisation")); - wxmin->labelcolor(FL_RED); + wxmin->labelcolor(x_axis_color); wxmax=new Fl_Value_Input(dx/2,y_,dx/6-2,dh-4,"WX+"); wxmax->tooltip(gettext("Xmax for visualisation")); - wxmax->labelcolor(FL_RED); + wxmax->labelcolor(x_axis_color); notperspective=new Fl_Check_Button(5*dx/6,y_,dx/6-2,dh-4,"Ortho proj"); notperspective->tooltip(gettext("Orthonormal or perspective")); notperspective->value(0); y_ += dh; wymin=new Fl_Value_Input(dx/6,y_,dx/6-2,dh-4,"WY-"); wymin->tooltip(gettext("Ymin for visualisation")); - wymin->labelcolor(dark_green_color); + wymin->labelcolor(y_axis_color); wymax=new Fl_Value_Input(dx/2,y_,dx/6-2,dh-4,"WY+"); wymax->tooltip(gettext("Ymax for visualisation")); - wymax->labelcolor(dark_green_color); + wymax->labelcolor(y_axis_color); blend=new Fl_Check_Button(5*dx/6,y_,dx/6-2,dh-4,"Blend"); blend->tooltip(gettext("Enable blending")); blend->value(1); y_ += dh; wzmin=new Fl_Value_Input(dx/6,y_,dx/6-2,dh-4,"WZ-"); wzmin->tooltip(gettext("Zmin for visualisation")); - wzmin->labelcolor(FL_BLUE); + wzmin->labelcolor(z_axis_color); wzmax=new Fl_Value_Input(dx/2,y_,dx/6-2,dh-4,"WZ+"); wzmax->tooltip(gettext("Zmax for visualisation")); - wzmax->labelcolor(FL_BLUE); + wzmax->labelcolor(z_axis_color); shade=new Fl_Check_Button(5*dx/6,y_,dx/6-2,dh-4,"Gouraud"); shade->tooltip(gettext("Flat or Gouraud shading")); shade->value(0); @@ -2516,11 +2546,13 @@ newx=(current_i-push_i)*x_scale; newy=(push_j-current_j)*y_scale; round3(newx,window_xmin,window_xmax); - round3(newy,window_ymin,window_ymax); - window_xmin -= newx; - window_xmax -= newx; - window_ymin -= newy; - window_ymax -= newy; + round3(newy,window_ymin,window_ymax); + if (!(display_mode & 0x80)){ + window_xmin -= newx; + window_xmax -= newx; + window_ymin -= newy; + window_ymax -= newy; + } push_i = current_i; push_j = current_j; ++animation_instructions_pos; @@ -3064,7 +3096,8 @@ moving = true; } else { // nothing selected, move frame - moving_frame=true; + if (!(display_mode & 0x80)) // disabled by default in 3-d + moving_frame=true; } return 1; } @@ -4369,11 +4402,11 @@ findij(zero,x_scale,y_scale,I0,J0,contextptr); int i_0=round(I0),j_0=round(J0); if ( show_axes && (window_ymax>=0) && (window_ymin<=0)){ // X-axis - fl_color(FL_RED); + fl_color(x_axis_color); check_fl_line(deltax,deltay+j_0,deltax+horizontal_pixels,deltay+j_0,clip_x,clip_y,clip_w,clip_h,0,0); fl_color(FL_CYAN); check_fl_line(deltax+i_0,deltay+j_0,deltax+i_0+int(x_scale),deltay+j_0,clip_x,clip_y,clip_w,clip_h,0,0); - fl_color(FL_RED); + fl_color(x_axis_color); if (x_tick>0 && (horizontal_pixels)/(x_scale*x_tick) < 40){ double nticks=(horizontal_pixels-I0)/(x_scale*x_tick); for (int ii=int(-I0/(x_tick*x_scale));ii<=nticks;++ii){ @@ -4385,11 +4418,11 @@ check_fl_draw(tmp.c_str(),deltax+horizontal_pixels-int(fl_width(tmp.c_str())),deltay+j_0+labelsize(),clip_x,clip_y,clip_w,clip_h,0,0); } if ( show_axes && (window_xmax>=0) && (window_xmin<=0) ) {// Y-axis - fl_color(dark_green_color); + fl_color(y_axis_color); check_fl_line(deltax+i_0,deltay,deltax+i_0,deltay+vertical_pixels,clip_x,clip_y,clip_w,clip_h,0,0); fl_color(FL_CYAN); check_fl_line(deltax+i_0,deltay+j_0,deltax+i_0,deltay+j_0-int(y_scale),clip_x,clip_y,clip_w,clip_h,0,0); - fl_color(dark_green_color); + fl_color(y_axis_color); if (y_tick>0 && vertical_pixels/(y_tick*y_scale) <40 ){ double nticks=(vertical_pixels-J0)/(y_tick*y_scale); for (int jj=int(-J0/(y_tick*y_scale));jj<=nticks;++jj){ @@ -4436,7 +4469,7 @@ vecteur aff; string tmp; // X - fl_color(FL_RED); + fl_color(x_axis_color); aff=ticks(window_xmin,window_xmax,true); affs=aff.size(); for (int i=0;i<affs;++i){ @@ -4453,7 +4486,7 @@ if (args_tmp.empty()) fl_draw(x_axis_unit.c_str(),x()+horizontal_pixels,y()+vertical_pixels+labelsize()-2); // Y - fl_color(dark_green_color); + fl_color(y_axis_color); aff=ticks(window_ymin,window_ymax,true); affs=aff.size(); taille=labelsize()/2; Modified: trunk/giac-xcas/giac/src/Graph.h =================================================================== --- trunk/giac-xcas/giac/src/Graph.h 2009-09-18 10:33:24 UTC (rev 760) +++ trunk/giac-xcas/giac/src/Graph.h 2009-10-06 13:06:56 UTC (rev 761) @@ -119,7 +119,7 @@ unsigned display_mode ; // bit0=1 plot_instructions, bit1=1 animations_instruction // bit2=1 glFrustum/glOrtho, bit3=1 GL_LIGHTING, bit4=1 GL_FLAT, - // bit5=GL_BLEND, bit6=trace + // bit5=GL_BLEND, bit6=trace, bit7=1 move frame disabled double window_xmin,window_xmax,window_ymin,window_ymax,window_zmin,window_zmax; std::vector<window_xyz> history; int history_pos; @@ -162,6 +162,7 @@ bool light_on[8]; int ntheta,nphi; // default discretization params for sphere drawing std::pair<Fl_Image *,Fl_Image *> * background_image; // 2-d only + int x_axis_color,y_axis_color,z_axis_color; Graph2d3d(int x,int y,int w,int h,const char * l,double xmin,double xmax,double ymin,double ymax,double zmin,double zmax,double ortho,History_Pack * hp_); Graph2d3d(int x,int y,int w,int h,const char * l=0,History_Pack * hp_=0); double find_eps(); // find value of a small real wrt the current graph Modified: trunk/giac-xcas/giac/src/Graph3d.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph3d.cc 2009-09-18 10:33:24 UTC (rev 760) +++ trunk/giac-xcas/giac/src/Graph3d.cc 2009-10-06 13:06:56 UTC (rev 761) @@ -122,6 +122,8 @@ theta_z(-110),theta_x(-13),theta_y(-95), delta_theta(5),draw_mode(GL_QUADS),printing(0),glcontext(0),dragi(0),dragj(0),push_in_area(false),depth(0),below_depth_hidden(false),screenbuf(0) { // end(); + // mode=0; + display_mode |= 0x80; box(FL_FLAT_BOX); couleur=_POINT_WIDTH_5; q=euler_deg_to_quaternion_double(theta_z,theta_x,theta_y); @@ -1611,7 +1613,12 @@ void Graph3d::find_ij(double x,double y,double z,double & i,double & j,double & depth_) { dim32dim2(view,proj,model,x,y,z,i,j,depth_); +#ifdef __APPLE__ + j=this->y()+h()-j; + i=i+this->x(); +#else j=window()->h()-j; +#endif // cout << i << " " << j << endl; } @@ -2413,7 +2420,7 @@ pushed = true; return 1; } - if (!dynamic_cast<Geo3d *>(this) && push_in_area && (event==FL_DRAG || event==FL_RELEASE)){ + if (!(display_mode & 0x80) && push_in_area && (event==FL_DRAG || event==FL_RELEASE)){ double x1,y1,z1,x2,y2,z2; find_xyz(current_i,current_j,current_depth,x1,y1,z1); find_xyz(push_i,push_j,push_depth,x2,y2,z2); Modified: trunk/giac-xcas/giac/src/Input.cc =================================================================== --- trunk/giac-xcas/giac/src/Input.cc 2009-09-18 10:33:24 UTC (rev 760) +++ trunk/giac-xcas/giac/src/Input.cc 2009-10-06 13:06:56 UTC (rev 761) @@ -758,7 +758,10 @@ History_Pack * g=get_history_pack(this); if (g && event==FL_MOUSEWHEEL){ if (Fl_Scroll * sc = dynamic_cast<Fl_Scroll *>(g->parent())){ - sc->position(sc->xposition(),sc->yposition()+labelsize()*Fl::e_dy); + int scy=sc->yposition()+labelsize()*Fl::e_dy; + if (scy<0) + scy=0; + sc->position(sc->xposition(),scy); return 1; } } @@ -885,9 +888,8 @@ int ans=fl_ask((logs+'\n'+gettext("To get a newline, use shift-Enter. Reedit?")).c_str()); if (ans==1){ position(taille,taille); - insert("\n"); - if (!tableur) - increase_size(this,labelsize()+1); + // insert("\n"); + // if (!tableur) increase_size(this,labelsize()+1); return 1; } } Modified: trunk/giac-xcas/giac/src/Xcas1.cc =================================================================== --- trunk/giac-xcas/giac/src/Xcas1.cc 2009-09-18 10:33:24 UTC (rev 760) +++ trunk/giac-xcas/giac/src/Xcas1.cc 2009-10-06 13:06:56 UTC (rev 761) @@ -1341,6 +1341,7 @@ res += "]"; res += ","+print_INT_(i->ntheta)+","+print_INT_(i->nphi); res += ","+print_INT_(i->rotanim_type)+","+print_INT_(i->rotanim_danim)+","+print_INT_(i->rotanim_nstep)+","+print_DOUBLE_(i->rotanim_rx)+","+print_DOUBLE_(i->rotanim_ry)+","+print_DOUBLE_(i->rotanim_rz)+","+print_DOUBLE_(i->rotanim_tstep); + res += ","+print_INT_(i->x_axis_color)+","+print_INT_(i->y_axis_color)+","+print_INT_(i->z_axis_color); return res + '\n'; } if (const History_Fold * g=dynamic_cast<const History_Fold *>(o)){ @@ -1534,6 +1535,11 @@ res->rotanim_rz=v[28]._DOUBLE_val; res->rotanim_tstep=v[29]._DOUBLE_val; } + if (v.size()>=33 && v[30].type==_INT_ && v[31].type==_INT_&& v[32].type==_INT_){ + res->x_axis_color=v[30].val; + res->y_axis_color=v[31].val; + res->z_axis_color=v[32].val; + } } if (Geo2d * geo=dynamic_cast<Geo2d *>(res)){ geo->hp=geo_find_history_pack(geo); Modified: trunk/giac-xcas/giac/src/derive.cc =================================================================== --- trunk/giac-xcas/giac/src/derive.cc 2009-09-18 10:33:24 UTC (rev 760) +++ trunk/giac-xcas/giac/src/derive.cc 2009-10-06 13:06:56 UTC (rev 761) @@ -190,9 +190,9 @@ return derive(v[2],i,contextptr)*subst(res,i,v[2],false,contextptr); if (nargs==4){ gen a3=derive(v[3],i,contextptr); - gen b3=subst(res,i,v[3],false,contextptr); + gen b3=is_zero(a3)?zero:limit(res,i,v[3],-1,contextptr); gen a2=derive(v[2],i,contextptr); - gen b2=subst(res,i,v[2],false,contextptr); + gen b2=is_zero(a2)?zero:limit(res,i,v[2],1,contextptr); return a3*b3-a2*b2+_integrate(gen(makevecteur(newint,v[1],v[2],v[3]),_SEQ__VECT),contextptr); } setsizeerr(); Modified: trunk/giac-xcas/giac/src/desolve.cc =================================================================== --- trunk/giac-xcas/giac/src/desolve.cc 2009-09-18 10:33:24 UTC (rev 760) +++ trunk/giac-xcas/giac/src/desolve.cc 2009-10-06 13:06:56 UTC (rev 761) @@ -1,4 +1,4 @@ -/* -*- mode:C++ ; compile-command: "g++-3.4 -I.. -g -c desolve.cc" -*- */ +/* -*- mode:C++ ; compile-command: "g++-3.4 -I.. -g -c desolve.cc -DHAVE_CONFIG_H -DIN_GIAC" -*- */ #include "first.h" /* * Copyright (C) 2000, 2007 B. Parisse, Institut Fourier, 38402 St Martin d'Heres @@ -36,6 +36,8 @@ #include "ifactor.h" #include "prog.h" #include "rpn.h" +#include "lin.h" +#include "intgab.h" #ifndef NO_NAMESPACE_GIAC namespace giac { @@ -51,12 +53,42 @@ return res; } - gen laplace(const gen & f,const gen & x,const gen & s,GIAC_CONTEXT){ + gen laplace(const gen & f0,const gen & x,const gen & s,GIAC_CONTEXT){ if (x.type!=_IDNT) setsizeerr(); gen t(s); if (s==x) t=identificateur(" t"); + // check for negative powers of x in f + gen f(f0); + vecteur v(1,x); + lvar(f,v); + fraction ff=sym2r(f,v,contextptr); + gen ffden=ff.den; + int n=0; + if (ffden.type==_POLY){ + polynome & ffdenp = *ffden._POLYptr; + if (!ffdenp.coord.empty() && (n=ffdenp.coord.back().index.riptr->i.front()) ){ + // multiply by (-1)^n*x^n, do laplace, then integrate n times answer + index_t idxt(v.size()); + idxt.front()=-n; + ff=fraction(ff.num,ffden._POLYptr->shift(idxt)); + f=r2sym(ff,v,contextptr); + if (n%2) + f=-f; + } + } + assume_t_in_ab(t,0,plus_inf,true,true,contextptr); + gen res=_integrate(gen(makevecteur(f*exp(-t*x,contextptr),x,0,plus_inf),_SEQ__VECT),contextptr); + for (int i=1;i<=n;++i){ + res = _integrate(gen(makevecteur(res,t,0,t),_SEQ__VECT),contextptr); + res += _integrate(gen(makevecteur(f/pow(-x,i),x,0,plus_inf),_SEQ__VECT),contextptr); + } + _purge(t,contextptr); + if (s==x) + res=subst(res,t,x,false,contextptr); + return ratnormal(res); + /* gen remains,res=integrate(f*exp(-t*x,contextptr),*x._IDNTptr,remains,contextptr); res=subst(-res,x,zero,false,contextptr); if (s==x) @@ -64,6 +96,7 @@ if (!is_zero(remains)) res = res +symbolic(at_integrate,gen(makevecteur(remains,x,0,plus_inf),_SEQ__VECT)); return res; + */ } // "unary" version @@ -82,109 +115,148 @@ unary_function_eval __laplace(&_laplace,_laplace_s); unary_function_ptr at_laplace (&__laplace,0,true); - gen pf_ilaplace(const gen & e,const identificateur & x, gen & remains,GIAC_CONTEXT){ - vecteur varx(lvarx(e,x)); - int varxs=varx.size(); - if (!varxs){ // should be delta function - remains=e; - return zero; - } - if ( (varxs>1) || (varx.front()!=x) ) { - remains = e; - return zero; - } - vecteur l; - l.push_back(x); // insure x is the main var - l.push_back(laplace_var); // s var as second var - l=vecteur(1,l); - alg_lvar(e,l); - gen glap=e2r(laplace_var,l,contextptr); - if (glap.type!=_POLY) setsizeerr("desolve.cc/pf_ilaplace"); - int s=l.front()._VECTptr->size(); - if (!s){ - l.erase(l.begin()); - s=l.front()._VECTptr->size(); - } - gen r=e2r(e,l,contextptr); - gen r_num,r_den; - fxnd(r,r_num,r_den); - if (r_num.type==_EXT){ - remains=e; - return zero; - } - if (r_den.type!=_POLY){ // should be delat function - remains=e; - return zero; - } - polynome den(*r_den._POLYptr),num(s); - if (r_num.type==_POLY) - num=*r_num._POLYptr; - else - num=polynome(r_num,s); - polynome p_content(lgcd(den)); - factorization vden(sqff(den/p_content)); // first square-free factorization - vector< pf<gen> > pfde_VECT; - polynome ipnum(s),ipden(s),temp(s),tmp(s); - partfrac(num,den,vden,pfde_VECT,ipnum,ipden); - vector< pf<gen> >::iterator it=pfde_VECT.begin(); - vector< pf<gen> >::const_iterator itend=pfde_VECT.end(); - vector< pf<gen> > rest,finalde_VECT; + polynome cstcoeff(const polynome & p){ + vector< monomial<gen> >::const_iterator it=p.coord.begin(),itend=p.coord.end(); for (;it!=itend;++it){ - pf<gen> single(Tlaplace_reduce_pf<gen>(*it,*glap._POLYptr)); - factor(single.den,p_content,vden,false,withsqrt(contextptr),complex_mode(contextptr)); - partfrac(single.num,single.den,vden,finalde_VECT,temp,tmp); + if (it->index.riptr->i[0]==0) + break; } - it=finalde_VECT.begin(); - itend=finalde_VECT.end(); - gen lnpart(0),deuxaxplusb,sqrtdelta,exppart; - polynome a(s),b(s),c(s); - polynome d(s),E(s),lnpartden(s); - polynome delta(s),atannum(s),alpha(s); - vecteur lprime(l); - if (lprime.front().type!=_VECT) setsizeerr("desolve.cc/pf_ilaplace"); - lprime.front()=cdr_VECT(*(lprime.front()._VECTptr)); - bool uselog; - for (;it!=itend;++it){ - int deg=it->fact.lexsorted_degree(); - switch (deg) { - case 1: // 1st order - findde(it->den,a,b); - lnpart=lnpart+rdiv(r2e(it->num,l,contextptr),r2e(firstcoeff(a),lprime,contextptr))*exp(r2e(rdiv(-b,a),lprime,contextptr)*laplace_var,contextptr); - break; - case 2: // 2nd order - findabcdelta(it->fact,a,b,c,delta); - exppart=exp(r2e(rdiv(-b,2*a),lprime,contextptr)*laplace_var,contextptr); - uselog=is_positive(delta); - alpha=(it->den/it->fact).trunc1()*a; - findde(it->num,d,E); - atannum=a*E*gen(2)-b*d; - // cos part d/alpha*ln(fact) - lnpartden=alpha; - simplify(d,lnpartden); - if (uselog){ - sqrtdelta=normal(sqrt(r2e(delta,lprime,contextptr),contextptr),contextptr); - gen racine=ratnormal(sqrtdelta/gen(2)/r2e(a,lprime,contextptr)); - lnpart=lnpart+rdiv(r2e(d,lprime,contextptr),r2e(lnpartden,lprime,contextptr))*cosh(racine*laplace_var,contextptr)*exppart; - gen aa=ratnormal(r2e(atannum,lprime,contextptr)/r2e(alpha,lprime,contextptr)/sqrtdelta); - lnpart=lnpart+aa*sinh(racine*laplace_var,contextptr)*exppart; + return polynome(p.dim,vector< monomial<gen> >(it,itend)); + } + + gen pf_ilaplace(const gen & e0,const identificateur & x, gen & remains,GIAC_CONTEXT){ + vecteur vexp; + gen res; + lin(e0,vexp,contextptr); // vexp = coeff, arg of exponential + const_iterateur it=vexp.begin(),itend=vexp.end(); + remains=0; + for (;it!=itend;){ + gen coeff=*it; + ++it; + gen axb=*it,expa,expb; + ++it; + gen e=coeff*exp(axb,contextptr); + if (!is_linear_wrt(axb,x,expa,expb,contextptr)){ + remains += e; + continue; + } + if (is_strictly_positive(expa,contextptr)) + *logptr(contextptr) << "Warning, exponential x coeff is positive " << expa << endl; + vecteur varx(lvarx(coeff,x)); + int varxs=varx.size(); + if (!varxs){ // Dirac function + res += e*symbolic(at_Dirac,x); + continue; + } + if ( (varxs>1) || (varx.front()!=x) ) { + remains += e; + continue; + } + vecteur l; + l.push_back(x); // insure x is the main var + l.push_back(laplace_var); // s var as second var + l=vecteur(1,l); + alg_lvar(makevecteur(coeff,axb),l); + gen glap=e2r(laplace_var,l,contextptr); + if (glap.type!=_POLY) setsizeerr("desolve.cc/pf_ilaplace"); + int s=l.front()._VECTptr->size(); + if (!s){ + l.erase(l.begin()); + s=l.front()._VECTptr->size(); + } + gen r=e2r(coeff,l,contextptr); + gen r_num,r_den; + fxnd(r,r_num,r_den); + if (r_num.type==_EXT){ + remains += e; + continue; + } + if (r_den.type!=_POLY){ + remains += e; + continue; + } + polynome den(*r_den._POLYptr),num(s); + if (r_num.type==_POLY) + num=*r_num._POLYptr; + else + num=polynome(r_num,s); + polynome p_content(lgcd(den)); + factorization vden(sqff(den/p_content)); // first square-free factorization + vector< pf<gen> > pfde_VECT; + polynome ipnum(s),ipden(s),temp(s),tmp(s); + partfrac(num,den,vden,pfde_VECT,ipnum,ipden); + vector< pf<gen> >::iterator it=pfde_VECT.begin(); + vector< pf<gen> >::const_iterator itend=pfde_VECT.end(); + vector< pf<gen> > rest,finalde_VECT; + for (;it!=itend;++it){ + pf<gen> single(Tlaplace_reduce_pf<gen>(*it,*glap._POLYptr)); + factor(single.den,p_content,vden,false,withsqrt(contextptr),complex_mode(contextptr)); + partfrac(single.num,single.den,vden,finalde_VECT,temp,tmp); + } + it=finalde_VECT.begin(); + itend=finalde_VECT.end(); + gen lnpart(0),deuxaxplusb,sqrtdelta,exppart; + polynome a(s),b(s),c(s); + polynome d(s),E(s),lnpartden(s); + polynome delta(s),atannum(s),alpha(s); + vecteur lprime(l); + if (lprime.front().type!=_VECT) setsizeerr("desolve.cc/pf_ilaplace"); + lprime.front()=cdr_VECT(*(lprime.front()._VECTptr)); + bool uselog; + for (;it!=itend;++it){ + int deg=it->fact.lexsorted_degree(); + switch (deg) { + case 1: // 1st order + findde(it->den,a,b); + lnpart=lnpart+rdiv(r2e(it->num,l,contextptr),r2e(firstcoeff(a),lprime,contextptr))*exp(r2e(rdiv(-b,a),lprime,contextptr)*laplace_var,contextptr); + break; + case 2: // 2nd order + findabcdelta(it->fact,a,b,c,delta); + exppart=exp(r2e(rdiv(-b,2*a),lprime,contextptr)*laplace_var,contextptr); + uselog=is_positive(delta); + alpha=(it->den/it->fact).trunc1()*a; + findde(it->num,d,E); + atannum=a*E*gen(2)-b*d; + // cos part d/alpha*ln(fact) + lnpartden=alpha; + simplify(d,lnpartden); + if (uselog){ + sqrtdelta=normal(sqrt(r2e(delta,lprime,contextptr),contextptr),contextptr); + gen racine=ratnormal(sqrtdelta/gen(2)/r2e(a,lprime,contextptr)); + lnpart=lnpart+rdiv(r2e(d,lprime,contextptr),r2e(lnpartden,lprime,contextptr))*cosh(racine*laplace_var,contextptr)*exppart; + gen aa=ratnormal(r2e(atannum,lprime,contextptr)/r2e(alpha,lprime,contextptr)/sqrtdelta); + lnpart=lnpart+aa*sinh(racine*laplace_var,contextptr)*exppart; + } + else { + sqrtdelta=normal(sqrt(r2e(-delta,lprime,contextptr),contextptr),contextptr); + gen racine=ratnormal(sqrtdelta/gen(2)/r2e(a,lprime,contextptr)); + lnpart=lnpart+rdiv(r2e(d,lprime,contextptr),r2e(lnpartden,lprime,contextptr))*cos(racine*laplace_var,contextptr)*exppart; + gen aa=ratnormal(r2e(atannum,lprime,contextptr)/r2e(alpha,lprime,contextptr)/sqrtdelta); + lnpart=lnpart+aa*sin(racine*laplace_var,contextptr)*exppart; + } + break; + default: + rest.push_back(pf<gen>(it->num,it->den,it->fact,1)); + break ; } - else { - sqrtdelta=normal(sqrt(r2e(-delta,lprime,contextptr),contextptr),contextptr); - gen racine=ratnormal(sqrtdelta/gen(2)/r2e(a,lprime,contextptr)); - lnpart=lnpart+rdiv(r2e(d,lprime,contextptr),r2e(lnpartden,lprime,contextptr))*cos(racine*laplace_var,contextptr)*exppart; - gen aa=ratnormal(r2e(atannum,lprime,contextptr)/r2e(alpha,lprime,contextptr)/sqrtdelta); - lnpart=lnpart+aa*sin(racine*laplace_var,contextptr)*exppart; - } - break; - default: - rest.push_back(pf<gen>(it->num,it->den,it->fact,1)); - break ; } + vecteur ipnumv=polynome2poly1(ipnum,1); + gen deno=r2e(ipden,l,contextptr); + int nums=ipnumv.size(); + for (int i=0;i<nums;++i){ + gen tmp = rdiv(r2e(ipnumv[i],lprime,contextptr),deno); + tmp = tmp*symbolic(at_Dirac,(i==nums-1)?laplace_var:gen(makevecteur(laplace_var,nums-1-i),_SEQ__VECT)); + res += tmp; + } + remains += r2sym(rest,l,contextptr)*exp(axb,contextptr); + if (is_zero(expa)) + res += lnpart*exp(expb,contextptr); + else + res += quotesubst(lnpart,laplace_var,laplace_var+expa,contextptr)*exp(expb,contextptr)*_Heaviside(laplace_var+expa,contextptr); } - remains=rdiv(r2e(ipnum,l,contextptr),r2e(ipden,l,contextptr))+r2sym(rest,l,contextptr); - return lnpart; + return res; } - + gen ilaplace(const gen & f,const gen & x,const gen & s,GIAC_CONTEXT){ if (x.type!=_IDNT) setsizeerr(); @@ -210,6 +282,10 @@ unary_function_eval __ilaplace(&_ilaplace,_ilaplace_s); unary_function_ptr at_ilaplace (&__ilaplace,0,true); + const string _invlaplace_s("invlaplace"); + unary_function_eval __invlaplace(&_ilaplace,_invlaplace_s); + unary_function_ptr at_invlaplace (&__invlaplace,0,true); + void unable_to_solve_diffeq(){ setsizeerr("Unable to solve diff eq"); } @@ -642,7 +718,156 @@ unary_function_eval __dsolve(&_desolve,_dsolve_s); unary_function_ptr at_dsolve (&__dsolve,_QUOTE_ARGUMENTS,true); + gen ztrans(const gen & f,const gen & x,const gen & s,GIAC_CONTEXT){ + if (x.type!=_IDNT) + setsizeerr(); + gen t(s); + if (s==x) + t=identificateur(" tztrans"); + assume_t_in_ab(t,plus_inf,plus_inf,true,true,contextptr); + gen tmp=expand(f*pow(t,-x,contextptr),contextptr); + gen res=_sum(gen(makevecteur(tmp,x,0,plus_inf),_SEQ__VECT),contextptr); + _purge(t,contextptr); + if (s==x) + res=subst(res,t,x,false,contextptr); + return ratnormal(res); + } + // "unary" version + gen _ztrans(const gen & args,GIAC_CONTEXT){ + if (args.type!=_VECT) + return ztrans(args,vx_var,vx_var,contextptr); + vecteur & v=*args._VECTptr; + int s=v.size(); + if (s==2) + return ztrans( v[0],v[1],v[1],contextptr); + if (s!=3) + setsizeerr(); + return ztrans( v[0],v[1],v[2],contextptr); + } + const string _ztrans_s("ztrans"); + unary_function_eval __ztrans(&_ztrans,_ztrans_s); + unary_function_ptr at_ztrans (&__ztrans,0,true); + + void invztranserr(){ + setsizeerr("Inverse z-transform of non rational functions not implemented or unable to fully factor rational function"); + } + + // limited to rational fractions + gen invztrans(const gen & f,const gen & x,const gen & s,GIAC_CONTEXT){ + if (x.type!=_IDNT) + setsizeerr(); + gen t(s); + if (s==x) + t=identificateur(" tinvztrans"); + vecteur varx(lvarx(f,*x._IDNTptr)); + int varxs=varx.size(); + gen res; + if (varxs==0) + res=f*symb_when(t,1,0); + else { + if (varxs>1) + invztranserr(); + res=f/x; + vecteur l; + l.push_back(x); // insure x is the main var + l.push_back(t); // s var as second var + l=vecteur(1,l); + alg_lvar(res,l); + vecteur lprime(l); + if (lprime.front().type!=_VECT) setsizeerr("desolve.cc/invztrans"); + lprime.front()=cdr_VECT(*(lprime.front()._VECTptr)); + gen glap=e2r(s,l,contextptr); + if (glap.type!=_POLY) setsizeerr("desolve.cc/invztrans"); + int dim=l.front()._VECTptr->size(); + if (!dim){ + l.erase(l.begin()); + dim=l.front()._VECTptr->size(); + } + gen r=e2r(res,l,contextptr); + res=0; + gen r_num,r_den; + fxnd(r,r_num,r_den); + if (r_num.type==_EXT) + invztranserr(); + if (r_den.type!=_POLY) + invztranserr(); + polynome den(*r_den._POLYptr),num(dim); + if (r_num.type==_POLY) + num=*r_num._POLYptr; + else + num=polynome(r_num,dim); + polynome p_content(lgcd(den)); + den=den/p_content; + factorization vden; gen an; + if (!cfactor(den,an,vden,true)) + invztranserr(); + vector< pf<gen> > pfde_VECT; + polynome ipnum(dim),ipden(dim); + partfrac(num,den,vden,pfde_VECT,ipnum,ipden); + if (!is_zero(ipnum)) + *logptr(contextptr) << "Warning, z*argument has a non-zero integral part" << endl; + vector< pf<gen> >::iterator it=pfde_VECT.begin(); + vector< pf<gen> >::const_iterator itend=pfde_VECT.end(); + gen a,A,B; + polynome b,c; + for (;it!=itend;++it){ + if (it->fact.lexsorted_degree()>1) + invztranserr(); + findde(it->fact,b,c); + a=-gen(c)/gen(b); // pole + B=r2e(Tfirstcoeff(it->den),l,contextptr); + if (is_zero(a)){ + int mult=it->mult; + gen res0; + vecteur vnum; + polynome2poly1(it->num,1,vnum); + for (int i=0;i<mult;++i){ + res0 += r2e(vnum[i],lprime,contextptr)*symb_when(s-i,1,0); + } + res += res0/B; + } + else { + // it->num/it->den in terms of 1/(z-a), a/(z-a)^2, a^2/(z-a)^3, etc. + gen cur=r2e(it->num,l,contextptr); + A=r2e(a,lprime,contextptr); + gen z_minus_a=x-A,res0; + for (int i=it->mult-1;i>=0;--i){ + gen tmp=_quorem(makevecteur(cur,z_minus_a,x),contextptr); + gen rem=tmp[1]; + cur=tmp[0]; + rem=rem/pow(A,i,contextptr)/factorial(i); + for (int j=0;j<i;++j) + rem = rem * (s-j); + res0 += rem; + } + res0 = res0 * pow(A,s,contextptr); + res += res0/B; + } + } + res=res/r2e(p_content,l,contextptr); + } + if (s==x) + res=subst(res,t,x,false,contextptr); + return ratnormal(res); + } + + gen _invztrans(const gen & args,GIAC_CONTEXT){ + if (args.type!=_VECT) + return invztrans(args,vx_var,vx_var,contextptr); + vecteur & v=*args._VECTptr; + int s=v.size(); + if (s==2) + return invztrans( v[0],v[1],v[1],contextptr); + if (s!=3) + setsizeerr(); + return invztrans( v[0],v[1],v[2],contextptr); + } + const string _invztrans_s("invztrans"); + unary_function_eval __invztrans(&_invztrans,_invztrans_s); + unary_function_ptr at_invztrans (&__invztrans,0,true); + + #ifndef NO_NAMESPACE_GIAC } // namespace giac #endif // ndef NO_NAMESPACE_GIAC Modified: trunk/giac-xcas/giac/src/dispatch.h =================================================================== --- trunk/giac-xcas/giac/src/dispatch.h 2009-09-18 10:33:24 UTC (rev 760) +++ trunk/giac-xcas/giac/src/dispatch.h 2009-10-06 13:06:56 UTC (rev 761) @@ -301,7 +301,10 @@ _GL_Y_AXIS_UNIT=97, _GL_Z_AXIS_UNIT=98, _GL_TEXTURE=99, - _GL_ROTATION_AXIS=100 + _GL_ROTATION_AXIS=100, + _GL_X_AXIS_COLOR=101, + _GL_Y_AXIS_COLOR=102, + _GL_Z_AXIS_COLOR=103 }; enum solver_methods { Modified: trunk/giac-xcas/giac/src/gen.cc =================================================================== --- trunk/giac-xcas/giac/src/gen.cc 2009-09-18 10:33:24 UTC (rev 760) +++ trunk/giac-xcas/giac/src/gen.cc 2009-10-06 13:06:56 UTC (rev 761) @@ -5418,7 +5418,7 @@ } // (-1)^n - gen minus1pow(const gen & exponent){ + gen minus1pow(const gen & exponent,GIAC_CONTEXT){ if (exponent.type==_INT_) return (exponent.val%2)?-1:1; if (exponent.type==_ZINT){ @@ -5430,18 +5430,34 @@ if (is_inf(exponent) || is_undef(exponent)) return undef; if (exponent.is_symb_of_sommet(at_neg)) - return minus1pow(exponent._SYMBptr->feuille); + return minus1pow(exponent._SYMBptr->feuille,contextptr); if (exponent.is_symb_of_sommet(at_plus)){ gen res(1); gen & f=exponent._SYMBptr->feuille; if (f.type!=_VECT) - return minus1pow(f); + return minus1pow(f,contextptr); vecteur & v = *f._VECTptr; int s=v.size(); for (int i=0;i<s;++i) - res = res * minus1pow(v[i]); + res = res * minus1pow(v[i],contextptr); return res; } + if (exponent.is_symb_of_sommet(at_prod)){ + gen & f =exponent._SYMBptr->feuille; + if (f.type==_VECT){ + vecteur & v = *f._VECTptr; + int i,s=v.size(); + bool even=false; + for (i=0;i<s;++i){ + if (is_integer(v[i]) && is_zero(smod(v[i],2))) + even=true; + if (!is_assumed_integer(v[i],contextptr)) + break; + } + if (even && i==s) + return 1; + } + } return new ref_symbolic(symbolic(at_pow,gen(makenewvecteur(-1,exponent),_SEQ__VECT))); } @@ -5609,7 +5625,7 @@ return undef; } if (is_integer(base) && is_positive(-base,contextptr)) - return minus1pow(exponent)*pow(-base,exponent,contextptr); + return minus1pow(exponent,contextptr)*pow(-base,exponent,contextptr); if (is_inf(exponent)) return exp(exponent*ln(base,contextptr),contextptr); // extract integral powers in a product exponent @@ -8354,6 +8370,8 @@ return (is_one(*a._CPLXptr) && is_zero(*(a._CPLXptr+1))); case _DOUBLE_: return a._DOUBLE_val==1; + case _REAL: + return evalf_double(a,0,0)._DOUBLE_val==1; case _VECT: return a._VECTptr->size()==1 && is_one(a._VECTptr->front()); case _POLY: @@ -8379,6 +8397,8 @@ return (is_minus_one(*a._CPLXptr) && is_zero(*(a._CPLXptr+1))); case _DOUBLE_: return a._DOUBLE_val==-1; + case _REAL: + return evalf_double(a,0,0)._DOUBLE_val==-1; case _VECT: return a._VECTptr->size()==1 && is_minus_one(a._VECTptr->front()); case _POLY: Modified: trunk/giac-xcas/giac/src/hist.cxx =================================================================== --- trunk/giac-xcas/giac/src/hist.cxx 2009-09-18 10:33:24 UTC (rev 760) +++ trunk/giac-xcas/giac/src/hist.cxx 2009-10-06 13:06:56 UTC (rev 761) @@ -1100,13 +1100,6 @@ Xcas_update_mode(); } -static void cb_Xcas_Set_Tortue0(Fl_Menu_*, void*) { - const giac::context * contextptr=Xcas_get_context(); -giac::xcas_mode(contextptr)=0; -xcas_user_level=8; -Xcas_update_mode(); -} - static void cb_Xcas_show_DispG(Fl_Menu_*, void*) { Xcas_DispG_Window_->show(); Xcas_DispG_Cancel_->hide(); @@ -1703,8 +1696,7 @@ {gettext("xcas"), 0, (Fl_Callback*)cb_Xcas_Set_Xcas0, 0, 0, 0, 0, 14, 56}, {gettext("maple"), 0, (Fl_Callback*)cb_Xcas_Set_Maple0, 0, 0, 0, 0, 14, 56}, {gettext("mupad"), 0, (Fl_Callback*)cb_Xcas_Set_Mupad0, 0, 0, 0, 0, 14, 56}, - {gettext("ti"), 0, (Fl_Callback*)cb_Xcas_Set_TI0, 0, 0, 0, 0, 14, 56}, - {gettext("tortue"), 0, (Fl_Callback*)cb_Xcas_Set_Tortue0, 0, 0, 0, 0, 14, 56}, + {gettext("ti89/92"), 0, (Fl_Callback*)cb_Xcas_Set_TI0, 0, 0, 0, 0, 14, 56}, {0}, {gettext("Show"), 0, 0, 0, 64, 0, 0, 14, 56}, {gettext("DispG"), 0, (Fl_Callback*)cb_Xcas_show_DispG, 0, 0, 0, 0, 14, 56}, Modified: trunk/giac-xcas/giac/src/hist.fl =================================================================== --- trunk/giac-xcas/giac/src/hist.fl 2009-09-18 10:33:24 UTC (rev 760) +++ trunk/giac-xcas/giac/src/hist.fl 2009-10-06 13:06:56 UTC (rev 761) @@ -1272,20 +1272,12 @@ xywh {40 40 100 20} } menuitem Xcas_Set_TI0 { - label ti + label {ti89/92} callback {const giac::context * contextptr=Xcas_get_context(); giac::xcas_mode(contextptr)=3;xcas_user_level=0; Xcas_update_mode();} xywh {40 40 100 20} } - menuitem Xcas_Set_Tortue0 { - label tortue - callback {const giac::context * contextptr=Xcas_get_context(); -giac::xcas_mode(contextptr)=0; -xcas_user_level=8; -Xcas_update_mode();} - xywh {50 50 100 20} - } } submenu Xcas_show_something { label Show Modified: trunk/giac-xcas/giac/src/hist.h =================================================================== --- trunk/giac-xcas/giac/src/hist.h 2009-09-18 10:33:24 UTC (rev 760) +++ trunk/giac-xcas/giac/src/hist.h 2009-10-06 13:06:56 UTC (rev 761) @@ -289,169 +289,168 @@ #define Xcas_Set_Maple0 (menu_Xcas_main_menu+61) #define Xcas_Set_Mupad0 (menu_Xcas_main_menu+62) #define Xcas_Set_TI0 (menu_Xcas_main_menu+63) -#define Xcas_Set_Tortue0 (menu_Xcas_main_menu+64) -#define Xcas_show_something (menu_Xcas_main_menu+66) -#define Xcas_show_DispG (menu_Xcas_main_menu+67) -#define Xcas_show_keyboard (menu_Xcas_main_menu+68) -#define Xcas_show_bandeau (menu_Xcas_main_menu+69) -#define Xcas_show_msg (menu_Xcas_main_menu+70) -#define Xcas_show_script_window (menu_Xcas_main_menu+71) -#define Xcas_Hide_Something (menu_Xcas_main_menu+73) -#define Xcas_hide_DispG (menu_Xcas_main_menu+74) -#define Xcas_hide_keyboard (menu_Xcas_main_menu+75) -#define Xcas_hide_bandeau (menu_Xcas_main_menu+76) -#define Xcas_hide_msg (menu_Xcas_main_menu+77) -#define Xcas_index_language (menu_Xcas_main_menu+79) -#define Xcas_index_Francais (menu_Xcas_main_menu+80) -#define Xcas_index_English (menu_Xcas_main_menu+81) -#define Xcas_index_Espanol (menu_Xcas_main_menu+82) -#define Xcas_Colors (menu_Xcas_main_menu+84) -#define Xcas_background_color_item (menu_Xcas_main_menu+85) -#define Xcas_input_text_color (menu_Xcas_main_menu+86) -#define Xcas_input_text_background_color (menu_Xcas_main_menu+87) -#define Xcas_comment_color_item (menu_Xcas_main_menu+88) -#define Xcas_comment_background_color_item (menu_Xcas_main_menu+89) -#define Xcas_log_color_item (menu_Xcas_main_menu+90) -#define Xcas_log_background_color_item (menu_Xcas_main_menu+91) -#define Xcas_equation_color_item (menu_Xcas_main_menu+92) -#define Xcas_equation_background_color_item (menu_Xcas_main_menu+93) -#define Xcas_editor_color_item (menu_Xcas_main_menu+94) -#define Xcas_editor_background_color_item (menu_Xcas_main_menu+95) -#define Xcas_change_current_fontsize (menu_Xcas_main_menu+97) -#define Xcas_change_fontsize (menu_Xcas_main_menu+98) -#define Xcas_browser (menu_Xcas_main_menu+99) -#define Save_config (menu_Xcas_main_menu+100) -#define Xcas_help_menu (menu_Xcas_main_menu+102) -#define Xcas_help_index (menu_Xcas_main_menu+103) -#define Xcas_help_find (menu_Xcas_main_menu+104) -#define Xcas_help_casinter (menu_Xcas_main_menu+105) -#define Xcas_help_manuals (menu_Xcas_main_menu+106) -#define Xcas_help_CAS (menu_Xcas_main_menu+107) -#define Xcas_help_algo (menu_Xcas_main_menu+108) -#define Xcas_help_Geo (menu_Xcas_main_menu+109) -#define Xcas_help_Prog (menu_Xcas_main_menu+110) -#define Xcas_help_Tableur (menu_Xcas_main_menu+111) -#define Xcas_help_Tortue (menu_Xcas_main_menu+112) -#define Xcas_help_Exercices (menu_Xcas_main_menu+113) -#define Xcas_help_Amusement (menu_Xcas_main_menu+114) -#define Xcas_help_PARI (menu_Xcas_main_menu+115) -#define Xcas_help_internet (menu_Xcas_main_menu+117) -#define Xcas_help_forum (menu_Xcas_main_menu+118) -#define Xcas_help_connan (menu_Xcas_main_menu+119) -#define Xcas_help_bacs (menu_Xcas_main_menu+120) -#define Xcas_help_agreg (menu_Xcas_main_menu+121) -#define Xcas_help_load (menu_Xcas_main_menu+122) -#define Xcas_help_start (menu_Xcas_main_menu+124) -#define Xcas_help_tutorial (menu_Xcas_main_menu+125) -#define Xcas_help_solution (menu_Xcas_main_menu+126) -#define Xcas_help_make_index (menu_Xcas_main_menu+128) -#define Xcas_help_CASmenu (menu_Xcas_main_menu+130) -#define Xcas_Add_Entry (menu_Xcas_main_menu+131) -#define Xcas_Add_Comment (menu_Xcas_main_menu+132) -#define Xcas_help_equations (menu_Xcas_main_menu+133) -#define Xcas_help_solve (menu_Xcas_main_menu+134) -#define Xcas_help_fsolve (menu_Xcas_main_menu+135) -#define Xcas_help_proot (menu_Xcas_main_menu+136) -#define Xcas_help_linsolve (menu_Xcas_main_menu+137) -#define Xcas_help_desolve (menu_Xcas_main_menu+138) -#define Xcas_help_calculus (menu_Xcas_main_menu+140) -#define Xcas_help_int (menu_Xcas_main_menu+141) -#define Xcas_help_diff (menu_Xcas_main_menu+142) -#define Xcas_help_limit (menu_Xcas_main_menu+143) -#define Xcas_help_series (menu_Xcas_main_menu+144) -#define Xcas_help_sum (menu_Xcas_main_menu+145) -#define Xcas_help_laplace (menu_Xcas_main_menu+146) -#define Xcas_help_ilaplace (menu_Xcas_main_menu+147) -#define Xcas_help_Simplify (menu_Xcas_main_menu+149) -#define Xcas_help_simplify (menu_Xcas_main_menu+150) -#define Xcas_help_normal (menu_Xcas_main_menu+151) -#define Xcas_help_ratnormal (menu_Xcas_main_menu+152) -#define Xcas_help_factor (menu_Xcas_main_menu+153) -#define Xcas_help_cfactor (menu_Xcas_main_menu+154) -#define Xcas_help_partfrac (menu_Xcas_main_menu+155) -#define Xcas_help_cpartfrac (menu_Xcas_main_menu+156) -#define Xcas_help_sep1 (menu_Xcas_main_menu+157) -#define Xcas_help_subst (menu_Xcas_main_menu+158) -#define Xcas_help_reorder (menu_Xcas_main_menu+159) -#define Xcas_help_sep2 (menu_Xcas_main_menu+160) -#define Xcas_help_lin (menu_Xcas_main_menu+161) -#define Xcas_help_tlin (menu_Xcas_main_menu+162) -#define Xcas_help_texpand (menu_Xcas_main_menu+163) -#define Xcas_help_lncollect (menu_Xcas_main_menu+164) -#define Xcas_help_exp2pow (menu_Xcas_main_menu+165) -#define Xcas_help_exp2trig (menu_Xcas_main_menu+166) -#define Xcas_help_trig2exp (menu_Xcas_main_menu+167) -#define Xcas_help_arit (menu_Xcas_main_menu+169) -#define Xcas_help_isprime (menu_Xcas_main_menu+170) -#define Xcas_help_ifactor (menu_Xcas_main_menu+171) -#define Xcas_help_iquo (menu_Xcas_main_menu+172) -#define Xcas_help_irem (menu_Xcas_main_menu+173) -#define Xcas_help_iabcuv (menu_Xcas_main_menu+174) -#define Xcas_help_ichinrem (menu_Xcas_main_menu+175) -#define Xcas_help_sep3 (menu_Xcas_main_menu+176) -#define Xcas_help_gcd (menu_Xcas_main_menu+177) -#define Xcas_help_lcm (menu_Xcas_main_menu+178) -#define Xcas_help_powmod (menu_Xcas_main_menu+179) -#define Xcas_help_sep4 (menu_Xcas_main_menu+180) -#define Xcas_help_quo (menu_Xcas_main_menu+181) -#define Xcas_help_rem (menu_Xcas_main_menu+182) -#define Xcas_help_abcuv (menu_Xcas_main_menu+183) -#define Xcas_help_chinrem (menu_Xcas_main_menu+184) -#define Xcas_help_linal (menu_Xcas_main_menu+186) -#define Xcas_help_matrix (menu_Xcas_main_menu+187) -#define Xcas_help_tran (menu_Xcas_main_menu+188) -#define Xcas_help_ker (menu_Xcas_main_menu+189) -#define Xcas_help_image (menu_Xcas_main_menu+190) -#define Xcas_help_inverse (menu_Xcas_main_menu+191) -#define Xcas_help_det (menu_Xcas_main_menu+192) -#define Xcas_help_charpoly (menu_Xcas_main_menu+193) -#define Xcas_help_egv (menu_Xcas_main_menu+194) -#define Xcas_help_egvl (menu_Xcas_main_menu+195) -#define Xcas_help_tableur (menu_Xcas_main_menu+198) -#define Xcas_Add_Tableur (menu_Xcas_main_menu+199) -#define Xcas_help_graph (menu_Xcas_main_menu+201) -#define Xcas_help_attributs (menu_Xcas_main_menu+202) -#define Xcas_help_curves (menu_Xcas_main_menu+203) -#define Xcas_help_plot (menu_Xcas_main_menu+204) -#define Xcas_help_plotparam2d (menu_Xcas_main_menu+205) -#define Xcas_help_plotpolar (menu_Xcas_main_menu+206) -#define Xcas_help_plotarea (menu_Xcas_main_menu+207) -#define Xcas_help_plotimplicit (menu_Xcas_main_menu+208) -#define Xcas_help_plotcontour (menu_Xcas_main_menu+209) -#define Xcas_help_plotdensity (menu_Xcas_main_menu+210) -#define Xcas_help_graph_surfaces (menu_Xcas_main_menu+212) -#define Xcas_help_plot3d (menu_Xcas_main_menu+213) -#define Xcas_help_plotparam3d (menu_Xcas_main_menu+214) -#define Xcas_help_graph_suite (menu_Xcas_main_menu+216) -#define Xcas_help_plotseq (menu_Xcas_main_menu+217) -#define Xcas_help_plotlist (menu_Xcas_main_menu+218) -#define Xcas_help_graph_ode (menu_Xcas_main_menu+220) -#define Xcas_help_plotfield (menu_Xcas_main_menu+221) -#define Xcas_help_plotode (menu_Xcas_main_menu+222) -#define Xcas_help_iplotode (menu_Xcas_main_menu+223) -#define Xcas_help_graph_stats (menu_Xcas_main_menu+225) -#define Xcas_help_camembert (menu_Xcas_main_menu+226) -#define Xcas_help_histogram (menu_Xcas_main_menu+227) -#define Xcas_help_moustache (menu_Xcas_main_menu+228) -#define Xcas_help_scatterplot (menu_Xcas_main_menu+229) -#define Xcas_help_polygonscatterplot (menu_Xcas_main_menu+230) -#define Xcas_help_linear_regression_plot (menu_Xcas_main_menu+231) -#define Xcas_help_geo (menu_Xcas_main_menu+234) -#define Xcas_new_figure (menu_Xcas_main_menu+235) -#define Xcas_Add_Figure (menu_Xcas_main_menu+236) -#define Xcas_Add_Figure3d (menu_Xcas_main_menu+237) -#define Xcas_Add_Figurex (menu_Xcas_main_menu+238) -#define Xcas_Add_Figure3dx (menu_Xcas_main_menu+239) -#define Xcas_help_prog (menu_Xcas_main_menu+242) -#define Xcas_Add_Program (menu_Xcas_main_menu+243) -#define Xcas_help_debug (menu_Xcas_main_menu+244) -#define Xcas_help_expression (menu_Xcas_main_menu+246) -#define Xcas_Add_Expression (menu_Xcas_main_menu+247) -#define Xcas_help_allcmds (menu_Xcas_main_menu+249) -#define Xcas_help_phys (menu_Xcas_main_menu+251) -#define Xcas_help_scolaire (menu_Xcas_main_menu+253) -#define Xcas_help_tortue (menu_Xcas_main_menu+255) -#define Xcas_Add_Logo (menu_Xcas_main_menu+256) +#define Xcas_show_something (menu_Xcas_main_menu+65) +#define Xcas_show_DispG (menu_Xcas_main_menu+66) +#define Xcas_show_keyboard (menu_Xcas_main_menu+67) +#define Xcas_show_bandeau (menu_Xcas_main_menu+68) +#define Xcas_show_msg (menu_Xcas_main_menu+69) +#define Xcas_show_script_window (menu_Xcas_main_menu+70) +#define Xcas_Hide_Something (menu_Xcas_main_menu+72) +#define Xcas_hide_DispG (menu_Xcas_main_menu+73) +#define Xcas_hide_keyboard (menu_Xcas_main_menu+74) +#define Xcas_hide_bandeau (menu_Xcas_main_menu+75) +#define Xcas_hide_msg (menu_Xcas_main_menu+76) +#define Xcas_index_language (menu_Xcas_main_menu+78) +#define Xcas_index_Francais (menu_Xcas_main_menu+79) +#define Xcas_index_English (menu_Xcas_main_menu+80) +#define Xcas_index_Espanol (menu_Xcas_main_menu+81) +#define Xcas_Colors (menu_Xcas_main_menu+83) +#define Xcas_background_color_item (menu_Xcas_main_menu+84) +#define Xcas_input_text_color (menu_Xcas_main_menu+85) +#define Xcas_input_text_background_color (menu_Xcas_main_menu+86) +#define Xcas_comment_color_item (menu_Xcas_main_menu+87) +#define Xcas_comment_background_color_item (menu_Xcas_main_menu+88) +#define Xcas_log_color_item (menu_Xcas_main_menu+89) +#define Xcas_log_background_color_item (menu_Xcas_main_menu+90) +#define Xcas_equation_color_item (menu_Xcas_main_menu+91) +#define Xcas_equation_background_color_item (menu_Xcas_main_menu+92) +#define Xcas_editor_color_item (menu_Xcas_main_menu+93) +#define Xcas_editor_background_color_item (menu_Xcas_main_menu+94) +#define Xcas_change_current_fontsize (menu_Xcas_main_menu+96) +#define Xcas_change_fontsize (menu_Xcas_main_menu+97) +#define Xcas_browser (menu_Xcas_main_menu+98) +#define Save_config (menu_Xcas_main_menu+99) +#define Xcas_help_menu (menu_Xcas_main_menu+101) +#define Xcas_help_index (menu_Xcas_main_menu+102) +#define Xcas_help_find (menu_Xcas_main_menu+103) +#define Xcas_help_casinter (menu_Xcas_main_menu+104) +#define Xcas_help_manuals (menu_Xcas_main_menu+105) +#define Xcas_help_CAS (menu_Xcas_main_menu+106) +#define Xcas_help_algo (menu_Xcas_main_menu+107) +#define Xcas_help_Geo (menu_Xcas_main_menu+108) +#define Xcas_help_Prog (menu_Xcas_main_menu+109) +#define Xcas_help_Tableur (menu_Xcas_main_menu+110) +#define Xcas_help_Tortue (menu_Xcas_main_menu+111) +#define Xcas_help_Exercices (menu_Xcas_main_menu+112) +#define Xcas_help_Amusement (menu_Xcas_main_menu+113) +#define Xcas_help_PARI (menu_Xcas_main_menu+114) +#define Xcas_help_internet (menu_Xcas_main_menu+116) +#define Xcas_help_forum (menu_Xcas_main_menu+117) +#define Xcas_help_connan (menu_Xcas_main_menu+118) +#define Xcas_help_bacs (menu_Xcas_main_menu+119) +#define Xcas_help_agreg (menu_Xcas_main_menu+120) +#define Xcas_help_load (menu_Xcas_main_menu+121) +#define Xcas_help_start (menu_Xcas_main_menu+123) +#define Xcas_help_tutorial (menu_Xcas_main_menu+124) +#define Xcas_help_solution (menu_Xcas_main_menu+125) +#define Xcas_help_make_index (menu_Xcas_main_menu+127) +#define Xcas_help_CASmenu (menu_Xcas_main_menu+129) +#define Xcas_Add_Entry (menu_Xcas_main_menu+130) +#define Xcas_Add_Comment (menu_Xcas_main_menu+131) +#define Xcas_help_equations (menu_Xcas_main_menu+132) +#define Xcas_help_solve (menu_Xcas_main_menu+133) +#define Xcas_help_fsolve (menu_Xcas_main_menu+134) +#define Xcas_help_proot (menu_Xcas_main_menu+135) +#define Xcas_help_linsolve (menu_Xcas_main_menu+136) +#define Xcas_help_desolve (menu_Xcas_main_menu+137) +#define Xcas_help_calculus (menu_Xcas_main_menu+139) +#define Xcas_help_int (menu_Xcas_main_menu+140) +#define Xcas_help_diff (menu_Xcas_main_menu+141) +#define Xcas_help_limit (menu_Xcas_main_menu+142) +#define Xcas_help_series (menu_Xcas_main_menu+143) +#define Xcas_help_sum (menu_Xcas_main_menu+144) +#define Xcas_help_laplace (menu_Xcas_main_menu+145) +#define Xcas_help_ilaplace (menu_Xcas_main_menu+146) +#define Xcas_help_Simplify (menu_Xcas_main_menu+148) +#define Xcas_help_simplify (menu_Xcas_main_menu+149) +#define Xcas_help_normal (menu_Xcas_main_menu+150) +#define Xcas_help_ratnormal (menu_Xcas_main_menu+151) +#define Xcas_help_factor (menu_Xcas_main_menu+152) +#define Xcas_help_cfactor (menu_Xcas_main_menu+153) +#define Xcas_help_partfrac (menu_Xcas_main_menu+154) +#define Xcas_help_cpartfrac (menu_Xcas_main_menu+155) +#define Xcas_help_sep1 (menu_Xcas_main_menu+156) +#define Xcas_help_subst (menu_Xcas_main_menu+157) +#define Xcas_help_reorder (menu_Xcas_main_menu+158) +#define Xcas_help_sep2 (menu_Xcas_main_menu+159) +#define Xcas_help_lin (menu_Xcas_main_menu+160) +#define Xcas_help_tlin (menu_Xcas_main_menu+161) +#define Xcas_help_texpand (menu_Xcas_main_menu+162) +#define Xcas_help_lncollect (menu_Xcas_main_menu+163) +#define Xcas_help_exp2pow (menu_Xcas_main_menu+164) +#define Xcas_help_exp2trig (menu_Xcas_main_menu+165) +#define Xcas_help_trig2exp (menu_Xcas_main_menu+166) +#define Xcas_help_arit (menu_Xcas_main_menu+168) +#define Xcas_help_isprime (menu_Xcas_main_menu+169) +#define Xcas_help_ifactor (menu_Xcas_main_menu+170) +#define Xcas_help_iquo (menu_Xcas_main_menu+171) +#define Xcas_help_irem (menu_Xcas_main_menu+172) +#define Xcas_help_iabcuv (menu_Xcas_main_menu+173) +#define Xcas_help_ichinrem (menu_Xcas_main_menu+174) +#define Xcas_help_sep3 (menu_Xcas_main_menu+175) +#define Xcas_help_gcd (menu_Xcas_main_menu+176) +#define Xcas_help_lcm (menu_Xcas_main_menu+177) +#define Xcas_help_powmod (menu_Xcas_main_menu+178) +#define Xcas_help_sep4 (menu_Xcas_main_menu+179) +#define Xcas_help_quo (menu_Xcas_main_menu+180) +#define Xcas_help_rem (menu_Xcas_main_menu+181) +#define Xcas_help_abcuv (menu_Xcas_main_menu+182) +#define Xcas_help_chinrem (menu_Xcas_main_menu+183) +#define Xcas_help_linal (menu_Xcas_main_menu+185) +#define Xcas_help_matrix (menu_Xcas_main_menu+186) +#define Xcas_help_tran (menu_Xcas_main_menu+187) +#define Xcas_help_ker (menu_Xcas_main_menu+188) +#define Xcas_help_image (menu_Xcas_main_menu+189) +#define Xcas_help_inverse (menu_Xcas_main_menu+190) +#define Xcas_help_det (menu_Xcas_main_menu+191) +#define Xcas_help_charpoly (menu_Xcas_main_menu+192) +#define Xcas_help_egv (menu_Xcas_main_menu+193) +#... [truncated message content] |
From: <pa...@us...> - 2009-09-18 10:34:32
|
Revision: 760 http://xcas.svn.sourceforge.net/xcas/?rev=760&view=rev Author: parisse Date: 2009-09-18 10:33:24 +0000 (Fri, 18 Sep 2009) Log Message: ----------- Modified Paths: -------------- trunk/giac-xcas/giac/src/Editeur.cc trunk/giac-xcas/giac/src/Input.cc trunk/giac-xcas/giac/src/gausspol.cc trunk/giac-xcas/giac/src/global.cc trunk/giac-xcas/giac/src/global.h trunk/giac-xcas/giac/src/hist.cxx trunk/giac-xcas/giac/src/hist.fl trunk/giac-xcas/giac/src/input_lexer.cc trunk/giac-xcas/giac/src/input_lexer.ll trunk/giac-xcas/giac/src/input_parser.cc trunk/giac-xcas/giac/src/input_parser.h trunk/giac-xcas/giac/src/input_parser.yy trunk/giac-xcas/giac/src/intgab.cc trunk/giac-xcas/giac/src/lin.cc trunk/giac-xcas/giac/src/prog.cc trunk/giac-xcas/giac/src/rpn.cc trunk/giac-xcas/giac/src/series.cc trunk/giac-xcas/giac/src/sym2poly.cc trunk/giac-xcas/giac/src/tex.cc trunk/giac-xcas/giac/src/usual.cc Modified: trunk/giac-xcas/giac/src/Editeur.cc =================================================================== --- trunk/giac-xcas/giac/src/Editeur.cc 2009-09-02 13:05:24 UTC (rev 759) +++ trunk/giac-xcas/giac/src/Editeur.cc 2009-09-18 10:33:24 UTC (rev 760) @@ -127,6 +127,7 @@ "pas", "pour", "proc", + "repeat", "return", "si", "sinon", @@ -138,6 +139,7 @@ "to", "true", "try", + "until", "while", "xor" }; Modified: trunk/giac-xcas/giac/src/Input.cc =================================================================== --- trunk/giac-xcas/giac/src/Input.cc 2009-09-02 13:05:24 UTC (rev 759) +++ trunk/giac-xcas/giac/src/Input.cc 2009-09-18 10:33:24 UTC (rev 760) @@ -93,6 +93,7 @@ else { cerr << "// Using help file " << helpfile << endl; giac::xcasroot=giac::xcasroot_dir((char *) progname.c_str()); + cerr << "// root dir " << giac::xcasroot << endl; giac::html_help_init((char *) progname.c_str(),language); giac::update_completions(); return true; Modified: trunk/giac-xcas/giac/src/gausspol.cc =================================================================== --- trunk/giac-xcas/giac/src/gausspol.cc 2009-09-02 13:05:24 UTC (rev 759) +++ trunk/giac-xcas/giac/src/gausspol.cc 2009-09-18 10:33:24 UTC (rev 760) @@ -3794,10 +3794,19 @@ gen newp=re(p,context0)+algebraic_EXTension(makevecteur(1,0),makevecteur(1,0,1))*ip; if (newp.type!=_POLY) return false; - gen bn=1; + gen bn=1,the_ext; lcmdeno(*newp._POLYptr,bn); newp=bn*newp; - bool res=ext_factor(*newp._POLYptr,newp._POLYptr->coord.front().value,an,p_content,f,false); + vector< monomial<gen> >::const_iterator it=newp._POLYptr->coord.begin(),itend=newp._POLYptr->coord.end(); + for (;it!=itend;++it){ + if (it->value.type==_EXT){ + the_ext=it->value; + break; + } + } + if (the_ext.type!=_EXT) + return false; + bool res=ext_factor(*newp._POLYptr,the_ext,an,p_content,f,false); an=an/bn; return res; } Modified: trunk/giac-xcas/giac/src/global.cc =================================================================== --- trunk/giac-xcas/giac/src/global.cc 2009-09-02 13:05:24 UTC (rev 759) +++ trunk/giac-xcas/giac/src/global.cc 2009-09-18 10:33:24 UTC (rev 760) @@ -1972,10 +1972,16 @@ cerr << s << endl; #ifdef WIN32 string firefox="/cygdrive/c/Program Files/Mozilla Firefox/firefox.exe"; - bool with_firefox=!access(firefox.c_str(),R_OK); - if (!with_firefox){ - firefox="/cygdrive/c/Program Files/mozilla.org/Mozilla/mozilla.exe"; - with_firefox=!access(firefox.c_str(),R_OK); + bool with_firefox=false; + if (getenv("BROWSER")){ + string tmp=getenv("BROWSER"); + if (tmp=="firefox" || tmp=="mozilla"){ + with_firefox=!access(firefox.c_str(),R_OK); + if (!with_firefox){ + firefox="/cygdrive/c/Program Files/mozilla.org/Mozilla/mozilla.exe"; + with_firefox=!access(firefox.c_str(),R_OK); + } + } } if (!url && (file.substr(0,10)=="/cygdrive/" || (file[0]!='/' && file[1]!=':')) ){ string s1=xcasroot; @@ -2854,6 +2860,31 @@ #endif // __APPLE__ + double giac_floor(double d){ + double maxdouble=longlong(1)<<54; + if (d>=maxdouble || d<=-maxdouble) + return d; + if (d>0) + return int(d); + double k=int(d); + if (k==d) + return k; + else + return k-1; + } + double giac_ceil(double d){ + double maxdouble=longlong(1)<<54; + if (d>=maxdouble || d<=-maxdouble) + return d; + if (d<0) + return int(d); + double k=int(d); + if (k==d) + return k; + else + return k+1; + } + #ifndef NO_NAMESPACE_GIAC } // namespace giac #endif // ndef NO_NAMESPACE_GIAC Modified: trunk/giac-xcas/giac/src/global.h =================================================================== --- trunk/giac-xcas/giac/src/global.h 2009-09-02 13:05:24 UTC (rev 759) +++ trunk/giac-xcas/giac/src/global.h 2009-09-18 10:33:24 UTC (rev 760) @@ -52,22 +52,10 @@ #endif #ifdef _SOFTMATH_H -inline double giac_floor(double d){ - return std::giac_gnuwince_floor(d); -} -inline double giac_ceil(double d){ - return std::giac_gnuwince_ceil(d); -} inline double giac_log(double d){ return std::giac_gnuwince_log(d); } #else -inline double giac_floor(double d){ - return std::floor(d); -} -inline double giac_ceil(double d){ - return std::ceil(d); -} inline double giac_log(double d){ return std::log(d); } @@ -100,6 +88,10 @@ #ifndef NO_NAMESPACE_GIAC namespace giac { #endif // ndef NO_NAMESPACE_GIAC + + double giac_floor(double d); + double giac_ceil(double d); + #ifdef VISUALC extern int R_OK; int access(const char * ch,int mode); Modified: trunk/giac-xcas/giac/src/hist.cxx =================================================================== --- trunk/giac-xcas/giac/src/hist.cxx 2009-09-02 13:05:24 UTC (rev 759) +++ trunk/giac-xcas/giac/src/hist.cxx 2009-09-18 10:33:24 UTC (rev 760) @@ -4609,8 +4609,10 @@ Fl_Bitmap * Xcas_Racine_carree_image=new Fl_Bitmap(Xcas_racine_carree_bitmap,8,8); Xcas_Racine_carree->image(Xcas_Racine_carree_image); #else +#ifndef __APPLE__ Xcas_Keyboard_infinity->label("\xA5"); Xcas_Keyboard_infinity->labelfont(FL_SYMBOL); +#endif Xcas_Racine_carree->label("\xD6"); Xcas_Racine_carree->labelfont(FL_SYMBOL); Xcas_approx_key->label("\xBB"); Modified: trunk/giac-xcas/giac/src/hist.fl =================================================================== --- trunk/giac-xcas/giac/src/hist.fl 2009-09-02 13:05:24 UTC (rev 759) +++ trunk/giac-xcas/giac/src/hist.fl 2009-09-18 10:33:24 UTC (rev 760) @@ -3587,8 +3587,10 @@ Fl_Bitmap * Xcas_Racine_carree_image=new Fl_Bitmap(Xcas_racine_carree_bitmap,8,8); Xcas_Racine_carree->image(Xcas_Racine_carree_image); \#else +\#ifndef __APPLE__ Xcas_Keyboard_infinity->label("\xA5"); Xcas_Keyboard_infinity->labelfont(FL_SYMBOL); +\#endif Xcas_Racine_carree->label("\xD6"); Xcas_Racine_carree->labelfont(FL_SYMBOL); Xcas_approx_key->label("\xBB"); Modified: trunk/giac-xcas/giac/src/input_lexer.cc =================================================================== --- trunk/giac-xcas/giac/src/input_lexer.cc 2009-09-02 13:05:24 UTC (rev 759) +++ trunk/giac-xcas/giac/src/input_lexer.cc 2009-09-18 10:33:24 UTC (rev 760) @@ -5612,12 +5612,12 @@ case 584: YY_RULE_SETUP #line 769 "input_lexer.ll" -index_status(yyextra)=0; return T_REPEAT; +(*yylval) = gen(at_for,1) ; index_status(yyextra)=0; return T_REPEAT; YY_BREAK case 585: YY_RULE_SETUP #line 770 "input_lexer.ll" -index_status(yyextra)=0; return T_REPEAT; +(*yylval) = gen(at_for,1) ;index_status(yyextra)=0; return T_REPEAT; YY_BREAK case 586: YY_RULE_SETUP Modified: trunk/giac-xcas/giac/src/input_lexer.ll =================================================================== --- trunk/giac-xcas/giac/src/input_lexer.ll 2009-09-02 13:05:24 UTC (rev 759) +++ trunk/giac-xcas/giac/src/input_lexer.ll 2009-09-18 10:33:24 UTC (rev 760) @@ -767,8 +767,8 @@ "rcl" (*yylval) = gen(at_RCL,1); index_status(yyextra)=0; return T_UNARY_OP; "RCL" (*yylval) = gen(at_RCL,1); index_status(yyextra)=0; return T_UNARY_OP; "read" (*yylval) = gen(at_read,1); index_status(yyextra)=0; return T_RETURN; -"repeat" index_status(yyextra)=0; return T_REPEAT; -"REPEAT" index_status(yyextra)=0; return T_REPEAT; +"repeat" (*yylval) = gen(at_for,1) ; index_status(yyextra)=0; return T_REPEAT; +"REPEAT" (*yylval) = gen(at_for,1) ;index_status(yyextra)=0; return T_REPEAT; "return" (*yylval) = gen(at_return,1) ; index_status(yyextra)=0; return T_RETURN; "retourne" (*yylval) = gen(at_return,1) ; index_status(yyextra)=0; return T_RETURN; "RETURN" (*yylval) = gen(at_return,1) ; index_status(yyextra)=0; return T_RETURN; Modified: trunk/giac-xcas/giac/src/input_parser.cc =================================================================== --- trunk/giac-xcas/giac/src/input_parser.cc 2009-09-02 13:05:24 UTC (rev 759) +++ trunk/giac-xcas/giac/src/input_parser.cc 2009-09-18 10:33:24 UTC (rev 760) @@ -1,8 +1,10 @@ -/* A Bison parser, made by GNU Bison 1.875d. */ +/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +/* Skeleton implementation for Bison's Yacc-like parsers in C + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) @@ -15,17 +17,25 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. -/* Written by Richard Stallman by simplifying the original so called - ``semantic'' parser. */ + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. @@ -36,6 +46,9 @@ /* Identify Bison output. */ #define YYBISON 1 +/* Bison version. */ +#define YYBISON_VERSION "2.3" + /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -45,8 +58,7 @@ /* Using locations. */ #define YYLSP_NEEDED 0 -/* If NAME_PREFIX is specified substitute the variables and functions - names. */ +/* Substitute the variable and function names. */ #define yyparse giac_yyparse #define yylex giac_yylex #define yyerror giac_yyerror @@ -191,6 +203,7 @@ NEG = 384 }; #endif +/* Tokens. */ #define T_NUMBER 258 #define T_SYMBOL 259 #define T_LITERAL 260 @@ -405,7 +418,12 @@ # define YYERROR_VERBOSE 0 #endif -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -417,56 +435,171 @@ /* Copy the second part of user declarations. */ -/* Line 214 of yacc.c. */ -#line 422 "input_parser.cc" +/* Line 216 of yacc.c. */ +#line 440 "input_parser.cc" -#if ! defined (yyoverflow) || YYERROR_VERBOSE +#ifdef short +# undef short +#endif -# ifndef YYFREE -# define YYFREE free +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int # endif -# ifndef YYMALLOC -# define YYMALLOC malloc +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif # endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int i) +#else +static int +YYID (i) + int i; +#endif +{ + return i; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA -# define YYSTACK_ALLOC alloca -# endif -# else -# if defined (alloca) || defined (_ALLOCA_H) -# define YYSTACK_ALLOC alloca -# else # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif # endif # endif # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif # else -# if defined (__STDC__) || defined (__cplusplus) +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif # endif -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif # endif -#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ -#if (! defined (yyoverflow) \ - && (! defined (__cplusplus) \ - || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { - short int yyss; + yytype_int16 yyss; YYSTYPE yyvs; }; @@ -476,24 +609,24 @@ /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY -# if defined (__GNUC__) && 1 < __GNUC__ +# if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ - register YYSIZE_T yyi; \ + YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ - while (0) + while (YYID (0)) # endif # endif @@ -511,39 +644,33 @@ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ - while (0) + while (YYID (0)) #endif -#if defined (__STDC__) || defined (__cplusplus) - typedef signed char yysigned_char; -#else - typedef short int yysigned_char; -#endif - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 181 +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 183 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 11211 +#define YYLAST 11243 -/* YYNTOKENS -- Number of terminals. */ +/* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 130 -/* YYNNTS -- Number of nonterminals. */ +/* YYNNTS -- Number of nonterminals. */ #define YYNNTS 29 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 258 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 585 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 259 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 590 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 384 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const unsigned char yytranslate[] = +static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -589,7 +716,7 @@ #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ -static const unsigned short int yyprhs[] = +static const yytype_uint16 yyprhs[] = { 0, 0, 3, 5, 8, 12, 16, 18, 21, 26, 30, 33, 35, 37, 44, 51, 58, 65, 69, 83, @@ -601,26 +728,26 @@ 336, 341, 346, 352, 357, 359, 364, 366, 370, 374, 379, 381, 386, 388, 391, 394, 396, 400, 403, 405, 409, 411, 413, 423, 434, 439, 447, 457, 467, 475, - 485, 487, 493, 499, 505, 509, 516, 522, 526, 534, - 539, 541, 547, 552, 559, 565, 573, 578, 583, 585, - 589, 592, 598, 602, 606, 609, 613, 617, 621, 625, - 629, 631, 635, 639, 646, 651, 655, 659, 663, 667, - 671, 675, 679, 683, 687, 691, 695, 699, 703, 705, - 707, 709, 712, 716, 719, 723, 726, 728, 730, 734, - 737, 740, 741, 744, 747, 752, 755, 759, 763, 765, - 769, 771, 775, 779, 781, 785, 787, 789, 790, 792, - 793, 795, 797, 800, 803, 804, 807, 811, 813, 817, - 819, 821, 823, 826, 830, 834, 836, 838, 840, 842, - 844, 846, 848, 850, 852, 854, 856, 858, 860, 862, - 864, 866, 868, 872, 874, 878, 882, 884, 890, 898, - 902, 906, 911, 916, 922, 928, 932, 936, 941, 943, - 947, 951, 953, 956, 957, 960, 961, 964, 965, 969, - 972, 976, 981, 983, 987, 993, 1000, 1002, 1005, 1007, - 1010, 1011, 1017, 1018, 1022, 1028, 1029, 1032, 1038 + 485, 487, 493, 499, 505, 509, 516, 522, 528, 532, + 540, 545, 547, 553, 558, 565, 571, 579, 584, 589, + 591, 595, 598, 604, 608, 612, 615, 619, 623, 627, + 631, 635, 637, 641, 645, 652, 657, 661, 665, 669, + 673, 677, 681, 685, 689, 693, 697, 701, 705, 709, + 711, 713, 715, 718, 722, 725, 729, 732, 734, 736, + 740, 743, 746, 747, 750, 753, 758, 761, 765, 769, + 771, 775, 777, 781, 785, 787, 791, 793, 795, 796, + 798, 799, 801, 803, 806, 809, 810, 813, 817, 819, + 823, 825, 827, 829, 832, 836, 840, 842, 844, 846, + 848, 850, 852, 854, 856, 858, 860, 862, 864, 866, + 868, 870, 872, 874, 878, 880, 884, 888, 890, 896, + 904, 908, 912, 917, 922, 928, 934, 938, 942, 947, + 949, 953, 957, 959, 962, 963, 966, 967, 970, 971, + 975, 978, 982, 987, 989, 993, 999, 1006, 1008, 1011, + 1013, 1016, 1017, 1023, 1024, 1028, 1034, 1035, 1038, 1044 }; -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const short int yyrhs[] = +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int16 yyrhs[] = { 131, 0, -1, 132, -1, 133, 8, -1, 133, 44, 8, -1, 133, 44, 132, -1, 3, -1, 3, 4, @@ -673,63 +800,64 @@ 133, 60, 143, 77, -1, 57, -1, 112, 142, 109, 143, 153, -1, 113, 133, 109, 143, 153, -1, 62, 17, 133, 18, 151, -1, 60, 143, 77, -1, 62, - 17, 133, 18, 133, 44, -1, 63, 133, 60, 143, - 77, -1, 111, 143, 153, -1, 71, 151, 72, 17, - 133, 18, 151, -1, 73, 17, 133, 18, -1, 73, - -1, 115, 143, 51, 143, 153, -1, 115, 143, 51, - 153, -1, 115, 143, 109, 51, 143, 153, -1, 115, - 143, 109, 51, 153, -1, 53, 17, 133, 18, 76, - 156, 77, -1, 54, 17, 4, 18, -1, 54, 133, - 157, 56, -1, 13, -1, 26, 13, 26, -1, 37, - 133, -1, 133, 37, 134, 67, 133, -1, 133, 37, - 133, -1, 133, 36, 133, -1, 36, 4, -1, 133, - 35, 133, -1, 133, 31, 133, -1, 133, 32, 133, - -1, 133, 33, 133, -1, 133, 117, 133, -1, 25, - -1, 26, 133, 26, -1, 122, 145, 122, -1, 17, - 133, 18, 17, 142, 18, -1, 133, 38, 133, 41, - -1, 17, 133, 18, -1, 40, 142, 41, -1, 39, - 142, 41, -1, 42, 142, 43, -1, 90, 142, 91, - -1, 92, 142, 93, -1, 94, 142, 95, -1, 96, - 142, 97, -1, 102, 142, 103, -1, 104, 142, 105, - -1, 106, 142, 107, -1, 133, 14, 133, -1, 133, - 120, 133, -1, 83, -1, 136, -1, 86, -1, 108, - 133, -1, 133, 124, 133, -1, 125, 133, -1, 133, - 125, 133, -1, 133, 128, -1, 1, -1, 4, -1, - 4, 46, 133, -1, 13, 4, -1, 121, 133, -1, - -1, 135, 137, -1, 138, 135, -1, 89, 17, 133, - 18, -1, 89, 83, -1, 79, 139, 44, -1, 81, - 133, 44, -1, 140, -1, 140, 14, 139, -1, 134, - -1, 4, 15, 133, -1, 17, 140, 18, -1, 10, - -1, 10, 46, 133, -1, 13, -1, 3, -1, -1, - 133, -1, -1, 133, -1, 133, -1, 143, 133, -1, - 143, 158, -1, -1, 145, 144, -1, 145, 14, 144, - -1, 10, -1, 26, 10, 26, -1, 3, -1, 134, - -1, 7, -1, 125, 145, -1, 3, 125, 145, -1, - 40, 144, 41, -1, 19, -1, 20, -1, 22, -1, - 21, -1, 24, -1, 29, -1, 23, -1, 30, -1, - 34, -1, 28, -1, 11, -1, 36, -1, 35, -1, - 31, -1, 32, -1, 33, -1, 86, -1, 26, 86, - 26, -1, 25, -1, 87, 144, 88, -1, 26, 133, - 26, -1, 52, -1, 48, 144, 50, 144, 77, -1, - 48, 144, 50, 144, 51, 144, 77, -1, 68, 144, - 61, -1, 68, 144, 70, -1, 57, 134, 144, 61, - -1, 57, 134, 144, 70, -1, 64, 144, 65, 144, - 77, -1, 60, 144, 66, 144, 77, -1, 16, 147, - 146, -1, 54, 155, 77, -1, 54, 155, 144, 77, - -1, 136, -1, 87, 144, 88, -1, 26, 133, 26, - -1, 134, -1, 147, 134, -1, -1, 61, 133, -1, - -1, 58, 133, -1, -1, 154, 133, 44, -1, 154, - 151, -1, 76, 143, 77, -1, 76, 135, 143, 77, - -1, 153, -1, 154, 143, 153, -1, 49, 133, 50, - 143, 152, -1, 109, 49, 133, 50, 143, 152, -1, - 77, -1, 109, 77, -1, 51, -1, 109, 51, -1, - -1, 155, 144, 50, 144, 77, -1, -1, 55, 45, - 151, -1, 54, 3, 45, 151, 156, -1, -1, 55, - 143, -1, 11, 3, 60, 143, 157, -1, 44, -1 + 17, 133, 18, 133, 44, -1, 65, 143, 66, 133, + 44, -1, 63, 133, 60, 143, 77, -1, 111, 143, + 153, -1, 71, 151, 72, 17, 133, 18, 151, -1, + 73, 17, 133, 18, -1, 73, -1, 115, 143, 51, + 143, 153, -1, 115, 143, 51, 153, -1, 115, 143, + 109, 51, 143, 153, -1, 115, 143, 109, 51, 153, + -1, 53, 17, 133, 18, 76, 156, 77, -1, 54, + 17, 4, 18, -1, 54, 133, 157, 56, -1, 13, + -1, 26, 13, 26, -1, 37, 133, -1, 133, 37, + 134, 67, 133, -1, 133, 37, 133, -1, 133, 36, + 133, -1, 36, 4, -1, 133, 35, 133, -1, 133, + 31, 133, -1, 133, 32, 133, -1, 133, 33, 133, + -1, 133, 117, 133, -1, 25, -1, 26, 133, 26, + -1, 122, 145, 122, -1, 17, 133, 18, 17, 142, + 18, -1, 133, 38, 133, 41, -1, 17, 133, 18, + -1, 40, 142, 41, -1, 39, 142, 41, -1, 42, + 142, 43, -1, 90, 142, 91, -1, 92, 142, 93, + -1, 94, 142, 95, -1, 96, 142, 97, -1, 102, + 142, 103, -1, 104, 142, 105, -1, 106, 142, 107, + -1, 133, 14, 133, -1, 133, 120, 133, -1, 83, + -1, 136, -1, 86, -1, 108, 133, -1, 133, 124, + 133, -1, 125, 133, -1, 133, 125, 133, -1, 133, + 128, -1, 1, -1, 4, -1, 4, 46, 133, -1, + 13, 4, -1, 121, 133, -1, -1, 135, 137, -1, + 138, 135, -1, 89, 17, 133, 18, -1, 89, 83, + -1, 79, 139, 44, -1, 81, 133, 44, -1, 140, + -1, 140, 14, 139, -1, 134, -1, 4, 15, 133, + -1, 17, 140, 18, -1, 10, -1, 10, 46, 133, + -1, 13, -1, 3, -1, -1, 133, -1, -1, 133, + -1, 133, -1, 143, 133, -1, 143, 158, -1, -1, + 145, 144, -1, 145, 14, 144, -1, 10, -1, 26, + 10, 26, -1, 3, -1, 134, -1, 7, -1, 125, + 145, -1, 3, 125, 145, -1, 40, 144, 41, -1, + 19, -1, 20, -1, 22, -1, 21, -1, 24, -1, + 29, -1, 23, -1, 30, -1, 34, -1, 28, -1, + 11, -1, 36, -1, 35, -1, 31, -1, 32, -1, + 33, -1, 86, -1, 26, 86, 26, -1, 25, -1, + 87, 144, 88, -1, 26, 133, 26, -1, 52, -1, + 48, 144, 50, 144, 77, -1, 48, 144, 50, 144, + 51, 144, 77, -1, 68, 144, 61, -1, 68, 144, + 70, -1, 57, 134, 144, 61, -1, 57, 134, 144, + 70, -1, 64, 144, 65, 144, 77, -1, 60, 144, + 66, 144, 77, -1, 16, 147, 146, -1, 54, 155, + 77, -1, 54, 155, 144, 77, -1, 136, -1, 87, + 144, 88, -1, 26, 133, 26, -1, 134, -1, 147, + 134, -1, -1, 61, 133, -1, -1, 58, 133, -1, + -1, 154, 133, 44, -1, 154, 151, -1, 76, 143, + 77, -1, 76, 135, 143, 77, -1, 153, -1, 154, + 143, 153, -1, 49, 133, 50, 143, 152, -1, 109, + 49, 133, 50, 143, 152, -1, 77, -1, 109, 77, + -1, 51, -1, 109, 51, -1, -1, 155, 144, 50, + 144, 77, -1, -1, 55, 45, 151, -1, 54, 3, + 45, 151, 156, -1, -1, 55, 143, -1, 11, 3, + 60, 143, 157, -1, 44, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned short int yyrline[] = +static const yytype_uint16 yyrline[] = { 0, 173, 173, 181, 182, 183, 186, 187, 188, 189, 190, 191, 192, 195, 196, 197, 198, 202, 203, 207, @@ -741,28 +869,28 @@ 330, 331, 332, 335, 336, 337, 338, 339, 343, 350, 351, 352, 356, 358, 359, 360, 361, 362, 363, 364, 366, 367, 368, 369, 370, 371, 378, 386, 394, 395, - 396, 397, 416, 420, 424, 425, 428, 429, 430, 431, - 432, 433, 434, 435, 436, 437, 438, 439, 440, 444, - 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 457, 458, 463, 464, 465, 469, 470, 475, 476, 477, - 478, 479, 480, 481, 482, 483, 484, 489, 490, 491, - 492, 493, 494, 495, 499, 503, 504, 513, 520, 527, - 532, 536, 537, 538, 542, 543, 546, 549, 552, 553, - 560, 561, 562, 563, 564, 565, 573, 583, 584, 587, - 588, 591, 593, 598, 601, 602, 603, 606, 607, 608, - 609, 610, 611, 615, 619, 620, 621, 622, 623, 624, - 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, - 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, - 645, 646, 647, 648, 649, 650, 651, 652, 653, 656, - 657, 660, 661, 664, 665, 668, 669, 672, 673, 674, - 678, 681, 688, 689, 692, 695, 700, 701, 704, 705, - 708, 709, 716, 717, 718, 721, 722, 723, 726 + 396, 397, 416, 420, 424, 425, 428, 433, 434, 435, + 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, + 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, + 459, 462, 463, 468, 469, 470, 474, 475, 480, 481, + 482, 483, 484, 485, 486, 487, 488, 489, 494, 495, + 496, 497, 498, 499, 500, 504, 508, 509, 518, 525, + 532, 537, 541, 542, 543, 547, 548, 551, 554, 557, + 558, 565, 566, 567, 568, 569, 570, 578, 588, 589, + 592, 593, 596, 598, 603, 606, 607, 608, 611, 612, + 613, 614, 615, 616, 620, 624, 625, 626, 627, 628, + 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, + 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, + 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, + 661, 662, 665, 666, 669, 670, 673, 674, 677, 678, + 679, 683, 686, 693, 694, 697, 700, 705, 706, 709, + 710, 713, 714, 721, 722, 723, 726, 727, 728, 731 }; #endif -#if YYDEBUG || YYERROR_VERBOSE -/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "T_NUMBER", "T_SYMBOL", "T_LITERAL", @@ -801,7 +929,7 @@ # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ -static const unsigned short int yytoknum[] = +static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, @@ -820,7 +948,7 @@ # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const unsigned char yyr1[] = +static const yytype_uint8 yyr1[] = { 0, 130, 131, 132, 132, 132, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, @@ -837,21 +965,21 @@ 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 134, 134, 134, - 134, 135, 135, 135, 136, 136, 137, 138, 139, 139, - 140, 140, 140, 140, 140, 140, 140, 141, 141, 142, - 142, 143, 143, 143, 144, 144, 144, 145, 145, 145, + 133, 133, 133, 133, 133, 133, 133, 133, 134, 134, + 134, 134, 135, 135, 135, 136, 136, 137, 138, 139, + 139, 140, 140, 140, 140, 140, 140, 140, 141, 141, + 142, 142, 143, 143, 143, 144, 144, 144, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, - 145, 145, 145, 145, 145, 145, 145, 145, 145, 146, - 146, 147, 147, 148, 148, 149, 149, 150, 150, 150, - 151, 151, 152, 152, 152, 152, 153, 153, 154, 154, - 155, 155, 156, 156, 156, 157, 157, 157, 158 + 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, + 146, 146, 147, 147, 148, 148, 149, 149, 150, 150, + 150, 151, 151, 152, 152, 152, 152, 153, 153, 154, + 154, 155, 155, 156, 156, 156, 157, 157, 157, 158 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const unsigned char yyr2[] = +static const yytype_uint8 yyr2[] = { 0, 2, 1, 2, 3, 3, 1, 2, 4, 3, 2, 1, 1, 6, 6, 6, 6, 3, 13, 12, @@ -863,2510 +991,2500 @@ 4, 4, 5, 4, 1, 4, 1, 3, 3, 4, 1, 4, 1, 2, 2, 1, 3, 2, 1, 3, 1, 1, 9, 10, 4, 7, 9, 9, 7, 9, - 1, 5, 5, 5, 3, 6, 5, 3, 7, 4, - 1, 5, 4, 6, 5, 7, 4, 4, 1, 3, - 2, 5, 3, 3, 2, 3, 3, 3, 3, 3, - 1, 3, 3, 6, 4, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, - 1, 2, 3, 2, 3, 2, 1, 1, 3, 2, - 2, 0, 2, 2, 4, 2, 3, 3, 1, 3, - 1, 3, 3, 1, 3, 1, 1, 0, 1, 0, - 1, 1, 2, 2, 0, 2, 3, 1, 3, 1, - 1, 1, 2, 3, 3, 1, 1, 1, 1, 1, + 1, 5, 5, 5, 3, 6, 5, 5, 3, 7, + 4, 1, 5, 4, 6, 5, 7, 4, 4, 1, + 3, 2, 5, 3, 3, 2, 3, 3, 3, 3, + 3, 1, 3, 3, 6, 4, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, + 1, 1, 2, 3, 2, 3, 2, 1, 1, 3, + 2, 2, 0, 2, 2, 4, 2, 3, 3, 1, + 3, 1, 3, 3, 1, 3, 1, 1, 0, 1, + 0, 1, 1, 2, 2, 0, 2, 3, 1, 3, + 1, 1, 1, 2, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 3, 1, 3, 3, 1, 5, 7, 3, - 3, 4, 4, 5, 5, 3, 3, 4, 1, 3, - 3, 1, 2, 0, 2, 0, 2, 0, 3, 2, - 3, 4, 1, 3, 5, 6, 1, 2, 1, 2, - 0, 5, 0, 3, 5, 0, 2, 5, 1 + 1, 1, 1, 3, 1, 3, 3, 1, 5, 7, + 3, 3, 4, 4, 5, 5, 3, 3, 4, 1, + 3, 3, 1, 2, 0, 2, 0, 2, 0, 3, + 2, 3, 4, 1, 3, 5, 6, 1, 2, 1, + 2, 0, 5, 0, 3, 5, 0, 2, 5, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ -static const unsigned short int yydefact[] = +static const yytype_uint16 yydefact[] = { - 0, 156, 6, 157, 33, 34, 11, 12, 61, 52, - 0, 118, 0, 0, 0, 130, 0, 0, 0, 0, + 0, 157, 6, 158, 33, 34, 11, 12, 61, 52, + 0, 119, 0, 0, 0, 131, 0, 0, 0, 0, 0, 0, 0, 0, 74, 0, 0, 100, 0, 0, - 0, 90, 91, 0, 110, 0, 80, 0, 82, 76, - 148, 57, 150, 184, 0, 0, 0, 0, 0, 0, + 0, 0, 90, 91, 0, 111, 0, 80, 0, 82, + 76, 149, 57, 151, 185, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 30, 0, 0, 0, 2, 0, - 32, 149, 7, 10, 0, 0, 0, 0, 54, 159, - 0, 49, 48, 118, 0, 0, 38, 124, 120, 180, - 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, - 0, 235, 181, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 84, 0, 0, 0, 0, 189, 191, 187, - 205, 0, 195, 196, 198, 197, 201, 199, 213, 0, - 204, 200, 202, 208, 209, 210, 203, 207, 206, 184, - 184, 216, 250, 0, 184, 184, 184, 211, 184, 0, - 190, 228, 0, 184, 0, 165, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 151, 24, 32, 0, 0, - 0, 0, 0, 23, 0, 160, 0, 0, 153, 0, - 87, 1, 3, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 62, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, - 0, 0, 0, 155, 0, 0, 9, 158, 35, 60, - 0, 0, 135, 119, 0, 131, 137, 136, 138, 0, - 0, 0, 0, 0, 157, 0, 0, 0, 178, 0, - 0, 0, 233, 258, 104, 182, 183, 0, 0, 0, - 0, 161, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 231, 0, 61, 150, 0, 0, 0, 184, - 184, 0, 0, 0, 0, 192, 64, 184, 185, 0, - 139, 140, 141, 142, 51, 0, 143, 144, 145, 0, - 246, 0, 107, 0, 0, 0, 0, 22, 0, 132, - 0, 89, 146, 53, 78, 77, 0, 39, 40, 41, - 42, 44, 43, 36, 37, 45, 126, 127, 128, 46, - 125, 123, 122, 32, 0, 4, 5, 47, 17, 129, - 147, 152, 154, 0, 8, 58, 59, 0, 0, 0, - 70, 71, 73, 0, 116, 0, 0, 117, 94, 0, - 236, 0, 0, 0, 0, 0, 0, 0, 0, 162, - 0, 163, 240, 0, 109, 161, 79, 81, 75, 55, - 56, 193, 0, 184, 232, 225, 188, 212, 215, 194, - 184, 226, 0, 0, 184, 184, 219, 220, 214, 186, - 164, 146, 0, 247, 0, 0, 0, 112, 0, 0, - 31, 29, 0, 134, 0, 0, 28, 0, 0, 0, - 237, 0, 248, 0, 72, 242, 0, 0, 252, 0, - 178, 0, 0, 233, 234, 0, 0, 0, 0, 103, - 106, 167, 176, 157, 173, 175, 0, 170, 0, 168, - 241, 0, 0, 0, 0, 0, 184, 227, 221, 222, - 0, 0, 50, 28, 101, 102, 111, 0, 114, 0, - 121, 0, 0, 0, 133, 0, 237, 0, 67, 0, - 0, 0, 249, 0, 69, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 105, 0, 0, 0, 166, - 0, 0, 0, 0, 230, 229, 184, 217, 0, 224, - 223, 0, 113, 0, 15, 16, 14, 13, 68, 0, - 239, 0, 0, 243, 0, 0, 115, 52, 257, 0, - 95, 0, 0, 98, 0, 171, 174, 172, 169, 108, - 0, 65, 0, 251, 0, 0, 0, 25, 238, 0, - 0, 0, 253, 0, 0, 0, 0, 66, 218, 0, - 0, 0, 21, 0, 0, 244, 0, 252, 0, 92, - 96, 97, 99, 0, 0, 0, 0, 27, 245, 254, - 93, 0, 0, 0, 0, 0, 0, 0, 0, 20, - 0, 19, 0, 18, 26 + 0, 0, 0, 0, 0, 30, 0, 0, 0, 2, + 0, 32, 150, 7, 10, 0, 0, 0, 0, 54, + 160, 0, 49, 48, 119, 0, 0, 38, 125, 121, + 181, 0, 0, 0, 0, 0, 0, 0, 0, 256, + 0, 0, 236, 182, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 84, 0, 0, 0, 0, 190, + 192, 188, 206, 0, 196, 197, 199, 198, 202, 200, + 214, 0, 205, 201, 203, 209, 210, 211, 204, 208, + 207, 185, 185, 217, 251, 0, 185, 185, 185, 212, + 185, 0, 191, 229, 0, 185, 0, 166, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 152, 24, 32, + 0, 0, 0, 0, 0, 23, 0, 161, 0, 0, + 154, 0, 87, 1, 3, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 62, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, + 0, 0, 0, 0, 0, 156, 0, 0, 9, 159, + 35, 60, 0, 0, 136, 120, 0, 132, 138, 137, + 139, 0, 0, 0, 0, 0, 158, 0, 0, 0, + 179, 0, 0, 0, 234, 259, 104, 183, 184, 0, + 0, 0, 0, 0, 162, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 232, 0, 61, 151, 0, + 0, 0, 185, 185, 0, 0, 0, 0, 193, 64, + 185, 186, 0, 140, 141, 142, 143, 51, 0, 144, + 145, 146, 0, 247, 0, 108, 0, 0, 0, 0, + 22, 0, 133, 0, 89, 147, 53, 78, 77, 0, + 39, 40, 41, 42, 44, 43, 36, 37, 45, 127, + 128, 129, 46, 126, 124, 123, 32, 0, 4, 5, + 47, 17, 130, 148, 153, 155, 0, 8, 58, 59, + 0, 0, 0, 70, 71, 73, 0, 117, 0, 0, + 118, 94, 0, 237, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 163, 0, 164, 241, 0, 110, 162, + 79, 81, 75, 55, 56, 194, 0, 185, 233, 226, + 189, 213, 216, 195, 185, 227, 0, 0, 185, 185, + 220, 221, 215, 187, 165, 147, 0, 248, 0, 0, + 0, 113, 0, 0, 31, 29, 0, 135, 0, 0, + 28, 0, 0, 0, 238, 0, 249, 0, 72, 243, + 0, 0, 253, 0, 179, 0, 0, 234, 235, 0, + 0, 0, 0, 103, 107, 106, 168, 177, 158, 174, + 176, 0, 171, 0, 169, 242, 0, 0, 0, 0, + 0, 185, 228, 222, 223, 0, 0, 50, 28, 101, + 102, 112, 0, 115, 0, 122, 0, 0, 0, 134, + 0, 238, 0, 67, 0, 0, 0, 250, 0, 69, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 105, 0, 0, 0, 167, 0, 0, 0, 0, 231, + 230, 185, 218, 0, 225, 224, 0, 114, 0, 15, + 16, 14, 13, 68, 0, 240, 0, 0, 244, 0, + 0, 116, 52, 258, 0, 95, 0, 0, 98, 0, + 172, 175, 173, 170, 109, 0, 65, 0, 252, 0, + 0, 0, 25, 239, 0, 0, 0, 254, 0, 0, + 0, 0, 66, 219, 0, 0, 0, 21, 0, 0, + 245, 0, 253, 0, 92, 96, 97, 99, 0, 0, + 0, 0, 27, 246, 255, 93, 0, 0, 0, 0, + 0, 0, 0, 0, 20, 0, 19, 0, 18, 26 }; -/* YYDEFGOTO[NTERM-NUM]. */ -static const short int yydefgoto[] = +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = { - -1, 67, 68, 102, 70, 250, 71, 359, 251, 438, - 439, 239, 407, 103, 152, 153, 375, 263, 354, 242, - 468, 107, 414, 415, 416, 269, 477, 237, 246 + -1, 68, 69, 103, 71, 253, 72, 363, 254, 443, + 444, 241, 411, 104, 154, 155, 379, 266, 357, 244, + 473, 109, 418, 419, 420, 272, 482, 239, 248 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -513 -static const short int yypact[] = +#define YYPACT_NINF -505 +static const yytype_int16 yypact[] = { - 7190, -513, 24, -13, -513, 20, -513, -513, 50, -513, - 7190, 35, 7190, 7190, 7190, -513, 7315, 7190, 39, 7190, - 4315, 4315, 4440, 7440, 58, 65, 7565, 55, 7190, 70, - 7190, -513, -513, 15, 101, 109, 117, 1052, 120, 121, - -513, 69, -513, 8262, -10, 4565, 4690, 4815, 4940, 7190, - 7190, 5065, 5190, 5315, 7190, 7190, 7190, 7190, 7190, 7190, - 5440, -2, 7190, 8262, 115, 7190, 1180, 148, -513, 8344, - 139, -513, -16, -513, 7190, 154, 5565, 7190, 54, -513, - 8532, 54, 54, 76, 1562, 8559, 10962, -513, 11035, 10490, - 119, 122, 124, 7190, 8417, 7190, 7190, 7690, 8380, 35, - 5690, -26, 10490, 2190, 7190, 8605, 2315, 90, 7190, 5815, - 7190, 1306, 10490, 7190, 7190, 7190, 7190, 40, -513, -513, - -513, -2, -513, -513, -513, -513, -513, -513, -513, 7815, - -513, -513, -513, -513, -513, -513, -513, -513, -513, 8262, - 8262, -513, -513, -2, 8262, 8262, 8262, -513, 8262, 8262, - -513, -513, 78, 792, 7190, -513, 73, 80, 74, 77, - 8678, 10549, 72, 75, 86, 10490, 10490, 164, 2440, 98, - 8720, 2565, 2440, -513, 199, 103, 95, 7190, 567, 5940, - 10962, -513, -513, 7190, 7190, 5440, 5815, 7190, 7190, 7190, - 7190, 7190, 7190, -513, 7190, 7190, 7190, 7190, 7190, 7190, - 7190, 7190, 7190, 7190, 7190, 6065, 7190, -513, -2, 7190, - 7190, 7190, 7190, -513, 5815, 7190, -513, 103, -513, -513, - 8835, 8862, 201, -513, 924, -513, -513, -513, -513, 8895, - 5440, 7190, 9010, 9043, 18, 216, 7190, 165, 9084, 176, - 7190, 7190, 62, -513, -513, 10490, -513, 9158, 7190, 7190, - 6190, 141, 2690, 208, 9199, 210, 9232, 9273, 9347, 9388, - 9421, 8262, -513, 57, 68, 203, 9462, 189, 185, 8190, - 8262, 171, 173, 63, 151, -513, -513, 8262, -513, 9536, - -513, -513, -513, -513, -513, 7190, -513, -513, -513, 5815, - -513, 6315, -513, 7190, 7190, 6440, 6565, -513, 5815, -513, - 9577, -513, 10962, 10667, 10989, -513, 224, 745, 745, 123, - 602, 10699, 108, 11061, 11035, 307, 9693, 282, 11083, 11013, - 103, 330, 11035, -11, 9610, -513, -513, 10962, 111, 10608, - 10726, 10785, 567, 225, 108, -513, -513, 5815, 1434, 1690, - 193, 10490, -513, 169, -513, 186, 2815, -513, -513, 5690, - 10490, 9651, 7190, 7190, 92, 5440, 2940, 9725, 21, -513, - 3065, 168, -513, 7190, -513, 141, -513, -513, -513, -513, - -513, -513, 7190, 8262, -513, -513, -513, -513, -513, -513, - 8262, -513, -8, 66, 8262, 8262, -513, -513, -513, -513, - -513, 10903, 232, -513, 2440, 2440, 2440, -513, 6440, 235, - -513, -513, 7190, -513, 5815, 7190, 239, 238, 5815, 9767, - -46, 7190, -513, 1815, -513, -513, 7190, 15, 44, 7190, - 10490, 211, 7190, 9840, 10490, 7190, 7190, 7190, 9899, -513, - -513, -513, -513, -6, 215, 35, 21, -513, 218, 252, - -513, 9958, 3190, 10018, 179, 28, 8262, -513, -513, -513, - 191, 194, -513, 3, -513, -513, -513, 2440, -513, 241, - 10490, 254, 10077, 5440, -513, 8532, -46, 223, -513, 5440, - 10136, 7190, -513, 2440, -513, 272, 231, 200, 1940, 6690, - 3315, 219, 10195, 3440, 10254, -513, 7190, 7190, 260, -513, - 21, 15, 7190, 3565, -513, -513, 8262, -513, 204, -513, - -513, 7940, -513, 6815, -513, -513, 10667, -513, -513, 10313, - -513, 7190, 10372, -513, 242, 15, -513, 216, -513, 264, - -513, 7190, 7190, -513, 7190, 10490, 10844, -513, -513, -513, - 3690, -513, 206, -513, 6940, 2065, 8065, 11035, -513, 1690, - 7190, 15, -513, 5440, 3815, 3940, 4065, -513, -513, 7190, - 4190, 7190, -513, 7065, 2440, -513, 1690, 44, 10431, -513, - -513, -513, -513, 175, 7190, 177, 7190, -513, -513, -513, - -513, 7190, 181, 7190, 183, 2440, 7190, 2440, 7190, -513, - 2440, -513, 2440, -513, -513 + 7362, -505, 134, -14, -505, 28, -505, -505, 53, -505, + 7362, 41, 7362, 7362, 7362, -505, 7487, 7362, 72, 7362, + 4487, 4487, 4612, 7612, 67, 70, 7737, 56, 7362, 78, + 7362, 7362, -505, -505, 13, 105, 107, 118, 1099, 124, + 126, -505, 71, -505, 8506, -11, 4737, 4862, 4987, 5112, + 7362, 7362, 5237, 5362, 5487, 7362, 7362, 7362, 7362, 7362, + 7362, 5612, -2, 7362, 8506, 43, 7362, 1227, 150, -505, + 8588, 138, -505, -20, -505, 7362, 148, 5737, 7362, 358, + -505, 8776, 358, 358, -1, 1609, 8803, 11115, -505, 675, + 10804, 117, 121, 116, 7362, 8661, 7362, 7362, 7862, 8624, + 41, 5862, 32, 10804, 2237, 7362, 8849, 2362, 2487, 92, + 7362, 5987, 7362, 1353, 10804, 7362, 7362, 7362, 7362, 40, + -505, -505, -505, -2, -505, -505, -505, -505, -505, -505, + -505, 7987, -505, -505, -505, -505, -505, -505, -505, -505, + -505, 8506, 8506, -505, -505, -2, 8506, 8506, 8506, -505, + 8506, 8506, -505, -505, 79, 8362, 7362, -505, 75, 82, + 73, 74, 8922, 10919, 80, 90, 69, 10804, 10804, 161, + 2612, 100, 8964, 2737, 2612, -505, 163, 76, 62, 7362, + 44, 6112, 11115, -505, -505, 7362, 7362, 5612, 5987, 7362, + 7362, 7362, 7362, 7362, 7362, -505, 7362, 7362, 7362, 7362, + 7362, 7362, 7362, 7362, 7362, 7362, 7362, 6237, 7362, -505, + -2, 7362, 7362, 7362, 7362, -505, 5987, 7362, -505, 76, + -505, -505, 9079, 9106, 165, -505, 971, -505, -505, -505, + -505, 9139, 5612, 7362, 9254, 9287, 18, 216, 7362, 171, + 9328, 185, 7362, 7362, -17, -505, -505, 10804, -505, 9402, + 7362, 7362, 7362, 6362, 149, 2862, 215, 9443, 217, 9476, + 9517, 9591, 9632, 9665, 8506, -505, 5, 106, 212, 9706, + 199, 191, 8434, 8506, 178, 180, 60, 166, -505, -505, + 8506, -505, 9780, -505, -505, -505, -505, -505, 7362, -505, + -505, -505, 5987, -505, 6487, -505, 7362, 7362, 6612, 6737, + -505, 5987, -505, 9821, -505, 11115, 10946, 10041, -505, 231, + 125, 125, 643, 336, 11029, 766, 841, 675, 10501, 10156, + 201, 10351, 285, 76, 330, 675, 16, 9854, -505, -505, + 11115, 89, 10389, 800, 10649, 44, 238, 766, -505, -505, + 5987, 1481, 1737, 206, 10804, -505, 182, -505, 202, 2987, + -505, -505, 5862, 10804, 9895, 7362, 7362, 77, 5612, 3112, + 9969, 10011, 24, -505, 3237, 186, -505, 7362, -505, 149, + -505, -505, -505, -505, -505, -505, 7362, 8506, -505, -505, + -505, -505, -505, -505, 8506, -505, -15, 64, 8506, 8506, + -505, -505, -505, -505, -505, 11088, 241, -505, 2612, 2612, + 2612, -505, 6612, 243, -505, -505, 7362, -505, 5987, 7362, + 251, 249, 5987, 10085, -44, 7362, -505, 1862, -505, -505, + 7362, 13, 99, 7362, 10804, 224, 7362, 10126, 10804, 7362, + 7362, 7362, 10200, -505, -505, -505, -505, -505, -7, 223, + 41, 24, -505, 227, 256, -505, 10241, 3362, 10274, 188, + 23, 8506, -505, -505, -505, 200, 204, -505, 9, -505, + -505, -505, 2612, -505, 253, 10804, 267, 10315, 5612, -505, + 8776, -44, 236, -505, 5612, 10430, 7362, -505, 2612, -505, + 286, 245, 214, 1987, 6862, 3487, 233, 10467, 3612, 10582, + -505, 7362, 7362, 277, -505, 24, 13, 7362, 3737, -505, + -505, 8506, -505, 219, -505, -505, 8112, -505, 6987, -505, + -505, 10946, -505, -505, 10616, -505, 7362, 10731, -505, 252, + 13, -505, 216, -505, 280, -505, 7362, 7362, -505, 7362, + 10804, 10978, -505, -505, -505, 3862, -505, 242, -505, 7112, + 2112, 8237, 675, -505, 1737, 7362, 13, -505, 5612, 3987, + 4112, 4237, -505, -505, 7362, 4362, 7362, -505, 7237, 2612, + -505, 1737, 99, 10768, -505, -505, -505, -505, 194, 7362, + 218, 7362, -505, -505, -505, -505, 7362, 221, 7362, 222, + 2612, 7362, 2612, 7362, -505, 2612, -505, 2612, -505, -505 }; /* YYPGOTO[NTERM-NUM]. */ -static const short int yypgoto[] = +static const yytype_int16 yypgoto[] = { - -513, -513, 83, 0, 373, -248, 237, -513, -513, -197, - -142, -348, 212, 167, 301, -48, -513, -513, -126, -513, - -159, 110, -512, 142, -406, -513, -249, -167, -513 + -505, -505, 93, 0, 374, -249, 467, -505, -505, -185, + -117, -351, 226, 203, 516, -49, -505, -505, -102, -505, + -139, 96, -504, 174, -385, -505, -229, -149, -505 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -257 -static const short int yytable[] = +#define YYTABLE_NINF -258 +static const yytype_int16 yytable[] = { - 69, 421, 3, 361, 469, 412, 214, 154, 215, 486, - 78, 99, 80, 81, 82, 176, 85, 86, 463, 88, - 89, 89, 89, 94, 432, 433, 98, 555, 72, 73, - 105, 434, 240, 74, 435, 75, 344, 112, 436, 79, - 74, 241, 446, 87, 568, 89, 89, 89, 89, 160, - 161, 89, 89, 89, 165, 166, 402, 89, 170, 3, - 469, 3, 175, 467, 74, 178, 180, 76, 99, 447, - 99, 186, 100, 155, 217, 95, 220, 221, 192, 496, - 79, 193, 96, 372, 112, 76, 115, 104, 77, 201, - 202, 106, 204, 229, 376, 232, 233, 80, 475, 476, - 238, 275, 223, 245, 247, 497, 77, 116, 254, 89, - 256, 166, 216, 257, 258, 259, 260, 442, 108, 62, - 186, 352, 501, 353, 386, 186, 109, 448, 404, 266, - 193, 519, 192, 387, 110, 193, 449, 113, 114, 207, - ... [truncated message content] |
From: <pa...@us...> - 2009-09-02 13:06:28
|
Revision: 759 http://xcas.svn.sourceforge.net/xcas/?rev=759&view=rev Author: parisse Date: 2009-09-02 13:05:24 +0000 (Wed, 02 Sep 2009) Log Message: ----------- Modified Paths: -------------- trunk/giac-xcas/giac/src/Editeur.cc trunk/giac-xcas/giac/src/Graph.cc trunk/giac-xcas/giac/src/Graph.h trunk/giac-xcas/giac/src/Graph3d.cc trunk/giac-xcas/giac/src/History.cc trunk/giac-xcas/giac/src/Input.cc trunk/giac-xcas/giac/src/Tableur.cc trunk/giac-xcas/giac/src/Tableur.h trunk/giac-xcas/giac/src/Xcas1.cc trunk/giac-xcas/giac/src/gen.cc trunk/giac-xcas/giac/src/gen.h trunk/giac-xcas/giac/src/global.cc trunk/giac-xcas/giac/src/global.h trunk/giac-xcas/giac/src/help.cc trunk/giac-xcas/giac/src/hist.cxx trunk/giac-xcas/giac/src/hist.fl trunk/giac-xcas/giac/src/hist.h trunk/giac-xcas/giac/src/icas.cc trunk/giac-xcas/giac/src/input_lexer.cc trunk/giac-xcas/giac/src/input_lexer.ll trunk/giac-xcas/giac/src/intg.cc trunk/giac-xcas/giac/src/intgab.cc trunk/giac-xcas/giac/src/maple.cc trunk/giac-xcas/giac/src/misc.cc trunk/giac-xcas/giac/src/permu.cc trunk/giac-xcas/giac/src/plot.cc trunk/giac-xcas/giac/src/prog.cc trunk/giac-xcas/giac/src/risch.cc trunk/giac-xcas/giac/src/series.cc trunk/giac-xcas/giac/src/solve.cc trunk/giac-xcas/giac/src/solve.h trunk/giac-xcas/giac/src/subst.cc trunk/giac-xcas/giac/src/sym2poly.cc trunk/giac-xcas/giac/src/ti89.cc trunk/giac-xcas/giac/src/usual.cc trunk/giac-xcas/giac/src/usual.h Modified: trunk/giac-xcas/giac/src/Editeur.cc =================================================================== --- trunk/giac-xcas/giac/src/Editeur.cc 2009-07-03 07:44:00 UTC (rev 758) +++ trunk/giac-xcas/giac/src/Editeur.cc 2009-09-02 13:05:24 UTC (rev 759) @@ -1857,13 +1857,45 @@ History_Pack * hp=get_history_pack(this); if (event==FL_KEYBOARD){ if (Fl::event_text()[0]==9 ){ + int pos=insert_position(); + if (pos) + --pos; + char car=buffer()->character(pos); + if (car=='\n'){ + ++pos; + car=buffer()->character(pos); + } + if (isalphan(car)){ + int wbeg=buffer()->word_start(pos); + int wend=buffer()->word_end(pos); + pos=wend; + string s(buffer()->text_range(wbeg,wend)),ans; + int remove; + if (int ii=handle_tab(s,*giac::vector_completions_ptr,window()->w(),window()->h()/3,remove,ans)){ + window()->show(); + Fl::focus(this); + handle(FL_FOCUS); + pos=wend-remove; + buffer()->remove(pos,wend); + if (ii==1){ + buffer()->insert(pos,(ans+"()").c_str()); + insert_position(pos+ans.size()+1); + } + else { + buffer()->insert(pos,ans.c_str()); + insert_position(pos+ans.size()); + } + if (parent()) + parent_redraw(parent()); + } + return 1; + } + int debut_ligne=buffer()->line_start(pos),indent=0; + // Tab pressed -> indent current line if (xcas_mode(contextptr)){ fl_message(gettext("Indentation works only in Xcas programming mode")); return 1; } - // Tab pressed -> indent current line - int pos=insert_position(); - int debut_ligne=buffer()->line_start(pos),indent=0; if (debut_ligne){ char * ch_ = buffer()->line_text(pos-1),*ch=ch_; bool empty_line=true; Modified: trunk/giac-xcas/giac/src/Graph.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph.cc 2009-07-03 07:44:00 UTC (rev 758) +++ trunk/giac-xcas/giac/src/Graph.cc 2009-09-02 13:05:24 UTC (rev 759) @@ -335,6 +335,8 @@ if (optvs>=3) z_axis_name=printstring(optv[2],contextptr); } + if (optname.val==_GL_ORTHO && optvalue==1) + orthonormalize(); if (optname.val>=_GL_X && optname.val<=_GL_Z && optvalue.is_symb_of_sommet(at_interval)){ gen optvf=evalf_double(optvalue._SYMBptr->feuille,1,contextptr); if (optvf.type==_VECT && optvf._VECTptr->size()==2){ @@ -1993,6 +1995,24 @@ w->hide(); } + Gen_Value_Slider * parameter2slider(const gen & e,const giac::context *contextptr){ + if (e.is_symb_of_sommet(at_parameter) && e._SYMBptr->feuille.type==_VECT){ + vecteur v = *e._SYMBptr->feuille.evalf(1,contextptr).evalf_double(1,contextptr)._VECTptr; + if (v.size()>3 &&v[1].type==_DOUBLE_ && v[2].type==_DOUBLE_ && v[3].type == _DOUBLE_ ){ + gen name=e._SYMBptr->feuille._VECTptr->front(); + double step=(v[2]._DOUBLE_val-v[1]._DOUBLE_val)/100.; + if (v.size()>4 && v[4].type==_DOUBLE_) + step=v[4]._DOUBLE_val; + Fl_Group::current(0); + Gen_Value_Slider * gvs = new Gen_Value_Slider(0,0,1,1,-2,v[1]._DOUBLE_val,v[2]._DOUBLE_val,step,name.print(contextptr),name.print(contextptr).c_str()); + gvs->align(FL_ALIGN_RIGHT); + gvs->value(v[3]._DOUBLE_val); + return gvs; + } + } + return 0; + } + void Graph2d3d::add(const gen & e){ context * contextptr=hp?hp->contextptr:get_context(this); if (e.is_symb_of_sommet(at_trace)){ @@ -2016,32 +2036,23 @@ } // gen_value_slider inside normal graphic do not work // especially if you save them, the output by widget_sprint is unusable - if ((dynamic_cast<Geo2d *>(this) || dynamic_cast<Geo3d *>(this)) && - e.is_symb_of_sommet(at_parameter) && e._SYMBptr->feuille.type==_VECT && param_group){ - // cerr << e << endl; - vecteur v = *e._SYMBptr->feuille.evalf(1,contextptr).evalf_double(1,contextptr)._VECTptr; - if (v.size()>3 &&v[1].type==_DOUBLE_ && v[2].type==_DOUBLE_ && v[3].type == _DOUBLE_ ){ - gen name=e._SYMBptr->feuille._VECTptr->front(); - int n=param_group->children(); - int x=param_group->x(), y=param_group->y(),h=param_group->h(),w=(6*param_group->w()/7); - int nmax=int(0.5+param_group->h()/(1.5*labelsize())); - if (n>nmax){ // Resize params height h/(n+1) - for (int i=0;i<n;++i) - param_group->child(i)->resize(x,y+h/(n+1)*i,w,h/(n+1)); - } - if (n) - y=param_group->child(n-1)->y()+param_group->child(n-1)->h(); - if (n<nmax) - n=nmax-1; - double step=(v[2]._DOUBLE_val-v[1]._DOUBLE_val)/100.; - if (v.size()>4 && v[4].type==_DOUBLE_) - step=v[4]._DOUBLE_val; - Gen_Value_Slider * gvs = new Gen_Value_Slider(x,y,w,param_group->h()/(n+1),plot_instructions.size()-1,v[1]._DOUBLE_val,v[2]._DOUBLE_val,step,name.print(contextptr),name.print(contextptr).c_str()); - gvs->align(FL_ALIGN_RIGHT); - gvs->value(v[3]._DOUBLE_val); - param_group->add(gvs); - param_group->redraw(); + Gen_Value_Slider * gvs=0; + if ( (dynamic_cast<Geo2d *>(this) || dynamic_cast<Geo3d *>(this)) && param_group && (gvs=parameter2slider(e,contextptr)) ){ + int n=param_group->children(); + int x=param_group->x(), y=param_group->y(),h=param_group->h(),w=(6*param_group->w()/7); + int nmax=int(0.5+param_group->h()/(1.5*labelsize())); + if (n>nmax){ // Resize params height h/(n+1) + for (int i=0;i<n;++i) + param_group->child(i)->resize(x,y+h/(n+1)*i,w,h/(n+1)); } + if (n) + y=param_group->child(n-1)->y()+param_group->child(n-1)->h(); + if (n<nmax) + n=nmax-1; + gvs->resize(x,y,w,param_group->h()/(n+1)); + gvs->pos=plot_instructions.size()-1; + param_group->add(gvs); + param_group->redraw(); } this->redraw(); } @@ -2712,6 +2723,7 @@ button2->show(); else button2->hide(); + /* if (dim3){ pt0->hide(); pt1->hide(); pt2->hide(); pt3->hide(); @@ -2724,6 +2736,7 @@ pt4->show(); pt5->show(); pt6->show(); pt7->show(); } + */ static string titlestr; titlestr=gettext("Object attributs ")+title; w->label(titlestr.c_str()); @@ -3130,7 +3143,7 @@ if (in_area && args_tmp.front().is_symb_of_sommet(at_point)){ val1=gen(autoname(hp->contextptr),hp->contextptr); // put in last history pack level - hp->set_gen_value(-1,symbolic(at_sto,makevecteur(Graph2d3d::add_attributs(args_tmp.front(),couleur),val1)),false); + hp->set_gen_value(-1,symbolic(at_sto,makevecteur(add_attributs(args_tmp.front(),couleur),val1)),false); hp_pos=hp->children()-1; autoname_plus_plus(); } @@ -3138,7 +3151,7 @@ val1=args_tmp.front(); if (in_area && tmp.is_symb_of_sommet(at_point)){ val2=gen(autoname(hp->contextptr),hp->contextptr); - gen tmp3=symbolic(at_sto,makevecteur(Graph2d3d::add_attributs(tmp,couleur),val2)); + gen tmp3=symbolic(at_sto,makevecteur(add_attributs(tmp,couleur),val2)); hp->set_gen_value(-1,tmp3,false); if (hp_pos<0) hp_pos=hp->children()-1; autoname_plus_plus(); @@ -3246,7 +3259,7 @@ unary_function_ptr * ptr=function_final._FUNCptr; hp_pos=-1; tmp_plot=symbolic(*ptr,gen( (*ptr==(gr3d?at_sphere:at_cercle)) ?makevecteur(args_tmp.front(),args_tmp.back()-args_tmp.front()):args_tmp,_SEQ__VECT)); - do_handle(symbolic(at_sto,makevecteur(Graph2d3d::add_attributs(tmp_plot,couleur),gen(autoname(hp->contextptr),hp->contextptr)))); + do_handle(symbolic(at_sto,makevecteur(add_attributs(tmp_plot,couleur),gen(autoname(hp->contextptr),hp->contextptr)))); autoname_plus_plus(); } args_tmp.clear(); @@ -3399,23 +3412,7 @@ } } - giac::gen Graph2d3d::add_attributs(const giac::gen & g,int couleur_) const { - if (g.type!=_SYMB) - return g; - gen & f=g._SYMBptr->feuille; - if (g._SYMBptr->sommet==at_couleur && f.type==_VECT && !f._VECTptr->empty()){ - gen col=couleur_; - col.subtype=_INT_COLOR; - vecteur v(*f._VECTptr); - v.back()=col; - return symbolic(at_couleur,gen(v,_SEQ__VECT)); - } - if (g._SYMBptr->sommet==at_of){ - gen col=couleur_; - col.subtype=_INT_COLOR; - return symbolic(at_couleur,gen(makevecteur(g,col),_SEQ__VECT)); - } - vecteur v =gen2vecteur(f); + gen int2color(int couleur_){ gen col; if (couleur_){ gen tmp; @@ -3466,10 +3463,34 @@ else col=symbolic(at_plus,gen(colv,_SEQ__VECT)); } - v.push_back(symbolic(at_equal,gen(makevecteur(at_couleur,col),_SEQ__VECT))); + return col; + } + + std::string print_color(int couleur){ + return int2color(couleur).print(context0); + } + + giac::gen add_attributs(const giac::gen & g,int couleur_) { + if (g.type!=_SYMB) + return g; + gen & f=g._SYMBptr->feuille; + if (g._SYMBptr->sommet==at_couleur && f.type==_VECT && !f._VECTptr->empty()){ + gen col=couleur_; + col.subtype=_INT_COLOR; + vecteur v(*f._VECTptr); + v.back()=col; + return symbolic(at_couleur,gen(v,_SEQ__VECT)); + } + if (g._SYMBptr->sommet==at_of){ + gen col=couleur_; + col.subtype=_INT_COLOR; + return symbolic(at_couleur,gen(makevecteur(g,col),_SEQ__VECT)); + } + vecteur v =gen2vecteur(f); + gen col=int2color(couleur_); + v.push_back(symbolic(at_equal,gen(makevecteur(at_display,col),_SEQ__VECT))); return symbolic(g._SYMBptr->sommet,(v.size()==1 && f.type!=_VECT)?f:gen(v,f.type==_VECT?f.subtype:_SEQ__VECT)); } - void Graph2d3d::set_mode(const giac::gen & f_tmp,const giac::gen & f_final,int m){ if (mode>=-1){ @@ -3676,6 +3697,8 @@ void find_dxdy(const string & legendes,int labelpos,int labelsize,int & dx,int & dy){ int l=int(fl_width(legendes.c_str())); + dx=3; + dy=1; switch (labelpos){ case 1: dx=-l-3; @@ -4678,7 +4701,7 @@ } - int figure_param_dialog(Figure * f,bool adjust,double & tmin,double & tmax,double & tcurrent,double & tstep,string & name,bool symb,string & tmp){ + int figure_param_dialog(Fl_Widget * f,bool adjust,double & tmin,double & tmax,double & tcurrent,double & tstep,string & name,bool symb,string & tmp){ static Fl_Window * w = 0; static Fl_Value_Input * wxmin=0, * wxmax=0, *wcurrent=0,*wstep=0; static Fl_Input * wname=0; @@ -4812,10 +4835,10 @@ int lignes=5; w=new Fl_Window(dx,dy); int l=spread_ptr->labelsize(); - ltres = new Line_Type(2,2,l,l,curvestyle); + ltres = new Line_Type(2,2,l,l,_MAGENTA+_FILL_POLYGON); ltres->show_pnt(true); ltres->show_poly(true); - do_plotfield= new Fl_Check_Button (2,2,dx/6-4,dy/lignes-4,"Field"); + do_plotfield= new Fl_Check_Button (l+2,2,dx/6-4-l,dy/lignes-4,"Field"); do_plotfield->value(true); do_plotfield->tooltip(gettext("Draw slopefield")); do_normal= new Fl_Check_Button (2+dx/6,2,dx/6-4,dy/lignes-4,"||=1"); @@ -5033,6 +5056,12 @@ Fl_Widget *o = Fl::readqueue(); if (!o) Fl::wait(); else { + if (o==ltres){ + int i=ltres->line_type(); + bool formel=false,untranslate=false,approx=false; + change_line_type(i,true,approx,"",fcnzuv->visible(),formel,untranslate,false,spread_ptr?spread_ptr->labelsize():14); + ltres->line_type(i); + } if (o == button0) {r = 0; break;} if (o == button1) {r = 1; break;} if (o == w) { r=1; break; } @@ -5041,7 +5070,7 @@ w->hide(); if (!r){ if (modeplot==3){ - arg=string(fcnimplicit->value())+",["+string(varnamex->value())+"="+print_DOUBLE_(xmin->value())+".."+print_DOUBLE_(xmax->value()) + string(",")+varnamey->value()+string("=")+print_DOUBLE_(ymin->value())+".."+print_DOUBLE_(ymax->value())+"],xstep="+print_DOUBLE_(xstep->value())+",ystep="+print_DOUBLE_(ystep->value()); + arg=string(fcnimplicit->value())+",["+string(varnamex->value())+"="+print_DOUBLE_(xmin->value())+".."+print_DOUBLE_(xmax->value()) + string(",")+varnamey->value()+string("=")+print_DOUBLE_(ymin->value())+".."+print_DOUBLE_(ymax->value())+"],xstep="+print_DOUBLE_(xstep->value())+",ystep="+print_DOUBLE_(ystep->value())+",display="+print_color(ltres->line_type()); return 1; } if (modeplot==2){ @@ -5052,19 +5081,19 @@ arg=string(fcnfield->value())+",["+string(varnametfield->value())+"="+print_DOUBLE_(xmin->value())+".."+print_DOUBLE_(xmax->value()) + string(",")+varnameyfield->value()+string("=")+print_DOUBLE_(ymin->value())+".."+print_DOUBLE_(ymax->value())+"]"; if (do_normal->value()) arg+=",normalize"; - arg+= ",xstep="+print_DOUBLE_(xstep->value())+",ystep="+print_DOUBLE_(ystep->value()); + arg+= ",xstep="+print_DOUBLE_(xstep->value())+",ystep="+print_DOUBLE_(ystep->value())+",display="+print_color(ltres->line_type()); return do_plotfield->value()?2:1; } if (modeplot==1) { arg = "["+string(fcnxuv->value())+","+string(fcnyuv->value())+","+string(fcnzuv->value())+"]"; - arg += ",\n["+string(varnameu->value())+"="+print_DOUBLE_(umin->value())+".."+print_DOUBLE_(umax->value()) + string(",")+varnamev->value()+string("=")+print_DOUBLE_(vmin->value())+".."+print_DOUBLE_(vmax->value())+"],\nustep="+print_DOUBLE_(ustep->value())+",vstep="+print_DOUBLE_(vstep->value()); + arg += ",\n["+string(varnameu->value())+"="+print_DOUBLE_(umin->value())+".."+print_DOUBLE_(umax->value()) + string(",")+varnamev->value()+string("=")+print_DOUBLE_(vmin->value())+".."+print_DOUBLE_(vmax->value())+"],\nustep="+print_DOUBLE_(ustep->value())+",vstep="+print_DOUBLE_(vstep->value())+",display="+print_color(ltres->line_type()); return 1; } if (modeplot==-1) arg = string(fcnrhot->value())+","; else arg = "["+string(fcnxt->value())+","+string(fcnyt->value())+"]\n,"; - arg += string(varnamet->value())+"="+print_DOUBLE_(tmin->value())+".."+print_DOUBLE_(tmax->value())+",tstep="+print_DOUBLE_(tstep->value()); + arg += string(varnamet->value())+"="+print_DOUBLE_(tmin->value())+".."+print_DOUBLE_(tmax->value())+",tstep="+print_DOUBLE_(tstep->value())+",display="+print_color(ltres->line_type()); return 1; } return 0; @@ -6327,91 +6356,103 @@ // adjust history level to the slider value, and eval history pack // if eval_hp is true void Gen_Value_Slider::adjust(bool eval_hp){ - Fl_Group * g = parent(); // param_group + Fl_Group * g = parent(); // param_group or tile if (!g) return; - g=parent_skip_scroll(g); // mouse_param_group + g=parent_skip_scroll(g); // mouse_param_group or history_pack if (!g) return; - g=parent_skip_scroll(g); // parent of Graph2d screen - if (!g) return; - // Now find an history_pack inside g - int n=g->children(); - for (int i=0;i<n;++i){ - Fl_Widget * wid = g->child(i); - if (Fl_Scroll * s=dynamic_cast<Fl_Scroll *>(wid)) - if (s->children()) - wid=s->child(0); - if (History_Pack * hp=dynamic_cast<History_Pack *>(wid)){ - // Find in hp the first level beginning with gvs->g := ... - unsigned m=hp->children(); - if (pos<m){ - bool do_cb=false; - giac::gen gt(hp->value(pos),hp->contextptr); - if (gt.is_symb_of_sommet(at_sto) && gt._SYMBptr->feuille.type==_VECT && !gt._SYMBptr->feuille._VECTptr->empty() ){ - // Check for element - gen & f = gt._SYMBptr->feuille._VECTptr->front(); - if (f.is_symb_of_sommet(at_element)){ - gen ff = f._SYMBptr->feuille; - if (ff.type==_VECT && !ff._VECTptr->empty()){ - vecteur v=*ff._VECTptr; - if (v.size()>1) - v[1]=value(); - else - v.push_back(value()); - ff = symbolic(at_element,gen(v,ff.subtype)); + History_Pack * hp=0; + int position=pos; + if (pos==-2){ + hp=dynamic_cast<History_Pack *>(g); + if (hp){ + for (int i=0;i<hp->children();i++){ + if (hp->child(i)==parent()){ + position=i; + break; + } + } + } + } + else { + g=parent_skip_scroll(g); // parent of Graph2d screen + if (!g) return; + // Now find an history_pack inside g + int n=g->children(); + for (int i=0;i<n;++i){ + Fl_Widget * wid = g->child(i); + if (Fl_Scroll * s=dynamic_cast<Fl_Scroll *>(wid)) + if (s->children()) + wid=s->child(0); + if (hp=dynamic_cast<History_Pack *>(wid)) + break; + } // end for i + } + if (hp){ + // check that level is gvs->g := ... + unsigned m=hp->children(); + if (position>=0 && position<m){ + bool do_cb=false; + giac::gen gt(hp->value(position),hp->contextptr); + if (gt.is_symb_of_sommet(at_sto) && gt._SYMBptr->feuille.type==_VECT && !gt._SYMBptr->feuille._VECTptr->empty() ){ + // Check for element + gen & f = gt._SYMBptr->feuille._VECTptr->front(); + if (f.is_symb_of_sommet(at_element)){ + gen ff = f._SYMBptr->feuille; + if (ff.type==_VECT && !ff._VECTptr->empty()) + ff = ff._VECTptr->front(); + // Change gt value with parameter + ff = symbolic(at_element,makevecteur(ff,value())); + gt=symbolic(at_sto,makevecteur(ff,gt._SYMBptr->feuille._VECTptr->back())); + do_cb=true; + } + } // end element + if (gt.is_symb_of_sommet(at_assume)){ + gen & f = gt._SYMBptr->feuille; + if (f.is_symb_of_sommet(at_equal)||f.is_symb_of_sommet(at_same)){ + gen & ff = f._SYMBptr->feuille; + if (ff.type==_VECT && !ff._VECTptr->empty()){ + vecteur v=*ff._VECTptr; + if (v.back().type==_VECT && v.back()._VECTptr->size()>=3){ + vecteur & vb=*v.back()._VECTptr; + gen step=(vb[2]-vb[1])/100; + if (vb.size()>3) + step=vb[3]; + v.back()=makevecteur(value(),vb[1],vb[2],step); } else - // Change gt value with parameter - ff = symbolic(at_element,makevecteur(ff,value())); - gt=symbolic(at_sto,makevecteur(ff,gt._SYMBptr->feuille._VECTptr->back())); - do_cb=true; + v.back()=makevecteur(value(),minimum(),maximum(),Fl_Valuator::step()); + gt = symbolic(at_equal,v); + gt = symbolic(at_assume,gt); + do_cb = true; } - } // end element - if (gt.is_symb_of_sommet(at_assume)){ - gen & f = gt._SYMBptr->feuille; - if (f.is_symb_of_sommet(at_equal)||f.is_symb_of_sommet(at_same)){ - gen & ff = f._SYMBptr->feuille; - if (ff.type==_VECT && !ff._VECTptr->empty()){ - vecteur v=*ff._VECTptr; - if (v.back().type==_VECT && v.back()._VECTptr->size()>=3){ - vecteur & vb=*v.back()._VECTptr; - gen step=(vb[2]-vb[1])/100; - if (vb.size()>3) - step=vb[3]; - v.back()=makevecteur(value(),vb[1],vb[2],step); - } - else - v.back()=makevecteur(value(),minimum(),maximum(),Fl_Valuator::step()); - gt = symbolic(at_equal,v); - gt = symbolic(at_assume,gt); - do_cb = true; + } + if (f.is_symb_of_sommet(at_sto)){ + gen & ff = f._SYMBptr->feuille; + if (ff.type==_VECT && !ff._VECTptr->empty()){ + vecteur v=*ff._VECTptr; + if (v.front().type==_VECT && v.front()._VECTptr->size()>=3){ + vecteur & vf=*v.front()._VECTptr; + gen step=(vf[2]-vf[1])/100.; + if (vf.size()>3) + step=vf[3]; + v.front()=makevecteur(value(),vf[1],vf[2],step); } + else + v.front() = makevecteur(value(),minimum(),maximum(),Fl_Valuator::step()); + gt = symbolic(at_sto,v); + gt = symbolic(at_assume,gt); + do_cb = true; } - if (f.is_symb_of_sommet(at_sto)){ - gen & ff = f._SYMBptr->feuille; - if (ff.type==_VECT && !ff._VECTptr->empty()){ - vecteur v=*ff._VECTptr; - if (v.front().type==_VECT && v.front()._VECTptr->size()>=3){ - vecteur & vf=*v.front()._VECTptr; - gen step=(vf[2]-vf[1])/100.; - if (vf.size()>3) - step=vf[3]; - v.front()=makevecteur(value(),vf[1],vf[2],step); - } - else - v.front() = makevecteur(value(),minimum(),maximum(),Fl_Valuator::step()); - gt = symbolic(at_sto,v); - gt = symbolic(at_assume,gt); - do_cb = true; - } - } - } // end assume - if (do_cb){ - hp->update_pos=pos; - hp->set_gen_value(pos,gt,eval_hp); - } // end do_cb - } // end if gvs->pos<children() - } // end if history_pack hp - } // end for i + } + } // end assume + if (do_cb){ + hp->update_pos=position; + if (pos==-2) + hp->eval_below=true; + hp->set_gen_value(position,gt,eval_hp); + } // end do_cb + } // end if gvs->pos<children() + } // end if history_pack hp } Figure * get_figure(Fl_Widget * widget){ @@ -6426,18 +6467,20 @@ int Gen_Value_Slider::handle(int event){ string tmp; Figure * f=get_figure(this); + int position=pos; + History_Pack * hp=f?f->geo->hp:get_history_pack(this,position); double tmin=minimum(),tmax=maximum(),tcur=value(),tstep=Fl_Valuator::step(); // tstep=100*tstep/(tmax-tmin); if ((event==FL_PUSH || event==FL_DRAG || event==FL_RELEASE) &&Fl::event_button()== FL_RIGHT_MOUSE){ - if (event==FL_RELEASE && f->geo->hp->children()>pos){ - Fl_Widget * wid=f->geo->hp->child(pos); + if (event==FL_RELEASE && hp->children()>position){ + Fl_Widget * wid=hp->child(position); while (Fl_Group * s=dynamic_cast<Fl_Group *>(wid)) { if (s->children()) wid=s->child(0); } if (Multiline_Input_tab * m=dynamic_cast<Multiline_Input_tab *>(wid)){ gen g=m->g(); - if (figure_param_dialog(f,true,tmin,tmax,tcur,tstep,paramname,g.is_symb_of_sommet(at_assume),tmp) ){ + if (figure_param_dialog(hp,true,tmin,tmax,tcur,tstep,paramname,g.is_symb_of_sommet(at_assume),tmp) ){ minimum(tmin); maximum(tmax); value(tcur); @@ -6445,7 +6488,9 @@ step(tstep,10*tstep); redraw(); label(paramname.c_str()); - f->geo->hp->set_value(pos,tmp,true); + hp->set_value(position,tmp,true); + // if (!f) + hp->eval_below=true; } } } @@ -6454,7 +6499,7 @@ return Fl_Counter::handle(event); } - Gen_Value_Slider::Gen_Value_Slider(int x,int y,int w,int h,unsigned _pos,double m,double M,double mystep,const std::string & pname,const char * l):Fl_Counter(x,y,w,h,l),pos(_pos) { + Gen_Value_Slider::Gen_Value_Slider(int x,int y,int w,int h,int _pos,double m,double M,double mystep,const std::string & pname,const char * l):Fl_Counter(x,y,w,h,l),pos(_pos) { // type(FL_HOR_NICE_SLIDER); // type(FL_HOR_FILL_SLIDER); minimum(m); maximum(M); Modified: trunk/giac-xcas/giac/src/Graph.h =================================================================== --- trunk/giac-xcas/giac/src/Graph.h 2009-07-03 07:44:00 UTC (rev 758) +++ trunk/giac-xcas/giac/src/Graph.h 2009-09-02 13:05:24 UTC (rev 759) @@ -97,6 +97,9 @@ window_xyz(double x,double X,double y,double Y,double z,double Z):xmin(x),xmax(X),ymin(y),ymax(Y),zmin(z),zmax(Z) {}; }; + giac::gen add_attributs(const giac::gen & g,int couleur_) ; + int change_line_type(int & res,bool show_approx,bool & approx,const std::string & title,bool dim3,bool & formel,bool & untranslate,bool del,int fontsize); + class Graph2d3d:public Fl_Widget { protected: int push_i,push_j,current_i,current_j; // position of mouse push/drag @@ -199,7 +202,6 @@ virtual int in_handle(int); int geo_handle(int event); virtual const char * latex(const char * filename); - giac::gen add_attributs(const giac::gen & g,int couleur_) const ; giac::gen geometry_round(double x,double y,double z,double eps,giac::gen & original,int & pos) ; virtual void geometry_round(double x,double y,double z,double eps,giac::gen & tmp,const giac::context *) ; giac::vecteur selection2vecteur(const std::vector<int> & v); @@ -236,6 +238,12 @@ int mouse_rescale(); }; + // find how to move position for legende drawing + void find_dxdy(const std::string & legendes,int labelpos,int labelsize,int & dx,int & dy); + std::string print_color(int couleur); + + int figure_param_dialog(Fl_Widget * f,bool adjust,double & tmin,double & tmax,double & tcurrent,double & tstep,std::string & name,bool symb,std::string & tmp); + giac::gen geometry_round_numeric(double x,double y,double eps,bool approx); giac::gen geometry_round_numeric(double x,double y,double z,double eps,bool approx); @@ -294,15 +302,17 @@ class Gen_Value_Slider:public Fl_Counter { public: - unsigned pos; + int pos; std::string paramname; - Gen_Value_Slider(int x,int y,int w,int h,unsigned _pos,double m,double M,double mystep,const std::string & pname,const char * l=0); + Gen_Value_Slider(int x,int y,int w,int h,int _pos,double m,double M,double mystep,const std::string & pname,const char * l=0); // adjust history level to the slider value, and eval history pack // if eval_hp is true void adjust(bool ); virtual int handle(int event); }; + Gen_Value_Slider * parameter2slider(const giac::gen & e,const giac::context *); + class Turtle:public Fl_Widget { public: virtual FL_EXPORT void draw(); Modified: trunk/giac-xcas/giac/src/Graph3d.cc =================================================================== --- trunk/giac-xcas/giac/src/Graph3d.cc 2009-07-03 07:44:00 UTC (rev 758) +++ trunk/giac-xcas/giac/src/Graph3d.cc 2009-09-02 13:05:24 UTC (rev 759) @@ -220,8 +220,20 @@ // draw s at g with mode= 0 (upper right), 1, 2 or 3 void Graph3d::legende_draw(const gen & g,const string & s,int mode){ - glraster(g+makevecteur(0,0,3*(window_zmax-window_zmin)/h())); - draw_string(s); + context * contextptr=hp?hp->contextptr:get_context(this); + gen gf=evalf_double(g,1,contextptr); + if (gf.type==_VECT && gf._VECTptr->size()==3){ + double Ax=gf[0]._DOUBLE_val; + double Ay=gf[1]._DOUBLE_val; + double Az=gf[2]._DOUBLE_val; + double Ai,Aj,Ad; + find_ij(Ax,Ay,Az,Ai,Aj,Ad); + int di=3,dj=1; + find_dxdy(s,mode,labelsize(),di,dj); + find_xyz(Ai+di,Aj+dj,Ad,Ax,Ay,Az); + glRasterPos3d(Ax,Ay,Az); + draw_string(s); + } } void glnormal(const vecteur & v){ @@ -772,7 +784,7 @@ int ensemble_attributs=style.front().val; int couleur=ensemble_attributs & 0x0000ff; int width =(ensemble_attributs & 0x00070000) >> 16; // 3 bits - int epaisseur_point =(ensemble_attributs & 0x00380000) >> 19; // 3 bits + int epaisseur_point =((ensemble_attributs & 0x00380000) >> 19)+1; // 3 bits int type_line =(ensemble_attributs & 0x01c00000) >> 22; // 3 bits int type_point =(ensemble_attributs & 0x0e000000) >> 25; // 3 bits int labelpos =(ensemble_attributs & 0x30000000) >> 28; // 2 bits @@ -783,10 +795,12 @@ glLineWidth(width+1); gl2psLineWidth(width); // FIXME line_stipple disabled because of printing - // glLineStipple(1,line_stipple(type_line)); - glLineStipple(1,0xffff); - glPointSize(epaisseur_point+1); - gl2psPointSize(epaisseur_point+1); + if (!printing) + glLineStipple(1,line_stipple(type_line)); + else + glLineStipple(1,0xffff); + glPointSize(epaisseur_point); + gl2psPointSize(epaisseur_point); if (styles<=2){ glEnable(GL_COLOR_MATERIAL); glColorMaterial(GL_FRONT,GL_AMBIENT_AND_DIFFUSE); @@ -1239,21 +1253,99 @@ return; } if (v0.type==_VECT && v0.subtype==_POINT__VECT && v0._VECTptr->size()==3 ){ - switch(type_point){ - // 1 losange, 2 croix verticale, 3 carre. 5 triangle, 6 etoile, 7 point - default: - glBegin(GL_POINTS); - glvertex(*v0._VECTptr); - glEnd(); + gen A(evalf_double(v0,1,contextptr)); + if (A.type==_VECT && A._VECTptr->size()==3 && type_point!=4){ + double xA=A._VECTptr->front()._DOUBLE_val; + double yA=(*A._VECTptr)[1]._DOUBLE_val; + double zA=A._VECTptr->back()._DOUBLE_val; + double iA,jA,depthA; + find_ij(xA,yA,zA,iA,jA,depthA); + glLineWidth(1+epaisseur_point/2); + switch(type_point){ + case 0: + glBegin(GL_LINES); + find_xyz(iA-epaisseur_point,jA-epaisseur_point,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + find_xyz(iA+epaisseur_point,jA+epaisseur_point,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + find_xyz(iA-epaisseur_point,jA+epaisseur_point,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + find_xyz(iA+epaisseur_point,jA-epaisseur_point,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + glEnd(); + break; + case 1: + // 1 losange, + glBegin(GL_LINE_LOOP); + find_xyz(iA-epaisseur_point,jA,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + find_xyz(iA,jA+epaisseur_point,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + find_xyz(iA+epaisseur_point,jA,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + find_xyz(iA,jA-epaisseur_point,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + glEnd(); + break; + case 2: // 2 croix verticale, + glBegin(GL_LINES); + find_xyz(iA,jA-epaisseur_point,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + find_xyz(iA,jA+epaisseur_point,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + find_xyz(iA-epaisseur_point,jA,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + find_xyz(iA+epaisseur_point,jA,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + glEnd(); + break; + case 3: // 3 carre. + glBegin(GL_LINE_LOOP); + find_xyz(iA-epaisseur_point,jA-epaisseur_point,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + find_xyz(iA+epaisseur_point,jA-epaisseur_point,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + find_xyz(iA+epaisseur_point,jA+epaisseur_point,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + find_xyz(iA-epaisseur_point,jA+epaisseur_point,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + glEnd(); + break; + case 5: // 5 triangle, + glBegin(GL_LINE_LOOP); + find_xyz(iA+epaisseur_point,jA-epaisseur_point,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + find_xyz(iA+epaisseur_point,jA+epaisseur_point,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + find_xyz(iA-epaisseur_point,jA,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + glEnd(); + break; + case 6: // 6 etoile, + glBegin(GL_LINES); + find_xyz(iA,jA-epaisseur_point,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + find_xyz(iA,jA+epaisseur_point,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + find_xyz(iA-epaisseur_point/2,jA+epaisseur_point,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + find_xyz(iA+epaisseur_point/2,jA-epaisseur_point,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + find_xyz(iA-epaisseur_point/2,jA-epaisseur_point,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + find_xyz(iA+epaisseur_point/2,jA+epaisseur_point,depthA,xA,yA,zA); + glVertex3d(xA,yA,zA); + glEnd(); + break; + default: // 7 point + glBegin(GL_POINTS); + glvertex(*v0._VECTptr); + glEnd(); + } + glLineWidth(width+1); } - /* - double i,j,k,x,y,z; - find_ij(evalf_double(v0[0])._DOUBLE_val,evalf_double(v0[1])._DOUBLE_val,evalf_double(v0[2])._DOUBLE_val,i,j,k); - find_xyz(i,j,k,x,y,z); - cout << x << " " << y << " " << z << endl; - */ if (!hidden_name && show_names) - legende_draw(v0,legende,0); + legende_draw(v0,legende,labelpos); return; } if (v0.type==_VECT && v0.subtype!=_POINT__VECT){ @@ -1363,6 +1455,39 @@ glvertex(B); } glEnd(); + if (v0.subtype==_VECTOR__VECT){ + double xB=evalf_double(B[0],1,contextptr)._DOUBLE_val; + double yB=evalf_double(B[1],1,contextptr)._DOUBLE_val; + double zB=evalf_double(B[2],1,contextptr)._DOUBLE_val; + double xA=evalf_double(A[0],1,contextptr)._DOUBLE_val; + double yA=evalf_double(A[1],1,contextptr)._DOUBLE_val; + double zA=evalf_double(A[2],1,contextptr)._DOUBLE_val; + /* 2-d code */ + double iA,jA,depthA,iB,jB,depthB,di,dj,dij; + find_ij(xB,yB,zB,iB,jB,depthB); + find_ij(xA,yA,zA,iA,jA,depthA); + di=iA-iB; dj=jA-jB; + dij=std::sqrt(di*di+dj*dj); + if (dij){ + dij /= min(5,int(dij/10))+width; + di/=dij; + dj/=dij; + double dip=-dj,djp=di; + di*=std::sqrt(3.0); + dj*=std::sqrt(3.0); + double iC=iB+di+dip,jC=jB+dj+djp; + double iD=iB+di-dip,jD=jB+dj-djp; + double xC,yC,zC,xD,yD,zD; + find_xyz(iC,jC,depthB,xC,yC,zC); + find_xyz(iD,jD,depthB,xD,yD,zD); + glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); + glBegin(GL_POLYGON); + glVertex3d(xB,yB,zB); + glVertex3d(xC,yC,zC); + glVertex3d(xD,yD,zD); + glEnd(); + } + } if (!hidden_name && show_names && v0.subtype!=_GROUP__VECT) legende_draw(B,legende,labelpos); return; Modified: trunk/giac-xcas/giac/src/History.cc =================================================================== --- trunk/giac-xcas/giac/src/History.cc 2009-07-03 07:44:00 UTC (rev 758) +++ trunk/giac-xcas/giac/src/History.cc 2009-09-02 13:05:24 UTC (rev 759) @@ -214,8 +214,10 @@ } giac::gen warn_equal(const giac::gen & g,GIAC_CONTEXT){ - if (g.is_symb_of_sommet(at_equal) && g._SYMBptr->feuille.type==_VECT && g._SYMBptr->feuille._VECTptr->size()==2 && g._SYMBptr->feuille._VECTptr->front().type!=_INT_) - *logptr(contextptr) << "Warning evaluating = at top level, you must use := to assign " << g._SYMBptr->feuille._VECTptr->back() << " to " << g._SYMBptr->feuille._VECTptr->front() << " or == to test equality" << endl; + if (g.is_symb_of_sommet(at_equal) && g._SYMBptr->feuille.type==_VECT && g._SYMBptr->feuille._VECTptr->size()==2 && g._SYMBptr->feuille._VECTptr->front().type!=_INT_){ + if (g._SYMBptr->feuille._VECTptr->front().is_symb_of_sommet(at_at) || g._SYMBptr->feuille._VECTptr->front().is_symb_of_sommet(at_of) || g._SYMBptr->feuille._VECTptr->front().type!=_SYMB) + *logptr(contextptr) << "Warning evaluating = at top level, you must use := to assign " << g._SYMBptr->feuille._VECTptr->back() << " to " << g._SYMBptr->feuille._VECTptr->front() << " or == to test equality" << endl; + } return g; } @@ -1776,7 +1778,7 @@ t->geo->approx=approx; t->geo->hp->contextptr=pack->contextptr; if (dim3) - t->lt->line_type(_POINT_WIDTH_5 | _POINT_PLUS); + t->lt->line_type(_POINT_WIDTH_5); set_colors(t); return t; } Modified: trunk/giac-xcas/giac/src/Input.cc =================================================================== --- trunk/giac-xcas/giac/src/Input.cc 2009-07-03 07:44:00 UTC (rev 758) +++ trunk/giac-xcas/giac/src/Input.cc 2009-09-02 13:05:24 UTC (rev 759) @@ -132,7 +132,7 @@ return s; } - void update_examples(const string & s,Fl_Browser * examples,Fl_Browser * related,Fl_Output * output,Fl_Input ** argtab,int language){ + void update_examples(const string & s,Fl_Browser * examples,Fl_Browser * related,Fl_Browser * syns,Fl_Output * output,Fl_Input ** argtab,int language){ help_output(s,language); if (output->label()) delete output->label(); @@ -203,6 +203,7 @@ for (;jt!=jtend;++jt) examples->add(jt->c_str()); related->clear(); + syns->clear(); std::vector<giac::indexed_string>::const_iterator kt=cur_aide.related.begin(),ktend=cur_aide.related.end(); for (;kt!=ktend;++kt){ related->add(kt->chaine.c_str()); @@ -210,7 +211,7 @@ std::vector<giac::localized_string>::const_iterator lt=cur_aide.synonymes.begin(),ltend=cur_aide.synonymes.end(); for (;lt!=ltend;++lt){ if (lt->chaine!=s) - related->add(lt->chaine.c_str()); + syns->add(lt->chaine.c_str()); } } } @@ -221,14 +222,15 @@ string s=b->text(k); // find examples browser Fl_Group * g = b->parent(); - Fl_Browser * examples=0, * related=0; + Fl_Browser * examples=0, * related=0,*syns=0; Fl_Output * output=0; Fl_Input * input=0,*argtab[TAB_ARGS]={0,0,0,0,0,0}; if (g){ int n=g->children(); for (int i=0;i<n-1;i++){ if (i>4 && (output=dynamic_cast<Fl_Output *>(g->child(i)))){ - related=dynamic_cast<Fl_Browser *>(g->child(i-3)); + related=dynamic_cast<Fl_Browser *>(g->child(i-4)); + syns=dynamic_cast<Fl_Browser *>(g->child(i-3)); examples=dynamic_cast<Fl_Browser *>(g->child(i+7)); input=dynamic_cast<Fl_Input *>(g->child(i-1)); for (int k=0;k<TAB_ARGS;k++){ @@ -238,8 +240,8 @@ } } } - if (output && input && examples && related){ - update_examples(s,examples,related,output,argtab,giac::language(giac::context0)); + if (output && input && examples && related && syns){ + update_examples(s,examples,related,syns,output,argtab,giac::language(giac::context0)); input->value(b->text(k)); } else @@ -247,12 +249,12 @@ } } - void browser_html_help(Fl_Browser * b,Fl_Browser * examples,Fl_Browser * related,Fl_Output * output,Fl_Input ** argtab,int language){ + void browser_html_help(Fl_Browser * b,Fl_Browser * examples,Fl_Browser * related,Fl_Browser * syns,Fl_Output * output,Fl_Input ** argtab,int language){ int k=b->value(); if (k>=1){ if (Xcas_help_window){ string s=b->text(k); - update_examples(s,examples,related,output,argtab,language); + update_examples(s,examples,related,syns,output,argtab,language); std::map<std::string,std::string>::const_iterator it=giac::lexer_localization_map().find(s),itend=giac::lexer_localization_map().end(); if (it!=itend) s=it->second; @@ -278,6 +280,7 @@ int handle_tab(const string & s,const vector<string> & v,int dx,int dy,int & remove,string & ans){ static Fl_Hold_Browser * browser = 0; static Fl_Hold_Browser * related = 0; + static Fl_Hold_Browser * syns = 0; static Fl_Button * button0 = 0 ; static Fl_Button * button1 =0; static Fl_Button * button2 =0; @@ -307,8 +310,9 @@ string res; remove=0; for (int i=ss-1;i>=0;--i,++remove){ - if (giac::isalphan(s[i])) - res=s[i]+res; + const char & ch =s[i]; + if (giac::isalphan(ch) || ch=='&' || ch=='|' || ch=='=' || ch==':' || ch=='@' || ch=='<' || ch=='>' || ch=='+' || ch=='-' || ch=='/' || ch=='*' || ch=='$' || ch=='%') + res=ch+res; else { if (!res.empty()) break; @@ -332,11 +336,14 @@ browser->label(gettext("Index")); browser->align(FL_ALIGN_TOP); browser->callback((Fl_Callback*)handle_tab_cb_browser); - // order is important: related, examples,input,output - related = new Fl_Hold_Browser(dx/2+2,2*L+4,dx/2-2,dy/2-(2*L+4)); + // order is important: related,syns, examples,input,output + related = new Fl_Hold_Browser(dx/2+2,2*L+4,dx/2-2,dy/4-(L+2)); related->label(gettext("Related")); related->align(FL_ALIGN_TOP); related->tooltip(gettext("Click for help on related command")); + syns = new Fl_Hold_Browser(dx/2+2,related->y()+related->h()+L+2,dx/2-2,dy/4-(2*L+4)); + syns->label(gettext("Synonyms")); + syns->align(FL_ALIGN_TOP); topic_help = new Fl_Button(0,browser->y()+browser->h(),L,L+4); topic_help->label("?"); topic_help->tooltip(gettext("Search this word in HTML help")); @@ -395,7 +402,7 @@ if (vs){ browser->value(i); string bt=browser->text(i); - update_examples(bt,examples,related,output,argtab,giac::language(contextptr)); + update_examples(bt,examples,related,syns,output,argtab,giac::language(contextptr)); handle_tab_w->show(); handle_tab_w->hotspot(handle_tab_w); Fl::focus(input); @@ -406,7 +413,7 @@ if (o == topic_help){ help_fltk(input->value()); } if (o == button0) {r = 0; break;} if (o == button1) {r = 1; break;} - if (o == button2) browser_html_help(browser,examples,related,output,argtab,giac::language(contextptr)); + if (o == button2) browser_html_help(browser,examples,related,syns,output,argtab,giac::language(contextptr)); int j=0; for (;j<TAB_ARGS;j++){ if (o==argtab[j]){ @@ -438,7 +445,7 @@ } if ( o == related && related->value() ) { string s=related->text(related->value()); - update_examples(s,examples,related,output,argtab,giac::language(contextptr)); + update_examples(s,examples,related,syns,output,argtab,giac::language(contextptr)); for (i=0;i<vs;++i){ if (v[i]==s){ browser->value(i+1); @@ -446,11 +453,21 @@ } } } + if ( o == syns && syns->value() ) { + string s=syns->text(syns->value()); + update_examples(s,examples,related,syns,output,argtab,giac::language(contextptr)); + for (i=0;i<vs;++i){ + if (v[i]==s){ + browser->value(i+1); + break; + } + } + } if (o == handle_tab_w) { r=1; break; } if (o == input){ if (Fl::event_key(FL_Enter) || Fl::event_key(FL_KP_Enter)){ Fl::focus(examples); - browser_html_help(browser,examples,related,output,argtab,giac::language(contextptr)); + browser_html_help(browser,examples,related,syns,output,argtab,giac::language(contextptr)); // r=0; // break; } @@ -463,7 +480,7 @@ } if (i<vs){ browser->value(i); - update_examples(browser->text(i),examples,related,output,argtab,giac::language(contextptr)); + update_examples(browser->text(i),examples,related,syns,output,argtab,giac::language(contextptr)); } } } Modified: trunk/giac-xcas/giac/src/Tableur.cc =================================================================== --- trunk/giac-xcas/giac/src/Tableur.cc 2009-07-03 07:44:00 UTC (rev 758) +++ trunk/giac-xcas/giac/src/Tableur.cc 2009-09-02 13:05:24 UTC (rev 759) @@ -117,20 +117,20 @@ void Flv_Table_Gen::config(){ static Fl_Window * w = 0; - static Fl_Input * varname=0; // sheet variable name + static Fl_Input * varname=0,*input_init=0; // sheet variable name static Fl_Check_Button* evaltype=0,*moveright=0,*mat2cell=0,* issheet=0,*horiz=0,*viewgr=0; - static Fl_Value_Input * nrow=0,*ncol=0,*max_hist; + static Fl_Value_Input * nrow=0,*ncol=0,*max_hist=0; static Fl_Return_Button * button0 = 0 ; static Fl_Button * button1 =0; if (!w){ - int nlignes=7; + int nlignes=8; #ifdef IPAQ int dx=240,dy=300; #else - int dx=15*labelsize(), dy=10*labelsize(); + int dx=20*labelsize(), dy=14*labelsize(); #endif w=new Fl_Window(dx,dy); - varname=new Fl_Input(dx/2,2,dx/2-4,dy/6-4,gettext("Variable")); + varname=new Fl_Input(dx/2,2,dx/2-4,dy/nlignes-4,gettext("Variable")); varname->tooltip(gettext("Save the spreadsheet as a matrix in this variable")); nrow = new Fl_Value_Input(dx/4,2+dy/nlignes,dx/4-2,dy/nlignes-4,gettext("Rows")); nrow->minimum(1); @@ -154,10 +154,11 @@ viewgr = new Fl_Check_Button(2+dx/2,2+4*dy/nlignes,dx/4-2,dy/nlignes-4,gettext("Graph")); viewgr->tooltip(gettext("Show or hide graph connected to this sheet")); max_hist = new Fl_Value_Input(3*dx/4,2+5*dy/nlignes,dx/4-2,dy/nlignes-4,gettext("Undo history")); - button0 = new Fl_Return_Button(2,2+6*dy/nlignes,dx/2-4,dy/nlignes-4); + input_init = new Fl_Input(3*dx/4,2+6*dy/nlignes,dx/4-2,dy/nlignes-4,gettext("Init sheet")); + button0 = new Fl_Return_Button(2,2+7*dy/nlignes,dx/2-4,dy/nlignes-4); button0->shortcut(0xff0d); button0->label(gettext("OK")); - button1 = new Fl_Button(dx/2+2,2+6*dy/nlignes,dx/2-4,dy/nlignes-4); + button1 = new Fl_Button(dx/2+2,2+7*dy/nlignes,dx/2-4,dy/nlignes-4); button1->shortcut(0xff1b); button1->label(gettext("Cancel")); w->end(); @@ -175,6 +176,7 @@ mat2cell->value(matrix_fill_cells); moveright->value(move_right); evaltype->value(spreadsheet_recompute); + input_init->value(init.print(contextptr).c_str()); if (gr){ viewgr->value(gr->disposition/2); horiz->value(!(gr->disposition % 2)); @@ -205,6 +207,9 @@ move_right=moveright->value(); spreadsheet_recompute=evaltype->value(); is_spreadsheet=issheet->value(); + init=gen(input_init->value(),contextptr); + if (init.type==_SYMB) + protecteval(init,eval_level(contextptr),contextptr); gen tmp(varname->value(),contextptr); if (tmp.type==_IDNT && !is_undef(tmp)){ name=tmp; @@ -937,7 +942,7 @@ set_matrix(mym,false); changed_=false; graph3d=0; graph2d=0; graph=0; _goto=input=0; - name=0; + name=0; init=0; finish_flv_table_gen(); } @@ -945,7 +950,7 @@ set_matrix(g,false); changed_=false; graph2d=0; graph3d=0; graph=0; _goto=input=0; - name=0; + name=0; init=0; finish_flv_table_gen(); } @@ -1232,6 +1237,15 @@ tg->spread_eval_interrupt(); } + void cb_Tableur_Init(Fl_Widget * m , void*param) { + Flv_Table_Gen * spread_ptr=find_table_brother(m); + const giac::context * contextptr =get_context(spread_ptr); + if (spread_ptr){ + protecteval(spread_ptr->init,eval_level(contextptr),contextptr); + cb_Tableur_Eval_Sheet(m,param); + } + } + void cb_Tableur_Value(Fl_Widget * m , void*) { Flv_Table_Gen * spread_ptr=find_table_brother(m); const giac::context * contextptr =get_context(spread_ptr); @@ -1710,6 +1724,7 @@ static Fl_Value_Input * ymin=0,*ystep=0,*ymax=0; static Fl_Return_Button * button0 = 0 ; static Fl_Button * button1 =0; + static Line_Type * ltres=0; if (!w){ #ifdef IPAQ int dx=240,dy=300; @@ -1719,6 +1734,9 @@ #endif int lignes=5; w=new Fl_Window(dx,dy); + ltres = new Line_Type(2,2,dx/15,dy/lignes-4,_MAGENTA+_FILL_POLYGON); + ltres->show_pnt(true); + ltres->show_poly(true); fcn=new Fl_Input(dx/2,2,dx/2-4,dy/lignes-4,gettext("Expression")); fcn->value("x^2"); fcn->tooltip(gettext("Expression of the function (e.g sin(x))")); @@ -1796,6 +1814,12 @@ Fl_Widget *o = Fl::readqueue(); if (!o) Fl::wait(); else { + if (o==ltres){ + int i=ltres->line_type(); + bool formel=false,untranslate=false,approx=false; + change_line_type(i,true,approx,"",fcn3d->visible(),formel,untranslate,false,spread_ptr?spread_ptr->labelsize():14); + ltres->line_type(i); + } if (o == button0) {r = 0; break;} if (o == button1) {r = 1; break;} if (o == w) { r=1; break; } @@ -1820,13 +1844,13 @@ arg += string(","); if (plot){ if (type==1){ - arg += "["+string(varname->value())+"="+print_DOUBLE_(xmin->value())+".."+print_DOUBLE_(xmax->value()) + string(",")+varnamey->value()+string("=")+print_DOUBLE_(ymin->value())+".."+print_DOUBLE_(ymax->value())+"],xstep="+print_DOUBLE_(xstep->value())+",ystep="+print_DOUBLE_(ystep->value()); + arg += "["+string(varname->value())+"="+print_DOUBLE_(xmin->value())+".."+print_DOUBLE_(xmax->value()) + string(",")+varnamey->value()+string("=")+print_DOUBLE_(ymin->value())+".."+print_DOUBLE_(ymax->value())+"],xstep="+print_DOUBLE_(xstep->value())+",ystep="+print_DOUBLE_(ystep->value())+",display="+print_color(ltres->line_type()); } else - arg += string(varname->value())+"="+print_DOUBLE_(xmin->value())+".."+print_DOUBLE_(xmax->value())+",xstep="+print_DOUBLE_(xstep->value()); + arg += string(varname->value())+"="+print_DOUBLE_(xmin->value())+".."+print_DOUBLE_(xmax->value())+",xstep="+print_DOUBLE_(xstep->value())+",display="+print_color(ltres->line_type()); } else - arg += string(varname->value())+","+print_DOUBLE_(xmin->value())+","+print_DOUBLE_(xstep->value())+","+print_DOUBLE_(xmax->value()); + arg += string(varname->value())+","+print_DOUBLE_(xmin->value())+","+print_DOUBLE_(xstep->value())+","+print_DOUBLE_(xmax->value())+",display="+print_color(ltres->line_type()); return true; } return false; @@ -3342,6 +3366,10 @@ seevalue->callback(cb_Tableur_Value); seevalue->tooltip(gettext("See value instead of formula")); bx += bw; bs -= bw; + Fl_Button * reinit=new Fl_Button(bx,by,bw,H,"init"); + reinit->callback(cb_Tableur_Init); + reinit->tooltip(gettext("Initialize the sheet using init formula")); + bx += bw; bs -= bw; Fl_Button * viewgraph2d=new Fl_Button(bx,by,bw,H,"2-d"); viewgraph2d->callback(cb_Tableur_Graph2d); viewgraph2d->tooltip(gettext("View attached graph 2-d")); Modified: trunk/giac-xcas/giac/src/Tableur.h =================================================================== --- trunk/giac-xcas/giac/src/Tableur.h 2009-07-03 07:44:00 UTC (rev 758) +++ trunk/giac-xcas/giac/src/Tableur.h 2009-09-02 13:05:24 UTC (rev 759) @@ -63,7 +63,7 @@ giac::vecteur m_history; int max_history,cur_history; giac::matrice selected,selected_1; - giac::gen name; // sheet evaluation saves the matrix in name + giac::gen name,init; // sheet evaluation saves the matrix in name bool is_spreadsheet,matrix_fill_cells; bool move_right; bool changed_; Modified: trunk/giac-xcas/giac/src/Xcas1.cc =================================================================== --- trunk/giac-xcas/giac/src/Xcas1.cc 2009-07-03 07:44:00 UTC (rev 758) +++ trunk/giac-xcas/giac/src/Xcas1.cc 2009-09-02 13:05:24 UTC (rev 759) @@ -909,6 +909,14 @@ evaled_g=giac::_simplifier(evaled_g,contextptr); */ if (pretty_output){ int anim=giac::animations(evaled_g); + if (evaled_g.is_symb_of_sommet(at_parameter) && evaled_g._SYMBptr->feuille.type==_VECT){ + Gen_Value_Slider * res = parameter2slider(evaled_g,contextptr); + if (res){ + res->resize(w->x()+3*w->labelsize(),w->y(),w->w()-3*w->labelsize(),w->labelsize()); + res->labelsize(w->labelsize()); + return res; + } + } if (evaled_g.type == _VECT && graph_output_type(evaled_g)){ Fl_Tile * g = new Fl_Tile(w->x(),w->y(),w->w(),max(130,w->w()/3)); g->labelsize(w->labelsize()); @@ -1233,7 +1241,7 @@ makevecteur(gr->window_xmin,gr->window_xmax,gr->window_ymin,gr->window_ymax), gr->npixels, makevecteur(gr->x_tick,gr->y_tick), - gr->show_axes,gr->show_names,dispv,makevecteur(rowv,colv)); + gr->show_axes,gr->show_names,dispv,makevecteur(rowv,colv),g->init); m00=gen(makevecteur(m00[0],m00[1],newm002),m0v[0].subtype); m0v[0]=m00; m[0]=gen(m0v,m0[0].subtype); @@ -1362,7 +1370,7 @@ return res; } if (const Gen_Value_Slider *g=dynamic_cast<const Gen_Value_Slider *>(o)){ - res += "// " + giac::print_INT_(g->pos)+" "+print_DOUBLE_(g->minimum())+" "+print_DOUBLE_(g->maximum())+" "+print_DOUBLE_(g->value())+" "+string(g->label()); + res += "\n" + giac::print_INT_(g->pos)+" "+print_DOUBLE_(g->minimum())+" "+print_DOUBLE_(g->maximum())+" "+print_DOUBLE_(g->value())+" "+string(g->label())+"\n"; return res; } return res + "\n[]\n"; @@ -1643,6 +1651,9 @@ } } } + if (ggs>8 && t){ + t->table->init=ggv[8]; + } } // end g002 of type _VECT g002=2; m00.back()=g002; @@ -2074,12 +2085,13 @@ double m,M,val; int pos; string name; - is >> name ; // this is not the name but //, name is read below + // is >> name ; // this is not the name but //, name is read below is >> pos >> m >> M >> val >> name; - Gen_Value_Slider * res=new Gen_Value_Slider(x,y,w,h,pos,m,M,(M-m)/100.,name,name.c_str()); + Gen_Value_Slider * res=new Gen_Value_Slider(x+3*lsize,y,w-3*lsize,h,pos,m,M,(M-m)/100.,name,name.c_str()); res->value(val); res->label(name.c_str()); res->labelfont(police); + res->labelsize(lsize); return res; } } // end if line begins with // fltk @@ -2330,7 +2342,9 @@ } // Given a vector v describing an input form, return - gen makeform(const vecteur & v,GIAC_CONTEXT) { + gen makeform(const vecteur & v0,GIAC_CONTEXT) { + vecteur v; + aplatir(v0,v); if (v.size()==1 && v.front().is_symb_of_sommet(at_output)){ fl_message(eval(v.front()._SYMBptr->feuille,contextptr).print(contextptr).c_str()); return plus_one; @@ -2356,6 +2370,7 @@ vector < vector<Fl_Menu_Item * > > vpopupitem; */ const_iterateur it=v.begin(),itend=v.end(); + bool focused=false; for (;it!=itend;++it){ if (it->type==_IDNT){ Fl_Input * o; @@ -2366,7 +2381,10 @@ taille=180; o=new Fl_Input(taille,current_y,240-taille,20,l->c_str()); vinput.push_back(o); - Fl::focus(o); + if (!focused){ + focused=true; + Fl::focus(o); + } current_y +=20; continue; } @@ -2380,7 +2398,10 @@ o=new Fl_Input(taille,current_y,240-taille,20,l->c_str()); ++it; vinput.push_back(o); - Fl::focus(o); + if (!focused){ + focused=true; + Fl::focus(o); + } current_y +=20; continue; } @@ -2402,7 +2423,10 @@ if (vg.size()>1&& u!=at_Request) o->value(vg[1].eval(eval_level(contextptr),contextptr).print(contextptr).c_str()); vinput.push_back(o); - Fl::focus(o); + if (!focused){ + focused=true; + Fl::focus(o); + } current_y +=20; continue; } Modified: trunk/giac-xcas/giac/src/gen.cc =================================================================== --- trunk/giac-xcas/giac/src/gen.cc 2009-07-03 07:44:00 UTC (rev 758) +++ trunk/giac-xcas/giac/src/gen.cc 2009-09-02 13:05:24 UTC (rev 759) @@ -1252,13 +1252,20 @@ } gen::gen(const sparse_poly1 & p){ + if (p.empty()){ + type=0; + subtype=0; + val=0; + } + else { #ifdef SMARTPTR64 * ((longlong * ) this) = longlong(new ref_sparse_poly1(p)) << 16; #else - __SPOL1ptr= new ref_sparse_poly1(p); + __SPOL1ptr= new ref_sparse_poly1(p); #endif - subtype=0; - type=_SPOL1; + subtype=0; + type=_SPOL1; + } } gen::gen(const unary_function_ptr & f,int nargs){ @@ -1708,6 +1715,10 @@ gen m_pi(GIAC_CONTEXT){ int nbits=digits2bits(decimal_digits(contextptr)); + return m_pi(nbits); + } + + gen m_pi(int nbits){ #ifdef HAVE_LIBMPFR if (nbits>52){ #ifdef HAVE_LIBPTHREAD @@ -1732,8 +1743,7 @@ return M_PI; } - gen m_gamma(GIAC_CONTEXT){ - int nbits=digits2bits(decimal_digits(contextptr)); + gen m_gamma(int nbits){ #ifdef HAVE_LIBMPFR if (nbits>15){ #ifdef HAVE_LIBPTHREAD @@ -1758,6 +1768,11 @@ return .577215664901533; } + gen m_gamma(GIAC_CONTEXT){ + int nbits=digits2bits(decimal_digits(contextptr)); + return m_gamma(nbits); + } + bool gen::in_evalf(int level,gen & evaled,const context * contextptr) const{ if (!level) return false; @@ -2505,6 +2520,20 @@ i=gen(I,subtype); } + void reim_spol(const sparse_poly1 & p,gen & r,gen & i,GIAC_CONTEXT){ + sparse_poly1 R,I; + sparse_poly1::const_iterator it=p.begin(),itend=p.end(); + for (;it!=itend;++it){ + reim(it->coeff,r,i,contextptr); + if (!is_zero(r)) + R.push_back(monome(r,it->exponent)); + if (!is_zero(i)) + I.push_back(monome(i,it->exponent)); + } + r=R; + i=I; + } + gen frac_reim(const gen & n,const gen & d,bool findre,GIAC_CONTEXT){ gen dbar(conj(d,contextptr)),tmp(n*dbar); tmp=findre?re(tmp,contextptr):im(tmp,contextptr); @@ -2571,6 +2600,9 @@ case _POLY: reim_poly(*g._POLYptr,r,i,contextptr); break; + case _SPOL1: + reim_spol(*g._SPOL1ptr,r,i,contextptr); + break; default: settypeerr("reim"); } @@ -6426,6 +6458,18 @@ case _CPLX__INT_: case _CPLX__ZINT: if ( (a._CPLXptr->type==_DOUBLE_) || ((a._CPLXptr+1)->type==_DOUBLE_)) return rdiv(no_context_evalf(a),no_context_evalf(b)); + if (a._CPLXptr->type==_REAL) +#ifdef HAVE_LIBMPFR + return rdiv(*a._CPLXptr,b)+cst_i*rdiv(real_object(*(a._CPLXptr+1),mpfr_get_prec(a._CPLXptr->_REALptr->inf)),b); +#else + return rdiv(*a._CPLXptr,b)+cst_i*rdiv(real_object(*(a._CPLXptr+1)),b); +#endif + if ((a._CPLXptr+1)->type==_REAL) +#ifdef HAVE_LIBMPFR + return rdiv(real_object(*a._CPLXptr,mpfr_get_prec((a._CPLXptr+1)->_REALptr->inf)),b)+cst_i*rdiv(*(a._CPLXptr+1),b); +#else + return rdiv(real_object(*a._CPLXptr),b)+cst_i*rdiv(*(a._CPLXptr+1),b); +#endif if (is_exactly_zero(b)) return unsigned_inf; if (is_exactly_zero(a%b)) @@ -6674,7 +6718,7 @@ case _ZINT__ZINT: case _INT___ZINT: case _ZINT__INT_: _ZINTrem(a,b,q,rem); return(rem); - case _INT___CPLX: case _ZINT__CPLX: case _CPLX__CPLX: + case _INT___CPLX: case _ZINT__CPLX: case _CPLX__CPLX: case _CPLX__INT_: case _CPLX__ZINT: q=iquo(a,b); return(a-b*q); default: Modified: trunk/giac-xcas/giac/src/gen.h =================================================================== --- trunk/giac-xcas/giac/src/gen.h 2009-07-03 07:44:00 UTC (rev 758) +++ trunk/giac-xcas/giac/src/gen.h 2009-09-02 13:05:24 UTC (rev 759) @@ -557,6 +557,8 @@ gen ext_reduce(const gen & a, const gen & v); gen maptoarray(const gen_map & m,GIAC_CONTEXT); gen evalf_VECT(const vecteur & v,int subtype,int level,const context * contextptr); + gen m_gamma(int nbits); // Euler gamma constant precision nbits + gen m_pi(int nbits); // pi precision nbits // a*b -> tmp, modifies tmp in place void type_operator_times(const gen & a,const gen &b,gen & tmp); Modified: trunk/giac-xcas/giac/src/global.cc =================================================================== --- trunk/giac-xcas/giac/src/global.cc 2009-07-03 07:44:00 UTC (rev 758) +++ trunk/giac-xcas/giac/src/global.cc 2009-09-02 13:05:24 UTC (rev 759) @@ -2434,13 +2434,7 @@ return ptr; } - context * clone_context(const context * contextptr) { - context * ptr = new context; - if (contextptr){ - *ptr->globalptr = *contextptr->globalptr; - *ptr->tabptr = *contextptr->tabptr; - } - else { + void init_context(context * ptr){ ptr->globalptr->_xcas_mode_=_xcas_mode_; ptr->globalptr->_decimal_digits_=_decimal_digits_; ptr->globalptr->_scientific_format_=_scientific_format_; @@ -2477,7 +2471,17 @@ ptr->globalptr->_language_=_language_; ptr->globalptr->_max_sum_sqrt_=_max_sum_sqrt_; ptr->globalptr->_max_sum_add_=_max_sum_add_; + } + + context * clone_context(const context * contextptr) { + context * ptr = new context; + if (contextptr){ + *ptr->globalptr = *contextptr->globalptr; + *ptr->tabptr = *contextptr->tabptr; } + else { + init_context(ptr); + } return ptr; } Modified: trunk/giac-xcas/giac/src/global.h =================================================================== --- trunk/giac-xcas/giac/src/global.h 2009-07-03 07:44:00 UTC (rev 758) +++ trunk/giac-xcas/giac/src/global.h 2009-09-02 13:05:24 UTC (rev 759) @@ -374,6 +374,7 @@ }; context * clone_context(const context *); + void init_context(context * ptr); extern const context * context0; extern std::vector<context *> context_list; Modified: trunk/giac-xcas/giac/src/help.cc =================================================================== --- trunk/giac-xcas/giac/src/help.cc 2009-07-03 07:44:00 UTC (rev 758) +++ trunk/giac-xcas/giac/src/help.cc 2009-09-02 13:05:24 UTC (rev 759) @@ -476,8 +476,8 @@ } } - string subdir_strings[]={"cascmd","casgeo","casrouge","cassim","castor","tutoriel","casinter"}; - int subdir_taille=7; + string subdir_strings[]={"cascmd","casgeo","casrouge","cassim","castor","tutoriel","casinter","casexo","cascas"}; + int subdir_taille=9; int equalposcomp(string * tab,const string & s){ int i=s.size()-1; for (;i>=0;--i){ Modified: trunk/giac-xcas/giac/src/hist.cxx =================================================================== --- trunk/giac-xcas/giac/src/hist.cxx 2009-07-03 07:44:00 UTC (rev 758) +++ trunk/giac-xcas/giac/src/hist.cxx 2009-09-02 13:05:24 UTC (rev 759) @@ -1021,6 +1021,24 @@ Fl::copy(s.c_str(),ss,1); } +static void cb_Xcas_Add_Entry1(Fl_Menu_*, void*) { + xcas::cb_New_Input(Xcas_current_session(),0); +} + +static void cb_Xcas_Add_Parameter(Fl_Menu_*, void*) { + std::string tmp,name; +double tmin,tmax,tcur,tstep; +Fl_Widget * wid = Fl::focus(); +int pos; +xcas::History_Pack * hp=xcas::get_history_pack(wid,pos)... [truncated message content] |
From: <pa...@us...> - 2009-07-03 07:44:20
|
Revision: 758 http://xcas.svn.sourceforge.net/xcas/?rev=758&view=rev Author: parisse Date: 2009-07-03 07:44:00 +0000 (Fri, 03 Jul 2009) Log Message: ----------- Modified Paths: -------------- trunk/giac-xcas/giac/src/Makefile.am trunk/giac-xcas/giac/src/Xcas1.cc trunk/giac-xcas/giac/src/gen.cc trunk/giac-xcas/giac/src/help.cc trunk/giac-xcas/giac/src/hist.cxx trunk/giac-xcas/giac/src/hist.fl Modified: trunk/giac-xcas/giac/src/Makefile.am =================================================================== --- trunk/giac-xcas/giac/src/Makefile.am 2009-06-30 08:48:33 UTC (rev 757) +++ trunk/giac-xcas/giac/src/Makefile.am 2009-07-03 07:44:00 UTC (rev 758) @@ -64,7 +64,7 @@ xcasfr.sh xcases.sh xcasen.sh mkstat mkhist updatecas update.bat \ giac.pl cas2html.cc all_global_var find_global_var.cc static_init \ Fl_GDI_Printer.cxx Fl_PS_Printer.cxx \ - casce.cc xcasce.cc xcasctrl.cc casctrl.cc Makefile.vcc config.h.vcc + casce.cc xcasce.cc xcasctrl.cc casctrl.cc Makefile.vcc config.h.vcc giac_oo.cpp giaclib.vcproj bin_SCRIPTS = xgiac pgiac updatecas Modified: trunk/giac-xcas/giac/src/Xcas1.cc =================================================================== --- trunk/giac-xcas/giac/src/Xcas1.cc 2009-06-30 08:48:33 UTC (rev 757) +++ trunk/giac-xcas/giac/src/Xcas1.cc 2009-07-03 07:44:00 UTC (rev 758) @@ -2606,7 +2606,7 @@ } // FIXME: forms should work under win32!! -#ifdef WIN32 +#if defined WIN32 || defined __APPLE__ giac::gen Xcas_fltk_input(const giac::gen & arg,const giac::context * contextptr){ Fl::lock(); if (Xcas_DispG) Xcas_DispG->waiting_click_value=arg; Modified: trunk/giac-xcas/giac/src/gen.cc =================================================================== --- trunk/giac-xcas/giac/src/gen.cc 2009-06-30 08:48:33 UTC (rev 757) +++ trunk/giac-xcas/giac/src/gen.cc 2009-07-03 07:44:00 UTC (rev 758) @@ -3106,7 +3106,7 @@ if ((i._SYMBptr->feuille._VECTptr->front().type==_INT_) && (i._SYMBptr->feuille._VECTptr->back().type==_INT_) ){ int debut=i._SYMBptr->feuille._VECTptr->front().val,fin=i._SYMBptr->feuille._VECTptr->back().val; if (fin<debut) - return gen(vecteur(0),subtype); // swap(debut,fin); + return (type==_STRNG)?string2gen("",false):gen(vecteur(0),subtype); // swap(debut,fin); if (type==_STRNG) return string2gen('"'+_STRNGptr->substr(debut,fin-debut+1)+'"'); if (type==_VECT){ Modified: trunk/giac-xcas/giac/src/help.cc =================================================================== --- trunk/giac-xcas/giac/src/help.cc 2009-06-30 08:48:33 UTC (rev 757) +++ trunk/giac-xcas/giac/src/help.cc 2009-07-03 07:44:00 UTC (rev 758) @@ -476,7 +476,7 @@ } } - string subdir_strings[]={"casref","casgeo","casrouge","cassim","castor","tutoriel","casinter"}; + string subdir_strings[]={"cascmd","casgeo","casrouge","cassim","castor","tutoriel","casinter"}; int subdir_taille=7; int equalposcomp(string * tab,const string & s){ int i=s.size()-1; @@ -729,7 +729,7 @@ cerr << "Unable to open HTML doc directory " << html_help_dir << endl; html_help_dir += find_lang_prefix(language); #ifdef WIN32 - html_help_dir +="casref_"+find_lang_prefix(giac::language(context0)); // temporary workaround + html_help_dir +="cascmd_"+find_lang_prefix(giac::language(context0)); // temporary workaround #endif html_mtt.clear(); html_mall.clear(); Modified: trunk/giac-xcas/giac/src/hist.cxx =================================================================== --- trunk/giac-xcas/giac/src/hist.cxx 2009-06-30 08:48:33 UTC (rev 757) +++ trunk/giac-xcas/giac/src/hist.cxx 2009-07-03 07:44:00 UTC (rev 758) @@ -119,6 +119,7 @@ s += "This documentation is freely redistribuable for non commercial purpose\n"; s += "Math ML support, xcas online: Jean-Pierre Branchard\n"; s += "Java interface: Loic Le Coq\n"; + s += "OpenOffice interface: Christophe Devalland, Serge Moutou\n"; s += "Tutorial (dxcas) with B. Ycart\n"; s += "Spanish localization, J. Manrique Lopez\n"; s += "Debian package: Carlos Enrique Carleos Artime\n"; @@ -718,7 +719,8 @@ configfile.close(); if (giac::language(giac::context0)==1) xcas::system_browser(giac::browser_command(doc_prefix+"tutoriel/index.html").c_str()); - xcas::system_browser(giac::browser_command(doc_prefix+"casinter/index.html").c_str()); + else + xcas::system_browser(giac::browser_command(doc_prefix+"casinter/index.html").c_str()); // fl_alert(("Configuration written to "+configname + "\nUse the Cfg menu to modify.\nLaunching tutorial.").c_str()); // n=fl_ask(gettext("Launch tutorial?")); // if (n==1) @@ -1290,10 +1292,10 @@ static void cb_Xcas_help_CAS(Fl_Menu_*, void*) { const giac::context * contextptr=Xcas_get_context(); if (xcas::use_external_browser) - xcas::system_browser(giac::browser_command(doc_prefix+"casref_"+giac::find_lang_prefix(giac::language(contextptr))+"index.html").c_str()); + xcas::system_browser(giac::browser_command(doc_prefix+"cascmd_"+giac::find_lang_prefix(giac::language(contextptr))+"index.html").c_str()); else { if (xcas::Xcas_help_window){ - xcas::Xcas_help_window->load((giac::giac_aide_dir()+doc_prefix+"casref_"+giac::find_lang_prefix(giac::language(contextptr))+"index.html").c_str()); + xcas::Xcas_help_window->load((giac::giac_aide_dir()+doc_prefix+"cascmd_"+giac::find_lang_prefix(giac::language(contextptr))+"index.html").c_str()); xcas::Xcas_help_window->show(); } }; Modified: trunk/giac-xcas/giac/src/hist.fl =================================================================== --- trunk/giac-xcas/giac/src/hist.fl 2009-06-30 08:48:33 UTC (rev 757) +++ trunk/giac-xcas/giac/src/hist.fl 2009-07-03 07:44:00 UTC (rev 758) @@ -188,6 +188,7 @@ s += "This documentation is freely redistribuable for non commercial purpose\\n"; s += "Math ML support, xcas online: Jean-Pierre Branchard\\n"; s += "Java interface: Loic Le Coq\\n"; + s += "OpenOffice interface: Christophe Devalland, Serge Moutou\\n"; s += "Tutorial (dxcas) with B. Ycart\\n"; s += "Spanish localization, J. Manrique Lopez\\n"; s += "Debian package: Carlos Enrique Carleos Artime\\n"; @@ -796,7 +797,8 @@ configfile.close(); if (giac::language(giac::context0)==1) xcas::system_browser(giac::browser_command(doc_prefix+"tutoriel/index.html").c_str()); - xcas::system_browser(giac::browser_command(doc_prefix+"casinter/index.html").c_str()); + else + xcas::system_browser(giac::browser_command(doc_prefix+"casinter/index.html").c_str()); // fl_alert(("Configuration written to "+configname + "\\nUse the Cfg menu to modify.\\nLaunching tutorial.").c_str()); // n=fl_ask(gettext("Launch tutorial?")); // if (n==1) @@ -1529,10 +1531,10 @@ label {CAS reference} callback {const giac::context * contextptr=Xcas_get_context(); if (xcas::use_external_browser) - xcas::system_browser(giac::browser_command(doc_prefix+"casref_"+giac::find_lang_prefix(giac::language(contextptr))+"index.html").c_str()); + xcas::system_browser(giac::browser_command(doc_prefix+"cascmd_"+giac::find_lang_prefix(giac::language(contextptr))+"index.html").c_str()); else { if (xcas::Xcas_help_window){ - xcas::Xcas_help_window->load((giac::giac_aide_dir()+doc_prefix+"casref_"+giac::find_lang_prefix(giac::language(contextptr))+"index.html").c_str()); + xcas::Xcas_help_window->load((giac::giac_aide_dir()+doc_prefix+"cascmd_"+giac::find_lang_prefix(giac::language(contextptr))+"index.html").c_str()); xcas::Xcas_help_window->show(); } }} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |