libsrc/insertnd.cxx File Reference

??? More...

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

Include dependency graph for insertnd.cxx:

Include dependency graph

Go to the source code of this file.

Functions

int widdiffs (typecuc *crumptr)
 ???

void findaddressofsecondcutforinsert (Tumbler *position, Tumbler *secondcut)
 ???

void makegappm (Session *sess, typecuc *fullcrumptr, typewid *origin, typewid *width)
 ???

void firstinsertionnd (typecuc *father, typewid *origin, typewid *width, type2dbottomcruminfo *infoptr)
 ???

bool isanextensionnd (typecbc *ptr, typedsp *offsetptr, typedsp *originptr, type2dbottomcruminfo *infoptr)
 ???

int insertcbcnd (typecuc *father, typedsp *grasp, typewid *origin, typewid *width, type2dbottomcruminfo *infoptr)
 ???

typecorecrumfindsontoinsertundernd (typecuc *father, typedsp *grasp, typewid *origin, typewid *width, int index)
 ???

int insertmorend (typecuc *father, typedsp *offset, typewid *origin, typewid *width, type2dbottomcruminfo *infoptr, int index)
 ???

int doinsertnd (typecuc *father, typewid *origin, typewid *width, type2dbottomcruminfo *infoptr, int index)
 ???

void insertnd (Session *sess, typecuc *fullcrumptr, typewid *origin, typewid *width, type2dbottomcruminfo *infoptr, int index)
 ???


Detailed Description

???

(to be defined)

Definition in file insertnd.cxx.


Function Documentation

int doinsertnd typecuc father,
typewid origin,
typewid width,
type2dbottomcruminfo infoptr,
int  index
[static]
 

???

???

Definition at line 361 of file insertnd.cxx.

References assert, clear, typewid::dsas, firstinsertionnd(), insertmorend(), isemptyenfilade(), iszerotumbler, and typedsp.

Referenced by insertnd().

00367 {
00368     typedsp offset;
00369 
00370     if (iszerotumbler(&width->dsas[index]))
00371         assert(0); // zero width in doinsertnd
00372 
00373     if (isemptyenfilade(father)) {
00374         firstinsertionnd(father, origin, width, infoptr);
00375         return false;
00376     }
00377     clear(&offset, sizeof(typedsp));
00378     return insertmorend(father, &offset, origin, width, infoptr, index);
00379 }

void findaddressofsecondcutforinsert Tumbler position,
Tumbler secondcut
[static]
 

???

???

Definition at line 113 of file insertnd.cxx.

References beheadtumbler(), tumblerclear, tumblerincrement(), and tumblerintdiff().

Referenced by makegappm().

00116 {                                      /* needs this to give it a place to find intersectionof for text is 2.1 */
00117     Tumbler zero, intpart;
00118 
00119     tumblerclear(&zero);
00120     tumblerincrement(position, -1, 1, secondcut);
00121     beheadtumbler(position, &intpart);
00122     tumblerincrement(secondcut, 0, -tumblerintdiff(&intpart, &zero), secondcut);
00123     tumblerincrement(secondcut, 1, 1, secondcut);
00124 }

typecorecrum* findsontoinsertundernd typecuc father,
typedsp grasp,
typewid origin,
typewid width,
int  index
[static]
 

???

???

Definition at line 289 of file insertnd.cxx.

References assert, typecorecrumhedr::cdsp, typewid::dsas, findleftson(), findrightbro, GREATER, iszerotumbler, LESS, ONMYLEFTBORDER, ONMYRIGHTBORDER, tumbleradd, tumblercmp(), typecorecrum, typedsp, and whereoncrum().

Referenced by insertmorend().

