libsrc/retrie.cxx File Reference

integrated enfilade retrieve routines More...

#include <memory.h>
#include "udanax.h"

Include dependency graph for retrie.cxx:

Include dependency graph

Go to the source code of this file.

Defines

#define intervalcmppart1(left, address)   cmp = tumblercmp ((address), (left)); if (cmp == LESS) return (TOMYLEFT); else if (cmp == EQUAL) return (ONMYLEFTBORDER);
#define intervalcmppart2(right, address)   cmp = tumblercmp ((address), (right)); if (cmp == LESS) return (THRUME); else if (cmp == EQUAL) return (ONMYRIGHTBORDER); else return (TOMYRIGHT);

Functions

CrumContextfindcbcseqcrum (typecorecrum *ptr, typedsp *offsetptr, Tumbler *address)
 ???

Contextfindcbcseq (typecorecrum *ptr, typedsp *offsetptr, Tumbler *address)
 ???

Contextfindcbcnd (typecorecrum *father, typewid *offsetptr, Tumbler *address, int index)
 ???

bool crumqualifies2d (typecorecrum *crumptr, typedsp *offset, Tumbler *span1start, Tumbler *span1end, int index1, Tumbler *span2start, Tumbler *span2end, int index2, type2dbottomcruminfo *infoptr)
 ???

void findcbcinarea2d (typecorecrum *crumptr, typedsp *offsetptr, Tumbler *span1start, Tumbler *span1end, int index1, Tumbler *span2start, Tumbler *span2end, int index2, Context **headptr, typebottomcruminfo *infoptr)
 ???

CrumContextretrievecrums (typecuc *fullcrumptr, Tumbler *address, int index)
 ???

Contextretrieve (typecuc *fullcrumptr, Tumbler *address, int index)
 ???

Contextretrieveinarea (typecuc *fullcrumptr, Tumbler *span1start, Tumbler *span1end, int index1, Tumbler *span2start, Tumbler *span2end, int index2, typebottomcruminfo *infoptr)
 ???

Contextretrieverestricted (typecuc *fullcrumptr, typespan *span1ptr, int index1, typespan *span2ptr, int index2, IStreamAddr *docisaptr)
 ???

Contextfindlastcbcseq (typecorecrum *fullcrumptr)
 ???

bool crumintersectsspanseq (typecorecrum *crumptr, Tumbler *offsetptr, Tumbler *spanstart, Tumbler *spanend)
 ???

void findcbcinspanseq (typecorecrum *crumptr, typewid *offsetptr, Tumbler *spanstart, Tumbler *spanend, Context **headptr)
 ???

Contextretrieveinspan (typecuc *fullcrumptr, Tumbler *spanstart, Tumbler *spanend, int index)
 ???

void prologuend (typecorecrum *ptr, typedsp *offset, typedsp *grasp, typedsp *reach)
 ???

int whereoncrum (typecorecrum *ptr, typewid *offset, Tumbler *address, int index)
 ???


Detailed Description

integrated enfilade retrieve routines

(to be defined)

Definition in file retrie.cxx.


Define Documentation

#define intervalcmppart1 left,
address   )     cmp = tumblercmp ((address), (left)); if (cmp == LESS) return (TOMYLEFT); else if (cmp == EQUAL) return (ONMYLEFTBORDER);
 

Definition at line 566 of file retrie.cxx.

#define intervalcmppart2 right,
address   )     cmp = tumblercmp ((address), (right)); if (cmp == LESS) return (THRUME); else if (cmp == EQUAL) return (ONMYRIGHTBORDER); else return (TOMYRIGHT);
 

Definition at line 568 of file retrie.cxx.


Function Documentation

bool crumintersectsspanseq typecorecrum crumptr,
Tumbler offsetptr,
Tumbler spanstart,
Tumbler spanend
[static]
 

???

(to be defined)

Definition at line 462 of file retrie.cxx.

References typecorecrumhedr::cwid, typewid::dsas, iszerotumbler, ONMYLEFTBORDER, ONMYRIGHTBORDER, typecorecrum, whereoncrum(), and WIDTH.

Referenced by findcbcinspanseq().

