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-11-28 08:39:16
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv935 Modified Files: Tag: sidewinder-branch langpython.c Log Message: lesson learned: call evaluatetree on your params Index: langpython.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langpython.c,v retrieving revision 1.2.4.18 retrieving revision 1.2.4.19 diff -C2 -d -r1.2.4.18 -r1.2.4.19 *** langpython.c 28 Nov 2004 06:51:47 -0000 1.2.4.18 --- langpython.c 28 Nov 2004 08:38:42 -0000 1.2.4.19 *************** *** 1604,1610 **** while (nomad != nil) { PyObject *arg; ! convertfrontiervalue(&((**nomad).nodeval), &arg); ! PyList_Append(argList, arg); nomad = (**nomad).link; } --- 1604,1618 ---- while (nomad != nil) { PyObject *arg; ! hdltreenode thisNode = nomad; nomad = (**nomad).link; + (**thisNode).link = nil; + if ((**thisNode).nodetype == constop) { + convertfrontiervalue(&((**thisNode).nodeval), &arg); + } else { + tyvaluerecord tvr; + evaluatetree(thisNode, &tvr); + convertfrontiervalue(&tvr, &arg); + } + PyList_Append(argList, arg); } |
|
From: David B. <dav...@us...> - 2004-11-28 08:30:46
|
Update of /cvsroot/frontierkernel/Frontier/Common/headers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14927/headers Modified Files: Tag: sidewinder-branch langpython.h Log Message: misc cleanup Index: langpython.h =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/headers/langpython.h,v retrieving revision 1.1.4.3 retrieving revision 1.1.4.4 diff -C2 -d -r1.1.4.3 -r1.1.4.4 *** langpython.h 28 Nov 2004 00:40:19 -0000 1.1.4.3 --- langpython.h 28 Nov 2004 06:51:46 -0000 1.1.4.4 *************** *** 28,37 **** - boolean runstringverb(hdltreenode hp1, tyvaluerecord *v); - boolean pythongetdict(Handle htext, tyvaluerecord *tvr); - boolean callpython(hdltreenode htree, tyvaluerecord *vreturned); boolean compilepython(Handle htext, tyvaluerecord *tvr); boolean ispythonnode(hdltreenode, tyvaluerecord *); ! boolean callpythonscript(tyvaluerecord, hdltreenode, bigstring, tyvaluerecord *); --- 28,35 ---- boolean compilepython(Handle htext, tyvaluerecord *tvr); boolean ispythonnode(hdltreenode, tyvaluerecord *); ! boolean callpythonscript(tyvaluerecord, hdltreenode, bigstring, tyvaluerecord *, boolean); ! boolean callpython(hdltreenode htree, tyvaluerecord *vreturned); |
|
From: David B. <dav...@us...> - 2004-11-28 08:22:06
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14927/source Modified Files: Tag: sidewinder-branch about.c langpython.c langvalue.c Log Message: misc cleanup Index: langvalue.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langvalue.c,v retrieving revision 1.5.4.1 retrieving revision 1.5.4.2 diff -C2 -d -r1.5.4.1 -r1.5.4.2 *** langvalue.c 28 Nov 2004 00:40:48 -0000 1.5.4.1 --- langvalue.c 28 Nov 2004 06:51:47 -0000 1.5.4.2 *************** *** 8101,8105 **** langsetthisvalue (currenthashtable, htable, bsname); ! fl = callpythonscript (pythoncode, hparam1, bsname, vreturned); langpopsourcecode (); --- 8101,8105 ---- langsetthisvalue (currenthashtable, htable, bsname); ! fl = callpythonscript (pythoncode, hparam1, bsname, vreturned, false); langpopsourcecode (); Index: about.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/about.c,v retrieving revision 1.4 retrieving revision 1.4.4.1 diff -C2 -d -r1.4 -r1.4.4.1 *** about.c 31 Oct 2004 13:02:23 -0000 1.4 --- about.c 28 Nov 2004 06:51:47 -0000 1.4.4.1 *************** *** 173,176 **** --- 173,178 ---- "\x23" "© 1992-" copyright_year_string " UserLand Software, Inc.", + + //"\x45" "(Portions © 2001, 2002, 2003 Python Software Foundation.)", #ifdef PIKE Index: langpython.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langpython.c,v retrieving revision 1.2.4.17 retrieving revision 1.2.4.18 diff -C2 -d -r1.2.4.17 -r1.2.4.18 *** langpython.c 28 Nov 2004 00:40:48 -0000 1.2.4.17 --- langpython.c 28 Nov 2004 06:51:47 -0000 1.2.4.18 *************** *** 519,563 **** static PyObject *frontierModule = NULL; - typedef struct { - PyObject *pyObject; - time_t cookie; - } FrontierPythonPtr; - - static boolean - getPythonPtr(FrontierPythonPtr *fpp, PyObject **pptr) { - if (fpp->cookie == currentCookie) { - *pptr = fpp->pyObject; - return true; - } - *pptr = NULL; - return false; - } - - static boolean - frontierToPython(tyvaluerecord *tvr, PyObject **pptr) { - if (tvr->valuetype != binaryvaluetype) - return false; - - if (gethandlesize(tvr->data.binaryvalue) != sizeof(FrontierPythonPtr)) - return false; - - if (!getPythonPtr((FrontierPythonPtr *)(*(tvr->data.binaryvalue)), pptr)) - return false; - - return true; - } - - static boolean - pythonToFrontier(PyObject *pptr, tyvaluerecord *tvr) { - FrontierPythonPtr fpp; - fpp.pyObject = pptr; - fpp.cookie = currentCookie; - - if (!newheapvalue(&fpp, sizeof(FrontierPythonPtr), binaryvaluetype, tvr)) - return false; - - return true; - } - static boolean convertPython(PyObject *, hdlhashtable, bigstring); --- 519,522 ---- *************** *** 1416,1419 **** --- 1375,1387 ---- } + static void + safeaddobject(PyObject *m, char *name, PyObject *obj) { + if (obj) { + PyModule_AddObject(m, name, obj); + } else { + printf("safeaddobject: null for %s\n", name); + } + } + static boolean addModuleVars(PyObject *m) { *************** *** 1429,1438 **** return false; ! //PyModule_AddObject(m, "examples", fetchAux("examples")); ! //PyModule_AddObject(m, "scratchpad", fetchAux("scratchpad")); ! //PyModule_AddObject(m, "suites", fetchAux("suites")); ! //PyModule_AddObject(m, "user", fetchAux("user")); ! //PyModule_AddObject(m, "websites", fetchAux("websites")); ! //PyModule_AddObject(m, "workspace", fetchAux("workspace")); return true; --- 1397,1406 ---- return false; ! safeaddobject(m, "examples", fetchAux("examples")); ! safeaddobject(m, "scratchpad", fetchAux("scratchpad")); ! safeaddobject(m, "suites", fetchAux("suites")); ! safeaddobject(m, "user", fetchAux("user")); ! safeaddobject(m, "websites", fetchAux("websites")); ! safeaddobject(m, "workspace", fetchAux("workspace")); return true; *************** *** 1561,1713 **** } - boolean runstringverb(hdltreenode hp1, tyvaluerecord *v) { - Handle pythonCode; - tyvaluerecord adrOutput; - tyvaluerecord adrError; - hdlhashtable htableOutput; - hdlhashtable htableError; - bigstring locOutput; - bigstring locError; - PyObject *locals; - PyObject *result; - PyObject *err; - - if (!ispythonloaded()) - return false; - - // if Python hasn't been started, start it and create our globals. - // - startInterpreter(); - - locals = globals; // hack alert -- confirm why I need to do this - - // set up default frontier return value - // - if (!setbooleanvalue(true, v)) - return false; - - // first param: handle to python code string - // - if (!gettextvalue (hp1, 1, &pythonCode)) - return (false); - - // second param: pointer to var to store output - // - if (!getaddressparam(hp1, 2, &adrOutput)) - return (false); - - // third param: pointer to var for error output - // - if (!getaddressparam(hp1, 3, &adrError)) - return false; - - // derefernce pointer to output variable - // - if (!getaddressvalue(adrOutput, &htableOutput, locOutput)) - return (false); - - // dereference pointer to error output - // - if (!getaddressvalue(adrError, &htableError, locError)) - return (false); - - // convert the text to a C string - // - if (!enlargehandle(pythonCode, gethandlesize(pythonCode) + 1, "\0")) - return false; - - // set up the interpreter to capture the output - // - result = PyRun_String("from cStringIO import StringIO; import sys; _f_old_output = sys.stdout; _f_output = StringIO(); sys.stdout = _f_output; _f_old_err = sys.stderr; _f_err = StringIO(); sys.stderr = _f_err; del StringIO", Py_file_input, globals, locals); - if (result) Py_DECREF(result); - - // run the python code - // - lockhandle (pythonCode); - result = PyRun_String(*pythonCode, Py_file_input, globals, locals); - unlockhandle (pythonCode); - if (result) Py_DECREF(result); - err = PyErr_Occurred(); - - if (err) { - PyObject *ferr; - PyObject *outputString; - - PyErr_Print(); - - // get the error output - // - ferr = PyDict_GetItemString(locals, "_f_err"); - outputString = PyObject_CallMethod(ferr, "getvalue", NULL); - result = PyObject_CallMethod(ferr, "close", NULL); - if (result) Py_DECREF(result); - - bundle { - tyvaluerecord errorValue; - char *output = PyString_AsString(outputString); - - if (!newheapvalue(output, strlen(output), stringvaluetype, &errorValue)) { - Py_DECREF(outputString); - return false; - } - - exemptfromtmpstack(&errorValue); - - if (!hashtableassign(htableError, locError, errorValue)) { - Py_DECREF(outputString); - return false; - } - - if (!setbooleanvalue(false, v)) { - Py_DECREF(outputString); - return false; - } - - Py_DECREF(outputString); - } - } - - bundle { - PyObject *foutput; - PyObject *outputString; - char *output; - tyvaluerecord outputValue; - boolean retcode = true; - - // get the output - // - foutput = PyDict_GetItemString(locals, "_f_output"); - outputString = PyObject_CallMethod(foutput, "getvalue", NULL); - result = PyObject_CallMethod(foutput, "close", NULL); - if (result) Py_DECREF(result); - - // convert the output from a python string into a cstring - // - output = PyString_AsString(outputString); - - // copy the output into the frontier variable that was passed in - // - if (!newheapvalue(output, strlen(output), stringvaluetype, &outputValue)) - retcode = false; - - exemptfromtmpstack(&outputValue); - - if (retcode && !hashtableassign(htableOutput, locOutput, outputValue)) - retcode = false; - - // erase all sign of us - // - result = PyRun_String("sys.stdout = _f_old_output; sys.stderr = _f_old_err", Py_file_input, globals, locals); - if (result) Py_DECREF(result); - - Py_DECREF(outputString); - //Py_DECREF(locals); - - return retcode; - } - } - static boolean pythonfunctionvalue (short token, hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) { ! hdltreenode hp1 = hparam1; tyvaluerecord *v = vreturned; --- 1529,1534 ---- } static boolean pythonfunctionvalue (short token, hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) { ! //hdltreenode hp1 = hparam1; tyvaluerecord *v = vreturned; *************** *** 1722,1727 **** return stopInterpreter(); ! case runstringfunc: ! return runstringverb(hp1, v); default: --- 1543,1548 ---- return stopInterpreter(); ! //case runstringfunc: ! // return runstringverb(hp1, v); default: *************** *** 1748,1864 **** } - boolean pythongetdict(Handle htext, tyvaluerecord *tvr) { - PyObject *dict; - PyObject *result; - - startInterpreter(); - - dict = PyDict_New(); - - makeGlobals(dict, "__compile__"); - - // execute the python - - // convert the text to a C string - // - if (!enlargehandle(htext, gethandlesize(htext) + 1, "\0")) - return false; - - // lock the text - lockhandle(htext); - - convertreturns(htext); - result = PyRun_String(*htext, Py_file_input, dict, dict); - if (result) Py_DECREF(result); - - // unlock the text - unlockhandle(htext); - - // handle errors - if (PyErr_Occurred()) { - PyErr_Print(); - PyErr_Clear(); - return false; - } - - // store the python dict in the tvr - if (!pythonToFrontier(dict, tvr)) - return false; - - return true; - } - - boolean callpython(hdltreenode htree, tyvaluerecord *vreturned) { - PyObject *globals; - PyObject *result; - Handle htext; - - startInterpreter(); - - globals = PyDict_New(); - - makeGlobals(globals, "__compile__"); - - // execute the python - - // convert the text to a C string - // - htext = (**htree).nodeval.data.stringvalue; - if (!enlargehandle(htext, gethandlesize(htext) + 1, "\0")) - return false; - - // lock the text - lockhandle(htext); - - convertreturns(htext); - result = PyRun_String(*htext, Py_file_input, globals, globals); - if (result) Py_DECREF(result); - - // unlock the text - unlockhandle(htext); - - // handle errors - if (PyErr_Occurred()) { - PyErr_Print(); - PyErr_Clear(); - return false; - } - - bundle { // run the code - PyObject *keys; - int len, i; - PyObject *value; - PyObject *func = NULL; - - // find the function that was just defined - // - // for right now, just find the first function defined in the namespace - // - keys = PyDict_Keys(globals); - len = PyList_GET_SIZE(keys); - for (i = 0; i < len; i++) { - value = PyDict_GetItem(globals, PyList_GET_ITEM(keys, i)); - if (PyCallable_Check(value)) { - func = value; - break; - } - } - - if (!func) - return false; - - // BUGBUG stopgap coding - - // convert the calling parameters - - // call it - PyObject_CallFunction(func, "()"); - - // convert the return value - } - - return true; - } - boolean compilepython(Handle htext, tyvaluerecord *tvr) { Handle newtext; --- 1569,1572 ---- *************** *** 1904,1916 **** } ! boolean callpythonscript(tyvaluerecord code, hdltreenode hparam1, bigstring bsname, tyvaluerecord *vreturned) { PyObject *globals; PyObject *result; Handle htext; startInterpreter(); globals = PyDict_New(); ! makeGlobals(globals, "__compile__"); // execute the python --- 1612,1628 ---- } ! boolean callpythonscript(tyvaluerecord code, hdltreenode hparam1, bigstring bsname, tyvaluerecord *vreturned, boolean runbutton) { PyObject *globals; PyObject *result; Handle htext; + startInterpreter(); globals = PyDict_New(); ! if (runbutton) ! makeGlobals(globals, "__main__"); ! else ! makeGlobals(globals, "__compile__"); // execute the python *************** *** 1925,1928 **** --- 1637,1641 ---- lockhandle(htext); + // run it convertreturns(htext); result = PyRun_String(*htext, Py_file_input, globals, globals); *************** *** 1939,1943 **** } ! bundle { // run the code PyObject *func = NULL; PyObject *argList; --- 1652,1656 ---- } ! if (!runbutton) { // run the code PyObject *func = NULL; PyObject *argList; *************** *** 1946,1956 **** // find the function that was called - // func = PyDict_GetItemString(globals, funcName); if (!func) return false; - // BUGBUG stopgap coding - // convert the calling parameters argList = pythonconvertparameters(hparam1); --- 1659,1666 ---- *************** *** 1959,1962 **** --- 1669,1674 ---- result = PyObject_CallObject(func, argList); + Py_DECREF(argList); + // handle errors if (PyErr_Occurred()) { *************** *** 1977,1980 **** --- 1689,1699 ---- } + boolean callpython(hdltreenode htree, tyvaluerecord *vreturned) { + boolean result; + bigstring bs; + copyctopstring("", bs); + result = callpythonscript((**htree).nodeval, NULL, bs, vreturned, true); + return result; + } #endif |
|
From: David B. <dav...@us...> - 2004-11-28 00:41:06
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10468 Modified Files: Tag: sidewinder-branch langevaluate.c langpython.c langvalue.c scripts.c Log Message: enable usertalk to call python Index: scripts.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/scripts.c,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -C2 -d -r1.3 -r1.3.4.1 *** scripts.c 31 Oct 2004 13:02:23 -0000 1.3 --- scripts.c 28 Nov 2004 00:40:48 -0000 1.3.4.1 *************** *** 70,73 **** --- 70,77 ---- #endif + #if FRONTIER_PYTHON + #include "langpython.h" + #endif + enum { *************** *** 284,293 **** if (signature == typeLAND) return (langbuildtree (htext, true, hcode)); ! #ifdef flcomponent ! fl = osagetcode (htext, signature, false, &codeval); #else ! fl = false; #endif disposehandle (htext); --- 288,309 ---- if (signature == typeLAND) return (langbuildtree (htext, true, hcode)); ! ! #ifdef FRONTIER_PYTHON ! if (signature == typePython) { ! fl = compilepython (htext, &codeval); ! } ! else { ! #endif ! #ifdef flcomponent ! fl = osagetcode (htext, signature, false, &codeval); #else ! fl = false; ! #endif ! ! #ifdef FRONTIER_PYTHON ! } #endif + disposehandle (htext); *************** *** 300,304 **** return (false); ! (**hstub).nodetype = osascriptop; /* --- 316,326 ---- return (false); ! #ifdef FRONTIER_PYTHON ! if (signature == typePython) ! (**hstub).nodetype = pythonscriptop; ! else ! #endif ! (**hstub).nodetype = osascriptop; ! /* *************** *** 3568,3571 **** --- 3590,3599 ---- bigstring bsname; + #ifdef FRONTIER_PYTHON + // a naive attempt to inject Python into the list + copyctopstring("Python", bsname); + (*visit)(typePython, bsname, refcon); + #endif + if (!havecomponentmanager ()) return (false); Index: langvalue.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langvalue.c,v retrieving revision 1.5 retrieving revision 1.5.4.1 diff -C2 -d -r1.5 -r1.5.4.1 *** langvalue.c 31 Oct 2004 21:43:38 -0000 1.5 --- langvalue.c 28 Nov 2004 00:40:48 -0000 1.5.4.1 *************** *** 53,56 **** --- 53,59 ---- #include "osacomponent.h" #endif + #ifdef FRONTIER_PYTHON + #include "langpython.h" + #endif #include "timedate.h" *************** *** 8054,8057 **** --- 8057,8063 ---- tyvaluerecord osacode; #endif + #if (version5orgreater && defined (FRONTIER_PYTHON)) + tyvaluerecord pythoncode; + #endif #if version5orgreater // do special case checking here, not in langrunhandlercode *************** *** 8086,8089 **** --- 8092,8111 ---- #endif // flcomponent + + #ifdef FRONTIER_PYTHON + if (ispythonnode (hcode, &pythoncode)) { + if (!langpushsourcecode (htable, hnode, bsname)) + return (false); + + // 5.0a18 dmb: this probably isn't adequate for osa execution + langsetthisvalue (currenthashtable, htable, bsname); + + fl = callpythonscript (pythoncode, hparam1, bsname, vreturned); + + langpopsourcecode (); + + return (fl); + } + #endif #endif // version5orgreater Index: langevaluate.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langevaluate.c,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -C2 -d -r1.3 -r1.3.4.1 *** langevaluate.c 30 Oct 2004 23:11:36 -0000 1.3 --- langevaluate.c 28 Nov 2004 00:40:47 -0000 1.3.4.1 *************** *** 40,43 **** --- 40,47 ---- #endif + #ifdef FRONTIER_PYTHON + #include "langpython.h" + #endif + #define fltryerrorstackcode false *************** *** 1561,1565 **** op = (**h).nodetype; /*copy into register*/ ! ctparams = (**h).ctparams; --- 1565,1569 ---- op = (**h).nodetype; /*copy into register*/ ! ctparams = (**h).ctparams; *************** *** 1879,1882 **** --- 1883,1892 ---- return (evaluateosascript (&val1, nil, zerostring, valtree)); #endif + + #ifdef FRONTIER_PYTHON + case pythonscriptop: + return callpython (htree, valtree); + + #endif default: Index: langpython.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langpython.c,v retrieving revision 1.2.4.16 retrieving revision 1.2.4.17 diff -C2 -d -r1.2.4.16 -r1.2.4.17 *** langpython.c 25 Nov 2004 13:13:58 -0000 1.2.4.16 --- langpython.c 28 Nov 2004 00:40:48 -0000 1.2.4.17 *************** *** 210,213 **** --- 210,221 ---- PyTypeObject * ptr_PyUnicode_Type; /*unicodeobject.h*/ + + int (*ptr_PyCallable_Check) (PyObject *); /*abstract.h*/ + PyObject * (*ptr_PyObject_Call) (PyObject *, PyObject *, PyObject *); + PyObject * (*ptr_PyObject_CallFunction) (PyObject *, char *, ...); + + PyObject * (*ptr_PyList_AsTuple) (PyObject *); + PyObject * (*ptr_PyObject_CallObject) (PyObject *, PyObject *); + } py; *************** *** 302,305 **** --- 310,318 ---- #define PyUnicode_Type (*py.ptr_PyUnicode_Type) + #define PyCallable_Check (*py.ptr_PyCallable_Check) + #define PyObject_Call (*py.ptr_PyObject_Call) + #define PyObject_CallFunction (*py.ptr_PyObject_CallFunction) + #define PyList_AsTuple (*py.ptr_PyList_AsTuple) + #define PyObject_CallObject (*py.ptr_PyObject_CallObject) static boolean importsymbol (typythonlib hm, char *symbol, void **ptraddress) { *************** *** 429,432 **** --- 442,452 ---- fl = fl && IMPORTSYMBOL (hm, PyUnicode_Type); + + fl = fl && IMPORTSYMBOL (hm, PyCallable_Check); + fl = fl && IMPORTSYMBOL (hm, PyObject_Call); + fl = fl && IMPORTSYMBOL (hm, PyObject_CallFunction); + + fl = fl && IMPORTSYMBOL (hm, PyList_AsTuple); + fl = fl && IMPORTSYMBOL (hm, PyObject_CallObject); if (fl) { *************** *** 447,452 **** - #if 0 - static boolean ispythonloaded (void) { --- 467,470 ---- *************** *** 455,458 **** --- 473,478 ---- + #if 0 + static void freepythonlib (void) { *************** *** 504,509 **** } FrontierPythonPtr; - #if 0 - /* static boolean getPythonPtr(FrontierPythonPtr *fpp, PyObject **pptr) { --- 524,527 ---- *************** *** 541,546 **** return true; } - */ - #endif static boolean convertPython(PyObject *, hdlhashtable, bigstring); --- 559,562 ---- *************** *** 571,574 **** --- 587,656 ---- } + static boolean pythontofrontier(PyObject *obj, tyvaluerecord *tvr) { + PyTypeObject *ob_type = obj->ob_type; + + setbooleanvalue(false, tvr); + + if (ob_type == &PyFloat_Type) { + + double d = PyFloat_AsDouble(obj); + if (!setdoublevalue(d, tvr)) + return false; + + } else if (ob_type == &PyInt_Type) { + + long l = PyInt_AsLong(obj); + if (!setlongvalue(l, tvr)) + return false; + + } else if (ob_type == &PyLong_Type) { + + long l = PyInt_AsLong(obj); + if (!setlongvalue(l, tvr)) + return false; + + } else if (ob_type == &PyString_Type) { + + char *s = PyString_AsString(obj); + if (!newheapvalue(s, strlen(s), stringvaluetype, tvr)) + return false; + + } else if (ob_type == &PyDict_Type) { + + //return convertPythonDict(obj, hdl, name); + return false; + + } else if (ob_type == &PyComplex_Type) { + + return false; + + } else if (ob_type == &PyInstance_Type) { + + //return convertPythonDict(PyObject_GetAttrString(obj, "__dict__"), hdl, name); + return false; + + } else if (ob_type == &PyList_Type) { + //printf("list\n"); + } else if (ob_type == &PyFile_Type) { + //printf("file\n"); + } else if (ob_type == &PyMethod_Type) { + //printf("method\n"); + } else if (ob_type == &PyModule_Type) { + //printf("module\n"); + } else if (ob_type == &PySeqIter_Type) { + //printf("seqiter\n"); + } else if (ob_type == &PySlice_Type) { + //printf("slice\n"); + } else if (ob_type == &PyTuple_Type) { + //printf("tuple\n"); + } else if (ob_type == &PyType_Type) { + //printf("type\n"); + } else if (ob_type == &PyUnicode_Type) { + //printf("unicode\n"); + } + + return false; + } + static boolean convertPython(PyObject *obj, hdlhashtable hdl, bigstring name) { *************** *** 617,621 **** if (!langassignnewtablevalue(hdl, name, &newTable)) return false; ! r = PyComplex_RealAsDouble(obj); i = PyComplex_ImagAsDouble(obj); --- 699,703 ---- if (!langassignnewtablevalue(hdl, name, &newTable)) return false; ! r = PyComplex_RealAsDouble(obj); i = PyComplex_ImagAsDouble(obj); *************** *** 644,648 **** return convertPythonDict(PyObject_GetAttrString(obj, "__dict__"), hdl, name); ! } else if (ob_type == &PyList_Type) { //printf("list\n"); --- 726,730 ---- return convertPythonDict(PyObject_GetAttrString(obj, "__dict__"), hdl, name); ! } else if (ob_type == &PyList_Type) { //printf("list\n"); *************** *** 1347,1356 **** return false; ! PyModule_AddObject(m, "examples", fetchAux("examples")); ! PyModule_AddObject(m, "scratchpad", fetchAux("scratchpad")); ! PyModule_AddObject(m, "suites", fetchAux("suites")); ! PyModule_AddObject(m, "user", fetchAux("user")); ! PyModule_AddObject(m, "websites", fetchAux("websites")); ! PyModule_AddObject(m, "workspace", fetchAux("workspace")); return true; --- 1429,1438 ---- return false; ! //PyModule_AddObject(m, "examples", fetchAux("examples")); ! //PyModule_AddObject(m, "scratchpad", fetchAux("scratchpad")); ! //PyModule_AddObject(m, "suites", fetchAux("suites")); ! //PyModule_AddObject(m, "user", fetchAux("user")); ! //PyModule_AddObject(m, "websites", fetchAux("websites")); ! //PyModule_AddObject(m, "workspace", fetchAux("workspace")); return true; *************** *** 1415,1428 **** PyObject *globals = 0; ! static boolean initGlobals() { ! if (globals) ! return true; ! ! globals = PyDict_New(); ! if (PyDict_SetItemString(globals, "__builtins__", PyEval_GetBuiltins())) return false; ! if (PyDict_SetItemString(globals, "__name__", PyString_FromString("__main__"))) return false; --- 1497,1505 ---- PyObject *globals = 0; ! static boolean makeGlobals(PyObject *globals, char *name) { if (PyDict_SetItemString(globals, "__builtins__", PyEval_GetBuiltins())) return false; ! if (PyDict_SetItemString(globals, "__name__", PyString_FromString(name))) return false; *************** *** 1433,1436 **** --- 1510,1525 ---- } + static boolean initGlobals() { + if (globals) + return true; + + globals = PyDict_New(); + + if (!makeGlobals(globals, "__main__")) + return false; + + return true; + } + static boolean disposeGlobals() { if (globals) { *************** *** 1442,1445 **** --- 1531,1537 ---- static boolean startInterpreter() { + if (!ispythonloaded()) + return false; + if (!Py_IsInitialized()) { Py_Initialize(); *************** *** 1457,1460 **** --- 1549,1555 ---- static boolean stopInterpreter() { + if (!ispythonloaded()) + return false; + if (Py_IsInitialized()) { disposeGlobals(); *************** *** 1478,1481 **** --- 1573,1579 ---- PyObject *err; + if (!ispythonloaded()) + return false; + // if Python hasn't been started, start it and create our globals. // *************** *** 1642,1644 **** --- 1740,1980 ---- } + static void + convertreturns(Handle htext) { + int len = gethandlesize(htext); + for (int i = 0; i < len; i++) + if ((*htext)[i] == '\r') + (*htext)[i] = '\n'; + } + + boolean pythongetdict(Handle htext, tyvaluerecord *tvr) { + PyObject *dict; + PyObject *result; + + startInterpreter(); + + dict = PyDict_New(); + + makeGlobals(dict, "__compile__"); + + // execute the python + + // convert the text to a C string + // + if (!enlargehandle(htext, gethandlesize(htext) + 1, "\0")) + return false; + + // lock the text + lockhandle(htext); + + convertreturns(htext); + result = PyRun_String(*htext, Py_file_input, dict, dict); + if (result) Py_DECREF(result); + + // unlock the text + unlockhandle(htext); + + // handle errors + if (PyErr_Occurred()) { + PyErr_Print(); + PyErr_Clear(); + return false; + } + + // store the python dict in the tvr + if (!pythonToFrontier(dict, tvr)) + return false; + + return true; + } + + boolean callpython(hdltreenode htree, tyvaluerecord *vreturned) { + PyObject *globals; + PyObject *result; + Handle htext; + + startInterpreter(); + + globals = PyDict_New(); + + makeGlobals(globals, "__compile__"); + + // execute the python + + // convert the text to a C string + // + htext = (**htree).nodeval.data.stringvalue; + if (!enlargehandle(htext, gethandlesize(htext) + 1, "\0")) + return false; + + // lock the text + lockhandle(htext); + + convertreturns(htext); + result = PyRun_String(*htext, Py_file_input, globals, globals); + if (result) Py_DECREF(result); + + // unlock the text + unlockhandle(htext); + + // handle errors + if (PyErr_Occurred()) { + PyErr_Print(); + PyErr_Clear(); + return false; + } + + bundle { // run the code + PyObject *keys; + int len, i; + PyObject *value; + PyObject *func = NULL; + + // find the function that was just defined + // + // for right now, just find the first function defined in the namespace + // + keys = PyDict_Keys(globals); + len = PyList_GET_SIZE(keys); + for (i = 0; i < len; i++) { + value = PyDict_GetItem(globals, PyList_GET_ITEM(keys, i)); + if (PyCallable_Check(value)) { + func = value; + break; + } + } + + if (!func) + return false; + + // BUGBUG stopgap coding + + // convert the calling parameters + + // call it + PyObject_CallFunction(func, "()"); + + // convert the return value + } + + return true; + } + + boolean compilepython(Handle htext, tyvaluerecord *tvr) { + Handle newtext; + + if (!copyhandle(htext, &newtext)) + return false; + + if (!newheapvalue(*newtext, gethandlesize(newtext), stringvaluetype, tvr)) + return false; + + //exemptfromtmpstack(&newtext); + + return true; + } + + boolean ispythonnode(hdltreenode htree, tyvaluerecord *tvr) { + register hdltreenode h = htree; + + if ((**h).nodetype == moduleop) + h = (**h).param1; + + if ((**h).nodetype != pythonscriptop) + return (false); + + *tvr = (**h).nodeval; + + return (true); + } + + static PyObject * + pythonconvertparameters(hdltreenode hparams) { + register hdltreenode nomad = hparams; + PyObject *argList = PyList_New(0); + + while (nomad != nil) { + PyObject *arg; + convertfrontiervalue(&((**nomad).nodeval), &arg); + PyList_Append(argList, arg); + nomad = (**nomad).link; + } + + return PyList_AsTuple(argList); + } + + boolean callpythonscript(tyvaluerecord code, hdltreenode hparam1, bigstring bsname, tyvaluerecord *vreturned) { + PyObject *globals; + PyObject *result; + Handle htext; + startInterpreter(); + + globals = PyDict_New(); + + makeGlobals(globals, "__compile__"); + + // execute the python + + // convert the text to a C string + // + htext = code.data.stringvalue; + if (!enlargehandle(htext, gethandlesize(htext) + 1, "\0")) + return false; + + // lock the text + lockhandle(htext); + + convertreturns(htext); + result = PyRun_String(*htext, Py_file_input, globals, globals); + if (result) Py_DECREF(result); + + // unlock the text + unlockhandle(htext); + + // handle errors + if (PyErr_Occurred()) { + PyErr_Print(); + PyErr_Clear(); + return false; + } + + bundle { // run the code + PyObject *func = NULL; + PyObject *argList; + char funcName[sizeof(bigstring)]; + copyptocstring(bsname, funcName); + + // find the function that was called + // + func = PyDict_GetItemString(globals, funcName); + if (!func) + return false; + + // BUGBUG stopgap coding + + // convert the calling parameters + argList = pythonconvertparameters(hparam1); + + // call it + result = PyObject_CallObject(func, argList); + + // handle errors + if (PyErr_Occurred()) { + PyErr_Print(); + PyErr_Clear(); + return false; + } + + // convert the return value + if (!pythontofrontier(result, vreturned)) { + if (result) Py_DECREF(result); + return false; + } + if (result) Py_DECREF(result); + } + + return true; + } + + #endif |
|
From: David B. <dav...@us...> - 2004-11-28 00:40:37
|
Update of /cvsroot/frontierkernel/Frontier/Common/headers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10392 Modified Files: Tag: sidewinder-branch lang.h langpython.h Log Message: enable usertalk to call python Index: lang.h =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/headers/lang.h,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 *** lang.h 10 Nov 2004 18:18:24 -0000 1.6 --- lang.h 28 Nov 2004 00:40:19 -0000 1.6.2.1 *************** *** 27,31 **** #define langinclude /*so other includes can tell if we've been loaded*/ - #ifndef shelltypesinclude --- 27,30 ---- *************** *** 179,182 **** --- 178,183 ---- dividevalueop = 61, + pythonscriptop = 62, + cttreetypes } tytreetype; Index: langpython.h =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/headers/langpython.h,v retrieving revision 1.1.4.2 retrieving revision 1.1.4.3 diff -C2 -d -r1.1.4.2 -r1.1.4.3 *** langpython.h 23 Nov 2004 16:13:23 -0000 1.1.4.2 --- langpython.h 28 Nov 2004 00:40:19 -0000 1.1.4.3 *************** *** 29,32 **** --- 29,37 ---- boolean runstringverb(hdltreenode hp1, tyvaluerecord *v); + boolean pythongetdict(Handle htext, tyvaluerecord *tvr); + boolean callpython(hdltreenode htree, tyvaluerecord *vreturned); + boolean compilepython(Handle htext, tyvaluerecord *tvr); + boolean ispythonnode(hdltreenode, tyvaluerecord *); + boolean callpythonscript(tyvaluerecord, hdltreenode, bigstring, tyvaluerecord *); |
|
From: Terry T. <ter...@us...> - 2004-11-27 08:35:45
|
Update of /cvsroot/frontierkernel/Frontier/Common/resources/Mac In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9896/Frontier/Common/resources/Mac Modified Files: SHELL.R Log Message: [ 1073173 ] window.dbstats doesn't work on OS X. Index: SHELL.R =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/resources/Mac/SHELL.R,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SHELL.R 26 Oct 2004 10:14:27 -0000 1.4 --- SHELL.R 27 Nov 2004 08:33:07 -0000 1.5 *************** *** 2086,2090 **** --- 2086,2094 ---- 'BigD', 'STAT', + #if TARGET_API_MAC_CARBON + 133, /* normal window */ + #else 128, + #endif {100, 25, 175, 200}, 2, |
|
From: Andre R. <and...@us...> - 2004-11-25 13:14:08
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24136/Common/source Modified Files: Tag: sidewinder-branch langpython.c Log Message: Fixed pre-processor checks for CFM and OS8. Index: langpython.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langpython.c,v retrieving revision 1.2.4.15 retrieving revision 1.2.4.16 diff -C2 -d -r1.2.4.15 -r1.2.4.16 *** langpython.c 24 Nov 2004 19:19:59 -0000 1.2.4.15 --- langpython.c 25 Nov 2004 13:13:58 -0000 1.2.4.16 *************** *** 79,87 **** #endif /*TARGET_API_MAC_CARBON*/ ! #if TARGET_API_MAC_CLASSIC #error "Python integration is not yet supported in the PPC build" ! #endif /*TARGET_API_MAC_CLASSIC*/ #endif /*MACVERSION*/ --- 79,87 ---- #endif /*TARGET_API_MAC_CARBON*/ ! #if TARGET_API_MAC_OS8 #error "Python integration is not yet supported in the PPC build" ! #endif /*TARGET_API_MAC_OS8*/ #endif /*MACVERSION*/ *************** *** 91,95 **** ! #if defined(WIN95VERSION) || (defined(MACVERSION) && defined(TARGET_RT_MAC_MACHO)) /* --- 91,95 ---- ! #if defined(WIN95VERSION) || (defined(MACVERSION) && TARGET_RT_MAC_MACHO) /* |
|
From: Terry T. <ter...@us...> - 2004-11-25 09:32:07
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9874/Frontier/Common/source Modified Files: langstartup.c Log Message: Fixed a few things so the code can compile with CodeWarrior (both Mac OS and Windows). Index: langstartup.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langstartup.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** langstartup.c 24 Nov 2004 18:58:00 -0000 1.4 --- langstartup.c 25 Nov 2004 09:31:48 -0000 1.5 *************** *** 41,45 **** --- 41,47 ---- #include "resources.h" #include "WinSockNetEvents.h" + #if TARGET_API_MAC_CARBON == 1 #include "CallMachOFrameWork.h" /* 2004-11-19 creedon */ + #endif *************** *** 223,226 **** --- 225,238 ---- unsigned long x; + #if TARGET_API_MAC_CARBON == 1 /*PBS 7.028: system.environment.isCarbon*/ + + /* 2004-11-19 creedon - added hcommand, hreturn, bs, response */ + Handle hcommand, hreturn; + bigstring bs; + UInt32 response; + OSErr err; + + #endif + gestalt (gestaltSystemVersion, &x); *************** *** 244,252 **** #if TARGET_API_MAC_CARBON == 1 /*PBS 7.028: system.environment.isCarbon*/ - /* 2004-11-19 creedon - added hcommand, hreturn, bs, response */ - Handle hcommand, hreturn; - bigstring bs; - UInt32 response; - langassignbooleanvalue (ht, str_isCarbon, true); --- 256,259 ---- *************** *** 287,291 **** /* This needs to be checked on Mac OS Classic as well as Mac OS 9 proper. */ ! OSErr err = gestalt (gestaltMacOSCompatibilityBoxAttr, &response); if ((err == noErr) && ((response & (1 << gestaltMacOSCompatibilityBoxPresent)) != 0)) --- 294,298 ---- /* This needs to be checked on Mac OS Classic as well as Mac OS 9 proper. */ ! err = gestalt (gestaltMacOSCompatibilityBoxAttr, &response); if ((err == noErr) && ((response & (1 << gestaltMacOSCompatibilityBoxPresent)) != 0)) *************** *** 305,309 **** langassignbooleanvalue (ht, str_isCarbon, false); ! bsos = "\x06" "Mac OS" /* 2004-11-19 creedon - Mac OS, used to be Macintosh*/ isMacOsClassic = true; /* 2004-11-19 creedon */ --- 312,316 ---- langassignbooleanvalue (ht, str_isCarbon, false); ! copystring ("\x06" "Mac OS", bsos); /* 2004-11-19 creedon - Mac OS, used to be Macintosh*/ isMacOsClassic = true; /* 2004-11-19 creedon */ |
|
From: Andre R. <and...@us...> - 2004-11-24 20:48:45
|
Update of /cvsroot/frontierkernel/Frontier/Common/headers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15457/Common/headers Modified Files: Tag: New_Tables_Experiment-branch frontierdefs.h lang.h langinternal.h Log Message: Retired flv10tables pre-processor definition. Code that was ifdef'd for it has been permanently enabled. We are going to make more changes soon that require the new code, but ifdef'ing the new stuff as well would be too complex. Index: lang.h =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/headers/lang.h,v retrieving revision 1.4.2.6 retrieving revision 1.4.2.7 diff -C2 -d -r1.4.2.6 -r1.4.2.7 *** lang.h 21 Nov 2004 20:15:25 -0000 1.4.2.6 --- lang.h 24 Nov 2004 20:48:17 -0000 1.4.2.7 *************** *** 448,456 **** byte ctlocks: 8; - #ifdef flv10tables - unsigned long hashval; /*2004-11-10 aradke: cache of hashfunction(hashkey)*/ - - #endif byte hashkey []; /*the identifier of this table element, lives in extension of record*/ --- 448,452 ---- *************** *** 463,491 **** ! #ifdef flv10tables ! ! 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)) ! #else ! #define ctbuckets 11 /*should be a prime number?*/ ! ! #define nthhashbucket(ht,i) ((**(ht)).hashbucket[i]) ! ! #define gethashbucketcount(ht) ctbuckets ! ! #define hashtobucketindex(ht,hash) hash /*already handled in hash function*/ ! #endif --- 459,473 ---- ! 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)) *************** *** 495,500 **** typedef struct tyhashtable { - #ifdef flv10tables - hdlhashbucketarray hbuckets; /*handle to an array of hash node handles*/ --- 477,480 ---- *************** *** 505,514 **** unsigned long ctnodes; /*number of nodes in the table*/ - #else - - hdlhashnode hashbucket [ctbuckets]; - - #endif - #ifdef fltablesortorderisarray --- 485,488 ---- Index: frontierdefs.h =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/headers/frontierdefs.h,v retrieving revision 1.2.2.4 retrieving revision 1.2.2.5 diff -C2 -d -r1.2.2.4 -r1.2.2.5 *** frontierdefs.h 15 Nov 2004 20:52:08 -0000 1.2.2.4 --- frontierdefs.h 24 Nov 2004 20:48:16 -0000 1.2.2.5 *************** *** 76,80 **** #undef lazythis_optimization #undef langexternalfind_optimization - #define flv10tables 1 /* 2004-11-10 aradke: for new hash table implementation [EXPERIMENTAL] */ #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] */ --- 76,79 ---- Index: langinternal.h =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/headers/langinternal.h,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -d -r1.3.2.1 -r1.3.2.2 *** langinternal.h 10 Nov 2004 17:21:46 -0000 1.3.2.1 --- langinternal.h 24 Nov 2004 20:48:17 -0000 1.3.2.2 *************** *** 416,424 **** extern boolean hashflushcache (long *); /*langhash.h*/ ! #ifdef flv10tables ! extern unsigned long hashfunction (const bigstring); /* 2004-11-10 aradke */ ! #else ! extern short hashfunction (const bigstring); ! #endif extern boolean hashresolvevalue (hdlhashtable, hdlhashnode); --- 416,420 ---- extern boolean hashflushcache (long *); /*langhash.h*/ ! extern unsigned long hashfunction (const bigstring); /* 2004-11-10 aradke */ extern boolean hashresolvevalue (hdlhashtable, hdlhashnode); |
|
From: Andre R. <and...@us...> - 2004-11-24 20:48:30
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15457/Common/source Modified Files: Tag: New_Tables_Experiment-branch langhash.c tablevalidate.c Log Message: Retired flv10tables pre-processor definition. Code that was ifdef'd for it has been permanently enabled. We are going to make more changes soon that require the new code, but ifdef'ing the new stuff as well would be too complex. Index: tablevalidate.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/tablevalidate.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 *** tablevalidate.c 15 Nov 2004 22:43:07 -0000 1.3.2.4 --- tablevalidate.c 24 Nov 2004 20:48:17 -0000 1.3.2.5 *************** *** 122,126 **** } - #ifdef flv10tables if (hashfunction (bs) != (**x).hashval) { --- 122,125 ---- *************** *** 138,150 **** return (false); } - #else - if (hashfunction (bs) != i) { - - if (flalert) - shellinternalerror (idbadbucketliststring, "\x1b" "bad string in a bucket list"); - - return (false); - } - #endif if (!gettablevariable ((**x).val, &hvariable, &errcode)) --- 137,140 ---- Index: langhash.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langhash.c,v retrieving revision 1.4.2.16 retrieving revision 1.4.2.17 diff -C2 -d -r1.4.2.16 -r1.4.2.17 *** langhash.c 21 Nov 2004 20:15:26 -0000 1.4.2.16 --- langhash.c 24 Nov 2004 20:48:17 -0000 1.4.2.17 *************** *** 163,167 **** ! #if defined(flv10tables) && defined (flrecyclehashbuckets) /* --- 163,167 ---- ! #ifdef flrecyclehashbuckets /* *************** *** 438,503 **** ! #ifdef flv10tables ! ! static boolean newhashbucketarray (unsigned long logsize, hdlhashbucketarray *hbuckets) { ! ! #ifdef flrecyclehashbuckets ! ! assert (logsize >= ctinitiallogsize); ! ! if (logsize < maxfreebucketlogsize) { ! ! hdlhashbucketarray hb = hfreebuckets[logsize]; ! if (hb != nil) { ! ! hfreebuckets[logsize] = (hdlhashbucketarray) (*hb)[0]; ! assert (gethandlesize ((Handle) hb) == (1 << logsize) * sizeof (hdlhashnode)); ! clearhandle ((Handle) hb); ! *hbuckets = hb; ! #ifdef fldebug ! hdebughashbucketsrecycled[logsize]++; ! #endif ! return (true); ! } #ifdef fldebug ! hdebughashbucketsallocated[logsize]++; #endif } - #endif ! return (newclearhandle ((1 << logsize) * sizeof (hdlhashnode), (Handle *) hbuckets)); ! } /*newhashbucketarray*/ - static void disposehashbucketarray (unsigned long logsize, hdlhashbucketarray hb) { - - #ifdef flrecyclehashbuckets ! assert (logsize >= ctinitiallogsize); ! if (logsize < maxfreebucketlogsize) { ! ! assert (gethandlesize ((Handle) hb) == (1 << logsize) * sizeof (hdlhashnode)); ! (*hb)[0] = (hdlhashnode) hfreebuckets[logsize]; ! hfreebuckets[logsize] = hb; ! return; ! } ! ! #endif ! disposehandle ((Handle) hb); ! } /*disposehashbucketarray*/ ! #endif --- 438,499 ---- ! static boolean newhashbucketarray (unsigned long logsize, hdlhashbucketarray *hbuckets) { ! ! #ifdef flrecyclehashbuckets ! ! assert (logsize >= ctinitiallogsize); ! if (logsize < maxfreebucketlogsize) { ! hdlhashbucketarray hb = hfreebuckets[logsize]; ! if (hb != nil) { ! ! hfreebuckets[logsize] = (hdlhashbucketarray) (*hb)[0]; ! assert (gethandlesize ((Handle) hb) == (1 << logsize) * sizeof (hdlhashnode)); ! clearhandle ((Handle) hb); ! *hbuckets = hb; #ifdef fldebug ! hdebughashbucketsrecycled[logsize]++; #endif + + return (true); } ! #ifdef fldebug ! hdebughashbucketsallocated[logsize]++; ! #endif ! } ! #endif + return (newclearhandle ((1 << logsize) * sizeof (hdlhashnode), (Handle *) hbuckets)); + } /*newhashbucketarray*/ ! static void disposehashbucketarray (unsigned long logsize, hdlhashbucketarray hb) { ! ! #ifdef flrecyclehashbuckets ! assert (logsize >= ctinitiallogsize); ! if (logsize < maxfreebucketlogsize) { ! ! assert (gethandlesize ((Handle) hb) == (1 << logsize) * sizeof (hdlhashnode)); ! (*hb)[0] = (hdlhashnode) hfreebuckets[logsize]; ! hfreebuckets[logsize] = hb; ! return; ! } ! ! #endif ! disposehandle ((Handle) hb); ! } /*disposehashbucketarray*/ *************** *** 523,530 **** hdlhashtable ht; ! #ifdef flv10tables ! hdlhashbucketarray hbuckets; ! unsigned long logsize = ctinitiallogsize; ! #endif #ifdef fltablesortorderisarray hdllist hsort; --- 519,524 ---- hdlhashtable ht; ! hdlhashbucketarray hbuckets; ! unsigned long logsize = ctinitiallogsize; #ifdef fltablesortorderisarray hdllist hsort; *************** *** 592,597 **** #endif - #ifdef flv10tables - if (!newhashbucketarray (logsize, &hbuckets)) { --- 586,589 ---- *************** *** 612,617 **** (**ht).bucketmask = (1 << logsize) - 1; - - #endif (**ht).timecreated = timenow (); --- 604,607 ---- *************** *** 623,628 **** - #ifdef flv10tables - static unsigned long ctresizedhashtables = 0; --- 613,616 ---- *************** *** 688,693 **** return (true); } /*resizehashtable*/ - - #endif /*flv10tables*/ --- 676,679 ---- *************** *** 1198,1206 **** dirtyhashtable (ht); - #ifdef flv10tables assert ((**ht).ctnodes == ctdisposed); (**ht).ctnodes = 0; - #endif return (ctdisposed); --- 1184,1190 ---- *************** *** 1269,1277 **** #endif - #ifdef flv10tables disposehashbucketarray ((**ht).logsize, (**ht).hbuckets); (**ht).hbuckets = nil; - #endif (**ht).prevhashtable = hfirstfreetable; /*queue for recycling*/ --- 1253,1259 ---- *************** *** 1283,1288 **** - #ifdef flv10tables - #if 0 --- 1265,1268 ---- *************** *** 1408,1412 **** #endif ! #else long hashfunction (const bigstring bs) { --- 1388,1392 ---- #endif ! #if 0 long hashfunction (const bigstring bs) { *************** *** 1437,1441 **** } /*hashfunction*/ ! #endif /*flv10tables*/ --- 1417,1421 ---- } /*hashfunction*/ ! #endif *************** *** 1565,1570 **** register hdlhashnode hnext; - #ifdef flv10tables - //if ((**htable).ctnodes > (1 << (**htable).logsize)) if (3 * (**htable).ctnodes > 2 * (1 << (**htable).logsize)) --- 1545,1548 ---- *************** *** 1589,1598 **** ixbucket = hashtobucketindex (ht, (**hn).hashval); - #else - - ixbucket = hashfunction ((**hn).hashkey); - - #endif - hnext = nthhashbucket (ht, ixbucket); --- 1567,1570 ---- *************** *** 1601,1609 **** (**hn).hashlink = hnext; - #ifdef flv10tables - (**htable).ctnodes++; - - #endif return (true); --- 1573,1577 ---- *************** *** 1677,1686 **** (**prev).hashlink = (**nomad).hashlink; - #ifdef flv10tables - (**htable).ctnodes--; - #endif - return (true); } /*hashunlinknode*/ --- 1645,1650 ---- *************** *** 1707,1713 **** hashunlinknode (htable, hnode); - #ifdef flv10tables (**hnode).hashval = hashfunction (bs); /*keep in sync with hashkey*/ - #endif copystring (bs, (**hnode).hashkey); --- 1671,1675 ---- *************** *** 1770,1776 **** #endif - #ifdef flv10tables (**hn).hashval = hashfunction (bskey); /*cache for re-use*/ - #endif copystring (bskey, (**hn).hashkey); --- 1732,1736 ---- *************** *** 1915,1923 **** */ - #ifdef flv10tables ixbucket = hashtobucketindex (currenthashtable, hashfunction (bs)); - #else - ixbucket = hashfunction (bs); - #endif //assert (currenthashtable != nil); --- 1875,1879 ---- *************** *** 1975,1996 **** if (hprev == nil) { - #ifdef flv10tables - assert ((**hn).hashval == hashfunction (bs)); nthhashbucket (currenthashtable, hashtobucketindex (currenthashtable, (**hn).hashval)) = (**hn).hashlink; - - #else - - nthhashbucket (currenthashtable, hashfunction (bs)) = (**hn).hashlink; - - #endif } else (**hprev).hashlink = (**hn).hashlink; - #ifdef flv10tables (**currenthashtable).ctnodes--; - #endif hashsorteddelete (hn); --- 1931,1942 ---- *************** *** 4109,4140 **** */ ! #ifdef flv10tables ! ! *ctitems = (**htable).ctnodes; ! ! #else ! ! #ifdef fltablesortorderisarray ! *ctitems = listcount ((**htable).hsortedlist); ! #else ! ! register hdlhashnode nomad = (**htable).hfirstsort; ! register long ct = 0; ! while (nomad != nil) { ! ! ct++; ! ! nomad = (**nomad).sortedlink; ! } /*while*/ ! ! *ctitems = ct; ! ! #endif ! ! #endif return (true); } /*hashcountitems*/ --- 4055,4074 ---- */ ! /* ! register hdlhashnode nomad = (**htable).hfirstsort; ! register long ct = 0; ! while (nomad != nil) { ! ct++; ! nomad = (**nomad).sortedlink; ! } /%while%/ ! ! *ctitems = ct; ! */ + *ctitems = (**htable).ctnodes; + return (true); } /*hashcountitems*/ |
|
From: Andre R. <and...@us...> - 2004-11-24 19:20:20
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26105 Modified Files: Tag: sidewinder-branch langpython.c Log Message: Added static ispythonloaded function (unused so far). Slightly simplified adding more import symbols with a little pre-processor magic. Index: langpython.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langpython.c,v retrieving revision 1.2.4.14 retrieving revision 1.2.4.15 diff -C2 -d -r1.2.4.14 -r1.2.4.15 *** langpython.c 24 Nov 2004 18:52:20 -0000 1.2.4.14 --- langpython.c 24 Nov 2004 19:19:59 -0000 1.2.4.15 *************** *** 301,330 **** #define PyUnicode_Type (*py.ptr_PyUnicode_Type) - - #if defined(WIN95VERSION) - static boolean importsymbol (HMODULE hm, LPCSTR symbol, void **ptraddress) { - - *ptraddress = (void*) GetProcAddress (hm, symbol); - - return (*ptraddress != NULL); - } /*importsymbol*/ ! #elif defined(MACVERSION) ! static boolean importsymbol (CFBundleRef hm, char *symbol, void **ptraddress) { - CFStringRef symbolref; - - symbolref = CFStringCreateWithCString (kCFAllocatorSystemDefault, symbol, kCFStringEncodingMacRoman); - - *ptraddress = (void*) CFBundleGetFunctionPointerForName (hm, symbolref); - - CFRelease (symbolref); - return (*ptraddress != NULL); } /*importsymbol*/ ! #endif static boolean loadpythonlib (void) { --- 301,332 ---- #define PyUnicode_Type (*py.ptr_PyUnicode_Type) ! static boolean importsymbol (typythonlib hm, char *symbol, void **ptraddress) { ! #if defined(WIN95VERSION) ! ! *ptraddress = (void*) GetProcAddress (hm, symbol); ! ! #elif defined(MACVERSION) && TARGET_RT_MAC_MACHO ! ! CFStringRef symbolref = CFStringCreateWithCString (kCFAllocatorSystemDefault, symbol, kCFStringEncodingMacRoman); ! ! *ptraddress = (void*) CFBundleGetFunctionPointerForName (hm, symbolref); ! ! CFRelease (symbolref); ! ! #endif return (*ptraddress != NULL); } /*importsymbol*/ ! /* ! use some pre-processor magic to simplify importing all required symbols ! and to enforce the naming convention for all py struct members ! */ ! ! #define IMPORTSYMBOL(hm,symbol) importsymbol(hm, # symbol, (void**) &py.ptr_ ## symbol) ! static boolean loadpythonlib (void) { *************** *** 335,339 **** #if defined(WIN95VERSION) hm = LoadLibraryEx("python23.dll", NULL, 0); ! #elif defined(MACVERSION) LoadFrameworkBundle (CFSTR ("Python.framework"), &hm); #endif --- 337,341 ---- #if defined(WIN95VERSION) hm = LoadLibraryEx("python23.dll", NULL, 0); ! #elif defined(MACVERSION) && TARGET_RT_MAC_MACHO LoadFrameworkBundle (CFSTR ("Python.framework"), &hm); #endif *************** *** 342,430 **** return (false); ! fl = fl && importsymbol (hm, "PyObject_CallMethod", (void**) &py.ptr_PyObject_CallMethod); ! fl = fl && importsymbol (hm, "PyEval_GetBuiltins", (void**) &py.ptr_PyEval_GetBuiltins); ! fl = fl && importsymbol (hm, "PyInstance_Type", (void**) &py.ptr_PyInstance_Type); ! fl = fl && importsymbol (hm, "PyComplex_Type", (void**) &py.ptr_PyComplex_Type); ! fl = fl && importsymbol (hm, "PyComplex_ImagAsDouble", (void**) &py.ptr_PyComplex_ImagAsDouble); ! fl = fl && importsymbol (hm, "PyComplex_RealAsDouble", (void**) &py.ptr_PyComplex_RealAsDouble); ! fl = fl && importsymbol (hm, "PyDict_Type", (void**) &py.ptr_PyDict_Type); ! fl = fl && importsymbol (hm, "PyDict_GetItem", (void**) &py.ptr_PyDict_GetItem); ! fl = fl && importsymbol (hm, "PyDict_GetItemString", (void**) &py.ptr_PyDict_GetItemString); ! fl = fl && importsymbol (hm, "PyDict_Keys", (void**) &py.ptr_PyDict_Keys); ! fl = fl && importsymbol (hm, "PyDict_New", (void**) &py.ptr_PyDict_New); ! fl = fl && importsymbol (hm, "PyDict_SetItemString", (void**) &py.ptr_PyDict_SetItemString); ! fl = fl && importsymbol (hm, "PyFile_Type", (void**) &py.ptr_PyFile_Type); ! fl = fl && importsymbol (hm, "PyFloat_Type", (void**) &py.ptr_PyFloat_Type); ! fl = fl && importsymbol (hm, "PyFloat_AsDouble", (void**) &py.ptr_PyFloat_AsDouble); ! fl = fl && importsymbol (hm, "PyInt_Type", (void**) &py.ptr_PyInt_Type); ! fl = fl && importsymbol (hm, "PyInt_AsLong", (void**) &py.ptr_PyInt_AsLong); ! fl = fl && importsymbol (hm, "PySeqIter_Type", (void**) &py.ptr_PySeqIter_Type); ! fl = fl && importsymbol (hm, "PyList_Append", (void**) &py.ptr_PyList_Append); ! fl = fl && importsymbol (hm, "PyList_GetItem", (void**) &py.ptr_PyList_GetItem); ! fl = fl && importsymbol (hm, "PyList_SetItem", (void**) &py.ptr_PyList_SetItem); ! fl = fl && importsymbol (hm, "PyList_New", (void**) &py.ptr_PyList_New); ! fl = fl && importsymbol (hm, "PyList_Size", (void**) &py.ptr_PyList_Size); ! fl = fl && importsymbol (hm, "PyLong_Type", (void**) &py.ptr_PyLong_Type); ! fl = fl && importsymbol (hm, "PyMethod_Type", (void**) &py.ptr_PyMethod_Type); ! fl = fl && importsymbol (hm, "Py_FindMethod", (void**) &py.ptr_Py_FindMethod); ! fl = fl && importsymbol (hm, "Py_BuildValue", (void**) &py.ptr_Py_BuildValue); ! fl = fl && importsymbol (hm, "Py_InitModule4", (void**) &py.ptr_Py_InitModule4); ! fl = fl && importsymbol (hm, "PyArg_ParseTuple", (void**) &py.ptr_PyArg_ParseTuple); ! fl = fl && importsymbol (hm, "PyModule_AddObject", (void**) &py.ptr_PyModule_AddObject); ! fl = fl && importsymbol (hm, "_Py_NoneStruct", (void**) &py.ptr__Py_NoneStruct); ! fl = fl && importsymbol (hm, "PyType_Type", (void**) &py.ptr_PyType_Type); ! fl = fl && importsymbol (hm, "PyObject_GetAttrString", (void**) &py.ptr_PyObject_GetAttrString); ! fl = fl && importsymbol (hm, "PyObject_Str", (void**) &py.ptr_PyObject_Str); ! fl = fl && importsymbol (hm, "PyType_GenericNew", (void**) &py.ptr_PyType_GenericNew); ! fl = fl && importsymbol (hm, "PyType_IsSubtype", (void**) &py.ptr_PyType_IsSubtype); ! fl = fl && importsymbol (hm, "PyType_Ready", (void**) &py.ptr_PyType_Ready); #ifdef Py_REF_DEBUG ! fl = fl && importsymbol (hm, "_Py_RefTotal", (void**) &py.ptr__Py_RefTotal); ! fl = fl && importsymbol (hm, "_Py_NegativeRefcount", (void**) &py.ptr__Py_NegativeRefcount); #endif #ifdef Py_TRACE_REFS ! fl = fl && importsymbol (hm, "_Py_Dealloc", (void**) &py.ptr__Py_Dealloc); #endif ! fl = fl && importsymbol (hm, "_PyObject_New", (void**) &py.ptr__PyObject_New); ! fl = fl && importsymbol (hm, "PyExc_IndexError", (void**) &py.ptr_PyExc_IndexError); ! fl = fl && importsymbol (hm, "PyExc_KeyError", (void**) &py.ptr_PyExc_KeyError); ! fl = fl && importsymbol (hm, "PyExc_SyntaxError", (void**) &py.ptr_PyExc_SyntaxError); ! fl = fl && importsymbol (hm, "PyExc_SystemError", (void**) &py.ptr_PyExc_SystemError); ! fl = fl && importsymbol (hm, "PyExc_TypeError", (void**) &py.ptr_PyExc_TypeError); ! fl = fl && importsymbol (hm, "PyExc_ValueError", (void**) &py.ptr_PyExc_ValueError); ! fl = fl && importsymbol (hm, "PyErr_Clear", (void**) &py.ptr_PyErr_Clear); ! fl = fl && importsymbol (hm, "PyErr_Occurred", (void**) &py.ptr_PyErr_Occurred); ! fl = fl && importsymbol (hm, "PyErr_Print", (void**) &py.ptr_PyErr_Print); ! fl = fl && importsymbol (hm, "PyErr_SetString", (void**) &py.ptr_PyErr_SetString); ! fl = fl && importsymbol (hm, "Py_Finalize", (void**) &py.ptr_Py_Finalize); ! fl = fl && importsymbol (hm, "Py_Initialize", (void**) &py.ptr_Py_Initialize); ! fl = fl && importsymbol (hm, "Py_IsInitialized", (void**) &py.ptr_Py_IsInitialized); ! fl = fl && importsymbol (hm, "PyRun_String", (void**) &py.ptr_PyRun_String); ! fl = fl && importsymbol (hm, "PySlice_Type", (void**) &py.ptr_PySlice_Type); ! fl = fl && importsymbol (hm, "PyString_Type", (void**) &py.ptr_PyString_Type); ! fl = fl && importsymbol (hm, "PyString_AsString", (void**) &py.ptr_PyString_AsString); ! fl = fl && importsymbol (hm, "PyString_FromString", (void**) &py.ptr_PyString_FromString); ! fl = fl && importsymbol (hm, "PyTuple_Type", (void**) &py.ptr_PyTuple_Type); - fl = fl && importsymbol (hm, "PyUnicode_Type", (void**) &py.ptr_PyUnicode_Type); if (fl) { --- 344,433 ---- return (false); ! fl = fl && IMPORTSYMBOL (hm, PyObject_CallMethod); ! fl = fl && IMPORTSYMBOL (hm, PyEval_GetBuiltins); ! fl = fl && IMPORTSYMBOL (hm, PyInstance_Type); ! fl = fl && IMPORTSYMBOL (hm, PyComplex_Type); ! fl = fl && IMPORTSYMBOL (hm, PyComplex_ImagAsDouble); ! fl = fl && IMPORTSYMBOL (hm, PyComplex_RealAsDouble); ! fl = fl && IMPORTSYMBOL (hm, PyDict_Type); ! fl = fl && IMPORTSYMBOL (hm, PyDict_GetItem); ! fl = fl && IMPORTSYMBOL (hm, PyDict_GetItemString); ! fl = fl && IMPORTSYMBOL (hm, PyDict_Keys); ! fl = fl && IMPORTSYMBOL (hm, PyDict_New); ! fl = fl && IMPORTSYMBOL (hm, PyDict_SetItemString); ! fl = fl && IMPORTSYMBOL (hm, PyFile_Type); ! fl = fl && IMPORTSYMBOL (hm, PyFloat_Type); ! fl = fl && IMPORTSYMBOL (hm, PyFloat_AsDouble); ! fl = fl && IMPORTSYMBOL (hm, PyInt_Type); ! fl = fl && IMPORTSYMBOL (hm, PyInt_AsLong); ! fl = fl && IMPORTSYMBOL (hm, PySeqIter_Type); ! fl = fl && IMPORTSYMBOL (hm, PyList_Append); ! fl = fl && IMPORTSYMBOL (hm, PyList_GetItem); ! fl = fl && IMPORTSYMBOL (hm, PyList_SetItem); ! fl = fl && IMPORTSYMBOL (hm, PyList_New); ! fl = fl && IMPORTSYMBOL (hm, PyList_Size); ! fl = fl && IMPORTSYMBOL (hm, PyLong_Type); ! fl = fl && IMPORTSYMBOL (hm, PyMethod_Type); ! fl = fl && IMPORTSYMBOL (hm, Py_FindMethod); ! fl = fl && IMPORTSYMBOL (hm, Py_BuildValue); ! fl = fl && IMPORTSYMBOL (hm, Py_InitModule4); ! fl = fl && IMPORTSYMBOL (hm, PyArg_ParseTuple); ! fl = fl && IMPORTSYMBOL (hm, PyModule_AddObject); ! fl = fl && IMPORTSYMBOL (hm, _Py_NoneStruct); ! fl = fl && IMPORTSYMBOL (hm, PyType_Type); ! fl = fl && IMPORTSYMBOL (hm, PyObject_GetAttrString); ! fl = fl && IMPORTSYMBOL (hm, PyObject_Str); ! fl = fl && IMPORTSYMBOL (hm, PyType_GenericNew); ! fl = fl && IMPORTSYMBOL (hm, PyType_IsSubtype); ! fl = fl && IMPORTSYMBOL (hm, PyType_Ready); #ifdef Py_REF_DEBUG ! fl = fl && IMPORTSYMBOL (hm, _Py_RefTotal); ! fl = fl && IMPORTSYMBOL (hm, _Py_NegativeRefcount); #endif #ifdef Py_TRACE_REFS ! fl = fl && IMPORTSYMBOL (hm, _Py_Dealloc); #endif ! fl = fl && IMPORTSYMBOL (hm, _PyObject_New); ! fl = fl && IMPORTSYMBOL (hm, PyExc_IndexError); ! fl = fl && IMPORTSYMBOL (hm, PyExc_KeyError); ! fl = fl && IMPORTSYMBOL (hm, PyExc_SyntaxError); ! fl = fl && IMPORTSYMBOL (hm, PyExc_SystemError); ! fl = fl && IMPORTSYMBOL (hm, PyExc_TypeError); ! fl = fl && IMPORTSYMBOL (hm, PyExc_ValueError); ! fl = fl && IMPORTSYMBOL (hm, PyErr_Clear); ! fl = fl && IMPORTSYMBOL (hm, PyErr_Occurred); ! fl = fl && IMPORTSYMBOL (hm, PyErr_Print); ! fl = fl && IMPORTSYMBOL (hm, PyErr_SetString); ! fl = fl && IMPORTSYMBOL (hm, Py_Finalize); ! fl = fl && IMPORTSYMBOL (hm, Py_Initialize); ! fl = fl && IMPORTSYMBOL (hm, Py_IsInitialized); ! fl = fl && IMPORTSYMBOL (hm, PyRun_String); ! fl = fl && IMPORTSYMBOL (hm, PySlice_Type); ! fl = fl && IMPORTSYMBOL (hm, PyString_Type); ! fl = fl && IMPORTSYMBOL (hm, PyString_AsString); ! fl = fl && IMPORTSYMBOL (hm, PyString_FromString); ! fl = fl && IMPORTSYMBOL (hm, PyTuple_Type); ! ! fl = fl && IMPORTSYMBOL (hm, PyUnicode_Type); if (fl) { *************** *** 435,439 **** #if defined(WIN95VERSION) FreeLibrary (hm); ! #elif defined(MACVERSION) CFRelease (hm); #endif --- 438,442 ---- #if defined(WIN95VERSION) FreeLibrary (hm); ! #elif defined(MACVERSION) && TARGET_RT_MAC_MACHO CFRelease (hm); #endif *************** *** 446,449 **** --- 449,458 ---- #if 0 + static boolean ispythonloaded (void) { + + return (py.hmodule != NULL); + } /*ispythonavailable*/ + + static void freepythonlib (void) { *************** *** 452,456 **** #if defined(WIN95VERSION) FreeLibrary (py.hmodule); ! #elif defined(MACVERSION) CFRelease (py.hmodule); #endif --- 461,465 ---- #if defined(WIN95VERSION) FreeLibrary (py.hmodule); ! #elif defined(MACVERSION) && TARGET_RT_MAC_MACHO CFRelease (py.hmodule); #endif |
|
From: icreedon <icr...@us...> - 2004-11-24 18:58:29
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21831 Modified Files: langstartup.c Log Message: Added osPointVersion for Mac OS, not set on Windows. Added osBuildNumber for Mac OS X, on Mac it is a string; Windows already had this, for Windows it is a number. Added isMacOsClassic for Mac OS, a boolean, true for Classic environment and Mac OS v9; not set for Windows. Changed osFullDisplayName for Mac OS, now displays Mac OS X, Mac OS X Server, or Mac OS; previously just displayed Macintosh. Changed osMajorVersion for Mac OS X, displays 10 instead of 16. Added isServer boolean, true for Mac OS X Server, Windows NT, false for non server OSes. Index: langstartup.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langstartup.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** langstartup.c 31 Oct 2004 18:48:51 -0000 1.3 --- langstartup.c 24 Nov 2004 18:58:00 -0000 1.4 *************** *** 24,27 **** --- 24,28 ---- ******************************************************************************/ + #include "frontier.h" #include "standard.h" *************** *** 40,58 **** #include "resources.h" #include "WinSockNetEvents.h" ! #define str_isPike "\x06" "isPike" ! #define str_isRadio "\x07" "isRadio" ! #define str_isMac "\x05" "isMac" ! #define str_isWindows "\x09" "isWindows" ! #define str_osFlavor "\x08" "osFlavor" #define str_osMajorVersion "\x0e" "osMajorVersion" #define str_osMinorVersion "\x0e" "osMinorVersion" #define str_osBuildNumber "\x0d" "osBuildNumber" #define str_osVersionString "\x0f" "osVersionString" #define str_osFullNameForDisplay "\x14" "osFullNameForDisplay" #define str_winServicePackNumber "\x14" "winServicePackNumber" ! #define str_isCarbon "\x08" "isCarbon" ! #define str_maxTcpConnections "\x11" "maxTcpConnections" --- 41,63 ---- #include "resources.h" #include "WinSockNetEvents.h" + #include "CallMachOFrameWork.h" /* 2004-11-19 creedon */ ! #define str_isPike "\x06" "isPike" ! #define str_isRadio "\x07" "isRadio" ! #define str_isMac "\x05" "isMac" ! #define str_isMacOsClassic "\x0e" "isMacOsClassic" /* 2004-11-19 creedon */ ! #define str_isServer "\x08" "isServer" /* 2004-11-19 creedon */ ! #define str_isWindows "\x09" "isWindows" ! #define str_osFlavor "\x08" "osFlavor" #define str_osMajorVersion "\x0e" "osMajorVersion" #define str_osMinorVersion "\x0e" "osMinorVersion" + #define str_osPointVersion "\x0e" "osPointVersion" /* 2004-11-19 creedon */ #define str_osBuildNumber "\x0d" "osBuildNumber" #define str_osVersionString "\x0f" "osVersionString" #define str_osFullNameForDisplay "\x14" "osFullNameForDisplay" #define str_winServicePackNumber "\x14" "winServicePackNumber" ! #define str_isCarbon "\x08" "isCarbon" ! #define str_maxTcpConnections "\x11" "maxTcpConnections" *************** *** 214,218 **** #ifdef MACVERSION ! bigstring bsversion; unsigned long x; --- 219,224 ---- #ifdef MACVERSION ! bigstring bsversion, bsos; /* 2004-11-19 creedon - added bsos*/ ! boolean isMacOsClassic, isServer; /* 2004-11-19 creedon */ unsigned long x; *************** *** 225,249 **** //langassignstringvalue (ht, str_osFlavor, zerostring); ! langassignlongvalue (ht, str_osMajorVersion, x >> 8); langassignlongvalue (ht, str_osMinorVersion, (x & 0x00f0) >> 4); ! getsystemversionstring (bsversion, nil); langassignstringvalue (ht, str_osVersionString, bsversion); - - langassignstringvalue (ht, str_osFullNameForDisplay, "\x09" "Macintosh"); #if TARGET_API_MAC_CARBON == 1 /*PBS 7.028: system.environment.isCarbon*/ ! langassignbooleanvalue (ht, str_isCarbon, true); #else langassignbooleanvalue (ht, str_isCarbon, false); #endif #endif --- 231,322 ---- //langassignstringvalue (ht, str_osFlavor, zerostring); ! langassignlongvalue (ht, str_osMajorVersion, bcdtolong (x >> 8)); /* 2004-11-19 creedon - convert from bcd for correct display on Mac OS X */ langassignlongvalue (ht, str_osMinorVersion, (x & 0x00f0) >> 4); ! ! langassignlongvalue (ht, str_osPointVersion, x & 0x0f); /* 2004-11-19 creedon */ getsystemversionstring (bsversion, nil); langassignstringvalue (ht, str_osVersionString, bsversion); + /* langassignstringvalue (ht, str_osFullNameForDisplay, "\x09" "Macintosh"); 2004-11-19 creedon - moved to later in code*/ #if TARGET_API_MAC_CARBON == 1 /*PBS 7.028: system.environment.isCarbon*/ ! ! /* 2004-11-19 creedon - added hcommand, hreturn, bs, response */ ! Handle hcommand, hreturn; ! bigstring bs; ! UInt32 response; ! langassignbooleanvalue (ht, str_isCarbon, true); + /* 2004-11-19 creedon - get mac os build number, full display name, is server*/ + + /* get mac os build number */ + + newtexthandle ("\psw_vers -buildVersion", &hcommand); + + newemptyhandle (&hreturn); + + unixshellcall (hcommand, hreturn); + + texthandletostring (hreturn, bs); + + sethandlesize (hreturn, 0); + + setstringlength (bs, stringlength (bs) - 1); + + langassignstringvalue (ht, str_osBuildNumber, bs); /* get mac os build number */ + + /* get os full display name */ + + copystring ("sw_vers -productName", bs); + + sethandlecontents (bs, stringsize (bs), hcommand); + + unixshellcall (hcommand, hreturn); + + texthandletostring (hreturn, bsos); + + setstringlength (bsos, stringlength (bsos) - 1); /* get os full display name */ + + disposehandle (hcommand); + disposehandle (hreturn); /* get mac os build number and full display name*/ + + /* 2004-11-19 creedon - is mac os classic */ + /* This needs to be checked on Mac OS Classic as well as Mac OS 9 proper. */ + + OSErr err = gestalt (gestaltMacOSCompatibilityBoxAttr, &response); + + if ((err == noErr) && ((response & (1 << gestaltMacOSCompatibilityBoxPresent)) != 0)) + isMacOsClassic = true; + else + isMacOsClassic = false; + + /* 2004-11-19 creedon - is server */ + + if (equalstrings (bsos, "\pMac OS X Server")) + isServer = true; + else + isServer = false; /* is server */ + #else langassignbooleanvalue (ht, str_isCarbon, false); + + bsos = "\x06" "Mac OS" /* 2004-11-19 creedon - Mac OS, used to be Macintosh*/ + + isMacOsClassic = true; /* 2004-11-19 creedon */ + + isServer = false; /* 2004-11-19 creedon */ #endif + langassignbooleanvalue (ht, str_isMacOsClassic, isMacOsClassic); /* 2004-11-19 creedon */ + + langassignstringvalue (ht, str_osFullNameForDisplay, bsos); /* 2004-11-19 creedon - changed "\x06" "Mac OS" to bsos. a calculated value */ + + langassignbooleanvalue (ht, str_isServer, isServer); /* 2004-11-19 creedon */ + #endif *************** *** 251,254 **** --- 324,328 ---- bigstring bsversion, bsservicepack, bsos; + boolean isServer; /* 2004-11-19 creedon */ byte bsflavor [4]; OSVERSIONINFO osinfo; *************** *** 264,269 **** langassignbooleanvalue (ht, str_isWindows, true); ! if (osinfo.dwPlatformId == VER_PLATFORM_WIN32_NT) copystring ("\x02" "NT", bsflavor); else { --- 338,346 ---- langassignbooleanvalue (ht, str_isWindows, true); ! if (osinfo.dwPlatformId == VER_PLATFORM_WIN32_NT) { copystring ("\x02" "NT", bsflavor); + + isServer = true; /* 2004-11-19 creedon */ + } else { *************** *** 272,275 **** --- 349,354 ---- else copystring ("\x02" "98", bsflavor); + + isServer = false; /* 2004-11-19 creedon */ } *************** *** 293,296 **** --- 372,377 ---- langassignbooleanvalue (ht, str_isCarbon, false); /*7.0b28: isCarbon is false on Windows.*/ + + langassignbooleanvalue (ht, str_isServer, isServer); /* 2004-11-19 creedon */ #endif |
|
From: Andre R. <and...@us...> - 2004-11-24 18:52:45
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20353 Modified Files: Tag: sidewinder-branch langpython.c Log Message: Reorganized platform ifdefs at top of file slightly to make clear what works and what doesn't work yet. Added a few more types from the Python C API. In runstringverb, lock the pythonCode handle before dereferencing and passing the resulting pointer in to the Python interpreter. Index: langpython.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langpython.c,v retrieving revision 1.2.4.13 retrieving revision 1.2.4.14 diff -C2 -d -r1.2.4.13 -r1.2.4.14 *** langpython.c 24 Nov 2004 07:16:26 -0000 1.2.4.13 --- langpython.c 24 Nov 2004 18:52:20 -0000 1.2.4.14 *************** *** 27,36 **** #include "standard.h" - #ifdef MACVERSION - #include <iac.h> - #endif - #include "error.h" - //#include "file.h" #include "memory.h" #include "ops.h" --- 27,31 ---- *************** *** 38,47 **** #include "strings.h" #include "lang.h" - //#include "langipc.h" #include "langinternal.h" #include "langexternal.h" - //#include "langsystem7.h" - //#include "langhtml.h" - //#include "langwinipc.h" //#include "process.h" //#include "tableinternal.h" --- 33,38 ---- *************** *** 54,63 **** #include "kernelverbs.h" #include "kernelverbdefs.h" - //#include "shell.rsrc.h" //#include "timedate.h" - //#include "winsocknetevents.h" - //#ifdef flcomponent - //#include "osacomponent.h" - //#endif #ifdef MACVERSION --- 45,49 ---- *************** *** 65,85 **** #endif #ifdef FRONTIER_PYTHON #include "langpython.h" ! #if defined(MACVERSION) && defined(TARGET_RT_MAC_MACHO) #include <Python/Python.h> ! #else ! #ifdef WIN95VERSION /*otherwise debug build of Frontier requires debug build of python dll*/ ! #undef _DEBUG ! #endif ! #include <Python.h> - #endif #include <time.h> --- 51,90 ---- #endif + #ifdef FRONTIER_PYTHON + #include "langpython.h" ! ! #if defined(WIN95VERSION) ! ! #undef _DEBUG /*otherwise debug build of Frontier requires debug build of python dll*/ ! #include <Python.h> ! ! #elif defined(MACVERSION) ! ! #if TARGET_API_MAC_CARBON ! ! #if TARGET_RT_MAC_MACHO #include <Python/Python.h> ! #elif TARGET_RT_MAC_CFM ! #error "Python integration is not yet supported in the OS X CFM build" ! #endif /*TARGET_RT_MAC_CFM*/ ! ! #endif /*TARGET_API_MAC_CARBON*/ ! ! #if TARGET_API_MAC_CLASSIC ! ! #error "Python integration is not yet supported in the PPC build" ! ! #endif /*TARGET_API_MAC_CLASSIC*/ ! ! #endif /*MACVERSION*/ #include <time.h> *************** *** 203,206 **** --- 208,213 ---- PyTypeObject * ptr_PyTuple_Type; /*tupleobject.h*/ + + PyTypeObject * ptr_PyUnicode_Type; /*unicodeobject.h*/ } py; *************** *** 286,289 **** --- 293,297 ---- #define PySlice_Type (*py.ptr_PySlice_Type) + #define PyString_Type (*py.ptr_PyString_Type) #define PyString_AsString (*py.ptr_PyString_AsString) *************** *** 291,294 **** --- 299,304 ---- #define PyTuple_Type (*py.ptr_PyTuple_Type) + + #define PyUnicode_Type (*py.ptr_PyUnicode_Type) #if defined(WIN95VERSION) *************** *** 349,352 **** --- 359,364 ---- fl = fl && importsymbol (hm, "PyDict_SetItemString", (void**) &py.ptr_PyDict_SetItemString); + fl = fl && importsymbol (hm, "PyFile_Type", (void**) &py.ptr_PyFile_Type); + fl = fl && importsymbol (hm, "PyFloat_Type", (void**) &py.ptr_PyFloat_Type); fl = fl && importsymbol (hm, "PyFloat_AsDouble", (void**) &py.ptr_PyFloat_AsDouble); *************** *** 354,357 **** --- 366,371 ---- fl = fl && importsymbol (hm, "PyInt_Type", (void**) &py.ptr_PyInt_Type); fl = fl && importsymbol (hm, "PyInt_AsLong", (void**) &py.ptr_PyInt_AsLong); + + fl = fl && importsymbol (hm, "PySeqIter_Type", (void**) &py.ptr_PySeqIter_Type); fl = fl && importsymbol (hm, "PyList_Append", (void**) &py.ptr_PyList_Append); *************** *** 363,366 **** --- 377,381 ---- fl = fl && importsymbol (hm, "PyLong_Type", (void**) &py.ptr_PyLong_Type); + fl = fl && importsymbol (hm, "PyMethod_Type", (void**) &py.ptr_PyMethod_Type); fl = fl && importsymbol (hm, "Py_FindMethod", (void**) &py.ptr_Py_FindMethod); *************** *** 371,374 **** --- 386,390 ---- fl = fl && importsymbol (hm, "_Py_NoneStruct", (void**) &py.ptr__Py_NoneStruct); + fl = fl && importsymbol (hm, "PyType_Type", (void**) &py.ptr_PyType_Type); fl = fl && importsymbol (hm, "PyObject_GetAttrString", (void**) &py.ptr_PyObject_GetAttrString); fl = fl && importsymbol (hm, "PyObject_Str", (void**) &py.ptr_PyObject_Str); *************** *** 402,409 **** --- 418,430 ---- fl = fl && importsymbol (hm, "PyRun_String", (void**) &py.ptr_PyRun_String); + fl = fl && importsymbol (hm, "PySlice_Type", (void**) &py.ptr_PySlice_Type); + fl = fl && importsymbol (hm, "PyString_Type", (void**) &py.ptr_PyString_Type); fl = fl && importsymbol (hm, "PyString_AsString", (void**) &py.ptr_PyString_AsString); fl = fl && importsymbol (hm, "PyString_FromString", (void**) &py.ptr_PyString_FromString); + fl = fl && importsymbol (hm, "PyTuple_Type", (void**) &py.ptr_PyTuple_Type); + + fl = fl && importsymbol (hm, "PyUnicode_Type", (void**) &py.ptr_PyUnicode_Type); if (fl) { *************** *** 1496,1500 **** --- 1517,1523 ---- // run the python code // + lockhandle (pythonCode); result = PyRun_String(*pythonCode, Py_file_input, globals, locals); + unlockhandle (pythonCode); if (result) Py_DECREF(result); err = PyErr_Occurred(); |
|
From: Andre R. <and...@us...> - 2004-11-24 18:41:48
|
Update of /cvsroot/frontierkernel/Frontier/build_CWPro8 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17493/build_CWPro8 Modified Files: Tag: sidewinder-branch Frontier.mcp Log Message: Rollback last revision, accidentally committed to wrong branch. Index: Frontier.mcp =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/build_CWPro8/Frontier.mcp,v retrieving revision 1.6.4.1 retrieving revision 1.6.4.2 diff -C2 -d -r1.6.4.1 -r1.6.4.2 Binary files /tmp/cvsWlYDcM and /tmp/cvs8tAYDq differ |
|
From: Andre R. <and...@us...> - 2004-11-24 18:24:59
|
Update of /cvsroot/frontierkernel/Frontier/build_CWPro8 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13782/build_CWPro8 Modified Files: Tag: New_Tables_Experiment-branch Frontier.mcp Log Message: Added arraylist.c to project file. Index: Frontier.mcp =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/build_CWPro8/Frontier.mcp,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 Binary files /tmp/cvsVZTCIy and /tmp/cvs8Fko2N differ |
|
From: icreedon <icr...@us...> - 2004-11-24 18:22:36
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13263 Modified Files: ops.c Log Message: changed bcdToLong to bcdtolong to follow style conventions already established for function names, re-implemented bcdtolong based on aradke comments Index: ops.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/ops.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ops.c 23 Nov 2004 12:32:17 -0000 1.5 --- ops.c 24 Nov 2004 18:22:17 -0000 1.6 *************** *** 863,867 **** gestalt (gestaltSystemVersion, &x); ! numbertostring (bcdToLong (x >> 8), bs); /* high byte is major rev., 2004-11-16 creedon - convert from bcd for correct display on Mac OS X */ pushchar ('.', bs); --- 863,867 ---- gestalt (gestaltSystemVersion, &x); ! numbertostring (bcdtolong (x >> 8), bs); /* high byte is major rev., 2004-11-16 creedon - convert from bcd for correct display on Mac OS X */ pushchar ('.', bs); *************** *** 953,968 **** ! unsigned long bcdToLong (unsigned long bcd) { /* 2004-11-16 creedon */ unsigned long ret = 0; ! short i; - for (i = 0; i < 8; i++) { - if (i > 0) - ret += i * 10 * (bcd & 0x0000000f); - else - ret += bcd & 0x0000000f; bcd >>= 4; ! } return (ret); ! } /* bcdToLong */ --- 953,974 ---- ! unsigned long bcdtolong (unsigned long bcd) { /* 2004-11-23 creedon, aradke */ ! ! /* ! convert a long value from BCD notation ! */ unsigned long ret = 0; ! unsigned long m = 1; ! ! do { ! ret += m * (bcd & 0x0000000f); ! ! m *= 10; bcd >>= 4; ! ! } while (bcd != 0); ! return (ret); ! } /* bcdtolong */ \ No newline at end of file |
|
From: icreedon <icr...@us...> - 2004-11-24 18:16:54
|
Update of /cvsroot/frontierkernel/Frontier/Common/headers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11935 Modified Files: ops.h Log Message: changed bcdToLong to bcdtolong to follow style conventions already established for function names Index: ops.h =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/headers/ops.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ops.h 23 Nov 2004 12:32:15 -0000 1.4 --- ops.h 24 Nov 2004 18:16:33 -0000 1.5 *************** *** 109,111 **** extern void getsizestring (unsigned long, bigstring); ! extern unsigned long bcdToLong (unsigned long); /* 2004-11-16 creedon */ \ No newline at end of file --- 109,111 ---- extern void getsizestring (unsigned long, bigstring); ! extern unsigned long bcdtolong (unsigned long); /* 2004-11-16 creedon */ \ No newline at end of file |
|
From: Andre R. <and...@us...> - 2004-11-24 17:57:49
|
Update of /cvsroot/frontierkernel/Frontier/build_CWPro8 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6968/build_CWPro8 Modified Files: Tag: sidewinder-branch Frontier.mcp Log Message: Added arraylist.c to project file. Index: Frontier.mcp =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/build_CWPro8/Frontier.mcp,v retrieving revision 1.6 retrieving revision 1.6.4.1 diff -C2 -d -r1.6 -r1.6.4.1 Binary files /tmp/cvsWSfCpB and /tmp/cvsqYce1O differ |
|
From: David B. <dav...@us...> - 2004-11-24 15:44:04
|
Update of /cvsroot/frontierkernel/Frontier/Common/headers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8659 Modified Files: Tag: sidewinder-branch scripts.h Log Message: change python sig to avoid potential conflicts Index: scripts.h =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/headers/scripts.h,v retrieving revision 1.2.4.1 retrieving revision 1.2.4.2 diff -C2 -d -r1.2.4.1 -r1.2.4.2 *** scripts.h 24 Nov 2004 04:38:59 -0000 1.2.4.1 --- scripts.h 24 Nov 2004 15:43:41 -0000 1.2.4.2 *************** *** 35,42 **** #define typeLAND 'LAND' ! // the type code for python scripts -- there is precedence for this type ! // code, MacPython uses it as the creator type for Python source files // ! #define typePyth 'Pyth' --- 35,41 ---- #define typeLAND 'LAND' ! // the type code for python scripts // ! #define typePython 'PYTH' |
|
From: David B. <dav...@us...> - 2004-11-24 07:16:39
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32555 Modified Files: Tag: sidewinder-branch langpython.c Log Message: made andre's dynamic loading for OSX permanent. Index: langpython.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langpython.c,v retrieving revision 1.2.4.12 retrieving revision 1.2.4.13 diff -C2 -d -r1.2.4.12 -r1.2.4.13 *** langpython.c 24 Nov 2004 03:34:01 -0000 1.2.4.12 --- langpython.c 24 Nov 2004 07:16:26 -0000 1.2.4.13 *************** *** 86,90 **** ! #if defined(WIN95VERSION) /* || (defined(MACVERSION) && defined(TARGET_RT_MAC_MACHO)) */ /* --- 86,90 ---- ! #if defined(WIN95VERSION) || (defined(MACVERSION) && defined(TARGET_RT_MAC_MACHO)) /* |
|
From: David B. <dav...@us...> - 2004-11-24 04:39:09
|
Update of /cvsroot/frontierkernel/Frontier/Common/headers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2279 Modified Files: Tag: sidewinder-branch scripts.h Log Message: added signature code for Python scripts, using MacPython as an example Index: scripts.h =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/headers/scripts.h,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** scripts.h 31 Oct 2004 13:02:36 -0000 1.2 --- scripts.h 24 Nov 2004 04:38:59 -0000 1.2.4.1 *************** *** 35,38 **** --- 35,43 ---- #define typeLAND 'LAND' + // the type code for python scripts -- there is precedence for this type + // code, MacPython uses it as the creator type for Python source files + // + #define typePyth 'Pyth' + /*prototypes*/ |
|
From: Andre R. <and...@us...> - 2004-11-24 03:34:24
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20768/Common/source Modified Files: Tag: sidewinder-branch langpython.c Log Message: Added support for dynamic loading of Python.framework at runtime on Mac OS X. Index: langpython.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langpython.c,v retrieving revision 1.2.4.11 retrieving revision 1.2.4.12 diff -C2 -d -r1.2.4.11 -r1.2.4.12 *** langpython.c 24 Nov 2004 02:05:06 -0000 1.2.4.11 --- langpython.c 24 Nov 2004 03:34:01 -0000 1.2.4.12 *************** *** 61,64 **** --- 61,68 ---- //#endif + #ifdef MACVERSION + #include "CallMachOFrameWork.h" + #endif + #ifdef FRONTIER_PYTHON *************** *** 82,86 **** ! #ifdef WIN95VERSION /* --- 86,90 ---- ! #if defined(WIN95VERSION) /* || (defined(MACVERSION) && defined(TARGET_RT_MAC_MACHO)) */ /* *************** *** 98,106 **** */ static struct { ! HMODULE hmodule; /*handle to DLL if it was loaded and all symbols were found*/ PyObject * (*ptr_PyObject_CallMethod) (PyObject *, char *, char *, ...); /*abstract.h*/ --- 102,119 ---- */ + #if defined(WIN95VERSION) + + typedef HMODULE typythonlib; + + #elif defined(MACVERSION) + + typedef CFBundleRef typythonlib; + + #endif static struct { ! typythonlib hmodule; /*handle to python library if it was loaded and all symbols were found*/ PyObject * (*ptr_PyObject_CallMethod) (PyObject *, char *, char *, ...); /*abstract.h*/ *************** *** 121,124 **** --- 134,139 ---- int (*ptr_PyDict_SetItemString) (PyObject *, const char *, PyObject *); + PyTypeObject * ptr_PyFile_Type; /*fileobject.h*/ + PyTypeObject * ptr_PyFloat_Type; /*floatobject.h*/ double (*ptr_PyFloat_AsDouble) (PyObject *); *************** *** 127,131 **** long (*ptr_PyInt_AsLong) (PyObject *); ! int (*ptr_PyList_Append) (PyObject *, PyObject *); /*listobject.h*/ PyObject * (*ptr_PyList_GetItem) (PyObject *, int); int (*ptr_PyList_SetItem) (PyObject *, int, PyObject *); --- 142,149 ---- long (*ptr_PyInt_AsLong) (PyObject *); ! PyTypeObject * ptr_PySeqIter_Type; /*iterobject.h*/ ! ! PyTypeObject * ptr_PyList_Type; /*listobject.h*/ ! int (*ptr_PyList_Append) (PyObject *, PyObject *); PyObject * (*ptr_PyList_GetItem) (PyObject *, int); int (*ptr_PyList_SetItem) (PyObject *, int, PyObject *); *************** *** 135,140 **** PyTypeObject * ptr_PyLong_Type; /*longobject.h*/ ! PyObject * (*ptr_Py_FindMethod) (PyMethodDef[], PyObject *, char *); /*methodobject.h*/ PyObject * (*ptr_Py_BuildValue) (char *, ...); /*modsupport.h*/ PyObject * (*ptr_Py_InitModule4) (char *, PyMethodDef *, char *, PyObject *, int); --- 153,161 ---- PyTypeObject * ptr_PyLong_Type; /*longobject.h*/ ! PyTypeObject * ptr_PyMethod_Type; /*methodobject.h*/ ! PyObject * (*ptr_Py_FindMethod) (PyMethodDef[], PyObject *, char *); + PyTypeObject * ptr_PyModule_Type; /*moduleobject.h*/ + PyObject * (*ptr_Py_BuildValue) (char *, ...); /*modsupport.h*/ PyObject * (*ptr_Py_InitModule4) (char *, PyMethodDef *, char *, PyObject *, int); *************** *** 143,146 **** --- 164,168 ---- PyObject * ptr__Py_NoneStruct; /*object.h*/ + PyTypeObject * ptr_PyType_Type; PyObject * (*ptr_PyObject_GetAttrString) (PyObject *, char *); PyObject * (*ptr_PyObject_Str) (PyObject *); *************** *** 174,180 **** --- 196,206 ---- PyObject * (*ptr_PyRun_String) (const char *, int, PyObject *, PyObject *); + PyTypeObject * ptr_PySlice_Type; /*sliceobject.h*/ + PyTypeObject * ptr_PyString_Type; /*stringobject.h*/ char * (*ptr_PyString_AsString) (PyObject *); PyObject * (*ptr_PyString_FromString) (const char *); + + PyTypeObject * ptr_PyTuple_Type; /*tupleobject.h*/ } py; *************** *** 197,200 **** --- 223,228 ---- #define PyDict_SetItemString (*py.ptr_PyDict_SetItemString) + #define PyFile_Type (*py.ptr_PyFile_Type) + #define PyFloat_Type (*py.ptr_PyFloat_Type) #define PyFloat_AsDouble (*py.ptr_PyFloat_AsDouble) *************** *** 203,206 **** --- 231,237 ---- #define PyInt_AsLong (*py.ptr_PyInt_AsLong) + #define PySeqIter_Type (*py.ptr_PySeqIter_Type) + + #define PyList_Type (*py.ptr_PyList_Type) #define PyList_Append (*py.ptr_PyList_Append) #define PyList_GetItem (*py.ptr_PyList_GetItem) *************** *** 211,216 **** --- 242,250 ---- #define PyLong_Type (*py.ptr_PyLong_Type) + #define PyMethod_Type (*py.ptr_PyMethod_Type) #define Py_FindMethod (*py.ptr_Py_FindMethod) + #define PyModule_Type (*py.ptr_PyModule_Type) + #define Py_BuildValue (*py.ptr_Py_BuildValue) #define Py_InitModule4 (*py.ptr_Py_InitModule4) *************** *** 219,222 **** --- 253,257 ---- #define _Py_NoneStruct (*py.ptr__Py_NoneStruct) + #define PyType_Type (*py.ptr_PyType_Type) #define PyObject_GetAttrString (*py.ptr_PyObject_GetAttrString) #define PyObject_Str (*py.ptr_PyObject_Str) *************** *** 250,258 **** --- 285,297 ---- #define PyRun_String (*py.ptr_PyRun_String) + #define PySlice_Type (*py.ptr_PySlice_Type) #define PyString_Type (*py.ptr_PyString_Type) #define PyString_AsString (*py.ptr_PyString_AsString) #define PyString_FromString (*py.ptr_PyString_FromString) + #define PyTuple_Type (*py.ptr_PyTuple_Type) + #if defined(WIN95VERSION) + static boolean importsymbol (HMODULE hm, LPCSTR symbol, void **ptraddress) { *************** *** 262,272 **** } /*importsymbol*/ static boolean loadpythonlib (void) { ! HMODULE hm; boolean fl = true; hm = LoadLibraryEx("python23.dll", NULL, 0); if (hm == NULL) --- 301,331 ---- } /*importsymbol*/ + #elif defined(MACVERSION) + + static boolean importsymbol (CFBundleRef hm, char *symbol, void **ptraddress) { + + CFStringRef symbolref; + + symbolref = CFStringCreateWithCString (kCFAllocatorSystemDefault, symbol, kCFStringEncodingMacRoman); + + *ptraddress = (void*) CFBundleGetFunctionPointerForName (hm, symbolref); + + CFRelease (symbolref); + + return (*ptraddress != NULL); + } /*importsymbol*/ + + #endif static boolean loadpythonlib (void) { ! typythonlib hm = NULL; boolean fl = true; + #if defined(WIN95VERSION) hm = LoadLibraryEx("python23.dll", NULL, 0); + #elif defined(MACVERSION) + LoadFrameworkBundle (CFSTR ("Python.framework"), &hm); + #endif if (hm == NULL) *************** *** 347,354 **** fl = fl && importsymbol (hm, "PyString_FromString", (void**) &py.ptr_PyString_FromString); ! if (fl) py.hmodule = hm; /*success!*/ ! else FreeLibrary (hm); return (fl); --- 406,421 ---- fl = fl && importsymbol (hm, "PyString_FromString", (void**) &py.ptr_PyString_FromString); ! if (fl) { ! py.hmodule = hm; /*success!*/ ! } ! else { ! ! #if defined(WIN95VERSION) FreeLibrary (hm); + #elif defined(MACVERSION) + CFRelease (hm); + #endif + } return (fl); *************** *** 356,365 **** ! static void freepythonlib () { if (py.hmodule != NULL) { FreeLibrary (py.hmodule); ! py.hmodule = NULL; } --- 423,437 ---- ! #if 0 ! ! static void freepythonlib (void) { if (py.hmodule != NULL) { + #if defined(WIN95VERSION) FreeLibrary (py.hmodule); ! #elif defined(MACVERSION) ! CFRelease (py.hmodule); ! #endif py.hmodule = NULL; } *************** *** 367,372 **** } /*freepythonlib*/ ! #endif /*WIN95VERSION*/ --- 439,458 ---- } /*freepythonlib*/ + #endif ! ! #else ! ! /*linking at build time*/ ! ! static boolean loadpythonlib (void) { ! return (true); ! } /*loadpythonlib*/ ! ! //static void freepythonlib (void) { ! // return; ! // } /*freepythonlib*/ ! ! #endif *************** *** 1518,1526 **** boolean pythoninitverbs (void) { ! #ifdef WIN95VERSION ! loadpythonlib (); ! #endif ! ! return (loadfunctionprocessor (idpythonverbs, &pythonfunctionvalue)); } --- 1604,1611 ---- boolean pythoninitverbs (void) { ! if (loadpythonlib ()) ! return (loadfunctionprocessor (idpythonverbs, &pythonfunctionvalue)); ! ! return (true); } |
|
From: Andre R. <and...@us...> - 2004-11-24 02:06:26
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31503 Modified Files: Tag: sidewinder-branch langpython.c Log Message: First cut at dynamically loading the Python library at runtime on Windows, so Frontier will start up normally even if the Python DLL is not present. Index: langpython.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langpython.c,v retrieving revision 1.2.4.10 retrieving revision 1.2.4.11 diff -C2 -d -r1.2.4.10 -r1.2.4.11 *** langpython.c 23 Nov 2004 22:12:16 -0000 1.2.4.10 --- langpython.c 24 Nov 2004 02:05:06 -0000 1.2.4.11 *************** *** 63,87 **** #ifdef FRONTIER_PYTHON - /* - 2004-11-23 aradke: To compile with Visual Studio 6.0 on Windows, - you need to grab the Python installer from http://www.python.org/ - and install it on your system. Then select the Options command - from the Tools menu, switch to the Directories rider, and add - the paths to the "include" and "libs" directories of your Python - installation to the "Include files" and "Library files" search - paths respectively. Since these paths depend on where you installed - Python on your system, we can't set them for you in our project file. - */ - #include "langpython.h" #if defined(MACVERSION) && defined(TARGET_RT_MAC_MACHO) #include <Python/Python.h> #else #include <Python.h> #endif #include <time.h> /* forward declarations */ --- 63,374 ---- #ifdef FRONTIER_PYTHON #include "langpython.h" #if defined(MACVERSION) && defined(TARGET_RT_MAC_MACHO) + #include <Python/Python.h> + #else + + #ifdef WIN95VERSION /*otherwise debug build of Frontier requires debug build of python dll*/ + #undef _DEBUG + #endif + #include <Python.h> + #endif #include <time.h> + + #ifdef WIN95VERSION + + /* + 2004-11-23 aradke: To compile with Visual Studio 6.0 on Windows, + you need to grab the Python installer from http://www.python.org/ + and install it on your system. In Visual Studio, select the Options + command from the Tools menu, switch to the Directories rider, and add + the path of the "include" directory of your Python installation to + the "Include files" search path. Since this path depends on where + you installed Python on your system, we can't set it for you in our + project file. + + 2004-11-23 aradke: dynamic linking to Python DLL at runtime + inspired by http://lists.wxwidgets.org/archive/wx-users/msg22930.html + */ + + + + static struct { + + HMODULE hmodule; /*handle to DLL if it was loaded and all symbols were found*/ + + PyObject * (*ptr_PyObject_CallMethod) (PyObject *, char *, char *, ...); /*abstract.h*/ + + PyObject * (*ptr_PyEval_GetBuiltins) (void); /*ceval.h*/ + + PyTypeObject * ptr_PyInstance_Type; /*classobject.h*/ + + PyTypeObject * ptr_PyComplex_Type; /*complexobject.h*/ + double (*ptr_PyComplex_ImagAsDouble) (PyObject *); + double (*ptr_PyComplex_RealAsDouble) (PyObject *); + + PyTypeObject * ptr_PyDict_Type; /*dictobject.h*/ + PyObject * (*ptr_PyDict_GetItem) (PyObject *, PyObject *); + PyObject * (*ptr_PyDict_GetItemString) (PyObject *, const char *); + PyObject * (*ptr_PyDict_Keys) (PyObject *); + PyObject * (*ptr_PyDict_New) (void); + int (*ptr_PyDict_SetItemString) (PyObject *, const char *, PyObject *); + + PyTypeObject * ptr_PyFloat_Type; /*floatobject.h*/ + double (*ptr_PyFloat_AsDouble) (PyObject *); + + PyTypeObject * ptr_PyInt_Type; /*intobject.h*/ + long (*ptr_PyInt_AsLong) (PyObject *); + + int (*ptr_PyList_Append) (PyObject *, PyObject *); /*listobject.h*/ + PyObject * (*ptr_PyList_GetItem) (PyObject *, int); + int (*ptr_PyList_SetItem) (PyObject *, int, PyObject *); + PyObject * (*ptr_PyList_New) (int); + int (*ptr_PyList_Size) (PyObject *); + + PyTypeObject * ptr_PyLong_Type; /*longobject.h*/ + + PyObject * (*ptr_Py_FindMethod) (PyMethodDef[], PyObject *, char *); /*methodobject.h*/ + + PyObject * (*ptr_Py_BuildValue) (char *, ...); /*modsupport.h*/ + PyObject * (*ptr_Py_InitModule4) (char *, PyMethodDef *, char *, PyObject *, int); + int (*ptr_PyArg_ParseTuple) (PyObject *, char *, ...); + int (*ptr_PyModule_AddObject) (PyObject *, char *, PyObject *); + + PyObject * ptr__Py_NoneStruct; /*object.h*/ + PyObject * (*ptr_PyObject_GetAttrString) (PyObject *, char *); + PyObject * (*ptr_PyObject_Str) (PyObject *); + PyObject * (*ptr_PyType_GenericNew) (PyTypeObject *, PyObject *, PyObject *); + int (*ptr_PyType_IsSubtype) (PyTypeObject *, PyTypeObject *); + int (*ptr_PyType_Ready) (PyTypeObject *); + #ifdef Py_REF_DEBUG + long * ptr__Py_RefTotal; + void (*ptr__Py_NegativeRefcount) (const char *, int, PyObject *); + #endif + #ifdef Py_TRACE_REFS + void (*ptr__Py_Dealloc) (PyObject *); + #endif + + PyObject * (*ptr__PyObject_New) (PyTypeObject *); /*objimpl.h*/ + + PyObject ** ptr_PyExc_IndexError; /*pyerrors.h*/ + PyObject ** ptr_PyExc_KeyError; + PyObject ** ptr_PyExc_SyntaxError; + PyObject ** ptr_PyExc_SystemError; + PyObject ** ptr_PyExc_TypeError; + PyObject ** ptr_PyExc_ValueError; + void (*ptr_PyErr_Clear) (void); + PyObject * (*ptr_PyErr_Occurred) (void); + void (*ptr_PyErr_Print) (void); + void (*ptr_PyErr_SetString) (PyObject *, const char *); + + void (*ptr_Py_Finalize) (); /*pythonrun.h*/ + void (*ptr_Py_Initialize) (void); + int (*ptr_Py_IsInitialized) (void); + PyObject * (*ptr_PyRun_String) (const char *, int, PyObject *, PyObject *); + + PyTypeObject * ptr_PyString_Type; /*stringobject.h*/ + char * (*ptr_PyString_AsString) (PyObject *); + PyObject * (*ptr_PyString_FromString) (const char *); + } py; + + + #define PyObject_CallMethod (*py.ptr_PyObject_CallMethod) + + #define PyEval_GetBuiltins (*py.ptr_PyEval_GetBuiltins) + + #define PyInstance_Type (*py.ptr_PyInstance_Type) + + #define PyComplex_Type (*py.ptr_PyComplex_Type) + #define PyComplex_ImagAsDouble (*py.ptr_PyComplex_ImagAsDouble) + #define PyComplex_RealAsDouble (*py.ptr_PyComplex_RealAsDouble) + + #define PyDict_Type (*py.ptr_PyDict_Type) + #define PyDict_GetItem (*py.ptr_PyDict_GetItem) + #define PyDict_GetItemString (*py.ptr_PyDict_GetItemString) + #define PyDict_Keys (*py.ptr_PyDict_Keys) + #define PyDict_New (*py.ptr_PyDict_New) + #define PyDict_SetItemString (*py.ptr_PyDict_SetItemString) + + #define PyFloat_Type (*py.ptr_PyFloat_Type) + #define PyFloat_AsDouble (*py.ptr_PyFloat_AsDouble) + + #define PyInt_Type (*py.ptr_PyInt_Type) + #define PyInt_AsLong (*py.ptr_PyInt_AsLong) + + #define PyList_Append (*py.ptr_PyList_Append) + #define PyList_GetItem (*py.ptr_PyList_GetItem) + #define PyList_SetItem (*py.ptr_PyList_SetItem) + #define PyList_New (*py.ptr_PyList_New) + #define PyList_Size (*py.ptr_PyList_Size) + + #define PyLong_Type (*py.ptr_PyLong_Type) + + #define Py_FindMethod (*py.ptr_Py_FindMethod) + + #define Py_BuildValue (*py.ptr_Py_BuildValue) + #define Py_InitModule4 (*py.ptr_Py_InitModule4) + #define PyArg_ParseTuple (*py.ptr_PyArg_ParseTuple) + #define PyModule_AddObject (*py.ptr_PyModule_AddObject) + + #define _Py_NoneStruct (*py.ptr__Py_NoneStruct) + #define PyObject_GetAttrString (*py.ptr_PyObject_GetAttrString) + #define PyObject_Str (*py.ptr_PyObject_Str) + #define PyType_GenericNew (*py.ptr_PyType_GenericNew) + #define PyType_IsSubtype (*py.ptr_PyType_IsSubtype) + #define PyType_Ready (*py.ptr_PyType_Ready) + #ifdef Py_REF_DEBUG + #define _Py_RefTotal (*py.ptr__Py_RefTotal) + #define _Py_NegativeRefcount (*py.ptr__Py_NegativeRefcount) + #endif + #ifdef Py_TRACE_REFS + #define _Py_Dealloc (*py.ptr__Py_Dealloc) + #endif + + #define _PyObject_New (*py.ptr__PyObject_New) + + #define PyExc_IndexError (*py.ptr_PyExc_IndexError) + #define PyExc_KeyError (*py.ptr_PyExc_KeyError) + #define PyExc_SyntaxError (*py.ptr_PyExc_SyntaxError) + #define PyExc_SystemError (*py.ptr_PyExc_SystemError) + #define PyExc_TypeError (*py.ptr_PyExc_TypeError) + #define PyExc_ValueError (*py.ptr_PyExc_ValueError) + #define PyErr_Clear (*py.ptr_PyErr_Clear) + #define PyErr_Occurred (*py.ptr_PyErr_Occurred) + #define PyErr_Print (*py.ptr_PyErr_Print) + #define PyErr_SetString (*py.ptr_PyErr_SetString) + + #define Py_Finalize (*py.ptr_Py_Finalize) + #define Py_Initialize (*py.ptr_Py_Initialize) + #define Py_IsInitialized (*py.ptr_Py_IsInitialized) + #define PyRun_String (*py.ptr_PyRun_String) + + #define PyString_Type (*py.ptr_PyString_Type) + #define PyString_AsString (*py.ptr_PyString_AsString) + #define PyString_FromString (*py.ptr_PyString_FromString) + + + static boolean importsymbol (HMODULE hm, LPCSTR symbol, void **ptraddress) { + + *ptraddress = (void*) GetProcAddress (hm, symbol); + + return (*ptraddress != NULL); + } /*importsymbol*/ + + + static boolean loadpythonlib (void) { + + HMODULE hm; + boolean fl = true; + + hm = LoadLibraryEx("python23.dll", NULL, 0); + + if (hm == NULL) + return (false); + + fl = fl && importsymbol (hm, "PyObject_CallMethod", (void**) &py.ptr_PyObject_CallMethod); + + fl = fl && importsymbol (hm, "PyEval_GetBuiltins", (void**) &py.ptr_PyEval_GetBuiltins); + + fl = fl && importsymbol (hm, "PyInstance_Type", (void**) &py.ptr_PyInstance_Type); + + fl = fl && importsymbol (hm, "PyComplex_Type", (void**) &py.ptr_PyComplex_Type); + fl = fl && importsymbol (hm, "PyComplex_ImagAsDouble", (void**) &py.ptr_PyComplex_ImagAsDouble); + fl = fl && importsymbol (hm, "PyComplex_RealAsDouble", (void**) &py.ptr_PyComplex_RealAsDouble); + + fl = fl && importsymbol (hm, "PyDict_Type", (void**) &py.ptr_PyDict_Type); + fl = fl && importsymbol (hm, "PyDict_GetItem", (void**) &py.ptr_PyDict_GetItem); + fl = fl && importsymbol (hm, "PyDict_GetItemString", (void**) &py.ptr_PyDict_GetItemString); + fl = fl && importsymbol (hm, "PyDict_Keys", (void**) &py.ptr_PyDict_Keys); + fl = fl && importsymbol (hm, "PyDict_New", (void**) &py.ptr_PyDict_New); + fl = fl && importsymbol (hm, "PyDict_SetItemString", (void**) &py.ptr_PyDict_SetItemString); + + fl = fl && importsymbol (hm, "PyFloat_Type", (void**) &py.ptr_PyFloat_Type); + fl = fl && importsymbol (hm, "PyFloat_AsDouble", (void**) &py.ptr_PyFloat_AsDouble); + + fl = fl && importsymbol (hm, "PyInt_Type", (void**) &py.ptr_PyInt_Type); + fl = fl && importsymbol (hm, "PyInt_AsLong", (void**) &py.ptr_PyInt_AsLong); + + fl = fl && importsymbol (hm, "PyList_Append", (void**) &py.ptr_PyList_Append); + fl = fl && importsymbol (hm, "PyList_GetItem", (void**) &py.ptr_PyList_GetItem); + fl = fl && importsymbol (hm, "PyList_SetItem", (void**) &py.ptr_PyList_SetItem); + fl = fl && importsymbol (hm, "PyList_New", (void**) &py.ptr_PyList_New); + fl = fl && importsymbol (hm, "PyList_Size", (void**) &py.ptr_PyList_Size); + + fl = fl && importsymbol (hm, "PyLong_Type", (void**) &py.ptr_PyLong_Type); + + fl = fl && importsymbol (hm, "Py_FindMethod", (void**) &py.ptr_Py_FindMethod); + + fl = fl && importsymbol (hm, "Py_BuildValue", (void**) &py.ptr_Py_BuildValue); + fl = fl && importsymbol (hm, "Py_InitModule4", (void**) &py.ptr_Py_InitModule4); + fl = fl && importsymbol (hm, "PyArg_ParseTuple", (void**) &py.ptr_PyArg_ParseTuple); + fl = fl && importsymbol (hm, "PyModule_AddObject", (void**) &py.ptr_PyModule_AddObject); + + fl = fl && importsymbol (hm, "_Py_NoneStruct", (void**) &py.ptr__Py_NoneStruct); + fl = fl && importsymbol (hm, "PyObject_GetAttrString", (void**) &py.ptr_PyObject_GetAttrString); + fl = fl && importsymbol (hm, "PyObject_Str", (void**) &py.ptr_PyObject_Str); + fl = fl && importsymbol (hm, "PyType_GenericNew", (void**) &py.ptr_PyType_GenericNew); + fl = fl && importsymbol (hm, "PyType_IsSubtype", (void**) &py.ptr_PyType_IsSubtype); + fl = fl && importsymbol (hm, "PyType_Ready", (void**) &py.ptr_PyType_Ready); + #ifdef Py_REF_DEBUG + fl = fl && importsymbol (hm, "_Py_RefTotal", (void**) &py.ptr__Py_RefTotal); + fl = fl && importsymbol (hm, "_Py_NegativeRefcount", (void**) &py.ptr__Py_NegativeRefcount); + #endif + #ifdef Py_TRACE_REFS + fl = fl && importsymbol (hm, "_Py_Dealloc", (void**) &py.ptr__Py_Dealloc); + #endif + + fl = fl && importsymbol (hm, "_PyObject_New", (void**) &py.ptr__PyObject_New); + + fl = fl && importsymbol (hm, "PyExc_IndexError", (void**) &py.ptr_PyExc_IndexError); + fl = fl && importsymbol (hm, "PyExc_KeyError", (void**) &py.ptr_PyExc_KeyError); + fl = fl && importsymbol (hm, "PyExc_SyntaxError", (void**) &py.ptr_PyExc_SyntaxError); + fl = fl && importsymbol (hm, "PyExc_SystemError", (void**) &py.ptr_PyExc_SystemError); + fl = fl && importsymbol (hm, "PyExc_TypeError", (void**) &py.ptr_PyExc_TypeError); + fl = fl && importsymbol (hm, "PyExc_ValueError", (void**) &py.ptr_PyExc_ValueError); + fl = fl && importsymbol (hm, "PyErr_Clear", (void**) &py.ptr_PyErr_Clear); + fl = fl && importsymbol (hm, "PyErr_Occurred", (void**) &py.ptr_PyErr_Occurred); + fl = fl && importsymbol (hm, "PyErr_Print", (void**) &py.ptr_PyErr_Print); + fl = fl && importsymbol (hm, "PyErr_SetString", (void**) &py.ptr_PyErr_SetString); + + fl = fl && importsymbol (hm, "Py_Finalize", (void**) &py.ptr_Py_Finalize); + fl = fl && importsymbol (hm, "Py_Initialize", (void**) &py.ptr_Py_Initialize); + fl = fl && importsymbol (hm, "Py_IsInitialized", (void**) &py.ptr_Py_IsInitialized); + fl = fl && importsymbol (hm, "PyRun_String", (void**) &py.ptr_PyRun_String); + + fl = fl && importsymbol (hm, "PyString_Type", (void**) &py.ptr_PyString_Type); + fl = fl && importsymbol (hm, "PyString_AsString", (void**) &py.ptr_PyString_AsString); + fl = fl && importsymbol (hm, "PyString_FromString", (void**) &py.ptr_PyString_FromString); + + if (fl) + py.hmodule = hm; /*success!*/ + else + FreeLibrary (hm); + + return (fl); + } /*loadpythonlib*/ + + + static void freepythonlib () { + + if (py.hmodule != NULL) { + + FreeLibrary (py.hmodule); + + py.hmodule = NULL; + } + + } /*freepythonlib*/ + + + #endif /*WIN95VERSION*/ + + /* forward declarations */ *************** *** 1230,1233 **** --- 1517,1525 ---- boolean pythoninitverbs (void) { + + #ifdef WIN95VERSION + loadpythonlib (); + #endif + return (loadfunctionprocessor (idpythonverbs, &pythonfunctionvalue)); } |
|
From: Andre R. <and...@us...> - 2004-11-23 22:12:45
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10825 Modified Files: Tag: sidewinder-branch langpython.c Log Message: Added comment about how to configure Visual Studio 6.0 to compile with Python integration. Index: langpython.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langpython.c,v retrieving revision 1.2.4.9 retrieving revision 1.2.4.10 diff -C2 -d -r1.2.4.9 -r1.2.4.10 *** langpython.c 23 Nov 2004 16:17:52 -0000 1.2.4.9 --- langpython.c 23 Nov 2004 22:12:16 -0000 1.2.4.10 *************** *** 63,66 **** --- 63,77 ---- #ifdef FRONTIER_PYTHON + /* + 2004-11-23 aradke: To compile with Visual Studio 6.0 on Windows, + you need to grab the Python installer from http://www.python.org/ + and install it on your system. Then select the Options command + from the Tools menu, switch to the Directories rider, and add + the paths to the "include" and "libs" directories of your Python + installation to the "Include files" and "Library files" search + paths respectively. Since these paths depend on where you installed + Python on your system, we can't set them for you in our project file. + */ + #include "langpython.h" |
|
From: Andre R. <and...@us...> - 2004-11-23 16:22:24
|
Update of /cvsroot/frontierkernel/Frontier/Common/resources/Mac In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24271 Modified Files: Tag: sidewinder-branch kernvelverbs.r Log Message: Only include python kernel verbs if FRONTIER_PYTHON is defined. Index: kernvelverbs.r =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/resources/Mac/kernvelverbs.r,v retrieving revision 1.2.4.1 retrieving revision 1.2.4.2 diff -C2 -d -r1.2.4.1 -r1.2.4.2 *** kernvelverbs.r 22 Nov 2004 04:33:08 -0000 1.2.4.1 --- kernvelverbs.r 23 Nov 2004 16:22:14 -0000 1.2.4.2 *************** *** 1098,1101 **** --- 1098,1104 ---- }; + + #ifdef FRONTIER_PYTHON + resource 'EFP#' (idpythonverbs, "python") { /* 2004-11-3 ddb: python verbs */ { *************** *** 1108,1110 **** --- 1111,1115 ---- }; + #endif + |