libsrc/do1.cxx File Reference

Udanax document handling routines. More...

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include "udanax.h"

Include dependency graph for do1.cxx:

Include dependency graph

Go to the source code of this file.

Functions

void graphwholetree (char *filename, typecorecrum *ptr, char *graphtitle)
 ???

bool dofinddocscontaining (Session *sess, typespecset specset, typelinkset *addresssetptr)
 Find documents containing any of the material specified.

bool doappend (Session *sess, IStreamAddr *doc_isa, typetextset textset)
 Append text to a document.

bool dorearrange (Session *sess, IStreamAddr *docisaptr, typecutseq *cutseqptr)
 Transpose two regions of text within a document.

bool docopy (Session *sess, IStreamAddr *docisaptr, Tumbler *vsaptr, typespecset specset)
 Virtually copy (transclude) some material into a document.

bool docopyinternal (Session *sess, IStreamAddr *docisaptr, Tumbler *vsaptr, typespecset specset)
 Virtually copy (transclude) some material into a document.

bool doinsert (Session *sess, IStreamAddr *docisaptr, Tumbler *vsaptr, typetextset textset)
 Insert a set of text strings into a document.

void checkspecandstringbefore ()
 ???

bool dodeletevspan (Session *sess, IStreamAddr *docisaptr, typevspan *vspanptr)
 Delete a range of text from a document.

bool domakelink (Session *sess, IStreamAddr *docisaptr, typespecset fromspecset, typespecset tospecset, IStreamAddr *linkisaptr)
 Create a 2-endpoint link between parts of documents.

bool docreatelink (Session *sess, IStreamAddr *docisaptr, typespecset fromspecset, typespecset tospecset, typespecset threespecset, IStreamAddr *linkisaptr)
 Create a 3-endpoint link between parts of documents.

bool dofollowlink (Session *sess, IStreamAddr *linkisaptr, typespecset *specsetptr, int whichend)
 Return the specification set of one endpoint of a link.

bool docreatenewdocument (Session *sess, IStreamAddr *isaptr)
 Create a new, empty document.

bool docreatenode_or_account (Session *sess, IStreamAddr *isaptr)
 Create a new node or account identifier.

bool doretrievedocvspanfoo (Session *sess, IStreamAddr *docisaptr, typevspan *vspanptr)
 Return the total span of the V-stream of a document.

bool docreatenewversion (Session *sess, IStreamAddr *isaptr, IStreamAddr *wheretoputit, IStreamAddr *newisaptr)
 Create a new version of a document and return its identifier.

bool doretrievedocvspan (Session *sess, IStreamAddr *docisaptr, typevspan *vspanptr)
 Return the total span of text and links within a document.

bool doretrievedocvspanset (Session *sess, IStreamAddr *docisaptr, typevspanset *vspansetptr)
 Return the total span of text and links within a document.

bool doretrievev (Session *sess, typespecset specset, typevstuffset *vstuffsetptr)
 Return the text and links from set of places within a document.

bool dofindlinksfromtothree (Session *sess, typespecset fromvspecset, typespecset tovspecset, typespecset threevspecset, typeispan *orglrangeptr, typelinkset *linksetptr)
 Return a list of links that meet a specific set of endpoint criteria.

bool dofindnumoflinksfromtothree (Session *sess, typespecset *fromvspecset, typespecset *tovspecset, typespecset *threevspecset, typeispan *orglrangeptr, int *numptr)
 Return a count of links that meet a specific set of endpoint criteria.

bool dofindnextnlinksfromtothree (Session *sess, typevspec *fromvspecptr, typevspec *tovspecptr, typevspec *threevspecptr, typeispan *orglrangeptr, IStreamAddr *lastlinkisaptr, typelinkset *nextlinksetptr, int *nptr)
 Return a subset of links that meet a specific set of endpoint criteria.

bool doretrieveendsets (Session *sess, typespecset specset, typespecset *fromsetptr, typespecset *tosetptr, typespecset *threesetptr)
 Return a list of all link end-sets in the specification set.

bool doshowrelationof2versions (Session *sess, typespecset version1, typespecset version2, typespanpairset *relation)
 ???


Variables

typespec spec
typespec spec2
typespec spec3
typevstuffset uppervstuffset
Tumbler fivetumbler = { 0, 0, 0, 0, { 500 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }


Detailed Description

Udanax document handling routines.

(to be defined)

Definition in file do1.cxx.


Function Documentation

void checkspecandstringbefore  ) 
 

???

Definition at line 357 of file do1.cxx.

References L.

Referenced by insertnd().

00358 {
00359     L("--checkspecandstringbefore is a NOP--\n");
00360 }

bool doappend Session sess,
IStreamAddr doc_isa,
typetextset  textset
 

Append text to a document.

Append a set of text strings onto the end of the text space of a document, returning an indicator of success.

Parameters:
sess  Input: User's session context
doc_isa  Input: Identifier of document
textset  Input: Set of text strings

Definition at line 148 of file do1.cxx.

References appendpm(), and typetextset.

Referenced by sourceunixcommand().

00149                                    : User's session context
00150     IStreamAddr *doc_isa, 
00151     typetextset  textset) 
00152 {
00153     return appendpm(sess, doc_isa, textset);
00154 }

