libsrc/granf2.cxx File Reference

granfilade interface routines More...

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

Include dependency graph for granf2.cxx:

Include dependency graph

Go to the source code of this file.

Functions

void findisatoinsertmolecule (typecuc *fullcrumptr, typehint *hintptr, IStreamAddr *isaptr)
 ???

void klugefindisatoinsertnonmolecule (typecuc *fullcrumptr, typehint *hintptr, IStreamAddr *isaptr)
 ???

void findisatoinsertnonmolecule (typecuc *fullcrumptr, typehint *hintptr, IStreamAddr *isaptr)
 ???

typeorgl fetchorglgr (Session *sess, typegranf fullcrumptr, IStreamAddr *address)
 ???

bool isaexistsgr (typecuc *crumptr, IStreamAddr *isaptr)
 ???

bool findisatoinsertgr (typecuc *fullcrumptr, typehint *hintptr, IStreamAddr *isaptr)
 ???

bool inserttextgr (Session *sess, typegranf fullcrumptr, typehint *hintptr, typetextset textset, typeispanset *ispansetptr)
 ???

bool createorglgr (Session *sess, typegranf fullcrumptr, typehint *hintptr, IStreamAddr *isaptr)
 ???

void findlastisaincbcgr (typecbc *ptr, IStreamAddr *offset)
 ???

void findpreviousisagr (typecorecrum *crumptr, IStreamAddr *upperbound, IStreamAddr *offset)
 ???

typevstuffsetispan2vstuffset (Session *sess, typegranf fullcrumptr, typeispan *ispanptr, typevstuffset *vstuffsetptr)
 ???


Detailed Description

granfilade interface routines

(to be defined)

Definition in file granf2.cxx.


Function Documentation

bool createorglgr Session sess,
typegranf  fullcrumptr,
typehint hintptr,
IStreamAddr isaptr
 

???

(to be defined)

Parameters:
sess  Input: User's session context

Definition at line 266 of file granf2.cxx.

References createenf(), typediskloafptr::diskblocknumber, typegranorgl::diskorglptr, DISKPTRNULL, findisatoinsertgr(), GRANORGL, typegranbottomcruminfo::granstuff, typegranbottomcruminfo::infotype, insertseq(), typediskloafptr::insidediskblocknumber, typegranorgl::orglincore, typegranorgl::orglptr, typegranstuff::orglstuff, POOM, rejuvinate, reserve(), and typecorecrum.

Referenced by createorglingranf().

00267                                          : User's session context
00268     typegranf    fullcrumptr,
00269     typehint    *hintptr,
00270     IStreamAddr *isaptr)
00271 {
00272     typegranbottomcruminfo locinfo;
00273 
00274     if (!findisatoinsertgr((typecuc *) fullcrumptr, hintptr, isaptr))
00275         return false;
00276 
00277     locinfo.infotype = GRANORGL;
00278     locinfo.granstuff.orglstuff.orglptr = createenf(POOM);
00279     reserve((typecorecrum *) locinfo.granstuff.orglstuff.orglptr);
00280 
00281     locinfo.granstuff.orglstuff.orglincore                        = true;
00282     locinfo.granstuff.orglstuff.diskorglptr.diskblocknumber       = DISKPTRNULL;
00283     locinfo.granstuff.orglstuff.diskorglptr.insidediskblocknumber = 0;
00284 
00285     insertseq((typecuc *) fullcrumptr, isaptr, &locinfo);
00286     rejuvinate((typecorecrum *) locinfo.granstuff.orglstuff.orglptr);
00287 
00288     return true;
00289 }

typeorgl fetchorglgr Session sess,
typegranf  fullcrumptr,
IStreamAddr address
 

???

(to be defined)

Parameters:
sess  Input: User's session context

Definition at line 110 of file granf2.cxx.

References assert, typecbc::cinfo, CrumContext::corecrum, crumcontextfree(), debug, typediskloafptr::diskblocknumber, typegranorgl::diskorglptr, DISKPTRNULL, dumptumbler(), GRANORGL, typegranbottomcruminfo::granstuff, typegranbottomcruminfo::infotype, inorgl(), L, LESS, NULL, typegranorgl::orglincore, typegranorgl::orglptr, typegranstuff::orglstuff, rejuvinate, retrievecrums(), CrumContext::totaloffset, tumblercmp(), tumblereq(), typecorecrum, typeorgl, and WIDTH.

Referenced by findorgl().

