|
From: <cre...@us...> - 2007-02-26 22:07:55
|
Revision: 1632
http://svn.sourceforge.net/frontierkernel/?rev=1632&view=rev
Author: creecode
Date: 2007-02-26 13:56:01 -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/langwinipc.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/langxml.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/launch.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/memory.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/menuverbs.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/meprograms.h
Frontier/branches/Frontier_Long_File_Paths/Common/source/lang.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/langipc.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langsystypes.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langtree.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/langwinipc.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langxml.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/launch.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/memory.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/menueditor.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/menuverbs.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/meprograms.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/langwinipc.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/langwinipc.h 2007-02-26 21:02:19 UTC (rev 1631)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/langwinipc.h 2007-02-26 21:56:01 UTC (rev 1632)
@@ -26,16 +26,18 @@
******************************************************************************/
#ifndef langwinipcinclude
-#define langwinipcinclude
-boolean langwinipcerrorroutine (bigstring bs, ptrvoid);
+ #define langwinipcinclude
+
+ boolean langwinipcerrorroutine (bigstring bs, ptrvoid);
+
+ //boolean langwinipcbuildparamlist (hdltreenode hcode, DISPPARAMS* pDispParams, hdltreenode *hparams, short * errarg);
+
+ boolean langwinipchandleCOM (bigstring bsscriptname, void * pDispParams, tyvaluerecord * retval, boolean *flfoundhandler, unsigned int * errarg);
+
+ //boolean langwinipccoerceparam (VARIANTARG * var, tyvaluerecord * val);
+
+ boolean langipcrunscript ( const Handle, tyvaluerecord *vparams, hdlhashtable hcontext, tyvaluerecord *vreturned );
-//boolean langwinipcbuildparamlist (hdltreenode hcode, DISPPARAMS* pDispParams, hdltreenode *hparams, short * errarg);
+#endif
-boolean langwinipchandleCOM (bigstring bsscriptname, void * pDispParams, tyvaluerecord * retval, boolean *flfoundhandler, unsigned int * errarg);
-
-//boolean langwinipccoerceparam (VARIANTARG * var, tyvaluerecord * val);
-
-boolean langipcrunscript (bigstring bsscriptname, tyvaluerecord *vparams, hdlhashtable hcontext, tyvaluerecord *vreturned);
-
-#endif
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/langxml.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/langxml.h 2007-02-26 21:02:19 UTC (rev 1631)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/langxml.h 2007-02-26 21:56:01 UTC (rev 1632)
@@ -32,17 +32,20 @@
typedef struct xmladdress {
hdlhashtable ht;
+
bigstring bs;
+
} xmladdress, *ptrxmladdress;
-
+
extern boolean xmlcompile (Handle htext, xmladdress *xmladr);
-extern boolean isxmlmatch (hdlhashnode hn, bigstring name);
+extern boolean isxmlmatch ( hdlhashnode hn, const Handle );
extern boolean xmlgetname (bigstring bsname);
-extern boolean xmlgetattribute (hdlhashtable ht, bigstring name, hdlhashtable *adratts);
+extern boolean xmlgetattribute ( hdlhashtable ht, const Handle, hdlhashtable *adratts );
extern boolean gethashnodetable (hdlhashnode hn, hdlhashtable *ht);
-extern boolean replaceallinhandle (bigstring bsfind, bigstring bsreplace, Handle htext);
\ No newline at end of file
+extern boolean replaceallinhandle (bigstring bsfind, bigstring bsreplace, Handle htext);
+
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/launch.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/launch.h 2007-02-26 21:02:19 UTC (rev 1631)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/launch.h 2007-02-26 21:56:01 UTC (rev 1632)
@@ -46,7 +46,7 @@
extern tylaunchcallbacks launchcallbacks;
-/*prototypes*/
+// prototypes
extern boolean launchapplication (const ptrfilespec, const ptrfilespec, boolean flbringtofront);
@@ -54,7 +54,7 @@
extern boolean activateapplication (bigstring);
-extern boolean getfrontapplication (bigstring, boolean);
+extern boolean getfrontapplication ( Handle, boolean );
extern short countapplications (void);
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/memory.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/memory.h 2007-02-26 21:02:19 UTC (rev 1631)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/memory.h 2007-02-26 21:56:01 UTC (rev 1632)
@@ -53,7 +53,9 @@
#if (MEMTRACKER != 1)
- /*function prototypes*/
+
+ // function prototypes
+
extern boolean newhandle (long, Handle *);
extern boolean newemptyhandle (Handle *);
@@ -64,6 +66,8 @@
extern boolean newfilledhandle (ptrvoid, long, Handle *);
+ extern boolean newFilledHandleFromCStringConstant ( char *, Handle );
+
#ifdef flnewfeatures
extern boolean newgrowinghandle (long, Handle *);
#endif
@@ -301,11 +305,19 @@
extern void disposehandlestream (handlestream *s);
+extern boolean insertCharInTextHandle ( char, long, Handle );
-
extern boolean initmemory (void);
-#endif
+extern long searchForCharacterInTextHandle ( Handle, char, long );
+extern boolean pushLongHandle ( long, Handle );
+extern boolean pushIntHandle ( short, Handle );
+extern boolean textHandleEqualsBigstring ( Handle, const bigstring, boolean );
+
+extern boolean setTextHandleFromBigstring ( const bigstring, Handle );
+
+#endif
+
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/menuverbs.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/menuverbs.h 2007-02-26 21:02:19 UTC (rev 1631)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/menuverbs.h 2007-02-26 21:56:01 UTC (rev 1632)
@@ -67,7 +67,7 @@
extern boolean menuverbsettimes (hdlexternalvariable, long, long);
-extern boolean menuverbfindusedblocks (hdlexternalvariable, bigstring);
+extern boolean menuverbfindusedblocks ( hdlexternalvariable, const Handle );
extern boolean menuverbfind (hdlexternalvariable, boolean *);
@@ -79,9 +79,9 @@
extern boolean menuverbnew (Handle, hdlexternalvariable *);
-extern boolean menunewmenubar (hdlhashtable, bigstring, hdlmenurecord *);
+extern boolean menunewmenubar ( hdlhashtable, const Handle, hdlmenurecord * );
-extern boolean menugetmenubar (hdlhashtable, bigstring, boolean, hdlmenurecord *);
+extern boolean menugetmenubar ( hdlhashtable, const Handle, boolean, hdlmenurecord * );
extern boolean editnamedmenubar (hdlhashtable, bigstring);
@@ -89,4 +89,3 @@
extern boolean menustart (void);
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/meprograms.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/meprograms.h 2007-02-26 21:02:19 UTC (rev 1631)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/meprograms.h 2007-02-26 21:56:01 UTC (rev 1632)
@@ -28,14 +28,15 @@
#define meprogramsinclude
-/*prototypes*/
+// prototypes
-extern boolean mescripterrorroutine (long, long, short, hdlhashtable *htable, bigstring); /*meprograms.c*/
+#pragma mark === meprograms.c ===
+extern boolean mescripterrorroutine (long, long, short, hdlhashtable *htable, Handle * );
+
extern boolean megetnodelangtext (hdlheadrecord, Handle *, long *);
extern boolean meshownode (hdlheadrecord);
extern boolean meuserselected (hdlheadrecord);
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/lang.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/lang.c 2007-02-26 21:02:19 UTC (rev 1631)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/lang.c 2007-02-26 21:56:01 UTC (rev 1632)
@@ -1163,7 +1163,7 @@
overriding its current chain. (our own scope chain becomes superflous.)
*/
- register boolean boolean fl, flchained = false, flscriptwasrunning = flscriptrunning;
+ register boolean fl, flchained = false, flscriptwasrunning = flscriptrunning;
register hdlhashtable ht = hcontext;
if (htree == nil) /*defensive driving*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langexternal.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langexternal.c 2007-02-26 21:02:19 UTC (rev 1631)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langexternal.c 2007-02-26 21:56:01 UTC (rev 1632)
@@ -1345,6 +1345,7 @@
hdlhashnode x;
hdlhashtable pht;
hdlwindowinfo hinfo;
+ short i = 0;
pht = nil;
@@ -1476,6 +1477,8 @@
while (x != nil) { // chain through the hash list
+ ++i;
+
fltempload = false;
++fullpathloopcount;
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langhash.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langhash.c 2007-02-26 21:02:19 UTC (rev 1631)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langhash.c 2007-02-26 21:56:01 UTC (rev 1632)
@@ -1151,11 +1151,12 @@
// 2007-02-23 creedon: support for long odb item names and file paths
//
- register Handle h;
register hdlhashnode hn = hnode, hnext;
register hdlhashtable ht = htable;
register short ixbucket;
+ Handle h;
+
gethashkey ( hn, &h );
ixbucket = hashfunction ( h );
@@ -2312,9 +2313,10 @@
// and tableverbpacktotext
//
- register Handle handleName;
register hdlhashnode nomad = (**htable).hfirstsort;
+ Handle handleName;
+
while (nomad != nil) {
gethashkey ( nomad, &handleName );
@@ -4158,8 +4160,7 @@
// 2007-02-23 creedon: created, used to be a macro
//
- register Handle h;
-
+ Handle h;
long length;
short s;
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langhtml.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langhtml.c 2007-02-26 21:02:19 UTC (rev 1631)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langhtml.c 2007-02-26 21:56:01 UTC (rev 1632)
@@ -7899,7 +7899,7 @@
static boolean mrcalendargetaddressdayverb (hdltreenode hp1, tyvaluerecord *v) {
-
+
Handle htext;
unsigned long date;
@@ -7907,11 +7907,12 @@
if(!getexempttextvalue (hp1, 1, &htext))
return (false);
-
+
if (!mrcalendargetaddressday (htext, &date))
return (false);
-
+
return (setdatevalue (date, v));
+
}/*mrcalendargetaddressdayverb*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langipc.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langipc.c 2007-02-26 21:02:19 UTC (rev 1631)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langipc.c 2007-02-26 21:56:01 UTC (rev 1632)
@@ -2562,6 +2562,8 @@
if (!getvarvalue (hp1, 1, &htable, &handleName, &listval, &hnode)) /*the list*/
return (false);
+ // disposehandle ( handleName );
+
if (!getbinarylistdesc (false, listval, &listdesc))
return (false);
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langsystypes.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langsystypes.c 2007-02-26 21:02:19 UTC (rev 1631)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langsystypes.c 2007-02-26 21:56:01 UTC (rev 1632)
@@ -43,6 +43,7 @@
#ifdef MACVERSION
+ #include <sys/param.h>
#include "MoreFilesX.h" // 2006-10-25 creedon
#endif // MACVERSION
@@ -159,29 +160,39 @@
-static boolean findvaluevisit (bigstring bs, hdlhashnode hnode, tyvaluerecord val, ptrvoid valfind) {
-#pragma unused (bs, hnode)
+static boolean findvaluevisit ( Handle *h, hdlhashnode hnode, tyvaluerecord val, ptrvoid valfind) {
- return (val.data.longvalue == (long) valfind); //.data.longvalue
+ #pragma unused (h, hnode)
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+
+ return (val.data.longvalue == (long) valfind); //.data.longvalue
+
} /*findvaluevisit*/
-static boolean langfindvalue (tyvaluerecord val, hdlhashtable *htable, bigstring bsname) {
+static boolean langfindvalue (tyvaluerecord val, hdlhashtable *htable, Handle *handleName ) {
+
+ //
+ // search through the stack of symbol tables until you find a value that
+ // matches val. return the name of the matching value.
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
- /*
- search through the stack of symbol tables until you find a value that
- matches val. return the name of the matching value.
- */
-
register hdlhashtable h = currenthashtable;
register long refcon;
register short n;
+
+ hdlhashnode hnode;
long valfind;
- hdlhashnode hnode;
*htable = nil;
- setemptystring (bsname);
+ if ( ! newemptyhandle ( handleName ) )
+ return ( false );
if (h == nil)
return (false);
@@ -197,68 +208,76 @@
if ((!(**h).fllocaltable) || (refcon == 0) || ((**h).lexicalrefcon == refcon)) {
- if (hashinversesearch (h, &findvaluevisit, (ptrvoid) valfind, bsname)) { /*symbol is defined in htable*/
+ if ( hashinversesearch ( h, &findvaluevisit, ( ptrvoid ) valfind, handleName ) ) { // symbol is defined in htable
*htable = h;
return (true);
+
}
for (n = (**h).ctwithvalues; n > 0; --n) { /*scan with values*/
tyvaluerecord valwith;
hdlhashtable hwith;
- bigstring bswith;
+ Handle handleWith;
- langgetwithvaluename (n, bswith);
+ langgetwithvaluename ( n, &handleWith );
- if (!hashtablelookup (h, bswith, &valwith, &hnode)) /*missing with value; keep going*/
+ if ( ! hashtablelookup (h, handleWith, &valwith, &hnode)) /*missing with value; keep going*/
continue;
- if (!getaddressvalue (valwith, &hwith, bswith)) /*error*/
+ if (!getaddressvalue (valwith, &hwith, &handleWith )) /*error*/
return (false);
- if (hashinversesearch (hwith, &findvaluevisit, (ptrvoid) valfind, bsname)) { /*found symbol*/
+ if (hashinversesearch (hwith, &findvaluevisit, (ptrvoid) valfind, handleName)) { /*found symbol*/
*htable = hwith;
return (true);
+
}
}
}
h = (**h).prevhashtable;
+
} /*while*/
+
} /*langfindvalue*/
-static boolean getostypevalnamevisit (bigstring bsname, hdlhashnode hnode, tyvaluerecord val, ptrvoid refcon) {
-#pragma unused (hnode)
+static boolean getostypevalnamevisit ( Handle *handleName, hdlhashnode hnode, tyvaluerecord val, ptrvoid refcon ) {
- /*
- 3.0.2b1 dmb: we now look in all loaded app tables for a match when
- converting an terminology value (a string4 value) its name
- */
+ #pragma unused (hnode)
- tyvaluerecord *vallookfor = (tyvaluerecord *) refcon;
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 3.0.2b1 dmb: we now look in all loaded app tables for a match when
+ // converting an terminology value (a string4 value) its name
+ //
+
+ register boolean fltempload;
+ register hdlhashtable ht;
register hdltablevariable hv;
- register hdlhashtable ht;
- register boolean fltempload;
+
+ boolean fl;
hdlhashtable htable;
hdltablevariable hvariable;
short errorcode;
- boolean fl;
+ tyvaluerecord *vallookfor = (tyvaluerecord *) refcon;
if (!gettablevariable (val, &hvariable, &errorcode))
return (false);
-
+
hv = hvariable;
fltempload = !(**hv).flinmemory;
if (fltempload) /*we don't want to search every app table, just those in use*/
return (false);
-
+
/*
if (!tableverbinmemory ((hdlexternalvariable) hv))
return (false);
@@ -268,10 +287,10 @@
if (ht == currenthashtable) /*it's already been searched*/
return (false);
-
+
pushhashtable (ht);
- fl = langfindvalue (*vallookfor, &htable, bsname);
+ fl = langfindvalue ( *vallookfor, &htable, handleName );
pophashtable ();
@@ -281,129 +300,161 @@
*/
return (fl);
+
} /*getostypevalnamevisit*/
-static boolean getostypedisplaystring (OSType key, bigstring bsdisplay) {
+static boolean getostypedisplaystring ( OSType key, bigstring bsdisplay ) {
+
+ //
+ // key is an enum or string4 value that may correspond to a bit of object
+ // model user terminology. our job is to scan the current context for a
+ // match, and return the symbolic name if found. otherwise, return a
+ // string4 in single quotes
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 5.0.2b16 dmb: don't return "id" as a string4 displaystring
+ //
+ // 2.1b6 dmb: if result is a quoted literal, add escape sequences
+ //
- /*
- key is an enum or string4 value that may correspond to a bit of
- object model user terminology. our job is to scan the current context
- for a match, and return the symbolic name if found. otherwise, return
- a string4 in single quotes
-
- 2.1b6 dmb: if result is a quoted literal, add escape sequences
-
- 5.0.2b16 dmb: don't return "id" as a string4 displaystring
- */
-
+ Handle h;
+ boolean fl;
+ byte bskey [ 16 ];
+ hdlhashtable htable;
tyvaluerecord val;
- hdlhashtable htable;
- byte bskey [16];
- boolean fl;
setostypevalue (key, &val);
- if (langfindvalue (val, &htable, bsdisplay))
+ if ( langfindvalue ( val, &htable, &h ) )
goto exit;
+
+ if (objectmodeltable != nil) {
- if (objectmodeltable != nil) {
+ disposehandle ( h );
pushhashtable (objectmodeltable);
- fl = langfindvalue (val, &htable, bsdisplay);
+ fl = langfindvalue ( val, &htable, &h );
pophashtable ();
if (fl)
goto exit;
}
+
+ if (iacgluetable != nil) {
- if (iacgluetable != nil) {
+ disposehandle ( h );
- //vallookfor = val;
-
- if (hashinversesearch (iacgluetable, &getostypevalnamevisit, &val, bsdisplay))
+ if ( hashinversesearch ( iacgluetable, &getostypevalnamevisit, &val, &h ) )
goto exit;
}
-
+
exit:
- if (!isemptystring (bsdisplay) && !equalstrings (bsdisplay, BIGSTRING ("\x02" "id")))
- return (true);
+ texthandletostring ( h, bsdisplay );
+
+ disposehandle ( h );
+
+ fl = ! isemptystring ( bsdisplay ) && ! equalstrings ( BIGSTRING ( "\x02" "id" ), bsdisplay );
+
+ if ( fl )
+ return (true);
+
+ ostypetostring (key, bskey);
+
+ langdeparsestring (bskey, chsinglequote); /*add needed escape sequences*/
+
+ parsedialogstring ( BIGSTRING ( "\x04'^0'" ), bskey, nil, nil, nil, bsdisplay );
+
+ return (false);
- ostypetostring (key, bskey);
-
- langdeparsestring (bskey, chsinglequote); /*add needed escape sequences*/
-
- parsedialogstring (BIGSTRING ("\x04'^0'"), bskey, nil, nil, nil, bsdisplay);
-
- return (false);
} /*getostypedisplaystring*/
static boolean getlimitedvaluestring (tyvaluerecord *val, short limit, char chquote, bigstring bsvalue) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 2.1b3 dmb: if binary ends up needing to be coerced to string, add quotes
+ // and escape sequences
+ //
+ // 2.1b2 dmb: try using AE coercion for unknown (binary) types
+ //
- /*
- 2.1b2 dmb: try using AE coercion for unknown (binary) types
+ register tyvaluerecord *v = val;
- 2.1b3 dmb: if binary ends up needing to be coerced to string, add quotes
- and escape sequences
- */
+ Handle h;
+ long length;
- register tyvaluerecord *v = val;
+ #ifdef MACVERSION
-#ifdef MACVERSION
- AEDesc desc, coerceddesc;
- OSErr err;
+ AEDesc desc, coerceddesc;
+ OSErr err;
- if ((*v).valuetype == binaryvaluetype) {
-
- binarytodesc ((*v).data.binaryvalue, &desc); /*binary handle remains in temp stack*/
-
- err = AECoerceDesc (&desc, typeChar, &coerceddesc);
-
- if (err == noErr)
- chquote = chdoublequote;
- else
- err = AECoerceDesc (&desc, typeObjectSpecifier, &coerceddesc);
-
- if (err != noErr) /*no AE coercion to objspec*/
- err = AECoerceDesc (&desc, typeAERecord, &coerceddesc);
-
- if (err != noErr) { /*no AE coercion to record either*/
+ if ((*v).valuetype == binaryvaluetype) {
- chquote = chdoublequote;
+ binarytodesc ((*v).data.binaryvalue, &desc); /*binary handle remains in temp stack*/
- /*
- hashgetvaluestring (*v, bsvalue); /%go with hex string%/
+ err = AECoerceDesc (&desc, typeChar, &coerceddesc);
- goto limit;
- */
- }
- else {
+ if (err == noErr)
+ chquote = chdoublequote;
+ else
+ err = AECoerceDesc (&desc, typeObjectSpecifier, &coerceddesc);
- disposevaluerecord (*v, true);
+ if (err != noErr) /*no AE coercion to objspec*/
+ err = AECoerceDesc (&desc, typeAERecord, &coerceddesc);
- if (!setdescriptorvalue (coerceddesc, v))
- return (false);
+ if (err != noErr) { /*no AE coercion to record either*/
+
+ chquote = chdoublequote;
+
+ /*
+ hashgetvaluestring (*v, bsvalue); /%go with hex string%/
+
+ goto limit;
+ */
+
+ }
+ else {
+
+ disposevaluerecord (*v, true);
+
+ if (!setdescriptorvalue (coerceddesc, v))
+ return (false);
+ }
}
- }
-#endif
-
+ #endif
+
if (!coercetostring (v))
return (false);
+
+ copyhandle ( ( *v ).data.stringvalue, &h );
- pullstringvalue (v, bsvalue);
+ length = gethandlesize ( h );
+ if ( length > 255 ) // trim from the middle
+ pullfromhandle ( h, 128, length - 255, NULL );
+
+ texthandletostring ( h, bsvalue );
+
+ disposehandle ( h );
+
if (chquote != chnul)
langdeparsestring (bsvalue, chquote); /*add needed escape sequences*/
+
+ length = stringlength ( bsvalue );
- if (stringlength (bsvalue) > limit) {
+ if ( length > limit ) {
- setstringlength (bsvalue, limit - stringlength (bsellipses));
+ short ct = length - limit - stringlength ( bsellipses );
- pushstring (bsellipses, bsvalue);
+ deletestring ( bsvalue, ( length / 2 ) - ( ct / 2 ), ct );
+
}
if (chquote != chnul) {
@@ -411,9 +462,11 @@
insertchar (chquote, bsvalue);
pushchar (chquote, bsvalue);
+
}
return (true);
+
} /*getlimitedvaluestring*/
@@ -437,41 +490,51 @@
switch ((*v).valuetype) {
case novaluetype:
- langgetmiscstring (justnilstring, bsdisplay);
+
+ langgetmiscstring ( justnilstring, bsdisplay, NULL );
break;
case ostypevaluetype:
case enumvaluetype:
- getostypedisplaystring ((*v).data.ostypevalue, bsdisplay);
+
+ getostypedisplaystring ( ( *v ).data.ostypevalue, bsdisplay );
break;
case charvaluetype: /*these need single quotes*/
+
if (!getlimitedvaluestring (v, 251, chsinglequote, bsdisplay))
return (false);
break;
case stringvaluetype: /*these need to be quoted*/
+
#ifndef version5orgreater
+
case addressvaluetype:
+
#endif
+
case filespecvaluetype:
case aliasvaluetype:
case datevaluetype:
+
if (!getlimitedvaluestring (v, 251, chdoublequote, bsdisplay))
return (false);
break;
#ifdef version5orgreater
+
case addressvaluetype:
+
if (!getlimitedvaluestring (v, 251, chnul, bsdisplay))
return (false);
if (isemptystring (bsdisplay))
- langgetmiscstring (justnilstring, bsdisplay);
+ langgetmiscstring ( justnilstring, bsdisplay, NULL );
else
insertchar ('@', bsdisplay);
@@ -481,6 +544,7 @@
case pointvaluetype: /*these should look like lists*/
case rectvaluetype:
case rgbvaluetype:
+
if (!getlimitedvaluestring (v, 251, chnul, bsdisplay))
return (false);
@@ -491,6 +555,7 @@
break;
case objspecvaluetype:
+
if (!getlimitedvaluestring (v, 253, chnul, bsdisplay))
return (false);
@@ -500,6 +565,7 @@
break;
default:
+
if (!getlimitedvaluestring (v, 253, chnul, bsdisplay))
return (false);
@@ -507,58 +573,130 @@
}
return (true);
+
} /*getobjectmodeldisplaystring*/
#ifdef MACVERSION
-static boolean stringtoalias (tyvaluerecord *val) {
-
- //
- // 2006-06-24 creedon: FSRef-ized
- //
- // 2.1b2 dmb: try converting to a filespec first to ensure that partial path or
- // drive number if processed properly. also, in the filespec case, the alias isn't
- // minimal
- //
- // 1992-07-23 dmb: OK, try to getfullfilepath, but with errors disabled
- //
- // 1992-07-02 dmb: don't call getfullfilepath; makes it impossible to create aliases of
- // not-yet-existing files, or offline volumes
- //
- // 1991-10-07 dmb: make sure we're actually passing a full path to the NewAlias routine
- //
-
- register Handle htext;
- bigstring bspath;
- tyfilespec fs;
- AliasHandle halias;
- boolean flfolder;
- OSErr errcode;
-
- if (!langcanusealiases ())
- return (false);
-
- htext = (*val).data.stringvalue;
-
- texthandletostring (htext, bspath);
-
- if (pathtofilespec (bspath, &fs) && fileexists (&fs, &flfolder))
- errcode = FSNewAlias (nil, &fs.fsref, &halias);
- else
- errcode = NewAliasMinimalFromFullPath (stringlength (bspath), bspath + 1, nil, nil, &halias);
-
- if (oserror (errcode))
- return (false);
-
- if (!setheapvalue ((Handle) halias, aliasvaluetype, val))
- return (false);
-
- releaseheaptmp ((Handle) htext);
-
- return (true);
- } /*stringtoalias*/
+ static boolean stringtoalias ( tyvaluerecord *val ) {
+
+ //
+ // 2006-06-24 creedon: FSRef-ized
+ //
+ // 2.1b2 dmb: try converting to a filespec first to ensure that partial path or
+ // drive number if processed properly. also, in the filespec case, the alias isn't
+ // minimal
+ //
+ // 1992-07-23 dmb: OK, try to getfullfilepath, but with errors disabled
+ //
+ // 1992-07-02 dmb: don't call getfullfilepath; makes it impossible to create aliases of
+ // not-yet-existing files, or offline volumes
+ //
+ // 1991-10-07 dmb: make sure we're actually passing a full path to the NewAlias routine
+ //
+
+ AliasHandle halias;
+ OSErr err;
+ register Handle htext;
+ tyfilespec fs;
+
+ clearbytes ( &fs, sizeof ( fs ) );
+
+ if ( ! langcanusealiases ( ) )
+ return ( false );
+
+ htext = ( *val ).data.stringvalue;
+
+ if ( pathtofilespec ( htext, &fs ) && extendfilespec ( &fs, &fs ) )
+ err = FSNewAlias ( nil, &fs.fsref, &halias );
+
+ else {
+
+ Handle hFolder, hFile;
+
+ if ( ! copyhandle ( htext, &hFolder ) )
+ return ( false );
+
+ inserttextinhandle ( hFolder, 0, BIGSTRING ( "\x09" ":Volumes:" ) );
+
+ popFromPathTextHandle ( hFolder, &hFile, NULL );
+
+ /* convert hFolder to / delimited path */ {
+
+ long ix = 0, slashpos [ 255 ];
+ unsigned char ixSlashPos = 0;
+
+ while ( ( ix = searchForCharacterInTextHandle ( hFolder, '/', ix ) ) != -1 )
+ slashpos [ ixSlashPos++ ] = ix++;
+
+ stringfindreplace ( BIGSTRING ( "\x01" ":" ), BIGSTRING ( "\x01" "/" ), hFolder, true, false );
+
+ while ( ixSlashPos > 0 )
+ setHandleCharacter ( hFolder, slashpos [ --ixSlashPos ], ':' );
+ }
+
+ /* convert hFolder from Mac Roman to UTF-8 */ {
+
+ CFStringRef cfsr = CFStringCreateWithBytes ( kCFAllocatorDefault, *hFolder,
+ ( CFIndex ) gethandlesize ( hFolder ), kCFStringEncodingMacRoman, false );
+
+ CFIndex cfi = CFStringGetMaximumSizeForEncoding ( CFStringGetLength ( cfsr ),
+ kCFStringEncodingUTF8 );
+
+ sethandlesize ( hFolder, ++cfi ); // resize hFolder plus one for c string terminator
+
+ CFStringGetCString ( cfsr, *hFolder, cfi, kCFStringEncodingUTF8 );
+
+ CFRelease ( cfsr );
+
+ }
+
+ err = FSPathMakeRef ( *hFolder, &fs.fsref, NULL );
+
+ if ( err == noErr ) {
+
+ CFStringRef cfsr = CFStringCreateWithBytes ( kCFAllocatorDefault, *hFile,
+ ( CFIndex ) gethandlesize ( hFile ), kCFStringEncodingMacRoman, false );
+ CFIndex length = CFStringGetLength ( cfsr );
+ CFRange range = CFRangeMake ( 0, length );
+ CFIndex maxLength = CFStringGetMaximumSizeForEncoding ( length, kCFStringEncodingUnicode );
+
+ UInt8 buffer [ maxLength ];
+
+ CFIndex used;
+
+ length = CFStringGetBytes ( cfsr, range,
+ kCFStringEncodingUnicode, 0, false, buffer, maxLength, &used );
+
+ /* if ( ( *output ).length == 0 )
+ return ( false ); */
+
+ CFRelease ( cfsr );
+
+ err = FSNewAliasMinimalUnicode ( &fs.fsref, length, ( UniChar * ) &buffer, &halias, false );
+
+ if ( err == fnfErr )
+ err = noErr;
+ }
+
+ disposehandle ( hFile );
+ disposehandle ( hFolder );
+ }
+
+ if ( oserror ( err ) )
+ return ( false );
+
+ if ( ! setheapvalue ( ( Handle ) halias, aliasvaluetype, val ) )
+ return ( false );
+
+ releaseheaptmp ( ( Handle ) htext );
+
+ return ( true );
+
+ } // stringtoalias
+
#endif
@@ -580,7 +718,7 @@
if ( ( *fs ).path == NULL ) {
- if (flminimal)
+ if ( flminimal )
err = FSNewAliasMinimal ( &( *fs ).fsref, halias);
else
err = FSNewAlias (nil, &( *fs ).fsref, halias);
@@ -589,33 +727,35 @@
flcreatefrompath = true;
if ( ( err == fnfErr ) || flcreatefrompath ) { // alias manager isn't friendly enough to do anything for us here
+
+ HFSUniStr255 name;
- HFSUniStr255 name;
-
- CFStringRefToHFSUniStr255 ( ( *fs ).path, &name );
-
+ if ( CFStringRefToHFSUniStr255 ( ( *fs ).path, &name ) )
err = FSNewAliasMinimalUnicode ( &( *fs ).fsref, name.length, name.unicode, halias, NULL );
+ else
+ err = bdNamErr;
}
-
- if (err == noErr)
- return (true);
-
- if (langerrorenabled ()) {
+ if ( err == noErr || err == fnfErr )
+ return ( true );
+
+ if ( langerrorenabled ( ) ) {
+
setfserrorparam ( fs );
- oserror (err);
+ oserror ( err );
+
}
+
+ return ( false );
- return (false);
-
#endif
-
+
#ifdef WIN95VERSION
- langparamerror (unimplementedverberror, bsfunctionname);
+ langParamErrBs ( unimplementedverberror, handleFunctionName );
- return (false);
+ return ( false );
#endif
@@ -656,96 +796,79 @@
#endif
-boolean aliastostring (Handle halias, bigstring bs) {
+boolean aliasToTextHandle ( Handle halias, Handle handlePath ) {
#ifdef MACVERSION
-
+
//
- // 2006-07-26 creedon: FSRef-ized
+ // 2006-11-27 creedon: created, cribbed from aliastostring function
//
- // 1996-04-26 dmb: restored FollowFinderAlias code; must use if we get fnfErr.
- //
- // 2.1b9 dmb: use FollowFinderAlias to avoid mounting volumes during alias resolution
- //
- // 1993-04-12 dmb: accept fnfErr result from ResolveAlias
- //
- // 1991-10-04 dmb: if alias can't be resolved, just say what volume it's on.
- //
- register AliasHandle h = (AliasHandle) halias;
- short flchanged;
+ OSErr err;
+ boolean flchanged;
+ register AliasHandle h = ( AliasHandle ) halias;
tyfilespec fs;
- bigstring bsinfo;
- AliasInfoType ix = asiAliasName;
- OSErr err;
+ if ( ! langcanusealiases ( ) )
+ return ( false );
+
clearbytes ( &fs, sizeof ( fs ) );
- if (!langcanusealiases ())
- return (false);
+ err = FSResolveAlias ( NULL, h, &fs.fsref, &flchanged );
- err = FSFollowFinderAlias (nil, h, false, &fs.fsref, (Boolean *) &flchanged);
+ if ( ( err == noErr ) )
+ return ( filespectopath ( &fs, &handlePath ) );
- if ((err == noErr) /* || (err == fnfErr) */ ) {
+ CFIndex cfi;
+ CFStringRef csr = NULL;
+ HFSUniStr255 targetName, volumeName;
+ OSStatus status;
+
+ status = FSCopyAliasInfo ( h, &targetName, &volumeName, &csr, NULL, NULL );
+
+ if ( status != noErr )
+ return ( false );
- if (flchanged)
- FSUpdateAlias (nil, &fs.fsref, h, (Boolean *) &flchanged);
-
- return (filespectopath (&fs, bs));
- }
+ if ( csr == NULL ) {
- langgettypestring (aliasvaluetype, bs);
+ CFStringRef separator = CFSTR ( ":" );
- /*
- if (GetAliasInfo (h, asiVolumeName, bsinfo) == noErr) { //add the volume name
+ CFMutableStringRef cmsr = CFStringCreateMutable ( kCFAllocatorDefault, 0 );
- bigstring bsaliasondisk;
+ CFStringAppendCharacters ( cmsr, volumeName.unicode, volumeName.length );
- langgetstringlist (unresolvedaliasstring, bsaliasondisk);
+ CFStringAppend ( cmsr, separator );
- parsedialogstring (bsaliasondisk, bs, bsinfo, nil, nil, bsaliasondisk);
+ CFStringAppendCharacters ( cmsr, targetName.unicode, targetName.length );
- copystring (bsaliasondisk, bs);
- }
- */
-
- setemptystring (bs);
-
- // get each path element out of the alias
- while (GetAliasInfo (h, ix, bsinfo) == noErr) {
+ csr = CFStringCreateCopy ( kCFAllocatorDefault, cmsr );
- if (isemptystring (bsinfo)) // reached top of path hierarchy
- break;
+ CFRelease ( cmsr );
+ CFRelease ( separator );
- if (ix > asiAliasName)
- pushchar (':', bsinfo);
+ }
- if (!insertstring (bsinfo, bs))
- break;
-
- ++ix;
- }
+ cfi = CFStringGetLength ( csr );
- // add the volume name
- GetAliasInfo (h, asiVolumeName, bsinfo);
+ sethandlesize ( handlePath, cfi );
- pushchar (':', bsinfo);
+ CFStringGetBytes ( csr, CFRangeMake ( 0, cfi ), kCFStringEncodingMacRoman, '^', false, *handlePath, cfi, NULL );
- insertstring (bsinfo, bs);
+ CFRelease ( csr );
- return (true);
+ return ( true );
#endif
#ifdef WIN95VERSION
- langparamerror (unimplementedverberror, bsfunctionname);
+ langParamErrBs ( unimplementedverberror, handleFunctionName );
- return (false);
+ return ( false );
#endif
- } // aliastostring
+ } // aliasToTextHandle
boolean aliastofilespec ( AliasHandle halias, ptrfilespec fs ) {
@@ -802,7 +925,7 @@
HFSUniStr255ToStr255 ( &targetName, bs );
else {
- langgetmiscstring ( unknownstring, bs );
+ langgetmiscstring ( unknownstring, bs, NULL );
}
@@ -822,7 +945,7 @@
#ifdef WIN95VERSION
- langparamerror (unimplementedverberror, bsfunctionname);
+ langParamErrBs ( unimplementedverberror, handleFunctionName);
return (false);
@@ -875,7 +998,7 @@
#endif
#ifdef WIN95VERSION
- langparamerror (unimplementedverberror, bsfunctionname);
+ langParamErrBs ( unimplementedverberror, handleFunctionName);
return (false);
#endif
@@ -888,58 +1011,61 @@
// add v2 to the filespec v1 by using it as a partial path. if anything but a valid
// fspec results, return a string value that is simple concatenation
//
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
// 2006-10-29 creedon: for Mac, if bs ends with ':', pop leading ':' from bsadd
//
// 2006-10-16 creedon: for Mac, FSRef-ized
//
- // 2.1b6 dmb: if resulting specifier exists, but doesn't agree with bsadd as far as
- // whether or not it's a folder, return a string.
+ // 2.1b6 dmb: if resulting specifier exists, but doesn't agree with bsadd
+ // as far as whether or not it's a folder, return a string.
//
// 2.1b3 dmb: if resulting path is to a non-existent folder, don't return a filespec
//
#ifdef MACVERSION
+ Handle hPath, handleV1Path;
OSStatus status;
- bigstring bs, bsadd, bsv1path;
boolean flfolder; // unused
tyfilespec fs;
+
+ if ( ! newemptyhandle ( &hPath ) )
+ return ( false );
fs = **( *v1 ).data.filespecvalue;
( void ) extendfilespec ( &fs, &fs );
-
- filespectopath ( &fs, bs );
- copystring ( bs, bsv1path );
+ filespectopath ( &fs, &hPath );
- if ( ! coercetostring ( v2 ) )
+ copyhandle ( hPath, &handleV1Path );
+
+ if ( ! coerceToTextHandle ( v2 ) )
return ( false );
- pullstringvalue ( v2, bsadd );
+ if ( textHandleLastChar ( hPath ) == ':' )
+ handlepopleadingchars ( ( *v2 ).data.stringvalue, ':' );
+
+ pushhandle ( ( *v2 ).data.stringvalue, hPath );
- if ( lastchar ( bs ) == ':' )
- popleadingchars ( bsadd, ':' );
+ inserttextinhandle ( hPath, 0L, BIGSTRING ( "\x09" ":Volumes:" ) );
- insertstring ( bs, bsadd );
+ stringfindreplace ( BIGSTRING ( "\x01" ":" ), BIGSTRING ( "\x01" "/" ), hPath, true, false );
- copystring ( bsadd, bs );
-
- insertstring ( BIGSTRING ( "\x09" ":Volumes:" ), bs );
-
- stringreplaceall ( ':', '/', bs );
-
/* convert from Mac Roman to UTF-8 */ {
- CFStringRef csr = CFStringCreateWithPascalString ( kCFAllocatorDefault, bs, kCFStringEncodingMacRoman );
+ boolean fl;
- CFStringGetCString ( csr, ( char * ) bs, sizeof ( bs ), kCFStringEncodingUTF8 );
+ CFStringRef csr = CFStringCreateWithCString ( kCFAllocatorDefault, *hPath, kCFStringEncodingMacRoman );
+
+ fl = CFStringGetCString ( csr, *hPath, gethandlesize ( hPath ) + 1, kCFStringEncodingUTF8 );
CFRelease ( csr );
}
- status = FSPathMakeRef ( bs, &fs.fsref, &flfolder );
+ status = FSPathMakeRef ( *hPath, &fs.fsref, &flfolder );
if ( status == noErr ) {
@@ -956,13 +1082,20 @@
( void ) extendfilespec ( *( *v1 ).data.filespecvalue, *( *v1 ).data.filespecvalue );
- if ( ! coercetostring ( v1 ) )
+ if ( ! coercetostring ( v1 ) ) {
+
+ disposehandle ( hPath );
+
return ( false );
+
+ }
return ( addvalue ( *v1, *v2, vreturned ) );
}
+ disposehandle ( hPath );
+
return ( setfilespecvalue ( &fs, vreturned ) );
#endif
@@ -1050,73 +1183,80 @@
boolean langpackfileval (const tyvaluerecord *vfile, Handle *hpacked) {
-
+
//
- // we create a record containing an alias to the file (Mac only),
- // the full path to the file (as a URL), and the machine name (for
- // future use).
+ // we create a record containing an alias to the file (Mac only), the full path to the file (as a URL), and the machine name
+ // (for future use).
//
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
// 2006-06-24 creedon: FSRef-ized
//
+ // 5.0a24 rab: adding platform indicator rather then converting to URL -
+ // URL's have as much difference as just indicating what
+ // platform the path is specific to.
+ //
// 5.0a24 dmb: new format for storing filespec and alias values in the odb.
//
+ Handle halias = nil, path;
+ bigstring bsmachine;
+ boolean fl = false;
hdllistrecord hlist;
- bigstring bspath, bsmachine;
tyfilespec fs;
- Handle halias = nil;
- boolean fl = false;
if (!opnewlist (&hlist, true))
return (false);
+ if ( ! newemptyhandle ( &path ) )
+ return ( false );
+
switch ((*vfile).valuetype) {
case aliasvaluetype:
+
if (!copyhandle ((*vfile).data.aliasvalue, &halias))
goto exit;
- aliastostring (halias, bspath);
+ aliasToTextHandle ( halias, path );
break;
case filespecvaluetype: {
- fs = **(*vfile).data.filespecvalue;
+ fs = **( *vfile ).data.filespecvalue;
- disablelangerror ();
+ disablelangerror ( );
if ( ! filespectoalias ( &fs, true, ( AliasHandle * ) &halias ) )
halias = nil;
enablelangerror ();
- fl = filespectopath (&fs, bspath);
+ fl = filespectopath ( &fs, &path );
break;
+
}
default:
+
assert (false);
-
+
goto exit;
}
- // *** should convert path to URL ***
-
- if (!oppushstring (hlist, filerecordpath, bspath))
+ if ( ! oppushhandle ( hlist, filerecordpath, path ) )
goto exit;
- if (halias != nil)
- if (!oppushhandle (hlist, filerecordalias, halias))
+ if ( halias != nil )
+ if ( ! oppushhandle ( hlist, filerecordalias, halias ) )
goto exit;
- //5.0a24 rab: adding platform indicator rather then converting to URL - URL's have as much difference as
- //just indicating what platform the path is specific to.
-
#ifdef MACVERSION
- if (!oppushstring (hlist, filerecordplatform, bsplatformmac))
+ if ( ! oppushstring ( hlist, filerecordplatform, bsplatformmac ) )
goto exit;
#endif
@@ -1134,28 +1274,33 @@
fl = oppacklist (hlist, hpacked);
- exit:
+ exit:
- opdisposelist (hlist);
+ disposehandle ( path );
+
+ opdisposelist ( hlist );
+
+ return ( fl );
- return (fl);
-
} // langpackfileval
-boolean langunpackfileval (Handle hpacked, tyvaluerecord *vfile) {
+boolean langunpackfileval ( Handle hpacked, tyvaluerecord *vfile ) {
//
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
// 2006-07-01 creedon: clearbytes of fs first thing
//
- // 5.0fc2 dmb: unpacking an alias on the pc, go straight for the path string
+ // 5.0fc2 dmb: unpacking an alias on the pc, go straight for the path
+ // string
//
+ Handle halias, hPath;
+ bigstring bsPath, bsplat;
+ boolean fl = false;
hdllistrecord hlist;
- Handle halias;
- bigstring bspath, bsplat;
tyfilespec fs;
- boolean fl = false;
clearbytes ( &fs, sizeof ( fs ) );
@@ -1191,59 +1336,75 @@
break;
case filespecvaluetype:
- fl = opgetlisthandle (hlist, -1, filerecordalias, &halias);
+
+ fl = opgetlisthandle ( hlist, -1, filerecordalias, &halias );
- if (fl) {
+ if ( fl ) {
- disablelangerror ();
+ disablelangerror ( );
- fl = aliastofilespec ((AliasHandle) halias, &fs);
+ fl = aliastofilespec ( ( AliasHandle ) halias, &fs );
- enablelangerror ();
+ enablelangerror ( );
+
}
- if (!fl) {
+ if ( ! fl ) {
- fl = opgetliststring (hlist, -1, filerecordpath, bspath);
+ fl = opgetlisthandle ( hlist, -1, filerecordpath, &hPath );
- if (fl) {
+ if ( ! fl ) {
- // here we should check to see if the file path is from the correct platform???
+ fl = opgetliststring ( hlist, -1, filerecordpath, bsPath );
- if (opgetliststring (hlist, -1, filerecordplatform, bsplat)) {
+ if ( ! newemptyhandle ( &hPath ) )
+ return ( false );
+ pushstringhandle ( bsPath, hPath );
+
+ }
+
+ if ( fl ) {
+
+ if ( opgetliststring ( hlist, -1, filerecordplatform, bsplat ) ) { // check to see if the file path is
+ // from the correct platform?
+
#ifdef MACVERSION
- if (equalidentifiers (bsplat, bsplatformwin)) {
+ if ( equalidentifiers ( bsplat, bsplatformwin ) ) {
+
// ERROR or Conversion HERE!
+
}
-
#endif
#ifdef WIN95VERSION
- if (equalidentifiers (bsplat, bsplatformmac)) {
+ if ( equalidentifiers ( bsplat, bsplatformmac ) ) {
+
// ERROR or Conversion HERE!
+
}
-
#endif
+
}
- fl = pathtofilespec (bspath, &fs);
+ fl = pathtofilespec ( hPath, &fs );
}
}
- if (fl)
- fl = newfilledhandle (&fs, filespecsize (fs), (Handle *) &(*vfile).data.filespecvalue);
+ if ( fl )
+ fl = newfilledhandle ( &fs, filespecsize ( fs ), ( Handle * ) &( *vfile ).data.filespecvalue );
else {
// *** once we make tyfilespec the new record on both platforms, this will be ok
// *** but for now, we need to make a string value
- (*vfile).valuetype = stringvaluetype;
+ ( *vfile ).valuetype = stringvaluetype;
- fl = newtexthandle (bspath, &(*vfile).data.stringvalue);
+ fl = copyhandle ( hPath, &( *vfile ).data.stringvalue );
+
}
break;
@@ -1255,9 +1416,9 @@
break;
}
- opdisposelist (hlist);
+ opdisposelist ( hlist );
- return (fl);
+ return ( fl );
} // langunpackfileval
@@ -1266,7 +1427,7 @@
boolean objspectoaddress (tyvaluerecord *val) {
- langparamerror (unimplementedverberror, bsfunctionname);
+ langParamErrBs ( unimplementedverberror, handleFunctionName);
return (false);
} /*objspectoaddress*/
@@ -1274,7 +1435,7 @@
boolean objspectofilespec (tyvaluerecord *val) {
- langparamerror (unimplementedverberror, bsfunctionname);
+ langParamErrBs ( unimplementedverberror, handleFunctionName);
return (false);
} /*objspectofilespec*/
@@ -1282,7 +1443,7 @@
boolean filespectoobjspec (tyvaluerecord *val) {
- langparamerror (unimplementedverberror, bsfunctionname);
+ langParamErrBs ( unimplementedverberror, handleFunctionName);
return (false);
} /*filespectoobjspec*/
@@ -1298,7 +1459,7 @@
boolean coercetoobjspec (tyvaluerecord *v) {
- langparamerror (unimplementedverberror, bsfunctionname);
+ langParamErrBs ( unimplementedverberror, handleFunctionName);
return (false);
} /*coercetoobjspec*/
@@ -1306,20 +1467,22 @@
boolean setobjspecverb (hdltreenode hparam1, tyvaluerecord *val) {
- langparamerror (unimplementedverberror, bsfunctionname);
+ langParamErrBs ( unimplementedverberror, handleFunctionName);
return (false);
} /*setobjspecverb*/
boolean isobjspectree (hdltreenode htree) {
+
return (false);
+
} /*isobjspectree*/
boolean evaluateobjspec (hdltreenode htree, tyvaluerecord *vreturned) {
- langparamerror (unimplementedverberror, bsfunctionname);
+ langParamErrBs ( unimplementedverberror, handleFunctionName);
return (false);
} /*evaluateobjspec*/
@@ -1328,21 +1491,20 @@
#ifdef MACVERSION
-static pascal OSErr langsystem7accessobject (
- DescType classWanted,
- AEDesc *container,
- DescType containerClass,
- DescType keyform,
- AEDesc *keydesc,
- AEDesc *resultToken,
- long theRefCon) {
+static pascal OSErr langsystem7accessobject ( DescType classWanted, AEDesc *container, DescType containerClass,
+ DescType keyform, AEDesc *keydesc, AEDesc *resultToken, long theRefCon ) {
#pragma unused (classWanted,container,containerClass,theRefCon)
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+
+ register OSErr err;
+
AEDesc tempdesc;
+ Handle h;
hdlhashtable htable;
- bigstring bs;
- register OSErr err;
switch (keyform) {
@@ -1351,28 +1513,21 @@
if (err != noErr)
return (err);
-
- #if TARGET_API_MAC_CARBON == 1 /*PBS 03/14/02: AE OS X fix.*/
-
- datahandletostring (keydesc, bs);
- #else
+ copydatahandle ( keydesc, &h );
- texthandletostring ((*keydesc).dataHandle, bs);
+ if ( ! langexpandtodotparams ( h, &htable, &h ) ) {
- #endif
-
- if (!langexpandtodotparams (bs, &htable, bs)) {
-
AEDisposeDesc (&tempdesc);
return(errAENoSuchObject);
+
}
-
+
*resultToken = tempdesc;
return (noErr);
-
+
/*
case formAbsolutePosition:
err = AECoerceDesc (keydesc, typeLongInteger, &tempdesc);
@@ -1383,9 +1538,11 @@
return (errAEEventNotHandled); // I've got no clue of how to access files by number.
*/
- default: // I don't handle any other key forms.
+ default: // I don't handle any other key forms.
+
return (errAEEventNotHandled);
}
+
} /*langsystem7accessobject*/
@@ -1583,21 +1740,23 @@
boolean filespectoobjspec (tyvaluerecord *val) {
- /*
- 2.1b5 dmb: added for AppleScript compatibility
- */
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 2.1b5 dmb: added for AppleScript compatibility
+ //
+ AEDesc container = {typeNull, nil};
+ AEDesc keydata;
+ AEDesc objdesc;
+ Handle path;
+ OSErr err;
register tyvaluerecord *v = val;
- AEDesc objdesc;
- AEDesc keydata;
tyfilespec fs = **(*v).data.filespecvalue;
- bigstring bs;
- AEDesc container = {typeNull, nil};
- OSErr err;
- filespectopath (&fs, bs);
+ filespectopath ( &fs, &path );
- err = AECreateDesc (typeChar, (Ptr) bs + 1, stringlength (bs), &keydata);
+ err = AECreateDesc ( typeChar, *path, gethandlesize ( path ), &keydata );
if (err == noErr)
err = CreateObjSpecifier (cFile, &container, formName, &keydata, true, &objdesc);
@@ -1607,24 +1766,13 @@
disposevaluerecord (*v, true);
+ Handle h;
- #if TARGET_API_MAC_CARBON == 1 /*PBS 03/14/02: AE OS X fix.*/
+ copydatahandle (&objdesc, &h);
- {
- Handle h;
-
- copydatahandle (&objdesc, &h);
-
- return (setheapvalue (h, objspecvaluetype, v));
- }
+ return (setheapvalue (h, objspecvaluetype, v));
- #else
-
- return (setheapvalue (objdesc.dataHandle, objspecvaluetype, v));
-
- #endif
-
- } /*filespectoobjspec*/
+ } // filespectoobjspec
static boolean stringtoobjspec (tyvaluerecord *val) {
@@ -2256,56 +2404,58 @@
static void getdefaultcontainer (OSType nulltype, AEDesc *containerdesc, boolean fluseexternalcontainer) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 3.0.3 dmb: added fluseexternalcontainer parameter. if true, allow "with"
+ // statements in external contexts to show through by setting
+ // the flfindanyspecialsymbol global to true. in practice, we're
+ // allowing string4 property values to be coerced to objspecs in
+ // glue scripts with the caller's "with <obj>" statement
+ // respected. at the same time, fully-formed object
+ // specifications don't erroniously pick up a parent container
+ // from a calling script. so, we've created an inconsistency
+ // that suites our needs and will create expected behavior in
+ // most scripts.
+ //
+ // 1992-08-13 dmb: create a container descriptor based on nulltype.
+ //
+ // the smarts: if nulltype is typeNull, and there is a with
+ // statement that defines a container value, then use that
+ // container. otherwise, a normal null container is returned.
+ //
- /*
- 8/13/92 dmb: create a container descriptor based on nulltype.
+ hdlhashnode hnode;
- the smarts: if nulltype is typeNull, and there is a with statement that
- defines a container value, then use that container. otherwise, a normal
- null container is returned.
-
- 3.0.3 dmb: added fluseexternalcontainer parameter. if true, allow
- "with" statements in external contexts to show through by setting the
- flfindanyspecialsymbol global to true. in practice, we're allowing
- string4 property values to be coerced to objspecs in glue scripts with
- the caller's "with <obj>" statement respected. at the same time, fully-
- formed object specifications don't erroniously pick up a parent
- container from a calling script. so, we've created an inconsistency
- that suites our needs and will create expected behavior in most scripts.
- */
-
- hdlhashnode hnode;
-
if (nulltype == typeNull) { /*not a special type of null container*/
+ Handle h;
+ boolean fl;
tyvaluerecord containerval;
- boolean fl;
flfindanyspecialsymbol = fluseexternalcontainer;
- fl = langgetsymbolval (bscontainername, &containerval, &hnode);
+ if ( ! newtexthandle ( bscontainername, &h ) )
+ return; // is this the best way to handle this error situation
+
+ fl = langgetsymbolval ( h, &containerval, &hnode );
+ disposehandle ( h );
+
flfindanyspecialsymbol = false; /*restore to default*/
if (fl) { /*got container*/
-
+
setupdescriptor (containerval.data.objspecvalue, containerdesc);
return;
+
}
}
-
- #if TARGET_API_MAC_CARBON == 1
- newdescnull (containerdesc, nulltype);
+ newdescnull (containerdesc, nulltype);
- #else
-
- (*containerdesc).descriptorType = nulltype;
-
- (*containerdesc).dataHandle = nil;
-
- #endif
} /*getdefaultcontainer*/
@@ -3318,25 +3468,28 @@
static boolean getidvalue (hdltreenode htree, tyvaluerecord *val) {
+
+ //
+ // just like idvalue, but we don't make a copy
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 2.1b2 dmb: dive into bracketops to more closely simulate objspec
+ // evaluation
+ //
+ // 1997-07-02 dmb: prevent extended symbol searching in langgetsymbolval
+ //
- /*
- just like idvalue, but we don't make a copy
+ register hdltreenode h = htree;
- 2.1b2 dmb: dive into bracketops to more closely simulate objspec evaluation
-
- 7.2.97 dmb: prevent extended symbol searching in langgetsymbolval
- */
-
- register hdltreenode h = htree;
- bigstring bs;
- hdlhashtable htable;
boolean fl = false;
hdlhashnode hnode;
+ hdlhashtable htable;
switch ((**h).nodetype) {
+
+ case bracketop: /*look for string4 literal only*/
- case bracketop: /*look for string4 literal only*/
-
h = (**h).param1;
if ((**h).nodetype != constop)
@@ -3347,27 +3500,35 @@
fl = true;
break;
+
+ case identifierop: {
- case identifierop:
+ Handle h2 = NULL;
- if (!langgetidentifier (h, bs))
+ if ( ! langgetidentifier ( h, &h2 ) )
break;
+
+ langsearchpathlookup ( h2, &htable );
- langsearchpathlookup (bs, &htable);
-
pushhashtable (htable);
- fl = langgetsymbolval (bs, val, &hnode);
+ fl = langgetsymbolval ( h2, val, &hnode );
+ disposehandle ( h2 );
+
pophashtable ();
break;
+
+ }
+
+ default:
- default:
break;
}
return (fl);
+
} /*getidvalue*/
@@ -3422,10 +3583,12 @@
}
case arrayop: /*continue scanning tree*/
+
break;
case bracketop:
case identifierop:
+
if (!getidvalue (h, &val))
return (false);
@@ -3436,8 +3599,10 @@
}
h = (**h).param1;
+
}
+
} /*isobjspectree*/
-
+
#endif
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langtree.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langtree.c 2007-02-26 21:02:19 UTC (rev 1631)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langtree.c 2007-02-26 21:56:01 UTC (rev 1632)
@@ -481,6 +481,7 @@
#endif
#ifndef treenodeallocator
+
ctbytes = longsizeof (tytreenode) - ((4 - ctparams) * longsizeof (Handle));
if (!newclearhandle (ctbytes, (Handle *) hnode)) {
@@ -488,6 +489,7 @@
*hnode = nil;
return (false);
+
}
#else
if (!alloctreenode (hnode)) {
@@ -495,6 +497,7 @@
*hnode = nil;
return (false);
+
}
#endif
@@ -507,6 +510,7 @@
(**h).ctparams = ctparams;
return (true);
+
} /*langnewtreenode*/
@@ -523,6 +527,7 @@
disposevaluerecord (val, false);
return (false);
+
}
h = *hreturned; /*copy into register*/
@@ -532,6 +537,7 @@
(**h).nodeval = val;
return (true);
+
} /*pushvalue*/
@@ -689,6 +695,7 @@
(**h).param2 = hp2;
return (true);
+
} /*pushbinaryoperation*/
@@ -777,92 +784,95 @@
boolean pushfunctioncall (hdltreenode hp1, hdltreenode hp2, hdltreenode *hreturned) {
+
+ //
+ // hp1 represents the name of the function call. hp2 represents the
+ // parameter list (it can be nil, indicating a function taking no
+ // parameters).
+ //
+ // before pushing the name onto the code tree, first see if it's a
+ // built-in function. if so, substitute the tokennumber for the built-in.
+ //
+ // note: since we always call pushbinaryoperation, we consume both
+ // parameters.
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 1990-07-10 DW: turns out we were disposing of an already-disposed-of
+ // handle in scripts.c.
+ //
+ // 1990-07-08 DW: only do the optimization if hp1 is a simple, undotted
+ // string. this has been a bug lurking in here for a long,
+ // long time! it took the whole day of splitting the baby
+ // to find this one. thank you.
+ //
+ // wishful thinking. this really was a problem, but the
+ // nasty behavior continues...
+ //
- /*
- hp1 represents the name of the function call. hp2 represents the parameter
- list (it can be nil, indicating a function taking no parameters).
-
- before pushing the name onto the code tree, first see if it's a built-in
- function. if so, substitute the tokennumber for the built-in.
-
- note: since we always call pushbinaryoperation, we consume both parameters.
-
- 7/8/90 DW: only do the optimization if hp1 is a simple, undotted string.
- this has been a bug lurking in here for a long, long time! it took the
- whole day of splitting the baby to find this one. thank you.
-
- 7/8/90 DW: wishful thinking. this really was a problem, but the nasty
- behavior continues...
-
- 7/10/90 DW: turns out we were disposing of an already-disposed-of handle
- in scripts.c.
- */
-
- register hdltreenode h = hp1; /*we do a lot of work on this guy*/
register Handle hstring;
register boolean fl;
- bigstring bs;
- tyvaluerecord val;
+ register hdltreenode h = hp1; /*we do a lot of work on this guy*/
+
hdlhashnode hnode;
+ tyvaluerecord val;
if ((**h).nodetype != identifierop) /*more complex than an ID, skip optimization*/
goto L1;
assert ((**h).nodeval.valuetype == stringvaluetype);
- /*
- if ((**h).nodeval.valuetype != stringvaluetype) /%skip optimization%/
- goto L1;
- */
-
hstring = (**h).nodeval.data.stringvalue;
- texthandletostring (hstring, bs); /*get the identifier name*/
+ fl = hashtablelookup (hbuiltinfunctions, hstring, &val, &hnode); /*check the built-in functions*/
- fl = hashtablelookup (hbuiltinfunctions, bs, &val, &hnode); /*check the built-in functions*/
-
if (fl && (val.valuetype == tokenvaluetype)) { /*a pre-defined built-in*/
disposehandle ((Handle) hstring); /*don't need the string*/
(**h).nodeval = val; /*replace with token value*/
+
}
L1:
return (pushbinaryoperation (functionop, h, hp2, hreturned));
+
} /*pushfunctioncall*/
boolean pushkernelcall (hdltreenode hp1, hdltreenode *hreturned) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 1997-05-07 dmb: protect herrornode global
+ //
+ // 1991-08-21 dmb: langvalue now supports calling kernel code directly,
+ // with kernelfunctionvalue, which doesn't work off the the
+ // code tree. so there's no point in stashing sway the
+ // token value, which was kind of a waste of memory anyway.
+ //
+ // 1991-07-18/ dmb: resolve the efp reference immediately, both for
+ // performance and to catch errors at compile time. we
+ // stick the resolved token in a constant node that
+ // becomes the one parameter in the kernel code tree.
+ //
- /*
- 7/18/91 dmb: resolve the efp reference immediately, both for
- performance and to catch errors at compile time. we stick the
- resolved token in a constant node that becomes the one parameter
- in the kernel code tree.
-
- 8/21/91 dmb: langvalue now supports calling kernel code directly, with
- kernelfunctionvalue, which doesn't work off the the code tree. so there's
- no point in stashing sway the token value, which was kind of a waste of
- memory anyway.
-
- 5.7.97 dmb: protect herrornode global
- */
-
- register hdltreenode h = hp1;
register boolean fl;
- hdlhashtable htable;
- bigstring bs;
- tyvaluerecord val;
+ register hdltreenode h = hp1;
+
+ Handle h1 = NULL;
boolean flerrornodewasset;
hdlhashnode hnode;
+ hdlhashtable htable;
+ tyvaluerecord val;
assert ((**h).nodetype == dotop);
pushhashtable (efptable);
- fl = langgetdotparams (h, &htable, bs);
+ fl = langgetdotparams ( h, &htable, &h1 );
pophashtable ();
@@ -871,45 +881,38 @@
fl = (**htable).valuero...
[truncated message content] |