|
From: Andre R. <and...@us...> - 2004-12-07 10:33:27
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27745/source Modified Files: Tag: New_Tables_Experiment-branch cancoon.c langcallbacks.c langexternal.c langhash.c langxml.c menuverbs.c opverbs.c pictverbs.c scripts.c tableexternal.c tableops.c tablestructure.c tablewindow.c wpverbs.c Log Message: Major change, conditionalized for fltablebackpointers pre-processor definition. External variables now strictly maintain a back pointer to their parent hashnode and parent hashtable. If either is zero, it's safe to assume that the external value is not directly part of the database hierarchy. This makes things like obtaining the full address of database objects, obtaining the direct parent of any object, or just building the popup menu of a window title much more efficient. Previously, we had to search the whole database hierarchy to accomplish these things. On the other hand, the new approach introduces some code that keeps the back pointers up-to-date at runtime. This has actually been attempted at least twice before but neither attempt was brought to completion. Index: wpverbs.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/wpverbs.c,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** wpverbs.c 30 Oct 2004 20:49:51 -0000 1.3 --- wpverbs.c 7 Dec 2004 10:33:14 -0000 1.3.2.1 *************** *** 148,153 **** ! ! #if langexternalfind_optimization typedef tyexternalvariable tywpvariable, *ptrwpvariable, **hdlwpvariable; --- 148,152 ---- ! #if fltablebackpointers typedef tyexternalvariable tywpvariable, *ptrwpvariable, **hdlwpvariable; Index: langexternal.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langexternal.c,v retrieving revision 1.3.2.4 retrieving revision 1.3.2.5 diff -C2 -d -r1.3.2.4 -r1.3.2.5 *** langexternal.c 3 Dec 2004 13:09:11 -0000 1.3.2.4 --- langexternal.c 7 Dec 2004 10:33:13 -0000 1.3.2.5 *************** *** 793,798 **** return (false); - assert (sizeof (tyexternalvariable) == 16L); - rollbeachball (); --- 793,796 ---- *************** *** 1213,1216 **** --- 1211,1216 ---- + #if !fltablebackpointers + typedef struct tyistableintableinfo { hdlhashtable hchild; *************** *** 1325,1329 **** return (true); /*keep looking*/ } /*fullpathsearchvisit*/ ! static boolean fullpathsearch (hdlhashtable intable, hdlhashtable fortable, bigstring forname, boolean flquote, boolean flincludeself, bigstring bspath, hdlwindowinfo *hroot) { --- 1325,1331 ---- return (true); /*keep looking*/ } /*fullpathsearchvisit*/ ! ! #endif ! static boolean fullpathsearch (hdlhashtable intable, hdlhashtable fortable, bigstring forname, boolean flquote, boolean flincludeself, bigstring bspath, hdlwindowinfo *hroot) { *************** *** 1338,1342 **** --- 1340,1450 ---- will do the right thing and fall back to hashtablevisit. part of the former loop body moved into fullpathsearchvisit. + + 2004-12-05 aradke: every external variable record has a handle to its parent hashnode + and parent hashtable. make use of it, no more searching! + still using recursion in first revision, might attempt to unroll recursion later. */ + + #if fltablebackpointers + + hdlexternalvariable hv; + hdlhashtable hparent; + bigstring bs; + + if (intable == nil) //defensive driving + return (false); + + if (intable == fortable) { /* we are at the correct table */ + + if (isemptystring (forname)) { /*asking for no specific name*/ + + setemptystring (bspath); + + return (true); + } + + if (hashtablesymbolexists (intable, forname)) { //Make sure the symbol exists + + copystring (forname, bspath); + + if (flquote) + langexternalbracketname (bspath); + + return (true); + } + + return (false); /*2004-12-05 aradke: should we set up an error message for this case?*/ + } + + hv = (hdlexternalvariable) (**fortable).hashtablerefcon; + + if (hv != nil) { + + hparent = (**hv).inhashtable; + + if (hparent != nil) { /*now lets follow the nodes up...*/ + + if (fullpathsearch (intable, hparent, "", flquote, flincludeself, bs, hroot)) { + + if ((intable != hparent) || flincludeself) { + + hdlhashnode hn = (**hv).inhashnode; + + gethashkey (hn, bspath); + + /*are inhashnode and inhashtable mutally consistent?*/ + assert (hashtablelookupnode (hparent, bspath, &hn) && (hn == (**hv).inhashnode)); + + if (flquote) + langexternalbracketname (bspath); + + if (stringlength (bs) > 0) { + + /*bspath = bs + "." + bspath*/ + + pushchar ('.', bs); + + pushstring (bspath, bs); + + copystring (bs, bspath); + } + } + else + setemptystring (bspath); + + if (!isemptystring (forname)) { /*asking for specific name*/ + + if (hashtablesymbolexists (fortable, forname)) { //Make sure the symbol exists + + copystring (forname, bs); + + if (flquote) + langexternalbracketname (bs); + + if (stringlength (bspath) > 0) + pushchar ('.', bspath); + + pushstring (bs, bspath); + } + + //return (false); + } + + if (hroot) { + + hdlwindowinfo hinfo; + + if (langexternalvariablewindowopen (hv, &hinfo) && (hinfo != nil)) + getrootwindow ((**hinfo).macwindow, hroot); + } + + return (true); /*unwind recursion*/ + } + } + } + + return (false); + + #else register hdlhashtable ht = intable; *************** *** 1510,1513 **** --- 1618,1623 ---- return (false); + + #endif } /*fullpathsearch*/ *************** *** 1677,1680 **** --- 1787,1844 ---- } /*fullpathstats*/ + + #if fltablebackpointers + + static boolean checkbackpointers (hdlhashtable ht, bigstring bspath, handlestream *s) { + + hdlhashnode x; + hdlexternalvariable hv; + bigstring bs; + long i; + + for (i = 0; i < gethashbucketcount (ht); i++) { + + x = nthhashbucket (ht, i); + + while (x != nil) { /*chain through the hash list*/ + + if ((**x).val.valuetype == externalvaluetype) { + + hv = (hdlexternalvariable) (**x).val.data.externalvalue; + + if (((**hv).inhashtable != ht) || ((**hv).inhashnode != x)) { + + copystring (bspath, bs); + + pushchar ('.', bs); + + pushstring ((**x).hashkey, bs); + + if (!writehandlestreamstringindent (s, bs, 0)) + return (false); /*out of memory*/ + } + + if ((**hv).id == idtableprocessor && (**hv).flinmemory) { + + copystring (bspath, bs); + + pushchar ('.', bs); + + pushstring ((**x).hashkey, bs); + + checkbackpointers ((hdlhashtable) (**hv).variabledata, bs, s); + } + } + + x = (**x).hashlink; + } /*while*/ + } /*for*/ + + return (true); + } /*checkbackpointersvisit*/ + + #endif + + #define STR_Comma_Space "\x02" ", " #define STR_Colon_Space "\x02" ": " *************** *** 1741,1744 **** --- 1905,1918 ---- }/*for*/ + #if fltablebackpointers + + if (!writehandlestreamstring (&s, "\x25" "\r\rIncorrect external back pointers:\r\r")) + goto error; + + if (!checkbackpointers (roottable, emptystring, &s)) + goto error; + + #endif + return (setheapvalue (closehandlestream (&s), stringvaluetype, v)); *************** *** 3097,3101 **** boolean langexternalsymbolchanged (hdlhashtable htable, const bigstring bsname, hdlhashnode hnode, boolean flvalue) { ! return langexternalsymbolinserted (htable, bsname, hnode); } /*langexternalsymbolchanged*/ --- 3271,3293 ---- boolean langexternalsymbolchanged (hdlhashtable htable, const bigstring bsname, hdlhashnode hnode, boolean flvalue) { ! #if fltablebackpointers ! ! if (flvalue && (hnode != nil) && (hnode != HNoNode)) { ! ! if ((**hnode).val.valuetype == externalvaluetype) { ! ! hdlexternalvariable hv = (hdlexternalvariable) (**hnode).val.data.externalvalue; ! ! assert (htable != nil); ! ! (**hv).inhashnode = hnode; ! ! (**hv).inhashtable = htable; ! } ! } ! ! #endif ! ! return (true); } /*langexternalsymbolchanged*/ *************** *** 3103,3118 **** boolean langexternalsymbolinserted (hdlhashtable htable, const bigstring bsname, hdlhashnode hnode) { ! #if langexternalfind_optimization ! if (hnode != nil && hnode != HNoNode && (**hnode).val.valuetype == externalvaluetype) { ! ! hdlexternalvariable hv = (hdlexternalvariable) (**hnode).val.data.externalvalue; ! ! (**hv).hexternaltable = htable; ! ! (**hv).hexternalnode = hnode; ! } ! #endif ! ! return true; } /*langexternalsymbolinserted*/ --- 3295,3299 ---- boolean langexternalsymbolinserted (hdlhashtable htable, const bigstring bsname, hdlhashnode hnode) { ! return (langexternalsymbolchanged (htable, bsname, hnode, true)); } /*langexternalsymbolinserted*/ Index: menuverbs.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/menuverbs.c,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** menuverbs.c 1 Nov 2004 11:50:16 -0000 1.3 --- menuverbs.c 7 Dec 2004 10:33:14 -0000 1.3.2.1 *************** *** 96,100 **** } tymenutoken; ! #if langexternalfind_optimization typedef tyexternalvariable tymenuvariable, *ptrmenuvariable, **hdlmenuvariable; --- 96,100 ---- } tymenutoken; ! #if fltablebackpointers typedef tyexternalvariable tymenuvariable, *ptrmenuvariable, **hdlmenuvariable; Index: tableops.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/tableops.c,v retrieving revision 1.3.2.4 retrieving revision 1.3.2.5 diff -C2 -d -r1.3.2.4 -r1.3.2.5 *** tableops.c 20 Nov 2004 23:03:19 -0000 1.3.2.4 --- tableops.c 7 Dec 2004 10:33:14 -0000 1.3.2.5 *************** *** 234,238 **** return (false); ! #if !flruntime (***hnamedtable).parenthashtable = htable; /*retain parental link*/ --- 234,238 ---- return (false); ! #if !flruntime && !fltablebackpointers (***hnamedtable).parenthashtable = htable; /*retain parental link*/ *************** *** 431,435 **** --- 431,507 ---- boolean findvariablesearch (hdlhashtable intable, hdlexternalvariable forvariable, boolean flonlyinmemory, hdlhashtable *foundintable, bigstring foundname, tyfindvariablecallback ancestorcallback) { + + /* + see comments at top of tablefindvariable below. if ancestorcallback is present, call it + first for the node containing forvariable and then once each for each containing table. + + 2004-12-05 aradke: every external variable record has a handle to its parent hashnode. + make use of it, no more searching! + + 2004-12-07 aradke: there where instances when forvariable was not really a hldexternalvariable, + e.g. when it was obtained by windowzoom via scriptverbgetvariable for a menubar script. + to make it easier to catch such cases in the future, we now assert that the id field of hv + is in the range of known external types. + */ + + #if fltablebackpointers + + hdlexternalvariable hv = forvariable; + hdlhashnode x; + hdlhashtable ht; + + /*first loop: pop out from forvariable to check whether we live below intable*/ + + while (hv != nil && (**hv).inhashtable != nil) { + + assert ((**hv).id < ctexternalprocessors); /*2004-12-07 aradke*/ + + ht = (**hv).inhashtable; + + if (ht == intable) { /*found it*/ + + /*set result values*/ + + x = (**forvariable).inhashnode; + + gethashkey (x, foundname); + + ht = (**forvariable).inhashtable; + + *foundintable = ht; + + /* + second loop: call ancestorcallback while popping out to intable. + this is only used for building the popup for window titles, so a + second loop is not a problem for overall performance. + */ + + if (ancestorcallback != nil) { + + while (true) { + + (*ancestorcallback) (ht, x); + + if (ht == intable) + break; /*done*/ + + hv = (hdlexternalvariable) (**ht).hashtablerefcon; + + x = (**hv).inhashnode; + + ht = (**hv).inhashtable; + } /*while*/ + } + + return (true); + } + + hv = (hdlexternalvariable) (**ht).hashtablerefcon; + } /*while*/ + + return (false); + #else + register hdlhashtable ht = intable; register hdlhashnode x; *************** *** 503,506 **** --- 575,580 ---- return (false); + + #endif } /*findvariablesearch*/ *************** *** 659,662 **** --- 733,738 ---- #if defined (isFrontier) && !defined (flruntime) + #if !fltablebackpointers + typedef struct findtableinfo { *************** *** 782,785 **** --- 858,863 ---- } /*parentsearch*/ + #endif + boolean findinparenttable (hdlhashtable htable, hdlhashtable *hparent, bigstring bs) { *************** *** 797,802 **** --- 875,915 ---- 5.0.2b13 dmb: if parenthashtable is nil, search for it and set it. parentOf func now calls us (we stole its code). + + 2004-12-05 aradke: every external variable record has a handle to its parent hashnode and hashtable. + make use of it, no more searching! */ + + #if fltablebackpointers + + hdlexternalvariable hv; + + hv = (hdlexternalvariable) (**htable).hashtablerefcon; + if ((hv != nil) && ((**hv).inhashtable != nil)) { + + assert ((**hv).inhashnode != nil); + + *hparent = (**hv).inhashtable; + + gethashkey ((**hv).inhashnode, bs); + + return (true); + } + else { + + *hparent = nil; + + if ((**htable).fllocaltable) + setemptystring (bs); + else + copystring (nameroottable, bs); + } + + assert ((*hparent != nil) || (htable == roottable) || (**htable).fllocaltable); + + return ((*hparent != nil) || (htable == roottable)); + + #else + hdlhashtable h, ht = (**htable).parenthashtable; tyfindtableinfo info; *************** *** 832,835 **** --- 945,951 ---- return (ht != nil) || (htable == roottable); + + #endif + } /*findinparenttable*/ Index: pictverbs.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/pictverbs.c,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** pictverbs.c 29 Oct 2004 21:14:52 -0000 1.3 --- pictverbs.c 7 Dec 2004 10:33:14 -0000 1.3.2.1 *************** *** 72,76 **** } typicttoken; ! #if langexternalfind_optimization typedef tyexternalvariable typictvariable, *ptrpictvariable, **hdlpictvariable; --- 72,76 ---- } typicttoken; ! #if fltablebackpointers typedef tyexternalvariable typictvariable, *ptrpictvariable, **hdlpictvariable; Index: langcallbacks.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langcallbacks.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** langcallbacks.c 23 Oct 2004 22:23:12 -0000 1.2 --- langcallbacks.c 7 Dec 2004 10:33:13 -0000 1.2.2.1 *************** *** 32,35 **** --- 32,36 ---- #include "shell.h" #include "memory.h" + #include "langexternal.h" /*2004-12-05 aradke*/ *************** *** 267,271 **** #endif ! (*langcallbacks.symbolchangedcallback) (htable, bs, hnode, flvalue); --- 268,274 ---- #endif ! ! langexternalsymbolchanged (htable, bs, hnode, true); ! (*langcallbacks.symbolchangedcallback) (htable, bs, hnode, flvalue); *************** *** 286,290 **** hashregisteraddressnode (htable, hnode); #endif ! (*langcallbacks.symbolinsertedcallback) (htable, bsname, hnode); --- 289,295 ---- hashregisteraddressnode (htable, hnode); #endif ! ! langexternalsymbolinserted (htable, bsname, hnode); ! (*langcallbacks.symbolinsertedcallback) (htable, bsname, hnode); Index: tableexternal.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/tableexternal.c,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -d -r1.3.2.1 -r1.3.2.2 *** tableexternal.c 15 Nov 2004 20:52:24 -0000 1.3.2.1 --- tableexternal.c 7 Dec 2004 10:33:14 -0000 1.3.2.2 *************** *** 283,287 **** (**htable).hashtablerefcon = (long) hv; /*we can get from hashtable to variable rec*/ ! (**htable).thistableshashnode = hnode; /*The var rec is contained in the hashnode... RAB 1/3/00 */ return (true); --- 283,289 ---- (**htable).hashtablerefcon = (long) hv; /*we can get from hashtable to variable rec*/ ! #ifndef fltablebackpointers ! (**htable).thistableshashnode = hnode; /*The var rec is contained in the hashnode... RAB 1/3/00 */ ! #endif return (true); *************** *** 439,444 **** register hdltableformats hf; Rect rwindow; ! hdlhashtable hparenttable; ! bigstring bsname; WindowPtr w; hdlwindowinfo hi; --- 441,448 ---- register hdltableformats hf; Rect rwindow; ! #if !fltablebackpointers ! hdlhashtable hparenttable; ! bigstring bsname; ! #endif WindowPtr w; hdlwindowinfo hi; *************** *** 449,455 **** --- 453,463 ---- ht = (hdlhashtable) (**hv).variabledata; + #if !fltablebackpointers + if (tablefindvariable ((hdlexternalvariable) hv, &hparenttable, bsname)) (**ht).parenthashtable = hparenttable; + #endif + if (tablewindowopen ((hdlexternalvariable) hv, &hi)) { /*bring to front, return true*/ *************** *** 628,632 **** ht = tablegetlinkedhashtable (); ! if ((**ht).parenthashtable == nil) { /*no parent, must be the root*/ if (!getrootwindow (tableformatswindow, &hrootinfo)) --- 636,645 ---- ht = tablegetlinkedhashtable (); ! #if fltablebackpointers ! if ((**ht).hashtablerefcon == nil || (**((hdlexternalvariable) (**ht).hashtablerefcon)).inhashtable == nil) ! #else ! if ((**ht).parenthashtable == nil) ! #endif ! { /*no parent, must be the root*/ if (!getrootwindow (tableformatswindow, &hrootinfo)) Index: scripts.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/scripts.c,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** scripts.c 31 Oct 2004 13:02:23 -0000 1.3 --- scripts.c 7 Dec 2004 10:33:14 -0000 1.3.2.1 *************** *** 512,516 **** --- 512,520 ---- langdisposetree (holdcode); + #if fltablebackpointers + if ((**hv).inhashtable == agentstable) /*special stuff for agents*/ + #else if (hashnodeintable (hnode, agentstable)) /*special stuff for agents*/ + #endif addnewprocess (hnewcode, false, &systemscripterrorroutine, (long) hnode); *************** *** 3881,3888 **** --- 3885,3900 ---- /* + 2004-12-07 aradke: don't know how to get hdlexternalvariable for + menubar scripts (does it even exist?) + */ + + /* if (!scriptindatabase ()) return (false); */ + if (scriptinmenubar ()) + return (false); + return (opverbgetvariable (hvariable)); } /*scriptgetvariable*/ Index: langxml.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langxml.c,v retrieving revision 1.3.2.3 retrieving revision 1.3.2.4 diff -C2 -d -r1.3.2.3 -r1.3.2.4 *** langxml.c 21 Nov 2004 20:15:26 -0000 1.3.2.3 --- langxml.c 7 Dec 2004 10:33:14 -0000 1.3.2.4 *************** *** 1973,1977 **** return (false); ! assert ((**nomadtable).parenthashtable == (*xmladr).ht); if (!newxmltoken (&token) || !newxmltoken (&lookaheadtoken) || !newxmltoken (&closetoken)) --- 1973,1981 ---- return (false); ! #if fltablebackpointers ! assert ((**((hdlexternalvariable) ((**nomadtable).hashtablerefcon))).inhashtable == (*xmladr).ht); ! #else ! assert ((**nomadtable).parenthashtable == (*xmladr).ht); ! #endif if (!newxmltoken (&token) || !newxmltoken (&lookaheadtoken) || !newxmltoken (&closetoken)) *************** *** 2100,2104 **** goto exit; ! assert ((**nomadtable).parenthashtable == nomad.ht); reuselookahead = true; --- 2104,2112 ---- goto exit; ! #if fltablebackpointers ! assert ((**((hdlexternalvariable) ((**nomadtable).hashtablerefcon))).inhashtable == nomad.ht); ! #else ! assert ((**nomadtable).parenthashtable == nomad.ht); ! #endif reuselookahead = true; Index: tablestructure.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/tablestructure.c,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -d -r1.3.2.1 -r1.3.2.2 *** tablestructure.c 21 Nov 2004 20:15:27 -0000 1.3.2.1 --- tablestructure.c 7 Dec 2004 10:33:14 -0000 1.3.2.2 *************** *** 345,349 **** } ! #if !flruntime (***hnewtable).parenthashtable = htable; /*retain parental link*/ --- 345,349 ---- } ! #if !flruntime && !fltablebackpointers (***hnewtable).parenthashtable = htable; /*retain parental link*/ Index: opverbs.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/opverbs.c,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** opverbs.c 4 Nov 2004 21:56:39 -0000 1.4 --- opverbs.c 7 Dec 2004 10:33:14 -0000 1.4.2.1 *************** *** 229,290 **** ! #if langexternalfind_optimization ! ! // 11/15/01 dmb: too messy trying to add linkedcode field to tyexternalvariable, so dup here ! typedef struct tyoutlinevariable { ! ! unsigned short id; /*tyexternalid*/ ! ! unsigned short flinmemory: 1; /*if true, variabledata is in a handle, else a dbaddress*/ ! ! unsigned short flmayaffectdisplay: 1; /*not in memory, but being displayed in a table window*/ ! ! unsigned short flpacked: 1; /* for wp doc; it isn't being edited, so we store it packed*/ ! ! unsigned short flscript: 1; /* for outlines and scripts; they're identical, except for this bit*/ ! ! unsigned short flsystemtable: 1; /*for tables: was it created by the system, or by a user script?*/ ! #ifdef xmlfeatures ! unsigned short flxml: 1; /*preserve for tables; is it an xml table?*/ ! #endif ! ! long variabledata; /*either a handle to data record or a dbaddress*/ ! ! hdldatabaserecord hdatabase; // 5.0a18 dmb ! dbaddress oldaddress; /*last place this variable was stored in db*/ ! hdlhashtable hexternaltable; ! hdlhashnode hexternalnode; ! Handle linkedcode; /*you can link code into any outline, mostly for scripts though*/ ! } tyoutlinevariable, *ptroutlinevariable, **hdloutlinevariable; ! ! #else ! typedef struct tyoutlinevariable { ! ! unsigned short id; /*tyexternalid: managed by langexternal.c*/ ! ! unsigned short flinmemory: 1; /*if true, variabledata is an hdloutlinerecord, else a dbaddress*/ ! ! unsigned short flmayaffectdisplay: 1; /*not in memory, but being displayed in a table window*/ ! ! unsigned short flscript: 1; /*outlines and scripts are identical, except for this bit*/ ! ! long variabledata; /*either a hdloutlinerecord or a dbaddress*/ ! ! hdldatabaserecord hdatabase; // 5.0a18 dmb ! ! dbaddress oldaddress; /*last place this outline was stored in db*/ ! ! Handle linkedcode; /*you can link code into any outline, mostly for scripts though*/ ! } tyoutlinevariable, *ptroutlinevariable, **hdloutlinevariable; ! ! #endif ! --- 229,268 ---- + typedef struct tyoutlinevariable { + + /* + 2004-12-05 aradke: identical to tyexternalvariable up to inhashnode (inclusive) + */ + + unsigned short id; /*tyexternalid*/ + + unsigned short flinmemory: 1; /*if true, variabledata is in a handle, else a dbaddress*/ + + unsigned short flmayaffectdisplay: 1; /*not in memory, but being displayed in a table window*/ + + unsigned short flpacked: 1; /* for wp doc; it isn't being edited, so we store it packed*/ ! unsigned short flscript: 1; /* for outlines and scripts; they're identical, except for this bit*/ ! unsigned short flsystemtable: 1; /*for tables: was it created by the system, or by a user script?*/ ! #ifdef xmlfeatures ! unsigned short flxml: 1; /*preserve for tables; is it an xml table?*/ ! #endif ! ! long variabledata; /*either a handle to data record or a dbaddress*/ ! ! hdldatabaserecord hdatabase; // 5.0a18 dmb ! dbaddress oldaddress; /*last place this variable was stored in db*/ ! #if fltablebackpointers ! hdlhashnode inhashnode; ! hdlhashtable inhashtable; ! #endif ! Handle linkedcode; /*you can link code into any outline, mostly for scripts though*/ ! } tyoutlinevariable, *ptroutlinevariable, **hdloutlinevariable; *************** *** 4225,4228 **** --- 4203,4213 ---- boolean opverbgetvariable (hdlexternalvariable *hvariable) { + /* + 2004-12-07 aradke: a disturbing discovery, this verb makes the assumption + that outlinerefcon always is a hdlexternalvariable, however this is not true. + for example, when windowzoom calls us for a menubar script, outlinerefcon + actually is the hdlmenurecord of the parent menubar object. + */ + if (outlinedata == nil) return (false); Index: cancoon.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/cancoon.c,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -C2 -d -r1.4.2.1 -r1.4.2.2 *** cancoon.c 4 Dec 2004 22:23:38 -0000 1.4.2.1 --- cancoon.c 7 Dec 2004 10:33:13 -0000 1.4.2.2 *************** *** 1740,1746 **** 2/28/91 dmb: also call ccchecktablestructureglobals to make sure our globals are up to date - - 11/14/01 dmb: also call new langexternalsymbolchanged. we should really create - a new callback so we don't have to call them explicitly here */ --- 1740,1743 ---- *************** *** 1749,1754 **** langipcsymbolchanged (htable, bsname, flvalue); - - langexternalsymbolchanged (htable, bsname, hnode, flvalue); return (tablesymbolchanged (htable, bsname, hnode, flvalue)); --- 1746,1749 ---- *************** *** 1762,1767 **** langipcsymbolinserted (htable, bsname); - - langexternalsymbolinserted (htable, bsname, hnode); return (tablesymbolinserted (htable, bsname)); --- 1757,1760 ---- Index: tablewindow.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/tablewindow.c,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** tablewindow.c 31 Oct 2004 20:41:10 -0000 1.3 --- tablewindow.c 7 Dec 2004 10:33:14 -0000 1.3.2.1 *************** *** 743,748 **** register ptrcallbacks cb; - assert (sizeof (tytablevariable) == 16L); - tableinitverbs (); --- 743,746 ---- Index: langhash.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langhash.c,v retrieving revision 1.4.2.20 retrieving revision 1.4.2.21 diff -C2 -d -r1.4.2.20 -r1.4.2.21 *** langhash.c 4 Dec 2004 22:23:39 -0000 1.4.2.20 --- langhash.c 7 Dec 2004 10:33:13 -0000 1.4.2.21 *************** *** 2264,2268 **** break; ! (**ht).parenthashtable = currenthashtable; (**ht).fllocaltable = fllocal; --- 2264,2270 ---- break; ! #if !fltablebackpointers ! (**ht).parenthashtable = currenthashtable; ! #endif (**ht).fllocaltable = fllocal; *************** *** 4210,4213 **** --- 4212,4221 ---- } + #if fltablebackpointers + + langexternalsymbolinserted (htable, bsname, hnewnode); /*set backpointers for externals*/ + + #endif + #ifdef fltablesortorderisarray |