bool docopy Session sess,
IStreamAddr docisaptr,
Tumbler vsaptr,
typespecset  specset
 

Virtually copy (transclude) some material into a document.

The material determined by the specification set provided is copied to the document at the V-stream address given.

Parameters:
sess  Input: User's session context
docisaptr  Input: Identifier of document
vsaptr  Input: Place within document to receive copy
specset  Input: Set of places from which to copy

Definition at line 193 of file do1.cxx.

References acceptablevsa(), asserttreeisok(), DOCISPAN, findorgl(), granf, graphwholetree(), insertpm(), insertspanf(), L, NOBERTREQUIRED, putitemset(), puttumbler(), spanf, specset2ispanset(), typecorecrum, typeispanset, typeorgl, typespecset, and WRITEBERT.

Referenced by copy(), docreatelink(), doinsert(), and domakelink().

00194                                      : User's session context
00195     IStreamAddr *docisaptr, 
00196     Tumbler     *vsaptr,    
00197     typespecset  specset)   
00198 {
00199     bool f;
00200 
00201     L("(specset2ispanset p=0x%08X)\n", (int) specset); putitemset(sess, (typeitem *) specset);  L(")\n");
00202 
00203     // Convert the specification set into a set of spans into the I-stream.
00204     typeispanset ispanset;
00205     f = specset2ispanset(sess, specset, &ispanset, NOBERTREQUIRED);
00206     if (!f) {
00207         L("(specset2ispanset FAILED)\n");
00208         return false;
00209     }
00210 
00211     L("ispanset is 0x%08X\n", (int) ispanset);
00212     L("(specset2ispanset ispanset=");  putitemset(sess, (typeitem *) ispanset);  L(")\n");
00213     L("(findorgl for docisa=");  puttumbler(stdout, docisaptr);  L(")\n");
00214 
00215     /*
00216      * Walk the granfilade to locate and lock, for writing, the document to receive
00217      * the copied material.
00218      */
00219 
00220     // Locate the document's ORGL within the Granfilade and
00221     // obtain a write lock on it.
00222     typeorgl docorgl;
00223     f = findorgl(sess, granf, docisaptr, &docorgl, WRITEBERT);
00224     if (!f) {
00225         L("(attempt to findorgl FAILED)\n");
00226         return false;
00227     }
00228 
00229     /*
00230      * Validate the V-stream address at which to insert the content for reasonableness.
00231      */ 
00232     L("(acceptablevsa)\n");
00233     f = acceptablevsa(vsaptr, docorgl);
00234     if (!f) {
00235         L("(acceptablevsa FAILED)\n");
00236         return false;
00237     }
00238 
00239     L("(asserttreeisok)\n");
00240     f = asserttreeisok((typecorecrum *) docorgl);
00241     if (!f) {
00242         L("(asserttreeisok FAILED)\n");
00243         return false;
00244     }
00245 
00246 //    L("---- Dump of Entire Granfilade Before Copy ----\n");
00247 //    dumpwholetree((typecorecrum *) granf);
00248     graphwholetree("/var/tmp/granf_before.dot", (typecorecrum *) granf, "Granfilade before Copy");
00249 
00250 //    L("---- End of Dump of Entire Granfilade Before Copy ----\n");
00251 
00252 //    L("---- Dump of Entire Spanfilade Before Copy ----\n");
00253 //    dumpwholetree((typecorecrum *) spanf);
00254     graphwholetree("/var/tmp/spanf_before.dot", (typecorecrum *) spanf, "Spanfilade before Copy");
00255 //    L("---- End of Dump of Entire Spanfilade Before Copy ----\n");
00256 
00257     /*
00258      *
00259      */
00260 
00261 /* the meat of docopy: */
00262     L("(insertpm)\n");
00263     f = insertpm(sess, docisaptr, docorgl, vsaptr, (typesporglitem *) ispanset);
00264     if (!f) {
00265         L("(insertpm FAILED)\n");
00266         return false;
00267     }
00268 
00269     L("(insertspanf)\n");
00270     f = insertspanf(sess, spanf, docisaptr, (typesporglitem *) ispanset, DOCISPAN);
00271     if (!f) {
00272         L("(insertspanf FAILED)\n");
00273         return false;
00274     }
00275 
00276     L("(asserttreeisok)\n");
00277     f = asserttreeisok((typecorecrum *) docorgl);
00278     if (!f) {
00279         L("(asserttreeisok FAILED)\n");
00280         return false;
00281     }
00282 
00283 //    L("---- Dump of Entire Granfilade After Copy ----\n");
00284 //    dumpwholetree((typecorecrum *) granf);
00285     graphwholetree("/var/tmp/granf_after.dot", (typecorecrum *) granf, "Granfilade after Copy");
00286 //    L("---- End of Dump of Entire Granfilade After Copy ----\n");
00287 
00288 //    L("---- Dump of Entire Spanfilade After Copy ----\n");
00289 //    dumpwholetree((typecorecrum *) spanf);
00290     graphwholetree("/var/tmp/spanf_after.dot", (typecorecrum *) spanf, "Spanfilade after Copy");
00291 //    L("---- End of Dump of Entire Spanfilade After Copy ----\n");
00292 
00293     return true;
00294 }

