libsrc/orglinks.cxx

Go to the documentation of this file.
00001 /**********************************************************************
00002  * Copyright 2002 Jeff Rush <jrush@taupro.com>
00003  * Original Copyright 1979-2002 Udanax.com
00004  *
00005  * This file is part of the Udanax xanalogical storage system.
00006  *
00007  * Udanax is free software; you can redistribute it and/or modify it
00008  * under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * Udanax is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with Udanax; if not, write to the Free Software Foundation,
00019  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  **********************************************************************/
00021 
00030 /* Modification History:
00031  * $Log: orglinks.cxx,v $
00032  * Revision 1.17  2004/09/11 13:59:21  jrush
00033  * Changed all fprintf's to stderr to use the Nana library L() macro.  Also
00034  * removed a 2-3 minor compiler warnings.
00035  *
00036  * Revision 1.16  2004/09/04 16:02:17  jrush
00037  * Added Doxygen headers before each and every function definition.
00038  *
00039  * Revision 1.15  2004/09/04 12:21:44  jrush
00040  * Fixed DOxygen commenting in a few places.
00041  *
00042  * Revision 1.14  2002/07/26 04:32:01  jrush
00043  * Replaced gerror() with assert()
00044  *
00045  * Revision 1.13  2002/05/28 04:22:29  jrush
00046  * Adjusted source files to comply with GPL licensing.
00047  *
00048  * Revision 1.12  2002/05/28 02:51:11  jrush
00049  * Made static any functions and global variables private to this source file
00050  * and commented out any unused functions.
00051  *
00052  * Revision 1.11  2002/04/12 11:56:43  jrush
00053  * Reorganized include file layout, renamed xanadu.h to udanax.h and
00054  * typecontext/typecrumcontext to C++ class Context/CrumContext.
00055  *
00056  * Revision 1.10  2002/04/10 18:01:54  jrush
00057  * Renamed class typeisa to IStreamAddr.
00058  *
00059  * Revision 1.9  2002/04/09 21:45:46  jrush
00060  * Renamed class 'tumbler' to 'Tumbler', for consistency with Python sources,
00061  * and changed typeisa from typedef to a subclass, in preparation for cleaning
00062  * up the type/class tree.
00063  *
00064  * Revision 1.8  2002/04/08 18:55:55  jrush
00065  * Switched from using global variable 'user' to object 'Session' as a
00066  * connection for tracking open document descriptors in the bert table.
00067  *
00068  * Revision 1.7  2002/04/06 20:42:50  jrush
00069  * Switch from sess->alloc() style to new(sess) Object parameterized allocator.
00070  *
00071  * Revision 1.6  2002/04/06 17:05:57  jrush
00072  * Switched from referring to 'task' for a client connection to 'session',
00073  * and converted the typetask typedef/struct into a Session C++ class.
00074  *
00075  * Revision 1.5  2002/04/06 15:01:17  jrush
00076  * Changed INT to just 'int'.
00077  *
00078  * Revision 1.4  2002/04/06 14:10:09  jrush
00079  * Cosmetic changes, commenting and rearrangement.
00080  *
00081  * Revision 1.3  2002/04/02 18:45:33  jrush
00082  * Fixed retrievevspansetpm() which seems to have never worked.  It was only
00083  * ever used by the front-end, so no one noticed, I guess.  Also added
00084  * useful debug messages.
00085  *
00086  * Revision 1.2  2002/02/14 09:27:43  jrush
00087  * Cleaned up source:
00088  *
00089  * 1. ran thru the indent tool to achieve a standard look,
00090  * 2. added structured comments at top for use with DOxygen reporting
00091  *    as well as CVS keywords,
00092  * 3. fixed compiler warnings re ambiguous assign/compares,
00093  *    needed casts and unused/uninitialized variables,
00094  * 4. fixed funcs that didn't specify a return type,
00095  * 5. centralized prototypes in protos.h, removing incomplete ones,
00096  * 6. cleaned up use of bool/BOOLEAN type to suit C++ type,
00097  * 7. fixed initializer nesting in tumbler constants,
00098  * 8. renamed vars that conflict with C++ keywords (new, this),
00099  * 9. fixed global/extern confusion re some global vars.
00100  *
00101  */
00102 
00103 #include <memory.h>
00104 #include "udanax.h"
00105 
00111     static void
00112 findnextaddressinvspace(
00113     typecorecrum *crumptr,
00114     typewid      *offsetptr,
00115     Tumbler      *nextvspacestartptr,
00116     Tumbler      *vsaptr)
00117 {
00118     typecorecrum *ptr;
00119     if (!(ptr = findleftson((typecuc *) crumptr)))
00120         return;
00121 
00122     Tumbler maxt;
00123     tumblerclear(&maxt);
00124 
00125     for (; ptr; ptr = findrightbro(ptr)) {
00126         typewid reach, grasp;
00127         prologuend(ptr, offsetptr, &grasp, &reach);
00128 
00129         if (whereoncrum(ptr, offsetptr, nextvspacestartptr, V) == THRUME) {
00130             findnextaddressinvspace(ptr, &grasp, nextvspacestartptr, vsaptr);
00131             return;
00132 
00133         } else if (tumblercmp(&grasp.dsas[V], nextvspacestartptr) != GREATER) {
00134             tumblermax(&reach.dsas[V], &maxt, &maxt);
00135 
00136         }
00137     }
00138     movetumbler(&maxt, vsaptr);
00139 }
00140 
00149     static void
00150 findvsatoappend(
00151     typecorecrum *ptr,
00152     Tumbler      *vsaptr)
00153 {
00154     typewid offset;
00155     clear(&offset, sizeof(offset));
00156 
00157     tumblerclear(vsaptr);
00158 
00159     Tumbler linkspacevstart;
00160     tumblerclear(&linkspacevstart);
00161     tumblerincrement(&linkspacevstart, 0, 2, &linkspacevstart);
00162 
00163     typewid grasp, reach;
00164     prologuend(ptr, &offset, &grasp, &reach);
00165 
00166     // If document contains no text but has links, just return a stream address of 1.1
00167     if (iszerolock((Tumbler *) &ptr->cwid, widsize(POOM)) || (tumblercmp(&grasp.dsas[V], &linkspacevstart) != LESS)) {
00168         tumblerincrement(vsaptr, 0, 1, vsaptr); /* no text in doc */
00169         tumblerincrement(vsaptr, 1, 1, vsaptr);
00170 
00171     // If document contains text but no links, return a stream address of the text's reach
00172     } else if (tumblercmp(&reach.dsas[V], &linkspacevstart) == LESS) {
00173         movetumbler(&reach.dsas[V], vsaptr);    /* no links in doc */
00174 
00175     // If document contains _both_ text and links
00176     } else
00177         findnextaddressinvspace(ptr, &grasp, &linkspacevstart, vsaptr);
00178 }
00179 
00187     bool
00188 appendpm(
00189     Session     *sess,          
00190     IStreamAddr *doc_isa,
00191     typetextset  textset)
00192 {
00193     /*
00194      * Walk the granfilade to find and lock the ORGL for the specified document.
00195      */
00196     typeorgl orglptr;
00197     if (!findorgl(sess, granf, doc_isa, &orglptr, WRITEBERT))
00198         return false;
00199 
00200     /*
00201      * Compute the highest stream address in use within the document, at which
00202      * to append the new content.
00203      */
00204     Tumbler vsa;
00205     findvsatoappend((typecorecrum *) orglptr, &vsa);
00206 
00207     return doinsert(sess, doc_isa, &vsa, textset);
00208 }
00209 
00217     bool
00218 insertpm(
00219     Session       *sess,          
00220     Tumbler       *orglisa,
00221     typeorgl       orgl,
00222     Tumbler       *vsaptr,
00223     typesporglset  sporglset)
00224 {
00225     Tumbler              lstream, lwidth;
00226     type2dbottomcruminfo linfo;
00227     typewid              crumorigin, crumwidth;
00228     Tumbler              zero;
00229     int                  shift, inc;
00230 
00231 #ifndef DISTRIBUTION
00232     if (debug) {
00233         L("\nINSERTpm  vsa ");
00234         dumptumbler(vsaptr);
00235         L("\n");
00236         dumpitemset((typeitem *) sporglset);
00237     }
00238 #endif
00239 
00240     if (iszerotumbler(vsaptr)) {
00241 #ifndef DISTRIBUTION
00242         L("insertpm inserting at 0 ---punt zzzz?");
00243 #endif
00244         return false;
00245     }
00246 
00247     tumblerclear(&zero);
00248 
00249     if (tumblercmp(vsaptr, &zero) == LESS)
00250         assert(0); // insertpm called with negative vsa
00251 
00252     logbertmodified(sess, orglisa);
00253     for (; sporglset; sporglset = (typesporglset) sporglset->xxxxsporgl.next) {
00254         unpacksporgl(sporglset, &lstream, &lwidth, &linfo);
00255 
00256 #ifndef DISTRIBUTION
00257         footumbler("lstream = ", &lstream);
00258 #endif
00259         movetumbler(&lstream, &crumorigin.dsas[I]);
00260 
00261 #ifndef DISTRIBUTION
00262         footumbler("lwidth = ", &lwidth);
00263 #endif
00264         movetumbler(&lwidth, &crumwidth.dsas[I]);
00265 
00266 #ifndef DISTRIBUTION
00267         footumbler("vsaptr = ", vsaptr);
00268 #endif
00269         movetumbler(vsaptr, &crumorigin.dsas[V]);
00270 /* I'm suspissious of this shift <reg> 3/1/85 zzzz */
00271         shift = tumblerlength(vsaptr) - 1;
00272         inc = tumblerintdiff(&lwidth, &zero);
00273         tumblerincrement(&zero, shift, inc, &crumwidth.dsas[V]);
00274 
00275 #ifndef DISTRIBUTION
00276         footumbler("crumwidth = ", &crumwidth.dsas[V]);
00277 #endif
00278 
00279         if (iszerotumbler(&crumwidth.dsas[V]))
00280             assert(0); // crum width 0 in insertpm
00281 
00282 #ifndef DISTRIBUTION
00283         if (debug) {
00284             L("    crumorigin: ");
00285             dumpwid(&crumorigin, POOM);
00286             L("    crumwidth: ");
00287             dumpwid(&crumwidth, POOM);
00288         }
00289 #endif
00290         insertnd(sess, (typecuc *) orgl, &crumorigin, &crumwidth, &linfo, V);
00291           tumbleradd(vsaptr, &crumwidth.dsas[V], vsaptr);
00292     }
00293     return true;
00294 }
00295 
00303     bool
00304 rearrangepm(
00305     Session    *sess,          
00306     Tumbler    *docisaptr,
00307     typeorgl    docorgl,
00308     typecutseq *cutseqptr)
00309 {
00310     rearrangend((typecuc *) docorgl, cutseqptr, V);
00311     logbertmodified(sess, docisaptr);
00312 
00313     return true;
00314 }
00315 
00323     bool
00324 deletevspanpm(
00325     Session   *sess,          
00326     Tumbler   *docisaptr,
00327     typeorgl   docorgl,
00328     typevspan *vspanptr)
00329 {
00330     if (iszerotumbler(&vspanptr->width))
00331         return false;
00332 
00333     deletend((typecuc *) docorgl, &vspanptr->stream, &vspanptr->width, V);
00334     logbertmodified(sess, docisaptr);
00335 
00336     return true;
00337 }
00338 
00346     bool
00347 retrievedocumentpartofvspanpm(
00348     Session   *sess,          
00349     typeorgl   orgl,
00350     typevspan *vspanptr)
00351 {                                      /* this is a kluge */
00352     vspanptr->next   = NULL;
00353     vspanptr->itemid = VSPANID;
00354 
00355     movetumbler(&((typecuc *) orgl)->cdsp.dsas[V], &vspanptr->stream);
00356     movetumbler(&((typecuc *) orgl)->cwid.dsas[V], &vspanptr->width);
00357 
00358     return true;
00359 }
00360 
00368     bool
00369 retrievevspanpm(
00370     Session   *sess,          
00371     typeorgl   orgl,
00372     typevspan *vspanptr)
00373 {
00374     vspanptr->next   = NULL;
00375     vspanptr->itemid = VSPANID;
00376 
00377     movetumbler(&((typecuc *) orgl)->cdsp.dsas[V], &vspanptr->stream);
00378     movetumbler(&((typecuc *) orgl)->cwid.dsas[V], &vspanptr->width);
00379 
00380     return true;
00381 }
00382 
00390     static bool
00391 istextcrum(
00392     typecorecrum *crumptr)
00393 {
00394     if (crumptr->cdsp.dsas[V].mantissa[1] == 0 && is1story(&crumptr->cwid.dsas[V])) {
00395         return true;
00396     }
00397     return false;
00398 }
00399 
00407     static bool
00408 islinkcrum(
00409     typecorecrum *crumptr)
00410 {
00411     if (crumptr->cdsp.dsas[V].mantissa[0] == 1 && crumptr->cdsp.dsas[V].mantissa[1] != 0) {
00412 /* if the whold crum is displaced into link space it is a link crum; this is true if the tumbler is a 1.n tumbler where 
00413  * n!= 0 */
00414         return true;
00415     }
00416     return false;
00417 }
00418 
00426     static void
00427 maxtextwid(
00428     Session      *sess,          
00429     typecorecrum *crumptr,
00430     Tumbler      *voffset,
00431     Tumbler      *maxwid)
00432 {
00433     if (istextcrum(crumptr)) {
00434         Tumbler localvoffset;
00435         tumbleradd(voffset, &crumptr->cwid.dsas[V], &localvoffset);
00436 
00437         tumblermax(&localvoffset, maxwid, maxwid);
00438 
00439     } else { // Non-Text CRUM
00440         Tumbler localvoffset;
00441 //        tumbleradd(voffset, &crumptr->cwid.dsas[V], &localvoffset);
00442 //        tumbleradd(voffset, &crumptr->cdsp.dsas[V], &localvoffset);
00443         tumblercopy(voffset, &localvoffset);
00444 
00445         typecorecrum *ptr;
00446         for (ptr = findleftson((typecuc *) crumptr); ptr; ptr = findrightbro(ptr)) {
00447             if (ptr && !islinkcrum(ptr)) // only look for text or overlapping stuff
00448                 maxtextwid(sess, ptr, &localvoffset, maxwid);
00449 
00450 //            tumbleradd(&localvoffset, &ptr->cwid.dsas[V], &localvoffset);
00451         }
00452     }
00453 }
00454 
00462     static typevspan *
00463 makevspan(
00464     Session   *sess,          
00465     typevspan *spanptr,
00466     typevspan *nextspan)
00467 {
00468     typevspan *ret = new(sess) typevspan;
00469 //    typevspan *ret = (typevspan *) sess->alloc(sizeof(typevspan));
00470 
00471     movetumbler(&spanptr->stream, &ret->stream);
00472     movetumbler(&spanptr->width, &ret->width);
00473 
00474     ret->itemid = VSPANID;
00475     ret->next   = nextspan;
00476 
00477     return ret;
00478 }
00479 
00487     static void
00488 putvspaninlist(
00489     Session      *sess,          
00490     typevspan    *spanptr,
00491     typevspanset *spansetptr)
00492 {
00493     Tumbler    newspanend, oldspanend;
00494     int        startcmp, endcmp, spancmp;
00495 
00496     typevspan *last = NULL;
00497 
00498     typevspan *ptr = *spansetptr;
00499     if (!ptr) {
00500         *spansetptr = makevspan(sess, spanptr, (typevspan *) NULL);
00501         return;
00502     }
00503 
00504     for (; ptr; last = ptr, ptr = ptr->next) {
00505         tumbleradd(&spanptr->stream, &spanptr->width, &newspanend);
00506         tumbleradd(&ptr->stream, &ptr->width, &oldspanend);
00507 
00508         spancmp = tumblercmp(&spanptr->stream, &oldspanend);
00509         if (!spancmp) {
00510             tumbleradd(&ptr->width, &spanptr->width, &ptr->width);
00511             return;
00512         } else if (spancmp == GREATER)
00513             continue;
00514 
00515         spancmp = tumblercmp(&ptr->stream, &newspanend);
00516         if (!spancmp) {
00517             movetumbler(&spanptr->stream, &ptr->stream);
00518             tumbleradd(&spanptr->width, &ptr->width, &ptr->width);
00519             return;
00520         } else if (spancmp == GREATER) {
00521             if (ptr != *spansetptr)
00522                 last->next = makevspan(sess, spanptr, ptr);
00523             else
00524                 *spansetptr = makevspan(sess, spanptr, ptr);
00525             return;
00526         }
00527 
00528         startcmp = tumblercmp(&spanptr->stream, &ptr->stream);
00529         endcmp = tumblercmp(&newspanend, &oldspanend);
00530         if (startcmp > LESS && endcmp < GREATER)
00531             return;
00532 
00533         switch (startcmp) {
00534         case EQUAL:
00535             if (endcmp == GREATER)
00536                 movetumbler(&spanptr->width, &ptr->width);
00537             return;
00538         case LESS:
00539             movetumbler(&spanptr->stream, &ptr->stream);
00540             if (endcmp == GREATER)
00541                 movetumbler(&spanptr->width, &ptr->width);
00542             else
00543                 tumblersub(&oldspanend, &spanptr->stream, &ptr->width);
00544             break;
00545         case GREATER:
00546             if (endcmp == GREATER) {
00547                 tumblersub(&newspanend, &ptr->stream, &ptr->width);
00548                 return;
00549             }
00550         }
00551     }
00552     last->next = makevspan(sess, spanptr, (typevspan *) NULL);
00553 }
00554 
00562     bool
00563 retrievevspansetpm(
00564     Session      *sess,          
00565     typeorgl      orgl,
00566     typevspanset *vspansetptr)
00567 {                                      /* return spans for doc and link part */
00568     typecorecrum *ccptr = (typecorecrum *) orgl;
00569 
00570     *vspansetptr = NULL;
00571     if (is1story(&ccptr->cwid.dsas[V])) {       /* if it is just text return that */
00572         typevspan  vspan;
00573         vspan.next   = NULL;
00574         vspan.itemid = VSPANID;
00575 
00576         movetumbler(&ccptr->cdsp.dsas[V], &vspan.stream);
00577         movetumbler(&ccptr->cwid.dsas[V], &vspan.width);
00578 
00579         putvspaninlist(sess, &vspan, vspansetptr);
00580         return true;
00581 
00582     } else {
00583         /* The link part is simple, just grab the last digit off the wid.  The
00584          * text part we get from a max function that delves into the crums. In
00585          * both cases we have to remove the first digit of the tumbler, the 1
00586          * and hack it around a bit.
00587          */
00588 
00589         typevspan  bytevspan;
00590         bytevspan.next   = NULL;
00591         bytevspan.itemid = VSPANID;
00592 
00593         typevspan  linkvspan;
00594         linkvspan.next   = NULL;
00595         linkvspan.itemid = VSPANID;
00596 
00597         movetumbler(&ccptr->cdsp.dsas[V], &bytevspan.stream);
00598 
00599         Tumbler voffset;
00600         tumblerclear(&voffset);
00601 
00602         Tumbler  maxwid;
00603         tumblerclear(&maxwid);
00604         maxtextwid(sess, ccptr, &voffset, &maxwid);
00605 
00606         movetumbler(&maxwid, &bytevspan.width);
00607 
00608         movetumbler(&ccptr->cdsp.dsas[V], &linkvspan.stream);
00609         linkvspan.stream.mantissa[0] = 2;
00610 
00611         movetumbler(&ccptr->cwid.dsas[V], &linkvspan.width);
00612         linkvspan.width.mantissa[0] = 0;
00613         tumblerjustify(&linkvspan.width);
00614 
00615         putvspaninlist(sess, &bytevspan, vspansetptr);
00616         putvspaninlist(sess, &linkvspan, vspansetptr);
00617 
00618         return true;
00619     }
00620 }
00621 
00629     static typespanset *
00630 span2spanset(
00631     Session     *sess,          
00632     typeorgl     orgl,
00633     typespanset  restrictionspanptr,
00634     int          restrictionindex,
00635     typespanset *targspansetptr,
00636     int          targindex)
00637 {
00638     typespan foundspan;
00639     typespan *nextptr = NULL;
00640 
00641 #ifndef DISTRIBUTION
00642     foo("entering span2spanset\n");
00643 #endif
00644 
00645     Context *context = retrieverestricted((typecuc *) orgl, restrictionspanptr, restrictionindex, (typespan *) NULL, targindex, (IStreamAddr *) NULL);
00646 
00647 #ifndef DISTRIBUTION
00648     foocontextlist("in sapan2spanset after retrieverestrictec context =", context);
00649 #endif
00650 
00651     Context *c;
00652     for (c = context; c; c = (Context *) c->nextcontext) {
00653 
00654 #ifndef DISTRIBUTION
00655         foocontext("in span2spanset loop  ", c);
00656 #endif
00657 
00658         context2span(c, restrictionspanptr, restrictionindex, &foundspan, targindex);
00659         nextptr = (typespan *) onitemlist(sess, (typeitem *) & foundspan, (typeitemset *) targspansetptr);
00660     }
00661 
00662     if (!context) {
00663         return (targspansetptr);
00664     }
00665 
00666 #ifndef DISTRIBUTION
00667     foocontext("leaving span2spanset returning context = \n", context);
00668 #endif
00669 
00670     contextfree(context);
00671     return &nextptr->next;
00672 }
00673 
00681     static typespanset *
00682 permute(
00683     Session     *sess,          
00684     typeorgl     orgl,
00685     typespanset  restrictionspanset,
00686     int          restrictionindex,
00687     typespanset *targspansetptr,
00688     int          targindex)
00689 {
00690     typespanset *save = targspansetptr;
00691 
00692 #ifndef DISTRIBUTION
00693     foo("entering permute\n");
00694     foospanset("targspanset ", *targspansetptr);
00695     foospanset("restrictionset is ", restrictionspanset);
00696 #endif
00697 
00698 /* consolidatespans(restrictionspanset); foospanset("restrictionset after consolidation is ",restrictionspanset); */
00699 
00700     for (; restrictionspanset; restrictionspanset = restrictionspanset->next) {
00701         targspansetptr = span2spanset(sess, orgl, restrictionspanset, restrictionindex, targspansetptr, targindex);
00702     }
00703 
00704 #ifndef DISTRIBUTION
00705     foospanset("leaving permute\n", *save);
00706 /* checkpointer ("targspansetptr(permute): ", targspansetptr); */
00707 #endif
00708 
00709     return save;
00710 }
00711 
00719     typevspanset *
00720 ispan2vspanset(
00721     Session      *sess,          
00722     typeorgl      orgl,
00723     typeispan    *ispanptr,
00724     typevspanset *vspansetptr)
00725 {
00726     return permute(sess, orgl, ispanptr, I, vspansetptr, V);
00727 }
00728 
00736     typeispanset *
00737 vspanset2ispanset(
00738     Session      *sess,          
00739     typeorgl      orgl,
00740     typevspanset  vspanptr,
00741     typeispanset *ispansetptr)
00742 {
00743     return permute(sess, orgl, vspanptr, V, ispansetptr, I);
00744 }
00745 
00746 /* 
00747  * consolidatespanset(spanset); typespan *spanset; {
00748  * for(;spanset->next;spanset = spanset->next){ if( } } */
00749 
00757     typeitem *
00758 onitemlist(
00759     Session     *sess,          
00760     typeitem    *itemptr,
00761     typeitemset *itemsetptr)
00762 {
00763     typeitem *temp, *newitem = NULL;
00764 
00765 /* foo("entering onitemlist\n"); */
00766 #ifndef DISTRIBUTION
00767     if (!itemsetptr)
00768         assert(0); // Null itemsetptr
00769 
00770     if (!itemptr)
00771         assert(0); // Null itemptr
00772 #else
00773     if (!itemsetptr || !itemptr)
00774         assert(0);
00775 #endif
00776 
00777     switch (((typeitemheader *) itemptr)->itemid) {     /* allocate and copy to proper sized item */
00778     case TEXTID:
00779         newitem = (typeitem *) new(sess) typetext;
00780 //        newitem = (typeitem *) sess->alloc(sizeof(typetext));
00781         movmem(itemptr, newitem, sizeof(typetext));
00782         break;
00783 
00784     case ISPANID:
00785         newitem = (typeitem *) new(sess) typeispan;
00786 //        newitem = (typeitem *) sess->alloc(sizeof(typeispan));
00787         movmem(itemptr, newitem, sizeof(typeispan));
00788         break;
00789 
00790     case VSPANID:
00791         newitem = (typeitem *) new(sess) typevspan;
00792 //        newitem = (typeitem *) sess->alloc(sizeof(typevspan));
00793         movmem(itemptr, newitem, sizeof(typevspan));
00794         break;
00795 
00796     case VSPECID:
00797         newitem = (typeitem *) new(sess) typevspec;
00798 //        newitem = (typeitem *) sess->alloc(sizeof(typevspec));
00799         movmem(itemptr, newitem, sizeof(typevspec));
00800         break;
00801 
00802     case NODEID:
00803         newitem = (typeitem *) new(sess) typeboolsetnode;
00804 //        newitem = (typeitem *) sess->alloc(sizeof(typeboolsetnode));
00805         movmem(itemptr, newitem, sizeof(typeboolsetnode));
00806         break;
00807 
00808     case ADDRESSID:                   /* also LINKID */
00809         newitem = (typeitem *) new(sess) typeaddress;
00810 //        newitem = (typeitem *) sess->alloc(sizeof(typeaddress));
00811         movmem(itemptr, newitem, sizeof(typeaddress));
00812         break;
00813 
00814     case SPORGLID:                    /* zzz kluge sporglitem is union * sporgl is struct which should i use * here
00815                                         * i.e. how is this used and set * in fact sporgl happens to be big * member in
00816                                         * union but this is * troubles me REG 1/5/86 */
00817         newitem = (typeitem *) new(sess) typesporglitem;
00818 //        newitem = (typeitem *) sess->alloc(sizeof(typesporglitem));
00819         movmem(itemptr, newitem, sizeof(typesporglitem));
00820         break;
00821 
00822     default:
00823         assert(0); // improper item
00824     }
00825 
00826     ((typeitemheader *) newitem)->next = NULL;
00827     if (*itemsetptr == NULL) {
00828         *itemsetptr = newitem;
00829     } else {
00830 
00831         /* this loop advances the ptr ot the end of the list */
00832         for (temp = *itemsetptr;
00833 #ifndef DISTRIBUTION
00834              checkitem("onitem2.5: ", temp), checkitem("onitem2.75: ", (typeitem *) ((typeitemheader *) temp)->next),
00835 #endif
00836              temp && ((typeitemheader *) temp)->next; temp = (typeitem *) ((typeitemheader *) temp)->next)
00837 
00838 #ifndef DISTRIBUTION
00839             if (debug) {
00840                 checkitem("onitem3: ", temp);
00841             }
00842 #else
00843             ;
00844 #endif
00845 
00846         ((typeitemheader *) temp)->next = (typeitemheader *) newitem;
00847     }
00848 
00849     return newitem;
00850 }
00851 
00859     bool
00860 isemptyorgl(
00861     typeorgl fullcrumptr)
00862 {
00863     return iszerolock((Tumbler *) & ((typecuc *) fullcrumptr)->cwid, widsize(POOM)) && iszerolock((Tumbler *) & ((typecuc *) fullcrumptr)->cdsp, dspsize(POOM));
00864 }

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