server/get1.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: get1.cxx,v $
00032  * Revision 1.17  2004/09/11 15:02:00  jrush
00033  * Fixed Doxygen tags on all Session parameter arguments.
00034  *
00035  * Revision 1.16  2004/09/11 13:59:21  jrush
00036  * Changed all fprintf's to stderr to use the Nana library L() macro.  Also
00037  * removed a 2-3 minor compiler warnings.
00038  *
00039  * Revision 1.15  2004/09/04 16:02:18  jrush
00040  * Added Doxygen headers before each and every function definition.
00041  *
00042  * Revision 1.14  2004/09/04 13:13:55  jrush
00043  * Added Doxygen commenting around functions.
00044  *
00045  * Revision 1.13  2002/05/28 03:58:42  jrush
00046  * Sources modified to comply with GPL licensing.
00047  *
00048  * Revision 1.12  2002/04/16 22:39:50  jrush
00049  * Converted many #defines into enumeration types instead, and adjusted
00050  * function prototypes accordingly.
00051  *
00052  * Revision 1.11  2002/04/12 11:48:50  jrush
00053  * Major reorganization of includes into a single base-include style.
00054  *
00055  * Revision 1.10  2002/04/10 18:01:54  jrush
00056  * Renamed class typeisa to IStreamAddr.
00057  *
00058  * Revision 1.9  2002/04/09 21:45:46  jrush
00059  * Renamed class 'tumbler' to 'Tumbler', for consistency with Python sources,
00060  * and changed typeisa from typedef to a subclass, in preparation for cleaning
00061  * up the type/class tree.
00062  *
00063  * Revision 1.8  2002/04/06 19:51:30  jrush
00064  * Renamed TRUE/FALSE constant use to the C++ standard of true/false.
00065  *
00066  * Revision 1.7  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.6  2002/04/06 15:01:44  jrush
00071  * Changed INT to just 'int'.
00072  *
00073  * Revision 1.5  2002/04/02 17:29:10  jrush
00074  * Purely cosmetic cleanup.
00075  *
00076  * Revision 1.4  2002/02/14 10:08:25  jrush
00077  * Cleaned up source:
00078  *
00079  * 1. ran thru the indent tool to achieve a standard look,
00080  * 2. added structured comments at top for use with DOxygen reporting
00081  *    as well as CVS keywords,
00082  * 3. centralized prototypes in protos.h, removing incomplete ones,
00083  * 4. cleaned up use of bool/BOOLEAN type to suit C++ type,
00084  * 5. fixed initializer nesting in tumbler constants,
00085  * 6. converted select() int bits into ANSI fd_set type,
00086  * 7. added Makefile.am for use by automake.
00087  *
00088  */
00089 
00090 #include "udanax.h"
00091 
00092 bool  getspecset(Session * sess, typespecset * specsetptr);
00093 void  prompt(Session * sess, char *string);
00094 bool  getisa(Session * sess, IStreamAddr * isaptr);
00095 bool  getvsa(Session * sess, Tumbler * vsaptr);
00096 bool  gettextset(Session * sess, typetextset * textsetptr);
00097 bool  getnumber(Session * sess, int * numptr);
00098 bool  getcutseq(Session * sess, typecutseq * cutseqptr);
00099 bool  getspanset(Session * sess, typespanset * spansetptr, typeitemid id);
00100 bool  getspan(Session * sess, typespan * spanptr, typeitemid id);
00101 bool  gettumbler(Session * sess, Tumbler * tumblerptr);
00102 bool  validaccount(Session * sess, IStreamAddr * accountptr);
00103 
00111     bool
00112 getfinddocscontaining(
00113     Session     *sess,    
00114     typespecset *specsetptr)
00115 {
00116     return getspecset(sess, specsetptr);
00117 }
00118 
00126     bool
00127 getcopy(
00128     Session     *sess,    
00129     IStreamAddr *docisaptr,
00130     IStreamAddr *vsaptr,
00131     typespecset *localspecsetptr)
00132 {
00133     prompt(sess, "copy to this document=> ");
00134     if (!getisa(sess, docisaptr))
00135         return false;
00136 
00137     prompt(sess, "at this address=> ");
00138     if (!(getvsa(sess, vsaptr) && getspecset(sess, localspecsetptr)))
00139         return false;
00140 
00141     return true;
00142 }
00143 
00151     bool
00152 getinsert(
00153     Session     *sess,    
00154     IStreamAddr *docisaptr,
00155     Tumbler     *vsaptr,
00156     typetextset *textsetptr)
00157 {
00158     prompt(sess, "text=>\n\n");
00159     if (!gettextset(sess, textsetptr))
00160         return false;
00161 
00162     prompt(sess, "document=> ");
00163     if (!getisa(sess, docisaptr))
00164         return false;
00165 
00166     prompt(sess, "address=> ");
00167     if (!getvsa(sess, vsaptr))
00168         return false;
00169 
00170     return true;
00171 }
00172 
00180     bool
00181 getcreatelink(
00182     Session     *sess,    
00183     IStreamAddr *docisaptr,
00184     typespecset *fromspecsetptr,
00185     typespecset *tospecsetptr,
00186     typespecset *threespecsetptr)
00187 {
00188     prompt(sess, "home document=> ");
00189     if (!getisa(sess, docisaptr))
00190         return false;
00191 
00192     prompt(sess, "fromset\n");
00193     if (!getspecset(sess, fromspecsetptr))
00194         return false;
00195 
00196     prompt(sess, "toset\n");
00197     if (!getspecset(sess, tospecsetptr))
00198         return false;
00199 
00200     prompt(sess, "threeset\n");
00201     if (!getspecset(sess, threespecsetptr))
00202         return false;
00203 
00204     return true;
00205 }
00206 
00214     bool
00215 getfollowlink(
00216     Session     *sess,    
00217     IStreamAddr *linkisaptr,
00218     int         *whichendptr)
00219 {
00220     prompt(sess, "enter link=> ");
00221     if (!getisa(sess, linkisaptr))
00222         return false;
00223 
00224     prompt(sess, "enter endset=> ");
00225     if (!(getnumber(sess, whichendptr) && (*whichendptr == 1 || *whichendptr == 2 || *whichendptr == 3)))
00226         return false;
00227 
00228     return true;
00229 }
00230 
00238     bool
00239 getcreatenewversion(
00240     Session     *sess,    
00241     IStreamAddr *docisaptr)
00242 {
00243     prompt(sess, "enter document=> ");
00244     return getisa(sess, docisaptr);
00245 }
00246 
00254     bool
00255 getretrievedocvspanset(
00256     Session     *sess,    
00257     IStreamAddr *docisaptr)
00258 {
00259     prompt(sess, "enter document=> ");
00260     return getisa(sess, docisaptr);
00261 }
00262 
00270     bool
00271 getretrievedocvspan(
00272     Session     *sess,    
00273     IStreamAddr *docisaptr)
00274 {
00275     prompt(sess, "enter document=> ");
00276     return getisa(sess, docisaptr);
00277 }
00278 
00286     bool
00287 getrearrange(
00288     Session     *sess,    
00289     IStreamAddr *docisaptr,
00290     typecutseq  *cutseqptr)
00291 {
00292     prompt(sess, "enter document=> ");
00293     if (!getisa(sess, docisaptr))
00294         return false;
00295 
00296     prompt(sess, "enter cutseq=>\n");
00297     if (!getcutseq(sess, cutseqptr))
00298         return false;
00299 
00300     return true;
00301 }
00302 
00310     bool
00311 getretrievev(
00312     Session     *sess,    
00313     typespecset *specsetptr)
00314 {
00315     return getspecset(sess, specsetptr);
00316 }
00317 
00325     bool
00326 getfindlinksfromtothree(
00327     Session      *sess,    
00328     typespecset  *fromvspecsetptr,
00329     typespecset  *tovspecsetptr,
00330     typespecset  *threevspecsetptr,
00331     typeispanset *homesetptr)
00332 {
00333     prompt(sess, "fromset\n");
00334     if (!getspecset(sess, fromvspecsetptr))
00335         return false;
00336 
00337     prompt(sess, "toset\n");
00338     if (!getspecset(sess, tovspecsetptr))
00339         return false;
00340 
00341     prompt(sess, "threeset\n");
00342     if (!getspecset(sess, threevspecsetptr))
00343         return false;
00344 
00345     prompt(sess, "home documents\n");
00346     if (!getspanset(sess, homesetptr, ISPANID))
00347         return false;
00348 
00349     return true;
00350 }
00351 
00359     bool
00360 getfindnumoflinksfromtothree(
00361     Session     *sess,    
00362     typespecset *fromvspecsetptr,
00363     typespecset *tovspecsetptr,
00364     typespecset *threevspecsetptr,
00365     typeispanset *homesetptr)
00366 {
00367     return getfindlinksfromtothree(sess, fromvspecsetptr, tovspecsetptr, threevspecsetptr, homesetptr);
00368 }
00369 
00377     bool
00378 getfindnextnlinksfromtothree(
00379     Session      *sess,    
00380     typespecset  *fromvspecsetptr,
00381     typespecset  *tovspecsetptr,
00382     typespecset  *threevspecsetptr,
00383     typeispanset *homesetptr,
00384     IStreamAddr  *lastlinkptr,
00385     int          *nptr)
00386 {
00387     if (!getfindlinksfromtothree(sess, fromvspecsetptr, tovspecsetptr, threevspecsetptr, homesetptr))
00388         return false;
00389 
00390     prompt(sess, "last link=> ");
00391     if (!getisa(sess, lastlinkptr))
00392         return false;
00393 
00394     prompt(sess, "number of links => ");
00395     if (!getnumber(sess, nptr))
00396         return false;
00397 
00398     return true;
00399 }
00400 
00408     bool
00409 getshowrelationof2versions(
00410     Session     *sess,    
00411     typespecset *version1ptr,
00412     typespecset *version2ptr)
00413 {
00414     prompt(sess, "version1\n");
00415     if (!getspecset(sess, version1ptr))
00416         return false;
00417 
00418     prompt(sess, "version2\n");
00419     if (!getspecset(sess, version2ptr))
00420         return false;
00421 
00422     return true;
00423 }
00424 
00432     void
00433 getcreatenewdocument()
00434 {
00435 }
00436 
00444     bool
00445 getdeletevspan(
00446     Session     *sess,    
00447     IStreamAddr *docisaptr,
00448     typevspan   *vspanptr)
00449 {
00450     prompt(sess, "document=> ");
00451     if (!getisa(sess, docisaptr))
00452         return false;
00453 
00454     prompt(sess, "delete this part\n");
00455     if (!getspan(sess, vspanptr, VSPANID /* zzz */ ))
00456         return false;
00457 
00458     return true;
00459 }
00460 
00468     void
00469 setdebug(
00470     Session *sess)    
00471 {
00472     prompt(sess, "set debug => ");
00473     getnumber(sess, &debug);
00474 }
00475 
00483     void
00484 playwithalloc(
00485     Session *sess)    
00486 {
00487     prompt(sess, "playwithalloc\n");
00488     lookatalloc();
00489 }
00490 
00498     bool
00499 getretrieveendsets(
00500     Session     *sess,    
00501     typespecset *specsetptr)
00502 {
00503     return getspecset(sess, specsetptr);
00504 }
00505 
00513     bool
00514 getxaccount(
00515     Session     *sess,    
00516     IStreamAddr *accountptr)
00517 {
00518 /* tumblerclear (accountptr); return true; */
00519 
00520 /* prompt (sess, "account? "); */
00521 
00522     gettumbler(sess, accountptr) && validaccount(sess, accountptr);
00523     sess->account = *accountptr;
00524 
00525     L("in get xaccount \n");
00526 
00527     return true;
00528 }
00529 
00537     bool
00538 getcreatenode_or_account(
00539     Session *sess,    
00540     Tumbler *tp)
00541 {
00542     gettumbler(sess, tp);
00543     return true;
00544 }
00545 
00553     bool
00554 getopen(
00555     Session *sess,    
00556     Tumbler *tp,
00557     int     *typep,
00558     int     *modep)
00559 {
00560 
00561     gettumbler(sess, tp);
00562     getnumber(sess, typep);
00563     getnumber(sess, modep);
00564 
00565     return true;
00566 }
00567 
00575     bool
00576 getclose(
00577     Session *sess,    
00578     Tumbler *tp)
00579 {
00580     gettumbler(sess, tp);
00581 
00582     return true;
00583 }

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