bool docopyinternal Session sess,
IStreamAddr docisaptr,
Tumbler vsaptr,
typespecset  specset
 

Virtually copy (transclude) some material into a document.

The material determined by the specification set provided is copied to the document at the V-stream address given.

Parameters:
sess  Input: User's session context
docisaptr  Input: Identifier of document
vsaptr  Input: Place within document to receive copy
specset  Input: Set of places from which to copy

Definition at line 304 of file do1.cxx.

References acceptablevsa(), asserttreeisok(), DOCISPAN, findorgl(), granf, insertpm(), insertspanf(), NOBERTREQUIRED, spanf, specset2ispanset(), typecorecrum, typeispanset, typeorgl, and typespecset.

Referenced by docreatenewversion().

00305                                      : User's session context
00306     IStreamAddr *docisaptr, 
00307     Tumbler     *vsaptr,    
00308     typespecset  specset)   
00309 {
00310     typeispanset ispanset;
00311 
00312     typeorgl docorgl;
00313 
00314     // Convert the specification set into a set of spans into the I-stream.
00315     return (specset2ispanset(sess, specset, &ispanset, NOBERTREQUIRED)
00316 
00317             && findorgl(sess, granf, docisaptr, &docorgl, NOBERTREQUIRED)
00318             && acceptablevsa(vsaptr, docorgl)
00319             && asserttreeisok((typecorecrum *) docorgl)
00320 
00321 /* the meat of docopy: */
00322             && insertpm(sess, docisaptr, docorgl, vsaptr, (typesporglitem *) ispanset)
00323 
00324             && insertspanf(sess, spanf, docisaptr, (typesporglitem *) ispanset, DOCISPAN)
00325             && asserttreeisok((typecorecrum *) docorgl)
00326             );
00327 }

bool docreatelink Session sess,
IStreamAddr docisaptr,
typespecset  fromspecset,
typespecset  tospecset,
typespecset  threespecset,
IStreamAddr linkisaptr
 

Create a 3-endpoint link between parts of documents.

Create a link within the specified document, -from- a set of spans, -to- a set of spans, -of type- a set of spans.

Parameters:
sess  Input: User's session context
docisaptr  Input: Identifier of document to contain link
fromspecset  Input: Specification set of 'From' end
tospecset  Input: Specification set of 'To' end
threespecset  Input: Specification set of 'Three' end
linkisaptr  Input: I-stream address of new link

Definition at line 428 of file do1.cxx.

References ATOM, createorglingranf(), docopy(), DOCUMENT, findnextlinkvsa(), findorgl(), granf, insertendsetsinorgl(), insertendsetsinspanf(), LINKATOM, makehint(), NOBERTREQUIRED, setlinkvsas(), spanf, specset2sporglset(), tumbler2spanset(), typeorgl, typespanset, typespecset, and typesporglset.

Referenced by createlink().

00429                                         : User's session context
00430     IStreamAddr *docisaptr,    
00431     typespecset  fromspecset,  
00432     typespecset  tospecset,    
00433     typespecset  threespecset, 
00434     IStreamAddr *linkisaptr)   
00435 {
00436     Tumbler       linkvsa, fromvsa, tovsa, threevsa;
00437     typespanset   ispanset;
00438     typesporglset fromsporglset;
00439     typesporglset tosporglset;
00440     typesporglset threesporglset;
00441     typeorgl      link;
00442 
00443     typehint hint;
00444     makehint(DOCUMENT, ATOM, LINKATOM, docisaptr, &hint);
00445 
00446     return createorglingranf(sess, granf, &hint, linkisaptr)
00447             && tumbler2spanset(sess, linkisaptr, &ispanset)
00448             && findnextlinkvsa(sess, docisaptr, &linkvsa)
00449             && docopy(sess, docisaptr, &linkvsa, (typespec *) ispanset)
00450             && findorgl(sess, granf, linkisaptr, &link, /* WRITEBERT ECH 7-1 */ NOBERTREQUIRED)
00451             && specset2sporglset(sess, fromspecset, &fromsporglset, NOBERTREQUIRED)
00452             && specset2sporglset(sess, tospecset, &tosporglset, NOBERTREQUIRED)
00453             && specset2sporglset(sess, threespecset, &threesporglset, NOBERTREQUIRED)
00454             && setlinkvsas(&fromvsa, &tovsa, &threevsa)
00455             && insertendsetsinorgl(sess, linkisaptr, link, &fromvsa, fromsporglset, &tovsa, tosporglset, &threevsa,
00456                                    threesporglset)
00457             && insertendsetsinspanf(sess, spanf, linkisaptr, fromsporglset, tosporglset, threesporglset)
00458             ;
00459 }

bool docreatenewdocument Session sess,
IStreamAddr isaptr
 

Create a new, empty document.

Create a new, empty and unopened document within the user's document space and return its identifier.

Create a new document under the account and node of the user who issued the request. Return the global identifier for the document.

This request creates the document but does not open it for access; you must issue an open request (see below) to access the data in the new document.

Parameters:
sess  Input: User's session context
isaptr  Output: I-stream address of new, empty document

