|
From: <cre...@us...> - 2007-06-23 19:41:51
|
Revision: 1699
http://svn.sourceforge.net/frontierkernel/?rev=1699&view=rev
Author: creecode
Date: 2007-06-23 12:41:49 -0700 (Sat, 23 Jun 2007)
Log Message:
-----------
support for long odb item names and file paths
formatting tweaks
Modified Paths:
--------------
Frontier/branches/Frontier_Long_File_Paths/Common/headers/claybrowserstruc.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/frontierdefs.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/lang.h
Frontier/branches/Frontier_Long_File_Paths/Common/source/OpenTransportNetEvents.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/cancoon.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/claybrowserstruc.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/claybrowservalidate.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/claycallbacks.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langevaluate.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langexternal.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langhash.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langhtml.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langops.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langvalue.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langverbs.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langxml.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/memory.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/opedit.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/opstructure.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/opverbs.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/opvisit.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/osacomponent.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/scripts.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shellcallbacks.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shellmenu.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shellwindow.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shellwindowverbs.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/strings.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/tableops.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/tablepack.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/tablevalidate.c
Frontier/branches/Frontier_Long_File_Paths/Common/stubs/megastubs.c
Frontier/branches/Frontier_Long_File_Paths/FrontierSDK/Toolkits/IACTools/Source/iacnetwork.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/claybrowserstruc.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/claybrowserstruc.h 2007-06-18 18:00:08 UTC (rev 1698)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/claybrowserstruc.h 2007-06-23 19:41:49 UTC (rev 1699)
@@ -25,47 +25,50 @@
******************************************************************************/
+
#ifndef claybrowserstrucinclude
-#define claybrowserstrucinclude
-
-#include "claybrowser.h"
-
-extern boolean lineinsertedcallbackdisabled;
-
-extern boolean browserdeletenodeswithtmpbitset (void);
-
-extern boolean browsercommitchanges (void);
-
-extern boolean browsercopyrefcon (hdlheadrecord, hdlheadrecord);
-
-extern boolean browsertextualizerefcon (hdlheadrecord, Handle);
-
-extern boolean browserreleaserefcon (hdlheadrecord, boolean);
-
-extern boolean browserpredrag (hdlheadrecord *, tydirection *);
-
-extern boolean browserdragcopy (hdlheadrecord, hdlheadrecord);
-
-extern boolean browserexportscrap (hdloutlinerecord);
-
-extern void browsersortfolder (hdlheadrecord);
-
-extern boolean browsergetparentspec (hdlheadrecord, tybrowserspec *);
-
-extern void browserinsertagain (hdlheadrecord);
-
-extern boolean browserlineinserted (hdlheadrecord);
-
-extern boolean browserlinedeleted (hdlheadrecord);
-
-extern boolean browserclearundo (void);
-
-extern boolean browsersetscrap (hdloutlinerecord);
-
-extern boolean browsergetscrap (hdloutlinerecord *, boolean *);
-
-extern boolean browserdeletedummyvalues (hdlheadrecord);
-
+ #define claybrowserstrucinclude
+
+
+ #include "claybrowser.h"
+
+
+ extern boolean lineinsertedcallbackdisabled;
+
+ extern boolean browserdeletenodeswithtmpbitset (void);
+
+ extern boolean browsercommitchanges (void);
+
+ extern boolean browsercopyrefcon (hdlheadrecord, hdlheadrecord);
+
+ extern boolean browsertextualizerefcon (hdlheadrecord, Handle);
+
+ extern boolean browserreleaserefcon (hdlheadrecord, boolean);
+
+ extern boolean browserpredrag (hdlheadrecord *, tydirection *);
+
+ extern boolean browserdragcopy (hdlheadrecord, hdlheadrecord);
+
+ extern boolean browserexportscrap (hdloutlinerecord);
+
+ extern void browsersortfolder (hdlheadrecord);
+
+ extern boolean browsergetparentspec (hdlheadrecord, tybrowserspec *);
+
+ extern void browserinsertagain (hdlheadrecord);
+
+ extern boolean browserlineinserted (hdlheadrecord);
+
+ extern boolean browserlinedeleted (hdlheadrecord);
+
+ extern boolean browserclearundo (void);
+
+ extern boolean browsersetscrap (hdloutlinerecord);
+
+ extern boolean browsergetscrap (hdloutlinerecord *, boolean *);
+
+ extern boolean browserdeletedummyvalues (hdlheadrecord);
+
#endif
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/frontierdefs.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/frontierdefs.h 2007-06-18 18:00:08 UTC (rev 1698)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/frontierdefs.h 2007-06-23 19:41:49 UTC (rev 1699)
@@ -52,15 +52,24 @@
#ifdef MACVERSION
+
#define flcomponent 1
+
#ifdef __powerc
+
#define noextended 1
+
#elif defined(__GNUC__)
+
#define noextended 1
+
#else
+
#define noextended 0
+
#endif
-#endif /* MACVERSION */
+
+ #endif // MACVERSION
#undef MEMTRACKER /* define as 1 to enable tracking of memory allocations */
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/lang.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/lang.h 2007-06-18 18:00:08 UTC (rev 1698)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/lang.h 2007-06-23 19:41:49 UTC (rev 1699)
@@ -415,6 +415,7 @@
/*param1 - param4 must be at the end of the record - see newtreenode*/
struct tytreenode **param1, **param2, **param3, **param4;
+
} tytreenode, *ptrtreenode, **hdltreenode;
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/OpenTransportNetEvents.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/OpenTransportNetEvents.c 2007-06-18 18:00:08 UTC (rev 1698)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/OpenTransportNetEvents.c 2007-06-23 19:41:49 UTC (rev 1699)
@@ -2252,7 +2252,7 @@
doLeave = OTEnterNotifier (epref->ep);
- /*bundle*/ {
+ bundle {
if (listenref != nil) { /*required to keep the stats accurate if CheckUnbind is called*/
listenref->stats.ctwaiting--;
@@ -3912,8 +3912,8 @@
doLeave = OTEnterNotifier (epref->ep);
-
- /*bundle*/ {
+ bundle {
+
ListenRecordRef listenref = epref->listener;
DoSndOrderlyDisconnect (epref, true);
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/cancoon.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/cancoon.c 2007-06-18 18:00:08 UTC (rev 1698)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/cancoon.c 2007-06-23 19:41:49 UTC (rev 1699)
@@ -509,8 +509,8 @@
create the standard global tables
*/
- /* register */ hdlcancoonrecord hc = hcancoon;
- /* register */ boolean fl;
+ register hdlcancoonrecord hc = hcancoon;
+ register boolean fl;
Handle hvariable;
hdlhashtable htable;
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/claybrowserstruc.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/claybrowserstruc.c 2007-06-18 18:00:08 UTC (rev 1698)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/claybrowserstruc.c 2007-06-23 19:41:49 UTC (rev 1699)
@@ -414,7 +414,7 @@
static boolean getundofolderspec ( void ) {
//
- // 2007-01-17 creedon: support for long odb item names and file paths
+ // 2007-03-01 creedon: support for long odb item names and file paths
//
Handle h;
@@ -422,6 +422,8 @@
if ( folderfound )
return ( true );
+
+ clearbytes ( &undofolderspec, sizeof ( undofolderspec ) );
if ( ! newtexthandle ( BIGSTRING ( "\x04" "Undo" ), &h ) )
return ( false );
@@ -433,18 +435,22 @@
return ( folderfound );
} // getundofolderspec
-
-
+
+
static boolean getclipfolderspec ( void ) {
+ //
+ // 2007-03-01 creedon: support for long odb item names and file paths
+ //
+
Handle h;
static boolean folderfound = false;
- clearbytes ( &undofolderspec, sizeof ( clipfolderspec ) );
+ if ( folderfound )
+ return ( true );
+
+ clearbytes ( &clipfolderspec, sizeof ( clipfolderspec ) );
- if (folderfound)
- return (true);
-
if ( ! newtexthandle ( BIGSTRING ( "\x09" "Clipboard" ), &h ) )
return ( false );
@@ -452,9 +458,9 @@
disposehandle ( h );
- return (folderfound);
+ return ( folderfound );
- } /*getclipfolderspec*/
+ } // getclipfolderspec
boolean browserclearundo (void) {
@@ -467,8 +473,9 @@
static boolean deletetmpbitvisit (hdlheadrecord hnode, ptrvoid refcon) {
-#pragma unused (refcon)
+ #pragma unused (refcon)
+
if ((**hnode).tmpbit) {
(**hnode).tmpbit = false;
@@ -476,9 +483,11 @@
opdeletenode (hnode);
browsercommitchanges (); /*moves the file into the undo folder*/
+
}
return (true); /*keep visiting*/
+
} /*deletetmpbitvisit*/
@@ -488,7 +497,8 @@
delete files with their tmp bits turned on
*/
- return (opsiblingvisiter ((**outlinedata).hsummit, true, &deletetmpbitvisit, nil));
+ return (opsiblingvisiter ((**outlinedata).hsummit, true, &deletetmpbitvisit, nil));
+
} /*browserdeletenodeswithtmpbitset*/
@@ -556,6 +566,7 @@
return (false);
}
else {
+
if (!(**hnode).flnodeonscrap) { /*we own this file -- move it*/
if ( ( ( fssource.vRefNum == fsdest.vRefNum ) || ( fssource.vRefNum == 0 ) || ( fsdest.vRefNum == 0 ) ) &&
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/claybrowservalidate.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/claybrowservalidate.c 2007-06-18 18:00:08 UTC (rev 1698)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/claybrowservalidate.c 2007-06-23 19:41:49 UTC (rev 1699)
@@ -463,20 +463,20 @@
static boolean compareforcopyvisit (hdlheadrecord hnode, ptrvoid refcon) {
-
+
bigstring bs, bsnode;
ptrdraginfo draginfo = (ptrdraginfo) refcon;
if (hnode == (*draginfo).hcompare)
return (true);
-
+
opgetheadstring (hnode, bsnode);
opgetheadstring ((*draginfo).hcompare, bs);
if (!equalidentifiers (bsnode, bs))
return (true);
-
+
copystring (BIGSTRING ("\x06" "Can\xD5t "), bs);
pushstring (pcommand, bs);
@@ -490,22 +490,25 @@
alertdialog (bs);
return (false); /*stop both traversals*/
+
} /*compareforcopyvisit*/
static boolean validatecopyvisit (hdlheadrecord hnode, ptrvoid refcon) {
-#pragma unused (refcon)
+ #pragma unused (refcon)
+
tydraginfo draginfo;
draginfo.hcompare = hnode;
return (opvisitmarked (down, &compareforcopyvisit, &draginfo));
+
} /*validatecopyvisit*/
boolean browservalidatecopy (bigstring bscommand) {
-
+
/*
don't allow a copy if there's a node selected that has the
same name as another node that's selected. we do the dialog
@@ -515,6 +518,6 @@
pcommand = bscommand; /*set static to point to string*/
return (opvisitmarked (down, &validatecopyvisit, nil));
+
} /*browservalidatecopy*/
-
-
+
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/claycallbacks.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/claycallbacks.c 2007-06-18 18:00:08 UTC (rev 1698)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/claycallbacks.c 2007-06-23 19:41:49 UTC (rev 1699)
@@ -314,16 +314,10 @@
tyvaluerecord val;
if ((*fsfolder).parID == nil) {
+
+ assert ( textHandleEqualsBigstring ( ( *fsfolder ).name,
+ nameroottable, true ) );
- Handle h;
-
- if ( ! newtexthandle ( nameroottable, &h ) )
- return ( false );
-
- assert ( equalhandles ( (*fsfolder).name, h ) );
-
- disposehandle ( h );
-
*dirid = roottable;
goto tagandexit;
@@ -331,32 +325,32 @@
}
if ( ( *fsfolder ).name == NULL ) {
-
+
*dirid = (*fsfolder).parID;
goto tagandexit;
}
-
+
if (!claylookupvalue (fsfolder, &val, &hnode))
return (false);
-
- if (flinmemory) {
+ if (flinmemory) {
+
hdlexternalvariable hv = (hdlexternalvariable) val.data.externalvalue;
if (!(**hv).flinmemory)
return (false);
}
-
+
if (!tablevaltotable (val, dirid, hnode))
return (false);
-
+
tagandexit:
return (true);
- } /*claygetfolder*/
+ } // claygetfolder
boolean claygetinmemorydirid ( const tybrowserspec *fsfolder, tybrowserdir *dirid ) {
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langevaluate.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langevaluate.c 2007-06-18 18:00:08 UTC (rev 1698)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langevaluate.c 2007-06-23 19:41:49 UTC (rev 1699)
@@ -1960,9 +1960,12 @@
#if lazythis_optimization
+
static int ctdeferredthis = 0;
+
#endif
+
boolean evaluatelist (hdltreenode hfirst, tyvaluerecord *val) {
//
@@ -1977,7 +1980,7 @@
// runtime stack, and releasing it before we exit. the global is reset to
// nil, so that it has to be reset on every use.
//
- // 2007-02-23 creedon: support for long odb item names and file paths
+ // 2007-06-23 creedon: support for long odb item names and file paths
//
// 2001-11-13 dmb: try lazy with evaluation
//
@@ -2078,6 +2081,7 @@
#if lazythis_optimization
++ctdeferredthis;
+
#else
if ( langgetthisaddress ( &hthis, &handleThis ) )
@@ -2093,7 +2097,7 @@
if ( setheapvalue ( tryerror, stringvaluetype, &errorval ) ) {
- /* register */ Handle h;
+ Handle h;
newfilledhandle ( nametryerrorval + 1, stringlength ( nametryerrorval ), &h );
@@ -2225,7 +2229,7 @@
}
- if (languserescaped (true)) /*user pressed cmd-period, unwind recursion -- quickly*/
+ if (languserescaped (true)) // user pressed cmd-period, unwind recursion -- quickly
goto exit;
flReturn = true; // fell through the bottom of the list
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langexternal.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langexternal.c 2007-06-18 18:00:08 UTC (rev 1698)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langexternal.c 2007-06-23 19:41:49 UTC (rev 1699)
@@ -215,6 +215,7 @@
return (nil);
return ((**hv).hdatabase);
+
} /*langexternalgetdatabase*/
@@ -1125,14 +1126,15 @@
5.0.2b12 dmb: new routine
*/
- hdlexternalhandle h = (hdlexternalhandle) (*v1).data.externalvalue;
Handle x;
boolean fl;
+ hdlexternalhandle h = (hdlexternalhandle) (*v1).data.externalvalue;
switch ((**h).id) {
case idoutlineprocessor:
case idscriptprocessor:
+
if (!opverbcopyvalue (h, &h))
return (false);
@@ -1141,6 +1143,7 @@
return (true);
default:
+
if (!langpackvalue (*v1, &x, HNoNode))
return (false);
@@ -1150,6 +1153,7 @@
return (fl);
}
+
} /*langexternalcopyvalue*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langhash.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langhash.c 2007-06-18 18:00:08 UTC (rev 1698)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langhash.c 2007-06-23 19:41:49 UTC (rev 1699)
@@ -851,16 +851,17 @@
void dirtyhashtable (hdlhashtable ht) {
-
+
(**ht).fldirty = true;
(**ht).timelastsave = timenow ();
} /*dirtyhashtable*/
-
-static short smashhashtable (hdlhashtable htable, boolean fldisk, boolean flcallback) {
+static short smashhashtable ( hdlhashtable htable, boolean fldisk,
+ boolean flcallback ) {
+
//
// 2007-02-23 creedon: support for long odb item names and file paths
//
@@ -872,57 +873,51 @@
register hdlhashnode nomad, nextnomad;
register hdlhashtable ht = htable;
register short i;
-
+
Handle h;
short ctdisposed = 0;
- if (ht == nil) /*easy to dispose of nil table*/
+ if (ht == nil) // easy to dispose of nil table
return (0);
+
+ (**ht).hfirstsort = nil; // disconnect now so table is valid during
+ // disposal
- (**ht).hfirstsort = nil; /*disconnect now so table is valid during disposal*/
-
for (i = 0; i < ctbuckets; i++) {
-
+
nomad = (**ht).hashbucket [i];
- (**ht).hashbucket [i] = nil; /*disconnect list so table is valid during disposal*/
+ (**ht).hashbucket [i] = nil; // disconnect list so table is valid
+ // during disposal
while (nomad != nil) {
-
+
nextnomad = (**nomad).hashlink;
if (flcallback)
gethashkey (nomad, &h);
-
+
if (flcallback)
langsymbolunlinking (ht, nomad);
-
+
disposehashnode (ht, nomad, true, fldisk);
if (flcallback)
langsymboldeleted (ht, h);
-
+
++ctdisposed;
- if ( ctdisposed == 59 ) {
-
- boolean fl;
-
- fl = true;
-
- }
-
nomad = nextnomad;
- } /*while*/
+ } // while
- } /*for*/
-
+ } // for
+
dirtyhashtable (ht);
-
+
return (ctdisposed);
- } /*smashhashtable*/
+ } // smashhashtable
short emptyhashtable (hdlhashtable htable, boolean fldisk) {
@@ -1001,6 +996,7 @@
disposehashnode (nomad, true /%fldisposevalue%/, fldisk);
nomad = nextnomad;
+
}
}
*/
@@ -1758,9 +1754,10 @@
// items
//
// 5.0.1b1 dmb: the b17 change broke stuff, because the object may be in
- // another table's temp stack. Our caller is responsible for exempting
- // anything assinged into a table. we just need to make sure that the
- // fltmpstack flag is clear for _any_ object we assign to a hashnode
+ // another table's temp stack. Our caller is responsible for
+ // exempting anything assinged into a table. we just need to
+ // make sure that the fltmpstack flag is clear
+ // for _any_ object we assign to a hashnode
//
// 5.0b17 dmb: if we're assigning a tmp external, claim the data like a
// normal tmp. don't copy the data, clean fltmpdata instead.
@@ -1775,9 +1772,9 @@
// side effect of hiding an error condition unexpectedly.
//
+ boolean fllocal = (**currenthashtable).fllocaltable;
hdlhashnode hnode, hprev;
tyvaluerecord existingval;
- boolean fllocal = (**currenthashtable).fllocaltable;
/*
fllangerror = false;
@@ -2108,8 +2105,8 @@
be examining strings values must handle this. (currently there are no such callers.)
*/
- /* register */ hdlhashnode x;
- /* register */ short i;
+ register hdlhashnode x;
+ register short i;
for (i = 0; i < ctbuckets; i++) {
@@ -4157,10 +4154,9 @@
boolean gethashkey ( hdlhashnode hhn, Handle *handleHashKey ) {
//
- // 2007-02-23 creedon: created, used to be a macro
+ // 2007-04-13 creedon: created, used to be a macro
//
- Handle h;
long length;
short s;
@@ -4168,13 +4164,11 @@
length = ( long ) s;
- if ( ! newhandle ( length, &h ) )
+ if ( ! newhandle ( length, handleHashKey ) )
return ( false );
- moveleft ( ( **hhn ).hashkey + sizeof ( short ), *h, length );
+ moveleft ( ( **hhn ).hashkey + sizeof ( short ), **handleHashKey, length );
- *handleHashKey = h;
-
return ( true );
} // gethashkey
@@ -4186,15 +4180,6 @@
// 2007-02-23 creedon: created
//
- Handle h1;
-
- newtexthandle ( BIGSTRING ( "\x08" "#ftpSite" ), &h1 );
-
- if ( equalhandles ( h, h1 ) )
- disposehandle ( h1 );
-
- disposehandle ( h1 );
-
long length = gethandlesize ( h );
short sLength = ( short ) length;
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langhtml.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langhtml.c 2007-06-18 18:00:08 UTC (rev 1698)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langhtml.c 2007-06-23 19:41:49 UTC (rev 1699)
@@ -825,24 +825,24 @@
if ( ! newtexthandle ( pref, &h ) )
return ( false );
- if (!htmlgetpref (pmi, h, &val)) {
+ if ( ! htmlgetpref ( pmi, h, &val ) ) {
disposehandle ( h );
- return (false);
+ return ( false );
}
disposehandle ( h );
- if (!coercetoboolean (&val))
- return (false);
+ if ( ! coercetoboolean ( &val ) )
+ return ( false );
*flpref = val.data.flvalue;
- return (true);
+ return ( true );
- } /*htmlgetbooleanpref*/
+ } // htmlgetbooleanpref
static boolean htmlgetstringpref (typrocessmacrosinfo *pmi, const Handle pref, bigstring bspref) {
@@ -887,7 +887,7 @@
} // htmlGetStringPreferenceBigstring
-static boolean htmlrefglossary (typrocessmacrosinfo *pmi, Handle hreference, bigstring perrorstring, Handle *hresult) {
+static boolean htmlrefglossary ( typrocessmacrosinfo *pmi, Handle hreference, bigstring perrorstring, Handle *hresult ) {
#pragma unused (pmi)
@@ -912,19 +912,19 @@
ptrvoid saveerrorstring = langcallbacks.errormessagerefcon;
tyvaluerecord vparams, vresult;
- setheapvalue (hreference, stringvaluetype, &vparams);
+ setheapvalue ( hreference, stringvaluetype, &vparams );
- if (!coercetolist (&vparams, listvaluetype))
- return (false);
-
+ if ( ! coercetolist ( &vparams, listvaluetype ) )
+ return ( false );
+
langcallbacks.errormessagecallback = &htmlcallbackerror;
langcallbacks.errormessagerefcon = perrorstring;
- if ( ! newtexthandle ( BIGSTRING ("\x10" "html.refglossary"), &h ) )
+ if ( ! newtexthandle ( BIGSTRING ( "\x10" "html.refglossary" ), &h ) )
return ( false );
- fl = langrunscript ( h, &vparams, nil, &vresult) && strongcoercetostring (&vresult);
+ fl = langrunscript ( h, &vparams, nil, &vresult ) && strongcoercetostring ( &vresult );
disposehandle ( h );
@@ -934,17 +934,18 @@
fllangerror = false;
- if (fl) {
+ if ( fl ) {
+
+ exemptfromtmpstack ( &vresult );
- exemptfromtmpstack (&vresult);
-
*hresult = vresult.data.stringvalue;
}
+
+ return ( fl );
- return (fl);
+ /*
- /*
// local (adrpagetable = html.data.adrPageTable);
// local (adrobject = adrpagetable^.adrobject);
// local (adrparent = parentOf (adrobject^));
@@ -1037,8 +1038,6 @@
if (!pushtexthandle ("\x01" "|", *hresult))
return (false);
-
-
case scriptvaluetype:
break;
@@ -1048,11 +1047,12 @@
}
// return (frontTextScriptCall ('refg', term, hresult, errorstring));
+
*/
- } /*htmlrefglossary*/
-
+ } // htmlrefglossary
+
static boolean htmlcleanforexport (Handle x) {
/*
@@ -1126,9 +1126,11 @@
}
closehandlestream (&s);
+
#endif
return (true);
+
} /*htmlcleanforexport*/
@@ -1137,10 +1139,11 @@
disposehashtable ((*pmi).hmacrocontext, false);
(*pmi).hmacrocontext = nil;
+
} /*htmldisposemacrocontext*/
-static boolean htmlbuildmacrocontext (typrocessmacrosinfo *pmi) {
+static boolean htmlbuildmacrocontext ( typrocessmacrosinfo *pmi ) {
//
// 2007-02-23 creedon: support for long odb item names and file paths
@@ -1156,74 +1159,83 @@
hdlhashtable hcontext, hstandardmacros, ht, htools, husermacros;
tyvaluerecord val;
- if ((*pmi).hmacrocontext != nil)
- return (true);
+ if ( ( *pmi ).hmacrocontext != nil )
+ return ( true );
// find macros tables
- if (!langfastaddresstotable (builtinstable, NULL, str_standardmacros, &hstandardmacros))
- return (false);
+ if ( ! langfastaddresstotable ( builtinstable, NULL, str_standardmacros, &hstandardmacros ) )
+ return ( false );
- if (!langfastaddresstotable (roottable, NULL, str_usermacros, &husermacros))
- return (false);
+ if ( ! langfastaddresstotable ( roottable, NULL, str_usermacros, &husermacros ) )
+ return ( false );
- if (!newhashtable (&hcontext)) /*new table for the function when it runs*/
- return (false);
+ if ( ! newhashtable ( &hcontext ) ) // new table for the function when it runs
+ return ( false );
- (**hcontext).fllocaltable = true;
+ ( **hcontext ).fllocaltable = true;
- (**hcontext).lexicalrefcon = 0L; /*'with' gets global scope*/
+ ( **hcontext ).lexicalrefcon = 0L; // 'with' gets global scope
// local (adrpagetable = html.data.adrPageTable)
+
if ( ! findinparenttable ( ( *pmi ).hpagetable, &ht, &h ) )
goto error;
- if (!setaddressvalue (ht, h, &val))
+ if ( ! setaddressvalue ( ht, h, &val ) ) {
+
+ disposehandle ( h );
+
goto error;
- if (!hashtableassignstring (hcontext, BIGSTRING ("\x0c" "adrPageTable"), val))
+ }
+
+ disposehandle ( h );
+
+ if ( ! hashtableassignstring ( hcontext, BIGSTRING ( "\x0c" "adrPageTable" ), val ) )
goto error;
- exemptfromtmpstack (&val);
+ exemptfromtmpstack ( &val );
// with html.data.adrPageTable^, html.data.standardMacros, user.html.macros, toolTableAdr^ {
- if (!langpushwithtable (hcontext, (*pmi).hpagetable))
+
+ if ( ! langpushwithtable ( hcontext, ( *pmi ).hpagetable ) )
goto error;
- if (!langpushwithtable (hcontext, hstandardmacros))
+ if ( ! langpushwithtable ( hcontext, hstandardmacros ) )
goto error;
- if (!langpushwithtable (hcontext, husermacros))
+ if ( ! langpushwithtable ( hcontext, husermacros ) )
goto error;
if ( hashTableLookupBigstring ( ( *pmi ).hpagetable, str_tools, &val, &hnode ) &&
- (val.valuetype == addressvaluetype) &&
+ ( val.valuetype == addressvaluetype ) &&
getaddressvalue ( val, &htools, &handleTools ) &&
- hashtablelookup (htools, handleTools, &val, &hnode) &&
- tablevaltotable (val, &htools, hnode))
+ hashtablelookup ( htools, handleTools, &val, &hnode ) &&
+ tablevaltotable ( val, &htools, hnode ) )
- if (!langpushwithtable (hcontext, htools))
+ if ( ! langpushwithtable ( hcontext, htools ) )
goto error;
disposehandle ( handleTools );
- (*pmi).hmacrocontext = hcontext;
+ ( *pmi ).hmacrocontext = hcontext;
- return (true);
+ return ( true );
error:
disposehandle ( handleTools );
- disposehashtable (hcontext, false);
+ disposehashtable ( hcontext, false );
- return (false);
+ return ( false );
- } /*htmlbuildmacrocontext*/
+ } // htmlbuildmacrocontext
static boolean htmlrunmacro (typrocessmacrosinfo *pmi, Handle macro, bigstring perrorstring, Handle *hresult) {
-
+
/*
run the macro, consuming it. return the result in hresult, which our caller
must dispose. on error, return the error text in perrorstring.
@@ -1265,7 +1277,7 @@
unchainhashtable ();
if (fl) {
-
+
Handle h = val.data.stringvalue;
if ((*pmi).flexpandglossaryitems) {
@@ -1276,35 +1288,39 @@
// macroResult = html.refGlossary (macroResult)}};
if ((*h) [0] == '"' && (*h) [gethandlesize (h) - 1] == '"') {
-
+
pullfromhandle (h, 0, 1, nil);
popfromhandle (h, 1, nil);
return (htmlrefglossary (pmi, h, perrorstring, hresult));
+
}
}
+
+ *hresult = h;
- *hresult = h;
}
else
if (stringlength (perrorstring) > 0 && ingoodthread ()) { //6.2b6 AR
+
+ Handle herror;
- Handle herror;
-
- if (newtexthandle (perrorstring, &herror)) {
+ if ( newtexthandle ( perrorstring, &herror ) ) {
+
+ htmlcleanforexport ( herror );
- htmlcleanforexport (herror);
+ texthandletostring ( herror, perrorstring );
- texthandletostring (herror, perrorstring);
-
- disposehandle (herror);
+ disposehandle ( herror );
+
}
}
else
*hresult = nil;
+
+ return (fl);
- return (fl);
/*
else {
local (errorString = html.cleanForExport (tryError));
@@ -1329,7 +1345,8 @@
scriptError (errorString)}}
*/
//return (frontTextScriptCall ('dosc', macro, hresult, errorstring));
- } /*htmlrunmacro*/
+
+ } // htmlrunmacro
static boolean htmlreportmacroerror (typrocessmacrosinfo *pmi, Handle macro, bigstring perrorstring) {
@@ -2345,301 +2362,304 @@
#ifdef version5orgreater
-static boolean iso8859encode (handlestream *s, hdlhashtable hiso8859usermap) {
+ static boolean iso8859encode (handlestream *s, hdlhashtable hiso8859usermap) {
- //
- // 2007-02-23 creedon: support for long odb item names and file paths
- //
- // 5.0.2b16 dmb: backup after replacement, so we don't miss next char
- //
- // 5.0.2b14 dmb: take a handlestream, not a Handle
- //
- // 4.1b13 dmb: fixed heap-trashing off-by-one error in text replacement code
- //
- // 4.1b4 dmb: use user preferences for mapping, if table exists. for extra
- // speed, don't even try to map characters < ascii 128
- //
-
- #define lentext ((*s).eof)
- #define ixtext ((*s).pos)
- Handle htext = (*s).data;
- unsigned char ch;
- Str255 bs;
- tyvaluerecord val;
- hdlhashnode hnode;
-
-
- #ifndef version5orgreater
- hdlhashtable hiso8859usermap = nil;
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 5.0.2b16 dmb: backup after replacement, so we don't miss next char
+ //
+ // 5.0.2b14 dmb: take a handlestream, not a Handle
+ //
+ // 4.1b13 dmb: fixed heap-trashing off-by-one error in text replacement
+ // code
+ //
+ // 4.1b4 dmb: use user preferences for mapping, if table exists. for extra
+ // speed, don't even try to map characters < ascii 128
+ //
- if (getsystemtablescript (iduseriso8859map, bs)) {
+ #define lentext ((*s).eof)
+ #define ixtext ((*s).pos)
+ Handle htext = (*s).data;
+ unsigned char ch;
+ Str255 bs;
+ tyvaluerecord val;
+ hdlhashnode hnode;
+
+ #ifndef version5orgreater
+
+ hdlhashtable hiso8859usermap = nil;
- pushstring (BIGSTRING ("\x08" ".[\"128\"]"), bs); /*refer to 1st entry in table*/
+ if (getsystemtablescript (iduseriso8859map, bs)) {
+
+ pushstring (BIGSTRING ("\x08" ".[\"128\"]"), bs); /*refer to 1st entry in table*/
+
+ disablelangerror ();
+
+ if (langexpandtodotparams (bs, &hiso8859usermap, bs))
+ ; /*map being non-nil is our flag*/
+
+ enablelangerror ();
+
+ }
+ #endif
+
+ if (hiso8859usermap != nil)
+ pushhashtable (hiso8859usermap);
- disablelangerror ();
-
- if (langexpandtodotparams (bs, &hiso8859usermap, bs))
- ; /*map being non-nil is our flag*/
-
- enablelangerror ();
-
- }
- #endif
-
- if (hiso8859usermap != nil)
- pushhashtable (hiso8859usermap);
-
- for (ixtext = 0; ixtext < lentext; ++ixtext) {
-
- ch = (*htext) [ixtext];
-
- if (ch <= 127)
- continue;
+ for (ixtext = 0; ixtext < lentext; ++ixtext) {
- if (hiso8859usermap != nil) {
+ ch = (*htext) [ixtext];
- Handle h;
+ if (ch <= 127)
+ continue;
+
+ if (hiso8859usermap != nil) {
- numbertostring ((long) ch, bs);
-
- if ( ! newtexthandle ( bs, &h ) )
- return ( false );
+ Handle h;
- if (!hashlookup ( h, &val, &hnode) || val.valuetype != stringvaluetype) {
-
+ numbertostring ((long) ch, bs);
+
+ if ( ! newtexthandle ( bs, &h ) )
+ return ( false );
+
+ if (!hashlookup ( h, &val, &hnode) || val.valuetype != stringvaluetype) {
+
+ disposehandle ( h );
+
+ continue;
+
+ }
+
disposehandle ( h );
- continue;
+ pullstringvalue (&val, bs);
}
+ else {
+
+ if (iso8859table [ch] == 0) /*normal char, doesn't need processing*/
+ continue;
+
+ /*encode the character*/
- disposehandle ( h );
+ copyctopstring ((char *)(iso8859table [ch]), bs); // 3/26/97 dmb: it's a c string now
+
+ }
+
+ if (!mergehandlestreamstring (s, 1, bs))
+ return (false);
+
+ --ixtext; // back up, so we can move ahead
+ } /*while*/
- pullstringvalue (&val, bs);
+ if (hiso8859usermap != nil)
+ pophashtable ();
- }
- else {
+ return (true);
- if (iso8859table [ch] == 0) /*normal char, doesn't need processing*/
- continue;
-
- /*encode the character*/
-
- copyctopstring ((char *)(iso8859table [ch]), bs); // 3/26/97 dmb: it's a c string now
-
- }
+ #undef lentext
+ #undef ixtext
- if (!mergehandlestreamstring (s, 1, bs))
- return (false);
-
- --ixtext; // back up, so we can move ahead
- } /*while*/
-
- if (hiso8859usermap != nil)
- pophashtable ();
-
- return (true);
-
- #undef lentext
- #undef ixtext
-
- } /*iso8859encode*/
+ } /*iso8859encode*/
-boolean processhtmlmacrosverb (hdltreenode hp1, tyvaluerecord *vreturned) {
-
- /*
- 5.0.2b13 dmb: create handlestream here, and use for both processtext and autoparagraphs
-
- 5.0.2b14 dmb: suck the whole damn thing into the kernel, changing our API
-
- on processMacros (s, plainprocessing = false) {
+ boolean processhtmlmacrosverb (hdltreenode hp1, tyvaluerecord *vreturned) {
- 6.1b17 AR: We were doing a lot of superfluous work to determine the page table,
- some of it even causing crashes. Calling getoptionalpagetableavalue
- is enough.
- */
-
- typrocessmacrosinfo pageinfo;
- boolean flplainprocessing = false;
- Handle htext = nil;
- handlestream s;
-
- // get all of the prefs and tables that we need
-
- clearbytes (&pageinfo, sizeof (pageinfo));
-/*
- if (!htmlgetpagetable (&pageinfo.hpagetable) && !htmlgetdefaultpagetable (&pageinfo.hpagetable))
- return (false);
-*/
- if (!htmlgetprefstable (&pageinfo.huserprefs))
- return (false);
-
- if (langgetparamcount (hp1) > 1) {
+ /*
+ 5.0.2b13 dmb: create handlestream here, and use for both processtext and autoparagraphs
- if (!getbooleanvalue (hp1, 2, &flplainprocessing))
- return (false);
- }
-/*
- if (langgetparamcount (hp1) > 2) {
+ 5.0.2b14 dmb: suck the whole damn thing into the kernel, changing our API
- flnextparamislast = true;
+ on processMacros (s, plainprocessing = false) {
+
+ 6.1b17 AR: We were doing a lot of superfluous work to determine the page table,
+ some of it even causing crashes. Calling getoptionalpagetableavalue
+ is enough.
+ */
- if (!gettablevalue (hp1, 3, &pageinfo.hpagetable))
- return (false);
- }
-*/
- if (!getoptionalpagetablevalue (hp1, 3, &pageinfo.hpagetable))
- return (false);
-
- if (flplainprocessing) {
-
- pageinfo.flautoparagraphs = false;
+ typrocessmacrosinfo pageinfo;
+ boolean flplainprocessing = false;
+ Handle htext = nil;
+ handlestream s;
- pageinfo.flclaycompatibility = false;
+ // get all of the prefs and tables that we need
- pageinfo.flactiveurls = false;
- }
- else {
- if (!htmlgetbooleanpref (&pageinfo, BIGSTRING ("\x0e" "autoParagraphs"), &pageinfo.flautoparagraphs))
+ clearbytes (&pageinfo, sizeof (pageinfo));
+ /*
+ if (!htmlgetpagetable (&pageinfo.hpagetable) && !htmlgetdefaultpagetable (&pageinfo.hpagetable))
return (false);
+ */
+ if (!htmlgetprefstable (&pageinfo.huserprefs))
+ return (false);
+
+ if (langgetparamcount (hp1) > 1) {
- if (!htmlgetbooleanpref (&pageinfo, BIGSTRING ("\x0a" "activeURLs"), &pageinfo.flactiveurls))
+ if (!getbooleanvalue (hp1, 2, &flplainprocessing))
+ return (false);
+ }
+ /*
+ if (langgetparamcount (hp1) > 2) {
+
+ flnextparamislast = true;
+
+ if (!gettablevalue (hp1, 3, &pageinfo.hpagetable))
+ return (false);
+ }
+ */
+ if (!getoptionalpagetablevalue (hp1, 3, &pageinfo.hpagetable))
return (false);
+
+ if (flplainprocessing) {
- if (!htmlgetbooleanpref (&pageinfo, BIGSTRING ("\x11" "clayCompatibility"), &pageinfo.flclaycompatibility))
+ pageinfo.flautoparagraphs = false;
+
+ pageinfo.flclaycompatibility = false;
+
+ pageinfo.flactiveurls = false;
+
+ }
+ else {
+
+ if (!htmlgetbooleanpref (&pageinfo, BIGSTRING ("\x0e" "autoParagraphs"), &pageinfo.flautoparagraphs))
+ return (false);
+
+ if (!htmlgetbooleanpref (&pageinfo, BIGSTRING ("\x0a" "activeURLs"), &pageinfo.flactiveurls))
+ return (false);
+
+ if (!htmlgetbooleanpref (&pageinfo, BIGSTRING ("\x11" "clayCompatibility"), &pageinfo.flclaycompatibility))
+ return (false);
+ }
+
+ if (!htmlgetbooleanpref (&pageinfo, BIGSTRING ("\x0d" "processMacros"), &pageinfo.flprocessmacros))
return (false);
- }
-
- if (!htmlgetbooleanpref (&pageinfo, BIGSTRING ("\x0d" "processMacros"), &pageinfo.flprocessmacros))
- return (false);
-
- if (!htmlgetbooleanpref (&pageinfo, BIGSTRING ("\x13" "expandGlossaryItems"), &pageinfo.flexpandglossaryitems))
- return (false);
-
- if (!htmlgetbooleanpref (&pageinfo, BIGSTRING ("\x09" "isoFilter"), &pageinfo.flisofilter))
- return (false);
-
- // get the text and process it!
-
- if (!getexempttextvalue (hp1, 1, &htext))
- return (false);
-
- openhandlestream (htext, &s);
-
- if (!processhtmltext (&s, &pageinfo))
- goto error;
-
- htmldisposemacrocontext (&pageinfo);
-
- if (pageinfo.flautoparagraphs) {
+
+ if (!htmlgetbooleanpref (&pageinfo, BIGSTRING ("\x13" "expandGlossaryItems"), &pageinfo.flexpandglossaryitems))
+ return (false);
+
+ if (!htmlgetbooleanpref (&pageinfo, BIGSTRING ("\x09" "isoFilter"), &pageinfo.flisofilter))
+ return (false);
+
+ // get the text and process it!
- if (!autoparagraphs (&s))
+ if (!getexempttextvalue (hp1, 1, &htext))
+ return (false);
+
+ openhandlestream (htext, &s);
+
+ if (!processhtmltext (&s, &pageinfo))
goto error;
- }
-
- if (pageinfo.flisofilter) {
+
+ htmldisposemacrocontext (&pageinfo);
- hdlhashtable hisomap;
+ if (pageinfo.flautoparagraphs) {
+
+ if (!autoparagraphs (&s))
+ goto error;
+ }
+
+ if (pageinfo.flisofilter) {
- if (!langfastaddresstotable (builtinstable, NULL, str_iso8859map, &hisomap))
- goto error;
+ hdlhashtable hisomap;
+
+ if (!langfastaddresstotable (builtinstable, NULL, str_iso8859map, &hisomap))
+ goto error;
+
+ if (!iso8859encode (&s, hisomap))
+ goto error;
+ }
+
+ closehandlestream (&s);
- if (!iso8859encode (&s, hisomap))
- goto error;
- }
-
- closehandlestream (&s);
-
- return (setheapvalue (htext, stringvaluetype, vreturned));
-
- error: {
+ return (setheapvalue (htext, stringvaluetype, vreturned));
- htmldisposemacrocontext (&pageinfo);
+ error:
- disposehandle (htext);
+ htmldisposemacrocontext (&pageinfo);
+
+ disposehandle (htext);
+
+ return (false);
+
+ } /*processhtmlmacrosverb*/
- return (false);
- }
- } /*processhtmlmacrosverb*/
-
#else
-boolean processhtmlmacrosverb (hdltreenode hparam1, tyvaluerecord *vreturned) {
+ boolean processhtmlmacrosverb (hdltreenode hparam1, tyvaluerecord *vreturned) {
- /*
- 5.0.2b13 dmb: create handlestream here, and use for both processtext and autoparagraphs
- */
-
- Handle htext = nil;
- boolean flautoparagraphs, flactiveurls, claycompatibity;
- tyvaluerecord callbackval;
- tyaddress callback;
- ptraddress savecallback;
- handlestream s;
-
- if (!getbooleanvalue (hparam1, 2, &flautoparagraphs))
- return (false);
-
- if (!getbooleanvalue (hparam1, 3, &flactiveurls))
- return (false);
-
- if (!getbooleanvalue (hparam1, 4, &claycompatibity))
- return (false);
-
- flnextparamislast = true;
-
- #if version42orgreater
-
- if (!getaddressparam (hparam1, 5, &callbackval))
- return (false);
-
- if (!getaddressvalue (callbackval, &callback.ht, callback.bs))
- return (false);
-
- savecallback = callbackscript;
-
- callbackscript = &callback;
-
- #else
-
- if (!getbinaryvalue (hparam1, 5, true, &osaval.data.binaryvalue))
- return (false);
-
- #endif
-
- if (!getexempttextvalue (hparam1, 1, &htext))
- goto error;
-
- openhandlestream (htext, &s);
-
- if (!processtext (&s, flactiveurls, claycompatibity))
- goto error;
+ /*
+ 5.0.2b13 dmb: create handlestream here, and use for both processtext and autoparagraphs
+ */
- if (flautoparagraphs) {
+ Handle htext = nil;
+ boolean flautoparagraphs, flactiveurls, claycompatibity;
+ tyvaluerecord callbackval;
+ tyaddress callback;
+ ptraddress savecallback;
+ handlestream s;
- if (!autoparagraphs (&s))
+ if (!getbooleanvalue (hparam1, 2, &flautoparagraphs))
+ return (false);
+
+ if (!getbooleanvalue (hparam1, 3, &flactiveurls))
+ return (false);
+
+ if (!getbooleanvalue (hparam1, 4, &claycompatibity))
+ return (false);
+
+ flnextparamislast = true;
+
+ #if version42orgreater
+
+ if (!getaddressparam (hparam1, 5, &callbackval))
+ return (false);
+
+ if (!getaddressvalue (callbackval, &callback.ht, callback.bs))
+ return (false);
+
+ savecallback = callbackscript;
+
+ callbackscript = &callback;
+
+ #else
+
+ if (!getbinaryvalue (hparam1, 5, true, &osaval.data.binaryvalue))
+ return (false);
+
+ #endif
+
+ if (!getexempttextvalue (hparam1, 1, &htext))
goto error;
- }
-
- closehandlestream (&s);
-
- callbackscript = savecallback;
-
- return (setheapvalue (htext, stringvaluetype, vreturned));
-
- error: {
+
+ openhandlestream (htext, &s);
+ if (!processtext (&s, flactiveurls, claycompatibity))
+ goto error;
+
+ if (flautoparagraphs) {
+
+ if (!autoparagraphs (&s))
+ goto error;
+ }
+
+ closehandlestream (&s);
+
callbackscript = savecallback;
- disposehandle (htext);
+ return (setheapvalue (htext, stringvaluetype, vreturned));
- return (false);
- }
- } /*processhtmlmacrosverb*/
+ error:
+
+ callbackscript = savecallback;
+
+ disposehandle (htext);
+
+ return (false);
+
+ } /*processhtmlmacrosverb*/
+
+ #endif
-#endif
-
#ifdef MACVERSION
#pragma mark === stringOps ucmd ===
#endif
@@ -2833,152 +2853,162 @@
6.1b7 AR: Bug fix: We no longer depend on the field value
to not contain "=" signs.
*/
-
+
#ifdef oplanglists
+
Handle htext, hreturnedtext = nil, hfieldname, hfieldvalue;
hdllistrecord list = nil;
short fieldnum = 1;
long lenfield, lenfieldname;
-
+
flnextparamislast = true;
if (!getexempttextvalue (hparam1, 1, &htext))
return (false);
-
+
if (!opnewlist (&list, false))
goto error;
+
+ while (true) {
- while (true) {
-
if (!nthfieldhandle (htext, '&', fieldnum++, &hreturnedtext))
break;
-
+
lenfield = gethandlesize (hreturnedtext);
if (lenfield == 0) { //ran out of fields
-
+
disposehandle (hreturnedtext);
break;
+
}
-
+
if (!nthfieldhandle (hreturnedtext, '=', 1, &hfieldname))
goto error;
+
+ lenfieldname = gethandlesize (hfieldname);
- lenfieldname = gethandlesize (hfieldname);
-
decodehandle (hfieldname);
if (!langpushlisttext (list, hfieldname))
goto error;
-
+
/* if (!nthfieldhandle (hreturnedtext, '=', 2, &hfieldvalue))
goto error;
*/
if (lenfieldname < lenfield)
lenfieldname++;
-
+
if (!loadhandleremains (lenfieldname, hreturnedtext, &hfieldvalue))
goto error;
+
+ decodehandle (hfieldvalue);
- decodehandle (hfieldvalue);
-
if (!langpushlisttext (list, hfieldvalue))
goto error;
-
+
disposehandle (hreturnedtext);
+
}
-
+
disposehandle (htext);
return (setheapvalue ((Handle) list, listvaluetype, vreturned));
-
- error: {
+ error:
+
disposehandle (hreturnedtext);
disposehandle (htext);
opdisposelist (list);
-
+
return (false);
- }
+
#else
+
Handle htext, hreturnedtext = nil, hfieldname, hfieldvalue;
AEDescList list = {typeNull, nil};
short fieldnum = 1, ixlist = 1;
-
+
flnextparamislast = true;
if (!getexempttextvalue (hparam1, 1, &htext))
return (false);
-
+
if (!IACnewlist (&list))
goto error;
+
+ while (true) {
- while (true) {
-
if (!nthfieldhandle (htext, '&', fieldnum++, &hreturnedtext))
break;
+
+ if (gethandlesize (hreturnedtext) == 0) { //ran out of fields
- if (gethandlesize (hreturnedtext) == 0) { //ran out of fields
-
disposehandle (hreturnedtext);
break;
+
}
-
+
if (!nthfieldhandle (hreturnedtext, '=', 1, &hfieldname))
goto error;
-
+
decodehandle (hfieldname);
if (!IACpushtextitem (&list, hfieldname, ixlist++))
goto error;
-
+
if (!nthfieldhandle (hreturnedtext, '=', 2, &hfieldvalue))
goto error;
-
+
decodehandle (hfieldvalue);
if (!IACpushtextitem (&list, hfieldvalue, ixlist++))
goto error;
+
+ disposehandle (hreturnedtext);
- disposehandle (hreturnedtext);
}
-
+
disposehandle (htext);
#if TARGET_API_MAC_CARBON == 1
{
+
Handle h;
copydatahandle (&list, &h);
- return (setheapvalue (h, listvaluetype, vreturned));
+ return (setheapvalue (h, listvaluetype, vreturned));
+
}
-
+
#else
return (setheapvalue (list.dataHandle, listvaluetype, vreturned));
-
+
#endif
- error: {
+ error:
disposehandle (hreturnedtext);
disposehandle (htext);
AEDisposeDesc (&list); // 5.0d12 dmb
-
+
if (!fllangerror)
oserror (IACglobals.errorcode);
-
+
return (false);
+
}
#endif
+
} /*parseargsverb*/
@@ -3363,11 +3393,13 @@
//
// on addItemToPageTable (adr) { \xC7adr points to an attribute
//
+
+ //
// 2007-02-23 creedon: support for long odb item names and file paths
//
- Handle lowername, name;
- boolean fl;
+ Handle lowername = nil, name = nil;
+ boolean fl, flReturn = false;
hdldatabaserecord hdb;
tyaddress adr;
tyvaluerecord val;
@@ -3385,7 +3417,7 @@
if ( *name [ 0 ] == '#')
pullfromhandle ( name, 0, 1, NULL );
-
+
// if not defined (adrpagetable^.[name]) {
if (!hashtablesymbolexists (hpagetable, name)) {
@@ -3422,12 +3454,14 @@
hdlhashnode hn;
if (langexternalvaltotable (val, &ht, hnode)) { // should never fail
-
+
for (hn = (**ht).hfirstsort; hn != nil; hn = (**hn).sortedlink)
if (!additemtopagetable (ht, hn, hpagetable))
goto exit;
+
+ flReturn = true;
- return (true);
+ goto exit;
}
}
@@ -3438,32 +3472,32 @@
if (!langassignaddressvalue (hpagetable, name, &adr))
goto exit;
+
+ break;
- break;
-
default:
hdb = tablegetdatabase (htable);
-
+
if (hdb)
dbpushdatabase (hdb);
-
+
fl = copyvaluerecord (val, &val);
-
+
if (hdb)
dbpopdatabase ();
-
+
if (!fl || !strongcoercetostring (&val))
goto exit;
-
+
if (!hashtableassign (hpagetable, name, val))
goto exit;
-
+
exemptfromtmpstack (&val);
break;
}
-
+
// if lowername == "ftpsite" { // dmb: move this into buildpagetableverb
// adrpagetable^.subdirectoryPath = subdirpath;
// adrpagetable^.adrSiteRootTable = nomad}; \xC74.2
@@ -3474,23 +3508,28 @@
// adrpagetable^.indirectTemplate = false;
if ( textHandleEqualsBigstring (lowername, str_template, false )) {
+
+ if ((objecttype == wordvaluetype) || (objecttype == outlinevaluetype)) {
- if ((objecttype == wordvaluetype) || (objecttype == outlinevaluetype)) {
+ if ( langAssignBooleanValueBigstring ( hpagetable, str_indirecttemplate, false ) ) {
- if ( ! langAssignBooleanValueBigstring ( hpagetable, str_indirecttemplate, false ) )
- return (false);
+ flReturn = true;
+ goto exit;
+
+ }
+
// if objecttype == outlinetype {
// adrpagetable^.[name] = adr^}}}};
if (objecttype == outlinevaluetype) {
if (!copyvaluerecord (val, &val))
- return (false);
-
+ goto exit;
+
if (!hashtableassign (hpagetable, name, val))
- return (false);
-
+ goto exit;
+
exemptfromtmpstack (&val);
}
@@ -3498,16 +3537,16 @@
}
}
- return (true);
+ flReturn = true;
exit:
disposehandle ( lowername );
disposehandle ( name );
- return ( false );
+ return ( flReturn );
- } /*additemtopagetable*/
+ } // additemtopagetable
static boolean buildpagetableverb (hdltreenode hparam1, tyvaluerecord *vreturned) {
@@ -3515,11 +3554,13 @@
//
// on buildTable (adrobject, adrpagetable) {
//
- // 2007-02-23 creedon: support for long odb item names and file paths
+
//
+ // 2007-06-20 creedon: support for long odb item names and file paths
+ //
- Handle name, subdirpath;
- boolean fl;
+ Handle name = NULL, subdirpath = NULL;
+ boolean fl = false;
hdlhashnode hn;
hdlhashtable hpagetable, nomadtable;
tyaddress nomad;
@@ -3527,7 +3568,7 @@
#ifdef MACVERSION
byte pc = ':';
-
+
#else
byte pc = '\\';
@@ -3536,21 +3577,21 @@
if (!getvarparam (hparam1, 1, &nomad.ht, &nomad.h))
return (false);
-
+
flnextparamislast = true;
if (!gettablevalue (hparam1, 2, &hpagetable))
return (false);
-
+
// local (nomad = parentOf (adrobject^), subdirpath = "");
if ( ! newemptyhandle ( &subdirpath ) )
return ( false );
-
+
// loop { \xC7pop out to the root looking for #directives
while (true) {
-
+
// local (i);
// if nomad == nil or nomad == @root {
// break};
@@ -3559,7 +3600,7 @@
if ((nomadtable == roottable) || !findinparenttable (nomadtable, &nomad.ht, &nomad.h))
break;
-
+
// for i = 1 to sizeOf (nomad^) {
for (hn = (**nomadtable).hfirstsort; hn != nil; hn = (**hn).sortedlink) {
@@ -3574,39 +3615,51 @@
// if lowername == "ftpsite" { // dmb: pulled this out of additemtopagetable
// adrpagetable^.subdirectoryPath = subdirpath;
// adrpagetable^.adrSiteRootTable = nomad}; \xC74.2
-
- if ( textHandleEqualsBigstring (name, BIGSTRING ("\x08" "#ftpsite"), true ) && !hashTableSymbolExistsBigstring (hpagetable, str_ftpsite)) {
+
+ if ( textHandleEqualsBigstring ( name, BIGSTRING ( "\x08" "#ftpsite" ), true ) && !hashTableSymbolExistsBigstring ( hpagetable, str_ftpsite ) ) {
- if ( ! langassignstringvalue ( hpagetable, NULL, BIGSTRING ( "\x10" "subdirectoryPath" ), subdirpath, NULL ) )
- goto exit;
+ if ( ! langassignstringvalue ( hpagetable, NULL, BIGSTRING ( "\x10" "subdirectoryPath" ), subdirpath, NULL ) ) {
+ disposehandle ( name );
+ disposehandle ( subdirpath );
+
+ return ( false );
+
+ }
+
if ( ! langAssignAddressValueBigstring ( hpagetable, BIGSTRING ( "\x10" "adrSiteRootTable" ), &nomad ) )
goto exit;
- }
+
+ } // if
if (!additemtopagetable (nomadtable, hn, hpagetable))
goto exit;
- }
+
+ } // if
// else {
// break}};
//else
// break;
- }
+ disposehandle ( name );
+ name = NULL;
+
+ } // for
+
// if defined (nomad^.tools) {
// addItemToPageTable (@nomad^.tools)};
if (hashTableLookupNodeBigstring (nomadtable, BIGSTRING ("\x05" "tools"), &hn))
additemtopagetable (nomadtable, hn, hpagetable);
-
+
// if defined (nomad^.glossary) {
// addItemToPageTable (@nomad^.glossary)};
if (hashTableLookupNodeBigstring (nomadtable, BIGSTRING ("\x08" "glossary"), &hn))
additemtopagetable (nomadtable, hn, hpagetable);
-
+
// subdirpath = nameOf (nomad^) + pc + subdirpath;
// nomad = parentOf (nomad^)}
@@ -3621,11 +3674,10 @@
exit:
disposehandle ( name );
- // disposehandle ( subdirpath );
- return ( fl );
-
- } /*buildpagetableverb*/
+ return ( fl );
+
+ } // buildpagetableverb
#ifdef MACVERSION
@@ -3698,8 +3750,9 @@
static boolean rundirectiveverb (hdltreenode hp1, tyvaluerecord *v) {
+
+ /*
- /*
on runDirective (linetext, adrpagetable=@websites.["#data"]) { \xC74.2 -- extracted from renderObject macro
\xC7linetext contains a #directive line
\xC7process the directive and return the name of the directive
@@ -3724,6 +3777,7 @@
if lastdirective == "template" { \xC74.0.2
adrpagetable^.indirectTemplate = true};
return (lastdirective)}
+
*/
Handle s;
@@ -3732,23 +3786,25 @@
if (!getexempttextvalue (hp1, 1, &s))
return (false);
-
+
if (!textcommentdelete (s))
goto error;
-
+
if (!getoptionalpagetablevalue (hp1, 2, &pageinfo.hpagetable))
goto error;
-
+
if (!htmlrundirective (&pageinfo, s, fieldname))
goto error;
-
+
return (setstringvalue (fieldname, v));
error:
+
disposehandle (s);
return (false);
- } /*rundirectiveverb*/
+
+ } // rundirectiveverb
static boolean rundirectivesverb (hdltreenode hp1, tyvaluerecord *v) {
@@ -4399,7 +4455,7 @@
//
// 2007-02-23 creedon: support for long odb item names and file paths
//
-
+
Handle handleName;
hdlhashtable ht;
tyvaluerecord val;
@@ -4408,23 +4464,23 @@
if (!getaddressparam (hp1, 1, &val))
return (false);
-
+
if (!getaddressvalue (val, &ht, &handleName))
return (false);
-
+
if ( *handleName [ 0 ] == '#' ) {
setbooleanvalue (true, v);
-
+
return (true);
}
-
+
lowertext ( *handleName, gethandlesize ( handleName ) );
- if ( textHandleEqualsBigstring (handleName, str_glossary, false )
- || textHandleEqualsBigstring (handleName, str_images, false )
- || textHandleEqualsBigstring (handleName, str_tools, false )) {
+ if ( textHandleEqualsBigstring ( handleName, str_glossary, false )
+ || textHandleEqualsBigstring ( handleName, str_images, false )
+ || textHandleEqualsBigstring ( handleName, str_tools, false ) ) {
setbooleanvalue (true, v);
@@ -4433,14 +4489,14 @@
return (true);
}
-
+
disposehandle ( handleName );
setbooleanvalue (false, v);
-
+
return (true);
-
- } /*traversalskipverb*/
+
+ } // traversalskipverb
static boolean getpagetableaddressverb (hdltreenode hp1, tyvaluerecord *v) {
@@ -4479,11 +4535,13 @@
return (true);
- } /*getpagetableaddressverb*/
+ } // getpagetableaddressverb
#ifdef MACVERSION
-#pragma mark === search indexing ===
+
+ #pragma mark === search indexing ===
+
#endif
static boolean stripmarkup (handlestream *s) {
@@ -4577,21 +4635,21 @@
copyhandle ( handleAddress, &h );
- disablelangerror ();
+ disablelangerror ( );
fl = langexpandtodotparams ( h, &hparent, handlePage ); // h is consumed
- enablelangerror ();
+ enablelangerror ( );
- if (fl) { // an odb address
+ if ( fl ) { // an odb address
+
+ if ( ! findinparenttable ( hparent, &hparent, handleParent ) ) {
- if (!findinparenttable (hparent, &hparent, handleParent)) {
-
if ( ! newemptyhandle ( handleParent ) )
return ( false );
}
- return (true);
+ return ( true );
}
@@ -4602,7 +4660,7 @@
if ( ctwords >= 4 ) {
nthfieldhandle ( handleAddress, '/', ctwords, handlePage );
-
+
nthfieldhandle ( handleAddress, '/', --ctwords, handleParent );
}
@@ -4623,7 +4681,7 @@
fl = pathtofilespec ( handleAddress, &fs );
- if (fl) { // maybe a valid file
+ if ( fl ) { // maybe a valid file
Handle h;
@@ -4639,6 +4697,8 @@
fileFromPathTextHandle ( h, *handleParent );
+ disposehandle ( h );
+
}
enablelangerror ( );
@@ -4701,7 +4761,7 @@
} // isstalepageaddress
-static boolean cleanindextable (hdlhashtable hpages) {
+static boolean cleanindextable ( hdlhashtable hpages ) {
//
// 2007-02-24 creedon: support for long odb item names and file paths
@@ -4716,10 +4776,10 @@
Handle handleAddress;
hdlhashnode hkey, hnext;
- for (hkey = (**hpages).hfirstsort; hkey != nil; hkey = hnext) {
+ for ( hkey = ( **hpages ).hfirstsort; hkey != nil; hkey = hnext ) {
+
+ hnext = ( **hkey ).sortedlink;
- hnext = (**hkey).sortedlink;
-
gethashkey ( hkey, &handleAddress );
if ( isstalepageaddress ( handleAddress ) )
@@ -4736,9 +4796,9 @@
}
- return (true);
+ return ( true );
- } /*cleanindextable*/
+ } // cleanindextable
static boolean deindexpage ( hdlhashtable hindex, Handle handlePageKey ) {
@@ -4817,7 +4877,7 @@
return (true);
- } /*deindexpage*/
+ } // deindexpage
static boolean indexpage ( const Handle handleAddress, bigstring bsurl,
@@ -4825,7 +4885,7 @@
hdlhashtable hstopwords, Handle const handleParent, Handle *handlePage ) {
#pragma unused (bsurl)
-
+
/*
Prepare text to be indexed.
Replace whitespace characters and punctuation with spaces.
@@ -4847,9 +4907,9 @@
if (!deindexpage (hindex, handleAddress))
return (false);
+
+ for ((*s).pos = 0; (*s).pos < (*s).eof; ++(*s).pos) {
- for ((*s).pos = 0; (*s).pos < (*s).eof; ++(*s).pos) {
-
p = (byte *)(*(*s).data + (*s).pos);
switch (*p) { // set chreplace or bsreplace
@@ -4876,28 +4936,28 @@
case '[':
case ']':
*p = chspace;
-
+
default:
break;
}
}
-
+
if (!stripmarkup (s))
return (false);
-
+
p = (unsigned char *)(*(*s).data);
ctwords = textcountwords (p, (*s).eof, chspace, true);
for (ixword = 1; ixword <= ctwords; ++ixword) {
-
+
textnthword (p, (*s).eof, ixword, chspace, true, &offset, &len);
texttostring (p + offset, len, bsword);
-
+
if (getstringcharacter (bsword, 0) == '#') //it's a directive
continue;
-
+
dropnonalphas (bsword);
alllower (bsword);
@@ -4907,28 +4967,28 @@
if (stringlength (bsword) < 3) //we don't index 1- and 2-letter words, except for "op" and "wp"
if (!equalstrings (bsword, BIGSTRING ("\x02" "op")) && !equalstrings (bsword, BIGSTRING ("\x02" "wp")))
continue;
-
+
if ( hashTableSymbolExistsBigstring ( hstopwords, bsword ) ) //check if this is on the list of words not to index
continue; //don't index
-
+
setstringwithchar (getstringcharacter (bsword, 0), bsletter);
if (!isalpha (getstringcharacter (bsletter, 0)))
continue;
-
+
// find the count for this page
if ( ! langSureTableValueBigstring (hindex, bsletter, &hwords)) // each letter table contains word tables
return (false);
-
+
if ( ! langSureTableValueBigstring (hwords, bsword, &hpages)) // each word table contains addresses
return (false);
-
+
if (!hashtablelookup (hpages, handleAddress, &vcount, &hnode)) // this objects count for this word
initvalue (&vcount, longvaluetype); //first occurence of this word in the page
-
+
if (!coercetolong (&vcount)) //make sure it's a number
return (false);
-
+
++vcount.data.longvalue; //one more occurrance
bundle { //do relevancy ranking
@@ -4938,13 +4998,13 @@
if ( textpatternmatch ( *handleAddress, gethandlesize ( handleAddress ), bsword, true ) > 0 )
if (vcount.data.longvalue < 100)
vcount.data.longvalue += 100;
-
+
if ( textpatternmatch ( **handlePage, gethandlesize ( *handlePage ), bsword, true ) > 0)
if (vcount.data.longvalue < 500)
vcount.data.longvalue += 500;
+
+ if ( textHandleEqualsBigstring ( handleParent, bsword, true )) {
- if ( textHandleEqualsBigstring ( handleParent, bsword, true )) {
-
Handle h;
getNthFieldTextHandle ( *handlePage, 1, '.', false, &h );
@@ -4964,14 +5024,14 @@
if (vcount.data.longvalue < 2000)
vcount.data.longvalue += 2000;
}
-
+
if ( ! hashtab...
[truncated message content] |