00467 {
00468     if (iszerotumbler(&crumptr->cwid.dsas[WIDTH]))
00469         return false;
00470 
00471     return (whereoncrum(crumptr, (typewid *) offsetptr, spanstart, WIDTH) < ONMYRIGHTBORDER)
00472             && (whereoncrum(crumptr, (typewid *) offsetptr, spanend, WIDTH) >
00473                 /*=*/ ONMYLEFTBORDER);
00474 }

bool crumqualifies2d typecorecrum crumptr,
typedsp offset,
Tumbler span1start,
Tumbler span1end,
int  index1,
Tumbler span2start,
Tumbler span2end,
int  index2,
type2dbottomcruminfo infoptr
[static]
 

???

(to be defined)

Definition at line 189 of file retrie.cxx.

References typecorecrumhedr::height, type2dbottomcruminfo::homedoc, iszerotumbler, L, ONMYLEFTBORDER, THRUME, TOMYRIGHT, tumblereq(), typecorecrum, typedsp, and whereoncrum().

Referenced by findcbcinarea2d().

00200 {
00201     int startcmp, endcmp;
00202 
00203 /* foocrum("entering crumqualifies2d\n",crumptr); */
00204     if ((crumptr->height == 0) && infoptr && !tumblereq(&infoptr->homedoc, &(((type2dcbc *) crumptr)->c2dinfo.homedoc))) {
00205 #ifndef DISTRIBUTION
00206         L("mumble homedoc");
00207 #endif
00208 /* foo("returningfalse case a"); */
00209         return false;
00210     }
00211 
00212     endcmp = iszerotumbler(span1end) ? TOMYRIGHT : whereoncrum(crumptr, offset, span1end, index1);
00213     if (endcmp <= /*=*/ ONMYLEFTBORDER)
00214         return false;
00215 
00216     startcmp = whereoncrum(crumptr, offset, span1start, index1);
00217     if ((startcmp > THRUME /* && endcmp > THRUME */ ))
00218         return false;
00219 
00220     endcmp = iszerotumbler(span2end) ? TOMYRIGHT : whereoncrum(crumptr, offset, span2end, index2);
00221     if (endcmp < ONMYLEFTBORDER) /* <= was < 12/20/84 */
00222         return false;
00223 
00224     startcmp = whereoncrum(crumptr, offset, span2start, index2);
00225     if ((startcmp > THRUME /* && endcmp > THRUME */ ))
00226         return false;
00227 
00228     return true;
00229 }

void findcbcinarea2d typecorecrum crumptr,
typedsp offsetptr,
Tumbler span1start,
Tumbler span1end,
int  index1,
Tumbler span2start,
Tumbler span2end,
int  index2,
Context **  headptr,
typebottomcruminfo infoptr
[static]
 

???

(to be defined)

Definition at line 239 of file retrie.cxx.

References assert, typecorecrumhedr::cdsp, typecorecrumhedr::cenftype, crumqualifies2d(), dspadd(), findleftson(), getrightbro, typecorecrumhedr::height, incontextlistnd(), L, makecontextfromcbc(), typecorecrum, and typedsp.

Referenced by retrieveinarea().

00250 {
00251     typedsp localoffset;
00252     Context *context;
00253 
00254 #ifndef DISTRIBUTION
00255 /* foo(" entering findcbcinarea2d\n"); */
00256 /* footumbler("span1start = ",span1start); */
00257 /* footumbler("span1end = ",span1end); */
00258 /* footumbler("span2start = ",span2start); */
00259 /* footumbler("span2end = ",span2end); */
00260 /* foodsp("offset = ",offsetptr,crumptr->cenftype); */
00261     if (infoptr) {
00262         L("not NULL infoptr versions mumble specialcase 11/27/84 shouldent happen till we try something fancier\n");
00263         assert(0); // findcbcinarea2d
00264     }
00265 #else
00266     if (infoptr)
00267         assert(0); // !NULL
00268 #endif
00269 
00270     for (; crumptr; crumptr = getrightbro(crumptr)) {
00271         if (!crumqualifies2d(crumptr, offsetptr, span1start, span1end, index1, span2start, span2end, index2, (type2dbottomcruminfo *) infoptr))
00272             continue;
00273 
00274 /* foocrum("crumqualifies in findcbcinarea2d\n",crumptr); */
00275         if (crumptr->height != 0) {
00276             dspadd(offsetptr, &crumptr->cdsp, &localoffset, (int) crumptr->cenftype);
00277             findcbcinarea2d(findleftson((typecuc *) crumptr), &localoffset, span1start, span1end, index1, span2start, span2end, index2, headptr, infoptr);
00278         } else {
00279 /* foo("make context in findcbcinarea2d\n"); */
00280             context = makecontextfromcbc((typecbc *) crumptr, (typewid *) offsetptr);
00281             incontextlistnd(headptr, context, index1);
00282         }
00283     }
00284 
00285 /* contextfree(context); */
00286 /* foo("leaving findcbcinarea2d\n"); */
00287 }

