#include <memory.h>
#include "udanax.h"
Include dependency graph for ndcuts.cxx:

Go to the source code of this file.
Functions | |
| void | makecutsbackuptohere (typecuc *ptr, typewid *offset, typeknives *knives) |
| ??? | |
| bool | crumiscut (typecuc *ptr, typewid *offset, typeknives *knives) |
| ??? | |
| bool | sonsarecut (typecuc *ptr, typewid *offset, typeknives *knives) |
| ??? | |
| void | makecutsdownnd (typecuc *fullcrumptr, typewid *offset, typeknives *knives) |
| ??? | |
| void | cutsons (typecuc *ptr, typewid *offset, typeknives *knives) |
| ??? | |
| bool | crumleftofithcut (typecorecrum *ptr, typewid *offset, typeknives *knives, int i) |
| ??? | |
| void | newpeelcrumoffnd (typecorecrum *ptr, typecorecrum *newuncle) |
| ??? | |
| void | peelsoncorrectly (typecorecrum *ptr, typewid *offset, typecorecrum *son, typewid *grasp, typeknives *knives, int i) |
| ??? | |
| bool | crumiscutbyithknife (typecuc *ptr, typewid *offset, typeknives *knives, int i) |
| ??? | |
| void | makeithcutonson (typecorecrum *ptr, typewid *offset, typecorecrum *son, typewid *grasp, typeknives *knives, int i) |
| ??? | |
| bool | peeloffcorrectson (typecorecrum *ptr, typeknives *knives) |
| ??? | |
| void | slicecbcpm (typecorecrum *ptr, typewid *offset, typecorecrum *newcc, Tumbler *cut, int index) |
| ??? | |
| void | makecutsnd (typecuc *fullcrumptr, typeknives *knives) |
| ??? | |
(to be defined)
Definition in file ndcuts.cxx.
|
||||||||||||||||
|
??? (to be defined) Definition at line 98 of file ndcuts.cxx. References typeknives::blades, typeknives::dimension, typeknives::nblades, THRUME, typecorecrum, and whereoncrum(). Referenced by cutsons(), makecutsdownnd(), and sonsarecut().
00102 {
00103 int i;
00104 for (i = 0; i < knives->nblades; ++i) {
00105 if (whereoncrum((typecorecrum *) ptr, offset, &knives->blades[i], knives->dimension) == THRUME)
00106 return true;
00107 }
00108 return false;
00109 }
|
|
||||||||||||||||||||
|
??? (to be defined) Definition at line 344 of file ndcuts.cxx. References typeknives::blades, typeknives::dimension, THRUME, typecorecrum, and whereoncrum(). Referenced by makecutsbackuptohere(), and makeithcutonson().
00349 {
00350 if (whereoncrum((typecorecrum *) ptr, offset, &knives->blades[i], knives->dimension) == THRUME)
00351 return true;
00352
00353 return false;
00354 }
|
|
||||||||||||||||||||
|
??? (to be defined) Definition at line 221 of file ndcuts.cxx. References typeknives::blades, typeknives::dimension, THRUME, typecorecrum, and whereoncrum(). Referenced by peelsoncorrectly().
00226 {
00227 if (whereoncrum(ptr, offset, &knives->blades[i], knives->dimension) > THRUME)
00228 return false;
00229 else
00230 return true;
00231 }
|
|
||||||||||||||||
|
??? (to be defined) Definition at line 192 of file ndcuts.cxx. References crumiscut(), findleftson(), findrightbro, makecutsbackuptohere(), NULL, prologuend(), setwispupwards(), sonsarecut(), typecorecrum, and typedsp. Referenced by makecutsbackuptohere().
00196 {
00197 typewid grasp;
00198 typecorecrum *son, *nextson;
00199
00200 while (sonsarecut(ptr, offset, knives)) {
00201 setwispupwards(ptr, 1);
00202 for (son = findleftson(ptr); son; son = nextson) {
00203 nextson = findrightbro(son);
00204 prologuend((typecorecrum *) ptr, offset, &grasp, (typedsp *) NULL);
00205 for (; crumiscut((typecuc *) son, &grasp, knives);
00206 prologuend((typecorecrum *) ptr, offset, &grasp, (typedsp *) NULL)) {
00207 makecutsbackuptohere((typecuc *) son, &grasp, knives);
00208 }
00209 }
00210 }
00211 }
|
|
||||||||||||||||
|
??? (to be defined) Definition at line 567 of file ndcuts.cxx. References typeknives::blades, typecorecrumhedr::cenftype, createcrum(), crumiscutbyithknife(), cutsons(), typeknives::dimension, findleftson(), findrightbro, GRAN, typecorecrumhedr::height, typecuc::height, isfullcrum(), ivemodified(), L, makeithcutonson(), typeknives::nblades, NULL, peeloffcorrectson(), prologuend(), setwisp(), setwispupwards(), slicecbcpm(), THRUME, toomanysons(), typecorecrum, typedsp, and whereoncrum(). Referenced by cutsons(), and makecutsdownnd().
00571 {
00572 typewid grasp;
00573 int i;
00574 typecuc *son, *newcc, *nextson;
00575
00576 if (ptr->height == 0) {
00577 for (i = 0; i < knives->nblades; i++) {
00578 if (whereoncrum((typecorecrum *) ptr, offset, &knives->blades[i], knives->dimension) == THRUME) {
00579 newcc = (typecuc *) createcrum((int) ptr->height, (int) ptr->cenftype);
00580 if (ptr->cenftype == GRAN) {
00581 ((typecbc *) newcc)->cinfo.infotype = ((typecbc *) ptr)->cinfo.infotype;
00582 }
00583 slicecbcpm((typecorecrum *) ptr, offset, (typecorecrum *) newcc, &knives->blades[i], knives->dimension);
00584 ivemodified((typecorecrum *) ptr);
00585 ivemodified((typecorecrum *) newcc);
00586 setwisp((typecorecrum *) ptr);
00587
00588 /* asserttreeisok(ptr); */
00589 }
00590 }
00591 return;
00592 } else {
00593 for (i = 0; i < knives->nblades; ++i) {
00594 cutsons(ptr, offset, knives);
00595
00596 if (!isfullcrum((typecorecrum *) ptr)) {
00597 setwispupwards(ptr, 0);
00598 if (crumiscutbyithknife(ptr, offset, knives, i)) {
00599 for (son = (typecuc *) findleftson(ptr); son; son = nextson) {
00600 nextson = (typecuc *) findrightbro((typecorecrum *)
00601 son);
00602 prologuend((typecorecrum *) ptr, offset, &grasp, (typedsp *) NULL);
00603
00604 makeithcutonson((typecorecrum *) ptr, offset, (typecorecrum *) son, &grasp, knives, i);
00605 if (!crumiscutbyithknife(ptr, offset, knives, i)) {
00606 if (ptr->numberofsons == 0) {
00607 return;
00608 }
00609 break;
00610 }
00611 }
00612 }
00613 setwispupwards(ptr, 0);
00614 }
00615 /* asserttreeisok(ptr); */
00616 }
00617 }
00618 if (!isfullcrum((typecorecrum *) ptr)) {
00619 if (toomanysons(ptr)) {
00620 while (toomanysons(ptr)) {
00621 #ifndef DISTRIBUTION
00622 L("setwispupwards 4\n" /*BUG: too many args, 1*/);
00623 #endif
00624 setwispupwards(ptr, 0);
00625
00626 #ifndef DISTRIBUTION
00627 L("toomanysons peel\n");
00628 #endif
00629 peeloffcorrectson((typecorecrum *) ptr, knives);
00630 }
00631 #ifndef DISTRIBUTION
00632 L("calling makecutsbackuptohere\n");
00633 #endif
00634 makecutsbackuptohere(ptr, offset, knives);
00635 }
00636 } else if (toomanysons(ptr)) {
00637 #ifndef DISTRIBUTION
00638 L("________________toomanysons in fullcrum\n");
00639 #endif
00640 }
00641 setwispupwards(ptr, 1);
00642
00643 }
|
|
||||||||||||||||
|
??? (to be defined) Definition at line 144 of file ndcuts.cxx. References crumiscut(), findleftson(), findrightbro, typecuc::height, isfullcrum(), levelpush(), makecutsbackuptohere(), makecutsnd(), typeknives::nblades, NULL, prologuend(), toomanysons(), typecorecrum, and typedsp. Referenced by makecutsnd().
00148 {
00149 typecuc *ptr;
00150 typecorecrum *sonptr, *son;
00151 int n;
00152
00153 ptr = fullcrumptr;
00154 for (; (knives->nblades > 1) && false && ptr->height;) {
00155 for (n = 0, son = findleftson(ptr); son; son = findrightbro(son)) {
00156 if (crumiscut((typecuc *) son, offset, knives)) {
00157 n++;
00158 sonptr = son;
00159 }
00160 }
00161
00162 if (n == 1) {
00163 prologuend((typecorecrum *) ptr, offset, offset, (typedsp *) NULL);
00164 ptr = (typecuc *) sonptr;
00165 } else
00166 break;
00167 } /* now we're at intersection */
00168
00169 makecutsbackuptohere(ptr, offset, knives);
00170 if (toomanysons(ptr)) {
00171 /* L("found toomany sons in makecutsdownnd\n"); */
00172 if (isfullcrum((typecorecrum *) ptr)) {
00173 /* L("and was fullcrum\n"); */
00174 /* return; */
00175
00176 levelpush(ptr);
00177 makecutsnd(fullcrumptr, knives);
00178 /* L("returningfrom makecutsnd\n"); */
00179 } else
00180 makecutsnd(fullcrumptr, knives);
00181 }
00182 }
|
|
||||||||||||
|
??? (to be defined) Definition at line 538 of file ndcuts.cxx. References asserttreeisok(), clear, findfullcrum(), makecutsdownnd(), sonsarecut(), and typecorecrum. Referenced by deletend(), makecutsdownnd(), makegappm(), and rearrangend().
00541 {
00542 typewid offset;
00543
00544 //FIX: needs access to Session from higher-level code logbertmodifiedforcrum(sess, fullcrumptr);
00545 /* (L("\nmakecutsnd knives = \n"); displaycutspm(knives); */
00546 clear(&offset, sizeof(offset));
00547 makecutsdownnd(fullcrumptr, &offset, knives);
00548 clear(&offset, sizeof(offset)); /* clears ARE redundant */
00549 for (fullcrumptr = findfullcrum((typecorecrum *) fullcrumptr); sonsarecut(fullcrumptr, &offset, knives);
00550 fullcrumptr = findfullcrum((typecorecrum *) fullcrumptr)) {
00551 clear(&offset, sizeof(offset));
00552 makecutsdownnd(fullcrumptr, &offset, knives);
00553 }
00554 #ifndef DISTRIBUTION
00555 asserttreeisok((typecorecrum *) fullcrumptr);
00556 #endif
00557 }
|
|
||||||||||||||||||||||||||||
|
??? (to be defined) Definition at line 364 of file ndcuts.cxx. References assert, typeknives::blades, typecuc::cenftype, check(), crumiscutbyithknife(), typeknives::dimension, displaycutspm(), dump(), dumpwid(), findleftson(), L, peelsoncorrectly(), setwispupwards(), THRUME, typecorecrum, and whereoncrum(). Referenced by makecutsbackuptohere().
00371 {
00372 int temp;
00373
00374 if (!crumiscutbyithknife((typecuc *) ptr, offset, knives, i)) {
00375 #ifndef DISTRIBUTION
00376 L("foo return in makeithcutonson\n");
00377 #endif
00378 return;
00379 }
00380 if ((temp = whereoncrum(son, grasp, &knives->blades[i], knives->dimension)) < THRUME) {
00381 peelsoncorrectly(ptr, offset, son, grasp, knives, i);
00382 setwispupwards((typecuc *) ptr, 1);
00383 if (!crumiscutbyithknife((typecuc *) ptr, offset, knives, i)) {
00384 setwispupwards((typecuc *) ptr, 1);
00385
00386 /* prologuend(ptr,offset,grasp,NULL); */
00387 if (((typecuc *) ptr)->numberofsons == 0) {
00388 #ifndef DISTRIBUTION
00389 displaycutspm(knives);
00390 dumpwid(offset, ptr->cenftype);
00391 L("sons went away\n");
00392 /* dump(ptr); *//*dumpwholetree(ptr); */
00393 check((typecuc *) ptr);
00394 #endif
00395 return;
00396 }
00397 return;
00398 }
00399 (void)findleftson((typecuc *) ptr); /* make sure its in core */
00400 if (((typecuc *) ptr)->numberofsons == 0) {
00401 #ifndef DISTRIBUTION
00402 displaycutspm(knives);
00403 dumpwid(offset, ptr->cenftype);
00404 L("____sons went away\n");
00405 dump(ptr);
00406 check((typecuc *) ptr);
00407 assert(0); // sons went away
00408 #else
00409 assert(0);
00410 #endif
00411 }
00412 } else if (temp == THRUME)
00413 assert(0); // makecutsbackuptohere crum not cut
00414 }
|
|
||||||||||||
|
??? (to be defined) Definition at line 241 of file ndcuts.cxx. References adopt(), assert, typecorecrumhedr::cdsp, typecuc::cdsp, typecorecrumhedr::cenftype, typecuc::cenftype, clear, disown(), dspadd(), dspsub(), findfather(), isfullcrum(), ivemodified(), LEFTMOSTSON, makeroomonleftnd(), roomformoresons(), setwispupwards(), toomanysons(), tumblercheckptr(), typecorecrum, and typedsp. Referenced by peeloffcorrectson(), and peelsoncorrectly().
00244 {
00245 typedsp temp;
00246 typecuc *father;
00247 typedsp grasp;
00248 typewid origin;
00249 typedsp offset;
00250
00251 if (!roomformoresons((typecuc *) newuncle))
00252 assert(0); // noroomfor more sons for newuncle
00253
00254 if (isfullcrum(ptr))
00255 assert(0); // peeloffcurmnd called with fullcrum
00256
00257 ivemodified(ptr); /* to set father->modified */
00258 father = findfather(ptr);
00259 clear(&offset, sizeof(offset));
00260 dspadd(&father->cdsp, &ptr->cdsp, &origin, (int) father->cenftype);
00261 /* 1 ptr->cdsp */
00262 /*
00263 * L("in newpeelcrumoffnd 1 \n"); dumpwid(&father->cdsp);
00264 * dumpwid(&ptr->cdsp); dumpwid(&origin); */
00265 (void)tumblercheckptr((Tumbler *) & origin, (int *) ptr);
00266
00267 makeroomonleftnd((typecuc *) newuncle, &offset, &origin, &grasp);
00268 disown(ptr);
00269 adopt(ptr, LEFTMOSTSON, newuncle);
00270 /* dspsub(&father->cdsp,&newuncle->cdsp,&temp,ptr->cenftype); */
00271 /* 2 &temp <- father->cdsp - newuncle->cdsp check this father temp stuff4/6/85 */
00272 dspadd(&father->cdsp, &ptr->cdsp, &temp, (int) ptr->cenftype);
00273 /*
00274 * dumpwid(&newuncle->cdsp); L("in newpeelcrumoffnd 2 \n");
00275 * dumpwid(&temp); */
00276 (void)tumblercheckptr((Tumbler *) & temp, (int *) ptr);
00277
00278 /* dspadd(&ptr->cdsp,&temp,&ptr->cdsp, ptr->cenftype); */
00279 dspsub(&temp, &newuncle->cdsp, &ptr->cdsp, (int) ptr->cenftype);
00280 /* 3 ptr->cdsp <- temp + ptr->cdsp */
00281 /*
00282 * L("in newpeelcrumoffnd 3 \n"); dumpwid(&ptr->cdsp);
00283 * dump(ptr); */
00284 (void)tumblercheckptr((Tumbler *) & ptr->cdsp, (int *) ptr);
00285
00286 ivemodified(ptr);
00287 ivemodified(newuncle);
00288 /* setwispsofsons(newuncle);// to fix makeroomonleftnd// */
00289 setwispupwards((typecuc *) ptr, 0);
00290 setwispupwards((typecuc *) newuncle, 0);
00291 setwispupwards(father, 1);
00292
00293 if (toomanysons((typecuc *) newuncle))
00294 assert(0); // toomany sons for newuncle
00295
00296 /* L("calling fixincoresubtreewids\n"); */
00297 /* fixincoresubtreewids(findfullcrum(ptr)); */
00298 }
|
|
||||||||||||
|
??? (to be defined) Definition at line 424 of file ndcuts.cxx. References adopt(), typecorecrumhedr::cdsp, typecorecrumhedr::cenftype, createcrum(), findleftson(), findrightbro, typecorecrumhedr::height, movewisp, newpeelcrumoffnd(), RIGHTBRO, roomformoresons(), toomanysons(), and typecorecrum. Referenced by makecutsbackuptohere().
00427 {
00428 typecorecrum *bro, *uncle;
00429
00430 if (toomanysons((typecuc *) ptr)) {
00431 for (bro = findrightbro(ptr); bro; ptr = findrightbro(ptr)) {
00432 if (roomformoresons /* !toomanysons */ ((typecuc *) bro)) {
00433 newpeelcrumoffnd(findleftson((typecuc *) ptr), bro);
00434 return true;
00435 }
00436 }
00437 uncle = createcrum((int) ptr->height, (int) ptr->cenftype);
00438 adopt(uncle, RIGHTBRO, ptr);
00439 movewisp(&ptr->cdsp, &uncle->cdsp);
00440 newpeelcrumoffnd(findleftson((typecuc *) ptr), uncle);
00441 }
00442 return true;
00443 }
|
|
||||||||||||||||||||||||||||
|
??? (to be defined) Definition at line 308 of file ndcuts.cxx. References adopt(), typecorecrumhedr::cdsp, typecorecrumhedr::cenftype, createcrum(), crumleftofithcut(), findleftmostbro(), findrightbro, findrightmostbro(), typecorecrumhedr::height, movewisp, newpeelcrumoffnd(), RIGHTBRO, roomformoresons(), and typecorecrum. Referenced by makeithcutonson().
00315 { /* put son in leftest uncle with room that is less than cut */
00316 typecuc *uncle;
00317
00318 uncle = (typecuc *) findleftmostbro(ptr);
00319 for (; uncle; uncle = (typecuc *) findrightbro((typecorecrum *) uncle)) {
00320 if (uncle == (typecuc *) ptr) {
00321 continue;
00322 }
00323 if (roomformoresons(uncle)) {
00324 if (crumleftofithcut((typecorecrum *) uncle, offset, knives, i)) {
00325 newpeelcrumoffnd((typecorecrum *) son, (typecorecrum *) uncle);
00326 return;
00327 }
00328 }
00329 }
00330 uncle = (typecuc *) createcrum((int) ptr->height, (int) ptr->cenftype);
00331 adopt((typecorecrum *) uncle, RIGHTBRO, findrightmostbro(ptr));
00332 movewisp(&ptr->cdsp, &uncle->cdsp);
00333 newpeelcrumoffnd((typecorecrum *) son, (typecorecrum *) uncle);
00334 }
|
|
||||||||||||||||||||||||
|
??? (to be defined) Definition at line 453 of file ndcuts.cxx. References adopt(), assert, typecorecrumhedr::cdsp, typecorecrumhedr::cenftype, typecorecrumhedr::cwid, typewid::dsas, dspadd(), dump(), dumptumbler(), dumpwholetree(), dumpwid(), Tumbler::exp, is1story(), L, lockis1story(), locksubtract(), Tumbler::mantissa, move2dinfo(), movewisp, NULL, prologuend(), RIGHTBRO, THRUME, tumblerjustify(), tumblerlength(), tumblersub(), typecorecrum, typedsp, whereoncrum(), and widsize. Referenced by makecutsbackuptohere().
00459 {
00460 typedsp grasp /* , reach */ ;
00461 Tumbler localcut;
00462 typewid newwid;
00463 int i;
00464
00465 /* L("entering slicecbcpm \n"); */
00466 int enftype = ptr->cenftype;
00467
00468 prologuend(ptr, offset, &grasp, /* &reach */ (typedsp *) NULL);
00469 if (whereoncrum(ptr, offset, cut, index) != THRUME)
00470 assert(0); // Why are you trying to slice me?
00471
00472 if (!lockis1story(ptr->cwid.dsas, (unsigned)widsize(enftype)))
00473 assert(0); // Not one story in POOM wid
00474
00475 tumblersub(cut, &grasp.dsas[index], &localcut);
00476
00477 if (localcut.exp != ptr->cwid.dsas[index].exp) {
00478 #ifndef DISTRIBUTION
00479 dump(ptr);
00480 dump(newcc);
00481 dumptumbler(cut);
00482 dumptumbler(&localcut);
00483 dumpwholetree(ptr);
00484 assert(0); // Oh well, I thought I understood this1
00485 #else
00486 assert(0);
00487 #endif
00488 }
00489 if (!is1story(&localcut)) {
00490 #ifndef DISTRIBUTION
00491 L("\nin slicecbcpm ptr \n");
00492 dump(ptr);
00493 L("\nin slicecbcpm newcc \n");
00494 dump(newcc);
00495 L("\nin slicecbcpm offset \n");
00496 dumpwid(offset, ptr->cenftype);
00497 L("\nin slicecbcpm grasp \n");
00498 dumpwid(&grasp, ptr->cenftype);
00499 L("\nin slicecbcpm cut \n");
00500 dumptumbler(cut);
00501 L("\nin slicecbcpm localcut \n");
00502 dumptumbler(&localcut);
00503 L("\nin slicecbcpm wholedamn tree \n");
00504 dumpwholetree(ptr);
00505 assert(0); // Oh well, I thought I understood this2
00506 #else
00507 assert(0);
00508 #endif
00509 }
00510
00511 if (tumblerlength(cut) != tumblerlength(&ptr->cwid.dsas[index]))
00512 assert(0); // level mismatch
00513
00514 movewisp(&ptr->cwid, &newwid);
00515 for (i = 0; i < widsize(enftype); i++) { /* I really don't understand this loop */
00516 newwid.dsas[i].mantissa[0] = localcut.mantissa[0];
00517 tumblerjustify(&newwid.dsas[i]);
00518 }
00519
00520 /* locksubtract (&ptr->cwid, &newwid, &newcc->cwid, widsize (enftype)); */
00521 locksubtract((Tumbler *) & ptr->cwid, (Tumbler *) & newwid, (Tumbler *) & newcc->cwid, (unsigned)widsize(enftype));
00522
00523 movewisp(&newwid, &ptr->cwid);
00524 dspadd(&ptr->cdsp, &ptr->cwid, &newcc->cdsp, enftype);
00525 move2dinfo(&((type2dcbc *) ptr)->c2dinfo, &((type2dcbc *) newcc)->c2dinfo);
00526 adopt(newcc, RIGHTBRO, ptr);
00527 /* L("leaving slicecpcpm \n"); */
00528 }
|
|
||||||||||||||||
|
??? (to be defined) Definition at line 119 of file ndcuts.cxx. References crumiscut(), findleftson(), findrightbro, NULL, prologuend(), typecorecrum, and typedsp. Referenced by cutsons(), and makecutsnd().
00123 {
00124 typecuc *son;
00125 typewid grasp;
00126
00127 prologuend((typecorecrum *) ptr, offset, &grasp, (typedsp *) NULL);
00128 for (son = (typecuc *) findleftson(ptr); son; son = (typecuc *) findrightbro((typecorecrum *) son)) {
00129 if (crumiscut(son, &grasp, knives))
00130 return true;
00131 }
00132
00133 return false;
00134 }
|
1.3.4