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

Go to the source code of this file.
Functions | |
| bool | fillupcbcseq (typecbc *ptr, Tumbler *crumboundary, typegranbottomcruminfo *info) |
| ??? | |
| void | insertseq (typecuc *fullcrumptr, Tumbler *address, typegranbottomcruminfo *info) |
| ??? | |
(to be defined)
Definition in file insert.cxx.
|
||||||||||||||||
|
??? (to be defined) first copy the text from the info to the crum that ptr points to Definition at line 87 of file insert.cxx. References typecbc::cinfo, clear, typegranbottomcruminfo::granstuff, GRANTEXTLENGTH, movmem, typegrantext::textlength, typegrantext::textstring, typegranstuff::textstuff, and tumblerincrement(). Referenced by insertseq().
00091 {
00092 char temp[GRANTEXTLENGTH];
00093
00095 /* do it nicer than this * */
00096
00097 int crumlength = ptr->cinfo.granstuff.textstuff.textlength;
00098 int remainingroom = GRANTEXTLENGTH - crumlength;
00099 int textlength = info->granstuff.textstuff.textlength;
00100
00101 if (remainingroom > textlength) {
00102 movmem(&info->granstuff.textstuff.textstring, (char *)(&(ptr->cinfo.granstuff.textstuff)) + crumlength, textlength);
00103 ptr->cinfo.granstuff.textstuff.textlength = crumlength + textlength;
00104 tumblerincrement(crumboundary, 0, textlength, crumboundary);
00105 return false;
00106
00107 } else {
00108 movmem(&info->granstuff.textstuff.textstring, (char *)(&(ptr->cinfo.granstuff.textstuff)) + crumlength,
00109 remainingroom);
00110 ptr->cinfo.granstuff.textstuff.textlength = GRANTEXTLENGTH;
00111 tumblerincrement(crumboundary, 0, remainingroom, crumboundary);
00112 }
00113
00114 /* then take whats left in info and renormalize it */
00115 info->granstuff.textstuff.textlength -= remainingroom;
00116
00117 movmem(&info->granstuff.textstuff.textstring[remainingroom], temp, info->granstuff.textstuff.textlength);
00118 clear(info->granstuff.textstuff.textstring, GRANTEXTLENGTH);
00119 movmem(temp, info->granstuff.textstuff.textstring, info->granstuff.textstuff.textlength);
00120
00121 return true;
00122 }
|
|
||||||||||||||||
|
??? (to be defined) Definition at line 132 of file insert.cxx. References adopt(), typecbc::cenftype, typecbc::cinfo, clear, CrumContext::corecrum, createcrum(), crumcontextfree(), typecbc::cwid, typecorecrumhedr::cwid, typewid::dsas, dspadd(), fillupcbcseq(), findfather(), GRAN, GRANORGL, typegranbottomcruminfo::granstuff, GRANTEXT, GRANTEXTLENGTH, typegranbottomcruminfo::infotype, iszerotumbler, ivemodified(), typecuc::leftbroorfather, moveinfo(), movetumbler, movewisp, typegranorgl::orglptr, typegranstuff::orglstuff, recombine(), rejuvinate, reserve(), retrievecrums(), RIGHTBRO, setwispupwards(), splitcrumupwards(), typegrantext::textlength, typegranstuff::textstuff, CrumContext::totaloffset, tumblerclear, tumblersub(), typecorecrum, typedsp, and WIDTH. Referenced by createorglgr(), and inserttextgr().
00136 {
00137 typedsp reach;
00138
00139 Tumbler nextaddress;
00140 movetumbler(address, &nextaddress);
00141
00142 CrumContext *context = retrievecrums(fullcrumptr, address, WIDTH);
00143 typecbc *ptr = context->corecrum;
00144
00145 typedsp offset;
00146 clear(&offset, sizeof(offset));
00147 movewisp(&context->totaloffset, &offset);
00148
00149 crumcontextfree(context);
00150
00151 if (/* crum can be extended */ info->infotype == GRANTEXT && ptr->cinfo.infotype == GRANTEXT && ptr->cinfo.granstuff.textstuff.textlength < GRANTEXTLENGTH) {
00152 if (!fillupcbcseq(ptr, &nextaddress, info)) {
00153 ivemodified((typecorecrum *) ptr);
00154 return;
00155 }
00156 }
00157 reserve((typecorecrum *) ptr);
00158
00159 typecorecrum *newcc = createcrum(0, (int) ptr->cenftype);
00160 reserve(newcc);
00161
00162 adopt(newcc, RIGHTBRO, (typecorecrum *) ptr);
00163 ivemodified(newcc);
00164
00165 bool splitsomething = splitcrumupwards(findfather(newcc));
00166
00167 if (info->infotype == GRANORGL)
00168 info->granstuff.orglstuff.orglptr->leftbroorfather = newcc;
00169
00170 moveinfo((typebottomcruminfo *) info, (typebottomcruminfo *) &((typecbc *) newcc)->cinfo); /* in GRAN */
00171 if (iszerotumbler(&ptr->cwid.dsas[WIDTH])) { /* last crum in granf */
00172 tumblerclear(&newcc->cwid.dsas[WIDTH]);
00173 tumblersub(&nextaddress, &offset.dsas[WIDTH], &ptr->cwid.dsas[WIDTH]);
00174 } else {
00175 dspadd(&offset, &ptr->cwid, &reach, GRAN);
00176 tumblersub(&reach.dsas[WIDTH], &nextaddress, &newcc->cwid.dsas[WIDTH]);
00177 tumblersub(&nextaddress, &offset.dsas[WIDTH], &ptr->cwid.dsas[WIDTH]);
00178 }
00179
00180 ivemodified((typecorecrum *) ptr);
00181 setwispupwards(findfather((typecorecrum *) ptr), 0);
00182 setwispupwards(findfather((typecorecrum *) newcc), 1);
00183 splitsomething |= splitcrumupwards(findfather((typecorecrum *) ptr));
00184 rejuvinate((typecorecrum *) ptr);
00185 rejuvinate(newcc);
00186
00187 if (splitsomething)
00188 recombine(fullcrumptr);
00189 }
|
1.3.4