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