void findcbcinspanseq typecorecrum crumptr,
typewid offsetptr,
Tumbler spanstart,
Tumbler spanend,
Context **  headptr
[static]
 

???

(to be defined)

Definition at line 484 of file retrie.cxx.

References typecorecrumhedr::cenftype, crumintersectsspanseq(), typecorecrumhedr::cwid, dspadd(), findleftson(), getrightbro, typecorecrumhedr::height, makecontextfromcbc(), movewisp, oncontextlistseq(), and typecorecrum.

Referenced by retrieveinspan().

00490 {
00491     typewid localoffset;
00492     Context *context;
00493 
00494     movewisp(offsetptr, &localoffset);
00495     for (; crumptr; crumptr = getrightbro(crumptr)) {
00496         if (!crumintersectsspanseq(crumptr, (Tumbler *) & localoffset, spanstart, spanend)) {
00497             dspadd(&localoffset, &crumptr->cwid, &localoffset, (int) crumptr->cenftype);
00498             continue;
00499         }
00500 
00501         if (crumptr->height == 0) {
00502             context = makecontextfromcbc((typecbc *) crumptr, offsetptr);
00503             oncontextlistseq(headptr, context);
00504         } else {
00505             findcbcinspanseq(findleftson((typecuc *) crumptr), &localoffset, spanstart, spanend, headptr);
00506         }
00507 
00508         dspadd(&localoffset, &crumptr->cwid, &localoffset, (int) crumptr->cenftype);
00509     }
00510 }

Context* findcbcnd typecorecrum father,
typewid offsetptr,
Tumbler address,
int  index
[static]
 

???

(to be defined)

Definition at line 155 of file retrie.cxx.

References findleftson(), getrightbro, typecorecrumhedr::height, makecontextfromcbc(), NULL, ONMYLEFTBORDER, prologuend(), THRUME, typecorecrum, typedsp, and whereoncrum().

Referenced by retrieve().

00160 {
00161     typecorecrum *ptr;
00162     typewid       grasp;
00163     Context      *retr = NULL;
00164     int           cmp;
00165 
00166     if ((cmp = whereoncrum(father, offsetptr, address, index)) < ONMYLEFTBORDER || cmp > THRUME)
00167         return NULL;
00168 
00169     if (father->height != 0) {
00170         prologuend(father, offsetptr, &grasp, (typedsp *) NULL);
00171         for (ptr = findleftson((typecuc *) father); ptr; ptr = getrightbro(ptr))
00172             if ((retr = findcbcnd(ptr, &grasp, address, index)) != 0)
00173                 break;
00174 
00175     } else                           /* FOUND IT! */
00176         retr = makecontextfromcbc((typecbc *) father, offsetptr);
00177 
00178     return retr;
00179 }

Context* findcbcseq typecorecrum ptr,
typedsp offsetptr,
Tumbler address
[static]
 

???

(to be defined)

Definition at line 128 of file retrie.cxx.

References typecorecrumhedr::cenftype, typecorecrumhedr::cwid, dspadd(), findleftson(), getrightbro, typecorecrumhedr::height, makecontextfromcbc(), typecorecrumhedr::rightbro, THRUME, typecorecrum, typedsp, whereoncrum(), and WIDTH.

Referenced by retrieve().