00295 {
00296     typecorecrum *ptr, *nearestonleft;
00297     Tumbler spanend, sonstart;
00298 
00299     if (iszerotumbler(&width->dsas[index]))
00300         assert(0); // width is zero in findsontoinsertundernd
00301 
00302     tumbleradd(&origin->dsas[index], &width->dsas[index], &spanend);
00303 
00304     ptr = nearestonleft = findleftson(father);
00305 
00306     for (; ptr; ptr = findrightbro(ptr)) {
00307         tumbleradd(&grasp->dsas[index], &ptr->cdsp.dsas[index], &sonstart);
00308         if (tumblercmp(&sonstart, &origin->dsas[index]) != GREATER
00309             && tumblercmp(&ptr->cdsp.dsas[index], &nearestonleft->cdsp.dsas[index]) != LESS) {
00310             nearestonleft = ptr;
00311         }
00312 
00313         if (whereoncrum(ptr, grasp, &origin->dsas[index], index) >= ONMYLEFTBORDER
00314             && whereoncrum(ptr, grasp, &spanend, index) <= ONMYRIGHTBORDER)
00315             return ptr;
00316     }
00317     return nearestonleft;
00318 }

void firstinsertionnd typecuc father,
typewid origin,
typewid width,
type2dbottomcruminfo infoptr
[static]
 

???

???

Definition at line 197 of file insertnd.cxx.

References typecorecrumhedr::cdsp, typecorecrumhedr::cwid, findleftson(), ivemodified(), move2dinfo(), movewisp, setwisp(), and typecorecrum.

Referenced by doinsertnd().

00202 {
00203     typecorecrum *ptr = findleftson(father);
00204     movewisp(origin, &ptr->cdsp);
00205     movewisp(width, &ptr->cwid);
00206     move2dinfo(infoptr, &((type2dcbc *) ptr)->c2dinfo);
00207     ivemodified(ptr);
00208     setwisp((typecorecrum *) father);
00209 }

int insertcbcnd typecuc father,
typedsp grasp,
typewid origin,
typewid width,
type2dbottomcruminfo infoptr
[static]
 

???

???

Definition at line 239 of file insertnd.cxx.

References adopt(), assert, typecorecrumhedr::cdsp, typecuc::cenftype, createcrum(), typecorecrumhedr::cwid, typecbc::cwid, dspadd(), dspsub(), findfather(), findleftson(), findrightbro, isanextensionnd(), isfullcrum(), iszerolock(), ivemodified(), move2dinfo(), movewisp, rejuvinate, reserve(), setwispupwards(), SON, splitcrumupwards(), typecorecrum, and typedsp.

Referenced by insertmorend().

00245 {
00246     typecorecrum *ptr, *newcc;
00247     bool splitsomething;
00248 
00249     for (ptr = findleftson(father); ptr; ptr = findrightbro(ptr)) {
00250         if (isanextensionnd((typecbc *) ptr, grasp, origin, infoptr)) {
00251             dspadd(&ptr->cwid, width, &ptr->cwid, (int) father->cenftype);
00252             ivemodified(ptr);
00253             setwispupwards(father, 1);
00254 
00255             if (!isfullcrum((typecorecrum *) father))
00256                 return setwispupwards(findfather((typecorecrum *) father), 1);        /* was ...),1); ECH *** */
00257 
00258             return false;
00259         }
00260     }
00261 
00262     newcc = createcrum(0, (int) father->cenftype);
00263     reserve(newcc);
00264     adopt(newcc, SON, (typecorecrum *) father);
00265     dspsub(origin, grasp, &newcc->cdsp, (int) father->cenftype);
00266 
00267     if (iszerolock((Tumbler *) width, 2))
00268         assert(0); // zero width in insertnd
00269 
00270     movewisp(width, &newcc->cwid);
00271     move2dinfo(infoptr, &((type2dcbc *) newcc)->c2dinfo);
00272     ivemodified(newcc);
00273 /* setwispallthewayupwards (newcc//father//); */
00274     setwispupwards((typecuc *) newcc /* father */ , 0);
00275     setwispupwards(father, 1);
00276     splitsomething = splitcrumupwards(father);
00277     rejuvinate(newcc);
00278 
00279     return splitsomething;
00280 }

int insertmorend typecuc father,
typedsp offset,
typewid origin,
typewid width,
type2dbottomcruminfo infoptr,
int  index
[static]
 

???

???

Definition at line 327 of file insertnd.cxx.