00111                                          : User's session context
00112     typegranf    fullcrumptr,
00113     IStreamAddr *address)
00114 {
00115     CrumContext *context;
00116     typecuc *ret = NULL;
00117 
00118 #ifndef DISTRIBUTION
00119     if (debug) {
00120         L("fetchorglgr ");
00121         dumptumbler(address);
00122         L("\n");
00123     }
00124 #endif
00125 
00126     if (tumblercmp(&((typecuc *) fullcrumptr)->cwid.dsas[WIDTH], address) == LESS)
00127         return NULL;
00128 
00129     if ((context = retrievecrums((typecuc *) fullcrumptr, address, WIDTH)) == NULL)
00130         return NULL;
00131 
00132     if (!tumblereq((Tumbler *) & context->totaloffset, address)) {
00133         crumcontextfree(context);
00134         return NULL;
00135     }
00136 
00137     if (!context->corecrum->cinfo.granstuff.orglstuff.orglptr && context->corecrum->cinfo.granstuff.orglstuff.diskorglptr.diskblocknumber == DISKPTRNULL) {
00138         assert(0); // No orgl core ptr when diskptr is null
00139     }
00140 
00141     assert(context->corecrum->cinfo.infotype == GRANORGL); // ERROR: I should have found an orgl in fetchorglgr
00142 
00143     if (!context->corecrum->cinfo.granstuff.orglstuff.orglincore) {
00144         if (context->corecrum->cinfo.granstuff.orglstuff.diskorglptr.diskblocknumber == DISKPTRNULL)
00145             assert(0); // fetchorglgr null diskorglptr
00146         inorgl(context->corecrum);
00147     }
00148 
00149     ret = context->corecrum->cinfo.granstuff.orglstuff.orglptr;
00150     if (!ret)
00151         assert(0); // fetchorglgr null orglptr
00152 
00153     crumcontextfree(context);
00154     rejuvinate((typecorecrum *) ret);
00155     return (typeorgl) ret;
00156 }

bool findisatoinsertgr typecuc fullcrumptr,
typehint hintptr,
IStreamAddr isaptr
[static]
 

???

(to be defined)

Definition at line 185 of file granf2.cxx.

References ATOM, findisatoinsertmolecule(), findisatoinsertnonmolecule(), typehint::hintisa, isaexistsgr(), klugefindisatoinsertnonmolecule(), L, typehint::subtype, and tumblerjustify().

Referenced by createorglgr(), and inserttextgr().

00189 {
00190 /* isaexistsgr (fullcrumptr, &hintptr->hintisa); */
00191     if (!isaexistsgr(fullcrumptr, &hintptr->hintisa)) {
00192         if (hintptr->subtype != ATOM) {
00193 
00194             klugefindisatoinsertnonmolecule(fullcrumptr, hintptr, isaptr);
00195             tumblerjustify(isaptr);
00196             return true;
00197         }
00198 #ifndef DISTRIBUTION
00199         L("nothing at hintisa\n");
00200 #endif
00201         return false;
00202     }
00203 
00204     if (hintptr->subtype == ATOM)
00205         findisatoinsertmolecule(fullcrumptr, hintptr, isaptr);
00206     else
00207         findisatoinsertnonmolecule(fullcrumptr, hintptr, isaptr);
00208 
00209     tumblerjustify(isaptr);
00210     return true;
00211 }

void findisatoinsertmolecule typecuc fullcrumptr,
typehint hintptr,
IStreamAddr isaptr
[static]
 

???

(to be defined)

Definition at line 350 of file granf2.cxx.

References assert, typehint::atomtype, clear, findpreviousisagr(), typehint::hintisa, LESS, LINKATOM, TEXTATOM, tumblercmp(), tumblerincrement(), tumblerlength(), and typecorecrum.

Referenced by findisatoinsertgr().

00354 {
00355     IStreamAddr upperbound, lowerbound;
00356 
00357     tumblerincrement(&hintptr->hintisa, 2, hintptr->atomtype + 1, &upperbound);
00358     clear(&lowerbound, sizeof(lowerbound));
00359 
00360     findpreviousisagr((typecorecrum *) fullcrumptr, &upperbound, &lowerbound);
00361     if (tumblerlength(&hintptr->hintisa) == tumblerlength(&lowerbound)) {
00362         tumblerincrement(&lowerbound, 2, hintptr->atomtype, isaptr);
00363         tumblerincrement(isaptr, 1, 1, isaptr);
00364     } else if (hintptr->atomtype == TEXTATOM) {
00365         tumblerincrement(&lowerbound, 0, 1, isaptr);
00366     } else if (hintptr->atomtype == LINKATOM) {
00367         tumblerincrement(&hintptr->hintisa, 2, 2, isaptr);
00368         if (tumblercmp(&lowerbound, isaptr) == LESS)
00369             tumblerincrement(isaptr, 1, 1, isaptr);
00370         else
00371             tumblerincrement(&lowerbound, 0, 1, isaptr);
00372     } else
00373         assert(0); // findisatoinsertmoleculegr
00374 }

void findisatoinsertnonmolecule typecuc fullcrumptr,
typehint hintptr,
IStreamAddr isaptr
[static]
 

???

(to be defined)