00132 {
00133     for (; getrightbro(ptr); ptr = ptr->rightbro) {
00134         if (whereoncrum(ptr, offsetptr, address, WIDTH) <= THRUME)
00135             break;
00136 
00137         dspadd(offsetptr, &ptr->cwid, offsetptr, (int) ptr->cenftype);
00138     }
00139 
00140     if (ptr->height != 0) {
00141         ptr = findleftson((typecuc *) ptr);
00142         return findcbcseq(ptr, offsetptr, address);
00143     } else
00144         return makecontextfromcbc((typecbc *) ptr, (typewid *) offsetptr);
00145 }

CrumContext* findcbcseqcrum typecorecrum ptr,
typedsp offsetptr,
Tumbler address
[static]
 

???

(to be defined)

Definition at line 98 of file retrie.cxx.

References assert, typecorecrumhedr::cenftype, createcrumcontext(), typecorecrumhedr::cwid, dspadd(), findleftson(), getrightbro, typecorecrumhedr::height, typecorecrumhedr::rightbro, THRUME, typecorecrum, typedsp, whereoncrum(), and WIDTH.

Referenced by retrievecrums().

00102 {
00103     if (!ptr)
00104         assert(0); // findcbcseqcrum called with NULL ptr
00105 
00106     for (; getrightbro(ptr); ptr = ptr->rightbro) {
00107         if (whereoncrum(ptr, offsetptr, address, WIDTH) <= THRUME)
00108             break;
00109 
00110         dspadd(offsetptr, &ptr->cwid, offsetptr, (int) ptr->cenftype);
00111     }
00112 
00113     if (ptr->height != 0) {
00114         ptr = findleftson((typecuc *) ptr);
00115         return findcbcseqcrum(ptr, offsetptr, address);
00116     } else
00117         return createcrumcontext(ptr, offsetptr);
00118 }

Context* findlastcbcseq typecorecrum fullcrumptr  )  [static]
 

???

(to be defined)

Definition at line 435 of file retrie.cxx.

References assert, typecorecrumhedr::cwid, typewid::dsas, findleftson(), getrightbro, typecorecrumhedr::height, makecontextfromcbc(), NULL, typecorecrumhedr::rightbro, tumbleradd, tumblerclear, typecorecrum, and WIDTH.

Referenced by retrieveinspan().

00437 {
00438     Tumbler offset;
00439     tumblerclear(&offset);
00440 
00441     typecorecrum *ptr;
00442     for (ptr = fullcrumptr; ptr; ptr = findleftson((typecuc *) ptr)) {
00443         for (; getrightbro(ptr); ptr = ptr->rightbro)
00444             tumbleradd(&offset, &ptr->cwid.dsas[WIDTH], &offset);
00445 
00446         if (ptr->height == 0)
00447             return makecontextfromcbc((typecbc *) ptr, (typewid *) &offset);
00448     }
00449 
00450     assert(0); // in findlastcbcseq couldn't find anything
00451     return NULL;                     /* for lint */
00452 }

void prologuend typecorecrum ptr,
typedsp offset,
typedsp grasp,
typedsp reach
 

???

(to be defined)

Definition at line 555 of file retrie.cxx.

References typecorecrumhedr::cdsp, typecorecrumhedr::cenftype, typecorecrumhedr::cwid, dspadd(), typecorecrum, and typedsp.

Referenced by cutsons(), deletend(), findcbcnd(), findnextaddressinvspace(), findvsatoappend(), isanextensionnd(), makecutsbackuptohere(), makecutsdownnd(), makegappm(), makeroomonleftnd(), rearrangend(), slicecbcpm(), sonsarecut(), and takenephewnd().

00560 {
00561     dspadd(offset, &ptr->cdsp, grasp, (int) ptr->cenftype);
00562     if (reach)
00563         dspadd(grasp, &ptr->cwid, reach, (int) ptr->cenftype);
00564 }

Context* retrieve typecuc fullcrumptr,
Tumbler address,
int  index
 

???

(to be defined)

Definition at line 321 of file retrie.cxx.

References assert, typecuc::cenftype, clear, findcbcnd(), findcbcseq(), GRAN, NULL, POOM, SPAN, typecorecrum, and typedsp.

Referenced by isaexistsgr().