Definition at line 493 of file do1.cxx.

References ACCOUNT, Session::account, createorglingranf(), DOCUMENT, granf, and makehint().

Referenced by createnewdocument(), and sourceunixcommand().

00494                                   : User's session context
00495     IStreamAddr *isaptr) 
00496 {
00497     typehint hint;
00498     makehint(ACCOUNT, DOCUMENT, 0, &sess->account, &hint);
00499 
00500     return createorglingranf(sess, granf, &hint, isaptr);
00501 }

bool docreatenewversion Session sess,
IStreamAddr isaptr,
IStreamAddr wheretoputit,
IStreamAddr newisaptr
 

Create a new version of a document and return its identifier.

Create a new version of a document and return its identifier. The new version of the document will contain a virtual copy of the original.

Parameters:
sess  Input: User's session context
isaptr  Input: Identifier of document to fork
wheretoputit  Input: User account under which to create copy
newisaptr  Output: I-stream address of new version

Definition at line 553 of file do1.cxx.

References ACCOUNT, assert, BERTMODEONLY, createorglingranf(), typevspec::docisa, doclose(), docopyinternal(), DOCUMENT, doopen(), doretrievedocvspanfoo(), granf, isthisusersdocument(), typevspec::itemid, makehint(), movetumbler, typevspec::next, NULL, typespan::stream, tumbleraccounteq(), typevspan, typevspec::vspanset, VSPECID, and WRITEBERT.

Referenced by createnewversion(), and doopen().

00554                                         : User's session context
00555     IStreamAddr *isaptr,       
00556     IStreamAddr *wheretoputit, 
00557     IStreamAddr *newisaptr)    
00558 {
00559     IStreamAddr newtp;      /* for internal open */
00560 
00561     // Test for ownership to do the right thing for explicit creation of new
00562     // version of someone else's document
00563     typehint hint;
00564     if (tumbleraccounteq(isaptr, wheretoputit) && isthisusersdocument(sess, isaptr)) {
00565         makehint(DOCUMENT, DOCUMENT, 0, isaptr /* wheretoputit */ , &hint);
00566     } else {
00567         // This does the right thing for a new version of someone else's
00568         // document, as it duplicates the behavior of docreatenewdocument
00569         makehint(ACCOUNT, DOCUMENT, 0, wheretoputit, &hint);
00570     }
00571 
00572     if (!createorglingranf(sess, granf, &hint, newisaptr))
00573         return false;
00574 
00575     // Determine the full span of the parent document, to know the range to
00576     // copy into the newly created version.
00577 
00578     typevspan vspan;
00579     if (!doretrievedocvspanfoo(sess, isaptr, &vspan))
00580         return false;
00581 
00582     typevspec vspec;
00583     vspec.next     = NULL;
00584     vspec.itemid   = VSPECID;
00585     movetumbler(isaptr, &vspec.docisa);
00586     vspec.vspanset = &vspan;
00587 
00588     // BERTMODEONLY to prevent recursive createnewversions
00589     if (!doopen(sess, newisaptr, &newtp, WRITEBERT, BERTMODEONLY))
00590         assert(0); // Couldn't do internal doopen for new doc in docreatenewversion
00591 
00592     // Map (copy virtually) the entire content of the original document into
00593     // V-stream of the newly created version.
00594     docopyinternal(sess, newisaptr, &vspan.stream, (typespec *) &vspec);
00595     doclose(sess, newisaptr);
00596 
00597     return true;
00598 }

bool docreatenode_or_account Session sess,
IStreamAddr isaptr
 

Create a new node or account identifier.

Create a new node or account identifier, globally, and return its identifier.

Declare that id-account is a legal account or node. If id-account is an account tumbler, then the backend creates the account. If it is a node tumbler, then the backend reassigns its own address to id-account.

Parameters:
sess  Input: User's session context
isaptr  Output: I-stream address of new node or account

Definition at line 515 of file do1.cxx.

References createorglingranf(), granf, makehint(), NODE, and tumblercopy().

Referenced by createnode_or_account().

00516                                   : User's session context
00517     IStreamAddr *isaptr) 
00518 {
00519     IStreamAddr  isa;
00520     tumblercopy(isaptr, &isa);
00521 
00522     typehint hint;
00523     makehint(NODE, NODE, 0, /* &sess->account */ &isa, &hint);
00524 
00525     return createorglingranf(sess, granf, &hint, &isa);
00526 }

bool dodeletevspan Session sess,
IStreamAddr docisaptr,
typevspan vspanptr
 

Delete a range of text from a document.

Remove the specified span of text from a document, shuffling down the text that follows that position.

Parameters:
sess  Input: User's session context
docisaptr  Input: Identifier of document
vspanptr  Input: Span of text to be deleted

Definition at line 370 of file do1.cxx.

References deletevspanpm(), findorgl(), granf, typeorgl, typevspan, and WRITEBERT.

Referenced by deletevspan().

00371                                      : User's session context
00372     IStreamAddr *docisaptr, 
00373     typevspan   *vspanptr)  
00374 {
00375     typeorgl docorgl;
00376 
00377     if (findorgl(sess, granf, docisaptr, &docorgl, WRITEBERT))
00378         return deletevspanpm(sess, docisaptr, docorgl, vspanptr);
00379 
00380     return false;
00381 }