Definition at line 410 of file granf2.cxx.

References clear, findpreviousisagr(), typehint::hintisa, typehint::subtype, typehint::supertype, tumblerincrement(), tumblerlength(), tumblertruncate(), and typecorecrum.

Referenced by findisatoinsertgr().

00414 {
00415     int depth      = (hintptr->supertype == hintptr->subtype) ? 1 : 2;
00416     int hintlength = tumblerlength(&hintptr->hintisa);
00417 
00418     IStreamAddr upperbound;
00419     tumblerincrement(&hintptr->hintisa, depth - 1, 1, &upperbound);
00420 
00421     IStreamAddr lowerbound;
00422     clear(&lowerbound, sizeof(lowerbound));
00423 
00424     findpreviousisagr((typecorecrum *) fullcrumptr, &upperbound, &lowerbound);
00425 
00426     tumblertruncate(&lowerbound, hintlength + depth, isaptr);
00427     tumblerincrement(isaptr, (tumblerlength(isaptr) == hintlength) ? depth : 0, 1, isaptr);
00428 }

void findlastisaincbcgr typecbc ptr,
IStreamAddr offset
[static]
 

???

(to be defined)

Definition at line 299 of file granf2.cxx.

References typecbc::cinfo, typegranbottomcruminfo::granstuff, GRANTEXT, typegranbottomcruminfo::infotype, typegrantext::textlength, typegranstuff::textstuff, and tumblerincrement().

Referenced by findpreviousisagr().

00303 {
00304     if (ptr->cinfo.infotype == GRANTEXT)
00305         tumblerincrement(offset, 0, (int) ptr->cinfo.granstuff.textstuff.textlength - 1, offset);
00306 }

void findpreviousisagr typecorecrum crumptr,
IStreamAddr upperbound,
IStreamAddr offset
[static]
 

???

(to be defined)

Definition at line 316 of file granf2.cxx.

References typecorecrumhedr::cwid, typewid::dsas, findlastisaincbcgr(), findleftson(), findrightbro, typecorecrumhedr::height, ONMYRIGHTBORDER, RECURSIVE, typecorecrumhedr::rightbro, THRUME, tumbleradd, typecorecrum, whereoncrum(), and WIDTH.

Referenced by findisatoinsertmolecule(), and findisatoinsertnonmolecule().

00320 {
00321     RECURSIVE                          /* findpreviousisagr */
00322             int tmp;
00323 
00324     /* zzz? if (!offset) tumblerclear (offset); */
00325     if (crumptr->height == 0) {
00326         findlastisaincbcgr((typecbc *) crumptr, offset);
00327         return;
00328     }
00329 
00330     typecorecrum *ptr;
00331     for (ptr = findleftson((typecuc *) crumptr); ptr; ptr = findrightbro(ptr)) {
00332         if ((tmp = whereoncrum(ptr, (typewid *) offset, upperbound, WIDTH)) == THRUME
00333             || tmp == /*ONMYLEFTBORDER*/ ONMYRIGHTBORDER || !ptr->rightbro) {
00334             findpreviousisagr(ptr, upperbound, offset);
00335             return;
00336         } else {
00337             tumbleradd(offset, &ptr->cwid.dsas[WIDTH], offset);
00338         }
00339     }
00340 }

bool inserttextgr Session sess,
typegranf  fullcrumptr,
typehint hintptr,
typetextset  textset,
typeispanset ispansetptr
 

???

(to be defined)

Parameters:
sess  Input: User's session context

Definition at line 221 of file granf2.cxx.

References findisatoinsertgr(), typegranbottomcruminfo::granstuff, GRANTEXT, typegranbottomcruminfo::infotype, insertseq(), ISPANID, typespan::itemid, typetext::length, movetumbler, movmem, typetext::next, typespan::next, NULL, typespan::stream, typetext::string, typegrantext::textlength, typegrantext::textstring, typegranstuff::textstuff, tumblerincrement(), tumblersub(), typeispan, typeispanset, typetextset, and typespan::width.

Referenced by inserttextingranf().

00222                                           : User's session context
00223     typegranf     fullcrumptr,
00224     typehint     *hintptr,
00225     typetextset   textset,
00226     typeispanset *ispansetptr)
00227 {
00228     typegranbottomcruminfo locinfo;
00229     typeispan *ispanptr;
00230 
00231     IStreamAddr lsa;
00232     if (!findisatoinsertgr((typecuc *) fullcrumptr, hintptr, &lsa))
00233         return false;
00234 
00235     Tumbler spanorigin;
00236     movetumbler(&lsa, &spanorigin);
00237 
00238     for (; textset; textset = textset->next) {
00239         locinfo.infotype = GRANTEXT;
00240         locinfo.granstuff.textstuff.textlength = textset->length;
00241         movmem(textset->string, locinfo.granstuff.textstuff.textstring, locinfo.granstuff.textstuff.textlength);
00242         insertseq((typecuc *) fullcrumptr, &lsa, &locinfo);
00243         tumblerincrement(&lsa, 0, textset->length, &lsa);
00244     }
00245 
00246     ispanptr         = new(sess) typeispan;
00247 //    ispanptr = (typeispan *) sess->alloc(sizeof(typeispan));
00248     ispanptr->itemid = ISPANID;
00249     ispanptr->next   = NULL;
00250 
00251     movetumbler(&spanorigin, &ispanptr->stream);
00252     tumblersub(&lsa, &spanorigin, &ispanptr->width);
00253     *ispansetptr = ispanptr;
00254 
00255     return true;
00256 }