00326 {
00327     typedsp offset;
00328 
00329     clear(&offset, sizeof(typedsp));
00330     switch (fullcrumptr->cenftype) {
00331     case GRAN:
00332         return findcbcseq((typecorecrum *) fullcrumptr, &offset, address);
00333     case SPAN:
00334     case POOM:
00335         return findcbcnd((typecorecrum *) fullcrumptr, &offset, address, index);
00336     default:
00337         assert(0); // retrieve - bad enftype
00338         return NULL;
00339     }
00340 }

CrumContext* retrievecrums typecuc fullcrumptr,
Tumbler address,
int  index
 

???

(to be defined)

Definition at line 297 of file retrie.cxx.

References assert, typecuc::cenftype, clear, findcbcseqcrum(), GRAN, NULL, typecorecrum, and typedsp.

Referenced by fetchorglgr(), and insertseq().

00301 {
00302     typedsp offset;
00303     clear(&offset, sizeof(typedsp));
00304 
00305     if (fullcrumptr->cenftype == GRAN)
00306         return findcbcseqcrum((typecorecrum *) fullcrumptr, &offset, address);
00307     else {
00308         assert(0); // retrivecrum - bad enftype
00309         return NULL;                 /* for lint */
00310     }
00311 }

Context* retrieveinarea typecuc fullcrumptr,
Tumbler span1start,
Tumbler span1end,
int  index1,
Tumbler span2start,
Tumbler span2end,
int  index2,
typebottomcruminfo infoptr
[static]
 

???

(to be defined)

Definition at line 350 of file retrie.cxx.

References assert, typecuc::cenftype, clear, findcbcinarea2d(), NULL, POOM, SPAN, typecorecrum, and typedsp.

Referenced by retrieverestricted().

00359 {
00360 /* foo("entering retrieveinarea\n"); */
00361     typedsp offset;
00362     clear(&offset, sizeof(offset));
00363 
00364     Context *context = NULL;
00365 
00366     switch (fullcrumptr->cenftype) {
00367     case SPAN:
00368     case POOM:
00369         findcbcinarea2d((typecorecrum *) fullcrumptr, &offset, span1start, span1end, index1, span2start, span2end,
00370                         index2, &context, infoptr);
00371         break;
00372     default:
00373 /* L("%s\n", enftypestring (fullcrumptr->cenftype)); */
00374         assert(0); // retrieveinarea - wrong enftype
00375     }
00376 /* foo("leaving retrieveinarea\n"); */
00377 
00378     return context;
00379 }

Context* retrieveinspan typecuc fullcrumptr,
Tumbler spanstart,
Tumbler spanend,
int  index
 

???

(to be defined)

Definition at line 520 of file retrie.cxx.

References assert, typecuc::cenftype, clear, typecorecrumhedr::cwid, typewid::dsas, findcbcinspanseq(), findlastcbcseq(), GRAN, GREATER, NULL, oncontextlistseq(), tumblercmp(), typecorecrum, typedsp, and WIDTH.

Referenced by ispan2vstuffset().

00525 {
00526     typedsp offset;
00527     clear(&offset, sizeof(offset));
00528 
00529     Context *context = NULL;
00530 
00531     switch (fullcrumptr->cenftype) {
00532     case GRAN:
00533         findcbcinspanseq((typecorecrum *) fullcrumptr, &offset, spanstart, spanend, &context);
00534         if (tumblercmp(spanend, &fullcrumptr->cwid.dsas[WIDTH]) == GREATER) {
00535             Context *c = findlastcbcseq((typecorecrum *) fullcrumptr);
00536             oncontextlistseq(&context, c);
00537         }
00538         return context;
00539     default:
00540         assert(0); // retrieveinspan - wrong enftype
00541         return NULL;
00542     }
00543 }

Context* retrieverestricted typecuc fullcrumptr,
typespan span1ptr,
int  index1,
typespan span2ptr,
int  index2,
IStreamAddr docisaptr
 

???

(to be defined)

Definition at line 389 of file retrie.cxx.

References type2dbottomcruminfo::homedoc, movetumbler, NULL, retrieveinarea(), typespan::stream, tumbleradd, tumblerclear, and typespan::width.

Referenced by finddocscontainingsp(), link2sporglset(), retrievesporglsetinrange(), span2spanset(), and sporglset2linksetinrange().