bool dofinddocscontaining Session sess,
typespecset  specset,
typelinkset addresssetptr
 

Find documents containing any of the material specified.

Return a list of all documents containing any of the material specified by the V-stream specification set, regardless of where the native copies are located.

Parameters:
sess  Input: User's session context
specset  Input: Set of specifications
addresssetptr  Output: Set of matching documents

Definition at line 126 of file do1.cxx.

References finddocscontainingsp(), NOBERTREQUIRED, specset2ispanset(), typeispanset, typelinkset, and typespecset.

Referenced by finddocscontaining().

00127                                          : User's session context
00128     typespecset  specset,       
00129     typelinkset *addresssetptr) 
00130 {
00131     typeispanset ispanset;
00132 
00133     // Convert the specification set into a set of spans into the I-stream.
00134     return specset2ispanset(sess, specset, &ispanset, NOBERTREQUIRED)
00135 
00136     // Search for documents containing those spans
00137             && finddocscontainingsp(sess, ispanset, addresssetptr);
00138 }

bool dofindlinksfromtothree Session sess,
typespecset  fromvspecset,
typespecset  tovspecset,
typespecset  threevspecset,
typeispan orglrangeptr,
typelinkset linksetptr
 

Return a list of links that meet a specific set of endpoint criteria.

Return a list of all links which are (1) from any or all part of the -from- set, (2) to any or all part of the -to- set and -three- set, and (3) in the home of ORGLs. This is an AND-relation in that all qualifications must be met.

Parameters:
sess  Input: User's session context
fromvspecset  Input: Specification of the From endpoint
tovspecset  Input: Specification of the To endpoint
threevspecset  Input: Specification of the Three endpoint
orglrangeptr  Input: a Range of document ORGLs
linksetptr  Output: Set of links meeting qualifications

Definition at line 675 of file do1.cxx.

References findlinksfromtothreesp(), spanf, typeispan, typelinkset, and typespecset.

Referenced by findlinksfromtothree().

00676                                          : User's session context
00677     typespecset  fromvspecset,  
00678     typespecset  tovspecset,    
00679     typespecset  threevspecset, 
00680     typeispan   *orglrangeptr,  
00681     typelinkset *linksetptr)    
00682 {
00683     return findlinksfromtothreesp(sess, spanf, fromvspecset, tovspecset, threevspecset, orglrangeptr, linksetptr);
00684 }

bool dofindnextnlinksfromtothree Session sess,
typevspec fromvspecptr,
typevspec tovspecptr,
typevspec threevspecptr,
typeispan orglrangeptr,
IStreamAddr lastlinkisaptr,
typelinkset nextlinksetptr,
int *  nptr
 

Return a subset of links that meet a specific set of endpoint criteria.

Return a subset of all links which are (1) from any or all part of the -from- set, (2) to any or all part of the -to- set and -three- set, and (3) in the home of ORGLs. This is an AND-relation in that all qualifications must be met.

Parameters:
sess  Input: User's session context
fromvspecptr  Input: Specification of the From endpoint
tovspecptr  Input: Specification of the To endpoint
threevspecptr  Input: Specification of the Three endpoint
orglrangeptr  Input: a range of document ORGLs
lastlinkisaptr  Input: last link addr from previous query
nextlinksetptr  Ouput: Set of links meeting qualifications
nptr  Input: Maximum count of links to return

Definition at line 717 of file do1.cxx.

References findnextnlinksfromtothreesp(), typeispan, and typelinkset.

Referenced by findnextnlinksfromtothree().

00718                                           : User's session context
00719     typevspec   *fromvspecptr,   
00720     typevspec   *tovspecptr,     
00721     typevspec   *threevspecptr,  
00722     typeispan   *orglrangeptr,   
00723     IStreamAddr *lastlinkisaptr, 
00724     typelinkset *nextlinksetptr, 
00725     int         *nptr)           
00726 {
00727     return findnextnlinksfromtothreesp(sess, (typespec *) fromvspecptr,
00728                (typespec *) tovspecptr, (typespec *) threevspecptr,
00729                orglrangeptr, lastlinkisaptr, nextlinksetptr, nptr);
00730 }

bool dofindnumoflinksfromtothree Session sess,
typespecset fromvspecset,
typespecset tovspecset,
typespecset threevspecset,
typeispan orglrangeptr,
int *  numptr
 

Return a count of links that meet a specific set of endpoint criteria.

Return a count of all links which are (1) from any or all part of the -from- set, (2) to any or all part of the -to- set and -three- set, and (3) in the home of ORGLs. This is an AND-relation in that all qualifications must be met.

Parameters:
sess  Input: User's session context
fromvspecset  Input: Specification of the From endpoint
tovspecset  Input: Specification of the To endpoint
threevspecset  Input: Specification of the Three endpoint
orglrangeptr  Input: a Range of document ORGLs
numptr  Output: Count of links meeting qualifications

Definition at line 695 of file do1.cxx.

References findnumoflinksfromtothreesp(), spanf, typeispan, and typespecset.

