libsrc/makeroom.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: makeroom.cxx,v $
00032  * Revision 1.9  2004/09/04 16:02:17  jrush
00033  * Added Doxygen headers before each and every function definition.
00034  *
00035  * Revision 1.8  2002/05/28 04:22:29  jrush
00036  * Adjusted source files to comply with GPL licensing.
00037  *
00038  * Revision 1.7  2002/05/28 02:51:11  jrush
00039  * Made static any functions and global variables private to this source file
00040  * and commented out any unused functions.
00041  *
00042  * Revision 1.6  2002/04/12 11:56:43  jrush
00043  * Reorganized include file layout, renamed xanadu.h to udanax.h and
00044  * typecontext/typecrumcontext to C++ class Context/CrumContext.
00045  *
00046  * Revision 1.5  2002/04/09 21:45:46  jrush
00047  * Renamed class 'tumbler' to 'Tumbler', for consistency with Python sources,
00048  * and changed typeisa from typedef to a subclass, in preparation for cleaning
00049  * up the type/class tree.
00050  *
00051  * Revision 1.4  2002/04/06 19:51:30  jrush
00052  * Renamed TRUE/FALSE constant use to the C++ standard of true/false.
00053  *
00054  * Revision 1.3  2002/04/06 15:01:17  jrush
00055  * Changed INT to just 'int'.
00056  *
00057  * Revision 1.2  2002/02/14 09:27:43  jrush
00058  * Cleaned up source:
00059  *
00060  * 1. ran thru the indent tool to achieve a standard look,
00061  * 2. added structured comments at top for use with DOxygen reporting
00062  *    as well as CVS keywords,
00063  * 3. fixed compiler warnings re ambiguous assign/compares,
00064  *    needed casts and unused/uninitialized variables,
00065  * 4. fixed funcs that didn't specify a return type,
00066  * 5. centralized prototypes in protos.h, removing incomplete ones,
00067  * 6. cleaned up use of bool/BOOLEAN type to suit C++ type,
00068  * 7. fixed initializer nesting in tumbler constants,
00069  * 8. renamed vars that conflict with C++ keywords (new, this),
00070  * 9. fixed global/extern confusion re some global vars.
00071  *
00072  */
00073 
00074 #include "udanax.h"
00075 
00083     static void
00084 expandcrumleftward(
00085     typecorecrum *crumptr,
00086     Tumbler      *newdsp,
00087     Tumbler      *base,
00088     int           index)
00089 {
00090     typecorecrum *ptr;
00091 
00092 #ifndef DISTRIBUTION
00093     foo("entering expandcrum leftward \n");
00094 #endif
00095 
00096     movetumbler(newdsp, &crumptr->cdsp.dsas[index]);
00097     tumbleradd(base, &crumptr->cwid.dsas[index], &crumptr->cwid.dsas[index]);
00098 
00099 #ifndef DISTRIBUTION
00100     footumbler("in expandcrumleftward cwid = ", &crumptr->cwid.dsas[index]);
00101 #endif
00102 
00103     ptr = findleftson((typecuc *) crumptr);
00104     for (; ptr; ptr = (typecorecrum *) findrightbro(ptr)) {
00105         tumbleradd(base, &ptr->cdsp.dsas[index], &ptr->cdsp.dsas[index]);
00106         ivemodified(ptr);
00107 
00108 #ifndef DISTRIBUTION
00109         footumbler("in expandcrumleftward cdsp = ", &crumptr->cdsp.dsas[index]);
00110 #endif
00111 
00112     }
00113 
00114 #ifndef DISTRIBUTION
00115     foo("leaveing expandcrum leftward \n");
00116 #endif
00117 }
00118 
00126     void
00127 makeroomonleftnd(
00128     typecuc *father,
00129     typedsp *offset,
00130     typewid *origin,
00131     typedsp *grasp)
00132 {
00133     typedsp newdsp;
00134     Tumbler base;
00135     int i;
00136     int savedebug;
00137 
00138 #ifndef DISTRIBUTION
00139     savedebug = debug;
00140 /* if(!is1story(offset)){ debug = true; } */
00141     foo("entering makeroomonleftnd\n");
00142 #endif
00143 
00144     prologuend((typecorecrum *) father, offset, grasp, (typedsp *) NULL);
00145     for (i = 0; i < widsize(father->cenftype); ++i) {
00146         if (tumblercmp(&origin->dsas[i], &grasp->dsas[i]) == LESS) {
00147 #ifndef DISTRIBUTION
00148             footumbler(" origin = ", &origin->dsas[i]);
00149             footumbler(" grasp = ", &grasp->dsas[i]);
00150 #endif
00151             tumblersub(&grasp->dsas[i], &origin->dsas[i], &base);
00152 #ifndef DISTRIBUTION
00153             footumbler(" base = ", &base);
00154             footumbler(" origin = ", &origin->dsas[i]);
00155             footumbler(" offset = ", &offset->dsas[i]);
00156 #endif
00157             tumblersub(&origin->dsas[i], &offset->dsas[i], &newdsp.dsas[i]);
00158 #ifndef DISTRIBUTION
00159             footumbler(" newdsp = ", &newdsp.dsas[i]);
00160 #endif
00161             expandcrumleftward((typecorecrum *) father, &newdsp.dsas[i], &base, i);
00162             prologuend((typecorecrum *) father, offset, grasp, (typedsp *) NULL);
00163         }
00164     }
00165 #ifndef DISTRIBUTION
00166     foo("leaving makeroomonleftnd\n");
00167     debug = savedebug;
00168 #endif
00169 }

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