You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(447) |
Nov
(163) |
Dec
(57) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(172) |
Feb
|
Mar
(123) |
Apr
(64) |
May
(1) |
Jun
(278) |
Jul
(89) |
Aug
(97) |
Sep
(62) |
Oct
(53) |
Nov
(119) |
Dec
(60) |
| 2006 |
Jan
(76) |
Feb
(1094) |
Mar
(363) |
Apr
(163) |
May
(57) |
Jun
(43) |
Jul
(39) |
Aug
(15) |
Sep
(33) |
Oct
(62) |
Nov
(8) |
Dec
|
| 2007 |
Jan
(9) |
Feb
(34) |
Mar
(2) |
Apr
(14) |
May
(8) |
Jun
(40) |
Jul
(21) |
Aug
(1) |
Sep
(20) |
Oct
(15) |
Nov
(26) |
Dec
|
| 2008 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
|
Nov
|
Dec
(1) |
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(32) |
Jun
|
Jul
|
Aug
(3) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
| 2010 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(7) |
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: David B. <dav...@us...> - 2004-12-19 21:46:44
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28287 Modified Files: Tag: sidewinder-branch langpython.c Log Message: added two-way type conversion for frontier records and lists. Records become Python Dictionaries, and vice versa. Lists become Python lists and vice versa. Index: langpython.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langpython.c,v retrieving revision 1.2.4.30 retrieving revision 1.2.4.31 diff -C2 -d -r1.2.4.30 -r1.2.4.31 *** langpython.c 18 Dec 2004 22:38:02 -0000 1.2.4.30 --- langpython.c 19 Dec 2004 21:46:34 -0000 1.2.4.31 *************** *** 39,43 **** #include "tablestructure.h" //#include "tableverbs.h" ! //#include "op.h" //#include "opinternal.h" #include "oplist.h" --- 39,43 ---- #include "tablestructure.h" //#include "tableverbs.h" ! #include "op.h" //#include "opinternal.h" #include "oplist.h" *************** *** 98,101 **** --- 98,103 ---- extern boolean langpushlistval (hdllistrecord hlist, ptrstring pkey, tyvaluerecord *val); + extern boolean langgetlistsize (const tyvaluerecord *, long *); + extern boolean langgetlistitem (const tyvaluerecord *, long, ptrstring, tyvaluerecord *); #if defined(WIN95VERSION) || (defined(MACVERSION) && TARGET_RT_MAC_MACHO) *************** *** 427,430 **** --- 429,433 ---- fl = fl && IMPORTSYMBOL (hm, PySeqIter_Type); + fl = fl && IMPORTSYMBOL (hm, PyList_Type); fl = fl && IMPORTSYMBOL (hm, PyList_Append); fl = fl && IMPORTSYMBOL (hm, PyList_GetItem); *************** *** 671,677 **** } else if (ob_type == &PyDict_Type) { ! //return convertPythonDict(obj, hdl, name); ! return false; } else if (ob_type == &PyComplex_Type) { --- 674,699 ---- } else if (ob_type == &PyDict_Type) { ! int pos = 0; ! PyObject *key; ! PyObject *value; + // get a new frontier list + setnilvalue(tvr); + if (!coercevalue(tvr, recordvaluetype)) + return false; + + // for each python element, convert and push a new value + while (PyDict_Next(obj, &pos, &key, &value)) { + char *name = PyString_AsString(PyObject_Str(key)); + bigstring bsname; + tyvaluerecord arg; + + copyctopstring(name, bsname); + if (!pythontofrontier(value, &arg)) + return false; + if (!langpushlistval((*tvr).data.listvalue, bsname, &arg)) + return false; + } + } else if (ob_type == &PyComplex_Type) { *************** *** 684,687 **** --- 706,727 ---- } else if (ob_type == &PyList_Type) { + int len, i; + + // get a new frontier list + setnilvalue(tvr); + if (!coercevalue(tvr, listvaluetype)) + return false; + + // for each python element, convert and push a new value + len = PyList_GET_SIZE(obj); + for (i = 0; i < len; i++) { + PyObject *o = PyList_GET_ITEM(obj, i); + tyvaluerecord arg; + if (!pythontofrontier(o, &arg)) + return false; + if (!langpushlistval((*tvr).data.listvalue, nil, &arg)) + return false; + } + //printf("list\n"); } else if (ob_type == &PyFile_Type) { *************** *** 739,744 **** } else if (ob_type == &PyDict_Type) { ! return convertPythonDict(obj, hdl, name); } else if (ob_type == &PyComplex_Type) { --- 779,804 ---- } else if (ob_type == &PyDict_Type) { ! int pos = 0; ! PyObject *key; ! PyObject *value; + // get a new frontier list + setnilvalue(&tvr); + if (!coercevalue(&tvr, recordvaluetype)) + return false; + + // for each python element, convert and push a new value + while (PyDict_Next(obj, &pos, &key, &value)) { + char *name = PyString_AsString(PyObject_Str(key)); + bigstring bsname; + tyvaluerecord arg; + + copyctopstring(name, bsname); + if (!pythontofrontier(value, &arg)) + return false; + if (!langpushlistval(tvr.data.listvalue, bsname, &arg)) + return false; + } + } else if (ob_type == &PyComplex_Type) { *************** *** 781,784 **** --- 841,862 ---- } else if (ob_type == &PyList_Type) { + int len, i; + + // get a new frontier list + setnilvalue(&tvr); + if (!coercevalue(&tvr, listvaluetype)) + return false; + + // for each python element, convert and push a new value + len = PyList_GET_SIZE(obj); + for (i = 0; i < len; i++) { + PyObject *o = PyList_GET_ITEM(obj, i); + tyvaluerecord arg; + if (!pythontofrontier(o, &arg)) + return false; + if (!langpushlistval(tvr.data.listvalue, nil, &arg)) + return false; + } + //printf("list\n"); } else if (ob_type == &PyFile_Type) { *************** *** 898,901 **** --- 976,1030 ---- break; + case listvaluetype: { + long len, i; + + if (!langgetlistsize(tvr, &len)) + return false; + + *pptr = PyList_New(len); + for (i = 1; i <= len; i++) { + tyvaluerecord item; + bigstring key; + PyObject *pobj; + + if (!langgetlistitem(tvr, i, (ptrstring)&key, &item)) + return false; + + if (!convertfrontiervalue(nil, zerostring, &item, &pobj)) + return false; + + PyList_SET_ITEM(*pptr, i - 1, pobj); + } + + break; + } + + case recordvaluetype: { + long len, i; + + if (!langgetlistsize(tvr, &len)) + return false; + + *pptr = PyDict_New(); + for (i = 1; i <= len; i++) { + tyvaluerecord item; + bigstring key; + char keyStr[sizeof(bigstring)]; + PyObject *pobj; + + if (!langgetlistitem(tvr, i, (ptrstring)&key, &item)) + return false; + + if (!convertfrontiervalue(nil, zerostring, &item, &pobj)) + return false; + + copyptocstring(key, keyStr); + + PyDict_SetItemString(*pptr, keyStr, pobj); + } + + break; + } + case externalvaluetype: { *************** *** 956,961 **** // //case binaryvaluetype: - //case listvaluetype: - //case recordvaluetype: // maybe support these --- 1085,1088 ---- |
|
From: David B. <dav...@us...> - 2004-12-18 22:38:15
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15932 Modified Files: Tag: sidewinder-branch langpython.c Log Message: changed name of UserTalk object type to UserTalkObject to avoid conflict with UserTalk module global Index: langpython.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langpython.c,v retrieving revision 1.2.4.29 retrieving revision 1.2.4.30 diff -C2 -d -r1.2.4.29 -r1.2.4.30 *** langpython.c 18 Dec 2004 22:31:20 -0000 1.2.4.29 --- langpython.c 18 Dec 2004 22:38:02 -0000 1.2.4.30 *************** *** 1635,1639 **** PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ ! "frontier.UserTalk", /*tp_name*/ sizeof(frontier_UserTalkObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ --- 1635,1639 ---- PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ ! "frontier.UserTalkObject", /*tp_name*/ sizeof(frontier_UserTalkObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ *************** *** 1704,1708 **** addType(m, &frontier_InternalValueType, "InternalValue") && addType(m, &frontier_ExternalValueType, "ExternalValue") && ! addType(m, &frontier_UserTalkType, "UserTalk"); if (!result) --- 1704,1708 ---- addType(m, &frontier_InternalValueType, "InternalValue") && addType(m, &frontier_ExternalValueType, "ExternalValue") && ! addType(m, &frontier_UserTalkType, "UserTalkObject"); if (!result) *************** *** 1805,1809 **** frontier_UserTalkObject *obj; ! class = PyObject_GetAttrString(frontierModule, "UserTalk"); obj = PyObject_New(frontier_UserTalkObject, (PyTypeObject *)class); --- 1805,1809 ---- frontier_UserTalkObject *obj; ! class = PyObject_GetAttrString(frontierModule, "UserTalkObject"); obj = PyObject_New(frontier_UserTalkObject, (PyTypeObject *)class); |
|
From: David B. <dav...@us...> - 2004-12-18 22:31:31
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14562 Modified Files: Tag: sidewinder-branch langpython.c Log Message: added top level UserTalk object (aliases: usertalk, ut) for access to scripts along system.path Index: langpython.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langpython.c,v retrieving revision 1.2.4.28 retrieving revision 1.2.4.29 diff -C2 -d -r1.2.4.28 -r1.2.4.29 *** langpython.c 5 Dec 2004 18:02:06 -0000 1.2.4.28 --- langpython.c 18 Dec 2004 22:31:20 -0000 1.2.4.29 *************** *** 575,578 **** --- 575,579 ---- static PyObject *newInternalValueObject(tyvaluetype vt); static PyObject *newExternalValueObject(tyexternalid ei); + static PyObject *newUserTalkObject(void); static time_t currentCookie = (time_t)0; *************** *** 1548,1560 **** // call the script - //releasepythonlock(); if (!langexternalgetquotedpath(self->parent, self->name, funcname)) { - //getpythonlock(); goto exitnone; } if (!langrunscript(funcname, ¶ms, nil, &retval)) { - //getpythonlock(); goto exitnone; } --- 1549,1558 ---- *************** *** 1600,1603 **** --- 1598,1677 ---- }; + typedef struct { + PyObject_HEAD + } frontier_UserTalkObject; + + static PyObject * + UserTalk_getattr(frontier_UserTalkObject *self, char *name) { + PyObject *result; + + getpythonlock(); + result = fetchAux(name); + releasepythonlock(); + + return result; + } + + static PyObject * + UserTalk_getItem(frontier_UserTalkObject *self, PyObject *key) { + char *keyName; + PyObject *result; + + getpythonlock(); + keyName = PyString_AsString(PyObject_Str(key)); + result = fetchAux(keyName); + releasepythonlock(); + + return result; + } + + PyMappingMethods utmapping = { + (inquiry)0, + (binaryfunc)UserTalk_getItem, + (objobjargproc)0 + }; + + static PyTypeObject frontier_UserTalkType = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "frontier.UserTalk", /*tp_name*/ + sizeof(frontier_UserTalkObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + 0, /*tp_dealloc*/ + 0, /*tp_print*/ + (getattrfunc)UserTalk_getattr, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + &utmapping, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + "Frontier UserTalk objects", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + }; + static boolean addType(PyObject *m, PyTypeObject *to, char *name) { *************** *** 1629,1633 **** addType(m, &frontier_ScriptType, "Script") && addType(m, &frontier_InternalValueType, "InternalValue") && ! addType(m, &frontier_ExternalValueType, "ExternalValue"); if (!result) --- 1703,1708 ---- addType(m, &frontier_ScriptType, "Script") && addType(m, &frontier_InternalValueType, "InternalValue") && ! addType(m, &frontier_ExternalValueType, "ExternalValue") && ! addType(m, &frontier_UserTalkType, "UserTalk"); if (!result) *************** *** 1640,1643 **** --- 1715,1723 ---- safeaddobject(m, "websites", fetchAux("websites")); safeaddobject(m, "workspace", fetchAux("workspace")); + + PyObject *ut = newUserTalkObject(); + safeaddobject(m, "ut", ut); + safeaddobject(m, "usertalk", ut); + safeaddobject(m, "UserTalk", ut); return true; *************** *** 1712,1716 **** PyObject *class; frontier_ExternalValue *obj; ! class = PyObject_GetAttrString(frontierModule, "ExternalValue"); obj = PyObject_New(frontier_ExternalValue, (PyTypeObject *)class); --- 1792,1796 ---- PyObject *class; frontier_ExternalValue *obj; ! class = PyObject_GetAttrString(frontierModule, "ExternalValue"); obj = PyObject_New(frontier_ExternalValue, (PyTypeObject *)class); *************** *** 1720,1723 **** --- 1800,1814 ---- } + static PyObject * + newUserTalkObject() { + PyObject *class; + frontier_UserTalkObject *obj; + + class = PyObject_GetAttrString(frontierModule, "UserTalk"); + obj = PyObject_New(frontier_UserTalkObject, (PyTypeObject *)class); + + return (PyObject *)obj; + } + /* the frontier kernel verb side */ |
|
From: Andre R. <and...@us...> - 2004-12-17 15:11:35
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26486/Common/source Modified Files: Tag: New_Tables_Experiment-branch langhash.c Log Message: In hashcomparekinds, reordered comparisons for performance. Index: langhash.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langhash.c,v retrieving revision 1.4.2.25 retrieving revision 1.4.2.26 diff -C2 -d -r1.4.2.25 -r1.4.2.26 *** langhash.c 17 Dec 2004 13:14:59 -0000 1.4.2.25 --- langhash.c 17 Dec 2004 15:11:23 -0000 1.4.2.26 *************** *** 1466,1469 **** --- 1466,1471 ---- 2004-12-04 aradke: moved from tablecompare.c, changed defintion to be compatible with qsort + + 2004-12-17 aradke: reordered comparisons for performance */ *************** *** 1479,1493 **** t2 = val2.valuetype; ! if ((t1 == externalvaluetype) && (t2 == externalvaluetype)) { ! ! register hdlexternalhandle h1 = (hdlexternalhandle) val1.data.externalvalue; ! register hdlexternalhandle h2 = (hdlexternalhandle) val2.data.externalvalue; ! register tyexternalid id1 = (tyexternalid) (**h1).id; ! register tyexternalid id2 = (tyexternalid) (**h2).id; ! ! if (id1 == id2) ! return (hashcomparenames (hnode1, hnode2)); ! return (langexternalcomparetypes (id1, id2)); } --- 1481,1498 ---- t2 = val2.valuetype; ! if (t1 == t2) { ! ! if (t1 == externalvaluetype) { /*implies t2 == externalvaluetype*/ ! register hdlexternalhandle h1 = (hdlexternalhandle) val1.data.externalvalue; ! register hdlexternalhandle h2 = (hdlexternalhandle) val2.data.externalvalue; ! register tyexternalid id1 = (tyexternalid) (**h1).id; ! register tyexternalid id2 = (tyexternalid) (**h2).id; ! ! if (id1 != id2) ! return (langexternalcomparetypes (id1, id2)); ! } ! ! return (hashcomparenames (hnode1, hnode2)); } *************** *** 1498,1504 **** return (-1); - if (t1 == t2) - return (hashcomparenames (hnode1, hnode2)); - return (sgn (t1 - t2)); } /*hashcomparekinds*/ --- 1503,1506 ---- |
|
From: Andre R. <and...@us...> - 2004-12-17 13:15:18
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32621/Common/source Modified Files: Tag: New_Tables_Experiment-branch langhash.c langops.c Log Message: First cut at hash-once optimizations: The new hash function is more costly in terms of CPU cycles than the old one. Luckily, we can compensate for this by reducing the number of times the hash value of the node key will be computed. For example, for a UserTalk identifier, the hash value only really needs to be computed once at compile time. Initially, we start this optimization in the low-level hash table functions in langhash.c and then let it percolate upwards. There is a compatibility layer for existing code implemented as pre-processor macros in lang.h. Index: langops.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langops.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 *** langops.c 21 Nov 2004 15:04:35 -0000 1.3.2.1 --- langops.c 17 Dec 2004 13:15:00 -0000 1.3.2.2 *************** *** 382,385 **** --- 382,386 ---- register boolean flspecialsymbol = false; register short n; + tyhashval hashval = hashfunction (bs); *htable = nil; *************** *** 406,410 **** if ((!(**h).fllocaltable) || flspecialsymbol || (refcon == 0) || (lexrefcon == refcon) || (lexrefcon == 0)) { ! if (hashtablelookupnode (h, bs, hnode)) { /*symbol is defined in htable*/ *htable = h; --- 407,411 ---- if ((!(**h).fllocaltable) || flspecialsymbol || (refcon == 0) || (lexrefcon == refcon) || (lexrefcon == 0)) { ! if (hashtablekeylookupnode (h, bs, hashval, hnode)) { /*symbol is defined in htable*/ *htable = h; *************** *** 437,441 **** } ! if (hashtablelookupnode (hwith, bs, hnode)) { /*found symbol*/ *htable = hwith; --- 438,442 ---- } ! if (hashtablekeylookupnode (hwith, bs, hashval, hnode)) { /*found symbol*/ *htable = hwith; Index: langhash.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langhash.c,v retrieving revision 1.4.2.24 retrieving revision 1.4.2.25 diff -C2 -d -r1.4.2.24 -r1.4.2.25 *** langhash.c 15 Dec 2004 21:36:21 -0000 1.4.2.24 --- langhash.c 17 Dec 2004 13:14:59 -0000 1.4.2.25 *************** *** 1282,1286 **** #if 0 ! unsigned long hashfunction (const bigstring bskey) { /* --- 1282,1286 ---- #if 0 ! tyhashval hashfunction (const bigstring bskey) { /* *************** *** 1333,1337 **** #define getuchar(d) ((unsigned long)(getlower (d))) ! unsigned long hashfunction (const bigstring bskey) { /* --- 1333,1337 ---- #define getuchar(d) ((unsigned long)(getlower (d))) ! tyhashval hashfunction (const bigstring bskey) { /* *************** *** 1405,1409 **** #if 0 ! long hashfunction (const bigstring bs) { /* --- 1405,1409 ---- #if 0 ! tyhashval hashfunction (const bigstring bs) { /* *************** *** 1470,1474 **** tyvaluerecord val1, val2; register tyvaluetype t1, t2; ! val1 = (***(hdlhashnode *)hnode1).val; --- 1470,1474 ---- tyvaluerecord val1, val2; register tyvaluetype t1, t2; ! val1 = (***(hdlhashnode *)hnode1).val; *************** *** 1523,1527 **** register boolean flequal = false; boolean flcomparable; ! flcomparable = (**h1).val.valuetype == (**h2).val.valuetype; --- 1523,1527 ---- register boolean flequal = false; boolean flcomparable; ! flcomparable = (**h1).val.valuetype == (**h2).val.valuetype; *************** *** 1811,1818 **** /* a sure-fire hash-algorithm-independent way to unlink a node. */ ! register long i; ! register hdlhashnode nomad, prev; for (i = 0; i < gethashbucketcount (htable); i++) { --- 1811,1831 ---- /* a sure-fire hash-algorithm-independent way to unlink a node. + + 2004-12-17 aradke: can't hurt to check the bucket first that *should* contain hnode */ ! register long i = hashtobucketindex (htable, (**hnode).hashval); ! register hdlhashnode nomad = nthhashbucket (htable, i); ! register hdlhashnode prev = nil; ! ! while (nomad != nil) { /*2004-12-17 aradke*/ ! ! if (nomad == hnode) /*found it*/ ! goto afterloop; ! ! prev = nomad; ! ! nomad = (**nomad).hashlink; ! } /*while*/ for (i = 0; i < gethashbucketcount (htable); i++) { *************** *** 1835,1839 **** return (false); /*not found*/ ! afterloop: if (prev == nil) --- 1848,1852 ---- return (false); /*not found*/ ! afterloop: if (prev == nil) *************** *** 2052,2056 **** */ ! boolean hashlocate (const bigstring bs, hdlhashnode *hnode, hdlhashnode *hprev) { /* --- 2065,2069 ---- */ ! boolean hashkeylocate (const bigstring bs, tyhashval hashval, hdlhashnode *hnode, hdlhashnode *hprev) { /* *************** *** 2058,2064 **** begins with a $, we return the node and prev for the nth guy in the sorted list of the table. */ - register long ixbucket; register hdlhashnode nomad, nomadprev; --- 2071,2083 ---- begins with a $, we return the node and prev for the nth guy in the sorted list of the table. + + 2004-11-24 aradke: depend on caller to provide hashval instead of calling + hashfunction ourselves. this will allow us to calculate the hash just + once if we need to look up the same key in several tables (i.e. search + path lookups during language execution) or if we need to check whether + a key already exists before inserting. later, we may want to put bs + and hashval into a new struct type, possibly to be called tyhashkey. */ register hdlhashnode nomad, nomadprev; *************** *** 2072,2082 **** */ ! ixbucket = hashtobucketindex (currenthashtable, hashfunction (bs)); ! ! //assert (currenthashtable != nil); ! ! //assert (validhandle ((Handle) currenthashtable)); ! nomad = nthhashbucket (currenthashtable, ixbucket); nomadprev = nil; --- 2091,2097 ---- */ ! assert (hashfunction (bs) == hashval); ! nomad = gethashbucket (currenthashtable, hashval); nomadprev = nil; *************** *** 2084,2088 **** while (nomad != nil) { ! if (equalidentifiers (bs, (**nomad).hashkey)) { *hnode = nomad; --- 2099,2103 ---- while (nomad != nil) { ! if (/*(hashval == (**nomad).hashval) && */ equalidentifiers (bs, (**nomad).hashkey)) { *hnode = nomad; *************** *** 2099,2106 **** return (false); /*loop terminated, not found*/ ! } /*hashlocate*/ ! static boolean hashdeletenode (const bigstring bs, hdlhashnode *hnode) { /* --- 2114,2121 ---- return (false); /*loop terminated, not found*/ ! } /*hashkeylocate*/ ! static boolean hashkeydeletenode (const bigstring bs, tyhashval hashval, hdlhashnode *hnode) { /* *************** *** 2115,2119 **** register hdlhashnode hn; ! if (!hashlocate (bs, hnode, &hprev)) { langparamerror (cantdeleteerror, bs); --- 2130,2134 ---- register hdlhashnode hn; ! if (!hashkeylocate (bs, hashval, hnode, &hprev)) { langparamerror (cantdeleteerror, bs); *************** *** 2126,2135 **** langsymbolunlinking (currenthashtable, hn); ! if (hprev == nil) { ! ! assert ((**hn).hashval == hashfunction (bs)); ! ! nthhashbucket (currenthashtable, hashtobucketindex (currenthashtable, (**hn).hashval)) = (**hn).hashlink; ! } else (**hprev).hashlink = (**hn).hashlink; --- 2141,2146 ---- langsymbolunlinking (currenthashtable, hn); ! if (hprev == nil) ! sethashbucket (currenthashtable, hashval, (**hn).hashlink); else (**hprev).hashlink = (**hn).hashlink; *************** *** 2140,2147 **** return (true); ! } /*hashdeletenode*/ ! boolean hashunlink (const bigstring bs, hdlhashnode *hnode) { /* --- 2151,2158 ---- return (true); ! } /*hashkeydeletenode*/ ! boolean hashkeyunlink (const bigstring bs, tyhashval hashval, hdlhashnode *hnode) { /* *************** *** 2150,2154 **** */ ! if (!hashdeletenode (bs, hnode)) return (false); --- 2161,2165 ---- */ ! if (!hashkeydeletenode (bs, hashval, hnode)) return (false); *************** *** 2158,2165 **** return (true); ! } /*hashunlink*/ ! boolean hashdelete (const bigstring bs, boolean fldisposevalue, boolean fldisk) { /* --- 2169,2176 ---- return (true); ! } /*hashkeyunlink*/ ! boolean hashkeydelete (const bigstring bs, tyhashval hashval, boolean fldisposevalue, boolean fldisk) { /* *************** *** 2170,2174 **** hdlhashnode hn; ! if (!hashdeletenode (bs, &hn)) return (false); --- 2181,2185 ---- hdlhashnode hn; ! if (!hashkeydeletenode (bs, hashval, &hn)) return (false); *************** *** 2180,2187 **** return (true); ! } /*hashdelete*/ ! boolean hashtabledelete (hdlhashtable htable, bigstring bs) { boolean fl; --- 2191,2198 ---- return (true); ! } /*hashkeydelete*/ ! boolean hashtablekeydelete (hdlhashtable htable, bigstring bs, tyhashval hashval) { boolean fl; *************** *** 2190,2221 **** return (false); ! fl = hashdelete (bs, true, true); pophashtable (); return (fl); ! } /*hashtabledelete*/ ! boolean hashsymbolexists (const bigstring bs) { ! hdlhashnode hnode, hprev; ! return (hashlocate (bs, &hnode, &hprev)); ! } /*hashsymbolexists*/ ! boolean hashtablesymbolexists (hdlhashtable htable, const bigstring bs) { boolean fl; pushhashtable (htable); ! fl = hashsymbolexists (bs); pophashtable (); return (fl); ! } /*hashtablesymbolexists*/ --- 2201,2246 ---- return (false); ! fl = hashkeydelete (bs, hashval, true, true); pophashtable (); return (fl); ! } /*hashtablekeydelete*/ ! boolean hashkeyexists (const bigstring bs, tyhashval hashval) { ! /* ! 2004-12-17 aradke: for performance, duplicate loop from hashkeylocate ! without keeping track of prev node. ! */ ! ! register hdlhashnode nomad; ! assert (hashfunction (bs) == hashval); ! ! for (nomad = gethashbucket (currenthashtable, hashval); nomad != nil; nomad = (**nomad).hashlink) { ! ! if (equalidentifiers (bs, (**nomad).hashkey)) ! return (true); ! } /*for*/ ! ! return (false); /*loop terminated, not found*/ ! } /*hashkeyexists*/ ! boolean hashtablekeyexists (hdlhashtable htable, const bigstring bs, tyhashval hashval) { + hdlhashnode hnode, hprev; boolean fl; pushhashtable (htable); ! fl = hashkeylocate (bs, hashval, &hnode, &hprev); pophashtable (); return (fl); ! } /*hashtablekeyexists*/ *************** *** 2591,2595 **** ! boolean hashlookup (const bigstring bs, tyvaluerecord *vreturned, hdlhashnode *hnode) { /* --- 2616,2620 ---- ! boolean hashkeylookup (const bigstring bs, tyhashval hashval, tyvaluerecord *vreturned, hdlhashnode *hnode) { /* *************** *** 2599,2603 **** hdlhashnode hprev; ! if (!hashlocate (bs, hnode, &hprev)) return (false); --- 2624,2628 ---- hdlhashnode hprev; ! if (!hashkeylocate (bs, hashval, hnode, &hprev)) return (false); *************** *** 2608,2615 **** return (true); ! } /*hashlookup*/ ! boolean hashtablelookup (hdlhashtable htable, const bigstring bs, tyvaluerecord *vreturned, hdlhashnode *hnode) { boolean fl; --- 2633,2640 ---- return (true); ! } /*hashkeylookup*/ ! boolean hashtablekeylookup (hdlhashtable htable, const bigstring bs, tyhashval hashval, tyvaluerecord *vreturned, hdlhashnode *hnode) { boolean fl; *************** *** 2618,2633 **** return (false); /*so the check is done here.*/ - pushhashtable (htable); ! fl = hashlookup (bs, vreturned, hnode); pophashtable (); return (fl); ! } /*hashtablelookup*/ ! boolean hashlookupnode (const bigstring bs, hdlhashnode *hnode) { /* --- 2643,2657 ---- return (false); /*so the check is done here.*/ pushhashtable (htable); ! fl = hashkeylookup (bs, hashval, vreturned, hnode); pophashtable (); return (fl); ! } /*hashtablekeylookup*/ ! boolean hashkeylookupnode (const bigstring bs, tyhashval hashval, hdlhashnode *hnode) { /* *************** *** 2637,2648 **** hdlhashnode hprev; ! if (!hashlocate (bs, hnode, &hprev)) return (false); return (hashresolvevalue (currenthashtable, *hnode)); ! } /*hashlookupnode*/ ! boolean hashtablelookupnode (hdlhashtable htable, const bigstring bs, hdlhashnode *hnode) { boolean fl; --- 2661,2672 ---- hdlhashnode hprev; ! if (!hashkeylocate (bs, hashval, hnode, &hprev)) return (false); return (hashresolvevalue (currenthashtable, *hnode)); ! } /*hashkeylookupnode*/ ! boolean hashtablekeylookupnode (hdlhashtable htable, const bigstring bs, tyhashval hashval, hdlhashnode *hnode) { boolean fl; *************** *** 2650,2659 **** pushhashtable (htable); ! fl = hashlookupnode (bs, hnode); pophashtable (); return (fl); ! } /*hashtablelookupnode*/ --- 2674,2683 ---- pushhashtable (htable); ! fl = hashkeylookupnode (bs, hashval, hnode); pophashtable (); return (fl); ! } /*hashtablekeylookupnode*/ |
|
From: Andre R. <and...@us...> - 2004-12-17 13:15:12
|
Update of /cvsroot/frontierkernel/Frontier/Common/headers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32621/Common/headers Modified Files: Tag: New_Tables_Experiment-branch lang.h langinternal.h Log Message: First cut at hash-once optimizations: The new hash function is more costly in terms of CPU cycles than the old one. Luckily, we can compensate for this by reducing the number of times the hash value of the node key will be computed. For example, for a UserTalk identifier, the hash value only really needs to be computed once at compile time. Initially, we start this optimization in the low-level hash table functions in langhash.c and then let it percolate upwards. There is a compatibility layer for existing code implemented as pre-processor macros in lang.h. Index: lang.h =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/headers/lang.h,v retrieving revision 1.4.2.10 retrieving revision 1.4.2.11 diff -C2 -d -r1.4.2.10 -r1.4.2.11 *** lang.h 7 Dec 2004 10:33:13 -0000 1.4.2.10 --- lang.h 17 Dec 2004 13:14:57 -0000 1.4.2.11 *************** *** 414,417 **** --- 414,420 ---- + typedef unsigned long tyhashval; + + typedef struct tyhashnode { *************** *** 448,452 **** byte ctlocks: 8; ! unsigned long hashval; /*2004-11-10 aradke: cache of hashfunction(hashkey)*/ byte hashkey []; /*the identifier of this table element, lives in extension of record*/ --- 451,455 ---- byte ctlocks: 8; ! tyhashval hashval; /*2004-11-10 aradke: cache of hashfunction(hashkey)*/ byte hashkey []; /*the identifier of this table element, lives in extension of record*/ *************** *** 455,473 **** ! #define HNoNode ((hdlhashnode) -1) ! #define gethashkey(h,bs) copystring ((**h).hashkey, bs); ! ! typedef hdlhashnode **hdlhashbucketarray; ! typedef unsigned long tyhashval; ! #define ctinitiallogsize 4 /*(2 ** 4) = 16 buckets*/ ! #define nthhashbucket(ht,i) ((*((**(ht)).hbuckets))[i]) ! #define gethashbucketcount(ht) (1 << (**(ht)).logsize) ! #define hashtobucketindex(ht,hash) ((hash) & ((**ht).bucketmask)) --- 458,479 ---- ! #define HNoNode ((hdlhashnode) -1) ! #define gethashkey(h,bs) copystring ((**h).hashkey, bs); ! #define ctinitiallogsize 4 /*(2 ** 4) = 16 buckets*/ ! #define nthhashbucket(ht,i) ((*((**(ht)).hbuckets))[i]) ! #define gethashbucketcount(ht) (1 << (**(ht)).logsize) /*alt.: (**ht).bucketmask + 1*/ ! #define hashtobucketindex(ht,hash) ((hash) & ((**ht).bucketmask)) ! #define gethashbucket(ht,hash) nthhashbucket(ht,hashtobucketindex(ht,hash)) ! ! #define sethashbucket(ht,hash,hn) do { nthhashbucket(ht,hashtobucketindex(ht,hash)) = hn; } while(0) ! ! ! typedef hdlhashnode **hdlhashbucketarray; *************** *** 924,928 **** #endif ! extern boolean newhashtable (hdlhashtable *, boolean); /*langhash.c*/ extern void dirtyhashtable (hdlhashtable); --- 930,936 ---- #endif ! extern tyhashval hashfunction (const bigstring); /*langhash.c*/ ! ! extern boolean newhashtable (hdlhashtable *, boolean); extern void dirtyhashtable (hdlhashtable); *************** *** 958,972 **** //extern hashmerge (hdlhashtable, hdlhashtable); ! extern boolean hashlocate (const bigstring, hdlhashnode *, hdlhashnode *); ! extern boolean hashunlink (const bigstring, hdlhashnode *); ! extern boolean hashdelete (const bigstring, boolean, boolean); ! extern boolean hashtabledelete (hdlhashtable, bigstring); ! extern boolean hashsymbolexists (const bigstring); ! extern boolean hashtablesymbolexists (hdlhashtable, const bigstring); extern void hashsetlocality (tyvaluerecord *, boolean); /*6.2b16 AR: needed to set locality in langaddlocals [langevaluate.c]*/ --- 966,980 ---- //extern hashmerge (hdlhashtable, hdlhashtable); ! extern boolean hashkeylocate (const bigstring, tyhashval, hdlhashnode *, hdlhashnode *); ! extern boolean hashkeyunlink (const bigstring, tyhashval, hdlhashnode *); ! extern boolean hashkeydelete (const bigstring, tyhashval, boolean, boolean); ! extern boolean hashtablekeydelete (hdlhashtable, bigstring, tyhashval); ! extern boolean hashkeyexists (const bigstring, tyhashval); ! extern boolean hashtablekeyexists (hdlhashtable, const bigstring, tyhashval); extern void hashsetlocality (tyvaluerecord *, boolean); /*6.2b16 AR: needed to set locality in langaddlocals [langevaluate.c]*/ *************** *** 980,990 **** extern boolean hashtableassign (hdlhashtable, const bigstring, tyvaluerecord); ! extern boolean hashlookup (const bigstring, tyvaluerecord *, hdlhashnode *); ! extern boolean hashtablelookup (hdlhashtable, const bigstring, tyvaluerecord *, hdlhashnode *); ! extern boolean hashlookupnode (const bigstring, hdlhashnode *); - extern boolean hashtablelookupnode (hdlhashtable, const bigstring, hdlhashnode *); extern boolean hashtablevisit (hdlhashtable, langtablevisitcallback, ptrvoid); --- 988,1020 ---- extern boolean hashtableassign (hdlhashtable, const bigstring, tyvaluerecord); ! extern boolean hashkeylookup (const bigstring, tyhashval, tyvaluerecord *, hdlhashnode *); ! extern boolean hashtablekeylookup (hdlhashtable, const bigstring, tyhashval, tyvaluerecord *, hdlhashnode *); ! extern boolean hashkeylookupnode (const bigstring, tyhashval, hdlhashnode *); ! ! extern boolean hashtablekeylookupnode (hdlhashtable, const bigstring, tyhashval, hdlhashnode *); ! ! ! #define hashlocate(bs, hn1, hn2) hashkeylocate((bs), hashfunction(bs), (hn1), (hn2)) ! ! #define hashunlink(bs, hn) hashkeyunlink((bs), hashfunction(bs), (hn)) ! ! #define hashdelete(bs, fl, fl2) hashkeydelete((bs), hashfunction(bs), (fl), (fl2)) ! ! #define hashtabledelete(ht, bs) hashtablekeydelete((ht), (bs), hashfunction(bs)) ! ! #define hashsymbolexists(bs) hashkeyexists((bs), hashfunction(bs)) ! ! #define hashtablesymbolexists(ht, bs) hashtablekeyexists((ht), (bs), hashfunction(bs)) ! ! #define hashlookup(bs, v, hn) hashkeylookup((bs), hashfunction(bs), (v), (hn)) ! ! #define hashtablelookup(ht, bs, v, hn) hashtablekeylookup((ht), (bs), hashfunction(bs), (v), (hn)) ! ! #define hashlookupnode(bs, hn) hashkeylookupnode((bs), hashfunction(bs), (hn)) ! ! #define hashtablelookupnode(ht, bs, hn) hashtablekeylookupnode((ht), (bs), hashfunction(bs), (hn)) extern boolean hashtablevisit (hdlhashtable, langtablevisitcallback, ptrvoid); Index: langinternal.h =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/headers/langinternal.h,v retrieving revision 1.3.2.2 retrieving revision 1.3.2.3 diff -C2 -d -r1.3.2.2 -r1.3.2.3 *** langinternal.h 24 Nov 2004 20:48:17 -0000 1.3.2.2 --- langinternal.h 17 Dec 2004 13:14:57 -0000 1.3.2.3 *************** *** 416,421 **** extern boolean hashflushcache (long *); /*langhash.h*/ - extern unsigned long hashfunction (const bigstring); /* 2004-11-10 aradke */ - extern boolean hashresolvevalue (hdlhashtable, hdlhashnode); --- 416,419 ---- |
|
From: Andre R. <and...@us...> - 2004-12-17 13:07:05
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31202/Common/source Modified Files: Tag: New_Tables_Experiment-branch arraylist.c Log Message: Fixed bug in unwraplist: When copying overlapping ranges of bytes, use memmove instead of memcpy. Index: arraylist.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/Attic/arraylist.c,v retrieving revision 1.1.2.8 retrieving revision 1.1.2.9 diff -C2 -d -r1.1.2.8 -r1.1.2.9 *** arraylist.c 4 Dec 2004 22:20:43 -0000 1.1.2.8 --- arraylist.c 17 Dec 2004 13:06:55 -0000 1.1.2.9 *************** *** 267,270 **** --- 267,272 ---- in one contiguous block, we will shift everything around to make it so. this is useful for when you want to run qsort from the C standard library. + + 2004-12-17 aradke: use memmove instead of memcpy if src and dest overlap. */ *************** *** 297,301 **** memcpy (*htemp, &((**hlist).item[(**hlist).ix_offset]), lenhead * sizeof(Handle)); ! memcpy (&((**hlist).item[lenhead]), &((**hlist).item[0]), lentail * sizeof(Handle)); memcpy (&((**hlist).item[0]), *htemp, lenhead * sizeof(Handle)); --- 299,303 ---- memcpy (*htemp, &((**hlist).item[(**hlist).ix_offset]), lenhead * sizeof(Handle)); ! memmove (&((**hlist).item[lenhead]), &((**hlist).item[0]), lentail * sizeof(Handle)); /*overlap!*/ memcpy (&((**hlist).item[0]), *htemp, lenhead * sizeof(Handle)); *************** *** 305,309 **** memcpy (*htemp, &((**hlist).item[0]), lentail * sizeof(Handle)); ! memcpy (&((**hlist).item[0]), &((**hlist).item[(**hlist).ix_offset]), lenhead * sizeof(Handle)); memcpy (&((**hlist).item[lenhead]), *htemp, lentail * sizeof(Handle)); --- 307,311 ---- memcpy (*htemp, &((**hlist).item[0]), lentail * sizeof(Handle)); ! memmove (&((**hlist).item[0]), &((**hlist).item[(**hlist).ix_offset]), lenhead * sizeof(Handle)); /*overlap!*/ memcpy (&((**hlist).item[lenhead]), *htemp, lentail * sizeof(Handle)); *************** *** 316,322 **** /*copy using free space in buffer*/ ! memcpy (&((**hlist).item[lenhead]), &((**hlist).item[0]), lentail * sizeof(Handle)); ! memcpy (&((**hlist).item[0]), &((**hlist).item[(**hlist).ix_offset]), lenhead * sizeof(Handle)); } --- 318,324 ---- /*copy using free space in buffer*/ ! memmove (&((**hlist).item[lenhead]), &((**hlist).item[0]), lentail * sizeof(Handle)); /*overlap!*/ ! memmove (&((**hlist).item[0]), &((**hlist).item[(**hlist).ix_offset]), lenhead * sizeof(Handle)); /*overlap!*/ } |
|
From: Andre R. <and...@us...> - 2004-12-17 13:04:44
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30676/Common/source Modified Files: Tag: New_Tables_Experiment-branch about.c Log Message: Bump release counter to -NT6 Index: about.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/about.c,v retrieving revision 1.4.2.5 retrieving revision 1.4.2.6 diff -C2 -d -r1.4.2.5 -r1.4.2.6 *** about.c 5 Dec 2004 19:37:59 -0000 1.4.2.5 --- about.c 17 Dec 2004 13:04:32 -0000 1.4.2.6 *************** *** 798,802 **** #if defined(flrecyclehashnodes) || defined(flrecyclehashnodes) || defined(fltablesortorderisarray) ! pushstring ("\x04" "-NT5", bs); #endif --- 798,802 ---- #if defined(flrecyclehashnodes) || defined(flrecyclehashnodes) || defined(fltablesortorderisarray) ! pushstring ("\x04" "-NT6", bs); #endif |
|
From: Andre R. <and...@us...> - 2004-12-15 21:36:31
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6896/Common/source Modified Files: Tag: New_Tables_Experiment-branch langhash.c Log Message: Fixed typo resulting in assignment instead of comparison. Index: langhash.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langhash.c,v retrieving revision 1.4.2.23 retrieving revision 1.4.2.24 diff -C2 -d -r1.4.2.23 -r1.4.2.24 *** langhash.c 15 Dec 2004 20:25:50 -0000 1.4.2.23 --- langhash.c 15 Dec 2004 21:36:21 -0000 1.4.2.24 *************** *** 2940,2944 **** assert (hlist != nil); ! if ((**ht).sortorder = sortbyname) { listresort (hlist, ix, comparefunc); --- 2940,2944 ---- assert (hlist != nil); ! if ((**ht).sortorder == sortbyname) { listresort (hlist, ix, comparefunc); |
|
From: Andre R. <and...@us...> - 2004-12-15 20:26:02
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23014 Modified Files: Tag: New_Tables_Experiment-branch langhash.c Log Message: A disturbing discovery, the sort order is only maintained strictly if the table is sorted by name. If the sort order is set to anything else, we can't use a binary search to locate existing items or appropriate slots for insertion. Index: langhash.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langhash.c,v retrieving revision 1.4.2.22 retrieving revision 1.4.2.23 diff -C2 -d -r1.4.2.22 -r1.4.2.23 *** langhash.c 7 Dec 2004 11:17:22 -0000 1.4.2.22 --- langhash.c 15 Dec 2004 20:25:50 -0000 1.4.2.23 *************** *** 1603,1614 **** static boolean hashsortedinsert (hdlhashnode hnode) { #ifdef fltablesortorderisarray ! if ((**currenthashtable).sortedlist == nil) return (true); - - return (listsortedinsert ((**currenthashtable).sortedlist, (Handle) hnode, hashgetcomparefunc (currenthashtable))); #else --- 1603,1639 ---- static boolean hashsortedinsert (hdlhashnode hnode) { + + /* + 2004-12-15 aradke: a disturbing discovery, the sort order is only maintained strictly + if the table is sorted by name. if the sort order is set to anything else, we can't + use a binary search to locate existing items or appropriate slots for insertion. + emulate previous behaviour when the sort order isn't by name. + */ #ifdef fltablesortorderisarray ! hdllist hlist = (**currenthashtable).sortedlist; ! hashcomparefunc comparefunc; ! long k, kmax; ! hdlhashnode nomad; ! ! if (hlist == nil) return (true); + if ((**currenthashtable).sortorder == sortbyname) + return (listsortedinsert (hlist, (Handle) hnode, hashgetcomparefunc (currenthashtable))); + + comparefunc = hashgetcomparefunc (currenthashtable); + + for (k = 0, kmax = listcount (hlist); k < kmax; k++) { + + nomad = (hdlhashnode) listget (hlist, k); + + if ((*comparefunc) (&hnode, &nomad) < 0) + return (listinsert (hlist, k, (Handle) hnode)); + } /*for*/ + + return (listappend (hlist, (Handle) hnode)); + #else *************** *** 1671,1680 **** static void hashsorteddelete (hdlhashnode hnodedelete) { #ifdef fltablesortorderisarray ! if ((**currenthashtable).sortedlist == nil) return; ! (void) listsorteddelete ((**currenthashtable).sortedlist, (Handle) hnodedelete, hashgetcomparefunc (currenthashtable)); #else --- 1696,1721 ---- static void hashsorteddelete (hdlhashnode hnodedelete) { + /* + 2004-12-15 aradke: see hashsortedinsert + */ + #ifdef fltablesortorderisarray ! hdllist hlist = (**currenthashtable).sortedlist; ! long ix; ! ! if (hlist == nil) return; ! if ((**currenthashtable).sortorder == sortbyname) { ! ! (void) listsorteddelete (hlist, (Handle) hnodedelete, hashgetcomparefunc (currenthashtable)); ! ! return; ! } ! ! if (listlinearsearch (hlist, (Handle) hnodedelete, &ix)) ! ! listdelete (hlist, ix); #else *************** *** 2876,2883 **** 2004-11-20 aradke: if a single node is affected, we rely on the caller to determine the index of the node before changing its hash key or value. */ register hdlhashtable ht = htable; ! if (hresort == nil) return (hashquicksort (ht)); --- 2917,2930 ---- 2004-11-20 aradke: if a single node is affected, we rely on the caller to determine the index of the node before changing its hash key or value. + + 2004-12-15 aradke: see hashsortedinsert */ register hdlhashtable ht = htable; ! #ifdef fltablesortorderisarray ! hdllist hlist; ! hashcomparefunc comparefunc; ! #endif ! if (hresort == nil) return (hashquicksort (ht)); *************** *** 2886,2894 **** #ifdef fltablesortorderisarray ! assert ((**ht).sortedlist != nil); ! listresort ((**ht).sortedlist, ix, hashgetcomparefunc (ht)); #else --- 2933,2966 ---- #ifdef fltablesortorderisarray + + hlist = (**ht).sortedlist; + + comparefunc = hashgetcomparefunc (currenthashtable); ! assert (hlist != nil); ! ! if ((**ht).sortorder = sortbyname) { ! listresort (hlist, ix, comparefunc); ! } ! else { + hdlhashnode nomad; + long k, kmax; + + for (k = 0, kmax = listcount (hlist); k < kmax; k++) { + + nomad = (hdlhashnode) listget (hlist, k); + + if ((*comparefunc) (&hresort, &nomad) < 0) + break; + } /*for*/ + + if (ix < k) /*adjust for source being to the left of the destination*/ + k--; + + listmove (hlist, ix, k); + } + #else *************** *** 4405,4426 **** is in the list, so we can use the binary search successfully. however, just to be sure we try a linearsearch if the binary search fails. */ #ifdef fltablesortorderisarray boolean flfound; ! assert ((**htable).sortedlist != nil); ! pushhashtable (htable); /*for hashcompare*/ ! ! flfound = listbinarysearchexact ((**htable).sortedlist, (Handle) hnode, index, hashgetcomparefunc (htable)); ! ! pophashtable (); ! if (flfound) ! return (true); ! return (listlinearsearch ((**htable).sortedlist, (Handle) hnode, index)); #else --- 4477,4503 ---- is in the list, so we can use the binary search successfully. however, just to be sure we try a linearsearch if the binary search fails. + + 2004-12-15 aradke: see hashsortedinsert, binary search only works with sort by name. */ #ifdef fltablesortorderisarray + hdllist hlist = (**htable).sortedlist; boolean flfound; ! assert (hlist != nil); ! if ((**htable).sortorder == sortbyname) { ! pushhashtable (htable); /*for hashcompare*/ ! flfound = listbinarysearchexact (hlist, (Handle) hnode, index, hashgetcomparefunc (htable)); ! ! pophashtable (); ! } ! else ! flfound = listlinearsearch (hlist, (Handle) hnode, index); ! ! return (flfound); #else |
|
From: Terry T. <ter...@us...> - 2004-12-13 02:01:35
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11812/Frontier/Common/source Modified Files: smallicon.c Log Message: Prevent popup arrow icon 'SICN' resource from being purged when the bitmap is being copied, and memory is being stressed. Found by QC. Index: smallicon.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/smallicon.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** smallicon.c 31 Oct 2004 16:45:52 -0000 1.3 --- smallicon.c 13 Dec 2004 02:01:25 -0000 1.4 *************** *** 205,212 **** #ifdef MACVERSION Handle h; h = GetResource ('SICN', resnum); ! return (copyhandle (h, (Handle *) hbits)); #endif --- 205,220 ---- #ifdef MACVERSION Handle h; + boolean fl; + SInt8 hState; h = GetResource ('SICN', resnum); ! LoadResource(h); /*in case resource was purged*/ ! hState = HGetState(h); ! HNoPurge(h); /*in case resource is purgeable*/ ! fl = copyhandle (h, (Handle *) hbits); ! HSetState(h, hState); ! ! return (fl); #endif |
|
From: Seth D. <set...@us...> - 2004-12-12 12:53:31
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3572 Modified Files: langregexp.c Log Message: regexpscanreplacement() now always treats double backslashes as escaped backslashes, so two become one. Removed all the extra commentary. Index: langregexp.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langregexp.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** langregexp.c 12 Dec 2004 03:29:51 -0000 1.7 --- langregexp.c 12 Dec 2004 12:53:18 -0000 1.8 *************** *** 1523,1542 **** - /* - 12/11/2004 smd: - regexpscanreplacement() should be converting double backslashes - to single backslashes, but isn't. In the replacement pattern, - double backslashes should be collapsed to single backslashes. - - This line: - msg( re.replace( re.compile( "(a)(b)" ), "\\1\\\\\\2", "ab" ) ) - - should display "a\b" but is instead showing "a\\b". There's no way - to "insert" a single (or any odd number) of backslashes to the result. - I've fixed it, but Andre is worried that it could cause breakage. - To make it work, uncomment the following line. - */ - /*#define REGEX_COMPACT_BACKSLASHES 1*/ - static boolean regexpscanreplacement (const char *pstart, long len, bigstring bserror, tyreplscanliteralcallback literalfunc, --- 1523,1526 ---- *************** *** 1630,1634 **** } } - #ifdef REGEX_COMPACT_BACKSLASHES else if (*p1 == '\\') { /* 2004/12/11 smd: double backslashes should be collapsed into singles */ --- 1614,1617 ---- *************** *** 1637,1645 **** return (false); ! p = plast = p1 + 1; continue; /*avoid incrementation of p*/ } - #endif else if (isdigit (*p1)) { --- 1620,1627 ---- return (false); ! p = plast = ++p1; continue; /*avoid incrementation of p*/ } else if (isdigit (*p1)) { |
|
From: Seth D. <set...@us...> - 2004-12-12 03:30:05
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv727 Modified Files: langregexp.c Log Message: Double backslashes in the replacement parameter should be compacted into single backslashes. regexpscanreplacement() was only eating backslashes before named/numbered references. This has been fixed, but it is shut off unless you add "#define REGEX_COMPACT_SLASHES 1". Full comments, with one-line test script, at top of regexscanreplacement. Index: langregexp.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langregexp.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** langregexp.c 31 Oct 2004 13:19:30 -0000 1.6 --- langregexp.c 12 Dec 2004 03:29:51 -0000 1.7 *************** *** 1523,1526 **** --- 1523,1542 ---- + /* + 12/11/2004 smd: + regexpscanreplacement() should be converting double backslashes + to single backslashes, but isn't. In the replacement pattern, + double backslashes should be collapsed to single backslashes. + + This line: + msg( re.replace( re.compile( "(a)(b)" ), "\\1\\\\\\2", "ab" ) ) + + should display "a\b" but is instead showing "a\\b". There's no way + to "insert" a single (or any odd number) of backslashes to the result. + I've fixed it, but Andre is worried that it could cause breakage. + To make it work, uncomment the following line. + */ + /*#define REGEX_COMPACT_BACKSLASHES 1*/ + static boolean regexpscanreplacement (const char *pstart, long len, bigstring bserror, tyreplscanliteralcallback literalfunc, *************** *** 1614,1617 **** --- 1630,1645 ---- } } + #ifdef REGEX_COMPACT_BACKSLASHES + else if (*p1 == '\\') { + /* 2004/12/11 smd: double backslashes should be collapsed into singles */ + + if (!literalfunc (plast - pstart, (p - plast) + 1, bserror, refcon)) + return (false); + + p = plast = p1 + 1; + + continue; /*avoid incrementation of p*/ + } + #endif else if (isdigit (*p1)) { |
|
From: Andre R. <and...@us...> - 2004-12-09 20:27:08
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26941/Common/source Modified Files: timedate.c Log Message: Worked around a crashing bug in getNewLocalePatternString, possibly a CW 8.x compiler bug. [but #static boolean getNewLocalePatternString (unsigned long lc, char ** foo, char * defValue) {] Index: timedate.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/timedate.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** timedate.c 31 Oct 2004 16:38:27 -0000 1.3 --- timedate.c 9 Dec 2004 20:26:51 -0000 1.4 *************** *** 190,202 **** static boolean getNewLocalePatternString (unsigned long lc, char ** foo, char * defValue) { char buf[256]; char buf2[256]; ! short i, j, cnt, len; char c; len = GetLocaleInfo (LOCALE_USER_DEFAULT, lc, buf, 256); ! --len; ! if (len != 0) { i = 0; j = 0; --- 190,224 ---- static boolean getNewLocalePatternString (unsigned long lc, char ** foo, char * defValue) { + + /* + 2004-12-09 aradke: site of a mysterious crashing bug, possibly a CodeWarrior 8.x compiler bug. + with full optimizations, the cw compiler produces the following code for Win32: + 221: buf2[j++] = '%'; + 00420257 movsx eax,word ptr [j] + 0042025E movsx edi,word ptr [j] + 222: buf2[j++] = '%'; + 00420265 movsx edx,word ptr [edi+1] + 00420269 mov byte ptr buf2[eax],25h + + the instruction at 00420265 ends up attempting to read from address 0x00000001. + details are available in bug #1081295 on sourceforge.net: + http://sourceforge.net/tracker/index.php?func=detail&aid=1081295&group_id=120666&atid=687798 + + the crashes disappear when the type of the integer variables is switched from short to int, + so that's what we'll do for now. + + also, check len for failed GetLocaleInfo call before decrementing it. + */ + char buf[256]; char buf2[256]; ! int i, j, cnt, len; /*2004-12-09 aradke*/ char c; len = GetLocaleInfo (LOCALE_USER_DEFAULT, lc, buf, 256); ! ! if (len > 0) { ! --len; /*2004-12-09 aradke: dont't attempt to parse trailing nil char*/ i = 0; j = 0; |
|
From: Seth D. <set...@us...> - 2004-12-09 16:32:01
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31200 Modified Files: dialogs.c Log Message: Fixed bug on Carbon builds, where fields in dialogs (like in dialog.ask or the find window) would not have their text selected. Explicit casting from DialogPtr to WindowPtr is a no-no, use the Carbon casting function GetDialogWindow. There are probably other areas that need the same fix. Index: dialogs.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/dialogs.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dialogs.c 30 Oct 2004 23:07:30 -0000 1.4 --- dialogs.c 9 Dec 2004 16:31:50 -0000 1.5 *************** *** 1310,1322 **** #if TARGET_API_MAC_CARBON == 1 WindowClass wclass; ! err = GetWindowClass ((WindowRef) pdialog, &wclass); if (err==noErr) { if (wclass == kModalWindowClass) { // it's a dialog ! return (dialogsetselect (pdialog, 0, infinity)); } else if (wclass == kDocumentWindowClass) { // it's not a dialog, it's an olde-tyme window. The Find window, for example. ! return (dialogsetselect (GetDialogFromWindow((WindowRef) pdialog), 0, infinity)); } --- 1310,1326 ---- #if TARGET_API_MAC_CARBON == 1 WindowClass wclass; ! ! /* 12/9/2004 smd: use carbon's casting function, as "(WindowRef)pdialog" doesn't work */ ! WindowPtr pwin = GetDialogWindow (pdialog); ! ! err = GetWindowClass (pwin, &wclass); if (err==noErr) { if (wclass == kModalWindowClass) { // it's a dialog ! return (dialogsetselect (pdialog, 0, infinity)); } else if (wclass == kDocumentWindowClass) { // it's not a dialog, it's an olde-tyme window. The Find window, for example. ! return (dialogsetselect (GetDialogFromWindow (pwin), 0, infinity)); } |
|
From: Andre R. <and...@us...> - 2004-12-08 12:58:32
|
Update of /cvsroot/frontierkernel/Frontier/Common/headers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8874/Common/headers Modified Files: frontierdefs.h Log Message: Disable buggy tracking of deleted local addresses. Index: frontierdefs.h =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/headers/frontierdefs.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** frontierdefs.h 10 Nov 2004 18:18:23 -0000 1.4 --- frontierdefs.h 8 Dec 2004 12:58:21 -0000 1.5 *************** *** 78,81 **** --- 78,83 ---- #define PASCALSTRINGVERSION 1 #define SPEED 1 + #undef fltracklocaladdresses /*2004-12-08 aradke: disable [buggy] code for tracking deleted local addresses*/ + #ifdef MACVERSION *************** *** 107,112 **** - #define fltracklocaladdresses 0 /* enable code for tracking deleted local addresses */ - - #endif /*__FRONTIERDEFS_H__*/ --- 109,111 ---- |
|
From: Seth D. <set...@us...> - 2004-12-07 17:44:08
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22093 Modified Files: stringverbs.c Log Message: Removed local variable hlen from midfunc. It was a leftover from an aborted attempt at a special-case optimization. Index: stringverbs.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/stringverbs.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** stringverbs.c 7 Dec 2004 17:08:01 -0000 1.7 --- stringverbs.c 7 Dec 2004 17:43:57 -0000 1.8 *************** *** 1574,1578 **** Handle x; long ix; ! long hlen, newlen; --- 1574,1578 ---- Handle x; long ix; ! long newlen; *************** *** 1591,1596 **** --ix; /*convert to zero-base*/ ! hlen = gethandlesize (hstring); ! newlen = min (newlen, hlen - ix); --- 1591,1595 ---- --ix; /*convert to zero-base*/ ! newlen = min (newlen, gethandlesize (hstring) - ix); |
|
From: Seth D. <set...@us...> - 2004-12-07 17:08:12
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13083 Modified Files: stringverbs.c Log Message: Minor updates to midfunc and deletefunc. midfunc is marginally faster, and the coding style for both is now more consistent with the rest of the code. Index: stringverbs.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/stringverbs.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** stringverbs.c 6 Dec 2004 00:51:12 -0000 1.6 --- stringverbs.c 7 Dec 2004 17:08:01 -0000 1.7 *************** *** 1433,1447 **** if (!newhandle (lenbefore + lenafter, &x)) ! return false; ixbefore = 0; if (lenbefore > 0) if (!loadfromhandle (hstring, &ixbefore, lenbefore, *x)) ! return false; ixbefore += ctdelete; if (lenafter > 0) if (!loadfromhandle (hstring, &ixbefore, lenafter, &((*x) [lenbefore]) )) ! return false; return (setheapvalue (x, stringvaluetype, v)); --- 1433,1447 ---- if (!newhandle (lenbefore + lenafter, &x)) ! return (false); ixbefore = 0; if (lenbefore > 0) if (!loadfromhandle (hstring, &ixbefore, lenbefore, *x)) ! return (false); ixbefore += ctdelete; if (lenafter > 0) if (!loadfromhandle (hstring, &ixbefore, lenafter, &((*x) [lenbefore]) )) ! return (false); return (setheapvalue (x, stringvaluetype, v)); *************** *** 1574,1578 **** Handle x; long ix; ! long len; --- 1574,1578 ---- Handle x; long ix; ! long hlen, newlen; *************** *** 1582,1586 **** flnextparamislast = true; ! if (!getlongvalue (hp1, 3, &len)) return (false); --- 1582,1586 ---- flnextparamislast = true; ! if (!getlongvalue (hp1, 3, &newlen)) return (false); *************** *** 1591,1603 **** --ix; /*convert to zero-base*/ ! len = min (len, gethandlesize (hstring) - ix); ! if (len > 0) { ! if (!loadfromhandletohandle (hstring, &ix, len, false, &x)) ! if (!newemptyhandle (&x)) ! return (false); } else if (!newemptyhandle (&x)) ! return false; return (setheapvalue (x, stringvaluetype, v)); --- 1591,1606 ---- --ix; /*convert to zero-base*/ ! hlen = gethandlesize (hstring); ! newlen = min (newlen, hlen - ix); ! ! if (newlen > 0) { ! if (!newhandle (newlen, &x)) ! return (false); ! if (!loadfromhandle (hstring, &ix, newlen, *x)) ! return (false); } else if (!newemptyhandle (&x)) ! return (false); return (setheapvalue (x, stringvaluetype, v)); |
|
From: Andre R. <and...@us...> - 2004-12-07 11:17:32
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4680 Modified Files: Tag: New_Tables_Experiment-branch langhash.c Log Message: Slight clean up of size check for dynamic allocation of hash buckets. Index: langhash.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langhash.c,v retrieving revision 1.4.2.21 retrieving revision 1.4.2.22 diff -C2 -d -r1.4.2.21 -r1.4.2.22 *** langhash.c 7 Dec 2004 10:33:13 -0000 1.4.2.21 --- langhash.c 7 Dec 2004 11:17:22 -0000 1.4.2.22 *************** *** 615,619 **** ! static unsigned long ctresizedhashtables = 0; static boolean resizehashtable (hdlhashtable htable, unsigned long newlogsize) { --- 615,630 ---- ! #define checkresizehashtable(ht) \ ! do { /*double bucket array if fill factor > 0.5*/ \ ! if (2 * (**(ht)).ctnodes > (**(ht)).bucketmask) { \ ! (void) resizehashtable ((ht), (**(ht)).logsize + 1); \ ! } \ ! } while(0) ! ! ! #ifdef fldebug ! static unsigned long ctdebugresizedhashtables = 0; ! #endif ! static boolean resizehashtable (hdlhashtable htable, unsigned long newlogsize) { *************** *** 641,645 **** return (true); ! ctresizedhashtables++; ctoldbuckets = 1 << oldlogsize; --- 652,658 ---- return (true); ! #ifdef fldebug ! ctdebugresizedhashtables++; ! #endif ctoldbuckets = 1 << oldlogsize; *************** *** 1704,1724 **** register hdlhashnode hnext; ! //if ((**htable).ctnodes > (1 << (**htable).logsize)) ! if (3 * (**htable).ctnodes > 2 * (1 << (**htable).logsize)) ! { ! ! /*more than 2/3rds full, grow it*/ ! ! unsigned long oldlogsize, newlogsize; ! ! oldlogsize = (**htable).logsize; ! ! //if (oldlogsize < 14) ! // newlogsize = oldlogsize + 2; /*quadruple for 8k items or less*/ ! //else ! newlogsize = oldlogsize + 1; /*double for 16k items or more*/ ! ! (void) resizehashtable (htable, newlogsize); /*ignore return value, our callers don't check for it*/ ! } assert ((**hn).hashval == hashfunction ((**hn).hashkey)); --- 1717,1721 ---- register hdlhashnode hnext; ! checkresizehashtable (htable); assert ((**hn).hashval == hashfunction ((**hn).hashkey)); |
|
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 |
|
From: Andre R. <and...@us...> - 2004-12-07 10:33:23
|
Update of /cvsroot/frontierkernel/Frontier/Common/headers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27745/headers Modified Files: Tag: New_Tables_Experiment-branch frontierdefs.h lang.h langexternal.h tableinternal.h 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: lang.h =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/headers/lang.h,v retrieving revision 1.4.2.9 retrieving revision 1.4.2.10 diff -C2 -d -r1.4.2.9 -r1.4.2.10 *** lang.h 4 Dec 2004 22:23:38 -0000 1.4.2.9 --- lang.h 7 Dec 2004 10:33:13 -0000 1.4.2.10 *************** *** 502,511 **** struct tyhashtable **prevhashtable; /*allow tables to be linked*/ ! #if !flruntime ! ! struct tyhashtable **parenthashtable; /*allow tables to be linked, but not lexically*/ ! ! #endif /* The following is added 12/29/99 by RAB so that we do not have to scan all the buckets of this tables parent to get the hashnode for this table and therefore it's value record and it's name. */ --- 502,513 ---- struct tyhashtable **prevhashtable; /*allow tables to be linked*/ ! #ifndef fltablebackpointers ! ! #if !flruntime + struct tyhashtable **parenthashtable; /*allow tables to be linked, but not lexically*/ + + #endif + /* The following is added 12/29/99 by RAB so that we do not have to scan all the buckets of this tables parent to get the hashnode for this table and therefore it's value record and it's name. */ *************** *** 513,516 **** --- 515,520 ---- hdlhashnode thistableshashnode; /*this tables hashnode referenced in it's parents hashbuckets 12/29/99 RAB*/ + #endif + #ifdef fltracklocaladdresses *************** *** 547,551 **** boolean flsubsdirty: 1; /*has this table got dirty subs -- set in tablepreflightsubsdirtyflag before saving*/ ! long hashtablerefcon; /*for use by application*/ long lexicalrefcon; --- 551,555 ---- boolean flsubsdirty: 1; /*has this table got dirty subs -- set in tablepreflightsubsdirtyflag before saving*/ ! long hashtablerefcon; /*2004-12-04 aradke: used for hdltablevariable*/ long lexicalrefcon; Index: langexternal.h =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/headers/langexternal.h,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** langexternal.h 20 Nov 2004 18:59:48 -0000 1.1.2.1 --- langexternal.h 7 Dec 2004 10:33:13 -0000 1.1.2.2 *************** *** 145,153 **** dbaddress oldaddress; /*last place this variable was stored in db*/ ! #if langexternalfind_optimization ! ! hdlhashtable hexternaltable; ! hdlhashnode hexternalnode; #endif --- 145,153 ---- dbaddress oldaddress; /*last place this variable was stored in db*/ ! #if fltablebackpointers ! hdlhashnode inhashnode; ! ! hdlhashtable inhashtable; #endif Index: tableinternal.h =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/headers/tableinternal.h,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** tableinternal.h 4 Dec 2004 22:23:38 -0000 1.1.2.2 --- tableinternal.h 7 Dec 2004 10:33:13 -0000 1.1.2.3 *************** *** 81,85 **** ! #if langexternalfind_optimization typedef tyexternalvariable tytablevariable, *ptrtablevariable, **hdltablevariable; --- 81,85 ---- ! #if fltablebackpointers typedef tyexternalvariable tytablevariable, *ptrtablevariable, **hdltablevariable; Index: frontierdefs.h =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/headers/frontierdefs.h,v retrieving revision 1.2.2.6 retrieving revision 1.2.2.7 diff -C2 -d -r1.2.2.6 -r1.2.2.7 *** frontierdefs.h 2 Dec 2004 13:20:25 -0000 1.2.2.6 --- frontierdefs.h 7 Dec 2004 10:33:13 -0000 1.2.2.7 *************** *** 76,82 **** #undef lazythis_optimization #undef langexternalfind_optimization ! #define flrecyclehashnodes 1 /* 2004-11-11 aradke: enable to recycle hashnodes instead of disposing [EXPERIMENTAL] */ ! #define flrecyclehashbuckets 1 /* 2004-11-14 aradke: enable to recylce hash bucket arrays [EXPERIMENTAL] */ #define fltablesortorderisarray 1 /* 2004-11-14 aradke: keep table sort order as array instead of linked list [EXPERIMENTAL] */ #define PASCALSTRINGVERSION 1 --- 76,83 ---- #undef lazythis_optimization #undef langexternalfind_optimization ! #define flrecyclehashnodes 1 /* 2004-11-11 aradke: enable to recycle hashnodes instead of disposing [EXPERIMENTAL] */ ! #define flrecyclehashbuckets 1 /* 2004-11-14 aradke: enable to recylce hash bucket arrays [EXPERIMENTAL] */ #define fltablesortorderisarray 1 /* 2004-11-14 aradke: keep table sort order as array instead of linked list [EXPERIMENTAL] */ + #define fltablebackpointers 1 /* 2004-12-05 aradke: maintain back-pointers for external variables [EXPERIMENTAL] */ #define PASCALSTRINGVERSION 1 |
|
From: Terry T. <ter...@us...> - 2004-12-06 02:04:30
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8857/Frontier/Common/source Modified Files: launch.c Log Message: [ 1076287 ] calling someApp.bringToFront() raises -600 error - fix by Karsten Wolf. Index: launch.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/launch.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** launch.c 31 Oct 2004 13:02:23 -0000 1.5 --- launch.c 6 Dec 2004 02:04:21 -0000 1.6 *************** *** 1358,1367 **** --- 1358,1372 ---- 2.1b14 dmb: make sure we call the waitcallback before timing out. + + 10.0a4 trt/karstenw: avoid -600 (no such process) error in Classic + even if the app is already launched. */ long startticks; + #if defined(TARGET_API_MAC_OS8) && (TARGET_API_MAC_OS8 == 1) if (oserror (WakeUpProcess (&psn))) return (false); + #endif if (oserror (SetFrontProcess (&psn))) |
|
From: Seth D. <set...@us...> - 2004-12-06 00:51:24
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26441 Modified Files: stringverbs.c Log Message: optimization - grabnthfield() now takes an additional parameter, Handle *hfield, where the extracted field will be stored. After calling textnthword() to find the field, it uses loadfromhandletohandle to create handle at *hfield and fill it with the result value. grabnthfield is only used in stringverbs.c, and all callers have been updated to provide the extra param. Also, nthfieldfunc, firstwordfunc, and nthwordfunc now declare the extra handle, and use getreadonlytextvalue instead of getextempttextvalue. Wow, I need to write shorter notes. Index: stringverbs.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/stringverbs.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** stringverbs.c 5 Dec 2004 22:08:23 -0000 1.5 --- stringverbs.c 6 Dec 2004 00:51:12 -0000 1.6 *************** *** 1031,1036 **** ! static void grabnthfield (Handle htext, long fieldnum, byte chdelim, boolean flstrict) { ! long ixword, lenword; --- 1031,1039 ---- ! static void grabnthfield (Handle htext, long fieldnum, byte chdelim, Handle *hfield, boolean flstrict) { ! ! /* 12/5/2004 smd: optimization - now takes hfield parameter, a pointer to the ! handle for the extracted field */ ! long ixword, lenword; *************** *** 1038,1045 **** lenword = 0; ! if ((lenword > 0) && (ixword > 0)) ! moveleft (*htext + ixword, *htext, lenword); - sethandlesize (htext, lenword); } /*grabnthfield*/ --- 1041,1047 ---- lenword = 0; ! if (!loadfromhandletohandle (htext, &ixword, lenword, false, hfield)) ! newemptyhandle (hfield); } /*grabnthfield*/ *************** *** 1592,1596 **** if (len > 0) { ! if (!loadfromhandletohandle(hstring, &ix, len, false, &x)) if (!newemptyhandle (&x)) return (false); --- 1594,1598 ---- if (len > 0) { ! if (!loadfromhandletohandle (hstring, &ix, len, false, &x)) if (!newemptyhandle (&x)) return (false); *************** *** 1625,1628 **** --- 1627,1631 ---- case nthfieldfunc: { Handle htext; + Handle x; char chdelim; long fieldnum; *************** *** 1643,1652 **** } /*if*/ ! if (!getexempttextvalue (hp1, 1, &htext)) /*get last to simplify error handing*/ return (false); ! grabnthfield (htext, fieldnum, chdelim, true); ! return (setheapvalue (htext, stringvaluetype, v)); } --- 1646,1655 ---- } /*if*/ ! if (!getreadonlytextvalue (hp1, 1, &htext)) /*get last to simplify error handing*/ return (false); ! grabnthfield (htext, fieldnum, chdelim, &x, true); ! return (setheapvalue (x, stringvaluetype, v)); } *************** *** 1673,1685 **** case firstwordfunc: { Handle htext; flnextparamislast = true; ! if (!getexempttextvalue (hp1, 1, &htext)) /*get last to simplify error handing*/ return (false); ! grabnthfield (htext, 1, chword, false); ! return (setheapvalue (htext, stringvaluetype, v)); } --- 1676,1689 ---- case firstwordfunc: { Handle htext; + Handle x; flnextparamislast = true; ! if (!getreadonlytextvalue (hp1, 1, &htext)) /*get last to simplify error handing*/ return (false); ! grabnthfield (htext, 1, chword, &x, false); ! return (setheapvalue (x, stringvaluetype, v)); } *************** *** 1699,1702 **** --- 1703,1707 ---- case nthwordfunc: { Handle htext; + Handle x; long wordnum; *************** *** 1706,1715 **** return (false); ! if (!getexempttextvalue (hp1, 1, &htext)) /*get last to simplify error handing*/ return (false); ! grabnthfield (htext, wordnum, chword, false); ! return (setheapvalue (htext, stringvaluetype, v)); } --- 1711,1720 ---- return (false); ! if (!getreadonlytextvalue (hp1, 1, &htext)) /*get last to simplify error handing*/ return (false); ! grabnthfield (htext, wordnum, chword, &x, false); ! return (setheapvalue (x, stringvaluetype, v)); } |
|
From: Seth D. <set...@us...> - 2004-12-05 22:08:37
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22414 Modified Files: stringverbs.c Log Message: optimization - deletefunc now uses readonly handle for input, creates output handle with precisely the right size for output, copies substrings with loadfromhandle Index: stringverbs.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/stringverbs.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** stringverbs.c 5 Dec 2004 00:09:15 -0000 1.4 --- stringverbs.c 5 Dec 2004 22:08:23 -0000 1.5 *************** *** 1362,1365 **** --- 1362,1369 ---- 12/4/2004 smd: optimization - midfunc (ie string.mid) now uses a readonly handle for the input string, and copies only the results to the output string, for performance + + 12/5/2004 smd: optimization - deletefunc now uses a readonly handle for the input + string, creates a new handle sized precisely for the output string, and copies + two parts from the input to the output (substrings before and after the deleted chars) */ *************** *** 1390,1396 **** --- 1394,1408 ---- case deletefunc: { + /* 12/5/2004 smd: optimized */ + Handle x; + Handle hstring; long ctdelete; long ixdelete; + long lenbefore; + long ixbefore; + long ixafter; + long lenafter; + long hlen; if (!getpositivelongvalue (hp1, 2, &ixdelete)) *************** *** 1402,1415 **** return (false); ! if (!getexempttextvalue (hp1, 1, &x)) return (false); ! --ixdelete; /*convert to zero-base*/ ! if (!pullfromhandle (x, ixdelete, ctdelete, nil)) { /*ctdelete too large*/ ! ! if (ixdelete >= 0) ! sethandlesize (x, min (ixdelete, gethandlesize (x))); ! } return (setheapvalue (x, stringvaluetype, v)); --- 1414,1445 ---- return (false); ! if (!getreadonlytextvalue (hp1, 1, &hstring)) return (false); ! hlen = gethandlesize (hstring); ! if (ixdelete > 0) ! --ixdelete; /*convert to zero-base*/ ! ! lenbefore = ixdelete; ! ! ctdelete = min (ctdelete, hlen - ixdelete); /* in case ctdelete is too big */ ! ! ixafter = ixdelete + ctdelete; ! ! lenafter = hlen - ixafter; ! ! if (!newhandle (lenbefore + lenafter, &x)) ! return false; ! ! ixbefore = 0; ! if (lenbefore > 0) ! if (!loadfromhandle (hstring, &ixbefore, lenbefore, *x)) ! return false; ! ! ixbefore += ctdelete; ! if (lenafter > 0) ! if (!loadfromhandle (hstring, &ixbefore, lenafter, &((*x) [lenbefore]) )) ! return false; return (setheapvalue (x, stringvaluetype, v)); |
|
From: Andre R. <and...@us...> - 2004-12-05 19:38:13
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21423/Common/source Modified Files: Tag: New_Tables_Experiment-branch about.c Log Message: Bump release counter to -NT5. Index: about.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/about.c,v retrieving revision 1.4.2.4 retrieving revision 1.4.2.5 diff -C2 -d -r1.4.2.4 -r1.4.2.5 *** about.c 4 Dec 2004 21:52:13 -0000 1.4.2.4 --- about.c 5 Dec 2004 19:37:59 -0000 1.4.2.5 *************** *** 798,802 **** #if defined(flrecyclehashnodes) || defined(flrecyclehashnodes) || defined(fltablesortorderisarray) ! pushstring ("\x04" "-NT4", bs); #endif --- 798,802 ---- #if defined(flrecyclehashnodes) || defined(flrecyclehashnodes) || defined(fltablesortorderisarray) ! pushstring ("\x04" "-NT5", bs); #endif |