|
From: <cre...@us...> - 2007-02-26 22:59:17
|
Revision: 1633
http://svn.sourceforge.net/frontierkernel/?rev=1633&view=rev
Author: creecode
Date: 2007-02-26 14:59:15 -0800 (Mon, 26 Feb 2007)
Log Message:
-----------
support for long odb item names and file paths
formatting tweaks
Modified Paths:
--------------
Frontier/branches/Frontier_Long_File_Paths/Common/headers/odbinternal.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/op.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/opinternal.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/ops.h
Frontier/branches/Frontier_Long_File_Paths/Common/source/OpenTransportNetEvents.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/odbengine.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/opbuttons.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/opedit.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/oplangtext.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/opops.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/oppopup.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/oprefcon.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/ops.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/odbinternal.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/odbinternal.h 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/odbinternal.h 2007-02-26 22:59:15 UTC (rev 1633)
@@ -178,23 +178,23 @@
extern pascal boolean odbCloseFile (odbref odb);
-extern pascal boolean odbDefined (odbref odb, bigstring bspath);
+extern pascal boolean odbDefined ( odbref, Handle );
-extern pascal boolean odbDelete (odbref odb, bigstring bspath);
+extern pascal boolean odbDelete ( odbref, Handle );
-extern pascal boolean odbGetType (odbref odb, bigstring bspath, OSType *type);
+extern pascal boolean odbGetType ( odbref, const Handle, OSType * );
-extern pascal boolean odbGetValue (odbref odb, bigstring bspath, odbValueRecord *value);
+extern pascal boolean odbGetValue ( odbref, const Handle, odbValueRecord * );
-extern pascal boolean odbSetValue (odbref odb, bigstring bspath, odbValueRecord *value);
+extern pascal boolean odbSetValue ( odbref, const Handle, odbValueRecord * );
-extern pascal boolean odbNewTable (odbref odb, bigstring bspath);
+extern pascal boolean odbNewTable ( odbref, const Handle );
-extern pascal boolean odbCountItems (odbref odb, bigstring bspath, long *count);
+extern pascal boolean odbCountItems ( odbref, const Handle, long * );
-extern pascal boolean odbGetNthItem (odbref odb, bigstring bspath, long n, bigstring bsname);
+extern pascal boolean odbGetNthItem ( odbref, const Handle, long, Handle );
-extern pascal boolean odbGetModDate (odbref odb, bigstring bspath, unsigned long *date);
+extern pascal boolean odbGetModDate ( odbref, const Handle, unsigned long * );
extern pascal void odbInitValue (odbValueRecord *value);
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/op.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/op.h 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/op.h 2007-02-26 22:59:15 UTC (rev 1633)
@@ -116,6 +116,7 @@
Handle hrefcon; /*for use by application, see opgetrefcon*/
Handle headstring; /*text of headline lives in its own block*/
+
} tyheadrecord;
@@ -186,7 +187,7 @@
typedef boolean (*opgetscrapcallback) (hdloutlinerecord *, boolean *);
-typedef boolean (*optextchangedcallback) (hdlheadrecord, bigstring);
+typedef boolean ( *optextchangedcallback ) ( hdlheadrecord, const Handle );
typedef boolean (*opcopyrefconcallback) (hdlheadrecord, hdlheadrecord);
@@ -595,8 +596,10 @@
extern boolean opoutlinetonewtextscrap (hdloutlinerecord, Handle *);
-extern boolean opsetrefcon (hdlheadrecord, ptrvoid, long); /*oprefcon.c*/
+#pragma mark === oprefcon.c ===
+extern boolean opsetrefcon (hdlheadrecord, ptrvoid, long);
+
extern boolean opgetrefcon (hdlheadrecord, ptrvoid, long);
extern void opemptyrefcon (hdlheadrecord);
@@ -607,11 +610,13 @@
boolean opattributesgetpackedtablevalue (hdlheadrecord hnode, tyvaluerecord *val); /*7.0b16 PBS*/
-boolean opattributesgetoneattribute (hdlheadrecord hnode, bigstring bsattname, tyvaluerecord *val); /*7.0b16 PBS*/
+boolean opattributesgetoneattribute ( hdlheadrecord, const Handle, tyvaluerecord *val ); /*7.0b16 PBS*/
-extern boolean opaddheadline (hdlheadrecord, tydirection, bigstring, hdlheadrecord *); /*opstructure.c*/
+#pragma mark === opstructure.c ===
+extern boolean opaddheadline ( hdlheadrecord, tydirection, bigstring, hdlheadrecord * );
+
extern boolean opdepositnewheadline (hdlheadrecord, tydirection, Handle, hdlheadrecord *);
extern boolean opmoveto (hdlheadrecord);
@@ -706,5 +711,3 @@
#endif
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/opinternal.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/opinternal.h 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/opinternal.h 2007-02-26 22:59:15 UTC (rev 1633)
@@ -161,8 +161,10 @@
extern void opactivate (boolean);
-extern tydirection opdowndir (void); /*opops.c*/
+#pragma mark === opops.c ===
+extern tydirection opdowndir (void);
+
extern tydirection opupdir (void);
extern boolean opfirstinlist (hdlheadrecord);
@@ -213,6 +215,8 @@
extern boolean opfindhead (hdlheadrecord, bigstring, hdlheadrecord *);
+extern boolean opFindHeadHandle ( hdlheadrecord, const Handle, hdlheadrecord * );
+
extern boolean opbestfind (hdlheadrecord hfirst, bigstring bs, hdlheadrecord *hnode);
extern long opcountatlevel (hdlheadrecord);
@@ -279,13 +283,17 @@
extern boolean opgetheadstring (hdlheadrecord, bigstring);
+extern boolean opGetHeadTextHandle ( hdlheadrecord, Handle * );
+
extern void opgetsortstring (hdlheadrecord, bigstring);
extern void opcopyformatting (hdloutlinerecord, hdloutlinerecord);
-extern boolean opsetprintinfo (void); /*opprint.c*/
+#pragma mark === opprint.c ===
+extern boolean opsetprintinfo (void);
+
extern void opgetprintrect (Rect *);
extern boolean opbeginprint (void);
@@ -295,8 +303,10 @@
extern boolean opprint (short);
-extern boolean opgetscrollbarinfo (boolean); /*opscrollbar.c*/
+#pragma mark === opscrollbar.c ===
+extern boolean opgetscrollbarinfo (boolean);
+
extern boolean opsetscrollpositiontoline1 (void);
extern boolean oprestorescrollposition (void);
@@ -357,11 +367,15 @@
extern boolean opcleartmpbits (void);
-extern void opdraggingmove (Point, hdlheadrecord); /*opdraggingmove.c*/
+#pragma mark === opdraggingmove.c ===
+extern void opdraggingmove (Point, hdlheadrecord);
-extern boolean opeditsetglobals (void); /*opedit.c*/
+#pragma mark === opedit.c ===
+
+extern boolean opeditsetglobals (void);
+
extern boolean opdefaultgetedittextrect (hdlheadrecord, const Rect *, Rect *);
extern boolean opdefaultsetwpedittext (hdlheadrecord);
@@ -392,6 +406,8 @@
extern void opeditgetseltext (bigstring);
+extern void opEditGetSelectedTextHandle ( Handle *h );
+
extern void opeditgetselrect (Rect *);
extern void opeditgetselpoint (Point *);
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/ops.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/ops.h 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/ops.h 2007-02-26 22:59:15 UTC (rev 1633)
@@ -110,4 +110,7 @@
extern void getsizestring (unsigned long, bigstring);
-extern unsigned long bcdtolong (unsigned long); /* 2004-11-16 creedon */
\ No newline at end of file
+extern unsigned long bcdtolong (unsigned long); // 2004-11-16 creedon
+
+extern void numberToTextHandle ( long, Handle * ); // 2006-12-08 creedon
+
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/OpenTransportNetEvents.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/OpenTransportNetEvents.c 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/OpenTransportNetEvents.c 2007-02-26 22:59:15 UTC (rev 1633)
@@ -334,24 +334,26 @@
*/
typedef struct tylistenrecord {
- EndpointRef ep;
- OTLink validationlink; /* Link into an OT FIFO (not atomic) */
- OTLIFO idleEPs; /* Endpoints ready to accept a new incoming connection */
- OTLIFO brokenEPs; /* Collect failed endpoints for recycling by worker thread */
- OTLIFO readyEPs; /* Ready to be picked up by the worker thread which will spawn a thread to call the daemon */
- OTLIFO waitingEPs; /* Endpoints waiting to complete an orderly disconnect */
- UInt8 stateflags;
+
+ EndpointRef ep;
+ OTLink validationlink; /* Link into an OT FIFO (not atomic) */
+ OTLIFO idleEPs; /* Endpoints ready to accept a new incoming connection */
+ OTLIFO brokenEPs; /* Collect failed endpoints for recycling by worker thread */
+ OTLIFO readyEPs; /* Ready to be picked up by the worker thread which will spawn a thread to call the daemon */
+ OTLIFO waitingEPs; /* Endpoints waiting to complete an orderly disconnect */
+ UInt8 stateflags;
OTConfigurationRef masterconfig;
EndpointRecordRef acceptors;
- long maxdepth;
- long refcon;
- long idthread;
+ long maxdepth;
+ long refcon;
+ long idthread;
hdldatabaserecord hdatabase;
- Handle hcallbacktree;
- tyepstatsrecord stats;
+ Handle hcallbacktree;
+ tyepstatsrecord stats;
tysocktypeid typeID;
- boolean fllistenpending;
- bigstring callback;
+ boolean fllistenpending;
+ Handle callback;
+
} tylistenrecord;
typedef struct tyendpointrecord {
@@ -2630,7 +2632,7 @@
if (err != kOTNoError) {
- langparamerror (cantencodeaddress, IPaddr);
+ langParamErrBs ( cantencodeaddress, IPaddr);
return (false);
}
@@ -2894,22 +2896,25 @@
} /*fwsNetEventMyAddress*/
-static boolean fwsgetcallbackcodetree (bigstring bs, Handle *htree) {
-
+static boolean fwsgetcallbackcodetree ( const Handle h, Handle *htree) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+
Handle htext;
boolean fl;
+ hdltreenode hmodule = nil;
unsigned long savelines;
unsigned short savechars;
- hdltreenode hmodule = nil;
- if (!newtexthandle (bs, &htext))
- return (false);
-
savelines = ctscanlines;
savechars = ctscanchars;
- fl = langcompiletext (htext, false, &hmodule); /*always disposes htext*/
+ copyhandle ( h, &htext );
+
+ fl = langcompiletext ( htext, false, &hmodule ); // always disposes htext
ctscanlines = savelines;
@@ -2918,12 +2923,13 @@
if (!fl)
return (false);
- fl = langpacktree ((**hmodule).param1, htree); /*make a copy of the sub-tree*/
+ fl = langpacktree ((**hmodule).param1, htree); // make a copy of the sub-tree
langdisposetree (hmodule);
return (fl);
- } /*fwsgetcallbackcodetree*/
+
+ } // fwsgetcallbackcodetree
static boolean fwsnewprocess (hdltreenode hcode, bigstring bsname, hdlprocessrecord *hprocess) {
@@ -2943,6 +2949,7 @@
disposehandle ((Handle) hp);
return (false);
+
}
if (!newclearhandle (sizeof (tytablestack), (Handle *) &htablestack)) {
@@ -2952,6 +2959,7 @@
disposehandle ((Handle) herrorstack);
return (false);
+
}
(**hp).hcode = hcode;
@@ -2977,21 +2985,28 @@
item.errorchar = 0;
item.errorrefcon = 0;
-
-#ifdef flnewfeatures
- item.profilebase = 0;
-#endif
+ #ifdef flnewfeatures
+
+ item.profilebase = 0;
+
+ #endif
+
(**herrorstack).stack [(**herrorstack).toperror++] = item;
copystring (bsname, (**hp).bsname);
return (true);
+
} /*newprocess*/
static boolean fwsruncallback (EndpointRecordRef epref) {
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+
hdltreenode hcallbackaddress;
hdltreenode hfunctioncall;
hdltreenode hcode;
@@ -3006,7 +3021,7 @@
Handle hcallbacktree = listenref->hcallbacktree;
bigstring bsname;
- copystring (listenref->callback, bsname);
+ texthandletostring ( listenref->callback, bsname );
//build code tree
@@ -3019,16 +3034,22 @@
setlongvalue ((long) epref, &val);
if (!newconstnode (val, &hparam1)) {
+
langdisposetree (hcallbackaddress);
+
return (false);
+
}
setlongvalue (refcon, &val);
if (!newconstnode (val, &hparam2)) {
+
langdisposetree (hcallbackaddress);
langdisposetree (hparam1);
+
return (false);
+
}
pushlastlink (hparam2, hparam1);
@@ -3042,18 +3063,26 @@
//create new process
if (!fwsnewprocess (hcode, bsname, &hprocess)) {
+
langdisposetree (hcode);
+
return (false);
+
}
//add new process
return (addprocess (hprocess));
- }/*fwsruncallback*/
+
+ } // fwsruncallback
static long fwsprocesspendingconnections (ListenRecordRef listenref) {
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+
OTLink* nomad = OTLIFOStealList (&listenref->readyEPs);
OTLink* next;
EndpointRecordRef epref;
@@ -3070,8 +3099,9 @@
epref->typeID = SOCKTYPE_OPEN;
- TCPprintf (wsprintf (TCPmsg, "In fwsacceptpendingconnections at line %d. Accepted new connection #%08ld on listener %08lx: %s (%08lx, %ld).",
- __LINE__, ct, (long) listenref, stringbaseaddress (listenref->callback), (long) epref, listenref->refcon));
+ TCPprintf ( wsprintf ( TCPmsg, "In fwsacceptpendingconnections at line %d. Accepted new connection #%08ld on listener %08lx: %s (%08lx, %ld).",
+ __LINE__, ct, ( long ) listenref, *listenref -> callback, ( long ) epref, listenref -> refcon ) );
+
TCPWRITEMSG();
fl = fwsruncallback (epref);
@@ -3081,10 +3111,12 @@
nomad = next;
ct++;
- }/*while*/
+ } /*while*/
+
return (ct);
- }/*fwsprocesspendingconnections*/
+
+ } /*fwsprocesspendingconnections*/
static void fwscleanuplistener (ListenRecordRef listenref) {
@@ -3234,47 +3266,54 @@
}/*fwslaunchacceptingthread*/
-boolean fwsNetEventListenStream (unsigned long port, long depth, bigstring pCallback, unsigned long refcon, unsigned long * stream, unsigned long ipaddr, long hdatabase) {
+boolean fwsNetEventListenStream ( unsigned long port, long depth, const Handle pCallback, unsigned long refcon,
+ unsigned long *stream, unsigned long ipaddr, long hdatabase ) {
- /* Set up a listner on a port */
-
+ //
+ // Set up a listner on a port
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+
+ EndpointRecordRef epref = nil;
Handle hcallbacktree = nil;
+ InetAddress ipAddress;
+ ListenRecordRef listenref = nil;
OSStatus err;
TBind bindReq;
- InetAddress ipAddress;
- ListenRecordRef listenref = nil;
- EndpointRecordRef epref = nil;
TOptMgmt optReq;
TOption opt;
long i;
- nullterminate (pCallback);
- TCPprintf(wsprintf(TCPmsg, "Entering fwsNetEventListenStream at line %d. Port = %ld, Depth = %ld, Refcon = %ld, Callback = %s.", __LINE__, port, depth, refcon, stringbaseaddress(pCallback)));
- TCPWRITEMSG ();
-
+ // nullterminate (pCallback);
+
+ TCPprintf ( wsprintf ( TCPmsg, "Entering fwsNetEventListenStream at line %d. Port = %ld, Depth = %ld, Refcon = %ld, Callback = %s.", __LINE__, port, depth, refcon, *pCallback ) );
+ TCPWRITEMSG ( );
+
/* Initialize Open Transport and static data structures */
if (!fwsNetEventLaunch (NO_HOST_SERVICES))
return (false);
-
+
/* Compile and pack a code tree for the address of the daemon script */
-
- if (!fwsgetcallbackcodetree (pCallback, &hcallbacktree))
- return (false);
+ if ( ! fwsgetcallbackcodetree ( pCallback, &hcallbacktree ) )
+ return ( false );
+
/* Allocate and clear memory for the listener */
listenref = (ListenRecordRef) NewPtr (sizeof (tylistenrecord));
-
+
if (listenref == nil) {
+
memoryerror ();
goto exit;
+
}
OTMemzero (listenref, sizeof (tylistenrecord));
- /* Initialize further status fields */
- copystring (pCallback, listenref->callback);
+ copyhandle ( pCallback, &listenref->callback ); // initialize further status fields
listenref->maxdepth = depth;
@@ -3286,25 +3325,30 @@
/* Open synchronous listener and set to blocking mode */
- #if TARGET_API_MAC_CARBON == 1
- listenref->ep = OTOpenEndpointInContext (OTCreateConfiguration ("tilisten,tcp"), nil, nil, &err, nil);
- #else
- listenref->ep = OTOpenEndpoint (OTCreateConfiguration ("tilisten,tcp"), nil, nil, &err);
- #endif
+ listenref->ep = OTOpenEndpointInContext (OTCreateConfiguration ("tilisten,tcp"), nil, nil, &err, nil);
if (kOTInvalidEndpointRef == listenref->ep || kOTNoError != err) {
+
neterror ("create listen stream", err);
+
goto exit;
+
}
err = OTSetBlocking (listenref->ep);
if (kOTNoError != err) {
+
OSStatus status;
- status = OTCloseProvider (listenref->ep);
+
+ status = OTCloseProvider (listenref->ep);
+
OTAssert ("fwsNetEventListenStream: Could not close listener", status == kOTNoError);
+
neterror ("set listen stream to blocking mode", err);
+
goto exit;
+
}
/* Option Management - Turn on ip_reuseaddr so we don't have port conflicts in general. */
@@ -3350,11 +3394,8 @@
}
/* Install a notifier for the listener and switch to async mode */
- #if TARGET_API_MAC_CARBON == 1
- err = OTInstallNotifier (listenref->ep, gListenNotifierUPP, (void *) listenref);
- #else
- err = OTInstallNotifier (listenref->ep, &ListenNotifier, (void *) listenref);
- #endif
+
+ err = OTInstallNotifier (listenref->ep, gListenNotifierUPP, (void *) listenref);
if (kOTNoError != err) {
OSStatus status;
@@ -3436,13 +3477,9 @@
return (true);
-exit:
-
- //disposehandle (hcallbacktree);
+ exit:
+ return (false);
- //neterror ("set up listen stream", err);
-
- return (false);
} /*fwsNetEventListenStream*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/odbengine.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/odbengine.c 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/odbengine.c 2007-02-26 22:59:15 UTC (rev 1633)
@@ -354,35 +354,39 @@
#else
- static boolean odbexpandtodotparams (bigstring bs, hdlhashtable *htable, bigstring bsname) {
+ static boolean odbexpandtodotparams ( const Handle h, hdlhashtable *htable, Handle handleName ) {
+
+ //
+ // the odbengine version of langexpandtodotparams gaurantees that
+ // htable will be non-nil. the frontier version doesn't. if we have
+ // just a name, we interpret it as a root-level item
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
- /*
- the odbengine version of langexpandtodotparams gaurantees that htable
- will be non-nil. the frontier version doesn't. if we have just a name,
- we interpret it as a root-level item
- */
-
boolean fl;
- disablelangerror ();
+ disablelangerror ( );
- fl = langexpandtodotparams (bs, htable, bsname);
+ fl = langexpandtodotparams ( h, htable, &handleName );
- enablelangerror ();
+ enablelangerror ( );
if (!fl) {
+
+ langparamerror ( addresscoerceerror, h );
- langparamerror (addresscoerceerror, bs);
+ return ( false );
- return (false);
}
+
+ if ( *htable == nil )
+ langsearchpathlookup ( handleName, htable ); // always sets htable
+
+ return ( true );
- if (*htable == nil)
- langsearchpathlookup (bsname, htable); /*always sets htable*/
+ } // odbexpandtodotparams
- return (true);
- } /*odbexpandtodotparams*/
-
#endif
@@ -631,112 +635,143 @@
} /*odbCloseFile*/
-pascal boolean odbDefined (odbref odb, bigstring bspath) {
+pascal boolean odbDefined ( odbref odb, const Handle handlePath ) {
- /*
- 4.1b5 dmb: new routine
- */
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 4.1b5 dmb: new routine
+ //
hdlhashtable htable;
- bigstring bsname;
+ Handle handleName;
boolean fl;
- setemptystring (bserror);
+ setemptystring ( bserror );
- setcancoonglobals ((hdlcancoonrecord) odb);
+ setcancoonglobals ( ( hdlcancoonrecord ) odb );
- disablelangerror ();
+ disablelangerror ( );
- fl = odbexpandtodotparams (bspath, &htable, bsname);
+ fl = odbexpandtodotparams ( handlePath, &htable, handleName );
- enablelangerror ();
+ enablelangerror ( );
- if (fl) {
+ if ( fl ) {
+
+ pushhashtable ( htable );
- pushhashtable (htable);
+ fl = hashsymbolexists ( handleName );
- fl = hashsymbolexists (bsname);
+ pophashtable ( );
- pophashtable ();
}
+
+ disposehandle ( handleName );
- return (fl);
- } /*odbDefined*/
+ return ( fl );
+
+ } // odbDefined
-pascal boolean odbDelete (odbref odb, bigstring bspath) {
+pascal boolean odbDelete (odbref odb, const Handle handlePath ) {
+ Handle handleName;
+ boolean fl;
hdlhashtable htable;
- bigstring bsname;
setemptystring (bserror);
setcancoonglobals ((hdlcancoonrecord) odb);
- if (!odbexpandtodotparams (bspath, &htable, bsname))
+ if (!odbexpandtodotparams (handlePath, &htable, handleName))
return (false);
+
+ fl = hashtabledelete ( htable, handleName );
- return (hashtabledelete (htable, bsname));
- } /*odbDelete*/
+ disposehandle ( handleName );
+
+ return ( fl );
+
+ } // odbDelete
-pascal boolean odbGetType (odbref odb, bigstring bspath, OSType *odbType) {
+pascal boolean odbGetType ( odbref odb, const Handle handlePath, OSType *odbType ) {
+ Handle handleName;
+ hdlhashnode hnode;
hdlhashtable htable;
- bigstring bsname;
tyvaluerecord val;
- hdlhashnode hnode;
setemptystring (bserror);
setcancoonglobals ((hdlcancoonrecord) odb);
- if (!odbexpandtodotparams (bspath, &htable, bsname))
- return (false);
+ if ( ! odbexpandtodotparams ( handlePath, &htable, handleName ) )
+ return ( false );
- if (!langsymbolreference (htable, bsname, &val, &hnode))
- return (false);
+ if ( ! langsymbolreference ( htable, handleName, &val, &hnode ) ) {
- if (val.valuetype == binaryvaluetype)
- *odbType = getbinarytypeid (val.data.binaryvalue);
+ disposehandle ( handleName );
+
+ return ( false );
+
+ }
+
+ disposehandle ( handleName );
+
+ if ( val.valuetype == binaryvaluetype )
+ *odbType = getbinarytypeid ( val.data.binaryvalue );
else
- *odbType = langexternalgettypeid (val);
+ *odbType = langexternalgettypeid ( val );
- return (true);
- } /*odbGetType*/
+ return ( true );
+
+ } // odbGetType
-pascal boolean odbGetValue (odbref odb, bigstring bspath, odbValueRecord *value) {
+pascal boolean odbGetValue ( odbref odb, const Handle handlePath, odbValueRecord *value ) {
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+
+ Handle handleName;
+ hdlhashnode hnode;
hdlhashtable htable;
- bigstring bsname;
tyvaluerecord val;
- hdlhashnode hnode;
setemptystring (bserror);
setcancoonglobals ((hdlcancoonrecord) odb);
- if (!odbexpandtodotparams (bspath, &htable, bsname))
+ if ( ! odbexpandtodotparams ( handlePath, &htable, handleName ) )
return (false);
+
+ if ( ! langsymbolreference ( htable, handleName, &val, &hnode ) ) {
- if (!langsymbolreference (htable, bsname, &val, &hnode))
- return (false);
-
- #ifndef isFrontier
-
- if (val.valuetype == externalvaluetype) {
+ disposehandle ( handleName );
- langerrormessage (canthandlethistypeerror);
+ return ( false );
- return (false);
}
+
+ disposehandle ( handleName );
+ #ifndef isFrontier
+
+ if (val.valuetype == externalvaluetype) {
+
+ langerrormessage (canthandlethistypeerror);
+
+ return (false);
+
+ }
#endif
if (!copyvaluerecord (val, &val))
return (false);
-
+
if (!copyvaluedata (&val))
return (false);
@@ -752,13 +787,18 @@
(*value).data.binaryvalue = val.data.binaryvalue; /*largest field covers everything*/
return (true);
+
} /*odbGetValue*/
-pascal boolean odbSetValue (odbref odb, bigstring bspath, odbValueRecord *value) {
+pascal boolean odbSetValue ( odbref odb, const Handle handlePath, odbValueRecord *value ) {
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+
hdlhashtable htable;
- bigstring bsname;
+ Handle handleName;
tyvaluerecord val;
tyvaluetype type = langexternalgetvaluetype (value->valuetype);
@@ -777,7 +817,7 @@
setcancoonglobals ((hdlcancoonrecord) odb);
- if (!odbexpandtodotparams (bspath, &htable, bsname))
+ if (!odbexpandtodotparams (handlePath, &htable, handleName))
return (false);
if (type == (tyvaluetype) -1) {
@@ -794,110 +834,146 @@
if (!copyvaluerecord (val, &val))
return (false);
+
+ if ( ! hashtableassign ( htable, handleName, val ) ) {
- if (!hashtableassign (htable, bsname, val)) {
-
+ disposehandle ( handleName );
+
disposevaluerecord (val, true);
return (false);
+
}
+ disposehandle ( handleName );
+
exemptfromtmpstack (&val);
return (true);
- } /*odbSetValue*/
+
+ } // odbSetValue
-pascal boolean odbNewTable (odbref odb, bigstring bspath) {
+pascal boolean odbNewTable (odbref odb, const Handle handlePath ) {
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+
+ Handle handleName;
hdlhashtable htable;
- bigstring bsname;
tyvaluerecord val;
setemptystring (bserror);
setcancoonglobals ((hdlcancoonrecord) odb);
- if (!odbexpandtodotparams (bspath, &htable, bsname))
+ if (!odbexpandtodotparams (handlePath, &htable, handleName))
return (false);
-
+
if (!langexternalnewvalue (idtableprocessor, nil, &val))
return (false);
+
+ if ( ! hashtableassign ( htable, handleName, val ) ) {
- if (!hashtableassign (htable, bsname, val)) {
-
+ disposehandle ( handleName );
+
disposevaluerecord (val, true);
return (false);
+
}
+
+ disposehandle ( handleName );
exemptfromtmpstack (&val);
return (true);
+
} /*odbNewTable*/
-pascal boolean odbCountItems (odbref odb, bigstring bspath, long *count) {
+pascal boolean odbCountItems (odbref odb, const Handle handlePath, long *count) {
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+
+ Handle handleName;
+ hdlhashnode hnode;
hdlhashtable htable;
- bigstring bsname;
+ long ctitems;
tyvaluerecord val;
- long ctitems;
- hdlhashnode hnode;
setemptystring (bserror);
setcancoonglobals ((hdlcancoonrecord) odb);
- if (!odbexpandtodotparams (bspath, &htable, bsname))
+ if (!odbexpandtodotparams (handlePath, &htable, handleName))
return (false);
+
+ if (!langsymbolreference (htable, handleName, &val, &hnode)) {
- if (!langsymbolreference (htable, bsname, &val, &hnode))
+ disposehandle ( handleName );
+
return (false);
+
+ }
+
+ disposehandle ( handleName );
if (!odbvaltotable (val, &htable, hnode))
return (false);
-
+
if (!hashcountitems (htable, &ctitems))
return (false);
-
+
*count = ctitems;
return (true);
+
} /*odbCountItems*/
-pascal boolean odbGetNthItem (odbref odb, bigstring bspath, long n, bigstring bsname) {
+pascal boolean odbGetNthItem (odbref odb, const Handle handlePath, long n, Handle handleName) {
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+
+ hdlhashnode hnode;
hdlhashtable htable;
tyvaluerecord val;
- hdlhashnode hnode;
setemptystring (bserror);
setcancoonglobals ((hdlcancoonrecord) odb);
- if (!odbexpandtodotparams (bspath, &htable, bsname))
+ if (!odbexpandtodotparams (handlePath, &htable, handleName))
return (false);
-
- if (!langsymbolreference (htable, bsname, &val, &hnode))
+
+ if (!langsymbolreference (htable, handleName, &val, &hnode))
return (false);
-
+
if (!odbvaltotable (val, &htable, hnode))
return (false);
-
- if (!hashgetiteminfo (htable, (short) (n - 1), bsname, nil))
+
+ if (!hashgetiteminfo (htable, (short) (n - 1), &handleName, nil))
return (false);
+
+ return (true);
- return (true);
} /*odbGetNthItem*/
+pascal boolean odbGetModDate (odbref odb, const Handle handlePath, unsigned long *date) {
-pascal boolean odbGetModDate (odbref odb, bigstring bspath, unsigned long *date) {
-
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+
hdlhashtable htable;
- bigstring bsname;
+ Handle handleName;
tyvaluerecord val;
hdlhashnode hnode;
@@ -905,18 +981,26 @@
setcancoonglobals ((hdlcancoonrecord) odb);
- if (!odbexpandtodotparams (bspath, &htable, bsname))
+ if (!odbexpandtodotparams (handlePath, &htable, handleName))
return (false);
+
+ if (!langsymbolreference (htable, handleName, &val, &hnode)) {
- if (!langsymbolreference (htable, bsname, &val, &hnode))
+ disposehandle ( handleName );
+
return (false);
+
+ }
+
+ disposehandle ( handleName );
if (!odbvaltotable (val, &htable, hnode))
return (false);
-
+
*date = (**htable).timelastsave;
return (true);
+
} /*odbGetModDate*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/opbuttons.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/opbuttons.c 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/opbuttons.c 2007-02-26 22:59:15 UTC (rev 1633)
@@ -42,10 +42,12 @@
void opbuttonsattach (hdlwindowinfo hinfo, hdlhashtable htable) {
- /*
- 7.1b18 PBS: attach buttons to this outline.
- */
-
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.1b18 PBS: attach buttons to this outline.
+ //
+
hdlhashnode hn;
short ct = 0;
hdllistrecord hlist;
@@ -61,7 +63,8 @@
/*loop through all of the items in the table*/
for (hn = (**htable).hfirstsort; hn != nil; hn = (**hn).sortedlink) {
-
+
+ Handle h;
bigstring bsname;
ct++;
@@ -69,8 +72,12 @@
if (ct > 16) /*16 is max number of buttons*/
break;
- gethashkey (hn, bsname);
+ gethashkey (hn, &h );
+ texthandletostring ( h, bsname );
+
+ disposehandle ( h );
+
xmlgetname (bsname);
oppushstring ((hdllistrecord) (**hinfo).buttonlist, nil, bsname);
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/opedit.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/opedit.c 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/opedit.c 2007-02-26 22:59:15 UTC (rev 1633)
@@ -42,12 +42,9 @@
#include "wpengine.h"
-
-
static boolean fleditingnow = false;
-
boolean opeditsetglobals (void) {
/*
@@ -108,19 +105,21 @@
boolean opdefaultsetwpedittext (hdlheadrecord hnode) {
-
+
/*
2/7/97 dmb: we are called with the wp globals set up.
our job it to set the wp to contain the right text.
*/
return (wpsettexthandle ((**hnode).headstring));
+
} /*opdefaultsetwpedittext*/
boolean opdefaultgetwpedittext (hdlheadrecord hnode, boolean flunload) {
-#pragma unused (flunload)
+ #pragma unused (flunload)
+
/*
2/7/97 dmb: we are called with the wp globals set up.
our job it to extract the current text from the wp.
@@ -634,6 +633,7 @@
popstyle ();
return (true);
+
} /*opeditdrawtext*/
@@ -642,6 +642,7 @@
opeditsetglobals ();
wpgetmaxpos (maxpos);
+
} /*opeditgetmaxpos*/
@@ -685,6 +686,19 @@
} /*opeditgetseltext*/
+void opEditGetSelectedTextHandle ( Handle *h ) {
+
+ //
+ // 2007-02-26 creedon: created
+ //
+
+ opeditsetglobals ( );
+
+ wpgetseltexthandle ( h );
+
+ } // opEditGetSelectedTextHandle
+
+
void opeditgetselrect (Rect * r) {
opeditsetglobals ();
@@ -1018,5 +1032,3 @@
return (true);
} /*opeditsetundoglobals*/
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/oplangtext.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/oplangtext.c 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/oplangtext.c 2007-02-26 22:59:15 UTC (rev 1633)
@@ -116,50 +116,54 @@
static boolean oplangtextvisit (hdlheadrecord hnode, ptrvoid refcon) {
- /*
- push the text of the indicated node onto the langtext output handle.
+ //
+ // push the text of the indicated node onto the langtext output handle.
+ //
+ // we flatten out the structure in the language understood by the parser.
+ //
+ // e.g. if we move in a level, we insert a left curly bracket. out a level
+ // a right curly bracket.
+ //
+ // carriage returns are inserted into the text so that the parser knows
+ // which line generated the code, this makes error reporting and
+ // debugging possible.
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 2006-01-23 smd: lots of changes when flmakepretty is true, to fix
+ // problems with round trip between script outline and
+ // text. This function is in desperate need of a rewrite,
+ // but it seems to work now for every test case I could
+ // come up with.
+ //
+ // 6.0a13 dmb: rewrote to use handles, handlestreams
+ //
+ // 5.0a16 dmb: don't require else to be on a line by itself
+ //
+ // 2.1b2 dmb: don't add returns until after continuation lines are complete
+ //
+ // 1993-05-06 dmb: test for "else" is now case-insensitive
+ //
+ // 1991-12-13 dmb: added support for flmakeitpretty so that langtext can be
+ // exported in a useful form
+ //
+ // 1991-12-09 dmb: support backslash for continuation lines. also, need to
+ // look ahead for non-comment lines in order to place
+ // opening '{' at end of correct line; otherwise, debugger
+ // can step onto a comment line
+ //
+ // 1991-11-12 dmb: push '{' when actually entering deeper level rather than
+ // when subheads are present, so single comment subhead is
+ // handled correctly. also, don't push a semicolon before
+ // an empty statement; otherwise, blank lines in a locals
+ // block (and perhaps elsewhere) generate syntax errors.
+ //
- we flatten out the structure in the language understood by the parser.
-
- e.g. if we move in a level, we insert a left curly bracket. out a level
- a right curly bracket.
-
- carriage returns are inserted into the text so that the parser knows
- which line generated the code, this makes error reporting and
- debugging possible.
-
- 11/12/91 dmb: push '{' when actually entering deeper level rather than
- when subheads are present, so single comment subhead is handled correctly.
- also, don't push a semicolon before an empty statement; otherwise, blank
- lines in a locals block (and perhaps elsewhere) generate syntax errors.
-
- 12/9/91 dmb: support backslash for continuation lines. also, need to look
- ahead for non-comment lines in order to place opening '{' at end of correct
- line; otherwise, debugger can step onto a comment line
-
- 12/13/91 dmb: added support for flmakeitpretty so that langtext can be
- exported in a useful form
-
- 5/6/93 dmb: test for "else" is now case-insensitive
-
- 2.1b2 dmb: don't add returns until after continuation lines are complete
-
- 5.0a16 dmb: don't require else to be on a line by itself
-
- 6.0a13 dmb: rewrote to use handles, handlestreams
-
- 2006-01-23 smd: lots of changes when flmakepretty is true,
- to fix problems with round trip between script outline and text.
- This function is in desperate need of a rewrite, but it seem to work now
- for every test case I could come up with.
- */
-
hdlheadrecord h = hnode;
handlestream *langtext = (handlestream *) refcon;
short level;
bigstring bs;
- Handle bshead;
- Handle bscomment = nil;
+ Handle handleComment = nil, handleHead;
boolean fltobecontinued = false;
boolean flcomment;
boolean flparentwascomment = false;
@@ -175,16 +179,16 @@
if (flcomment) { /*just generate a blank line for a comment line*/
- bshead = nil;
+ handleHead = nil;
if (flmakeitpretty) {
- if (!copyhandle ((**h).headstring, &bscomment))
+ if (!copyhandle ((**h).headstring, &handleComment))
goto exit;
ch = chcomment;
- if (!insertinhandle (bscomment, 0, &ch, 1L))
+ if (!insertinhandle (handleComment, 0, &ch, 1L))
goto exit;
}
@@ -215,35 +219,35 @@
}
else {
- if (!copyhandle ((**h).headstring, &bshead))
+ if (!copyhandle ((**h).headstring, &handleHead))
goto exit;
- fltobecontinued = backslashdelete (bshead); /*pop off continuation marker*/
+ fltobecontinued = backslashdelete (handleHead); /*pop off continuation marker*/
}
- len1 = gethandlesize (bshead); /*get size with comments*/
+ len1 = gethandlesize (handleHead); /*get size with comments*/
if (len1 > 0) {
- len2 = langcommentdelete (chcomment, (byte *) (*bshead), len1);
+ len2 = langcommentdelete (chcomment, (byte *) (*handleHead), len1);
if (len2 >= 0) { /* line is partly a comment */
if (flmakeitpretty) { /*for exporting, we want to *add* comment character*/
- if (!loadhandleremains (len2, bshead, &bscomment))
+ if (!loadhandleremains (len2, handleHead, &handleComment))
goto exit;
- if ((gethandlesize (bscomment) > 0) && (len2 > 0))
- insertinhandle (bscomment, 0, " ", 1L);
+ if ((gethandlesize (handleComment) > 0) && (len2 > 0))
+ insertinhandle (handleComment, 0, " ", 1L);
}
- sethandlesize (bshead, len2);
+ sethandlesize (handleHead, len2);
}
}
- if (!fltobecontinued && bshead)
- poptrailingwhitespacehandle (bshead); /*pop blanks, returns, tabs, etc at end of string*/
+ if (!fltobecontinued && handleHead)
+ poptrailingwhitespacehandle (handleHead); /*pop blanks, returns, tabs, etc at end of string*/
if (ctlinesincontinuation == 0) { /*not continuing a previous line*/
@@ -260,8 +264,8 @@
if ((level < langtextlastlevel) || !fllastwascomment) {
- if (bshead)
- textfirstword ((ptrbyte) (*bshead), gethandlesize (bshead), chspace, bsfirst);
+ if (handleHead)
+ textfirstword ((ptrbyte) (*handleHead), gethandlesize (handleHead), chspace, bsfirst);
else
setemptystring (bsfirst);
@@ -279,7 +283,7 @@
langtextlastlevel = level;
}
- fllastwascomment = flcomment || isemptyhandle (bshead);
+ fllastwascomment = flcomment || isemptyhandle (handleHead);
L2:
@@ -290,7 +294,7 @@
disposehandle (*plastcomment);
- *plastcomment = bscomment;
+ *plastcomment = handleComment;
}
@@ -316,7 +320,7 @@
}
else if (flmakeitpretty && flcomment) {
- if (!inserttextinhandle (bscomment, 0L, bs))
+ if (!inserttextinhandle (handleComment, 0L, bs))
goto exit;
}
@@ -334,18 +338,18 @@
if (! *plastcomment)
- *plastcomment = bscomment;
+ *plastcomment = handleComment;
else {
- if (!pushhandle (bscomment, *plastcomment))
+ if (!pushhandle (handleComment, *plastcomment))
goto exit;
}
}
else {
- if (!writehandlestreamhandle (langtext, bshead))
+ if (!writehandlestreamhandle (langtext, handleHead))
goto exit;
}
@@ -364,15 +368,18 @@
}
ctlinesincontinuation = 0;
+
}
}
fl = true; //natural exit
- exit:
- disposehandle (bshead);
-
- return (fl);
+ exit:
+
+ disposehandle (handleHead);
+
+ return (fl);
+
} /*oplangtextvisit*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/opops.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/opops.c 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/opops.c 2007-02-26 22:59:15 UTC (rev 1633)
@@ -43,7 +43,6 @@
#include "process.h"
-
typedef struct tyscanrecord { /*information for contains/find/search recursive scans*/
hdlheadrecord hnodelookfor;
@@ -66,7 +65,7 @@
hdloutlinerecord opsetoutline (hdloutlinerecord houtline) {
-
+
/*
5.1.5b7 dmb: carefully manage the setting of outlinedata
@@ -90,9 +89,10 @@
}
return (houtline);
+
} /*opsetoutline*/
-
+
boolean oppushoutline (hdloutlinerecord houtline) {
/*
@@ -893,8 +893,8 @@
nomad = nextnomad;
} /*while*/
} /*opfindhead*/
-
+
boolean opbestfind (hdlheadrecord hfirst, bigstring bs, hdlheadrecord *hnode) {
/*
@@ -1146,12 +1146,13 @@
boolean opnewheadrecord (Handle hstring, hdlheadrecord *hnewnode) {
-
+
/*
create a new headline, without linking into any structure.
*/
register hdlheadrecord h;
+
Handle hnew;
if (!newclearhandle (sizeof (tyheadrecord), &hnew)) {
@@ -1159,6 +1160,7 @@
disposehandle (hstring);
return (false);
+
}
h = *hnewnode = (hdlheadrecord) hnew; /*copy into register*/
@@ -1172,6 +1174,7 @@
(**h).fldirty = true;
return (true);
+
} /*opnewheadrecord*/
@@ -1197,10 +1200,11 @@
boolean opreleasevisit (hdlheadrecord hnode, ptrvoid refcon) {
-
+
register hdlheadrecord h = hnode;
- Handle hrefcon = (Handle) (**h).hrefcon;
+ Handle hrefcon = ( Handle ) ( **h ).hrefcon;
+
if (hrefcon != nil) { /*node has a refcon handle attached*/
hdloutlinerecord x = outlinedata; /*preserve x over callback*/
@@ -1210,23 +1214,25 @@
(*(**outlinedata).releaserefconcallback) (hnode, (boolean) ((long) refcon));
#endif
-
+
opsetoutline (x); /*restore*/
- disposehandle (hrefcon);
+ disposehandle ( hrefcon );
+
}
+
+ disposehandle ( ( **h ).headstring );
+ disposehandle ( (Handle ) h );
- disposehandle ((**h).headstring);
+ return (true);
- disposehandle ((Handle) h);
-
- return (true);
} /*opreleasevisit*/
void opreleasenode (hdlheadrecord hnode, boolean fldisk) {
opreleasevisit (hnode, (ptrvoid) ((long) fldisk));
+
} /*opreleasenode*/
@@ -1314,6 +1320,7 @@
return (false);
return (opsetsummit (outlinedata, hnewsummit));
+
} /*opnewsummit*/
@@ -1460,6 +1467,7 @@
#endif
return (true);
+
} /*opnewrecord*/
@@ -1477,6 +1485,7 @@
*/
opsiblingvisiter (hnode, true, &opreleasevisit, (ptrvoid) ((long) fldisk));
+
} /*opdisposestructure*/
@@ -1493,35 +1502,37 @@
oprestorehoists ();
oppopoutline ();
+
} /*opdisposerefcons*/
void opdisposeoutline (hdloutlinerecord houtline, boolean fldisk) {
-
+
/*
5.0a10 dmb: if we're disposing outlinedata, nil the global
5.1.5b7 dmb: ctpushes, fldisposewhenpopped replaces processinvalidoutline
*/
-
+
register hdloutlinerecord ho = houtline;
//long ix;
if (ho == nil) /*defensive driving*/
return;
-
+
//processinvalidoutline (ho);
if ((**ho).ctpushes > 0) {
-
+
if (fldisk)
opdisposerefcons (ho); //do this in current odb context
-
+
(**ho).fldisposewhenpopped = true;
return;
+
}
-
+
(**ho).fldisposewhenpopped = false;
oppushoutline (ho); /*set the current outline to this one*/
@@ -1532,18 +1543,18 @@
if ((**ho).hbuffer != nil) /*avoid smashing wp globals*/
opeditdispose ();
+
+ #endif
- #endif
-
opdisposestructure ((**ho).hsummit, fldisk);
oppopoutline ();
-
+
disposehandle ((Handle) ho);
-
+
if (ho == outlinedata)
outlinedata = nil;
-
+
} /*opdisposeoutline*/
@@ -1666,43 +1677,47 @@
boolean opsetactualheadstring (hdlheadrecord hnode, bigstring newstring) {
return (sethandlecontents (stringbaseaddress (newstring), stringlength (newstring), (**hnode).headstring));
+
} /*opsetactualheadstring*/
-boolean opsetheadtext (hdlheadrecord hnode, Handle hstring) {
+boolean opsetheadtext ( hdlheadrecord hnode, Handle hstring ) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 5.0d14 dmb: do as little as possible when the head string isn't
+ // changing.
+ //
+ // 1993-08-15 DW: leave the tmp bit set over call to callback, so that the
+ // browser can avoid re-inserting the node, again for find &
+ // replace. we don't keep the lists sorted, to make things
+ // fast, avoid jumpiness, and also to keep the search order
+ // intact (!).
+ //
+ // 1993-08-14 DW: if the node's tmpbit is set, we display the line before
+ // calling the callback. in clay basket the callback can
+ // reorder the outline. too much for a human mind to parse
+ // while doing a find/replace.
+ //
+ // 1992-04-03 dmb: moved call to textchangedcallback into this bottleneck
+ // so that find/replace and op.setlinetext will update
+ // menubar items properly. call used to be in
+ // opwriteeditbuffer
+ //
- /*
- 4/3/92 dmb: moved call to textchangedcallback into this bottleneck so
- that find/replace and op.setlinetext will update menubar items properly.
- call used to be in opwriteeditbuffer
+ register hdlheadrecord h = hnode;
- 8/14/93 DW: if the node's tmpbit is set, we display the line before
- calling the callback. in clay basket the callback can reorder the
- outline. too much for a human mind to parse while doing a find/replace.
-
- 8/15/93 DW: leave the tmp bit set over call to callback, so that
- the browser can avoid re-inserting the node, again for find & replace.
- we don't keep the lists sorted, to make things fast, avoid jumpiness,
- and also to keep the search order intact (!).
-
- 5.0d14 dmb: do as little as possible when the head string isn't changing.
- */
-
- register hdlheadrecord h = hnode;
Handle horig;
- bigstring bsorig;
- opgetheadstring (hnode, bsorig);
-
horig = (**hnode).headstring;
(**hnode).headstring = hstring;
if (equalhandles (horig, hstring))
disposehandle (horig);
+ else {
- else {
-
opnodechanged (h);
(**h).fldirty = true;
@@ -1714,24 +1729,27 @@
opinvalnode (h);
opupdatenow ();
+
}
+
+ if ( ! ( *( **outlinedata ).textchangedcallback ) ( h, horig ) ) {
- if (!(*(**outlinedata).textchangedcallback) (h, bsorig)) {
-
/*DW 8/31/93 -- file rename in cb failed*/
(**hnode).headstring = horig;
disposehandle (hstring);
+
}
else
disposehandle (horig);
}
- (**h).tmpbit = false; /*consume the bit*/
+ (**h).tmpbit = false; // consume the bit
return (true);
- } /*opsetheadtext*/
+
+ } // opsetheadtext
boolean opsetheadstring (hdlheadrecord hnode, bigstring bs) {
@@ -1767,27 +1785,47 @@
opupdatenow ();
}
- return (fl);
+ return (fl);
+
} /*opsetcursorlinetext*/
boolean opgetheadstring (hdlheadrecord hnode, bigstring bs) {
-
+
if (hnode == nil)
setstringlength (bs, 0);
else
texthandletostring ((**hnode).headstring, bs);
return (true);
+
} /*opgetheadstring*/
+boolean opGetHeadTextHandle ( hdlheadrecord hnode, Handle *h ) {
+
+ //
+ // 2007-02-26 creedon: created
+ //
+
+ if ( ! newemptyhandle ( h ) )
+ return ( false );
+
+ if ( hnode != nil )
+ copyhandle ( ( Handle ) ( **hnode ).headstring, h );
+
+ return ( true );
+
+ } // opGetHeadTextHandle
+
+
void opgetsortstring (hdlheadrecord hnode, bigstring bs) {
opgetheadstring (hnode, bs);
if (searchparams.flunicase)
- alllower (bs);
+ alllower (bs);
+
} /*opgetsortstring*/
@@ -1813,7 +1851,52 @@
(**ho2).outlinerect = (**ho1).outlinerect;
(**ho2).windowrect = (**ho1).windowrect;
+
} /*opcopyformatting*/
+boolean opFindHeadHandle ( hdlheadrecord hfirst, const Handle h, hdlheadrecord *hnode ) {
+ //
+ // search starting with hfirst and step through its siblings looking for a
+ // headline that exactly matches h.
+ //
+ // 2007-02-26 creedon: created, cribbed from opfindhead function
+ //
+
+ register hdlheadrecord nextnomad, nomad;
+ Handle handleLook, handleNomad;
+
+ *hnode = NULL; // default returned value
+
+ nomad = hfirst;
+
+ copyhandle ( h, &handleLook ); // work on a copy
+
+ lowertext ( *handleLook, gethandlesize ( handleLook ) ); // unicase
+
+ while ( true ) {
+
+ opGetHeadTextHandle ( nomad, &handleNomad );
+
+ lowertext ( *handleNomad, gethandlesize ( handleNomad ) );
+
+ if ( equalhandles ( handleLook, handleNomad ) ) {
+
+ *hnode = nomad;
+
+ return ( true );
+
+ }
+
+ nextnomad = ( **nomad ).headlinkdown;
+
+ if ( nextnomad == nomad )
+ return ( false );
+
+ nomad = nextnomad;
+
+ } // while
+
+ } // opFindHeadHandle
+
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/oppopup.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/oppopup.c 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/oppopup.c 2007-02-26 22:59:15 UTC (rev 1633)
@@ -298,19 +298,20 @@
static boolean opfillpopup (hdlmenu hmenu, short *checkeditem) {
- /*
- 7.1b43 PBS: make sure the menu object is in memory, so the
- app doesn't crash.
- */
-
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.1b43 PBS: make sure the menu object is in memory, so the app doesn't
+ // crash.
+ //
+
hdlhashtable htable;
hdlhashnode hnode;
- tyvaluerecord valaddress;
- tyvaluerecord val;
+ tyvaluerecord val, valaddress;
hdlmenurecord hm;
hdlexternalhandle h;
hdlheadrecord hsummit;
- bigstring bsaddress;
+ Handle handleAddress;
boolean fl = false;
long menusize = 0;
@@ -320,10 +321,10 @@
if (valaddress.valuetype != addressvaluetype)
goto exit;
- if (!getaddressvalue (valaddress, &htable, bsaddress))
+ if ( ! getaddressvalue ( valaddress, &htable, &handleAddress ) )
goto exit;
- if (!langsymbolreference (htable, bsaddress, &val, &hnode))
+ if ( ! langsymbolreference (htable, handleAddress, &val, &hnode ) )
goto exit;
if ((val.valuetype) != externalvaluetype)
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/oprefcon.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/oprefcon.c 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/oprefcon.c 2007-02-26 22:59:15 UTC (rev 1633)
@@ -137,30 +137,28 @@
} /*ophasrefcon*/
-boolean opattributesgetoneattribute (hdlheadrecord hnode, bigstring bsattname, tyvaluerecord *val) {
+boolean opattributesgetoneattribute ( hdlheadrecord hnode, const Handle handleAttributeName, tyvaluerecord *val) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b16 PBS: get one value from a packed attributes table.
+ //
- /*
- 7.0b16 PBS: get one value from a packed attributes table.
- */
-
- tyvaluerecord vattributes;
- tyvaluerecord v;
+ boolean fl = false;
+ hdlhashnode hn = nil, hnatt;
hdlhashtable htable;
- hdlhashnode hn = nil;
- hdlhashnode hnatt;
- boolean fl = false;
+ tyvaluerecord v, vattributes;
disablelangerror ();
if (!opattributesgetpackedtablevalue (hnode, &vattributes))
-
return (false);
if (!tablevaltotable (vattributes, &htable, hn))
-
goto exit;
- if (hashtablelookup (htable, bsattname, &v, &hnatt)) {
+ if (hashtablelookup (htable, handleAttributeName, &v, &hnatt)) {
copyvaluerecord (v, val);
@@ -169,15 +167,17 @@
exemptfromtmpstack (val);
fl = true;
+
} /*if*/
exit:
- disposevaluerecord (vattributes, false);
-
- enablelangerror ();
-
- return (fl);
+ disposevaluerecord (vattributes, false);
+
+ enablelangerror ();
+
+ return (fl);
+
} /*opattributesgetoneattribute*/
@@ -232,71 +232,71 @@
boolean opattributesgettypestring (hdlheadrecord hnode, bigstring bstype) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b14 PBS: Fixed memory leaks.
+ //
+ // 7.0b4 PBS: Get the node type of a headline. Unpack the refcon, look in
+ // the table for a type attribute, set bstype equal to that
+ // string.
+ //
- /*
- 7.0b4 PBS: Get the node type of a headline.
- Unpack the refcon, look in the table for a type attribute, set bstype
- equal to that string.
-
- 7.0b14 PBS: Fixed memory leaks.
- */
-
- Handle hrefcon = (**hnode).hrefcon;
+ Handle handleType, hrefcon = (**hnode).hrefcon;
tyvaluerecord linkedval;
tyvaluerecord val;
hdlhashtable htable;
- hdlhashnode hn = nil;
- hdlhashnode hnheadlinetype;
+ hdlhashnode hn = nil, hnheadlinetype;
tyvaluerecord valheadlinetype;
boolean fl = false;
disablelangerror ();
if (!ophasrefcon (hnode)) //if no refcon, not attributes
-
goto exit3;
if (!langunpackvalue (hrefcon, &linkedval)) //try to unpack the refcon
-
goto exit3;
if (linkedval.valuetype != binaryvaluetype) //must be a binary
-
goto exit2;
if (!langunpackvalue (linkedval.data.binaryvalue, &val)) //it's a packed binary: unpack it.
-
goto exit2;
if (val.valuetype != externalvaluetype) //it must be a table
-
goto exit1;
if (!tablevaltotable (val, &htable, hn))
+ goto exit1;
+ if ( ! newtexthandle ( BIGSTRING ("\x04""type"), &handleType ) )
goto exit1;
+
+ if (hashtablelookup (htable, handleType, &valheadlinetype, &hnheadlinetype)) {
- if (hashtablelookup (htable, BIGSTRING ("\x04""type"), &valheadlinetype, &hnheadlinetype)) {
-
pullstringvalue (&valheadlinetype, bstype);
fl = true;
+
} /*if*/
exit1: /*7.0b14 PBS: fix memory leaks*/
- disposevaluerecord (val, false);
-
+ disposehandle ( handleType );
+
+ disposevaluerecord (val, false);
+
exit2:
- disposevaluerecord (linkedval, false);
-
+ disposevaluerecord (linkedval, false);
+
exit3:
- enablelangerror ();
-
- return (fl);
+ enablelangerror ();
+
+ return (fl);
+
} /*opattributesgettypestring*/
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/ops.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/ops.c 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/ops.c 2007-02-26 22:59:15 UTC (rev 1633)
@@ -243,17 +243,24 @@
void numbertostring (long longval, bigstring bs) {
-#ifdef MACVERSION
- NumToString (longval, bs);
-#endif
+ #ifdef MACVERSION
+
+ NumToString (longval, bs);
+
+ #endif
-#ifdef WIN95VERSION
- wsprintf (bs, "%ld", longval);
+ #ifdef WIN95VERSION
+
+ wsprintf (bs, "%ld", longval);
- #ifdef PASCALSTRINGVERSION
- convertcstring (bs);
+ #ifdef PASCALSTRINGVERSION
+
+ convertcstring (bs);
+
+ #endif
+
#endif
-#endif
+
} /*numbertostring*/
@@ -312,6 +319,7 @@
*shortval = (short) longval;
return (true);
+
} /*stringtoshort*/
@@ -954,7 +962,7 @@
} /*getsizestring*/
-unsigned long bcdtolong (unsigned long bcd) { /* 2004-11-23 creedon, aradke */
+unsigned long bcdtolong (unsigned long bcd) { // 2004-11-23 creedon, aradke
/*
convert a long value from BCD notation
@@ -972,5 +980,23 @@
} while (bcd != 0);
- return (ret);
- } /* bcdtolong */
\ No newline at end of file
+ return ( ret );
+
+ } // bcdtolong
+
+
+void numberToTextHandle ( long l, Handle *h ) {
+
+ //
+ // 2007-02-26 creedon: created
+ //
+
+ bigstring bs;
+
+ numbertostring ( l, bs );
+
+ if ( ! newtexthandle ( bs, h ) )
+ h = NULL;
+
+ } // numberToTextHandle
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|