Changeset e56c23 in git
- Timestamp:
- Sep 30, 1999, 4:09:40 PM (25 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- e932fe2d2234f4a4bd69be155f7e58b510ff7c5b
- Parents:
- 3cb555afe6eee925f6dc7b33a2de1a6fbdcd0185
- Location:
- Singular
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/Makefile.in
r3cb555 re56c23 417 417 CXXFLAGSB = -g -O3 ${PIPE} 418 418 CXXTEMPLFLAGSB = -fno-implicit-templates 419 DEFSB = -D@SING_UNAME@ 419 DEFSB = -D@SING_UNAME@ -DNDEBUG 420 420 LDFLAGSB = -static @LDFLAGS@ 421 421 # bprof object file to link with … … 424 424 425 425 ## 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 429 OBJP1 := $(CXXSOURCES:.cc=.op) 430 OBJP2 := $(CSOURCES:.c=.op) 431 OBJP=$(OBJP1) $(OBJP2) 432 433 OBJB1 := $(CXXSOURCES:.cc=.ob) 434 OBJB2 := $(CSOURCES:.c=.ob) 435 OBJB=$(OBJB1) $(OBJB2) 436 478 437 479 438 ## … … 491 450 $(CCP) ${CFLAGSP} ${CPPFLAGS} ${DEFSP} -c $< -o $@ 492 451 493 Singularp: scanner.cc gmalloc.op $(OBJP) iparith.op mpsr_Tok.op tesths.cc version.h452 Singularp: scanner.cc gmalloc.op $(OBJP) iparith.op mpsr_Tok.op claptmpl.op tesths.cc version.h 494 453 $(CXXP) ${CXXFLAGSP} ${CPPFLAGS} ${DEFSP} -o Singularp \ 495 454 tesths.cc iparith.op mpsr_Tok.op $(OBJP) ${LDFLAGSP} ${LIBS} \ … … 502 461 $(CXXP) ${CXXFLAGSP} ${CPPFLAGS} ${DEFSP} -c mpsr_Tok.cc -o mpsr_Tok.op 503 462 504 ## for pbrof 463 464 ## for bprof 505 465 claptmpl.ob: claptmpl.cc mod2.h 506 $(CXXP) ${CXXFLAGS B} ${CPPFLAGS} ${DEFSB} -c $< -o $@466 $(CXXP) ${CXXFLAGSP} ${CPPFLAGS} ${DEFSB} -c $< -o $@ 507 467 508 468 $(OBJB1): %.ob: %.cc 509 $(CXXP) ${CXXFLAGS B} ${CXXTEMPLFLAGSB} ${CPPFLAGS} ${DEFSB} -c $< -o $@469 $(CXXP) ${CXXFLAGSP} ${CXXTEMPLFLAGSP} ${CPPFLAGS} ${DEFSB} -c $< -o $@ 510 470 511 471 $(OBJB2) gmalloc.ob: %.ob: %.c 512 $(CCP) ${CFLAGSB} ${CPPFLAGS} ${DEFSB} -c $< -o $@ 472 $(CCP) ${CFLAGSP} ${CPPFLAGS} ${DEFSB} -c $< -o $@ 473 474 Singularb: 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 513 478 514 479 iparith.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 482 mpsr_Tok.ob: iparith.inc mpsr_Tok.cc 483 $(CXXP) ${CXXFLAGSP} ${CPPFLAGS} ${DEFSB} -c mpsr_Tok.cc -o mpsr_Tok.ob 528 484 529 485 ## -
Singular/kspoly.cc
r3cb555 re56c23 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kspoly.cc,v 1. 1 1999-09-29 10:59:29obachman Exp $ */4 /* $Id: kspoly.cc,v 1.2 1999-09-30 14:09:34 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT - Routines for Spoly creation and reductions … … 19 19 #define assume(x) 20 20 #endif 21 21 22 22 23 /*************************************************************** … … 38 39 assume(p2 != NULL && p1 != NULL && pDivisibleBy(p2, p1)); 39 40 poly a2 = pNext(p2), lm = p1; 40 41 41 42 42 p1 = pNext(p1); … … 151 151 a2 = p_Mult_m(a2, m2, spNoether); 152 152 153 int l2;154 153 // and, finally, the spoly 155 154 Pair->p = p_Minus_m_Mult_q(a2, m1, a1, spNoether); … … 170 169 } 171 170 } 172 173 171 } 174 172 … … 458 456 } 459 457 458 #if 0 459 void 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 460 473 461 474 /*2 … … 491 504 m = pHead0(p2); 492 505 pSetCoeff0(m,bn); 493 a2 = pCopy(a2);494 506 } 495 507 if ((ct == 0) || (ct == 2)) … … 529 541 } 530 542 531 532 533 534 543 #endif 544 545 546 -
Singular/kstd2.cc
r3cb555 re56c23 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kstd2.cc,v 1.3 1 1999-09-29 17:03:33obachman Exp $ */4 /* $Id: kstd2.cc,v 1.32 1999-09-30 14:09:35 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT - Kernel: alg. of Buchberger … … 364 364 365 365 // 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 369 368 #ifdef KDEBUG 370 369 if (TEST_OPT_DEBUG) … … 900 899 if (strat->Ll== 0) strat->interpt=TRUE; 901 900 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)))) 904 903 { 905 904 /* 906 *stops computation if907 * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then908 *a predefined number Kstd1_deg909 */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 */ 910 909 while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat); 911 910 break; … … 925 924 if((strat->P.p1==NULL) && (strat->minim>0)) 926 925 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); 941 937 if (strat->P.p != NULL) 942 938 { 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)) 948 949 { 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); 990 953 } 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); 994 992 if (strat->sl>srmax) srmax = strat->sl; 993 kTest(strat); 995 994 } 996 995 #ifdef KDEBUG -
Singular/kutil.cc
r3cb555 re56c23 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kutil.cc,v 1.3 7 1999-09-29 10:59:31obachman Exp $ */4 /* $Id: kutil.cc,v 1.38 1999-09-30 14:09:36 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT: kernel: utils for kStd … … 180 180 if (p == strat->S[i]) 181 181 { 182 #if 0 182 183 if (strat->T[j].heap != NULL) 183 184 strat->S[i] 184 185 = pShallowCopyDelete(mm_specHeap, &p, strat->T[j].heap); 186 #endif 185 187 break; 186 188 } … … 255 257 BOOLEAN ret = TRUE; 256 258 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 258 268 if (L->pLength != 0 && L->pLength != pLength(L->p)) 259 269 { … … 289 299 } 290 300 291 BOOLEAN K_Test (char *f, int l, kStrategy strat )301 BOOLEAN K_Test (char *f, int l, kStrategy strat, int pref) 292 302 { 293 303 int i; 294 304 BOOLEAN ret; 295 305 // 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 } 296 323 ret = K_Test_L(f, l, &(strat->P), 297 324 (strat->P.p != NULL && pNext(strat->P.p) != strat->tail), 298 325 -1, strat->T, strat->tl+1); 299 326 327 #ifdef MDEBUG 328 if (pref) mmStopReferenceWatch(); 329 #endif 330 if (ret == FALSE) 331 { 332 Print("for strat->P\n"); 333 } 334 300 335 // test L 301 336 if (strat->L != NULL) … … 308 343 ret = FALSE; 309 344 } 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 324 355 return ret; 325 356 } … … 328 359 { 329 360 BOOLEAN ret = pDBTest(T->p, T->heap, f, l); 361 if (ret == FALSE) Print("for T[%d]\n", i); 330 362 if (T->pLength != 0 && 331 363 T->pLength != pLength(T->p)) … … 2232 2264 { 2233 2265 strat->redTailChange=TRUE; 2266 assume(p != strat->S[j]); 2234 2267 ksOldSpolyTail(strat->S[j], p, h, strat->kNoether); 2235 2268 hn = pNext(h); -
Singular/kutil.h
r3cb555 re56c23 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: kutil.h,v 1.1 6 1999-09-29 10:59:32obachman Exp $ */6 /* $Id: kutil.h,v 1.17 1999-09-30 14:09:36 obachman Exp $ */ 7 7 /* 8 8 * ABSTRACT: kernel: utils for kStd … … 179 179 #define kTest_T(T) K_Test_T(__FILE__,__LINE__,T) 180 180 #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) 182 BOOLEAN K_Test(char *f, int l,kStrategy strat, int pref=0); 182 183 BOOLEAN K_Test_TS(char *f, int l,kStrategy strat); 183 184 BOOLEAN K_Test_T(char *f, int l, TObject* T, int tpos = -1); … … 187 188 #else 188 189 #define kTest(A) (TRUE) 190 #define kTest_Pref(A) (TRUE) 189 191 #define kTest_TS(A) (TRUE) 190 192 #define kTest_T(T) (TRUE) -
Singular/longrat.cc
r3cb555 re56c23 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: longrat.cc,v 1.2 2 1999-09-24 12:24:15 SingularExp $ */4 /* $Id: longrat.cc,v 1.23 1999-09-30 14:09:37 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT: computation with long rational numbers (Hubert Grassmann) … … 1828 1828 BOOLEAN nlIsZero (number a) 1829 1829 { 1830 #ifdef LDEBUG1831 nlTest(a);1832 #endif1830 // #ifdef LDEBUG 1831 // nlTest(a); 1832 // #endif 1833 1833 //if (a==INT_TO_SR(0)) return TRUE; 1834 1834 //if (SR_HDL(a) & SR_INT) return FALSE; -
Singular/mmcheck.c
r3cb555 re56c23 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: mmcheck.c,v 1. 8 1999-09-29 17:03:35obachman Exp $ */4 /* $Id: mmcheck.c,v 1.9 1999-09-30 14:09:37 obachman Exp $ */ 5 5 6 6 /* … … 35 35 /* int mm_MDEBUG = MDEBUG; */ 36 36 int mm_MDEBUG = 0; 37 38 int mm_markCurrentUsage = 0; 39 int mm_referenceWatch = 0; 37 40 38 41 /********************************************************************** … … 117 120 { 118 121 (void)fprintf( stderr, "warning: %s\n", msg ); 119 (void)fprintf( stderr, "block % lxallocated in: %s:%d",122 (void)fprintf( stderr, "block %p allocated in: %s:%d", 120 123 (long)&(what->data), 121 124 what->allocated_fname, what->freed_lineno ); … … 126 129 if ((what->flags & MM_FREEFLAG) && what->freed_fname != NULL) 127 130 { 128 (void)fprintf( stderr, " 131 (void)fprintf( stderr, "freed in: %s:%d", 129 132 what->freed_fname, what->freed_lineno ); 130 133 #ifdef MTRACK 131 mmDBPrintThisStack(what, MM_PRINT_ALL_STACK, 0);134 mmDBPrintThisStack(what, MM_PRINT_ALL_STACK, 1); 132 135 #endif 133 136 } … … 191 194 } 192 195 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 196 210 if (flags & MM_FREEFLAG) 197 211 memset(addr, MM_FREE_PATTERN, size); … … 206 220 while (what != NULL) 207 221 { 208 what-> init = 1;222 what->flags |= MM_INITFLAG; 209 223 what = what->next; 210 224 } … … 329 343 330 344 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 334 367 if ( what->size != size ) 335 368 return mmPrintDBMCB( what, "size", size ); … … 563 596 } 564 597 598 /********************************************************************** 599 * 600 * Routines fro marking 601 * 602 **********************************************************************/ 603 void 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 614 void mmMarkCurrentUsageStart() 615 { 616 mm_markCurrentUsage = 1; 617 } 618 619 void mmMarkCurrentUsageStop() 620 { 621 mm_markCurrentUsage = 0; 622 } 623 624 void 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 638 void 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 649 void mmStopReferenceWatch() 650 { 651 mm_referenceWatch = 0; 652 } 653 565 654 #endif /* MDEBUG */ 566 655 -
Singular/mmemory.h
r3cb555 re56c23 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: mmemory.h,v 1.2 2 1999-09-27 14:36:35obachman Exp $ */6 /* $Id: mmemory.h,v 1.23 1999-09-30 14:09:38 obachman Exp $ */ 7 7 /* 8 8 * ABSTRACT … … 134 134 void mmPrintUsedList(); 135 135 void mmMarkInitDBMCB(); 136 void mmMarkCurrentUsageState(); 137 void mmMarkCurrentUsageStart(); 138 void mmMarkCurrentUsageStop(); 139 void mmPrintUnMarkedBlocks(); 140 void mmStartReferenceWatch(); 141 void mmStopReferenceWatch(); 136 142 void mmTestList (int all); 137 143 -
Singular/mmheap.c
r3cb555 re56c23 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: mmheap.c,v 1. 9 1999-07-05 14:13:16 SingularExp $ */4 /* $Id: mmheap.c,v 1.10 1999-09-30 14:09:38 obachman Exp $ */ 5 5 6 6 #include "mod2.h" … … 110 110 111 111 mmCheckHeap(into); 112 } 113 114 void mmRemoveFromCurrentHeap(memHeap heap, void* addr) 115 { 116 heap->current = mmRemoveFromList((void*) heap->current, addr); 112 117 } 113 118 … … 340 345 if (mm_HEAP_DEBUG > 1 && ! mmDebugCheckHeap(heap, fn, l)) 341 346 return NULL; 342 #if 0343 347 _mmAllocHeap(res, heap); 344 #else345 {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 #endif354 355 348 356 349 mmDebugCheckSingleHeapAddr(res, heap, fn, l); -
Singular/mmheap.h
r3cb555 re56c23 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: mmheap.h,v 1.1 0 1999-09-29 10:59:33obachman Exp $ */6 /* $Id: mmheap.h,v 1.11 1999-09-30 14:09:38 obachman Exp $ */ 7 7 #include <stdlib.h> 8 8 #include "mod2.h" … … 50 50 /* Merges what is free in Heap "what" into free list of heap "into" */ 51 51 void mmMergeHeap(memHeap into, memHeap what); 52 53 /* Removes addr from free list of heap, provided it finds it there */ 54 void mmRemoveFromCurrentHeap(memHeap heap, void* addr); 55 52 56 53 57 /***************************************************************** … … 178 182 register memHeap _heap = heap; \ 179 183 if ((_heap)->current == NULL) mmAllocNewHeapPage(_heap); \ 180 ( what) = (void *)((_heap)->current);\184 (void*) (what) = (void *)((_heap)->current); \ 181 185 (_heap)->current = *((void**)(_heap)->current); \ 182 186 } \ -
Singular/mmisc.c
r3cb555 re56c23 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: mmisc.c,v 1.1 2 1999-09-29 17:03:35obachman Exp $ */4 /* $Id: mmisc.c,v 1.13 1999-09-30 14:09:38 obachman Exp $ */ 5 5 6 6 /* … … 163 163 while (what!=NULL) 164 164 { 165 if ((all & MM_PRINT_ALL_ADDR) || what->init == 0)165 if ((all & MM_PRINT_ALL_ADDR) || ! (what->flags & MM_INITFLAG)) 166 166 { 167 167 fprintf( stderr, "%d bytes at %p allocated in: %s:%d", -
Singular/mmprivate.h
r3cb555 re56c23 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: mmprivate.h,v 1.1 1 1999-09-29 17:03:36obachman Exp $ */6 /* $Id: mmprivate.h,v 1.12 1999-09-30 14:09:39 obachman Exp $ */ 7 7 /* 8 8 * ABSTRACT … … 40 40 unsigned long bt_freed_stack[BT_MAXSTACK]; 41 41 #endif 42 int init;43 42 size_t size; 44 43 int allocated_lineno; … … 65 64 extern void * mm_minAddr; 66 65 66 #define MM_INITFLAG 2 67 67 #define MM_FREEFLAG 4 68 68 #define MM_USEDFLAG 8 69 #define MM_CURRENTLY_USEDFLAG 16 70 #define MM_REFERENCEFLAG 32 69 71 70 72 void mmPrintFL( const char* fname, const int lineno ); -
Singular/pProcs.cc
r3cb555 re56c23 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: pProcs.cc,v 1. 2 1999-09-29 17:03:36obachman Exp $ */4 /* $Id: pProcs.cc,v 1.3 1999-09-30 14:09:39 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT - Routines for primitive poly arithmetic … … 13 13 #include "numbers.h" 14 14 15 16 15 // Define to us COMP_MACROS 17 16 #define HAVE_COMP_MACROS … … 33 32 } \ 34 33 while(0) 35 36 34 /*************************************************************** 37 35 * … … 51 49 number nc = pGetCoeff(p); 52 50 pSetCoeff0(p, nMult(n, nc)); 53 nDelete(&nc);51 // nDelete(&nc); 54 52 pIter(p); 55 53 } … … 152 150 } 153 151 152 154 153 /*************************************************************** 155 154 * … … 162 161 * 163 162 ***************************************************************/ 164 165 163 poly p_Mult_m_General(poly p, 166 164 poly m, … … 170 168 assume(heap != NULL && heap != MM_UNKNOWN_HEAP); 171 169 assume(pHeapTest(p, MM_UNKNOWN_HEAP)); 172 //assume(pHeapTest(m, MM_UNKNOWN_HEAP));170 assume(pHeapTest(m, MM_UNKNOWN_HEAP)); 173 171 174 172 if (p == NULL) return NULL; 175 173 spolyrec rp; 176 poly q = &rp ;174 poly q = &rp, r; 177 175 number ln = pGetCoeff(m); 178 176 … … 183 181 AllocHeap(pNext(q), heap); 184 182 q = pNext(q); 185 186 183 pSetCoeff0(q, nMult(ln, pGetCoeff(p))); 187 184 … … 234 231 memHeap heap) 235 232 { 233 #ifdef TRACK_MEMORY 234 mmMarkCurrentUsageState(); 235 poly ptemp = pCopy(p); 236 pDelete(&p); 237 p = ptemp; 238 #endif 236 239 assume(heap != NULL && heap != MM_UNKNOWN_HEAP); 237 240 assume(pHeapTest(p, heap)); 238 // assume(pHeapTest(m, MM_UNKNOWN_HEAP));239 241 assume(pHeapTest(q, MM_UNKNOWN_HEAP)); 242 assume(pNext(m) == NULL || (! (pNext(m) = NULL))); 243 assume(pHeapTest(m, MM_UNKNOWN_HEAP)); 240 244 assume(lp == NULL || (pLength(p) == *lp && pLength(q) == lq)); 241 245 … … 325 329 326 330 Finish: // q or p is NULL: Clean-up time 331 332 pNext(a) = NULL; 333 327 334 if (q == NULL) // append rest of p to result 328 335 pNext(a) = p; … … 336 343 nDelete(&tneg); 337 344 if (qm != NULL) FreeHeap(qm, heap); 345 if (lp != NULL) *lp = l; 338 346 339 347 assume(pHeapTest(pNext(&rp), heap)); 340 348 assume(lp == NULL || pLength(pNext(&rp)) == l); 341 349 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); 344 360 } 345 361 -
Singular/polys-impl.cc
r3cb555 re56c23 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: polys-impl.cc,v 1.2 5 1999-09-29 11:47:47obachman Exp $ */4 /* $Id: polys-impl.cc,v 1.26 1999-09-30 14:09:39 obachman Exp $ */ 5 5 6 6 /*************************************************************** … … 920 920 if (p2 == p1 || p3 == p1) 921 921 { 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); 929 940 930 941 if (! pEqual(ptemp, p1)) 931 Warn("Error in p CopyMonAddOn in %s:%d\n", f, l);942 Warn("Error in pMonAdd in %s:%d", f, l); 932 943 pFree1(ptemp); 933 944 } -
Singular/polys-impl.h
r3cb555 re56c23 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: polys-impl.h,v 1.3 5 1999-09-29 10:59:36obachman Exp $ */6 /* $Id: polys-impl.h,v 1.36 1999-09-30 14:09:40 obachman Exp $ */ 7 7 8 8 /*************************************************************** … … 372 372 const unsigned long* const ub = s3 + currRing->ExpLSize; 373 373 374 p1->next = p2->next;375 p1->coef = p2->coef;376 377 374 for (;;) 378 375 {
Note: See TracChangeset
for help on using the changeset viewer.