Changeset 92e539 in git


Ignore:
Timestamp:
Aug 8, 1997, 2:59:30 PM (27 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'c7af8613769b29c741d6c338945669719f1fc4f8')
Children:
55ef0ba5df13c3b0a08097f49a2c51fee40b2d2d
Parents:
c56606b5463dc5f7952f108b3b9454daea2f3793
Message:
Fri Aug  8 14:54:28 1997  Olaf Bachmann
<obachman@mathematik.uni-kl.de>

	* Makefile.in ndbm.[cc,h]: Together with krueger: Added files
	  ndbm.[cc,h]; no longer linking with libdbm, instead,
	  user supplied files; added dbm_test; small changes to sing_dbm.cc

Thu Aug  7 14:51:59 1997  Olaf Bachmann
<obachman@mathematik.uni-kl.de>

	* mpsr_Get.cc (GetCopCommandLeftv): made +/* to binary ops

	* longrat.[h,cc]: added number   nlInit(number i) to initialize a
	  number, i.e. get it into the right Singular state


git-svn-id: file:///usr/local/Singular/svn/trunk@604 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
Singular
Files:
2 added
11 edited

Legend:

Unmodified
Added
Removed
  • Singular/ChangeLog

    rc56606 r92e539  
     1Fri Aug  8 14:54:28 1997  Olaf Bachmann  <obachman@mathematik.uni-kl.de>
     2
     3        * Makefile.in ndbm.[cc,h]: Together with krueger: Added files
     4          ndbm.[cc,h]; no longer linking with libdbm, instead,
     5          user supplied files; added dbm_test; small changes to sing_dbm.cc
     6
    17Fri Aug  8 12:56:44 MET DST 1997
    28        * hannes: introduced "div" for integer division
    39          grammar.*, iparith.cc, singular.doc
    410        * changed version to 1.1.2/August
     11
     12Thu Aug  7 14:51:59 1997  Olaf Bachmann  <obachman@mathematik.uni-kl.de>
     13
     14        * mpsr_Get.cc (GetCopCommandLeftv): made +/* to binary ops
     15
     16        * longrat.[h,cc]: added number   nlInit(number i) to initialize a
     17                  number, i.e. get it into the right Singular state
     18
    519Wed Jul 16 12:57:22 MET DST 1997: hannes
    620        * introduced '.singularrc', modified loading of satndard.lib
  • Singular/Makefile.in

    rc56606 r92e539  
    6565WITH_FACTORY    = @WITH_FACTORY@
    6666WITH_LIBFAC     = @WITH_LIBFAC@
     67WITH_DBM        = @WITH_DBM@
    6768
    6869##
     
    9293    tesths.cc timer.cc weight.cc \
    9394    mpsr_Put.cc mpsr_PutPoly.cc mpsr_Tok.cc mpsr_GetPoly.cc \
    94     mpsr_Get.cc mpsr_GetMisc.cc mpsr_Error.cc
     95    mpsr_Get.cc mpsr_GetMisc.cc mpsr_Error.cc \
     96    ndbm.cc
    9597
    9698CSOURCES=mmalloc.c mmallocb.c mmallocs.c mmblock.c mmheap.c mmspec.c mmutil.c weight0.c
     
    108110        fglmvec.h kstd2.h mpsr.h sing_mp.h \
    109111        kstdfac.h mpsr_Get.h spolys.h \
    110         kutil.h mpsr_Put.h spolys0.h
     112        kutil.h mpsr_Put.h spolys0.h \
     113        ndbm.h
    111114
    112115TESTS=${testdir}/comparecheck ${testdir}/fac_test.in ${testdir}/fac_test.out\
    113116        ${testdir}/general_test.in ${testdir}/general_test.out \
    114         ${testdir}/mpcheck ${testdir}/mpcheck.data
     117        ${testdir}/mpcheck ${testdir}/mpcheck.data \
     118        ${testdir}/dbm_test.in ${testdir}/dbm_test.out
    115119
    116120DOCS=${docdir}/Makefile.in ${docdir}/copyright.tex ${docdir}/doc2tex.c \
     
    136140     algmap.o clapconv.o  clapmem.o clapsing.o claptmpl.o\
    137141     mpsr_Error.o mpsr_Put.o mpsr_PutPoly.o mpsr_GetPoly.o \
    138      mpsr_Get.o mpsr_GetMisc.o
     142     mpsr_Get.o mpsr_GetMisc.o ndbm.o
    139143
    140144##
     
    238242clean:
    239243        -rm -rf Singular* *.o *.og core *.d *.dd *~ \#* /tmp/mp* \
    240                 *.got *dump* *.diff
     244                *.got *dump* *.diff *.dir *.pag
    241245        cd ${docdir}; ${MAKE} clean
    242246
     
    262266        @ if test "${WITH_FACTORY}" = yes && test "${WITH_LIBFAC}" = yes; then \
    263267          ${MAKE} factorycheck;\
    264         fi     
    265                    
     268        fi
     269        @ if test "${WITH_DBM}" = yes; then ${MAKE} dbmcheck; fi
     270
    266271
    267272mpcheck: Singular ${testdir}/mpcheck ${testdir}/mpcheck.data
     
    275280        PATH=`pwd`:${PATH}; export PATH;\
    276281        ${testdir}/comparecheck ${testdir}/fac_test.in ${testdir}/fac_test.out
    277        
     282
     283dbmcheck: Singular ${testdir}/comparecheck ${testdir}/dbm_test.in \
     284                ${testdir}/dbm_test.out
     285        - @ SINGULARPATH=`pwd`/LIB; export SINGULARPATH; \
     286        PATH=`pwd`:${PATH}; export PATH;\
     287        ${testdir}/comparecheck ${testdir}/dbm_test.in ${testdir}/dbm_test.out
     288
     289
    278290##
    279291## miscellanous targets
     
    328340     cntrlc.og  \
    329341     mpsr_Error.og mpsr_Put.og mpsr_PutPoly.og mpsr_GetPoly.og \
    330      mpsr_Get.og mpsr_GetMisc.og
     342     mpsr_Get.og mpsr_GetMisc.og \
     343     ndbm.og
    331344
    332345OBJG2= mmalloc.og mmallocb.og mmallocs.og mmblock.og mmheap.og \
     
    365378## dependencies
    366379##
    367        
    368380%.dd: %.cc mod2.h
    369381        echo $@ $(@:.dd=.og) " " \\ > $@
  • Singular/configure

    rc56606 r92e539  
    14041404fi
    14051405 
    1406 if test "$with_dbm" != no; then
    1407   echo $ac_n "checking for -ldbm""... $ac_c" 1>&6
    1408 ac_lib_var=`echo dbm_dbminit | tr '.-/+' '___p'`
    1409 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    1410   echo $ac_n "(cached) $ac_c" 1>&6
    1411 else
    1412   ac_save_LIBS="$LIBS"
    1413 LIBS="-ldbm  $LIBS"
    1414 cat > conftest.$ac_ext <<EOF
    1415 #line 1416 "configure"
    1416 #include "confdefs.h"
    1417 /* Override any gcc2 internal prototype to avoid an error.  */
    1418 char dbminit();
    1419 
    1420 int main() { return 0; }
    1421 int t() {
    1422 dbminit()
    1423 ; return 0; }
    1424 EOF
    1425 if { (eval echo configure:1426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
    1426   rm -rf conftest*
    1427   eval "ac_cv_lib_$ac_lib_var=yes"
    1428 else
    1429   rm -rf conftest*
    1430   eval "ac_cv_lib_$ac_lib_var=no"
    1431 fi
    1432 rm -f conftest*
    1433 LIBS="$ac_save_LIBS"
    1434 
    1435 fi
    1436 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
    1437   echo "$ac_t""yes" 1>&6
    1438   cat >> confdefs.h <<\EOF
    1439 #define HAVE_DBM 1
    1440 EOF
    1441  LIBS="-ldbm $LIBS"
    1442 else
    1443   echo "$ac_t""no" 1>&6
    1444 echo $ac_n "checking for -lgdbm""... $ac_c" 1>&6
    1445 ac_lib_var=`echo gdbm_dbminit | tr '.-/+' '___p'`
    1446 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    1447   echo $ac_n "(cached) $ac_c" 1>&6
    1448 else
    1449   ac_save_LIBS="$LIBS"
    1450 LIBS="-lgdbm  $LIBS"
    1451 cat > conftest.$ac_ext <<EOF
    1452 #line 1453 "configure"
    1453 #include "confdefs.h"
    1454 /* Override any gcc2 internal prototype to avoid an error.  */
    1455 char dbminit();
    1456 
    1457 int main() { return 0; }
    1458 int t() {
    1459 dbminit()
    1460 ; return 0; }
    1461 EOF
    1462 if { (eval echo configure:1463: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
    1463   rm -rf conftest*
    1464   eval "ac_cv_lib_$ac_lib_var=yes"
    1465 else
    1466   rm -rf conftest*
    1467   eval "ac_cv_lib_$ac_lib_var=no"
    1468 fi
    1469 rm -f conftest*
    1470 LIBS="$ac_save_LIBS"
    1471 
    1472 fi
    1473 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
    1474   echo "$ac_t""yes" 1>&6
    1475   cat >> confdefs.h <<\EOF
    1476 #define HAVE_DBM 1
    1477 EOF
    1478  LIBS="-lgdbm $LIBS"
    1479 else
    1480   echo "$ac_t""no" 1>&6
    1481 echo "configure: warning: building without dbm: disabling DBM links" 1>&2
    1482 fi
    1483 
    1484 fi
    1485 
    1486 fi
    1487 
    14881406if test "$with_dld" = yes; then
    14891407  echo $ac_n "checking for -ldld""... $ac_c" 1>&6
     
    14951413LIBS="-ldld  $LIBS"
    14961414cat > conftest.$ac_ext <<EOF
    1497 #line 1498 "configure"
     1415#line 1416 "configure"
    14981416#include "confdefs.h"
    14991417/* Override any gcc2 internal prototype to avoid an error.  */
     
    15051423; return 0; }
    15061424EOF
    1507 if { (eval echo configure:1508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     1425if { (eval echo configure:1426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
    15081426  rm -rf conftest*
    15091427  eval "ac_cv_lib_$ac_lib_var=yes"
     
    15361454LIBS="-lgmp  $LIBS"
    15371455cat > conftest.$ac_ext <<EOF
    1538 #line 1539 "configure"
     1456#line 1457 "configure"
    15391457#include "confdefs.h"
    15401458/* Override any gcc2 internal prototype to avoid an error.  */
     
    15461464; return 0; }
    15471465EOF
    1548 if { (eval echo configure:1549: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     1466if { (eval echo configure:1467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
    15491467  rm -rf conftest*
    15501468  eval "ac_cv_lib_$ac_lib_var=yes"
     
    15781496LIBS="-lsmallgmp  $LIBS"
    15791497cat > conftest.$ac_ext <<EOF
    1580 #line 1581 "configure"
     1498#line 1499 "configure"
    15811499#include "confdefs.h"
    15821500/* Override any gcc2 internal prototype to avoid an error.  */
     
    15881506; return 0; }
    15891507EOF
    1590 if { (eval echo configure:1591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     1508if { (eval echo configure:1509: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
    15911509  rm -rf conftest*
    15921510  eval "ac_cv_lib_$ac_lib_var=yes"
     
    16201538LIBS="-lMP  $LIBS"
    16211539cat > conftest.$ac_ext <<EOF
    1622 #line 1623 "configure"
     1540#line 1541 "configure"
    16231541#include "confdefs.h"
    16241542/* Override any gcc2 internal prototype to avoid an error.  */
     
    16301548; return 0; }
    16311549EOF
    1632 if { (eval echo configure:1633: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     1550if { (eval echo configure:1551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
    16331551  rm -rf conftest*
    16341552  eval "ac_cv_lib_$ac_lib_var=yes"
     
    16621580LIBS="-lMPT  $LIBS"
    16631581cat > conftest.$ac_ext <<EOF
    1664 #line 1665 "configure"
     1582#line 1583 "configure"
    16651583#include "confdefs.h"
    16661584/* Override any gcc2 internal prototype to avoid an error.  */
     
    16721590; return 0; }
    16731591EOF
    1674 if { (eval echo configure:1675: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     1592if { (eval echo configure:1593: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
    16751593  rm -rf conftest*
    16761594  eval "ac_cv_lib_$ac_lib_var=yes"
     
    17041622LIBS="-lsingcf  $LIBS"
    17051623cat > conftest.$ac_ext <<EOF
    1706 #line 1707 "configure"
     1624#line 1625 "configure"
    17071625#include "confdefs.h"
    17081626/* Override any gcc2 internal prototype to avoid an error.  */
     
    17141632; return 0; }
    17151633EOF
    1716 if { (eval echo configure:1717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     1634if { (eval echo configure:1635: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
    17171635  rm -rf conftest*
    17181636  eval "ac_cv_lib_$ac_lib_var=yes"
     
    17461664LIBS="-lsingfac  $LIBS"
    17471665cat > conftest.$ac_ext <<EOF
    1748 #line 1749 "configure"
     1666#line 1667 "configure"
    17491667#include "confdefs.h"
    17501668/* Override any gcc2 internal prototype to avoid an error.  */
     
    17561674; return 0; }
    17571675EOF
    1758 if { (eval echo configure:1759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     1676if { (eval echo configure:1677: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
    17591677  rm -rf conftest*
    17601678  eval "ac_cv_lib_$ac_lib_var=yes"
     
    17891707else
    17901708  cat > conftest.$ac_ext <<EOF
    1791 #line 1792 "configure"
     1709#line 1710 "configure"
    17921710#include "confdefs.h"
    17931711#include <$ac_hdr>
    17941712EOF
    17951713ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
    1796 { (eval echo configure:1797: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
     1714{ (eval echo configure:1715: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
    17971715ac_err=`grep -v '^ *+' conftest.out`
    17981716if test -z "$ac_err"; then
     
    19931911else
    19941912cat > conftest.$ac_ext <<EOF
    1995 #line 1996 "configure"
     1913#line 1914 "configure"
    19961914#include "confdefs.h"
    19971915main(){return(0);}
    19981916EOF
    1999 { (eval echo configure:2000: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
     1917{ (eval echo configure:1918: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
    20001918if test -s conftest && (./conftest; exit) 2>/dev/null; then
    20011919  ac_cv_c_cross=no
     
    20151933else
    20161934  cat > conftest.$ac_ext <<EOF
    2017 #line 2018 "configure"
     1935#line 1936 "configure"
    20181936#include "confdefs.h"
    20191937#include <stdlib.h>
     
    20231941EOF
    20241942ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
    2025 { (eval echo configure:2026: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
     1943{ (eval echo configure:1944: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
    20261944ac_err=`grep -v '^ *+' conftest.out`
    20271945if test -z "$ac_err"; then
     
    20381956  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
    20391957cat > conftest.$ac_ext <<EOF
    2040 #line 2041 "configure"
     1958#line 1959 "configure"
    20411959#include "confdefs.h"
    20421960#include <string.h>
     
    20561974  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
    20571975cat > conftest.$ac_ext <<EOF
    2058 #line 2059 "configure"
     1976#line 1977 "configure"
    20591977#include "confdefs.h"
    20601978#include <stdlib.h>
     
    20771995else
    20781996cat > conftest.$ac_ext <<EOF
    2079 #line 2080 "configure"
     1997#line 1998 "configure"
    20801998#include "confdefs.h"
    20811999#include <ctype.h>
     
    20882006
    20892007EOF
    2090 { (eval echo configure:2091: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
     2008{ (eval echo configure:2009: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
    20912009if test -s conftest && (./conftest; exit) 2>/dev/null; then
    20922010  :
     
    21162034else
    21172035  cat > conftest.$ac_ext <<EOF
    2118 #line 2119 "configure"
     2036#line 2037 "configure"
    21192037#include "confdefs.h"
    21202038#include <$ac_hdr>
    21212039EOF
    21222040ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
    2123 { (eval echo configure:2124: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
     2041{ (eval echo configure:2042: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
    21242042ac_err=`grep -v '^ *+' conftest.out`
    21252043if test -z "$ac_err"; then
     
    21552073else
    21562074  cat > conftest.$ac_ext <<EOF
    2157 #line 2158 "configure"
     2075#line 2076 "configure"
    21582076#include "confdefs.h"
    21592077#include <$ac_hdr>
    21602078EOF
    21612079ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
    2162 { (eval echo configure:2163: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
     2080{ (eval echo configure:2081: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
    21632081ac_err=`grep -v '^ *+' conftest.out`
    21642082if test -z "$ac_err"; then
     
    21852103
    21862104
     2105WITH_DBM=no
     2106echo $ac_n "checking whether to build with dbm links""... $ac_c" 1>&6
     2107if test "$with_dbm" != no; then
     2108  cat >> confdefs.h <<\EOF
     2109#define HAVE_DBM 1
     2110EOF
     2111 
     2112  WITH_DBM=yes
     2113 
     2114  echo "$ac_t""yes" 1>&6
     2115else
     2116  echo "$ac_t""no" 1>&6
     2117fi
     2118
    21872119echo $ac_n "checking for working const""... $ac_c" 1>&6
    21882120if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
     
    21902122else
    21912123  cat > conftest.$ac_ext <<EOF
    2192 #line 2193 "configure"
     2124#line 2125 "configure"
    21932125#include "confdefs.h"
    21942126
     
    22402172; return 0; }
    22412173EOF
    2242 if { (eval echo configure:2243: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     2174if { (eval echo configure:2175: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    22432175  rm -rf conftest*
    22442176  ac_cv_c_const=yes
     
    22662198for ac_kw in inline __inline__ __inline; do
    22672199  cat > conftest.$ac_ext <<EOF
    2268 #line 2269 "configure"
     2200#line 2201 "configure"
    22692201#include "confdefs.h"
    22702202
     
    22742206; return 0; }
    22752207EOF
    2276 if { (eval echo configure:2277: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     2208if { (eval echo configure:2209: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    22772209  rm -rf conftest*
    22782210  ac_cv_c_inline=$ac_kw; break
     
    23022234else
    23032235  cat > conftest.$ac_ext <<EOF
    2304 #line 2305 "configure"
     2236#line 2237 "configure"
    23052237#include "confdefs.h"
    23062238#include <sys/types.h>
     
    23332265else
    23342266  cat > conftest.$ac_ext <<EOF
    2335 #line 2336 "configure"
     2267#line 2268 "configure"
    23362268#include "confdefs.h"
    23372269#include <sys/types.h>
     
    23432275; return 0; }
    23442276EOF
    2345 if { (eval echo configure:2346: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     2277if { (eval echo configure:2278: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    23462278  rm -rf conftest*
    23472279  ac_cv_header_time=yes
     
    23672299else
    23682300  cat > conftest.$ac_ext <<EOF
    2369 #line 2370 "configure"
     2301#line 2302 "configure"
    23702302#include "confdefs.h"
    23712303#include <sys/types.h>
     
    23762308; return 0; }
    23772309EOF
    2378 if { (eval echo configure:2379: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     2310if { (eval echo configure:2311: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    23792311  rm -rf conftest*
    23802312  ac_cv_struct_tm=time.h
     
    24032335else
    24042336  cat > conftest.$ac_ext <<EOF
    2405 #line 2406 "configure"
     2337#line 2338 "configure"
    24062338#include "confdefs.h"
    24072339#include <alloca.h>
     
    24112343; return 0; }
    24122344EOF
    2413 if { (eval echo configure:2414: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     2345if { (eval echo configure:2346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
    24142346  rm -rf conftest*
    24152347  ac_cv_header_alloca_h=yes
     
    24352367else
    24362368  cat > conftest.$ac_ext <<EOF
    2437 #line 2438 "configure"
     2369#line 2370 "configure"
    24382370#include "confdefs.h"
    24392371
     
    24592391; return 0; }
    24602392EOF
    2461 if { (eval echo configure:2462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     2393if { (eval echo configure:2394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
    24622394  rm -rf conftest*
    24632395  ac_cv_func_alloca=yes
     
    24942426else
    24952427  cat > conftest.$ac_ext <<EOF
    2496 #line 2497 "configure"
     2428#line 2429 "configure"
    24972429#include "confdefs.h"
    24982430#if defined(CRAY) && ! defined(CRAY2)
     
    25232455else
    25242456  cat > conftest.$ac_ext <<EOF
    2525 #line 2526 "configure"
     2457#line 2458 "configure"
    25262458#include "confdefs.h"
    25272459/* System header to define __stub macros and hopefully few prototypes,
     
    25452477; return 0; }
    25462478EOF
    2547 if { (eval echo configure:2548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     2479if { (eval echo configure:2480: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
    25482480  rm -rf conftest*
    25492481  eval "ac_cv_func_$ac_func=yes"
     
    25772509else
    25782510cat > conftest.$ac_ext <<EOF
    2579 #line 2580 "configure"
     2511#line 2512 "configure"
    25802512#include "confdefs.h"
    25812513find_stack_direction ()
     
    25962528}
    25972529EOF
    2598 { (eval echo configure:2599: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
     2530{ (eval echo configure:2531: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
    25992531if test -s conftest && (./conftest; exit) 2>/dev/null; then
    26002532  ac_cv_c_stack_direction=1
     
    26202552    ac_pattern="Autoconf.*'x'"
    26212553  cat > conftest.$ac_ext <<EOF
    2622 #line 2623 "configure"
     2554#line 2555 "configure"
    26232555#include "confdefs.h"
    26242556#include <sgtty.h>
     
    26382570  if test $ac_cv_prog_gcc_traditional = no; then
    26392571    cat > conftest.$ac_ext <<EOF
    2640 #line 2641 "configure"
     2572#line 2573 "configure"
    26412573#include "confdefs.h"
    26422574#include <termio.h>
     
    26662598else
    26672599  cat > conftest.$ac_ext <<EOF
    2668 #line 2669 "configure"
     2600#line 2601 "configure"
    26692601#include "confdefs.h"
    26702602/* System header to define __stub macros and hopefully few prototypes,
     
    26882620; return 0; }
    26892621EOF
    2690 if { (eval echo configure:2691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     2622if { (eval echo configure:2623: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
    26912623  rm -rf conftest*
    26922624  eval "ac_cv_func_$ac_func=yes"
     
    27182650else
    27192651cat > conftest.$ac_ext <<EOF
    2720 #line 2721 "configure"
     2652#line 2653 "configure"
    27212653#include "confdefs.h"
    27222654
     
    27872719
    27882720EOF
    2789 { (eval echo configure:2790: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
     2721{ (eval echo configure:2722: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
    27902722if test -s conftest && (./conftest; exit) 2>/dev/null; then
    27912723  ac_cv_func_mmap=yes
     
    28102742else
    28112743  cat > conftest.$ac_ext <<EOF
    2812 #line 2813 "configure"
     2744#line 2745 "configure"
    28132745#include "confdefs.h"
    28142746#include <sys/types.h>
     
    28282760; return 0; }
    28292761EOF
    2830 if { (eval echo configure:2831: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     2762if { (eval echo configure:2763: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    28312763  rm -rf conftest*
    28322764  ac_cv_type_signal=void
     
    28502782else
    28512783  cat > conftest.$ac_ext <<EOF
    2852 #line 2853 "configure"
     2784#line 2785 "configure"
    28532785#include "confdefs.h"
    28542786/* System header to define __stub macros and hopefully few prototypes,
     
    28722804; return 0; }
    28732805EOF
    2874 if { (eval echo configure:2875: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     2806if { (eval echo configure:2807: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
    28752807  rm -rf conftest*
    28762808  eval "ac_cv_func_vprintf=yes"
     
    28982830else
    28992831  cat > conftest.$ac_ext <<EOF
    2900 #line 2901 "configure"
     2832#line 2833 "configure"
    29012833#include "confdefs.h"
    29022834/* System header to define __stub macros and hopefully few prototypes,
     
    29202852; return 0; }
    29212853EOF
    2922 if { (eval echo configure:2923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     2854if { (eval echo configure:2855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
    29232855  rm -rf conftest*
    29242856  eval "ac_cv_func__doprnt=yes"
     
    29492881else
    29502882  cat > conftest.$ac_ext <<EOF
    2951 #line 2952 "configure"
     2883#line 2884 "configure"
    29522884#include "confdefs.h"
    29532885/* System header to define __stub macros and hopefully few prototypes,
     
    29712903; return 0; }
    29722904EOF
    2973 if { (eval echo configure:2974: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     2905if { (eval echo configure:2906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
    29742906  rm -rf conftest*
    29752907  eval "ac_cv_func_$ac_func=yes"
     
    30032935else
    30042936cat > conftest.$ac_ext <<EOF
    3005 #line 3006 "configure"
     2937#line 2938 "configure"
    30062938#include "confdefs.h"
    30072939 int main() { if (-2 >> 1 == -1) exit(0); else exit(1); }
    30082940EOF
    3009 { (eval echo configure:3010: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
     2941{ (eval echo configure:2942: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
    30102942if test -s conftest && (./conftest; exit) 2>/dev/null; then
    30112943  ac_cv_shift=yes
     
    30332965else
    30342966cat > conftest.$ac_ext <<EOF
    3035 #line 3036 "configure"
     2967#line 2968 "configure"
    30362968#include "confdefs.h"
    30372969 int main() {if (sizeof(int) == 4)  exit(0); else exit(1); }
    30382970EOF
    3039 { (eval echo configure:3040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
     2971{ (eval echo configure:2972: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
    30402972if test -s conftest && (./conftest; exit) 2>/dev/null; then
    30412973  ac_cv_sizeof_int_equals_four=yes
     
    30632995else
    30642996cat > conftest.$ac_ext <<EOF
    3065 #line 3066 "configure"
     2997#line 2998 "configure"
    30662998#include "confdefs.h"
    30672999 int main() {if (sizeof(long) == sizeof(void*))  exit(0); else exit(1); }
    30683000EOF
    3069 { (eval echo configure:3070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
     3001{ (eval echo configure:3002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
    30703002if test -s conftest && (./conftest; exit) 2>/dev/null; then
    30713003  ac_cv_sizeof_long_equals_voidp=yes
     
    30923024else
    30933025cat > conftest.$ac_ext <<EOF
    3094 #line 3095 "configure"
     3026#line 3027 "configure"
    30953027#include "confdefs.h"
    30963028#include <stdio.h>
    30973029 main() { char *str=(char*)malloc(20); if (((int) sprintf(str,"123456789")) == 9) exit(0); else exit(1); }
    30983030EOF
    3099 { (eval echo configure:3100: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
     3031{ (eval echo configure:3032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
    31003032if test -s conftest && (./conftest; exit) 2>/dev/null; then
    31013033  ac_cv_returns_n_of_chars=yes
     
    31253057else
    31263058cat > conftest.$ac_ext <<EOF
    3127 #line 3128 "configure"
     3059#line 3060 "configure"
    31283060#include "confdefs.h"
    31293061#include <stdio.h>
     
    31363068}
    31373069EOF
    3138 { (eval echo configure:3139: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
     3070{ (eval echo configure:3071: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
    31393071if test -s conftest && (./conftest; exit) 2>/dev/null; then
    31403072  ac_cv_sizeof_voidp=`cat conftestval`
     
    31583090else
    31593091  cat > conftest.$ac_ext <<EOF
    3160 #line 3161 "configure"
     3092#line 3093 "configure"
    31613093#include "confdefs.h"
    31623094#ifdef _AIX
     
    33343266s%@WITH_LIBFAC@%$WITH_LIBFAC%g
    33353267s%@NEED_LIBS@%$NEED_LIBS%g
     3268s%@WITH_DBM@%$WITH_DBM%g
    33363269s%@ALLOCA@%$ALLOCA%g
    33373270s%@CXXTEMPLFLAGS@%$CXXTEMPLFLAGS%g
  • Singular/configure.in

    rc56606 r92e539  
    171171fi
    172172 
    173 dnl Check dbm
    174 if test "$with_dbm" != no; then
    175   AC_CHECK_LIB(
    176     dbm,
    177     dbminit,
    178     AC_DEFINE(HAVE_DBM) LIBS="-ldbm $LIBS",
    179     AC_CHECK_LIB(
    180       gdbm,
    181       dbminit,
    182       AC_DEFINE(HAVE_DBM) LIBS="-lgdbm $LIBS",
    183       AC_MSG_WARN(building without dbm: disabling DBM links)))
    184 fi
    185 
    186173dnl Check dld
    187174if test "$with_dld" = yes; then
     
    364351
    365352AC_CHECK_HEADERS(sys/file.h sys/ioctl.h sys/time.h sys/times.h)
     353
     354dnl Check dbm
     355WITH_DBM=no
     356AC_MSG_CHECKING(whether to build with dbm links)
     357if test "$with_dbm" != no; then
     358  AC_DEFINE(HAVE_DBM)
     359  WITH_DBM=yes
     360  AC_SUBST(WITH_DBM)
     361  AC_MSG_RESULT(yes)
     362else
     363  AC_MSG_RESULT(no)
     364fi
    366365
    367366dnl
  • Singular/extra.cc

    rc56606 r92e539  
    22*  Computer Algebra System SINGULAR      *
    33*****************************************/
    4 /* $Id: extra.cc,v 1.17 1997-08-05 13:04:02 Singular Exp $ */
     4/* $Id: extra.cc,v 1.18 1997-08-08 12:59:20 obachman Exp $ */
    55/*
    66* ABSTRACT: general interface to internals of Singular ("system" command)
     
    485485    {
    486486      MP_Link_pt rlink = (MP_Link_pt) ((si_link) h->next->Data())->data;
    487 //      MP_Link_pt wlink = (MP_Link_pt) ((si_link) h->next->next->Data())->data;
     487      MP_Link_pt wlink;
     488     
    488489      MPT_Tree_pt tree1 = NULL, tree2;
    489490
     
    509510      MPT_Tree_pt var_tree;
    510511      MP_Common_t ordering;
    511       MPT_IsDDPTree(tree1, &ch, &var_tree, &ordering);
    512       MPT_CpyTree(&tree2, tree1);
     512//      MPT_IsDDPTree(tree1, &ch, &var_tree, &ordering);
     513//      MPT_CpyTree(&tree2, tree1);
    513514      tree1 = MPT_DDP_2_ExpTree(tree1);
     515      tree1 = MPT_UntypespecTree(tree1);
     516
     517      if (h->next->next != NULL)
     518      {
     519        wlink = (MP_Link_pt) ((si_link) h->next->next->Data())->data;
     520        MP_ResetLink(wlink);
     521        if (MPT_PutTree(wlink, tree1) != MPT_Success)
     522        {
     523          Werror("PutTree failed \n");
     524          return TRUE;
     525        }
     526        MP_EndMsg(wlink);
     527      }
    514528      MPT_DeleteTree(tree1);
     529       
    515530      return FALSE;
    516531    }
  • Singular/longrat.cc

    rc56606 r92e539  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: longrat.cc,v 1.9 1997-06-11 08:00:09 obachman Exp $ */
     4/* $Id: longrat.cc,v 1.10 1997-08-08 12:59:22 obachman Exp $ */
    55/*
    66* ABSTRACT: computation with long rational numbers (Hubert Grassmann)
     
    243243#endif
    244244  return n;
     245}
     246
     247
     248number nlInit (number u)
     249{
     250  if (u->s == 3 && mpz_size1(&u->z)<=MP_SMALL)
     251  {
     252    int ui=(int)mpz_get_si(&u->z);
     253    if ((((ui<<3)>>3)==ui)
     254        && (mpz_cmp_si(&u->z,(long)ui)==0))
     255    {
     256      mpz_clear(&u->z);
     257      Free((ADDRESS)u,sizeof(rnumber));
     258      return INT_TO_SR(ui);
     259    }
     260  }
     261  return u;
    245262}
    246263
  • Singular/longrat.h

    rc56606 r92e539  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: longrat.h,v 1.6 1997-06-11 08:00:10 obachman Exp $ */
     6/* $Id: longrat.h,v 1.7 1997-08-08 12:59:24 obachman Exp $ */
    77/*
    88* ABSTRACT: computation with long rational numbers
     
    6565void     nlNew(number *r);
    6666number   nlInit(int i);
     67number   nlInit(number i);
    6768int      nlInt(number &n);
    6869BOOLEAN  nlIsZero(number za);
  • Singular/mpsr.h

    rc56606 r92e539  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: mpsr.h,v 1.6 1997-07-11 11:10:08 obachman Exp $ */
     4/* $Id: mpsr.h,v 1.7 1997-08-08 12:59:25 obachman Exp $ */
    55/***************************************************************
    66 *
     
    168168  if (x != MPT_Success)                                              \
    169169  {                                                                 \
    170     Werror("mpr_failr violation in %s line %d:",__FILE__, __LINE__); \
     170    Werror("mpt_failr violation in %s line %d:",__FILE__, __LINE__); \
    171171    return mpsr_SetError(mpsr_MPT_Failure);                           \
    172172  }                                                                 \
  • Singular/mpsr_Get.cc

    rc56606 r92e539  
    33****************************************/
    44
    5 /* $Id: mpsr_Get.cc,v 1.12 1997-07-16 07:51:29 obachman Exp $ */
     5/* $Id: mpsr_Get.cc,v 1.13 1997-08-08 12:59:26 obachman Exp $ */
    66/***************************************************************
    77 *
     
    175175  n->s = 3;
    176176  memcpy(&(n->z), apint, sizeof(MP_INT));
     177  n = nlInit(n);
    177178  Free(apint, sizeof(MP_INT));
    178179  mlv->lv = mpsr_InitLeftv(NUMBER_CMD, n);
     
    693694 
    694695static mpsr_Status_t GetCopCommandLeftv(MP_Link_pt link, MPT_Node_pt node,
    695                                       mpsr_leftv mlv, short quote)
     696                                        mpsr_leftv mlv, short quote)
    696697{
    697698  short tok;
     
    703704  failr(mpsr_mp2tok(node->dict, MP_COMMON_T(node->nvalue), &tok));
    704705
    705   if ((typespec = MPT_GetProtoTypespec(node)) && MPT_IsTrueProtoTypeSpec(typespec))
     706  if ((typespec = MPT_GetProtoTypespec(node)) &&
     707      MPT_IsTrueProtoTypeSpec(typespec))
    706708    return mpsr_SetError(mpsr_CanNotHandlePrototype);
    707709
     
    724726  cmd->argc = nc;
    725727
    726   if (nc >= 1)
     728  // check that associative operators are binary
     729  if (nc > 2 && (tok == '+' || tok == '*'))
     730  {
     731    leftv lv = mlv->lv, lv2;
     732    command c = cmd, c2;
     733
     734    for (i=2; i<nc; i++)
     735    {
     736      c->op = tok;
     737      c->argc = 2;
     738      memcpy(&(c->arg1), lv, sizeof(sleftv));
     739      c->arg1.next = NULL;
     740
     741      c2 = (command) Alloc0(sizeof(sip_command));
     742      c->arg2.data = (void *) c2;
     743      c->arg2.rtyp = COMMAND;
     744      c = c2;
     745      lv2 = lv->next;
     746      Free(lv, sizeof(sleftv));
     747      lv = lv2;
     748    }
     749    c->op = tok;
     750    c->argc = 2;
     751    memcpy(&(c->arg1), lv, sizeof(sleftv));
     752    c->arg1.next = NULL;
     753    memcpy(&(c->arg2), lv->next, sizeof(sleftv));
     754    Free(lv->next, sizeof(sleftv));
     755    Free(lv, sizeof(sleftv));
     756  }
     757  else if (nc >= 1)
    727758  {
    728759    memcpy(&(cmd->arg1), mlv->lv, sizeof(sleftv));
     
    745776    Free(mlv->lv, sizeof(sleftv));
    746777  }
    747   else
    748   {
     778
     779  // Now we perform some tree manipulations
     780  if (nc == 0 && tok == LIST_CMD)
    749781    // Here we work around a Singular bug: It can not handle lists of 0 args
    750782    // so we construct them explicitely
    751     if (tok == LIST_CMD)
    752     {
    753       lists l = (lists) Alloc(sizeof(slists));
    754       l->Init(0);
    755       mlv->lv = mpsr_InitLeftv(LIST_CMD, (void *) l);
    756       return mpsr_Success;
    757     }
    758   }
    759 
     783  {
     784    lists l = (lists) Alloc(sizeof(slists));
     785    l->Init(0);
     786    mlv->lv = mpsr_InitLeftv(LIST_CMD, (void *) l);
     787    return mpsr_Success;
     788  }
    760789  mlv->lv = mpsr_InitLeftv(COMMAND, (void *) cmd);
    761790  return mpsr_Success;
  • Singular/mpsr_GetPoly.cc

    rc56606 r92e539  
    33****************************************/
    44
    5 /* $Id: mpsr_GetPoly.cc,v 1.8 1997-06-30 17:04:46 obachman Exp $ */
     5/* $Id: mpsr_GetPoly.cc,v 1.9 1997-08-08 12:59:27 obachman Exp $ */
    66
    77/***************************************************************
     
    241241  {
    242242    mpz_ptr gnum;
    243     *x =  (number) Alloc0(sizeof(rnumber));
    244     y = (number) *x;
     243    y =  (number) Alloc0(sizeof(rnumber));
    245244    y->s = 3;
    246245    gnum = &(y->z);
    247246    mpz_init(gnum);
    248247    mp_failr(IMP_MyGetApInt(link, (MP_ApInt_t *) &gnum));
     248    *x = nlInit(y);
    249249  }
    250250  // fraction of numbers
  • Singular/sing_dbm.cc

    rc56606 r92e539  
    33****************************************/
    44
    5 //**************************************************************************
     5//**************************************************************************/
    66//
    7 // $Id: sing_dbm.cc,v 1.4 1997-04-09 12:20:09 Singular Exp $
     7// $Id: sing_dbm.cc,v 1.5 1997-08-08 12:59:30 obachman Exp $
    88//
    9 //**************************************************************************
     9//**************************************************************************/
    1010//  'sing_dbm.cc' containes command to handle dbm-files under
    11 // Singular. Don't forget to compile Singular with the option -ldbm
     11// Singular.
    1212//
    13 //**************************************************************************
     13//**************************************************************************/
    1414
    1515#include "mod2.h"
     
    1717#ifdef HAVE_DBM
    1818
    19 #include <stdio.h>
    20 #include <fcntl.h>
    21 #include <errno.h>
    22 #include "tok.h"
    23 #include "febase.h"
    24 #include "mmemory.h"
    25 #include "ipid.h"
    26 #include "silink.h"
    27 #include "sing_dbm.h"
    28 
    29 
    30 static BOOLEAN dbOpened = FALSE;
    31 
    32 /* The data and key structure.  This structure is defined for compatibility. */
     19#  include <stdio.h>
     20#  include <fcntl.h>
     21#  include <errno.h>
     22#  include "tok.h"
     23#  include "febase.h"
     24#  include "mmemory.h"
     25#  include "ipid.h"
     26#  include "silink.h"
     27#  include "sing_dbm.h"
     28
     29/* These are the routines in dbm. */
     30#  include "ndbm.h"
    3331typedef struct {
    34         char *dptr;
    35         int   dsize;
    36 } datum;
    37 
    38 
    39 /* These are the routines in dbm. */
    40 
    41 
    42 extern "C" {
    43 extern int dbminit(const char *__file);
    44 extern int store(datum __key, datum __content);
    45 extern datum fetch(datum);
    46 extern datum firstkey(void);
    47 extern datum nextkey(datum);
    48 }
     32  DBM *db;        // pointer to open database
     33  int first;      // firstkey to look for?
     34} DBM_info;
    4935
    5036//extern char *getenv(char *var);
    5137extern char *index(char *str, char c);
    5238
    53 //**************************************************************************
     39//**************************************************************************/
    5440BOOLEAN dbOpen(si_link l, short flag)
    5541{
    56   if((flag==SI_LINK_OPEN)
    57   || (flag==SI_LINK_READ)
    58   || (flag==SI_LINK_WRITE))
    59   {
    60     if (!dbOpened)
    61     {
    62       if(dbminit(l->name) == 0)
    63       {
    64         dbOpened=TRUE;
    65         SI_LINK_SET_RW_OPEN_P(l);
    66         l->data=NULL;
    67         FreeL(l->mode);
    68         l->mode=mstrdup("rw");
    69         return FALSE;
    70       }
    71       Werror("dbminit of `%s` failed",l->name);
    72     }
    73     else
    74       Werror("only one DBM link allowed:`%s`",l->name);
     42  char *mode = "r";
     43  DBM_info *db;
     44  int dbm_flags = O_RDONLY | O_CREAT;  // open database readonly as default
     45
     46  if((flag & SI_LINK_OPEN)
     47  || (flag & SI_LINK_READ)
     48  || (flag & SI_LINK_WRITE)) {
     49    if (l->mode[0] == '\0' || (strcmp(l->mode, "r") == 0))
     50      flag = SI_LINK_READ;
     51    else flag = SI_LINK_READ | SI_LINK_WRITE;
     52  }
     53
     54  if((flag & SI_LINK_READ) || (flag & SI_LINK_WRITE)) {
     55    if( l->data == NULL ) {
     56      if ((db = (DBM_info *)malloc(sizeof *db)) == 0) {
     57        errno = ENOMEM;
     58        return TRUE;
     59      }
     60      if( flag & SI_LINK_WRITE ) {
     61        dbm_flags = O_RDWR | O_CREAT;
     62        mode = "rw";
     63      }
     64      if( (db->db = dbm_open(l->name, dbm_flags, 0664 )) != NULL ) {
     65        db->first=1;
     66        if(flag & SI_LINK_WRITE) SI_LINK_SET_RW_OPEN_P(l);
     67        else SI_LINK_SET_R_OPEN_P(l);
     68        l->data=(void *)(db);
     69        FreeL(l->mode);
     70        l->mode=mstrdup(mode);
     71        return FALSE;
     72      }
     73      Werror("dbm_open of `%s` failed",l->name);
     74    }
    7575  }
    7676  return TRUE;
    7777}
    7878
    79 //**************************************************************************
     79//**************************************************************************/
    8080BOOLEAN dbClose(si_link l)
    8181{
    82   dbOpened=FALSE;
     82  DBM_info *db = l->data;
     83
     84  dbm_close(db->db);
     85  free(db);
     86  l->data=NULL; 
    8387  SI_LINK_SET_CLOSE_P(l);
    8488  return FALSE;
    8589}
    8690
    87 //**************************************************************************
     91//**************************************************************************/
    8892static datum d_value;
    8993leftv dbRead2(si_link l, leftv key)
    9094{
     95  DBM_info *db = l->data;
    9196  leftv v=NULL;
    92   if(dbOpened)
    93   {
     97  if(l->data != NULL) {
    9498    datum d_key;
    9599
     
    100104        d_key.dptr = (char*)key->Data();
    101105        d_key.dsize = strlen(d_key.dptr)+1;
    102         d_value = fetch(d_key);
     106        d_value = dbm_fetch(db->db, d_key);
    103107        v=(leftv)Alloc0(sizeof(sleftv));
    104108        if (d_value.dptr!=NULL) v->data=mstrdup(d_value.dptr);
     
    111115      }
    112116    }
    113     else
    114     {
    115       if (l->data==NULL)
    116       {
    117         d_value = firstkey();
    118         l->data=(void *)&d_value;
    119       }
    120       else
    121       {
    122         d_value = nextkey(*(datum *)l->data);
    123       }
     117    else {
     118      if(db->first) d_value = dbm_firstkey((DBM *)db->db);
     119      else d_value = dbm_nextkey((DBM *)db->db);
     120
    124121      v=(leftv)Alloc0(sizeof(sleftv));
    125122      v->rtyp=STRING_CMD;
    126       if (d_value.dptr!=NULL) v->data=mstrdup(d_value.dptr);
    127       else                    v->data=mstrdup("");
     123      if (d_value.dptr!=NULL) {
     124        v->data=mstrdup(d_value.dptr);
     125        db->first = 0;
     126      }
     127      else {
     128        v->data=mstrdup("");
     129        db->first = 1;
     130      }
     131
    128132    }
    129133  }
     
    138142  return dbRead2(l,NULL);
    139143}
    140 //**************************************************************************
     144//**************************************************************************/
    141145BOOLEAN dbWrite(si_link l, leftv key)
    142146{
     147  DBM_info *db = l->data;
    143148  BOOLEAN b=TRUE;
    144 
    145   if(dbOpened)
    146   {
    147     if((key!=NULL)
    148     && (key->Typ()==STRING_CMD)
    149     && (key->next!=NULL)
    150     && (key->next->Typ()==STRING_CMD))
    151     {
    152       datum d_key, d_value;
    153       d_key.dptr = (char *)key->Data();
    154       d_key.dsize = strlen(d_key.dptr)+1;
    155       d_value.dptr = (char *)key->next->Data();
    156       d_value.dsize = strlen(d_value.dptr)+1;
    157       store(d_key, d_value);
    158       b=FALSE;
    159     }
    160     else
    161     {
     149  register int ret;
     150
     151  if(l->data != NULL) {                      // is database opened ?
     152    if((key!=NULL) && (key->Typ()==STRING_CMD) ) {
     153      if (key->next!=NULL) {                 // have a second parameter ?
     154        if(key->next->Typ()==STRING_CMD) {   // replace (key,value)
     155          datum d_key, d_value;
     156
     157          d_key.dptr = (char *)key->Data();
     158          d_key.dsize = strlen(d_key.dptr)+1;
     159          d_value.dptr = (char *)key->next->Data();
     160          d_value.dsize = strlen(d_value.dptr)+1;
     161          ret  = dbm_store(db->db, d_key, d_value, DBM_REPLACE);
     162          if(!ret ) b=FALSE;
     163          else {
     164            if(dbm_error(db->db)) {
     165              Werror("DBM link I/O error. is '%s' readonly?", l->name);
     166              dbm_clearerr(db->db);
     167            }
     168          }
     169        }
     170      } else {                               // delete (key)
     171        datum d_key;
     172
     173        d_key.dptr = (char *)key->Data();
     174        d_key.dsize = strlen(d_key.dptr)+1;
     175        dbm_delete(db->db, d_key);
     176        b=FALSE;
     177      }
     178    } else {
    162179      WerrorS("write(`DBM link`,`key string`,`data string`) expected");
    163180    }
     
    169186  return b;
    170187}
    171 //**************************************************************************
     188//**************************************************************************/
    172189char *dbStatus(si_link l, char *request)
    173190{
    174   if ((strcmp(request, "read") == 0)
    175   ||  (strcmp(request, "write") == 0))
    176   {
    177     if (SI_LINK_RW_OPEN_P(l)) return "ready";
    178     else                      return "not ready";
     191  if (strcmp(request, "read") == 0)
     192  {
     193    if (SI_LINK_R_OPEN_P(l)) return "ready";
     194    else return "not ready";
     195  }
     196  else if (strcmp(request, "write") == 0)
     197  {
     198    if (SI_LINK_W_OPEN_P(l)) return "ready";
     199    else return "not ready";
    179200  }
    180201  else return "unknown status request";
    181202}
    182 //**************************************************************************
     203//**************************************************************************/
    183204si_link_extension slInitDBMExtension(si_link_extension s)
    184205{
     
    194215  return s;
    195216}
    196 #endif
     217#endif /* HAVE_DBM */
Note: See TracChangeset for help on using the changeset viewer.