libsrc/granf1.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: granf1.cxx,v $
00032  * Revision 1.13  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.12  2004/09/04 16:02:17  jrush
00037  * Added Doxygen headers before each and every function definition.
00038  *
00039  * Revision 1.11  2002/07/26 04:32:01  jrush
00040  * Replaced gerror() with assert()
00041  *
00042  * Revision 1.10  2002/05/28 04:22:29  jrush
00043  * Adjusted source files to comply with GPL licensing.
00044  *
00045  * Revision 1.9  2002/05/28 02:47:35  jrush
00046  * Cosmetic cleanup of code.
00047  *
00048  * Revision 1.8  2002/04/12 11:56:43  jrush
00049  * Reorganized include file layout, renamed xanadu.h to udanax.h and
00050  * typecontext/typecrumcontext to C++ class Context/CrumContext.
00051  *
00052  * Revision 1.7  2002/04/10 18:01:54  jrush
00053  * Renamed class typeisa to IStreamAddr.
00054  *
00055  * Revision 1.6  2002/04/08 18:55:55  jrush
00056  * Switched from using global variable 'user' to object 'Session' as a
00057  * connection for tracking open document descriptors in the bert table.
00058  *
00059  * Revision 1.5  2002/04/07 14:04:37  jrush
00060  * Add ptr to Session to checkforopen() and isthisusersdocument() so that we
00061  * have session information available to make the decision.
00062  *
00063  * Revision 1.4  2002/04/06 19:51:30  jrush
00064  * Renamed TRUE/FALSE constant use to the C++ standard of true/false.
00065  *
00066  * Revision 1.3  2002/04/06 17:05:57  jrush
00067  * Switched from referring to 'task' for a client connection to 'session',
00068  * and converted the typetask typedef/struct into a Session C++ class.
00069  *
00070  * Revision 1.2  2002/02/14 09:27:43  jrush
00071  * Cleaned up source:
00072  *
00073  * 1. ran thru the indent tool to achieve a standard look,
00074  * 2. added structured comments at top for use with DOxygen reporting
00075  *    as well as CVS keywords,
00076  * 3. fixed compiler warnings re ambiguous assign/compares,
00077  *    needed casts and unused/uninitialized variables,
00078  * 4. fixed funcs that didn't specify a return type,
00079  * 5. centralized prototypes in protos.h, removing incomplete ones,
00080  * 6. cleaned up use of bool/BOOLEAN type to suit C++ type,
00081  * 7. fixed initializer nesting in tumbler constants,
00082  * 8. renamed vars that conflict with C++ keywords (new, this),
00083  * 9. fixed global/extern confusion re some global vars.
00084  *
00085  */
00086 
00087 #include "udanax.h"
00088 
00089 bool isxumain = false;
00090 
00098     bool
00099 findorgl(
00100     /*BERT*/ Session *sess,          
00101     typegranf         granfptr,
00102     IStreamAddr      *isaptr,
00103     typeorgl         *orglptr,
00104     int               type)
00105 {
00106     int temp;
00107 
00108     if ( /* backenddaemon && */ (temp = checkforopen(sess, isaptr, type)) <= 0) {
00109 #ifndef DISTRIBUTION
00110         if (!isxumain) {
00111             L("orgl for ");
00112             dumptumbler(isaptr);
00113             L(" not open in findorgl temp = %d\n", temp);
00114             return false;
00115 
00116 // assert(0); /* Temporary crash in findorgl */);
00117 /* ECH ?? or should I simply return false? */
00118         }
00119 #else
00120         if (!isxumain) {
00121             *orglptr = NULL;
00122             return false;
00123         }
00124 #endif
00125     }
00126     *orglptr = fetchorglgr(sess, granfptr, isaptr);
00127     return *orglptr ? true : false;
00128 }
00129 
00137     bool
00138 inserttextingranf(
00139     Session      *sess,          
00140     typegranf     granfptr,
00141     typehint     *hintptr,
00142     typetextset   textset,
00143     typeispanset *ispansetptr)
00144 {
00145     return inserttextgr(sess, granfptr, hintptr, textset, ispansetptr);
00146 }
00147 
00155     bool
00156 createorglingranf(
00157     Session     *sess,          
00158     typegranf    granfptr,
00159     typehint    *hintptr,
00160     IStreamAddr *isaptr)
00161 {
00162     return createorglgr(sess, /* GRR not defd (typecuc*) */ granfptr, hintptr, isaptr);
00163 }
00164 
00172     bool
00173 ispanset2vstuffset(
00174     Session       *sess,          
00175     typegranf      granfptr,
00176     typeispanset   ispanset,
00177     typevstuffset *vstuffsetptr)
00178 {
00179     typevstuffset *save = vstuffsetptr;
00180 
00181 #ifndef DISTRIBUTION
00182     if (debug) {
00183         L("\n\nISPANSET2VSTUFFSET\n");
00184         fooitemset("", (typeitem *) ispanset);
00185     }
00186 #endif
00187 
00188     *vstuffsetptr = NULL;
00189     for (; ispanset; ispanset = ispanset->next)
00190         vstuffsetptr = ispan2vstuffset(sess, granfptr, ispanset, vstuffsetptr);
00191 
00192 #ifndef DISTRIBUTION
00193     if (debug)
00194         fooitemset("", (typeitem *) *save);
00195 #endif
00196 
00197     return true;
00198 }

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