]> www.ginac.de Git - ginac.git/commitdiff
- expressions can now be read from streams; the input expression can contain
authorChristian Bauer <Christian.Bauer@uni-mainz.de>
Wed, 29 Mar 2000 20:20:12 +0000 (20:20 +0000)
committerChristian Bauer <Christian.Bauer@uni-mainz.de>
Wed, 29 Mar 2000 20:20:12 +0000 (20:20 +0000)
  a list of predefined symbols to be used, before reading (and overwriting)
  the expression, e.g:
    symbol x("x"), y("y");
    e = lst(x, y);
    cout << "Enter an expression containing 'x' and 'y': ";
    try {
        cin >> e;
    } catch (exception &e) {
        cerr << e.what() << endl;
    }
    cout << "You entered " << e << endl;
    cout << "de/dx = " << e.diff(x) << endl;
    cout << "de/dy = " << e.diff(y) << endl;

22 files changed:
Makefile.in
aclocal.m4
check/Makefile.in
cint/Makefile.in
configure
doc/Makefile.in
doc/reference/Makefile.in
doc/tutorial/Makefile.in
ginac/Makefile.am
ginac/Makefile.in
ginac/function.pl
ginac/input_lexer.h [new file with mode: 0644]
ginac/input_lexer.ll [new file with mode: 0644]
ginac/input_parser.yy [new file with mode: 0644]
ginac/matrix.cpp
ginac/matrix.h
ginac/operators.cpp
ginac/version.h [new file with mode: 0644]
ginsh/Makefile.in
ginsh/ginsh_lexer.ll
ginsh/ginsh_parser.yy
tools/Makefile.in

index fd63e6e66b41be8a9e6f5cd9819a7fbd7553d349..c65826461046cea7b5f6b551444f2259ee4e70bd 100644 (file)
@@ -82,6 +82,7 @@ GINACLIB_MINOR_VERSION = @GINACLIB_MINOR_VERSION@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
+LD = @LD@
 LEX = @LEX@
 LIBGINACCINT = @LIBGINACCINT@
 LIBTERMCAP = @LIBTERMCAP@
@@ -95,6 +96,7 @@ MAINT = @MAINT@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
+NM = @NM@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
index 099e24f86e965ddc661d1f239538ed8f722be7c0..dd8a1c229dda2f064eaa2a275f987d75efea43ce 100644 (file)
@@ -297,7 +297,7 @@ LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
-$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
 || AC_MSG_ERROR([libtool configure failed])
 
 # Reload cache, that may have been modified by ltconfig
@@ -329,11 +329,6 @@ AC_REQUIRE([AC_PROG_NM])dnl
 AC_REQUIRE([AC_PROG_LN_S])dnl
 dnl
 
-case "$target" in
-NONE) lt_target="$host" ;;
-*) lt_target="$target" ;;
-esac
-
 # Check for any special flags to pass to ltconfig.
 libtool_flags="--cache-file=$cache_file"
 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
@@ -352,7 +347,7 @@ test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
 
 # Some flags need to be propagated to the compiler or linker for good
 # libtool support.
-case "$lt_target" in
+case "$host" in
 *-*-irix6*)
   # Find out which ABI we are using.
   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
@@ -568,6 +563,7 @@ else
   AC_MSG_RESULT(no)
 fi
 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_SUBST(LD)
 AC_PROG_LD_GNU
 ])
 
@@ -613,13 +609,14 @@ else
 fi])
 NM="$ac_cv_path_NM"
 AC_MSG_RESULT([$NM])
+AC_SUBST(NM)
 ])
 
 # AC_CHECK_LIBM - check for math library
 AC_DEFUN(AC_CHECK_LIBM,
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 LIBM=
-case "$lt_target" in
+case "$host" in
 *-*-beos* | *-*-cygwin*)
   # These system don't have libm
   ;;
index ab8c531a6ad6e1b493f9e8b37fd86bc958438650..b577c2fd2e68af623b48cb78a3375edae64dd2ed 100644 (file)
@@ -82,6 +82,7 @@ GINACLIB_MINOR_VERSION = @GINACLIB_MINOR_VERSION@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
+LD = @LD@
 LEX = @LEX@
 LIBGINACCINT = @LIBGINACCINT@
 LIBTERMCAP = @LIBTERMCAP@
@@ -95,6 +96,7 @@ MAINT = @MAINT@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
+NM = @NM@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
@@ -285,7 +287,7 @@ distdir: $(DISTFILES)
        @for file in $(DISTFILES); do \
          d=$(srcdir); \
          if test -d $$d/$$file; then \
-           cp -pr $$d/$$file $(distdir)/$$file; \
+           cp -pr $$/$$file $(distdir)/$$file; \
          else \
            test -f $(distdir)/$$file \
            || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
index 859afebbd6eb178863fd7edca1605afb643dc91d..3e762ac45e9cf2bdbf1955b3e2273b0a1e056449 100644 (file)
@@ -82,6 +82,7 @@ GINACLIB_MINOR_VERSION = @GINACLIB_MINOR_VERSION@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
+LD = @LD@
 LEX = @LEX@
 LIBGINACCINT = @LIBGINACCINT@
 LIBTERMCAP = @LIBTERMCAP@
@@ -95,6 +96,7 @@ MAINT = @MAINT@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
+NM = @NM@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
index ecd447e902fabc0edf195a1cdfb2604a329758c7..7d002ff2620e27940c8bdc0e689fba163b4465d4 100755 (executable)
--- a/configure
+++ b/configure
@@ -1550,8 +1550,9 @@ else
   echo "$ac_t""no" 1>&6
 fi
 test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
+
 echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
-echo "configure:1555: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:1556: checking if the linker ($LD) is GNU ld" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1567,7 +1568,7 @@ echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6
 
 
 echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1571: checking for BSD-compatible nm" >&5
+echo "configure:1572: checking for BSD-compatible nm" >&5
 if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1602,8 +1603,9 @@ fi
 NM="$ac_cv_path_NM"
 echo "$ac_t""$NM" 1>&6
 
+
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1607: checking whether ln -s works" >&5
+echo "configure:1609: checking whether ln -s works" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1624,11 +1626,6 @@ else
 fi
 
 
-case "$target" in
-NONE) lt_target="$host" ;;
-*) lt_target="$target" ;;
-esac
-
 # Check for any special flags to pass to ltconfig.
 libtool_flags="--cache-file=$cache_file"
 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
