|
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] |