Changeset e56c23 in git


Ignore:
Timestamp:
Sep 30, 1999, 4:09:40 PM (25 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
e932fe2d2234f4a4bd69be155f7e58b510ff7c5b
Parents:
3cb555afe6eee925f6dc7b33a2de1a6fbdcd0185
Message:
* bug fixes


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

Legend:

Unmodified
Added
Removed
  • Singular/Makefile.in

    r3cb555 re56c23  
    417417CXXFLAGSB       = -g -O3 ${PIPE}
    418418CXXTEMPLFLAGSB  = -fno-implicit-templates
    419 DEFSB           = -D@SING_UNAME@
     419DEFSB           = -D@SING_UNAME@ -DNDEBUG
    420420LDFLAGSB        = -static @LDFLAGS@
    421421# bprof object  file to link with
     
    424424
    425425##
    426 ## .op files for gprof
    427 ##
    428 
    429 OBJP1=  grammar.op scanner.op matpol.op binom.op gnumpfl.op mpr_complex.op \
    430      febase.op feread.op fehelp.op feResource.op timer.op intvec.op attrib.op lists.op \
    431      gnumpc.op longrat.op longrat0.op misc.op ring.op numbers.op maps.op\
    432      hilb.op comm.op kstd1.op kstd2.op kutil.op khstd.op kstdfac.op modulop.op \
    433      ideals.op subexpr.op hdegree.op hutil.op ffields.op shortfl.op \
    434      longalg.op kspoly.op syz.op syz0.op syz1.op weight.op \
    435      ipid.op ipshell.op iplib.op ipassign.op ipconv.op ipprint.op\
    436      polys.op polys0.op polys1.op polys-impl.op extra.op\
    437      mminit.op sing_dld.op sing_dbm.op silink.op sparsmat.op\
    438      sing_mp.op fglm.op fglmzero.op fglmvec.op fglmgauss.op fglmhom.op\
    439      algmap.op clapconv.op  clapmem.op clapsing.op \
    440      cntrlc.op  sdb.op\
    441      mpsr_Error.op mpsr_Put.op mpsr_PutPoly.op mpsr_GetPoly.op \
    442      mpsr_Get.op mpsr_GetMisc.op \
    443      ndbm.op libparse.op  mod_raw.op \
    444      mpr_inout.op mpr_base.op mpr_numeric.op \
    445      GMPrat.op multicnt.op npolygon.op semic.op spectrum.op splist.op \
    446      pcv.op kbuckets.op
    447 
    448 OBJP2= mmalloc.op mmheap.op mmpage.op mmcheck.op mmbt.op page.op \
    449      mmisc.op mmtables.op weight0.op find_exec.op getopt.op fereadl.op
    450 
    451 OBJP=$(OBJP1) $(OBJP2) claptmpl.op
    452 
    453 ##
    454 ## .ob files for bprof
    455 ##
    456 
    457 OBJB1=  grammar.ob scanner.ob matpol.ob binom.ob\
    458      febase.ob feread.ob timer.ob intvec.ob attrib.ob lists.ob\
    459      longrat.ob longrat0.ob misc.ob ring.ob numbers.ob maps.ob\
    460      hilb.ob comm.ob kstd1.ob kstd2.ob kutil.ob khstd.ob kstdfac.ob modulop.ob \
    461      spolys.ob ideals.ob subexpr.ob hdegree.ob hutil.ob ffields.ob shortfl.ob \
    462      longalg.ob kspoly.ob syz.ob syz0.ob syz1.ob weight.ob \
    463      ipid.ob ipshell.ob iplib.ob ipassign.ob ipconv.ob ipprint.ob\
    464      polys.ob polys0.ob polys1.ob polys-impl.ob extra.ob\
    465      mminit.ob sing_dld.ob sing_dbm.ob silink.ob \
    466      sing_mp.ob fglm.ob fglmzero.ob fglmvec.ob fglmgauss.ob fglmhom.ob\
    467      algmap.ob clapconv.ob  clapmem.ob clapsing.ob \
    468      cntrlc.ob  \
    469      mpsr_Error.ob mpsr_Put.ob mpsr_PutPoly.ob mpsr_GetPoly.ob \
    470      mpsr_Get.ob mpsr_GetMisc.ob \
    471      ndbm.ob libparse.ob mod-${SINGUNAME}.ob \
    472      pcv.ob kbuckets.ob
    473 
    474 OBJB2= mmalloc.ob mmheap.ob mmpage.ob mmcheck.ob mmbt.ob page.ob\
    475      mmisc.ob mmtables.ob weight0.ob find_exec.ob getopt.ob fereadl.ob
    476 
    477 OBJB=$(OBJB1) $(OBJB2) claptmpl.ob
     426## .op and ob files for gprof and bprof
     427##
     428
     429OBJP1 := $(CXXSOURCES:.cc=.op)
     430OBJP2 := $(CSOURCES:.c=.op)
     431OBJP=$(OBJP1) $(OBJP2)
     432
     433OBJB1 := $(CXXSOURCES:.cc=.ob)
     434OBJB2 := $(CSOURCES:.c=.ob)
     435OBJB=$(OBJB1) $(OBJB2)
     436
    478437
    479438##
     
    491450        $(CCP)  ${CFLAGSP} ${CPPFLAGS} ${DEFSP} -c $< -o $@
    492451
    493 Singularp: scanner.cc  gmalloc.op $(OBJP) iparith.op mpsr_Tok.op tesths.cc version.h
     452Singularp: scanner.cc  gmalloc.op $(OBJP) iparith.op mpsr_Tok.op claptmpl.op tesths.cc version.h
    494453        $(CXXP) ${CXXFLAGSP} ${CPPFLAGS} ${DEFSP} -o Singularp \
    495454        tesths.cc iparith.op mpsr_Tok.op $(OBJP) ${LDFLAGSP} ${LIBS} \
     
    502461        $(CXXP) ${CXXFLAGSP} ${CPPFLAGS} ${DEFSP} -c mpsr_Tok.cc -o mpsr_Tok.op
    503462
    504 ## for pbrof
     463
     464## for bprof
    505465claptmpl.ob: claptmpl.cc mod2.h
    506         $(CXXP)  ${CXXFLAGSB} ${CPPFLAGS} ${DEFSB} -c $< -o $@
     466        $(CXXP)  ${CXXFLAGSP} ${CPPFLAGS} ${DEFSB} -c $< -o $@
    507467
    508468$(OBJB1): %.ob: %.cc
    509         $(CXXP) ${CXXFLAGSB} ${CXXTEMPLFLAGSB} ${CPPFLAGS} ${DEFSB} -c $< -o $@
     469        $(CXXP) ${CXXFLAGSP} ${CXXTEMPLFLAGSP} ${CPPFLAGS} ${DEFSB} -c $< -o $@
    510470
    511471$(OBJB2) gmalloc.ob: %.ob: %.c
    512         $(CCP)  ${CFLAGSB} ${CPPFLAGS} ${DEFSB} -c $< -o $@
     472        $(CCP)  ${CFLAGSP} ${CPPFLAGS} ${DEFSB} -c $< -o $@
     473
     474Singularb: scanner.cc  gmalloc.ob $(OBJB) iparith.ob mpsr_Tok.ob claptmpl.ob tesths.cc version.h
     475        $(CXXP) ${CXXFLAGSP} ${CPPFLAGS} ${DEFSB} -o Singularb \
     476        tesths.cc iparith.ob mpsr_Tok.ob $(OBJB) $(BPROFOBJ) \
     477        ${LDFLAGSP} ${LIBS} ${LD_DYN_FLAGS} gmalloc.ob
    513478
    514479iparith.ob: iparith.inc iparith.cc
    515         $(CXXP)  ${CXXFLAGSB} ${CPPFLAGS} ${DEFSB} -c iparith.cc -o iparith.ob
    516 
    517 ## for brof
    518 
    519 Singularb: scanner.cc gmalloc.og $(OBJG) iparith.op mpsr_Tok.op tesths.cc version.h
    520         $(CXXG) ${CXXFLAGSB} ${CPPFLAGS} ${DEFSG} ${DEFSB} -o Singularb \
    521         tesths.cc iparith.og mpsr_Tok.og $(OBJG)  $(BPROFOBJ) \
    522         ${LDFLAGSB} ${LD_DYN_FLAGS} ${LIBS} gmalloc.og
    523 
    524 installp: Singularp
    525         ${MKINSTALLDIRS} ${bindir}
    526         ${INSTALL_PROGRAM} Singularp ${bindir} 
    527 
     480        $(CXXP)  ${CXXFLAGSP} ${CPPFLAGS} ${DEFSB} -c iparith.cc -o iparith.ob
     481
     482mpsr_Tok.ob: iparith.inc mpsr_Tok.cc
     483        $(CXXP) ${CXXFLAGSP} ${CPPFLAGS} ${DEFSB} -c mpsr_Tok.cc -o mpsr_Tok.ob
    528484
    529485##
  • Singular/kspoly.cc

    r3cb555 re56c23  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kspoly.cc,v 1.1 1999-09-29 10:59:29 obachman Exp $ */
     4/* $Id: kspoly.cc,v 1.2 1999-09-30 14:09:34 obachman Exp $ */
    55/*
    66*  ABSTRACT -  Routines for Spoly creation and reductions
     
    1919#define assume(x)
    2020#endif
     21
    2122
    2223/***************************************************************
     
    3839  assume(p2 != NULL && p1 != NULL && pDivisibleBy(p2,  p1));
    3940  poly a2 = pNext(p2), lm = p1;
    40  
    4141
    4242  p1 = pNext(p1);
     
    151151  a2 = p_Mult_m(a2, m2, spNoether);
    152152
    153   int l2;
    154153  // and, finally, the spoly
    155154  Pair->p = p_Minus_m_Mult_q(a2, m1, a1, spNoether);
     
    170169    }
    171170  }
    172  
    173171}
    174172
     
    458456}
    459457
     458#if 0
     459void ksOldSpolyTail(poly p1, poly q, poly q2, poly spNoether)
     460{
     461  LObject L;
     462  TObject T;
     463
     464  L.p = q;
     465  T.p = p1;
     466 
     467  ksSpolyTail(&L, &T, q2, spNoether);
     468  return;
     469}
     470
     471
     472#else
    460473 
    461474/*2
     
    491504    m = pHead0(p2);
    492505    pSetCoeff0(m,bn);
    493     a2 = pCopy(a2);
    494506  }
    495507  if ((ct == 0) || (ct == 2))
     
    529541}
    530542
    531          
    532 
    533  
    534  
     543#endif         
     544
     545 
     546 
  • Singular/kstd2.cc

    r3cb555 re56c23  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kstd2.cc,v 1.31 1999-09-29 17:03:33 obachman Exp $ */
     4/* $Id: kstd2.cc,v 1.32 1999-09-30 14:09:35 obachman Exp $ */
    55/*
    66*  ABSTRACT -  Kernel: alg. of Buchberger
     
    364364
    365365    // now we found one which is divisible
    366     ksReducePoly(h, &(strat->T[j]),
    367                  strat->kNoether);
    368     kTest(strat);
     366    ksReducePoly(h, &(strat->T[j]), strat->kNoether);
     367
    369368#ifdef KDEBUG
    370369    if (TEST_OPT_DEBUG)
     
    900899    if (strat->Ll== 0) strat->interpt=TRUE;
    901900    if (TEST_OPT_DEGBOUND
    902     && ((strat->honey && (strat->L[strat->Ll].ecart+pFDeg(strat->L[strat->Ll].p)>Kstd1_deg))
    903        || ((!strat->honey) && (pFDeg(strat->L[strat->Ll].p)>Kstd1_deg))))
     901        && ((strat->honey && (strat->L[strat->Ll].ecart+pFDeg(strat->L[strat->Ll].p)>Kstd1_deg))
     902            || ((!strat->honey) && (pFDeg(strat->L[strat->Ll].p)>Kstd1_deg))))
    904903    {
    905904      /*
    906       *stops computation if
    907       * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
    908       *a predefined number Kstd1_deg
    909       */
     905       *stops computation if
     906       * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
     907       *a predefined number Kstd1_deg
     908       */
    910909      while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
    911910      break;
     
    925924    if((strat->P.p1==NULL) && (strat->minim>0))
    926925      strat->P.p2=pCopy(strat->P.p);
    927     {
    928       if (strat->honey)
    929       {
    930         if (TEST_OPT_PROT) message(strat->P.ecart+pFDeg(strat->P.p),&olddeg,&reduc,strat);
    931       }
    932       else
    933       {
    934         if (TEST_OPT_PROT) message(pFDeg(strat->P.p),&olddeg,&reduc,strat);
    935       }
    936       /* reduction of the element choosen from L */
    937       strat->red(&strat->P,strat);
    938       pTest(strat->P.p);
    939     }
    940     kTest_TS(strat);
     926    if (strat->honey)
     927    {
     928      if (TEST_OPT_PROT) message(strat->P.ecart+pFDeg(strat->P.p),&olddeg,&reduc,strat);
     929    }
     930    else
     931    {
     932      if (TEST_OPT_PROT) message(pFDeg(strat->P.p),&olddeg,&reduc,strat);
     933    }
     934    /* reduction of the element choosen from L */
     935    kTest_Pref(strat);
     936    strat->red(&strat->P,strat);
    941937    if (strat->P.p != NULL)
    942938    {
    943           /* statistic */
    944           if (TEST_OPT_PROT) PrintS("s");
    945           /* enter P.p into s and L */
    946           {
    947             int pos=posInS(strat->S,strat->sl,strat->P.p);
     939      kTest(strat);
     940      /* statistic */
     941      if (TEST_OPT_PROT) PrintS("s");
     942      /* enter P.p into s and L */
     943      {
     944        int pos=posInS(strat->S,strat->sl,strat->P.p);
     945        {
     946          if (TEST_OPT_INTSTRATEGY)
     947          {
     948            if ((!TEST_OPT_MINRES)||(strat->syzComp==0)||(!strat->homog))
    948949            {
    949               if (TEST_OPT_INTSTRATEGY)
    950               {
    951                 if ((!TEST_OPT_MINRES)||(strat->syzComp==0)||(!strat->homog))
    952                 {
    953                   strat->P.p = redtailBba(strat->P.p,pos-1,strat);
    954                   //if (strat->redTailChange)
    955                     pCleardenom(strat->P.p);
    956                 }
    957               }
    958               else
    959               {
    960                 pNorm(strat->P.p);
    961                 if ((!TEST_OPT_MINRES)||(strat->syzComp==0)||(!strat->homog))
    962                 {
    963                   strat->P.p = redtailBba(strat->P.p,pos-1,strat);
    964                 }
    965               }
    966               if (TEST_OPT_DEBUG)
    967               {
    968                 PrintS("new s:");
    969                 wrp(strat->P.p);
    970                 PrintLn();
    971               }
    972               if((strat->P.p1==NULL) && (strat->minim>0))
    973               {
    974                 if (strat->minim==1)
    975                 {
    976                   strat->M->m[minimcnt]=pCopy(strat->P.p);
    977                   pDelete(&strat->P.p2);
    978                 }
    979                 else
    980                 {
    981                   strat->M->m[minimcnt]=strat->P.p2;
    982                   strat->P.p2=NULL;
    983                 }
    984                 minimcnt++;
    985               }
    986               enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat);
    987               if (strat->sl==-1) pos=0;
    988               else pos=posInS(strat->S,strat->sl,strat->P.p);
    989               strat->enterS(strat->P,pos,strat);
     950              strat->P.p = redtailBba(strat->P.p,pos-1,strat);
     951              //if (strat->redTailChange)
     952              pCleardenom(strat->P.p);
    990953            }
    991             if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
    992           }
    993           if (strat->P.lcm!=NULL) pFree1(strat->P.lcm);
     954          }
     955          else
     956          {
     957            pNorm(strat->P.p);
     958            if ((!TEST_OPT_MINRES)||(strat->syzComp==0)||(!strat->homog))
     959            {
     960              strat->P.p = redtailBba(strat->P.p,pos-1,strat);
     961              kTest(strat);
     962            }
     963          }
     964          if (TEST_OPT_DEBUG)
     965          {
     966            PrintS("new s:");
     967            wrp(strat->P.p);
     968            PrintLn();
     969          }
     970          if((strat->P.p1==NULL) && (strat->minim>0))
     971          {
     972            if (strat->minim==1)
     973            {
     974              strat->M->m[minimcnt]=pCopy(strat->P.p);
     975              pDelete(&strat->P.p2);
     976            }
     977            else
     978            {
     979              strat->M->m[minimcnt]=strat->P.p2;
     980              strat->P.p2=NULL;
     981            }
     982            minimcnt++;
     983          }
     984          enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat);
     985          if (strat->sl==-1) pos=0;
     986          else pos=posInS(strat->S,strat->sl,strat->P.p);
     987          strat->enterS(strat->P,pos,strat);
     988        }
     989        if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
     990      }
     991      if (strat->P.lcm!=NULL) pFree1(strat->P.lcm);
    994992      if (strat->sl>srmax) srmax = strat->sl;
     993      kTest(strat);
    995994    }
    996995#ifdef KDEBUG
  • Singular/kutil.cc

    r3cb555 re56c23  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kutil.cc,v 1.37 1999-09-29 10:59:31 obachman Exp $ */
     4/* $Id: kutil.cc,v 1.38 1999-09-30 14:09:36 obachman Exp $ */
    55/*
    66* ABSTRACT: kernel: utils for kStd
     
    180180      if (p == strat->S[i])
    181181      {
     182#if 0
    182183        if (strat->T[j].heap != NULL)
    183184          strat->S[i]
    184185            = pShallowCopyDelete(mm_specHeap, &p, strat->T[j].heap);
     186#endif
    185187        break;
    186188      }
     
    255257  BOOLEAN ret = TRUE;
    256258 
    257   if (testp) ret &= pDBTest(L->p, L->heap, f, l);
     259  if (testp)
     260  {
     261    if (! pDBTest(L->p, L->heap, f, l))
     262    {
     263      Print("for L->p\n");
     264      ret = FALSE;
     265    }
     266  }
     267 
    258268  if (L->pLength != 0 && L->pLength != pLength(L->p))
    259269  {
     
    289299}
    290300
    291 BOOLEAN K_Test (char *f, int l, kStrategy strat)
     301BOOLEAN K_Test (char *f, int l, kStrategy strat, int pref)
    292302{
    293303  int i;
    294304  BOOLEAN ret;
    295305  // test P
     306  // test T
     307  if (strat->T != NULL)
     308  {
     309#ifdef MDEBUG
     310    mmStartReferenceWatch();
     311#endif
     312    for (i=0; i<=strat->tl; i++)
     313    {
     314      if (K_Test_T(f, l, &(strat->T[i]), i) == FALSE)
     315      {
     316        ret = FALSE;
     317      }
     318    }
     319#ifdef MDEBUG
     320    if (! pref) mmStopReferenceWatch();
     321#endif
     322  }
    296323  ret = K_Test_L(f, l, &(strat->P),
    297324                 (strat->P.p != NULL && pNext(strat->P.p) != strat->tail),
    298325                 -1, strat->T, strat->tl+1);
    299326
     327#ifdef MDEBUG
     328  if (pref) mmStopReferenceWatch();
     329#endif
     330  if (ret == FALSE)
     331  {
     332    Print("for strat->P\n");
     333  }
     334 
    300335  // test L
    301336  if (strat->L != NULL)
     
    308343        ret = FALSE;
    309344      }
    310       ret &= K_Test_L(f, l, &(strat->L[i]),
    311                       (pNext(strat->L[i].p) != strat->tail), i,
    312                       strat->T, strat->tl + 1);
    313     }
    314   }
    315 
    316   // test T
    317   if (strat->T != NULL)
    318   {
    319     for (i=0; i<=strat->tl; i++)
    320     {
    321       ret &= K_Test_T(f, l, &(strat->T[i]), i);
    322     }
    323   }
     345      if (K_Test_L(f, l, &(strat->L[i]),
     346                   (pNext(strat->L[i].p) != strat->tail), i,
     347                   strat->T, strat->tl + 1) == FALSE)
     348      {
     349        Print("for strat->L[%d]\n", i);
     350        ret = FALSE;
     351      }
     352    }
     353  }
     354
    324355  return ret;
    325356}
     
    328359{
    329360  BOOLEAN ret = pDBTest(T->p, T->heap, f, l);
     361  if (ret == FALSE) Print("for T[%d]\n", i);
    330362  if (T->pLength != 0 &&
    331363      T->pLength != pLength(T->p))
     
    22322264      {
    22332265        strat->redTailChange=TRUE;
     2266        assume(p != strat->S[j]);
    22342267        ksOldSpolyTail(strat->S[j], p, h, strat->kNoether);
    22352268        hn = pNext(h);
  • Singular/kutil.h

    r3cb555 re56c23  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: kutil.h,v 1.16 1999-09-29 10:59:32 obachman Exp $ */
     6/* $Id: kutil.h,v 1.17 1999-09-30 14:09:36 obachman Exp $ */
    77/*
    88* ABSTRACT: kernel: utils for kStd
     
    179179#define kTest_T(T) K_Test_T(__FILE__,__LINE__,T)
    180180#define kTest_L(L) K_Test_L(__FILE__,__LINE__,L)
    181 BOOLEAN K_Test(char *f, int l,kStrategy strat);
     181#define kTest_Pref(L) K_Test(__FILE__,__LINE__,L, 1)
     182BOOLEAN K_Test(char *f, int l,kStrategy strat, int pref=0);
    182183BOOLEAN K_Test_TS(char *f, int l,kStrategy strat);
    183184BOOLEAN K_Test_T(char *f, int l, TObject* T, int tpos = -1);
     
    187188#else
    188189#define kTest(A)    (TRUE)
     190#define kTest_Pref(A) (TRUE)
    189191#define kTest_TS(A) (TRUE)
    190192#define kTest_T(T)  (TRUE)
  • Singular/longrat.cc

    r3cb555 re56c23  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: longrat.cc,v 1.22 1999-09-24 12:24:15 Singular Exp $ */
     4/* $Id: longrat.cc,v 1.23 1999-09-30 14:09:37 obachman Exp $ */
    55/*
    66* ABSTRACT: computation with long rational numbers (Hubert Grassmann)
     
    18281828BOOLEAN nlIsZero (number a)
    18291829{
    1830 #ifdef LDEBUG
    1831   nlTest(a);
    1832 #endif
     1830// #ifdef LDEBUG
     1831//   nlTest(a);
     1832// #endif
    18331833  //if (a==INT_TO_SR(0)) return TRUE;
    18341834  //if (SR_HDL(a) & SR_INT) return FALSE;
  • Singular/mmcheck.c

    r3cb555 re56c23  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: mmcheck.c,v 1.8 1999-09-29 17:03:35 obachman Exp $ */
     4/* $Id: mmcheck.c,v 1.9 1999-09-30 14:09:37 obachman Exp $ */
    55
    66/*
     
    3535/* int mm_MDEBUG = MDEBUG; */
    3636int mm_MDEBUG = 0;
     37
     38int mm_markCurrentUsage = 0;
     39int mm_referenceWatch = 0;
    3740
    3841/**********************************************************************
     
    117120{
    118121  (void)fprintf( stderr, "warning: %s\n", msg );
    119   (void)fprintf( stderr, "block %lx allocated in: %s:%d",
     122  (void)fprintf( stderr, "block %p allocated in: %s:%d",
    120123                 (long)&(what->data),
    121124                 what->allocated_fname, what->freed_lineno );
     
    126129  if ((what->flags & MM_FREEFLAG) && what->freed_fname != NULL)
    127130  {
    128     (void)fprintf( stderr, " freed in: %s:%d",
     131    (void)fprintf( stderr, "freed in: %s:%d",
    129132                   what->freed_fname, what->freed_lineno );
    130133#ifdef MTRACK
    131     mmDBPrintThisStack(what, MM_PRINT_ALL_STACK, 0);
     134    mmDBPrintThisStack(what, MM_PRINT_ALL_STACK, 1);
    132135#endif
    133136  }
     
    191194  }
    192195 
    193   what->flags = flags;
    194   what->init = 0;
    195 
     196  if (flags == MM_FREEFLAG)
     197  {
     198    what->flags &= ~ MM_USEDFLAG;
     199    what->flags |= MM_FREEFLAG;
     200    what->flags &= ~ MM_CURRENTLY_USEDFLAG;
     201  }
     202  else if (flags == MM_USEDFLAG)
     203  {
     204    what->flags &= ~ MM_FREEFLAG;
     205    what->flags |= MM_USEDFLAG;
     206    if (mm_markCurrentUsage == 1)
     207      what->flags |= MM_CURRENTLY_USEDFLAG;
     208  }
     209 
    196210  if (flags & MM_FREEFLAG)
    197211    memset(addr, MM_FREE_PATTERN, size);
     
    206220  while (what != NULL)
    207221  {
    208     what->init = 1;
     222    what->flags |= MM_INITFLAG;
    209223    what = what->next;
    210224  }
     
    329343
    330344  if ( ( what->flags & flags ) != flags )
    331     return mmPrintDBMCB( what, "flags", 0 );
    332 
    333 
     345  {
     346    if (flags & MM_USEDFLAG)
     347    {
     348//      mmRemoveFromCurrentHeap(what->heap, what);
     349//      mmMoveDBMCB(&mm_theDBfree, &mm_theDBused, what);
     350      what->flags |= MM_USEDFLAG;
     351      return mmPrintDBMCB( what, "block has been freed but still in use (fixed)", 0 );
     352    }
     353    return mmPrintDBMCB(what, "block still in use but should be free", 0);
     354  }
     355
     356  if (mm_referenceWatch)
     357  {
     358    if (what->flags & MM_REFERENCEFLAG)
     359    {
     360//      mm_referenceWatch = 0;
     361      return mmPrintDBMCB(what, "reference", 0);
     362    }
     363    else
     364      what->flags |= MM_REFERENCEFLAG;
     365  }
     366     
    334367  if ( what->size != size )
    335368    return mmPrintDBMCB( what, "size", size );
     
    563596}
    564597
     598/**********************************************************************
     599 *
     600 * Routines fro marking
     601 *
     602 **********************************************************************/
     603void mmMarkCurrentUsageState()
     604{
     605  DBMCB* what = mm_theDBused.next;
     606  mm_markCurrentUsage = -1;
     607  while (what != NULL)
     608  {
     609    what->flags |= MM_CURRENTLY_USEDFLAG;
     610    what = what->next;
     611  }
     612}
     613
     614void mmMarkCurrentUsageStart()
     615{
     616  mm_markCurrentUsage = 1;
     617}
     618
     619void mmMarkCurrentUsageStop()
     620{
     621  mm_markCurrentUsage = 0;
     622}
     623
     624void mmPrintUnMarkedBlocks()
     625{
     626  DBMCB* what = mm_theDBused.next;
     627  while (what != NULL)
     628  {
     629    if (! (what->flags & MM_CURRENTLY_USEDFLAG))
     630    {
     631      mmPrintDBMCB(what, "unused", 0);
     632      what->flags |= MM_CURRENTLY_USEDFLAG;
     633    }
     634    what = what->next;
     635  }
     636}
     637
     638void mmStartReferenceWatch()
     639{
     640  DBMCB* what = mm_theDBused.next;
     641  mm_referenceWatch = 1;
     642  while (what != NULL)
     643  {
     644    what->flags &= ~ MM_REFERENCEFLAG;
     645    what = what->next;
     646  }
     647}
     648
     649void mmStopReferenceWatch()
     650{
     651  mm_referenceWatch = 0;
     652}
     653
    565654#endif /* MDEBUG */
    566655
  • Singular/mmemory.h

    r3cb555 re56c23  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: mmemory.h,v 1.22 1999-09-27 14:36:35 obachman Exp $ */
     6/* $Id: mmemory.h,v 1.23 1999-09-30 14:09:38 obachman Exp $ */
    77/*
    88* ABSTRACT
     
    134134void mmPrintUsedList();
    135135void mmMarkInitDBMCB();
     136void mmMarkCurrentUsageState();
     137void mmMarkCurrentUsageStart();
     138void mmMarkCurrentUsageStop();
     139void mmPrintUnMarkedBlocks();
     140void mmStartReferenceWatch();
     141void mmStopReferenceWatch();
    136142void mmTestList (int all);
    137143
  • Singular/mmheap.c

    r3cb555 re56c23  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: mmheap.c,v 1.9 1999-07-05 14:13:16 Singular Exp $ */
     4/* $Id: mmheap.c,v 1.10 1999-09-30 14:09:38 obachman Exp $ */
    55
    66#include "mod2.h"
     
    110110
    111111  mmCheckHeap(into);
     112}
     113
     114void mmRemoveFromCurrentHeap(memHeap heap, void* addr)
     115{
     116  heap->current = mmRemoveFromList((void*) heap->current, addr);
    112117}
    113118
     
    340345  if (mm_HEAP_DEBUG > 1 && ! mmDebugCheckHeap(heap, fn, l))
    341346    return NULL;
    342 #if 0 
    343347  _mmAllocHeap(res, heap);
    344 #else
    345   {
    346     register memHeap _heap =   heap ;
    347     if ((_heap)->current == ((void *)0) ) mmAllocNewHeapPage(_heap);
    348     do { register memHeapPage page = (memHeapPage) ((void*) ((long) (   (_heap)->current   ) & ~(SIZE_OF_SYSTEM_PAGE  -1)))  ;
    349     (page->counter)++; } while (0) ;
    350     ((void*) ( res )) = (_heap)->current;
    351     (_heap)->current =  *((void**)(_heap)->current);
    352   }
    353 #endif 
    354 
    355348
    356349  mmDebugCheckSingleHeapAddr(res, heap, fn, l);
  • Singular/mmheap.h

    r3cb555 re56c23  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: mmheap.h,v 1.10 1999-09-29 10:59:33 obachman Exp $ */
     6/* $Id: mmheap.h,v 1.11 1999-09-30 14:09:38 obachman Exp $ */
    77#include <stdlib.h>
    88#include "mod2.h"
     
    5050/* Merges what is free in Heap "what" into free list of heap "into" */
    5151void mmMergeHeap(memHeap into, memHeap what);
     52
     53/* Removes addr from free list of heap, provided it finds it there */
     54void mmRemoveFromCurrentHeap(memHeap heap, void* addr);
     55 
    5256
    5357/*****************************************************************
     
    178182  register memHeap _heap = heap;                            \
    179183  if ((_heap)->current == NULL) mmAllocNewHeapPage(_heap);  \
    180   (what) = (void *)((_heap)->current);                      \
     184  (void*) (what) = (void *)((_heap)->current);              \
    181185  (_heap)->current =  *((void**)(_heap)->current);          \
    182186}                                                           \
  • Singular/mmisc.c

    r3cb555 re56c23  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: mmisc.c,v 1.12 1999-09-29 17:03:35 obachman Exp $ */
     4/* $Id: mmisc.c,v 1.13 1999-09-30 14:09:38 obachman Exp $ */
    55
    66/*
     
    163163  while (what!=NULL)
    164164  {
    165     if ((all & MM_PRINT_ALL_ADDR) || what->init == 0)
     165    if ((all & MM_PRINT_ALL_ADDR) || ! (what->flags & MM_INITFLAG))
    166166    {
    167167      fprintf( stderr, "%d bytes at %p allocated in: %s:%d",
  • Singular/mmprivate.h

    r3cb555 re56c23  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: mmprivate.h,v 1.11 1999-09-29 17:03:36 obachman Exp $ */
     6/* $Id: mmprivate.h,v 1.12 1999-09-30 14:09:39 obachman Exp $ */
    77/*
    88* ABSTRACT
     
    4040  unsigned long bt_freed_stack[BT_MAXSTACK];
    4141#endif
    42   int init;
    4342  size_t size;
    4443  int allocated_lineno;
     
    6564extern void * mm_minAddr;
    6665
     66#define MM_INITFLAG 2
    6767#define MM_FREEFLAG 4
    6868#define MM_USEDFLAG 8
     69#define MM_CURRENTLY_USEDFLAG 16
     70#define MM_REFERENCEFLAG 32
    6971
    7072void mmPrintFL( const char* fname, const int lineno );
  • Singular/pProcs.cc

    r3cb555 re56c23  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: pProcs.cc,v 1.2 1999-09-29 17:03:36 obachman Exp $ */
     4/* $Id: pProcs.cc,v 1.3 1999-09-30 14:09:39 obachman Exp $ */
    55/*
    66*  ABSTRACT -  Routines for primitive poly arithmetic
     
    1313#include "numbers.h"
    1414
    15 
    1615// Define to us COMP_MACROS
    1716#define HAVE_COMP_MACROS
     
    3332}                                               \
    3433while(0)
    35 
    3634/***************************************************************
    3735 *
     
    5149    number nc = pGetCoeff(p);
    5250    pSetCoeff0(p, nMult(n, nc));
    53     nDelete(&nc);
     51//    nDelete(&nc);
    5452    pIter(p);
    5553  }
     
    152150}
    153151
     152
    154153/***************************************************************
    155154 *
     
    162161 *
    163162 ***************************************************************/
    164  
    165163poly  p_Mult_m_General(poly p,
    166164                       poly m,
     
    170168  assume(heap != NULL && heap != MM_UNKNOWN_HEAP);
    171169  assume(pHeapTest(p, MM_UNKNOWN_HEAP));
    172 //  assume(pHeapTest(m, MM_UNKNOWN_HEAP));
     170  assume(pHeapTest(m, MM_UNKNOWN_HEAP));
    173171 
    174172  if (p == NULL) return NULL;
    175173  spolyrec rp;
    176   poly q = &rp;
     174  poly q = &rp, r;
    177175  number ln = pGetCoeff(m);
    178176
     
    183181      AllocHeap(pNext(q), heap);
    184182      q = pNext(q);
    185 
    186183      pSetCoeff0(q, nMult(ln, pGetCoeff(p)));
    187184   
     
    234231                               memHeap heap)
    235232{
     233#ifdef TRACK_MEMORY
     234  mmMarkCurrentUsageState();
     235  poly ptemp = pCopy(p);
     236  pDelete(&p);
     237  p = ptemp;
     238#endif 
    236239  assume(heap != NULL && heap != MM_UNKNOWN_HEAP);
    237240  assume(pHeapTest(p, heap));
    238 //  assume(pHeapTest(m, MM_UNKNOWN_HEAP));
    239241  assume(pHeapTest(q, MM_UNKNOWN_HEAP));
     242  assume(pNext(m) == NULL || (! (pNext(m) = NULL)));
     243  assume(pHeapTest(m, MM_UNKNOWN_HEAP));
    240244  assume(lp == NULL || (pLength(p) == *lp && pLength(q) == lq));
    241245
     
    325329 
    326330 Finish: // q or p is NULL: Clean-up time
     331
     332    pNext(a) = NULL;
     333   
    327334   if (q == NULL) // append rest of p to result
    328335     pNext(a) = p;
     
    336343   nDelete(&tneg);
    337344   if (qm != NULL) FreeHeap(qm, heap);
     345   if (lp != NULL) *lp = l;
    338346   
    339347   assume(pHeapTest(pNext(&rp), heap));
    340348   assume(lp == NULL || pLength(pNext(&rp)) == l);
    341349   
    342    if (lp != NULL) *lp = l;
    343    return pNext(&rp);
     350#ifdef TRACK_MEMORY
     351   mmMarkCurrentUsageStart();
     352   ptemp = pCopy(rp.next);
     353   pDelete(&(rp.next));
     354   rp.next = ptemp;
     355   mmMarkCurrentUsageStop();
     356   mmPrintUnMarkedBlocks();
     357#endif
     358   
     359  return pNext(&rp);
    344360}
    345361
  • Singular/polys-impl.cc

    r3cb555 re56c23  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: polys-impl.cc,v 1.25 1999-09-29 11:47:47 obachman Exp $ */
     4/* $Id: polys-impl.cc,v 1.26 1999-09-30 14:09:39 obachman Exp $ */
    55
    66/***************************************************************
     
    920920  if (p2 == p1 || p3 == p1)
    921921  {
    922     Warn("Error in pMonAdd: Destination equals source in %s:%d\n", f, l);
    923   }
    924   poly ptemp = pNew();
    925   __pMonAdd(ptemp, p2, p3);
    926 
    927   pCopy2(p1, p2);
    928   pDBMonAddOn(p1, p3, f, l);
     922    Warn("Error in pMonAdd: Destination equals source in %s:%d", f, l);
     923  }
     924  __pMonAdd(p1, p2, p3);
     925
     926 
     927  poly ptemp = pInit();
     928  for (int i=1; i<=pVariables; i++)
     929  {
     930    pSetExp(ptemp, i, pGetExp(p2, i) + pGetExp(p3, i));
     931    if (pGetExp(ptemp, i) != pGetExp(p1, i))
     932    {
     933      Warn("Error in pMonAdd: %th exponent: %d != (%d == %d + %d)",
     934           i, pGetExp(p1, i), pGetExp(ptemp, i), pGetExp(p2, i),
     935           pGetExp(p3, i));
     936    }
     937  }
     938  pSetComp(ptemp, pGetComp(p2) + pGetComp(p3));
     939  pSetm(ptemp);
    929940
    930941  if (! pEqual(ptemp, p1))
    931     Warn("Error in pCopyMonAddOn in %s:%d\n", f, l);
     942    Warn("Error in pMonAdd in %s:%d", f, l);
    932943  pFree1(ptemp);
    933944}
  • Singular/polys-impl.h

    r3cb555 re56c23  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: polys-impl.h,v 1.35 1999-09-29 10:59:36 obachman Exp $ */
     6/* $Id: polys-impl.h,v 1.36 1999-09-30 14:09:40 obachman Exp $ */
    77
    88/***************************************************************
     
    372372  const unsigned long* const ub = s3 + currRing->ExpLSize;
    373373
    374   p1->next = p2->next;
    375   p1->coef = p2->coef;
    376 
    377374  for (;;)
    378375  {
Note: See TracChangeset for help on using the changeset viewer.