@@ -1649,11 +1646,11 @@ test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
 
 # Some flags need to be propagated to the compiler or linker for good
 # libtool support.
-case "$lt_target" in
+case "$host" in
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 1656 "configure"' > conftest.$ac_ext
-  if { (eval echo configure:1657: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  echo '#line 1653 "configure"' > conftest.$ac_ext
+  if { (eval echo configure:1654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     case "`/usr/bin/file conftest.o`" in
     *32-bit*)
       LD="${LD-ld} -32"
@@ -1674,19 +1671,19 @@ case "$lt_target" in
   SAVE_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -belf"
   echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:1678: checking whether the C compiler needs -belf" >&5
+echo "configure:1675: checking whether the C compiler needs -belf" >&5
 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1683 "configure"
+#line 1680 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:1690: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1687: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   lt_cv_cc_needs_belf=yes
 else
@@ -1764,7 +1761,7 @@ LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
-$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
 || { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
 
 # Reload cache, that may have been modified by ltconfig
@@ -1788,7 +1785,7 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool'
 exec 5>>./config.log
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1792: checking how to run the C preprocessor" >&5
+echo "configure:1789: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -1803,13 +1800,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1807 "configure"
+#line 1804 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1813: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1810: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1820,13 +1817,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1824 "configure"
+#line 1821 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1830: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1827: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1837,13 +1834,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 1841 "configure"
+#line 1838 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1847: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1844: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1873,7 +1870,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1877: checking for $ac_word" >&5
+echo "configure:1874: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1906,7 +1903,7 @@ test -n "$LEX" || LEX=""$missing_dir/missing flex""
 # Extract the first word of "flex", so it can be a program name with args.
 set dummy flex; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1910: checking for $ac_word" >&5
+echo "configure:1907: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1940,7 +1937,7 @@ then
   *) ac_lib=l ;;
   esac
   echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6
-echo "configure:1944: checking for yywrap in -l$ac_lib" >&5
+echo "configure:1941: checking for yywrap in -l$ac_lib" >&5
 ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1948,7 +1945,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-l$ac_lib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1952 "configure"
+#line 1949 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1959,7 +1956,7 @@ int main() {
 yywrap()
 ; return 0; }
 EOF
-if { (eval echo configure:1963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1960: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1982,7 +1979,7 @@ fi
 fi
 
 echo $ac_n "checking lex output file root""... $ac_c" 1>&6
-echo "configure:1986: checking lex output file root" >&5
+echo "configure:1983: checking lex output file root" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2003,7 +2000,7 @@ echo "$ac_t""$ac_cv_prog_lex_root" 1>&6
 LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
 
 echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6
-echo "configure:2007: checking whether yytext is a pointer" >&5
+echo "configure:2004: checking whether yytext is a pointer" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2015,14 +2012,14 @@ echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c
 ac_save_LIBS="$LIBS"
 LIBS="$LIBS $LEXLIB"
 cat > conftest.$ac_ext <<EOF
-#line 2019 "configure"
+#line 2016 "configure"
 #include "confdefs.h"
 `cat $LEX_OUTPUT_ROOT.c`
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2026: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_prog_lex_yytext_pointer=yes
 else
@@ -2048,7 +2045,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2052: checking for $ac_word" >&5
+echo "configure:2049: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2105,7 +2102,7 @@ fi
 
 
 echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:2109: checking size of long" >&5
+echo "configure:2106: checking size of long" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2113,7 +2110,7 @@ else
   ac_cv_sizeof_long=4
 else
   cat > conftest.$ac_ext <<EOF
-#line 2117 "configure"
+#line 2114 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -2124,7 +2121,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:2128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2125: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_long=`cat conftestval`
 else
@@ -2144,7 +2141,7 @@ EOF
 
 
 echo $ac_n "checking size of long long""... $ac_c" 1>&6
-echo "configure:2148: checking size of long long" >&5
+echo "configure:2145: checking size of long long" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2152,7 +2149,7 @@ else
   ac_cv_sizeof_long_long=8
 else
   cat > conftest.$ac_ext <<EOF
-#line 2156 "configure"
+#line 2153 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -2163,7 +2160,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:2167: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2164: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_long_long=`cat conftestval`
 else
@@ -2183,7 +2180,7 @@ EOF
 
 
 echo $ac_n "checking size of long double""... $ac_c" 1>&6
-echo "configure:2187: checking size of long double" >&5
+echo "configure:2184: checking size of long double" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_long_double'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2191,7 +2188,7 @@ else
   ac_cv_sizeof_long_double=12
 else
   cat > conftest.$ac_ext <<EOF
-#line 2195 "configure"
+#line 2192 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -2202,7 +2199,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:2206: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_long_double=`cat conftestval`
 else
@@ -2234,17 +2231,17 @@ for ac_hdr in unistd.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2238: checking for $ac_hdr" >&5
+echo "configure:2235: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2243 "configure"
+#line 2240 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2248: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2245: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2274,17 +2271,17 @@ for ac_hdr in readline/readline.h readline/history.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2278: checking for $ac_hdr" >&5
+echo "configure:2275: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2283 "configure"
+#line 2280 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2288: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2285: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2321,12 +2318,12 @@ LIBTERMCAP=
 for ac_func in tgetent
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2325: checking for $ac_func" >&5
+echo "configure:2322: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2330 "configure"
+#line 2327 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2352,7 +2349,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2353: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2380,7 +2377,7 @@ if test "x$ac_cv_func_tgetent" = "xyes"; then
     :
 else
     echo $ac_n "checking for tgetent in -lncurses""... $ac_c" 1>&6
-echo "configure:2384: checking for tgetent in -lncurses" >&5
+echo "configure:2381: checking for tgetent in -lncurses" >&5
 ac_lib_var=`echo ncurses'_'tgetent | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2388,7 +2385,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lncurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2392 "configure"
+#line 2389 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
@@ -2402,7 +2399,7 @@ int main() {
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:2406: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2403: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2424,7 +2421,7 @@ fi
 
     if test -z "$LIBTERMCAP"; then
         echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6
-echo "configure:2428: checking for tgetent in -ltermcap" >&5
+echo "configure:2425: checking for tgetent in -ltermcap" >&5
 ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2432,7 +2429,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2436 "configure"
+#line 2433 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
@@ -2446,7 +2443,7 @@ int main() {
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:2450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2447: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2473,7 +2470,7 @@ fi
 save_LIBS=$LIBS
 LIBS="$LIBTERMCAP $LIBS"
 echo $ac_n "checking for readline in -lreadline""... $ac_c" 1>&6
-echo "configure:2477: checking for readline in -lreadline" >&5
+echo "configure:2474: checking for readline in -lreadline" >&5
 ac_lib_var=`echo readline'_'readline | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2481,7 +2478,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lreadline  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2485 "configure"
+#line 2482 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
@@ -2495,7 +2492,7 @@ int main() {
 readline()
 ; return 0; }
 EOF
-if { (eval echo configure:2499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2496: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2534,7 +2531,7 @@ LIBS=$save_LIBS
 
 
 echo $ac_n "checking for cout in -lstdc++""... $ac_c" 1>&6
-echo "configure:2538: checking for cout in -lstdc++" >&5
+echo "configure:2535: checking for cout in -lstdc++" >&5
 ac_lib_var=`echo stdc++'_'cout | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2542,7 +2539,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lstdc++  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2546 "configure"
+#line 2543 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
@@ -2556,7 +2553,7 @@ int main() {
 cout()
 ; return 0; }
 EOF
-if { (eval echo configure:2560: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2557: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2588,17 +2585,17 @@ for ac_hdr in iostream vector map string list typeinfo iterator stdexcept algori
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2592: checking for $ac_hdr" >&5
+echo "configure:2589: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2597 "configure"
+#line 2594 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2602: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2599: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2629,17 +2626,17 @@ for ac_hdr in sstream strstream
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2633: checking for $ac_hdr" >&5
+echo "configure:2630: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2638 "configure"
+#line 2635 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2643: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2640: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2671,17 +2668,17 @@ done
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2675: checking for $ac_hdr" >&5
+echo "configure:2672: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2680 "configure"
+#line 2677 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2685: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2682: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2708,17 +2705,17 @@ for ac_hdr in cln.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2712: checking for $ac_hdr" >&5
+echo "configure:2709: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2717 "configure"
+#line 2714 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2722: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2719: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2753,7 +2750,7 @@ done
 
 
     echo $ac_n "checking for doublefactorial in -lcln""... $ac_c" 1>&6
-echo "configure:2757: checking for doublefactorial in -lcln" >&5
+echo "configure:2754: checking for doublefactorial in -lcln" >&5
     saved_LIBS="${LIBS}"
     if eval "test \"`echo '$''{'ginac_cv_lib_cln_link'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2762,14 +2759,14 @@ else
         case "${ac_cv_header_cln_cln_h}" in
         "yes")
             cat > conftest.$ac_ext <<EOF
-#line 2766 "configure"
+#line 2763 "configure"
 #include "confdefs.h"
 #include <cln/cl_integer.h>
 int main() {
 doublefactorial(2);
 ; return 0; }
 EOF
-if { (eval echo configure:2773: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ginac_cv_lib_cln_link="-lcln"
 else
@@ -2782,14 +2779,14 @@ rm -f conftest*
             ;;
         *)
             cat > conftest.$ac_ext <<EOF
-#line 2786 "configure"
+#line 2783 "configure"
 #include "confdefs.h"
 #include <cl_integer.h>
 int main() {
 doublefactorial(2);
 ; return 0; }
 EOF
-if { (eval echo configure:2793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2790: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ginac_cv_lib_cln_link="-lcln"
 else
@@ -2830,7 +2827,7 @@ GINACLIB_LIBS=$LIBS
 # Extract the first word of "doxygen", so it can be a program name with args.
 set dummy doxygen; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2834: checking for $ac_word" >&5
+echo "configure:2831: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_DOXYGEN'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2866,7 +2863,7 @@ fi
 # Extract the first word of "latex", so it can be a program name with args.
 set dummy latex; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2870: checking for $ac_word" >&5
+echo "configure:2867: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_LATEX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2902,7 +2899,7 @@ fi
 # Extract the first word of "makeindex", so it can be a program name with args.
 set dummy makeindex; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2906: checking for $ac_word" >&5
+echo "configure:2903: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_MAKEINDEX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2938,7 +2935,7 @@ fi
 # Extract the first word of "dvips", so it can be a program name with args.
 set dummy dvips; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2942: checking for $ac_word" >&5
+echo "configure:2939: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_DVIPS'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2974,7 +2971,7 @@ fi
 # Extract the first word of "fig2dev", so it can be a program name with args.
 set dummy fig2dev; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2978: checking for $ac_word" >&5
+echo "configure:2975: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_FIG2DEV'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3042,7 +3039,7 @@ if test "x$with_cint" != "xno"; then
   # Extract the first word of "cint", so it can be a program name with args.
 set dummy cint; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3046: checking for $ac_word" >&5
+echo "configure:3043: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_CINT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3078,7 +3075,7 @@ fi
   # Extract the first word of "makecint", so it can be a program name with args.
 set dummy makecint; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3082: checking for $ac_word" >&5
+echo "configure:3079: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_MAKECINT'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3317,6 +3314,8 @@ s%@build_vendor@%$build_vendor%g
 s%@build_os@%$build_os%g
 s%@RANLIB@%$RANLIB%g
 s%@CC@%$CC%g
+s%@LD@%$LD%g
+s%@NM@%$NM%g
 s%@LN_S@%$LN_S%g
 s%@LIBTOOL@%$LIBTOOL%g
 s%@LEX@%$LEX%g
index 90b3a168ba1d7272c6228b7dd19a630fd6fefd42..86782bd739345b17199b0adac12faf3a7ed84b21 100644 (file)
@@ -82,6 +82,7 @@ GINACLIB_MINOR_VERSION = @GINACLIB_MINOR_VERSION@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
+LD = @LD@
 LEX = @LEX@
 LIBGINACCINT = @LIBGINACCINT@
 LIBTERMCAP = @LIBTERMCAP@
@@ -95,6 +96,7 @@ MAINT = @MAINT@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
+NM = @NM@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
index 7addcef536ecf2ff38bf1ca598220abaa0b93fb5..bc1ddcc7648e90146c860ce717332b708a7e0a33 100644 (file)
@@ -85,6 +85,7 @@ GINACLIB_MINOR_VERSION = @GINACLIB_MINOR_VERSION@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
+LD = @LD@
 LEX = @LEX@
 LIBGINACCINT = @LIBGINACCINT@
 LIBTERMCAP = @LIBTERMCAP@
@@ -98,6 +99,7 @@ MAINT = @MAINT@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
+NM = @NM@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
index b90fdead93fd304c16059af1a3bc3e06cd33e478..56c89ab6f5982a3fe68715f606ca6fd21cc08465 100644 (file)
@@ -84,6 +84,7 @@ GINACLIB_MINOR_VERSION = @GINACLIB_MINOR_VERSION@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
+LD = @LD@
 LEX = @LEX@
 LIBGINACCINT = @LIBGINACCINT@
 LIBTERMCAP = @LIBTERMCAP@
@@ -97,6 +98,7 @@ MAINT = @MAINT@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
+NM = @NM@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
index c17aea204d633aebcf6ab085d26c96e451e0c582..cbf8f4e73b8703dda2f7e807c0a91f509ce44e6a 100644 (file)
@@ -8,6 +8,7 @@ libginac_la_SOURCES = add.cpp archive.cpp basic.cpp constant.cpp ex.cpp \
   symbol.cpp pseries.cpp utils.cpp ncmul.cpp clifford.cpp structure.cpp \
   color.cpp indexed.cpp idx.cpp isospin.cpp exprseq_suppl.cpp lst.cpp \
   lst_suppl.cpp simp_lor.cpp coloridx.cpp lorentzidx.cpp lortensor.cpp \
+  input_parser.yy input_lexer.ll input_lexer.h \
   remember.h remember.cpp debugmsg.h utils.h 
 libginac_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
   -release $(LT_RELEASE)
@@ -18,7 +19,9 @@ ginacinclude_HEADERS = ginac.h add.h archive.h basic.h clifford.h color.h \
   mul.h ncmul.h normal.h numeric.h operators.h power.h registrar.h \
   relational.h pseries.h simp_lor.h structure.h symbol.h lortensor.h tinfos.h \
   assertion.h
-EXTRA_DIST = container.pl function.pl structure.pl
+LFLAGS = -olex.yy.c
+YFLAGS = -d
+EXTRA_DIST = container.pl function.pl structure.pl input_parser.h
 
 # Files which are generated by perl scripts
 $(srcdir)/function.h $(srcdir)/function.cpp: $(srcdir)/function.pl
index d3eabe5c4a70682b62bf4b14b7ad98e9ef1915fa..53b3d16f864cc38f20bbbff282e31a487408ffe1 100644 (file)
@@ -82,6 +82,7 @@ GINACLIB_MINOR_VERSION = @GINACLIB_MINOR_VERSION@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
+LD = @LD@
 LEX = @LEX@
 LIBGINACCINT = @LIBGINACCINT@
 LIBTERMCAP = @LIBTERMCAP@
@@ -95,6 +96,7 @@ MAINT = @MAINT@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
+NM = @NM@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
@@ -104,14 +106,16 @@ VERSION = @VERSION@
 YACC = @YACC@
 
 lib_LTLIBRARIES = libginac.la
-libginac_la_SOURCES = add.cpp archive.cpp basic.cpp constant.cpp ex.cpp   expairseq.cpp exprseq.cpp fail.cpp function.cpp inifcns.cpp   inifcns_trans.cpp inifcns_zeta.cpp inifcns_gamma.cpp matrix.cpp mul.cpp   normal.cpp numeric.cpp operators.cpp power.cpp registrar.cpp relational.cpp   symbol.cpp pseries.cpp utils.cpp ncmul.cpp clifford.cpp structure.cpp   color.cpp indexed.cpp idx.cpp isospin.cpp exprseq_suppl.cpp lst.cpp   lst_suppl.cpp simp_lor.cpp coloridx.cpp lorentzidx.cpp lortensor.cpp   remember.h remember.cpp debugmsg.h utils.h 
+libginac_la_SOURCES = add.cpp archive.cpp basic.cpp constant.cpp ex.cpp   expairseq.cpp exprseq.cpp fail.cpp function.cpp inifcns.cpp   inifcns_trans.cpp inifcns_zeta.cpp inifcns_gamma.cpp matrix.cpp mul.cpp   normal.cpp numeric.cpp operators.cpp power.cpp registrar.cpp relational.cpp   symbol.cpp pseries.cpp utils.cpp ncmul.cpp clifford.cpp structure.cpp   color.cpp indexed.cpp idx.cpp isospin.cpp exprseq_suppl.cpp lst.cpp   lst_suppl.cpp simp_lor.cpp coloridx.cpp lorentzidx.cpp lortensor.cpp   input_parser.yy input_lexer.ll input_lexer.h   remember.h remember.cpp debugmsg.h utils.h 
 
 libginac_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)   -release $(LT_RELEASE)
 
 ginacincludedir = $(includedir)/ginac
 ginacinclude_HEADERS = ginac.h add.h archive.h basic.h clifford.h color.h   coloridx.h constant.h ex.h expair.h expairseq.h exprseq.h fail.h flags.h   function.h idx.h indexed.h inifcns.h isospin.h lorentzidx.h lst.h matrix.h   mul.h ncmul.h normal.h numeric.h operators.h power.h registrar.h   relational.h pseries.h simp_lor.h structure.h symbol.h lortensor.h tinfos.h   assertion.h
 
-EXTRA_DIST = container.pl function.pl structure.pl
+LFLAGS = -olex.yy.c
+YFLAGS = -d
+EXTRA_DIST = container.pl function.pl structure.pl input_parser.h
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../config.h
 CONFIG_CLEAN_FILES =  version.h
@@ -129,12 +133,14 @@ inifcns_zeta.lo inifcns_gamma.lo matrix.lo mul.lo normal.lo numeric.lo \
 operators.lo power.lo registrar.lo relational.lo symbol.lo pseries.lo \
 utils.lo ncmul.lo clifford.lo structure.lo color.lo indexed.lo idx.lo \
 isospin.lo exprseq_suppl.lo lst.lo lst_suppl.lo simp_lor.lo coloridx.lo \
-lorentzidx.lo lortensor.lo remember.lo
+lorentzidx.lo lortensor.lo input_parser.lo input_lexer.lo remember.lo
 CXXFLAGS = @CXXFLAGS@
 CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
 LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
 CXXLD = $(CXX)
 CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LEXLIB = @LEXLIB@
 CFLAGS = @CFLAGS@
 COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -142,7 +148,8 @@ CCLD = $(CC)
 LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
 HEADERS =  $(ginacinclude_HEADERS)
 
-DIST_COMMON =  Makefile.am Makefile.in version.h.in
+DIST_COMMON =  Makefile.am Makefile.in input_lexer.cc input_parser.cc \
+version.h.in
 
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
@@ -154,17 +161,18 @@ DEP_FILES =  .deps/add.P .deps/archive.P .deps/basic.P .deps/clifford.P \
 .deps/expairseq.P .deps/exprseq.P .deps/exprseq_suppl.P .deps/fail.P \
 .deps/function.P .deps/idx.P .deps/indexed.P .deps/inifcns.P \
 .deps/inifcns_gamma.P .deps/inifcns_trans.P .deps/inifcns_zeta.P \
-.deps/isospin.P .deps/lorentzidx.P .deps/lortensor.P .deps/lst.P \
-.deps/lst_suppl.P .deps/matrix.P .deps/mul.P .deps/ncmul.P \
-.deps/normal.P .deps/numeric.P .deps/operators.P .deps/power.P \
-.deps/pseries.P .deps/registrar.P .deps/relational.P .deps/remember.P \
-.deps/simp_lor.P .deps/structure.P .deps/symbol.P .deps/utils.P
+.deps/input_lexer.P .deps/input_parser.P .deps/isospin.P \
+.deps/lorentzidx.P .deps/lortensor.P .deps/lst.P .deps/lst_suppl.P \
+.deps/matrix.P .deps/mul.P .deps/ncmul.P .deps/normal.P .deps/numeric.P \
+.deps/operators.P .deps/power.P .deps/pseries.P .deps/registrar.P \
+.deps/relational.P .deps/remember.P .deps/simp_lor.P .deps/structure.P \
+.deps/symbol.P .deps/utils.P
 SOURCES = $(libginac_la_SOURCES)
 OBJECTS = $(libginac_la_OBJECTS)
 
 all: all-redirect
 .SUFFIXES:
-.SUFFIXES: .S .c .cpp .lo .o .s
+.SUFFIXES: .S .c .cc .cpp .ll .lo .o .s .yy
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
        cd $(top_srcdir) && $(AUTOMAKE) --gnu ginac/Makefile
 
@@ -234,10 +242,23 @@ maintainer-clean-libtool:
 
 libginac.la: $(libginac_la_OBJECTS) $(libginac_la_DEPENDENCIES)
        $(CXXLINK) -rpath $(libdir) $(libginac_la_LDFLAGS) $(libginac_la_OBJECTS) $(libginac_la_LIBADD) $(LIBS)
+.cc.o:
+       $(CXXCOMPILE) -c $<
+.cc.lo:
+       $(LTCXXCOMPILE) -c $<
 .cpp.o:
        $(CXXCOMPILE) -c $<
 .cpp.lo:
        $(LTCXXCOMPILE) -c $<
+.ll.cc:
+       $(LEX) $(AM_LFLAGS) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@
+.yy.cc:
+       $(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*.cc
+       if test -f y.tab.h; then \
+       if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
+       else :; fi
+input_parser.hh: input_parser.cc
+
 
 install-ginacincludeHEADERS: $(ginacinclude_HEADERS)
        @$(NORMAL_INSTALL)
@@ -336,6 +357,25 @@ maintainer-clean-depend:
            >> .deps/$(*F).P; \
        rm -f .deps/$(*F).pp
 
+%.o: %.cc
+       @echo '$(CXXCOMPILE) -c $<'; \
+       $(CXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+       @-cp .deps/$(*F).pp .deps/$(*F).P; \
+       tr ' ' '\012' < .deps/$(*F).pp \
+         | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+           >> .deps/$(*F).P; \
+       rm .deps/$(*F).pp
+
+%.lo: %.cc
+       @echo '$(LTCXXCOMPILE) -c $<'; \
+       $(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+       @-sed -e 's/^\([^:]*\)\.o[      ]*:/\1.lo \1.o :/' \
+         < .deps/$(*F).pp > .deps/$(*F).P; \
+       tr ' ' '\012' < .deps/$(*F).pp \
+         | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+           >> .deps/$(*F).P; \
+       rm -f .deps/$(*F).pp
+
 %.o: %.cpp
        @echo '$(CXXCOMPILE) -c $<'; \
        $(CXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@@ -390,6 +430,7 @@ distclean-generic:
        -rm -f config.cache config.log stamp-h stamp-h[0-9]*
 
 maintainer-clean-generic:
+       -test -z "input_lexerllinput_parserhhinput_parsercc" || rm -f input_lexerll input_parserhh input_parsercc
 mostlyclean-am:  mostlyclean-libLTLIBRARIES mostlyclean-compile \
                mostlyclean-libtool mostlyclean-tags mostlyclean-depend \
                mostlyclean-generic
index bb6c974f6f83ee6b6634cec5b5c14f28d0962a16..31893b2685e46991b685b0c4095bb270612c6706 100755 (executable)
@@ -498,6 +498,7 @@ protected:
     void store_remember_table(ex const & result) const;
 public:
     static unsigned register_new(function_options const & opt);
+    static unsigned find_function(const string &name, unsigned nparams);
     unsigned getserial(void) const {return serial;}
     
 // member variables
@@ -1114,6 +1115,21 @@ unsigned function::register_new(function_options const & opt)
     return registered_functions().size()-1;
 }
 
+/** Find serial number of function by name and number of parameters.
+ *  Throws exception if function was not found. */
+unsigned function::find_function(const string &name, unsigned nparams)
+{
+    vector<function_options>::const_iterator i = function::registered_functions().begin(), end = function::registered_functions().end();
+    unsigned serial = 0;
+    while (i != end) {
+        if (i->get_name() == name && i->get_nparams() == nparams)
+            return serial;
+        i++;
+        serial++;
+    }
+    throw (std::runtime_error("no function '" + name + "' with " + ToString(nparams) + " parameters defined"));
+}
+
 //////////
 // static member variables
 //////////
diff --git a/ginac/input_lexer.h b/ginac/input_lexer.h
new file mode 100644 (file)
index 0000000..575c836
--- /dev/null
@@ -0,0 +1,69 @@
+/** @file input_lexer.h
+ *
+ *  Lexical analyzer definition for reading expressions.
+ *  This file must be processed with flex. */
+
+/*
+ *  GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
+ *
+ *  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 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  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
+ */
+
+#ifndef __GINAC_INPUT_LEXER_H__
+#define __GINAC_INPUT_LEXER_H__
+
+#include <stdio.h>
+
+#include "config.h"
+
+// yacc stack type
+#define YYSTYPE ex
+
+// lex functions/variables
+extern int ginac_yyerror(char *s);
+extern int ginac_yylex(void);
+extern void ginac_yyrestart(FILE *f);
+#if YYTEXT_POINTER
+extern char *ginac_yytext;
+#else
+extern char ginac_yytext[];
+#endif
+
+#ifndef NO_NAMESPACE_GINAC
+namespace GiNaC {
+#endif // ndef NO_NAMESPACE_GINAC
+
+class ex;
+
+/** Set the input string to be parsed by yyparse(). */
+extern void set_lexer_string(const string &s);
+
+/** Set the list of predefined symbols for the lexer (used internally for stream input). */
+extern void set_lexer_symbols(ex l);
+
+/** The expression parser function (used internally for stream input). */
+extern int yyparse();
+
+/** The expression returned by the parser (used internally for stream input). */
+extern ex parsed_ex;
+
+/** Get error message from the parser. */
+extern string get_parser_error(void);
+
+#ifndef NO_NAMESPACE_GINAC
+} // namespace GiNaC
+#endif // ndef NO_NAMESPACE_GINAC
+
+#endif // ndef __GINAC_INPUT_LEXER_H__
diff --git a/ginac/input_lexer.ll b/ginac/input_lexer.ll
new file mode 100644 (file)
index 0000000..eebdae4
--- /dev/null
@@ -0,0 +1,171 @@
+/** @file input_lexer.ll
+ *
+ *  Lexical analyzer definition for reading expressions.
+ *  This file must be processed with flex. */
+
+/*
+ *  GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
+ *
+ *  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 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  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
+ */
+
+
+/*
+ *  Definitions
+ */
+
+%{
+#include <iostream>
+#include <string>
+#include <map>
+#include <stdexcept>
+
+#include "input_lexer.h"
+#include "ex.h"
+#include "constant.h"
+#include "fail.h"
+#include "numeric.h"
+#include "symbol.h"
+
+#ifndef NO_NAMESPACE_GINAC
+using namespace GiNaC;
+namespace GiNaC {
+#endif // ndef NO_NAMESPACE_GINAC
+
+#include "input_parser.h"
+
+#ifndef NO_NAMESPACE_GINAC
+} // namespace GiNaC
+#endif // ndef NO_NAMESPACE_GINAC
+
+// Table of all used symbols
+typedef map<string, ex> sym_tab;
+static sym_tab syms;
+
+// lex input function
+static int lexer_input(char *buf, int max_size);
+#define YY_INPUT(buf, result, max_size) (result = lexer_input(buf, max_size))
+%}
+
+       /* The code output by flex doesn't work well with namespaces, so we're doing it this way */
+%option prefix="ginac_yy"
+
+       /* Abbreviations */
+D      [0-9]
+E      [elEL][-+]?{D}+
+A      [a-zA-Z_]
+AN     [0-9a-zA-Z_]
+
+
+/*
+ *  Lexical rules
+ */
+
+%%
+[ \t]+                 /* skip whitespace */
+
+                       /* special values */
+Pi                     yylval = Pi; return T_LITERAL;
+gamma                  yylval = gamma; return T_LITERAL;
+Catalan                        yylval = Catalan; return T_LITERAL;
+FAIL                   yylval = *new fail(); return T_LITERAL;
+I                      yylval = I; return T_NUMBER;
+Digits                 yylval = (long)Digits; return T_DIGITS;
+
+                       /* comparison */
+"=="                   return T_EQUAL;
+"!="                   return T_NOTEQ;
+"<="                   return T_LESSEQ;
+">="                   return T_GREATEREQ;
+
+                       /* matrix delimiters */
+\[\[                   return T_MATRIX_BEGIN;
+\]\]                   return T_MATRIX_END;
+
+                       /* numbers */
+{D}+                   |
+{D}+"."{D}*({E})?      |
+{D}*"."{D}+({E})?      |
+{D}+{E}                        yylval = numeric(yytext); return T_NUMBER;
+
+                       /* symbols */
+{A}{AN}*               {
+                               if (syms.find(yytext) == syms.end())
+                                       syms[yytext] = *(new symbol(yytext));
+                               yylval = syms[yytext];
+                               return T_SYMBOL;
+                       }
+
+                       /* everything else */
+.                      return *yytext;
+
+%%
+
+
+/*
+ *  Routines
+ */
+
+// The string from which we will read
+static string lexer_string;
+
+// The current position within the string
+static int curr_pos = 0;
+
+// Input function that reads from string
+static int lexer_input(char *buf, int max_size)
+{
+       int actual = lexer_string.length() - curr_pos;
+       if (actual > max_size)
+               actual = max_size;
+       if (actual <= 0)
+               return YY_NULL;
+       lexer_string.copy(buf, actual, curr_pos);
+       curr_pos += actual;
+       return actual;
+}
+
+// EOF encountered, terminate the scanner
+int ginac_yywrap()
+{
+       return 1;
+}
+
+#ifndef NO_NAMESPACE_GINAC
+namespace GiNaC {
+#endif // ndef NO_NAMESPACE_GINAC
+
+// Set the input string
+void set_lexer_string(const string &s)
+{
+       lexer_string = s;
+       curr_pos = 0;
+}
+
+// Set the list of predefined symbols
+void set_lexer_symbols(ex l)
+{
+       syms.clear();
+       if (!is_ex_exactly_of_type(l, lst))
+               return;
+       for (int i=0; i<l.nops(); i++) {
+               if (is_ex_exactly_of_type(l.op(i), symbol))
+                       syms[ex_to_symbol(l.op(i)).getname()] = l.op(i);
+       }
+}
+
+#ifndef NO_NAMESPACE_GINAC
+} // namespace GiNaC
+#endif // ndef NO_NAMESPACE_GINAC
diff --git a/ginac/input_parser.yy b/ginac/input_parser.yy
new file mode 100644 (file)
index 0000000..5a80c95
--- /dev/null
@@ -0,0 +1,162 @@
+/** @file input_parser.yy
+ *
+ *  Input grammar definition for reading expressions.
+ *  This file must be processed with yacc/bison. */
+
+/*
+ *  GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
+ *
+ *  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 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  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
+ */
+
+
+/*
+ *  Definitions
+ */
+
+%{
+#include <stdexcept>
+
+#include "input_lexer.h"
+#include "ex.h"
+#include "relational.h"
+#include "symbol.h"
+#include "lst.h"
+#include "power.h"
+#include "exprseq.h"
+#include "matrix.h"
+#include "inifcns.h"
+
+#ifndef NO_NAMESPACE_GINAC
+namespace GiNaC {
+#endif // ndef NO_NAMESPACE_GINAC
+
+#define YYERROR_VERBOSE 1
+
+#define yylex ginac_yylex
+#define yyerror ginac_yyerror
+
+// Parsed output expression
+ex parsed_ex;
+
+// Last error message returned by parser
+static string parser_error;
+%}
+
+/* Tokens (T_LITERAL means a literal value returned by the parser, but not
+   of class numeric or symbol (e.g. a constant or the FAIL object)) */
+%token T_NUMBER T_SYMBOL T_LITERAL T_DIGITS T_EQUAL T_NOTEQ T_LESSEQ T_GREATEREQ T_MATRIX_BEGIN T_MATRIX_END
+
+/* Operator precedence and associativity */
+%right '='
+%left T_EQUAL T_NOTEQ
+%left '<' '>' T_LESSEQ T_GREATEREQ
+%left '+' '-'
+%left '*' '/' '%'
+%nonassoc NEG
+%right '^'
+%nonassoc '!'
+
+%start input
+
+
+/*
+ *  Grammar rules
+ */
+
+%%
+input  : exp {
+               try {
+                       parsed_ex = $1;
+                       YYACCEPT;
+               } catch (exception &e) {
+                       parser_error = e.what();
+                       YYERROR;
+               }
+       }
+       | error         {yyclearin; yyerrok;}
+       ;
+
+exp    : T_NUMBER              {$$ = $1;}
+       | T_SYMBOL              {$$ = $1.eval();}
+       | T_LITERAL             {$$ = $1;}
+       | T_DIGITS              {$$ = $1;}
+       | T_SYMBOL '(' exprseq ')' {
+               unsigned i = function::find_function(ex_to_symbol($1).getname(), $3.nops());
+               $$ = function(i, static_cast<const exprseq &>(*($3.bp)));
+       }
+       | exp T_EQUAL exp       {$$ = $1 == $3;}
+       | exp T_NOTEQ exp       {$$ = $1 != $3;}
+       | exp '<' exp           {$$ = $1 < $3;}
+       | exp T_LESSEQ exp      {$$ = $1 <= $3;}
+       | exp '>' exp           {$$ = $1 > $3;}
+       | exp T_GREATEREQ exp   {$$ = $1 >= $3;}
+       | exp '+' exp           {$$ = $1 + $3;}
+       | exp '-' exp           {$$ = $1 - $3;}
+       | exp '*' exp           {$$ = $1 * $3;}
+       | exp '/' exp           {$$ = $1 / $3;}
+       | exp '%' exp           {$$ = $1 % $3;}
+       | '-' exp %prec NEG     {$$ = -$2;}
+       | '+' exp %prec NEG     {$$ = $2;}
+       | exp '^' exp           {$$ = pow($1, $3);}
+       | exp '!'               {$$ = factorial($1);}
+       | '(' exp ')'           {$$ = $2;}
+       | '[' list_or_empty ']' {$$ = $2;}
+       | T_MATRIX_BEGIN matrix T_MATRIX_END    {$$ = lst_to_matrix($2);}
+       ;
+
+exprseq        : exp                   {$$ = exprseq($1);}
+       | exprseq ',' exp       {exprseq es(static_cast<exprseq &>(*($1.bp))); $$ = es.append($3);}
+       ;
+
+list_or_empty: /* empty */     {$$ = *new lst;}
+       | list                  {$$ = $1;}
+       ;
+
+list   : exp                   {$$ = lst($1);}
+       | list ',' exp          {lst l(static_cast<lst &>(*($1.bp))); $$ = l.append($3);}
+       ;
+
+matrix : T_MATRIX_BEGIN row T_MATRIX_END               {$$ = lst($2);}
+       | matrix ',' T_MATRIX_BEGIN row T_MATRIX_END    {lst l(static_cast<lst &>(*($1.bp))); $$ = l.append($4);}
+       ;
+
+row    : exp                   {$$ = lst($1);}
+       | row ',' exp           {lst l(static_cast<lst &>(*($1.bp))); $$ = l.append($3);}
+       ;
+
+
+/*
+ *  Routines
+ */
+
+%%
+// Get last error encountered by parser
+string get_parser_error(void)
+{
+       return parser_error;
+}
+
+#ifndef NO_NAMESPACE_GINAC
+} // namespace GiNaC
+
+using GiNaC::parser_error;
+#endif // ndef NO_NAMESPACE_GINAC
+
+// Error print routine (store error string in parser_error)
+int ginac_yyerror(char *s)
+{
+       parser_error = string(s) + " at " + string(ginac_yytext);
+}
index fab7b5fde949e1a68f02623a04fe6d6636cb0140..f219f27de0c3dcb1432bcc7d944b4ef8bcd63dcc 100644 (file)
 
 #include "matrix.h"
 #include "archive.h"
+#include "numeric.h"
+#include "lst.h"
 #include "utils.h"
 #include "debugmsg.h"
-#include "numeric.h"
 
 #ifndef NO_NAMESPACE_GINAC
 namespace GiNaC {
@@ -1218,6 +1219,29 @@ int matrix::pivot(unsigned ro, bool symbolic)
     return 0;
 }
 
+/** Convert list of lists to matrix. */
+ex lst_to_matrix(const ex &l)
+{
+       if (!is_ex_of_type(l, lst))
+               throw(std::invalid_argument("argument to lst_to_matrix() must be a lst"));
+
+       // Find number of rows and columns
+       unsigned rows = l.nops(), cols = 0, i, j;
+       for (i=0; i<rows; i++)
+               if (l.op(i).nops() > cols)
+                       cols = l.op(i).nops();
+
+       // Allocate and fill matrix
+       matrix &m = *new matrix(rows, cols);
+       for (i=0; i<rows; i++)
+               for (j=0; j<cols; j++)
+                       if (l.op(i).nops() > j)
+                               m.set(i, j, l.op(i).op(j));
+                       else
+                               m.set(i, j, ex(0));
+       return m;
+}
+
 //////////
 // global constants
 //////////
index 8b0555c8eb102bb937e538e922f5c755f83efca7..60931cc54a3e5d71d8ce6077cbfaae538c5b628b 100644 (file)
@@ -165,6 +165,8 @@ inline const matrix &ex_to_matrix(const ex &e)
        return static_cast<const matrix &>(*e.bp);
 }
 
+extern ex lst_to_matrix(const ex &l);
+
 #ifndef NO_NAMESPACE_GINAC
 } // namespace GiNaC
 #endif // ndef NO_NAMESPACE_GINAC
index 9a681b5ea2e2e68f263e40caad0c3956af4cc476..6cf750cefa7005542175ee6d46f2178a18a34787 100644 (file)
@@ -29,6 +29,7 @@
 #include "numeric.h"
 #include "power.h"
 #include "relational.h"
+#include "input_lexer.h"
 #include "debugmsg.h"
 #include "utils.h"
 
@@ -335,9 +336,21 @@ ostream & operator<<(ostream & os, const ex & e)
     return os;
 }
 
+/** Input (parse) expression from stream. The input grammar is similar to the
+ *  GiNaC output format. If 'e' contains a list of symbols upon entry, these
+ *  symbols are used in the parsed expression in all places where symbols with
+ *  the same names appear. All other encountered symbols will be newly created. */
 istream & operator>>(istream & is, ex & e)
 {
-    throw(std::logic_error("input from streams not yet implemented"));
+       string s;
+       getline(is, s);
+       set_lexer_string(s);
+       set_lexer_symbols(e);
+       ginac_yyrestart(NULL);
+       if (yyparse())
+               throw (std::runtime_error(get_parser_error()));
+       else
+               e = parsed_ex;
 }
 
 #ifndef NO_NAMESPACE_GINAC
diff --git a/ginac/version.h b/ginac/version.h
new file mode 100644 (file)
index 0000000..187d421
--- /dev/null
@@ -0,0 +1,31 @@
+/** @file version.h
+ *
+ *  GiNaC library version information. */
+
+/*
+ *  GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
+ *
+ *  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 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  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
+ */
+
+#ifndef __GINAC_VERSION_H__
+#define __GINAC_VERSION_H__
+
+/* Major, minor, and micro version number of the GiNaC library. */
+#define GINACLIB_MAJOR_VERSION 0
+#define GINACLIB_MINOR_VERSION 6
+#define GINACLIB_MICRO_VERSION 0
+
+#endif // ndef __GINAC_VERSION_H__
index 09bea8f908bb89d9746064273377776af0000c6e..7fad8dcc6eedbd1673622108af6387e34e23b1e4 100644 (file)
@@ -82,6 +82,7 @@ GINACLIB_MINOR_VERSION = @GINACLIB_MINOR_VERSION@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
+LD = @LD@
 LEX = @LEX@
 LIBGINACCINT = @LIBGINACCINT@
 LIBTERMCAP = @LIBTERMCAP@
@@ -95,6 +96,7 @@ MAINT = @MAINT@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
+NM = @NM@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@
index 94bff017b1de95c3c130210ce3377433c4a556b7..ed093299d85067027e759cb360aa7405d99a872a 100644 (file)
@@ -1,8 +1,9 @@
 /** @file ginsh_lexer.ll
  *
  *  Lexical analyzer definition for ginsh.
- *  This file must be processed with flex.
- *
+ *  This file must be processed with flex. */
+
+/*
  *  GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
  *
  *  This program is free software; you can redistribute it and/or modify
index 65a41f5a33a18917e56c0ea6bae303f463ad66f7..8538ad0bcf192b2d511be73f485188e703900d81 100644 (file)
@@ -1,8 +1,9 @@
 /** @file ginsh_parser.yy
  *
  *  Input grammar definition for ginsh.
- *  This file must be processed with yacc/bison.
- *
+ *  This file must be processed with yacc/bison. */
+
+/*
  *  GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -39,6 +40,8 @@
 
 #include "ginsh.h"
 
+#define YYERROR_VERBOSE 1
+
 // Original readline settings
 static int orig_completion_append_character;
 static char *orig_basic_word_break_characters;
@@ -77,8 +80,6 @@ static help_tab help;
 
 static void print_help(const string &topic);
 static void print_help_topics(void);
-
-static ex lst2matrix(const ex &l);
 %}
 
 /* Tokens (T_LITERAL means a literal value returned by the parser, but not
@@ -206,7 +207,7 @@ exp : T_NUMBER              {$$ = $1;}
        | exp '!'               {$$ = factorial($1);}
        | '(' exp ')'           {$$ = $2;}
        | '[' list_or_empty ']' {$$ = $2;}
-       | T_MATRIX_BEGIN matrix T_MATRIX_END    {$$ = lst2matrix($2);}
+       | T_MATRIX_BEGIN matrix T_MATRIX_END    {$$ = lst_to_matrix($2);}
        ;
 
 exprseq        : exp                   {$$ = exprseq($1);}
@@ -653,33 +654,6 @@ static void print_help_topics(void)
 }
 
 
-/*
- *  Convert list of lists to matrix
- */
-
-static ex lst2matrix(const ex &l)
-{
-       if (!is_ex_of_type(l, lst))
-               throw(std::logic_error("internal error: argument to lst2matrix() is not a list"));
-
-       // Find number of rows and columns
-       unsigned rows = l.nops(), cols = 0, i, j;
-       for (i=0; i<rows; i++)
-               if (l.op(i).nops() > cols)
-                       cols = l.op(i).nops();
-
-       // Allocate and fill matrix
-       matrix &m = *new matrix(rows, cols);
-       for (i=0; i<rows; i++)
-               for (j=0; j<cols; j++)
-                       if (l.op(i).nops() > j)
-                               m.set(i, j, l.op(i).op(j));
-                       else
-                               m.set(i, j, ex(0));
-       return m;
-}
-
-
 /*
  *  Function name completion functions for readline
  */
@@ -733,6 +707,7 @@ void greeting(void)
 /*
  *  Main program
  */
+
 int main(int argc, char **argv)
 {
        // Print banner in interactive mode
index c04d6ddab9792264c36cb8029cf23e79aa2f0d7a..392fb729da89fefea731a2c844091c2a24386903 100644 (file)
@@ -82,6 +82,7 @@ GINACLIB_MINOR_VERSION = @GINACLIB_MINOR_VERSION@
 GINACLIB_VERSION = @GINACLIB_VERSION@
 GINSH_LIBS = @GINSH_LIBS@
 LATEX = @LATEX@
+LD = @LD@
 LEX = @LEX@
 LIBGINACCINT = @LIBGINACCINT@
 LIBTERMCAP = @LIBTERMCAP@
@@ -95,6 +96,7 @@ MAINT = @MAINT@
 MAKECINT = @MAKECINT@
 MAKEINDEX = @MAKEINDEX@
 MAKEINFO = @MAKEINFO@
+NM = @NM@
 OBJDUMP = @OBJDUMP@
 PACKAGE = @PACKAGE@
 RANLIB = @RANLIB@