Referenced by findnumoflinksfromtothree().

00696                                          : User's session context
00697     typespecset *fromvspecset,  
00698     typespecset *tovspecset,    
00699     typespecset *threevspecset, 
00700     typeispan   *orglrangeptr,  
00701     int         *numptr)        
00702 {
00703     /*BUG: there is some inconsistency re arg 'fromvspecset' as whether it is (typespec *)[fn below] or (typespec **)[passed-in] */
00704     return findnumoflinksfromtothreesp(sess, spanf, (typespec *) fromvspecset, (typespec *) tovspecset, (typespec *) threevspecset, orglrangeptr, numptr);
00705 }

bool dofollowlink Session sess,
IStreamAddr linkisaptr,
typespecset specsetptr,
int  whichend
 

Return the specification set of one endpoint of a link.

Parameters:
sess  Input: User's session context
linkisaptr  Input: Identifier of link to query
specsetptr  Output: Specification of end specified
whichend  Input: Which end of the link to query

Definition at line 466 of file do1.cxx.

References link2sporglset(), linksporglset2specset(), NOBERTREQUIRED, typespecset, and typesporglset.

Referenced by followlink().

00467                                       : User's session context
00468     IStreamAddr *linkisaptr, 
00469     typespecset *specsetptr, 
00470     int          whichend)   
00471 {
00472     typesporglset sporglset;
00473 
00474     return link2sporglset(sess, linkisaptr, &sporglset, whichend, NOBERTREQUIRED)
00475             && linksporglset2specset(sess, &((typesporgl *) sporglset)->sporgladdress, sporglset, specsetptr, NOBERTREQUIRED);
00476 }

bool doinsert Session sess,
IStreamAddr docisaptr,
Tumbler vsaptr,
typetextset  textset
 

Insert a set of text strings into a document.

Insert a set of text strings into the specified place within a document, shoving down the text following that position.

Parameters:
sess  Input: User's session context
docisaptr  Input: Identifier of document
vsaptr  Input: Place within document to receive text
textset  Input: Set of text strings to insert

Definition at line 337 of file do1.cxx.

References ATOM, docopy(), DOCUMENT, granf, inserttextingranf(), makehint(), TEXTATOM, typespanset, and typetextset.

Referenced by appendpm(), and insert().

00338                                      : User's session context
00339     IStreamAddr *docisaptr, 
00340     Tumbler     *vsaptr,    
00341     typetextset  textset)   
00342 {
00343     typehint hint;
00344     makehint(DOCUMENT, ATOM, TEXTATOM, docisaptr, &hint);
00345 
00346     typespanset ispanset;
00347     return inserttextingranf(sess, granf, &hint, textset, &ispanset)
00348 
00349            && docopy(sess, docisaptr, vsaptr, (typespec *) ispanset);
00350 }

bool domakelink Session sess,
IStreamAddr docisaptr,
typespecset  fromspecset,
typespecset  tospecset,
IStreamAddr linkisaptr
 

Create a 2-endpoint link between parts of documents.

Create a link within the specified document, -from- a set of spans, -to- a set of spans.

Parameters:
sess  Input: User's session context
docisaptr  Input: Identifier of document to contain link
fromspecset  Input: Specification set of 'From' end
tospecset  Input: Specification set of 'To' end
linkisaptr  Output: I-stream address of new link

Definition at line 391 of file do1.cxx.

References ATOM, createorglingranf(), docopy(), DOCUMENT, findnextlinkvsa(), findorgl(), granf, insertendsetsinorgl(), insertendsetsinspanf(), LINKATOM, makehint(), NOBERTREQUIRED, NULL, setlinkvsas(), spanf, specset2sporglset(), tumbler2spanset(), typeorgl, typespanset, typespecset, typesporglset, and WRITEBERT.

00392                                        : User's session context
00393     IStreamAddr *docisaptr,   
00394     typespecset  fromspecset, 
00395     typespecset  tospecset,   
00396     IStreamAddr *linkisaptr)  
00397 {
00398     Tumbler       linkvsa, fromvsa, tovsa;
00399     typespanset   ispanset;
00400     typesporglset fromsporglset;
00401     typesporglset tosporglset;
00402     typeorgl      link;
00403 
00404     typehint hint;
00405     makehint(DOCUMENT, ATOM, LINKATOM, docisaptr, &hint);
00406 
00407     return createorglingranf(sess, granf, &hint, linkisaptr)
00408             && tumbler2spanset(sess, linkisaptr, &ispanset)
00409             && findnextlinkvsa(sess, docisaptr, &linkvsa)
00410             && docopy(sess, docisaptr, &linkvsa, (typespec *) ispanset)
00411             && findorgl(sess, granf, linkisaptr, &link, WRITEBERT)
00412             && specset2sporglset(sess, fromspecset, &fromsporglset, NOBERTREQUIRED)
00413             && specset2sporglset(sess, tospecset, &tosporglset, NOBERTREQUIRED)
00414             && setlinkvsas(&fromvsa, &tovsa, NULL)
00415             && insertendsetsinorgl(sess, linkisaptr, link, &fromvsa, fromsporglset, &tovsa, tosporglset, NULL, NULL)
00416             && insertendsetsinspanf(sess, spanf, linkisaptr, fromsporglset, tosporglset, NULL)
00417             ;
00418 }

