You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(447) |
Nov
(163) |
Dec
(57) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(172) |
Feb
|
Mar
(123) |
Apr
(64) |
May
(1) |
Jun
(278) |
Jul
(89) |
Aug
(97) |
Sep
(62) |
Oct
(53) |
Nov
(119) |
Dec
(60) |
| 2006 |
Jan
(76) |
Feb
(1094) |
Mar
(363) |
Apr
(163) |
May
(57) |
Jun
(43) |
Jul
(39) |
Aug
(15) |
Sep
(33) |
Oct
(62) |
Nov
(8) |
Dec
|
| 2007 |
Jan
(9) |
Feb
(34) |
Mar
(2) |
Apr
(14) |
May
(8) |
Jun
(40) |
Jul
(21) |
Aug
(1) |
Sep
(20) |
Oct
(15) |
Nov
(26) |
Dec
|
| 2008 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
|
Nov
|
Dec
(1) |
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(32) |
Jun
|
Jul
|
Aug
(3) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
| 2010 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(7) |
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <cre...@us...> - 2007-04-04 22:18:13
|
Revision: 1643
http://svn.sourceforge.net/frontierkernel/?rev=1643&view=rev
Author: creecode
Date: 2007-04-04 15:18:14 -0700 (Wed, 04 Apr 2007)
Log Message:
-----------
in getfileverb function use getfilespecparent to return an unextended filespec
Modified Paths:
--------------
Frontier/trunk/Common/source/shellwindowverbs.c
Modified: Frontier/trunk/Common/source/shellwindowverbs.c
===================================================================
--- Frontier/trunk/Common/source/shellwindowverbs.c 2007-03-06 20:41:09 UTC (rev 1642)
+++ Frontier/trunk/Common/source/shellwindowverbs.c 2007-04-04 22:18:14 UTC (rev 1643)
@@ -1045,26 +1045,36 @@
} /*settitleverb*/
-static boolean getfileverb (hdltreenode hparam1, tyvaluerecord *vreturned) {
+static boolean getfileverb ( hdltreenode hparam1, tyvaluerecord *vreturned ) {
+
+ //
+ // 2007-04-03 creedon: use getfilespecparent to return an unextended
+ // filespec
+ //
+ // 1992-06-24 dmb: get the title of the object or window indicated in
+ // hparam1. if it's not an external value or a window,
+ // always return the empty string
+ //
- /*
- 6/24/92 dmb: get the title of the object or window indicated in hparam1.
- if it's not an external value or a window, always return the empty string
- */
-
hdlwindowinfo hinfo;
tyfilespec fs;
flnextparamislast = true;
- if (!getwinparam (hparam1, 1, &hinfo))
- return (false);
+ if ( ! getwinparam ( hparam1, 1, &hinfo ) )
+ return ( false );
+
+ if ( ( hinfo != nil ) && windowgetfspec ( ( **hinfo ).macwindow, &fs ) ) {
- if ((hinfo != nil) && windowgetfspec ((**hinfo).macwindow, &fs))
- return (setfilespecvalue (&fs, vreturned));
+ getfilespecparent ( &fs );
+
+ return ( setfilespecvalue ( &fs, vreturned ) );
+
+ }
+
+ return ( setstringvalue ( zerostring, vreturned ) );
- return (setstringvalue (zerostring, vreturned));
- } /*getfileverb*/
+ } // getfileverb
static boolean windowfunctionvalue (short token, hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cre...@us...> - 2007-03-06 20:41:15
|
Revision: 1642
http://svn.sourceforge.net/frontierkernel/?rev=1642&view=rev
Author: creecode
Date: 2007-03-06 12:41:09 -0800 (Tue, 06 Mar 2007)
Log Message:
-----------
added glue scripts
Added Paths:
-----------
ODBs/trunk/frontierRoot/system/verbs/builtins/sys/getEnvironmentVariable.fvc
ODBs/trunk/frontierRoot/system/verbs/builtins/sys/setEnvironmentVariable.fvc
Added: ODBs/trunk/frontierRoot/system/verbs/builtins/sys/getEnvironmentVariable.fvc
===================================================================
--- ODBs/trunk/frontierRoot/system/verbs/builtins/sys/getEnvironmentVariable.fvc (rev 0)
+++ ODBs/trunk/frontierRoot/system/verbs/builtins/sys/getEnvironmentVariable.fvc 2007-03-06 20:41:09 UTC (rev 1642)
@@ -0,0 +1,6 @@
+FrontierVcsFile:3:scpt:system.verbs.builtins.sys.getEnvironmentVariable
+
+on getEnvironmentVariable ( var ) {
+ kernel ( sys.getEnvironmentVariable )}
+
+
Property changes on: ODBs/trunk/frontierRoot/system/verbs/builtins/sys/getEnvironmentVariable.fvc
___________________________________________________________________
Name: svn:eol-style
+ native
Added: ODBs/trunk/frontierRoot/system/verbs/builtins/sys/setEnvironmentVariable.fvc
===================================================================
--- ODBs/trunk/frontierRoot/system/verbs/builtins/sys/setEnvironmentVariable.fvc (rev 0)
+++ ODBs/trunk/frontierRoot/system/verbs/builtins/sys/setEnvironmentVariable.fvc 2007-03-06 20:41:09 UTC (rev 1642)
@@ -0,0 +1,6 @@
+FrontierVcsFile:3:scpt:system.verbs.builtins.sys.setEnvironmentVariable
+
+on setEnvironmentVariable ( var, s ) {
+ kernel ( sys.setEnvironmentVariable )}
+
+
Property changes on: ODBs/trunk/frontierRoot/system/verbs/builtins/sys/setEnvironmentVariable.fvc
___________________________________________________________________
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cre...@us...> - 2007-03-06 20:04:53
|
Revision: 1641
http://svn.sourceforge.net/frontierkernel/?rev=1641&view=rev
Author: creecode
Date: 2007-03-06 12:04:53 -0800 (Tue, 06 Mar 2007)
Log Message:
-----------
added glue scripts
Added Paths:
-----------
ODBs/trunk/docServerRoot/docServerData/formats/outline/sys/getEnvironmentVariable.fvc
ODBs/trunk/docServerRoot/docServerData/formats/outline/sys/setEnvironmentVariable.fvc
Added: ODBs/trunk/docServerRoot/docServerData/formats/outline/sys/getEnvironmentVariable.fvc
===================================================================
--- ODBs/trunk/docServerRoot/docServerData/formats/outline/sys/getEnvironmentVariable.fvc (rev 0)
+++ ODBs/trunk/docServerRoot/docServerData/formats/outline/sys/getEnvironmentVariable.fvc 2007-03-06 20:04:53 UTC (rev 1641)
@@ -0,0 +1,23 @@
+FrontierVcsFile:3:optx:docServerData.formats.outline.sys.getEnvironmentVariable
+
+Syntax
+ sys.getEnvironmentVariable ( var )
+Params
+ var is a string containing the name of an environment variable content you wish to determine.
+Action
+ Determines the content of the named environment variable.
+Returns
+ The content of the named environment variable in the context of the running Frontier application.
+Examples
+ sys.getEnvironmentVariable ( "path" )
+ "C:\WINDOWS\system32;C:\WINDOWS;C:\cygwin\bin"
+Platform Notes
+ This verb is only implemented in the Windows version of Frontier.
+Notes
+ If the variable does not exist an empty string will be returned
+ If the contents of the variable is longer than 255, false will be returned
+See Also
+ sys.setEnvironmentVariable
+
+
+
Property changes on: ODBs/trunk/docServerRoot/docServerData/formats/outline/sys/getEnvironmentVariable.fvc
___________________________________________________________________
Name: svn:eol-style
+ native
Added: ODBs/trunk/docServerRoot/docServerData/formats/outline/sys/setEnvironmentVariable.fvc
===================================================================
--- ODBs/trunk/docServerRoot/docServerData/formats/outline/sys/setEnvironmentVariable.fvc (rev 0)
+++ ODBs/trunk/docServerRoot/docServerData/formats/outline/sys/setEnvironmentVariable.fvc 2007-03-06 20:04:53 UTC (rev 1641)
@@ -0,0 +1,23 @@
+FrontierVcsFile:3:optx:docServerData.formats.outline.sys.setEnvironmentVariable
+
+Syntax
+ sys.setEnvironmentVariable ( var, s )
+Params
+ var is a string containing the name of an environment variable whose content you wish to set.
+ s is the desired content of the environment variable
+Action
+ Sets the content of the named environment variable to the desired string.
+Returns
+ True if successful.
+Examples
+ sys.setEnvironmentVariable ( "path", "c:\cygwin\bin" )
+ true
+Platform Notes
+ This verb is only implemented in the Windows version of Frontier.
+Notes
+ The variable is set within the context of the running Frontier application and its sub-processes. Other processes, and the default values after reboot, are not affected.
+See Also
+ sys.getEnvironmentVariable
+
+
+
Property changes on: ODBs/trunk/docServerRoot/docServerData/formats/outline/sys/setEnvironmentVariable.fvc
___________________________________________________________________
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cre...@us...> - 2007-02-28 00:38:41
|
Revision: 1640
http://svn.sourceforge.net/frontierkernel/?rev=1640&view=rev
Author: creecode
Date: 2007-02-27 16:38:41 -0800 (Tue, 27 Feb 2007)
Log Message:
-----------
fixed xmlcompileverb function comment that was missing // chars
Modified Paths:
--------------
Frontier/branches/Frontier_Long_File_Paths/Common/source/langxml.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langxml.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langxml.c 2007-02-28 00:36:13 UTC (rev 1639)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langxml.c 2007-02-28 00:38:41 UTC (rev 1640)
@@ -3607,7 +3607,7 @@
// 2007-02-26 creedon: support for long odb item names and file paths
//
// 5.0.2b8 dmb: new verb
- on compile (htext, adrtable) {
+ // on compile (htext, adrtable) {
//
Handle h, x;
@@ -3654,6 +3654,7 @@
return (false);
return (setheapvalue (xmltext, stringvaluetype, v));
+
} /*xmldecompileverb*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cre...@us...> - 2007-02-28 00:36:13
|
Revision: 1639
http://svn.sourceforge.net/frontierkernel/?rev=1639&view=rev
Author: creecode
Date: 2007-02-27 16:36:13 -0800 (Tue, 27 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/WinSockNetEvents.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/strings.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/tableinternal.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/tablestructure.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/tableverbs.h
Frontier/branches/Frontier_Long_File_Paths/Common/source/strings.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/stringverbs.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/tabledisplay.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/tableedit.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/tableexternal.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/tablefind.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/tablepopup.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/tablerunbutton.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/tablescrap.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/tablestructure.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/tablevalidate.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/tableverbs.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/WinSockNetEvents.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/WinSockNetEvents.h 2007-02-28 00:32:28 UTC (rev 1638)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/WinSockNetEvents.h 2007-02-28 00:36:13 UTC (rev 1639)
@@ -103,8 +103,7 @@
/* Set up a listner on a port */
// 2006-04-04 - kw --- removed parameter names
-// extern boolean fwsNetEventListenStream (unsigned long port, long depth, bigstring callback, unsigned long refcon, unsigned long * stream, unsigned long ipaddr, long hdatabase);
-extern boolean fwsNetEventListenStream (unsigned long, long, bigstring, unsigned long, unsigned long *, unsigned long, long);
+extern boolean fwsNetEventListenStream ( unsigned long, long, const Handle, unsigned long, unsigned long *, unsigned long, long );
/* get the status of a stream */
extern boolean fwsNetEventStatusStream (unsigned long stream, bigstring status, unsigned long * bytesPending);
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/strings.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/strings.h 2007-02-28 00:32:28 UTC (rev 1638)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/strings.h 2007-02-28 00:36:13 UTC (rev 1639)
@@ -45,19 +45,21 @@
extern unsigned char lowercasetable[256];
-/*prototypes*/
+// prototypes
extern short getstringlength (bigstring);
/*extern unsigned char getlower (unsigned char c);*/
#define getlower(c) (lowercasetable[(unsigned char)c])
-extern boolean equaltextidentifiers (byte * string1, byte * string2, short len);
+extern boolean equaltextidentifiers ( byte *string1, byte *string2, short len );
extern boolean equalstrings (const bigstring, const bigstring);
extern boolean equalidentifiers (const bigstring, const bigstring);
+extern boolean equalHandleIdentifiers ( const Handle, const Handle );
+
extern short comparestrings (bigstring, bigstring);
extern short compareidentifiers (bigstring, bigstring);
@@ -184,6 +186,8 @@
extern void ellipsize (bigstring, short);
+extern void ellipsizemiddle ( bigstring, short );
+
extern void parsedialogstring (const bigstring, ptrstring, ptrstring, ptrstring, ptrstring, bigstring);
extern boolean parsedialoghandle (Handle hsource, Handle h0, Handle h1, Handle h2, Handle h3);
@@ -248,12 +252,15 @@
extern boolean pullstringsuffix (bigstring, bigstring, unsigned char); /*7.0.2b1 Radio PBS*/
+extern boolean pullTextHandleSuffix ( Handle *, Handle *, unsigned char ); // 2006-11-24 creedon
extern void initstrings (void);
-extern boolean stringinitverbs (void); /*stringverbs.c*/
+#pragma mark === stringverbs.c ===
+extern boolean stringinitverbs (void);
+
extern long countleadingchars (Handle, byte);
extern void handlepopleadingchars (Handle htext, byte ch);
@@ -272,5 +279,27 @@
extern boolean isTextEncodingAvailable( bigstring ); /* 2006-04-23 smd */
+extern boolean textHandleAssureLastCharIsColon ( Handle ); // 2006-11-22 creedon
+
+extern boolean textHandleFindChar ( byte, Handle ); // 2006-11-22 creedon
+
+extern char textHandleFirstChar ( Handle ); // 2006-12-07 creedon
+
+extern char textHandleLastChar ( Handle ); // 2006-11-23 creedon
+
+extern boolean setHandleCharacter ( Handle, long, char );; // 2006-11-25 creedon
+
+extern boolean textHandleLastWord ( Handle, byte, Handle * ); // 2006-11-25 creedon
+
+extern void osTypeToTextHandle ( OSType, Handle * ); // 2006-12-05 creedon
+
+extern boolean textHandleToOsType ( const Handle, OSType * ); // 2006-12-06 creedon
+
+extern boolean getNthFieldTextHandle ( const Handle, long, byte, boolean, Handle * ); // 2006-12-08 creedon
+
+extern boolean textHandleTrimWhiteSpace ( Handle, boolean, boolean ); // 2006-12-12 creedon
+
+extern void textHandlePopTrailingChars ( Handle, byte ); // 2006-12-15 creedon
+
#endif
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/tableinternal.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/tableinternal.h 2007-02-28 00:32:28 UTC (rev 1638)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/tableinternal.h 2007-02-28 00:36:13 UTC (rev 1639)
@@ -150,23 +150,26 @@
extern boolean tablegetwpedittext (hdlheadrecord, boolean);
-extern boolean tableverbsearch (void); /*tablefind.c*/
+#pragma mark === tablefind.c ===
+extern boolean tableverbsearch (void);
// extern boolean tablemakenewvalue (void); /*tablenewvalue.c*/
-extern boolean tablesetdebugglobals (hdlhashtable, hdlhashnode); /*tableops.c*/
+#pragma mark === tableops.c ===
+extern boolean tablesetdebugglobals (hdlhashtable, hdlhashnode);
+
extern hdlhashtable tablegetlinkedhashtable (void);
extern hdltablevariable tablegetlinkedtablevariable (void);
extern hdltablevariable tablegetlinkedtablevariable (void);
-extern boolean tablegetiteminfo (hdlheadrecord, hdlhashtable *, bigstring, tyvaluerecord *, hdlhashnode *);
+extern boolean tablegetiteminfo ( hdlheadrecord, hdlhashtable *, Handle *, tyvaluerecord *, hdlhashnode * );
-extern boolean tablegetcursorinfo (hdlhashtable *, bigstring, tyvaluerecord *, hdlhashnode *);
+extern boolean tablegetcursorinfo ( hdlhashtable *, Handle *, tyvaluerecord *, hdlhashnode * );
extern void tablelinkformats (hdlhashtable, hdltableformats);
@@ -186,7 +189,7 @@
extern boolean tablecheckwindowrect (hdlhashtable);
-extern boolean findvariablesearch (hdlhashtable, hdlexternalvariable, boolean, hdlhashtable *, bigstring, tyfindvariablecallback);
+extern boolean findvariablesearch ( hdlhashtable, hdlexternalvariable, boolean, hdlhashtable *, Handle *, tyfindvariablecallback );
extern boolean tablenosubsdirty (hdlhashtable);
@@ -206,7 +209,7 @@
extern boolean tablesetsortorder (hdlhashtable, short);
-extern boolean tablegetcursorpath (bigstring);
+extern boolean tablegetcursorpath ( Handle * );
extern boolean tablepushcontext (hdlhashtable, tyvaluetype);
@@ -214,32 +217,42 @@
extern boolean tablegetstringlist (short, bigstring);
+extern boolean tableGetStringListTextHandle ( short, Handle * );
-extern boolean tablepacktable (hdlhashtable, boolean, Handle *, boolean *); /*tablepack.c*/
+#pragma mark === tablepack.c ===
+
+extern boolean tablepacktable (hdlhashtable, boolean, Handle *, boolean *);
+
extern boolean tableunpacktable (Handle, boolean, hdlhashtable *);
-extern boolean tablekindpopuphit (Point); /*tablepopup.c*/
+#pragma mark === tablepopup.c ===
+extern boolean tablekindpopuphit (Point);
+
extern void tableupdatekindpopup (void);
extern boolean tablesortpopuphit (Point);
extern void tableupdatesortpopup (void);
-extern boolean tablesetitemname (hdlhashtable, bigstring, hdlheadrecord, boolean); /*6.2b16 AR: hdlheadrecord instead of bigstring*/
+extern boolean tablesetitemname ( hdlhashtable, const Handle, hdlheadrecord, boolean ); /*6.2b16 AR: hdlheadrecord instead of bigstring*/
extern boolean tablepopupkinddialog (void);
-extern boolean tablesetprintinfo (void); /*tableprint.c*/
+#pragma mark === tableprint.c ===
+extern boolean tablesetprintinfo (void);
+
extern boolean tableprint (short);
-extern boolean tablecursoriszoomable (void); /*tablerunbutton.c*/
+#pragma mark === tablerunbutton.c ===
+extern boolean tablecursoriszoomable (void);
+
extern boolean tablecheckzoombutton (void);
extern void tabledrawzoombutton (boolean);
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/tablestructure.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/tablestructure.h 2007-02-28 00:32:28 UTC (rev 1638)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/tablestructure.h 2007-02-28 00:36:13 UTC (rev 1639)
@@ -232,17 +232,19 @@
extern byte namecharsetstable [];
-/*prototypes*/
+// prototypes
-extern boolean linksystemtablestructure (hdlhashtable); /*tablestructure.c*/
+#pragma mark === tablestructure.c ===
+extern boolean linksystemtablestructure (hdlhashtable);
+
extern boolean getsystemtablescript (short, bigstring);
extern boolean unlinksystemtablestructure (void);
-extern boolean tablenewsubtable (hdlhashtable, bigstring, hdlhashtable *);
+extern boolean tablenewsubtable ( hdlhashtable, const Handle, hdlhashtable * );
-extern boolean tablenewsystemtable (hdlhashtable, bigstring, hdlhashtable *);
+extern boolean tablenewsystemtable ( hdlhashtable, const Handle, hdlhashtable * );
extern boolean tableloadsystemtable (dbaddress, Handle *, hdlhashtable *, boolean);
@@ -257,15 +259,16 @@
extern boolean settablestructureglobals (Handle, boolean);
-extern void initsegment (void); /*tablestartup.c*/
+#pragma mark === tablestartup.c ===
+extern void initsegment (void);
+
extern boolean loadfunctionprocessor (short, langvaluecallback);
extern boolean inittablestructure (void);
-extern boolean tablevalidate (hdlhashtable, boolean); /*tablevalidate.c*/
+#pragma mark ===tablevalidate.c ===
+extern boolean tablevalidate (hdlhashtable, boolean);
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/tableverbs.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/tableverbs.h 2007-02-28 00:32:28 UTC (rev 1638)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/tableverbs.h 2007-02-28 00:36:13 UTC (rev 1639)
@@ -32,32 +32,39 @@
#include "langexternal.h"
-/*prototypes*/
+// prototypes
+#pragma mark === tablecompare.c ===
-extern short tablecomparenodes (hdlhashtable, hdlhashnode, hdlhashnode); /*tablecompare.c*/
+extern short tablecomparenodes (hdlhashtable, hdlhashnode, hdlhashnode);
-extern boolean tableverbfind (hdlexternalvariable, boolean *); /*tablefind.c*/
+#pragma mark === tablefind.c ===
+extern boolean tableverbfind (hdlexternalvariable, boolean *);
+
extern boolean tableverbcontinuesearch (hdlexternalvariable);
-extern boolean tablefindvariable (hdlexternalvariable, hdlhashtable *, bigstring); /*tableops.c*/
+#pragma mark === tableops.c ===
-extern boolean findnamedtable (hdlhashtable, bigstring, hdlhashtable *);
+extern boolean tablefindvariable ( hdlexternalvariable, hdlhashtable *, Handle * );
-extern boolean findinparenttable (hdlhashtable, hdlhashtable *, bigstring);
+extern boolean findnamedtable ( hdlhashtable, const Handle, hdlhashtable * );
+extern boolean findinparenttable ( hdlhashtable, hdlhashtable *, Handle * );
+
extern boolean tableverbunload (hdlexternalvariable);
-extern boolean tablemovetoname (hdlhashtable, bigstring);
+extern boolean tablemovetoname ( hdlhashtable, const Handle );
extern hdldatabaserecord tablegetdatabase (hdlhashtable);
-extern boolean tableverbmemorypack (hdlexternalvariable, Handle *, hdlhashnode); /*tablepack.c*/
+#pragma mark === tablepack.c ===
+extern boolean tableverbmemorypack (hdlexternalvariable, Handle *, hdlhashnode);
+
extern boolean tableverbmemoryunpack (Handle, long *, hdlexternalvariable *, boolean);
extern boolean tableverbpack (hdlexternalvariable, Handle *, boolean *);
@@ -70,22 +77,30 @@
extern boolean tableverbsettimes (hdlexternalvariable, long, long, hdlhashnode);
-extern boolean tableverbfindusedblocks (hdlexternalvariable, bigstring bspath);
+extern boolean tableverbfindusedblocks ( hdlexternalvariable, const Handle );
-extern boolean tableclienttitlepopuphit (Point, hdlexternalvariable); /*tablepopup.c*/
+#pragma mark === tablepopup.c ===
+extern boolean tableclienttitlepopuphit (Point, hdlexternalvariable);
-extern boolean tabledroppasteroutine (void); /*tablescrap*/
+#pragma mark === tablescrap ===
-extern boolean tableinitverbs (void); /*tableverbs.c*/
+extern boolean tabledroppasteroutine (void);
+
+#pragma mark === tableverbs.c ===
+
+extern boolean tableinitverbs (void);
+
extern boolean gettablevalue (hdltreenode, short, hdlhashtable *);
-extern boolean tablewindowopen (hdlexternalvariable, hdlwindowinfo *); /*tableexternal.c*/
+#pragma mark === tableexternal.c ===
+extern boolean tablewindowopen (hdlexternalvariable, hdlwindowinfo *);
+
extern boolean tablevaltotable (tyvaluerecord, hdlhashtable *, hdlhashnode);
extern boolean tableverbgetdisplaystring (hdlexternalvariable, bigstring);
@@ -104,13 +119,13 @@
extern boolean tableverbsetdirty (hdlexternalvariable, boolean);
-extern boolean tableedit (hdlexternalvariable, hdlwindowinfo, ptrfilespec, bigstring, rectparam);
+extern boolean tableedit ( hdlexternalvariable, hdlwindowinfo, ptrfilespec, const Handle, rectparam );
extern boolean tablewindowclosed (hdlexternalvariable);
extern boolean tablezoomfromtable (hdlhashtable);
-extern boolean tablezoomtoname (hdlhashtable, bigstring);
+extern boolean tablezoomtoname ( hdlhashtable, const Handle );
extern boolean tableclientsurface (hdlexternalvariable);
@@ -118,11 +133,11 @@
extern boolean tablepushglobals (hdlhashtable);
-extern boolean tablesymbolchanged (hdlhashtable, const bigstring, hdlhashnode, boolean);
+extern boolean tablesymbolchanged ( hdlhashtable, const Handle, hdlhashnode, boolean );
-extern boolean tablesymbolinserted (hdlhashtable, const bigstring);
+extern boolean tablesymbolinserted ( hdlhashtable, const Handle );
-extern boolean tablesymboldeleted (hdlhashtable, const bigstring);
+extern boolean tablesymboldeleted ( hdlhashtable, const Handle );
extern boolean tableverbclose (void);
@@ -136,5 +151,3 @@
#endif
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/strings.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/strings.c 2007-02-28 00:32:28 UTC (rev 1638)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/strings.c 2007-02-28 00:36:13 UTC (rev 1639)
@@ -116,13 +116,13 @@
boolean equaltextidentifiers (byte * string1, byte * string2, short len) {
+
while (--len >= 0)
-
if (getlower (*string1++) != getlower (*string2++))
-
return (false);
return (true); /*loop terminated*/
+
} /*equaltextidentifiers*/
@@ -239,27 +239,31 @@
#endif
-short compareidentifiers (bigstring bs1, bigstring bs2) {
+short compareidentifiers ( ptrbyte p1, ptrbyte p2 ) {
- /*
- 2004-11-09 aradke: cross between comparestrings and equalidentifiers,
- useful for sorting identifiers.
-
- return zero if the two strings (pascal type, with length-byte) are
- equal. return -1 if bs1 is less than bs2, or +1 if bs1 is greater than
- bs2. the comparison is not case-sensitive.
- */
+ //
+ // 2007-02-27 creedon: support for long odb item names and file paths
+ //
+ // 2004-11-09 aradke: cross between comparestrings and equalidentifiers,
+ // useful for sorting identifiers.
+ //
+ // return zero if the two strings (pascal type, with
+ // length-byte) are equal. return -1 if bs1 is less
+ // than bs2, or +1 if bs1 is greater than bs2. the
+ // comparison is not case-sensitive.
+ //
- register short n = min (stringlength (bs1), stringlength (bs2)) + 1;
- register ptrbyte p1 = (ptrbyte) stringbaseaddress (bs1);
- register ptrbyte p2 = (ptrbyte) stringbaseaddress (bs2);
+ register ptrbyte p3 = p1 + sizeof ( short );
+ register ptrbyte p4 = p2 + sizeof ( short );
+ register short n = min ( getHashKeyLength ( p1 ), getHashKeyLength ( p2 ) ) + 1;
- while (--n)
- if (getlower (*p1++) != getlower (*p2++))
- return ((getlower (*--p1) < getlower (*--p2)) ? -1 : +1); /*rewind*/
+ while ( --n )
+ if ( getlower ( *p3++ ) != getlower ( *p4++ ))
+ return ( ( getlower ( *--p3 ) < getlower ( *--p4 ) ) ? - 1 : + 1 ); // rewind
- return (sgn (stringlength (bs1) - stringlength (bs2)));
- } /*compareidentifiers*/
+ return ( sgn ( stringlength ( p3 ) - stringlength ( p4 ) ) );
+
+ } // compareidentifiers
boolean stringlessthan (register bigstring bs1, register bigstring bs2) {
@@ -734,7 +738,7 @@
boolean textnthword (ptrbyte ptext, long len, long wordnum, byte chdelim, boolean flstrict, long *ixword, long *lenword) {
-
+
/*
6/10/91 dmb: a single word preceeded or followed by chdelim should be
counted as just one word
@@ -773,11 +777,13 @@
ixlastword = ix + 1; /*next word starts after the delimiter*/
fllastwasdelim = true;
+
}
else
fllastwasdelim = false;
ix++; /*advance to next character*/
+
} /*while*/
/*
@@ -795,6 +801,7 @@
return (false);
return (ctwords == wordnum);
+
} /*textnthword*/
@@ -815,13 +822,16 @@
return (wordnum - 1);
wordnum++;
+
} /*while*/
+
} /*textcountwords*/
boolean lastword (bigstring bssource, byte chdelim, bigstring bsdest) {
return (textlastword (stringbaseaddress (bssource), stringlength (bssource), chdelim, bsdest));
+
} /*lastword*/
@@ -832,12 +842,14 @@
if (lastword (bs, chdelim, bsword))
setstringlength (bs, stringlength (bs) - stringlength (bsword));
+
} /*poplastword*/
boolean firstword (bigstring bssource, byte chdelim, bigstring bsdest) {
return (textfirstword (stringbaseaddress (bssource), stringlength (bssource), chdelim, bsdest));
+
} /*firstword*/
@@ -852,6 +864,7 @@
texttostring (stringbaseaddress (bs) + ixword, lenword, bsword);
return (true);
+
} /*nthword*/
@@ -870,12 +883,14 @@
texttostring (stringbaseaddress (bs) + ixfield, lenfield, bsfield);
return (true);
+
} /*nthfield*/
short countwords (bigstring bs, byte chdelim) {
return (textcountwords (stringbaseaddress (bs), stringlength (bs), chdelim, false));
+
} /*countwords*/
@@ -902,6 +917,7 @@
break;
ixcomment = searchhandle (x, hcomment, ixcomment + 2, longinfinity);
+
}
//scan for Mac comment
@@ -923,6 +939,7 @@
disposehandle (hcomment); //RAB: 1/27/98, clean up after one self
return (true);
+
} /*textcommentdelete*/
@@ -976,6 +993,7 @@
flinstring = true;
chendstring = '"';
+
}
else if (ch == (byte) '\xD2') {
@@ -983,6 +1001,7 @@
flinstring = true;
chendstring = '\xD3';
+
}
else if (ch == (byte) '\'') {
@@ -990,6 +1009,7 @@
flinstring = true;
chendstring = '\'';
+
}
else if (ch == chdelim)
@@ -1003,6 +1023,7 @@
}
return (-1);
+
} /*langcommentdelete*/
@@ -1018,12 +1039,14 @@
if (i >= 0)
setstringlength (bs, i);
+
} /*commentdelete*/
boolean whitespacechar (byte ch) {
+
+ return ((ch == ' ') || (ch == '\t') || (ch == '\n') || (ch == '\r'));
- return ((ch == ' ') || (ch == '\t') || (ch == '\n') || (ch == '\r'));
} /*whitespacechar*/
@@ -1044,11 +1067,13 @@
setstringlength (bs, i);
return (i < ct);
+
}
setemptystring (bs);
return (true); /*string is all blank*/
+
} /*poptrailingwhitespace*/
@@ -1075,32 +1100,17 @@
setstringlength (bs, i+1);
return (true);
+
}
}
+
} /*for*/
return (false); /*no chars popped*/
+
} /*firstsentence*/
-/* This is now initialized by initstrings and getlower is a macro in strings.h
-static boolean initlowercase = false;
-char lowercasetable[256];
-unsigned char getlower (unsigned char c) { /-fast lowercase functions-/
- int i;
-
- if (! initlowercase) {
- for (i = 0; i < 256; i++)
- lowercasetable[i] = tolower (i);
-
- initlowercase = true;
- }
-
- return (lowercasetable [c]);
- } /-getlower-/
-
-*/
-
void uppertext (ptrbyte ptext, long ctchars) {
register ptrbyte p = ptext;
@@ -1111,7 +1121,9 @@
ch = *p;
*p++ = toupper (ch);
+
}
+
} /*uppertext*/
@@ -1125,7 +1137,9 @@
ch = *p;
*p++ = getlower (ch);
+
}
+
} /*lowertext*/
@@ -1138,6 +1152,7 @@
void alllower (bigstring bs) {
lowertext (stringbaseaddress (bs), stringlength (bs));
+
} /*alllower*/
@@ -1156,6 +1171,7 @@
setstringcharacter (bs, 0, toupper (ch));
return (true);
+
} /*capitalizefirstchar*/
@@ -1182,10 +1198,13 @@
}
return (false);
+
}
+
} /*while*/
return (true); /*composed entirely of numeric chars*/
+
} /*isallnumeric*/
@@ -1201,11 +1220,13 @@
setstringlength (bs, ct);
memset (stringbaseaddress (bs), ch, (long) ct);
+
/*
bs [0] = ct;
memset (&bs [1], ch, (long) ct);
*/
+
} /*filledstring*/
@@ -1244,30 +1265,28 @@
setemptystring (bsdest);
return;
+
}
+
+ #ifdef SPEED
-#ifdef SPEED
- len = stringsize (bssource);
+ len = stringsize (bssource);
- moveleft ((ptrstring) bssource, bsdest, len);
+ moveleft ((ptrstring) bssource, bsdest, len);
-#else
- short i;
+ #else
+
+ short i;
- len = stringlength (bssource);
+ len = stringlength (bssource);
- for (i = 0; i < len; i++)
- setstringcharacter (bsdest, i, getstringcharacter (bssource, i));
+ for (i = 0; i < len; i++)
+ setstringcharacter (bsdest, i, getstringcharacter (bssource, i));
- setstringlength (bsdest, len);
-#endif
+ setstringlength (bsdest, len);
+
+ #endif
- /*
- len = (short) bssource [0];
-
- for (i = 0; i <= len; i++)
- bsdest [i] = bssource [i];
- */
} /*copystring*/
@@ -1278,6 +1297,7 @@
memmove (sdest, stringbaseaddress (bssource), len);
sdest [len] = '\0';
+
} /*copyptocstring*/
@@ -1329,6 +1349,7 @@
setemptystring (bsdest);
return;
+
}
// HLock ((Handle) h);
@@ -1336,6 +1357,7 @@
copystring (*h, bsdest);
// HUnlock ((Handle) h);
+
} /*copyheapstring*/
@@ -1400,9 +1422,13 @@
#ifdef MACVERSION
+
static byte bsellipses [] = "\x01\xC9";
+
#else
+
static byte bsellipses [] = "\x03...";
+
#endif
void ellipsize (bigstring bs, short width) {
@@ -1480,10 +1506,35 @@
}
pushstring (bsellipses, bs);
+
}
+
} /*ellipsize*/
+void ellipsizemiddle ( bigstring bs, short w ) {
+
+ //
+ // if the string fits inside the given number of pixels, fine -- do nothing and return
+ //
+ // if not, return a string that does fit, with ellipses representing the deleted characters
+ //
+ // 2006-12-31 creedon: created, cribbed from ellipsize function
+ //
+
+ if ( stringpixels ( bs ) <= w ) // nothing to do, the string fits
+ return;
+
+ if ( stringlength ( bs ) < 2 ) // too short to truncate
+ return;
+
+ w -= 5; // a little extra whitespace
+
+ TruncString ( w, bs, truncMiddle );
+
+ } // ellipsizemiddle
+
+
void parsedialogstring (const bigstring bssource, ptrstring bs0, ptrstring bs1, ptrstring bs2, ptrstring bs3, bigstring bsresult) {
/*
@@ -1550,9 +1601,11 @@
} /*for*/
/***subtractstrings (bsresult, "\p \xD2\xD3", bsresult); #*in case there was a missing param*/
- } /*parsedialogstring*/
+
+ } // parsedialogstring
-boolean parsedialoghandle (Handle hsource, Handle h0, Handle h1, Handle h2, Handle h3) {
+
+boolean parsedialoghandle ( Handle hsource, Handle h0, Handle h1, Handle h2, Handle h3 ) {
/*
6.1d1 AR: parse a handle with up to four handle parameters, following the syntax
@@ -1604,7 +1657,7 @@
return (true);
- } /*parsedialogstring*/
+ } // parsedialoghandle
boolean setparseparams (bigstring bs0, bigstring bs1, bigstring bs2, bigstring bs3) {
@@ -1620,6 +1673,7 @@
disposehandle ((Handle) parseparams [i]);
parseparams [i] = nil;
+
} /*for*/
if (bs0 != nil)
@@ -1831,7 +1885,7 @@
/*fill in the jump array according to the characters in the search pattern*/
- for (i = 0; i <= 255; i++)
+ for (i = 0; i <= 255; i++)
jump [i] = lenpattern;
for (i = 1; i <= lenpattern; i++)
@@ -1865,10 +1919,12 @@
/*fell through; reset search to position following last check*/
p = psave - dist + 1;
+
}
}
return (-1);
+
} /*textpatternmatch*/
@@ -1904,16 +1960,20 @@
if (getstringcharacter (bs, ix) != getstringcharacter (bspattern, i))
goto L1;
+
} /*for*/
return (ixstring + 1); /*loop terminated, full match*/
+
}
L1: /*advance to next character in string*/
if (++ixstring > lenstring) /*reached end of string, not found*/
return (0);
+
} /*while*/
+
} /*patternmatch*/
@@ -1929,6 +1989,7 @@
copystring (bs1, bsdest);
return (pushstring (bs2, bsdest));
+
} /*addstrings*/
@@ -1955,6 +2016,7 @@
}
return (false); /*didn't change string*/
+
} /*subtractstrings*/
@@ -1990,6 +2052,7 @@
len = sizeof (OSType);
fl = false;
+
}
moveleft (stringbaseaddress (bs), type, (long) len);
@@ -1997,6 +2060,7 @@
disktomemlong (*type);
return (fl);
+
} /*stringtoostype*/
@@ -2235,12 +2299,15 @@
*dir = indextodir (i);
return (true);
+
}
+
} /*for*/
*dir = nodirection;
return (false);
+
} /*stringtodir*/
@@ -2352,10 +2419,10 @@
return (true);
return (pushchar (':', bs));
- } /*assurelastchariscolon*/
+
+ } // assurelastchariscolon
-
static short getTextEncodingErrorNumFromOSCode( long osStatusCode )
{
switch ( osStatusCode )
@@ -3051,7 +3118,6 @@
} /* utf8tomacroman */
-
void initstrings (void) {
register short i;
@@ -3070,3 +3136,319 @@
newheapstring (bs, &dirstrings [i - 1]);
} /*for*/
} /*initstrings*/
+
+
+boolean textHandleAssureLastCharIsColon ( Handle textHandle ) {
+
+ //
+ // 2007-02-27 creedon: created
+ //
+
+ register ptrbyte p = ( ptrbyte ) *textHandle;
+
+ if ( p [ gethandlesize ( textHandle ) - 1 ] == ':' )
+ return ( true );
+
+ return ( pushcharhandle ( ':', textHandle ) );
+
+ } // textHandleAssureLastCharIsColon
+
+
+boolean setHandleCharacter ( Handle textHandle, long ix, char character ) {
+
+ //
+ // 2007-02-27 creedon: created
+ //
+
+ register ptrbyte p = ( ptrbyte ) *textHandle;
+
+ p [ ix ] = character;
+
+ return ( true );
+
+ } // setHandleCharacter
+
+
+boolean textHandleFindChar ( byte ch, Handle handleText ) {
+
+ //
+ // simpler entrypoint for scanstring when caller just wants to know if ch appears anywhere in handleText
+ //
+ // 2006-11-23 creedon: created, cribbed from stringfindchar
+ //
+
+ bigstring bs;
+ Handle findChar;
+
+ bs [ 0 ] = 1;
+ bs [ 1 ] = ch;
+
+ if ( ! newtexthandle ( bs, &findChar ) )
+ return ( false );
+
+ long ix = searchhandle ( handleText, findChar, 0L, gethandlesize ( handleText ) );
+
+ return ( ix > -1 );
+
+ } // textHandleFindChar
+
+
+boolean pullTextHandleSuffix ( Handle *source, Handle *suffix, unsigned char ch ) {
+
+ //
+ // get the suffix from a text handle. on return, handleSource lacks the
+ // suffix and the suffix character. handleSuffix contains the suffix minus
+ // the suffix character.
+ //
+ // 2006-11-22 creedon: created, cribbbed from pullsuffix function
+ //
+
+ long ix, lengthSource = gethandlesize ( *source );
+
+ if ( lengthSource <= 0 )
+ return ( false );
+
+ for ( ix = lengthSource - 1; ix >= 0; ix-- )
+
+ if ( ( byte ) ( ( **source ) [ ix ] ) == ch )
+
+ if ( newhandle ( lengthSource - ++ix, suffix ) )
+
+ if ( pullfromhandle ( *source, ix, lengthSource - ix, **suffix ) ) {
+
+ sethandlesize ( *source, --ix );
+
+ return ( true );
+
+ }
+
+ return ( false );
+
+ } // pullTextHandleSuffix
+
+
+char textHandleFirstChar ( Handle text ) {
+
+ //
+ // 2007-02-27 creedon: created
+ //
+
+ if ( ( text != NULL ) && validhandle ( text ) ) {
+
+ register ptrbyte p = ( ptrbyte ) *text;
+
+ return ( p [ 0 ] );
+
+ }
+
+ return ( NULL );
+
+ } // textHandleFirstChar
+
+
+char textHandleLastChar ( Handle textHandle ) {
+
+ //
+ // 2007-02-27 creedon: created
+ //
+
+ register ptrbyte p = ( ptrbyte ) *textHandle;
+
+ return ( p [ gethandlesize ( textHandle ) - 1 ] );
+
+ } // textHandleLastChar
+
+
+boolean textHandleLastWord ( Handle text, byte characterDelimiter, Handle *hWord ) {
+
+ //
+ // copy the last word from text and put it into hWord
+ //
+ // search backwards from the end of the source text until you find
+ // characterDelimiter
+ //
+ //
+ // 2007-02-27 creedon: created
+ //
+
+ register ptrbyte p = ( ptrbyte ) *text;
+
+ long ix, length = gethandlesize ( text );
+
+ for ( ix = length - 1; ix > 0; --ix ) {
+
+ if ( p [ ix ] == characterDelimiter )
+ break;
+
+ } // for
+
+ length = length - ++ix;
+
+ /* if ( ! newhandle ( length, hWord ) )
+ return ( false ); */
+
+ if ( ! loadfromhandletohandle ( text, &ix, length, false, hWord ) )
+ return ( false );
+
+ return ( true );
+
+ } // textHandleLastWord
+
+
+void osTypeToTextHandle ( OSType type, Handle *h ) {
+
+ //
+ // 2006-12-06 creedon: created, cribbed from ostypetostring function
+ //
+
+ long size = longsizeof ( OSType );
+
+ if ( ! newhandle ( size, h ) )
+ h = NULL;
+
+ disktomemlong ( type );
+
+ moveleft ( &type, **h, size );
+
+ } // osTypeToTextHandle
+
+
+boolean textHandleToOsType ( const Handle h, OSType *type ) {
+
+ //
+ // 2006-12-06 creedon: created, crribbed from stringtoostype function
+ //
+
+ /* register */ unsigned short len = gethandlesize ( h );
+
+ *type = ' ';
+
+ if ( len > sizeof ( OSType ) ) {
+
+ len = sizeof ( OSType );
+
+ return ( false );
+
+ }
+
+ moveleft ( *h, type, ( long ) len );
+
+ disktomemlong ( *type );
+
+ return ( true );
+
+ } // textHandleToOsType
+
+
+boolean getNthFieldTextHandle ( const Handle htext, long fieldnum, byte chdelim, boolean flstrict, Handle *hfield ) {
+
+ //
+ // 2006-12-08 creedon: cribbed from grabnthfield function
+ //
+
+ long ixword, lenword;
+
+ if ( textnthword ( ( ptrbyte ) *htext, gethandlesize ( htext ), fieldnum, chdelim, flstrict, &ixword, &lenword ) )
+ if ( loadfromhandletohandle ( htext, &ixword, lenword, false, hfield ) )
+ return ( true );
+
+ lenword = 0;
+
+ newemptyhandle ( hfield );
+
+ return ( false );
+
+ } // getNthFieldTextHandle
+
+
+boolean textHandleTrimWhiteSpace ( Handle text, boolean flTrimBegin, boolean flTrimEnd ) {
+
+ //
+ // 2007-02-27 creedon: created, cribbed from handletrimwhitespace function
+ //
+
+ long ixBegin, ixEnd, length = gethandlesize ( text );
+
+ if ( length <= 0 || ! ( flTrimBegin && flTrimEnd ) )
+ return ( false );
+
+ ixBegin = 0;
+
+ if ( flTrimBegin )
+ for ( ; ixBegin < length; ixBegin++ )
+ if ( ( *text ) [ ixBegin ] != ' ' && ( *text ) [ ixBegin ] != '\t' && ( *text ) [ ixBegin ] != '\r' &&
+ ( *text ) [ ixBegin ] != '\n' )
+ break;
+
+ ixEnd = length - 1;
+
+ if ( flTrimEnd )
+ for ( ; ixEnd >= 0; ixEnd-- )
+ if ( ( *text ) [ ixEnd ] != ' ' && ( *text ) [ ixEnd ] != '\t' && ( *text ) [ ixEnd ] != '\r' && ( *text ) [ ixEnd ] != '\n' )
+ break;
+
+ if ( ixEnd < ixBegin )
+ sethandlesize ( text, 0 );
+ else {
+ sethandlesize ( text, ixEnd + 1 ); // shrinking, can't fail
+
+ pullfromhandle ( text, 0, ixBegin, nil );
+
+ }
+
+ return ( length != gethandlesize ( text ) );
+
+ } // textHandleTrimWhiteSpace
+
+
+void textHandlePopTrailingChars ( Handle text, byte ch ) {
+
+ //
+ // 2006-12-25 creedon: created, cribbed from handlepoptrailingchars
+ // function
+ //
+
+ register ptrbyte p = ( ptrbyte ) *text;
+
+ long i, len = gethandlesize ( text );
+
+ if ( len <= 0 )
+ return;
+
+ for ( i = len - 1; i >= 0; i-- )
+ if ( p [ i ] != ch )
+ break;
+
+ sethandlesize ( text, i + 1 ); // shrinking, can't fail
+
+ } // textHandlePopTrailingChars
+
+
+boolean equalHandleIdentifiers ( const Handle h1, const Handle h2 ) {
+
+ //
+ // 2007-01-03 creedon: created, cribbed from equalidentifiers
+ //
+
+ register long ct = gethandlesize ( h1 );
+
+ if ( ct != gethandlesize ( h2 ) ) // different lengths
+
+ return ( false );
+
+ else {
+
+ /* register */ ptrbyte p1 = ( ( ptrbyte ) *h1 ) + ct - 1;
+ /* register */ ptrbyte p2 = ( ( ptrbyte ) *h2 ) + ct - 1;
+
+ while ( --ct >= 0 )
+
+ if ( getlower ( *p1-- ) != getlower ( *p2-- ) )
+
+ return ( false );
+ }
+
+ return ( true ); // loop terminated
+
+ } // equalHandleIdentifiers
+
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/stringverbs.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/stringverbs.c 2007-02-28 00:32:28 UTC (rev 1638)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/stringverbs.c 2007-02-28 00:36:13 UTC (rev 1639)
@@ -42,10 +42,10 @@
#include "timedate.h"
#include "oplist.h"
#include "tableverbs.h"
+#include "md5.h" // 6.1b11 AR
+#include "langcrypt.h" // 2006-12-02 creedon
-#include "md5.h" //6.1b11 AR
-
/*Latin to Mac conversion table: 7.0b28 PBS*/
/* moved to stringverbs.c: 2004-10-28 aradke */
@@ -316,13 +316,13 @@
ischarsetavailablefunc, /* 2006-04-23 smd */
ctstringverbs
+
} tystringtoken;
char chword = ' '; /*used when getting first word, last word, etc from a string*/
-
long countleadingchars (Handle htext, byte ch) {
long len = gethandlesize (htext);
@@ -410,12 +410,14 @@
}
return;
+
} /*handlepopsuffix*/
static boolean handlehassuffix (Handle hsuffix, Handle h) {
return (searchhandle (h, hsuffix, gethandlesize (h) - gethandlesize (hsuffix), longinfinity) >= 0);
+
} /*handlehassuffix*/
@@ -437,6 +439,7 @@
(*h) [maxlen - ix] = '.';
return (true);
+
} /*handleellipsize*/
@@ -742,11 +745,12 @@
return (setheapvalue (h, stringvaluetype, vreturned));
-exit:
+ exit:
- disposehandle (h);
+ disposehandle (h);
- return (false);
+ return (false);
+
} /*stringreplaceverb*/
@@ -773,10 +777,13 @@
}
return (setheapvalue (x, stringvaluetype, v));
+
} /*commentdeleteverb*/
-boolean parseaddress (Handle htext, tyvaluerecord *v); /*called from langhtml.c*/
+boolean parseaddress ( Handle, tyvaluerecord * );
+
+
boolean parseaddress (Handle htext, tyvaluerecord *v) {
/*
@@ -810,6 +817,7 @@
langerror (parseaddresserror); /*Can't parse the address because of a syntax error.*/
return (false);
+
}
fl = opnewlist (&hlist, false);
@@ -829,9 +837,11 @@
langerror (parseaddresserror); /*Can't parse the address because it's not a valid address.*/
return (false);
+
}
return (setheapvalue ((Handle) hlist, listvaluetype, v));
+
} /*parseaddressverb*/
@@ -845,6 +855,7 @@
return (false);
return (parseaddress (htext, v));
+
} /*parseaddressverb*/
@@ -915,16 +926,18 @@
} /*padwithzerosverb*/
-static boolean stringmultiplereplace (Handle h, hdlhashtable ht, boolean flunicase, bigstring bsstartstring, bigstring bsendstring) {
+static boolean stringmultiplereplace ( Handle h, hdlhashtable ht,
+ boolean flunicase, bigstring bsstartstring, bigstring bsendstring) {
+
+ //
+ // 2007-02-27 creedon: support for long odb item names and file paths
+ //
+ // 7.0b58 PBS: front end for string.replaceAll -- do a replace all for each
+ // item in a table.
+ //
- /*
- 7.0b58 PBS: front end for string.replaceAll -- do a replace all for
- each item in a table.
- */
-
hdlhashnode hn;
tyvaluerecord v;
- bigstring hashkey;
boolean flstartstring = false, flendstring = false;
if (stringlength (bsstartstring) > 0)
@@ -934,39 +947,37 @@
flendstring = true;
for (hn = (**ht).hfirstsort; hn != nil; hn = (**hn).sortedlink) {
-
+
v = ((**hn).val);
if (copyvaluerecord (v, &v) && coercevalue (&v, stringvaluetype)) {
-
+
Handle hfind;
- gethashkey (hn, hashkey);
-
- if (!newtexthandle (hashkey, &hfind))
- return (false);
-
+ if ( ! gethashkey ( hn, &hfind ) )
+ return ( false );
+
if (flstartstring) {
if (!inserttextinhandle (hfind, 0, bsstartstring)) {
disposehandle (hfind);
return (false);
} /*if*/
} /*if*/
-
+
if (flendstring) {
if (!inserttextinhandle (hfind, gethandlesize (hfind), bsendstring)) {
disposehandle (hfind);
return (false);
} /*if*/
} /*if*/
-
+
if (!textfindreplace (hfind, v.data.stringvalue, h, true, flunicase)) {
disposehandle (hfind);
return (false);
} /*if*/
disposehandle (hfind);
-
+
disposevaluerecord (v, false); // don't let tmp stack accumulate
} /*if*/
} /*for*/
@@ -1421,6 +1432,7 @@
return (setcharvalue (chword, v));
case deletefunc: {
+
/* 12/5/2004 smd: optimized */
Handle x;
@@ -1471,9 +1483,11 @@
return (false);
return (setheapvalue (x, stringvaluetype, v));
+
}
case insertfunc: {
+
Handle hsource;
Handle hdest;
long ixinsert;
@@ -1506,9 +1520,11 @@
disposehandle (hdest);
return (false);
+
}
return (setheapvalue (hdest, stringvaluetype, v));
+
}
case popleadingfunc: {
@@ -1579,6 +1595,7 @@
}
case hassuffixfunc: {
+
Handle h, hsuffix;
if (!getreadonlytextvalue (hp1, 1, &hsuffix))
@@ -1590,6 +1607,7 @@
return (false);
return (setbooleanvalue (handlehassuffix (hsuffix, h), v));
+
}
case midfunc: {
@@ -1629,9 +1647,11 @@
return (false);
return (setheapvalue (x, stringvaluetype, v));
+
}
case nthcharfunc: {
+
Handle htext;
byte ch;
long charnum;
@@ -1650,9 +1670,11 @@
ch = *((byte *) *htext + charnum - 1);
return (setcharvalue (ch, v));
+
}
case nthfieldfunc: {
+
Handle htext;
Handle x;
char chdelim;
@@ -1679,9 +1701,11 @@
grabnthfield (htext, fieldnum, chdelim, &x, true);
return (setheapvalue (x, stringvaluetype, v));
+
}
case countfieldsfunc: {
+
Handle htext;
char chdelim;
long ctfields;
@@ -1699,9 +1723,11 @@
setlongvalue (ctfields, v);
return (true);
+
}
case firstwordfunc: {
+
Handle htext;
Handle x;
@@ -1713,9 +1739,11 @@
grabnthfield (htext, 1, chword, &x, false);
return (setheapvalue (x, stringvaluetype, v));
+
}
case lastwordfunc: {
+
Handle htext;
flnextparamislast = true;
@@ -1726,9 +1754,11 @@
textlastword ((ptrbyte) *htext, gethandlesize (htext), chword, bs);
return (setstringvalue (bs, v));
+
}
case nthwordfunc: {
+
Handle htext;
Handle x;
long wordnum;
@@ -1744,9 +1774,11 @@
grabnthfield (htext, wordnum, chword, &x, false);
return (setheapvalue (x, stringvaluetype, v));
+
}
case countwordsfunc: {
+
Handle htext;
long ctwords;
@@ -1760,6 +1792,7 @@
setlongvalue (ctwords, v);
return (true);
+
}
case commentdeletefunc:
@@ -1843,6 +1876,7 @@
}
case patternmatchfunc: {
+
Handle hsearch, hpattern;
long ixmatch;
short ctconsumed = 2;
@@ -1871,6 +1905,7 @@
setlongvalue (ixmatch + 1, v);
return (true);
+
}
case hexfunc: {
@@ -1945,6 +1980,7 @@
return (stringreplaceverb (hp1, v, true));
case lengthfunc: {
+
Handle htext;
flnextparamislast = true;
@@ -1953,6 +1989,7 @@
return (false);
return (setlongvalue (gethandlesize (htext), v));
+
}
case isalphafunc: {
@@ -2032,6 +2069,7 @@
}
case davenetmassagerfunc: {
+
Handle htext, hnew;
boolean result;
short indentlen, maxlinelen;
@@ -2052,18 +2090,23 @@
result = result && setheapvalue (hnew, stringvaluetype, v);
return (result);
+
}
case parseaddressfunc:
+
return (parseaddressverb (hparam1, v));
case dropnonalphasfunc:
+
return (dropnonalphasverb (hparam1, v));
case padwithzerosfunc:
+
return (padwithzerosverb (hparam1, v));
case ellipsizefunc: {
+
Handle htext;
long maxlen = 35;
@@ -2083,9 +2126,11 @@
}
return (setheapvalue (htext, stringvaluetype, v));
+
}
case innercasefunc: {
+
Handle x;
flnextparamislast = true;
@@ -2099,6 +2144,7 @@
}
case urlsplitfunc: {
+
Handle x;
flnextparamislast = true;
@@ -2107,73 +2153,33 @@
return (false);
return (urlsplit (x, v));
+
}
case hashmd5func: {
- Handle x;
- MD5_CTX hashcontext; /* MD5 context. */
- unsigned char checksum[16];
- short ctconsumed = 1;
- short ctpositional = 1;
+
+ Handle h, x;
+ boolean flHex;
+ short ctconsumed = 1, ctpositional = 1;
tyvaluerecord vtranslate;
-
- if (!getreadonlytextvalue (hp1, 1, &x))
- return (false);
+
+ if ( ! getreadonlytextvalue ( hp1, 1, &x ) )
+ return ( false );
- setbooleanvalue (true, &vtranslate);
+ setbooleanvalue ( true, &vtranslate );
flnextparamislast = true;
- if (!getoptionalparamvalue (hp1, &ctconsumed, &ctpositional, BIGSTRING ("\x0b""flTranslate"), &vtranslate))
- return (false);
-
-/* if (langgetparamcount (hparam1) > 1) {
-
- flnextparamislast = true;
-
- if (!getbooleanvalue (hparam1, 2, &flTranslate))
- return (false);
- }
-*/
- lockhandle (x);
-
- MD5Init (&hashcontext);
-
- MD5Update (&hashcontext, (unsigned char *)(*x), gethandlesize (x));
-
- MD5Final (checksum, &hashcontext);
-
- unlockhandle (x);
-
- if (vtranslate.data.flvalue) { /*return a hex string*/
- bigstring lbs;
- unsigned char enc[] = "0123456789abcdef";
- long ix;
- Handle h;
-
- for(ix = 0; ix < 16; ix++) {
- setstringcharacter (lbs, 2*ix, enc[(int)((checksum[ix])/16)]);
- setstringcharacter (lbs, 2*ix+1, enc[(int)((checksum[ix])%16)]);
- }/*for*/
-
- setstringlength (lbs, 32);
-
- if (!newtexthandle (lbs, &h))
- return (false);
-
- return (setheapvalue (h, stringvaluetype, v));
- }
-
- else { /*return a binary of unknown type*/
- Handle h;
-
- if (!newfilledhandle (checksum, 16, &h))
- return (false);
-
- return (setbinaryvalue (h, typeunknown, v));
- }
-
- return (true);
+ if ( ! getoptionalparamvalue ( hp1, &ctconsumed, &ctpositional, BIGSTRING ( "\x0b""flTranslate" ), &vtranslate ) )
+ return ( false );
+
+ if ( ! md5 ( x, vtranslate.data.flvalue, &h, &flHex ) )
+ return ( false );
+
+ if ( flHex )
+ return ( setheapvalue ( h, stringvaluetype, v ) );
+ else
+ return ( setbinaryvalue ( h, typeunknown, v ) ); // return a binary of unknown type
}
case latintomacfunc: { /*7.0b28 PBS: convert from Latin to Mac character sets*/
@@ -2300,6 +2306,7 @@
goto error;
return (setheapvalue (hresult, stringvaluetype, v));
+
}
case utf8tomacromanfunc: { /* 2006-02-25 creedon: convert utf-8 character set to mac roman */
@@ -2317,6 +2324,7 @@
goto error;
return (setheapvalue (hresult, stringvaluetype, v));
+
}
case convertcharsetfunc: /* 2006-04-13 smd: convert any character set to any other character set, if the os supports it */
@@ -2364,6 +2372,7 @@
getstringlist (stringerrorlist, errornum, bserror);
return (false);
+
} /*stringfunctionvalue*/
@@ -2381,5 +2390,6 @@
*/
return (loadfunctionprocessor (idstringverbs, &stringfunctionvalue));
+
} /*stringinitverbs*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/tabledisplay.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/tabledisplay.c 2007-02-28 00:32:28 UTC (rev 1638)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/tabledisplay.c 2007-02-28 00:36:13 UTC (rev 1639)
@@ -162,19 +162,27 @@
static void tabledisplaytitle (short col, boolean flbitmap) {
+
+ // 2007-02-27 creedon: support for long odb item names and file paths
+ //
+ Handle h;
+ Rect r;
+ bigstring bs;
hdlhashtable ht;
- bigstring bs;
- Rect r;
short fontstyle = bold;
if (col == (**tableformatsdata).sorttitlecol)
fontstyle |= underline;
-
+
pushstyle ((**outlinedata).fontnum, (**outlinedata).fontsize, fontstyle);
- tablegetcursorinfo (&ht, bs, nil, nil);
+ tablegetcursorinfo ( &ht, &h, nil, nil );
+ texthandletostring ( h, bs );
+
+ disposehandle ( h );
+
tablegettitlerect (col, &r); /*set left and right*/
tableprepfordraw (&r); /*inset the rect, move QuickDraw's pen*/
@@ -183,7 +191,7 @@
if (flbitmap)
flbitmap = openbitmap (r, (WindowPtr) getport ());
-
+
#if TARGET_API_MAC_CARBON == 1
pushpen ();
@@ -193,7 +201,7 @@
paintrect (r);
poppen ();
-
+
#else
eraserect (r);
@@ -206,8 +214,9 @@
if (flbitmap)
closebitmap ((WindowPtr) getport ());
+
+ popstyle ();
- popstyle ();
} /*tabledisplaytitle*/
@@ -231,48 +240,34 @@
boolean tablechecksortorder (void) {
+
+ // 2007-02-27 creedon: support for long odb item names and file paths
+ //
+ Handle h = NULL; // place holder
+ hdlhashtable ht;
hdltableformats hf = tableformatsdata;
- hdlhashtable ht;
- bigstring bs;
- if (tablegetcursorinfo (&ht, bs, nil, nil)) {
+ if (tablegetcursorinfo (&ht, &h, nil, nil)) {
+
+ if ((**ht).sortorder != (**hf).sorttitlecol) {
- if ((**ht).sortorder != (**hf).sorttitlecol) {
-
(**hf).sorttitlecol = (**ht).sortorder;
+ disposehandle ( h );
+
return (true);
+
}
}
+
+ disposehandle ( h );
- return (false);
+ return ( false );
+
} /*tablechecksortorder*/
-/*
-static void tableupdateseparator (void) {
-
- /%
- we formalized the separator rect so we could easily experiment with different
- ideas for showing the boundary between the titles of a table display and
- the content of the table.
- %/
-
- Rect seprect;
-
- seprect = (**tableformatsdata).seprect;
-
- if (!shellrectneedsupdate (&seprect)) /%no intersection, nothing to do%/
- return;
-
- if ((**tableformatsdata).flprinting)
- return;
-
- eraserect (seprect);
- } /%tableupdateseparator%/
-*/
-
static void tableupdategridlines (void) {
/*
@@ -426,16 +421,17 @@
boolean tabletitleclick (Point pt) {
+
+ //
+ // 2007-02-27 creedon: support for long odb item names and file paths
+ //
+ // 5.0.2b20 dmb: set style when measuring title text
+ //
- /*
- 5.0.2b20 dmb: set style when measuring title text
- */
-
+ bigstring bs;
+ hdloutlinerecord ho = outlinedata;
hdltableformats hf = tableformatsdata;
- hdloutlinerecord ho = outlinedata;
- short dh;
- short col;
- bigstring bs;
+ short col, dh;
dh = pt.h - (**hf).titlerect.left;
@@ -445,7 +441,7 @@
tablegettitlestring (col, bs);
-// tablesettitlestyle (col);
+ // tablesettitlestyle (col);
pushstyle ((**ho).fontnum, (**ho).fontsize, bold);
@@ -457,16 +453,20 @@
if (pointinrect (pt, titlerect))
if (trackicon (titlerect, &tableinverttitle)) {
-
+
+ Handle h;
hdlhashtable ht;
- bigstring lbs;
- tablegetcursorinfo (&ht, lbs, nil, nil);
+ tablegetcursorinfo ( &ht, &h, nil, nil );
- tablesetsortorder (ht, col);
+ disposehandle ( h );
+
+ tablesetsortorder ( ht, col );
+
}
+
+ return (true);
- return (true);
} /*tabletitleclick*/
@@ -745,37 +745,56 @@
boolean tablegetcellstring (hdlheadrecord hnode, short col, bigstring bs, boolean fllimitbinaries) {
-
- /*
- 1/8/91 dmb: push/pophashtable around call to hashvaltostrings, since
- we can no longer assume that the root table is always set
- call hashgetvaluestring, _or_ hashgettype/size string; not hashvaltostrings
+ //
+ // 2007-02-27 creedon: support for long odb item names and file paths
+ //
+ // 5.0.2b3 dmb: user tablepush/popcontext; don't just push our table as a
+ // context
+ //
+ // 1991-01-08 dmb: push/pophashtable around call to hashvaltostrings, since
+ // we can no longer assume that the root table is always
+ // set
+ //
+ // call hashgetvaluestring, _or_ hashgettype/size string;
+ // not hashvaltostrings
+ //
- 5.0.2b3 dmb: user tablepush/popcontext; don't just push our table as a context
- */
-
- bigstring bstype, bssize;
+ bigstring bssize, bstype;
+ hdlhashnode hhashnode;
+ tybrowserspec fs;
tyvaluerecord val;
- tybrowserspec fs;
- hdlhashnode hhashnode;
-// tablegetstringlist (questionmarksstring, bs);
+ if ( col == namecolumn ) {
- if (col == namecolumn) {
+ Handle h;
+ long length;
- if (!opgetheadstring (hnode, bs))
- return (false);
+ if ( ! opGetHeadTextHandle ( hnode, &h ) )
+ return ( false );
+
+ length = gethandlesize ( h );
- //omit xml prefix
+ if ( length > 255 ) // trim from the middle
+ pullfromhandle ( h, 128, length - 255, NULL );
+
+ texthandletostring ( h, bs );
+
+ disposehandle ( h );
+
+ // omit xml prefix
+
if ((stringlength (bs) > 5) && getstringcharacter (bs, 4) == chtab)
deletestring (bs, 1, 5);
else
if ((stringlength (bs) > 9) && getstringcharacter (bs, 8) == chtab)
deletestring (bs, 1, 9);
+
+ return (true);
- return (true);
}
+
+ clearbytes ( &fs, sizeof ( fs ) );
if (!claygetfilespec (hnode, &fs))
return (false);
@@ -801,6 +820,7 @@
setstringlength (bs, min (stringlength (bs), binarycharacterstomeasure));
return (true); /*with bs set to the value of the variable*/
+
}
hashgettypestring (val, bstype);
@@ -814,11 +834,13 @@
pushstring (bssize, bstype);
pushchar (']', bstype);
+
}
copystring (bstype, bs);
return (true);
+
} /*tablegetcellstring*/
@@ -908,35 +930,34 @@
boolean tabledefaultdrawcell (hdlheadrecord hnode, short col, const Rect *rcell) {
+
+ //
+ // 2007-02-27 creedon: ellipsize string from middle
+ //
register hdltableformats hf = tableformatsdata;
+
bigstring bs;
if (opeditingtext (hnode) && ((**hf).editnode == hnode) && ((**hf).editcol == col)) {
-
+
opeditupdate ();
return (true);
+
}
-
- /*
- if (col == valuecolumn)
- pushbackcolor (&lightgraycolor);
-
- eraserect (*rcell);
-
- if (col == valuecolumn)
- popbackcolor ();
- */
-
+
if (!tablegetcellstring (hnode, col, bs, false))
return (false);
+
+ // ellipsize (bs, (*rcell).right - (*rcell).left);
- ellipsize (bs, (*rcell).right - (*rcell).left);
+ ellipsizemiddle ( bs, ( *rcell ).right - ( *rcell ).left );
pendrawstring (bs);
return (true);
+
} /*tabledefaultdrawcell*/
@@ -1009,6 +1030,7 @@
else
grayframerect (rcell);
}
+
} /*tabledrawcell*/
@@ -1161,13 +1183,17 @@
boolean tableadjustcursor (hdlheadrecord hnode, Point pt, const Rect *textrect) {
+
+ //
+ // 2007-02-27 creedon: support for long odb item names and file paths
+ //
+ Handle h;
+ hdlhashnode hhashnode;
+ hdlhashtable htable;
short col;
tycursortype cursortype = cursorisarrow;
- hdlhashtable htable;
- bigstring bs;
tyvaluerecord val;
- hdlhashnode hhashnode;
col = tablefindcolumn (hnode, pt, textrect);
@@ -1178,7 +1204,7 @@
break;
case valuecolumn:
- if (tablegetiteminfo (hnode, &htable, bs, &val, &hhashnode) && (val.valuetype != externalvaluetype))
+ if (tablegetiteminfo (hnode, &htable, &h, &val, &hhashnode) && (val.valuetype != externalvaluetype))
cursortype = cursorisibeam;
break;
@@ -1190,93 +1216,82 @@
setcursortype (cursortype);
return (true);
+
} /*tableadjustcursor*/
boolean tablemouseinline (hdlheadrecord hnode, Point pt, const Rect *textrect, boolean *flintext) {
- /*
- 5.0d19 dmb: zoom item on value column 2click
- */
+ //
+ // 2007-02-27 creedon: support for long odb item names and file paths
+ //
+ // 5.0d19 dmb: zoom item on value column 2click
+ //
+ hdlhashnode hhashnode;
hdltableformats hf = tableformatsdata;
short col;
- hdlhashnode hhashnode;
col = tablefindcolumn (hnode, pt, textrect);
- switch (col) {
+ switch ( col ) {
case namecolumn:
+
break;
case valuecolumn: {
+
+ Handle h;
hdlhashtable htable;
- bigstring bs;
tyvaluerecord val;
- if (tablegetiteminfo (hnode, &htable, bs, &val, &hhashnode) && (val.valuetype == externalvaluetype)) {
+ if ( tablegetiteminfo ( hnode, &htable, &h, &val, &hhashnode ) && ( val.valuetype == externalvaluetype ) ) {
+
+ disposehandle ( h );
*flintext = false;
if (mousedoubleclick ()) {
-
+
tablezoomfromhead (hnode);
setmousedoubleclickstatus (false);
return (false);
+
}
-
+
return (true);
+
}
+
+ break;
- break;
}
+
+ default:
- default:
*flintext = false;
-
+
return (true);
}
-
+
(**hf).focuscol = col;
if (col != (**hf).editcol)
(**outlinedata).flcursorneedsdisplay = true; /*make sure opmoveto does something*/
-
+
*flintext = true;
return (true);
+
} /*tablemouseinline*/
-/*
-boolean tablereturnkey (tydirection dir) {
-
- hdloutlinerecord ho = outlinedata;
- hdlheadrecord hpre = (**ho).hbarcursor;
- tybrowserspec fspre;
- hdlhashtable htable;
-
- if (!claygetfilespec (hpre, fspre))
- return (false);
-
- if (dir == right)
- claygetdirid (&fspre, &htable);
- else
- htable = fspre.dirid;
-
- getparent
- return (opinsertheadline (emptystring, dir, flcomment));
- } /%tablereturnkey%/
-*/
+boolean tableinitdisplay (void) {
-boolean tableinitdisplay (void) {
+ return (true);
- return (true);
} /*tableinitdisplay*/
-
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/tableedit.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/tableedit.c 2007-02-28 00:32:28 UTC (rev 1638)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/tableedit.c 2007-02-28 00:36:13 UTC (rev 1639)
@@ -41,216 +41,258 @@
#include "wpengine.h"
#include "claybrowser.h"
#include "claycallbacks.h"
+#include "file.h" // 2006-11-27 creedon
-boolean tablecelliseditable (hdlheadrecord hnode, short col) {
+boolean tablecelliseditable ( hdlheadrecord hnode, short col ) {
+
+ //
+ // 2007-02-27 creedon: support for long odb item names and file paths
+ //
+ // return true if there should be an ibeam cursor in this cell.
+ //
- /*
- return true if there should be an ibeam cursor in this cell.
- */
-
+ Handle h;
+ hdlhashnode hhashnode;
hdlhashtable htable;
- bigstring bs;
tyvaluerecord val;
- hdlhashnode hhashnode;
- if (!tablegetiteminfo (hnode, &htable, bs, &val, &hhashnode))
- return (false);
+ if ( ! tablegetiteminfo ( hnode, &htable, &h, &val, &hhashnode ) )
+ return ( false );
- switch (col) {
+ switch ( col ) {
+
+ case namecolumn: // names are always editable
- case namecolumn: /*names are always editable*/
- return (true);
+ return ( true );
+
+ case valuecolumn: // only scalar values are editable
- case valuecolumn: /*only scalar values are editable*/
- return ((val.valuetype != externalvaluetype) && (val.valuetype != codevaluetype));
+ return ( ( val.valuetype != externalvaluetype ) && ( val.valuetype != codevaluetype ) );
+
+ default: // kind is not directly editable
- default: /*kind is not directly editable*/
- return (false);
- } /*switch*/
- } /*tablecelliseditable*/
+ return ( false );
+
+ } // switch
+
+ } // tablecelliseditable
-static boolean getvalueedittext (const tyvaluerecord *val, Handle *htext) {
+static boolean getvalueedittext ( const tyvaluerecord *val, Handle *htext ) {
+
+ //
+ // return the editable text corresponding to the value
+ //
+ // 2007-02-27 creedon: support for long odb item names and file paths
+ //
- /*
- return the editable text corresponding to the value.
- */
-
+ bigstring bsvalue;
tyvaluerecord valcopy;
- bigstring bsvalue;
- switch ((*val).valuetype) {
+ switch ( ( *val ).valuetype ) {
- case stringvaluetype:
case listvaluetype:
case recordvaluetype:
- if (!copyvaluerecord (*val, &valcopy) || !coercetostring (&valcopy))
- return (false);
+ case stringvaluetype:
- exemptfromtmpstack (&valcopy);
+ if ( ! copyvaluerecord ( *val, &valcopy ) || ! coercetostring ( &valcopy ) )
+ return ( false );
+
+ exemptfromtmpstack ( &valcopy );
*htext = valcopy.data.stringvalue;
break;
+
+ case binaryvaluetype:
- case binaryvaluetype:
- if (!bytestohex ((*val).data.binaryvalue, htext))
- return (false);
+ if ( ! bytestohex ( ( *val ).data.binaryvalue, htext ) )
+ return ( false );
+
+ pullfromhandle ( *htext, 2, 8, nil ); // get rid of the binary type
- pullfromhandle (*htext, 2, 8, nil); /*get rid of the binary type*/
+ break;
+ case filespecvaluetype:
+
+ newemptyhandle ( htext );
+
+ if ( ! filespectopath ( *( *val ).data.filespecvalue, htext ) )
+ return ( false );
+
break;
+
+ default:
- default:
- hashgetvaluestring (*val, bsvalue);
+ hashgetvaluestring ( *val, bsvalue );
- if (!newtexthandle (bsvalue, htext))
- return (false);
-
+ if ( ! newtexthandle ( bsvalue, htext ) )
+ return ( false );
+
break;
}
+
+ return ( true );
- return (true);
- } /*getvalueedittext*/
+ } // getvalueedittext
-boolean tablesetwpedittext (hdlheadrecord hnode) {
+boolean tablesetwpedittext ( hdlheadrecord hnode ) {
+
+ //
+ // 2007-02-27 creedon: support for long odb item names and file paths
+ //
+ // 1997-02-07 dmb: adapted from tableeditentercell, but our role is more
+ // focused: we just need to put the right text into the wp.
+ //
- /*
- 2/7/97 dmb: adapted from tableeditentercell, but our role is
- more focused: we just need to put the right text into the wp.
- */
+ hdltableformats hc = tableformatsdata;
- hdltableformats hc = tableformatsdata;
+ Handle htext = nil;
+ boolean fl = false;
+ hdlhashnode hhashnode;
+ hdlhashtable htable;
short col = (**hc).focuscol;
- hdlhashtable htable;
tyvaluerecord val;
- bigstring bs;
- boolean fl = false;
- Handle htext = nil;
- hdlhashnode hhashnode;
- (**hc).focuscol = 0; // reset
+ ( **hc ).focuscol = 0; // reset
- switch (col) {
+ switch ( col ) {
case namecolumn:
- getheadstring (hnode, bs);
+
+ fl = opGetHeadTextHandle ( hnode, &htext );
- fl = newtexthandle (bs, &htext);
-
break;
- case valuecolumn:
- if (!tablegetiteminfo (hnode, &htable, bs, &val, &hhashnode))
+ case valuecolumn: {
+
+ Handle h;
+
+ if ( ! tablegetiteminfo ( hnode, &htable, &h, &val, &hhashnode ) ) {
+
+ disposehandle ( h );
+
break;
+
+ }
+
+ disposehandle ( h );
- if (val.valuetype == externalvaluetype) /*can't edit external in its cell*/
+ if ( val.valuetype == externalvaluetype ) // can't edit external in its cell
break;
- pushhashtable (htable);
+ pushhashtable ( htable );
- fl = getvalueedittext (&val, &htext);
+ fl = ge...
[truncated message content] |
|
From: <cre...@us...> - 2007-02-28 00:32:28
|
Revision: 1638
http://svn.sourceforge.net/frontierkernel/?rev=1638&view=rev
Author: creecode
Date: 2007-02-27 16:32:28 -0800 (Tue, 27 Feb 2007)
Log Message:
-----------
formatting tweaks
Modified Paths:
--------------
Frontier/branches/Frontier_Long_File_Paths/Common/source/tablewindow.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/threads.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/timedate.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/wpverbs.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/tablewindow.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/tablewindow.c 2007-02-27 23:30:09 UTC (rev 1637)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/tablewindow.c 2007-02-28 00:32:28 UTC (rev 1638)
@@ -308,6 +308,7 @@
shelladjustaftergrow (tableformatswindow); /*PBS 7.0b52: Get col. titles caught up.*/
return (true);
+
} /*tableverbsetfont*/
@@ -365,44 +366,46 @@
if (outlinedata == nil)
return;
-
+
if (tablechecksortorder ())
tableupdatecoltitles (false);
-
+
if (tablecheckzoombutton ())
tabledrawzoombutton (false);
-
+
browsercommitchanges ();
opidle ();
+
} /*tableverbeventloopidle*/
static boolean tablegetvariableroutine (ptrvoid refcon) {
-
+
hdlexternalvariable *hvariable = (hdlexternalvariable *) refcon;
hdlhashtable ht;
if (tableformatsdata == nil)
return (false);
-
+
ht = (hdlhashtable) (**tableformatsdata).htable;
*hvariable = (hdlexternalvariable) (**ht).hashtablerefcon;
return (true);
+
} /*tablegetvariableroutine*/
boolean tableverbclose (void) {
-
+
hdltableformats hf = tableformatsdata;
hdlhashtable ht;
hdloutlinerecord ho = outlinedata;
if (hf == nil) //already closed & disposed?
return (true);
-
+
ht = (hdlhashtable) (**hf).htable;
// tableverbcheckwindowrect (ho);
@@ -416,15 +419,18 @@
assert ((**hf).editval == nil);
if (tableoutlineneedssaving ()) { /*we have to keep the in-memory version around*/
-
+
(**ho).flwindowopen = false;
opcloseoutline (); /*prepare for dormancy, not in a window anymore*/
+
}
else {
+
tabledisposeoutline (hf);
+
}
-
+
killundo (); /*toss any newly-generated undos*/
tablewindowclosed ((hdlexternalvariable) (**ht).hashtablerefcon);
@@ -435,7 +441,8 @@
(**ht).flwindowopen = false;
- return (true);
+ return (true);
+
} /*tableverbclose*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/threads.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/threads.c 2007-02-27 23:30:09 UTC (rev 1637)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/threads.c 2007-02-28 00:32:28 UTC (rev 1638)
@@ -437,46 +437,52 @@
boolean threadyield (boolean flresting) {
-#pragma unused(flresting)
+ #pragma unused(flresting)
+
/*
5.0a19 dmb: added flresting parameter
*/
-
-#ifdef MACVERSION
- ThreadID idthread = idwaitingthread;
- idwaitingthread = kNoThreadID;
+ #ifdef MACVERSION
- return (YieldToThread (idthread) == noErr);
-#endif
-
-#ifdef WIN95VERSION
- ptrvoid hglobals = TlsGetValue (ixlocalthreadglobals);
+ ThreadID idthread = idwaitingthread;
+
+ idwaitingthread = kNoThreadID;
+
+ return (YieldToThread (idthread) == noErr);
+
+ #endif
- (*threadcallbacks.swapoutcallback) (hglobals);
+ #ifdef WIN95VERSION
- if (flresting)
- SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_BELOW_NORMAL);
+ ptrvoid hglobals = TlsGetValue (ixlocalthreadglobals);
+
+ (*threadcallbacks.swapoutcallback) (hglobals);
+
+ if (flresting)
+ SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_BELOW_NORMAL);
+
+ ReleaseMutex (hsharedthreadglobals);
- ReleaseMutex (hsharedthreadglobals);
+ Sleep (0L); /*6.1b12 AR: give up the rest of our timeslice*/
+
+ WaitForSingleObject (hsharedthreadglobals, INFINITE);
- Sleep (0L); /*6.1b12 AR: give up the rest of our timeslice*/
-
- WaitForSingleObject (hsharedthreadglobals, INFINITE);
-
- if (flresting) {
+ if (flresting) {
- // if (inmainthread ())
- // SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_ABOVE_NORMAL);
- // else
- SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_NORMAL);
- }
-
- (*threadcallbacks.swapincallback) (hglobals);
+ // if (inmainthread ())
+ // SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_ABOVE_NORMAL);
+ // else
+ SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_NORMAL);
+ }
+
+ (*threadcallbacks.swapincallback) (hglobals);
+
+ return (true);
+
+ #endif
- return (true);
-#endif
} /*threadyield*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/timedate.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/timedate.c 2007-02-27 23:30:09 UTC (rev 1637)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/timedate.c 2007-02-28 00:32:28 UTC (rev 1638)
@@ -695,12 +695,10 @@
while (getstringcharacter(bsdate, idx-1) == ' ')
--idx;
- if (idx > 3) {
- if ((getstringcharacter(bsdate, idx - 3) == 'G') && (getstringcharacter(bsdate, idx - 2) == 'M') && (getstringcharacter(bsdate, idx -1) == 'T')) {
+ if (idx > 3)
+ if ((getstringcharacter(bsdate, idx - 3) == 'G') && (getstringcharacter(bsdate, idx - 2) == 'M') && (getstringcharacter(bsdate, idx -1) == 'T'))
flUseGMT = true;
- }
- }
-
+
*ptime = 0; /*default return value*/
clearbytes (&longdate, sizeof (longdate));
@@ -722,14 +720,12 @@
shortdate.month = longdate.ld.month;
shortdate.year = longdate.ld.year;
+
}
else {
SecondsToDate (0, &shortdate);
-
- /*
- GetTime (&shortdate);
- */
+
}
shortdate.hour = longdate.ld.hour; /*time fields will be zero if !flgottime*/
@@ -740,13 +736,13 @@
DateToSeconds (&shortdate, ptime);
- if (flUseGMT) {
+ if (flUseGMT)
adjustforcurrenttimezone (ptime);
- }
#endif
#ifdef WIN95VERSION
+
tydaterec returnDT;
tydaterec return2DT;
tydaterec actualDT;
@@ -887,6 +883,7 @@
#endif
return (true);
+
} /*stringtotime*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/wpverbs.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/wpverbs.c 2007-02-27 23:30:09 UTC (rev 1637)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/wpverbs.c 2007-02-28 00:32:28 UTC (rev 1638)
@@ -1085,6 +1085,7 @@
}
case settextfunc: {
+
Handle htext;
flnextparamislast = true;
@@ -1098,6 +1099,7 @@
fl = setbooleanvalue (true, v);
break;
+
}
case getseltextfunc: {
@@ -1360,6 +1362,7 @@
}
case insertfunc: {
+
Handle x;
flnextparamislast = true;
@@ -1377,6 +1380,7 @@
fl = true;
break;
+
}
/*
@@ -1942,6 +1946,7 @@
*hv = (hdlexternalvariable) (**wpdata).wprefcon;
return (true);
+
} /*wpverbgetvariable*/
@@ -1966,6 +1971,7 @@
default:
return (false);
}
+
} /*wpverbgettargetdata*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cre...@us...> - 2007-02-27 23:30:13
|
Revision: 1637
http://svn.sourceforge.net/frontierkernel/?rev=1637&view=rev
Author: creecode
Date: 2007-02-27 15:30:09 -0800 (Tue, 27 Feb 2007)
Log Message:
-----------
formatting tweaks
Modified Paths:
--------------
Frontier/branches/Frontier_Long_File_Paths/Common/SystemHeaders/standard.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/stringdefs.h
Frontier/branches/Frontier_Long_File_Paths/Common/source/resources.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/search.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shell.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shellactivate.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shellcallbacks.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shellhooks.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shellscroll.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shellundo.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/tablecompare.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/tableformats.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/SystemHeaders/standard.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/SystemHeaders/standard.h 2007-02-27 20:29:44 UTC (rev 1636)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/SystemHeaders/standard.h 2007-02-27 23:30:09 UTC (rev 1637)
@@ -33,13 +33,17 @@
#define standardinclude /*so other modules can tell that we've been included*/
#ifdef WIN95VERSION
+
#include "macconv.h"
-#endif
+
+ #endif // WIN95VERSION
+
+#ifdef MACVERSION
-#ifdef MACVERSION /* 2005-01-09 SMD - for getmilliseconds */
- #include "FastTimes.h"
-#endif
-
+ #include "FastTimes.h" // 2005-01-09 SMD - for getmilliseconds
+
+ #endif // MACVERSION
+
#include "stringdefs.h" /* embedded string definitions */
#ifndef appletdefsinclude
@@ -73,7 +77,6 @@
#endif
-
/*constants*/
#ifndef ctdirections
@@ -205,13 +208,29 @@
#ifdef WIN95VERSION
-typedef unsigned char Str255[258];
+
+ typedef unsigned char Str255 [ 258 ];
+
#endif
#define lenbigstring 255
+#ifdef MACVERSION // 2006-11-19 creedon
+
+ #define MAXPATHLEN 1024 // i wanted to include <sys/param.h> but that didn't fly! how can I include it here?
+ #define lengthpathstring MAXPATHLEN
+
+ #endif // MACVERSION
+
+#ifdef WIN95VERSION // 2006-11-19 creedon
+
+ #define MAX_PATH 260
+ #define lengthpathstring MAX_PATH // see < http://msdn2.microsoft.com/en-us/library/930f87yf(VS.80).aspx >
+
+ #endif // WIN95VERSION
+
#define sizegrowicon 15 /*it's square, this is the length of each side*/
-
+
#define dragscreenmargin 4 /*for dragging windows, leave this many pixels on all sides*/
#define doctitlebarheight 18 /*number of pixels in the title bar of each standard window*/
@@ -221,7 +240,7 @@
#define private static /*use "private" when a value or routine should not be seen outside the file it appears in*/
-/*types*/
+// types
#define bigstring Str255
@@ -250,7 +269,7 @@
#if defined(__RPCNDR_H_VERSION__)
typedef unsigned char *ptrbyte; /* 2004-12-29 trt: byte defined by Win32 rpcndr.h */
#else
-typedef unsigned char byte, *ptrbyte;
+typedef unsigned char byte, *ptrbyte;
#endif
@@ -307,7 +326,7 @@
#define stringbaseaddress(bs) (bs+1)
#define setstringlength(bs,len) (bs[0]=(char)(len))
-#define stringlength(bs) ((unsigned char)(bs)[0])
+#define stringlength(bs) ((unsigned char)(bs)[0])
#define setstringwithchar(ch,bs) {bs[0]=1;bs[1]=(ch);}
#define getstringcharacter(bs,pos) bs[(pos)+1]
#define setstringcharacter(bs,pos,ch) {bs[(pos)+1] = (ch);}
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/stringdefs.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/stringdefs.h 2007-02-27 20:29:44 UTC (rev 1636)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/stringdefs.h 2007-02-27 23:30:09 UTC (rev 1637)
@@ -73,23 +73,23 @@
#define STR_script BIGSTRING ("\x06" "script")
#define STR_menubar "\x07" "menubar"
#define STR_picture BIGSTRING ("\x07" "picture")
-
+
#define STR_with BIGSTRING ("\x04" "with")
#define STR_this BIGSTRING ("\x04" "this")
#define STR_temp "\x04" "temp"
#define STR_environment "\x0b" "environment"
#define STR_charsets "\x08" "charsets"
-
+
#define STR_Stack_overflow BIGSTRING ("\x0f" "Stack overflow!")
-
+
#define STR_too_many_pophashtables BIGSTRING ("\x16" "too many pophashtables")
#define STR_trying_to_dispose_global_symbol_table BIGSTRING ("\x26" "trying to dispose global symbol table!")
#define STR_pushpackstack_no_room_on_stack BIGSTRING ("\x1f" "pushpackstack: no room on stack")
#define STR_poppackstack_nothing_on_stack BIGSTRING ("\x1e" "poppackstack: nothing on stack")
#define STR_Error_unpacking BIGSTRING ("\x11" "Error unpacking: ")
-
+
#define STR_The_version_number_of_this_database_file_is_not_recognized_by_this_version_of_Frontier BIGSTRING ("\x57" "The version number of this database file is not recognized by this version of Frontier.")
-
+
#define STR_move BIGSTRING ("\x04" "move")
#define STR_copy BIGSTRING ("\x04" "copy")
#define STR_rename BIGSTRING ("\x06" "rename")
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/resources.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/resources.c 2007-02-27 20:29:44 UTC (rev 1636)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/resources.c 2007-02-27 23:30:09 UTC (rev 1637)
@@ -43,38 +43,44 @@
boolean getstringlist (short listnum, short id, bigstring bs) {
-#ifdef MACVERSION
- /*
- the Mac routine GetIndString doesn't set ResError false when we fall off
- the end of the indicated list, so we return false if the returned string
- is of zero length.
- */
+
+ #ifdef MACVERSION
- #if 0 //#ifdef fldebug /* 2006-04-16 aradke: disabled for Mac Intel build */
+ /*
+ the Mac routine GetIndString doesn't set ResError false when we fall off
+ the end of the indicated list, so we return false if the returned string
+ is of zero length.
+ */
+
+ #if 0 //#ifdef fldebug /* 2006-04-16 aradke: disabled for Mac Intel build */
+
+ if (GetResource ('STR#', listnum) == nil)
+ DebugStr ("\pmissing STR# resource");
+
+ #endif
+
+ GetIndString (bs, listnum, id);
+
+ return (stringlength (bs) > 0);
+
+ #endif
+
+ #ifdef WIN95VERSION
- if (GetResource ('STR#', listnum) == nil)
- DebugStr ("\pmissing STR# resource");
-
+ HANDLE reshandle, hdata;
+
+ setstringlength(bs,0);
+ reshandle = FindResource (hInst, MAKEINTRESOURCE(id), MAKEINTRESOURCE(listnum));
+ if (reshandle != NULL)
+ {
+ hdata = LoadResource (hInst, reshandle);
+ strcpy (stringbaseaddress(bs), LockResource(hdata));
+ setstringlength (bs, strlen (stringbaseaddress(bs)));
+ }
+ return (stringlength (bs) > 0);
+
#endif
-
- GetIndString (bs, listnum, id);
-
- return (stringlength (bs) > 0);
-#endif
-#ifdef WIN95VERSION
- HANDLE reshandle, hdata;
-
- setstringlength(bs,0);
- reshandle = FindResource (hInst, MAKEINTRESOURCE(id), MAKEINTRESOURCE(listnum));
- if (reshandle != NULL)
- {
- hdata = LoadResource (hInst, reshandle);
- strcpy (stringbaseaddress(bs), LockResource(hdata));
- setstringlength (bs, strlen (stringbaseaddress(bs)));
- }
- return (stringlength (bs) > 0);
-#endif
} /*getstringlist*/
@@ -859,6 +865,7 @@
#endif
#ifdef MACVERSION
+
boolean getnthresourcehandle (const ptrfilespec fs, ResType type, short n, short *id, bigstring bsname, Handle *hresource, short forktype) {
/*
@@ -905,11 +912,14 @@
popresourcefile ();
return (fl);
+
} /*getnthresourcehandle*/
+
#endif
#ifdef MACVERSION
+
static boolean getemptyresourcehandle (ResType type, short id, bigstring bsname, Handle *hresource) {
/*
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/search.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/search.c 2007-02-27 20:29:44 UTC (rev 1636)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/search.c 2007-02-27 23:30:09 UTC (rev 1637)
@@ -75,6 +75,7 @@
#endif
return (true);
+
} /*isword*/
@@ -109,10 +110,13 @@
*lenmatch = stringlength (searchparams.bsfind);
return (true);
+
}
ixstart = ixmatch + 1; /*continue after beginning of false match*/
+
}
+
} /*textsearch*/
@@ -127,6 +131,7 @@
unlockhandle (h);
return (fl);
+
} /*handlesearch*/
@@ -142,6 +147,7 @@
*length = len;
return (true);
+
} /*stringsearch*/
/*
@@ -161,6 +167,7 @@
searchparams.flzoomfound = flzoomfound;
searchparams.flreplaceall = flreplaceall;
+
} /*startnewsearch*/
@@ -195,6 +202,7 @@
searchparams.searchrefcon = refcon;
return (true);
+
} /*startingtosearch*/
@@ -214,6 +222,7 @@
return (true);
return (searchparams.searchrefcon != refcon);
+
} /*searchshouldcontinue*/
@@ -232,6 +241,7 @@
return (false);
return (searchparams.flwraparound);
+
} /*searchshouldwrap*/
@@ -247,6 +257,7 @@
searchparams.ctreplaced = 0;
searchparams.searchrefcon = 0;
+
} /*endcurrentsearch*/
@@ -293,8 +304,6 @@
#endif
return (true);
+
} /*initsearch*/
-
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/shell.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/shell.c 2007-02-27 20:29:44 UTC (rev 1636)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/shell.c 2007-02-27 23:30:09 UTC (rev 1637)
@@ -499,6 +499,7 @@
void shellidle (void) {
(*shellglobals.idleroutine) ();
+
} /*shellidle*/
@@ -541,6 +542,7 @@
fl = processyield ();
return (fl);
+
} /*shellyield*/
@@ -551,6 +553,7 @@
*/
flshellimmediatebackground = true;
+
} /*shellforcebackgroundtask*/
@@ -1160,7 +1163,7 @@
boolean shellinit (void) {
-
+
/*
2.1b5 dmb: added small first steps towards starting up with a clean heap.
rearrange the load order slightly and added "ctreservebytes" parameter to
@@ -1169,8 +1172,9 @@
if (!initmacintosh ())
return (showerrorandexit (notenoughmemorystring));
-
- #ifdef MACVERSION
+
+ #ifdef MACVERSION
+
//Code change by Timothy Paustian Friday, June 9, 2000 2:36:02 PM
//Changed because using SysEnvisons and SysEnvRec is like Really old style
//This was changed to Gestalt calls with two new globals see mac.c initmacintosh
@@ -1181,11 +1185,12 @@
initfsdefault (); /* 2005-07-18 creedon, karstenw - init fsdefault here, don't leave it up to an
FSMakeFSSpec call at some unknown time, see
< http://sourceforge.net/tracker/index.php?func=detail&aid=1239991&group_id=120666&atid=687798 > */
-
#endif
if (keyboardescape ()) /*check for command-period for accidental launch*/
return (false);
+
+ //
langipcinit (); /*must do first to allow permanant event hook to be installed*/
@@ -1197,7 +1202,9 @@
initfile (); /*do this before about to filegetprogramversion will work*/
#ifdef MACVERSION
+
aboutsegment ();
+
#endif
initquickdraw ();
@@ -1215,38 +1222,43 @@
initscrollbars (); /*7.0b18 PBS*/
#ifdef MACVERSION
+
initmouse ();
+
#endif
#ifdef fltrialsize
- if (!shellinitclock ()) {
- bigstring bs;
+ if (!shellinitclock ()) {
- getstringlist (trialsizelistnumber, expirationstring, bs);
-
- parsedialogstring (bs, "\x06" "1/1/99", nil, nil, nil, bs);
+ bigstring bs;
+
+ getstringlist (trialsizelistnumber, expirationstring, bs);
+
+ parsedialogstring (bs, "\x06" "1/1/99", nil, nil, nil, bs);
- shellerrormessage (bs);
+ shellerrormessage (bs);
- return (false);
- }
-
- //alertdialog ("\x30" "This version of Frontier expires on July 1, 1998");
-
+ return (false);
+
+ }
+
+ //alertdialog ("\x30" "This version of Frontier expires on July 1, 1998");
+
#endif
#ifdef MACVERSION
- //#ifndef PIKE
- openabout (true, macmemoryconfig.reserveforcode); /*show about window, do zoom -- closed by shellmaineventloop*/
- //#endif
- FastInitialize(); /*2005-01-14 aradke: init timer, may take up to a second to callibrate*/
-
+ //#ifndef PIKE
+ openabout (true, macmemoryconfig.reserveforcode); /*show about window, do zoom -- closed by shellmaineventloop*/
+ //#endif
+
+ FastInitialize(); /*2005-01-14 aradke: init timer, may take up to a second to callibrate*/
+
#endif
#ifdef WIN95VERSION
- // openabout (true, 0);
+ // openabout (true, 0);
#endif
initmenusystem ();
@@ -1264,6 +1276,7 @@
sysbeep ();
return (false);
+
}
//RAB: 1/19/98 moved printing init to the bottom of the chain
@@ -1283,77 +1296,80 @@
#if TARGET_API_MAC_CARBON == 1
- initservices ();
-
-#endif
-
-#if isFrontier || flruntime || winhybrid
-
- initlang (); /*init callbacks and other basic inits*/
-
- langcallbacks.processeventcallback = &shellprocessevent; /*4.1b13 dmb - new*/
+ initservices ();
+
+ #endif
- if (!inittablestructure ()) /*create initial hashtable structure*/
- return (false);
+ #if isFrontier || flruntime || winhybrid
- initscripts (); /*set up global debugger data*/
-
- langinitverbs ();
-
- dbinitverbs (); // 4.1b4 dmb
-
- shellinitverbs ();
-
- fileinitverbs ();
-
- stringinitverbs ();
-
- windowinitverbs ();
-
- xmlinitverbs ();
-
- htmlinitverbs ();
+ initlang (); /*init callbacks and other basic inits*/
- sqliteinitverbs (); /* 2006-03-15 gewirtz: langsqlite.c */
+ langcallbacks.processeventcallback = &shellprocessevent; /*4.1b13 dmb - new*/
+
+ if (!inittablestructure ()) /*create initial hashtable structure*/
+ return (false);
+
+ initscripts (); /*set up global debugger data*/
+
+ langinitverbs ();
+
+ dbinitverbs (); // 4.1b4 dmb
+
+ shellinitverbs ();
+
+ fileinitverbs ();
+
+ stringinitverbs ();
+
+ windowinitverbs ();
+
+ xmlinitverbs ();
+
+ htmlinitverbs ();
-#ifdef flregexpverbs
- regexpinitverbs (); /* 2003-04-23 AR: langregexp.c */
-#endif
-
-#ifdef MACVERSION /*7.0b4 PBS: initialize QuickTime verbs*/
-
- quicktimeinitverbs ();
-
-#endif
-
- mathinitverbs (); /*2004-12-30 smd: langmath.c*/
-
- dllinitverbs (); /*2004-11-29 aradke: langdll.c*/
-
- cryptinitverbs (); /* 2006-03-07 creedon: langcrypt.c */
-
- if (keyboardescape ()) /*check again before landinit; after this, must do shellquit*/
- exittooperatingsystem ();
-
- flipcstarted = langipcstart ();
-
- initprocess ();
+ sqliteinitverbs (); /* 2006-03-15 gewirtz: langsqlite.c */
+
+ #ifdef flregexpverbs
+
+ regexpinitverbs (); /* 2003-04-23 AR: langregexp.c */
+
+ #endif
+
+ #ifdef MACVERSION /*7.0b4 PBS: initialize QuickTime verbs*/
+
+ quicktimeinitverbs ();
+
+ #endif
+
+ mathinitverbs (); /*2004-12-30 smd: langmath.c*/
+
+ dllinitverbs (); /*2004-11-29 aradke: langdll.c*/
+
+ cryptinitverbs (); /* 2006-03-07 creedon: langcrypt.c */
+
+ if (keyboardescape ()) /*check again before landinit; after this, must do shellquit*/
+ exittooperatingsystem ();
+
+ flipcstarted = langipcstart ();
+
+ initprocess ();
- //RAB: 1/19/98 - moved print init here so that Windows will have enough setup before using the dialog.
- shellinitprint (); /*get set up for printing*/
+ //RAB: 1/19/98 - moved print init here so that Windows will have enough setup before using the dialog.
+ shellinitprint (); /*get set up for printing*/
-#else
-
- flipcstarted = langipcstart ();
-
-#endif
-
+ #else
+
+ flipcstarted = langipcstart ();
+
+ #endif
+
//Code change by Timothy Paustian Wednesday, July 26, 2000 9:23:50 PM
//added init code for scroll proc
#if TARGET_API_MAC_CARBON == 1
shellinitscroll();
+
//Ok we now need to set up a timer for handling idle and network processes
{
//EventLoopRef mainLoop;
@@ -1373,42 +1389,28 @@
NULL,
&theTimer);*/
- /*Install dock menu handler.*/
-
- EventHandlerUPP dockmenuUPP;
- OSStatus ec = noErr;
- EventTypeSpec eventTypes [1];
+ /*Install dock menu handler.*/
+
+ EventHandlerUPP dockmenuUPP;
+ OSStatus ec = noErr;
+ EventTypeSpec eventTypes [1];
- eventTypes[0].eventClass = kEventClassApplication;
- eventTypes[0].eventKind = kEventAppGetDockTileMenu;
+ eventTypes[0].eventClass = kEventClassApplication;
+ eventTypes[0].eventKind = kEventAppGetDockTileMenu;
- dockmenuUPP = NewEventHandlerUPP (dockmenuhandler);
+ dockmenuUPP = NewEventHandlerUPP (dockmenuhandler);
- ec = InstallApplicationEventHandler (dockmenuUPP, 1, eventTypes, NULL, NULL);
+ ec = InstallApplicationEventHandler (dockmenuUPP, 1, eventTypes, NULL, NULL);
- /*If it fails, oh well, there's nothing to be done. So ec isn't checked.*/
- }
-
+ /*If it fails, oh well, there's nothing to be done. So ec isn't checked.*/
+
+ }
+
#endif
- fileinit();
+ fileinit ( );
+
return (true);
} /*shellinit*/
-#if 0 //TARGET_API_MAC_CARBON == 1
-static pascal void idleTimer (EventLoopTimerRef theTimer, void * userData)
-{
- //I hate warnings, shut up the compiler
- #pragma unused(theTimer)
- #pragma unused(userData)
-
- boolean flbackground;
-
- fwsNetEventCheckAndAcceptSocket ();
-
- shellhandlenullevent (&flbackground);
-
-}
-#endif
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/shellactivate.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/shellactivate.c 2007-02-27 20:29:44 UTC (rev 1636)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/shellactivate.c 2007-02-27 23:30:09 UTC (rev 1637)
@@ -151,13 +151,12 @@
if (config.fleraseonresize)
shellupdatenow (w);
#endif
+
}
shellpopglobals ();
return (true);
+
} /*shellactivatewindow*/
-
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/shellcallbacks.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/shellcallbacks.c 2007-02-27 20:29:44 UTC (rev 1636)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/shellcallbacks.c 2007-02-27 23:30:09 UTC (rev 1637)
@@ -97,6 +97,7 @@
} /*for*/
return (false); /*loop terminated, not found*/
+
} /*shellfindcallbacks*/
@@ -466,8 +467,7 @@
void shellloadbuttonlists (void) {
- register short i;
- register short resnum;
+ register short i, resnum;
for (i = 0; i < topglobalsarray; i++) {
@@ -492,6 +492,7 @@
*pconfig = globalsarray [ix].config;
return (true);
+
} /*shellgetconfig*/
@@ -505,6 +506,7 @@
globalsarray [ix].config = pconfig;
return (true);
+
} /*shellsetconfig*/
@@ -533,11 +535,14 @@
shellundostack = nil; /*7/21/91 dmb*/
-#ifdef WIN95VERSION
- setport (NULL); // must clear port from prev globals
-#endif
+ #ifdef WIN95VERSION
+
+ setport (NULL); // must clear port from prev globals
+
+ #endif
return (false);
+
}
if (!getwindowinfo (w, &hinfo)) /*chase the refcon field of the mac window*/
@@ -581,6 +586,7 @@
}
return (true);
+
} /*shellsetglobals*/
/*
@@ -674,6 +680,7 @@
shellsetglobals (nil);
return (false);
+
}
if (shellwindow != nil) { /*there are some globals currently set - set data to nil*/
@@ -685,6 +692,7 @@
*shellglobals.infoholder = nil;
(*shellglobals.setglobalsroutine) ();
+
}
shellsetglobals (globalsstack.stack [--globalsstack.top]);
@@ -698,6 +706,7 @@
}
return (true);
+
} /*shellpopglobals*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/shellhooks.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/shellhooks.c 2007-02-27 20:29:44 UTC (rev 1636)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/shellhooks.c 2007-02-27 23:30:09 UTC (rev 1637)
@@ -208,6 +208,7 @@
eventhooks [cteventhooks++] = routine;
return (true);
+
} /*shellpusheventhook*/
@@ -261,13 +262,16 @@
if (cterrorhooks >= maxerrorhooks) {
- shellinternalerror (idtoomanyerrorhooks, STR_increase_maxerrorhooks);
+ shellinternalerror (idtoomanyerrorhooks, STR_increase_maxerrorhooks);
+
return (false);
+
}
errorhooks [cterrorhooks++] = routine;
return (true);
+
} /*shellpusherrorhook*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/shellscroll.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/shellscroll.c 2007-02-27 20:29:44 UTC (rev 1636)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/shellscroll.c 2007-02-27 23:30:09 UTC (rev 1637)
@@ -109,6 +109,7 @@
dir = right;
return (dir);
+
} /*scrolldirection*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/shellundo.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/shellundo.c 2007-02-27 20:29:44 UTC (rev 1636)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/shellundo.c 2007-02-27 23:30:09 UTC (rev 1637)
@@ -226,6 +226,7 @@
(**hstack).ixaction = ixaction;
return (true);
+
} /*pushaction*/
@@ -246,16 +247,16 @@
if (step.flactionstep)
globaldata = (long) step.hundodata;
-
else {
-
shellsetundoglobals (globaldata, false); /*set up environment*/
(*step.undoroutine) (step.hundodata, false); /*ignore errors*/
+
}
}
(**hstack).ixaction = noaction;
+
} /*killactions*/
@@ -300,6 +301,7 @@
shelladjustundo (); /*7.0fc1: adjust the Undo menu item.*/
return (res);
+
} /*pushundoaction*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/tablecompare.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/tablecompare.c 2007-02-27 20:29:44 UTC (rev 1636)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/tablecompare.c 2007-02-27 23:30:09 UTC (rev 1637)
@@ -37,36 +37,23 @@
static short tablecomparenames (hdlhashnode hnode1, hdlhashnode hnode2) {
-
+
/*
2004-11-09 aradke: optimized by calling compareidentifiers which does
an in-place case-insensitive compare instead of copying both key strings,
converting both copies completely to lowercase, and running a case-sensitive
compare on the resulting lowercase strings.
*/
-
+
return (compareidentifiers ((**hnode1).hashkey, (**hnode2).hashkey));
- /*
- bigstring bs1, bs2;
-
- gethashkey (hnode1, bs1);
-
- gethashkey (hnode2, bs2);
-
- alllower (bs1); /%comparison is unicase%/
-
- alllower (bs2);
-
- return (comparestrings (bs1, bs2));
- */
} /*tablecomparenames*/
#if !flruntime
static short tablecomparekinds (hdlhashnode hnode1, hdlhashnode hnode2) {
-
+
tyvaluerecord val1, val2;
register tyvaluetype t1, t2;
@@ -101,6 +88,7 @@
return (tablecomparenames (hnode1, hnode2));
return (sgn (t1 - t2));
+
} /*tablecomparekinds*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/tableformats.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/tableformats.c 2007-02-27 20:29:44 UTC (rev 1636)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/tableformats.c 2007-02-27 23:30:09 UTC (rev 1637)
@@ -306,6 +306,7 @@
remaining -= w;
maxwidth -= x;
+
}
tablesetcolwidth (lastcol, remaining, false);
@@ -313,6 +314,7 @@
opseteditbufferrect ();
return (true);
+
} /*tablerecalccolwidths*/
@@ -505,22 +507,22 @@
static boolean initializetableoutline (hdloutlinerecord ho, hdlhashtable ht) {
-
+
/*
5.0.2b21 dmb: use shellgetdatabase, not databasedata global
5.1.3 dmb: roll beachball; don't ignore clayfolderloop return value
*/
-
- hdlheadrecord hsummit = (**ho).hsummit;
- hdlheadrecord hnewsummit, hlastsummit;
- hdlheadrecord nomad, hnext;
+
+ boolean fl = false;
+ hdlheadrecord hlastsummit, hnewsummit, hnext, hsummit = (**ho).hsummit, nomad;
+ hdlwindowinfo hinfo;
+ long lnumcursor;
tybrowserspec fsroot;
tyexpandinfo expandinfo;
- hdlwindowinfo hinfo;
- long lnumcursor;
- boolean fl = false;
+ clearbytes ( &fsroot, sizeof ( fsroot ) );
+
oppushoutline (ho);
opgetnodeline ((**ho).hbarcursor, &lnumcursor);
@@ -529,7 +531,7 @@
while (opchasedown (&hlastsummit))
;
-
+
opdisabledisplay ();
opsetdisplaydefaults (ho);
@@ -549,22 +551,21 @@
fsroot.parID = ht;
- setemptystring (fsroot.name);
-
initbeachball (right);
- if (!clayfolderloop (&fsroot, false, browserexpandvisit, (long) &expandinfo))
+ if ( ! clayfolderloop ( &fsroot, false, browserexpandvisit, ( long ) &expandinfo ) )
goto exit;
-
+
hnewsummit = (**hlastsummit).headlinkdown;
if (hnewsummit == hlastsummit) { // table was empty
-
+
browserlineinserted (hnewsummit);
(**ho).fltextmode = true;
opeditsetselection (0, infinity);
+
}
else { // table was not empty
@@ -575,7 +576,7 @@
hnewsummit = (**hlastsummit).headlinkdown;
while (true) {
-
+
hnext = (**nomad).headlinkdown;
duplicateexpansionvisit (nomad, hnewsummit);
@@ -586,10 +587,11 @@
if (hnext == hnewsummit)
break;
+
+ nomad = hnext;
- nomad = hnext;
}
-
+
(**ho).hbarcursor = oprepeatedbump (flatdown, lnumcursor, hnewsummit, true);
(**ho).hline1 = oprepeatedbump (flatdown, (**ho).vertscrollinfo.cur, hnewsummit, true);
@@ -599,10 +601,13 @@
opdirtymeasurements (); //6.0a14 dmb
opsetctexpanded (ho);
+
}
+
+ #ifdef fldebug
- #ifdef fldebug
opvalidate (outlinedata);
+
#endif
fl = true;
@@ -615,6 +620,7 @@
// (**(**ho).hsummit).flnodeisfolder = true;
return (fl);
+
} /*initializetableoutline*/
@@ -729,11 +735,12 @@
//hdlhashtable ht = (**hf).htable;
hdloutlinerecord ho = (**hf).houtline;
-
+
if (ho == nil)
return;
+
+ // grab display setting from outline
- // grab display setting from outline
(**hf).fontnum = (**ho).fontnum;
(**hf).fontsize = (**ho).fontsize;
@@ -743,7 +750,7 @@
(**hf).vertcurrent = (**ho).vertscrollinfo.cur;
opgetnodeline ((**ho).hbarcursor, &(**hf).vertcurrent);
-
+
// if we have an auto-generated node, delete the table entry
/*
@@ -771,6 +778,7 @@
(**hf).houtline = nil;
opdisposeoutline (ho, false);
+
} /*tabledisposeoutline*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cre...@us...> - 2007-02-27 20:29:43
|
Revision: 1636
http://svn.sourceforge.net/frontierkernel/?rev=1636&view=rev
Author: creecode
Date: 2007-02-27 12:29:44 -0800 (Tue, 27 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/process.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/scripts.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/shell.h
Frontier/branches/Frontier_Long_File_Paths/Common/resources/Mac/SHELL.R
Frontier/branches/Frontier_Long_File_Paths/Common/source/opverbs.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/opxml.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/osacomponent.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/osawindows.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/pictverbs.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/process.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/scripts.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shellfile.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shellmenu.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shellsysverbs.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shellverbs.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shellwindow.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shellwindowmenu.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/shellwindowverbs.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/process.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/process.h 2007-02-27 08:00:29 UTC (rev 1635)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/process.h 2007-02-27 20:29:44 UTC (rev 1636)
@@ -41,7 +41,7 @@
#endif
-typedef struct tythreadglobals **hdlprocessthread; // it's a hdlthreadglobals really; we're avoiding dependencies
+typedef struct tythreadglobals **hdlprocessthread; // it's a hdlthreadglobals really; we're avoiding dependencies
typedef struct typrocessrecord {
@@ -96,6 +96,7 @@
bigstring bsname; // 5.0a22 dmb: why not maintain the name from the start?
long processrefcon; /*for client use only*/
+
} typrocessrecord, *ptrprocessrecord, **hdlprocessrecord;
@@ -206,7 +207,7 @@
extern short processthreadcount (void);
-extern boolean initprocessthread (bigstring);
+extern boolean initprocessthread ( Handle );
extern void exitprocessthread (void);
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/scripts.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/scripts.h 2007-02-27 08:00:29 UTC (rev 1635)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/scripts.h 2007-02-27 20:29:44 UTC (rev 1636)
@@ -65,7 +65,7 @@
extern boolean scriptkilled (void);
-extern boolean scriptpushsourcecode (hdlhashtable, hdlhashnode, bigstring);
+extern boolean scriptpushsourcecode ( hdlhashtable, hdlhashnode, const Handle );
extern boolean scriptpopsourcecode (void);
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/shell.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/shell.h 2007-02-27 08:00:29 UTC (rev 1635)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/shell.h 2007-02-27 20:29:44 UTC (rev 1636)
@@ -253,7 +253,7 @@
Handle hundostack, hredostack; /*handles are untyped here so avoid shellundo.h*/
- hdlstring hwindowtitle; /*so we don't have to ask the window for it*/
+ Handle hwindowtitle; /*so we don't have to ask the window for it*/
long ctpushes;
@@ -280,6 +280,7 @@
boolean flbeingclosed: 1; /*if true, we're inside of shellclosexxx right now*/
boolean fldisposewhenpopped: 1; //if true, dispose was called while we were pushed
+
} tywindowinfo, *ptrwindowinfo, **hdlwindowinfo;
@@ -776,7 +777,7 @@
extern boolean windowgetfspec ( WindowPtr, ptrfilespec );
-extern boolean windowgetpath (WindowPtr, bigstring);
+extern boolean windowgetpath ( WindowPtr, Handle * );
extern void windowsetvnum (WindowPtr, short);
@@ -796,9 +797,9 @@
extern boolean shellbringtofront (hdlwindowinfo);
-extern boolean shellsetwindowtitle (hdlwindowinfo, bigstring);
+extern boolean shellsetwindowtitle ( hdlwindowinfo, const Handle );
-extern void shellgetwindowtitle (hdlwindowinfo, bigstring);
+extern void shellgetwindowtitle ( hdlwindowinfo, Handle * );
extern boolean getfrontwindowinfo (hdlwindowinfo *);
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/resources/Mac/SHELL.R
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/resources/Mac/SHELL.R 2007-02-27 08:00:29 UTC (rev 1635)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/resources/Mac/SHELL.R 2007-02-27 20:29:44 UTC (rev 1636)
@@ -871,19 +871,23 @@
}
};
-resource 'STR#' (132, "Font Names", purgeable) {
- { /* array StringArray: 4 elements */
- /* [1] */
- "Palatino",
- /* [2] */
- "Geneva",
- /* [3] */
- "Helvetica",
- /* [4] */
- "Chicago"
- }
-};
+resource 'STR#' ( 132, "Font Names", purgeable ) {
+ { // array StringArray: 5 elements
+
+ "Palatino", // 1
+
+ "Geneva", // 2
+
+ "Helvetica", // 3
+
+ "Chicago", // 4
+
+ "Lucida Grande" // 5
+
+ }
+ };
+
resource 'STR#' (133, "QuickScript") {
{ /* array StringArray: 2 elements */
/* [1] */
@@ -3348,8 +3352,8 @@
}
};
+
/* kw - 2006-02-05 --- personalisation dialog - was in root resourcefork */
-/* kw - 2006-02-05 --- personalisation dialog - was in root resourcefork */
#if 0
@@ -3775,8 +3779,8 @@
"scroll bar"
};
-/* kw - 2006-02-05 --- missing; taken from old root */
-resource 'CNTL' (25000) {
+
+resource 'CNTL' (25000) { // kw - 2006-02-05 --- missing; taken from old root
{64, 9, 89, 169},
0,
visible,
@@ -3787,6 +3791,7 @@
"Hot List:"
};
+
resource 'cnfg' (128, "menu bar") {
nohorizscroll,
vertscroll,
@@ -3922,40 +3927,63 @@
{100, 100, 270, 540}
};
-resource 'cnfg' (132, "table") {
+resource 'cnfg' ( 132, "table" ) {
+
nohorizscroll,
+
vertscroll,
+
windowfloats,
+
messagearea,
+
dontinsetcontentrect,
+
nonewonlaunch,
+
dontopenresfile,
+
normalwindow,
+
isgrowable,
+
createonnew,
+
nowindoidscrollbars,
+
notstoredindatabase,
+
handlesownsave,
+
eraseonresize,
+
consumefrontclicks,
+
colorwindow,
+
onethird,
- #ifdef version42orgreater
- 'LAND',
- 'FTtb',
- #else
- 'BigD',
- 'TABL',
- #endif
+
+ 'LAND',
+
+ 'FTtb',
+
129,
- {0, 0, 100, 260},
- 4,
+
+ { 0, 0, 100, 260 },
+
+ 5,
+
size12,
+
plain,
+
0,
- {100, 100, 250, 500}
-};
+
+ { 100, 100, 250, 500 }
+
+ };
+
resource 'cnfg' (134, "wpengine") {
horizscroll,
vertscroll,
@@ -4690,4 +4718,3 @@
"Frontier\xAA\n\nHigh performance Web content management, object database, system-level and Internet scripting environment, including source code editing and debugging"
};
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/opverbs.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/opverbs.c 2007-02-27 08:00:29 UTC (rev 1635)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/opverbs.c 2007-02-27 20:29:44 UTC (rev 1636)
@@ -377,6 +377,7 @@
opdisposeoutline ((hdloutlinerecord) (**hv).variabledata, fldisk);
return (true);
+
} /*opdisposevariable*/
@@ -387,6 +388,7 @@
opverbdisposecode ((hdloutlinevariable) hv); /*must check for code even if outline isn't in memory*/
return (langexternaldisposevariable (hv, fldisk, &opdisposevariable));
+
} /*opverbdispose*/
@@ -456,10 +458,12 @@
shellinvalbuttons ();
shellpopglobals ();
+
}
}
return (true);
+
} /*opverblinkcode*/
@@ -1839,21 +1843,25 @@
static boolean opcompileverb (hdltreenode hparam1, tyvaluerecord *v) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ Handle handleName;
+ boolean fl;
+ hdlhashnode hnode;
hdlhashtable htable;
- bigstring bsname;
- hdlhashnode hnode;
hdltreenode hcode;
- boolean fl;
flnextparamislast = true;
- if (!getvarparam (hparam1, 1, &htable, bsname))
+ if (!getvarparam (hparam1, 1, &htable, &handleName))
return (false);
pushhashtable (htable);
- fl = hashlookupnode (bsname, &hnode);
+ fl = hashlookupnode (handleName, &hnode);
pophashtable ();
@@ -1869,35 +1877,45 @@
}
return (setbooleanvalue (fl, v));
+
} /*opcompileverb*/
static boolean opuncompileverb (hdltreenode hparam1, tyvaluerecord *v) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ Handle handleName;
+ hdlhashnode hnode;
hdlhashtable htable;
- bigstring bsname;
+ hdltreenode hcode;
tyvaluerecord val;
- hdltreenode hcode;
- hdlhashnode hnode;
flnextparamislast = true;
- if (!getvarvalue (hparam1, 1, &htable, bsname, &val, &hnode))
+ if (!getvarvalue (hparam1, 1, &htable, &handleName, &val, &hnode))
return (false);
if (!langexternalvaltocode (val, &hcode)) { /*easy way to check for a script*/
-
+
errornum = namenotscripterror;
+ // disposehandle ( handleName );
+
return (false);
+
}
-
+
pushhashtable (htable);
- hashlookupnode (bsname, &hnode);
+ hashlookupnode (handleName, &hnode);
pophashtable ();
+ // disposehandle ( handleName );
+
if (opcodeisrunning (hnode)) /*can't uncompile running code; return false to caller*/
return (true);
@@ -1907,6 +1925,7 @@
opverbdisposecode ((hdloutlinevariable) val.data.externalvalue);
return (setbooleanvalue (true, v));
+
} /*opuncompileverb*/
@@ -1977,35 +1996,39 @@
static boolean opgetcodeverb (hdltreenode hparam1, boolean flosacode, tyvaluerecord *v) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 2.1b15 dmb: fixed memory leak; osagetcode does _not_ consume htext
+ //
- /*
- 2.1b15 dmb: fixed memory leak; osagetcode does _not_ consume htext
- */
+ register hdltreenode hp1 = hparam1;
- register hdltreenode hp1 = hparam1;
+ Handle handleName;
+ boolean fl;
+ hdlhashnode hnode;
+ hdlhashtable htable;
short pnum;
- hdlhashtable htable;
- bigstring bsname;
- tyvaluerecord val;
- hdlhashnode hnode;
- tyvaluerecord vcode;
- boolean fl;
+ tyvaluerecord val, vcode;
initvalue (&vcode, codevaluetype);
if (flosacode) {
+
+ #ifdef flcomponent
- #ifdef flcomponent
+ Handle htext;
+ boolean flexecuteonly;
hdloutlinevariable hv;
- Handle htext;
long signature;
- boolean flexecuteonly;
if (!havecomponentmanager ()) {
langerror (nocomponentmanagererror);
return (false);
+
}
if (!getscriptparam (hp1, 1, &hv))
@@ -2025,69 +2048,96 @@
return (false);
pnum = 3;
+
#else
+
langerror (nocomponentmanagererror);
return (false);
+
#endif
+
}
else {
-
- if (!getvarvalue (hp1, 1, &htable, bsname, &val, &hnode))
+
+ if (!getvarvalue (hp1, 1, &htable, &handleName, &val, &hnode))
return (false);
-
+
if (!langexternalvaltocode (val, &vcode.data.codevalue)) {
errornum = namenotscripterror;
+ // disposehandle ( handleName );
+
return (false);
+
}
+
+ if (vcode.data.codevalue == nil) {
- if (vcode.data.codevalue == nil) {
-
pushhashtable (htable);
- fl = hashlookupnode (bsname, &hnode);
+ fl = hashlookupnode (handleName, &hnode);
pophashtable ();
- if (!langcompilescript (hnode, &vcode.data.codevalue))
+ if (!langcompilescript (hnode, &vcode.data.codevalue)) {
+
+ // disposehandle ( handleName );
+
return (false);
+
+ }
}
+
+ // disposehandle ( handleName );
if (!copyvaluerecord (vcode, &vcode))
return (false);
+
+ pnum = 2;
- pnum = 2;
}
-
+
flnextparamislast = true;
- if (!getvarparam (hp1, pnum, &htable, bsname))
+ if (!getvarparam (hp1, pnum, &htable, &handleName))
return (false);
+
+ if (!hashtableassign (htable, handleName, vcode)) {
- if (!hashtableassign (htable, bsname, vcode))
+ // disposehandle ( handleName );
+
return (false);
+
+ }
+
+ // disposehandle ( handleName );
exemptfromtmpstack (&vcode);
return (setbooleanvalue (true, v));
+
} /*opgetcodeverb*/
static boolean opgetsourceverb (hdltreenode hparam1, boolean flosacode, tyvaluerecord *v) {
-#pragma unused(flosacode)
+ #pragma unused(flosacode)
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+
register hdltreenode hp1 = hparam1;
+
+ Handle handleName;
+ OSType signature;
hdlhashtable htable;
- bigstring bsname;
- tyvaluerecord vcode;
- tyvaluerecord vsource;
- tyvaluerecord vscript;
hdlheadrecord hsummit;
hdloutlinerecord houtline;
register hdloutlinerecord ho;
- OSType signature;
+ tyvaluerecord vcode, vscript, vsource;
initvalue (&vcode, binaryvaluetype);
@@ -2096,16 +2146,19 @@
flnextparamislast = true;
- if (!getvarparam (hp1, 2, &htable, bsname))
+ if (!getvarparam (hp1, 2, &htable, &handleName))
return (false);
#ifdef flcomponent
+
if (!osagetsource (&vcode, &signature, &vsource))
return (false);
#else
+
langerror (nocomponentmanagererror);
return (false);
+
#endif
if (!langexternalnewvalue (idscriptprocessor, nil, &vscript))
@@ -2128,17 +2181,17 @@
//oppopoutline ();
- if (!hashtableassign (htable, bsname, vscript))
+ if (!hashtableassign (htable, handleName, vscript))
goto error;
return (setbooleanvalue (true, v));
- error: {
+ error:
disposevaluerecord (vscript, true);
return (false);
- }
+
} /*opgetsourceverb*/
@@ -2161,70 +2214,90 @@
static boolean convertprofiletoticksvisit (hdlhashnode hnode, ptrvoid refcon) {
-#pragma unused (refcon)
+ #pragma unused (refcon)
+
tyvaluerecord * val = &(**hnode).val;
(*val).data.longvalue = ( ( (*val).data.longvalue * 3 ) / 50 );
return (true);
-}
+
+ }
+
static boolean opstopprofileverb (hdltreenode hp1, tyvaluerecord *v) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 2005-01-14 SMD: results are stored in milliseconds, but the return
+ // values have been in ticks for a long time. So, added an
+ // optional param, flUseMilliseconds. Default is false. If
+ // true, we convert the milliseconds to ticks.
+ //
+ // 5.0.2b15 dmb: turn off profiling. If the user passes an address (not
+ // nil), we assign the profiledata table and remove it from
+ // the process.
+ //
- /*
- 5.0.2b15 dmb: turn off profiling. If the user passes an address (not nil),
- we assign the profiledata table and remove it from the process.
-
- 2005-01-14 SMD: results are stored in milliseconds, but the return values
- have been in ticks for a long time. So, added an optional param,
- flUseMilliseconds. Default is false. If true, we convert the milliseconds
- to ticks.
- */
-
+ Handle h = NULL;
+ boolean fl = false;
+ hdlhashtable ht;
hdlprocessrecord hp = currentprocess;
- hdlhashtable ht;
- bigstring bs;
+ short ctconsumed = 1, ctpositional = 1;
tyvaluerecord val;
- short ctconsumed = 1;
- short ctpositional = 1;
tyvaluerecord vflusemilliseconds; /* for optional flUseMilliseconds param */
- if (!getvarparam (hp1, 1, &ht, bs))
+ if (!getvarparam (hp1, 1, &ht, &h))
return (false);
-
+
setbooleanvalue (false, &vflusemilliseconds);
flnextparamislast = true;
if (!getoptionalparamvalue (hp1, &ctconsumed, &ctpositional, BIGSTRING ("\x11" "flUseMilliseconds"), &vflusemilliseconds))
- return (false);
+ goto exit;
+
+ if (!processstopprofiling ()) {
- if (!processstopprofiling ())
- return (setbooleanvalue (false, v));
+ fl = setbooleanvalue (false, v);
+
+ goto exit;
+
+ }
- if (!isemptystring (bs)) { // move our table to caller's address
+ if ( h != NULL ) { // move our table to caller's address
if ((**hp).hprofiledata == nil)
+
setnilvalue (&val);
- else
- {
+
+ else {
+
if (! vflusemilliseconds.data.flvalue) /* convert values to ticks */
- {
+
if (!hashtablevisit ((hdlhashtable) (**(**hp).hprofiledata).variabledata, &convertprofiletoticksvisit, (ptrvoid) nil))
- return (false);
+ goto exit;
+
+ setexternalvalue ((Handle) (**hp).hprofiledata, &val);
+
}
- setexternalvalue ((Handle) (**hp).hprofiledata, &val);
+ hashtableassign (ht, h, val);
+
+ (**hp).hprofiledata = nil;
+
}
- hashtableassign (ht, bs, val);
+ fl = setbooleanvalue (true, v);
+
+ exit:
+ disposehandle ( h );
- (**hp).hprofiledata = nil;
- }
-
- return (setbooleanvalue (true, v));
-} /*opstopprofileverb*/
+ return ( fl );
+
+ } /*opstopprofileverb*/
static boolean opverbrejectmenubar (bigstring bserror) {
@@ -2873,7 +2946,7 @@
} /*opgetheadnumberverb*/
-extern boolean langsettarget (hdlhashtable htable, bigstring bsname, tyvaluerecord *prevtarget);
+extern boolean langsettarget ( hdlhashtable, const Handle, tyvaluerecord * );
extern boolean langcleartarget (tyvaluerecord *prevtarget);
@@ -2917,44 +2990,46 @@
static boolean opvisitallverb (hdltreenode hparam1, tyvaluerecord *v, bigstring bserror) {
-#pragma unused (bserror)
- /*
- 7.0b17 PBS: visit every headline, running the specified callback script.
- */
+ #pragma unused (bserror)
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b17 PBS: visit every headline, running the specified callback script.
+ //
+
+ Handle handleName = NULL, handleNameOldTarget = NULL;
bigstring bsscriptname;
+ boolean fl = false, flhadtarget = false;
+ hdlhashnode hnode;
+ hdlhashtable htable, htableoldtarget;
+ hdlheadrecord horigcursor;
hdloutlinerecord ho;
- hdlhashtable htable, htableoldtarget;
- bigstring bsname, bsnameoldtarget;
tyvaluerecord val, prevtarget;
- hdlhashnode hnode;
- hdlheadrecord horigcursor;
- boolean fl = false;
- boolean flhadtarget = false;
/*Get outline parameter.*/
if (!getoutlinevalue (hparam1, 1, &ho))
goto exit1;
-
+
/*Set the target to the outline.*/
- if (!getvarvalue (hparam1, 1, &htable, bsname, &val, &hnode))
+ if (!getvarvalue (hparam1, 1, &htable, &handleName, &val, &hnode))
goto exit1;
-
- if (!langsettarget (htable, bsname, &prevtarget))
+
+ if (!langsettarget (htable, handleName, &prevtarget))
goto exit1;
-
- if (getaddressvalue (prevtarget, &htableoldtarget, bsnameoldtarget)) /*get info about previous target*/
+
+ if (getaddressvalue (prevtarget, &htableoldtarget, &handleNameOldTarget)) /*get info about previous target*/
flhadtarget = true;
-
+
if (htableoldtarget == nil)
flhadtarget = false;
-
+
/*Open window as hidden.*/
- if (!langzoomvalwindow (htable, bsname, val, false))
+ if (!langzoomvalwindow (htable, &handleName, val, false))
goto exit2;
/*Get script parameter.*/
@@ -2963,18 +3038,13 @@
if (!getstringvalue (hparam1, 2, bsscriptname))
goto exit2;
-
-// if (!getvarvalue (hparam1, 2, &htable, bsname, &val, &hnode))
-// goto exit2;
-
+
oppushoutline (ho);
horigcursor = (**ho).hbarcursor; /*get cursor*/
opvisiteverything (&opvisitallvisit, bsscriptname); /*call the visit routine*/
-// opvisiteverything (&opvisitallvisit, val); /*call the visit routine*/
-
(**ho).hbarcursor = horigcursor; /*restore cursor*/
oppopoutline ();
@@ -2983,18 +3053,25 @@
exit2:
- /*Restore the previous target.*/
-
- if (flhadtarget)
- langsettarget (htableoldtarget, bsnameoldtarget, &prevtarget);
- else
- langcleartarget (nil);
-
+ /*Restore the previous target.*/
+
+ if (flhadtarget)
+ langsettarget (htableoldtarget, handleNameOldTarget, &prevtarget);
+ else
+ langcleartarget (nil);
+
exit1:
- setbooleanvalue (fl, v);
-
- return (fl);
+ setbooleanvalue (fl, v);
+
+ if ( handleName != NULL )
+ disposehandle ( handleName );
+
+ if ( handleNameOldTarget != NULL )
+ disposehandle ( handleNameOldTarget );
+
+ return (fl);
+
} /*opvisitallverb*/
@@ -3080,12 +3157,16 @@
static boolean getoptionaltablereference (hdltreenode hp1, short pnum, hdlhashtable *ht) {
- /*
- 7.1b45 dmb: new function to get an optional table reference that may be nil
- */
-
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.1b45 dmb: new function to get an optional table reference that may be nil
+ //
+
tyvaluerecord v;
xmladdress adr;
+ Handle h;
+ boolean fl;
if (!getparamvalue (hp1, pnum, &v))
return (false);
@@ -3095,36 +3176,43 @@
*ht = nil;
return (true);
+
}
- if (!getvarparam (hp1, pnum, &adr.ht, adr.bs))
+ if (!getvarparam (hp1, pnum, &adr.ht, &h))
return (false);
-
- return (langassignnewtablevalue (adr.ht, adr.bs, ht));
+
+ texthandletostring ( h, adr.bs );
+
+ fl = langassignnewtablevalue (adr.ht, h, ht);
+
+ disposehandle ( h );
+
+ return ( fl );
+
} /*getoptionaltablereference*/
static boolean opxmltooutlineverb (hdltreenode hparam1, tyvaluerecord *v) {
- /*
- 7.0b21 PBS -- convert an XML outlineDocument to an outline.
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.1b43 dmb: added optional cloudSpec parameter. table can be null.
+ //
+ // 7.0b21 PBS: convert an XML outlineDocument to an outline.
+ //
+ // Two parameters: xml text and the address of an outline.
+ //
+ // opxmltooutline is in opxml.c.
+ //
- Two parameters: xml text and the address of an outline.
-
- opxmltooutline is in opxml.c.
-
- 7.1b43 dmb: added optional cloudSpec parameter. table can be null.
- */
-
+ Handle handleName = NULL, htext;
+ boolean fl = false, flnewoutline;
+ hdlhashnode hnode;
+ hdlhashtable hcloud = nil, htable;
hdloutlinerecord ho;
- hdlhashtable htable;
- bigstring bsname;
tyvaluerecord val;
- hdlhashnode hnode;
- boolean fl = false;
- Handle htext;
- boolean flnewoutline;
- hdlhashtable hcloud = nil;
if (!getreadonlytextvalue (hparam1, 1, &htext))
goto exit;
@@ -3132,7 +3220,7 @@
if (!getoutlinevalue (hparam1, 2, &ho))
goto exit;
- if (!getvarvalue (hparam1, 2, &htable, bsname, &val, &hnode))
+ if (!getvarvalue (hparam1, 2, &htable, &handleName, &val, &hnode))
goto exit;
if (!getbooleanvalue (hparam1, 3, &flnewoutline))
@@ -3148,50 +3236,52 @@
oppushoutline (ho);
- fl = opxmltooutline (htext, ho, flnewoutline, htable, bsname, val, hcloud);
+ fl = opxmltooutline ( htext, ho, flnewoutline, htable, &handleName, val, hcloud );
oppopoutline ();
-
+
exit:
- setbooleanvalue (fl, v);
-
- return (fl);
+ if ( handleName != NULL )
+ disposehandle ( handleName );
+
+ setbooleanvalue (fl, v);
+
+ return (fl);
+
} /*opxmltooutlineverb*/
static boolean opoutlinetoxmlverb (hdltreenode hparam1, tyvaluerecord *v) {
-
- /*
- 7.0b21 PBS: convert an outline to outlineDocument XML.
- 7.1b43 dmb; handle optional cloud parameter. also, fixed handle disposal
- in error condition
- */
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.1b43 dmb; handle optional cloud parameter. also, fixed handle
+ // disposal in error condition
+ //
+ // 7.0b21 PBS: convert an outline to outlineDocument XML.
+ //
+ Handle handleName, hemail = nil, hname = nil, htext = nil;
boolean fl = false;
- Handle htext = nil;
- Handle hname = nil;
- Handle hemail = nil;
- hdloutlinerecord ho;
- hdlhashtable ht;
+ hdlhashnode hnode;
+ hdlhashtable hcloud = nil, ht;
+ hdloutlinerecord ho ;
tyvaluerecord val;
- hdlhashnode hnode;
- bigstring bsname;
- hdlhashtable hcloud = nil;
-
+
if (!getoutlinevalue (hparam1, 1, &ho)) /*Get the outline pointed to in first parameter*/
goto exit;
-
- if (!getvarvalue (hparam1, 1, &ht, bsname, &val, &hnode)) /*We'll be opening the window.*/
+
+ if (!getvarvalue (hparam1, 1, &ht, &handleName, &val, &hnode)) /*We'll be opening the window.*/
goto exit;
-
+
if (!getexempttextvalue (hparam1, 2, &hname)) /*ownerName*/
goto exit;
-
+
if (!getexempttextvalue (hparam1, 3, &hemail)) /*ownerEmail*/
goto exit;
-
+
if (langgetparamcount (hparam1) > 3) {
flnextparamislast = true;
@@ -3199,19 +3289,22 @@
if (!getoptionaltablevalue (hparam1, 4, &hcloud))
return (false);
}
-
- if (!opoutlinetoxml (ho, hname, hemail, &htext, ht, bsname, val, hcloud)) /*Convert from outline to XML text*/
+
+ if (!opoutlinetoxml (ho, hname, hemail, &htext, ht, &handleName, val, hcloud)) /*Convert from outline to XML text*/
goto exit;
fl = setheapvalue (htext, stringvaluetype, v); /*htext is returned XML text*/
exit:
- disposehandle (hname);
-
- disposehandle (hemail);
-
- return (fl);
+ disposehandle ( handleName );
+
+ disposehandle (hname);
+
+ disposehandle (hemail);
+
+ return (fl);
+
} /*opoutlinetoxmlverb*/
@@ -4109,74 +4202,77 @@
case getallfunc: { /*7.0b16 PBS: op.attributes.getAll*/
+ Handle handleVariableName;
hdlhashtable ht;
- bigstring bsvarname;
tyvaluerecord val;
flnextparamislast = true;
- if (!getvarparam (hparam1, 1, &ht, bsvarname))
+ if (!getvarparam (hparam1, 1, &ht, &handleVariableName))
break;
- if (!opattributesgetpackedtablevalue (hbarcursor, &val)) {
-
+ if (!opattributesgetpackedtablevalue (hbarcursor, &val))
break;
- }
- if (!langsetsymboltableval (ht, bsvarname, val)) {
+ if (!langsetsymboltableval (ht, handleVariableName, val)) {
disposevaluerecord (val, false);
break;
+
}
fl = true;
break;
+
}
-
+
case getonefunc: { /*7.0b16 PBS: op.attributes.getOne*/
- bigstring bsattname, bsvarname;
+ Handle handleAttributeName, handleVariableName;
+ hdlhashtable ht;
tyvaluerecord val;
- hdlhashtable ht;
fl = true;
- if (!getstringvalue (hparam1, 1, bsattname))
+ if ( ! getreadonlytextvalue ( hparam1, 1, &handleAttributeName ) )
break;
-
+
flnextparamislast = true;
- if (!getvarparam (hparam1, 2, &ht, bsvarname))
- break;
+ if (!getvarparam (hparam1, 2, &ht, &handleVariableName))
+ goto exitgetonefunc;
+
+ (*v).data.flvalue = opattributesgetoneattribute (hbarcursor, handleAttributeName, &val);
- (*v).data.flvalue = opattributesgetoneattribute (hbarcursor, bsattname, &val);
+ if ((*v).data.flvalue) {
- if ((*v).data.flvalue) {
+ if (!langsetsymboltableval (ht, handleVariableName, val)) {
- if (!langsetsymboltableval (ht, bsvarname, val)) {
-
disposevaluerecord (val, false);
-
- break;
+
+ goto exitgetonefunc;
+
} /*if*/
+
} /*if*/
-
- break;
+
+ exitgetonefunc:
+
+ disposehandle ( handleVariableName );
+
+ break;
+
}
-
- case makeemptyfunc: { /*7.0b16 PBS: op.attributes.makeEmpty*/
-
+ case makeemptyfunc: /*7.0b16 PBS: op.attributes.makeEmpty*/
+
break;
- }
- case setonefunc: { /*7.0b16 PBS: op.attributes.setOne*/
+ case setonefunc: /*7.0b16 PBS: op.attributes.setOne*/
-
break;
- }
} /*switch*/
@@ -4190,16 +4286,18 @@
error:
- if (errornum != 0) /*get error string*/
- getstringlist (operrorlist, errornum, bserror);
-
- return (false);
+ if (errornum != 0) /*get error string*/
+ getstringlist (operrorlist, errornum, bserror);
+
+ return (false);
+
} /*opfunctionvalue*/
static boolean opinitverbs (void) {
return (loadfunctionprocessor (idopverbs, &opfunctionvalue));
+
} /*opinitverbs*/
@@ -4212,6 +4310,7 @@
#ifdef WIN95VERSION
opupdatenow ();
#endif
+
} /*opverbresize*/
@@ -4249,12 +4348,14 @@
}
return (true);
+
} /*opverbclose*/
boolean opverbfind (hdlexternalvariable hvariable, boolean *flzoom) {
-#pragma unused(flzoom)
+ #pragma unused(flzoom)
+
register hdloutlinevariable hv = (hdloutlinevariable) hvariable;
register hdloutlinerecord ho;
register boolean fl;
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/opxml.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/opxml.c 2007-02-27 08:00:29 UTC (rev 1635)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/opxml.c 2007-02-27 20:29:44 UTC (rev 1636)
@@ -115,19 +115,19 @@
-/*Prototypes*/
+// prototypes
static boolean opxmltooutlinevisit (hdlhashtable ht, short ixlevel, bigstring bsname, boolean flfirstline);
static boolean opxmlgetheadlinetextfromatts (hdlhashtable ht, Handle htext);
-static boolean opxmlsetwindowatts (hdlhashtable ht, hdloutlinerecord ho, hdlhashtable hto, bigstring bso, tyvaluerecord vo);
+static boolean opxmlsetwindowatts (hdlhashtable, hdloutlinerecord, hdlhashtable, Handle *, tyvaluerecord );
static boolean opxmlsetwindowpositionandsize (hdlhashtable ht, hdlwindowinfo hinfo);
-static boolean opxmlfindtableitem (hdlhashtable ht, bigstring bsname, hdlhashtable *htfound);
+static boolean opxmlfindtableitem ( hdlhashtable, const Handle, hdlhashtable * );
-static boolean opxmlgetonelongvalue (hdlhashtable ht, bigstring bsname, long *v);
+static boolean opxmlgetonelongvalue ( hdlhashtable, const Handle, long * );
//static boolean opxmlpushxmlheader (Handle htext, short indentlevel);
@@ -143,7 +143,7 @@
static boolean opxmlbuildbody (hdloutlinerecord ho, Handle htext, short indentlevel);
-static boolean opxmlensureopenwindow (hdloutlinerecord ho, hdlhashtable hto, bigstring bso, tyvaluerecord vo, hdlwindowinfo *hinfo, boolean *flwasopen);
+static boolean opxmlensureopenwindow ( hdloutlinerecord, hdlhashtable, Handle *, tyvaluerecord, hdlwindowinfo *, boolean * );
static boolean opxmlpushindents (Handle htext, short indentlevel);
@@ -155,31 +155,32 @@
static boolean opxmlgetcloudatts (hdlhashtable hhead, hdlhashtable hcloudspec);
-static boolean opxmlpushoneattribute (Handle htext, bigstring bsname, Handle hvalue);
+static boolean opxmlpushoneattribute ( Handle htext, const Handle, Handle hvalue );
-static boolean opxmlgetattribute (hdlhashtable ht, bigstring bsname, tyvaluetype type, tyvaluerecord *val);
+static boolean opxmlgetattribute ( hdlhashtable, const Handle, tyvaluetype, tyvaluerecord * );
-/*Functions*/
+// functions
boolean opoutlinetoxml (hdloutlinerecord ho, Handle hname, Handle hemail, Handle *htext,
- hdlhashtable hto, bigstring bso, tyvaluerecord vo, hdlhashtable hcloud) {
-
- /*
- 7.0b21 PBS: convert an outline to XML text.
-
- 7.1b42 dmb: added hcloud parameter
+ hdlhashtable hto, Handle *handleO, tyvaluerecord vo, hdlhashtable hcloud) {
- Note: it might be wise to use handlestreams at some point. Since I don't know how they work yet,
- I'm sticking with the tried-and-true.
+ //
+ // Note: it might be wise to use handlestreams at some point. Since I don't
+ // know how they work yet, I'm sticking with the tried-and-true.
+ //
+ // Caller is responsible for disposing htext.
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.1b42 dmb: added hcloud parameter
+ //
+ // 7.0b21 PBS: convert an outline to XML text.
+ //
- Caller is responsible for disposing htext.
- */
-
+ boolean fl = false, flwindowwasopen = false;
+ hdlwindowinfo hinfo;
short indentlevel = 0;
- hdlwindowinfo hinfo;
- boolean flwindowwasopen = false;
- boolean fl = false;
if (!newemptyhandle (htext))
goto exit;
@@ -192,7 +193,7 @@
indentlevel++;
- if (!opxmlensureopenwindow (ho, hto, bso, vo, &hinfo, &flwindowwasopen)) /*Make sure op window is open.*/
+ if (!opxmlensureopenwindow (ho, hto, handleO, vo, &hinfo, &flwindowwasopen)) /*Make sure op window is open.*/
goto exit;
if (!opxmlbuildhead (*htext, ho, hname, hemail, indentlevel, hinfo, hcloud)) /*Build <head> section.*/
@@ -211,34 +212,33 @@
exit:
- return (fl);
+ return (fl);
+
} /*opoutlinetoxml*/
boolean opxmltooutline (Handle htext, hdloutlinerecord ho, boolean flnewoutline,
- hdlhashtable hto, bigstring bso, tyvaluerecord vo, hdlhashtable hcloud) {
-
- /*
- 7.0b21 PBS -- convert XML text to an outline.
+ hdlhashtable hto, Handle *handleO, tyvaluerecord vo, hdlhashtable hcloud) {
-
-
- 7.0b33 PBS: changes to conform to changing spec. Both <head> and <body> are required. <head> may be empty.
-
- 7.1b42 dmb: added hcloud parameter
-
- <body> must contain one or more <outline> elements.
- */
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.1b42 dmb: added hcloud parameter
+ //
+ // <body> must contain one or more <outline> elements.
+ //
+ // 7.0b33 PBS: changes to conform to changing spec. Both <head> and <body>
+ // are required. <head> may be empty.
+ //
+ // 7.0b21 PBS: convert XML text to an outline.
+ Handle h;
+ bigstring bsvers;
+ boolean fl = false, flcanhavecloud = true, flheadfound = false, florigdisplayenabled = true;
+ hdlhashnode hn;
hdlhashtable ht, htfirst, htopmldocument, htbody, hthead;
- hdlhashnode hn;
+ tyvaluerecord v, vvers;
xmladdress xstruct;
- boolean flheadfound = false;
- boolean fl = false;
- boolean florigdisplayenabled = true;
- boolean flcanhavecloud = true;
- tyvaluerecord v, vvers;
- bigstring bsvers;
/*New local table*/
@@ -261,21 +261,36 @@
/*Get <opml> item*/
- if (!opxmlfindtableitem (htfirst, STR_opmldocument, &htopmldocument)) { /*Find <opml> item*/
+ if ( ! newtexthandle ( STR_opmldocument, &h ) )
+ goto exit2;
- if (!opxmlfindtableitem (htfirst, STR_outlinedocument, &htopmldocument)) { /*<outlineDocument> grandfathered in*/
+ if (!opxmlfindtableitem (htfirst, h, &htopmldocument)) { /*Find <opml> item*/
+
+ disposehandle ( h );
+
+ if ( ! newtexthandle ( STR_outlinedocument, &h ) )
+ goto exit2;
+ if (!opxmlfindtableitem (htfirst, h, &htopmldocument)) { /*<outlineDocument> grandfathered in*/
+
langerrormessage (STR_errornotopml);
goto exit2;
+
} /*if*/
-
+
} /*if*/
+
+ // Get the version number and test for 1.1
- // Get the version number and test for 1.1
- if (!opxmlgetattribute (htopmldocument, STR_version, stringvaluetype, &vvers))
+ disposehandle ( h );
+
+ if ( ! newtexthandle ( STR_version, &h ) )
goto exit2;
-
+
+ if (!opxmlgetattribute (htopmldocument, h, stringvaluetype, &vvers))
+ goto exit2;
+
pullstringvalue (&vvers, bsvers);
dateversionlessthan (bsvers, BIGSTRING ("\x03" "1.1"), &v);
@@ -284,13 +299,19 @@
/*Get <body> item and convert it to an outline.*/
- if (!opxmlfindtableitem (htopmldocument, STR_body, &htbody)) { /*<body> is not optional*/
+ disposehandle ( h );
+
+ if ( ! newtexthandle ( STR_body, &h ) )
+ goto exit2;
+
+ if (!opxmlfindtableitem (htopmldocument, h, &htbody)) { /*<body> is not optional*/
langerrormessage (STR_errornobody);
goto exit2;
+
} /*if*/
-
+
oppushoutline (ho);
if (!flnewoutline) { /*7.1b12 PBS: Inhibit display*/
@@ -298,18 +319,19 @@
florigdisplayenabled = (**ho).flinhibitdisplay;
(**ho).flinhibitdisplay = true;
+
}
-
+
if (!opxmltooutlinevisit (htbody, 0, STR_body, true)) { /*Convert XML to outline -- recursive routine*/
-
+
langerrormessage (STR_errornooutlines);
-
+
oppopoutline ();
-
+
goto exit2;
-
+
} /*if*/
-
+
if (!flnewoutline) { /*7.1b12 PBS: Restore display setting; update window*/
hdlwindowinfo hinfo;
@@ -319,10 +341,11 @@
if (shellfinddatawindow ((Handle) ho, &hinfo)) { /*get window info*/
shellupdatenow ((**hinfo).macwindow);
+
} /*if*/
+
} /*if*/
-
-
+
oppopoutline ();
/*Get <head> item and set the window attributes if this is a new outline.*/
@@ -335,13 +358,19 @@
if (flnewoutline && flheadfound) {
- if (opxmlfindtableitem (htopmldocument, STR_head, &hthead)) {
+ disposehandle ( h );
+
+ if ( ! newtexthandle ( STR_head, &h ) )
+ goto exit2;
+ if (opxmlfindtableitem (htopmldocument, h, &hthead)) {
+
oppushoutline (ho);
- opxmlsetwindowatts (hthead, ho, hto, bso, vo); /*set window attributes*/
+ opxmlsetwindowatts (hthead, ho, hto, handleO, vo); /*set window attributes*/
oppopoutline ();
+
}
} /*if*/
@@ -355,6 +384,7 @@
langerrormessage (STR_errornohead);
goto exit2;
+
} /*if*/
if (hcloud != nil && flcanhavecloud) { /*7.1b43 dmb: load the cloud elements into the table*/
@@ -367,11 +397,14 @@
exit2:
- disposehashtable (ht, false);
-
+ disposehandle ( h );
+
+ disposehashtable (ht, false);
+
exit1:
- return (fl);
+ return (fl);
+
} /*opxmltooutline*/
@@ -561,72 +594,103 @@
} /*teststringvalue*/
-static boolean opxmlpushcloudattribute (Handle htag, hdlhashtable hcloud, bigstring bsatt, bigstring legalvalues) {
+static boolean opxmlpushcloudattribute (Handle htag, hdlhashtable hcloud, const Handle handleAttribute, bigstring legalvalues) {
- /*
- 7.1b43 dmb: push the named attribute into the cloud tag, getting the value from the hcloud table
- if legalvalues is not nil, it's a |-delimited list of legal string values for this attribute
- */
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.1b43 dmb: push the named attribute into the cloud tag, getting the
+ // value from the hcloud table if legalvalues is not nil, it's
+ // a |-delimited list of legal string values for this attribute
+ //
tyvaluerecord v;
hdlhashnode hn;
- if (!hashtablelookup (hcloud, bsatt, &v, &hn) ||
- !copyvaluerecord (v, &v) ||
- !coercetostring (&v) ||
- !teststringvalue (&v, legalvalues)) {
+ if ( ! hashtablelookup ( hcloud, handleAttribute, &v, &hn ) ||
+ ! copyvaluerecord ( v, &v ) || ! coercetostring ( &v ) ||
+ ! teststringvalue ( &v, legalvalues ) ) {
- langparamerror (cloudspecerror, bsatt);
+ langparamerror ( cloudspecerror, handleAttribute );
return (false);
+
}
-
- if (!opxmlpushoneattribute (htag, bsatt, v.data.stringvalue)) //Add att to returned text.
+
+ if (!opxmlpushoneattribute (htag, handleAttribute, v.data.stringvalue)) //Add att to returned text.
return (false);
disposevaluerecord (v, false);
return (true);
+
} /*opxmlpushcloudattribute*/
static boolean opxmlpushcloudtag (hdlhashtable hcloud, short indentlevel, Handle htext) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.1b43 dmb: push a cloud tag with attributes coming from hcloud table
+ // values
+ //
- /*
- 7.1b43 dmb: push a cloud tag with attributes coming from hcloud table values
- */
-
- Handle hcloudtag;
+ Handle h, hcloudtag;
boolean fl = false;
if (!newtexthandle (STR_opencloud, &hcloudtag))
return (false);
+
+ if ( ! newtexthandle ( STR_domain, &h ) )
+ return ( false );
+
+ if (!opxmlpushcloudattribute (hcloudtag, hcloud, h, nil))
+ goto exit;
+
+ disposehandle ( h );
- if (!opxmlpushcloudattribute (hcloudtag, hcloud, STR_domain, nil))
+ if ( ! newtexthandle ( STR_port, &h ) )
+ return ( false );
+
+ if (!opxmlpushcloudattribute (hcloudtag, hcloud, h, nil))
goto exit;
-
- if (!opxmlpushcloudattribute (hcloudtag, hcloud, STR_port, nil))
+
+ disposehandle ( h );
+
+ if ( ! newtexthandle ( STR_path, &h ) )
+ return ( false );
+
+ if (!opxmlpushcloudattribute (hcloudtag, hcloud, h, nil))
goto exit;
-
- if (!opxmlpushcloudattribute (hcloudtag, hcloud, STR_path, nil))
+
+ disposehandle ( h );
+
+ if ( ! newtexthandle ( STR_regProcedure, &h ) )
+ return ( false );
+
+ if (!opxmlpushcloudattribute (hcloudtag, hcloud, h, nil))
goto exit;
-
- if (!opxmlpushcloudattribute (hcloudtag, hcloud, STR_regProcedure, nil))
+
+ disposehandle ( h );
+
+ if ( ! newtexthandle ( STR_protocol, &h ) )
+ return ( false );
+
+ if (!opxmlpushcloudattribute (hcloudtag, hcloud, h, STR_legalprotocols))
goto exit;
-
- if (!opxmlpushcloudattribute (hcloudtag, hcloud, STR_protocol, STR_legalprotocols))
- goto exit;
-
+
if (!pushtexthandle (BIGSTRING ("\x02" "/>"), hcloudtag))
goto exit;
-
+
fl = opxmlpushhandleline (htext, hcloudtag, indentlevel);
exit:
-
- disposehandle (hcloudtag);
-
- return (fl);
+
+ disposehandle (hcloudtag);
+
+ return (fl);
+
} /*opxmlpushcloudtag*/
@@ -698,12 +762,14 @@
} /*opxmlpushclosingoutlinetags*/
-static boolean opxmlpushoneattribute (Handle htext, bigstring bsname, Handle hvalue) {
+static boolean opxmlpushoneattribute (Handle htext, const Handle handleName, Handle hvalue) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b21 PBS: Push one attribute onto the returned text.
+ //
- /*
- 7.0b21 PBS: Push one attribute onto the returned text.
- */
-
Handle h;
boolean fl = false;
@@ -719,7 +785,7 @@
if (!pushtexthandle (STR_space, htext)) /*add a space character*/
goto exit;
- if (!pushtexthandle (bsname, htext)) /*add the attribute name*/
+ if (!pushhandle (handleName, htext)) /*add the attribute name*/
goto exit;
if (!pushtexthandle (STR_equalsquotes, htext)) /*add ="*/
@@ -739,37 +805,52 @@
static boolean opxmlpushattributes (hdlheadrecord hnode, Handle htext, short indentlevel) {
-#pragma unused(indentlevel)
- /*
- 7.0b21 PBS: push the attributes onto the current <outline> item.
- */
+ #pragma unused(indentlevel)
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b21 PBS: push the attributes onto the current <outline> item.
+ //
+
+ Handle h = NULL, htrue;
+ boolean fl = false, flhasatts = false;
+ hdlhashnode hn = nil, hn2 = nil;
+ hdlhashtable ht;
tyvaluerecord v;
- hdlhashtable ht;
- hdlhashnode hn = nil, hn2 = nil;
- boolean fl = false;
- boolean flhasatts = false;
- Handle htrue;
/*Possibly set isComment and isBreakpoint.*/
if (!newemptyhandle (&htrue))
return (false);
-
+
if (!pushtexthandle (STR_booleantrue, htrue))
goto exit;
+
+ if ((**hnode).flcomment) {
- if ((**hnode).flcomment)
-
- if (!opxmlpushoneattribute (htext, STR_iscomment, htrue)) /*isComment="true"*/
+ if ( ! newtexthandle ( STR_iscomment, &h ) )
goto exit;
+
+ if (!opxmlpushoneattribute (htext, h, htrue)) /*isComment="true"*/
+ goto exit;
+
+ disposehandle ( h );
+
+ h = NULL;
+
+ }
+
+ if ((**hnode).flbreakpoint) {
- if ((**hnode).flbreakpoint)
-
- if (!opxmlpushoneattribute (htext, STR_isbreakpoint, htrue)) /*isBreakpoint="true"*/
+ if ( ! newtexthandle ( STR_isbreakpoint, &h ) )
goto exit;
-
+
+ if (!opxmlpushoneattribute (htext, h, htrue)) /*isBreakpoint="true"*/
+ goto exit;
+ }
+
/*Get other attributes from the refcon -- the packed table.*/
disablelangerror ();
@@ -783,36 +864,48 @@
fl = true;
goto exit; /*no atts -- not an error*/
+
} /*if*/
-
+
if (!tablevaltotable (v, &ht, hn))
goto exit; /*Error.*/
-
+
/*Loop through the table*/
for (hn2 = (**ht).hfirstsort; hn2 != nil; hn2 = (**hn2).sortedlink) {
+
+ Handle handleName;
- bigstring bsname;
-
if (coercevalue (&((**hn2).val), stringvaluetype)) { /*Does the coercion to string succeed?*/
- gethashkey (hn2, bsname); /*Get att name*/
+ gethashkey ( hn2, &handleName ); // get att name
- if (!opxmlpushoneattribute (htext, bsname, (**hn2).val.data.stringvalue)) /*Add att to returned text.*/
- goto exit;
+ if (!opxmlpushoneattribute (htext, handleName, (**hn2).val.data.stringvalue)) { /*Add att to returned text.*/
+
+ disposehandle ( handleName );
+
+ goto exit;
+
+ }
+
+ disposehandle ( handleName );
+
} /*if*/
+
} /*for*/
fl = true; /*success*/
exit:
- disposehandle (htrue);
-
- if (flhasatts)
- disposevaluerecord (v, false);
-
- return (fl);
+ disposehandle ( h );
+ disposehandle ( htrue );
+
+ if (flhasatts)
+ disposevaluerecord (v, false);
+
+ return (fl);
+
} /*opxmlpushattributes*/
@@ -878,22 +971,23 @@
return (true);
nomad = nextnomad;
+
} /*while*/
} /*opxmlvisitnondynamicnodes*/
static boolean opxmlbodyvisit (hdlheadrecord hnode, ptrvoid htext) {
-
+
/*
7.0b21 PBS: process one headline, add it to the returned text.
Look ahead to the next flatdown headline, and add a /> if no subs.
If next headline is at a higher level, close off <outline> elements,
as many as needed.
-
+
7.0b30 PBS: handle a dynamic node -- it has subs, but pretend it doesn't,
-
+
since the children should not be saved.
*/
@@ -906,25 +1000,25 @@
if (!copyhandle ((**hnode).headstring, &h))
return (false);
-
+
indentlevel = (**hnode).headlevel + 2;
if (!opxmlpushoutlinetext (h, htext, indentlevel))
goto exit;
-
+
if (!opxmlpushattributes (hnode, htext, indentlevel))
goto exit;
-
+
hflatdown = opbumpflatdown (hnode, false);
nextlevel = (**hflatdown).headlevel + 2;
if (nextlevel == indentlevel)
fl = true;
-
+
if (nextlevel > indentlevel)
flsubs = true;
-
+
if ((**hnode).fldynamic) /*7.0b30: dynamic nodes may have subs, but we ignore them.*/
flsubs = false;
@@ -936,19 +1030,21 @@
goto exit;
fl = true;
+
} /*if*/
-
+
if (nextlevel < indentlevel) /*Need to close off outline items?*/
fl = opxmlpushclosingoutlinetags (htext, indentlevel, nextlevel); /*Add as many </outline> tags as needed.*/
if (hnode == hflatdown) /*At the end of the outline?*/
fl = opxmlpushclosingoutlinetags (htext, indentlevel, 2); /*Add as many </outline> tags as needed.*/
-exit:
+ exit:
- disposehandle (h);
-
- return (fl);
+ disposehandle (h);
+
+ return (fl);
+
} /*opxmlbodyvisit*/
@@ -991,45 +1087,50 @@
} /*opxmlbuildbody*/
-static boolean opxmlensureopenwindow (hdloutlinerecord ho, hdlhashtable hto, bigstring bso, tyvaluerecord vo, hdlwindowinfo *hinfo, boolean *flwasopen) {
+static boolean opxmlensureopenwindow (hdloutlinerecord ho, hdlhashtable hto, Handle *handleO, tyvaluerecord vo, hdlwindowinfo *hinfo, boolean *flwasopen) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b21 PBS: make sure the window is open. *hinfo gets the window info.
+ //
- /*
- 7.0b21 PBS: make sure the window is open. *hinfo gets the window info.
- */
-
*flwasopen = true;
if (!shellfinddatawindow ((Handle) ho, hinfo)) { /*try to find window -- it might be open*/
*flwasopen = false;
- if (!langzoomvalwindow (hto, bso, vo, false)) /*open window*/
+ if (!langzoomvalwindow (hto, handleO, vo, false)) /*open window*/
return (false);
+
} /*if*/
if (!shellfinddatawindow ((Handle) ho, hinfo)) /*get window info*/
return (false);
return (true);
+
} /*opxmlensureopenwindow*/
static boolean opxmlbuildhead (Handle htext, hdloutlinerecord ho, Handle hname, Handle hemail, short indentlevel, hdlwindowinfo hinfo, hdlhashtable hcloud) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b21 PBS: build the <head> section of the document.
+ //
+ // First get info about the window -- title, rect, etc. -- then
+ // push the tagged values on the returned text.
+ //
- /*
- 7.0b21 PBS: build the <head> section of the document.
-
- First get info about the window -- title, rect, etc. -- then push the tagged values on the returned text.
- */
-
- long scrollstate;
- Handle hexpansionstate;
+ Handle hexpansionstate, hTitle;
Rect r;
boolean fl = false;
+ long scrollstate;
+ tyvaluerecord vtimecreated, vtimemodified;
unsigned long timecreated, timemodified;
- tyvaluerecord vtimecreated, vtimemodified;
- bigstring bstitle;
- Handle htitle;
/*Get window info.*/
@@ -1042,8 +1143,11 @@
if (!shellgetglobalwindowrect (hinfo, &r)) /*window rect*/
goto exit;
- shellgetwindowtitle (hinfo, bstitle); /*window title -- no return value*/
+ if ( ! newemptyhandle ( &hTitle ) )
+ goto exit3;
+ shellgetwindowtitle ( hinfo, &hTitle ); // window title -- no return value
+
timecreated = (**ho).timecreated; /*time created*/
timemodified = (**ho).timelastsave; /*time last saved*/
@@ -1061,17 +1165,11 @@
indentlevel++;
- if (!newemptyhandle (&htitle))
+ if (!opxmlpushonetag (STR_title, hTitle, indentlevel, htext)) /*<title>*/
goto exit3;
- if (!pushtexthandle (bstitle, htitle))
- goto exit3;
+ disposehandle ( hTitle );
- if (!opxmlpushonetag (STR_title, htitle, indentlevel, htext)) /*<title>*/
- goto exit3;
-
- disposehandle (htitle);
-
if (!opxmlpushonetag (STR_datecreated, vtimecreated.data.stringvalue, indentlevel, htext)) /*<dateCreated>*/
goto exit3;
@@ -1113,20 +1211,18 @@
/*Clean up*/
-exit3:
+ exit3:
+ disposevaluerecord (vtimemodified, false);
+
+ exit2:
+ disposevaluerecord (vtimecreated, false);
+
+ exit:
+ disposehandle (hexpansionstate);
- disposevaluerecord (vtimemodified, false);
+ return (fl);
-exit2:
-
- disposevaluerecord (vtimecreated, false);
-
-exit:
-
- disposehandle (hexpansionstate);
-
- return (fl);
- } /*opxmlbuildhead*/
+ } // opxmlbuildhead
static boolean opxmlencodetext (Handle htext) {
@@ -1243,65 +1339,88 @@
} /*opxmlpushhandleline*/
-static boolean opxmlfindtableitem (hdlhashtable ht, bigstring bsname, hdlhashtable *htfound) {
+static boolean opxmlfindtableitem (hdlhashtable ht, const Handle handleName, hdlhashtable *htfound) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b21 PBS: find one table item in a table, such as an
+ // <outlineDocument>, <head>, or <body> item.
+ //
- /*
- 7.0b21 PBS: find one table item in a table, such as an <outlineDocument>,
- <head>, or <body> item.
- */
-
hdlhashnode hn;
for (hn = (**ht).hfirstsort; hn != nil; hn = (**hn).sortedlink) { /*loop through the table*/
- if (isxmlmatch (hn, bsname)) { /*is this the name we're looking for?*/
+ if (isxmlmatch (hn, handleName)) { /*is this the name we're looking for?*/
if (gethashnodetable (hn, htfound)) { /*Try to get the table*/
return (true); /*Found, it's a table, return true.*/
+
} /*if*/
+
} /*if*/
+
} /*for*/
return (false);
+
} /*opxmlfindtableitem*/
static boolean opxmlheadexists (hdlhashtable ht) {
- /*
- 7.0b33 PBS: return true if there's a required <head> section of the document.
- */
-
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b33 PBS: return true if there's a required <head> section of the
+ // document.
+ //
+
+ Handle h;
+ boolean fl = false;
hdlhashnode hn;
+
+ if ( newtexthandle ( STR_head, &h ) )
+ return ( false );
+
+ for (hn = (**ht).hfirstsort; hn != nil; hn = (**hn).sortedlink) // loop through the table
+
+ if ( isxmlmatch ( hn, h ) ) { // is this the name we're looking for?
+
+ fl = true;
+
+ goto exit; // found; return true
+
+ }
+
+ exit:
+ disposehandle ( h );
+
+ return ( fl );
+
+ } /*opxmlheadexists*/
- for (hn = (**ht).hfirstsort; hn != nil; hn = (**hn).sortedlink) { /*loop through the table*/
- if (isxmlmatch (hn, STR_head)) /*is this the name we're looking for?*/
- return (true); /*Found; return true.*/
- } /*for*/
+static boolean opxmlgetonevalue (hdlhashtable ht, const Handle handleName, Handle htext) {
- return (false);
- } /*opxmlheadexists*/
-
-
-static boolean opxmlgetonevalue (hdlhashtable ht, bigstring bsname, Handle htext) {
+ // Everything is text at this level -- if you're not expecting text, don't
+ // use this routine. Other wrapper routines convert from text to numbers or
+ // lists or whatever.
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b21 PBS: get the value of one item from a table.
+ //
- /*
- 7.0b21 PBS: get the value of one item from a table.
-
- Everything is text at this level -- if you're not expecting text,
- don't use this routine. Other wrapper routines convert from text
- to numbers or lists or whatever.
- */
-
tyvaluerecord val;
hdlhashnode hn;
boolean fl = false;
for (hn = (**ht).hfirstsort; hn != nil; hn = (**hn).sortedlink) {
- if (isxmlmatch (hn, bsname)) {
+ if (isxmlmatch (hn, handleName)) {
val = (**hn).val;
@@ -1310,29 +1429,36 @@
if (copyhandlecontents (val.data.stringvalue, htext)) {
fl = true;
+
} /*if*/
+
} /*if*/
break; /*Break once the item has been found, whether or not htext contains the data sought.*/
+
} /*if*/
+
} /*for*/
return (fl);
+
} /*opxmlgetonevalue*/
-static boolean opxmlgetonelongvalue (hdlhashtable ht, bigstring bsname, long *v) {
+static boolean opxmlgetonelongvalue (hdlhashtable ht, const Handle handleName, long *v) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b21 PBS: get one long value. See comments in opxmlgetoneshortvalue.
+ //
- /*
- 7.0b21 PBS: get one long value. See comments in opxmlgetoneshortvalue.
- */
-
Handle h;
bigstring bs;
newemptyhandle (&h);
- if (!opxmlgetonevalue (ht, bsname, h)) /*Get value in Handle h*/
+ if (!opxmlgetonevalue (ht, handleName, h)) /*Get value in Handle h*/
return (false);
texthandletostring (h, bs); /*Convert to bigstring -- it's going to be a number, so a bigstring's size limit is okay*/
@@ -1340,26 +1466,30 @@
disposehandle (h);
return (stringtonumber (bs, v)); /*Convert bigstring to a long*/
+
} /*opxmlgetonelongvalue*/
-static boolean opxmlgetoneshortvalue (hdlhashtable ht, bigstring bsname, short *v) {
+static boolean opxmlgetoneshortvalue (hdlhashtable ht, const Handle handleName, short *v) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b21 PBS: get one number value.
+ //
+ // This function goes from handle to bigstring to short. Why?
+ // Because I wanted just one routine that gets the value --
+ // that's opxmlgetonevalue. All other routines use that routine
+ // to get a value, then do coercions. Is that a performance
+ // problem? I seriously doubt it, but testing will tell.
+ //
- /*
- 7.0b21 PBS: get one number value.
-
- This function goes from handle to bigstring to short. Why? Because I wanted just one
- routine that gets the value -- that's opxmlgetonevalue. All other routines use
- that routine to get a value, then do coercions. Is that a performance problem? I seriously
- doubt it, but testing will tell.
- */
-
Handle h;
bigstring bs;
newemptyhandle (&h);
- if (!opxmlgetonevalue (ht, bsname, h)) /*Get value in Handle h*/
+ if (!opxmlgetonevalue (ht, handleName, h)) /*Get value in Handle h*/
return (false);
texthandletostring (h, bs); /*Convert to bigstring -- it's going to be a number, so a bigstring's size limit is okay*/
@@ -1367,87 +1497,146 @@
disposehandle (h);
return (stringtoshort (bs, v)); /*Convert bigstring to a short*/
+
} /*opxmlgetoneshortvalue*/
static boolean opxmlsetwindowpositionandsize (hdlhashtable ht, hdlwindowinfo hinfo) {
+
+ //
+ // Get windowtop, windowleft, windowbottom, and windowright from the
+ // <head> section of the XML.
+ //
+ // Even though the return value is ignored by opxmlsetwindowatts, this
+ // script still returns a boolean just in case at some point later someone
+ // does care about success or failure.
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b21 PBS: set the window's position and size.
+ //
- /*
- 7.0b21 PBS: set the window's position and size.
-
- Get windowtop, windowleft, windowbottom, and windowright from the <head>
- section of the XML.
-
- Even though the return value is ignored by opxmlsetwindowatts, this script still returns
- a boolean just in case at some point later someone does care about success or failure.
- */
-
+ Handle h;
short windowtop, windowleft, windowbottom, windowright;
/*Set window position*/
-
- if (!opxmlgetoneshortvalue (ht, STR_windowtop, &windowtop))
- return (false);
-
- if (!opxmlgetoneshortvalue (ht, STR_windowleft, &windowleft))
- return (false);
+ if ( ! newtexthandle ( STR_windowtop, &h ) )
+ return ( false );
+
+ if (!opxmlgetoneshortvalue (ht, h, &windowtop))
+ goto exit;
+
+ disposehandle ( h );
+
+ if ( ! newtexthandle ( STR_windowleft, &h ) )
+ return ( false );
+
+ if (!opxmlgetoneshortvalue (ht, h, &windowleft))
+ goto exit;
+
// if (!shellmovewindow (hinfo, windowleft, windowtop)) /*Set window position*/
// return (false); /*shellmovewindow always returns true at this writing, but that could change*/
if (!shellmovewindowhidden (hinfo, windowleft, windowtop)) /*Set window position*/
return (false); /*shellmovewindow always returns true at this writing, but that could change*/
-
+
/*Set the window size*/
-
- if (!opxmlgetoneshortvalue (ht, STR_windowright, &windowright))
- return (false);
- if (!opxmlgetoneshortvalue (ht, STR_windowbottom, &windowbottom))
- return (false);
+ disposehandle ( h );
+ if ( ! newtexthandle ( STR_windowright, &h ) )
+ return ( false );
+
+ if (!opxmlgetoneshortvalue (ht, h, &windowright))
+ goto exit;
+
+ disposehandle ( h );
+
+ if ( ! newtexthandle ( STR_windowbottom, &h ) )
+ return ( false );
+
+ if (!opxmlgetoneshortvalue (ht, h, &windowbottom))
+ goto exit;
+
+ disposehandle ( h );
+
if (!shellsizewindowhidden (hinfo, windowright - windowleft, windowbottom - windowtop)) /*Set window size*/
return (false); /*shellsizewindow returns false if the window isn't growable*/
-
+
return (true);
+
+ exit:
+
+ disposehandle ( h );
+
+ return ( false );
+
} /*opxmlsetwindowpositionandsize*/
static boolean opxmlsetwindowtitle (hdlhashtable ht, hdlwindowinfo hinfo) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b21 PBS: set the window title.
+ //
- /*
- 7.0b21 PBS: set the window title.
- */
+ Handle h, htext;
+ boolean fl;
- Handle htext;
- bigstring bstitle;
-
if (!newemptyhandle (&htext))
return (false);
+
+ if ( ! newtexthandle ( STR_title, &h ) )
+ return ( false );
+
+ if (!opxmlgetonevalue (ht, h, htext)) { /*Get the <title> value*/
- if (!opxmlgetonevalue (ht, STR_title, htext)) /*Get the <title> value*/
+ disposehandle ( h );
+
return (false);
+
+ }
+
+ disposehandle ( h );
- texthandletostring (htext, bstitle); /*Convert to bigstring -- window titles are bigstrings*/
+ fl = shellsetwindowtitle ( hinfo, htext ); // Set the window title
- return (shellsetwindowtitle (hinfo, bstitle)); /*Set the window title*/
+ return ( fl );
+
+ disposehandle ( htext );
+
} /*opxmlsetwindowtitle*/
static boolean opxmlsetwindowexpansionstate (hdlhashtable ht, hdlwindowinfo hinfo) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b21 PBS: set the expansion state for a window.
+ //
- /*
- 7.0b21 PBS: set the expansion state for a window.
- */
-
- Handle htext;
+ Handle h, htext;
+ boolean fl = false;
tyvaluerecord val, v;
- boolean fl = false;
if (!newemptyhandle (&htext))
return (false);
+
+ if ( ! newtexthandle ( STR_expansionstate, &h ) ) {
- if (!opxmlgetonevalue (ht, STR_expansionstate, htext))
+ disposehandle ( h );
+
+ return ( false );
+
+ }
+
+ disposehandle ( h );
+
+ if (!opxmlgetonevalue (ht, h, htext))
goto exit1;
/*Surround text with { and }, so it can be coerced to a list.*/
@@ -1486,36 +1675,47 @@
htext = nil;
-exit1:
+ exit1:
- if (htext != nil)
- disposehandle (htext);
-
- return (fl);
+ if (htext != nil)
+ disposehandle (htext);
+
+ return (fl);
+
} /*opxmlsetwindowexpansionstate*/
static boolean opxmlsetwindowverticalscrollstate (hdlhashtable ht, hdlwindowinfo hinfo) {
-
- /*
- 7.0b21 PBS: set vertical scroll state for the outline window.
- 7.0b22 PBS: fix display glitch by updating the outline window.
-
-
-
- 7.0b23 PBS: display glitch fix part two -- set hline1 to hbarcursor, not ...
[truncated message content] |
|
From: <cre...@us...> - 2007-02-27 08:00:30
|
Revision: 1635
http://svn.sourceforge.net/frontierkernel/?rev=1635&view=rev
Author: creecode
Date: 2007-02-27 00:00:29 -0800 (Tue, 27 Feb 2007)
Log Message:
-----------
in centerbuttonstring function, ellipsize strings from middle
Modified Paths:
--------------
Frontier/branches/Frontier_Long_File_Paths/Common/source/quickdraw.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/quickdraw.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/quickdraw.c 2007-02-27 04:38:00 UTC (rev 1634)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/quickdraw.c 2007-02-27 08:00:29 UTC (rev 1635)
@@ -1298,25 +1298,28 @@
void centerbuttonstring (const Rect *r, bigstring bs, boolean fldisabled) {
-
- /*
- draw the string in the current font, size and style, centered inside
- the indicated rectangle.
-
- 11/10/89 DW: workaround wierdnesses in geneva 9 by subtracting 1 from v.
-
- 9/10/91 dmb: geneva 9 workaround can mess up other fonts; added check to
- ensure top of characters aren't cut off
- 6.26.97 dmb: added fldisabled, renamed as centerbuttonstring
- */
+ //
+ // draw the string in the current font, size and style, centered inside the
+ // indicated rectangle.
+ //
+ // 2007-02-26 creedon: ellipsize strings from middle
+ //
+ // 1997-06-26 dmb: added fldisabled, renamed as centerbuttonstring
+ //
+ // 1991-09-10 dmb: geneva 9 workaround can mess up other fonts; added
+ // check to ensure top of characters aren't cut off
+ //
+ // 1989-11-10 DW: workaround wierdnesses in geneva 9 by subtracting 1 from
+ // v.
+ //
register short lh = globalfontinfo.ascent + globalfontinfo.descent; /*line height*/
register short rh = (*r).bottom - (*r).top;
register short rw = (*r).right - (*r).left;
register short h, v;
- ellipsize (bs, rw); /*make sure it fits inside the rectangle, width-wise*/
+ ellipsizemiddle (bs, rw); /*make sure it fits inside the rectangle, width-wise*/
h = (*r).left + ((rw - stringpixels (bs)) / 2);
@@ -1338,6 +1341,7 @@
Drawstring (bs, fldisabled);
popclip ();
+
} /*centerbuttonstring*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cre...@us...> - 2007-02-27 04:38:07
|
Revision: 1634
http://svn.sourceforge.net/frontierkernel/?rev=1634&view=rev
Author: creecode
Date: 2007-02-26 20:38:00 -0800 (Mon, 26 Feb 2007)
Log Message:
-----------
formatting tweaks
Modified Paths:
--------------
Frontier/branches/Frontier_Long_File_Paths/Common/headers/opxml.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/osincludes.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/popup.h
Frontier/branches/Frontier_Long_File_Paths/Common/source/miniwindow.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/op.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/opinit.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/oplist.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/oppack.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/opstructure.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/opvisit.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/osadroplet.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/popup.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/opxml.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/opxml.h 2007-02-26 22:59:15 UTC (rev 1633)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/opxml.h 2007-02-27 04:38:00 UTC (rev 1634)
@@ -25,10 +25,9 @@
******************************************************************************/
-/*
-opxml.h -- 7.0b21 PBS
-*/
+// 7.0b21 PBS
-boolean opxmltooutline (Handle htext, hdloutlinerecord ho, boolean flnewoutline, hdlhashtable hto, bigstring bso, tyvaluerecord vo, hdlhashtable hcloud);
+boolean opxmltooutline ( Handle, hdloutlinerecord, boolean, hdlhashtable, Handle *, tyvaluerecord, hdlhashtable );
-boolean opoutlinetoxml (hdloutlinerecord ho, Handle hname, Handle hemail, Handle *htext, hdlhashtable hto, bigstring bso, tyvaluerecord vo, hdlhashtable hcloud);
+boolean opoutlinetoxml ( hdloutlinerecord, Handle, Handle, Handle *, hdlhashtable, Handle *, tyvaluerecord, hdlhashtable );
+
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/osincludes.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/osincludes.h 2007-02-26 22:59:15 UTC (rev 1633)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/osincludes.h 2007-02-27 04:38:00 UTC (rev 1634)
@@ -63,7 +63,6 @@
#endif /* WIN95VERSION */
-
#ifdef MACVERSION
#define OTDEBUG 1 /* must define before including OpenTransport headers */
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/popup.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/popup.h 2007-02-26 22:59:15 UTC (rev 1633)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/popup.h 2007-02-27 04:38:00 UTC (rev 1634)
@@ -65,9 +65,9 @@
typedef boolean (*popupselectcallback) (hdlmenu, short);
-/*prototypes*/
+// prototypes
-extern boolean pushpopupitem (hdlmenu, bigstring, boolean, short);
+extern boolean pushpopupitem ( hdlmenu, bigstring, boolean, short );
extern boolean popupmenuhit (Rect, boolean, fillpopupcallback, popupselectcallback);
@@ -75,5 +75,3 @@
extern boolean adjustpopupcursor (Point, Rect);
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/miniwindow.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/miniwindow.c 2007-02-26 22:59:15 UTC (rev 1633)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/miniwindow.c 2007-02-27 04:38:00 UTC (rev 1634)
@@ -417,21 +417,25 @@
closebitmap (miniwindow);
return (true);
+
} /*minidrawmsg*/
static boolean minimessage (bigstring bs, boolean flbackgroundmsg) {
-#pragma unused (flbackgroundmsg)
+ #pragma unused (flbackgroundmsg)
+
copystring (bs, (**minidata).bsmsg);
return (minidrawmsg ());
+
} /*minimessage*/
static boolean minigettargetdata (short id) {
return ((*(**minidata).gettargetdataroutine) (id));
+
} /*minigettargetdata*/
@@ -1100,6 +1104,7 @@
shellpopglobals ();
return (true);
+
} /*minisetwindowmessage*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/op.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/op.c 2007-02-26 22:59:15 UTC (rev 1633)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/op.c 2007-02-27 04:38:00 UTC (rev 1634)
@@ -235,6 +235,7 @@
opsetfont ((short) ((long) hdata));
return (true);
+
} /*undosetfont*/
@@ -256,6 +257,7 @@
oppoststylechange ();
return (true);
+
} /*opsetfont*/
@@ -265,6 +267,7 @@
opsetsize ((short) ((long) hdata));
return (true);
+
} /*undosetsize*/
@@ -959,15 +962,18 @@
opdraggingmove (pt, (**ho).hbarcursor);
break;
+
}
+
} /*while*/
return (true);
+
} /*opmousedown*/
static boolean opcmdmove (tydirection dir) {
-
+
if (!opreorgcursor (dir, 1)) {
shellouch ();
@@ -976,6 +982,7 @@
}
return (true);
+
} /*opcmdmove*/
@@ -1092,33 +1099,15 @@
langopruncallbackscripts (idopreturnkeyscript); /* DW 1/19/00, let the opReturnKey callbacks have a chance to hook in */
-/* if (flsplit) { /% AR 2/16/00, split the current headline at the cursor position %/
-
- long maxpos, startsel, endsel;
-
- opeditgetmaxpos (&maxpos);
-
- opeditgetselection (&startsel, &endsel);
-
- //set current headline to 0..startsel
-
- if (!loadfromhandletohandle ((**ho).hbuffer, &startsel, 4, false, &hstring)) {
- ouch ();
- return;
- }
-
- opinsertheadline (hstring, dir, flcomment);
- }
+ if ( newemptyhandle ( &hstring ) )
+ opinsertheadline ( hstring, dir, flcomment );
else
-*/
- if (!newemptyhandle (&hstring))
- ouch ();
- else
- opinsertheadline (hstring, dir, flcomment);
-
+ ouch ( );
+
langopruncallbackscripts (idopinsertscript); /*7.1b7: callback after a headline is created.*/
opdocursor (true);
+
} /*opreturnkey*/
@@ -1127,6 +1116,7 @@
optoggletextmode ();
return (true);
+
} /*openterkey*/
@@ -1136,6 +1126,7 @@
(**outlinedata).hbarcursor = hnode; /*move cursor to first headline encountered*/
return (false); /*stop visiting*/
+
} /*opmovetovisit*/
@@ -1408,6 +1399,7 @@
opreturnkey ();
return (true);
+
}
if (chkb == chenter) {
@@ -1423,6 +1415,7 @@
return (true);
return (openterkey ());
+
}
if (keyboardstatus.flkeypad) {
@@ -1449,6 +1442,7 @@
return (opcollapse (hcursor));
}
+
} /*keypad expand/collapse keys*/
if (!fltextmode) {
@@ -1474,6 +1468,7 @@
opeditselectall ();
fltextmode = true; /*set local copy*/
+
}
}
@@ -1498,6 +1493,7 @@
}
return (opeditkey ()); /*pass keystroke to TextEdit*/
+
}
L1: /*process keystroke as a structure command*/
@@ -1534,6 +1530,7 @@
}
goto motion;
+
}
if (floption && keyboardstatus.flcmdkey) { /*check for surface & dive keys*/
@@ -1557,6 +1554,7 @@
break;
default:
+
/* do nothing */
break;
}
@@ -1625,6 +1623,7 @@
}
return (true);
+
} /*opkeystroke*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/opinit.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/opinit.c 2007-02-26 22:59:15 UTC (rev 1633)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/opinit.c 2007-02-27 04:38:00 UTC (rev 1634)
@@ -97,15 +97,18 @@
opdefaultsetscraproutine (houtline);
return (false); /*don't call any more hooks*/
+
}
return (true); /*keep going*/
+
} /*opscraphook*/
boolean opdefaultreleaserefconroutine (hdlheadrecord hnode, boolean fldisk) {
-#pragma unused (hnode, fldisk)
+ #pragma unused (hnode, fldisk)
+
/*
default callback for releasing the refcon, does nothing. note that the
callback is responsible for releasing the data linked into the refcon
@@ -113,15 +116,18 @@
*/
return (true);
+
} /*opdefaultreleaserefconroutine*/
static boolean opdefaultpushstyle (hdlheadrecord hnode) {
-#pragma unused (hnode)
+ #pragma unused (hnode)
+
oppushstyle (outlinedata);
return (true);
+
} /*opdefaultpushstyle*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/oplist.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/oplist.c 2007-02-26 22:59:15 UTC (rev 1633)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/oplist.c 2007-02-27 04:38:00 UTC (rev 1634)
@@ -155,10 +155,11 @@
hcurrentlist = nil;
disposehandle ((Handle) hlist);
+
} /*opdisposelist*/
-boolean oppushhandle (hdllistrecord hlist, ptrstring pname, Handle hdata) {
+boolean oppushhandle ( hdllistrecord hlist, ptrstring pname, Handle hdata ) {
/*
add a new item at the end of the list. link in the indicated handle in the
@@ -172,6 +173,7 @@
register hdlheadrecord hlast;
register hdloutlinerecord ho;
register long ctitems;
+
hdlheadrecord hnew;
bigstring bs;
@@ -188,29 +190,30 @@
copystring (pname, bs); /*checks for nil*/
if (ctitems == 0) { /*adding to an empty list*/
-
+
hnew = (**ho).hsummit; /*set this guy's refcon handle*/
opsetheadstring (hnew, bs);
+
}
-
else {
+
hlast = oprepeatedbump (down, ctitems - 1, (**ho).hsummit, false);
- // setstringlength (bs, 0);
+ if ( ! opaddheadline ( hlast, down, bs, &hnew ) ) {
- if (!opaddheadline (hlast, down, bs, &hnew)) {
-
oppopoutline ();
goto error;
+
}
-
+
(**ho).ctexpanded++;
(**hnew).flexpanded = true;
+
}
-
+
#ifdef fldebug
if (fldebugging) {
@@ -220,23 +223,25 @@
pushint (ctitems + 1, bs);
opsetheadstring (hnew, bs);
+
}
-
+
#endif
(**hnew).hrefcon = hdata; /*link in the user's data structure*/
(**h).ctitems++;
-
+
oppopoutline ();
-
+
return (true);
-
+
error:
-
+
disposehandle (hdata);
return (false);
+
} /*oppushhandle*/
@@ -343,6 +348,7 @@
*/
return (oppushdata (hlist, pname, bs, (long) stringsize (bs)));
+
} /*oppushstring*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/oppack.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/oppack.c 2007-02-26 22:59:15 UTC (rev 1633)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/oppack.c 2007-02-27 04:38:00 UTC (rev 1634)
@@ -620,6 +620,7 @@
}
return (true);
+
} /*oppack*/
@@ -634,6 +635,7 @@
oppopoutline ();
return (fl);
+
} /*oppackoutline*/
@@ -694,6 +696,7 @@
}
return (true);
+
} /*intablevisit*/
@@ -708,6 +711,7 @@
packinfo.packstream = packstream;
return (opsiblingvisiter (hsummit, false, &intablevisit, &packinfo));
+
} /*optabletooutline*/
@@ -717,6 +721,7 @@
static boolean fltabindent;
+
static void clearindentvalues (boolean flmusttabindent) {
spacesforlevel = 0;
@@ -724,6 +729,7 @@
firstindent = -1;
fltabindent = flmusttabindent;
+
} /*clearindentvalues*/
@@ -861,11 +867,13 @@
}
(*textstream).pos++;
+
} /*while*/
closehandlestream (&s);
return (true);
+
} /*opgetlinetext*/
@@ -882,60 +890,67 @@
register hdlheadrecord h = nil;
register short lastlevel = 0;
register tydirection dir;
+
Handle hlinetext;
+ boolean fl = false; /*guilty until proven innocent*/
hdlheadrecord hnewnode;
short level;
- boolean fl = false; /*guilty until proven innocent*/
opstartinternalchange ();
clearindentvalues (true);
while (true) {
+
+ if (!opgetlinetext (platform != thisplatform, packstream, &level, &hlinetext)) { /*consumed the text*/
- if (!opgetlinetext (platform != thisplatform, packstream, &level, &hlinetext)) { /*consumed the text*/
-
if (h != nil) /*success -- we got something*/
fl = true;
+
+ break;
- break;
}
+
+ if (h == nil) { /*first line*/
- if (h == nil) { /*first line*/
-
if (!opnewstructure (hlinetext, hnode))
break;
-
+
h = *hnode;
lastlevel = 0;
+
}
else {
if (level > lastlevel)
dir = right;
-
+
else {
h = oprepeatedbump (left, lastlevel - level, h, true);
dir = down;
}
+
+ if (!opdepositnewheadline (h, dir, hlinetext, &hnewnode)) {
- if (!opdepositnewheadline (h, dir, hlinetext, &hnewnode)) {
-
opdisposestructure (*hnode, false);
break;
+
}
h = hnewnode;
lastlevel = level;
+
}
+
} /*while*/
-
+
opendinternalchange ();
return (fl);
+
} /*opunpacktexttooutline*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/opstructure.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/opstructure.c 2007-02-26 22:59:15 UTC (rev 1633)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/opstructure.c 2007-02-27 04:38:00 UTC (rev 1634)
@@ -443,6 +443,7 @@
opnodechanged ((**hd).headlinkleft); /*the parent's list changed*/
opnodechanged ((**hd).headlinkdown); /*the next guy's prev pointer changed*/
+
} /*opdepositdown*/
@@ -592,9 +593,11 @@
default:
return (false); /*invalid direction for deposit*/
+
} /*switch*/
return (true);
+
} /*opdeposit*/
@@ -2221,6 +2224,7 @@
static void opdisposenode (hdlheadrecord hnode) {
opdisposestructure (hnode, true);
+
} /*opdisposenode*/
@@ -2247,10 +2251,11 @@
opdisposenode (hnode);
return (true);
+
} /*opundodelete*/
-boolean opdepositnewheadline (hdlheadrecord hpre, tydirection dir, Handle hstring, hdlheadrecord *hnew) {
+boolean opdepositnewheadline ( hdlheadrecord hpre, tydirection dir, const Handle hstring, hdlheadrecord *hnew ) {
/*
6.0a1 dmb: handle-based version of opaddheadline, which now calls us
@@ -2266,6 +2271,7 @@
#endif
return (opdeposit (hpre, dir, *hnew));
+
} /*opdepositnewheadline*/
@@ -2277,6 +2283,7 @@
return (false);
return (opdepositnewheadline (hpre, dir, hstring, hnew));
+
} /*opaddheadline*/
@@ -2755,6 +2762,7 @@
opeditselectall (); // 5.0d18 dmb: in case text was added by callback
return (true);
+
} /*opinsertheadline*/
@@ -2833,6 +2841,3 @@
return (opsiblingvisiter ((**outlinedata).hsummit, true, &opsettmpbitvisit, (ptrvoid) false));
} /*opcleartmpbits*/
-
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/opvisit.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/opvisit.c 2007-02-26 22:59:15 UTC (rev 1633)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/opvisit.c 2007-02-27 04:38:00 UTC (rev 1634)
@@ -133,7 +133,9 @@
return (true);
nomad = nextnomad;
+
} /*while*/
+
} /*oprecursivelyvisit*/
@@ -191,7 +193,9 @@
return (true);
nomad = nextnomad;
+
} /*while*/
+
} /*oprecursivelyvisitkidsfirst*/
@@ -247,7 +251,9 @@
return (true);
nomad = nextnomad; /*advance to the next sibling*/
+
} /*while*/
+
} /*opsiblingvisiter*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/osadroplet.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/osadroplet.c 2007-02-26 22:59:15 UTC (rev 1633)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/osadroplet.c 2007-02-27 04:38:00 UTC (rev 1634)
@@ -1061,30 +1061,13 @@
long selfa5;
long clienta5;
- /*
- selfa5 = GetComponentRefcon (self);
-
- asm {
- move.l a5,clienta5
- move.l a5,-(a7)
- move.l selfa5,a5
- }
-
- SetComponentInstanceA5 ((ComponentInstance) self, selfa5);
- */
-
if (newcomponentglobals (self, clienta5, &hglobals))
SetComponentInstanceStorage ((ComponentInstance) self, (Handle) hglobals);
else
result = memFullErr;
- /*
- asm {
- move.l (a7)+,a5
- }
- */
-
break;
+
}
case kComponentCloseSelect:
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/popup.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/popup.c 2007-02-26 22:59:15 UTC (rev 1633)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/popup.c 2007-02-27 04:38:00 UTC (rev 1634)
@@ -42,7 +42,7 @@
#include "shell.h"
-boolean pushpopupitem (hdlmenu hmenu, bigstring bs, boolean flenabled, short commandid) {
+boolean pushpopupitem ( hdlmenu hmenu, bigstring bs, boolean flenabled, short commandid ) {
/*
7.1b23 PBS: commandid is new parameter: allow caller to specify the command id of
@@ -56,6 +56,7 @@
disablemenuitem (hmenu, countmenuitems (hmenu));
return (true);
+
} /*pushpopupitem*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cre...@us...> - 2007-02-26 22:59:17
|
Revision: 1633
http://svn.sourceforge.net/frontierkernel/?rev=1633&view=rev
Author: creecode
Date: 2007-02-26 14:59:15 -0800 (Mon, 26 Feb 2007)
Log Message:
-----------
support for long odb item names and file paths
formatting tweaks
Modified Paths:
--------------
Frontier/branches/Frontier_Long_File_Paths/Common/headers/odbinternal.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/op.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/opinternal.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/ops.h
Frontier/branches/Frontier_Long_File_Paths/Common/source/OpenTransportNetEvents.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/odbengine.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/opbuttons.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/opedit.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/oplangtext.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/opops.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/oppopup.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/oprefcon.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/ops.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/odbinternal.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/odbinternal.h 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/odbinternal.h 2007-02-26 22:59:15 UTC (rev 1633)
@@ -178,23 +178,23 @@
extern pascal boolean odbCloseFile (odbref odb);
-extern pascal boolean odbDefined (odbref odb, bigstring bspath);
+extern pascal boolean odbDefined ( odbref, Handle );
-extern pascal boolean odbDelete (odbref odb, bigstring bspath);
+extern pascal boolean odbDelete ( odbref, Handle );
-extern pascal boolean odbGetType (odbref odb, bigstring bspath, OSType *type);
+extern pascal boolean odbGetType ( odbref, const Handle, OSType * );
-extern pascal boolean odbGetValue (odbref odb, bigstring bspath, odbValueRecord *value);
+extern pascal boolean odbGetValue ( odbref, const Handle, odbValueRecord * );
-extern pascal boolean odbSetValue (odbref odb, bigstring bspath, odbValueRecord *value);
+extern pascal boolean odbSetValue ( odbref, const Handle, odbValueRecord * );
-extern pascal boolean odbNewTable (odbref odb, bigstring bspath);
+extern pascal boolean odbNewTable ( odbref, const Handle );
-extern pascal boolean odbCountItems (odbref odb, bigstring bspath, long *count);
+extern pascal boolean odbCountItems ( odbref, const Handle, long * );
-extern pascal boolean odbGetNthItem (odbref odb, bigstring bspath, long n, bigstring bsname);
+extern pascal boolean odbGetNthItem ( odbref, const Handle, long, Handle );
-extern pascal boolean odbGetModDate (odbref odb, bigstring bspath, unsigned long *date);
+extern pascal boolean odbGetModDate ( odbref, const Handle, unsigned long * );
extern pascal void odbInitValue (odbValueRecord *value);
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/op.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/op.h 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/op.h 2007-02-26 22:59:15 UTC (rev 1633)
@@ -116,6 +116,7 @@
Handle hrefcon; /*for use by application, see opgetrefcon*/
Handle headstring; /*text of headline lives in its own block*/
+
} tyheadrecord;
@@ -186,7 +187,7 @@
typedef boolean (*opgetscrapcallback) (hdloutlinerecord *, boolean *);
-typedef boolean (*optextchangedcallback) (hdlheadrecord, bigstring);
+typedef boolean ( *optextchangedcallback ) ( hdlheadrecord, const Handle );
typedef boolean (*opcopyrefconcallback) (hdlheadrecord, hdlheadrecord);
@@ -595,8 +596,10 @@
extern boolean opoutlinetonewtextscrap (hdloutlinerecord, Handle *);
-extern boolean opsetrefcon (hdlheadrecord, ptrvoid, long); /*oprefcon.c*/
+#pragma mark === oprefcon.c ===
+extern boolean opsetrefcon (hdlheadrecord, ptrvoid, long);
+
extern boolean opgetrefcon (hdlheadrecord, ptrvoid, long);
extern void opemptyrefcon (hdlheadrecord);
@@ -607,11 +610,13 @@
boolean opattributesgetpackedtablevalue (hdlheadrecord hnode, tyvaluerecord *val); /*7.0b16 PBS*/
-boolean opattributesgetoneattribute (hdlheadrecord hnode, bigstring bsattname, tyvaluerecord *val); /*7.0b16 PBS*/
+boolean opattributesgetoneattribute ( hdlheadrecord, const Handle, tyvaluerecord *val ); /*7.0b16 PBS*/
-extern boolean opaddheadline (hdlheadrecord, tydirection, bigstring, hdlheadrecord *); /*opstructure.c*/
+#pragma mark === opstructure.c ===
+extern boolean opaddheadline ( hdlheadrecord, tydirection, bigstring, hdlheadrecord * );
+
extern boolean opdepositnewheadline (hdlheadrecord, tydirection, Handle, hdlheadrecord *);
extern boolean opmoveto (hdlheadrecord);
@@ -706,5 +711,3 @@
#endif
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/opinternal.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/opinternal.h 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/opinternal.h 2007-02-26 22:59:15 UTC (rev 1633)
@@ -161,8 +161,10 @@
extern void opactivate (boolean);
-extern tydirection opdowndir (void); /*opops.c*/
+#pragma mark === opops.c ===
+extern tydirection opdowndir (void);
+
extern tydirection opupdir (void);
extern boolean opfirstinlist (hdlheadrecord);
@@ -213,6 +215,8 @@
extern boolean opfindhead (hdlheadrecord, bigstring, hdlheadrecord *);
+extern boolean opFindHeadHandle ( hdlheadrecord, const Handle, hdlheadrecord * );
+
extern boolean opbestfind (hdlheadrecord hfirst, bigstring bs, hdlheadrecord *hnode);
extern long opcountatlevel (hdlheadrecord);
@@ -279,13 +283,17 @@
extern boolean opgetheadstring (hdlheadrecord, bigstring);
+extern boolean opGetHeadTextHandle ( hdlheadrecord, Handle * );
+
extern void opgetsortstring (hdlheadrecord, bigstring);
extern void opcopyformatting (hdloutlinerecord, hdloutlinerecord);
-extern boolean opsetprintinfo (void); /*opprint.c*/
+#pragma mark === opprint.c ===
+extern boolean opsetprintinfo (void);
+
extern void opgetprintrect (Rect *);
extern boolean opbeginprint (void);
@@ -295,8 +303,10 @@
extern boolean opprint (short);
-extern boolean opgetscrollbarinfo (boolean); /*opscrollbar.c*/
+#pragma mark === opscrollbar.c ===
+extern boolean opgetscrollbarinfo (boolean);
+
extern boolean opsetscrollpositiontoline1 (void);
extern boolean oprestorescrollposition (void);
@@ -357,11 +367,15 @@
extern boolean opcleartmpbits (void);
-extern void opdraggingmove (Point, hdlheadrecord); /*opdraggingmove.c*/
+#pragma mark === opdraggingmove.c ===
+extern void opdraggingmove (Point, hdlheadrecord);
-extern boolean opeditsetglobals (void); /*opedit.c*/
+#pragma mark === opedit.c ===
+
+extern boolean opeditsetglobals (void);
+
extern boolean opdefaultgetedittextrect (hdlheadrecord, const Rect *, Rect *);
extern boolean opdefaultsetwpedittext (hdlheadrecord);
@@ -392,6 +406,8 @@
extern void opeditgetseltext (bigstring);
+extern void opEditGetSelectedTextHandle ( Handle *h );
+
extern void opeditgetselrect (Rect *);
extern void opeditgetselpoint (Point *);
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/ops.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/ops.h 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/ops.h 2007-02-26 22:59:15 UTC (rev 1633)
@@ -110,4 +110,7 @@
extern void getsizestring (unsigned long, bigstring);
-extern unsigned long bcdtolong (unsigned long); /* 2004-11-16 creedon */
\ No newline at end of file
+extern unsigned long bcdtolong (unsigned long); // 2004-11-16 creedon
+
+extern void numberToTextHandle ( long, Handle * ); // 2006-12-08 creedon
+
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/OpenTransportNetEvents.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/OpenTransportNetEvents.c 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/OpenTransportNetEvents.c 2007-02-26 22:59:15 UTC (rev 1633)
@@ -334,24 +334,26 @@
*/
typedef struct tylistenrecord {
- EndpointRef ep;
- OTLink validationlink; /* Link into an OT FIFO (not atomic) */
- OTLIFO idleEPs; /* Endpoints ready to accept a new incoming connection */
- OTLIFO brokenEPs; /* Collect failed endpoints for recycling by worker thread */
- OTLIFO readyEPs; /* Ready to be picked up by the worker thread which will spawn a thread to call the daemon */
- OTLIFO waitingEPs; /* Endpoints waiting to complete an orderly disconnect */
- UInt8 stateflags;
+
+ EndpointRef ep;
+ OTLink validationlink; /* Link into an OT FIFO (not atomic) */
+ OTLIFO idleEPs; /* Endpoints ready to accept a new incoming connection */
+ OTLIFO brokenEPs; /* Collect failed endpoints for recycling by worker thread */
+ OTLIFO readyEPs; /* Ready to be picked up by the worker thread which will spawn a thread to call the daemon */
+ OTLIFO waitingEPs; /* Endpoints waiting to complete an orderly disconnect */
+ UInt8 stateflags;
OTConfigurationRef masterconfig;
EndpointRecordRef acceptors;
- long maxdepth;
- long refcon;
- long idthread;
+ long maxdepth;
+ long refcon;
+ long idthread;
hdldatabaserecord hdatabase;
- Handle hcallbacktree;
- tyepstatsrecord stats;
+ Handle hcallbacktree;
+ tyepstatsrecord stats;
tysocktypeid typeID;
- boolean fllistenpending;
- bigstring callback;
+ boolean fllistenpending;
+ Handle callback;
+
} tylistenrecord;
typedef struct tyendpointrecord {
@@ -2630,7 +2632,7 @@
if (err != kOTNoError) {
- langparamerror (cantencodeaddress, IPaddr);
+ langParamErrBs ( cantencodeaddress, IPaddr);
return (false);
}
@@ -2894,22 +2896,25 @@
} /*fwsNetEventMyAddress*/
-static boolean fwsgetcallbackcodetree (bigstring bs, Handle *htree) {
-
+static boolean fwsgetcallbackcodetree ( const Handle h, Handle *htree) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+
Handle htext;
boolean fl;
+ hdltreenode hmodule = nil;
unsigned long savelines;
unsigned short savechars;
- hdltreenode hmodule = nil;
- if (!newtexthandle (bs, &htext))
- return (false);
-
savelines = ctscanlines;
savechars = ctscanchars;
- fl = langcompiletext (htext, false, &hmodule); /*always disposes htext*/
+ copyhandle ( h, &htext );
+
+ fl = langcompiletext ( htext, false, &hmodule ); // always disposes htext
ctscanlines = savelines;
@@ -2918,12 +2923,13 @@
if (!fl)
return (false);
- fl = langpacktree ((**hmodule).param1, htree); /*make a copy of the sub-tree*/
+ fl = langpacktree ((**hmodule).param1, htree); // make a copy of the sub-tree
langdisposetree (hmodule);
return (fl);
- } /*fwsgetcallbackcodetree*/
+
+ } // fwsgetcallbackcodetree
static boolean fwsnewprocess (hdltreenode hcode, bigstring bsname, hdlprocessrecord *hprocess) {
@@ -2943,6 +2949,7 @@
disposehandle ((Handle) hp);
return (false);
+
}
if (!newclearhandle (sizeof (tytablestack), (Handle *) &htablestack)) {
@@ -2952,6 +2959,7 @@
disposehandle ((Handle) herrorstack);
return (false);
+
}
(**hp).hcode = hcode;
@@ -2977,21 +2985,28 @@
item.errorchar = 0;
item.errorrefcon = 0;
-
-#ifdef flnewfeatures
- item.profilebase = 0;
-#endif
+ #ifdef flnewfeatures
+
+ item.profilebase = 0;
+
+ #endif
+
(**herrorstack).stack [(**herrorstack).toperror++] = item;
copystring (bsname, (**hp).bsname);
return (true);
+
} /*newprocess*/
static boolean fwsruncallback (EndpointRecordRef epref) {
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+
hdltreenode hcallbackaddress;
hdltreenode hfunctioncall;
hdltreenode hcode;
@@ -3006,7 +3021,7 @@
Handle hcallbacktree = listenref->hcallbacktree;
bigstring bsname;
- copystring (listenref->callback, bsname);
+ texthandletostring ( listenref->callback, bsname );
//build code tree
@@ -3019,16 +3034,22 @@
setlongvalue ((long) epref, &val);
if (!newconstnode (val, &hparam1)) {
+
langdisposetree (hcallbackaddress);
+
return (false);
+
}
setlongvalue (refcon, &val);
if (!newconstnode (val, &hparam2)) {
+
langdisposetree (hcallbackaddress);
langdisposetree (hparam1);
+
return (false);
+
}
pushlastlink (hparam2, hparam1);
@@ -3042,18 +3063,26 @@
//create new process
if (!fwsnewprocess (hcode, bsname, &hprocess)) {
+
langdisposetree (hcode);
+
return (false);
+
}
//add new process
return (addprocess (hprocess));
- }/*fwsruncallback*/
+
+ } // fwsruncallback
static long fwsprocesspendingconnections (ListenRecordRef listenref) {
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+
OTLink* nomad = OTLIFOStealList (&listenref->readyEPs);
OTLink* next;
EndpointRecordRef epref;
@@ -3070,8 +3099,9 @@
epref->typeID = SOCKTYPE_OPEN;
- TCPprintf (wsprintf (TCPmsg, "In fwsacceptpendingconnections at line %d. Accepted new connection #%08ld on listener %08lx: %s (%08lx, %ld).",
- __LINE__, ct, (long) listenref, stringbaseaddress (listenref->callback), (long) epref, listenref->refcon));
+ TCPprintf ( wsprintf ( TCPmsg, "In fwsacceptpendingconnections at line %d. Accepted new connection #%08ld on listener %08lx: %s (%08lx, %ld).",
+ __LINE__, ct, ( long ) listenref, *listenref -> callback, ( long ) epref, listenref -> refcon ) );
+
TCPWRITEMSG();
fl = fwsruncallback (epref);
@@ -3081,10 +3111,12 @@
nomad = next;
ct++;
- }/*while*/
+ } /*while*/
+
return (ct);
- }/*fwsprocesspendingconnections*/
+
+ } /*fwsprocesspendingconnections*/
static void fwscleanuplistener (ListenRecordRef listenref) {
@@ -3234,47 +3266,54 @@
}/*fwslaunchacceptingthread*/
-boolean fwsNetEventListenStream (unsigned long port, long depth, bigstring pCallback, unsigned long refcon, unsigned long * stream, unsigned long ipaddr, long hdatabase) {
+boolean fwsNetEventListenStream ( unsigned long port, long depth, const Handle pCallback, unsigned long refcon,
+ unsigned long *stream, unsigned long ipaddr, long hdatabase ) {
- /* Set up a listner on a port */
-
+ //
+ // Set up a listner on a port
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+
+ EndpointRecordRef epref = nil;
Handle hcallbacktree = nil;
+ InetAddress ipAddress;
+ ListenRecordRef listenref = nil;
OSStatus err;
TBind bindReq;
- InetAddress ipAddress;
- ListenRecordRef listenref = nil;
- EndpointRecordRef epref = nil;
TOptMgmt optReq;
TOption opt;
long i;
- nullterminate (pCallback);
- TCPprintf(wsprintf(TCPmsg, "Entering fwsNetEventListenStream at line %d. Port = %ld, Depth = %ld, Refcon = %ld, Callback = %s.", __LINE__, port, depth, refcon, stringbaseaddress(pCallback)));
- TCPWRITEMSG ();
-
+ // nullterminate (pCallback);
+
+ TCPprintf ( wsprintf ( TCPmsg, "Entering fwsNetEventListenStream at line %d. Port = %ld, Depth = %ld, Refcon = %ld, Callback = %s.", __LINE__, port, depth, refcon, *pCallback ) );
+ TCPWRITEMSG ( );
+
/* Initialize Open Transport and static data structures */
if (!fwsNetEventLaunch (NO_HOST_SERVICES))
return (false);
-
+
/* Compile and pack a code tree for the address of the daemon script */
-
- if (!fwsgetcallbackcodetree (pCallback, &hcallbacktree))
- return (false);
+ if ( ! fwsgetcallbackcodetree ( pCallback, &hcallbacktree ) )
+ return ( false );
+
/* Allocate and clear memory for the listener */
listenref = (ListenRecordRef) NewPtr (sizeof (tylistenrecord));
-
+
if (listenref == nil) {
+
memoryerror ();
goto exit;
+
}
OTMemzero (listenref, sizeof (tylistenrecord));
- /* Initialize further status fields */
- copystring (pCallback, listenref->callback);
+ copyhandle ( pCallback, &listenref->callback ); // initialize further status fields
listenref->maxdepth = depth;
@@ -3286,25 +3325,30 @@
/* Open synchronous listener and set to blocking mode */
- #if TARGET_API_MAC_CARBON == 1
- listenref->ep = OTOpenEndpointInContext (OTCreateConfiguration ("tilisten,tcp"), nil, nil, &err, nil);
- #else
- listenref->ep = OTOpenEndpoint (OTCreateConfiguration ("tilisten,tcp"), nil, nil, &err);
- #endif
+ listenref->ep = OTOpenEndpointInContext (OTCreateConfiguration ("tilisten,tcp"), nil, nil, &err, nil);
if (kOTInvalidEndpointRef == listenref->ep || kOTNoError != err) {
+
neterror ("create listen stream", err);
+
goto exit;
+
}
err = OTSetBlocking (listenref->ep);
if (kOTNoError != err) {
+
OSStatus status;
- status = OTCloseProvider (listenref->ep);
+
+ status = OTCloseProvider (listenref->ep);
+
OTAssert ("fwsNetEventListenStream: Could not close listener", status == kOTNoError);
+
neterror ("set listen stream to blocking mode", err);
+
goto exit;
+
}
/* Option Management - Turn on ip_reuseaddr so we don't have port conflicts in general. */
@@ -3350,11 +3394,8 @@
}
/* Install a notifier for the listener and switch to async mode */
- #if TARGET_API_MAC_CARBON == 1
- err = OTInstallNotifier (listenref->ep, gListenNotifierUPP, (void *) listenref);
- #else
- err = OTInstallNotifier (listenref->ep, &ListenNotifier, (void *) listenref);
- #endif
+
+ err = OTInstallNotifier (listenref->ep, gListenNotifierUPP, (void *) listenref);
if (kOTNoError != err) {
OSStatus status;
@@ -3436,13 +3477,9 @@
return (true);
-exit:
-
- //disposehandle (hcallbacktree);
+ exit:
+ return (false);
- //neterror ("set up listen stream", err);
-
- return (false);
} /*fwsNetEventListenStream*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/odbengine.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/odbengine.c 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/odbengine.c 2007-02-26 22:59:15 UTC (rev 1633)
@@ -354,35 +354,39 @@
#else
- static boolean odbexpandtodotparams (bigstring bs, hdlhashtable *htable, bigstring bsname) {
+ static boolean odbexpandtodotparams ( const Handle h, hdlhashtable *htable, Handle handleName ) {
+
+ //
+ // the odbengine version of langexpandtodotparams gaurantees that
+ // htable will be non-nil. the frontier version doesn't. if we have
+ // just a name, we interpret it as a root-level item
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
- /*
- the odbengine version of langexpandtodotparams gaurantees that htable
- will be non-nil. the frontier version doesn't. if we have just a name,
- we interpret it as a root-level item
- */
-
boolean fl;
- disablelangerror ();
+ disablelangerror ( );
- fl = langexpandtodotparams (bs, htable, bsname);
+ fl = langexpandtodotparams ( h, htable, &handleName );
- enablelangerror ();
+ enablelangerror ( );
if (!fl) {
+
+ langparamerror ( addresscoerceerror, h );
- langparamerror (addresscoerceerror, bs);
+ return ( false );
- return (false);
}
+
+ if ( *htable == nil )
+ langsearchpathlookup ( handleName, htable ); // always sets htable
+
+ return ( true );
- if (*htable == nil)
- langsearchpathlookup (bsname, htable); /*always sets htable*/
+ } // odbexpandtodotparams
- return (true);
- } /*odbexpandtodotparams*/
-
#endif
@@ -631,112 +635,143 @@
} /*odbCloseFile*/
-pascal boolean odbDefined (odbref odb, bigstring bspath) {
+pascal boolean odbDefined ( odbref odb, const Handle handlePath ) {
- /*
- 4.1b5 dmb: new routine
- */
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 4.1b5 dmb: new routine
+ //
hdlhashtable htable;
- bigstring bsname;
+ Handle handleName;
boolean fl;
- setemptystring (bserror);
+ setemptystring ( bserror );
- setcancoonglobals ((hdlcancoonrecord) odb);
+ setcancoonglobals ( ( hdlcancoonrecord ) odb );
- disablelangerror ();
+ disablelangerror ( );
- fl = odbexpandtodotparams (bspath, &htable, bsname);
+ fl = odbexpandtodotparams ( handlePath, &htable, handleName );
- enablelangerror ();
+ enablelangerror ( );
- if (fl) {
+ if ( fl ) {
+
+ pushhashtable ( htable );
- pushhashtable (htable);
+ fl = hashsymbolexists ( handleName );
- fl = hashsymbolexists (bsname);
+ pophashtable ( );
- pophashtable ();
}
+
+ disposehandle ( handleName );
- return (fl);
- } /*odbDefined*/
+ return ( fl );
+
+ } // odbDefined
-pascal boolean odbDelete (odbref odb, bigstring bspath) {
+pascal boolean odbDelete (odbref odb, const Handle handlePath ) {
+ Handle handleName;
+ boolean fl;
hdlhashtable htable;
- bigstring bsname;
setemptystring (bserror);
setcancoonglobals ((hdlcancoonrecord) odb);
- if (!odbexpandtodotparams (bspath, &htable, bsname))
+ if (!odbexpandtodotparams (handlePath, &htable, handleName))
return (false);
+
+ fl = hashtabledelete ( htable, handleName );
- return (hashtabledelete (htable, bsname));
- } /*odbDelete*/
+ disposehandle ( handleName );
+
+ return ( fl );
+
+ } // odbDelete
-pascal boolean odbGetType (odbref odb, bigstring bspath, OSType *odbType) {
+pascal boolean odbGetType ( odbref odb, const Handle handlePath, OSType *odbType ) {
+ Handle handleName;
+ hdlhashnode hnode;
hdlhashtable htable;
- bigstring bsname;
tyvaluerecord val;
- hdlhashnode hnode;
setemptystring (bserror);
setcancoonglobals ((hdlcancoonrecord) odb);
- if (!odbexpandtodotparams (bspath, &htable, bsname))
- return (false);
+ if ( ! odbexpandtodotparams ( handlePath, &htable, handleName ) )
+ return ( false );
- if (!langsymbolreference (htable, bsname, &val, &hnode))
- return (false);
+ if ( ! langsymbolreference ( htable, handleName, &val, &hnode ) ) {
- if (val.valuetype == binaryvaluetype)
- *odbType = getbinarytypeid (val.data.binaryvalue);
+ disposehandle ( handleName );
+
+ return ( false );
+
+ }
+
+ disposehandle ( handleName );
+
+ if ( val.valuetype == binaryvaluetype )
+ *odbType = getbinarytypeid ( val.data.binaryvalue );
else
- *odbType = langexternalgettypeid (val);
+ *odbType = langexternalgettypeid ( val );
- return (true);
- } /*odbGetType*/
+ return ( true );
+
+ } // odbGetType
-pascal boolean odbGetValue (odbref odb, bigstring bspath, odbValueRecord *value) {
+pascal boolean odbGetValue ( odbref odb, const Handle handlePath, odbValueRecord *value ) {
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+
+ Handle handleName;
+ hdlhashnode hnode;
hdlhashtable htable;
- bigstring bsname;
tyvaluerecord val;
- hdlhashnode hnode;
setemptystring (bserror);
setcancoonglobals ((hdlcancoonrecord) odb);
- if (!odbexpandtodotparams (bspath, &htable, bsname))
+ if ( ! odbexpandtodotparams ( handlePath, &htable, handleName ) )
return (false);
+
+ if ( ! langsymbolreference ( htable, handleName, &val, &hnode ) ) {
- if (!langsymbolreference (htable, bsname, &val, &hnode))
- return (false);
-
- #ifndef isFrontier
-
- if (val.valuetype == externalvaluetype) {
+ disposehandle ( handleName );
- langerrormessage (canthandlethistypeerror);
+ return ( false );
- return (false);
}
+
+ disposehandle ( handleName );
+ #ifndef isFrontier
+
+ if (val.valuetype == externalvaluetype) {
+
+ langerrormessage (canthandlethistypeerror);
+
+ return (false);
+
+ }
#endif
if (!copyvaluerecord (val, &val))
return (false);
-
+
if (!copyvaluedata (&val))
return (false);
@@ -752,13 +787,18 @@
(*value).data.binaryvalue = val.data.binaryvalue; /*largest field covers everything*/
return (true);
+
} /*odbGetValue*/
-pascal boolean odbSetValue (odbref odb, bigstring bspath, odbValueRecord *value) {
+pascal boolean odbSetValue ( odbref odb, const Handle handlePath, odbValueRecord *value ) {
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+
hdlhashtable htable;
- bigstring bsname;
+ Handle handleName;
tyvaluerecord val;
tyvaluetype type = langexternalgetvaluetype (value->valuetype);
@@ -777,7 +817,7 @@
setcancoonglobals ((hdlcancoonrecord) odb);
- if (!odbexpandtodotparams (bspath, &htable, bsname))
+ if (!odbexpandtodotparams (handlePath, &htable, handleName))
return (false);
if (type == (tyvaluetype) -1) {
@@ -794,110 +834,146 @@
if (!copyvaluerecord (val, &val))
return (false);
+
+ if ( ! hashtableassign ( htable, handleName, val ) ) {
- if (!hashtableassign (htable, bsname, val)) {
-
+ disposehandle ( handleName );
+
disposevaluerecord (val, true);
return (false);
+
}
+ disposehandle ( handleName );
+
exemptfromtmpstack (&val);
return (true);
- } /*odbSetValue*/
+
+ } // odbSetValue
-pascal boolean odbNewTable (odbref odb, bigstring bspath) {
+pascal boolean odbNewTable (odbref odb, const Handle handlePath ) {
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+
+ Handle handleName;
hdlhashtable htable;
- bigstring bsname;
tyvaluerecord val;
setemptystring (bserror);
setcancoonglobals ((hdlcancoonrecord) odb);
- if (!odbexpandtodotparams (bspath, &htable, bsname))
+ if (!odbexpandtodotparams (handlePath, &htable, handleName))
return (false);
-
+
if (!langexternalnewvalue (idtableprocessor, nil, &val))
return (false);
+
+ if ( ! hashtableassign ( htable, handleName, val ) ) {
- if (!hashtableassign (htable, bsname, val)) {
-
+ disposehandle ( handleName );
+
disposevaluerecord (val, true);
return (false);
+
}
+
+ disposehandle ( handleName );
exemptfromtmpstack (&val);
return (true);
+
} /*odbNewTable*/
-pascal boolean odbCountItems (odbref odb, bigstring bspath, long *count) {
+pascal boolean odbCountItems (odbref odb, const Handle handlePath, long *count) {
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+
+ Handle handleName;
+ hdlhashnode hnode;
hdlhashtable htable;
- bigstring bsname;
+ long ctitems;
tyvaluerecord val;
- long ctitems;
- hdlhashnode hnode;
setemptystring (bserror);
setcancoonglobals ((hdlcancoonrecord) odb);
- if (!odbexpandtodotparams (bspath, &htable, bsname))
+ if (!odbexpandtodotparams (handlePath, &htable, handleName))
return (false);
+
+ if (!langsymbolreference (htable, handleName, &val, &hnode)) {
- if (!langsymbolreference (htable, bsname, &val, &hnode))
+ disposehandle ( handleName );
+
return (false);
+
+ }
+
+ disposehandle ( handleName );
if (!odbvaltotable (val, &htable, hnode))
return (false);
-
+
if (!hashcountitems (htable, &ctitems))
return (false);
-
+
*count = ctitems;
return (true);
+
} /*odbCountItems*/
-pascal boolean odbGetNthItem (odbref odb, bigstring bspath, long n, bigstring bsname) {
+pascal boolean odbGetNthItem (odbref odb, const Handle handlePath, long n, Handle handleName) {
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+
+ hdlhashnode hnode;
hdlhashtable htable;
tyvaluerecord val;
- hdlhashnode hnode;
setemptystring (bserror);
setcancoonglobals ((hdlcancoonrecord) odb);
- if (!odbexpandtodotparams (bspath, &htable, bsname))
+ if (!odbexpandtodotparams (handlePath, &htable, handleName))
return (false);
-
- if (!langsymbolreference (htable, bsname, &val, &hnode))
+
+ if (!langsymbolreference (htable, handleName, &val, &hnode))
return (false);
-
+
if (!odbvaltotable (val, &htable, hnode))
return (false);
-
- if (!hashgetiteminfo (htable, (short) (n - 1), bsname, nil))
+
+ if (!hashgetiteminfo (htable, (short) (n - 1), &handleName, nil))
return (false);
+
+ return (true);
- return (true);
} /*odbGetNthItem*/
+pascal boolean odbGetModDate (odbref odb, const Handle handlePath, unsigned long *date) {
-pascal boolean odbGetModDate (odbref odb, bigstring bspath, unsigned long *date) {
-
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+
hdlhashtable htable;
- bigstring bsname;
+ Handle handleName;
tyvaluerecord val;
hdlhashnode hnode;
@@ -905,18 +981,26 @@
setcancoonglobals ((hdlcancoonrecord) odb);
- if (!odbexpandtodotparams (bspath, &htable, bsname))
+ if (!odbexpandtodotparams (handlePath, &htable, handleName))
return (false);
+
+ if (!langsymbolreference (htable, handleName, &val, &hnode)) {
- if (!langsymbolreference (htable, bsname, &val, &hnode))
+ disposehandle ( handleName );
+
return (false);
+
+ }
+
+ disposehandle ( handleName );
if (!odbvaltotable (val, &htable, hnode))
return (false);
-
+
*date = (**htable).timelastsave;
return (true);
+
} /*odbGetModDate*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/opbuttons.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/opbuttons.c 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/opbuttons.c 2007-02-26 22:59:15 UTC (rev 1633)
@@ -42,10 +42,12 @@
void opbuttonsattach (hdlwindowinfo hinfo, hdlhashtable htable) {
- /*
- 7.1b18 PBS: attach buttons to this outline.
- */
-
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.1b18 PBS: attach buttons to this outline.
+ //
+
hdlhashnode hn;
short ct = 0;
hdllistrecord hlist;
@@ -61,7 +63,8 @@
/*loop through all of the items in the table*/
for (hn = (**htable).hfirstsort; hn != nil; hn = (**hn).sortedlink) {
-
+
+ Handle h;
bigstring bsname;
ct++;
@@ -69,8 +72,12 @@
if (ct > 16) /*16 is max number of buttons*/
break;
- gethashkey (hn, bsname);
+ gethashkey (hn, &h );
+ texthandletostring ( h, bsname );
+
+ disposehandle ( h );
+
xmlgetname (bsname);
oppushstring ((hdllistrecord) (**hinfo).buttonlist, nil, bsname);
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/opedit.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/opedit.c 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/opedit.c 2007-02-26 22:59:15 UTC (rev 1633)
@@ -42,12 +42,9 @@
#include "wpengine.h"
-
-
static boolean fleditingnow = false;
-
boolean opeditsetglobals (void) {
/*
@@ -108,19 +105,21 @@
boolean opdefaultsetwpedittext (hdlheadrecord hnode) {
-
+
/*
2/7/97 dmb: we are called with the wp globals set up.
our job it to set the wp to contain the right text.
*/
return (wpsettexthandle ((**hnode).headstring));
+
} /*opdefaultsetwpedittext*/
boolean opdefaultgetwpedittext (hdlheadrecord hnode, boolean flunload) {
-#pragma unused (flunload)
+ #pragma unused (flunload)
+
/*
2/7/97 dmb: we are called with the wp globals set up.
our job it to extract the current text from the wp.
@@ -634,6 +633,7 @@
popstyle ();
return (true);
+
} /*opeditdrawtext*/
@@ -642,6 +642,7 @@
opeditsetglobals ();
wpgetmaxpos (maxpos);
+
} /*opeditgetmaxpos*/
@@ -685,6 +686,19 @@
} /*opeditgetseltext*/
+void opEditGetSelectedTextHandle ( Handle *h ) {
+
+ //
+ // 2007-02-26 creedon: created
+ //
+
+ opeditsetglobals ( );
+
+ wpgetseltexthandle ( h );
+
+ } // opEditGetSelectedTextHandle
+
+
void opeditgetselrect (Rect * r) {
opeditsetglobals ();
@@ -1018,5 +1032,3 @@
return (true);
} /*opeditsetundoglobals*/
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/oplangtext.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/oplangtext.c 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/oplangtext.c 2007-02-26 22:59:15 UTC (rev 1633)
@@ -116,50 +116,54 @@
static boolean oplangtextvisit (hdlheadrecord hnode, ptrvoid refcon) {
- /*
- push the text of the indicated node onto the langtext output handle.
+ //
+ // push the text of the indicated node onto the langtext output handle.
+ //
+ // we flatten out the structure in the language understood by the parser.
+ //
+ // e.g. if we move in a level, we insert a left curly bracket. out a level
+ // a right curly bracket.
+ //
+ // carriage returns are inserted into the text so that the parser knows
+ // which line generated the code, this makes error reporting and
+ // debugging possible.
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 2006-01-23 smd: lots of changes when flmakepretty is true, to fix
+ // problems with round trip between script outline and
+ // text. This function is in desperate need of a rewrite,
+ // but it seems to work now for every test case I could
+ // come up with.
+ //
+ // 6.0a13 dmb: rewrote to use handles, handlestreams
+ //
+ // 5.0a16 dmb: don't require else to be on a line by itself
+ //
+ // 2.1b2 dmb: don't add returns until after continuation lines are complete
+ //
+ // 1993-05-06 dmb: test for "else" is now case-insensitive
+ //
+ // 1991-12-13 dmb: added support for flmakeitpretty so that langtext can be
+ // exported in a useful form
+ //
+ // 1991-12-09 dmb: support backslash for continuation lines. also, need to
+ // look ahead for non-comment lines in order to place
+ // opening '{' at end of correct line; otherwise, debugger
+ // can step onto a comment line
+ //
+ // 1991-11-12 dmb: push '{' when actually entering deeper level rather than
+ // when subheads are present, so single comment subhead is
+ // handled correctly. also, don't push a semicolon before
+ // an empty statement; otherwise, blank lines in a locals
+ // block (and perhaps elsewhere) generate syntax errors.
+ //
- we flatten out the structure in the language understood by the parser.
-
- e.g. if we move in a level, we insert a left curly bracket. out a level
- a right curly bracket.
-
- carriage returns are inserted into the text so that the parser knows
- which line generated the code, this makes error reporting and
- debugging possible.
-
- 11/12/91 dmb: push '{' when actually entering deeper level rather than
- when subheads are present, so single comment subhead is handled correctly.
- also, don't push a semicolon before an empty statement; otherwise, blank
- lines in a locals block (and perhaps elsewhere) generate syntax errors.
-
- 12/9/91 dmb: support backslash for continuation lines. also, need to look
- ahead for non-comment lines in order to place opening '{' at end of correct
- line; otherwise, debugger can step onto a comment line
-
- 12/13/91 dmb: added support for flmakeitpretty so that langtext can be
- exported in a useful form
-
- 5/6/93 dmb: test for "else" is now case-insensitive
-
- 2.1b2 dmb: don't add returns until after continuation lines are complete
-
- 5.0a16 dmb: don't require else to be on a line by itself
-
- 6.0a13 dmb: rewrote to use handles, handlestreams
-
- 2006-01-23 smd: lots of changes when flmakepretty is true,
- to fix problems with round trip between script outline and text.
- This function is in desperate need of a rewrite, but it seem to work now
- for every test case I could come up with.
- */
-
hdlheadrecord h = hnode;
handlestream *langtext = (handlestream *) refcon;
short level;
bigstring bs;
- Handle bshead;
- Handle bscomment = nil;
+ Handle handleComment = nil, handleHead;
boolean fltobecontinued = false;
boolean flcomment;
boolean flparentwascomment = false;
@@ -175,16 +179,16 @@
if (flcomment) { /*just generate a blank line for a comment line*/
- bshead = nil;
+ handleHead = nil;
if (flmakeitpretty) {
- if (!copyhandle ((**h).headstring, &bscomment))
+ if (!copyhandle ((**h).headstring, &handleComment))
goto exit;
ch = chcomment;
- if (!insertinhandle (bscomment, 0, &ch, 1L))
+ if (!insertinhandle (handleComment, 0, &ch, 1L))
goto exit;
}
@@ -215,35 +219,35 @@
}
else {
- if (!copyhandle ((**h).headstring, &bshead))
+ if (!copyhandle ((**h).headstring, &handleHead))
goto exit;
- fltobecontinued = backslashdelete (bshead); /*pop off continuation marker*/
+ fltobecontinued = backslashdelete (handleHead); /*pop off continuation marker*/
}
- len1 = gethandlesize (bshead); /*get size with comments*/
+ len1 = gethandlesize (handleHead); /*get size with comments*/
if (len1 > 0) {
- len2 = langcommentdelete (chcomment, (byte *) (*bshead), len1);
+ len2 = langcommentdelete (chcomment, (byte *) (*handleHead), len1);
if (len2 >= 0) { /* line is partly a comment */
if (flmakeitpretty) { /*for exporting, we want to *add* comment character*/
- if (!loadhandleremains (len2, bshead, &bscomment))
+ if (!loadhandleremains (len2, handleHead, &handleComment))
goto exit;
- if ((gethandlesize (bscomment) > 0) && (len2 > 0))
- insertinhandle (bscomment, 0, " ", 1L);
+ if ((gethandlesize (handleComment) > 0) && (len2 > 0))
+ insertinhandle (handleComment, 0, " ", 1L);
}
- sethandlesize (bshead, len2);
+ sethandlesize (handleHead, len2);
}
}
- if (!fltobecontinued && bshead)
- poptrailingwhitespacehandle (bshead); /*pop blanks, returns, tabs, etc at end of string*/
+ if (!fltobecontinued && handleHead)
+ poptrailingwhitespacehandle (handleHead); /*pop blanks, returns, tabs, etc at end of string*/
if (ctlinesincontinuation == 0) { /*not continuing a previous line*/
@@ -260,8 +264,8 @@
if ((level < langtextlastlevel) || !fllastwascomment) {
- if (bshead)
- textfirstword ((ptrbyte) (*bshead), gethandlesize (bshead), chspace, bsfirst);
+ if (handleHead)
+ textfirstword ((ptrbyte) (*handleHead), gethandlesize (handleHead), chspace, bsfirst);
else
setemptystring (bsfirst);
@@ -279,7 +283,7 @@
langtextlastlevel = level;
}
- fllastwascomment = flcomment || isemptyhandle (bshead);
+ fllastwascomment = flcomment || isemptyhandle (handleHead);
L2:
@@ -290,7 +294,7 @@
disposehandle (*plastcomment);
- *plastcomment = bscomment;
+ *plastcomment = handleComment;
}
@@ -316,7 +320,7 @@
}
else if (flmakeitpretty && flcomment) {
- if (!inserttextinhandle (bscomment, 0L, bs))
+ if (!inserttextinhandle (handleComment, 0L, bs))
goto exit;
}
@@ -334,18 +338,18 @@
if (! *plastcomment)
- *plastcomment = bscomment;
+ *plastcomment = handleComment;
else {
- if (!pushhandle (bscomment, *plastcomment))
+ if (!pushhandle (handleComment, *plastcomment))
goto exit;
}
}
else {
- if (!writehandlestreamhandle (langtext, bshead))
+ if (!writehandlestreamhandle (langtext, handleHead))
goto exit;
}
@@ -364,15 +368,18 @@
}
ctlinesincontinuation = 0;
+
}
}
fl = true; //natural exit
- exit:
- disposehandle (bshead);
-
- return (fl);
+ exit:
+
+ disposehandle (handleHead);
+
+ return (fl);
+
} /*oplangtextvisit*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/opops.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/opops.c 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/opops.c 2007-02-26 22:59:15 UTC (rev 1633)
@@ -43,7 +43,6 @@
#include "process.h"
-
typedef struct tyscanrecord { /*information for contains/find/search recursive scans*/
hdlheadrecord hnodelookfor;
@@ -66,7 +65,7 @@
hdloutlinerecord opsetoutline (hdloutlinerecord houtline) {
-
+
/*
5.1.5b7 dmb: carefully manage the setting of outlinedata
@@ -90,9 +89,10 @@
}
return (houtline);
+
} /*opsetoutline*/
-
+
boolean oppushoutline (hdloutlinerecord houtline) {
/*
@@ -893,8 +893,8 @@
nomad = nextnomad;
} /*while*/
} /*opfindhead*/
-
+
boolean opbestfind (hdlheadrecord hfirst, bigstring bs, hdlheadrecord *hnode) {
/*
@@ -1146,12 +1146,13 @@
boolean opnewheadrecord (Handle hstring, hdlheadrecord *hnewnode) {
-
+
/*
create a new headline, without linking into any structure.
*/
register hdlheadrecord h;
+
Handle hnew;
if (!newclearhandle (sizeof (tyheadrecord), &hnew)) {
@@ -1159,6 +1160,7 @@
disposehandle (hstring);
return (false);
+
}
h = *hnewnode = (hdlheadrecord) hnew; /*copy into register*/
@@ -1172,6 +1174,7 @@
(**h).fldirty = true;
return (true);
+
} /*opnewheadrecord*/
@@ -1197,10 +1200,11 @@
boolean opreleasevisit (hdlheadrecord hnode, ptrvoid refcon) {
-
+
register hdlheadrecord h = hnode;
- Handle hrefcon = (Handle) (**h).hrefcon;
+ Handle hrefcon = ( Handle ) ( **h ).hrefcon;
+
if (hrefcon != nil) { /*node has a refcon handle attached*/
hdloutlinerecord x = outlinedata; /*preserve x over callback*/
@@ -1210,23 +1214,25 @@
(*(**outlinedata).releaserefconcallback) (hnode, (boolean) ((long) refcon));
#endif
-
+
opsetoutline (x); /*restore*/
- disposehandle (hrefcon);
+ disposehandle ( hrefcon );
+
}
+
+ disposehandle ( ( **h ).headstring );
+ disposehandle ( (Handle ) h );
- disposehandle ((**h).headstring);
+ return (true);
- disposehandle ((Handle) h);
-
- return (true);
} /*opreleasevisit*/
void opreleasenode (hdlheadrecord hnode, boolean fldisk) {
opreleasevisit (hnode, (ptrvoid) ((long) fldisk));
+
} /*opreleasenode*/
@@ -1314,6 +1320,7 @@
return (false);
return (opsetsummit (outlinedata, hnewsummit));
+
} /*opnewsummit*/
@@ -1460,6 +1467,7 @@
#endif
return (true);
+
} /*opnewrecord*/
@@ -1477,6 +1485,7 @@
*/
opsiblingvisiter (hnode, true, &opreleasevisit, (ptrvoid) ((long) fldisk));
+
} /*opdisposestructure*/
@@ -1493,35 +1502,37 @@
oprestorehoists ();
oppopoutline ();
+
} /*opdisposerefcons*/
void opdisposeoutline (hdloutlinerecord houtline, boolean fldisk) {
-
+
/*
5.0a10 dmb: if we're disposing outlinedata, nil the global
5.1.5b7 dmb: ctpushes, fldisposewhenpopped replaces processinvalidoutline
*/
-
+
register hdloutlinerecord ho = houtline;
//long ix;
if (ho == nil) /*defensive driving*/
return;
-
+
//processinvalidoutline (ho);
if ((**ho).ctpushes > 0) {
-
+
if (fldisk)
opdisposerefcons (ho); //do this in current odb context
-
+
(**ho).fldisposewhenpopped = true;
return;
+
}
-
+
(**ho).fldisposewhenpopped = false;
oppushoutline (ho); /*set the current outline to this one*/
@@ -1532,18 +1543,18 @@
if ((**ho).hbuffer != nil) /*avoid smashing wp globals*/
opeditdispose ();
+
+ #endif
- #endif
-
opdisposestructure ((**ho).hsummit, fldisk);
oppopoutline ();
-
+
disposehandle ((Handle) ho);
-
+
if (ho == outlinedata)
outlinedata = nil;
-
+
} /*opdisposeoutline*/
@@ -1666,43 +1677,47 @@
boolean opsetactualheadstring (hdlheadrecord hnode, bigstring newstring) {
return (sethandlecontents (stringbaseaddress (newstring), stringlength (newstring), (**hnode).headstring));
+
} /*opsetactualheadstring*/
-boolean opsetheadtext (hdlheadrecord hnode, Handle hstring) {
+boolean opsetheadtext ( hdlheadrecord hnode, Handle hstring ) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 5.0d14 dmb: do as little as possible when the head string isn't
+ // changing.
+ //
+ // 1993-08-15 DW: leave the tmp bit set over call to callback, so that the
+ // browser can avoid re-inserting the node, again for find &
+ // replace. we don't keep the lists sorted, to make things
+ // fast, avoid jumpiness, and also to keep the search order
+ // intact (!).
+ //
+ // 1993-08-14 DW: if the node's tmpbit is set, we display the line before
+ // calling the callback. in clay basket the callback can
+ // reorder the outline. too much for a human mind to parse
+ // while doing a find/replace.
+ //
+ // 1992-04-03 dmb: moved call to textchangedcallback into this bottleneck
+ // so that find/replace and op.setlinetext will update
+ // menubar items properly. call used to be in
+ // opwriteeditbuffer
+ //
- /*
- 4/3/92 dmb: moved call to textchangedcallback into this bottleneck so
- that find/replace and op.setlinetext will update menubar items properly.
- call used to be in opwriteeditbuffer
+ register hdlheadrecord h = hnode;
- 8/14/93 DW: if the node's tmpbit is set, we display the line before
- calling the callback. in clay basket the callback can reorder the
- outline. too much for a human mind to parse while doing a find/replace.
-
- 8/15/93 DW: leave the tmp bit set over call to callback, so that
- the browser can avoid re-inserting the node, again for find & replace.
- we don't keep the lists sorted, to make things fast, avoid jumpiness,
- and also to keep the search order intact (!).
-
- 5.0d14 dmb: do as little as possible when the head string isn't changing.
- */
-
- register hdlheadrecord h = hnode;
Handle horig;
- bigstring bsorig;
- opgetheadstring (hnode, bsorig);
-
horig = (**hnode).headstring;
(**hnode).headstring = hstring;
if (equalhandles (horig, hstring))
disposehandle (horig);
+ else {
- else {
-
opnodechanged (h);
(**h).fldirty = true;
@@ -1714,24 +1729,27 @@
opinvalnode (h);
opupdatenow ();
+
}
+
+ if ( ! ( *( **outlinedata ).textchangedcallback ) ( h, horig ) ) {
- if (!(*(**outlinedata).textchangedcallback) (h, bsorig)) {
-
/*DW 8/31/93 -- file rename in cb failed*/
(**hnode).headstring = horig;
disposehandle (hstring);
+
}
else
disposehandle (horig);
}
- (**h).tmpbit = false; /*consume the bit*/
+ (**h).tmpbit = false; // consume the bit
return (true);
- } /*opsetheadtext*/
+
+ } // opsetheadtext
boolean opsetheadstring (hdlheadrecord hnode, bigstring bs) {
@@ -1767,27 +1785,47 @@
opupdatenow ();
}
- return (fl);
+ return (fl);
+
} /*opsetcursorlinetext*/
boolean opgetheadstring (hdlheadrecord hnode, bigstring bs) {
-
+
if (hnode == nil)
setstringlength (bs, 0);
else
texthandletostring ((**hnode).headstring, bs);
return (true);
+
} /*opgetheadstring*/
+boolean opGetHeadTextHandle ( hdlheadrecord hnode, Handle *h ) {
+
+ //
+ // 2007-02-26 creedon: created
+ //
+
+ if ( ! newemptyhandle ( h ) )
+ return ( false );
+
+ if ( hnode != nil )
+ copyhandle ( ( Handle ) ( **hnode ).headstring, h );
+
+ return ( true );
+
+ } // opGetHeadTextHandle
+
+
void opgetsortstring (hdlheadrecord hnode, bigstring bs) {
opgetheadstring (hnode, bs);
if (searchparams.flunicase)
- alllower (bs);
+ alllower (bs);
+
} /*opgetsortstring*/
@@ -1813,7 +1851,52 @@
(**ho2).outlinerect = (**ho1).outlinerect;
(**ho2).windowrect = (**ho1).windowrect;
+
} /*opcopyformatting*/
+boolean opFindHeadHandle ( hdlheadrecord hfirst, const Handle h, hdlheadrecord *hnode ) {
+ //
+ // search starting with hfirst and step through its siblings looking for a
+ // headline that exactly matches h.
+ //
+ // 2007-02-26 creedon: created, cribbed from opfindhead function
+ //
+
+ register hdlheadrecord nextnomad, nomad;
+ Handle handleLook, handleNomad;
+
+ *hnode = NULL; // default returned value
+
+ nomad = hfirst;
+
+ copyhandle ( h, &handleLook ); // work on a copy
+
+ lowertext ( *handleLook, gethandlesize ( handleLook ) ); // unicase
+
+ while ( true ) {
+
+ opGetHeadTextHandle ( nomad, &handleNomad );
+
+ lowertext ( *handleNomad, gethandlesize ( handleNomad ) );
+
+ if ( equalhandles ( handleLook, handleNomad ) ) {
+
+ *hnode = nomad;
+
+ return ( true );
+
+ }
+
+ nextnomad = ( **nomad ).headlinkdown;
+
+ if ( nextnomad == nomad )
+ return ( false );
+
+ nomad = nextnomad;
+
+ } // while
+
+ } // opFindHeadHandle
+
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/oppopup.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/oppopup.c 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/oppopup.c 2007-02-26 22:59:15 UTC (rev 1633)
@@ -298,19 +298,20 @@
static boolean opfillpopup (hdlmenu hmenu, short *checkeditem) {
- /*
- 7.1b43 PBS: make sure the menu object is in memory, so the
- app doesn't crash.
- */
-
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.1b43 PBS: make sure the menu object is in memory, so the app doesn't
+ // crash.
+ //
+
hdlhashtable htable;
hdlhashnode hnode;
- tyvaluerecord valaddress;
- tyvaluerecord val;
+ tyvaluerecord val, valaddress;
hdlmenurecord hm;
hdlexternalhandle h;
hdlheadrecord hsummit;
- bigstring bsaddress;
+ Handle handleAddress;
boolean fl = false;
long menusize = 0;
@@ -320,10 +321,10 @@
if (valaddress.valuetype != addressvaluetype)
goto exit;
- if (!getaddressvalue (valaddress, &htable, bsaddress))
+ if ( ! getaddressvalue ( valaddress, &htable, &handleAddress ) )
goto exit;
- if (!langsymbolreference (htable, bsaddress, &val, &hnode))
+ if ( ! langsymbolreference (htable, handleAddress, &val, &hnode ) )
goto exit;
if ((val.valuetype) != externalvaluetype)
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/oprefcon.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/oprefcon.c 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/oprefcon.c 2007-02-26 22:59:15 UTC (rev 1633)
@@ -137,30 +137,28 @@
} /*ophasrefcon*/
-boolean opattributesgetoneattribute (hdlheadrecord hnode, bigstring bsattname, tyvaluerecord *val) {
+boolean opattributesgetoneattribute ( hdlheadrecord hnode, const Handle handleAttributeName, tyvaluerecord *val) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b16 PBS: get one value from a packed attributes table.
+ //
- /*
- 7.0b16 PBS: get one value from a packed attributes table.
- */
-
- tyvaluerecord vattributes;
- tyvaluerecord v;
+ boolean fl = false;
+ hdlhashnode hn = nil, hnatt;
hdlhashtable htable;
- hdlhashnode hn = nil;
- hdlhashnode hnatt;
- boolean fl = false;
+ tyvaluerecord v, vattributes;
disablelangerror ();
if (!opattributesgetpackedtablevalue (hnode, &vattributes))
-
return (false);
if (!tablevaltotable (vattributes, &htable, hn))
-
goto exit;
- if (hashtablelookup (htable, bsattname, &v, &hnatt)) {
+ if (hashtablelookup (htable, handleAttributeName, &v, &hnatt)) {
copyvaluerecord (v, val);
@@ -169,15 +167,17 @@
exemptfromtmpstack (val);
fl = true;
+
} /*if*/
exit:
- disposevaluerecord (vattributes, false);
-
- enablelangerror ();
-
- return (fl);
+ disposevaluerecord (vattributes, false);
+
+ enablelangerror ();
+
+ return (fl);
+
} /*opattributesgetoneattribute*/
@@ -232,71 +232,71 @@
boolean opattributesgettypestring (hdlheadrecord hnode, bigstring bstype) {
+
+ //
+ // 2007-02-26 creedon: support for long odb item names and file paths
+ //
+ // 7.0b14 PBS: Fixed memory leaks.
+ //
+ // 7.0b4 PBS: Get the node type of a headline. Unpack the refcon, look in
+ // the table for a type attribute, set bstype equal to that
+ // string.
+ //
- /*
- 7.0b4 PBS: Get the node type of a headline.
- Unpack the refcon, look in the table for a type attribute, set bstype
- equal to that string.
-
- 7.0b14 PBS: Fixed memory leaks.
- */
-
- Handle hrefcon = (**hnode).hrefcon;
+ Handle handleType, hrefcon = (**hnode).hrefcon;
tyvaluerecord linkedval;
tyvaluerecord val;
hdlhashtable htable;
- hdlhashnode hn = nil;
- hdlhashnode hnheadlinetype;
+ hdlhashnode hn = nil, hnheadlinetype;
tyvaluerecord valheadlinetype;
boolean fl = false;
disablelangerror ();
if (!ophasrefcon (hnode)) //if no refcon, not attributes
-
goto exit3;
if (!langunpackvalue (hrefcon, &linkedval)) //try to unpack the refcon
-
goto exit3;
if (linkedval.valuetype != binaryvaluetype) //must be a binary
-
goto exit2;
if (!langunpackvalue (linkedval.data.binaryvalue, &val)) //it's a packed binary: unpack it.
-
goto exit2;
if (val.valuetype != externalvaluetype) //it must be a table
-
goto exit1;
if (!tablevaltotable (val, &htable, hn))
+ goto exit1;
+ if ( ! newtexthandle ( BIGSTRING ("\x04""type"), &handleType ) )
goto exit1;
+
+ if (hashtablelookup (htable, handleType, &valheadlinetype, &hnheadlinetype)) {
- if (hashtablelookup (htable, BIGSTRING ("\x04""type"), &valheadlinetype, &hnheadlinetype)) {
-
pullstringvalue (&valheadlinetype, bstype);
fl = true;
+
} /*if*/
exit1: /*7.0b14 PBS: fix memory leaks*/
- disposevaluerecord (val, false);
-
+ disposehandle ( handleType );
+
+ disposevaluerecord (val, false);
+
exit2:
- disposevaluerecord (linkedval, false);
-
+ disposevaluerecord (linkedval, false);
+
exit3:
- enablelangerror ();
-
- return (fl);
+ enablelangerror ();
+
+ return (fl);
+
} /*opattributesgettypestring*/
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/ops.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/ops.c 2007-02-26 21:56:01 UTC (rev 1632)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/ops.c 2007-02-26 22:59:15 UTC (rev 1633)
@@ -243,17 +243,24 @@
void numbertostring (long longval, bigstring bs) {
-#ifdef MACVERSION
- NumToString (longval, bs);
-#endif
+ #ifdef MACVERSION
+
+ NumToString (longval, bs);
+
+ #endif
-#ifdef WIN95VERSION
- wsprintf (bs, "%ld", longval);
+ #ifdef WIN95VERSION
+
+ wsprintf (bs, "%ld", longval);
- #ifdef PASCALSTRINGVERSION
- convertcstring (bs);
+ #ifdef PASCALSTRINGVERSION
+
+ convertcstring (bs);
+
+ #endif
+
#endif
-#endif
+
} /*numbertostring*/
@@ -312,6 +319,7 @@
*shortval = (short) longval;
return (true);
+
} /*stringtoshort*/
@@ -954,7 +962,7 @@
} /*getsizestring*/
-unsigned long bcdtolong (unsigned long bcd) { /* 2004-11-23 creedon, aradke */
+unsigned long bcdtolong (unsigned long bcd) { // 2004-11-23 creedon, aradke
/*
convert a long value from BCD notation
@@ -972,5 +980,23 @@
} while (bcd != 0);
- return (ret);
- } /* bcdtolong */
\ No newline at end of file
+ return ( ret );
+
+ } // bcdtolong
+
+
+void numberToTextHandle ( long l, Handle *h ) {
+
+ //
+ // 2007-02-26 creedon: created
+ //
+
+ bigstring bs;
+
+ numbertostring ( l, bs );
+
+ if ( ! newtexthandle ( bs, h ) )
+ h = NULL;
+
+ } // numberToTextHandle
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
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] |
|
From: <cre...@us...> - 2007-02-26 21:02:18
|
Revision: 1631
http://svn.sourceforge.net/frontierkernel/?rev=1631&view=rev
Author: creecode
Date: 2007-02-26 13:02:19 -0800 (Mon, 26 Feb 2007)
Log Message:
-----------
combined twowaydialog function code into twowaydialog function in dialogs.c file
Modified Paths:
--------------
Frontier/branches/Frontier_Long_File_Paths/Common/stubs/megastubs.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/stubs/megastubs.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/stubs/megastubs.c 2007-02-26 20:56:06 UTC (rev 1630)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/stubs/megastubs.c 2007-02-26 21:02:19 UTC (rev 1631)
@@ -873,33 +873,6 @@
} /*CBTProc*/
-boolean twowaydialog (bigstring bsprompt, bigstring bsok, bigstring bscancel) {
- int nResult;
- char s[256];
-
- copyptocstring (bsprompt, s);
- setbuttonstring (bsok, gMsgRetryButton);
- setbuttonstring (bscancel, gMsgCancelButton);
-
- setmessageboxbuttonsize (2);
-
- releasethreadglobals ();
-
- // Set a task specific CBT hook before calling MessageBox. The CBT hook will
- // be called when the message box is created and will give us access to
- // the window handle of the MessageBox. The message box
- // can then be subclassed in the CBT hook to change the color of the text and
- // background. Remove the hook after the MessageBox is destroyed.
- g_hhookCBT = SetWindowsHookEx(WH_CBT, CBTProc, shellinstance, 0);
- nResult = MessageBox(hwndMDIClient, s, frontierstring, MB_RETRYCANCEL | MB_APPLMODAL);
- UnhookWindowsHookEx(g_hhookCBT);
-
- grabthreadglobals ();
-
- return (nResult == IDRETRY);
- }
-
-
short threewaydialog (bigstring bsprompt, bigstring bsyes, bigstring bsno, bigstring bscancel) {
int nResult;
char s[256];
@@ -1504,21 +1477,14 @@
}
-// langipcmenus.c
+#pragma mark === langipcmenus.c ===
boolean langipcmenustartup (void) {return true;}
boolean langipcmenushutdown (void) {return true;}
-boolean langipcsymbolchanged (hdlhashtable ht, const bigstring bs, boolean fl) {return true;}
-boolean langipcsymbolinserted (hdlhashtable ht, const bigstring bs) {return true;}
-
-boolean langipcsymboldeleted (hdlhashtable ht, const bigstring bs) {return true;}
-
-
// langdialog.h
boolean langdialogstart (void) {return (true);}
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cre...@us...> - 2007-02-26 20:56:12
|
Revision: 1630
http://svn.sourceforge.net/frontierkernel/?rev=1630&view=rev
Author: creecode
Date: 2007-02-26 12:56:06 -0800 (Mon, 26 Feb 2007)
Log Message:
-----------
removed system 6 related code
Modified Paths:
--------------
Frontier/branches/Frontier_Long_File_Paths/Common/source/mac.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/mac.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/mac.c 2007-02-26 19:46:59 UTC (rev 1629)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/mac.c 2007-02-26 20:56:06 UTC (rev 1630)
@@ -200,75 +200,13 @@
} /*initmacintosh*/
-#ifdef flsystem6
-
-short countinitialfiles (void) {
-
- short message, ctfiles;
-
- CountAppFiles (&message, &ctfiles);
-
- if (message == 0)
- return (ctfiles);
-
- return (0);
- } /*countinitialfiles*/
-
-
-void getinitialfile (short ix, bigstring fname, short *vnum) {
-
- AppFile appfilerecord;
-
- GetAppFiles (ix, &appfilerecord);
-
- copystring (appfilerecord.fName, fname);
-
- *vnum = appfilerecord.vRefNum;
- } /*getinitialfile*/
-
-#endif
-
-#if 0
-
-boolean installgestaltfunction (void) {
-
- Handle hgdef;
- ProcPtr x;
-
- hgdef = GetResource ('GDEF', idgestaltfunction);
-
- if (hgdef == nil) /*didn't find gestalt definition function*/
- return (false);
-
- x = (ProcPtr) *hgdef;
-
- if (NewGestalt (idgestaltselector, x) != noErr) {
-
- if (ReplaceGestalt (idgestaltselector, x, &x) != noErr) {
-
- ReleaseResource (hgdef);
-
- return (false);
- }
- }
-
- DetachResource (hgdef);
-
- return (true);
- } /*installgestaltfunction*/
-
-#endif
-
-
-
#if TARGET_API_MAC_CARBON
-void WriteToConsole (char *s)
-{
+void WriteToConsole (char *s) {
CFShow(CFStringCreateWithCString(NULL,s,kCFStringEncodingMacRoman));
-}
+ }
void DoErrorAlert(OSStatus status, CFStringRef errorFormatString)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cre...@us...> - 2007-02-26 19:47:07
|
Revision: 1629
http://svn.sourceforge.net/frontierkernel/?rev=1629&view=rev
Author: creecode
Date: 2007-02-26 11:46:59 -0800 (Mon, 26 Feb 2007)
Log Message:
-----------
formatting tweaks
Modified Paths:
--------------
Frontier/branches/Frontier_Long_File_Paths/Common/SystemHeaders/land.h
Frontier/branches/Frontier_Long_File_Paths/Common/UserLandIACToolkit/land.c
Frontier/branches/Frontier_Long_File_Paths/Common/UserLandIACToolkit/landgetparam.c
Frontier/branches/Frontier_Long_File_Paths/Common/UserLandIACToolkit/landpush.c
Frontier/branches/Frontier_Long_File_Paths/Common/UserLandIACToolkit/landverbarray.c
Frontier/branches/Frontier_Long_File_Paths/Common/headers/kernelverbs.h
Frontier/branches/Frontier_Long_File_Paths/Common/source/langdialog.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langparser.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langparser.y
Frontier/branches/Frontier_Long_File_Paths/Common/source/langtmpstack.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/SystemHeaders/land.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/SystemHeaders/land.h 2007-02-25 04:59:30 UTC (rev 1628)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/SystemHeaders/land.h 2007-02-26 19:46:59 UTC (rev 1629)
@@ -348,6 +348,7 @@
macsystem6 /*using System 6 INIT as transport mechanism*/
/*room for support of other IAC protocols in our super-protocol*/
+
} tytransport;
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/UserLandIACToolkit/land.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/UserLandIACToolkit/land.c 2007-02-25 04:59:30 UTC (rev 1628)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/UserLandIACToolkit/land.c 2007-02-26 19:46:59 UTC (rev 1629)
@@ -120,6 +120,7 @@
pascal hdllandglobals landgetglobals (void) {
return (landgetlandglobals ()); /*return value of asm routine*/
+
} /*landgetglobals*/
@@ -366,7 +367,7 @@
if (!landcomplexsend (hverb, &hresult))
return (false);
-
+
landnextparamisoptional (hresult); /*don't require that any reply values exist*/
if (landgetparam (hresult, errornumberkey, notype, &errorparam)) { /*got an error*/
@@ -376,8 +377,9 @@
landseterror (noErr); /*clear coercion error*/
*iderror = errAEEventFailed;
+
}
-
+
landnextparamisoptional (hresult); /*don't require next parameter...*/
if (*iderror == 0) { /*'errn' was zero, not an error; check for direct param*/
@@ -385,6 +387,7 @@
fl = true; /*not an error*/
landgetparam (hresult, returnedvaluekey, notype, result); /*take it if it's there*/
+
}
else {
@@ -399,6 +402,7 @@
GetIndString (bserror, (**hg).iderrorlist, ixstring);
#endif
+
}
}
}
@@ -415,6 +419,7 @@
landdisposeverb (hresult);
return (fl);
+
} /*landsendverb*/
@@ -443,6 +448,7 @@
landdisposeverb (hv);
return (fl);
+
} /*landhandleverb*/
@@ -521,12 +527,6 @@
return (landsystem7eventfilter (ev));
- /*
- if ((**hg).transport == macsystem7)
- return (landsystem7eventfilter (ev));
- else
- return (landsystem6eventfilter (ev));
- */
} /*landeventfilter*/
#endif
@@ -699,19 +699,13 @@
*/
register hdllandglobals hg = landgetglobals ();
- /*
- SysEnvRec world;
- */
+
long result;
hdllandglobals hglobals;
tyapplicationid id;
- #if TARGET_API_MAC_CARBON == 1
landzone = LMGetApplZone();
- #else
- landzone = GetZone ();
- #endif
-
+
#if !TARGET_API_MAC_CARBON
landresmap = LMGetTopMapHndl ();
#endif
@@ -726,40 +720,13 @@
landsetlandglobals (hglobals); /*stick the handle in*/
hg = hglobals;
+
}
(**hg).transport = macsystem7;
(**hg).applicationid = ' ';
- /*
- (**hg).iderrorlist = 129;
-
- (**hg).flconnected = false;
-
- (**hg).flacceptanyverb = false;
-
- (**hg).verbarray = nil;
-
- (**hg).handleverbroutine = nil;
-
- (**hg).breakembraceroutine = nil;
-
- (**hg).macopenapproutine = nil;
-
- (**hg).macopendocroutine = nil;
-
- (**hg).macprintdocroutine = nil;
-
- (**hg).macquitapproutine = nil;
-
- (**hg).mactypes = nil;
-
- (**hg).hqueue = nil;
-
- (**hg).ipcrefnum = 0;
- */
-
(**hg).breakembraceroutine = &landefaultbreakembrace;
if (!landgetappcreator (&id))
@@ -781,9 +748,8 @@
(**hg).flconnected = true;
- //landsetmemstats (); /*copy freemem into globals -- for use in stats window*/
-
return (true);
+
} /*landinit*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/UserLandIACToolkit/landgetparam.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/UserLandIACToolkit/landgetparam.c 2007-02-25 04:59:30 UTC (rev 1628)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/UserLandIACToolkit/landgetparam.c 2007-02-26 19:46:59 UTC (rev 1629)
@@ -215,7 +215,6 @@
#endif
return (true);
+
} /*landgettextparam*/
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/UserLandIACToolkit/landpush.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/UserLandIACToolkit/landpush.c 2007-02-25 04:59:30 UTC (rev 1628)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/UserLandIACToolkit/landpush.c 2007-02-26 19:46:59 UTC (rev 1629)
@@ -31,7 +31,6 @@
#include "landinternal.h"
-
pascal boolean landpushparam (hdlverbrecord hverb, typaramtype type, Handle hval, void *pval, long len, typaramkeyword key) {
/*
@@ -55,26 +54,27 @@
(**hv).ctparams++; /*added room for another param*/
return (true);
+
} /*landpushparam*/
pascal boolean landpushintparam (hdlverbrecord hverb, short x, typaramkeyword key) {
return (landpushparam (hverb, inttype, nil, &x, longsizeof (x), key));
+
} /*landpushintparam*/
pascal boolean landpushlongparam (hdlverbrecord hverb, long x, typaramkeyword key) {
return (landpushparam (hverb, longtype, nil, &x, longsizeof (x), key));
+
} /*landpushlongparam*/
pascal boolean landpushstringparam (hdlverbrecord hverb, bigstring bs, typaramkeyword key) {
return (landpushparam (hverb, texttype, nil, bs + 1, stringlength (bs), key));
+
} /*landpushstringparam*/
-
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/UserLandIACToolkit/landverbarray.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/UserLandIACToolkit/landverbarray.c 2007-02-25 04:59:30 UTC (rev 1628)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/UserLandIACToolkit/landverbarray.c 2007-02-26 19:46:59 UTC (rev 1629)
@@ -31,7 +31,6 @@
#include "landinternal.h"
-
pascal boolean landaddclass (tyverbclass class) {
register hdllandglobals hg = landgetglobals ();
@@ -48,6 +47,7 @@
}
return (fl);
+
} /*landaddclass*/
@@ -96,6 +96,7 @@
*/
return (landaddverbtoken (token, false));
+
} /*landaddverb*/
@@ -107,8 +108,6 @@
*/
return (landaddverbtoken (token, true));
- } /*landaddfastverb*/
+
+ } /*landaddfastverb*/
-
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/kernelverbs.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/kernelverbs.h 2007-02-25 04:59:30 UTC (rev 1628)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/kernelverbs.h 2007-02-26 19:46:59 UTC (rev 1629)
@@ -28,7 +28,7 @@
#define kernelverbsinclude
-/*prototypes for initialization*/
+// prototypes
extern boolean fileinitverbs (void); /*fileverbs.c*/
@@ -46,14 +46,22 @@
extern boolean windowinitverbs (void); /*shellwindowverbs.c*/
-extern boolean htmlinitverbs (void); /*langhtml.c*/
-extern boolean quicktimeinitverbs (void); /*langquicktime.c*/
+#pragma mark === langhtml.c ===
+extern boolean htmlinitverbs (void);
+
+
+#pragma mark === langquicktime.c ===
+
+extern boolean quicktimeinitverbs (void);
+
+
extern boolean regexpinitverbs (void); /* langregexp.c */
extern boolean mathinitverbs (void); /* langmath.c */
extern boolean cryptinitverbs (void); /* langcrypt.c */
-extern boolean sqliteinitverbs (void); /* langsqlite.c */
\ No newline at end of file
+extern boolean sqliteinitverbs (void); /* langsqlite.c */
+
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langdialog.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langdialog.c 2007-02-25 04:59:30 UTC (rev 1628)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langdialog.c 2007-02-26 19:46:59 UTC (rev 1629)
@@ -94,22 +94,25 @@
}
return (true);
+
} /*langvaliddialogitem*/
-static boolean langdialoggetitemparam (hdltreenode hfirst, short pnum, short *itemnum) {
+static boolean langdialoggetitemparam ( hdltreenode hfirst, short pnum, short *itemnum ) {
- if (!langdialogrunning ()) { /*factored run-time check*/
+ if (!langdialogrunning ()) { // factored run-time check
- langparamerror (dialognotrunningerror, bsfunctionname);
+ langparamerror ( dialognotrunningerror, handleFunctionName );
return (false);
+
}
-
+
if (!getintvalue (hfirst, pnum, itemnum))
return (false);
+
+ return (langvaliddialogitem (*itemnum));
- return (langvaliddialogitem (*itemnum));
} /*langdialoggetitemparam*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langparser.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langparser.c 2007-02-25 04:59:30 UTC (rev 1628)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langparser.c 2007-02-26 19:46:59 UTC (rev 1629)
@@ -1902,3 +1902,4 @@
} break; }
goto enstack;
}
+
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langparser.y
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langparser.y 2007-02-25 04:59:30 UTC (rev 1628)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langparser.y 2007-02-26 19:46:59 UTC (rev 1629)
@@ -1526,6 +1526,3 @@
parseerror ((ptrstring) s);
} /*yyerror*/
-
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langtmpstack.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langtmpstack.c 2007-02-25 04:59:30 UTC (rev 1628)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langtmpstack.c 2007-02-26 19:46:59 UTC (rev 1629)
@@ -66,7 +66,7 @@
if (currenthashtable == nil)
return;
- lockhandle ((Handle) currenthashtable);
+ lockhandle ((Handle) currenthashtable);
p = (**currenthashtable).tmpstack;
@@ -79,10 +79,13 @@
disposevaluerecord (*p, false);
initvalue (p, novaluetype);
+
}
+
} /*for*/
unlockhandle ((Handle) currenthashtable);
+
} /*cleartmpstack*/
@@ -116,7 +119,9 @@
*p = *vpush;
return (true);
+
}
+
} /*for*/
// langerror (tmpstackoverflowerror); /*loop terminated, no room in tmpstack*/
@@ -131,6 +136,7 @@
(**currenthashtable).cttmpstack += ctgrowtmpstack;
return (true);
+
} /*pushtmpstackvalue*/
@@ -151,6 +157,7 @@
val.data.binaryvalue = h;
return (pushtmpstackvalue (&val));
+
} /*pushtmpstack*/
@@ -182,10 +189,13 @@
initvalue (p, novaluetype); /*nil the entry so it can be re-used*/
return (true);
+
}
+
} /*while*/
return (false); /*didn't find it*/
+
} /*removeheaptmp*/
@@ -254,10 +264,12 @@
(*val).fltmpstack = false;
return (true);
+
}
}
return (false);
+
} /*exemptfromtmpstack*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cre...@us...> - 2007-02-25 04:59:34
|
Revision: 1628
http://svn.sourceforge.net/frontierkernel/?rev=1628&view=rev
Author: creecode
Date: 2007-02-24 20:59:30 -0800 (Sat, 24 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/langsystem7.h
Frontier/branches/Frontier_Long_File_Paths/Common/source/langregexp.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langscan.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langstartup.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/langsystem7.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/langsystem7.h 2007-02-25 02:52:04 UTC (rev 1627)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/langsystem7.h 2007-02-25 04:59:30 UTC (rev 1628)
@@ -56,11 +56,11 @@
typedef boolean (*langvisitlistvaluescallback) (tyvaluerecord *, ptrvoid); /*2003-04-28 AR*/
-/*prototypes*/
+// prototypes
extern boolean filespectoalias (const ptrfilespec , boolean, AliasHandle *); /*landsystem7.c*/
-extern boolean aliastostring (Handle, bigstring);
+extern boolean aliasToTextHandle ( Handle, Handle );
extern boolean aliastofilespec (AliasHandle, ptrfilespec );
@@ -88,58 +88,61 @@
#ifdef flnewfeatures
-extern boolean filespecaddvalue (tyvaluerecord *, tyvaluerecord *, tyvaluerecord *);
+ extern boolean filespecaddvalue (tyvaluerecord *, tyvaluerecord *, tyvaluerecord *);
-extern boolean filespecsubtractvalue (tyvaluerecord *, tyvaluerecord *, tyvaluerecord *);
+ extern boolean filespecsubtractvalue (tyvaluerecord *, tyvaluerecord *, tyvaluerecord *);
-extern boolean getobjectmodeldisplaystring (tyvaluerecord *, bigstring);
+ extern boolean getobjectmodeldisplaystring ( tyvaluerecord *, bigstring );
-extern boolean makelistvalue (hdltreenode, tyvaluerecord *);
+ extern boolean makelistvalue (hdltreenode, tyvaluerecord *);
-extern boolean makerecordvalue (hdltreenode, boolean, tyvaluerecord *);
+ extern boolean makerecordvalue (hdltreenode, boolean, tyvaluerecord *);
-extern boolean langgetlistsize (const tyvaluerecord *, long *);
+ extern boolean langgetlistsize (const tyvaluerecord *, long *);
-#ifdef oplanglists
- extern boolean langgetlistitem (const tyvaluerecord *, long, ptrstring, tyvaluerecord *);
-
- extern boolean langpushlistval (struct tylistrecord **, ptrstring, tyvaluerecord *);
+ #ifdef oplanglists
- extern boolean langpushlisttext (struct tylistrecord ** hlist, Handle hstring);
-
- extern boolean langpushliststring (struct tylistrecord ** hlist, bigstring bs);
-
- extern boolean langpushlistaddress (struct tylistrecord ** hlist, hdlhashtable ht, bigstring bs);
-
- extern boolean langpushlistlong (struct tylistrecord ** hlist, long num);
-
- extern boolean getnthlistval (struct tylistrecord ** hlist, long n, ptrstring pkey, tyvaluerecord *val);
+ extern boolean langgetlistitem (const tyvaluerecord *, long, ptrstring, tyvaluerecord *);
+
+ extern boolean langpushlistval (struct tylistrecord **, ptrstring, tyvaluerecord *);
- extern boolean setnthlistval (struct tylistrecord ** hlist, long n, ptrstring pkey, tyvaluerecord *val);
-#else
- extern boolean langgetlistitem (const tyvaluerecord *, long, OSType *, tyvaluerecord *);
-#endif
+ extern boolean langpushlisttext (struct tylistrecord ** hlist, Handle hstring);
+
+ extern boolean langpushliststring (struct tylistrecord ** hlist, bigstring bs);
+
+ extern boolean langpushlistaddress ( struct tylistrecord **, hdlhashtable, const Handle );
+
+ extern boolean langPushListAddressBigstring ( struct tylistrecord **, hdlhashtable, bigstring );
+
+ extern boolean langpushlistlong (struct tylistrecord ** hlist, long num);
+
+ extern boolean getnthlistval (struct tylistrecord ** hlist, long n, ptrstring pkey, tyvaluerecord *val);
-extern boolean coercetolist (tyvaluerecord *, tyvaluetype);
+ extern boolean setnthlistval (struct tylistrecord ** hlist, long n, ptrstring pkey, tyvaluerecord *val);
+ #else
+ extern boolean langgetlistitem (const tyvaluerecord *, long, OSType *, tyvaluerecord *);
+
+ #endif
-extern boolean coercelistvalue (tyvaluerecord *, tyvaluetype);
+ extern boolean coercetolist (tyvaluerecord *, tyvaluetype);
-extern boolean listaddvalue (tyvaluerecord *, tyvaluerecord *, tyvaluerecord *);
+ extern boolean coercelistvalue (tyvaluerecord *, tyvaluetype);
-extern boolean listsubtractvalue (tyvaluerecord *, tyvaluerecord *, tyvaluerecord *);
+ extern boolean listaddvalue (tyvaluerecord *, tyvaluerecord *, tyvaluerecord *);
-extern boolean listcomparevalue (tyvaluerecord *, tyvaluerecord *, tytreetype, tyvaluerecord *);
+ extern boolean listsubtractvalue (tyvaluerecord *, tyvaluerecord *, tyvaluerecord *);
-extern boolean coercetolistposition (tyvaluerecord *);
-
-extern boolean listarrayvalue (tyvaluerecord *, bigstring, tyvaluerecord *, tyvaluerecord *);
+ extern boolean listcomparevalue (tyvaluerecord *, tyvaluerecord *, tytreetype, tyvaluerecord *);
-extern boolean listassignvalue (tyvaluerecord *, bigstring, tyvaluerecord *, tyvaluerecord *);
+ extern boolean coercetolistposition (tyvaluerecord *);
+
+ extern boolean listarrayvalue ( tyvaluerecord *, const Handle, tyvaluerecord *, tyvaluerecord * );
-extern boolean listdeletevalue (tyvaluerecord *, bigstring, tyvaluerecord *);
+ extern boolean listassignvalue (tyvaluerecord *, const Handle, tyvaluerecord *, tyvaluerecord *);
-extern boolean langvisitlistvalues (tyvaluerecord *, langvisitlistvaluescallback, ptrvoid); /*2003-04-28 AR*/
+ extern boolean listdeletevalue ( tyvaluerecord *, const Handle, tyvaluerecord * );
+ extern boolean langvisitlistvalues (tyvaluerecord *, langvisitlistvaluescallback, ptrvoid); // 2003-04-28 AR
+
#endif
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langregexp.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langregexp.c 2007-02-25 02:52:04 UTC (rev 1627)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langregexp.c 2007-02-25 04:59:30 UTC (rev 1628)
@@ -1027,19 +1027,17 @@
}
return (true);
+
} /*regexpgetpatterninfo*/
-static boolean regexpbuildmatchinfotable (Handle hsubject, Handle hcp, Handle hovec,
- boolean flmakegroups, boolean flmakenamedgroups,
- bigstring bserror, hdlhashtable ht) {
+static boolean regexpbuildmatchinfotable ( Handle hsubject, Handle hcp,
+ Handle hovec, boolean flmakegroups, boolean flmakenamedgroups,
+ bigstring bserror, hdlhashtable ht ) {
- long offset = getgroupoffset (hovec, 0);
- long length = getgrouplength (hovec, 0);
- hdllistrecord hoffsets = nil;
- hdllistrecord hlengths = nil;
- hdllistrecord hstrings = nil;
Handle h;
+ long length = getgrouplength (hovec, 0), offset = getgroupoffset (hovec, 0);
+ hdllistrecord hlengths = nil, hoffsets = nil, hstrings = nil;
/* matchOffset */
@@ -1057,8 +1055,11 @@
goto exit;
if (!langassigntextvalue (ht, STR_matchString, h)) {
+
disposehandle (h);
+
goto exit;
+
}
/* make groups */
@@ -1119,7 +1120,6 @@
if (!langpushliststring (hstrings, emptystring))
goto exit;
-
}
}
@@ -1129,7 +1129,7 @@
vtemp.data.binaryvalue = (Handle) hoffsets;
- if (!hashtableassign (ht, STR_groupOffsets, vtemp))
+ if (!hashtableassignstring (ht, STR_groupOffsets, vtemp))
goto exit;
hoffsets = nil;
@@ -1140,7 +1140,7 @@
vtemp.data.binaryvalue = (Handle) hlengths;
- if (!hashtableassign (ht, STR_groupLengths, vtemp))
+ if (!hashtableassignstring (ht, STR_groupLengths, vtemp))
goto exit;
hlengths = nil;
@@ -1151,10 +1151,11 @@
vtemp.data.binaryvalue = (Handle) hstrings;
- if (!hashtableassign (ht, STR_groupStrings, vtemp))
+ if (!hashtableassignstring (ht, STR_groupStrings, vtemp))
goto exit;
hstrings = nil;
+
}
if (flmakenamedgroups) {
@@ -1173,11 +1174,14 @@
res = pcre_fullinfo (getpatternref (hcp), nil, PCRE_INFO_NAMETABLE, (void *) &cptr);
if (res != 0) {
+
regexpverberrorwithnumber (regexpinternalerror, res, bserror);
+
goto exit;
+
}
- if (!langassignnewtablevalue (ht, STR_namedGroups, &htgroups))
+ if ( ! langAssignNewTableValueBigstring ( ht, STR_namedGroups, &htgroups ) )
goto exit;
if (cptr != nil) {
@@ -1188,7 +1192,7 @@
copyctopstring ((char *) (cptr + k * sz + 2), bs);
- if (!langassignnewtablevalue (htgroups, bs, &htname))
+ if ( ! langAssignNewTableValueBigstring ( htgroups, bs, &htname ) )
goto exit;
offset = getgroupoffset (hovec, groupnum);
@@ -1208,24 +1212,29 @@
goto exit;
if (!langassigntextvalue (htname, STR_matchString, h)) {
+
disposehandle (h);
+
goto exit;
+
}
+
} /*for*/
}
}
return (true);
-
-exit:
- opdisposelist (hoffsets);
+ exit:
- opdisposelist (hlengths);
-
- opdisposelist (hstrings);
-
- return (false);
+ opdisposelist (hoffsets);
+
+ opdisposelist (hlengths);
+
+ opdisposelist (hstrings);
+
+ return (false);
+
} /*regexpbuildmatchinfotable*/
@@ -1378,12 +1387,15 @@
releaseheaptmp (val.data.stringvalue);
return (true);
+
} /*replscanwritenumbered*/
-static boolean replscanwritenamed (int ix, int len, const char *cptr, int clen, bigstring bserror, void *refcon) {
-#pragma unused (ix, len, bserror)
+static boolean replscanwritenamed ( int ix, int len, const char *cptr, int clen,
+ bigstring bserror, void *refcon ) {
+ #pragma unused (ix, len, bserror)
+
tyreplscanexpandinfo *info = (tyreplscanexpandinfo *) refcon;
hdlhashnode hnode;
hdlhashtable ht;
@@ -1393,27 +1405,27 @@
moveleft ((void *) cptr, stringbaseaddress (bsname), clen);
setstringlength (bsname, clen);
-
- if (!langhashtablelookup (info->htnames, bsname, &vname, &hnode))
+
+ if ( ! langHashTableLookupBigstring ( info->htnames, bsname, &vname, &hnode ) )
return (false);
-
- if (!langexternalvaltotable (vname, &ht, hnode)) {
+
+ if (!langexternalvaltotable (vname, &ht, hnode))
return (false);
- }
-
- if (!langhashtablelookup (ht, STR_matchString, &vstr, &hnode))
+
+ if ( ! langHashTableLookupBigstring ( ht, STR_matchString, &vstr, &hnode ) )
return (false);
if (vstr.valuetype != stringvaluetype)
if (!copyvaluerecord (vstr, &vstr) || !coercetostring (&vstr))
return (false);
-
+
fl = writehandlestreamhandle (&(info->s), vstr.data.stringvalue);
-
+
if (vstr.fltmpstack)
releaseheaptmp (vstr.data.stringvalue);
+
+ return (fl);
- return (fl);
} /*replscanwritenamed*/
@@ -1717,20 +1729,23 @@
} /*writereplacementhandlestream*/
-static boolean getcodetreefromscriptaddress (hdlhashtable htable, bigstring bsverb, hdltreenode *hcode) {
+static boolean getcodetreefromscriptaddress (hdlhashtable htable, const Handle handleVerb, hdltreenode *hcode) {
+
+ //
+ // Given the address of an object, assume it's a script or code object and
+ // get its code tree
+ //
+ // Code cribbed from langrunscript in lang.c
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
- /*
- Given the address of an object, assume it's a script or code object and get its code tree
-
- Code cribbed from langrunscript in lang.c
- */
-
tyvaluerecord vhandler;
hdlhashnode handlernode;
- if (!hashtablelookupnode (htable, bsverb, &handlernode)) {
+ if (!hashtablelookupnode (htable, handleVerb, &handlernode)) {
- langparamerror (unknownfunctionerror, bsverb);
+ langparamerror ( unknownfunctionerror, handleVerb );
return (false);
}
@@ -1749,9 +1764,10 @@
if (!langexternalvaltocode (vhandler, hcode)) {
- langparamerror (notfunctionerror, bsverb);
+ langparamerror ( notfunctionerror, handleVerb );
return (false);
+
}
if (*hcode == nil) { /*needs compilation*/
@@ -1762,17 +1778,24 @@
}
return (true);
+
} /*getcodetreefromscriptaddress*/
-static boolean regexprunreplacecallback (tyaddress *adrcallback, tyvaluerecord *vrepl, tyvaluerecord *vmatchinfo, Handle *hrepl, boolean *flcallbackresult) {
+static boolean regexprunreplacecallback ( tyaddress *adrcallback,
+ tyvaluerecord *vrepl, tyvaluerecord *vmatchinfo, Handle *hrepl,
+ boolean *flcallbackresult ) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ boolean fl;
+ hdlhashnode hdummy;
hdlhashtable htlocals = nil;
hdllistrecord hparams;
+ hdltreenode hcode;
tyvaluerecord vparams, vresult, val;
- hdltreenode hcode;
- hdlhashnode hdummy;
- boolean fl;
*hrepl = nil;
@@ -1785,13 +1808,13 @@
fl = langpushlocalchain (&htlocals);
if (fl)
- fl = hashtableassign (htlocals, STR_replacementString, *vrepl);
+ fl = hashtableassignstring (htlocals, STR_replacementString, *vrepl);
if (!fl)
disposevaluerecord (*vrepl, false);
if (fl)
- fl = hashtableassign (htlocals, STR_matchInfo, *vmatchinfo);
+ fl = hashtableassignstring (htlocals, STR_matchInfo, *vmatchinfo);
if (!fl)
disposevaluerecord (*vmatchinfo, false);
@@ -1805,20 +1828,20 @@
fl = setheapvalue ((Handle) hparams, listvaluetype, &vparams);
if (fl)
- fl = langpushlistaddress (hparams, htlocals, STR_matchInfo);
+ fl = langPushListAddressBigstring ( hparams, htlocals, STR_matchInfo );
if (fl)
- fl = langpushlistaddress (hparams, htlocals, STR_replacementString);
+ fl = langPushListAddressBigstring ( hparams, htlocals, STR_replacementString );
/* obtain code tree for callback script */
if (fl)
- fl = getcodetreefromscriptaddress ((*adrcallback).ht, (*adrcallback).bs, &hcode);
+ fl = getcodetreefromscriptaddress ((*adrcallback).ht, (*adrcallback).h, &hcode);
/* run callback script */
if (fl)
- fl = langrunscriptcode ((*adrcallback).ht, (*adrcallback).bs, hcode, &vparams, nil, &vresult);
+ fl = langrunscriptcode ((*adrcallback).ht, (*adrcallback).h, hcode, &vparams, nil, &vresult);
if (fl)
fl = coercetoboolean (&vresult);
@@ -1829,7 +1852,7 @@
/* get replacement string from locals table */
if (fl)
- fl = langhashtablelookup (htlocals, STR_replacementString, &val, &hdummy);
+ fl = langHashTableLookupBigstring ( htlocals, STR_replacementString, &val, &hdummy );
if (fl)
fl = copyvaluerecord (val, &val);
@@ -1839,20 +1862,28 @@
fl = coercetostring (&val);
if (fl) {
+
exemptfromtmpstack (&val);
+
*hrepl = val.data.stringvalue;
+
}
/* dispose table for local variables */
return (langpoplocalchain (htlocals) && fl);
+
} /*regexprunreplacecallback*/
-static boolean regexpreplacematch (handlestream *s, Handle hsubject, Handle hreplace, hdlreplacepart hreplaceparts,
- Handle hcp, Handle hovec, tyaddress *adrcallback,
- bigstring bserror, boolean *flresult) {
+static boolean regexpreplacematch ( handlestream *s, Handle hsubject,
+ Handle hreplace, hdlreplacepart hreplaceparts, Handle hcp, Handle hovec,
+ tyaddress *adrcallback, bigstring bserror, boolean *flresult ) {
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+
hdlhashtable htmatchinfo = nil;
tyvaluerecord vmatchinfo;
handlestream hsrepl;
@@ -1864,26 +1895,26 @@
/* if adrcallback was not specified just perform the replacement and return */
- if ((*adrcallback).ht == nil && isemptystring ((*adrcallback).bs))
+ if ( ( *adrcallback ).ht == nil && isemptyhandle ( ( *adrcallback ).h ) )
return (writereplacementhandlestream (s, hsubject, hreplace, hreplaceparts, hovec));
-
+
/* build default replacement string */
openhandlestream (nil, &hsrepl);
if (!writereplacementhandlestream (&hsrepl, hsubject, hreplace, hreplaceparts, hovec))
return (false);
-
+
hrepl = closehandlestream (&hsrepl);
if (hrepl == nil) {
if (!newemptyhandle (&hrepl))
return (false);
}
-
+
if (!setheapvalue (hrepl, stringvaluetype, &vrepl))
return (false);
-
+
/* build matchInfo table */
if (!tablenewtablevalue (&htmatchinfo, &vmatchinfo))
@@ -1898,18 +1929,22 @@
/* run callback script */
if (!regexprunreplacecallback (adrcallback, &vrepl, &vmatchinfo, &hrepl, flresult)) {
+
disposehandle (hrepl);
+
return (false);
+
}
-
+
if (*flresult)
fl = writehandlestreamhandle (s, hrepl);
else
fl = writehandlestreamhandlepart (s, hsubject, getgroupoffset (hovec, 0), getgrouplength (hovec, 0));
-
+
disposehandle (hrepl);
return (fl);
+
} /*regexpreplacematch*/
@@ -1921,6 +1956,7 @@
return (false);
return (langpushlisttext (hlist, h));
+
} /*pushhandlepartonlist*/
@@ -1989,20 +2025,23 @@
} /*regexpwritelistitemscallback*/
-static boolean regexprunvisitcallback (Handle hsubject, Handle hcp, Handle hovec,
- boolean flmakegroups, boolean flmakenamedgroups, tyaddress *adrcallback,
- bigstring bserror, tyvaluerecord *vresult) {
+static boolean regexprunvisitcallback ( Handle hsubject, Handle hcp,
+ Handle hovec, boolean flmakegroups, boolean flmakenamedgroups,
+ tyaddress *adrcallback, bigstring bserror, tyvaluerecord *vresult ) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
- hdlhashtable htlocals = nil;
- hdlhashtable htmatchinfo;
+ boolean fl = true;
+ hdlhashtable htlocals = nil, htmatchinfo;
hdllistrecord hparams;
+ hdltreenode hcode;
tyvaluerecord vparams;
- hdltreenode hcode;
- boolean fl = true;
/* obtain code tree for callback script */
- if (!getcodetreefromscriptaddress ((*adrcallback).ht, (*adrcallback).bs, &hcode))
+ if (!getcodetreefromscriptaddress ((*adrcallback).ht, (*adrcallback).h, &hcode))
return (false);
/* set up table for local variables */
@@ -2012,7 +2051,7 @@
/* build match info table */
- fl = langassignnewtablevalue (htlocals, STR_matchInfo, &htmatchinfo);
+ fl = langAssignNewTableValueBigstring (htlocals, STR_matchInfo, &htmatchinfo);
if (fl)
fl = regexpbuildmatchinfotable (hsubject, hcp, hovec, flmakegroups, flmakenamedgroups, bserror, htmatchinfo);
@@ -2026,18 +2065,19 @@
fl = setheapvalue ((Handle) hparams, listvaluetype, &vparams);
if (fl)
- fl = langpushlistaddress (hparams, htlocals, STR_matchInfo);
+ fl = langPushListAddressBigstring (hparams, htlocals, STR_matchInfo);
/* run callback script */
if (fl)
- fl = langrunscriptcode ((*adrcallback).ht, (*adrcallback).bs, hcode, &vparams, nil, vresult);
+ fl = langrunscriptcode ((*adrcallback).ht, (*adrcallback).h, hcode, &vparams, nil, vresult);
/* dispose table for local variables */
fl = langpoplocalchain (htlocals) && fl;
return (fl);
+
} /*regexprunvisitcallback*/
@@ -2490,6 +2530,7 @@
setlongvalue (0, v);
return (true);
+
}
/* catch execution errors, presumably indicative of a bug in the PCRE library */
@@ -2510,35 +2551,31 @@
releaseheaptmp (hovec); /*no need to accumulate these on the tmp stack*/
return (true);
+
} /*regexpmatchverb*/
-static boolean regexpreplaceverb (hdltreenode hp1, tyvaluerecord *v, bigstring bserror) {
+static boolean regexpreplaceverb ( hdltreenode hp1, tyvaluerecord *v,
+ bigstring bserror ) {
/*
replace (patternRef, repl, s, maxReplacements = infinity)
//string: modified string
*/
-
- Handle hcp;
- Handle hovec = nil;
- Handle hreplace;
- long replacelength;
- Handle hsubject;
- long subjectlength;
- long maxrepl;
- tyaddress adrctrepl;
- tyaddress adrcallback;
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+
+ Handle hcp, hovec = nil, hsubject, hreplace, hresult;
+ boolean fl, flresult;
+ handlestream hs;
+ hdlreplacepart hreplaceparts = nil;
+ int ctrepl = 0, ix, lastix, res;
+ long maxrepl, replacelength, subjectlength;
+ short ctconsumed = 3, ctpositional = 3;
+ tyaddress adrcallback, adrctrepl;
tyvaluerecord vtemp;
- short ctconsumed = 3;
- short ctpositional = 3;
- hdlreplacepart hreplaceparts = nil;
- handlestream hs;
- Handle hresult;
- int res;
- int ix, lastix;
- int ctrepl = 0;
- boolean fl, flresult;
clearbytes (&hs, sizeof (hs));
@@ -2573,31 +2610,32 @@
/* get adrReplacementCount parameter */
adrctrepl.ht = nil; /*defaults to a nil address*/
- setemptystring (adrctrepl.bs);
-
- if (!getoptionaladdressparam (hp1, &ctconsumed, &ctpositional, STR_adrReplacementCount, &adrctrepl.ht, adrctrepl.bs))
+ adrctrepl.h = NULL;
+
+ if (!getoptionaladdressparam (hp1, &ctconsumed, &ctpositional, STR_adrReplacementCount, &adrctrepl.ht, &adrctrepl.h))
goto exit;
-
+
/* get adrCallback parameter */
-
+
flnextparamislast = true;
adrcallback.ht = nil; /*defaults to a nil address*/
- setemptystring (adrcallback.bs);
-
- if (!getoptionaladdressparam (hp1, &ctconsumed, &ctpositional, STR_adrCallback, &adrcallback.ht, adrcallback.bs))
+ adrcallback.h = NULL;
+
+ if (!getoptionaladdressparam (hp1, &ctconsumed, &ctpositional, STR_adrCallback, &adrcallback.ht, &adrcallback.h))
goto exit;
-
+
/* return early if the caller hasn't asked for at least one replacement */
if (maxrepl <= 0) {
-
+
if (!copyhandle (hsubject, &hresult))
return (false);
+
+ goto done;
- goto done;
}
-
+
/* scan repl parameter */
lockhandle (hreplace);
@@ -2608,7 +2646,7 @@
if (!fl)
goto exit;
-
+
pushtmpstack ((Handle) hreplaceparts);
/* run engine */
@@ -2618,7 +2656,7 @@
lastix = ix = 0;
while (true) { /*execute loop at least once*/
-
+
res = regexpexechandle (hcp, hsubject, ix, longinfinity, hovec, bserror);
/* catch internal errors */
@@ -2634,8 +2672,9 @@
goto exit;
break;
+
}
-
+
/* write fragment between last match and current match */
if (!writehandlestreamhandlepart (&hs, hsubject, lastix, getgroupoffset (hovec, 0) - lastix))
@@ -2656,6 +2695,7 @@
goto exit;
break;
+
}
/* determine position of next match attempt */
@@ -2664,6 +2704,7 @@
if (getgrouplength (hovec, 0) == 0)
ix++; /* prevent infinite loop if we matched the empty string */
+
} /*while*/
hresult = closehandlestream (&hs);
@@ -2673,30 +2714,37 @@
goto exit;
}
-done:
+ done:
- releaseheaptmp (hovec); /*no need to accumulate these on the tmp stack*/
-
- releaseheaptmp ((Handle) hreplaceparts);
-
- /* set result */
+ releaseheaptmp (hovec); /*no need to accumulate these on the tmp stack*/
+
+ releaseheaptmp ((Handle) hreplaceparts);
+
+ /* set result */
- if (!isemptystring (adrctrepl.bs)) {
+ if ( ! isemptyhandle ( adrctrepl.h ) ) {
- setlongvalue (ctrepl, &vtemp);
+ setlongvalue (ctrepl, &vtemp);
+
+ if (!langsetsymboltableval (adrctrepl.ht, adrctrepl.h, vtemp))
+ goto exit;
+
+ }
+
+ disposehandle ( adrctrepl.h );
+ disposehandle ( adrcallback.h );
- if (!langsetsymboltableval (adrctrepl.ht, adrctrepl.bs, vtemp)) {
- goto exit;
- }
- }
+ return (setheapvalue (hresult, stringvaluetype, v));
+
+ exit:
- return (setheapvalue (hresult, stringvaluetype, v));
-
-exit:
-
- disposehandlestream (&hs);
-
- return (false);
+ disposehandle ( adrctrepl.h );
+ disposehandle ( adrcallback.h );
+
+ disposehandlestream (&hs);
+
+ return (false);
+
} /*regexpreplaceverb*/
@@ -3065,7 +3113,7 @@
if (!getaddressparam (hp1, 3, &vtemp))
return (false);
- if (!getaddressvalue (vtemp, &adrcallback.ht, adrcallback.bs))
+ if ( ! getaddressvalue ( vtemp, &adrcallback.ht, &adrcallback.h ) )
return (false);
/* get flMakeGroups parameter */
@@ -3139,11 +3187,13 @@
if (getgrouplength (hovec, 0) == 0)
ix++; /* prevent infinite loop if we matched the empty string */
+
} /*while*/
releaseheaptmp (hovec); /*no need to accumulate these on the tmp stack*/
return (true);
+
} /*regexpvisitverb*/
@@ -3299,33 +3349,45 @@
} /*regexpgrepverb*/
-static boolean regexpgetpatterninfoverb (hdltreenode hp1, tyvaluerecord *v, bigstring bserror) {
+static boolean regexpgetpatterninfoverb ( hdltreenode hp1, tyvaluerecord *v,
+ bigstring bserror ) {
/*
on getPatternInfo (patternRef, adrInfoTable)
//boolean: true
*/
- Handle hcp;
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+
+ Handle handleName, hcp;
+ bigstring bsnum;
+ char *cptr;
hdlhashtable htable, htinfo, htfirstbyte, htnames, htoptions;
- bigstring bsname, bsnum;
+ int x, k, ct, sz;
unsigned char *ucptr;
- char *cptr;
- int x, k, ct, sz;
/* get patternRef parameter */
if (!regexpgetpatternvalue (hp1, 1, true, bserror, &hcp, nil))
return (false);
-
+
/* get adrInfoTable parameter */
- if (!getvarparam (hp1, 2, &htable, bsname))
+ if (!getvarparam (hp1, 2, &htable, &handleName))
return (false);
-
- if (!langsuretablevalue (htable, bsname, &htinfo))
+
+ if (!langsuretablevalue (htable, handleName, &htinfo)) {
+
+ disposehandle ( handleName );
+
return (false);
-
+
+ }
+
+ disposehandle ( handleName );
+
/* highest back reference */
if (!regexpgetpatterninfo (hcp, PCRE_INFO_BACKREFMAX, bserror, (void *) &x))
@@ -3361,7 +3423,7 @@
if (!regexpgetpatterninfo (hcp, PCRE_INFO_FIRSTTABLE, bserror, (void *) &ucptr))
return (false);
- if (!langassignnewtablevalue (htinfo, STR_firstByteTable, &htfirstbyte))
+ if ( ! langAssignNewTableValueBigstring ( htinfo, STR_firstByteTable, &htfirstbyte ) )
return (false);
if (ucptr != nil) {
@@ -3372,8 +3434,9 @@
padwithzeros (bsnum, 3);
- if (!langassignbooleanvalue (htfirstbyte, bsnum, ucptr[k/8] & (1 << (k % 8))))
+ if (!langAssignBooleanValueBigstring (htfirstbyte, bsnum, ucptr[k/8] & (1 << (k % 8))))
return (false);
+
} /*for*/
}
@@ -3402,7 +3465,7 @@
if (!regexpgetpatterninfo (hcp, PCRE_INFO_NAMETABLE, bserror, (void *) &cptr))
return (false);
- if (!langassignnewtablevalue (htinfo, STR_nameTable, &htnames))
+ if ( ! langAssignNewTableValueBigstring ( htinfo, STR_nameTable, &htnames ) )
return (false);
if (cptr != nil) {
@@ -3427,28 +3490,28 @@
if (!regexpgetpatterninfo (hcp, PCRE_INFO_OPTIONS, bserror, (void *) &x))
return (false);
- if (!langassignnewtablevalue (htinfo, STR_options, &htoptions))
+ if ( ! langAssignNewTableValueBigstring ( htinfo, STR_options, &htoptions ) )
return (false);
- if (!langassignbooleanvalue (htoptions, STR_flCaseSensitive, (x & PCRE_CASELESS) == 0))
+ if (!langAssignBooleanValueBigstring (htoptions, STR_flCaseSensitive, (x & PCRE_CASELESS) == 0))
return (false);
- if (!langassignbooleanvalue (htoptions, STR_flDotMatchesAll, (x & PCRE_DOTALL) != 0))
+ if (!langAssignBooleanValueBigstring (htoptions, STR_flDotMatchesAll, (x & PCRE_DOTALL) != 0))
return (false);
- if (!langassignbooleanvalue (htoptions, STR_flMultiLine, (x & PCRE_MULTILINE) != 0))
+ if (!langAssignBooleanValueBigstring (htoptions, STR_flMultiLine, (x & PCRE_MULTILINE) != 0))
return (false);
- if (!langassignbooleanvalue (htoptions, STR_flAutoCapture, (x & PCRE_NO_AUTO_CAPTURE) == 0))
+ if (!langAssignBooleanValueBigstring (htoptions, STR_flAutoCapture, (x & PCRE_NO_AUTO_CAPTURE) == 0))
return (false);
- if (!langassignbooleanvalue (htoptions, STR_flGreedyQuantifiers, (x & PCRE_UNGREEDY) == 0))
+ if (!langAssignBooleanValueBigstring (htoptions, STR_flGreedyQuantifiers, (x & PCRE_UNGREEDY) == 0))
return (false);
- if (!langassignbooleanvalue (htoptions, STR_flMatchEmptyString, (x & PCRE_NOTEMPTY) == 0))
+ if (!langAssignBooleanValueBigstring (htoptions, STR_flMatchEmptyString, (x & PCRE_NOTEMPTY) == 0))
return (false);
- if (!langassignbooleanvalue (htoptions, STR_flExtendedMode, (x & PCRE_EXTENDED) == 0))
+ if (!langAssignBooleanValueBigstring (htoptions, STR_flExtendedMode, (x & PCRE_EXTENDED) == 0))
return (false);
/* size */
@@ -3472,41 +3535,55 @@
setbooleanvalue (true, v);
return (true);
+
} /*regexpgetpatterninfoverb*/
static boolean regexpexpandverb (hdltreenode hp1, tyvaluerecord *v, bigstring bserror) {
-
+
/*
on expand (s, adrMatchInfoTable)
//string: processed copy of s
*/
-
- Handle hsubject;
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+
+ Handle h, hresult, hsubject;
+ boolean fl;
+ hdlhashnode hnode;
+ hdlhashtable htmatchinfo;
long subjectlength;
+ tyreplscanexpandinfo info;
tyvaluerecord vtemp;
- hdlhashtable htmatchinfo;
- hdlhashnode hnode;
- tyreplscanexpandinfo info;
- Handle hresult;
- boolean fl;
-
+
/* get s parameter */
if (!getreadonlytextvalue (hp1, 1, &hsubject))
return (false);
-
+
subjectlength = gethandlesize (hsubject);
/* get adrMatchInfoTable parameter */
if (!gettablevalue (hp1, 2, &htmatchinfo))
return (false);
-
+
/* get groupStrings list from info table*/
+
+ if ( ! newtexthandle ( STR_groupStrings, &h ) )
+ return ( false );
- if (!langhashtablelookup (htmatchinfo, STR_groupStrings, &vtemp, &hnode))
+ if ( ! langhashtablelookup ( htmatchinfo, h, &vtemp, &hnode ) ) {
+
+ disposehandle ( h );
+
return (false);
+
+ }
+
+ disposehandle ( h );
if (vtemp.valuetype != listvaluetype) {
@@ -3514,17 +3591,24 @@
return (false);
}
}
-
+
info.hgroups = (hdllistrecord) vtemp.data.binaryvalue;
-
+
/* get namedGroups sub-table from info table*/
-
- if (hashtablelookup (htmatchinfo, STR_namedGroups, &vtemp, &hnode)) {
- if (!langexternalvaltotable (vtemp, &info.htnames, hnode)) {
+
+ if ( ! newtexthandle ( STR_namedGroups, &h ) )
+ return ( false );
+
+ if ( hashtablelookup ( htmatchinfo, h, &vtemp, &hnode ) ) {
+
+ disposehandle ( h );
+
+ if ( ! langexternalvaltotable (vtemp, &info.htnames, hnode))
return (false);
- }
}
+ disposehandle ( h );
+
/* perform replacement */
info.hsubject = hsubject;
@@ -3533,12 +3617,8 @@
lockhandle (hsubject);
- fl = regexpscanreplacement (*hsubject, subjectlength, bserror,
- &replscanwriteliteral,
- &replscanwritenumbered,
- &replscanwritenamed,
- &replscanerror,
- (void *) &info);
+ fl = regexpscanreplacement ( *hsubject, subjectlength, bserror, &replscanwriteliteral, &replscanwritenumbered,
+ &replscanwritenamed, &replscanerror, ( void * ) &info );
unlockhandle (hsubject);
@@ -3555,6 +3635,7 @@
}
return (setheapvalue (hresult, stringvaluetype, v));
+
} /*regexpexpandverb*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langscan.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langscan.c 2007-02-25 02:52:04 UTC (rev 1627)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langscan.c 2007-02-25 04:59:30 UTC (rev 1628)
@@ -62,8 +62,6 @@
bigstring bstoken; /*for viewing with the debugger, text of last token*/
-
-
boolean isfirstidentifierchar (byte ch) {
/*
@@ -102,41 +100,44 @@
} /*isidentifierchar*/
-boolean langisidentifier (bigstring bs) {
+boolean langisidentifier ( const Handle h ) {
+
+ //
+ // called externally to determine when quoting in necessary in path
+ // construction
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 4.1b2 dmb: check the constants table too
+ //
- /*
- called externally to determine when quoting in necessary in path
- construction
+ register byte *s = *h;
+ register short ct = gethandlesize ( h );
- 4.1b2 dmb: check the constants table too
- */
-
- register short ct = stringlength (bs);
- register byte *s = bs;
+ hdlhashnode hnode;
tyvaluerecord val;
- hdlhashnode hnode;
if (ct == 0) /*empty string*/
return (false);
-
- if (!isfirstidentifierchar (*++s))
+
+ if ( ! isfirstidentifierchar ( *s ) )
return (false);
-
+
while (--ct > 0)
if (!isidentifierchar (*++s))
return (false);
-
- if (hashtablelookup (hkeywordtable, bs, &val, &hnode)) /*it's a keyword*/
+
+ if ( hashtablelookup ( hkeywordtable, h, &val, &hnode ) ) // it's a keyword
return (false);
-
- if (hashtablelookup (hconsttable, bs, &val, &hnode)) /*dmb 4.1b2 - it's a constant*/
+
+ if ( hashtablelookup ( hconsttable, h, &val, &hnode ) ) // dmb 4.1b2 - it's a constant
return (false);
+
+ return (true);
- return (true);
- } /*langisidentifier*/
+ } // langisidentifier
-
#if (odbengine==0)
static boolean midinsertchar (byte ch, bigstring bs, short ixinsert) {
@@ -152,9 +153,116 @@
setstringwithchar (ch, bs1);
return (midinsertstring (bs1, bs, ixinsert)); /*should always be true*/
+
} /*midinsertchar*/
+boolean langDeparseTextHandle ( Handle text, byte chendquote ) {
+
+ //
+ // add any necessary escape sequences to make the string compilable. return
+ // true if we don't have to truncate the string to do so.
+ //
+ // 2007-02-24 creedon: created, cribbed from langdeparse function
+ //
+
+ register byte ch;
+ register short ct = gethandlesize ( text ), ix;
+
+ byte hex [ 16 ]; // should only need 7 bytes
+
+ for ( ix = 0; --ct >= 0; ++ix ) {
+
+ ch = ( byte ) *( *text + ix );
+
+ if ( isprint ( ch ) ) { // look for the few printable characters that
+ // might need quoting
+ switch ( ch ) {
+
+ case '\\':
+
+ break;
+
+ case '\'':
+ case '\"':
+ case chclosecurlyquote:
+
+ if ( ch != chendquote ) // don't always need to quote these
+ ch = 0;
+
+ break;
+
+ default:
+
+ ch = 0;
+
+ break;
+ }
+
+ if ( ch == 0 ) // no quote necessary
+ continue;
+ }
+
+ if ( ch >= 128 ) // extended ascii
+ continue;
+
+ if ( ! insertCharInTextHandle ( '\\', ix++, text ) )
+ return ( false );
+
+ switch ( ch ) {
+
+ case '\n':
+
+ ch = 'n';
+
+ break;
+
+ case '\r':
+
+ ch = 'r';
+
+ break;
+
+ case '\t':
+
+ ch = 't';
+
+ break;
+
+ case '\\':
+ case '\'':
+ case '\"':
+ case chclosecurlyquote:
+
+ break;
+
+ default:
+
+ if ( ! insertCharInTextHandle ( 'x', ix++, text ) )
+ return ( false );
+
+ numbertohexstring ( ch, hex );
+
+ if ( ! insertCharInTextHandle ( hex [ 5 ], ix++, text ) ) // skip over 0x00
+ return ( false );
+
+ ch = hex [ 6 ];
+
+ break;
+ }
+
+ /* if ( ix > ct )
+ return ( false ); */
+
+ *( *text + ix ) = ch;
+
+ } // for
+
+ return ( true );
+
+ } // langDeparseTextHandle
+
+
boolean langdeparsestring (bigstring bs, byte chendquote) {
/*
@@ -344,21 +452,21 @@
static byte parsefirstchar (void) {
+
+ //
+ // return the character at the head of the parse stream without popping it
+ //
- /*
- return the character at the head of the parse stream without
- popping it.
- */
-
register long ix = ixparsestring;
register ptrbyte p;
if (ix >= lenparsestring)
return (chendscanstring);
-
+
p = (ptrbyte) *hscanstring + ix;
return (*p);
+
} /*parsefirstchar*/
@@ -381,23 +489,27 @@
} /*parsenextchar*/
-static void parsepopidentifier (bigstring bs) {
+static void parsepopidentifier ( Handle *h ) {
+
+ //
+ // pull characters off the front of the input stream as long as we're still
+ // getting identifier characters.
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
- /*
- pull characters off the front of the input stream as long as
- we're still getting identifier characters.
- */
+ newemptyhandle ( h );
- setstringlength (bs, 0);
+ while ( true ) {
- while (true) {
-
- if (!isidentifierchar (parsefirstchar ())) /*finished accumulating identifier*/
+ if ( ! isidentifierchar ( parsefirstchar ( ) ) ) // finished accumulating identifier
return;
+
+ pushcharhandle ( parsepopchar ( ), *h ); // add char to the end of the string
- pushchar (parsepopchar (), bs); /*add char to the end of the string*/
- } /*while*/
- } /*parsepopidentifier*/
+ } // while
+
+ } // parsepopidentifier
static boolean parsepopnumber (tyvaluerecord *val) {
@@ -457,8 +569,10 @@
initvalue (val, doublevaluetype);
(*val).data.binaryvalue = x;
+
}
else {
+
long x;
bigstring bstest;
@@ -483,6 +597,7 @@
}
setlongvalue (x, val);
+
}
#ifdef fldebug
@@ -492,6 +607,7 @@
#endif
return (true);
+
}
}
@@ -500,7 +616,7 @@
overflow:
- langparamerror (numbertoolargeerror, bsnumber);
+ langParamErrBs ( numbertoolargeerror, bsnumber);
return (false);
} /*parsepopnumber*/
@@ -805,31 +921,33 @@
static tokentype langscanner (hdltreenode *nodetoken) {
+
+ //
+ // scan the input string for the next token, return the character that we
+ // stopped on in chtoken.
+ //
+ // if it's an identifier or a constant, nodetoken will be non-nil.
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 5.0.2b10 dmb: exempt const identifier from tmp stack before pushing it
+ // into code tree. it will be disposed on error
+ //
+ // 1991-11-22 dmb: return zero when out of text, after returning exactly
+ // one (non-zero) eoltoken.
+ //
- /*
- scan the input string for the next token, return the character
- that we stopped on in chtoken.
+ register byte ch, chfirst, chsecond;
- if it's an identifier or a constant, nodetoken will be non-nil.
-
- 11/22/91 dmb: return zero when out of text, after returning exactly
- one (non-zero) eoltoken.
-
- 5.0.2b10 dmb: exempt const identifier from tmp stack before pushing it
- into code tree. it will be disposed on error
- */
-
- register byte ch, chfirst, chsecond;
- bigstring bs;
+ hdlhashnode hnode;
tyvaluerecord val;
- hdlhashnode hnode;
*nodetoken = nil; /*default*/
#ifdef fldebug
-
- setstringlength (bstoken, 0);
-
+
+ setstringlength (bstoken, 0);
+
#endif
if (!parsepopblanks ()) { /*ran out of text*/
@@ -840,6 +958,7 @@
flsenteol = true; /*we're about to...*/
return (eoltoken);
+
}
chfirst = ch = parsefirstchar (); /*lookahead at the next character*/
@@ -853,6 +972,7 @@
return (0 /*errortoken*/);
return (constanttoken);
+
}
if ((ch == chdoublequote) || (ch == chopencurlyquote)) { /*a string constant*/
@@ -864,14 +984,15 @@
#ifdef fldebug
- texthandletostring (val.data.stringvalue, bstoken); /*8/13*/
-
+ texthandletostring (val.data.stringvalue, bstoken); /*8/13*/
+
#endif
if (!newconstnode (val, nodetoken))
return (0 /*errortoken*/);
return (constanttoken);
+
}
if (isdigit (ch)) {
@@ -883,28 +1004,31 @@
return (0 /*errortoken*/);
return (constanttoken);
+
}
-
+
if (isfirstidentifierchar (ch)) {
register boolean fl;
- parsepopidentifier (bs);
+ Handle h;
+ parsepopidentifier ( &h );
+
#ifdef fldebug
- copystring (bs, bstoken);
-
+ texthandletostring (h, bstoken);
+
#endif
- fl = hashtablelookup (hkeywordtable, bs, &val, &hnode);
+ fl = hashtablelookup (hkeywordtable, h, &val, &hnode);
if (fl)
return ((tokentype) val.data.tokenvalue); /*it's a reserved word*/
+
+ fl = hashtablelookup (hconsttable, h, &val, &hnode);
- fl = hashtablelookup (hconsttable, bs, &val, &hnode);
-
- if (fl) { /*it's a pre-defined constant*/
+ if (fl) { // it's a pre-defined constant
if (!copyvaluerecord (val, &val))
return (0);
@@ -915,17 +1039,26 @@
return (0 /*errortoken*/);
return (constanttoken);
+
}
initvalue (&val, stringvaluetype);
- if (!newtexthandle (bs, &val.data.stringvalue))
- return (0 /*errortoken*/);
+ if ( ! copyhandle ( h, &val.data.stringvalue ) ) {
+ disposehandle ( h );
+
+ return ( 0 ); // errortoken
+
+ }
+
+ disposehandle ( h );
+
if (!newidnode (val, nodetoken))
return (0 /*errortoken*/);
return (identifiertoken);
+
}
parsepopchar (); /*consume the token char*/
@@ -934,8 +1067,8 @@
#ifdef fldebug
- pushchar (chfirst, bstoken);
-
+ pushchar (chfirst, bstoken);
+
#endif
switch (chfirst) {
@@ -969,6 +1102,7 @@
return (GEtoken);
case '+':
+
if (chsecond == '+') {
parsepopchar (); /*consume the second char*/
@@ -980,6 +1114,7 @@
#endif
return (plusplustoken);
+
}
return (addtoken);
@@ -1071,11 +1206,12 @@
#ifdef fldebug
- pushchar ('=', bstoken);
-
+ pushchar ('=', bstoken);
+
#endif
return (GEtoken);
+
}
return (GTtoken);
@@ -1092,18 +1228,21 @@
#endif
return (NEtoken);
+
}
return (nottoken);
+
} /*switch*/
setstringwithchar (chfirst, bstoken);
//assert (ixparsestring <= lenparsestring && hscanstring);
- langparamerror (illegaltokenerror, bstoken); /*all the legal tokens are caught above*/
+ langParamErrBs ( illegaltokenerror, bstoken ); /*all the legal tokens are caught above*/
return (errortoken);
+
} /*langscanner*/
@@ -1121,6 +1260,7 @@
token = langscanner (nodetoken);
return (token);
+
} /*parsegettoken*/
@@ -1341,11 +1481,3 @@
#endif
-
-
-
-
-
-
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langstartup.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langstartup.c 2007-02-25 02:52:04 UTC (rev 1627)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langstartup.c 2007-02-25 04:59:30 UTC (rev 1628)
@@ -70,24 +70,27 @@
} /*initsegment*/
-static boolean newfunctionprocessor (bigstring bsname, langvaluecallback valuecallback, boolean flwindow, hdlhashtable *htable) {
+static boolean newfunctionprocessor ( Handle handleName, langvaluecallback valuecallback, boolean flwindow, hdlhashtable *htable ) {
+
+ //
+ // each of the external function processors register with the system by
+ // calling this routine. we create a new hashtable in the EFP table, and
+ // return a handle to the new table. we also link in a callback routine
+ // that processes the verbs for this EFP. flwindow is also recorded -- it
+ // says whether or not the EFP requires a window be open in order for one
+ // of its verbs to be executed.
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 1993-06-01 dmb: flwindow parameter is now real. when true, the
+ // valuecallback must respond to being called with a nil
+ // parameter list by determining whether or not a specific
+ // verb requires Frontier to be the current process.
+ //
- /*
- each of the external function processors register with the system by calling
- this routine. we create a new hashtable in the EFP table, and return a
- handle to the new table. we also link in a callback routine that processes the
- verbs for this EFP. flwindow is also recorded -- it says whether or not
- the EFP requires a window be open in order for one of its verbs to be
- executed.
-
- 6/1/93 dmb: flwindow parameter is now real. when true, the valuecallback must
- respond to being called with a nil parameter list by determining whether or not
- a specific verb requires Frontier to be the current process.
- */
-
register hdlhashtable ht;
- if (!tablenewsystemtable (efptable, bsname, htable))
+ if ( ! tablenewsystemtable ( efptable, handleName, htable ) )
return (false);
ht = *htable; /*copy into register*/
@@ -97,86 +100,75 @@
(**ht).valueroutine = valuecallback;
return (true);
+
} /*newfunctionprocessor*/
-static boolean hashinsertcstring (bigstring bs, const tyvaluerecord *v) {
+static boolean langaddcstringkeyword (bigstring bs, short tokennumber) {
- convertcstring (bs);
-
- return (hashinsert (bs, *v));
- } /*hashinsertcstring*/
-
-
-static boolean langaddcstringkeyword (bigstring bs, short tokennumber) {
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ Handle h;
tyvaluerecord val;
initvalue (&val, tokenvaluetype);
val.data.tokenvalue = (short) tokennumber;
- return (hashinsertcstring (bs, &val));
- } /*langaddcstringkeyword*/
+ newfilledhandle ( bs, strlen ( bs ), &h );
+ return ( hashinsert ( h, val ) );
+
+ } // langaddcstringkeyword
-boolean langaddkeyword (bigstring bs, short tokennumber) {
+
+boolean langaddkeyword ( const Handle h, short tokennumber ) {
tyvaluerecord val;
- initvalue (&val, tokenvaluetype);
+ initvalue ( &val, tokenvaluetype );
- val.data.tokenvalue = (short) tokennumber;
+ val.data.tokenvalue = ( short ) tokennumber;
- return (hashinsert (bs, val));
- } /*langaddkeyword*/
+ return ( hashinsert ( h, val ) );
-/*
-boolean langaddkeywordlist (hdlhashtable htable, byte * bskeywords[], short ctkeywords) {
+ } // langaddkeyword
- register short i;
- register boolean fl = true;
-
- pushhashtable (htable);
-
- for (i = 0; fl && (i < ctkeywords); i++)
- fl = langaddkeyword ((ptrstring) bskeywords [i], i);
-
- pophashtable ();
-
- return (fl);
- } /%langaddkeywordlist%/
-*/
boolean loadfunctionprocessor (short id, langvaluecallback valuecallback) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 2006-04-16 aradke: swap byte-order on Intel Macs
+ //
+ // 2.1b5 dmb: having learning that our use of lots of string literals, and
+ // hence the "Seperate STRS" option in Think C was making us
+ // victim of an '040 instruction cache bug in Think C's run-time
+ // implementation of same, it's time to create the kernel tables
+ // directly from resources. that's what this routine does.
+ //
- /*
- 2.1b5 dmb: having learning that our use of lots of string literals, and
- hence the "Seperate STRS" option in Think C was making us victim of an
- '040 instruction cache bug in Think C's run-time implementation of same,
- it's time to create the kernel tables directly from resources. that's
- what this routine does.
-
- 2006-04-16 aradke: swap byte-order on Intel Macs
- */
-
- bigstring bsname;
+ Handle handleName, hefps;
+ boolean fl = true;
hdlhashtable htable;
- short flwindow;
long ix = 0;
- Handle hefps;
- short ctefps;
- short ctverbs;
- short ixverb = 0;
- boolean fl = true;
+ short ctefps, ctverbs, flwindow, ixverb = 0;
-#ifdef MACVERSION
- hefps = getresourcehandle ('EFP#', id);
-#endif
-#ifdef WIN95VERSION
- hefps = getresourcehandle ('EFP_', id);
-#endif
+ #ifdef MACVERSION
+ hefps = getresourcehandle ('EFP#', id);
+
+ #endif
+
+ #ifdef WIN95VERSION
+
+ hefps = getresourcehandle ('EFP_', id);
+
+ #endif
+
assert (hefps != nil);
if (hefps == nil)
@@ -188,18 +180,21 @@
reztomemshort (ctefps);
while (--ctefps >= 0) {
+
+ if ( ! newtexthandle ( BIGSTRING ( *hefps + ix ), &handleName ) )
+ return ( false );
+
+ ix += gethandlesize ( handleName ) + 1;
- copyrezstring (BIGSTRING (*hefps + ix), bsname);
-
- ix += stringsize (bsname);
-
if (!loadfromhandle (hefps, &ix, 2, &flwindow))
- return (false);
-
+ goto exit;
+
reztomemshort (flwindow);
- if (!newfunctionprocessor (bsname, valuecallback, (boolean) flwindow, &htable))
- return (false);
+ if (!newfunctionprocessor (handleName, valuecallback, (boolean) flwindow, &htable))
+ goto exit;
+
+ disposehandle ( handleName );
if (!loadfromhandle (hefps, &ix, 2, &ctverbs))
return (false);
@@ -209,97 +204,110 @@
pushhashtable (htable);
while (--ctverbs >= 0 && fl) {
+
+ if ( ! newtexthandle ( BIGSTRING ( *hefps + ix ), &handleName ) )
+ return ( false );
+
+ ix += gethandlesize (handleName) + 1;
- copyrezstring (BIGSTRING (*hefps + ix), bsname);
+ fl = langaddkeyword ( handleName, ixverb++ );
- ix += stringsize (bsname);
+ disposehandle ( handleName );
- fl = langaddkeyword ((ptrstring) bsname, ixverb++);
}
- pophashtable ();
+ pophashtable ( );
+
}
- releaseresourcehandle (hefps);
+ releaseresourcehandle ( hefps );
- return (fl);
- } /*loadfunctionprocessor*/
+ return ( fl );
+
+ exit:
+ disposehandle ( handleName );
+
+ return ( false );
+
+ } // loadfunctionprocessor
static boolean initenvironment (hdlhashtable ht) {
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 2004-11-19 creedon - for Mac, get os build number, full display name, is server
+ //
+
#ifdef MACVERSION
+ OSErr err;
+ UInt32 response;
bigstring bsversion, bsos; /* 2004-11-19 creedon - added bsos*/
boolean isMacOsClassic, isServer; /* 2004-11-19 creedon */
unsigned long x;
- #if TARGET_API_MAC_CARBON == 1 /*PBS 7.028: system.environment.isCarbon*/
-
- /* 2004-11-19 creedon - added hcommand, hreturn, bs, response */
- Handle hcommand, hreturn;
- bigstring bs;
- UInt32 response;
- OSErr err;
-
- #endif
-
gestalt (gestaltSystemVersion, (long *)(&x));
- langassignbooleanvalue (ht, str_isMac, true);
+ langAssignBooleanValueBigstring (ht, str_isMac, true);
- langassignbooleanvalue (ht, str_isWindows, false);
+ langAssignBooleanValueBigstring (ht, str_isWindows, false);
- //langassignstringvalue (ht, str_osFlavor, zerostring);
+ // langassignstringvalue (ht, str_osFlavor, zerostring);
langassignlongvalue (ht, str_osMajorVersion, bcdtolong (x >> 8)); /* 2004-11-19 creedon - convert from bcd for correct display on Mac OS X */
langassignlongvalue (ht, str_osMinorVersion, (x & 0x00f0) >> 4);
- langassignlongvalue (ht, str_osPointVersion, x & 0x0f); /* 2004-11-19 creedon */
+ langassignlongvalue (ht, str_osPointVersion, x & 0x0f); /* 2004-11-19 creedon */
+
getsystemversionstring (bsversion, nil);
- langassignstringvalue (ht, str_osVersionString, bsversion);
+ langassignstringvalue ( ht, NULL, str_osVersionString, NULL, bsversion );
- /* langassignstringvalue (ht, str_osFullNameForDisplay, "\x09" "Macintosh"); 2004-11-19 creedon - moved to later in code*/
+ #if TARGET_API_MAC_CARBON == 1 /*PBS 7.028: system.environment.isCarbon*/
- #if TARGET_API_MAC_CARBON == 1 /*PBS 7.028: system.environment.isCarbon*/
-
- langassignbooleanvalue (ht, str_isCarbon, true);
+ langAssignBooleanValueBigstring (ht, str_isCarbon, true);
- /* 2004-11-19 creedon - get mac os build number, full display name, is server*/
-
- /* get mac os build number */
-
- newtexthandle ("\psw_vers -buildVersion", &hcommand);
+ /* get mac os build number */ {
- newemptyhandle (&hreturn);
-
- unixshellcall (hcommand, hreturn);
-
- texthandletostring (hreturn, bs);
-
- sethandlesize (hreturn, 0);
-
- setstringlength (bs, stringlength (bs) - 1);
-
- langassignstringvalue (ht, str_osBuildNumber, bs); /* get mac os build number */
-
- /* get os full display name */
-
- copystring ((unsigned char *)"sw_vers -productName", bs);
-
- sethandlecontents (bs, stringsize (bs), hcommand);
-
- unixshellcall (hcommand, hreturn);
-
- texthandletostring (hreturn, bsos);
-
- setstringlength (bsos, stringlength (bsos) - 1); /* get os full display name */
-
- disposehandle (hcommand);
- disposehandle (hreturn); /* get mac os build number and full display name*/
-
+ Handle hcommand, hreturn;
+ bigstring bs;
+
+ newtexthandle ("\psw_vers -buildVersion", &hcommand);
+
+ newemptyhandle (&hreturn);
+
+ unixshellcall (hcommand, hreturn);
+
+ texthandletostring (hreturn, bs);
+
+ sethandlesize (hreturn, 0);
+
+ setstringlength (bs, stringlength (bs) - 1);
+
+ langassignstringvalue ( ht, NULL, str_osBuildNumber, NULL, bs ); /* get mac os build number */
+
+ /* get os full display name */ {
+
+ copystring ((unsigned char *)"sw_vers -productName", bs);
+
+ sethandlecontents (bs, stringsize (bs), hcommand);
+
+ unixshellcall (hcommand, hreturn);
+
+ texthandletostring (hreturn, bsos);
+
+ setstringlength (bsos, stringlength (bsos) - 1);
+
+ }
+
+ disposehandle (hcommand);
+ disposehandle (hreturn);
+
+ }
+
/* 2004-11-19 creedon - is mac os classic */
/* This needs to be checked on Mac OS Classic as well as Mac OS 9 proper. */
@@ -310,17 +318,15 @@
else
isMacOsClassic = false;
- /* 2004-11-19 creedon - is server */
-
if (equalstrings (bsos, "\pMac OS X Server"))
isServer = true;
else
isServer = false; /* is server */
-
+
#else
+
+ langAssignBooleanValueBigstring (ht, str_isCarbon, false);
- langassignbooleanvalue (ht, str_isCarbon, false);
-
copystring (BIGSTRING ("\x06" "Mac OS"), bsos); /* 2004-11-19 creedon - Mac OS, used to be Macintosh*/
isMacOsClassic = true; /* 2004-11-19 creedon */
@@ -329,11 +335,11 @@
#endif
- langassignbooleanvalue (ht, str_isMacOsClassic, isMacOsClassic); /* 2004-11-19 creedon */
+ langAssignBooleanValueBigstring (ht, str_isMacOsClassic, isMacOsClassic); /* 2004-11-19 creedon */
- langassignstringvalue (ht, str_osFullNameForDisplay, bsos); /* 2004-11-19 creedon - changed "\x06" "Mac OS" to bsos. a calculated value */
+ langassignstringvalue ( ht, NULL, str_osFullNameForDisplay, NULL, bsos ); /* 2004-11-19 creedon - changed "\x06" "Mac OS" to bsos. a calculated value */
- langassignbooleanvalue (ht, str_isServer, isServer); /* 2004-11-19 creedon */
+ langAssignBooleanValueBigstring (ht, str_isServer, isServer); /* 2004-11-19 creedon */
#endif
@@ -350,9 +356,9 @@
copystring (BIGSTRING ("\x08" "Windows "), bsos);
- langassignbooleanvalue (ht, str_isMac, false);
+ langAssignBooleanValueBigstring (ht, str_isMac, false);
- langassignbooleanvalue (ht, str_isWindows, true);
+ langAssignBooleanValueBigstring (ht, str_isWindows, true);
if (osinfo.dwPlatformId == VER_PLATFORM_WIN32_NT) {
copystring (BIGSTRING ("\x02" "NT"), bsflavor);
@@ -371,7 +377,7 @@
pushstring (bsflavor, bsos);
- langassignstringvalue (ht, str_osFlavor, bsflavor);
+ langassignstringvalue ( ht, NULL, str_osFlavor, NULL, bsflavor );
langassignlongvalue (ht, str_osMajorVersion, osinfo.dwMajorVersion);
@@ -381,17 +387,17 @@
getsystemversionstring (bsversion, bsservicepack);
- langassignstringvalue (ht, str_osVersionString, bsversion);
+ langassignstringvalue ( ht, NULL, str_osVersionString, NULL, bsversion );
- langassignstringvalue (ht, str_winServicePackNumber, bsservicepack);
+ langassignstringvalue ( ht, NULL, str_winServicePackNumber, NULL, bsservicepack );
- langassignstringvalue (ht, str_osFullNameForDisplay, bsos);
+ langassignstringvalue ( ht, NULL, str_osFullNameForDisplay, NULL, bsos );
- langassignbooleanvalue (ht, str_isCarbon, false); /*7.0b28: isCarbon is false on Windows.*/
+ langAssignBooleanValueBigstring (ht, str_isCarbon, false); /*7.0b28: isCarbon is false on Windows.*/
- langassignbooleanvalue (ht, str_isMacOsClassic, false); /* 2006-02-18 aradke */
+ langAssignBooleanValueBigstring (ht, str_isMacOsClassic, false); /* 2006-02-18 aradke */
- langassignbooleanvalue (ht, str_isServer, isServer); /* 2004-11-19 creedon */
+ langAssignBooleanValueBigstring (ht, str_isServer, isServer); /* 2004-11-19 creedon */
#endif
@@ -399,155 +405,163 @@
#ifdef PIKE
#ifndef OPMLEDITOR
- langassignbooleanvalue (ht, str_isPike, true);
+ langAssignBooleanValueBigstring (ht, str_isPike, true);
- langassignbooleanvalue (ht, str_isRadio, true); /*7.0b37 PBS: system.environment.isRadio*/
- langassignbooleanvalue (ht, str_isOpmlEditor, false); /*2005-04-06 dluebbert: system.environment.isOPML*/
- langassignbooleanvalue (ht, str_isFrontier, false); /*2005-04-06 dluebbert: system.environment.isFrontier*/
+ langAssignBooleanValueBigstring (ht, str_isRadio, true); /*7.0b37 PBS: system.environment.isRadio*/
+ langAssignBooleanValueBigstring (ht, str_isOpmlEditor, false); /*2005-04-06 dluebbert: system.environment.isOPML*/
+ langAssignBooleanValueBigstring (ht, str_isFrontier, false); /*2005-04-06 dluebbert: system.environment.isFrontier*/
#else // OPMLEDITOR
- langassignbooleanvalue (ht, str_isPike, false);
+ langAssignBooleanValueBigstring (ht, str_isPike, false);
- langassignbooleanvalue (ht, str_isRadio, false); /*7.0b37 PBS: system.environment.isRadio*/
- langassignbooleanvalue (ht, str_isOpmlEditor, true); /*2005-04-06 dluebbert: system.environment.isOPML*/
- langassignbooleanvalue (ht, str_isFrontier, false); /*2005-04-06 dluebbert: system.environment.isFrontier*/
+ langAssignBooleanValueBigstring (ht, str_isRadio, false); /*7.0b37 PBS: system.environment.isRadio*/
+ langAssignBooleanValueBigstring (ht, str_isOpmlEditor, true); /*2005-04-06 dluebbert: system.environment.isOPML*/
+ langAssignBooleanValueBigstring (ht, str_isFrontier, false); /*2005-04-06 dluebbert: system.environment.isFrontier*/
#endif // OPMLEDITOR
#else //!PIKE
- langassignbooleanvalue (ht, str_isPike, false);
+ langAssignBooleanValueBigstring (ht, str_isPike, false);
- langassignbooleanvalue (ht, str_isRadio, false); /*7.0b37 PBS: system.environment.isRadio*/
- langassignbooleanvalue (ht, str_isOpmlEditor, false); /*2005-04-06 dluebbert: system.environment.isOPML*/
- langassignbooleanvalue (ht, str_isFrontier, true); /*2005-04-06 dluebbert: system.environment.isFrontier*/
+ langAssignBooleanValueBigstring (ht, str_isRadio, false); /*7.0b37 PBS: system.environment.isRadio*/
+ langAssignBooleanValueBigstring (ht, str_isOpmlEditor, false); /*2005-04-06 dluebbert: system.environment.isOPML*/
+ langAssignBooleanValueBigstring (ht, str_isFrontier, true); /*2005-04-06 dluebbert: system.environment.isFrontier*/
#endif //!PIKE
return (true);
+
} /*initenvironment*/
-static boolean initCharsetsTable (hdlhashtable cSetsTable)
-{
-#if MACVERSION
- OSStatus err;
- ItemCount ct, actual_ct, i;
-
- err = TECCountAvailableTextEncodings( &ct );
- if ( err != noErr ) {
- return (true); // don't kill the whole startup
- }
-
- TextEncoding enc, encOut;
- TextEncoding availEncodings[ ct ];
- bigstring ianaName, displayName;
- unsigned long lenDisplayName;
- RegionCode reg;
-
- err = TECGetAvailableTextEncodings ( availEncodings, ct, &actual_ct );
- if ( err != noErr )
- return (true); // we don't want to kill the whole startup here
-
- for ( i = 0; i < actual_ct; i++ ) {
- enc = availEncodings[ i ];
+static boolean initCharsetsTable (hdlhashtable cSetsTable) {
+
+ #if MACVERSION
+
+ OSStatus err;
+ ItemCount ct, actual_ct, i;
- /*
- get the internet "iana" name for the encoding
- */
- err = TECGetTextEncodingInternetName( enc, ianaName );
- if ( err != noErr )
- continue;
+ err = TECCountAvailableTextEncodings( &ct );
+ if ( err != noErr ) {
+ return (true); // don't kill the whole startup
+ }
- /*
- now convert the "iana" name back into the canonical encoding value
- (more than one encoding will point to the same iana name,
- this makes sure that we use the right one)
- */
- err = TECGetTextEncodingFromInternetName( &enc, ianaName );
- if ( err != noErr )
- continue;
+ TextEncoding enc, encOut;
+ TextEncoding availEncodings[ ct ];
+ bigstring ianaName, displayName;
+ unsigned long lenDisplayName;
+ RegionCode reg;
- /*
- get the encoding's display name, which is the value of the table cell
- */
- err = GetTextEncodingName( enc, kTextEncodingFullName, verUS, kTextEncodingMacRoman, 255, &lenDisplayName, ®, &encOut, (TextPtr) displayName + 1 );
+ err = TECGetAvailableTextEncodings ( availEncodings, ct, &actual_ct );
if ( err != noErr )
- continue;
+ return (true); // we don't want to kill the whole startup here
- displayName[ 0 ] = (unsigned char) lenDisplayName;
+ for ( i = 0; i < actual_ct; i++ ) {
+ enc = availEncodings[ i ];
+
+ /*
+ get the internet "iana" name for the encoding
+ */
+ err = TECGetTextEncodingInternetName( enc, ianaName );
+ if ( err != noErr )
+ continue;
+
+ /*
+ now convert the "iana" name back into the canonical encoding value
+ (more than one encoding will point to the same iana name,
+ this makes sure that we use the ...
[truncated message content] |
|
From: <cre...@us...> - 2007-02-25 02:52:09
|
Revision: 1627
http://svn.sourceforge.net/frontierkernel/?rev=1627&view=rev
Author: creecode
Date: 2007-02-24 18:52:04 -0800 (Sat, 24 Feb 2007)
Log Message:
-----------
support for long odb item names and file paths
formatting tweaks
Modified Paths:
--------------
Frontier/branches/Frontier_Long_File_Paths/Common/source/langipcmenus.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langlist.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langops.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langpack.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langipcmenus.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langipcmenus.c 2007-02-25 01:45:06 UTC (rev 1626)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langipcmenus.c 2007-02-25 02:52:04 UTC (rev 1627)
@@ -203,25 +203,34 @@
*htable = menubartable;
return (menubartable != nil);
+
} /*getmenubartable*/
-static boolean getappmenurecord (long id, hdlmenurecord *hrecord) {
+static boolean getappmenurecord ( long id, hdlmenurecord *hrecord ) {
+
+ //
+ // get the menurecord for the application with the indicated id.
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
- /*
- get the menurecord for the application with the indicated id.
- */
-
+ Handle h;
+ boolean fl;
hdlhashtable lmenubartable;
- bigstring bs;
- if (!getmenubartable (&lmenubartable))
+ if ( ! getmenubartable ( &lmenubartable ) )
return (false);
- ostypetostring (id, bs);
+ osTypeToTextHandle ( id, &h );
- return (menugetmenubar (lmenubartable, bs, false, hrecord));
- } /*getappmenurecord*/
+ fl = menugetmenubar ( lmenubartable, h, false, hrecord );
+
+ disposehandle ( h );
+
+ return ( fl );
+
+ } // getappmenurecord
static boolean buildmenubarstack (hdlmenurecord hmenurecord, short firstmenuid, hdlmenubarstack *hstack) {
@@ -692,37 +701,41 @@
static boolean notifyappvisit (hdlhashnode hnode, ptrvoid refcon) {
-#pragma unused (refcon)
- /*
- if hnode is a menubar that may belong to an application, send the
- updatemenustoken message to that application.
+ #pragma unused (refcon)
- always return true so all table nodes will be visited.
+ //
+ // if hnode is a menubar that may belong to an application, send the
+ // updatemenustoken message to that application.
+ //
+ // always return true so all table nodes will be visited.
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 2.1b13 dmb: under component menusharing, the client might ask for (and
+ // get) its shared menus before we get here. do don't send a
+ // notification if the menubar stack is already built.
+ //
- 2.1b13 dmb: under component menusharing, the client might ask for
- (and get) its shared menus before we get here. do don't send a
- notification if the menubar stack is already built.
- */
-
+ Handle handleKey;
+ hdlmenubarstack hstack;
+ long id;
register hdlhashnode h = hnode;
- bigstring bskey;
- long id;
- hdlmenubarstack hstack;
- if (langexternalgettype ((**h).val) != idmenuprocessor) /*not a menubar value*/
+ if (langexternalgettype ((**h).val) != idmenuprocessor) // not a menubar value
return (true);
- gethashkey (h, bskey);
+ gethashkey ( h, &handleKey );
- if (!stringtoostype (bskey, (OSType *) &id)) /*name longer than 4 characters*/
+ if ( ! textHandleToOsType ( handleKey, ( OSType * ) &id ) ) // name longer than 4 characters
return (true);
- if (!langipcfindmenubarstack (id, &hstack)) /*didn't already get them*/
+ if (!langipcfindmenubarstack (id, &hstack)) // didn't already get them
langipcsendmenumessage (id, idupdatemenus);
return (true);
- } /*notifyappvisit*/
+
+ } // notifyappvisit
boolean langipcmenustartup (void) {
@@ -772,7 +785,11 @@
} /*langipcmenushutdown*/
-static boolean getmenubarid (hdlhashtable htable, const bigstring bs, tyapplicationid *id) {
+static boolean getmenubarid (hdlhashtable htable, const Handle h, tyapplicationid *id) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
hdlhashtable lmenubartable;
@@ -782,36 +799,66 @@
if (htable != lmenubartable)
return (false);
- return (stringtoostype ((ptrstring) bs, id)); /*false if name is longer than 4 characters*/
- } /*getmenubarid*/
+ return ( textHandleToOsType ( h, id ) ); // false if name is longer than 4 characters
+
+ } // getmenubarid
-boolean langipcsymbolchanged (hdlhashtable htable, const bigstring bs, boolean flvalue) {
-#pragma unused(flvalue)
+boolean langipcsymbolchanged ( hdlhashtable htable, const Handle h, boolean flvalue ) {
- tyapplicationid id;
+ #pragma unused(flvalue)
- if (getmenubarid (htable, bs, &id)) {
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+
+ #ifdef MACVERSION
+
+ tyapplicationid id;
- langipcsendmenumessage (id, idupdatemenus);
+ if ( getmenubarid ( htable, h, &id ) ) {
+
+ langipcsendmenumessage (id, idupdatemenus);
+
+ disposemenulist (id); // must rebuild from scratch
+
+ }
- disposemenulist (id); /*must rebuild from scratch*/
- }
+ #endif // MACVERSION
return (true);
- } /*langipcsymbolchanged*/
+
+ } // langipcsymbolchanged
-boolean langipcsymbolinserted (hdlhashtable htable, const bigstring bs) {
+boolean langipcsymbolinserted ( hdlhashtable htable, const Handle h ) {
+
+ #ifdef MACVERSION
- return (langipcsymbolchanged (htable, bs, true));
- } /*langipcsymbolinserted*/
+ return ( langipcsymbolchanged ( htable, h, true ) );
+
+ #endif // MACVERSION
+
+ return ( true ); // all other platforms return true
+
+ } // langipcsymbolinserted
-boolean langipcsymboldeleted (hdlhashtable htable, const bigstring bs) {
+boolean langipcsymboldeleted ( hdlhashtable htable, const Handle h ) {
+
+ #ifdef MACVERSION
- return (langipcsymbolchanged (htable, bs, true));
- } /*langipcsymboldeleted*/
+ return ( langipcsymbolchanged ( htable, h, true ) );
+
+ #endif // MACVERSION
+
+ #ifdef WIN95VERSION
+
+ return ( true );
+
+ #endif // WIN95VERSION
+
+ } // langipcsymboldeleted
boolean langipcmenuinit (void) {
@@ -823,9 +870,6 @@
#endif
return (true);
+
} /*langipcmenuinit*/
-
-
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langlist.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langlist.c 2007-02-25 01:45:06 UTC (rev 1626)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langlist.c 2007-02-25 02:52:04 UTC (rev 1627)
@@ -106,6 +106,7 @@
fl = oppushhandle (hlist, nil, hdata);
return (fl);
+
} /*langpushlisttext*/
@@ -117,30 +118,58 @@
return (false);
return (langpushlisttext (hlist, htext));
+
} /*langpushliststring*/
-boolean langpushlistaddress (hdllistrecord hlist, hdlhashtable ht, bigstring bs) {
+boolean langpushlistaddress ( hdllistrecord hlist, hdlhashtable ht, const Handle h ) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
Handle hdata;
+ boolean fl;
tyvaluerecord val;
- boolean fl;
- if (!setexemptaddressvalue (ht, bs, &val))
+ if (!setexemptaddressvalue (ht, h, &val))
return (false);
-
+
fl = langpackvalue (val, &hdata, HNoNode);
disposevaluerecord (val, true);
if (fl)
fl = oppushhandle (hlist, nil, hdata);
+
+ return (fl);
- return (fl);
} /*langpushlistaddress*/
+boolean langPushListAddressBigstring ( hdllistrecord hlist, hdlhashtable ht, bigstring bs ) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+
+ Handle h;
+ boolean fl;
+
+ if ( ! newtexthandle ( bs, &h ) )
+ return ( false );
+
+ fl = langpushlistaddress ( hlist, ht, h );
+
+ disposehandle ( h );
+
+ return ( fl );
+
+ } // langPushListAddressBigstring
+
+
boolean langpushlistlong (hdllistrecord hlist, long num) {
+
Handle hdata;
tyvaluerecord val;
boolean fl;
@@ -153,46 +182,49 @@
fl = oppushhandle (hlist, nil, hdata);
return (fl);
+
} /*langpushlistlong*/
-static boolean evaluatefield (hdltreenode htree, bigstring key, boolean flformal, tyvaluerecord *itemval) {
-
- /*
- 3/23/93 dmb: htree is a x:y field specification. return the field key,
- and the field data as a descriptor record whose dataHandle is not on the
- temp stack.
+static boolean evaluatefield (hdltreenode htree, Handle *key, boolean flformal, tyvaluerecord *itemval) {
- 02/05/02 dmb: added flformal param and handling
- */
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 2002-02-05 dmb: added flformal param and handling
+ //
+ // 1993-03-23 dmb: htree is a x:y field specification. return the field
+ // key, and the field data as a descriptor record whose
+ // dataHandle is not on the temp stack.
+ //
register hdltreenode h = htree;
+
tyvaluerecord keyval;
assert ((**h).nodetype == fieldop);
if (flformal) {
-
- if (!langgetidentifier ((**h).param1, key))
+
+ if ( ! langgetidentifier ( ( **h ).param1, key ) )
return (false);
}
else {
-
if (!evaluatetree ((**h).param1, &keyval))
return (false);
-
+
if (!coercetostring (&keyval))
return (false);
-
- pullstringvalue (&keyval, key);
-
- disposevaluerecord (keyval, false);
+
+ copyhandle ( keyval.data.stringvalue, key );
+
}
-
+
if (!evaluatetree ((**h).param2, itemval))
return (false);
+
+ return (true);
- return (true);
} /*evaluatefield*/
@@ -231,28 +263,31 @@
boolean makerecordvalue (hdltreenode htree, boolean flformal, tyvaluerecord *vreturned) {
-
- /*
- 4/1/93 dmb: don't cleartmpstack here -- we might be creating a value in
- an expression. just take care of what we create.
- 02/05/02 dmb: added flformal param and handling
- */
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 2002-02-05 dmb: added flformal param and handling
+ //
+ // 1993-04-01 dmb: don't cleartmpstack here -- we might be creating a value
+ // in an expression. just take care of what we create.
+ //
register hdltreenode h;
+
hdllistrecord hlist;
- bigstring key;
+ Handle key;
tyvaluerecord itemval;
if (!opnewlist (&hlist, true))
return (false);
-
+
for (h = htree; h != nil; h = (**h).link) { /*process each expression in the list*/
- if (!evaluatefield (h, key, flformal, &itemval))
+ if (!evaluatefield (h, &key, flformal, &itemval))
goto error;
- if (!langpushlistval (hlist, key, &itemval))
+ if (!langpushlistval (hlist, *key, &itemval))
goto error;
}
@@ -263,25 +298,29 @@
opdisposelist (hlist);
return (false);
+
}
+
} /*makerecordvalue*/
boolean langgetlistitem (const tyvaluerecord *vlist, long ix, ptrstring pkey, tyvaluerecord *vitem) {
-
+
if (getnthlistval ((*vlist).data.listvalue, ix, pkey, vitem))
return (true);
+
+ if (!fllangerror) {
- if (!fllangerror) {
-
tyvaluerecord vindex;
setlongvalue (ix, &vindex);
langarrayreferror (0, pkey, vlist, &vindex);
+
}
+
+ return (false);
- return (false);
} /*langgetlistitem*/
@@ -293,7 +332,7 @@
4/2/93 dmb: next version: 255-char limit for individual items only.
2006-02-20 aradke: rewrite using handlestreams for efficiency.
- also in preparation for revoming the 255-char limit for list items.
+ also in preparation for removing the 255-char limit for list items.
*/
long i, n;
@@ -355,6 +394,7 @@
disposehandlestream (&s);
return (false);
+
} /*listtostring*/
@@ -1162,19 +1202,21 @@
} /*coercetolistposition*/
-boolean listarrayvalue (tyvaluerecord *vlist, bigstring bsname, register tyvaluerecord *vindex, tyvaluerecord *vreturned) {
+boolean listarrayvalue ( tyvaluerecord *vlist, const Handle handleName, register tyvaluerecord *vindex, tyvaluerecord *vreturned ) {
+
+ //
+ // bsname is provided for error reporting only
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
- /*
- bsname is provided for error reporting only
- */
-
- hdllistrecord hlist = (*vlist).data.listvalue;
bigstring key;
boolean fl;
+ hdllistrecord hlist = (*vlist).data.listvalue;
if (!coercetolistposition (vindex))
return (false);
-
+
if ((*vindex).valuetype == longvaluetype)
fl = getnthlistval (hlist, (*vindex).data.longvalue, nil, vreturned);
else {
@@ -1182,50 +1224,57 @@
pullstringvalue (vindex, key);
fl = getnthlistval (hlist, -1, key, vreturned);
+
}
-
+
if (!fl && !fllangerror)
- langarrayreferror (0, bsname, vlist, vindex);
+ langarrayreferror (0, handleName, vlist, vindex);
+
+ return (fl);
- return (fl);
} /*listarrayvalue*/
-boolean listassignvalue (tyvaluerecord *vlist, bigstring bsname, register tyvaluerecord *vindex, tyvaluerecord *vassign) {
+boolean listassignvalue ( tyvaluerecord *vlist, const Handle handleName, register tyvaluerecord *vindex, tyvaluerecord *vassign ) {
+
+ //
+ // bsname is provided for error reporting only
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
- /*
- bsname is provided for error reporting only
- */
-
- hdllistrecord hlist = (*vlist).data.listvalue;
bigstring key;
boolean fl;
+ hdllistrecord hlist = (*vlist).data.listvalue;
if (!coercetolistposition (vindex))
return (false);
if ((*vindex).valuetype == longvaluetype)
fl = setnthlistval (hlist, (*vindex).data.longvalue, nil, vassign);
- else{
-
+ else {
pullstringvalue (vindex, key);
fl = setnthlistval (hlist, -1, key, vassign);
+
}
if (!fl && !fllangerror)
- langarrayreferror (0, bsname, vlist, vindex);
+ langarrayreferror (0, handleName, vlist, vindex);
return (fl);
+
} /*listassignvalue*/
-boolean listdeletevalue (tyvaluerecord *vlist, bigstring bsname, register tyvaluerecord *vindex) {
+boolean listdeletevalue ( tyvaluerecord *vlist, const Handle handleName, register tyvaluerecord *vindex ) {
+
+ //
+ // bsname is provided for error reporting only
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
- /*
- bsname is provided for error reporting only
- */
-
hdllistrecord hlist = (*vlist).data.listvalue;
bigstring key;
boolean fl;
@@ -1243,9 +1292,10 @@
}
if (!fl && !fllangerror)
- langarrayreferror (0, bsname, vlist, vindex);
+ langarrayreferror (0, handleName, vlist, vindex);
return (fl);
+
} /*listdeletevalue*/
@@ -1256,8 +1306,9 @@
static boolean langvisitlistvaluesvisit (Handle hdata, ptrstring bskey, ptrvoid refcon) {
-#pragma unused (bskey)
+ #pragma unused (bskey)
+
/*
2004-11-04 aradke: helper for langvisitlistvalues, called from opvisitlist.
*/
@@ -1292,7 +1343,3 @@
return (opvisitlist (hlist, &langvisitlistvaluesvisit, &info));
} /*langvisitlistvalues*/
-
-
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langops.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langops.c 2007-02-25 01:45:06 UTC (rev 1626)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langops.c 2007-02-25 02:52:04 UTC (rev 1627)
@@ -46,8 +46,6 @@
#include "oplist.h"
-
-
#define minstackspace 0x0800
@@ -58,7 +56,6 @@
//short flextendedsymbolsearch = true; /*see langgetsymbolval*/
-
typedef struct tytypeinfo {
OSType id;
@@ -288,7 +285,9 @@
default:
return (type >= outlinevaluetype); /*virtual external types are heap-allocated*/
+
} /*switch*/
+
} /*langheaptype*/
@@ -316,148 +315,172 @@
*heaphandle = (*val).data.binaryvalue;
return (true);
+
} /*langheapallocated*/
-void langgetwithvaluename (short n, bigstring bswith) {
+void langgetwithvaluename ( short n, Handle *handleWith ) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 1992-08-31 dmb: return the name for the nth with value for a stack
+ // frame.
+ //
+ // n should be 1-based.
+ //
- /*
- 8/31/92 dmb: return the name for the nth with value for a stack frame.
-
- n should be 1-based.
- */
-
bigstring bsint;
- copystring (STR_with, bswith);
+ newtexthandle ( STR_with, handleWith );
- numbertostring (n, bsint);
+ numbertostring ( n, bsint );
- if (stringlength (bsint) < 2)
- pushchar ('0', bswith);
+ if ( stringlength ( bsint ) < 2 )
+ pushcharhandle ( '0', *handleWith );
+
+ pushtexthandle ( bsint, *handleWith );
- pushstring (bsint, bswith);
- } /*langgetwithvaluename*/
+ } // langgetwithvaluename
-boolean langfindsymbol (const bigstring bs, hdlhashtable *htable, hdlhashnode *hnode) {
+boolean langfindsymbol ( const Handle handleName, hdlhashtable *htable, hdlhashnode *hnode ) {
+
+ //
+ // search through the stack of symbol tables until you find one that has
+ // the symbol named by bs defined.
+ //
+ // return with handles to the table it was found in and the hash node that
+ // holds the value of the symbol.
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 5.0.2b6 dmb: caller who sets flfindanyspecialsymbol is asserting that
+ // whatever is being searched for is a special symbol of
+ // sorts, whatever its name might be. so don't require it to
+ // start with an underscore. so, flspecialsymbol really means
+ // just "context free"
+ //
+ // 3.0.3 dmb: sadly, while the above change worked fine, we _sometimes_
+ // need to include the default container in a context-free
+ // (lexically-independent) fashion. so, we introduce the
+ // flfindanyspecialsymbol global. in the default (false) case,
+ // we require the trailing underscore. if set to true
+ // (temporarily), we'll treat any indentifier that starts with
+ // an underscore specially.
+ //
+ // 3.0.2 dmb: to be a "special" symbol that can be seen across lexical
+ // scope, bs must now end with an '_' as well as start with one.
+ // This excludes the default container for object model
+ // expressions, while retaining the current target.
+ //
+ // 1992-12-18 dmb: removed a bit of functionality for the safety of our
+ // users: don't allow "with" statement to create context
+ // for assigning undeclared values.
+ //
+ // 1992-09-14 dmb: set htable to the innermost valid with table or local
+ // table encountered so that new symbols can be placed
+ // there by default. also, fixed with handling so that
+ // tables are visited in the right order -- last to first
+ //
+ // 1992-08-07 dmb: make sure currenthashtable isn't nil before setting
+ // refcon
+ //
+ // 1992-02-12 dmb: implemented lexicalrefcon check to prevent dangerous
+ // dynamic scoping possibilities. specifically, we're
+ // preventing a script from accessing the local variables
+ // in a stack frame that comes from another script object.
+ //
- /*
- search through the stack of symbol tables until you find one that has the
- symbol named by bs defined.
-
- return with handles to the table it was found in and the hash node that
- holds the value of the symbol.
-
- 2/12/92 dmb: implemented lexicalrefcon check to prevent dangerous dynamic
- scoping possibilities. specifically, we're preventing a script from accessing
- the local variables in a stack frame that comes from another script object.
-
- 8/7/92 dmb: make sure currenthashtable isn't nil before setting refcon
-
- 9/14/92 dmb: set htable to the innermost valid with table or local table
- encountered so that new symbols can be placed there by default. also, fixed
- with handling so that tables are visited in the right order -- last to first
-
- 12/18/92 dmb: removed a bit of functionality for the safety of our users: don't
- allow "with" statement to create context for assigning undeclared values.
-
- 3.0.2 dmb: to be a "special" symbol that can be seen across lexical scope, bs
- must now end with an '_' as well as start with one. This excludes the default
- container for object model expressions, while retaining the current target.
-
- 3.0.3 dmb: sadly, while the above change worked fine, we _sometimes_ need to
- include the default container in a context-free (lexically-independent) fashion.
- so, we introduce the flfindanyspecialsymbol global. in the default (false) case,
- we require the trailing underscore. if set to true (temporarily), we'll treat
- any indentifier that starts with an underscore specially.
-
- 5.0.2b6 dmb: caller who sets flfindanyspecialsymbol is asserting that whatever
- is being searched for is a special symbol of sorts, whatever its name might be.
- so don't require it to start with an underscore. so, flspecialsymbol really
- means just "context free"
- */
-
+ register boolean flspecialsymbol = false;
register hdlhashtable h = currenthashtable;
- register long refcon;
- register long lexrefcon;
- register boolean flspecialsymbol = false;
+ register long lexrefcon, refcon;
register short n;
+ *hnode = nil;
*htable = nil;
- *hnode = nil;
-
if (h == nil)
return (false);
+
+ // maybe treat as context-free
- /*maybe treat as context-free*/
- flspecialsymbol = flfindanyspecialsymbol || ((bs [1] == '_') && (lastchar (bs) == '_'));
-
+ flspecialsymbol = flfindanyspecialsymbol || ( ( textHandleFirstChar ( handleName ) == '_' ) &&
+ ( textHandleLastChar ( handleName ) == '_' ) );
+
refcon = (**h).lexicalrefcon;
- while (true) { /*chain through each linked hash table*/
-
- if (h == nil) /*symbol not defined*/
+ while (true) { // chain through each linked hash table
+
+ if (h == nil) // symbol not defined
return (false);
-
- //assert (validhandle ((Handle) h));
+
+ // assert (validhandle ((Handle) h));
lexrefcon = (**h).lexicalrefcon;
if ((!(**h).fllocaltable) || flspecialsymbol || (refcon == 0) || (lexrefcon == refcon) || (lexrefcon == 0)) {
+
+ if ( hashtablelookupnode ( h, handleName, hnode ) ) { // symbol is defined in htable
- if (hashtablelookupnode (h, bs, hnode)) { /*symbol is defined in htable*/
-
*htable = h;
return (true);
+
}
+
+ for (n = (**h).ctwithvalues; n > 0; --n) { // scan with values
- for (n = (**h).ctwithvalues; n > 0; --n) { /*scan with values*/
-
+ Handle handleWith;
+ hdlhashnode hnode2;
+ hdlhashtable hwith;
tyvaluerecord valwith;
- hdlhashtable hwith;
- bigstring bswith;
- hdlhashnode hnode2;
- langgetwithvaluename (n, bswith);
+ langgetwithvaluename ( n, &handleWith );
- if (!hashtablelookup (h, bswith, &valwith, &hnode2)) /*missing with value; keep going*/
+ if ( ! hashtablelookup ( h, handleWith, &valwith, &hnode2 ) ) // missing with value; keep going
continue;
+
+ disposehandle ( handleWith );
- if (!getaddressvalue (valwith, &hwith, bswith)) /*error*/
+ if ( ! getaddressvalue ( valwith, &hwith, &handleWith ) ) // error
return (false);
+
+ if ( ! isemptyhandle ( handleWith ) ) { // not encoded as expected
- if (!isemptystring (bswith)) { // not encoded as expected
-
- if (!hashtablelookup (hwith, bswith, &valwith, &hnode2))
+ if (!hashtablelookup (hwith, handleWith, &valwith, &hnode2))
return (false);
-
+
if (!langexternalvaltotable (valwith, &hwith, hnode2))
return (false);
}
-
- if (hashtablelookupnode (hwith, bs, hnode)) { /*found symbol*/
+ disposehandle ( handleWith );
+
+ if (hashtablelookupnode (hwith, handleName, hnode)) { // found symbol
+
*htable = hwith;
return (true);
+
}
+
+ // 12/18/92 dmb
+ // if (*htable == nil) // this is the innermost with value -- return to caller
+ // *htable = hwith;
+ //
- /*12/18/92 dmb
- if (*htable == nil) /%this is the innermost with value -- return to caller%/
- *htable = hwith;
- */
}
-
- if (*htable == nil) /*this is the innermost local table -- return to caller*/
+
+ if (*htable == nil) // this is the innermost local table -- return to caller
*htable = h;
}
+
+ h = (**h).prevhashtable;
- h = (**h).prevhashtable;
- } /*while*/
- } /*langfindsymbol*/
+ } // while
+
+ } // langfindsymbol
/*
@@ -480,125 +503,138 @@
*/
-boolean langgetsymbolval (const bigstring bs, tyvaluerecord *vreturned, hdlhashnode *hnode) {
+boolean langgetsymbolval ( const Handle h, tyvaluerecord *vreturned, hdlhashnode *hnode ) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 2003-05-18 AR: Disabled special check for fllocaltable to prevent the
+ // address of a value in a local table to resolve to the
+ // root table if the value is actually named "root". This
+ // could potentially cause top-level tables in Frontier.root
+ // to be overwritten unintentionally. It's not clear what
+ // purpose this check was meant to serve in the first place.
+ //
+ // 1991-06-13 dmb: moved special-case check for root table in from
+ // langsymbolreference
+ //
- /*
- 6/13/91 dmb: moved special-case check for root table in from langsymbolreference
-
- 2003-05-18 AR: Disabled special check for fllocaltable to prevent the address of a value
- in a local table to resolve to the root table if the value is actually named "root".
- This could potentially cause top-level tables in Frontier.root to be overwritten unintentionally.
- It's not clear what purpose this check was meant to serve in the first place.
- */
-
hdlhashtable htable;
-// hdlhashnode hnode;
- if (langfindsymbol (bs, &htable, hnode)) {
+ if ( langfindsymbol ( h, &htable, hnode)) {
*vreturned = (***hnode).val;
return (true);
+
}
- if (equalstrings (bs, nameroottable)) {
-
+ if ( textHandleEqualsBigstring ( h, nameroottable, false ) ) {
+
if ((currenthashtable == roottable) || (currenthashtable == nil) /* || ((**currenthashtable).fllocaltable) */) {
setexternalvalue (rootvariable, vreturned);
return (true);
+
}
}
+
+ return (false);
- return (false);
} /*langgetsymbolval*/
-boolean langsetsymbolval (const bigstring bs, tyvaluerecord val) {
+boolean langsetsymbolval ( const Handle h, tyvaluerecord val ) {
+
+ //
+ // if the symbol is defined in one of the chain of symbol tables, then
+ // assign the value.
+ //
+ // if the symbol isn't defined anywhere, create a new symbol with the name
+ // in the most global symbol table. this is where automatic declaration of
+ // variables is implemented.
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 5.0a18 dmb: require declarations! (if user's pref is set)
+ //
+ // 1992-09-14 dmb: see comment in langfindsymbol; if htable is non-nil, it
+ // is now valid even when false is returned.
+ //
+ // 1990-07-10 DW: instead of allocating automatic variables in the most-
+ // global table, allocate them in the most-local table. see
+ // comment at the head of evaluatelist.
+ //
- /*
- if the symbol is defined in one of the chain of symbol tables, then
- assign the value.
-
- if the symbol isn't defined anywhere, create a new symbol with the
- name in the most global symbol table. this is where automatic
- declaration of variables is implemented.
-
- 7/10/90 DW: instead of allocating automatic variables in the most-
- global table, allocate them in the most-local table. see comment
- at the head of evaluatelist.
-
- 9/14/92 dmb: see comment in langfindsymbol; if htable is non-nil, it
- is now valid even when false is returned.
-
- 5.0a18 dmb: require declarations! (if user's pref is set)
- */
-
hdlhashtable htable;
hdlhashnode hnode;
if (false && langgetuserflag (idrequiredeclarationsscript, false)) {
- if (langfindsymbol (bs, &htable, &hnode) || (htable != nil)) { /*name is defined, or with statement set table*/
-
- return (hashtableassign (htable, bs, val));
- }
+ if ( langfindsymbol ( h, &htable, &hnode ) || ( htable != nil ) ) // name is defined, or with statement set table
+ return ( hashtableassign ( htable, h, val ) );
- langparamerror (unknownidentifiererror, bs);
+ langparamerror ( unknownidentifiererror, h );
- return (false);
+ return ( false );
+
}
else {
-
- if (langfindsymbol (bs, &htable, &hnode) || (htable != nil)) { /*name is defined, or with statement set table*/
+ if ( langfindsymbol ( h, &htable, &hnode ) || ( htable != nil ) ) // name is defined, or with statement set table
+ return ( hashtableassign ( htable, h, val ) );
- return (hashtableassign (htable, bs, val));
- }
+ return ( hashassign ( h, val ) );
- return (hashassign (bs, val));
}
- } /*langsetsymbolval*/
+
+ } // langsetsymbolval
-boolean langsetsymboltableval (hdlhashtable htable, const bigstring bs, tyvaluerecord val) {
+boolean langsetsymboltableval ( hdlhashtable htable, const Handle h, tyvaluerecord val ) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
boolean fl;
pushhashtable (htable);
- fl = langsetsymbolval (bs, val);
+ fl = langsetsymbolval ( h, val );
pophashtable ();
return (fl);
+
} /*langsetsymboltableval*/
-boolean langsetstringval (const bigstring bsname, const bigstring bsval) {
+boolean langsetstringval ( const Handle handleName, const Handle handleValue ) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
tyvaluerecord val;
- Handle htext;
initvalue (&val, stringvaluetype);
- if (!newtexthandle (bsval, &htext))
+ val.data.stringvalue = handleValue;
+
+ if ( ! langsetsymbolval ( handleName, val ) )
return (false);
-
- val.data.stringvalue = htext;
-
- if (!langsetsymbolval (bsname, val)) {
- disposehandle (htext);
-
- return (false);
- }
+ return (true);
- return (true);
} /*langsetstringval*/
-boolean langsetbinaryval (hdlhashtable htable, const bigstring bsname, Handle x) {
+boolean langsetbinaryval ( hdlhashtable htable, const Handle handleName, Handle x ) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
tyvaluerecord val;
@@ -606,7 +642,7 @@
val.data.binaryvalue = x;
- if (!langsetsymboltableval (htable, bsname, val)) {
+ if ( ! langsetsymboltableval ( htable, handleName, val ) ) {
disposehandle (x);
@@ -614,6 +650,7 @@
}
return (true);
+
} /*langsetbinaryval*/
@@ -631,57 +668,109 @@
val.data.stringvalue = h;
- if (!hashtableassign (ht, bs, val))
+ if (!hashtableassignstring (ht, bs, val))
return (false);
return (true);
+
} /*hashtableassignstringhandle*/
+boolean langassignstringvalue ( hdlhashtable ht, const Handle handleNameInput,
+ const bigstring bsNameInput, const Handle handleValueInput,
+ const bigstring bsValueInput ) {
-boolean langassignstringvalue (hdlhashtable ht, const bigstring bs, const bigstring bsval) {
+ //
+ // efficient way to do this operation; no tmpstack overhead.
+ //
+ // note: very similar to langsetstringval, but w/out the symbol lookup logic
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
- /*
- efficient way to do this operation; no tmpstack overhead.
+ Handle handleName = NULL, handleValue = NULL;
+ boolean fl = false;
+ tyvaluerecord val;
- note: very similar to langsetstringval, but w/out the symbol lookup logic
- */
+ if ( ( handleNameInput == NULL ) && ( bsNameInput == NULL ) )
+ return ( false );
+
+ if ( ( handleValueInput == NULL ) && ( bsValueInput == NULL ) )
+ return ( false );
+
+ /* setup handleName */ {
- tyvaluerecord val;
- Handle htext;
+ if ( handleNameInput != NULL )
+ handleName = handleNameInput;
+ else
+ if ( ! newtexthandle ( bsNameInput, &handleName ) )
+ return ( false );
+ }
+
+ /* setup handleValue */ {
- initvalue (&val, stringvaluetype);
+ if ( handleValueInput != NULL )
+ handleValue = handleValueInput;
+ else
+ if ( ! newtexthandle ( bsValueInput, &handleValue ) )
+ goto exit;
+ }
+
+ initvalue ( &val, stringvaluetype );
- if (!newtexthandle (bsval, &htext))
- return (false);
+ val.data.stringvalue = handleValue;
- val.data.stringvalue = htext;
+ if ( ! hashtableassign ( ht, handleName, val ) )
+ goto exit;
+
+ fl = true;
- if (!hashtableassign (ht, bs, val)) {
+ exit:
+
+ disposehandle ( handleName );
- disposehandle (htext);
+ return ( fl );
+
+ } // langassignstringvalue
+
+
+boolean langassignbooleanvalue ( hdlhashtable ht, const Handle h, boolean flval ) {
+
+ //
+ // could be useful...
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+
+ tyvaluerecord val;
+
+ setbooleanvalue (flval, &val);
+
+ if ( ! hashtableassign ( ht, h, val ) )
+ return ( false );
- return (false);
- }
+ return ( true );
- return (true);
- } /*langassignstringvalue*/
+ } // langassignbooleanvalue
-boolean langassignbooleanvalue (hdlhashtable ht, const bigstring bs, boolean flval) {
+boolean langAssignBooleanValueBigstring ( hdlhashtable ht, const bigstring bs, boolean flval ) {
+
+ Handle h;
+ boolean fl;
- /*
- could be useful...
- */
+ if ( ! newtexthandle ( bs, &h ) )
+ return ( false );
+
+ fl = langassignbooleanvalue ( ht, h, flval );
- tyvaluerecord val;
+ disposehandle ( h );
- setbooleanvalue (flval, &val);
+ return ( fl );
- return (hashtableassign (ht, bs, val));
- } /*langassignbooleanvalue*/
+ }
+
-
boolean langassigncharvalue (hdlhashtable ht, const bigstring bs, unsigned char ch) {
/*
@@ -692,128 +781,212 @@
setcharvalue (ch, &val);
- return (hashtableassign (ht, bs, val));
+ return (hashtableassignstring (ht, bs, val));
} /*langassigncharvalue*/
-boolean langassignlongvalue (hdlhashtable ht, const bigstring bs, long x) {
+boolean langassignlongvalue ( hdlhashtable ht, const bigstring bs, long x ) {
+
+ //
+ // might as well!
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
- /*
- might as well!
- */
-
+ Handle h;
tyvaluerecord val;
- setlongvalue (x, &val);
+ setlongvalue ( x, &val );
- return (hashtableassign (ht, bs, val));
- } /*langassignbooleanvalue*/
-
-
-boolean langassignaddressvalue (hdlhashtable ht, const bigstring bs, const tyaddress *adr) {
+ if ( ! newtexthandle ( bs, &h ) )
+ return ( false );
- /*
- efficient way to do this operation; no tmpstack overhead.
+ if ( ! hashtableassign ( ht, h, val ) ) {
- 6.1d4 AR: Modified to no longer use tmpstack (which it did, previously)
- by cribbing some code from setaddressvalue.
- */
+ disposehandle ( h );
+
+ return ( false );
+
+ }
+
+ return ( true );
- tyvaluerecord val;
- hdlstring hstring;
-
- if (!newheapstring ((*adr).bs, &hstring))
- return (false);
-
- if (!enlargehandle ((Handle) hstring, sizeof ((*adr).ht), (void *) &(*adr).ht)) {
+ } // langassignlongvalue
- disposehandle ((Handle) hstring);
- return (false);
- }
+boolean langassignaddressvalue (hdlhashtable ht, const Handle h, const tyaddress *adr) {
+
+ //
+ // efficient way to do this operation; no tmpstack overhead.
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 6.1d4 AR: Modified to no longer use tmpstack (which it did, previously)
+ // by cribbing some code from setaddressvalue.
+ //
- initvalue (&val, addressvaluetype);
+ tyvaluerecord val;
- val.data.addressvalue = hstring;
+ setexemptaddressvalue ( ( *adr ).ht, ( *adr ).h, &val );
- if (!hashtableassign (ht, bs, val)) {
+ if (!hashtableassign (ht, h, val)) {
disposevaluerecord (val, false);
return (false);
+
}
return (true);
+
} /*langassignaddressvalue*/
-boolean langassignnewtablevalue (hdlhashtable ht, const bigstring bs, hdlhashtable *newtable) {
+boolean langAssignAddressValueBigstring ( hdlhashtable ht, const bigstring bs, const tyaddress *adr ) {
+
+ //
+ // 2007-02-24 creedon: created
+ //
- /*
- create a new, empty table and assign it to the given table/name in the database
- */
+ Handle h;
+ boolean fl;
+ if ( ! newtexthandle ( bs, &h ) )
+ return ( false );
+
+ fl = langassignaddressvalue ( ht, h, adr );
+
+ disposehandle ( h );
+
+ return ( fl );
+
+ } // langAssignAddressValueBigstring
+
+
+boolean langassignnewtablevalue (hdlhashtable ht, const Handle h, hdlhashtable *newtable) {
+
+ //
+ // create a new, empty table and assign it to the given table/name in the
+ // database
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+
tyvaluerecord val;
if (!tablenewtablevalue (newtable, &val))
return (false);
- if (!hashtableassign (ht, bs, val)) {
+ if ( ! hashtableassign ( ht, h, val ) ) {
disposevaluerecord (val, false);
return (false);
+
}
(***newtable).fllocaltable = (**ht).fllocaltable;
return (true);
+
} /*langassignnewtablevalue*/
-boolean langsuretablevalue (hdlhashtable ht, const bigstring bs, hdlhashtable *htable) {
+boolean langAssignNewTableValueBigstring ( hdlhashtable ht, const bigstring bs, hdlhashtable *newtable ) {
- /*
- 5.1.4 dmb: if the cell has a table, return it. otherwise, create a new table,
- assign it, and return it.
- */
+ //
+ // 2007-02-24 creedon: created
+ //
+ Handle h;
+ boolean fl;
+
+ if ( ! newtexthandle ( bs, &h ) )
+ return ( false );
+
+ fl = langassignnewtablevalue ( ht, h, newtable );
+
+ disposehandle ( h );
+
+ return ( fl );
+
+ } // langAssignNewTableValueBigstring
+
+
+boolean langsuretablevalue ( hdlhashtable ht, const Handle h, hdlhashtable *htable ) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 5.1.4 dmb: if the cell has a table, return it. otherwise, create a new
+ // table, assign it, and return it.
+ //
+
tyvaluerecord val;
hdlhashnode hnode;
- if (hashtablelookup (ht, bs, &val, &hnode))
+ if (hashtablelookup (ht, h, &val, &hnode))
if (langexternalvaltotable (val, htable, hnode))
return (true);
- return (langassignnewtablevalue (ht, bs, htable));
+ return ( langassignnewtablevalue ( ht, h, htable ) );
+
} /*langsuretablevalue*/
+boolean langSureTableValueBigstring ( hdlhashtable ht, const bigstring bs, hdlhashtable *htable ) {
+
+ //
+ // 2007-02-24 creedon: created
+ //
+
+ Handle h;
+ boolean fl;
+
+ if ( ! newtexthandle ( bs, &h ) )
+ return ( false );
+
+ fl = langsuretablevalue ( ht, h, htable );
+
+ disposehandle ( h );
+
+ return ( fl );
+
+ } // langSureTableValueBigstring
+
+
#ifndef odbengine
boolean langgetvalsize (tyvaluerecord v, long *size) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 2.1b3 dmb: expand filespec to string to avoid breaking 2.0 scripts
+ //
+ // 1993-04-26 dmb: count tree nodes
+ //
- /*
- 4/26/93 dmb: count tree nodes
-
- 2.1b3 dmb: expand filespec to string to avoid breaking 2.0 scripts
- */
-
register long x;
switch (v.valuetype) {
+
+ case addressvaluetype: {
- case addressvaluetype: {
- bigstring bs;
+ Handle h;
- getaddresspath (v, bs);
+ getaddresspath ( v, &h );
- x = stringlength (bs);
+ x = gethandlesize ( h );
+ disposehandle ( h );
+
break;
+
}
case booleanvaluetype:
+
x = longsizeof (v.data.flvalue);
break;
@@ -867,23 +1040,27 @@
break;
case filespecvaluetype: {
- bigstring bs;
+
+ Handle path;
- if (filespectopath (*v.data.filespecvalue, bs))
- x = stringlength (bs);
+ if ( filespectopath ( *v.data.filespecvalue, &path ) )
+ x = gethandlesize ( path );
else
- x = gethandlesize ((Handle) v.data.filespecvalue);
+ x = gethandlesize ( ( Handle ) v.data.filespecvalue );
+ disposehandle ( path );
+
break;
+
}
#if defined(__powerc) || defined(WIN95VERSION)
case doublevaluetype:
+
x = sizeof (extended80);
break;
-
#else
case doublevaluetype:
#endif
@@ -943,18 +1120,36 @@
#endif
+
boolean langgetstringlist (short id, bigstring bs) {
return (getstringlist (langinterfacelist, id, bs));
+
} /*langgetstringlist*/
-boolean langgetmiscstring (short id, bigstring bs) {
+boolean langgetmiscstring ( short id, bigstring bsString, Handle *handleString ) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
- return (getstringlist (langmiscstringlist, id, bs));
- } /*langgetmiscstring*/
+ bigstring bs;
+
+ getstringlist ( langmiscstringlist, id, bs );
+ if ( bsString != NULL )
+ copystring ( bs, bsString );
+
+ if ( handleString != NULL )
+ if ( ! newtexthandle ( bs, handleString ) )
+ return ( false );
+
+ return ( true );
+
+ } // langgetmiscstring
+
boolean langcheckstacklimit (tystackid idstack, short topstack, short maxstack) {
/*
@@ -968,9 +1163,10 @@
getstringlist (langstacklist, idstack, bsstack);
- langparamerror (stackoverflowerror, bsstack);
+ langParamErrBs ( stackoverflowerror, bsstack);
return (false);
+
} /*langcheckstacklimit*/
#if !odbengine
@@ -1006,86 +1202,104 @@
else
langgetstringlist (useaddressoperatorstring, bsscriptextra);
- lang2paramerror (errornum, bstype, bsscriptextra);
+ lang2ParamErrBs ( errornum, bstype, bsscriptextra);
+
} /*langbadexternaloperror*/
#if !odbengine
-void langarrayreferror (short stringnum, bigstring bsname, const tyvaluerecord *valarray, tyvaluerecord *valindex) {
+
+void langarrayreferror ( short stringnum, const Handle handleName, const tyvaluerecord *valarray, tyvaluerecord *valindex ) {
+
+ //
+ // valindex is nil, the error is trying to treat valarray as an array in
+ // the 1st place.
+ //
+ // otherwise, it's a bad name or item number
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
- /*
- valindex is nil, the error is trying to treat valarray as an array in the 1st place.
-
- otherwise, it's a bad name or item number
- */
-
+ Handle handleIndex, handleType;
bigstring bstype;
- bigstring bsindex;
hashgettypestring (*valarray, bstype);
+ newtexthandle ( bstype, &handleType );
+
if (valindex == nil) {
-
+
stringnum = arraynottableerror;
- setemptystring (bsindex);
+ newemptyhandle ( &handleIndex );
+
}
else {
+
switch ((*valindex).valuetype) {
case intvaluetype:
case longvaluetype:
+
stringnum = arrayindexerror;
break;
+
+ default:
- default:
stringnum= arraystringindexerror;
}
-
+
coercetostring (valindex);
- pullstringvalue (valindex, bsindex);
+ copyhandle ( ( *valindex ).data.stringvalue, &handleIndex );
+
}
-
- if (bsname == nil)
- lang3paramerror (stringnum, emptystring, bstype, bsindex);
+
+ if (handleName == nil)
+ lang3paramerror ( stringnum, NULL, handleType, handleIndex );
else
- lang3paramerror (stringnum, bsname, bstype, bsindex);
-
+ lang3paramerror ( stringnum, handleName, handleType, handleIndex );
+
+ disposehandle ( handleIndex );
+ disposehandle ( handleType );
+
} /*langarrayreferror*/
+
#endif
-boolean langgetuserflag (short idscript, boolean fldefault) {
+boolean langgetuserflag ( short idscript, boolean fldefault ) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 5.0a18 dmb: make sure table globals are set up; fixed crashing bug.
+ //
- /*
- 5.0a18 dmb: make sure table globals are set up; fixed crashing bug.
- */
-
- bigstring bspref;
- hdlhashtable htable;
+ Handle h, handlePreference;
bigstring bs;
- tyvaluerecord val;
boolean fl;
hdlhashnode hnode;
+ hdlhashtable htable;
+ tyvaluerecord val;
- if (roottable == nil)
- return (fldefault);
+ if ( roottable == nil )
+ return ( fldefault );
- getsystemtablescript (idscript, bspref);
+ getsystemtablescript ( idscript, bs );
+ if ( ! newtexthandle ( bs, &handlePreference ) )
+ return ( false );
+
+ if ( ! newemptyhandle ( &h ) )
+ return ( false );
+
disablelangerror ();
pushhashtable (roottable);
- if (
- langexpandtodotparams (bspref, &htable, bs) &&
-
- hashtablelookup (htable, bs, &val, &hnode) &&
-
- copyvaluerecord (val, &val) && coercetoboolean (&val)
- )
-
+ if ( langexpandtodotparams ( handlePreference, &htable, &h ) && hashtablelookup ( htable, h, &val, &hnode ) &&
+ copyvaluerecord ( val, &val ) && coercetoboolean ( &val ) )
fl = val.data.flvalue;
else
fl = fldefault;
@@ -1094,8 +1308,11 @@
enablelangerror ();
+ disposehandle ( h );
+
return (fl);
- } /*langgetuserflag*/
+
+ } // langgetuserflag
boolean langsetuserflag (short idscript, boolean fl) {
@@ -1122,46 +1339,53 @@
} /*langsetuserflag*/
-boolean langgetthisaddress (hdlhashtable *htable, bigstring bsthis) {
+boolean langgetthisaddress ( hdlhashtable *htable, Handle *handleThis ) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 5.0a18 dmb: find the current lexical address. right now, we're sticking
+ // this in stack frames when necessary. but we could also make
+ // "this" a magic value that is calculated when referenced;
+ // idvalue would call this function
+ //
- /*
- 5.0a18 dmb: find the current lexical address. right now, we're sticking
- this in stack frames when necessary. but we could also make "this" a magic
- value that is calculated when referenced; idvalue would call this function
- */
+ register hdlerrorstack hs = langcallbacks.scripterrorstack;
- register hdlerrorstack hs = langcallbacks.scripterrorstack;
tyerrorrecord *pe;
if ((hs == nil) || ((**hs).toperror == 0))
return (false);
-
+
pe = &(**hs).stack [(**hs).toperror - 1];
if ((*pe).errorcallback == nil)
return (false);
+
+ return ( ( *( *pe ).errorcallback ) ( ( *pe ).errorrefcon, 0, 0, htable, handleThis ) );
- return ((*(*pe).errorcallback) ((*pe).errorrefcon, 0, 0, htable, bsthis));
} /*langgetthisaddress*/
-boolean langsetthisvalue (hdlhashtable hlocaltable, hdlhashtable htable, bigstring bsname) {
+boolean langsetthisvalue ( hdlhashtable hlocaltable, hdlhashtable htable, const Handle handleName ) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 5.0a18 dmb: new feature: this. it remains to be seen whether or not
+ // we're setting it whereever we need it. another alternative
+ // is to calculate it when refererenced, in idvalue, based on
+ // the errorcallback stack
+ //
- /*
- 5.0a18 dmb: new feature: this. it remains to be seen whether or not
- we're setting it whereever we need it. another alternative is to
- calculate it when refererenced, in idvalue, based on the errorcallback
- stack
- */
-
#ifdef version5orgreater
tyvaluerecord val;
- if (!setaddressvalue (htable, bsname, &val))
+ if ( ! setaddressvalue ( htable, handleName, &val ) )
return (false);
- if (!hashtableassign (hlocaltable, STR_this, val))
+ if (!hashtableassignstring ( hlocaltable, STR_this, val ) )
return (false);
exemptfromtmpstack (&val);
@@ -1169,72 +1393,135 @@
#endif
return (true);
+
} /*langsetthisvalue*/
boolean langbuildnamelist (hdltreenode htree, hdllistrecord hlist) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 5.0.2b8 dmb: new routine. recursively build an ordered list of names
+ // from the dotparams in the code tree. similar, but more
+ // limited, than langgetdotparams
+ //
- /*
- 5.0.2b8 dmb: new routine. recursively build an ordered list of
- names from the dotparams in the code tree. similar, but more
- limited, than langgetdotparams
- */
+ Handle handleName = NULL;
- bigstring bsname;
-
switch ((**htree).nodetype) {
case identifierop:
case bracketop:
- if (!langgetidentifier (htree, bsname))
+
+ if (!langgetidentifier (htree, &handleName))
return (false);
- return (langpushliststring (hlist, bsname));
+ return ( langpushlisttext ( hlist, handleName ) );
case dotop:
+
if (!langbuildnamelist ((**htree).param1, hlist))
return (false);
- if (!langgetidentifier ((**htree).param2, bsname))
- return (false);
+ if ( ! langgetidentifier ( ( **htree ).param2, &handleName ) )
+ return ( false );
- return (langpushliststring (hlist, bsname));
+ return ( langpushlisttext ( hlist, handleName ) );
default:
+
langlongparamerror (unexpectedopcodeerror, (**htree).nodetype);
return (false);
- }
+ }
+
} /*buildnamelist*/
-boolean langfastaddresstotable (hdlhashtable hstart, bigstring bsaddress, hdlhashtable *htable) {
+boolean langfastaddresstotable ( hdlhashtable hstart, const Handle handleAddress, const bigstring bsAddress, hdlhashtable *htable ) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 5.0.2 dmb: super-fast lookup of a table, given a simple path starting
+ // from the given table. no periods are allowed in any item
+ // name; no square brackets are used.
+ //
- /*
- 5.0.2 dmb: super-fast lookup of a table, given a simple path starting from the
- given table. no periods are allowed in any item name; no square brackets are used.
- */
+ Handle h, handleField;
+ boolean fl = false;
+ hdlhashnode hnode;
+ hdlhashtable ht = hstart;
+ short i;
+ tyvaluerecord val;
+ if ( ( handleAddress == NULL ) && ( bsAddress == NULL ) )
+ return ( false );
+
+ if ( handleAddress != NULL )
+ copyhandle ( handleAddress, &h );
+ else
+ if ( ! newtexthandle ( bsAddress, &h ) )
+ return ( false );
+
+ for ( i = 1; getNthFieldTextHandle ( h, i, '.', false, &handleField ); ++i ) {
+
+ if ( ! hashtablelookup ( ht, handleField, &val, &hnode ) || ! langexternalvaltotable ( val, &ht, hnode ) ) {
+
+ langparamerror ( nosuchtableerror, handleField );
+
+ goto exit;
+
+ } // if
+
+ disposehandle ( handleField );
+
+ } // for
+
+ *htable = ht;
+
+ fl = true;
+
+ exit:
+
+ disposehandle ( h );
+ disposehandle ( handleField );
+
+ return ( fl );
+
+ } // langfastaddresstotable
+
+
+/* boolean langfastaddresstotable ( hdlhashtable hstart, const Handle handleAddress, hdlhashtable *htable ) {
+
+ //
+ // 5.0.2 dmb: super-fast lookup of a table, given a simple path starting from the
+ // given table. no periods are allowed in any item name; no square brackets are used.
+ //
+
+ Handle h;
+ hdlhashnode hnode;
+ hdlhashtable ht = hstart;
+ short i;
tyvaluerecord val;
- short i;
- bigstring bs;
- hdlhashtable ht = hstart;
- hdlhashnode hnode;
- for (i = 1; nthword (bsaddress, i, '.', bs); ++i) {
+ for ( i = 1; getNthFieldTextHandle ( handleAddress, i, '.', false, &h ); ++i ) {
+
+ if ( ! hashtablelookup ( ht, h, &val, &hnode ) || ! langexternalvaltotable ( val, &ht, hnode ) ) {
- if (!hashtablelookup (ht, bs, &val, &hnode) || !langexternalvaltotable (val, &ht, hnode)) {
+ langparamerror ( nosuchtableerror, h);
- langparamerror (nosuchtableerror, bs);
+ return (false);
- return (false);
- }
- }
-
+ } // if
+ } // for
+
*htable = ht;
return (true);
- } /*langfastaddresstotable*/
+
+ } // langfastaddresstotable */
boolean langvaltocode (tyvaluerecord *vcode, hdltreenode *hcode) {
@@ -1262,31 +1549,52 @@
boolean langfollowifaddressvalue (tyvaluerecord *v) {
- /*
- 1/15/02 dmb: new function. return true if we successfully follow an addres.
- */
-
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 1902-01-15 dmb: new function. return true if we successfully follow an
+ // address.
+ //
+
+ Handle h;
+ boolean fl;
+ hdlhashnode hnode;
hdlhashtable ht;
- bigstring bs;
- hdlhashnode hnode;
- boolean fl;
-
+
if ((*v).valuetype != addressvaluetype)
return (false);
- if (!getaddressvalue ((*v), &ht, bs))
+ if ( ! getaddressvalue ( (*v ), &ht, &h ) )
return (false);
-
+
disablelangerror ();
-
- fl = langhashtablelookup (ht, bs, v, &hnode);
-
+
+ fl = langhashtablelookup (ht, h, v, &hnode);
+
enablelangerror ();
-
+
return (fl);
+
} /*langfollowifaddressvalue*/
+boolean langSetStringValueFromBigstring ( const Handle name, const bigstring value ) {
+ //
+ // 2007-01-01 creedon: created, cribbed from langsetstringval function
+ //
+
+ tyvaluerecord val;
+
+ initvalue ( &val, stringvaluetype );
+
+ if ( ! newtexthandle ( value, &val.data.stringvalue ) )
+ return ( false );
+
+ if ( ! langsetsymbolval ( name, val ) )
+ return ( false );
+
+ return (true);
+
+ } // langSetStringValueFromBigstring
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langpack.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langpack.c 2007-02-25 01:45:06 UTC (rev 1626)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langpack.c 2007-02-25 02:52:04 UTC (rev 1627)
@@ -105,19 +105,23 @@
boolean langpackvalue (tyvaluerecord val, Handle *h, hdlhashnode hnode) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 2006-04-20 sethdill & aradke: convert rgb values from native byte order
+ // to big-endian
+ //
+ // 5.0.2b10 dmb: don't disable langerror when getting an address path.
+ //
+ // 1993-04-08 dmb: save/restore hdlpackedvalue to allow reentrancy needed for code values
+ //
- /*
- 4/8/93 dmb: save/restore hdlpackedvalue to allow reentrancy needed for code values
+ register boolean fl;
- 5.0.2b10 dmb: don't disable langerror when getting an address path.
-
- 2006-04-20 sethdill & aradke: convert rgb values from native byte order to big-endian
- */
-
- register boolean fl;
+ Handle hdata;
+ hdlpackedvalue hpackedvalue;
typackedvalue header;
- hdlpackedvalue hpackedvalue;
- Handle hdata;
/*
copystring (signaturestring, header.sigbytes); /%prevents crashes on bad data%/
@@ -135,23 +139,27 @@
switch (val.valuetype) {
case novaluetype:
+
fl = true; /*nothing to pack*/
break;
case booleanvaluetype:
+
fl = langpackdata (sizeof (val.data.flvalue), &val.data.flvalue, hpackedvalue);
break;
case charvaluetype:
case directionvaluetype:
+
fl = langpackdata (sizeof (val.data.chvalue), &val.data.chvalue, hpackedvalue);
break;
case intvaluetype:
case tokenvaluetype:
+
memtodiskshort (val.data.intvalue);
fl = langpackdata (sizeof (val.data.intvalue), &val.data.intvalue, hpackedvalue);
@@ -162,55 +170,56 @@
case ostypevaluetype:
case enumvaluetype:
case fixedvaluetype:
+
memtodisklong (val.data.longvalue);
fl = langpackdata (sizeof (val.data.longvalue), &val.data.longvalue, hpackedvalue);
break;
+
+ case pointvaluetype:
- case pointvaluetype:
memtodiskshort (val.data.pointvalue.h);
memtodiskshort (val.data.pointvalue.v);
fl = langpackdata (sizeof (val.data.pointvalue), &val.data.pointvalue, hpackedvalue);
break;
+
+ case datevaluetype:
- case datevaluetype:
memtodisklong (val.data.longvalue);
fl = langpackdata (sizeof (val.data.datevalue), &val.data.datevalue, hpackedvalue);
break;
+
+ case addressvaluetype: {
- case addressvaluetype: {
- bigstring bs;
+ Handle h;
- /*
- copyheapstring (val.data.addressvalue, bs);
- */
+ fl = getaddresspath ( val, &h );
- // disablelangerror ();
-
- fl = getaddresspath (val, bs);
-
- // enablelangerror ();
-
- if (!fl)
+ if ( ! fl )
break;
+
+ fl = langpackhandle ( h, hpackedvalue );
- fl = langpackdata ((long) stringlength (bs), bs + 1, hpackedvalue);
+ disposehandle ( h );
break;
+
}
+
+ case singlevaluetype:
- case singlevaluetype:
// ??? need swapping ???
fl = langpackdata (sizeof (val.data.singlevalue), &val.data.singlevalue, hpackedvalue);
break;
case rectvaluetype: {
+
diskrect rdisk;
recttodiskrect (*val.data.rectvalue, &rdisk);
@@ -218,9 +227,11 @@
fl = langpackdata (sizeof (rdisk), &rdisk, hpackedvalue);
break;
+
}
- case rgbvaluetype: { // 2006-04-20 sethdill & aradke
+ case rgbvaluetype: { // 2006-04-20 sethdill & aradke
+
diskrgb rgbdiskk;
rgbtodiskrgb (*val.data.rgbvalue, &rgbdiskk);
@@ -228,11 +239,13 @@
fl = langpackdata (sizeof (rgbdiskk), &rgbdiskk, hpackedvalue);
break;
+
}
#if noextended
case doublevaluetype: {
+
long double x = **val.data.doublevalue;
extended80 x80;
@@ -245,6 +258,7 @@
fl = langpackdata (sizeof (x80), &x80, hpackedvalue);
break;
+
}
#else
@@ -256,22 +270,31 @@
case passwordvaluetype:
case patternvaluetype:
case objspecvaluetype:
+
#ifndef version5orgreater
+
case filespecvaluetype:
case aliasvaluetype:
+
#endif
+
#ifndef oplanglists
+
case listvaluetype:
case recordvaluetype:
+
#endif
case binaryvaluetype:
+
fl = langpackhandle (val.data.binaryvalue, hpackedvalue);
break;
#ifdef oplanglists
+
case listvaluetype:
case recordvaluetype:
+
fl = oppacklist (val.data.listvalue, &hdata);
if (!fl)
@@ -288,6 +311,7 @@
case filespecvaluetype:
case aliasvaluetype:
+
fl = langpackfileval (&val, &hdata);
if (!fl)
@@ -301,6 +325,7 @@
#endif
case codevaluetype:
+
fl = langpacktree (val.data.codevalue, &hdata);
if (!fl)
@@ -313,7 +338,9 @@
break;
case externalvaluetype: {
+
register Handle lh = val.data.externalvalue;
+
Handle hpacked;
initbeachball (left);
@@ -328,14 +355,17 @@
disposehandle (hpacked);
break;
+
}
default:
+
langerror (cantpackerror);
fl = false;
break;
+
} /*switch*/
if (fl)
@@ -349,85 +379,103 @@
boolean langpackverb (hdltreenode hparam1, tyvaluerecord *vreturned) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
- tyvaluerecord val;
register boolean fl;
+
+ Handle handleVariableName, hpacked;
hdlhashtable htable;
- bigstring bsvarname;
- Handle hpacked;
+ tyvaluerecord val;
setbooleanvalue (false, vreturned); /*default returned value of verb*/
if (!getparamvalue (hparam1, 1, &val)) /*the value to be packed*/
return (false);
-
+
flnextparamislast = true;
- if (!getvarparam (hparam1, 2, &htable, bsvarname)) /*the place to put the binary value*/
+ if ( ! getvarparam ( hparam1, 2, &htable, &handleVariableName ) ) // the place to put the binary value
return (false);
+
+ if (!langpackvalue (val, &hpacked, HNoNode)) {
- if (!langpackvalue (val, &hpacked, HNoNode))
+ disposehandle ( handleVariableName );
+
return (false);
+
+ }
+
+ fl = langsetbinaryval ( htable, handleVariableName, hpacked );
- fl = langsetbinaryval (htable, bsvarname, hpacked);
+ disposehandle ( handleVariableName );
(*vreturned).data.flvalue = fl;
return (fl);
+
} /*langpackverb*/
boolean langpackwindowverb (hdltreenode hparam1, tyvaluerecord *vreturned) {
+
+ //
+ // 2007-02-24 creedon: support for long odb item names and file paths
+ //
+ // 1997-06-16 dmb: new verb for standalone window handling.
+ //
- /*
- 6.16.97 dmb: new verb for standalone window handling.
- */
+ register boolean fl = false;
+ Handle handleVariableName, hpacked, x;
+ hdlhashtable htable;
hdlwindowinfo hinfo;
tyvaluerecord val;
- register boolean fl;
- hdlhashtable htable;
- bigstring bsvarname;
- Handle hpacked;
- Handle x;
-
setbooleanvalue (false, vreturned); /*default returned value of verb*/
if (!getwinparam (hparam1, 1, &hinfo)) /*the value to be packed*/
return (false);
-
+
flnextparamislast = true;
- if (!getvarparam (hparam1, 2, &htable, bsvarname)) /*the place to put the binary value*/
+ if (!getvarparam (hparam1, 2, &htable, &handleVariableName)) /*the place to put the binary value*/
return (false);
if (hinfo == nil) {
- langparamerror (badwindowerror, BIGSTRING ("\x04" "pack"));
+ langParamErrBs ( badwindowerror, BIGSTRING (...
[truncated message content] |
|
From: <cre...@us...> - 2007-02-25 01:45:08
|
Revision: 1626
http://svn.sourceforge.net/frontierkernel/?rev=1626&view=rev
Author: creecode
Date: 2007-02-24 17:45:06 -0800 (Sat, 24 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/langexternal.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/langinternal.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/langipc.h
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
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/langexternal.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/langexternal.h 2007-02-24 00:04:28 UTC (rev 1625)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/langexternal.h 2007-02-25 01:45:06 UTC (rev 1626)
@@ -82,6 +82,7 @@
idcardprocessor,
ctexternalprocessors
+
} tyexternalid;
@@ -187,15 +188,15 @@
#define externaldiskversionnumber 1
-/*prototypes*/
+// prototypes
extern tyexternalid langexternalgettype (tyvaluerecord);
-extern boolean langexternalgettable (bigstring, hdlhashtable *);
+extern boolean langexternalgettable ( const Handle, hdlhashtable * );
extern boolean langexternalvaltotable (tyvaluerecord, hdlhashtable *, hdlhashnode);
-extern boolean langexternalfindvariable (hdlexternalvariable, hdlhashtable *, bigstring);
+extern boolean langexternalfindvariable ( hdlexternalvariable, hdlhashtable *, Handle * );
extern boolean langexternalgettablevalue (hdltreenode, short, hdlhashtable *);
@@ -203,11 +204,11 @@
extern void langexternalsetdatabase (hdlexternalvariable, hdldatabaserecord);
-extern boolean langsetexternalsymbol (hdlhashtable, bigstring, tyexternalid, Handle);
+extern boolean langsetexternalsymbol ( hdlhashtable, const Handle, tyexternalid, Handle );
-extern boolean langexternaldontsave (hdlhashtable, bigstring);
+extern boolean langexternaldontsave ( hdlhashtable, const Handle );
-extern boolean langexternalpleasesave (hdlhashtable, bigstring);
+extern boolean langexternalpleasesave ( hdlhashtable, const Handle );
extern boolean langexternaltypestring (hdlexternalhandle, bigstring);
@@ -231,19 +232,19 @@
extern boolean langexternalgetowningwindow (hdlwindowinfo *);
-extern void langexternalquotename (bigstring);
+extern void langexternalquotename ( Handle );
-extern void langexternalbracketname (bigstring);
+extern void langexternalbracketname ( Handle );
-extern boolean langexternalgetfullpath (hdlhashtable, bigstring, bigstring, hdlwindowinfo *);
+extern boolean langexternalgetfullpath ( hdlhashtable, const Handle, Handle *, hdlwindowinfo * );
-extern boolean langexternalgetquotedpath (hdlhashtable, bigstring, bigstring);
+extern boolean langexternalgetquotedpath (hdlhashtable, const Handle, Handle * );
extern boolean langexternalgetexternalparam (hdltreenode, short, short *, hdlexternalvariable *);
-extern boolean langexternalzoomfrom (tyvaluerecord, hdlhashtable, bigstring, rectparam);
+extern boolean langexternalzoomfrom ( tyvaluerecord, hdlhashtable, Handle *, rectparam );
-extern boolean langexternalzoom (tyvaluerecord, hdlhashtable, bigstring);
+extern boolean langexternalzoom ( tyvaluerecord, hdlhashtable, Handle * );
extern boolean langexternalzoomfilewindow (const tyvaluerecord *, ptrfilespec, boolean);
@@ -279,7 +280,7 @@
extern boolean langexternalsettimes (hdlexternalhandle, long, long, hdlhashnode);
-extern boolean langexternalfindusedblocks (hdlexternalhandle, bigstring);
+extern boolean langexternalfindusedblocks ( hdlexternalhandle, const Handle );
extern boolean langexternaltitleclick (Point, hdlexternalvariable);
@@ -303,11 +304,9 @@
extern boolean hashstatsverb (tyvaluerecord *v);
-extern boolean langexternalsymbolchanged (hdlhashtable htable, const bigstring bsname, hdlhashnode hnode, boolean flvalue);
+extern boolean langexternalsymbolchanged ( hdlhashtable, const Handle, hdlhashnode, boolean );
-extern boolean langexternalsymbolinserted (hdlhashtable htable, const bigstring bsname, hdlhashnode hnode);
+extern boolean langexternalsymbolinserted ( hdlhashtable, const Handle, hdlhashnode );
#endif
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/langinternal.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/langinternal.h 2007-02-24 00:04:28 UTC (rev 1625)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/langinternal.h 2007-02-25 01:45:06 UTC (rev 1626)
@@ -272,6 +272,7 @@
anomynousthreadstring,
appleeventthreadstring
+
};
@@ -333,7 +334,7 @@
extern DialogPtr langmodaldialog;
-extern bigstring bsfunctionname;
+extern Handle handleFunctionName;
extern boolean flstackoverflow; /*langops.c*/
@@ -348,10 +349,12 @@
//extern short flextendedsymbolsearch;
-/*prototypes*/
+// prototypes
-extern boolean langpushlocalchain (hdlhashtable *); /*langcallbacks.c*/
+#pragma mark === langcallbacks.c ===
+extern boolean langpushlocalchain (hdlhashtable *);
+
extern boolean langpoplocalchain (hdlhashtable);
extern boolean languserescaped (boolean);
@@ -364,7 +367,7 @@
extern boolean langrestoreglobals (void);
-extern boolean langpushsourcecode (hdlhashtable, hdlhashnode, bigstring);
+extern boolean langpushsourcecode ( hdlhashtable, hdlhashnode, const Handle );
extern boolean langpopsourcecode (void);
@@ -399,53 +402,65 @@
extern boolean langrundialog (hdltreenode, tyvaluerecord *);
-extern boolean langdialogstart (void); /*langdialog.c*/
+#pragma mark === langdialog.c ===
+extern boolean langdialogstart (void);
-extern void parseerror (bigstring); /*langerror.c*/
+#pragma mark === langerror.c ===
-extern hdlerrorstack langerrorgetstack (void); /*langerrorwindow.c*/
+extern void parseerror (bigstring);
+
+#pragma mark === langerrorwindow.c ===
+
+extern hdlerrorstack langerrorgetstack (void);
+
extern boolean langerrorstart (void);
-extern void langseterrorline (hdltreenode); /*langevaluate.c*/
+#pragma mark === langevaluate.c ===
-extern boolean langrunscript (bigstring, tyvaluerecord *, hdlhashtable, tyvaluerecord *);
+extern void langseterrorline (hdltreenode);
extern boolean evaluatetree (hdltreenode, tyvaluerecord *);
extern boolean evaluatelist (hdltreenode, tyvaluerecord *);
-extern boolean hashflushcache (long *); /*langhash.h*/
+#pragma mark === langhash.h ===
-extern short hashfunction (const bigstring);
+extern boolean hashflushcache (long *);
+extern short hashfunction ( const Handle );
+
extern boolean hashresolvevalue (hdlhashtable, hdlhashnode);
-extern boolean langrunmodeless (hdltreenode, tyvaluerecord *); /*langmodeless.c*/
+#pragma mark === langmodeless.c ===
+extern boolean langrunmodeless (hdltreenode, tyvaluerecord *);
-extern boolean langheaptype (tyvaluetype); /*langops.c*/
+#pragma mark === langops.c ===
+
+extern boolean langheaptype (tyvaluetype);
+
extern boolean langheapallocated (tyvaluerecord *, Handle *);
-extern void langgetwithvaluename (short, bigstring);
+extern void langgetwithvaluename ( short, Handle * );
extern boolean langgetvalsize (tyvaluerecord, long *);
extern boolean langgetstringlist (short, bigstring);
-extern boolean langgetmiscstring (short, bigstring);
+extern boolean langgetmiscstring ( short, bigstring, Handle * );
extern boolean langcheckstacklimit (tystackid, short, short);
extern void langbadexternaloperror (short, tyvaluerecord);
-extern void langarrayreferror (short, bigstring, const tyvaluerecord *, tyvaluerecord *);
+extern void langarrayreferror ( short, const Handle, const tyvaluerecord *, tyvaluerecord * );
extern boolean langfindexternalwindow (const bigstring, Handle *);
@@ -453,32 +468,38 @@
extern boolean langsetuserflag (short, boolean);
-extern boolean langgetthisaddress (hdlhashtable *, bigstring);
+extern boolean langgetthisaddress ( hdlhashtable *, Handle * );
-extern boolean langsetthisvalue (hdlhashtable, hdlhashtable, bigstring);
+extern boolean langsetthisvalue ( hdlhashtable, hdlhashtable, const Handle );
-extern boolean langfastaddresstotable (hdlhashtable, bigstring, hdlhashtable *);
+extern boolean langfastaddresstotable ( hdlhashtable, const Handle, const bigstring, hdlhashtable * );
extern boolean langvaltocode (tyvaluerecord *vcode, hdltreenode *hcode); //02/04/02 dmb
extern boolean langfollowifaddressvalue (tyvaluerecord *v);
-extern boolean isfirstidentifierchar (byte ch); /*langscan.c*/
+#pragma mark === langscan.c ===
+extern boolean isfirstidentifierchar (byte ch);
+
extern boolean isidentifierchar (byte ch);
-extern boolean langisidentifier (bigstring);
+extern boolean langisidentifier ( const Handle );
extern boolean langdeparsestring (bigstring, byte);
+extern boolean langDeparseTextHandle ( Handle, byte );
+
extern boolean langstriptextsyntax (Handle);
extern boolean langaddapplescriptsyntax (Handle);
-extern void langstarttrace (void); /*langtrace.c*/
+#pragma mark === langtrace.c ===
+extern void langstarttrace (void);
+
extern void langendtrace (void);
extern void langtrace (bigstring);
@@ -486,8 +507,10 @@
extern void langsyntaxtrace (boolean);
-extern boolean langvisitcodetree (hdltreenode, langtreevisitcallback, ptrvoid); /*langtree.c*/
+#pragma mark === langtree.c ===
+extern boolean langvisitcodetree (hdltreenode, langtreevisitcallback, ptrvoid);
+
extern short langcounttreenodes (hdltreenode);
extern boolean newconstnode (tyvaluerecord, hdltreenode *);
@@ -529,8 +552,10 @@
extern boolean langcopytree (hdltreenode, hdltreenode *);
-extern boolean stringtoaddress (tyvaluerecord *); /*langvalue.c*/
+#pragma mark === langvalue.c ===
+extern boolean stringtoaddress (tyvaluerecord *);
+
extern boolean stringisboolean (bigstring bs, boolean *flboolean);
extern void pullstringvalue (const tyvaluerecord *, bigstring);
@@ -545,7 +570,7 @@
extern boolean langcoerceerror (tyvaluerecord *, tyvaluetype);
-extern boolean langgetdottedsymbolval (hdltreenode, hdlhashtable *, bigstring, tyvaluerecord *, hdlhashnode *);
+extern boolean langgetdottedsymbolval ( hdltreenode, hdlhashtable *, Handle*, tyvaluerecord *, hdlhashnode * );
extern boolean idvalue (hdltreenode, tyvaluerecord *);
@@ -565,25 +590,34 @@
extern boolean incrementvalue (boolean, boolean, hdltreenode, tyvaluerecord *);
-extern boolean langgetnodecode (hdlhashtable, bigstring, hdlhashnode, hdltreenode *);
+extern boolean langgetnodecode ( hdlhashtable, const Handle, hdlhashnode, hdltreenode * );
extern boolean evaluatereadonlyparam (hdltreenode hparam, tyvaluerecord *vparam);
+extern boolean setAddressValueFromHandle ( const Handle, tyvaluerecord * );
-extern boolean langinitbuiltins (void); /*langverbs.h*/
+#pragma mark === langverbs.h ===
+
+extern boolean langinitbuiltins (void);
+
extern boolean langreleasesemaphores (hdlprocessrecord);
-// langxml.c
+#pragma mark === langxml.c ===
extern boolean langisremotefunction (hdltreenode htree);
extern boolean langremotefunctioncall (hdltreenode htree, hdltreenode hparam1, tyvaluerecord *vreturned);
-// lang.c
-extern boolean langrunscriptcode (hdlhashtable htable, bigstring bsverb, hdltreenode hcode, tyvaluerecord *vparams, hdlhashtable hcontext, tyvaluerecord *vreturned);
+#pragma mark === lang.c ===
+extern boolean langrunscript ( const Handle, tyvaluerecord *, hdlhashtable, tyvaluerecord * );
-#endif /*langinternalinclude*/
+extern boolean langRunScriptBigstring ( const bigstring, tyvaluerecord *, hdlhashtable, tyvaluerecord * );
+
+extern boolean langrunscriptcode ( hdlhashtable, const Handle, hdltreenode, tyvaluerecord *, hdlhashtable, tyvaluerecord * );
+
+#endif // langinternalinclude
+
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/langipc.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/langipc.h 2007-02-24 00:04:28 UTC (rev 1625)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/langipc.h 2007-02-25 01:45:06 UTC (rev 1626)
@@ -84,7 +84,7 @@
#endif
-extern boolean langipcfindapptable (OSType , boolean, hdlhashtable *, bigstring);
+extern boolean langipcfindapptable ( OSType, boolean, hdlhashtable *, Handle * );
extern boolean langipcbrowsenetwork (hdltreenode, tyvaluerecord *);
@@ -122,11 +122,11 @@
extern boolean langipctablemessage (hdltreenode, tyvaluerecord *);
-extern boolean langipcbuildsubroutineevent (AppleEvent *, bigstring, hdltreenode);
+extern boolean langipcbuildsubroutineevent ( AppleEvent *, Handle *, hdltreenode );
-extern boolean langipchandlercall (hdltreenode, bigstring, hdltreenode, tyvaluerecord *);
+extern boolean langipchandlercall ( hdltreenode, Handle *, hdltreenode, tyvaluerecord * );
-extern boolean langipckernelfunction (hdlhashtable, bigstring, hdltreenode, tyvaluerecord *);
+extern boolean langipckernelfunction ( hdlhashtable, Handle, hdltreenode, tyvaluerecord * );
extern boolean langipcshowmenunode (long);
@@ -139,15 +139,17 @@
extern boolean langipcinit (void);
-extern boolean langipcgetmenuhandle (OSType, short, Handle *); /*langipcmenus.c*/
+#pragma mark === langipcmenus.c ===
+extern boolean langipcgetmenuhandle (OSType, short, Handle *);
+
#ifdef flnewfeatures
-extern boolean langipcgetitemlangtext (long, short, short, Handle *, long *);
+ extern boolean langipcgetitemlangtext (long, short, short, Handle *, long *);
-extern boolean langipccheckformulas (long);
+ extern boolean langipccheckformulas (long);
-extern void langipcdisposemenuarray (long, Handle);
+ extern void langipcdisposemenuarray (long, Handle);
#endif
@@ -161,14 +163,11 @@
extern boolean langipcmenushutdown (void);
-extern boolean langipcsymbolchanged (hdlhashtable, const bigstring, boolean);
+extern boolean langipcsymbolchanged ( hdlhashtable, const Handle, boolean );
-extern boolean langipcsymbolinserted (hdlhashtable, const bigstring);
+extern boolean langipcsymbolinserted ( hdlhashtable, const Handle );
-extern boolean langipcsymboldeleted (hdlhashtable, const bigstring);
+extern boolean langipcsymboldeleted (hdlhashtable, const Handle );
extern boolean langipcmenuinit (void);
-
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langhash.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langhash.c 2007-02-24 00:04:28 UTC (rev 1625)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langhash.c 2007-02-25 01:45:06 UTC (rev 1626)
@@ -46,10 +46,9 @@
#include "timedate.h"
#include "byteorder.h" /* 2006-04-08 aradke: endianness conversion macros */
-#if TARGET_API_MAC_CARBON == 1 /*PBS 03/14/02: AE OS X fix.*/
- #include "aeutils.h" /*PBS 03/14/02: AE OS X fix.*/
-#endif
+#include "aeutils.h" /*PBS 03/14/02: AE OS X fix.*/
+
typedef struct tydisksymbolrecord {
long ixkey; /*in the string handle, where is this symbol's name?*/
@@ -61,6 +60,7 @@
tyvaluedata data; /*if a string, this stores an index into the string handle*/
} tydisksymbolrecord, *ptrdisksymbolrecord, **hdldisksymbolrecord;
+
typedef struct tyOLD42disksymbolrecord {
long ixkey; /*in the string handle, where is this symbol's name?*/
@@ -77,8 +77,7 @@
} tyOLD42disksymbolrecord, *ptrOLD42disksymbolrecord, **hdlOLD42disksymbolrecord;
-// 5.0.1: bumped version number so we can clear uninitialized flags
-#define tablediskversion 0x03
+#define tablediskversion 0x04 // 2006-12-30 creedon: bumped version number, hashkey is stored as handle not Str255
typedef struct tydisktablerecord { /*new in 5.0, a header for each table*/
@@ -90,6 +89,7 @@
unsigned long timecreated, timelastsave; /*number of seconds since 1/1/04*/
long flags;
+
} tydisktablerecord, *ptrdisktablerecord, **hdldisktablerecord;
@@ -107,11 +107,13 @@
#define maxinlinescalarsize 1023
#define diskvalsizeflag (-1)
+
typedef struct tydiskvaluerecord { /*4.0.1b1 dmb*/
long sizeflag; /*always -1*/
dbaddress adr; /*addres of actual scalar value*/
+
} tydiskvaluerecord;
@@ -161,240 +163,245 @@
#endif
-static void hashaddrefnode (hdlhashtable ht, hdlhashnode hn) {
-
- /*
- 2003-05-21 AR: Insert the node at the beginning of the table's
- linked list of nodes that reference it.
-
- This is so that right before the table gets disposed, it can notify
- the nodes that the addresses they contain are about to become invalid.
- Not only are they pointing at an object that will no longer exist
- in the namespace, worse, the handle tacked onto the end of the address
- string will soon point at a block of memory that was already released!
-
- For now, we only keep track of nodes referencing a local table.
-
- Note that references to global tables can become invalid, too, if a
- database file is closed while an address pointing into it is part
- of some thread's stack of local variables.
- */
+ static void hashaddrefnode (hdlhashtable ht, hdlhashnode hn) {
+
+ /*
+ 2003-05-21 AR: Insert the node at the beginning of the table's
+ linked list of nodes that reference it.
+
+ This is so that right before the table gets disposed, it can notify
+ the nodes that the addresses they contain are about to become invalid.
+ Not only are they pointing at an object that will no longer exist
+ in the namespace, worse, the handle tacked onto the end of the address
+ string will soon point at a block of memory that was already released!
+
+ For now, we only keep track of nodes referencing a local table.
+
+ Note that references to global tables can become invalid, too, if a
+ database file is closed while an address pointing into it is part
+ of some thread's stack of local variables.
+ */
- assert (ht != nil);
-
- assert ((**ht).fllocaltable);
-
- assert (hn != nil);
-
- assert ((**hn).val.valuetype == addressvaluetype);
-
- assert ((**hn).refnodelink == nil);
-
- (**hn).refnodelink = (**ht).refnodes;
-
- (**ht).refnodes = hn;
+ assert (ht != nil);
+
+ assert ((**ht).fllocaltable);
+
+ assert (hn != nil);
+
+ assert ((**hn).val.valuetype == addressvaluetype);
+
+ assert ((**hn).refnodelink == nil);
+
+ (**hn).refnodelink = (**ht).refnodes;
+
+ (**ht).refnodes = hn;
- #ifdef fldebug
- ++ctrefnodesadded;
- #endif
- } /*hashaddrefnode*/
+ #ifdef fldebug
+ ++ctrefnodesadded;
+ #endif
+ } /*hashaddrefnode*/
-static void hashremoverefnode (hdlhashtable ht, hdlhashnode hn) {
+ static void hashremoverefnode (hdlhashtable ht, hdlhashnode hn) {
- /*
- 2003-05-21 AR: Complements hashaddrefnode.
- Remove the given node from the table's linked list.
-
- 2003-06-14 AR: Commented out an over-eager assertion.
- */
+ /*
+ 2003-05-21 AR: Complements hashaddrefnode.
+ Remove the given node from the table's linked list.
+
+ 2003-06-14 AR: Commented out an over-eager assertion.
+ */
- assert (ht != nil);
-
- assert ((**ht).fllocaltable);
-
- assert ((**ht).refnodes != nil);
-
- assert (hn != nil);
-
- // assert ((**hn).val.valuetype == addressvaluetype); /* this may no longer be true */
-
- if ((**ht).refnodes == hn) {
-
- (**ht).refnodes = (**hn).refnodelink;
-
- (**hn).refnodelink = nil;
- }
- else {
-
- hdlhashnode nomad = (**ht).refnodes;
-
- while ((**nomad).refnodelink != nil) {
+ assert (ht != nil);
+
+ assert ((**ht).fllocaltable);
+
+ assert ((**ht).refnodes != nil);
+
+ assert (hn != nil);
+
+ // assert ((**hn).val.valuetype == addressvaluetype); /* this may no longer be true */
+
+ if ((**ht).refnodes == hn) {
+
+ (**ht).refnodes = (**hn).refnodelink;
+
+ (**hn).refnodelink = nil;
+ }
+ else {
+
+ hdlhashnode nomad = (**ht).refnodes;
+
+ while ((**nomad).refnodelink != nil) {
- if ((**nomad).refnodelink == hn) {
-
- (**nomad).refnodelink = (**hn).refnodelink;
+ if ((**nomad).refnodelink == hn) {
- (**hn).refnodelink = nil;
+ (**nomad).refnodelink = (**hn).refnodelink;
+
+ (**hn).refnodelink = nil;
+
+ break;
+ } /*while*/
- break;
- } /*while*/
+ nomad = (**nomad).refnodelink;
+ }
+ }
- nomad = (**nomad).refnodelink;
- }
- }
-
- assert ((**hn).refnodelink == nil); /*check that we found it*/
+ assert ((**hn).refnodelink == nil); /*check that we found it*/
- #ifdef fldebug
- ++ctrefnodesremoved;
- #endif
- } /*hashremoverefnode*/
+ #ifdef fldebug
+ ++ctrefnodesremoved;
+ #endif
+ } /*hashremoverefnode*/
-void hashregisteraddressnode (hdlhashtable hparent, hdlhashnode hn) {
+ void hashregisteraddressnode (hdlhashtable hparent, hdlhashnode hn) {
- /*
- 2003-05-21 AR: Call me if the valuerecord of hn has just been
- assigned a new value. If it's an address of a local variable,
- we will register hn with the table that contains the local variable.
-
- When the table is about to be disposed, it can notify us of the fact
- that our address value is about to point to an invalid handle.
-
- Optimization: We don't have to register hn with the destination table
- if hn lives in a stack frame that will be disposed before (or at worst
- at the same time) as the destination table. For this to work properly,
- we have to make sure that if hn is unlinked and inserted into another
- table (or the same table), e.g. via copy&paste, we unregister and
- register hn again.
-
- Actually, the above should work but its probably not a useful optimization.
- Just check whether the table containing hn and the destination table are
- identical. This should already apply to a lot of cases.
- */
-
- assert ((**hn).reftable == nil);
-
- if ((**hn).val.valuetype == addressvaluetype && (**hn).reftable == nil) {
+ /*
+ 2003-05-21 AR: Call me if the valuerecord of hn has just been
+ assigned a new value. If it's an address of a local variable,
+ we will register hn with the table that contains the local variable.
- hdlhashtable hdest;
- bigstring bsname;
- boolean fl;
+ When the table is about to be disposed, it can notify us of the fact
+ that our address value is about to point to an invalid handle.
- disablelangerror ();
+ Optimization: We don't have to register hn with the destination table
+ if hn lives in a stack frame that will be disposed before (or at worst
+ at the same time) as the destination table. For this to work properly,
+ we have to make sure that if hn is unlinked and inserted into another
+ table (or the same table), e.g. via copy&paste, we unregister and
+ register hn again.
- fl = getaddressvalue ((**hn).val, &hdest, bsname);
-
- enablelangerror ();
-
- if (!fl || (hdest == nil) || !(**hdest).fllocaltable)
- return;
-
- if (hparent == hdest) /*don't bother...*/
- return;
-
- /*
- if ((**hparent).fllocaltable) { //optimization?
+ Actually, the above should work but its probably not a useful optimization.
+ Just check whether the table containing hn and the destination table are
+ identical. This should already apply to a lot of cases.
+ */
- register hdlhashtable nomad = hparent;
+ assert ((**hn).reftable == nil);
+
+ if ((**hn).val.valuetype == addressvaluetype && (**hn).reftable == nil) {
- while ((**nomad).parenthashtable != nil) { //surface to stack frame
- nomad = (**nomad).parenthashtable;
- }
+ hdlhashtable hdest;
+ bigstring bsname;
+ boolean fl;
- while (nomad != nil && (**nomad).fllocaltable) { //walk chain and check whether hdest is in it
+ disablelangerror ();
+
+ fl = getaddressvalue ((**hn).val, &hdest, bsname);
+
+ enablelangerror ();
+
+ if (!fl || (hdest == nil) || !(**hdest).fllocaltable)
+ return;
+
+ if (hparent == hdest) /*don't bother...*/
+ return;
+
+ /*
+ if ((**hparent).fllocaltable) { //optimization?
- if (nomad == hdest)
- return;
+ register hdlhashtable nomad = hparent;
+
+ while ((**nomad).parenthashtable != nil) { //surface to stack frame
+ nomad = (**nomad).parenthashtable;
+ }
+
+ while (nomad != nil && (**nomad).fllocaltable) { //walk chain and check whether hdest is in it
- nomad = (**nomad).prevhashtable;
+ if (nomad == hdest)
+ return;
+
+ nomad = (**nomad).prevhashtable;
+ }
}
+ */
+
+ hashaddrefnode (hdest, hn);
+
+ (**hn).reftable = hdest;
+
}
- */
-
- hashaddrefnode (hdest, hn);
- (**hn).reftable = hdest;
- }
- } /*hashregisteraddressnode*/
+ } /*hashregisteraddressnode*/
-void hashunregisteraddressnode (hdlhashnode hn) {
+ void hashunregisteraddressnode (hdlhashnode hn) {
- /*
- 2003-05-21 AR: Call me if the valuerecord of hn has changed
- or if hn itself is about to be disposed.
- */
-
- if ((**hn).reftable != nil) {
-
- hashremoverefnode ((**hn).reftable, hn);
+ /*
+ 2003-05-21 AR: Call me if the valuerecord of hn has changed
+ or if hn itself is about to be disposed.
+ */
- (**hn).reftable = nil;
- }
- } /*hashunregisteraddressnode*/
+ if ((**hn).reftable != nil) {
+ hashremoverefnode ((**hn).reftable, hn);
+
+ (**hn).reftable = nil;
+
+ }
+
+ } /*hashunregisteraddressnode*/
-static void hashinvalidaterefnodes (hdlhashtable ht) {
-
- /*
- 2003-05-21 AR: The hash table is about to be disposed, so notify
- all hash nodes containing an address that reference the table
- of the fact that they are about to become invalid.
-
- Call me from disposehashtable after it has disposed of its nodes.
-
- 2003-05-23 AR: Set refnodes field to nil so we won't crash
- if we are called multiple times for the same table. Also, try
- to get the full path representation of the address, but this
- will only work if the table hasn't been removed from the
- namespace yet.
- */
- hdlhashnode hn, hnext;
- bigstring bspath;
+ static void hashinvalidaterefnodes (hdlhashtable ht) {
- assert (ht != nil);
-
- hn = (**ht).refnodes; /*unlink list from table*/
-
- (**ht).refnodes = nil;
-
- disablelangerror (); /*must re-enable before we return*/
-
- while (hn != nil) {
+ /*
+ 2003-05-21 AR: The hash table is about to be disposed, so notify
+ all hash nodes containing an address that reference the table
+ of the fact that they are about to become invalid.
- assert ((**hn).reftable == ht);
- assert ((**hn).val.valuetype == addressvaluetype);
+ Call me from disposehashtable after it has disposed of its nodes.
- hnext = (**hn).refnodelink;
+ 2003-05-23 AR: Set refnodes field to nil so we won't crash
+ if we are called multiple times for the same table. Also, try
+ to get the full path representation of the address, but this
+ will only work if the table hasn't been removed from the
+ namespace yet.
+ */
+
+ hdlhashnode hn, hnext;
+ bigstring bspath;
+
+ assert (ht != nil);
- /* unlink */
+ hn = (**ht).refnodes; /*unlink list from table*/
- (**hn).refnodelink = nil;
+ (**ht).refnodes = nil;
+
+ disablelangerror (); /*must re-enable before we return*/
- (**hn).reftable = nil;
+ while (hn != nil) {
+
+ assert ((**hn).reftable == ht);
+ assert ((**hn).val.valuetype == addressvaluetype);
+
+ hnext = (**hn).refnodelink;
+
+ /* unlink */
+
+ (**hn).refnodelink = nil;
+
+ (**hn).reftable = nil;
+
+ /* nuke the htable handle tacked onto the item name */
+
+ getaddresspath ((**hn).val, bspath);
+
+ sethandlecontents (bspath, stringsize (bspath), (Handle) (**hn).val.data.addressvalue);
+
+ #if fldebug
+ ++ctrefnodesinvalidated;
+ #endif
+
+ /* advance */
+
+ hn = hnext;
+
+ } /*while*/
+
+ enablelangerror ();
- /* nuke the htable handle tacked onto the item name */
-
- getaddresspath ((**hn).val, bspath);
-
- sethandlecontents (bspath, stringsize (bspath), (Handle) (**hn).val.data.addressvalue);
-
- #if fldebug
- ++ctrefnodesinvalidated;
- #endif
-
- /* advance */
-
- hn = hnext;
- } /*while*/
+ } /*hashinvalidaterefnodes*/
- enablelangerror ();
-
- } /*hashinvalidaterefnodes*/
-
#endif /*fltracklocaladdresses*/
@@ -420,6 +427,7 @@
hmagictable = nil;
return (true);
+
}
#ifdef fldebug
@@ -444,6 +452,7 @@
*htable = ht;
return (true);
+
}
if (!newclearhandle (sizeof (tyhashtable), (Handle *) htable))
@@ -452,6 +461,7 @@
(***htable).timecreated = timenow ();
return (true);
+
} /*newhashtable*/
@@ -490,6 +500,7 @@
(**ht).flchained = true;
currenthashtable = ht;
+
} /*chainhashtable*/
@@ -507,48 +518,10 @@
(**ht).flchained = false;
currenthashtable = hprev;
+
} /*unchainhashtable*/
-#if 0
-
-static boolean indexhashtable_obsolete (short tablenum, hdlhashtable *htable) {
-
- /*
- turn an index into a hash table. the most-global hashtable has index 0.
- its previous table is index 1.
-
- you can safely ask for the most-global one by asking for table number
- infinity, but watch out -- we return false if we fell off the list.
- */
-
- register hdlhashtable nomad = currenthashtable;
- register hdlhashtable prevnomad = nomad;
- register short ct = tablenum;
- register short i;
-
- for (i = 1; i <= ct; i++) {
-
- if (nomad == nil) { /*ran out of tables, return most-global table*/
-
- *htable = prevnomad;
-
- return (false);
- }
-
- prevnomad = nomad;
-
- nomad = (**nomad).prevhashtable;
- } /*for*/
-
- *htable = nomad;
-
- return (true);
- } /*indexhashtable*/
-
-#endif
-
-
hdlhashtable sethashtable (hdlhashtable hset) {
/*
@@ -560,6 +533,7 @@
currenthashtable = hset;
return (hprev);
+
} /*sethashtable*/
@@ -585,6 +559,7 @@
/*stacktracer (toptables);*/
return (true);
+
} /*pushhashtable*/
@@ -597,6 +572,7 @@
shellinternalerror (idtoomanypophashtables, STR_too_many_pophashtables);
return (false);
+
}
currenthashtable = (**hs).stack [--(**hs).toptables];
@@ -604,6 +580,7 @@
/*stacktracer (toptables);*/
return (true);
+
} /*pophashtable*/
@@ -629,11 +606,12 @@
return (pushhashtable (ht));
ht = hprev;
+
} /*while*/
+
} /*pushouterlocaltable*/
-
#ifdef smartmemory
@@ -811,9 +789,11 @@
*ctbytesneeded -= gethandlesize ((Handle) hfreetable);
disposehandle ((Handle) hfreetable);
+
}
return (true);
+
} /*hashflushcache*/
@@ -838,32 +818,35 @@
}
*/
-#ifdef fltracklocaladdresses
- hashunregisteraddressnode (hnode);
-#endif
+ #ifdef fltracklocaladdresses
+
+ hashunregisteraddressnode (hnode);
+
+ #endif
if (fldisposevalue) {
-
+
boolean flneeddatabase = (fldisk && (**hn).val.fldiskval);
hdldatabaserecord hdb = nil;
-
+
if (flneeddatabase) {
-
+
hdb = tablegetdatabase (ht);
if (hdb)
dbpushdatabase (hdb);
}
-
+
disposevaluerecord ((**hn).val, fldisk);
if (flneeddatabase && hdb)
dbpopdatabase ();
}
-
+
disposehandle ((Handle) hn);
return (true);
+
} /*disposehashnode*/
@@ -872,22 +855,26 @@
(**ht).fldirty = true;
(**ht).timelastsave = timenow ();
+
} /*dirtyhashtable*/
static short smashhashtable (hdlhashtable htable, boolean fldisk, boolean flcallback) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 1996-04-25 ( 4.0b7 ) dmb: pulled this code out of disposehashtable so we
+ // could make a verb out of it. had to add the flcallback parameter, since
+ // disposehashtable doesn't want to.
+ //
- /*
- 4.0b7 4/25/96 dmb: pulled this code out of disposehashtable
- so we could make a verb out of it. had to add the flcallback parameter,
- since disposehashtable doesn't want to.
- */
-
+ register hdlhashnode nomad, nextnomad;
register hdlhashtable ht = htable;
- register hdlhashnode nomad, nextnomad;
register short i;
+
+ Handle h;
short ctdisposed = 0;
- bigstring bs;
if (ht == nil) /*easy to dispose of nil table*/
return (0);
@@ -905,7 +892,7 @@
nextnomad = (**nomad).hashlink;
if (flcallback)
- gethashkey (nomad, bs);
+ gethashkey (nomad, &h);
if (flcallback)
langsymbolunlinking (ht, nomad);
@@ -913,27 +900,40 @@
disposehashnode (ht, nomad, true, fldisk);
if (flcallback)
- langsymboldeleted (ht, bs);
+ langsymboldeleted (ht, h);
++ctdisposed;
+ if ( ctdisposed == 59 ) {
+
+ boolean fl;
+
+ fl = true;
+
+ }
+
nomad = nextnomad;
+
} /*while*/
+
} /*for*/
dirtyhashtable (ht);
- return (ctdisposed);
+ return (ctdisposed);
+
} /*smashhashtable*/
short emptyhashtable (hdlhashtable htable, boolean fldisk) {
return (smashhashtable (htable, fldisk, true));
+
} /*emptyhashtable*/
+
boolean disposehashtable (hdlhashtable htable, boolean fldisk) {
-
+
/*
7/10/90 DW: if it's a local table, don't dispose of any code trees linked
in as values.
@@ -950,11 +950,11 @@
if (ht == nil) /*easy to dispose of nil table*/
return (true);
-
+
#ifdef fldebug
- --cthashtablesallocated;
-
+ --cthashtablesallocated;
+
#endif
if (ht == roottable) { /*very serious internal error*/
@@ -962,6 +962,7 @@
shellinternalerror (iddisposingsystemtable, STR_trying_to_dispose_global_symbol_table);
return (false);
+
}
if ((**ht).flchained) { /*table is in local chain; can't dispose now*/
@@ -969,6 +970,7 @@
(**ht).fldisposewhenunchained = true; /*we'll do it later*/
return (true);
+
}
pushhashtable (ht);
@@ -978,6 +980,7 @@
pophashtable ();
smashhashtable (ht, fldisk, false);
+
/*
for (i = 0; i < ctbuckets; i++) {
@@ -1002,10 +1005,12 @@
}
*/
-#ifdef fltracklocaladdresses
- hashinvalidaterefnodes (ht);
-#endif
+ #ifdef fltracklocaladdresses
+ hashinvalidaterefnodes (ht);
+
+ #endif
+
(**ht).prevhashtable = hfirstfreetable;
hfirstfreetable = ht;
@@ -1014,44 +1019,47 @@
disposehandle ((Handle) ht);
*/
- return (true);
+ return (true);
+
} /*disposehashtable*/
-short hashfunction (const bigstring bs) {
+short hashfunction ( const Handle h ) {
- /*
- 3.0.4b8 dmb: need to make locals unsigned to protect against ctype's int's
- */
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 2006-12-05 creedon: use text handle instead of bigstring
+ //
+ // 3.0.4b8 dmb: need to make locals unsigned to protect against ctype's int's
+ //
-// register unsigned short c;
- register unsigned short len;
-// register ptrstring p = (ptrstring) bs;
- register unsigned short val;
-
- len = stringlength (bs);
+ register unsigned short len, val, val2;
+ register ptrbyte p = ( ptrbyte ) *h;
- if (len == 0)
- return (0);
+ len = gethandlesize ( h );
-// c = p [1];
+ if ( len == 0 )
+ return ( 0 );
+
+ val = getlower ( p [ 0 ] );
- val = getlower(getstringcharacter(bs,0));
+ val2 = getlower ( p [ len - 1 ] );
-// c = p [len];
+ val += val2;
- val += getlower(getstringcharacter(bs,len-1));
+ return ( val % ctbuckets );
- return (val % ctbuckets);
- } /*hashfunction*/
+ } // hashfunction
static boolean hashsortedinsert (hdlhashnode hnode) {
- register hdlhashnode hn = hnode;
+ register hdlhashnode hn = hnode, nomadprev = nil;
register hdlhashtable ht = currenthashtable;
+
register hdlhashnode nomad = (**ht).hfirstsort;
- register hdlhashnode nomadprev = nil;
+
short comparison;
if (nomad == nil) { /*first guy in sorted list*/
@@ -1061,6 +1069,7 @@
(**hn).sortedlink = nil;
return (true);
+
}
while (true) {
@@ -1076,6 +1085,7 @@
(**ht).hfirstsort = hn;
return (true);
+
}
(**hn).sortedlink = nomad; /*insert in before nomad, middle of list*/
@@ -1083,6 +1093,7 @@
(**nomadprev).sortedlink = hn;
return (true);
+
}
nomadprev = nomad; /*advance to next node in list*/
@@ -1096,8 +1107,11 @@
(**nomadprev).sortedlink = hn;
return (true);
+
}
+
} /*while*/
+
} /*hashsortedinsert*/
@@ -1131,38 +1145,51 @@
} /*hashsorteddelete*/
-static boolean hashlinknode (hdlhashtable htable, hdlhashnode hnode) {
+static boolean hashlinknode ( hdlhashtable htable, hdlhashnode hnode ) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
- register hdlhashnode hn = hnode;
+ register Handle h;
+ register hdlhashnode hn = hnode, hnext;
register hdlhashtable ht = htable;
register short ixbucket;
- register hdlhashnode hnext;
- ixbucket = hashfunction ((**hn).hashkey);
+ gethashkey ( hn, &h );
- hnext = (**ht).hashbucket [ixbucket];
+ ixbucket = hashfunction ( h );
- (**ht).hashbucket [ixbucket] = hnode; /*link new guy at head of list*/
+ disposehandle ( h );
- (**hn).hashlink = hnext;
+ hnext = ( **ht ).hashbucket [ ixbucket ];
- return (true);
- } /*hashlinknode*/
+ ( **ht ).hashbucket [ ixbucket ] = hnode; // link new guy at head of list
+ ( **hn ).hashlink = hnext;
+
+ return ( true );
+
+ } // hashlinknode
+
boolean hashinsertnode (hdlhashnode hnode, hdlhashtable htable) {
+
+ //
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 1993-03-23 dmb: don't invoke callback when flunpackingtable flag is set
+ //
- /*
- 3/23/93 dmb: don't invoke callback when flunpackingtable flag is set
- */
-
register hdlhashnode hn = hnode;
register hdlhashtable ht = htable;
- bigstring bs;
+ Handle h;
+
hashlinknode (ht, hn);
- if (flunpackingtable) /*tableunpack will take care of sort links*/
+ if (flunpackingtable) // tableunpack will take care of sort links
return (true);
pushhashtable (ht);
@@ -1173,13 +1200,16 @@
dirtyhashtable (ht);
- gethashkey (hn, bs);
+ gethashkey ( hn, &h );
- langsymbolinserted (ht, bs, hn);
+ langsymbolinserted ( ht, h, hn );
+ disposehandle ( h );
+
return (true);
- } /*hashinsertnode*/
+ } // hashinsertnode
+
boolean hashunlinknode (hdlhashtable htable, hdlhashnode hnode) {
@@ -1220,61 +1250,77 @@
} /*hashunlinknode*/
-boolean hashsetnodekey (hdlhashtable htable, hdlhashnode hnode, const bigstring bs) {
+boolean hashsetnodekey ( hdlhashtable htable, hdlhashnode hnode, const Handle h ) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
- if (!sethandlesize ((Handle) hnode, sizeof (tyhashnode) + stringsize (bs)))
- return (false);
+ long size = sizeof ( tyhashnode ) + sizeof ( short ) + gethandlesize ( h );
- hashunlinknode (htable, hnode);
+ if ( ! sethandlesize ( ( Handle ) hnode, size ) )
+ return ( false );
- copystring (bs, (**hnode).hashkey);
+ hashunlinknode ( htable, hnode );
- hashlinknode (htable, hnode);
+ setHashKey ( h, ( **hnode ).hashkey );
- (**htable).flneedsort = true;
+ hashlinknode ( htable, hnode );
- langsymbolchanged (htable, bs, hnode, false); /*value didn't change*/
+ ( **htable ).flneedsort = true;
- return (true);
- } /*hashsetnodekey*/
+ langsymbolchanged ( htable, h, hnode, false); // value didn't change
+
+ return ( true );
+
+ } // hashsetnodekey
-static boolean newhashnode (hdlhashnode *hnode, const bigstring bskey) {
+static boolean newhashnode ( hdlhashnode *hnode, const Handle handleKey ) {
+
+ long size = sizeof ( tyhashnode ) + sizeof ( short ) + gethandlesize ( handleKey );
- if (!newclearhandle (sizeof (tyhashnode) + stringsize (bskey), (Handle *) hnode))
- return (false);
+ if ( ! newclearhandle ( size, ( Handle * ) hnode ) )
+ return ( false );
+
+ setHashKey ( handleKey, ( ***hnode).hashkey );
- copystring (bskey, (***hnode).hashkey);
+ return ( true );
- return (true);
- } /*newhashnode*/
+ } // newhashnode
-boolean hashinsert (const bigstring bs, tyvaluerecord val) {
+boolean hashinsert ( const Handle handleName, tyvaluerecord val ) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ //
+ // 5.0.2b10 dmb: make sure we don't put a value with the tmp flag set.
+ //
- /*
- 5.0.2b10 dmb: make sure we don't put a value with the tmp flag set.
- */
-
register hdlhashtable ht = currenthashtable;
register hdlhashnode h;
+
hdlhashnode hnode;
- if (isemptystring (bs)) {
- bigstring bspath;
+ if ( isemptyhandle ( handleName ) ) {
+
+ Handle handlePath;
- langexternalgetfullpath (currenthashtable, (ptrstring) bs, bspath, nil);
+ langexternalgetfullpath ( currenthashtable, handleName, &handlePath, nil );
- lang2paramerror (illegalnameerror, bspath, bs);
+ lang2paramerror ( illegalnameerror, handlePath, handleName );
- return (false);
+ return ( false );
+
}
- if (!newhashnode (&hnode, bs))
- return (false);
+ if ( ! newhashnode ( &hnode, handleName ) )
+ return ( false );
+
+ h = hnode; // copy into register
- h = hnode; /*copy into register*/
-
hnewnode = h; /*copy into global for hashinsertaddress*/
val.fltmpstack = false; // 5.0.2: caller is responsible for actually removing it
@@ -1284,8 +1330,9 @@
hashinsertnode (h, ht);
return (true);
- } /*hashinsert*/
+ } // hashinsert
+
/*
hashmerge (hdlhashtable hsource, hdlhashtable hdest) {
@@ -1354,7 +1401,7 @@
if (!stringtoshort (bscopy, arrayindex)) {
- langparamerror (badindexname, bs);
+ langParamErrBs ( badindexname, bs);
return (false);
}
@@ -1363,66 +1410,72 @@
} /%hashstringtoarrayindex%/
*/
-boolean hashlocate (const bigstring bs, hdlhashnode *hnode, hdlhashnode *hprev) {
+boolean hashlocate ( const Handle handleKey, hdlhashnode *hnode, hdlhashnode *hprev ) {
- /*
- 7/15/90 DW: add support for table array-style references. if the string
- begins with a $, we return the node and prev for the nth guy in the sorted
- list of the table.
- */
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 1990-07-15 DW: add support for table array-style references. if the
+ // string begins with a $, we return the node and prev for
+ // the nth guy in the sorted list of the table.
+ //
+ register hdlhashnode nomad, nomadprev;
register short ixbucket;
- register hdlhashnode nomad, nomadprev;
- /*
- short arrayindex;
+ ixbucket = hashfunction ( handleKey );
- if (hashstringtoarrayindex (bs, &arrayindex)) {
+ nomad = ( **currenthashtable ).hashbucket [ ixbucket ];
- return (hashlocatearray (arrayindex, hnode, hprev));
- }
- */
-
- ixbucket = hashfunction (bs);
-
- //assert (currenthashtable != nil);
-
- //assert (validhandle ((Handle) currenthashtable));
-
- nomad = (**currenthashtable).hashbucket [ixbucket];
-
nomadprev = nil;
while (nomad != nil) {
+
+ Handle h;
- if (equalidentifiers (bs, (**nomad).hashkey)) {
+ gethashkey ( nomad, &h );
+ if ( equalHandleIdentifiers ( handleKey, h ) ) {
+
*hnode = nomad;
*hprev = nomadprev;
+ disposehandle ( h );
+
return (true);
+
}
+ disposehandle ( h );
+
nomadprev = nomad;
nomad = (**nomad).hashlink;
- } /*while*/
- return (false); /*loop terminated, not found*/
- } /*hashlocate*/
+ } // while
+
+ return (false); // loop terminated, not found
+
+ } // hashlocate
-boolean hashunlink (const bigstring bs, hdlhashnode *hnode) {
+boolean hashunlink ( const Handle h, hdlhashnode *hnode) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
- hdlhashnode hprev;
register hdlhashnode hn;
- if (!hashlocate (bs, hnode, &hprev)) {
+ hdlhashnode hprev;
- langparamerror (cantdeleteerror, bs);
+ if (!hashlocate (h, hnode, &hprev)) {
+
+ langparamerror ( cantdeleteerror, h );
return (false);
+
}
hn = *hnode; /*copy into register*/
@@ -1430,7 +1483,7 @@
langsymbolunlinking (currenthashtable, hn);
if (hprev == nil)
- (**currenthashtable).hashbucket [hashfunction (bs)] = (**hn).hashlink;
+ (**currenthashtable).hashbucket [hashfunction (h)] = (**hn).hashlink;
else
(**hprev).hashlink = (**hn).hashlink;
@@ -1438,9 +1491,10 @@
dirtyhashtable (currenthashtable);
- langsymboldeleted (currenthashtable, bs);
+ langsymboldeleted (currenthashtable, h);
return (true);
+
} /*hashunlink*/
/*
@@ -1460,16 +1514,26 @@
*/
-boolean hashdelete (const bigstring bs, boolean fldisposevalue, boolean fldisk) {
+boolean hashdelete ( const Handle h, boolean fldisposevalue, boolean fldisk) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+
+ register hdlhashnode hn;
hdlhashnode hnode, hprev;
- register hdlhashnode hn;
+
+ if (!hashlocate ( h, &hnode, &hprev)) {
- if (!hashlocate (bs, &hnode, &hprev)) {
+ bigstring bs;
+
+ texthandletostring ( h, bs );
- langparamerror (cantdeleteerror, bs);
+ langParamErrBs ( cantdeleteerror, bs);
return (false);
+
}
hn = hnode; /*copy into register*/
@@ -1477,7 +1541,7 @@
langsymbolunlinking (currenthashtable, hn);
if (hprev == nil)
- (**currenthashtable).hashbucket [hashfunction (bs)] = (**hn).hashlink;
+ (**currenthashtable).hashbucket [ hashfunction ( h ) ] = (**hn).hashlink;
else
(**hprev).hashlink = (**hn).hashlink;
@@ -1487,49 +1551,103 @@
dirtyhashtable (currenthashtable);
- langsymboldeleted (currenthashtable, bs);
+ langsymboldeleted (currenthashtable, h );
return (true);
- } /*hashdelete*/
+
+ } // hashdelete
-boolean hashtabledelete (hdlhashtable htable, bigstring bs) {
-
+boolean hashtabledelete (hdlhashtable htable, const Handle h ) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+
boolean fl;
if (!pushhashtable (htable))
return (false);
- fl = hashdelete (bs, true, true);
+ fl = hashdelete ( h, true, true );
pophashtable ();
return (fl);
+
} /*hashtabledelete*/
-boolean hashsymbolexists (const bigstring bs) {
+boolean hashTableDeleteBigstring ( hdlhashtable htable, const bigstring bs ) {
+
+ //
+ // 2007-02-23 creedon: created
+ //
+ Handle h;
+ boolean fl;
+
+ if ( ! newtexthandle ( bs, &h ) )
+ return ( false );
+
+ fl = hashtabledelete ( htable, h );
+
+ disposehandle ( h );
+
+ return ( fl );
+
+ }
+
+
+boolean hashsymbolexists ( Handle h ) {
+
hdlhashnode hnode, hprev;
- return (hashlocate (bs, &hnode, &hprev));
- } /*hashsymbolexists*/
+ return ( hashlocate ( h, &hnode, &hprev ) );
+
+ } // hashsymbolexists
-boolean hashtablesymbolexists (hdlhashtable htable, const bigstring bs) {
+boolean hashtablesymbolexists ( hdlhashtable htable, const Handle h ) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
boolean fl;
pushhashtable (htable);
- fl = hashsymbolexists (bs);
+ fl = hashsymbolexists ( h );
pophashtable ();
return (fl);
+
} /*hashtablesymbolexists*/
+boolean hashTableSymbolExistsBigstring ( hdlhashtable htable, const bigstring bs ) {
+
+ //
+ // 2007-02-23 creedon: created
+ //
+
+ Handle h;
+ boolean fl;
+
+ if ( ! newtexthandle ( bs, &h ) )
+ return ( false );
+
+ fl = hashtablesymbolexists ( htable, h );
+
+ disposehandle ( h );
+
+ return ( fl );
+
+ } // hashTableSymbolExistsBigstring
+
+
typedef struct localityinfo {
boolean fllocal;
@@ -1557,6 +1675,7 @@
(**ht).fllocaltable = (*info).fllocal;
hashtablevisit (ht, &hashsetlocalityvisit, info);
+
}
}
@@ -1626,29 +1745,35 @@
} /*hashsetlocality*/
-boolean hashassign (const bigstring bs, tyvaluerecord val) {
-
- /*
- 9/23/91 dmb: no longer clear fllangerror, or look at it when
- hashlocate returns false. array references are implemented differently
- now, and hashlocate never generates errors. clearing fllangerror can
- have the side effect of hiding an error condition unexpectedly.
-
- 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. really, our
- caller should be exempting from the tmp stack, but this close to shipping
- let's not assume more than we have to
+boolean hashassign ( const Handle h, tyvaluerecord val ) {
- 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
-
- 5.0.1b2 dmb: when disposing a value, set fldisk false for local table items
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 5.0.2b13 dmb: set fltmpdata false & call hashsetlocality before
+ // hashinsert case
+ //
+ // 5.0.1b2 dmb: when disposing a value, set fldisk false for local table
+ // 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
+ //
+ // 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.
+ // really, our caller should be exempting from the tmp stack,
+ // but this close to shipping let's not assume more than we
+ // have to
+ //
+ // 1991-09-23 dmb: no longer clear fllangerror, or look at it when
+ // hashlocate returns false. array references are
+ // implemented differently now, and hashlocate never
+ // generates errors. clearing fllangerror can have the
+ // side effect of hiding an error condition unexpectedly.
+ //
- 5.0.2b13 dmb: set fltmpdata false & call hashsetlocality before hashinsert case
- */
-
hdlhashnode hnode, hprev;
tyvaluerecord existingval;
boolean fllocal = (**currenthashtable).fllocaltable;
@@ -1671,30 +1796,30 @@
//if (val.valuetype == externalvaluetype) // 5.0.2: localness of tables must match parent
hashsetlocality (&val, fllocal);
- if (!hashlocate (bs, &hnode, &hprev)) { /*the name doesn't exist or is invalid*/
+ if ( ! hashlocate ( h, &hnode, &hprev ) ) // the name doesn't exist or is invalid
+ return ( hashinsert ( h, val ) ); // just an undefined variable
- /*just an undefined variable*/
-
- return (hashinsert (bs, val));
- }
-
existingval = (**hnode).val;
- if (fllanghashassignprotect) { /*protect externals from being smashed by assignment*/
+ if (fllanghashassignprotect) { // protect externals from being smashed by assignment
+
+ if ((existingval.valuetype == externalvaluetype) && (val.valuetype != externalvaluetype)) {
- if ((existingval.valuetype == externalvaluetype) && (val.valuetype != externalvaluetype)) {
- bigstring bstype;
+ bigstring bs, bstype;
langexternaltypestring ((hdlexternalhandle) existingval.data.externalvalue, bstype);
- lang2paramerror (badexternalassignmenterror, bstype, bs);
+ texthandletostring ( h, bs );
+ lang2ParamErrBs ( badexternalassignmenterror, bstype, bs );
+
return (false);
+
}
}
+
+ /*carefully nuke existing value*/ {
- /*carefully nuke existing value*/ {
-
boolean flneeddatabase = (!fllocal && existingval.fldiskval);
hdldatabaserecord hdb = nil;
@@ -1714,26 +1839,56 @@
(**hnode).val = val;
- langsymbolchanged (currenthashtable, bs, hnode, true); /*value changed*/
+ langsymbolchanged ( currenthashtable, h, hnode, true ); // value changed
return (true);
- } /*hashassign*/
+
+ } // hashassign
-boolean hashtableassign (hdlhashtable htable, const bigstring bs, tyvaluerecord val) {
+boolean hashtableassign ( hdlhashtable htable, const Handle h, tyvaluerecord val ) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
boolean fl;
- pushhashtable (htable);
+ pushhashtable ( htable );
- fl = hashassign (bs, val);
+ fl = hashassign ( h, val );
- pophashtable ();
+ pophashtable ( );
- return (fl);
- } /*hashtableassign*/
+ return ( fl );
+
+ } // hashtableassign
+boolean hashtableassignstring ( hdlhashtable htable, const bigstring bs, tyvaluerecord val ) {
+
+ //
+ // 2006-12-08 creedon: cribbed from hashtableassign function
+ //
+
+ Handle h;
+ boolean fl = false;
+
+ pushhashtable ( htable );
+
+ if ( newtexthandle ( bs, &h ) )
+ if ( hashassign ( h, val ) )
+ fl = true;
+ else
+ disposehandle ( h );
+
+ pophashtable ( );
+
+ return ( fl );
+
+ } // hashtableassignstring
+
+
boolean hashresolvevalue (hdlhashtable htable, hdlhashnode hnode) {
/*
@@ -1757,7 +1912,6 @@
register hdlhashnode hn = hnode;
boolean fl;
- #ifdef version5orgreater
if (htable == pathstable && (**hn).flunresolvedaddress) {
(**hn).flunresolvedaddress = false; /*clear now to avoid potential recursion*/
@@ -1775,41 +1929,9 @@
if (!fl)
return (false);
}
- #else
- register hdlstring hstring;
- bigstring bs;
- if ((**hn).flunresolvedaddress) {
-
- (**hn).flunresolvedaddress = false; /*clear now to avoid potential recursion*/
- hstring = (**hn).val.data.addressvalue;
-
- copyheapstring (hstring, bs);
-
- pushhashtable (roottable);
-
- disablelangerror ();
-
- fl = langexpandtodotparams (bs, &htable, bs);
-
- enablelangerror ();
-
- pophashtable ();
-
- if (!fl) {
-
- // (**hn).flunresolvedaddress = true; /*didn't actually resolve it*/
-
- return (false);
- }
-
- setheapstring (bs, hstring); /*now we have just the name*/
-
- enlargehandle ((Handle) hstring, sizeof (hdlhashtable), &htable); /*should never fail*/
- }
- #endif
-
if ((**hn).val.fldiskval) {
+
Handle hbinary;
hdldatabaserecord hdb = tablegetdatabase (htable);
@@ -1832,22 +1954,26 @@
(**hn).val.data.binaryvalue = hbinary;
(**hn).val.fldiskval = false;
+
}
return (true);
+
} /*hashresolvevalue*/
-boolean hashlookup (const bigstring bs, tyvaluerecord *vreturned, hdlhashnode *hnode) {
+boolean hashlookup ( const Handle h, tyvaluerecord *vreturned, hdlhashnode *hnode ) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 1992-03-19 dmb: must check for unresolved addresses here
+ //
- /*
- 3/19/92 dmb: must check for unresolved addresses here
- */
-
hdlhashnode hprev;
- if (!hashlocate (bs, hnode, &hprev))
- return (false);
+ if ( ! hashlocate ( h, hnode, &hprev ) )
+ return ( false );
if (!hashresolvevalue (currenthashtable, *hnode))
return (false);
@@ -1855,10 +1981,15 @@
*vreturned = (***hnode).val;
return (true);
+
} /*hashlookup*/
-boolean hashtablelookup (hdlhashtable htable, const bigstring bs, tyvaluerecord *vreturned, hdlhashnode *hnode) {
+boolean hashtablelookup (hdlhashtable htable, const Handle h, tyvaluerecord *vreturned, hdlhashnode *hnode) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
boolean fl;
@@ -1868,120 +1999,116 @@
pushhashtable (htable);
- fl = hashlookup (bs, vreturned, hnode);
+ fl = hashlookup (h, vreturned, hnode);
pophashtable ();
return (fl);
+
} /*hashtablelookup*/
-boolean hashlookupnode (const bigstring bs, hdlhashnode *hnode) {
+boolean hashlookupnode ( Handle h, hdlhashnode *hnode ) {
- /*
- 3/19/92 dmb: must check for unresolved addresses here
- */
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 1992-03-19 dmb: must check for unresolved addresses here
+ //
hdlhashnode hprev;
- if (!hashlocate (bs, hnode, &hprev))
- return (false);
+ if ( ! hashlocate ( h, hnode, &hprev ) )
+ return ( false );
return (hashresolvevalue (currenthashtable, *hnode));
- } /*hashlookupnode*/
+
+ } // hashlookupnode
-boolean hashtablelookupnode (hdlhashtable htable, const bigstring bs, hdlhashnode *hnode) {
+boolean hashtablelookupnode (hdlhashtable htable, const Handle h, hdlhashnode *hnode) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
boolean fl;
pushhashtable (htable);
- fl = hashlookupnode (bs, hnode);
+ fl = hashlookupnode (h, hnode);
pophashtable ();
return (fl);
+
} /*hashtablelookupnode*/
-static boolean hashinsertaddress (bigstring bsname, bigstring bsval) {
+boolean hashTableLookupNodeBigstring ( hdlhashtable htable, const bigstring bs, hdlhashnode *hnode ) {
+
+ //
+ // 2007-02-23 creedon: created
+ //
- /*
- 3/19/92 dmb: discovered critical bug: if we try to resolve address references
- here, using langexpandtodotparams, an address that references the table
- being unpacked will generate infinite recursion. That answer is to leave
- the address in its string format for now, and then resolve the address when
- it's referenced through a hashlookup. this necessitated adding a new flag
- to the hashrecord, and introducing the hnewnode global so we know what node
- was created by hashinsert. also, to preserve the original path information
- and coordinate with getaddressvalue, we adopted a new convention of using
- a hashtable of -1 to indicate an unresvoled address value.
- */
+ Handle h;
+ boolean fl;
- tyvaluerecord val;
+ if ( ! newtexthandle ( bs, & h ) )
+ return ( false );
- if (!setaddressvalue ((hdlhashtable) -1, bsval, &val))
- return (false);
+ fl = hashtablelookupnode ( htable, h, hnode );
- if (!hashinsert (bsname, val))
- return (false);
+ disposehandle ( h );
- exemptfromtmpstack (&val);
+ return ( fl );
- (**hnewnode).flunresolvedaddress = true;
-
- return (true);
- } /*hashinsertaddress*/
+ } // hashTableLookupNodeBigstring
-/*
-static boolean hashinsertaddress (bigstring bsname, bigstring bsval) {
+static boolean hashinsertaddress ( const Handle handleName, const Handle handleValue ) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 1992-03-19 dmb: discovered critical bug: if we try to resolve address
+ // references here, using langexpandtodotparams, an address that references
+ // the table being unpacked will generate infinite recursion. The answer
+ // is to leave the address in its string format for now, and then resolve
+ // the address when it's referenced through a hashlookup. this
+ // necessitated adding a new flag to the hashrecord, and introducing the
+ // hnewnode global so we know what node was created by hashinsert. also,
+ // to preserve the original path information and coordinate with
+ // getaddressvalue, we adopted a new convention of using a hashtable of -1
+ // to indicate an unresvoled address value.
+ //
tyvaluerecord val;
- hdlhashtable htable;
- bigstring bs;
- boolean fl;
- pushhashtable (roottable);
-
- disablelangerror ();
-
- if (langexpandtodotparams (bsval, &htable, bs))
- fl = setaddressvalue (htable, bs, &val);
- else
- fl = setstringvalue (bsval, &val);
-
- enablelangerror ();
-
- pophashtable ();
-
- if (!fl)
+ if ( ! setaddressvalue ( ( hdlhashtable ) - 1, handleValue, &val ) )
return (false);
- if (!hashinsert (bsname, val))
- return (false);
+ if ( ! hashinsert ( handleName, val ) )
+ return ( false );
- pushhashtable (roottable);
+ exemptfromtmpstack ( &val );
- exemptfromtmpstack (val);
+ ( **hnewnode ).flunresolvedaddress = true;
- pophashtable ();
+ return ( true );
- return (true);
- } /%hashinsertaddress%/
-*/
+ } // hashinsertaddress
-boolean hashtablevisit (hdlhashtable htable, langtablevisitcallback visit, ptrvoid refcon) {
+boolean hashtablevisit ( hdlhashtable htable, langtablevisitcallback visit, ptrvoid refcon ) {
/*
###4.0.2b1 warning: scalar node values may now be on disk. callers that may
- be examining strings values must handle this. (currently these are no such callers.)
+ 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++) {
@@ -1991,20 +2118,24 @@
hdlhashnode nextx = (**x).hashlink;
- if (!(*visit) (x, refcon))
- return (false);
+ if ( ! ( *visit ) ( x, refcon ) )
+ return ( false );
x = nextx;
- } /*while*/
- } /*for*/
+
+ } // while
+
+ } // for
...
[truncated message content] |
|
From: <cre...@us...> - 2007-02-24 00:04:28
|
Revision: 1625
http://svn.sourceforge.net/frontierkernel/?rev=1625&view=rev
Author: creecode
Date: 2007-02-23 16:04:28 -0800 (Fri, 23 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/langdll.h
Frontier/branches/Frontier_Long_File_Paths/Common/source/langdll.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langerror.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langerrorwindow.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langevaluate.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langexternal.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/langdll.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/langdll.h 2007-02-23 21:45:04 UTC (rev 1624)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/langdll.h 2007-02-24 00:04:28 UTC (rev 1625)
@@ -77,8 +77,8 @@
odbBool xCALLBACK extInvoke (bigstring bsscriptname, void * pDispParams, odbValueRecord * retval, boolean *flfoundhandler, unsigned int * errarg);
odbBool xCALLBACK extCoerce (odbValueRecord * odbval, odbValueType newtype);
-odbBool xCALLBACK extCallScript (odbString bspath, odbValueRecord *vparams, odbValueRecord *value); /* 2002-10-13 AR */
-odbBool xCALLBACK extCallScriptText (odbString bspath, odbValueRecord *vparams, Handle * text); /* 2002-10-13 AR */
+odbBool xCALLBACK extCallScript ( const Handle, odbValueRecord *, odbValueRecord * ); /* 2002-10-13 AR */
+odbBool xCALLBACK extCallScriptText ( const Handle, odbValueRecord *, Handle * ); /* 2002-10-13 AR */
odbBool xCALLBACK extThreadYield (void); /* 2003-04-22 AR */
odbBool xCALLBACK extThreadSleep (long sleepticks); /* 2003-04-22 AR */
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langdll.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langdll.c 2007-02-23 21:45:04 UTC (rev 1624)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langdll.c 2007-02-24 00:04:28 UTC (rev 1625)
@@ -786,13 +786,16 @@
} /*extInvoke*/
-odbBool xCALLBACK extCallScript (odbString bspath, odbValueRecord *vparams, odbValueRecord *value) {
+odbBool xCALLBACK extCallScript ( const Handle handlePath, odbValueRecord *vparams, odbValueRecord *value) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 2002-10-13 AR: Run the script at bspath with the parameters supplied in
+ // vparams. This is an adaption of callscriptverb
+ // (langverbs.c) for the DLL callback interface.
+ //
- /*
- 2002-10-13 AR: Run the script at bspath with the parameters supplied in vparams.
- This is an adaption of callscriptverb (langverbs.c) for the DLL callback interface.
- */
-
odbBool res = false;
tyvaluerecord val;
tyvaluerecord vret;
@@ -803,7 +806,7 @@
convertodbtotyval (vparams, &val);
- if (langrunscript (bspath, &val, nil, &vret)) {
+ if (langrunscript (handlePath, &val, nil, &vret)) {
exemptfromtmpstack (&vret);
@@ -812,21 +815,26 @@
(*value).data.binaryvalue = vret.data.binaryvalue; /*largest field covers everything*/
res = true;
+
}
}
releasethreadglobals ();
return (res);
+
} /* extCallScript */
-odbBool xCALLBACK extCallScriptText (odbString bspath, odbValueRecord *vparams, Handle * text) {
+odbBool xCALLBACK extCallScriptText ( const Handle handlePath, odbValueRecord *vparams, Handle *text ) {
- /*
- 2002-10-13 AR: Like extCallScript, but coerce the result to a string and return it
- */
-
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 2002-10-13 AR: Like extCallScript, but coerce the result to a string and
+ // return it
+ //
+
odbBool res = false;
tyvaluerecord val;
tyvaluerecord vret;
@@ -837,7 +845,7 @@
convertodbtotyval (vparams, &val);
- if (langrunscript (bspath, &val, nil, &vret)) {
+ if (langrunscript (handlePath, &val, nil, &vret)) {
if (coercetostring (&vret)) {
@@ -846,6 +854,7 @@
*text = vret.data.binaryvalue;
res = true;
+
}
}
}
@@ -853,6 +862,7 @@
releasethreadglobals ();
return (res);
+
} /* extCallScriptText */
@@ -1034,7 +1044,7 @@
getfsfile ( &fs, bs );
- lang2paramerror (cantfindprocinfofunctionerror, bsprocname, bs );
+ lang2ParamErrBs ( cantfindprocinfofunctionerror, bsprocname, bs );
return (false);
} // locateprocinfo
@@ -1257,10 +1267,10 @@
if (bsprocname != nil)
- lang2paramerror (cantfindprocinfoerror, bsprocname, bs);
+ lang2ParamErrBs ( cantfindprocinfoerror, bsprocname, bs);
else
- langparamerror (cantfindprocinfoloaderror, bs );
+ langParamErrBs ( cantfindprocinfoloaderror, bs );
return (false);
@@ -1469,11 +1479,13 @@
//
// Platform-specific code for loading the library code into memory
//
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
// 2006-06-25 creedon: for Mac, FSRef-ized
//
-
+
tyfilespec fs = (**hdll).fs;
-
+
#ifdef WIN95VERSION
bigstring fn;
@@ -1488,6 +1500,7 @@
(**hdll).hdllsyshandle = (tydllsyshandle) COMStartup(); /*** FIXME: make sure we deal properly with the COM DLL ***/
return ((**hdll).hdllsyshandle != nil);
+
}
#endif
@@ -1532,13 +1545,20 @@
if ((**hdll).hdllsyshandle == NULL) {
+ Handle h;
bigstring bs;
getfsfile ( &fs, bs );
-
- lang2paramerror (cantconnecttodllerror, bsfunctionname, bs );
+ if ( ! newtexthandle ( bs, &h ) )
+ return ( false );
+
+ lang2paramerror ( cantconnecttodllerror, handleFunctionName, h );
+
+ disposehandle ( h );
+
return (false);
+
}
return (true);
@@ -1778,7 +1798,7 @@
getfsfile ( &fs, bs );
- lang2paramerror (cantfinddllfunctionerror, (**hprocinfo).bsprocname, bs );
+ lang2ParamErrBs ( cantfinddllfunctionerror, (**hprocinfo).bsprocname, bs );
goto exit;
}
@@ -1826,6 +1846,7 @@
#endif
langerrormessage (errmsg);
+
}
exit:
@@ -1871,6 +1892,7 @@
(**hdll).ctreferences--;
return (fl);
+
} /*callproc*/
@@ -1898,6 +1920,7 @@
unloadlibrary (hdll);
return (fl);
+
} /*callstayresident*/
@@ -1944,6 +1967,7 @@
unloadlibrary (hdll);
return (fl);
+
} /*callvolatile*/
@@ -1956,6 +1980,7 @@
*/
return (getlibrary (fs) != nil);
+
} /*islibraryloaded*/
@@ -1986,11 +2011,13 @@
}
addlibrary (hdll);
+
}
*hdllptr = hdll;
return (true);
+
} /*dodllload*/
@@ -2014,6 +2041,7 @@
}
return (true);
+
} /*dodllunload*/
@@ -2034,6 +2062,7 @@
fl = callvolatile (hparam1, fs, bsprocname, vreturned);
return (fl);
+
} /*dodllcall*/
@@ -2099,10 +2128,13 @@
info->resulttype = gettypefromchar (parameterline[0]);
for (i = 0; i < info->ctparams; i++) {
+
info->paramtypes[i] = gettypefromchar (parameterline[i+1]);
+
}
return (true);
+
}
}
@@ -2166,8 +2198,11 @@
info->moduleDesc.routineRecords [0].procDescriptor = (ProcPtr)info->procAddress; // fill in the blank
info->moduleUPP = (UniversalProcPtr) &(info->moduleDesc);
+
}
+
#endif
+
#endif
#ifdef WIN95VERSION
@@ -2176,19 +2211,22 @@
if (info->procAddress == NULL) {
- lang2paramerror (cantfinddllfunctionerror, bsprocname, fsname (fs));
+ lang2ParamErrBs ( cantfinddllfunctionerror, bsprocname, fsname (fs));
return (false);
+
}
if (!parseprocdata (procname, info)) {
- lang2paramerror (cantfindprocinfofunctionerror, bsprocname, fsname (fs));
+ lang2ParamErrBs ( cantfindprocinfofunctionerror, bsprocname, fsname (fs));
return (false);
+
}
return (true);
+
} /*getprocinfo*/
@@ -2229,6 +2267,7 @@
#endif
return (*hModule != NULL);
+
} /*islibraryloaded*/
@@ -2291,7 +2330,7 @@
#endif
if (hModule == NULL)
- lang2paramerror (cantconnecttodllerror, bsfunctionname, fsname (fs));
+ lang2ParamErrBs ( cantconnecttodllerror, handleFunctionName, fsname (fs));
return (hModule);
} /*doloadlibrary*/
@@ -2310,6 +2349,7 @@
#ifdef MACVERSION
return (CloseConnection ((CFragConnectionID *) &hModule) == noErr);
#endif
+
} /*dofreelibrary*/
@@ -2329,7 +2369,7 @@
load the dll, find the module, and map its parameter info to our types.
*/
- copystring (bsprocname, bsfunctionname); // for error reporting
+ copystring (bsprocname, handleFunctionName); // for error reporting
info->moduleHandle = doloadlibrary (fs, false);
@@ -2364,19 +2404,22 @@
HLock (hRes);
info->pdata = *hRes;
+
}
CloseResFile (resfile);
+
}
#endif
if (info->pdata == NULL) {
- lang2paramerror (cantfindprocinfoerror, bsprocname, fsname (fs));
+ lang2ParamErrBs ( cantfindprocinfoerror, bsprocname, fsname (fs));
dofreelibrary (info->moduleHandle, false);
goto exit;
+
}
if (getprocinfo (fs, bsprocname, info))
@@ -2391,6 +2434,7 @@
#endif
return (fl);
+
} /*loaddllmodule*/
@@ -2399,6 +2443,7 @@
/*
call the dll.
*/
+
boolean fl = false;
releasethreadglobals ();
@@ -2427,6 +2472,7 @@
grabthreadglobals ();
return fl;
+
} /*langcalldll*/
#endif /* NEW_DLL_INTERFACE */
@@ -2725,13 +2771,13 @@
tyfilespec fsdll;
bigstring bsprocname;
-
+
if (!getfilespecvalue (hparam1, 1, &fsdll))
return (false);
-
+
if (!getstringvalue (hparam1, 2, bsprocname))
return (false);
-
+
return (dodllcall (hparam1, &fsdll, bsprocname, vreturned));
#else
@@ -2817,11 +2863,12 @@
(*vreturned).data.longvalue = dllcall.resultdata;
- pushvalueontmpstack (vreturned);
+ pushvalueontmpstack (vreturned);
+
}
}
- else
- {
+ else {
+
bigstring errmsg;
#ifdef MACVERSION
@@ -2831,6 +2878,7 @@
#endif
langerrormessage (errmsg);
+
}
return (fl);
@@ -2849,5 +2897,6 @@
if (dllcallbacks != nil)
fillcalltable (dllcallbacks);
}
+
} /*initdllverbs*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langerror.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langerror.c 2007-02-23 21:45:04 UTC (rev 1624)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langerror.c 2007-02-24 00:04:28 UTC (rev 1625)
@@ -34,29 +34,29 @@
#include "langinternal.h"
-
boolean fllangerror = false; /*if true, the langerror dialog has already appeared*/
unsigned short langerrordisable = 0; /*it's possible to temporarily disable lang errors*/
-
-
void disablelangerror (void) {
++langerrordisable;
+
} /*disablelangerror*/
void enablelangerror (void) {
--langerrordisable;
+
} /*enablelangerror*/
boolean langerrorenabled (void) {
return (langerrordisable == 0);
+
} /*langerrorenabled*/
@@ -87,40 +87,83 @@
getstringlist (langerrorlist, stringnum, bs);
langerrormessage (bs);
+
} /*langerror*/
-void lang3paramerror (short stringnum, const bigstring bs1, const bigstring bs2, const bigstring bs3) {
+void lang3paramerror ( short stringnum, const Handle h1, const Handle h2, const Handle h3 ) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ Handle h;
bigstring bs;
getstringlist (langerrorlist, stringnum, bs);
- parsedialogstring (bs, (ptrstring) bs1, (ptrstring) bs2, (ptrstring) bs3, nil, bs);
+ newtexthandle ( bs, &h );
+ parsedialoghandle ( h, h1, h2, h3, nil );
+
+ texthandletostring ( h, bs );
+
+ disposehandle ( h );
+
langerrormessage (bs);
- } /*lang3paramerror*/
+
+ } // lang3paramerror
-void langparamerror (short stringnum, const bigstring bsparam) {
+void lang3ParamErrBs ( short stringnum, const bigstring bs1, const bigstring bs2, const bigstring bs3 ) {
- lang3paramerror (stringnum, bsparam, nil, nil);
- } /*langparamerror*/
+ bigstring bs;
+
+ getstringlist ( langerrorlist, stringnum, bs );
+
+ parsedialogstring ( bs, ( ptrstring ) bs1, ( ptrstring ) bs2, ( ptrstring ) bs3, NULL, bs );
+
+ langerrormessage ( bs );
+
+ } // lang3ParamErrBs
-void lang2paramerror (short stringnum, const bigstring bs1, const bigstring bs2) {
+void langparamerror ( short stringnum, const Handle h ) {
- lang3paramerror (stringnum, bs1, bs2, nil);
- } /*lang2paramerror*/
+ lang3paramerror ( stringnum, h, NULL, NULL );
+
+ } // langparamerror
+void langParamErrBs ( short stringnum, const bigstring bs ) {
+
+ lang3ParamErrBs ( stringnum, bs, NULL, NULL );
+
+ } // langParamErrBs
+
+
+void lang2paramerror ( short stringnum, const Handle h1, const Handle h2 ) {
+
+ lang3paramerror ( stringnum, h1, h2, NULL );
+
+ } // lang2paramerror
+
+
+void lang2ParamErrBs ( short stringnum, const bigstring bs1, const bigstring bs2 ) {
+
+ lang3ParamErrBs ( stringnum, bs1, bs2, NULL );
+
+ } // lang2ParamErrBs
+
+
void langlongparamerror (short stringnum, long x) {
byte bslong [64];
numbertostring (x, bslong);
- lang3paramerror (stringnum, bslong, nil, nil);
+ lang3ParamErrBs ( stringnum, bslong, nil, nil);
+
} /*langlongparamerror*/
@@ -130,7 +173,8 @@
ostypetostring (x, bsid);
- lang3paramerror (stringnum, bsid, nil, nil);
+ lang3ParamErrBs ( stringnum, bsid, nil, nil);
+
} /*langostypeparamerror*/
@@ -142,8 +186,7 @@
convertcstring (bscopy); /*convert a c string to pascal format*/
- langparamerror (parsererror, bscopy);
+ langParamErrBs ( parsererror, bscopy);
+
} /*parseerror*/
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langerrorwindow.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langerrorwindow.c 2007-02-23 21:45:04 UTC (rev 1624)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langerrorwindow.c 2007-02-24 00:04:28 UTC (rev 1625)
@@ -514,17 +514,23 @@
pe = &(**hs).stack [ix];
return ((*(*pe).errorcallback) ((*pe).errorrefcon, (*pe).errorline, (*pe).errorchar, nil, nil));
+
} /*langerrorpopupselect*/
static boolean langerrorfillerrorpopup (hdlmenu hmenu, short *checkeditem) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
register hdlerrorstack hs = (**langerrordata).herrorstack;
- register short ix;
- register short ixtop;
- hdlhashtable htable;
+ register short ix, ixtop;
+
+ Handle handleName;
bigstring bsname;
boolean flenabled;
+ hdlhashtable htable;
if (hs == nil)
return (false);
@@ -535,17 +541,20 @@
tyerrorrecord *pe = &(**hs).stack [ix];
- if ((*pe).errorcallback == nil ||
- !(*(*pe).errorcallback) ((*pe).errorrefcon, 0, 0, &htable, bsname)) {
+ if ( ( *pe ).errorcallback == nil || ! ( *( *pe ).errorcallback ) ( ( *pe ).errorrefcon, 0, 0, &htable, &handleName ) ) {
- langgetstringlist (anomynousthreadstring, bsname);
+ langgetstringlist ( anomynousthreadstring, bsname );
flenabled = false;
+
}
- else {
+ else
flenabled = true;
- }
+ texthandletostring ( handleName, bsname );
+
+ disposehandle ( handleName );
+
if (!pushpopupitem (hmenu, bsname, flenabled, 0)) /*terminate visit on error*/
return (false);
}
@@ -553,8 +562,10 @@
*checkeditem = -1;
return (true);
+
} /*langerrorfillerrorpopup*/
+
static boolean langerrorpopupmenu (void) {
/*
@@ -682,9 +693,10 @@
} /*langerrorkeystroke*/
-boolean langerrordialog (bigstring bsmsg, ptrvoid refcon) {
-#pragma unused (refcon)
+boolean langerrordialog ( bigstring bsmsg, ptrvoid refcon ) {
+ #pragma unused (refcon)
+
unsigned short savedlines, savedchars;
if (isemptystring (bsmsg)) /*don't post empty messages -- scipterrror ("") relies on this*/
@@ -697,6 +709,7 @@
ctscanlines = savedlines; ctscanchars = savedchars; /*restore*/
return (true);
+
} /*langerrordialog*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langevaluate.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langevaluate.c 2007-02-23 21:45:04 UTC (rev 1624)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langevaluate.c 2007-02-24 00:04:28 UTC (rev 1625)
@@ -55,25 +55,31 @@
#ifdef PASCALSTRINGVERSION
-byte bscontainername [] = "\x0a" "_container\0";
-static byte nametryerrorval [] = "\x08" "tryerror\0";
-
-#if fltryerrorstackcode
- static byte nametryerrorstackval [] = "\x0d" "tryerrorstack\0";
-#endif
-
+ byte bscontainername [ ] = "\x0a" "_container\0";
+
+ static byte nametryerrorval [ ] = "\x08" "tryerror\0";
+
+ #if fltryerrorstackcode
+
+ static byte nametryerrorstackval [ ] = "\x0d" "tryerrorstack\0";
+
+ #endif
+
#else
-byte bscontainername [] = "_container";
-
-static byte nametryerrorval [] = "tryerror";
-
-#if fltryerrorstackcode
- static byte nametryerrorstackval [] = "tryerrorstack";
+ byte bscontainername [ ] = "_container";
+
+ static byte nametryerrorval [ ] = "tryerror";
+
+ #if fltryerrorstackcode
+
+ static byte nametryerrorstackval [ ] = "tryerrorstack";
+
+ #endif
+
#endif
-#endif
void langseterrorline (hdltreenode hnode) {
@@ -92,7 +98,9 @@
ctscanchars = (**hnode).charnum;
herrornode = hnode;
+
}
+
} /*langseterrorline*/
@@ -101,18 +109,19 @@
#if fldebug > 0
static boolean validvalue (tyvaluerecord *val) {
-
+
Handle h;
if (!langheapallocated (val, &h))
return (true);
+
+ return (validhandle (h));
- return (validhandle (h));
} /*validvalue*/
static boolean leakingmemory (tyvaluerecord *val) {
-
+
/*
1/14/91 dmb: verify that val is in the temp stack if it's heap-allocated
*/
@@ -120,22 +129,23 @@
register Handle h;
register short ctloops;
register tyvaluerecord *p;
+
Handle hcheck;
if (!langheapallocated (val, &hcheck))
return (false);
-
+
if ((*val).fltmpdata) /*data has never been copied from original*/
return (false);
-
+
if ((*val).valuetype == externalvaluetype)
return (false);
-
+
h = hcheck; /*move into register*/
if (currenthashtable == nil)
return (true);
-
+
p = (**currenthashtable).tmpstack;
for (ctloops = (**currenthashtable).cttmpstack; ctloops--; ++p) { /*step through tmpstack*/
@@ -145,17 +155,20 @@
assert (validvalue (val)); /*make sure it's not already disposed*/
return (false);
+
}
+
} /*while*/
return (true); /*didn't find it -- it's a leak!*/
+
} /*leakingmemory*/
#else
#define validvalue(v) (true)
#define leakingmemory(v) (false)
-
+
#endif
#endif
@@ -293,108 +306,131 @@
flbreak = false; /*only good for one level*/
return (true);
+
}
if (!langdebuggercall (h)) /*user killed the script*/
return (false);
+
} /*for*/
return (true);
+
} /*evaluateforloop*/
static boolean evaluateforinloop (hdltreenode hloop, tyvaluerecord vlist, tyvaluerecord *valtree) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 6.1b12 AR: Fixed crashes when trying to loop over root table.
+ //
+ // 6.1d19 AR: Make work for tables too. (Again?)
+ //
+ // 4.28.97 dmb: put list "counter" value in valtree, so it's the statement
+ // value if nothing is return-d.
+ //
+ // 4.1b8 dmb: fixed bug when evaluatetree within the loop returns false.
+ //
+ // 1993-04-14 dmb: don't try to coerce records to lists; leave them as is.
+ //
+ // 1993-03-19 dmb: make work for tables too.
+ //
+ // 1993-03-17 dmb: a new loop for list processing:
+ //
+ // for counter in x
+ // <body>
+ //
- /*
- 3/17/93 dmb: a new loop for list processing:
-
- for counter in x
- <body>
-
- 3/19/93 dmb: make work for tables too.
-
- 4/14/93 dmb: don't try to coerce records to lists; leave them as is.
-
- 4.1b8 dmb: fixed bug when evaluatetree within the loop returns false.
-
- 4.28.97 dmb: put list "counter" value in valtree, so it's the statement value
- if nothing is return-d.
+ register hdltreenode htn = hloop;
- 6.1d19 AR: Make work for tables too. (Again?)
-
- 6.1b12 AR: Fixed crashes when trying to loop over root table.
- */
+ register hdltreenode hcounter = (**htn).param2;
+ register long ixlist = 0;
+ Handle handleName;
+ boolean fl = false, fltable = false;
+ hdlhashnode hnode;
hdlhashtable htable;
- register hdltreenode h = hloop;
- register long ixlist = 0;
long ctitems;
- register hdltreenode hcounter = (**h).param2;
- boolean fltable = false;
- boolean fl = false;
- bigstring bsname;
- hdlhashnode hnode;
if (vlist.valuetype == addressvaluetype) {
+ Handle h;
hdlhashtable ht;
- bigstring bs;
tyvaluerecord val;
- if (!getaddressvalue (vlist, &ht, bs))
+ if (!getaddressvalue (vlist, &ht, &h))
return (false);
- if (ht == nil && langgetspecialtable (bs, &htable))
+ if (ht == nil && langgetspecialtable (h, &htable))
fltable = true;
if (!fltable) {
- if (ht == nil && !langsearchpathlookup (bs, &ht)) {
- langparamerror (unknownidentifiererror, bs);
- return (false);
+ if (ht == nil && !langsearchpathlookup (h, &ht)) {
+
+ langparamerror ( unknownidentifiererror, h );
+
+ disposehandle ( h );
+
+ return ( false );
+
}
-
- if (!langhashtablelookup (ht, bs, &val, &hnode))
- return (false);
-
+
+ if (!langhashtablelookup (ht, h, &val, &hnode)) {
+
+ disposehandle ( h );
+
+ return ( false );
+
+ }
+
if (langexternalvaltotable (val, &htable, hnode))
fltable = true;
}
+
+ disposehandle ( h );
+
}
-
+
if (!fltable) {
if (vlist.valuetype != recordvaluetype)
if (!coercetolist (&vlist, listvaluetype))
return (false);
-
+
if (!langgetlistsize (&vlist, &ctitems))
return (false);
+
+ exemptfromtmpstack (&vlist); /*protect our list*/
- exemptfromtmpstack (&vlist); /*protect our list*/
}
+
+ while (true) {
- while (true) {
+ if (fltable) {
- if (fltable) {
-
- if (!hashgetiteminfo (htable, ixlist++, bsname, nil)) { /* 0-based */
-
+ if (!hashgetiteminfo (htable, ixlist++, &handleName, nil)) { /* 0-based */
+
fl = true;
-
+
break;
+
}
-
- setaddressvalue (htable, bsname, valtree);
+
+ setaddressvalue (htable, handleName, valtree);
+
+ disposehandle ( handleName );
+
}
-
else {
-
if (++ixlist > ctitems) { /* 1-based */
fl = true;
break;
+
}
if (!langgetlistitem (&vlist, ixlist, nil, valtree)) // 4.28.97 dmb: use valtree, not local val
@@ -412,7 +448,7 @@
flcontinue = false;
- fl = evaluatelist ((**h).param4, valtree);
+ fl = evaluatelist ((**htn).param4, valtree);
if (!fl)
break;
@@ -428,107 +464,24 @@
fl = true;
break;
+
}
+
+ if (!langdebuggercall (htn)) /*user killed the script*/
+ break;
+
+ } // while
-
- if (!langdebuggercall (h)) /*user killed the script*/
- break;
- } /*for*/
-
if (!fltable)
disposetmpvalue (&vlist);
+
+ return ( fl );
- return (fl);
} /*evaluateforinloop*/
-#if 0 /*support for fileloop file filtering*/
-#include "strings.h"
-#include "tableverbs.h"
+static boolean fileloopguts (hdltreenode htree, ptrfilespec fsfolder, const Handle handleIdentifier, long ctlevels, tyvaluerecord *valtree) {
-
-static hdlhashtable hfiletable = nil;
-
-static hdltreenode hpathtree = nil;
-
-/*
-static hdltreenode hfilecalltree = nil;
-*/
-
-static boolean fileidvaluecallback (hdltreenode htree, tyvaluerecord *val) {
-
- register hdltreenode h = htree;
- bigstring bsverb;
-
- if ((**h).nodetype != identifierop)
- return (false);
-
- langgetidentifier (h, bsverb);
-
- if (!hashtablesymbolexists (hfiletable, bsverb))
- return (false);
-
- return (kernelfunctionvalue (hfiletable, bsverb, hpathtree, val));
- } /*fileidvaluecallback*/
-
-
-static hdltreenode hfiltertree;
-
-
-static boolean fileloopfilter (bigstring bsfolder, bigstring bsfile) {
-
- /*
- 6.2b15 AR: Call coercetoboolean directly instead of the now defunct truevalue
- */
-
- tyvaluerecord val;
- boolean fl;
- bigstring bspath;
- Handle hpath;
-
- if (hfiletable == nil) { /****need to do 1-time initialization*/
-
- initvalue (&val, stringvaluetype);
-
- if (!newconstnode (val, &hpathtree))
- return (false);
-
- findnamedtable (efptable, "\pfile", &hfiletable);
- }
-
- if (isfolderpath (bsfile))
- return (true);
-
- addstrings (bsfolder, bsfile, bspath);
-
- if (!newtexthandle (bspath, &hpath))
- return (false);
-
- (**hpathtree).nodeval.data.stringvalue = hpath;
-
- langcallbacks.idvaluecallback = &fileidvaluecallback;
-
- fl = evaluatetree (hfiltertree, &val);
-
- cleartmpstack ();
-
- langcallbacks.idvaluecallback = nil;
-
- disposehandle (hpath);
-
- if (!fl)
- return (false);
-
- if (!coercetoboolean (&val))
- return (false);
-
- return (val.data.flvalue);
- } /*fileloopfilter*/
-
-#endif
-
-static boolean fileloopguts (hdltreenode htree, ptrfilespec fsfolder, bigstring bsidentifier, long ctlevels, tyvaluerecord *valtree) {
-
//
// the core of fileloop evaluation, now recursive.
//
@@ -536,6 +489,8 @@
//
// if ctlevels is not -1, only process files, and recurse for folders to the specified depth
//
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
// 2006-10-26 creedon: on Mac, fix a problem with CFRelease releasing data that needed to hang around
//
// 2006-10-03 creedon: for Mac, minimally FSRef-ized
@@ -543,12 +498,13 @@
// 1992-10-08 dmb: break & return must kick out of all levels of recursion (whew!)
//
+ register boolean fl;
register hdltreenode h = htree;
- register boolean fl;
+
+ Handle hfileloop;
+ boolean flfolder;
+ tyfilespec fs;
tyvaluerecord val;
- tyfilespec fs;
- boolean flfolder;
- Handle hfileloop;
clearbytes ( &fs, sizeof ( fs ) );
@@ -580,7 +536,7 @@
if (ctlevels > 0) {
- fl = fileloopguts (h, &fs, bsidentifier, ctlevels - 1, valtree);
+ fl = fileloopguts (h, &fs, handleIdentifier, ctlevels - 1, valtree);
if (!fl)
break;
@@ -619,7 +575,7 @@
if (!fl)
break;
- fl = langsetsymbolval (bsidentifier, val); // user program gets the name
+ fl = langsetsymbolval (handleIdentifier, val); // user program gets the name
if (!fl)
break;
@@ -659,65 +615,75 @@
static boolean evaluatefileloop (hdltreenode hloop, tyvaluerecord *valtree) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 1992-10-08 dmb: must clear flbreak here so that fileloopguts can leave
+ // it set while unwinding recursion
+ //
+ // 1992-04-24 dmb: removed misplaced & redundant leakingmemory check
+ //
+ // 1990-07-09 DW: bug -- fileloops leak memory.
+ //
- /*
- 7/9/90 DW: bug -- fileloops leak memory.
+ register hdltreenode h = hloop;
+ register hdltreenode hp = (**h).param2;
- 4/24/92 dmb: removed misplaced & redundant leakingmemory check
-
- 10/8/92 dmb: must clear flbreak here so that fileloopguts can leave it set
- while unwinding recursion
- */
-
- register hdltreenode h = hloop;
+ Handle handleIdentifier = NULL;
+ boolean fl = false;
+ long ctlevels;
tyfilespec fsfolder;
- bigstring bsidentifier;
tyvaluerecord val;
- register hdltreenode hp = (**h).param2;
- long ctlevels;
if (!evaluatetree (hp, &val)) /*the path is the second parameter*/
return (false);
-
+
if (!coercetofilespec (&val))
return (false);
-
+
assert (!leakingmemory (&val));
- fsfolder = **val.data.filespecvalue;
+ fsfolder = **val.data.filespecvalue;
- if (!langgetidentifier ((**h).param1, bsidentifier))
+ if ( ! langgetidentifier ( ( **h ).param1, &handleIdentifier ) )
return (false);
-
+
hp = (**h).param4; /*copy into register*/
if (hp == nil) /*no depth clause*/
ctlevels = -1;
+ else {
- else {
-
if (!evaluatetree (hp, &val))
return (false);
-
+
if (!coercetolong (&val))
return (false);
-
+
ctlevels = val.data.longvalue;
if (ctlevels <= 0)
return (true);
+
+ --ctlevels;
- --ctlevels;
}
-
+
langseterrorline (h); /*reset error reporting after evaulatetree calls*/
- if (!fileloopguts (h, &fsfolder, bsidentifier, ctlevels, valtree))
- return (false);
-
+ if (!fileloopguts (h, &fsfolder, handleIdentifier, ctlevels, valtree))
+ goto exit;
+
flbreak = false; /*good for all levels of single fileloop*/
- return (true);
+ fl = true;
+
+ exit:
+ disposehandle ( handleIdentifier );
+
+ return ( fl );
+
} /*evaluatefileloop*/
@@ -877,10 +843,10 @@
#endif
- if ((hs == nil) || ((**hs).toperror == 0)) {
-
+ if ((hs == nil) || ((**hs).toperror == 0))
+
return (-1);
- }
+
else {
#if TARGET_API_MAC_CARBON == 1
@@ -896,37 +862,40 @@
#endif
return ((**hs).stack [(**hs).toperror - 1].errorrefcon);
+
}
+
} /*langgetlexicalrefcon*/
static boolean evaluatewith (hdltreenode hwith, tyvaluerecord *valtree) {
+
+ //
+ // evaluate a with block. hparam1 should be a list of terminals that
+ // specify tables to add to the search path for the with block.
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 1992-08-31 dmb: added supports for multiple with items, object
+ // specifiers
+ //
- /*
- evaluate a with block. hparam1 should be a list of terminals that
- specify tables to add to the search path for the with block.
+ register hdlhashtable ht;
+ register hdltreenode h = hwith, hterm;
- 8/31/92 dmb: added supports for multiple with items, object specifiers
- */
-
- register hdltreenode h = hwith;
- register hdltreenode hterm;
- hdlhashtable htable;
- bigstring bs;
- hdlhashtable hlocaltable;
- register hdlhashtable ht;
- tyvaluerecord valtable;
- tyvaluerecord valwith;
+ Handle h2 = NULL;
+ hdlhashnode hnode;
+ hdlhashtable hlocaltable, htable;
short n = 0;
- hdlhashnode hnode;
+ tyvaluerecord valtable, valwith;
if (!newhashtable (&hlocaltable)) /*new table for the function when it runs*/
return (false);
-
+
ht = hlocaltable; /*copy into register*/
(**ht).fllocaltable = true; // 5.1.4 dmb: set now so pre-assignments will know locality of table
-
+
(**ht).lexicalrefcon = langgetlexicalrefcon (); /*'with' expressions use local scope*/
chainhashtable (ht); /*need it in scope to handle multiple items in list*/
@@ -934,84 +903,77 @@
/*populate the local table with path values*/
for (hterm = (**h).param1; hterm != nil; hterm = (**hterm).link) {
+
+ if (isobjspectree (hterm)) {
- if (isobjspectree (hterm)) {
-
if (!evaluateobjspec (hterm, &valwith))
goto error;
-
- copystring (bscontainername, bs);
+
+ if ( ! newtexthandle ( bscontainername, &h2 ) )
+ goto error;
}
else {
-
- if (!langgetdottedsymbolval (hterm, &htable, bs, &valtable, &hnode))
+
+ if (!langgetdottedsymbolval (hterm, &htable, &h2, &valtable, &hnode))
goto error;
+
+ if (!langexternalvaltotable (valtable, &htable, hnode)) {
- /*
- if (langexternalvaltocode (valtable, &hcode)) { /%5/14/93 dmb%/
+ langparamerror ( badwithstatementerror, h2 );
- if (!hashtablelookupnode (htable, bs, &hnode))
- goto error;
+ goto error;
- if (hcode == nil) {
-
- if (!langcompilescript (hnode, &hcode))
- goto error;
- }
-
- if (!addmodulecontext (htable, hnode, bs, hcode))
- goto error;
-
- continue;
}
- */
-
- if (!langexternalvaltotable (valtable, &htable, hnode)) {
- langparamerror (badwithstatementerror, bs);
-
- goto error;
- }
+ disposehandle ( h2 );
- if (!setaddressvalue (htable, zerostring, &valwith))
+ if ( ! setaddressvalue ( htable, NULL, &valwith ) )
goto error;
+
+ if (n == 7) { /*maximum value of ctwithvalues*/
- if (n == 7) { /*maximum value of ctwithvalues*/
-
langlongparamerror (toomanywithtableserror, n);
goto error;
+
}
+
+ langgetwithvaluename ( ++n, &h2 );
- langgetwithvaluename (++n, bs);
+ (**ht).ctwithvalues = n; /*optimization for langfindsymbol*/
- (**ht).ctwithvalues = n; /*optimization for langfindsymbol*/
}
-
- if (!hashtableassign (ht, bs, valwith)) {
+ if ( ! hashtableassign ( ht, h2, valwith ) ) {
+
disposevaluerecord (valwith, false);
goto error;
+
}
+
+ disposehandle ( h2 );
exemptfromtmpstack (&valwith); /*its in the local table now*/
- }
-
+
+ } // for
+
unchainhashtable ();
hmagictable = ht; /*evaluatelist uses this as its local symbol table*/
return (evaluatelist ((**h).param2, valtree));
- error: {
+ error:
+
+ disposehandle ( h2 );
unchainhashtable ();
disposehashtable (ht, false);
return (false);
- }
+
} /*evaluatewith*/
@@ -1161,8 +1123,9 @@
#endif
static boolean langtryerror (bigstring bsmsg, ptrvoid refcon) {
-#pragma unused (refcon)
+ #pragma unused (refcon)
+
/*
6/25/92 dmb: when an error occurs during a try block, we stash it in
the tryerror handle. it is later placed in the stack frame of the
@@ -1174,25 +1137,31 @@
newtexthandle (bsmsg, &tryerror); /*if out of mem, script won't be able to get error*/
#if fltryerrorstackcode
+
assert (tryerrorstack == nil);
langsettryerrorstack();
+
#endif
return (true);
+
} /*langtryerror*/
static boolean evaluatetry (hdltreenode htry, tyvaluerecord *valtree) {
register hdltreenode h = htry;
+
boolean fl;
langerrormessagecallback savecallback;
assert (tryerror == nil);
#if fltryerrorstackcode
+
assert (tryerrorstack == nil);
+
#endif
savecallback = langcallbacks.errormessagecallback;
@@ -1208,10 +1177,13 @@
assert (tryerror == nil);
#if fltryerrorstackcode
+
assert (tryerrorstack == nil);
+
#endif
return (fl); /*might be false if script has been killed*/
+
}
fllangerror = false; /*recover*/
@@ -1225,140 +1197,171 @@
tryerror = nil;
#if fltryerrorstackcode
+
opdisposelist ((hdllistrecord) tryerrorstack);
// disposehandle (tryerrorstack);
tryerrorstack = nil;
+
#endif
return (true);
+
}
//assert (tryerror != nil); //6.1b8 AR: attempt to catch "tryerror not defined" situations
return (evaluatelist (h, valtree)); /*will take care of tryerror automatically*/
+
} /*evaluatetry*/
static boolean langaddlocals (hdltreenode hnode) {
+
+ //
+ // add the names in hnamelist to the most-local symbol table.
+ //
+ // return false if the symbol is already declared in the local table, or
+ // if there was a memory allocation error.
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 4.28.97 dmb: make sure assignments copy tmpdata
+ //
+ // 4.1b4 dmb: added fllangexternalvalueprotect flag to disable protection
+ //
+ // 2.1b2 dmb: added debugger call for local initial assignments
+ //
+ // 1992-12-11 dmb: set unassigned locals to novaluetype, not zero (long).
+ // this allows them to more easily be used in expressions
+ // and yield expected results.
+ //
+ // 1991-01-17 dmb: simplified code and moved tmpstack logic from
+ // assignlocalop clause to bottom of loop, so on error val
+ // is still in tmpstack and will be disposed later
+ //
- /*
- add the names in hnamelist to the most-local symbol table.
-
- return false if the symbol is already declared in the local table, or
- if there was a memory allocation error.
-
- 1/17/91 dmb: simplified code and moved tmpstack logic from assignlocalop
- clause to bottom of loop, so on error val is still in tmpstack and will
- be disposed later
-
- xxx 12/11/92 dmb: set unassigned locals to novaluetype, not zero (long). this
- xxx allows them to more easily be used in expressions and yield expected results.
-
- 2.1b2 dmb: added debugger call for local initial assignments
-
- 4.1b4 dmb: added fllangexternalvalueprotect flag to disable protection
-
- 4.28.97 dmb: make sure assignments copy tmpdata
- */
-
register hdltreenode nomad = (**hnode).param1;
while (true) { /*step through name list, inserting each into symbol table*/
+ Handle h = NULL;
tyvaluerecord val;
- bigstring bs;
if (nomad == nil) /*reached the end of the names list*/
return (true);
+
+ if ((**nomad).nodetype == assignlocalop) {
- if ((**nomad).nodetype == assignlocalop) {
-
if (!langdebuggercall (nomad)) /*2.1b2*/
return (false);
-
+
if (!evaluatetree ((**nomad).param2, &val))
return (false);
-
+
if (fllangexternalvalueprotect && val.valuetype == externalvaluetype) { /*4.1b4 dmb*/
langbadexternaloperror (externalassignerror, val);
return (false);
+
}
-
- if (!langgetidentifier ((**nomad).param1, bs))
+
+ if ( ! langgetidentifier ( ( **nomad ).param1, &h ) )
return (false);
}
else {
-
initvalue (&val, novaluetype);
- if (!langgetidentifier (nomad, bs))
+ if (!langgetidentifier (nomad, &h))
return (false);
}
- if (hashsymbolexists (bs)) { /*multiply-defined symbol*/
+ if (hashsymbolexists (h)) { /*multiply-defined symbol*/
langseterrorline (nomad); /*point right at the offending name*/
- langparamerror (multiplesymbolerror, bs);
+ langparamerror ( multiplesymbolerror, h );
+ disposehandle ( h );
+
return (false);
+
}
// 4.28.97 dmb: do what hashassign does with tmpdata. shouls hashinsert do this?
if (val.fltmpdata) { /*val doesn't own it's data*/
- if (!copyvaluedata (&val))
+ if ( ! copyvaluedata ( &val ) ) {
+
+ disposehandle ( h );
+
return (false);
+
+ }
+
+ exemptfromtmpstack (&val); /***should wait until success*/
- exemptfromtmpstack (&val); /***should wait until success*/
}
hashsetlocality (&val, true); /*6.2b16 AR*/
- if (!hashinsert (bs, val)) /*error creating new symbol*/
+ if ( ! hashinsert ( h, val ) ) { // error creating new symbol
+
+ disposehandle ( h );
+
return (false);
+
+ }
+ disposehandle ( h );
+
exemptfromtmpstack (&val); /*it's been successfully added to local table*/
cleartmpstack (); /*dealloc all outstanding temporary values*/
nomad = (**nomad).link; /*advance to next name in list*/
+
} /*while*/
+
} /*langaddlocals*/
static boolean langaddhandler (hdltreenode hnode) {
+
+ //
+ // add a handler node to the current hashtable. the structure below hnode
+ // must conform to the structure documented in the comment at the head of
+ // langfunccall.
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 1991-02-05 dmb: stuff the current scripterrorrefcon into the (otherwise
+ // unused) nodeval so that the script debugger and error
+ // dialog can trace handler calls back to their source.
+ // this would otherwise be quite difficult to do, since the
+ // address of a local handler can be passed around between
+ // scripts and called from anywhere. see
+ // scriptpushsourcecode in scripts.c.
+ //
- /*
- add a handler node to the current hashtable. the structure below hnode
- must conform to the structure documented in the comment at the head of
- langfunccall.
+ register hdltreenode h = hnode;
- 2/5/91 dmb: stuff the current scripterrorrefcon into the (otherwise unused)
- nodeval so that the script debugger and error dialog can trace handler
- calls back to their source. this would otherwise be quite difficult to
- do, since the address of a local handler can be passed around between
- scripts and called from anywhere. see scriptpushsourcecode in scripts.c.
- */
-
- register hdltreenode h = hnode;
- bigstring bs;
+ Handle handleIdentifier = NULL;
tyvaluerecord val;
- if (!langgetidentifier ((**(**h).param2).param1, bs))
- return (false);
+ if ( ! langgetidentifier ( ( **( **h ).param2 ).param1, &handleIdentifier ) )
+ return ( false );
- if (hashsymbolexists (bs)) { /*name already defined in most-local table*/
+ if (hashsymbolexists (handleIdentifier)) { /*name already defined in most-local table*/
- langseterrorline (h); /*point right at the offending name*/
+ langseterrorline ( h ); /*point right at the offending name*/
- langparamerror (multiplesymbolerror, bs);
+ langparamerror ( multiplesymbolerror, handleIdentifier );
return (false);
+
}
initvalue (&val, codevaluetype);
@@ -1367,8 +1370,8 @@
val.fltmpdata = true; /*data belong to code tree*/
- if (!hashinsert (bs, val))
- return (false);
+ if ( ! hashinsert ( handleIdentifier, val ) )
+ return ( false );
bundle { /*link this code value to the source from whence it came*/
@@ -1377,9 +1380,11 @@
val.data.longvalue = langgetlexicalrefcon ();
(**h).nodeval = val;
+
}
return (true);
+
} /*langaddhandler*/
@@ -1413,6 +1418,7 @@
byte evalparam1;
byte evalparam2;
+
} typaraminfo;
#define nope ((byte) -1)
@@ -1542,6 +1548,7 @@
{false, true}, /*multiplyvalueop*/
{false, true} /*dividevalueop*/
+
};
@@ -1591,15 +1598,15 @@
register hdltreenode h = htree;
register tytreetype op;
register short ctparams;
+
tyvaluerecord val1, val2;
setbooleanvalue (true, valtree); /*default returned value*/
- if (fllangerror) { /*a language error dialog has appeared, unwind*/
+ if (fllangerror) /*a language error dialog has appeared, unwind*/
return (false); /*return false, aid in the unwinding process*/
- }
-
+
if (h == nil)
return (true);
@@ -1619,12 +1626,12 @@
#ifdef newparams
- if (info.evalparam1)
-
+ if (info.evalparam1)
+
#else
- if (evalparam1 (op))
-
+ if (evalparam1 (op))
+
#endif
{
if (!evaluatetree ((**h).param1, &val1))
@@ -1640,12 +1647,12 @@
#ifdef newparams
- if (info.evalparam2)
-
+ if (info.evalparam2)
+
#else
- if (evalparam2 (op))
-
+ if (evalparam2 (op))
+
#endif
{
boolean fl, fltmp;
@@ -1669,7 +1676,7 @@
}
}
}
-
+
langseterrorline (h); /*set globals for error reporting*/
//printf ("evaltree: op = %d/n", op);
@@ -1931,6 +1938,7 @@
langlongparamerror (unexpectedopcodeerror, (long) op);
return (false); /*unimplemented opcode*/
+
} /*evaltree*/
@@ -1946,7 +1954,8 @@
if (!langcheckstackspace ())
return (false);
- return (evaltree (htree, valtree) && !fllangerror);
+ return ( evaltree ( htree, valtree ) && ! fllangerror );
+
} /*evaluatetree*/
@@ -1955,169 +1964,201 @@
#endif
boolean evaluatelist (hdltreenode hfirst, tyvaluerecord *val) {
+
+ //
+ // this is something like the main-event-loop for CanCoon's interpreter.
+ //
+ // chain through a list of statements, evaluating each one and then advance
+ // to the next. the value we return is the value generated by the last
+ // statement in the list.
+ //
+ // we allow an external caller to hand us a pre-stuffed symbol table
+ // through the global hmagictable. we take care of chaining it into the
+ // 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
+ //
+ // 2001-11-13 dmb: try lazy with evaluation
+ //
+ // 2.1b2 dmb: added langbadexternaloperror check after each evaluatetree
+ //
+ // 1992-09-27 dmb: added languserescaped (false) call inside of loop
+ //
+ // 1992-09-01 dmb: added decent stack overflow detection/handling code
+ //
+ // 1992-02-12 dmb: set lexicalrefcon when pushing local frame. see
+ // langfindsymbol
+ //
+ // 1991-09-23 dmb: magic table handling is now buried a little deeper --
+ // in newhashtable.
+ //
+ // 1991-09-04 dmb: on break and return, make sure langerror isn't missed
+ //
+ // 1990-09-04 DW: Major rewrite -- wrote the Ultimate SuperStresser\xAA
+ // script, and it works!
+ //
+ // 1990-07-23 DW: we have to protect the returned value from being
+ // deallocated as part of the local list's tmp stack. if
+ // it's a string, the caller will get a garbage handle. so
+ // we move the value from the local tmpstack into the
+ // next-most-global tmpstack.
+ //
+ // 1990-07-10 DW: allocate a local table for every level -- it's really
+ // cheap in time, and also cheap in space. this allows
+ // automatic locals to be reliably allocated in the local
+ // space, and may help in the future in making other things
+ // work. now there is one table in the chain for every
+ // level, even if there are no local variables or local
+ // handlers.
+ //
- /*
- this is something like the main-event-loop for CanCoon's interpreter.
+ register boolean fl = false;
+ register hdltreenode programcounter = hfirst;
- chain through a list of statements, evaluating each one and then advance
- to the next. the value we return is the value generated by the last
- statement in the list.
+ hdlhashtable hlocals;
+ boolean flhavelocals, flneedlocals, flneedthis, flReturn = false, fltmpval;
- we allow an external caller to hand us a pre-stuffed symbol table through the
- global hmagictable. we take care of chaining it into the runtime stack, and
- releasing it before we exit. the global is reset to nil, so that it has to
- be reset on every use.
+ #if !lazythis_optimization
- 7/10/90 DW: allocate a local table for every level -- it's really cheap in
- time, and also cheap in space. this allows automatic locals to be reliably
- allocated in the local space, and may help in the future in making other
- things work. now there is one table in the chain for every level, even if
- there are no local variables or local handlers.
+ Handle handleThis = NULL;
+ hdlhashtable hthis;
+
+ #endif
- 7/23/90 DW: we have to protect the returned value from being deallocated
- as part of the local list's tmp stack. if it's a string, the caller will
- get a garbage handle. so we move the value from the local tmpstack into
- the next-most-global tmpstack.
-
- 9/4/90 DW: Major rewrite -- wrote the Ultimate SuperStresser\xAA script, and
- it works!
-
- 9/4/91 dmb: on break and return, make sure langerror isn't missed
-
- 9/23/91 dmb: magic table handling is now buried a little deeper -- in
- newhashtable.
-
- 2/12/92 dmb: set lexicalrefcon when pushing local frame. see langfindsymbol
-
- 9/1/92 dmb: added decent stack overflow detection/handling code
-
- 9/27/92 dmb: added languserescaped (false) call inside of loop
-
- 2.1b2 dmb: added langbadexternaloperror check after each evaluatetree
-
- 11/13/01 dmb: try lazy with evaluation
- */
-
- register hdltreenode programcounter = hfirst;
- register boolean fl = false;
- hdlhashtable hlocals;
- boolean fltmpval;
- boolean flhavelocals, flneedlocals, flneedthis;
-#if !lazythis_optimization
- hdlhashtable hthis;
- bigstring bsthis;
-#endif
-
-
setbooleanvalue (false, val); /*default returned value*/
if (!langcheckstackspace ())
return (false);
-
+
flhavelocals = (**currenthashtable).fllocaltable;
flneedthis = !flhavelocals && (hmagictable == nil);
#if fltryerrorstackcode
+
flneedlocals = !flhavelocals || (hmagictable != nil) || (tryerror != nil) || (tryerrorstack != nil);
+
#else
+
flneedlocals = !flhavelocals || (hmagictable != nil) || (tryerror != nil);
+
#endif
-
+
if (!flneedlocals) { /*pre-scan statement list to see if we need a local frame*/
-
+
register hdltreenode h;
register tytreetype op;
for (h = programcounter; h != nil; h = (**h).link) {
-
+
op = (**h).nodetype;
if ((op == localop) || (op == moduleop)) {
-
+
flneedlocals = true;
break;
+
}
}
}
+
+ if (flneedlocals) {
- if (flneedlocals) {
-
if (!langpushlocalchain (&hlocals))
return (false);
-
+
(**hlocals).lexicalrefcon = langgetlexicalrefcon ();
#ifdef version5orgreater
- if (flneedthis) {
- #if lazythis_optimization
- ++ctdeferredthis;
- #else
- if (langgetthisaddress (&hthis, bsthis))
- langsetthisvalue (hlocals, hthis, bsthis);
- #endif
- }
+
+ if (flneedthis) {
+
+ #if lazythis_optimization
+
+ ++ctdeferredthis;
+ #else
+
+ if ( langgetthisaddress ( &hthis, &handleThis ) )
+ langsetthisvalue ( hlocals, hthis, handleThis );
+ #endif
+
+ }
#endif
if (tryerror != nil) {
-
+
tyvaluerecord errorval;
- if (setheapvalue (tryerror, stringvaluetype, &errorval))
- if (hashassign (nametryerrorval, errorval))
- exemptfromtmpstack (&errorval);
+ if ( setheapvalue ( tryerror, stringvaluetype, &errorval ) ) {
+ /* register */ Handle h;
+
+ newfilledhandle ( nametryerrorval + 1, stringlength ( nametryerrorval ), &h );
+
+ if ( hashassign ( h, errorval ) )
+ exemptfromtmpstack ( &errorval );
+
+ disposehandle ( h );
+
+ }
+
tryerror = nil;
+
}
-
+
#if fltryerrorstackcode
+
if (tryerrorstack != nil) {
-
+
tyvaluerecord errorval;
- // if (setheapvalue (tryerrorstack, listvaluetype, &errorval))
if (setheapvalue (tryerrorstack, stringvaluetype, &errorval))
if (hashassign (nametryerrorstackval, errorval))
exemptfromtmpstack (&errorval);
+
+ tryerrorstack = nil;
- tryerrorstack = nil;
}
#endif
-
+
}
else
hlocals = currenthashtable;
+
+ while (true) { /*visit each statement in the statement list*/
- while (true) { /*visit each statement in the statement list*/
-
if (fllangerror) /*a language error dialog has appeared, unwind*/
break;
+
+ if (programcounter == nil) { /*reached the end of the list*/
- if (programcounter == nil) { /*reached the end of the list*/
-
fl = true; /*don't halt the interpreter*/
break;
+
}
-
+
cleartmpstack (); /*dealloc all outstanding temporary values*/
langseterrorline (programcounter); /*set globals for error reporting*/
if (languserescaped (false)) /*user killed the script*/
break;
-
+
if (!langdebuggercall (programcounter)) /*user killed the script*/
break;
-
+
if (!evaluatetree (programcounter, val))
break;
+
+ #if defined(fldebug) && (fldebug > 1)
- #if defined(fldebug) && (fldebug > 1)
assert (validvalue (val));
assert (!leakingmemory (val));
+
#endif
if (flbreak || flreturn || flcontinue) {
@@ -2125,11 +2166,13 @@
fl = !fllangerror; /*don't halt the interpreter, except on error*/
break;
+
}
+
+ programcounter = (**programcounter).link; /*advance to next statement*/
- programcounter = (**programcounter).link; /*advance to next statement*/
} /*while*/
-
+
/*
1/31/97 dmb: below is the site of a major osamenusharing bug. It can fail!
I've seen it myself. But it's also been reported by Timothy Paustian
@@ -2140,7 +2183,7 @@
*/
if (hlocals != currenthashtable) { /*should never happen*/
-
+
assert (hlocals == currenthashtable); /*context change in background destroyed our state*/
langerror (undefinederror);
@@ -2148,8 +2191,9 @@
currenthashtable = hlocals;
fl = false;
+
}
-
+
/*finished processing list, either natural termination, a break, return or error*/
assert (!fl || !leakingmemory (val));
@@ -2157,31 +2201,44 @@
fltmpval = exemptfromtmpstack (val); /*must survive disposing of local table & background task*/
if (flneedlocals) /*pop the runtime stack*/
+
+ langpoplocalchain (hlocals);
- langpoplocalchain (hlocals);
+ if (fl) /*give agents a shot while val is exempt from temp*/
- if (fl) /*give agents a shot while val is exempt from temp*/
+ fl = langbackgroundtask (false); /*background task can cause termination*/
- fl = langbackgroundtask (false); /*background task can cause termination*/
-
if (fltmpval)
pushtmpstackvalue (val); /*insert into the next-most-global tmpstack*/
+
+ if (!fl) { /*failure of some sort -- return immediately*/
- if (!fl) { /*failure of some sort -- return immediately*/
+ if (flstackoverflow) { /*error was stack overflow*/
- if (flstackoverflow) { /*error was stack overflow*/
-
langcheckstacklimit (idprogramstack, 1, 0); /*report now that stack has been popped a bit */
flstackoverflow = false; /*it's been reported*/
+
}
+
+ goto exit;
- return (false);
}
-
+
if (languserescaped (true)) /*user pressed cmd-period, unwind recursion -- quickly*/
- return (false);
+ goto exit;
+
+ flReturn = true; // fell through the bottom of the list
- return (true); /*fell through the bottom of the list*/
- } /*evaluatelist*/
+ exit:
+
+ #if !lazythis_optimization
+ disposehandle ( handleThis );
+
+ #endif
+
+ return ( flReturn );
+
+ } // evaluatelist
+
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langexternal.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langexternal.c 2007-02-23 21:45:04 UTC (rev 1624)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langexternal.c 2007-02-24 00:04:28 UTC (rev 1625)
@@ -126,22 +126,24 @@
} /*langexternalgettype*/
-static boolean langexternalgetinfo (bigstring bs, hdlhashtable *htable, langvaluecallback *valueroutine) {
+static boolean langexternalgetinfo ( const Handle h, hdlhashtable *htable, langvaluecallback *valueroutine ) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // a very central bottleneck -- we translate the name of an EFP (something
+ // like "shell" or "wp") into a symbol table and a routine which can be
+ // called to get a function value.
+ //
+ // indicate in flwindow whether the EFP requires that a window be open in
+ // order to evaluate a functionvalue.
+ //
- /*
- a very central bottleneck -- we translate the name of an EFP (something like
- "shell" or "wp") into a symbol table and a routine which can be called to
- get a function value.
-
- indicate in flwindow whether the EFP requires that a window be open in order to
- evaluate a functionvalue.
- */
-
tyvaluerecord val;
register hdlhashtable ht;
hdlhashnode hnode;
- if (!langgetsymbolval (bs, &val, &hnode)) /*has special case for root*/
+ if ( ! langgetsymbolval ( h, &val, &hnode ) ) // has special case for root
return (false);
if (!tablevaltotable (val, htable, hnode))
@@ -152,42 +154,55 @@
*valueroutine = (**ht).valueroutine;
return (true);
+
} /*langexternalgetinfo*/
-boolean langexternalgettable (bigstring bs, hdlhashtable *htable) {
-
+boolean langexternalgettable ( const Handle h, hdlhashtable *htable ) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+
langvaluecallback valueroutine;
- return (langexternalgetinfo (bs, htable, &valueroutine));
+ return ( langexternalgetinfo ( h, htable, &valueroutine ) );
+
} /*langexternalgettable*/
boolean langexternalvaltotable (tyvaluerecord val, hdlhashtable *htable, hdlhashnode hnode) {
return (tablevaltotable (val, htable, hnode));
+
} /*langexternalvaltotable*/
-boolean langexternalfindvariable (hdlexternalvariable hv, hdlhashtable *htable, bigstring bsname) {
+boolean langexternalfindvariable ( hdlexternalvariable hv, hdlhashtable *htable, Handle *handleName ) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
#if langexternalfind_optimization
-
- if (hv != nil && (**hv).hexternaltable != nil && (**hv).hexternalnode != nil) {
-
- *htable = (**hv).hexternaltable;
-
- gethashkey ((**hv).hexternalnode, bsname);
+
+ if (hv != nil && (**hv).hexternaltable != nil && (**hv).hexternalnode != nil) {
- return true;
- }
-
+ *htable = (**hv).hexternaltable;
+
+ gethashkey ( ( **hv ).hexternalnode, handleName );
+
+ return true;
+
+ }
+
#endif
+
+ return ( tablefindvariable ( hv, htable, handleName ) );
+
+ } // langexternalfindvariable
- return (tablefindvariable (hv, htable, bsname));
- } /*langexternalfindvariable*/
-
boolean langexternalgettablevalue (hdltreenode hfirst, short pnum, hdlhashtable *htable) {
return (gettablevalue (hfirst, pnum, htable));
@@ -239,14 +254,14 @@
if (!langgetsymbolval (bsarrayname, &val)) {
- langparamerror (unknownidentifiererror, bsarrayname);
+ langParamErrBs ( unknownidentifiererror, bsarrayname);
return (false);
}
if (val.valuetype != externalvaluetype) {
- langparamerror (notarrayerror, bsarrayname);
+ langParamErrBs ( notarrayerror, bsarrayname);
return (false);
}
@@ -255,14 +270,14 @@
if ((**h).id != idoutlineprocessor) {
- langparamerror (notarrayerror, bsarrayname);
+ langParamErrBs ( notarrayerror, bsarrayname);
return (false);
}
if (!opverbarrayreference ((**h).hdata, ix, &hnode)) {
- langparamerror (arrayreferror, bsarrayname);
+ langParamErrBs ( arrayreferror, bsarrayname);
return (false);
}
@@ -285,41 +300,49 @@
*/
-boolean langsetexternalsymbol (hdlhashtable htable, bigstring bs, tyexternalid id, Handle hdata) {
+boolean langsetexternalsymbol ( hdlhashtable htable, const Handle h, tyexternalid id, Handle hdata ) {
+
+ //
+ // called by an External Function Processor (EFP) to link his data into the
+ // current symboltable. bs is the name of the variable, id tells us who is
+ // responsible for the data, and hdata is the handle we move around to move
+ // the data, and pass back to the EFP when he needs to do something with
+ // it.
+ //
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
- /*
- called by an External Function Processor (EFP) to link his data into the
- current symboltable. bs is the name of the variable, id tells us who is
- responsible for the data, and hdata is the handle we move around to move
- the data, and pass back to the EFP when he needs to do something with it.
- */
+ register boolean fl;
+ register hdlexternalvariable hv = (hdlexternalvariable) hdata;
- register hdlexternalvariable hv = (hdlexternalvariable) hdata;
tyvaluerecord val;
- register boolean fl;
(**hv).id = id;
setexternalvalue ((Handle) hv, &val);
- fl = hashtableassign (htable, bs, val);
+ fl = hashtableassign ( htable, h, val );
return (fl);
- } /*langsetexternalsymbol*/
+
+ } // langsetexternalsymbol
-static boolean langexternalsetsave (hdlhashtable htable, bigstring bs, boolean fldontsave) {
+static boolean langexternalsetsave (hdlhashtable htable, const Handle h, boolean fldontsave) {
+
+ //
+ // set the dont-save bit on the variable whose name is the indicated string.
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
- /*
- set the dont-save bit on the variable whose name is the indicated string.
- */
-
hdlhashnode hnode;
register boolean fl;
pushhashtable (htable);
- fl = langfindsymbol (bs, &htable, &hnode);
+ fl = langfindsymbol (h, &htable, &hnode);
pophashtable ();
@@ -327,35 +350,44 @@
(**hnode).fldontsave = fldontsave;
return (fl);
- } /*langexternalsetsave*/
+ } // langexternalsetsave
-boolean langexternaldontsave (hdlhashtable htable, bigstring bs) {
- /*
- set the dont-save bit on the variable whose name is the indicated string.
- */
+boolean langexternaldontsave ( hdlhashtable htable, const Handle h ) {
+
+ //
+ //set the dont-save bit on the variable whose name is the indicated string.
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
- return (langexternalsetsave (htable, bs, true));
- } /*langexternaldontsave*/
+ return ( langexternalsetsave ( htable, h, true ) );
+ } // langexternaldontsave
-boolean langexternalpl...
[truncated message content] |
|
From: <cre...@us...> - 2007-02-23 21:45:06
|
Revision: 1624
http://svn.sourceforge.net/frontierkernel/?rev=1624&view=rev
Author: creecode
Date: 2007-02-23 13:45:04 -0800 (Fri, 23 Feb 2007)
Log Message:
-----------
support for long odb item names and file paths
formatting tweaks
Modified Paths:
--------------
Frontier/branches/Frontier_Long_File_Paths/Common/IowaRuntime/Source/iowaruntime.c
Frontier/branches/Frontier_Long_File_Paths/Common/UserLandIACToolkit/landsystem7.c
Frontier/branches/Frontier_Long_File_Paths/Common/headers/lang.h
Frontier/branches/Frontier_Long_File_Paths/Common/source/lang.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langcallbacks.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langcard.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/langdate.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/IowaRuntime/Source/iowaruntime.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/IowaRuntime/Source/iowaruntime.c 2007-02-23 20:59:35 UTC (rev 1623)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/IowaRuntime/Source/iowaruntime.c 2007-02-23 21:45:04 UTC (rev 1624)
@@ -653,6 +653,7 @@
(*lCallback) (ev);
popmacport ();
+
} /*filterevent*/
@@ -669,6 +670,7 @@
ev.message = (long) iowadata;
(*lcallback) (&ev);
+
} /*sendinitmessage*/
@@ -2308,6 +2310,7 @@
boolean runModalCard (Handle hpackedcard, boolean flscriptedcard, short top, short pLeft, tycardeventcallback pCallback) {
+
// 2006-04-03 - kw --- renamed params left -pLeft, callback -> pCallback
/*
dmb 1.0b24: changed flcallback logic. we no longer call back on activate
@@ -2338,6 +2341,7 @@
flreturn = false;
goto exit;
+
}
(**runtimedata).callback = pCallback;
@@ -2351,8 +2355,10 @@
flreturn = false;
goto exit;
+
}
}
+
//Code change by Timothy Paustian Wednesday, August 23, 2000 9:21:06 PM
//
{
@@ -2363,6 +2369,7 @@
#endif
SetPort (thePort);
+
}
sendinitmessage ();
@@ -2439,6 +2446,7 @@
if (flexitcardloop) /*can be set by closeCardWindow*/
break;
+
} /*while*/
exit:
@@ -2452,9 +2460,11 @@
runtimedata = oldruntimedata;
SetPort (oldport);
+
}
return (flreturn);
+
} /*runModalCard*/
@@ -2732,22 +2742,19 @@
}
return (flreturn);
+
} /*runHostedCard*/
boolean initIowaRuntime (void) {
+
+ //
+ // 2007-02-23 creedon: removed A5 related code, not needed on Mac OS X
+ //
+ // 4.1b14 dmb: remember A5 for AE handler
+ //
- /*
- 4.1b14 dmb: remember A5 for AE handler
- */
- //Code change by Timothy Paustian Monday, June 26, 2000 3:16:32 PM
- //
- #if !TARGET_API_MAC_CARBON
- RememberA5 ();
- #endif
-
return (true);
- } /*initIowaRuntime*/
-
-
+ } /*initIowaRuntime*/
+
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/UserLandIACToolkit/landsystem7.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/UserLandIACToolkit/landsystem7.c 2007-02-23 20:59:35 UTC (rev 1623)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/UserLandIACToolkit/landsystem7.c 2007-02-23 21:45:04 UTC (rev 1624)
@@ -227,7 +227,7 @@
pascal boolean landbrowsenetworkapps (ConstStr255Param bsprompt, tynetworkaddress *adr, tyapplicationid id) {
-# pragma unused (bsprompt, adr, id)
+ #pragma unused (bsprompt, adr, id)
/*
7/15/91 DW: return false on system 6.
@@ -478,24 +478,27 @@
static pascal void *eventthreadmain (void *hverb) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 4.1b3 dmb: name for initprocessthread is more informative now
+ //
+ // 4.0.1b1 dmb: pass name of thread to initprocessthread; call exitprocessthread
+ //
+ // 2.1a7 dmb: geteventrecords before handling the verb (which disposes it)
+ //
- /*
- 2.1a7 dmb: geteventrecords before handling the verb (which disposes it)
+ register hdlverbrecord hv = (hdlverbrecord) hverb;
- 4.0.1b1 dmb: pass name of thread to initprocessthread; call exitprocessthread
-
- 4.1b3 dmb: name for initprocessthread is more informative now
- */
-
- register hdlverbrecord hv = (hdlverbrecord) hverb;
AppleEvent event, reply;
FSSpec fs;
+ Handle h;
OSType signature;
ProcessSerialNumber psn;
- byte class [6];
- byte token [6];
bigstring bs;
-
+ byte class [ 6 ], token [ 6 ];
+
landsystem7geteventrecords (hv, &event, &reply);
ostypetostring ((**hv).verbclass, class);
@@ -505,12 +508,16 @@
if (landsystem7getsenderinfo (&event, &psn, &fs, &signature) != noErr)
ostypetostring ((**hv).idsender, fs.name);
- langgetstringlist (appleeventthreadstring, bs); // "\papple event ['^0', '^1'] from \xD2^2\xD3"
+ langgetstringlist (appleeventthreadstring, bs ); // "\papple event ['^0', '^1'] from \xD2^2\xD3"
parsedialogstring (bs, class, token, fs.name, nil, bs);
- initprocessthread (bs); /*must call this*/
+ newtexthandle ( bs, &h );
+ initprocessthread ( h ); // must call this
+
+ disposehandle ( h );
+
(void) landhandleverb (hv);
AEResumeTheCurrentEvent (&event, &reply, (AEEventHandlerUPP) kAENoDispatch, 0);
@@ -518,7 +525,8 @@
exitprocessthread ();
return (nil);
- } /*eventthreadmain*/
+
+ } // eventthreadmain
static pascal OSErr landsystem7handleevent (AppleEvent *message, AppleEvent *reply, long refcon) {
@@ -587,23 +595,21 @@
errcode = memFullErr;
goto exit;
+
}
hv = hverb; /*copy into register*/
- /*
- (**hv).flsystemverb = flsystemevent;
- */
+ if (refcon == typeWildCard) {
- if (refcon == typeWildCard) {
+ if (!(*(**hg).findhandlerroutine) (hv)) {
- if (!(*(**hg).findhandlerroutine) (hv)) {
-
landdisposeverb (hv);
errcode = errAEEventNotHandled;
goto exit;
+
}
}
@@ -617,6 +623,7 @@
--fldisableyield;
goto exit;
+
}
if (newprocessthread (&eventthreadmain, (tythreadmainparams) hv, &hthread))
@@ -641,10 +648,13 @@
RestoreA5 (curA5);
#endif
+
}
return (errcode);
+
}
+
} /*landsystem7handleevent*/
@@ -666,6 +676,7 @@
hdlsys7transportinfo ht = (hdlsys7transportinfo) htinfo;
return ((**ht).replyid == (short) id);
+
} /*replyidvisit*/
@@ -694,6 +705,7 @@
return (ec);
*signature = info.processSignature;
+
}
else { /*not a local program*/
@@ -714,6 +726,7 @@
return (noErr);
+
} /*targettoprocessinfo*/
@@ -782,6 +795,7 @@
register hdllandglobals hg = landgetglobals ();
return ((*(**hg).macopenapproutine) ());
+
} /*landsystem7openapproutine*/
@@ -845,7 +859,9 @@
static pascal OSErr landsystem7opendocsroutine (AppleEvent *message, AppleEvent *reply, long refcon) {
-#pragma unused (reply, refcon)
+
+ #pragma unused (reply, refcon)
+
/*
this is the dispatch routine for the open documents (required) core event.
*/
@@ -853,6 +869,7 @@
register hdllandglobals hg = landgetglobals ();
return (landsystem7visitdoclist (message, (**hg).macopendocroutine));
+
} /*landsystem7opendocsroutine*/
@@ -872,7 +889,9 @@
static pascal OSErr landsystem7quitapproutine (AppleEvent *message, AppleEvent *reply, long refcon) {
-#pragma unused (message, reply, refcon)
+
+ #pragma unused (message, reply, refcon)
+
/*
this is the dispatch routine for the quit application (required) core event.
@@ -884,6 +903,7 @@
register hdllandglobals hg = landgetglobals ();
return ((*(**hg).macquitapproutine) ());
+
} /*landsystem7quitapproutine*/
@@ -1123,6 +1143,7 @@
(*cb) (hv);
errcode = landgeterror ();
+
}
else { /*send the message & wait for reply*/
@@ -1151,6 +1172,7 @@
#ifdef flcomponent
{
+
register tyeventsendcallback cb = (**hg).eventsendcallback;
errcode = (*(AESendCallback) cb) (
@@ -1177,6 +1199,7 @@
#endif
landsystem7getlongattr (&message, keyReturnIDAttr, typeLongInteger, &id); /*before disposal*/
+
}
AEDisposeDesc (&message);
@@ -1188,6 +1211,7 @@
landseterror (errcode);
return (false);
+
}
if (mode == kAEQueueReply) {
@@ -1219,6 +1243,7 @@
landseterror (usercancellederror); /*silent error*/
return (false);
+
}
/*we're back! grab reply from transport info*/
@@ -1235,9 +1260,11 @@
landseterror (errAEWaitCanceled);
return (false);
+
}
reply = (**ht).sys7reply;
+
}
/*we got our answer, process it and return*/
@@ -1248,7 +1275,8 @@
/*failed to create verb handle to hold returned values*/
- return (false);
+ return (false);
+
}
hv = *hvalues; /*copy into register*/
@@ -1262,6 +1290,7 @@
(**ht).flownmessage = true;
return (fl);
+
} /*landsystem7send*/
@@ -1745,15 +1774,6 @@
register hdllandglobals hg = landgetglobals ();
-
- #ifdef flcomponent
-
- #if !TARGET_API_MAC_CARBON
- RememberA5 ();
- #endif /*for event handlers, browser hook*/
-
- #endif
-
(**hg).macnetglobals.flhavebrowsed = false;
(**hg).eventsettings.timeoutticks = kNoTimeOut;
@@ -1789,6 +1809,7 @@
#endif
return (true);
+
} /*landsystem7init*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/lang.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/lang.h 2007-02-23 20:59:35 UTC (rev 1623)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/lang.h 2007-02-23 21:45:04 UTC (rev 1624)
@@ -181,6 +181,7 @@
dividevalueop = 61,
cttreetypes
+
} tytreetype;
@@ -309,12 +310,17 @@
unsigned long datevalue;
-#ifdef MACVERSION
- tydirection dirvalue;
-#endif
-#ifdef WIN95VERSION
- byte dirvalue;
-#endif
+ #ifdef MACVERSION
+
+ tydirection dirvalue;
+
+ #endif
+
+ #ifdef WIN95VERSION
+
+ byte dirvalue;
+
+ #endif
OSType ostypevalue;
@@ -356,17 +362,20 @@
OSType enumvalue;
-#ifdef oplanglists
- struct tylistrecord **listvalue;
+ #ifdef oplanglists
+
+ struct tylistrecord **listvalue;
- struct tylistrecord **recordvalue;
-#else
- Handle listvalue;
+ struct tylistrecord **recordvalue;
+ #else
+ Handle listvalue;
+
+ Handle recordvalue;
+
+ #endif
+
+ dbaddress diskvalue; // 4.0.2b1 dmb
- Handle recordvalue;
-#endif
-
- dbaddress diskvalue; /*4.0.2b1 dmb*/
} tyvaluedata;
@@ -385,6 +394,7 @@
byte fldiskval: 1; /*set when value data points to disk block of actual value*/
tyvaluedata data;
+
} tyvaluerecord;
@@ -416,10 +426,10 @@
#ifdef fltracklocaladdresses
- struct tyhashnode **refnodelink; /*next guy in linked list of refnodes list of a hashtable*/
-
- struct tyhashtable **reftable; /*table referenced by an address value*/
-
+ struct tyhashnode **refnodelink; /*next guy in linked list of refnodes list of a hashtable*/
+
+ struct tyhashtable **reftable; /*table referenced by an address value*/
+
#endif
tyvaluerecord val; /*the value of the identifier*/
@@ -443,9 +453,7 @@
} tyhashnode, *ptrhashnode, **hdlhashnode;
-#define HNoNode ((hdlhashnode) -1)
-#define gethashkey(h,bs) copystring ((**h).hashkey, bs);
-
+#define HNoNode ((hdlhashnode) -1)
#define ctbuckets 11 /*should be a prime number?*/
@@ -525,25 +533,28 @@
short cttmpstack;
tyvaluerecord tmpstack []; /*temps generated during expression evaluation*/
+
} tyhashtable, *ptrhashtable, **hdlhashtable;
-typedef boolean (*langerrorcallback) (long, long, short, hdlhashtable *, bigstring);
+typedef boolean ( *langerrorcallback ) ( long, long, short, hdlhashtable *, Handle * );
typedef struct tymodulerecord {
-
+
hdltreenode parsetree; /*the code tree generated by the parser*/
boolean flhandler; /*is the generated code a handler (true) or standalone (false)*/
+
} tymodulerecord;
typedef struct tyaddress { // 5.0.2 dmb (finally)
-
+
hdlhashtable ht;
- bigstring bs;
+ Handle h;
+
} tyaddress, *ptraddress;
@@ -568,6 +579,7 @@
#endif
long errorrefcon;
+
} tyerrorrecord;
@@ -587,13 +599,13 @@
typedef boolean (*langtreenodescallback) (hdltreenode, hdltreenode);
-typedef boolean (*langaddresscallback) (hdlhashtable, const bigstring);
+typedef boolean ( *langaddresscallback ) ( hdlhashtable, const Handle );
-typedef boolean (*langsymbolinsertedcallback) (hdlhashtable, const bigstring, hdlhashnode);
+typedef boolean ( *langsymbolinsertedcallback ) ( hdlhashtable, const Handle, hdlhashnode );
typedef boolean (*langtablenodecallback) (hdlhashtable, hdlhashnode);
-typedef boolean (*langsymbolchangedcallback) (hdlhashtable, const bigstring, hdlhashnode, boolean);
+typedef boolean ( *langsymbolchangedcallback ) ( hdlhashtable, const Handle, hdlhashnode, boolean );
typedef short (*langcomparenodescallback)(hdlhashtable, hdlhashnode, hdlhashnode);
@@ -603,7 +615,7 @@
typedef boolean (*langtablecallback)(hdlhashtable);
-typedef boolean (*langsourcecodecallback)(hdlhashtable, hdlhashnode, bigstring);
+typedef boolean ( *langsourcecodecallback ) ( hdlhashtable, hdlhashnode, const Handle );
typedef boolean (*langerrormessagecallback)(bigstring, ptrvoid);
@@ -615,9 +627,9 @@
typedef boolean (*langtablevisitcallback) (hdlhashnode, ptrvoid);
-typedef boolean (*langinversesearchcallback) (bigstring, hdlhashnode, tyvaluerecord, ptrvoid);
+typedef boolean ( *langinversesearchcallback ) ( Handle *, hdlhashnode, tyvaluerecord, ptrvoid );
-typedef boolean (*langsortedinversesearchcallback) (bigstring, hdlhashnode, tyvaluerecord, ptrvoid);
+typedef boolean ( *langsortedinversesearchcallback ) ( const Handle, hdlhashnode, tyvaluerecord, ptrvoid );
typedef struct tylangcallbacks {
@@ -760,7 +772,7 @@
extern boolean langdefaultpushtable (hdlhashtable *);
-extern boolean langdefaultpoptable (hdlhashtable);
+extern boolean langdefaultpoptable ( void );
extern boolean langnoop (void);
@@ -798,7 +810,7 @@
extern boolean langruncode (hdltreenode, hdlhashtable, tyvaluerecord *);
-extern boolean langaddkeyword (bigstring, short);
+extern boolean langaddkeyword ( const Handle, short );
extern boolean langaddkeywordlist (hdlhashtable, byte *[], short);
@@ -807,31 +819,35 @@
extern boolean initlang (void);
-extern boolean langcompilescript (hdlhashnode, hdltreenode *); /*langcallbacks.c*/
+#pragma mark === langcallbacks.c ===
+extern boolean langcompilescript (hdlhashnode, hdltreenode *);
+
extern boolean langerrorclear (void);
-extern void langsymbolchanged (hdlhashtable, const bigstring, hdlhashnode, boolean);
+extern void langsymbolchanged (hdlhashtable, const Handle, hdlhashnode, boolean);
-extern void langsymbolinserted (hdlhashtable, const bigstring, hdlhashnode);
+extern void langSymbolChangedBigstring ( hdlhashtable, const bigstring, hdlhashnode, boolean );
+extern void langsymbolinserted ( hdlhashtable, const Handle, hdlhashnode );
+
extern void langsymbolunlinking (hdlhashtable, hdlhashnode);
-extern void langsymboldeleted (hdlhashtable, const bigstring);
+extern void langsymboldeleted ( hdlhashtable, const Handle );
extern boolean langbackgroundtask (boolean);
#ifdef flnewfeatures
-extern boolean langpartialeventloop (short);
+ extern boolean langpartialeventloop (short);
#endif
#ifdef flcomponent
-extern callback langpresystemdialog (void);
+ extern callback langpresystemdialog (void);
-extern void langpostsystemdialog (void);
+ extern void langpostsystemdialog (void);
#endif
@@ -845,41 +861,53 @@
extern boolean dateversionlessthan (bigstring bsv1, bigstring bsv2, tyvaluerecord *v);
-extern void disablelangerror (void); /*langerror.c*/
+#pragma mark === langerror.c ===
+extern void disablelangerror (void);
+
extern void enablelangerror (void);
extern boolean langerrorenabled (void);
extern void langerror (short);
-extern void lang3paramerror (short, const bigstring, const bigstring, const bigstring);
+extern void lang3paramerror ( short, const Handle, const Handle, const Handle );
-extern void langparamerror (short, const bigstring);
+extern void lang3ParamErrBs ( short, const bigstring, const bigstring, const bigstring );
-extern void lang2paramerror (short, const bigstring, const bigstring);
+extern void langparamerror ( short, const Handle );
+extern void langParamErrBs ( short, const bigstring );
+
+extern void lang2paramerror ( short, const Handle, const Handle );
+
+extern void lang2ParamErrBs ( short, const bigstring, const bigstring );
+
extern void langlongparamerror (short, long);
extern void langostypeparamerror (short, OSType);
-extern boolean langerrordialog (bigstring, ptrvoid); /*langerrorwindow.c*/
+#pragma mark === langerrorwindow.c ===
+extern boolean langerrordialog (bigstring, ptrvoid);
+
extern boolean langerrorflush (void);
extern boolean clearlangerrordialog (void);
+#pragma mark === langhash.c ===
+
#ifdef fltracklocaladdresses
-extern void hashregisteraddressnode (hdlhashtable, hdlhashnode); /*langhash.c*/
+ extern void hashregisteraddressnode (hdlhashtable, hdlhashnode);
-extern void hashunregisteraddressnode (hdlhashnode);
-
+ extern void hashunregisteraddressnode (hdlhashnode);
+
#endif
-extern boolean newhashtable (hdlhashtable *); /*langhash.c*/
+extern boolean newhashtable (hdlhashtable *);
extern void dirtyhashtable (hdlhashtable);
@@ -909,45 +937,55 @@
extern boolean hashunlinknode (hdlhashtable, hdlhashnode);
-extern boolean hashsetnodekey (hdlhashtable, hdlhashnode, const bigstring);
+extern boolean hashsetnodekey ( hdlhashtable, hdlhashnode, const Handle );
-extern boolean hashinsert (const bigstring, tyvaluerecord);
+extern boolean hashinsert ( const Handle, tyvaluerecord );
//extern hashmerge (hdlhashtable, hdlhashtable);
-extern boolean hashlocate (const bigstring, hdlhashnode *, hdlhashnode *);
+extern boolean hashlocate ( const Handle, hdlhashnode *, hdlhashnode * );
-extern boolean hashunlink (const bigstring, hdlhashnode *);
+extern boolean hashunlink ( const Handle, hdlhashnode * );
-extern boolean hashdelete (const bigstring, boolean, boolean);
+extern boolean hashdelete ( const Handle, boolean, boolean);
-extern boolean hashtabledelete (hdlhashtable, bigstring);
+extern boolean hashtabledelete ( hdlhashtable, const Handle );
-extern boolean hashsymbolexists (const bigstring);
+extern boolean hashTableDeleteBigstring ( hdlhashtable, const bigstring );
-extern boolean hashtablesymbolexists (hdlhashtable, const bigstring);
+extern boolean hashsymbolexists ( Handle );
-extern void hashsetlocality (tyvaluerecord *, boolean); /*6.2b16 AR: needed to set locality in langaddlocals [langevaluate.c]*/
+extern boolean hashtablesymbolexists ( hdlhashtable, const Handle );
-extern boolean hashassign (const bigstring, tyvaluerecord);
+extern boolean hashTableSymbolExistsBigstring ( hdlhashtable, const bigstring );
-extern boolean hashtableassign (hdlhashtable, const bigstring, tyvaluerecord);
+extern void hashsetlocality (tyvaluerecord *, boolean); // 6.2b16 AR: needed to set locality in langaddlocals [langevaluate.c]
-extern boolean hashlookup (const bigstring, tyvaluerecord *, hdlhashnode *);
+extern boolean hashassign ( const Handle, tyvaluerecord );
-extern boolean hashtablelookup (hdlhashtable, const bigstring, tyvaluerecord *, hdlhashnode *);
+extern boolean hashtableassign ( hdlhashtable, const Handle, tyvaluerecord );
-extern boolean hashlookupnode (const bigstring, hdlhashnode *);
+extern boolean hashtableassignstring ( hdlhashtable, const bigstring, tyvaluerecord );
-extern boolean hashtablelookupnode (hdlhashtable, const bigstring, hdlhashnode *);
+extern boolean hashlookup ( const Handle, tyvaluerecord *, hdlhashnode * );
+extern boolean hashtablelookup ( hdlhashtable, const Handle, tyvaluerecord *, hdlhashnode * );
+
+extern boolean hashTableLookupBigstring ( hdlhashtable, const bigstring, tyvaluerecord *, hdlhashnode * );
+
+extern boolean hashlookupnode ( Handle, hdlhashnode * );
+
+extern boolean hashtablelookupnode (hdlhashtable, const Handle, hdlhashnode *);
+
+extern boolean hashTableLookupNodeBigstring ( hdlhashtable, const bigstring, hdlhashnode * );
+
extern boolean hashtablevisit (hdlhashtable, langtablevisitcallback, ptrvoid);
extern boolean hashresort (hdlhashtable, hdlhashnode);
-extern boolean hashinversesearch (hdlhashtable, langinversesearchcallback, ptrvoid, bigstring);
+extern boolean hashinversesearch ( hdlhashtable, langinversesearchcallback, ptrvoid, Handle * );
-extern boolean hashsortedinversesearch (hdlhashtable, langsortedinversesearchcallback, ptrvoid);
+extern boolean hashsortedinversesearch ( hdlhashtable, langsortedinversesearchcallback, ptrvoid );
extern boolean hashnodeintable (hdlhashnode, hdlhashtable);
@@ -963,7 +1001,7 @@
extern boolean hashgetsortedindex (hdlhashtable, hdlhashnode, long *);
-extern boolean hashgetiteminfo (hdlhashtable, long, bigstring, tyvaluerecord *);
+extern boolean hashgetiteminfo ( hdlhashtable, long, Handle *, tyvaluerecord * );
extern boolean hashgetvaluestring (tyvaluerecord, bigstring);
@@ -973,11 +1011,21 @@
extern boolean hashvaltostrings (tyvaluerecord, bigstring, bigstring, bigstring);
+extern boolean gethashkey ( hdlhashnode, Handle * );
-extern boolean langgettypestring (tyvaluetype, bigstring); /*langops.c*/
+extern void setHashKey ( const Handle, ptrbyte );
-extern tyvaluetype langgettype (tyvaluerecord val); /*6.2b5 AR*/
+extern short getHashKeyLength ( ptrbyte );
+
+#pragma mark === langops.c ===
+
+extern boolean langSetStringValueFromBigstring ( const Handle, const bigstring );
+
+extern boolean langgettypestring (tyvaluetype, bigstring);
+
+extern tyvaluetype langgettype (tyvaluerecord val); // 6.2b5 AR
+
extern boolean langscalartype (tyvaluetype);
extern OSType langgettypeid (tyvaluetype);
@@ -986,39 +1034,49 @@
extern boolean langgoodbinarytype (tyvaluetype);
-extern boolean langfindsymbol (const bigstring, hdlhashtable *, hdlhashnode *);
+extern boolean langfindsymbol ( const Handle, hdlhashtable *, hdlhashnode * );
-extern boolean langgetsymbolval (const bigstring, tyvaluerecord *, hdlhashnode *);
+extern boolean langgetsymbolval ( const Handle, tyvaluerecord *, hdlhashnode * );
-extern boolean langsetsymbolval (const bigstring, tyvaluerecord);
+extern boolean langsetsymbolval ( const Handle, tyvaluerecord );
-extern boolean langsetsymboltableval (hdlhashtable, const bigstring, tyvaluerecord);
+extern boolean langsetsymboltableval ( hdlhashtable, const Handle, tyvaluerecord );
-extern boolean langsetstringval (const bigstring, const bigstring);
+extern boolean langsetstringval ( const Handle, const Handle );
-extern boolean langsetbinaryval (hdlhashtable, const bigstring, Handle);
+extern boolean langsetbinaryval ( hdlhashtable, const Handle, Handle );
-extern boolean langassignstringvalue (hdlhashtable, const bigstring, const bigstring);
+extern boolean langassignstringvalue ( hdlhashtable, const Handle, const bigstring, const Handle, const bigstring );
+
+extern boolean langassignbooleanvalue (hdlhashtable, const Handle, boolean);
-extern boolean langassignbooleanvalue (hdlhashtable, const bigstring, boolean);
+extern boolean langAssignBooleanValueBigstring ( hdlhashtable, const bigstring, boolean );
extern boolean langassigncharvalue (hdlhashtable, const bigstring, unsigned char);
extern boolean langassignlongvalue (hdlhashtable, const bigstring, long);
-extern boolean langassignaddressvalue (hdlhashtable, const bigstring, const tyaddress *);
+extern boolean langassignaddressvalue ( hdlhashtable, const Handle, const tyaddress * );
-extern boolean langassignnewtablevalue (hdlhashtable, const bigstring, hdlhashtable *);
+extern boolean langAssignAddressValueBigstring ( hdlhashtable, const bigstring, const tyaddress * );
-extern boolean langsuretablevalue (hdlhashtable, const bigstring, hdlhashtable *);
+extern boolean langassignnewtablevalue ( hdlhashtable, const Handle, hdlhashtable * );
+extern boolean langAssignNewTableValueBigstring ( hdlhashtable, const bigstring, hdlhashtable * );
+
+extern boolean langsuretablevalue ( hdlhashtable, const Handle, hdlhashtable * );
+
+extern boolean langSureTableValueBigstring ( hdlhashtable, const bigstring, hdlhashtable * );
+
extern boolean langcheckstackspace (void);
extern boolean langbuildnamelist (hdltreenode htree, struct tylistrecord **hlist);
-extern boolean langpackvalue (tyvaluerecord, Handle *, hdlhashnode); /*langpack.c*/
+#pragma mark === langpack.c ===
+extern boolean langpackvalue (tyvaluerecord, Handle *, hdlhashnode);
+
extern boolean langpackverb (hdltreenode, tyvaluerecord *);
extern boolean langpackwindowverb (hdltreenode, tyvaluerecord *);
@@ -1032,13 +1090,17 @@
extern boolean langvaluetotextscrap (tyvaluerecord, Handle);
-extern boolean langcanusealiases (void); /*langsystem7.c*/
+#pragma mark === langsystem7.c ===
+extern boolean langcanusealiases (void);
+
extern boolean langcanuseappleevents (void);
-extern void cleartmpstack (void); /*langtmpstack.c*/
+#pragma mark === langtmpstack.c ===
+extern void cleartmpstack (void);
+
extern boolean pushtmpstackvalue (tyvaluerecord *);
extern boolean pushtmpstack (Handle);
@@ -1052,204 +1114,226 @@
extern boolean exemptfromtmpstack (tyvaluerecord *);
-extern boolean langdisposetree (hdltreenode); /*langtree.c*/
+#pragma mark === langtree.c ===
+extern boolean langdisposetree (hdltreenode);
-extern boolean langsymbolreference (hdlhashtable, bigstring, tyvaluerecord *, hdlhashnode *); /*langvalue.c*/
-extern void initvalue (tyvaluerecord *, tyvaluetype);
+#pragma mark === langvalue.c ===
-extern boolean setnilvalue (tyvaluerecord *);
+extern OSType getbinarytypeid (Handle);
-extern boolean setbooleanvalue (boolean, tyvaluerecord *);
+extern boolean coerceToTextHandle ( tyvaluerecord * );
-extern boolean setcharvalue (byte, tyvaluerecord *);
+extern boolean coercetoaddress (tyvaluerecord *);
-extern boolean setintvalue (short, tyvaluerecord *);
+extern boolean coercetobinary (tyvaluerecord *);
-extern boolean setlongvalue (long, tyvaluerecord *);
+extern boolean coercetoboolean (tyvaluerecord *);
-extern boolean setdatevalue (unsigned long, tyvaluerecord *);
+extern boolean coercetofilespec (tyvaluerecord *);
-extern boolean setdirectionvalue (tydirection, tyvaluerecord *);
+extern boolean coercetoint (tyvaluerecord *);
-extern boolean setostypevalue (OSType, tyvaluerecord *);
+extern boolean coercetolong (tyvaluerecord *);
-extern boolean setpointvalue (Point, tyvaluerecord *);
+extern boolean coercetoostype (tyvaluerecord *);
-extern boolean setfixedvalue (Fixed, tyvaluerecord *);
+extern boolean coercetorgb (tyvaluerecord *);
-extern boolean setsinglevalue (float, tyvaluerecord *);
+extern boolean coercetostring (tyvaluerecord *);
-extern boolean newheapvalue (ptrvoid, long, tyvaluetype, tyvaluerecord *);
+extern boolean coercetypes (tyvaluerecord *, tyvaluerecord *);
-extern boolean setstringvalue (bigstring, tyvaluerecord *);
+extern boolean coercevalue (tyvaluerecord *, tyvaluetype);
-extern boolean setaddressvalue (hdlhashtable, const bigstring, tyvaluerecord *);
+extern boolean copyvaluedata (tyvaluerecord *);
-extern boolean setexemptaddressvalue (hdlhashtable htable, const bigstring bs, tyvaluerecord *val);
+extern boolean copyvaluerecord (tyvaluerecord, tyvaluerecord *);
-extern boolean getaddressvalue (tyvaluerecord, hdlhashtable *, bigstring);
+extern boolean getaddressparam (hdltreenode, short, tyvaluerecord *);
-/*
-extern boolean setpasswordvalue (bigstring, tyvaluerecord *);
-*/
+extern boolean getaddresspath ( tyvaluerecord, Handle * );
-extern boolean setheapvalue (Handle, tyvaluetype, tyvaluerecord *);
+extern boolean getaddressvalue ( tyvaluerecord, hdlhashtable *, Handle * );
-extern boolean setbinaryvalue (Handle, OSType, tyvaluerecord *);
+extern boolean getaliasparam (hdltreenode, short, tyvaluerecord *);
-extern boolean setbinarytypeid (Handle, OSType);
+extern boolean getbinaryparam (hdltreenode, short, tyvaluerecord *);
-extern OSType getbinarytypeid (Handle);
+extern boolean getbooleanparam (hdltreenode, short, tyvaluerecord *);
-extern boolean stripbinarytypeid (Handle);
+extern boolean getcharparam (hdltreenode, short, tyvaluerecord *);
-extern boolean setdoublevalue (double, tyvaluerecord *);
+extern boolean getdateparam (hdltreenode, short, tyvaluerecord *);
-extern boolean setfilespecvalue (ptrfilespec, tyvaluerecord *);
+extern boolean getdirectionparam (hdltreenode, short, tyvaluerecord *);
-extern boolean setexternalvalue (Handle, tyvaluerecord *);
+extern boolean getdoubleparam (hdltreenode, short, tyvaluerecord *);
-extern boolean langhashtablelookup (hdlhashtable htable, const bigstring bs, tyvaluerecord *vreturned, hdlhashnode *); /*6.1d4 AR*/
+extern boolean getfilespecparam (hdltreenode, short, tyvaluerecord *);
-extern boolean langassigntextvalue (hdlhashtable ht, bigstring bs, Handle h); /*6.1d4 AR*/
+extern boolean getfixedparam (hdltreenode, short, tyvaluerecord *);
-extern boolean langlookupstringvalue (hdlhashtable ht, bigstring bs, bigstring bsval); /*6.1d3 AR*/
+extern boolean getintparam (hdltreenode, short, tyvaluerecord *);
-extern boolean langlookupaddressvalue (hdlhashtable ht, bigstring bs, tyaddress *addressval); /*6.1d3 AR*/
+extern boolean getlongparam (hdltreenode, short, tyvaluerecord *);
-extern boolean langlookuplongvalue (hdlhashtable ht, bigstring bs, long *x); /*6.1d4 AR*/
+extern boolean getobjspecparam (hdltreenode, short, tyvaluerecord *);
-extern boolean langlookupbooleanvalue (hdlhashtable ht, bigstring bs, boolean *fl); /*6.1d3 AR*/
+extern boolean getoptionaladdressparam ( hdltreenode , short *, short *, bigstring , hdlhashtable *, Handle * ); // 2006-03-10 aradke
-extern boolean langtablecopyvalue (hdlhashtable hsource, hdlhashtable hdest, bigstring bs); /*6.1d4 AR*/
+extern boolean getoptionalparam (hdltreenode, short *, short *, bigstring, hdltreenode *);
+extern boolean getoptionalparamvalue (hdltreenode, short *, short *, bigstring, tyvaluerecord *);
-extern boolean setwinvalue (WindowPtr pwindow, tyvaluerecord *val); /*shellwindowverbs.c*/
+extern boolean getoptionaltableparam (hdltreenode , short *, short *, bigstring, hdlhashtable *); /*2006-03-10 aradke*/
-extern boolean copyvaluedata (tyvaluerecord *);
+extern boolean getostypeparam (hdltreenode, short, tyvaluerecord *);
-extern boolean copyvaluerecord (tyvaluerecord, tyvaluerecord *);
+extern boolean getparamvalue (hdltreenode, short, tyvaluerecord *);
-#ifdef DATABASE_DEBUG
- extern void debug_disposevaluerecord (tyvaluerecord, boolean, long, char*);
- #define disposevaluerecord(val, fldisk) \
- debug_disposevaluerecord (val, fldisk, __LINE__, __FILE__)
-#else
- extern void disposevaluerecord (tyvaluerecord, boolean);
-#endif
+extern boolean getpatternparam (hdltreenode, short, tyvaluerecord *);
-extern boolean langgetspecialtable (bigstring, hdlhashtable *);
+extern boolean getpointparam (hdltreenode, short, tyvaluerecord *);
-extern boolean getaddresspath (tyvaluerecord, bigstring);
+extern boolean getreadonlyparamvalue (hdltreenode, short, tyvaluerecord *); /* 2003-04-28 AR: needed in langregexp.c */
-//extern boolean truevalue (tyvaluerecord); //6.2b15 AR: removed
+extern boolean getrectparam (hdltreenode, short, tyvaluerecord *);
-extern boolean coercetolong (tyvaluerecord *);
+extern boolean getrgbparam (hdltreenode, short, tyvaluerecord *);
-extern boolean coercetoint (tyvaluerecord *);
+extern boolean getsingleparam (hdltreenode, short, tyvaluerecord *);
-extern boolean coercetorgb (tyvaluerecord *);
+extern boolean getstringparam (hdltreenode, short, tyvaluerecord *);
-extern boolean coercetoostype (tyvaluerecord *);
+extern boolean getstringvalue (hdltreenode, short, bigstring);
-extern boolean coercetostring (tyvaluerecord *);
+extern boolean gettextvalue (hdltreenode, short, Handle *);
-extern boolean coercetoaddress (tyvaluerecord *);
+extern boolean getvarparam ( hdltreenode, short, hdlhashtable *, Handle * );
-extern boolean coercetoboolean (tyvaluerecord *);
+extern boolean getvarvalue ( hdltreenode, short, hdlhashtable *, Handle *, tyvaluerecord *, hdlhashnode * );
-extern boolean coercetofilespec (tyvaluerecord *);
+extern boolean idstringvalue ( hdlhashtable, const Handle, bigstring );
-extern boolean coercetobinary (tyvaluerecord *);
+extern boolean langassigntextvalue (hdlhashtable ht, bigstring bs, Handle h); /*6.1d4 AR*/
-extern boolean coercevalue (tyvaluerecord *, tyvaluetype);
+extern boolean langcheckparamcount (hdltreenode, short);
-extern boolean coercetypes (tyvaluerecord *, tyvaluerecord *);
+extern boolean langexpandtodotparams ( const Handle, hdlhashtable *, Handle * );
-extern void disposevalues (tyvaluerecord *, tyvaluerecord *);
+extern boolean langgetdotparams ( hdltreenode, hdlhashtable *, Handle * );
-extern boolean langgetidentifier (hdltreenode, bigstring);
+extern boolean langgetidentifier ( hdltreenode, Handle * );
-extern boolean langtablelookup (hdlhashtable, bigstring, hdlhashtable *);
+extern boolean langgetspecialtable ( const Handle, hdlhashtable * );
-extern boolean langsearchpathlookup (bigstring, hdlhashtable *);
+extern boolean langhashtablelookup ( hdlhashtable, const Handle, tyvaluerecord *, hdlhashnode * ); // 6.1d4 AR
-extern boolean langexpandtodotparams (bigstring, hdlhashtable *, bigstring);
+extern boolean langHashTableLookupBigstring ( hdlhashtable, const bigstring, tyvaluerecord *, hdlhashnode * );
-extern boolean langgetdotparams (hdltreenode, hdlhashtable *, bigstring);
+extern boolean langlookupaddressvalue ( hdlhashtable, const Handle, tyaddress * ); // 6.1d3 AR
-extern boolean idstringvalue (hdlhashtable, bigstring, bigstring);
+extern boolean langLookupAddressValueBigstring ( hdlhashtable, const bigstring, tyaddress * );
-extern boolean langcheckparamcount (hdltreenode, short);
+extern boolean langlookupbooleanvalue ( hdlhashtable, const Handle, boolean * ); // 6.1d3 AR
-extern short langgetparamcount (hdltreenode);
+extern boolean langLookupBooleanValueBigstring ( hdlhashtable, const bigstring, boolean * );
-extern boolean getparamvalue (hdltreenode, short, tyvaluerecord *);
+extern boolean langlookuplongvalue ( hdlhashtable, const Handle, long * ); // 6.1d4 AR
-extern boolean getreadonlyparamvalue (hdltreenode, short, tyvaluerecord *); /* 2003-04-28 AR: needed in langregexp.c */
+extern boolean langLookupLongValueBigstring ( hdlhashtable, const bigstring, long * );
-extern boolean getoptionalparam (hdltreenode, short *, short *, bigstring, hdltreenode *);
+extern boolean langlookupstringvalue ( hdlhashtable, const Handle, bigstring ); // 6.1d3 AR
-extern boolean getoptionalparamvalue (hdltreenode, short *, short *, bigstring, tyvaluerecord *);
+extern boolean langLookupStringValueBigstring ( hdlhashtable, const bigstring, bigstring );
-extern boolean getoptionaladdressparam (hdltreenode , short *, short *, bigstring , hdlhashtable *, bigstring); /*2006-03-10 aradke*/
+extern boolean langsearchpathlookup ( const Handle, hdlhashtable * );
-extern boolean getoptionaltableparam (hdltreenode , short *, short *, bigstring, hdlhashtable *); /*2006-03-10 aradke*/
+extern boolean langsymbolreference ( hdlhashtable, const Handle, tyvaluerecord *, hdlhashnode * );
-extern boolean getaddressparam (hdltreenode, short, tyvaluerecord *);
+extern boolean langtablecopyvalue ( hdlhashtable, hdlhashtable, const bigstring ); // 6.1d4 AR
-extern boolean getvarparam (hdltreenode, short, hdlhashtable *, bigstring);
+extern boolean langtablelookup ( hdlhashtable, const Handle, hdlhashtable * );
-extern boolean getcharparam (hdltreenode, short, tyvaluerecord *);
+extern boolean newheapvalue (ptrvoid, long, tyvaluetype, tyvaluerecord *);
-extern boolean getlongparam (hdltreenode, short, tyvaluerecord *);
+extern boolean setStringValueFromHandle ( const Handle, tyvaluerecord * );
-extern boolean getdateparam (hdltreenode, short, tyvaluerecord *);
+extern boolean setaddressvalue ( hdlhashtable, const Handle, tyvaluerecord * );
-extern boolean getintparam (hdltreenode, short, tyvaluerecord *);
+extern boolean setbinarytypeid (Handle, OSType);
-extern boolean getbooleanparam (hdltreenode, short, tyvaluerecord *);
+extern boolean setbinaryvalue (Handle, OSType, tyvaluerecord *);
-extern boolean getstringparam (hdltreenode, short, tyvaluerecord *);
+extern boolean setbooleanvalue (boolean, tyvaluerecord *);
-extern boolean getdirectionparam (hdltreenode, short, tyvaluerecord *);
+extern boolean setcharvalue (byte, tyvaluerecord *);
-extern boolean getostypeparam (hdltreenode, short, tyvaluerecord *);
+extern boolean setdatevalue (unsigned long, tyvaluerecord *);
-extern boolean getpointparam (hdltreenode, short, tyvaluerecord *);
+extern boolean setdirectionvalue (tydirection, tyvaluerecord *);
-extern boolean getrectparam (hdltreenode, short, tyvaluerecord *);
+extern boolean setdoublevalue (double, tyvaluerecord *);
-extern boolean getrgbparam (hdltreenode, short, tyvaluerecord *);
-
-extern boolean getpatternparam (hdltreenode, short, tyvaluerecord *);
+extern boolean setexemptaddressvalue ( hdlhashtable, const Handle, tyvaluerecord * );
-extern boolean getfixedparam (hdltreenode, short, tyvaluerecord *);
+extern boolean setexternalvalue (Handle, tyvaluerecord *);
-extern boolean getsingleparam (hdltreenode, short, tyvaluerecord *);
+extern boolean setfilespecvalue (ptrfilespec, tyvaluerecord *);
-extern boolean getdoubleparam (hdltreenode, short, tyvaluerecord *);
+extern boolean setfixedvalue (Fixed, tyvaluerecord *);
-extern boolean getfilespecparam (hdltreenode, short, tyvaluerecord *);
+extern boolean setheapvalue (Handle, tyvaluetype, tyvaluerecord *);
-extern boolean getaliasparam (hdltreenode, short, tyvaluerecord *);
+extern boolean setintvalue (short, tyvaluerecord *);
-extern boolean getobjspecparam (hdltreenode, short, tyvaluerecord *);
+extern boolean setlongvalue (long, tyvaluerecord *);
-extern boolean getbinaryparam (hdltreenode, short, tyvaluerecord *);
+extern boolean setnilvalue (tyvaluerecord *);
-#ifdef shellinclude
-extern boolean getwinparam (hdltreenode, short, hdlwindowinfo *); // shellwindowverbs.c
+extern boolean setostypevalue (OSType, tyvaluerecord *);
+
+extern boolean setpointvalue (Point, tyvaluerecord *);
+
+extern boolean setsinglevalue (float, tyvaluerecord *);
+
+extern boolean setstringvalue ( bigstring, tyvaluerecord * );
+
+extern boolean stripbinarytypeid (Handle);
+
+extern short langgetparamcount (hdltreenode);
+
+extern void disposevalues (tyvaluerecord *, tyvaluerecord *);
+
+extern void initvalue (tyvaluerecord *, tyvaluetype);
+
+#ifdef DATABASE_DEBUG
+
+ extern void debug_disposevaluerecord (tyvaluerecord, boolean, long, char*);
+
+ #define disposevaluerecord(val, fldisk) \
+ debug_disposevaluerecord (val, fldisk, __LINE__, __FILE__)
+#else
+ extern void disposevaluerecord (tyvaluerecord, boolean);
#endif
-extern boolean getvarvalue (hdltreenode, short, hdlhashtable *, bigstring, tyvaluerecord *, hdlhashnode *);
+// extern boolean setpasswordvalue (bigstring, tyvaluerecord *);
-extern boolean getstringvalue (hdltreenode, short, bigstring);
+// extern boolean truevalue (tyvaluerecord); //6.2b15 AR: removed
-extern boolean gettextvalue (hdltreenode, short, Handle *);
+#pragma mark === shellwindowverbs.c ===
+
+extern boolean setwinvalue (WindowPtr pwindow, tyvaluerecord *val);
+
+#ifdef shellinclude
+
+ extern boolean getwinparam (hdltreenode, short, hdlwindowinfo *);
+
+#endif
+
extern boolean getexempttextvalue (hdltreenode, short, Handle *);
extern boolean getreadonlytextvalue (hdltreenode, short, Handle *);
@@ -1322,20 +1406,22 @@
extern boolean notvalue (tyvaluerecord, tyvaluerecord *);
-extern boolean kernelfunctionvalue (hdlhashtable, bigstring, hdltreenode, tyvaluerecord *);
+extern boolean kernelfunctionvalue ( hdlhashtable, const Handle, hdltreenode, tyvaluerecord * );
extern boolean langhandlercall (hdltreenode, hdltreenode, tyvaluerecord *);
-extern boolean langfunctioncall (hdltreenode, hdlhashtable, hdlhashnode, bigstring, hdltreenode, hdltreenode, tyvaluerecord *);
+extern boolean langfunctioncall ( hdltreenode, hdlhashtable, hdlhashnode, const Handle, hdltreenode, hdltreenode, tyvaluerecord * );
extern boolean functionvalue (hdltreenode, hdltreenode, tyvaluerecord *);
-extern boolean langzoomvalwindow (hdlhashtable, bigstring, tyvaluerecord, boolean); /*langverbs.c*/
+#pragma mark === langverbs.c ===
+extern boolean langzoomvalwindow ( hdlhashtable, Handle *, tyvaluerecord, boolean );
+
extern boolean langfindtargetwindow (short, WindowPtr *);
-extern boolean setstatusbarstring (bigstring bs, long partNumber); /*7.0b20 PBS: new statusbar verbs from Bob*/
+extern boolean setstatusbarstring (bigstring bs, long partNumber); // 7.0b20 PBS: new statusbar verbs from Bob
extern boolean getstatusbarstring (bigstring bs, long partNumber);
@@ -1345,9 +1431,7 @@
extern boolean langcleartarget (tyvaluerecord *prevtarget);
-extern boolean langsettarget (hdlhashtable htable, bigstring bsname, tyvaluerecord *prevtarget);
+extern boolean langsettarget ( hdlhashtable, const Handle, tyvaluerecord * );
#endif
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/lang.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/lang.c 2007-02-23 20:59:35 UTC (rev 1623)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/lang.c 2007-02-23 21:45:04 UTC (rev 1624)
@@ -92,14 +92,18 @@
static boolean langtracktimeslice (tyerrorrecord *slice) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ Handle handleName, handlePath;
+ bigstring bspath;
hdlerrorstack hs = langcallbacks.scripterrorstack;
+ hdlhashnode hnode;
+ hdlhashtable hprofiledata, htable;
hdlprocessrecord hp = currentprocess;
- hdlhashtable hprofiledata;
tyerrorrecord *pe = slice;
- hdlhashtable htable;
- bigstring bsname, bspath;
- hdlhashnode hnode;
tyvaluerecord val;
if (hp == nil)
@@ -113,30 +117,41 @@
if (hprofiledata == nil)
return (false);
- if ((*pe).errorcallback == nil
- || !(*(*pe).errorcallback) ((*pe).errorrefcon, 0, 0, &htable, bsname)) {
+ if ( ( *pe ).errorcallback == nil || ! ( *( *pe ).errorcallback ) ( ( *pe ).errorrefcon, 0, 0, &htable, &handleName ) ) {
- langgetstringlist (anomynousthreadstring, bspath);
- }
+ langgetstringlist ( anomynousthreadstring, bspath );
+
+ if ( ! newtexthandle ( bspath, &handlePath ) ) {
+
+ disposehandle ( handleName );
+
+ return ( false );
+
+ } // if
+
+ } // if
else {
if (htable == nil)
- copystring (bsname, bspath);
+ copyhandle( handleName, &handlePath );
else
- langexternalgetfullpath (htable, bsname, bspath, nil);
+ langexternalgetfullpath (htable, handleName, &handlePath, nil);
}
- if (hashtablelookupnode (hprofiledata, bspath, &hnode)) {
-
+ if ( hashtablelookupnode ( hprofiledata, handlePath, &hnode ) )
(**hnode).val.data.longvalue += (*pe).profiletotal;
- }
else {
setlongvalue ((*pe).profiletotal, &val);
- hashtableassign (hprofiledata, bspath, val);
+ hashtableassign (hprofiledata, handlePath, val);
+
}
- return (true);
- } /*langtracktimeslice*/
+ disposehandle ( handleName );
+ disposehandle ( handlePath );
+
+ return ( true );
+
+ } // langtracktimeslice
boolean langstartprofiling (void) {
@@ -215,10 +230,11 @@
} /*langstopprofiling*/
-boolean langpusherrorcallback (langerrorcallback errorroutine, long errorrefcon) {
+boolean langpusherrorcallback ( langerrorcallback errorroutine, long errorrefcon ) {
register hdlerrorstack hs = langcallbacks.scripterrorstack;
register hdlprocessrecord hp = currentprocess;
+
tyerrorrecord *pe;
tyerrorrecord item;
@@ -252,6 +268,7 @@
pe = &(**hs).stack [(**hs).toperror - 1];
(*pe).profiletotal += item.profilebase - (*pe).profilebase;
+
}
}
@@ -260,6 +277,7 @@
(**hs).stack [(**hs).toperror++] = item;
return (true);
+
} /*langpusherrorcallback*/
@@ -442,9 +460,11 @@
cnumerror = ctscanchars;
refconerror = refcon;
+
}
return (true);
+
} /*langcompileerror*/
@@ -501,6 +521,7 @@
langdisposetree (h); /*dispose whatever was built...*/
langdisposetree (yylval); /*...including this piece*/
+
}
if (!isemptystring (bsparsererror)) {
@@ -510,9 +531,11 @@
ctscanchars = cnumerror;
(*savecallback) (bsparsererror, refconerror);
+
}
return (false);
+
}
if (h == nil) /*syntax error, or system error*/
@@ -521,6 +544,7 @@
*hcode = h;
return (true);
+
} /*langcompiletext*/
@@ -533,6 +557,7 @@
langprescript (); /*initialize lang globals, about to compile a script*/
return (langcompiletext (htext, fllinebased, hcode)); /*disposes htext*/
+
} /*langbuildtree*/
@@ -550,11 +575,11 @@
chainhashtable (ht); /*link it into the runtime stack*/
return (true);
+
} /*langdefaultpushtable*/
-boolean langdefaultpoptable (hdlhashtable htable) {
-#pragma unused (htable)
+boolean langdefaultpoptable ( void ) {
register hdlhashtable ht = currenthashtable;
@@ -563,6 +588,7 @@
disposehashtable (ht, false);
return (true);
+
} /*langdefaultpoptable*/
@@ -571,6 +597,7 @@
langerrormessage (bs);
return (false); /*consume the error*/
+
} /*langerrorhook*/
@@ -581,12 +608,14 @@
*/
shellpusherrorhook (&langerrorhook);
+
} /*langhookerrors*/
void langunhookerrors (void) {
shellpoperrorhook ();
+
} /*langunhookerrors*/
@@ -600,6 +629,7 @@
copystring (bsmsg, perrorstring);
return (true);
+
} /*langtraperrormessage*/
@@ -618,6 +648,7 @@
langcallbacks.errormessagerefcon = bserror;
langcallbacks.errormessagecallback = (langerrormessagecallback) &langtraperrormessage;
+
} /*langtraperrors*/
@@ -764,19 +795,18 @@
a parameter everywhere. Running card scripts needs it.
*/
- register boolean fl;
- hdltreenode hcode;
- /*tylangcallbacks savecallbacks;*/
+ register boolean fl, flscriptalreadyrunning = flscriptrunning, fltablealreadypushed = false;
+
boolean fltmpval;
- register boolean flscriptalreadyrunning = flscriptrunning;
- register boolean fltablealreadypushed = false;
- unsigned short savelines = ctscanlines;
- unsigned short savechars = ctscanchars;
+ hdltreenode hcode;
+ unsigned short savechars = ctscanchars, savelines = ctscanlines;
-#ifdef WIN95VERSION
-checkthreadglobals ();
-#endif
-
+ #ifdef WIN95VERSION
+
+ checkthreadglobals ();
+
+ #endif
+
setbooleanvalue (false, val);
flscriptrunning = true;
@@ -800,8 +830,8 @@
ctscanchars = savechars;
langvisitcodetree (hcode, &renumberlinesvisit, nil);
+
}
-
else {
fltablealreadypushed = currenthashtable != nil;
@@ -813,6 +843,7 @@
langerrorclear ();
langhookerrors ();
+
}
fl = evaluatelist ((**hcode).param1, val);
@@ -838,14 +869,15 @@
exit:
- /*
- if (flscriptalreadyrunning)
- */
- langpoperrorcallback ();
-
- flscriptrunning = flscriptalreadyrunning;
-
- return (fl);
+ /*
+ if (flscriptalreadyrunning)
+ */
+ langpoperrorcallback ();
+
+ flscriptrunning = flscriptalreadyrunning;
+
+ return (fl);
+
} /*langrun*/
@@ -885,6 +917,7 @@
pushhashtable (roottable); /*need temp stack services*/
pushvalueontmpstack (&val);
+
}
if (coercetostring (&val)) {
@@ -892,6 +925,7 @@
texthandletostring (val.data.stringvalue, bsresult);
fl = true; /*it worked, we'll return true*/
+
}
cleartmpstack ();
@@ -900,6 +934,7 @@
pophashtable ();
return (fl);
+
} /*langrunhandle*/
@@ -916,6 +951,7 @@
copystring (bsmsg, perrorstring);
return (true);
+
} /*langtraperror*/
@@ -1044,29 +1080,30 @@
// 3/5/97 dmb: disablelangerror ();
- saveerrormessage = langcallbacks.errormessagecallback;
-
- saveerrorclear = langcallbacks.clearerrorcallback;
-
- langcallbacks.errormessagecallback = (langerrormessagecallback) &truenoop;
-
- langcallbacks.clearerrorcallback = &truenoop;
-
- ++fldisableyield;
-
+ saveerrormessage = langcallbacks.errormessagecallback;
+
+ saveerrorclear = langcallbacks.clearerrorcallback;
+
+ langcallbacks.errormessagecallback = (langerrormessagecallback) &truenoop;
+
+ langcallbacks.clearerrorcallback = &truenoop;
+
+ ++fldisableyield;
+
fl = langrunstring (bsprogram, bsresult);
// 3/5/97 dmb: enablelangerror ();
- --fldisableyield;
-
- langcallbacks.errormessagecallback = saveerrormessage;
-
- langcallbacks.clearerrorcallback = saveerrorclear;
-
- fllangerror = false;
+ --fldisableyield;
+ langcallbacks.errormessagecallback = saveerrormessage;
+
+ langcallbacks.clearerrorcallback = saveerrorclear;
+
+ fllangerror = false;
+
return (fl);
+
} /*langrunstringnoerror*/
@@ -1126,10 +1163,8 @@
overriding its current chain. (our own scope chain becomes superflous.)
*/
- register boolean flscriptwasrunning = flscriptrunning;
+ register boolean boolean fl, flchained = false, flscriptwasrunning = flscriptrunning;
register hdlhashtable ht = hcontext;
- register boolean fl;
- register boolean flchained = false;
if (htree == nil) /*defensive driving*/
return (false);
@@ -1173,6 +1208,7 @@
langpostscript ();
return (fl);
+
} /*langruncode*/
@@ -1394,14 +1430,19 @@
} /*langbuildparamlist*/
-boolean langrunscriptcode (hdlhashtable htable, bigstring bsverb, hdltreenode hcode, tyvaluerecord *vparams, hdlhashtable hcontext, tyvaluerecord *vreturned) {
-
- /*
- 02/04/02 dmb: the guts of langrunscript
+boolean langrunscriptcode ( hdlhashtable htable, const Handle handleVerb,
+ hdltreenode hcode, tyvaluerecord *vparams, hdlhashtable hcontext,
+ tyvaluerecord *vreturned ) {
- 2004-11-03 aradke: Accept nil for vparams, meaning the function
- doesn't take any parameters, so we simply bypass langbuildparamlist.
- */
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 2004-11-03 aradke: Accept nil for vparams, meaning the function doesn't
+ // take any parameters, so we simply bypass
+ // langbuildparamlist.
+ //
+ // 1902-02-04 dmb: the guts of langrunscript
+ //
boolean fl = false;
boolean flchained;
@@ -1410,15 +1451,12 @@
hdltreenode hparamlist = nil;
boolean fltmpval;
- if (!setaddressvalue (htable, bsverb, &val))
+ if (!setaddressvalue (htable, handleVerb, &val))
goto exit;
if (!pushfunctionreference (val, &hfunctioncall))
goto exit;
-/* if (hcontext != nil)
- pushhashtable (hcontext);
-*/
flchained = (hcontext != nil) && (**hcontext).flchained;
if (vparams != nil) {
@@ -1446,6 +1484,7 @@
langdisposetree (hfunctioncall);
goto exit;
+
}
}
@@ -1480,154 +1519,112 @@
exit:
return (fl);
+
} /*langrunscriptcode*/
-boolean langrunscript (bigstring bsscriptname, tyvaluerecord *vparams, hdlhashtable hcontext, tyvaluerecord *vreturned) {
-
- /*
- 5.0.2b6 rab/dmb: new verb
-
- 5.0.2b7 dmb: preserve errormessagecallback through the call
-
- 6.0a9 dmb: was langipcrunscript, moved here and don't create new process
+boolean langrunscript ( const Handle handleScriptName, tyvaluerecord *vparams, hdlhashtable hcontext, tyvaluerecord *vreturned ) {
- 6.0a14 dmb: fixed potential memory leak in error case.
-
- 7.0b41 pbs: if passed a record instead of a list, call the script with named parameters.
-
- 8.0.4 dmb: handle running code values
- */
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 8.0.4 dmb: handle running code values
+ //
+ // 7.0b41 pbs: if passed a record instead of a list, call the script with
+ // named parameters.
+ //
+ // 6.0a14 dmb: fixed potential memory leak in error case.
+ //
+ // 6.0a9 dmb: was langipcrunscript, moved here and don't create new process
+ //
+ // 5.0.2b7 dmb: preserve errormessagecallback through the call
+ //
+ // 5.0.2b6 rab/dmb: new verb
+ //
- bigstring bsverb;
- boolean fl = false;
- hdltreenode hcode;
+ Handle handleVerb = NULL;
+ boolean fl = false, flReturn = false;
+ hdlhashnode handlernode;
hdlhashtable htable;
+ hdltreenode hcode;
tyvaluerecord vhandler;
- hdlhashnode handlernode;
pushhashtable (roottable);
- fl = langexpandtodotparams (bsscriptname, &htable, bsverb);
+ fl = langexpandtodotparams ( handleScriptName, &htable, &handleVerb );
- if (fl) {
-
+ if (fl)
if (htable == nil)
- langsearchpathlookup (bsverb, &htable);
- }
-
+ langsearchpathlookup (handleVerb, &htable);
+
pophashtable();
if (!fl)
return (false);
+
+ if (!hashtablelookupnode (htable, handleVerb, &handlernode)) {
- if (!hashtablelookupnode (htable, bsverb, &handlernode)) {
+ langparamerror ( unknownfunctionerror, handleVerb );
- langparamerror (unknownfunctionerror, bsverb);
+ goto exit;
- return (false);
}
-
+
vhandler = (**handlernode).val;
/*build a code tree and call the handler, with our error hook in place*/
hcode = nil;
- if (vhandler.valuetype == codevaluetype) {
-
+ if (vhandler.valuetype == codevaluetype)
+
hcode = vhandler.data.codevalue;
- }
+
else if ((**htable).valueroutine == nil) { /*not a kernel table*/
if (!langexternalvaltocode (vhandler, &hcode)) {
- langparamerror (notfunctionerror, bsverb);
+ langparamerror ( notfunctionerror, handleVerb );
- return (false);
+ goto exit;
+
}
-
- if (hcode == nil) { /*needs compilation*/
+ if (hcode == nil) // needs compilation
+
if (!langcompilescript (handlernode, &hcode))
- return (false);
- }
+
+ goto exit;
}
-
- return (langrunscriptcode (htable, bsverb, hcode, vparams, hcontext, vreturned));
- } /*langrunscript*/
-
-/*
- boolean flchained;
- tyvaluerecord val;
- hdltreenode hfunctioncall;
- hdltreenode hparamlist;
- boolean fltmpval;
-
- if (!setaddressvalue (htable, bsverb, &val))
- goto exit;
-
- if (!pushfunctionreference (val, &hfunctioncall))
- goto exit;
-
- if (hcontext != nil) {
- flchained = (**hcontext).flchained;
-
- if (flchained)
- pushhashtable (hcontext);
- else
- chainhashtable (hcontext); //establishes outer local context
- }
+ flReturn = langrunscriptcode ( htable, handleVerb, hcode, vparams, hcontext, vreturned );
- fl = langbuildparamlist (vparams, &hparamlist);
+ exit:
- if (hcontext != nil) {
+ disposehandle ( handleVerb );
- if (flchained)
- pophashtable ();
- else
- unchainhashtable ();
- }
-
- if (!fl) {
+ return ( flReturn );
- langdisposetree (hfunctioncall);
-
- goto exit;
- }
-
- if (!pushfunctioncall (hfunctioncall, hparamlist, &hcode)) //consumes input parameters
- goto exit;
-
- if (hcontext != nil) {
+ } /*langrunscript*/
- if (flchained)
- pushhashtable (hcontext);
- else
- chainhashtable (hcontext); //establishes outer local context
- }
+
+boolean langRunScriptBigstring ( const bigstring scriptName, tyvaluerecord *vparams, hdlhashtable hcontext, tyvaluerecord *vreturned ) {
+
+ //
+ // 2007-02-07 creedon: created
+ //
- fl = evaluatelist (hcode, vreturned);
+ Handle handleScriptName;
+ boolean fl;
- fltmpval = exemptfromtmpstack (vreturned); //must survive disposing of local scope chain
+ if ( ! newtexthandle ( scriptName, &handleScriptName ) )
+ return ( false );
+
+ fl = langrunscript ( handleScriptName, vparams, hcontext, vreturned );
- if (hcontext != nil) {
-
- if (flchained)
- pophashtable ();
- else
- unchainhashtable ();
- }
+ disposehandle ( handleScriptName );
- if (fltmpval) //insert into the next-most-global tmpstack, if one exists
- pushvalueontmpstack (vreturned);
-
- langdisposetree (hcode);
-
- exit:
+ return ( fl );
- return (fl);
- } /%langrunscript%/
-*/
+ } // langRunScriptBigstring
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langcallbacks.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langcallbacks.c 2007-02-23 20:59:35 UTC (rev 1623)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langcallbacks.c 2007-02-23 21:45:04 UTC (rev 1624)
@@ -63,9 +63,11 @@
disposehashtable (hmagictable, false);
hmagictable = nil;
+
}
return (fl);
+
} /*langpushlocalchain*/
@@ -81,6 +83,7 @@
/*stacktracer (hashgetstackdepth ());*/ /*debugging code*/
return (fl);
+
} /*langpoplocalchain*/
@@ -161,6 +164,7 @@
assert (flcontinue == flsavedcontinue); /****should be able to nuke this stuff*/
return (fl);
+
} /*langdebuggercall*/
@@ -176,10 +180,15 @@
} /*langrestoreglobals*/
-boolean langpushsourcecode (hdlhashtable htable, hdlhashnode hnode, bigstring bs) {
+boolean langpushsourcecode ( hdlhashtable htable, hdlhashnode hnode, const Handle h ) {
- return ((*langcallbacks.pushsourcecodecallback) (htable, hnode, bs));
- } /*langpushsourcecode*/
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+
+ return ( ( *langcallbacks.pushsourcecodecallback ) ( htable, hnode, h ) );
+
+ } // langpushsourcecode
boolean langpopsourcecode (void) {
@@ -230,6 +239,7 @@
return (false);
return ((*langcallbacks.errormessagecallback) (bs, langcallbacks.errormessagerefcon));
+
} /*langerrormessage*/
@@ -238,6 +248,7 @@
fllangerror = false;
return ((*langcallbacks.clearerrorcallback) ());
+
} /*langerrorclear*/
@@ -247,52 +258,68 @@
} /*langcompilescript*/
-void langsymbolchanged (hdlhashtable htable, const bigstring bs, hdlhashnode hnode, boolean flvalue) {
+void langsymbolchanged (hdlhashtable htable, const Handle handleName, hdlhashnode hnode, boolean flvalue) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 5.1.5b15 dmb: call callback first, so it can tell if table was already dirty
+ //
- /*
- 5.1.5b15 dmb: call callback first, so it can tell if table was already dirty
- */
-
-#ifdef fltracklocaladdresses
-
- if (flvalue) {
-
- hdlhashnode hn = hnode;
+ #ifdef fltracklocaladdresses
+
+ if (flvalue) {
- if ((hn != nil && hn != HNoNode) || hashtablelookupnode (htable, bs, &hn)) {
-
- hashunregisteraddressnode (hn);
-
- hashregisteraddressnode (htable, hn);
+ hdlhashnode hn = hnode;
+
+ if ((hn != nil && hn != HNoNode) || hashtablelookupnode (htable, handleName, &hn)) {
+
+ hashunregisteraddressnode (hn);
+
+ hashregisteraddressnode (htable, hn);
+
+ }
}
- }
-
-#endif
-
- (*langcallbacks.symbolchangedcallback) (htable, bs, hnode, flvalue);
+ #endif
+ (*langcallbacks.symbolchangedcallback) (htable, handleName, hnode, flvalue);
+
dirtyhashtable (htable);
- } /*langsymbolchanged*/
+
+ } // langsymbolchanged
-/*
-void langsymbolprechange (hdlhashtable htable, const bigstring bs, hdlhashnode hnode, boolean flvalue) {
+
+void langSymbolChangedBigstring ( hdlhashtable htable, const bigstring bsName, hdlhashnode hnode, boolean flvalue ) {
+
+ //
+ // 2007-02-23 creedon: created
+ //
- (*langcallbacks.symbolprechangecallback) (htable, bs, hnode, flvalue);
+ Handle h;
+
+ if ( ! newtexthandle ( bsName, &h ) )
+ ;
+
+ langsymbolchanged ( htable, h, hnode, flvalue );
+
+ disposehandle ( h );
+
+ } // langSymbolChangedBigstring
- }*/ /*langsymbolprechange*/
+void langsymbolinserted ( hdlhashtable htable, const Handle handleName, hdlhashnode hnode ) {
-void langsymbolinserted (hdlhashtable htable, const bigstring bsname, hdlhashnode hnode) {
+ #ifdef fltracklocaladdresses
+
+ hashregisteraddressnode ( htable, hnode );
+
+ #endif
-#ifdef fltracklocaladdresses
- hashregisteraddressnode (htable, hnode);
-#endif
+ ( *langcallbacks.symbolinsertedcallback ) ( htable, handleName, hnode );
- (*langcallbacks.symbolinsertedcallback) (htable, bsname, hnode);
+ } // langsymbolinserted
- } /*langsymbolinserted*/
-
void langsymbolunlinking (hdlhashtable htable, hdlhashnode hnode) {
(*langcallbacks.symbolunlinkingcallback) (htable, hnode);
@@ -300,18 +327,20 @@
} /*langsymbolunlinking*/
-void langsymboldeleted (hdlhashtable h...
[truncated message content] |
|
From: <cre...@us...> - 2007-02-23 20:59:35
|
Revision: 1623
http://svn.sourceforge.net/frontierkernel/?rev=1623&view=rev
Author: creecode
Date: 2007-02-23 12:59:35 -0800 (Fri, 23 Feb 2007)
Log Message:
-----------
created md5 function, broke out from cryptfunctionvalue function case md5func
Modified Paths:
--------------
Frontier/branches/Frontier_Long_File_Paths/Common/headers/langcrypt.h
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/langcrypt.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/langcrypt.h 2007-02-23 20:57:58 UTC (rev 1622)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/langcrypt.h 2007-02-23 20:59:35 UTC (rev 1623)
@@ -25,9 +25,11 @@
******************************************************************************/
-/* prototypes */
+// prototypes
-boolean hmacmd5 (unsigned char *, int, unsigned char *, int, unsigned char *); /* 2006-03-05 creedon */
+boolean hmacmd5 (unsigned char *, int, unsigned char *, int, unsigned char *); // 2006-03-05 creedon
-boolean hmacsha1 (unsigned char *, int, unsigned char *, int, unsigned char *); /* 2006-03-12 creedon */
+boolean hmacsha1 (unsigned char *, int, unsigned char *, int, unsigned char *); // 2006-03-12 creedon
+boolean md5 ( Handle, boolean, Handle *, boolean * ); // 2006-12-02
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cre...@us...> - 2007-02-23 20:58:05
|
Revision: 1622
http://svn.sourceforge.net/frontierkernel/?rev=1622&view=rev
Author: creecode
Date: 2007-02-23 12:57:58 -0800 (Fri, 23 Feb 2007)
Log Message:
-----------
created md5 function, broke out from cryptfunctionvalue function case md5func
formatting tweaks
Modified Paths:
--------------
Frontier/branches/Frontier_Long_File_Paths/Common/source/langcrypt.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/langcrypt.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/langcrypt.c 2007-02-23 19:47:25 UTC (rev 1621)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/langcrypt.c 2007-02-23 20:57:58 UTC (rev 1622)
@@ -62,9 +62,11 @@
static boolean cryptfunctionvalue (short token, hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) {
- /*
- 2006-03-07 creedon: created, cribbed from htmlfunctionvalue
- */
+ //
+ // 2006-03-10 creedon: added md5func case, cribbed from stringverbs.c
+ //
+ // 2006-03-07 creedon: created, cribbed from htmlfunctionvalue
+ //
hdltreenode hp1 = hparam1;
tyvaluerecord *v = vreturned;
@@ -129,6 +131,7 @@
}
return (true);
+
} /* whirlpoolfunc */
case hmacmd5func: { /* 2006-03-05 creedon: keyed-hashing for message authentication using md5 */
@@ -167,8 +170,10 @@
Handle hresult;
for (ix = 0; ix < 16; ix++) {
+
setstringcharacter (bs, 2 * ix, enc [(int) ((digest [ix]) / 16)]);
setstringcharacter (bs, 2 * ix + 1, enc [(int) ((digest [ix]) % 16)]);
+
} /* for */
setstringlength (bs, 32);
@@ -180,76 +185,47 @@
}
else { /* return a binary of unknown type */
+
Handle hresult;
if (!newfilledhandle (digest, 16, &hresult))
return (false);
return (setbinaryvalue (hresult, typeunknown, v));
+
}
return (true);
+
} /* hmacmd5func */
- case md5func: { /* 2006-03-10 creedon: cribbed from stringverbs.c */
- Handle x;
- MD5_CTX hashcontext; /* MD5 context. */
- unsigned char checksum [16];
- short ctconsumed = 1;
- short ctpositional = 1;
+ case md5func: {
+
+ Handle h, x;
+ boolean flHex;
+ short ctconsumed = 1, ctpositional = 1;
tyvaluerecord vtranslate;
-
- if (!getreadonlytextvalue (hp1, 1, &x))
- return (false);
+
+ if ( ! getreadonlytextvalue ( hp1, 1, &x ) )
+ return ( false );
- setbooleanvalue (true, &vtranslate);
+ setbooleanvalue ( true, &vtranslate );
flnextparamislast = true;
- if (!getoptionalparamvalue (hp1, &ctconsumed, &ctpositional, BIGSTRING ("\x0b""flTranslate"), &vtranslate))
- return (false);
-
- lockhandle (x);
-
- MD5Init (&hashcontext);
+ if ( ! getoptionalparamvalue ( hp1, &ctconsumed, &ctpositional, BIGSTRING ( "\x0b""flTranslate" ), &vtranslate ) )
+ return ( false );
+
+ if ( ! md5 ( x, vtranslate.data.flvalue, &h, &flHex ) )
+ return ( false );
+
+ if ( flHex )
+ return ( setheapvalue ( h, stringvaluetype, v ) );
+ else
+ return ( setbinaryvalue ( h, typeunknown, v ) ); // return a binary of unknown type
+
+ } // md5func
- MD5Update (&hashcontext, (unsigned char *)(*x), gethandlesize (x));
-
- MD5Final (checksum, &hashcontext);
-
- unlockhandle (x);
-
- if (vtranslate.data.flvalue) { /* return a hex string */
- bigstring bs;
- unsigned char enc [] = "0123456789abcdef";
- long ix;
- Handle h;
-
- for(ix = 0; ix < 16; ix++) {
- setstringcharacter (bs, 2 * ix, enc [(int)((checksum [ix]) / 16)]);
- setstringcharacter (bs, 2 * ix + 1, enc [(int)((checksum [ix]) % 16)]);
- } /* for */
-
- setstringlength (bs, 32);
-
- if (!newtexthandle (bs, &h))
- return (false);
-
- return (setheapvalue (h, stringvaluetype, v));
- }
-
- else { /* return a binary of unknown type */
- Handle h;
-
- if (!newfilledhandle (checksum, 16, &h))
- return (false);
-
- return (setbinaryvalue (h, typeunknown, v));
- }
-
- return (true);
- } /* md5func */
-
case sha1func: { /* 2006-03-11 creedon: SHA1 hash */
Handle h;
SHA_CTX hashcontext; /* SHA context */
@@ -307,6 +283,7 @@
}
return (true);
+
} /* sha1func */
case hmacsha1func: { /* 2006-03-11 creedon: keyed-hashing for message authentication using sha1 */
@@ -367,14 +344,17 @@
}
return (true);
+
} /* hmacsha1func */
default:
getstringlist (langerrorlist, unimplementedverberror, bserror);
return (false);
- } /* switch */
- } /* cryptfunctionvalue */
+
+ } // switch
+
+ } // cryptfunctionvalue
boolean cryptinitverbs (void) {
@@ -525,3 +505,58 @@
return (true);
} /* hmacsha1 */
+
+boolean md5 ( Handle handleText, boolean flTranslate, Handle *handleHash, boolean *flHex ) {
+
+ //
+ // 2006-12-02 creedon: broke out from cryptfunctionvalue function case md5func
+ //
+
+ MD5_CTX hashcontext; // MD5 context
+ unsigned char checksum [ 16 ];
+
+ lockhandle ( handleText );
+
+ MD5Init ( &hashcontext );
+
+ MD5Update ( &hashcontext, ( unsigned char * ) ( *handleText ), gethandlesize ( handleText ) );
+
+ MD5Final ( checksum, &hashcontext );
+
+ unlockhandle ( handleText );
+
+ if ( flTranslate ) { // return a hex string
+
+ bigstring bs;
+ long ix;
+ unsigned char enc [ ] = "0123456789abcdef";
+
+ for ( ix = 0; ix < 16; ix++ ) {
+
+ setstringcharacter ( bs, 2 * ix, enc [ ( int ) ( ( checksum [ ix ] ) / 16 ) ] );
+
+ setstringcharacter ( bs, 2 * ix + 1, enc [ ( int ) ( ( checksum [ ix ] ) % 16 ) ] );
+
+ } // for
+
+ setstringlength ( bs, 32 );
+
+ if ( ! newtexthandle ( bs, handleHash ) )
+ return ( false );
+
+ *flHex = true;
+
+ }
+ else { // return a binary of unknown type
+
+ if ( ! newfilledhandle ( checksum, 16, handleHash ) )
+ return ( false );
+
+ *flHex = false;
+
+ }
+
+ return ( true );
+
+ } // md5
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cre...@us...> - 2007-02-23 19:47:29
|
Revision: 1621
http://svn.sourceforge.net/frontierkernel/?rev=1621&view=rev
Author: creecode
Date: 2007-02-23 11:47:25 -0800 (Fri, 23 Feb 2007)
Log Message:
-----------
formatting tweaks
Modified Paths:
--------------
Frontier/branches/Frontier_Long_File_Paths/Common/IOAToolkit/ioa.c
Frontier/branches/Frontier_Long_File_Paths/Common/IOAToolkit/ioa.h
Frontier/branches/Frontier_Long_File_Paths/Common/IowaRuntime/Source/iowacore.c
Frontier/branches/Frontier_Long_File_Paths/Common/IowaRuntime/Source/iowafrontier.c
Frontier/branches/Frontier_Long_File_Paths/Common/IowaRuntime/Source/iowainit.c
Frontier/branches/Frontier_Long_File_Paths/Common/IowaRuntime/Source/iowascript.c
Frontier/branches/Frontier_Long_File_Paths/Common/headers/FDllCall.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/frontierwindows.h
Frontier/branches/Frontier_Long_File_Paths/Common/source/filedialog.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/frontierconfig.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/frontierstart.c
Frontier/branches/Frontier_Long_File_Paths/build_Xcode/frontier.xcode.h
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/IOAToolkit/ioa.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/IOAToolkit/ioa.c 2007-02-23 19:27:43 UTC (rev 1620)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/IOAToolkit/ioa.c 2007-02-23 19:47:25 UTC (rev 1621)
@@ -1867,6 +1867,7 @@
IOAregister (12, 'scro', &scrollbarmain, &setupscrollbar);
return (true);
+
} /*IOAregistercomponents*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/IOAToolkit/ioa.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/IOAToolkit/ioa.h 2007-02-23 19:27:43 UTC (rev 1620)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/IOAToolkit/ioa.h 2007-02-23 19:47:25 UTC (rev 1621)
@@ -264,8 +264,6 @@
typedef boolean (*tyevalscriptcallback) (hdlobject, Handle, Handle *, OSType, bigstring);
-
-
typedef struct tycard {
short versionnumber; /*must be the first object in the struct, must be 2 bytes*/
@@ -429,6 +427,7 @@
hdlobject recalcobject; /*dmb 1.0b20 - the object that changed, triggering a card recalc*/
char waste [4]; /*room for growth*/
+
} tycard, **hdlcard;
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/IowaRuntime/Source/iowacore.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/IowaRuntime/Source/iowacore.c 2007-02-23 19:27:43 UTC (rev 1620)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/IowaRuntime/Source/iowacore.c 2007-02-23 19:47:25 UTC (rev 1621)
@@ -2649,6 +2649,7 @@
*h = nil;
return (true);
+
}
if (unpack.p >= unpack.lastp)
@@ -2660,6 +2661,7 @@
unpack.p += ctbytes;
return (true);
+
} /*unpackhandle*/
@@ -2713,6 +2715,7 @@
switch ((**h).objecttype) {
case clonetype: /*force a recalc of the object*/
+
disposehandle ((**h).objectdata);
(**h).objectdata = nil;
@@ -2720,10 +2723,13 @@
break;
default:
+
callunpackdata (h);
break;
+
} /*switch*/
+
} /*postunpackfilter*/
@@ -2792,7 +2798,8 @@
oldclutconverter (info.objectrecalcperiod, &info.objecttextcolor);
- oldclutconverter (info.unused1, &info.objectframecolor);
+ oldclutconverter (info.unused1, &info.objectframecolor);
+
}
clearbytes (&obj, longsizeof (obj));
@@ -2877,6 +2884,7 @@
return (false);
(**h).childobjectlist = firstchild;
+
}
*hobject = h;
@@ -2887,15 +2895,16 @@
error:
- disposehandle (obj.objectname);
-
- disposehandle (obj.objectvalue);
-
- disposehandle (obj.objectscript);
-
- disposehandle (obj.objectdata);
-
- return (false);
+ disposehandle (obj.objectname);
+
+ disposehandle (obj.objectvalue);
+
+ disposehandle (obj.objectscript);
+
+ disposehandle (obj.objectdata);
+
+ return (false);
+
} /*unpackobject*/
@@ -2922,9 +2931,11 @@
if (unpack.p >= unpack.lastp)
return (true);
+
} /*while*/
return (false);
+
} /*unpacklist*/
@@ -2977,6 +2988,7 @@
header.lenwindowtitle = 0;
unpack.p -= 66;
+
}
disktomemshort (header.v2backcolor);
@@ -3005,13 +3017,17 @@
if (header.versionnumber <= 2) /*back color was stored as an index, now stored as a RGBColor*/
oldclutconverter (header.v2backcolor, &header.backcolor);
+
+ switch (header.versionnumber) {
- switch (header.versionnumber) {
+ case 1:
- case 1:
break;
- case 2: case 3: case 4: {
+ case 2:
+ case 3:
+ case 4: {
+
Handle htable;
if (header.flselection) /*we're unpacking for a paste operation*/
@@ -3023,10 +3039,13 @@
(**iowadata).embeddedtable = htable;
break;
+
}
default:
+
goto error;
+
} /*switch*/
/*DW 12/12/93 -- unpack the card's window title*/ {
@@ -3039,6 +3058,7 @@
goto error;
(**iowadata).windowtitle = hwindowtitle;
+
}
}
@@ -3054,12 +3074,15 @@
if ((**hc).objectlist == nil)
(**hc).objectlist = newlist;
+
else {
+
hdlobject lastobject;
getlastinlist ((**hc).objectlist, &lastobject);
(**lastobject).nextobject = newlist;
+
}
laythread (); /*re-establish the flat thread thru all non-group objects*/
@@ -3095,6 +3118,7 @@
header.idwindow = 128;
(**hc).idwindow = header.idwindow;
+
}
checkobjectnames ();
@@ -3103,9 +3127,10 @@
error:
- unlockhandle (hpacked);
-
- return (false);
+ unlockhandle (hpacked);
+
+ return (false);
+
} /*iowaunpack*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/IowaRuntime/Source/iowafrontier.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/IowaRuntime/Source/iowafrontier.c 2007-02-23 19:27:43 UTC (rev 1620)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/IowaRuntime/Source/iowafrontier.c 2007-02-23 19:47:25 UTC (rev 1621)
@@ -204,10 +204,12 @@
componenterrormessage (ec, errormessage);
return (false);
+
}
}
flinitialized = true;
+
}
*scriptcomp = comp;
@@ -215,6 +217,7 @@
*scriptid = id;
return (true);
+
} /*getcompiledscript*/
@@ -248,11 +251,13 @@
ec = OSACoerceToDesc (scriptcomp, resultid, resulttype, kOSANullMode, &resultdesc);
OSADispose (scriptcomp, resultid);
+
}
/*DW 11/17/95 -- site of a former memory leak*/ {
AEDisposeDesc (message);
+
}
switch (ec) {
@@ -320,6 +325,7 @@
AEDisposeDesc (&selfAddress);
return (ec == noErr);
+
} /*newevent*/
@@ -330,7 +336,7 @@
boolean frontStartCard (AEDesc *filelist) {
-
+
/*
a card is starting up. we call the script at system.verbs.traps.IRUN.stcd
to create a table for it, unpack the packed table at that location, and
@@ -365,24 +371,27 @@
if ((**iowadata).tablestoredinfrontier)
return (true);
+
+ getappspec (&fsapp);
- getappspec (&fsapp);
-
/*pull the table name from the tablename handle*/ {
if ((**iowadata).tablename == nil) { /*let the script assign a name to the table*/
-
+
setstringlength (tablename, 0);
flcopyname = true;
+
}
else {
+
texthandletostring ((**iowadata).tablename, tablename);
flcopyname = false;
+
}
}
-
+
if (!newevent (startcardtoken, &event))
return (false);
@@ -390,29 +399,29 @@
if (!IACpushstringparam (tablename, 'prm1'))
goto error;
-
+
IACglobals.dontdisposenextparam = true; /*dmb 1.0b19*/
if (!IACpushbinaryparam ((**iowadata).embeddedtable, 'tabl', 'prm2'))
goto error;
-
+
if (!IACpushfilespecparam (&fsapp, 'prm3'))
goto error;
+
+ if (filelist == nil) {
- if (filelist == nil) {
-
AEDesc desc;
#if TARGET_API_MAC_CARBON == 1 /*PBS 03/14/02: AE OS X fix.*/
newdescnull (&desc, typeNull);
-
+
#else
desc.descriptorType = typeNull;
-
+
desc.dataHandle = nil;
-
+
#endif
if (AEPutParamDesc (IACglobals.event, 'prm4', &desc) != noErr)
@@ -421,7 +430,7 @@
else
if (AEPutParamDesc (IACglobals.event, 'prm4', filelist) != noErr)
goto error;
-
+
/*
if (!IACpushbooleanparam ((**iowadata).runmode, 'runm'))
goto error;
@@ -436,12 +445,13 @@
installRuntimeEventHandlers (); /*1.0b20 dmb: init script may call back to card*/
if (!callcompiledscript (&event, typeChar, errormessage, &htablename)) {
-
+
iowadata = savediowadata;
alertdialog (errormessage);
return (false);
+
}
iowadata = savediowadata;
@@ -453,17 +463,19 @@
lasttablewasmajor = true;
*/
+
}
-
+
(**iowadata).tablestoredinfrontier = true;
return (true);
error:
- AEDisposeDesc (&event);
-
- return (false);
+ AEDisposeDesc (&event);
+
+ return (false);
+
} /*frontStartCard*/
@@ -591,6 +603,7 @@
alertdialog (errormessage);
return (false);
+
}
disposehandle (hresult);
@@ -603,6 +616,7 @@
AEDisposeDesc (&event);
return (false);
+
} /*frontEditTable*/
@@ -1028,8 +1042,8 @@
disposehandle (hresult);
return (false);
+
} /*frontEditObject*/
#endif
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/IowaRuntime/Source/iowainit.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/IowaRuntime/Source/iowainit.c 2007-02-23 19:27:43 UTC (rev 1620)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/IowaRuntime/Source/iowainit.c 2007-02-23 19:47:25 UTC (rev 1621)
@@ -61,6 +61,7 @@
initlangcomponents ();
return (true);
+
} /*iowaInit*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/IowaRuntime/Source/iowascript.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/IowaRuntime/Source/iowascript.c 2007-02-23 19:27:43 UTC (rev 1620)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/IowaRuntime/Source/iowascript.c 2007-02-23 19:47:25 UTC (rev 1621)
@@ -439,32 +439,36 @@
disposehandle (hscript);
return (false);
+
}
-
+
copystring ("\p}", bswith);
pushtexthandle (bswith, hscript);
+
}
-
+
#ifdef isFrontier
- /*bypass the component manager; run script directly*/ {
-
- extern boolean langrunhandletraperror (Handle, bigstring, bigstring);
- bigstring bsresult;
+ /*bypass the component manager; run script directly*/ {
- if (!langrunhandletraperror (hscript, bsresult, errorstring))
- return (false); /***need to trap error info*/
-
- if (flgetreturn)
- return (newtexthandle (bsresult, hreturns));
-
- return (true);
- }
-
+ extern boolean langrunhandletraperror (Handle, bigstring, bigstring);
+ bigstring bsresult;
+
+ if (!langrunhandletraperror (hscript, bsresult, errorstring))
+ return (false); /***need to trap error info*/
+
+ if (flgetreturn)
+ return (newtexthandle (bsresult, hreturns));
+
+ return (true);
+
+ }
+
#endif
+
}
-
+
setstringlength (errorstring, 0);
#if TARGET_API_MAC_CARBON == 1 /*PBS 03/14/02: AE OS X fix.*/
@@ -482,7 +486,7 @@
scriptcomp = findlangcomponent (idlanguage);
if (scriptcomp == 0) { /*didn't find the component*/
-
+
bigstring bs;
AEDisposeDesc (&scriptdesc);
@@ -498,8 +502,9 @@
pushstring ("\p' scripting component.", errorstring);
return (false);
+
}
-
+
ec = OSADoScript (scriptcomp, &scriptdesc, kOSANullScript, typeChar, kOSAModeTransparentScope, &resultdesc);
if (ec != noErr)
@@ -525,44 +530,47 @@
error:
- AEDisposeDesc (&scriptdesc);
-
- if (ec == errOSAScriptError) { /*try to get an error message*/
+ AEDisposeDesc (&scriptdesc);
- AEDesc errordesc;
-
- ec = OSAScriptError (scriptcomp, kOSAErrorMessage, typeChar, &errordesc);
-
- if (ec == noErr) {
+ if (ec == errOSAScriptError) { /*try to get an error message*/
- #if TARGET_API_MAC_CARBON == 1 /*PBS 03/14/02: AE OS X fix.*/
+ AEDesc errordesc;
- datahandletostring (&errordesc, errorstring);
+ ec = OSAScriptError (scriptcomp, kOSAErrorMessage, typeChar, &errordesc);
- #else
+ if (ec == noErr) {
+
+ #if TARGET_API_MAC_CARBON == 1 /*PBS 03/14/02: AE OS X fix.*/
+
+ datahandletostring (&errordesc, errorstring);
+
+ #else
+
+ texthandletostring (errordesc.dataHandle, errorstring);
+
+ #endif
+
+ AEDisposeDesc (&errordesc);
+
+ }
+ else
+ copystring ("\pThe script generated an error, but no message was provided.", errorstring);
+ }
- texthandletostring (errordesc.dataHandle, errorstring);
+ if (ec == -128) /*1.0b15 DW -- user cancelled the script with cmd-period*/
+ return (false);
+
+ if (stringlength (errorstring) == 0) {
- #endif
+ copystring ("\pComponent Manager error. Its code number is ", errorstring);
- AEDisposeDesc (&errordesc);
+ pushlong (ec, errorstring);
+
+ pushstring ("\p.", errorstring);
+
}
- else
- copystring ("\pThe script generated an error, but no message was provided.", errorstring);
- }
-
- if (ec == -128) /*1.0b15 DW -- user cancelled the script with cmd-period*/
+
return (false);
-
- if (stringlength (errorstring) == 0) {
- copystring ("\pComponent Manager error. Its code number is ", errorstring);
-
- pushlong (ec, errorstring);
-
- pushstring ("\p.", errorstring);
- }
-
- return (false);
} /*runlangscript*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/FDllCall.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/FDllCall.h 2007-02-23 19:27:43 UTC (rev 1620)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/FDllCall.h 2007-02-23 19:47:25 UTC (rev 1621)
@@ -42,20 +42,24 @@
#endif
#ifdef WIN32
-#define Handle HANDLE
-typedef unsigned long FourCharCode;
-typedef FourCharCode OSType;
+ #define Handle HANDLE
-typedef struct tyPoint
- {
- short v;
- short h;
- } Point, *PointPtr;
+ typedef unsigned long FourCharCode;
-typedef RECT Rect;
+ typedef FourCharCode OSType;
-typedef HANDLE hdlfilenum;
+ typedef struct tyPoint {
+
+ short v;
+ short h;
+
+ } Point, *PointPtr;
+
+ typedef RECT Rect;
+
+ typedef HANDLE hdlfilenum;
+
#endif
#endif
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/frontierwindows.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/frontierwindows.h 2007-02-23 19:27:43 UTC (rev 1620)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/frontierwindows.h 2007-02-23 19:47:25 UTC (rev 1621)
@@ -28,13 +28,13 @@
#define windowsinclude
-/*prototypes*/
+// prototypes
extern WindowPtr getnewwindow (short, boolean, Rect *);
extern void disposewindow (WindowPtr);
-extern void windowsettitle (WindowPtr, bigstring);
+extern void windowsettitle ( WindowPtr, const Handle );
extern void windowgettitle (WindowPtr, bigstring);
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/filedialog.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/filedialog.c 2007-02-23 19:27:43 UTC (rev 1620)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/filedialog.c 2007-02-23 19:47:25 UTC (rev 1621)
@@ -1120,7 +1120,7 @@
anErr = NavDialogRun (dialogRef);
anErr = NavDialogGetReply (dialogRef, &reply);
-
+
if (anErr == noErr && reply.validRecord) {
AEKeyword theKeyword;
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/frontierconfig.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/frontierconfig.c 2007-02-23 19:27:43 UTC (rev 1620)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/frontierconfig.c 2007-02-23 19:47:25 UTC (rev 1621)
@@ -96,6 +96,7 @@
*/
register Handle h;
+
bigstring bs;
h = getresourcehandle (configresourcetype, configresnum);
@@ -158,14 +159,16 @@
reztomemrect ((*cr).defaultwindowrect);
- getstringlist (fontnamelistnumber, (*cr).defaultfont, bs);
+ getstringlist ( fontnamelistnumber, ( *cr ).defaultfont, bs );
- fontgetnumber (bs, &(*cr).defaultfont);
+ fontgetnumber ( bs, &(*cr).defaultfont );
centerrectondesktop (&(*cr).defaultwindowrect);
+
}
else
initconfigrecord (cr);
+
} /*loadconfigresource*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/frontierstart.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/frontierstart.c 2007-02-23 19:27:43 UTC (rev 1620)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/frontierstart.c 2007-02-23 19:47:25 UTC (rev 1621)
@@ -150,5 +150,3 @@
return (true);
} /*frontierstart*/
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/build_Xcode/frontier.xcode.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/build_Xcode/frontier.xcode.h 2007-02-23 19:27:43 UTC (rev 1620)
+++ Frontier/branches/Frontier_Long_File_Paths/build_Xcode/frontier.xcode.h 2007-02-23 19:47:25 UTC (rev 1621)
@@ -40,3 +40,4 @@
#define FRONTIER_FRAMEWORK_INCLUDES 1
#include "frontier.h"
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cre...@us...> - 2007-02-23 19:27:44
|
Revision: 1620
http://svn.sourceforge.net/frontierkernel/?rev=1620&view=rev
Author: creecode
Date: 2007-02-23 11:27:43 -0800 (Fri, 23 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/file.h
Frontier/branches/Frontier_Long_File_Paths/Common/source/file.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/fileops.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/filepath.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/fileverbs.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/findinfile.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/font.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/frontierwindows.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/file.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/file.h 2007-02-23 18:20:57 UTC (rev 1619)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/file.h 2007-02-23 19:27:43 UTC (rev 1620)
@@ -280,7 +280,7 @@
extern boolean flushvolumechanges (const ptrfilespec fsspec, hdlfilenum fnum);
-extern boolean getfullfilepath (bigstring);
+extern boolean getfullfilepath ( Handle );
extern boolean foldertest ( FSRefParamPtr );
@@ -424,24 +424,30 @@
#ifdef MACVERSION
+ extern OSErr FSRefGetName ( const FSRef *, CFStringRef * );
+
extern boolean CFStringRefToHFSUniStr255 ( CFStringRef, HFSUniStr255 * ); // 2006-06-07 creedon
+ extern boolean CFStringRefToCString ( CFStringRef, StringPtr ); // 2006-11-22 creedon
+
extern boolean CFStringRefToStr255 ( CFStringRef, StringPtr ); // 2006-06-07 creedon
extern boolean FSRefGetNameStr255 ( const FSRef *, Str255 ); // 2006-06-07 creedon
+ extern boolean HFSUniStr255ToCString ( ConstHFSUniStr255Param, StringPtr ); // 2006-11-22 creedon
+
extern boolean HFSUniStr255ToStr255 ( ConstHFSUniStr255Param, StringPtr ); // 2006-06-07 creedon
extern boolean bigstringToHFSUniStr255 ( const bigstring, HFSUniStr255 * ); // 2006-06-07 creedon
extern void filegetinfofrompb ( FSRefParam *, tyfileinfo * );
-
+
extern void filegetinfofrompbcipbr ( CInfoPBRec *, tyfileinfo * );
-
+
extern boolean getmacfileinfo ( const ptrfilespec, FSRefParamPtr, FSCatalogInfoPtr );
-
+
extern boolean getmacfileinfocipbr ( const FSSpecPtr, CInfoPBRec * );
-
+
/* 2006-08-11 creedon: cribbed from MoreFilesX.c and modded to work with Str255 */
OSErr
@@ -504,12 +510,16 @@
extern boolean extendfilespec ( const ptrfilespec, ptrfilespec ); // 2006-06-23 creedon
+extern boolean fileFromPathTextHandle ( Handle, Handle ); // 2006-11-25 creedon
+
extern boolean getfilespecparent ( ptrfilespec ); // 2006-06-17 creedon
-extern boolean setfilelabelindex (const ptrfilespec , short, boolean); // 2006-04-23 creedon */
+extern boolean popFromPathTextHandle ( Handle, Handle *, char ); // 2006-11-26 creedon
-extern short getfilelabelindex (const ptrfilespec , short *); // 2006-04-23 creedon */
+extern boolean setfilelabelindex (const ptrfilespec , short, boolean); // 2006-04-23 creedon
+extern short getfilelabelindex (const ptrfilespec , short *); // 2006-04-23 creedon
+
#ifdef MACVERSION
extern OSStatus GetApplicationIconRef ( const ProcessSerialNumber * , const FSSpec* , IconRef * ); // 2006-06-04 creedon
@@ -521,28 +531,28 @@
#pragma mark === filepath.c ===
- extern boolean directorytopath ( const ptrfilespec, bigstring);
+extern boolean directorytopath ( const ptrfilespec, Handle );
-extern boolean volumerefnumtopath (short, bigstring);
+extern boolean filegetdefaultpath ( ptrfilespec );
+extern boolean filegetpath ( const ptrfilespec, bigstring );
+
extern boolean filesetdefaultpath ( const ptrfilespec );
-extern boolean filegetdefaultpath (ptrfilespec );
+extern boolean filespectopath ( const ptrfilespec, Handle * );
-extern boolean filespectopath (const ptrfilespec , bigstring);
+extern boolean getfsfile ( const ptrfilespec, bigstring );
-extern boolean pathtofilespec ( bigstring, ptrfilespec );
+extern boolean getfsvolume ( const ptrfilespec, long * );
-extern boolean filegetpath (const ptrfilespec , bigstring);
+extern boolean pathtofilespec ( Handle, ptrfilespec );
-extern boolean setfsfile (ptrfilespec , bigstring);
+extern boolean setfsfile ( ptrfilespec, bigstring );
-extern boolean getfsfile (const ptrfilespec , bigstring);
+extern boolean volumerefnumtopath ( short, bigstring );
-extern boolean getfsvolume (const ptrfilespec, long *);
+extern void initfsdefault ( void ); // 2005-07-18 creedon
-extern void initfsdefault (void); /* 2005-07-18 creedon */
-
#pragma mark === fileverbs.c ===
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/file.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/file.c 2007-02-23 18:20:57 UTC (rev 1619)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/file.c 2007-02-23 19:27:43 UTC (rev 1620)
@@ -526,6 +526,8 @@
static boolean filecreateandopen ( ptrfilespec fs, OSType creator, OSType filetype, hdlfilenum *fnum) {
//
+ // 2007-02-23 creedon: added bad name error condition
+ //
// 2006-09-15 creedon: for Mac, FSRef-ized
//
@@ -536,10 +538,12 @@
setfserrorparam ( fs );
- CFStringRefToHFSUniStr255 ( ( *fs ).path, &name );
-
- err = FSCreateFileUnicode ( &( *fs ).fsref, name.length, name.unicode, kFSCatInfoNone, NULL, &( *fs ).fsref, NULL );
-
+ if ( CFStringRefToHFSUniStr255 ( ( *fs ).path, &name ) )
+ err = FSCreateFileUnicode ( &( *fs ).fsref, name.length, name.unicode, kFSCatInfoNone, NULL, &( *fs ).fsref,
+ NULL );
+ else
+ err = bdNamErr;
+
if ( oserror ( err ) )
return (false);
@@ -904,11 +908,13 @@
#ifdef MACVERSION
- static OSErr FSRefGetName ( const FSRef *fsRef, CFStringRef *name ) {
+ OSErr FSRefGetName ( const FSRef *fsRef, CFStringRef *name ) {
//
// the caller must dispose of the CFString
//
+ // 2007-02-23 creedon: made function externally available
+ //
// 2006-07-06 creedon: created
//
@@ -922,6 +928,22 @@
} // FSRefGetName
+ boolean CFStringRefToCString ( CFStringRef input, StringPtr output ) {
+
+ //
+ // 2006-11-22 creedon: created, cribbed from < http://developer.apple.com/carbon/tipsandtricks.html#CFStringFromUnicode >
+ //
+
+ // check output for NULL
+
+ if ( CFStringGetCString ( input, output, CFStringGetLength ( input ) + 1, kCFStringEncodingMacRoman ) )
+ return ( true );
+
+ return ( false );
+
+ } // CFStringRefToCString
+
+
boolean CFStringRefToStr255 ( CFStringRef input, StringPtr output ) {
//
@@ -943,6 +965,25 @@
} // CFStringRefToStr255
+ boolean HFSUniStr255ToCString ( ConstHFSUniStr255Param input, StringPtr output ) {
+
+ //
+ // 2006-11-22 creedon; created
+ //
+
+ CFStringRef csr;
+
+ csr = CFStringCreateWithCharacters ( kCFAllocatorDefault, input -> unicode, input -> length );
+
+ CFStringRefToCString ( csr, output );
+
+ CFRelease ( csr );
+
+ return ( true );
+
+ } // HFSUniStr255ToCString
+
+
boolean HFSUniStr255ToStr255 ( ConstHFSUniStr255Param input, StringPtr output ) {
//
@@ -1009,11 +1050,19 @@
boolean CFStringRefToHFSUniStr255 ( CFStringRef input, HFSUniStr255 *output ) {
//
+ // 2006-11-30 creedon: fix bug where if input was 255 characters, we were only getting back 127 in output,
+ // increased buffer to 511
+ //
// 2006-08-11 creedon: created, cribbed from < http://developer.apple.com/carbon/tipsandtricks.html#CFStringFromUnicode >
//
- ( *output ).length = CFStringGetBytes ( input, CFRangeMake ( 0, MIN ( CFStringGetLength ( input ), 255 ) ),
- kCFStringEncodingUnicode, 0, false, ( UInt8 * ) ( *output ).unicode, 255, NULL );
+ CFIndex length = CFStringGetLength ( input );
+
+ if ( length > 255 )
+ return ( false );
+
+ ( *output ).length = CFStringGetBytes ( input, CFRangeMake ( 0, MIN ( length, 255 ) ),
+ kCFStringEncodingUnicode, 0, false, ( UInt8 * ) ( *output ).unicode, 511, NULL );
if ( ( *output ).length == 0 )
return ( false );
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/fileops.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/fileops.c 2007-02-23 18:20:57 UTC (rev 1619)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/fileops.c 2007-02-23 19:27:43 UTC (rev 1620)
@@ -84,12 +84,6 @@
#endif
-#ifdef flsystem6
-
-static short applicationvolnum = 0;
-
-#endif
-
static short applicationresnum = -1;
#ifdef MACVERSION
@@ -179,16 +173,22 @@
#endif
return (false);
+
} /*endswithpathsep*/
boolean cleanendoffilename (bigstring bs) {
+
if (endswithpathsep(bs)) {
+
setstringlength (bs, stringlength(bs) - 1);
+
return (true);
+
}
return (false);
+
} /*cleanendoffilename*/
@@ -1898,25 +1898,6 @@
} /*filegetapplicationrnum*/
-#ifdef flsystem6
-
-short filegetapplicationvnum (void) {
-
- return (applicationvolnum);
- } /*filegetapplicationvnum*/
-
-
-short filegetsystemvnum (void) {
-
- SysEnvRec env;
-
- SysEnvirons (1, &env);
-
- return (env.sysVRefNum);
- } /*filegetsystemvnum*/
-
-#endif
-
#ifdef MACVERSION
static boolean pathtovolume (bigstring bspath, short *vnum) {
@@ -3418,6 +3399,8 @@
boolean newfile ( const ptrfilespec fs, OSType creator, OSType filetype ) {
//
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
// 2006-06-18 creedon: for Mac, FSRef-ized
//
@@ -3428,10 +3411,12 @@
setfserrorparam ( fs );
- CFStringRefToHFSUniStr255 ( ( *fs ).path, &name );
-
- err = FSCreateFileUnicode ( &( *fs ).fsref, name.length, name.unicode, kFSCatInfoNone, NULL, &( *fs ).fsref, NULL );
-
+ if ( CFStringRefToHFSUniStr255 ( ( *fs ).path, &name ) )
+ err = FSCreateFileUnicode ( &( *fs ).fsref, name.length, name.unicode, kFSCatInfoNone, NULL, &( *fs ).fsref,
+ NULL );
+ else
+ err = bdNamErr;
+
return ( ! oserror ( err ) );
#endif
@@ -3465,27 +3450,45 @@
#ifdef MACVERSION
- boolean getfullfilepath (bigstring bspath) {
+ boolean getfullfilepath ( Handle handlePath ) {
//
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
// 2006-06-25 creedon: FSRef-ized
//
+ Handle colon = NULL, forwardSlash = NULL;
+ boolean fl = false;
+ bigstring bs;
tyfilespec fs;
- setoserrorparam (bspath); /*in case error message takes a filename parameter*/
+ if ( ! newtexthandle ( BIGSTRING ( "\x01" ":" ), &colon ) )
+ return ( false );
- insertstring ( BIGSTRING ( "\x09" "/Volumes/" ), bspath );
+ if ( ! newtexthandle ( BIGSTRING ( "\x01" "/" ), &forwardSlash ) )
+ goto exit;
- stringreplaceall ( ':', '/', bspath );
+ texthandletostring ( handlePath, bs );
+
+ setoserrorparam ( bs ); // in case error message takes a filename parameter
+
+ inserttextinhandle ( handlePath, 0L, BIGSTRING ( "\x09" "/Volumes/" ) );
+
+ textfindreplace ( handlePath, colon, forwardSlash, true, false );
+
+ if ( oserror ( FSPathMakeRef ( *handlePath, &fs.fsref, NULL ) ) )
+ goto exit;
+
+ fl = filespectopath ( &fs, &handlePath );
+
+ exit:
+
+ disposehandle ( colon );
+ disposehandle ( forwardSlash );
- convertpstring ( bspath );
+ return ( fl );
- if ( oserror ( FSPathMakeRef ( bspath, &fs.fsref, NULL ) ) )
- return ( false );
-
- return ( filespectopath ( &fs, bspath ) );
-
} // getfullfilepath
@@ -3525,12 +3528,6 @@
#endif
- #ifdef flsystem6
-
- GetVol (nil, &applicationvolnum);
-
- #endif
-
#ifdef MACVERSION
#ifdef flcomponent
@@ -3630,6 +3627,8 @@
boolean extendfilespec ( const ptrfilespec fsin, ptrfilespec fsout ) {
//
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
// 2006-06-23 creedon: created
//
@@ -3648,9 +3647,10 @@
HFSUniStr255 name;
OSErr err;
- CFStringRefToHFSUniStr255 ( ( *fsin ).path, &name );
+ if ( ! CFStringRefToHFSUniStr255 ( ( *fsin ).path, &name ) )
+ return ( false );
- err = FSMakeFSRefUnicode ( &( *fsin ).fsref, name.length, name.unicode, kTextEncodingUnknown, &fst.fsref ); // kTextEncodingUnicodeDefault
+ err = FSMakeFSRefUnicode ( &( *fsin ).fsref, name.length, name.unicode, kTextEncodingUnknown, &fst.fsref );
if ( err != noErr )
return ( false );
@@ -3686,3 +3686,153 @@
} // getfilespecparent
+
+boolean fileFromPathTextHandle ( Handle path, Handle fileName ) {
+
+ //
+ // return all the characters to the right of the last path seperator in the path
+ //
+ // example: "Work Disk #1:MORE Work:Status Center" returns "Status Center"
+ //
+ // 2007-02-23 creedon: created, cribbed from filefrompath function
+ //
+
+ #ifdef MACVERSION
+
+ return ( textHandleLastWord ( path, chpathseparator, &fileName ) );
+
+ #endif
+
+ #ifdef WIN95VERSION
+
+ char fn[300];
+ char * fileptr;
+ tyfilespec fs;
+
+ copystring (path, fsname (&fs));
+
+ if (stringlength (path) >= 255) { /* RAB 4/27/98 fix for to long a filename conversion attempt*/
+
+ setemptystring (fname);
+
+ return (true);
+
+ }
+
+ if (isemptystring (path) || fileisvolume (&fs)) {
+
+ copystring (path, fname);
+
+ return (true);
+
+ }
+
+ nullterminate (path);
+
+ GetFullPathName (stringbaseaddress(path), 298, fn, &fileptr);
+
+ /*the comparison of fileptr within the legal range of fn is a kludge
+ but if fixes GetFullPathName which goes wild on some strings and
+ there is no other way of determining that it has gone wild.
+ RAB 4/27/98 */
+
+ if ((fileptr == NULL) || (fileptr < fn) || (fileptr > (fn + 298)))
+ setemptystring (fname);
+ else
+ copyctopstring (fileptr, fname);
+
+ // strcpy (stringbaseaddress(fname), fileptr);
+ // setstringlength (fname, strlen (fileptr));
+
+ return (true);
+
+ #endif
+
+ } // fileFromPathTextHandle
+
+
+boolean popFromPathTextHandle ( Handle path, Handle *fileName, char characterDelimiter ) {
+
+ //
+ // pop the characters to the right of the last path seperator in the path
+ //
+ // example: "Work Disk #1:MORE Work:Status Center" returns "Status Center"
+ //
+ // 2007-02-23 creedon: created, cribbed from filefrompath function
+ //
+
+ if ( characterDelimiter == NULL )
+ characterDelimiter = chpathseparator;
+
+ #ifdef MACVERSION
+
+ Handle h;
+ long ix, length = gethandlesize ( path );
+ register ptrbyte p = ( ptrbyte ) *path;
+
+ for ( ix = length - 1; ix > 0; --ix ) {
+
+ if ( p [ ix ] == characterDelimiter )
+ break;
+
+ } // for
+
+ length = length - ++ix;
+
+ newhandle ( length, &h );
+
+ popfromhandle ( path, length, *h );
+
+ *fileName = h;
+
+ return ( true );
+
+ #endif
+
+ #ifdef WIN95VERSION
+
+ char fn[300];
+ char * fileptr;
+ tyfilespec fs;
+
+ copystring (path, fsname (&fs));
+
+ if (stringlength (path) >= 255) { /* RAB 4/27/98 fix for to long a filename conversion attempt*/
+
+ setemptystring (fname);
+
+ return (true);
+
+ }
+
+ if (isemptystring (path) || fileisvolume (&fs)) {
+
+ copystring (path, fname);
+
+ return (true);
+
+ }
+
+ nullterminate (path);
+
+ GetFullPathName (stringbaseaddress(path), 298, fn, &fileptr);
+
+ /*the comparison of fileptr within the legal range of fn is a kludge
+ but if fixes GetFullPathName which goes wild on some strings and
+ there is no other way of determining that it has gone wild.
+ RAB 4/27/98 */
+
+ if ((fileptr == NULL) || (fileptr < fn) || (fileptr > (fn + 298)))
+ setemptystring (fname);
+ else
+ copyctopstring (fileptr, fname);
+
+ // strcpy (stringbaseaddress(fname), fileptr);
+ // setstringlength (fname, strlen (fileptr));
+
+ return (true);
+
+ #endif
+
+ } // popFromPathTextHandle
+
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/filepath.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/filepath.c 2007-02-23 18:20:57 UTC (rev 1619)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/filepath.c 2007-02-23 19:27:43 UTC (rev 1620)
@@ -52,9 +52,11 @@
static tyfilespec fsdefault; // we maintain our own default directory
- boolean directorytopath ( const ptrfilespec fs, bigstring path ) {
+ boolean directorytopath ( const ptrfilespec fs, Handle handlePath ) {
//
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
// 2006-09-09 creedon: FSRef-ized
// another way might be to use FSRefMakePath and then push insert the volume name on it
//
@@ -73,7 +75,7 @@
if ( err == noErr ) {
- setemptystring ( path );
+ handlePath = NULL;
return ( true );
@@ -81,17 +83,18 @@
} // bail
- CFMutableStringRef ioPath = CFStringCreateMutable ( NULL, 0 );
FSCatalogInfo catalogInfo;
FSRef localRef = ( *fs ).fsref;
HFSUniStr255 names [ 100 ];
+ Handle handleText;
int i, n;
- UniChar inSepChar = ':';
err = noErr;
-
+
+ newemptyhandle ( &handleText );
+
clearbytes ( &catalogInfo, longsizeof ( catalogInfo ) );
-
+
for ( n = 0 ; err == noErr && catalogInfo.nodeID != fsRtDirID && n < 100 ; n++ )
err = FSGetCatalogInfo ( &localRef, kFSCatInfoNodeID, &catalogInfo, &names [ n ], NULL, &localRef );
@@ -99,17 +102,24 @@
return ( false );
for ( i = n - 1; i >= 0; --i ) {
- CFStringAppendCharacters ( ioPath, names [ i ].unicode, names [ i ].length );
-
- // if ( i > 0 )
+
+ sethandlesize ( handleText, names [ i ].length );
+
+ HFSUniStr255ToCString ( &names [ i ], *handleText );
- CFStringAppendCharacters ( ioPath, &inSepChar, 1 );
+ pushhandle ( handleText, handlePath );
+
+ pushcharhandle ( ':', handlePath );
+
}
- return ( CFStringGetPascalString ( ioPath, path, 256, kCFStringEncodingMacRoman ) );
-
+ disposehandle ( handleText );
+
+ return ( true );
+
} // directorytopath
+
#endif
@@ -185,9 +195,11 @@
} // filesetdefaultpath
-boolean filespectopath (const ptrfilespec fs, bigstring bspath) {
-
+boolean filespectopath ( const ptrfilespec fs, Handle *handlePath ) {
+
//
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
// 2006-09-09 creedon: for Mac, FSRef-ized
//
// 2.1a7 dmb: if it's a null filespec, return the empty string
@@ -202,12 +214,12 @@
#ifdef MACVERSION
- bigstring bs;
- boolean flfolder;
FSCatalogInfo catalogInfo;
- tyfilespec fsp, fst = *fs;
HFSUniStr255 outName;
OSErr err;
+ boolean flfolder;
+ Handle hp;
+ tyfilespec fsp, fst = *fs;
( void ) extendfilespec ( &fst, &fst );
@@ -217,36 +229,49 @@
if ( err != noErr )
return ( false );
- setemptystring ( bspath );
+ if ( catalogInfo.parentDirID != fsRtParID ) { // it's not a volume so lets get the directory path
- if ( catalogInfo.parentDirID != fsRtParID ) // it's not a volume so lets get the directory path
- if ( ! directorytopath ( &fsp, bspath ) )
+ if ( ! directorytopath ( &fsp, *handlePath ) )
return ( false );
+ }
- HFSUniStr255ToStr255 ( &outName, bs );
+ newhandle ( outName.length + 1, &hp );
- pushstring ( bs, bspath );
+ HFSUniStr255ToCString ( &outName, *hp );
+ sethandlesize ( hp, outName.length );
+
+ pushhandle ( hp, *handlePath );
+
if ( fst.path != NULL ) {
+
+ CFIndex cfi = CFStringGetMaximumSizeForEncoding ( CFStringGetLength ( fst.path ),
+ kCFStringEncodingMacRoman );
- pushchar ( ':', bspath );
+ sethandlesize ( hp, cfi ); // resize hp
- CFStringRefToStr255 ( fst.path, bs );
+ pushcharhandle ( ':', *handlePath );
- pushstring ( bs, bspath );
-
+ CFStringGetBytes ( fst.path, CFRangeMake ( 0, cfi ), kCFStringEncodingMacRoman, '^', false, *hp, cfi, NULL );
+
+ pushhandle ( hp, *handlePath );
+
+ disposehandle ( hp );
+
return ( true );
}
if ( fileexists ( &fst, &flfolder ) )
if ( flfolder )
- assurelastchariscolon ( bspath );
+ textHandleAssureLastCharIsColon ( *handlePath );
+
+ disposehandle ( hp );
return ( true );
#endif
-
+
#ifdef WIN95VERSION
// 5.0d12 dmb: use GetFullPath to clean up 8.3 names
@@ -267,14 +292,16 @@
} // filespectopath
-boolean pathtofilespec ( bigstring bspath, ptrfilespec fs ) {
+boolean pathtofilespec ( Handle path, ptrfilespec fs ) {
//
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
// 2006-10-16 creedon: for Mac, FSRef-ized
//
// 5.0d8 dmb: clear fs first thing
//
- // 2.1b2 dmb: use new fsdefault for building filespec. note that if bspath isn't a partial path, the vref and dirid will be
+ // 2.1b2 dmb: use new fsdefault for building filespec. note that if path isn't a partial path, the vref and dirid will be
// ignored.
//
// 2.1b2 dmb: added special case for empty string. also, added drive number interpretation here.
@@ -287,59 +314,80 @@
// non-existant files, we don't give up right away.
//
- bigstring bsfolder;
+ Handle handleFolder = NULL;
+ boolean flReturn = false;
clearbytes ( fs, sizeof ( *fs ) );
- if ( isemptystring ( bspath ) )
+ if ( isemptyhandle ( path ) )
return ( true );
#ifdef MACVERSION
FSRef fsr;
HFSUniStr255 name;
+ Handle colon = NULL, h = NULL, pT = NULL, fS = NULL;
OSErr err;
OSStatus status;
- bigstring bs, bspathtmp;
- short ix = 1, ixslashpos = 0, slashpos [ 255 ];
+ long ix = 0, slashpos [ 255 ];
+ unsigned char ixSlashPos = 0;
- copystring ( bspath, bspathtmp );
+ if ( ! newemptyhandle ( &pT ) )
+ return ( false );
+
+ if ( ! newtexthandle ( BIGSTRING ( "\x01" ":" ), &colon ) )
+ return ( false );
- cleanendoffilename ( bspathtmp );
+ if ( ! newtexthandle ( BIGSTRING ( "\x01" "/" ), &fS ) )
+ return ( false );
+
+ copyhandle ( path, &pT );
- if ( scanstring ( ':', bspath, &ix ) && ( ix > 1 ) ) { // full path, includes a colon, not the first character
+ handlepoptrailingchars ( pT, chpathseparator ); // clean up end of path
- bigstring bsfile, bsfullpath;
-
- copystring ( bspathtmp, bsfullpath );
-
- insertstring ( BIGSTRING ( "\x09" ":Volumes:" ), bsfullpath );
-
- copystring ( bsfullpath, bs );
-
+ if ( ( ix = searchhandle ( path, colon, ix, gethandlesize ( path ) ) ) && ( ix > 0 ) ) { // full path, includes a colon, not
+ // the first character
+
+ Handle handleFullPath;
+
+ copyhandle ( pT, &handleFullPath );
+
+ inserttextinhandle ( handleFullPath, 0, BIGSTRING ( "\x09" ":Volumes:" ) );
+
+ copyhandle ( handleFullPath, &h );
+
/* convert to / delimited path */ {
- while ( scanstring ( '/', bs, &ix ) )
- slashpos [ ixslashpos++ ] = ix++;
+ ix = 0;
- stringreplaceall ( ':', '/', bs );
+ while ( ( ix = searchhandle ( h, fS, ix, gethandlesize ( h ) ) ) != -1 )
+ slashpos [ ixSlashPos++ ] = ix++;
+
+ stringfindreplace ( BIGSTRING ( "\x01" ":" ), BIGSTRING ( "\x01" "/" ), h, true, false );
- while ( ixslashpos > 0 )
- setstringcharacter ( bs, slashpos [ --ixslashpos ] - 1, ':' );
+ while ( ixSlashPos > 0 )
+ setHandleCharacter ( h, slashpos [ --ixSlashPos ], ':' );
}
+
+ /* convert h from Mac Roman to UTF-8 */ {
- /* convert from Mac Roman to UTF-8 */ {
-
- CFStringRef csr = CFStringCreateWithPascalString ( kCFAllocatorDefault, bs,
- kCFStringEncodingMacRoman );
-
- CFStringGetCString ( csr, ( char * ) bs, sizeof ( bs ), kCFStringEncodingUTF8 );
+ CFStringRef cfsr = CFStringCreateWithBytes ( kCFAllocatorDefault, *h, ( CFIndex ) gethandlesize ( h ),
+ kCFStringEncodingMacRoman, false );
- CFRelease ( csr );
-
+ CFIndex cfi = CFStringGetMaximumSizeForEncoding ( CFStringGetLength ( cfsr ),
+ kCFStringEncodingUTF8 );
+
+ sethandlesize ( h, ++cfi ); // resize h plus one for c string terminator
+
+ CFStringGetCString ( cfsr, *h, cfi, kCFStringEncodingUTF8 );
+
+ CFRelease ( cfsr );
+
}
+
+ status = FSPathMakeRef ( *h, &fsr, NULL );
- status = FSPathMakeRef ( bs, &fsr, NULL );
+ disposehandle ( h );
if ( status == noErr ) {
@@ -349,114 +397,149 @@
( *fs ).path = CFStringCreateWithCharacters ( kCFAllocatorDefault, name.unicode, name.length );
- return ( true );
+ flReturn = true;
+ goto exit;
+
} // if
- filefrompath ( bsfullpath, bsfile );
+ if ( ! newemptyhandle ( &handleFolder ) )
+ return ( false );
+
+ copyhandle ( handleFullPath, &handleFolder );
- folderfrompath ( bsfullpath, bsfolder );
+ Handle handleFile;
- /* convert to / delimited path */ {
+ popFromPathTextHandle ( handleFolder, &handleFile, NULL );
- ix = 1;
- ixslashpos = 0;
+ if ( gethandlesize ( handleFile ) > 255 ) // leaf can't be more than 255 characters
+ goto exit;
+
+ /* convert handleFolder to / delimited path */ {
+
+ ix = 0;
+ ixSlashPos = 0;
- while ( scanstring ( '/', bsfolder, &ix ) )
- slashpos [ ixslashpos++ ] = ix++;
+ while ( ( ix = searchhandle ( handleFolder, fS, ix, gethandlesize ( handleFolder ) ) ) != -1 )
+ slashpos [ ixSlashPos++ ] = ix++;
- stringreplaceall ( ':', '/', bsfolder );
+ stringfindreplace ( BIGSTRING ( "\x01" ":" ), BIGSTRING ( "\x01" "/" ), handleFolder, true, false );
- while ( ixslashpos > 0 )
- setstringcharacter ( bsfolder, slashpos [ --ixslashpos ] - 1, ':' );
+ while ( ixSlashPos > 0 )
+ setHandleCharacter ( handleFolder, slashpos [ --ixSlashPos ] - 1, ':' );
}
+
+ /* convert h from Mac Roman to UTF-8 */ {
- /* convert from Mac Roman to UTF-8 */ {
-
- CFStringRef csr = CFStringCreateWithPascalString ( kCFAllocatorDefault, bsfolder,
- kCFStringEncodingMacRoman );
-
- CFStringGetCString ( csr, ( char * ) bsfolder, sizeof ( bsfolder ), kCFStringEncodingUTF8 );
+ CFStringRef cfsr = CFStringCreateWithBytes ( kCFAllocatorDefault, *handleFolder,
+ ( CFIndex ) gethandlesize ( handleFolder ), kCFStringEncodingMacRoman, false );
- CFRelease ( csr );
-
+ CFIndex cfi = CFStringGetMaximumSizeForEncoding ( CFStringGetLength ( cfsr ),
+ kCFStringEncodingUTF8 );
+
+ sethandlesize ( handleFolder, ++cfi ); // resize handleFolder plus one for c string terminator
+
+ CFStringGetCString ( cfsr, *handleFolder, cfi, kCFStringEncodingUTF8 );
+
+ CFRelease ( cfsr );
+
}
-
- status = FSPathMakeRef ( bsfolder, &fsr, NULL );
+
+ status = FSPathMakeRef ( *handleFolder, &fsr, NULL );
if ( status == noErr ) {
( *fs ).fsref = fsr;
- ( *fs ).path = CFStringCreateWithPascalString ( kCFAllocatorDefault, bsfile,
- kCFStringEncodingMacRoman );
-
- return ( true );
+ ( *fs ).path = CFStringCreateWithBytes ( kCFAllocatorDefault, *handleFile,
+ ( CFIndex ) gethandlesize ( handleFile ), kCFStringEncodingMacRoman, false );
+
+ disposehandle ( handleFile );
+ handleFile = NULL;
+
+ disposehandle ( handleFolder );
+
+ handleFolder = NULL;
+
+ flReturn = true;
+
+ goto exit;
+
} // if
} // end full path
else { // partial path
- bigstring bspartialpath;
+ Handle partialPath;
tyfilespec fst;
- copystring ( bspathtmp, bspartialpath );
+ if ( ! newhandle ( MAXPATHLEN, &h ) )
+ return ( false );
+
+ copyhandle ( pT, &partialPath );
- if ( bspartialpath [ 1 ] != chpathseparator )
- insertchar ( chpathseparator, bspartialpath );
+ if ( *partialPath [ 0 ] != chpathseparator )
+ insertCharInTextHandle ( chpathseparator, 0, partialPath );
( void ) extendfilespec ( &fsdefault, &fst );
- status = FSRefMakePath ( &fst.fsref, ( UInt8 * ) bs, 256 ); // bs is now a c string
+ status = FSRefMakePath ( &fst.fsref, ( UInt8 * ) *h, MAXPATHLEN );
- convertcstring ( bs ); // bs is now a bigstring
+ sethandlesize ( h, strlen ( *h ) );
- /* convert bs to colon delimited path */ {
+ /* convert h to : delimited path */ {
- ix = 1;
- ixslashpos = 0;
+ ix = 0;
+ ixSlashPos = 0;
- while ( scanstring ( ':', bs, &ix ) )
- slashpos [ ixslashpos++ ] = ix++;
+ while ( ( ix = searchhandle ( h, colon, ix, gethandlesize ( h ) ) ) != -1 )
+ slashpos [ ixSlashPos++ ] = ix++;
+
+ stringfindreplace ( BIGSTRING ( "\x01" "/" ), BIGSTRING ( "\x01" ":" ), h, true, false );
- stringreplaceall ( '/', ':', bs );
+ while ( ixSlashPos > 0 )
+ setHandleCharacter ( h, slashpos [ --ixSlashPos ] - 1, '/' );
+ }
- while ( ixslashpos > 0 )
- setstringcharacter ( bs, slashpos [ --ixslashpos ] - 1, '/' );
- }
+ insertinhandle ( partialPath, 0, *h, gethandlesize ( h ) ); // we now have a full path
- insertstring ( bs, bspartialpath ); // we now have a full path
+ copyhandle ( partialPath, &h );
- copystring ( bspartialpath, bs );
+ /* convert h to / delimited path */ {
- /* convert bs to / delimited path */ {
-
- ix = 1;
- ixslashpos = 0;
+ ix = 0;
+ ixSlashPos = 0;
- while ( scanstring ( '/', bs, &ix ) )
- slashpos [ ixslashpos++ ] = ix++;
+ while ( ( ix = searchhandle ( h, fS, ix, gethandlesize ( h ) ) ) != -1 )
+ slashpos [ ixSlashPos++ ] = ix++;
+
+ stringfindreplace ( BIGSTRING ( "\x01" ":" ), BIGSTRING ( "\x01" "/" ), h, true, false );
- stringreplaceall ( ':', '/', bs );
+ while ( ixSlashPos > 0 )
+ setHandleCharacter ( h, slashpos [ --ixSlashPos ] - 1, ':' );
+ }
- while ( ixslashpos > 0 )
- setstringcharacter ( bs, slashpos [ --ixslashpos ] - 1, ':' );
- }
+ /* convert h from Mac Roman to UTF-8 */ {
- /* convert from Mac Roman to UTF-8 */ {
-
- CFStringRef csr = CFStringCreateWithPascalString ( kCFAllocatorDefault, bsfolder,
- kCFStringEncodingMacRoman );
-
- CFStringGetCString ( csr, ( char * ) bsfolder, sizeof ( bsfolder ), kCFStringEncodingUTF8 );
+ CFStringRef cfsr = CFStringCreateWithBytes ( kCFAllocatorDefault, *h, ( CFIndex ) gethandlesize ( h ),
+ kCFStringEncodingMacRoman, false );
+
+ CFIndex cfi = CFStringGetMaximumSizeForEncoding ( CFStringGetLength ( cfsr ),
+ kCFStringEncodingUTF8 );
+
+ sethandlesize ( h, ++cfi ); // resize h plus one for c string terminator
- CFRelease ( csr );
-
+ CFStringGetCString ( cfsr, *h, cfi, kCFStringEncodingUTF8 );
+
+ CFRelease ( cfsr );
+
}
+
+ status = FSPathMakeRef ( *h, &fsr, NULL );
- status = FSPathMakeRef ( bs, &fsr, NULL );
+ disposehandle ( h );
if ( status == noErr ) {
@@ -465,76 +548,111 @@
( *fs ).fsref = fsr;
( *fs ).path = CFStringCreateWithCharacters ( kCFAllocatorDefault, name.unicode, name.length );
-
- return ( true );
+ flReturn = true;
+
+ goto exit;
+
} // if
/* try parent of path */ {
- bigstring bsfile;
-
- filefrompath ( bspartialpath, bsfile );
+ Handle handleFile;
- folderfrompath ( bspartialpath, bsfolder );
+ copyhandle ( partialPath, &handleFolder );
- /* convert to slash delimited path */ {
-
- ix = 1;
- ixslashpos = 0;
+ popFromPathTextHandle ( handleFolder, &handleFile, NULL );
+
+ if ( gethandlesize ( handleFile ) > 255 ) // leaf can't be more than 255 characters
+ goto exit;
- while ( scanstring ( '/', bsfolder, &ix ) )
- slashpos [ ixslashpos++ ] = ix++;
+ /* convert handleFolder to / delimited path */ {
+
+ ix = 0;
+ ixSlashPos = 0;
- stringreplaceall ( ':', '/', bsfolder );
+ while ( ( ix = searchhandle ( handleFolder, fS, ix, gethandlesize ( handleFolder ) ) ) != -1 )
+ slashpos [ ixSlashPos++ ] = ix++;
+
+ stringfindreplace ( BIGSTRING ( "\x01" ":" ), BIGSTRING ( "\x01" "/" ), handleFolder, true, false );
- while ( ixslashpos > 0 )
- setstringcharacter ( bsfolder, slashpos [ --ixslashpos ] - 1, ':' );
+ while ( ixSlashPos > 0 )
+ setHandleCharacter ( handleFolder, slashpos [ --ixSlashPos ] - 1, ':' );
}
+
+ /* convert handleFolder from Mac Roman to UTF-8 */ {
- /* convert from Mac Roman to UTF-8 */ {
-
- CFStringRef csr = CFStringCreateWithPascalString ( kCFAllocatorDefault, bsfolder,
- kCFStringEncodingMacRoman );
-
- CFStringGetCString ( csr, ( char * ) bsfolder, sizeof ( bsfolder ), kCFStringEncodingUTF8 );
+ CFStringRef cfsr = CFStringCreateWithBytes ( kCFAllocatorDefault, *handleFolder,
+ ( CFIndex ) gethandlesize ( handleFolder ), kCFStringEncodingMacRoman, false );
- CFRelease ( csr );
-
+ CFIndex cfi = CFStringGetMaximumSizeForEncoding ( CFStringGetLength ( cfsr ),
+ kCFStringEncodingUTF8 );
+
+ sethandlesize ( handleFolder, ++cfi ); // resize handleFolder plus one for c string terminator
+
+ CFStringGetCString ( cfsr, *handleFolder, cfi, kCFStringEncodingUTF8 );
+
+ CFRelease ( cfsr );
+
}
+
+ status = FSPathMakeRef ( *handleFolder, &fsr, NULL );
- status = FSPathMakeRef ( bsfolder, &fsr, NULL );
-
if ( status == noErr ) {
( *fs ).fsref = fsr;
- ( *fs ).path = CFStringCreateWithPascalString ( kCFAllocatorDefault, bsfile,
- kCFStringEncodingMacRoman );
-
- return ( true );
+ ( *fs ).path = CFStringCreateWithBytes ( kCFAllocatorDefault, *handleFile,
+ ( CFIndex ) gethandlesize ( handleFile ), kCFStringEncodingMacRoman, false );
+ disposehandle ( handleFile );
+
+ handleFile = NULL;
+
+ disposehandle ( handleFolder );
+
+ handleFolder = NULL;
+
+ flReturn = true;
+
+ goto exit;
+
} // if
} // end try parent of path
} // end partial path
+
+ exit:
- return ( false );
-
+ if ( colon != NULL )
+ disposehandle ( colon );
+
+ if ( fS != NULL )
+ disposehandle ( fS );
+
+ if ( handleFolder != NULL )
+ disposehandle ( handleFolder );
+
+ if ( pT != NULL )
+ disposehandle ( pT );
+
+ return ( flReturn );
+
#endif
#ifdef WIN95VERSION
- copystring (bspath, fsname (fs));
+ copystring (path, fsname (fs));
- folderfrompath (bspath, bsfolder);
+ folderFromPath (path, handleFolder);
- if ((isemptystring (bsfolder)) && (! fileisvolume(fs))) {
+ if ((isemptystring (handleFolder)) && (! fileisvolume(fs))) {
filegetdefaultpath (fs);
- pushstring (bspath, fsname (fs));
+ pushstring (path, fsname (fs));
+
}
nullterminate (fsname (fs));
@@ -542,7 +660,7 @@
return (true);
#endif
-
+
} // pathtofilespec
@@ -590,7 +708,7 @@
} // setfsfile
-boolean getfsfile (const ptrfilespec fs, bigstring bsfile) {
+boolean getfsfile ( const ptrfilespec fs, bigstring bsfile ) {
//
// 2006-06-18 creedon: for Mac, FSRef-ized
@@ -603,10 +721,9 @@
if ( CFStringRefToStr255 ( ( *fs ).path, bsfile ) )
return ( true );
}
- else {
+ else
FSRefGetNameStr255 ( &( *fs ).fsref, bsfile );
- }
-
+
if (stringlength ( bsfile ) > 0)
return (true);
@@ -625,6 +742,7 @@
return (true);
#endif
+
} // getfsfile
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/fileverbs.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/fileverbs.c 2007-02-23 18:20:57 UTC (rev 1619)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/fileverbs.c 2007-02-23 19:27:43 UTC (rev 1620)
@@ -709,7 +709,7 @@
static boolean filedialogverb (tysfverb sfverb, hdltreenode hparam1, tyvaluerecord *vreturned) {
-
+
//
// put up one of the "standard file" dialogs. if sfverb is sfputfileverb we use the "put" dialog, otherwise the "get" dialog.
//
@@ -717,6 +717,8 @@
//
// if it's the getfile dialog, we take a second parameter -- it indicates the type of the file.
//
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
// 2006-08-16 creedon: FSRef-ized
//
// 2005-10-06 creedon: added creator parameter
@@ -725,17 +727,16 @@
// potentially set default directory.
//
- bigstring bsprompt;
- bigstring bsvarname;
+ Handle handleVariableName;
+ OSType oscreator = kNavGenericSignature, ostype;
+ bigstring bsext, bsprompt;
+ boolean fl;
+ hdlhashnode hnode;
+ hdlhashtable htable;
+ ptrsftypelist typelist = nil;
tyfilespec fs;
+ tysftypelist filetypes;
tyvaluerecord val;
- tysftypelist filetypes;
- ptrsftypelist typelist = nil;
- hdlhashtable htable;
- boolean fl;
- OSType ostype, oscreator = kNavGenericSignature;
- bigstring bsext;
- hdlhashnode hnode;
if (!getstringvalue (hparam1, 1, bsprompt))
return (false);
@@ -743,13 +744,12 @@
if (sfverb != sfgetfileverb)
flnextparamislast = true;
- if (!getvarparam (hparam1, 2, &htable, bsvarname)) // returned filename holder
- return (false);
+ if ( ! getvarparam ( hparam1, 2, &htable, &handleVariableName ) ) // returned filename holder
+ return ( false );
if (sfverb == sfgetfileverb) { // get extra parameters for get file dialog, indicating file type(s) and file creator
- short ctconsumed = 3;
- short ctpositional = 3;
+ short ctconsumed = 3, ctpositional = 3;
tyvaluerecord lval;
if (!gettypelistvalue (hparam1, 3, &filetypes, &typelist))
@@ -768,15 +768,15 @@
clearbytes (&fs, sizeof (fs));
- //
- // if (idstringvalue (htable, bsvarname, bsfname))
- // filecheckdefaultpath (bsfname);
- //
-
- if (hashtablelookup (htable, bsvarname, &val, &hnode)) {
+ if ( hashtablelookup ( htable, handleVariableName, &val, &hnode ) ) {
- if (!copyvaluerecord (val, &val))
+ if (!copyvaluerecord (val, &val)) {
+
+ disposehandle ( handleVariableName );
+
return (false);
+
+ }
disablelangerror ();
@@ -784,8 +784,9 @@
fs = **val.data.filespecvalue;
enablelangerror ();
+
}
-
+
if (sfverb == sfputfileverb) {
bigstring bs;
@@ -795,30 +796,34 @@
lastword ( bs, '.', bsext);
if ( ! ( ( stringlength ( bs ) == stringlength ( bsext ) ) || ( stringlength ( bsext ) > 4 ) ) ) { // extension
+
stringtoostype (bsext, &ostype);
filetypes.cttypes = 1;
filetypes.types [0] = ostype;
typelist = &filetypes;
+
}
}
-
+
setbooleanvalue (false, vreturned);
if (!sfdialog (sfverb, bsprompt, typelist, &fs, oscreator)) // user hit cancel
return (true);
-
+
if (!setfilespecvalue (&fs, &val))
return (false);
-
+
pushhashtable (htable);
- fl = langsetsymbolval (bsvarname, val);
+ fl = langsetsymbolval ( handleVariableName, val );
+ disposehandle ( handleVariableName );
+
pophashtable ();
if (!fl)
return (false);
-
+
exemptfromtmpstack (&val);
(*vreturned).data.flvalue = true; // the user did select a file
@@ -859,18 +864,19 @@
static boolean getresourceverb (hdltreenode hparam1, boolean flnamed, tyvaluerecord *v) {
- /*
- 2005-09-02 creedon: added support for fork parameter, see resources.c: openresourcefile and pushresourcefile
- */
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 2005-09-02 creedon: added support for fork parameter, see resources.c: openresourcefile and pushresourcefile
+ //
- tyfilespec fs;
+ Handle h, handleVariableName;
OSType type;
- short id, forktype;
- short ctconsumed = 4;
- short ctpositional = 4;
- Handle h;
+ bigstring bs;
+ boolean fl = false;
hdlhashtable htable;
- bigstring bs, bsvarname;
+ short ctconsumed = 4, ctpositional = 4, forktype, id;
+ tyfilespec fs;
tyvaluerecord val;
if (!getpathvalue (hparam1, 1, &fs))
@@ -882,7 +888,7 @@
if (!getstringorintvalue (hparam1, 3, flnamed, &id, bs))
return (false);
- if (!getvarparam (hparam1, 4, &htable, bsvarname)) /*returned handle holder*/
+ if ( ! getvarparam ( hparam1, 4, &htable, &handleVariableName ) ) // returned handle holder
return (false);
flnextparamislast = true;
@@ -890,7 +896,7 @@
setintvalue (resourcefork, &val); /* defaults to 1 */
if (!getoptionalparamvalue (hparam1, &ctconsumed, &ctpositional, BIGSTRING ("\x04""fork"), &val))
- return (false);
+ goto exit;
forktype = val.data.intvalue;
@@ -898,22 +904,27 @@
(*v).data.flvalue = false;
- return (true);
- }
-
- if (!insertinhandle (h, 0L, &type, sizeof (type))) { /*out of memory*/
+ fl = true;
- disposehandle (h);
+ goto exit;
- return (false);
}
- if (!langsetbinaryval (htable, bsvarname, h))
- return (false);
+ if (!insertinhandle (h, 0L, &type, sizeof (type))) /*out of memory*/
+ goto exit;
- (*v).data.flvalue = true;
+ if ( ! langsetbinaryval ( htable, handleVariableName, h ) )
+ goto exit;
- return (true);
+ fl = ( *v ).data.flvalue = true;
+
+ exit:
+
+ disposehandle ( h );
+ disposehandle ( handleVariableName );
+
+ return ( fl );
+
} /*getresourceverb*/
@@ -1001,19 +1012,19 @@
static boolean getnthrestypeverb (hdltreenode hparam1, tyvaluerecord *v) {
- /*
- 2005-09-02 creedon: added support for fork parameter, see resources.c: openresourcefile and pushresourcefile
- */
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 2005-09-02 creedon: added support for fork parameter, see resources.c: openresourcefile and pushresourcefile
+ //
- tyfilespec fs;
- short n, forktype;
- short ctconsumed = 3;
- short ctpositional = 3;
+ Handle handleVariableName;
OSType type;
+ boolean fl;
hdlhashtable htable;
- bigstring bsvarname;
+ short ctconsumed = 3, ctpositional = 3, forktype, n;
+ tyfilespec fs;
tyvaluerecord val;
- boolean fl;
if (!getpathvalue (hparam1, 1, &fs))
return (false);
@@ -1021,7 +1032,7 @@
if (!getintvalue (hparam1, 2, &n))
return (false);
- if (!getvarparam (hparam1, 3, &htable, bsvarname)) /*returned handle holder*/
+ if ( ! getvarparam ( hparam1, 3, &htable, &handleVariableName ) ) /*returned handle holder*/
return (false);
flnextparamislast = true;
@@ -1042,11 +1053,12 @@
setostypevalue (type, &val);
- fl = langsetsymboltableval (htable, bsvarname, val);
+ fl = langsetsymboltableval (htable, handleVariableName, val);
(*v).data.flvalue = fl;
return (fl);
+
} /*getnthrestypeverb*/
@@ -1089,19 +1101,19 @@
static boolean getnthresourceverb (hdltreenode hparam1, tyvaluerecord *v) {
- /*
- 2005-09-02 creedon: added support for fork parameter, see resources.c: openresourcefile and pushresourcefile
- */
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 2005-09-02 creedon: added support for fork parameter, see resources.c: openresourcefile and pushresourcefile
+ //
- tyfilespec fs;
+ Handle h, h2, h3, h4;
OSType type;
- short n, id, forktype;
- short ctconsumed = 5;
- short ctpositional = 5;
- Handle h;
+ bigstring bs;
+ boolean fl = false;
hdlhashtable ht1, ht2;
- bigstring bs, bs1, bs2;
- boolean fl;
+ short ctconsumed = 5, ctpositional = 5, forktype, id, n;
+ tyfilespec fs;
tyvaluerecord val;
if (!getpathvalue (hparam1, 1, &fs))
@@ -1113,76 +1125,92 @@
if (!getintvalue (hparam1, 3, &n))
return (false);
- if (!getvarparam (hparam1, 4, &ht1, bs1)) /*returned name holder*/
+ if ( ! getvarparam ( hparam1, 4, &ht1, &h2 ) ) // returned name holder
return (false);
- if (!getvarparam (hparam1, 5, &ht2, bs2)) /*returned handle holder*/
- return (false);
+ if ( ! getvarparam ( hparam1, 5, &ht2, &h3 ) ) // returned handle holder
+ goto exit;
flnextparamislast = true;
setintvalue (resourcefork, &val); /* defaults to 1 */
if (!getoptionalparamvalue (hparam1, &ctconsumed, &ctpositional, BIGSTRING ("\x04""fork"), &val))
- return (false);
+ goto exit;
forktype = val.data.intvalue;
- if (!getnthresourcehandle (&fs, type, n, &id, bs, &h, forktype)) {
+ if ( ! getnthresourcehandle (&fs, type, n, &id, bs, &h, forktype ) ) {
(*v).data.flvalue = false;
- return (true);
+ fl = true;
+
+ goto exit;
+
}
-
+
+ if ( ! newtexthandle ( bs, &h4 ) )
+ goto exit;
+
pushhashtable (ht1);
- fl = langsetstringval (bs1, bs);
+ fl = langsetstringval ( h2, h4 );
+ disposehandle ( h4 );
+
pophashtable ();
- if (!fl)
- return (false);
+ if ( ! fl ) {
- if (!insertinhandle (h, 0L, &type, sizeof (type))) {
+ fl = false;
- disposehandle (h);
+ goto exit;
- return (false);
}
- if (!langsetbinaryval (ht2, bs2, h))
- return (false);
+ fl = false;
- (*v).data.flvalue = true;
+ if (!insertinhandle (h, 0L, &type, sizeof (type)))
+ goto exit;
+
+ if ( ! langsetbinaryval ( ht2, h3, h ) )
+ goto exit;
- return (true);
+ fl = ( *v ).data.flvalue = true;
+
+ exit:
+ disposehandle ( h );
+ disposehandle ( h2 );
+ disposehandle ( h3 );
+ disposehandle ( h4 );
+
+ return ( fl );
+
} /*getnthresourceverb*/
static boolean getnthresinfoverb (hdltreenode hparam1, tyvaluerecord *v) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 2005-12-26 creedon: commented out param count check
+ //
+ // 2005-09-02 creedon: added support for fork parameter, see resources.c: openresourcefile and pushresourcefile
+ //
+ // 1992-06-02 dmb: created.
+ //
- /*
- 2005-12-26 creedon: commented out param count check
-
- 2005-09-02 creedon: added support for fork parameter, see resources.c: openresourcefile and pushresourcefile
-
- 6/2/92 dmb: created.
- */
-
- tyfilespec fs;
+ Handle h, h2;
OSType type;
- short n, id, forktype;
- short ctconsumed = 5;
- short ctpositional = 5;
+ bigstring bs;
+ boolean fl;
hdlhashtable ht1;
- bigstring bs, bs1;
- boolean fl;
+ short ctconsumed = 5, ctpositional = 5, id, forktype, n;
+ tyfilespec fs;
tyvaluerecord val;
- /* if (!langcheckparamcount (hparam1, 5))
- return (false); */
-
if (!getpathvalue (hparam1, 1, &fs))
return (false);
@@ -1209,21 +1237,27 @@
if (!langsetlongvarparam (hparam1, 4, id))
return (false);
- if (!getvarparam (hparam1, 5, &ht1, bs1)) /*returned name holder*/
+ if ( ! getvarparam ( hparam1, 5, &ht1, &h ) ) /*returned name holder*/
return (false);
pushhashtable (ht1);
- fl = langsetstringval (bs1, bs);
+ if ( ! newtexthandle ( bs, &h2 ) )
+ return ( false );
+
+ fl = langsetstringval ( h, h2 );
pophashtable ();
+ disposehandle ( h );
+
if (!fl)
return (false);
(*v).data.flvalue = true;
return (true);
+
} /*getnthresinfoverb*/
@@ -2999,6 +3033,8 @@
// if we return false, we try to provide a descriptive error message in the
// returned string bserror.
//
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
// 2006-10-23 creedon: for Mac, extend filespec for fs2 in case filemovefunc
//
// 2006-06-25 creedon: FSRef-ized
@@ -3905,7 +3941,7 @@
if (countwords (bsvol, chpathseparator) != 3) {
- langparamerror (badnetworkvolumespecificationerror, bsvol);
+ langParamErrBs ( badnetworkvolumespecificationerror, bsvol);
return (false);
}
@@ -3996,16 +4032,8 @@
if (!langcheckparamcount (hp1, 0)) /*no parameters expected*/
break;
-
- #ifdef flsystem6
-
- filegetpath (filegetsystemvnum (), bs);
- return (setstringvalue (bs, v));
-
- #else
-
- setemptystring (bsvol);
+ setemptystring (bsvol);
clearbytes ( &fs, sizeof ( fs ) );
@@ -4025,12 +4053,11 @@
break;
return (setfilespecvalue (&fs, v));
-
- #endif
-
+
}
case getspecialpathfunc: {
+
bigstring bsvol, bsfolder;
tyfilespec fs;
boolean flcreate;
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/findinfile.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/findinfile.c 2007-02-23 18:20:57 UTC (rev 1619)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/findinfile.c 2007-02-23 19:27:43 UTC (rev 1620)
@@ -137,16 +137,24 @@
static void fifopenfileerror (const ptrfilespec fs) {
+
+ //
+ // 2007-02-23 creedon: support for long odb item names and file paths
+ //
+ // 5.0.1 dmb: new, additional error reporting
+ //
- /*
- 5.0.1 dmb: new, additional error reporting
- */
+ Handle h;
+ bigstring bsfile;
- bigstring bsfile;
-
getfsfile (fs, bsfile);
-
- lang2paramerror (filenotopenederror, bsfunctionname, bsfile);
+
+ newtexthandle ( bsfile, &h );
+
+ lang2paramerror ( filenotopenederror, handleFunctionName, h );
+
+ disposehandle ( h );
+
} /*fifopenfileerror*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/font.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/font.c 2007-02-23 18:20:57 UTC (rev 1619)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/font.c 2007-02-23 19:27:43 UTC (rev 1620)
@@ -181,14 +181,15 @@
#endif
+
static boolean mapxfont (ptrstring bsfont) {
/*
2002-10-13 AR: Slight change to eliminate compiler warning about possible unwanted assignment
*/
- register pg_char_ptr table_ptr;
- short alternate_index, out_index;
+ register pg_char_ptr table_ptr;
+ short alternate_index, out_index;
if ((table_ptr = cross_font_table) == (pg_char_ptr)NULL)
return (false);
@@ -222,18 +223,21 @@
}
return (true);
+
} /*mapxfont*/
void fontgetnumber (bigstring fontname, short *fontnumber) {
+
+ //
+ // 2007-02-23 creedon: for Mac, use updated font calls
+ //
+ // 5.0.2b19 dmb: added cachedfont logic
+ //
+ // 5.0a13 dmb: operate on a copy; mapping modifies string (64 bytes!)
+ // map on Mac platform too
+ //
- /*
- 5.0a13 dmb: operate on a copy; mapping modifies string (64 bytes!)
- 5.0a13 dmb: map on Mac platform too
-
- 5.0.2b19 dmb: added cachedfont logic
- */
-
bigstring bsfont;
copystring (fontname, bsfont);
@@ -245,27 +249,32 @@
copystring (bsfont, cachedfontname);
-#ifdef MACVERSION
- GetFNum (bsfont, &cachedfontnum);
+ #ifdef MACVERSION
+
+ cachedfontnum = FMGetFontFamilyFromName ( bsfont ); // GetFNum (bsfont, &cachedfontnum);
+
+ if ( ( cachedfontnum == 0 ) && ! equalstrings ( bsfont, BIGSTRING ( "\x07" "Chicago" ) ) )
+ if ( mapxfont ( bsfont ) )
+ cachedfontnum = FMGetFontFamilyFromName ( bsfont ); // GetFNum (bsfont, &cachedfontnum);
+ #endif
+
+ #ifdef WIN95VERSION
+
+ if (findWindowsFont (bsfont, &cachedfontnum))
+ goto exit;
- if ((cachedfontnum == 0) && !equalstrings (bsfont, BIGSTRING ("\x07" "Chicago")))
if (mapxfont (bsfont))
- GetFNum (bsfont, &cachedfontnum);
-#endif
-#ifdef WIN95VERSION
- if (findWindowsFont (bsfont, &cachedfontnum))
- goto exit;
+ if (findWindowsFont (bsfont, &cachedfontnum))
+ goto exit;
- if (mapxfont (bsfont))
- if (findWindowsFont (bsfont, &cachedfontnum))
- goto exit;
-
- cachedfontnum = 0;
-#endif
-
+ cachedfontnum = 0;
+
+ #endif
+
exit:
- *fontnumber = cachedfontnum;
+ *fontnumber = cachedfontnum;
+
} /*fontgetnumber*/
@@ -285,83 +294,96 @@
void setfontsizestyle (short fontnum, short fontsize, short fontstyle) {
-#ifdef MACVERSION
- TextFont (fontnum);
+
+ #ifdef MACVERSION
- TextSize (fontsize);
+ TextFont (fontnum);
+
+ TextSize (fontsize);
+
+ TextFace (fontstyle);
+
+ #endif
- TextFace (fontstyle);
-#endif
-#ifdef WIN95VERSION
- if (fontnum > 0)
- currentFontNum = fontnum;
+ #ifdef WIN95VERSION
+
+ if (fontnum > 0)
+ currentFontNum = fontnum;
- if (fontsize != 0)
- currentFontSize = fontsize;
+ if (fontsize != 0)
+ currentFontSize = fontsize;
- currentFontStyle = fontstyle;
-#endif
+ currentFontStyle = fontstyle;
+
+ #endif
+
} /*setfontsizestyle*/
void setglobalfontsizestyle (short fontnum, short fontsize, short fontstyle) {
-#ifdef MACVERSION
- setfontsizestyle (fontnum, fontsize, fontstyle);
+
+ #ifdef MACVERSION
- GetFontInfo (&globalfontinfo);
-#endif
+ setfontsizestyle ( fontnum, fontsize, fontstyle );
+
+ GetFontInfo ( &globalfontinfo );
+
+ #endif
-#ifdef WIN95VERSION
- HFONT fnt, oldfnt;
- TEXTMETRIC tm;
- tywindowsfontinformation * wfi;
- short ctr;
- HDC hdc;
- long logpix;
+ #ifdef WIN95VERSION
+
+ HFONT fnt, oldfnt;
+ TEXTMETRIC tm;
+ tywindowsfontinformation * wfi;
+ short ctr;
+ HDC hdc;
+ long logpix;
- hdc = GetDC (GetDesktopWindow());
+ hdc = GetDC (GetDesktopWindow());
- if (fontnum > 0)
- currentFontNum = fontnum;
+ if (fontnum > 0)
+ currentFontNum = fontnum;
- if (fontsize != 0)
- currentFontSize = fontsize;
+ if (fontsize != 0)
+ currentFontSize = fontsize;
- currentFontStyle = fontstyle;
+ currentFontStyle = fontstyle;
- ctr = currentFontNum;
+ ctr = currentFontNum;
-// ctr = ctr + 1;
- wfi = *globalWindowsFontInfo + ctr;
+ // ctr = ctr + 1;
+ wfi = *globalWindowsFontInfo + ctr;
- wfi->lfi.lfHeight = -MulDiv(currentFontSize, GetDeviceCaps(getcurrentDC(), LOGPIXELSY), 72);
-
- wfi->lfi.lfWidth = 0;
-
- wfi->lfi.lfWeight = (currentFontStyle & bold)? FW_BOLD : FW_NORMAL;
-
- wfi->lfi.lfItalic = (currentFontStyle & italic)? true : false;
-
- wfi->lfi.lfUnderline = (currentFontStyle & underline)? true : false;
+ wfi->lfi.lfHeight = -MulDiv(currentFontSize, GetDeviceCaps(getcurrentDC(), LOGPIXELSY), 72);
+
+ wfi->lfi.lfWidth = 0;
+
+ wfi->lfi.lfWeight = (currentFontStyle & bold)? FW_BOLD : FW_NORMAL;
+
+ wfi->lfi.lfItalic = (currentFontStyle & italic)? true : false;
+
+ wfi->lfi.lfUnderline = (currentFontStyle & underline)? true : false;
- fnt = CreateFontIndirect (&(wfi->lfi));
+ fnt = CreateFontIndirect (&(wfi->lfi));
- oldfnt = SelectObject (hdc, fnt);
+ oldfnt = SelectObject (hdc, fnt);
- GetTextMetrics (hdc, &tm);
+ GetTextMetrics (hdc, &tm);
- logpix = GetDeviceCaps(getcurrentDC(), LOGPIXELSY);
+ logpix = GetDeviceCaps(getcurrentDC(), LOGPIXELSY);
- globalfontinfo.ascent = (short) tm.tmAscent;
- globalfontinfo.descent = (short) tm.tmDescent;
- globalfontinfo.leading = (short) tm.tmExternalLeading;
-// globalfontinfo.leading = (short)tm.tmInternalLeading;
+ globalfontinfo.ascent = (short) tm.tmAscent;
+ globalfontinfo.descent = (short) tm.tmDescent;
+ globalfontinfo.leading = (short) tm.tmExternalLeading;
+ // globalfontinfo.leading = (short)tm.tmInternalLeading;
- SelectObject (hdc, oldfnt);
- DeleteObject (fnt);
+ SelectObject (hdc, oldfnt);
+ DeleteObject (fnt);
- ReleaseDC (GetDesktopWindow(), hdc);
-#endif
+ ReleaseDC (GetDesktopWindow(), hdc);
+
+ #endif
+
} /*setglobalfontsizestyle*/
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/frontierwindows.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/frontierwindows.c 2007-02-23 18:20:57 UTC (rev 1619)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/frontierwindows.c 2007-02-23 19:27:43 UTC (rev 1620)
@@ -218,16 +218,22 @@
grabthreadglobals ();
#endif
+
} /*disposewindow*/
void windowgettitle (WindowPtr w, bigstring bs) {
#ifdef MACVERSION
+
+ // OSStatus CopyWindowTitleAsCFString ( WindowRef inWindow, CFStringRef * outString );
+
GetWTitle (w, bs);
+
#endif
-
+
#ifdef WIN95VERSION
+
releasethreadglobals ();
GetWindowText(w, bs, lenbigstring);
@@ -235,59 +241,59 @@
grabthreadglobals ();
convertcstring (bs);
+
#endif
+
} /*windowgettitle*/
-
+
#if !flruntime
-void windowsettitle (WindowPtr w, bigstring bs) {
+void windowsettitle ( WindowPtr w, const Handle h ) {
+
+ //
+ // 2007-02-23 creedon: for Mac, support for long odb item names and file
+ // paths
+ //
#ifdef MACVERSION
- bigstring bsorig;
+
+ CFStringRef csr = CFStringCreateWithBytes ( kCFAllocatorDefault, *h,
+ gethandlesize ( h ), kCFStringEncodingMacRoman, false );
+
+ SetWindowTitleWithCFString ( w, csr );
- GetWTitle (w, bsorig);
+ CFRelease ( csr );
- if (!equalstrings (bs, bsorig)) /*save a little flickering*/
- SetWTitle (w, bs);
#endif
-
+
#ifdef WIN95VERSION
- #ifdef PASCALSTRINGVERSION
- bs[stringlength(bs)+1] = 0;
- #endif
+
+ #ifdef PASCALSTRINGVERSION
+ bs[stringlength(bs)+1] = 0;
+
+ #endif
+
releasethreadglobals ();
-
- SetWindowText(w, stringbaseaddress(bs));
-
+
+ SetWindowText ( w, *h );
+
grabthreadglobals ();
+
#endif
+
} /*windowsettitle*/
void windowinval (WindowPtr w) {
+
+ Rect r;
- Rect r;
-
getlocalwindowrect (w, &r);
-
+
invalwindowrect (w, r);
-
- /*
- #ifdef MACVERSION
- invalwindowrect (w, (*w).portRect);
- #endif
- #ifdef WIN95VERSION
- releasethreadglobals ();
-
- ShowWindow (w, SW_SHOWNA);
-
- grabthreadglobals ();
-
- #endif
- */
} /*windowinval*/
@@ -314,6 +320,7 @@
popport ();
return (true);
+
} /*graywindow*/
#endif
@@ -405,6 +412,7 @@
sizewindow (w, r.right - r.left, r.bottom - r.top);
movewindow (w, r.left, r.top);
+
} /*moveandsizewindow*/
@@ -475,6 +483,7 @@
shellwindowmenudirty (); /*the checked item changes*/
return (true);
+
} /*windowbringtofront*/
@@ -501,6 +510,7 @@
shellwindowmenudirty (); /*the checked item changes*/
return (true);
+
} /*windowsendtoback*/
@@ -545,6 +555,7 @@
#endif
return (true);
+
} /*getlocalwindowrect*/
@@ -572,6 +583,7 @@
#endif
return (true);
+
} /*getglobalwindowrect*/
@@ -616,6 +628,7 @@
shellwindowmenudirty (); /*the checked item changes*/
return (true);
+
} /*windowsendbehind*/
@@ -633,6 +646,7 @@
#endif
return (*w != nil);
+
} /*findmousewindow*/
@@ -666,6 +680,7 @@
#endif
return (true);
+
} /*windowsetcolor**/
@@ -683,6 +698,7 @@
#ifdef WIN95VERSION
return (false);
#endif
+
} /*isdeskaccessorywindow*/
#endif
@@ -701,6 +717,7 @@
grabthreadglobals ();
#endif
+
} /*showwindow*/
@@ -751,6 +768,7 @@
grabthreadglobals ();
#endif
+
} /*hidewindow*/
boolean windowvisible (WindowPtr w) {
@@ -766,6 +784,7 @@
#ifdef WIN95VERSION
return (IsWindowVisible (w));
#endif
+
} /*windowvisible*/
@@ -798,6 +817,7 @@
GetUpdateRgn (w, (HRGN) rgn, false);
return (rgn);
#endif
+
} /*getupdateregion*/
@@ -837,6 +857,7 @@
// ReleaseDC(w, hdc);
return (rgn);
#endif
+
} /*getupdateregion*/
@@ -853,6 +874,7 @@
#ifdef WIN95VERSION
SetWindowLong (w, 0, (LONG) refcon);
#endif
+
} /*setwindowrefcon*/
@@ -869,7 +891,6 @@
#ifdef WIN95VERSION
return (GetWindowLong (w, 0));
#endif
+
} /*getwindowrefcon*/
-
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cre...@us...> - 2007-02-23 18:20:57
|
Revision: 1619
http://svn.sourceforge.net/frontierkernel/?rev=1619&view=rev
Author: creecode
Date: 2007-02-23 10:20:57 -0800 (Fri, 23 Feb 2007)
Log Message:
-----------
formatting tweaks
Modified Paths:
--------------
Frontier/branches/Frontier_Long_File_Paths/Common/source/cancoonpopup.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/claybrowserexpand.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/cancoonpopup.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/cancoonpopup.c 2007-02-23 18:20:35 UTC (rev 1618)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/cancoonpopup.c 2007-02-23 18:20:57 UTC (rev 1619)
@@ -147,6 +147,7 @@
copystring ((**hprocess).bsmsg, bs);
else {
+
scriptinstallagent (hnode);
copystring ((ptrstring) "\x01" " ", bs);
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/claybrowserexpand.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/claybrowserexpand.c 2007-02-23 18:20:35 UTC (rev 1618)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/claybrowserexpand.c 2007-02-23 18:20:57 UTC (rev 1619)
@@ -357,7 +357,7 @@
rollbeachball ();
/*insert the new line*/ {
-
+
hdlheadrecord hpre;
tydirection dir;
@@ -365,7 +365,7 @@
browserfindinsertionpoint ( ( *expandinfo ).hparent, handleItem, info, &hpre, &dir );
else
browsercalcinsertionpoint ( ( *expandinfo ).hparent, &hpre, &dir );
-
+
opstartinternalchange (); /*this operation is not undo-able, and mustn't trigger callbacks*/
opdepositnewheadline (hpre, dir, handleItem, &hnew);
@@ -373,14 +373,14 @@
opendinternalchange ();
}
-
+
browsercopyfileinfo (hnew, info);
if ((*expandinfo).flsettmpbits)
(**hnew).tmpbit = true; /*if expand is cancelled, we nuke all nodes with tmp bit set*/
+
+ if ((*info).flfolder) {
- if ((*info).flfolder) {
-
(**hnew).flnodeisfolder = true;
if ((*expandinfo).ctlevels > 1) {
@@ -445,6 +445,7 @@
expandcount = 0; /*for debugging*/
return (clayfolderloop (&fs, false, &browserexpandvisit, (long) &expandinfo));
+
} /*browserexpand*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|