References assert, typewid::dsas, findsontoinsertundernd(), typecuc::height, insertcbcnd(), iszerotumbler, ivemodified(), makeroomonleftnd(), setwispupwards(), typecorecrum, and typedsp.

Referenced by doinsertnd().

00334 {
00335     typedsp grasp;
00336 
00337     if (iszerotumbler(&width->dsas[index]))
00338         assert(0); // zero width in insertmorend
00339 
00340     makeroomonleftnd(father, offset, origin, &grasp);
00341     if (father->height == 1)
00342         return insertcbcnd(father, &grasp, origin, width, infoptr);
00343 
00344     typecorecrum *ptr = findsontoinsertundernd(father, &grasp, origin, width, index);
00345     int temp = insertmorend((typecuc *) ptr, &grasp, origin, width, infoptr, index);
00346 
00347 /* setwispupwards(ptr,1); *//* was done in insertcbcnd */
00348     setwispupwards(father, 1);
00349 
00350     ivemodified(ptr);                  /* zzz possibly redundant with setwispupwards */
00351     return temp;
00352 }

void insertnd Session sess,
typecuc fullcrumptr,
typewid origin,
typewid width,
type2dbottomcruminfo infoptr,
int  index
 

???

???

Parameters:
sess  Input: User's session context

Definition at line 388 of file insertnd.cxx.

References assert, typecuc::cenftype, checkspecandstringbefore(), typecuc::cwid, doinsertnd(), typewid::dsas, typecuc::height, iszerotumbler, makegappm(), POOM, recombine(), setwispupwards(), SPAN, tumblercopy(), V, and widdiffs().

Referenced by insertpm(), and insertspanf().

00389                                                    : User's session context
00390     typecuc               *fullcrumptr,
00391     typewid               *origin,
00392     typewid               *width,
00393     type2dbottomcruminfo  *infoptr,
00394     int                    index)
00395 /* origin is vsa fo crum *//* note that here they're wids, */
00396 /* and in deletend they're single tumblers */
00397 {
00398     int bothertorecombine = 0;
00399     int newdiff;
00400 
00401     int olddiff = widdiffs(fullcrumptr);
00402     int oldheight = fullcrumptr->height;
00403 
00404     if (iszerotumbler(&width->dsas[index]))
00405         assert(0); // zero width in insertnd
00406 
00407     Tumbler oldwid;
00408     tumblercopy(&fullcrumptr->cwid.dsas[V], &oldwid);
00409 
00410     switch (fullcrumptr->cenftype) {
00411     case POOM:
00412         makegappm(sess, fullcrumptr, origin, width);
00413         checkspecandstringbefore();
00414         setwispupwards(fullcrumptr, 0);
00415 
00416         bothertorecombine = doinsertnd(fullcrumptr, origin, width, infoptr, index);
00417         setwispupwards(fullcrumptr, 1);
00418         break;
00419 
00420     case SPAN:
00421         bothertorecombine = doinsertnd(fullcrumptr, origin, width, infoptr, index);
00422         setwispupwards(fullcrumptr, 1);
00423         break;
00424 
00425     default:
00426         assert(0); // insertnd: bad enftype
00427     }
00428 
00429     if (bothertorecombine || (fullcrumptr->height != oldheight))
00430         recombine(fullcrumptr);
00431 
00432     newdiff = widdiffs(fullcrumptr);
00433 }

bool isanextensionnd typecbc ptr,
typedsp offsetptr,
typedsp originptr,
type2dbottomcruminfo infoptr
[static]
 

???

???

Definition at line 218 of file insertnd.cxx.

References typecorecrumhedr::cenftype, typewid::dsas, dspsize, type2dbottomcruminfo::homedoc, lockeq(), prologuend(), tumblereq(), typecorecrum, and typedsp.

Referenced by insertcbcnd().

00223 {
00224     if (!tumblereq(&infoptr->homedoc, &((type2dcbc *) ptr)->c2dinfo.homedoc))
00225         return false;
00226 
00227     typedsp grasp, reach;
00228     prologuend((typecorecrum *) ptr, offsetptr, &grasp, &reach);
00229     return lockeq(reach.dsas, originptr->dsas, (unsigned) dspsize(ptr->cenftype));
00230 }