bool dorearrange Session sess,
IStreamAddr docisaptr,
typecutseq cutseqptr
 

Transpose two regions of text within a document.

Transpose two regions of text, using a set of 'cuts' within a document. Cuts are V-stream addresses within a particular document. There can be three of four entries in the cut set. If three cuts are supplied, the two regions being transposed are from cut 1 to cut 2, and from cut 2 to cut 3, assuming cut 1 < cut 2 < cut 3. If four cuts are supplied, the regions are from cut 1 to cut 2, and from cut 3 to cut 4, again assuming cut 1 < cut 2 < cut 3 < cut 4.

Parameters:
sess  Input: User's session context
docisaptr  Input: Identifier of document
cutseqptr  Input: Sequence of cuts

Definition at line 169 of file do1.cxx.

References findorgl(), granf, rearrangepm(), typeorgl, and WRITEBERT.

Referenced by rearrange().

00170                                      : User's session context
00171     IStreamAddr *docisaptr, 
00172     typecutseq  *cutseqptr) 
00173 {
00174     // ORGL element on the Granfilade representing the particular document
00175     typeorgl docorgl;
00176 
00177     // Locate the document's ORGL within the Granfilade and
00178     // obtain a write lock on it.
00179     return findorgl(sess, granf, docisaptr, &docorgl, WRITEBERT)
00180 
00181     // Actually perform the rearrangement of text.
00182             && rearrangepm(sess, docisaptr, docorgl, cutseqptr);
00183 }

bool doretrievedocvspan Session sess,
IStreamAddr docisaptr,
typevspan vspanptr
 

Return the total span of text and links within a document.

Return a V-stream span representing the full size of both the text and link streams.

Parameters:
sess  Input: User's session context
docisaptr  Input: Identifier of document
vspanptr  Input: Span of V-stream to query for content

Definition at line 608 of file do1.cxx.

References findorgl(), granf, READBERT, retrievevspanpm(), typeorgl, and typevspan.

Referenced by findnextlinkvsa(), and retrievedocvspan().

00609                                      : User's session context
00610     IStreamAddr *docisaptr, 
00611     typevspan   *vspanptr)  
00612 {
00613     typeorgl docorgl;
00614 
00615     return findorgl(sess, granf, docisaptr, &docorgl, READBERT)
00616             && retrievevspanpm(sess, docorgl, vspanptr);
00617 }

bool doretrievedocvspanfoo Session sess,
IStreamAddr docisaptr,
typevspan vspanptr
[static]
 

Return the total span of the V-stream of a document.

Note: Internal routine, no open required.

Parameters:
sess  Input: User's session context
docisaptr  Input: Identifier of document
vspanptr  Output: Total span of V-stream within document

Definition at line 534 of file do1.cxx.

References findorgl(), granf, NOBERTREQUIRED, retrievedocumentpartofvspanpm(), typeorgl, and typevspan.

Referenced by docreatenewversion().

00535                                      : User's session context
00536     IStreamAddr *docisaptr, 
00537     typevspan   *vspanptr)  
00538 {
00539     typeorgl docorgl;
00540 
00541     return findorgl(sess, granf, docisaptr, &docorgl, NOBERTREQUIRED)
00542             && retrievedocumentpartofvspanpm(sess, docorgl, vspanptr);
00543 }

bool doretrievedocvspanset Session sess,
IStreamAddr docisaptr,
typevspanset vspansetptr
 

Return the total span of text and links within a document.

Return a set of V-stream spans, one representing the full size of the text stream, and one representing the full size of the link stream.

To-Fix: This function should not fail on an empty doc but instead return an empty result set. It also should return a set for each type of data, even when there are none of that type.

Parameters:
sess  Input: User's session context
docisaptr  Input: Identifier of document
vspansetptr  Input: Set of V-stream spans to query

Definition at line 630 of file do1.cxx.

References findorgl(), granf, isemptyorgl(), READBERT, retrievevspansetpm(), typeorgl, and typevspanset.

Referenced by retrievedocvspanset().

00631                                         : User's session context
00632     IStreamAddr  *docisaptr,   
00633     typevspanset *vspansetptr) 
00634 {
00635     typeorgl docorgl;
00636 
00637     if (findorgl(sess, granf, docisaptr, &docorgl, READBERT)) {
00638         if (!isemptyorgl(docorgl)) {
00639             if (retrievevspansetpm(sess, docorgl, vspansetptr)) {
00640                 return true;
00641             }
00642         }
00643     }
00644     return false;
00645 }

bool doretrieveendsets Session sess,
typespecset  specset,
typespecset fromsetptr,
typespecset tosetptr,
typespecset threesetptr
 

Return a list of all link end-sets in the specification set.

Parameters:
sess  Input: User's session context
specset  Input: Specification set
fromsetptr  Output: List of all From sets in specification
tosetptr  Output: List of all To sets in specification
threesetptr  Output: List of all Three sets in specifiations

Definition at line 737 of file do1.cxx.

References retrieveendsetsfromspanf(), and typespecset.