00396 {
00397     Tumbler span1start, span1end, span2start, span2end;
00398     type2dbottomcruminfo info, *infoptr;
00399 
00400     if (span1ptr) {
00401         movetumbler(&span1ptr->stream, &span1start);
00402         tumbleradd(&span1start, &span1ptr->width, &span1end);
00403     } else {
00404         tumblerclear(&span1start);
00405         tumblerclear(&span1end);
00406     }
00407 
00408     if (span2ptr) {
00409         movetumbler(&span2ptr->stream, &span2start);
00410         tumbleradd(&span2start, &span2ptr->width, &span2end);
00411     } else {
00412         tumblerclear(&span2start);
00413         tumblerclear(&span2end);
00414     }
00415 
00416     if (docisaptr) {
00417         movetumbler(docisaptr, &info.homedoc /* shouldberestrictiondoc */ );
00418         infoptr = &info;
00419     } else {
00420         infoptr = NULL;
00421     }
00422 
00423     return retrieveinarea(fullcrumptr, &span1start, &span1end, index1, &span2start, &span2end, index2,
00424                           (typebottomcruminfo *) infoptr);
00425 }

int whereoncrum typecorecrum ptr,
typewid offset,
Tumbler address,
int  index
 

???

(to be defined)

Definition at line 578 of file retrie.cxx.

References assert, typecorecrumhedr::cdsp, typecorecrumhedr::cenftype, typecorecrumhedr::cwid, typewid::dsas, EQUAL, GRAN, intervalcmp(), LESS, ONMYLEFTBORDER, ONMYRIGHTBORDER, POOM, SPAN, THRUME, TOMYLEFT, TOMYRIGHT, tumbleradd, tumblercmp(), typecorecrum, and WIDTH.

Referenced by crumintersectsspanseq(), crumiscut(), crumiscutbyithknife(), crumleftofithcut(), crumqualifies2d(), deletecutsectionnd(), findcbcnd(), findcbcseq(), findcbcseqcrum(), findnextaddressinvspace(), findpreviousisagr(), findsontoinsertundernd(), insertcutsectionnd(), makecutsbackuptohere(), makeithcutonson(), rearrangecutsectionnd(), and slicecbcpm().

00585 {
00586     Tumbler left, right;
00587     int cmp;
00588 
00589     switch (ptr->cenftype) {
00590     case GRAN:
00591         tumbleradd(&offset->dsas[WIDTH], &ptr->cwid.dsas[WIDTH], &right);
00592         return intervalcmp(&offset->dsas[WIDTH], &right, address);
00593 
00594     case SPAN:
00595     case POOM:
00596         tumbleradd(&offset->dsas[index], &ptr->cdsp.dsas[index], &left);
00597         cmp = tumblercmp(address, &left);
00598         if (cmp == LESS) {
00599             return TOMYLEFT;
00600         } else if (cmp == EQUAL) {
00601             return ONMYLEFTBORDER;
00602         }
00603 
00604 /* intervalcmppart1(&left,address); */
00605         tumbleradd(&left, &ptr->cwid.dsas[index], &right);
00606         cmp = tumblercmp(address, &right);
00607         if (cmp == LESS) {
00608             return THRUME;
00609         } else if (cmp == EQUAL) {
00610             return ONMYRIGHTBORDER;
00611         } else {
00612             return TOMYRIGHT;
00613         }
00614 
00615 /* intervalcmppart2(&right,address); */
00616 /* #ifndef DISTRIBUTION assert(0); "whereoncrum:can't get here" #else assert(0); #endif */
00617 /* 
00618  * tumbleradd(&offset->dsas[index],&ptr->cdsp.dsas[index], &left); tumbleradd 
00619  * (&left, &ptr->cwid.dsas[index], &right); return (intervalcmp (&left,
00620  * &right, address)); */
00621     default:
00622         assert(0); // whereoncrum: bad enftype
00623     }
00624 
00625     assert(0); // whereoncrum: can't get here either
00626     return 0;                        /* for lint */
00627 }


Generated on Sun Aug 21 04:18:36 2005 for Udanax-Green by doxygen1.3.4