void makegappm Session sess,
typecuc fullcrumptr,
typewid origin,
typewid width
[static]
 

???

???

Parameters:
sess  Input: User's session context

Definition at line 133 of file insertnd.cxx.

References assert, typeknives::blades, typecorecrumhedr::cdsp, checkwholesubtree(), clear, typecorecrumhedr::cwid, typeknives::dimension, typewid::dsas, dump(), findaddressofsecondcutforinsert(), findfather(), findleftson(), findrightbro, foo(), insertcutsectionnd(), iszerotumbler, ivemodified(), LESS, makecutsnd(), movetumbler, typeknives::nblades, newfindintersectionnd(), NULL, prologuend(), setwidnd(), setwispupwards(), tumbleradd, tumblercmp(), typecorecrum, typedsp, and V.

Referenced by insertnd().

00134                                      : User's session context
00135     typecuc *fullcrumptr,
00136     typewid *origin,
00137     typewid *width)
00138 {
00139     typeknives    knives;
00140     typewid       offset, grasp, reach;
00141     typecuc      *father;
00142     typecorecrum *ptr;
00143     typewid       foffset, fgrasp;
00144     int           i /* ,enfheight */ ;
00145 
00146 #ifndef DISTRIBUTION
00147     foo("makegappm\n");
00148     checkwholesubtree(fullcrumptr);
00149 #endif
00150 
00151 /* enfheight = fullcrumptr->height; */
00152     clear(&offset, sizeof(offset));    /* fullcrum alway has zero offset */
00153     prologuend((typecorecrum *) fullcrumptr, &offset, &grasp, &reach);
00154     if (iszerotumbler(&fullcrumptr->cwid.dsas[V])
00155         || tumblercmp(&origin->dsas[V], &grasp.dsas[V]) == LESS || tumblercmp(&origin->dsas[V], &reach.dsas[V]) != LESS)
00156         return;                        /* this if for extensions to bc without calling cut */
00157 
00158     movetumbler(&origin->dsas[V], &knives.blades[0]);
00159     findaddressofsecondcutforinsert(&origin->dsas[V], &knives.blades[1]);
00160     knives.nblades = /* 1 */ 2;
00161     knives.dimension = V;
00162 
00163     makecutsnd(fullcrumptr, &knives);
00164     newfindintersectionnd(fullcrumptr, &knives, &father, &foffset);
00165     prologuend((typecorecrum *) father, &foffset, &fgrasp, (typedsp *) NULL);
00166 
00167     for (ptr = findleftson(father); ptr; ptr = findrightbro(ptr)) {
00168         i = insertcutsectionnd(ptr, &fgrasp, &knives);
00169         switch (i) {
00170         case 0:
00171         case 2:
00172             break;
00173         case -1:                      /* THRUME */
00174             dump(ptr);
00175             assert(0); // makegappm can't classify crum
00176             break;
00177         case 1:                       /* 9-17-87 fix */
00178             tumbleradd(&ptr->cdsp.dsas[V], &width->dsas[V], &ptr->cdsp.dsas[V]);
00179 /* tumbleradd(&width->dsas[V],&ptr->cdsp.dsas[V],&ptr->cdsp.dsas[V]); */
00180             ivemodified(ptr);
00181             break;
00182         default:
00183             assert(0); // unexpected cutsection
00184         }
00185     }
00186     setwidnd(father);
00187     setwispupwards(findfather((typecorecrum *) father), 1);
00188 }

int widdiffs typecuc crumptr  )  [static]
 

???

???

Definition at line 96 of file insertnd.cxx.

References typecuc::cenftype, typecuc::cwid, typewid::dsas, I, lastdigitintumbler(), POOM, and V.

Referenced by insertnd().

00097 {
00098     if (crumptr->cenftype != POOM)
00099         return 0;
00100 
00101     int i = lastdigitintumbler(&crumptr->cwid.dsas[I]);
00102     int v = lastdigitintumbler(&crumptr->cwid.dsas[V]);
00103     return i - v;
00104 }


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