Referenced by retrieveendsets().

00738                                        : User's session context
00739     typespecset  specset,     
00740     typespecset *fromsetptr,  
00741     typespecset *tosetptr,    
00742     typespecset *threesetptr) 
00743 {
00744     return retrieveendsetsfromspanf(sess, specset, fromsetptr, tosetptr, threesetptr);
00745 }

bool doretrievev Session sess,
typespecset  specset,
typevstuffset vstuffsetptr
 

Return the text and links from set of places within a document.

Return actual content from a document.

Parameters:
sess  Input: User's session context
specset  Input: Set of specifications from which to obtain content
vstuffsetptr  Output: Set of content items queried

Definition at line 654 of file do1.cxx.

References granf, ispanset2vstuffset(), READBERT, specset2ispanset(), typeispanset, typespecset, and typevstuffset.

Referenced by assertspecisstring(), and retrievev().

00655                                           : User's session context
00656     typespecset    specset,      
00657     typevstuffset *vstuffsetptr) 
00658 {
00659     typeispanset ispanset;
00660 
00661     // Convert the specification set into a set of spans into the I-stream.
00662     return specset2ispanset(sess, specset, &ispanset, READBERT)
00663             && ispanset2vstuffset(sess, granf, ispanset, vstuffsetptr);
00664 }

bool doshowrelationof2versions Session sess,
typespecset  version1,
typespecset  version2,
typespanpairset relation
 

???

Return a list of ordered pairs of the spans of the two spec sets that correspond

Parameters:
sess  Input: User's session context
version1  Input: Specification of version 1 document
version2  Input: Specification of version 2 document
relation  Output: List of corresponding spans

Definition at line 754 of file do1.cxx.

References intersectspansets(), ISPANID, ispansetandspecsets2spanpairset(), NULL, READBERT, specset2ispanset(), typeispanset, typespanpairset, and typespecset.

Referenced by showrelationof2versions().

00755                                         : User's session context
00756     typespecset      version1, 
00757     typespecset      version2, 
00758     typespanpairset *relation) 
00759 {
00760     typeispanset version1ispans = NULL;
00761     typeispanset version2ispans = NULL;
00762     typeispanset commonispans   = NULL;
00763 
00764     // Convert the specification set into a set of spans into the I-stream.
00765     return specset2ispanset(sess, version1, &version1ispans, READBERT)
00766             && specset2ispanset(sess, version2, &version2ispans, READBERT)
00767             && intersectspansets(sess, version1ispans, version2ispans, &commonispans, ISPANID)
00768             && ispansetandspecsets2spanpairset(sess, commonispans, version1, version2, relation);
00769 }

void graphwholetree char *  filename,
typecorecrum ptr,
char *  graphlabel
 

???

(to be defined)

Definition at line 710 of file test.cxx.

References clear, findfather(), graphwholesubtree(), isfullcrum(), typecorecrum, and typedsp.

Referenced by docopy().

00714 {
00715     FILE *fd = fopen(filename, "w");
00716 
00717     fprintf(fd, "digraph G {\n");
00718     fprintf(fd, "    nodesep=0.40;\n");
00719     fprintf(fd, "    ranksep=\"0.40 equally\";\n");
00720     fprintf(fd, "    center=true;\n");
00721     fprintf(fd, "    page=\"8.5, 11\"; /* unit of pagination */\n");
00722     fprintf(fd, "    size=\"8.25, 10.75\";\n");
00723     fprintf(fd, "    /* ratio=auto; */\n");
00724     fprintf(fd, "    orientation=landscape;\n");
00725     fprintf(fd, "    label=\"%s\";\n", graphlabel);
00726     fprintf(fd, "    fontsize=14;\n");
00727     fprintf(fd, "    fontcolor=blue;\n");
00728     fprintf(fd, "\n");
00729     fprintf(fd, "    node [shape = record];\n");
00730     fprintf(fd, "\n");
00731 
00732     for (; !isfullcrum(ptr); ptr = (typecorecrum *) findfather(ptr))
00733         ;
00734 
00735     typedsp offset;
00736     clear(&offset, sizeof(offset));
00737 
00738     graphwholesubtree(fd, (typecuc *) ptr, &offset, "");
00739 
00740     fprintf(fd, "    A [width=0.1, height=0.1, style=invis];\n");
00741     fprintf(fd, "    B [width=0.1, height=0.1, style=invis];\n");
00742     fprintf(fd, "    C [width=0.1, height=0.1, style=invis];\n");
00743     fprintf(fd, "    A -> B [style=invis];\n");
00744     fprintf(fd, "    B -> C [style=invis];\n");
00745 
00746     fprintf(fd, "}\n");
00747     fclose(fd);
00748 }


Variable Documentation

Tumbler fivetumbler = { 0, 0, 0, 0, { 500 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }
 

Definition at line 115 of file do1.cxx.

typespec spec
 

Definition at line 113 of file do1.cxx.

typespec spec2
 

Definition at line 113 of file do1.cxx.

Referenced by makespanpairsforispan().

typespec spec3
 

Definition at line 113 of file do1.cxx.

typevstuffset uppervstuffset
 

Definition at line 114 of file do1.cxx.


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