bool isaexistsgr typecuc crumptr,
IStreamAddr isaptr
[static]
 

???

(to be defined)

Definition at line 166 of file granf2.cxx.

References contextfree(), retrieve(), ContextBase::totaloffset, tumblereq(), and WIDTH.

Referenced by findisatoinsertgr().

00169 {
00170     Context *context = retrieve(crumptr, isaptr, WIDTH);
00171     bool ret = tumblereq((Tumbler *) &context->totaloffset, isaptr);
00172 
00173     contextfree(context);
00174     return ret;
00175 }

typevstuffset* ispan2vstuffset Session sess,
typegranf  fullcrumptr,
typeispan ispanptr,
typevstuffset vstuffsetptr
 

???

(to be defined)

Parameters:
sess  Input: User's session context

Definition at line 438 of file granf2.cxx.

References context2vstuff(), contextfree(), foocontext(), foocontextlist(), foohex(), movetumbler, ContextBase::nextcontext, NULL, retrieveinspan(), typespan::stream, tumbleradd, typeispan, typevstuffset, typespan::width, and WIDTH.

Referenced by ispanset2vstuffset().

00439                                            : User's session context
00440     typegranf      fullcrumptr,
00441     typeispan     *ispanptr,
00442     typevstuffset *vstuffsetptr)
00443 {
00444     typevstuffset vstuffset;
00445     Context *temp;
00446 
00447     *vstuffsetptr = NULL;
00448 
00449     IStreamAddr lowerbound;
00450     movetumbler(&ispanptr->stream, &lowerbound);
00451 
00452     IStreamAddr upperbound;
00453     tumbleradd(&lowerbound, &ispanptr->width, &upperbound);
00454 
00455     Context *context = retrieveinspan((typecuc *) fullcrumptr, &lowerbound, &upperbound, WIDTH);
00456 
00457 #ifndef DISTRIBUTION
00458     foocontextlist("retrieveinspan returning\n", context);
00459 #endif
00460 
00461     for (temp = context; temp; temp = (Context *) temp->nextcontext) {
00462 #ifndef DISTRIBUTION
00463         foocontext("passing context temp =", temp);
00464 #endif
00465         if (context2vstuff(sess, temp, ispanptr, &vstuffset)) {
00466 #ifndef DISTRIBUTION
00467             foohex("vstuffsetptr = ", (int) vstuffsetptr);
00468             foohex("vstuffset = ", (int) vstuffset);
00469             foohex("&vstuffset->next = ", (int) &((typeitemheader *) vstuffset)->next);
00470 #endif
00471             *vstuffsetptr = vstuffset;
00472             vstuffsetptr = (typevstuffset *) & ((typeitemheader *) vstuffset)->next;
00473         }
00474     }
00475 
00476     contextfree(context);
00477     return vstuffsetptr;
00478 }

void klugefindisatoinsertnonmolecule typecuc fullcrumptr,
typehint hintptr,
IStreamAddr isaptr
[static]
 

???

(to be defined)

Definition at line 384 of file granf2.cxx.

References typehint::hintisa, and tumblercopy().

Referenced by findisatoinsertgr().

00388 {
00389 /* IStreamAddr upperbound, lowerbound; int depth, hintlength; depth = hintptr->supertype == hintptr->subtype ? 1 : 2;
00390  * hintlength = tumblerlength (&hintptr->hintisa); tumblerincrement (&hintptr->hintisa, depth - 1, 1, &upperbound);
00391  * clear (&lowerbound, sizeof(lowerbound)); findpreviousisagr (fullcrumptr, &upperbound, &lowerbound); tumblertruncate
00392  * (&lowerbound, hintlength + depth, isaptr);
00393  * tumblerincrement(isaptr,tumblerlength(isaptr)==hintlength?depth:0,1,isaptr); */
00394 #ifdef UnDeFIned
00395 
00396     tumblercopy( /* & */ hintptr /*->hintisa*/ , isaptr);       /* ECH 8-30-88 was hintptr, not &hintptr->hintisa */
00397 #endif
00398     tumblercopy(&hintptr->hintisa, isaptr);
00399 
00400 }


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