[Gcblue-commits] gcb_wx/src/scriptinterface tcFlightPortInterface.cpp,1.8,1.9 tcGroupInterface.cpp,1
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2006-03-23 01:11:22
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10630/src/scriptinterface Modified Files: tcFlightPortInterface.cpp tcGroupInterface.cpp tcPanelInterface.cpp tcPlatformInterface.cpp tcPlatformInterfaceExtension.cpp tcPlatformInterfaceExtensionB.cpp tcPythonInterface.cpp tcScenarioInterface.cpp tcSimPythonInterface.cpp tcSubInterface.cpp tcTrackInterface.cpp Log Message: vc8 updates Index: tcPlatformInterfaceExtension.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterfaceExtension.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tcPlatformInterfaceExtension.cpp 1 Jun 2005 00:13:32 -0000 1.17 --- tcPlatformInterfaceExtension.cpp 23 Mar 2006 01:11:02 -0000 1.18 *************** *** 1,4 **** /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,4 ---- /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 44,48 **** void tcPlatformInterface::InitPythonClassesA() { ! object class_track = class_<tcTrack>("tcTrack") .def_readwrite("Alt",&tcTrack::mfAlt_m) .def_readwrite("Lat",&tcTrack::mfLat_rad) --- 44,48 ---- void tcPlatformInterface::InitPythonClassesA() { ! class_<tcTrack>("tcTrack") .def_readwrite("Alt",&tcTrack::mfAlt_m) .def_readwrite("Lat",&tcTrack::mfLat_rad) *************** *** 66,70 **** ; ! object class_smtrack = class_<tcSensorMapTrack>("tcSMTrack") .def_readwrite("Alt",&tcSensorMapTrack::mfAlt_m) .def_readwrite("Lat",&tcSensorMapTrack::mfLat_rad) --- 66,70 ---- ; ! class_<tcSensorMapTrack>("tcSMTrack") .def_readwrite("Alt",&tcSensorMapTrack::mfAlt_m) .def_readwrite("Lat",&tcSensorMapTrack::mfLat_rad) *************** *** 77,80 **** --- 77,81 ---- .def_readonly("Time", &tcSensorMapTrack::mfTimestamp) .def("IsAir", &tcSensorMapTrack::IsAir) + .def("IsDestroyed", &tcSensorMapTrack::IsDestroyed) .def("IsMissile", &tcSensorMapTrack::IsMissile) .def("IsSurface", &tcSensorMapTrack::IsSurface) *************** *** 131,134 **** --- 132,138 ---- .def_readonly("SectorCenter", &tcLauncherInfo::sectorCenter) .def_readonly("SectorWidth", &tcLauncherInfo::sectorWidth) + .def_readonly("FireControlTracks", &tcLauncherInfo::fireControlTracks) + .def_readonly("MaxFireControlTracks", &tcLauncherInfo::maxFireControlTracks) + .def("IsValid", &tcLauncherInfo::IsValid) ; Index: tcScenarioInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcScenarioInterface.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** tcScenarioInterface.cpp 14 Jan 2006 17:13:59 -0000 1.37 --- tcScenarioInterface.cpp 23 Mar 2006 01:11:02 -0000 1.38 *************** *** 2,6 **** ** tcScenarioInterface.cpp ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** tcScenarioInterface.cpp ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 153,159 **** // Interface class management methods ! void tcScenarioInterface::AddGoalClasses(boost::python::dict *dictionary) { ! InitGoalPython(dictionary); } --- 153,159 ---- // Interface class management methods ! void tcScenarioInterface::AddGoalClasses() { ! InitGoalPython(); } *************** *** 208,211 **** --- 208,212 ---- .def("SetAllianceGoal",&tcScenarioInterface::SetAllianceGoal) .def("SetDateTime",&tcScenarioInterface::SetDateTime) + .def("SetPerfectScore",&tcScenarioInterface::SetPerfectScore) .def("SetScenarioDescription",&tcScenarioInterface::SetScenarioDescription) .def("SetScenarioLoaded",&tcScenarioInterface::SetScenarioLoaded) *************** *** 619,622 **** --- 620,628 ---- } + void tcScenarioInterface::SetPerfectScore(float score) + { + tcGoalTracker::Get()->SetPerfectScore(score); + } + void tcScenarioInterface::SetScenarioDescription(std::string s) { Index: tcTrackInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcTrackInterface.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcTrackInterface.cpp 10 Sep 2005 21:47:38 -0000 1.10 --- tcTrackInterface.cpp 23 Mar 2006 01:11:02 -0000 1.11 *************** *** 2,6 **** ** tcTrackInterface.cpp ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** tcTrackInterface.cpp ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcFlightPortInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcFlightPortInterface.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcFlightPortInterface.cpp 22 Jun 2005 01:22:08 -0000 1.8 --- tcFlightPortInterface.cpp 23 Mar 2006 01:11:02 -0000 1.9 *************** *** 2,6 **** ** @file tcFlightPortInterface.cpp */ ! /* Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcFlightPortInterface.cpp */ ! /* Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** tcPlatformInterface.cpp 14 Jan 2006 17:13:59 -0000 1.58 --- tcPlatformInterface.cpp 23 Mar 2006 01:11:02 -0000 1.59 *************** *** 2,6 **** ** @file tcPlatformInterface.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcPlatformInterface.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 523,526 **** --- 523,529 ---- info.sectorWidth = C_180OVERPI * pLauncher->GetSectorWidth(); + info.fireControlTracks = pLauncher->GetFireControlTrackCount(); + info.maxFireControlTracks = pLauncher->GetMaxFireControlTracks(); + info.maxDepth_m = 0; *************** *** 572,576 **** } else if ((pLauncher->meLaunchMode == SEEKER_TRACK)|| ! (pLauncher->meLaunchMode == FC_TRACK)) { info.mnLaunchMode = 1; --- 575,580 ---- } else if ((pLauncher->meLaunchMode == SEEKER_TRACK)|| ! (pLauncher->meLaunchMode == FC_TRACK) || ! (pLauncher->meLaunchMode == TARGET_ONLY)) { info.mnLaunchMode = 1; Index: tcPlatformInterfaceExtensionB.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterfaceExtensionB.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** tcPlatformInterfaceExtensionB.cpp 12 Dec 2005 02:37:01 -0000 1.29 --- tcPlatformInterfaceExtensionB.cpp 23 Mar 2006 01:11:02 -0000 1.30 *************** *** 2,6 **** ** @file tcPlatformInterfaceExtensionB.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcPlatformInterfaceExtensionB.cpp */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcSimPythonInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcSimPythonInterface.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** tcSimPythonInterface.cpp 18 Dec 2005 04:10:33 -0000 1.42 --- tcSimPythonInterface.cpp 23 Mar 2006 01:11:02 -0000 1.43 *************** *** 302,307 **** try { ! handle<>( PyRun_String(azCommand ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } catch(error_already_set) --- 302,307 ---- try { ! handle<> ignored( PyRun_String(azCommand ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); } catch(error_already_set) *************** *** 326,330 **** { handle<>( PyRun_String(azCommand ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } catch (error_already_set) --- 326,330 ---- { handle<>( PyRun_String(azCommand ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); } catch (error_already_set) *************** *** 394,398 **** { handle<>( PyRun_String("Menu.BuildGroupMenu(UserMenu, GroupInfo)" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } catch(error_already_set) --- 394,398 ---- { handle<>( PyRun_String("Menu.BuildGroupMenu(UserMenu, GroupInfo)" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); } catch(error_already_set) *************** *** 411,415 **** { handle<>( PyRun_String("Menu.BuildUnitMenu(UserMenu, HookedUnitInfo)" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } catch(error_already_set) --- 411,415 ---- { handle<>( PyRun_String("Menu.BuildUnitMenu(UserMenu, HookedUnitInfo)" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); } catch(error_already_set) *************** *** 428,432 **** { handle<>( PyRun_String("Menu.BuildUnitEditMenu(UserMenu, HookedUnitInfo)" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } catch(error_already_set) --- 428,432 ---- { handle<>( PyRun_String("Menu.BuildUnitEditMenu(UserMenu, HookedUnitInfo)" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); } catch(error_already_set) *************** *** 482,487 **** try { ! handle<>( PyRun_String(commandtext ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); return 0; } --- 482,487 ---- try { ! handle<> ignored( PyRun_String(commandtext ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); return 0; } *************** *** 1001,1009 **** { handle<>( PyRun_String("import AI\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); handle<>( PyRun_String("import Menu\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); handle<>( PyRun_String("print ''\nprint 'Re-imported modules'\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } catch (error_already_set) --- 1001,1009 ---- { handle<>( PyRun_String("import AI\n" ! , Py_file_input, main_namespace.ptr(),main_namespace.ptr()) ); handle<>( PyRun_String("import Menu\n" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); handle<>( PyRun_String("print ''\nprint 'Re-imported modules'\n" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); } catch (error_already_set) *************** *** 1137,1141 **** handle<>( PyRun_String("hello = file('settest.txt', 'a')\n" "hello.write('Y is ' + str(Y) + '\\n')\n" ! "hello.close()", Py_file_input,mpDictionary->ptr(), mpDictionary->ptr()) ); } catch (error_already_set) --- 1137,1141 ---- handle<>( PyRun_String("hello = file('settest.txt', 'a')\n" "hello.write('Y is ' + str(Y) + '\\n')\n" ! "hello.close()", Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); } catch (error_already_set) *************** *** 1180,1188 **** "myout.truncate(0)\n" "myerr.truncate(0)\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); if (showPythonErrors) { ! handle<> errorTextHandle(borrowed(PyDict_GetItemString(mpDictionary->ptr(), "ErrorText"))); str textObject(errorTextHandle); --- 1180,1188 ---- "myout.truncate(0)\n" "myerr.truncate(0)\n" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); if (showPythonErrors) { ! handle<> errorTextHandle(borrowed(PyDict_GetItemString(main_namespace.ptr(), "ErrorText"))); str textObject(errorTextHandle); *************** *** 1306,1310 **** object scenarioInterfaceType = tcScenarioInterface::GetInterface(); ! tcScenarioInterface::AddGoalClasses(mpDictionary); ScenarioInterface = scenarioInterfaceType(); scenarioInterface = extract<tcScenarioInterface*>(ScenarioInterface); --- 1306,1310 ---- object scenarioInterfaceType = tcScenarioInterface::GetInterface(); ! tcScenarioInterface::AddGoalClasses(); ScenarioInterface = scenarioInterfaceType(); scenarioInterface = extract<tcScenarioInterface*>(ScenarioInterface); *************** *** 1316,1334 **** // add PlatformInterface to python environment as global var // called "UnitInfo" ! PyDict_SetItemString(mpDictionary->ptr(), "UnitInfo", PlatformInterface.ptr()); ! PyDict_SetItemString(mpDictionary->ptr(), "HookedUnitInfo", HookedPlatformInterface.ptr()); ! PyDict_SetItemString(mpDictionary->ptr(), "UserMenu", MenuInterface.ptr()); ! PyDict_SetItemString(mpDictionary->ptr(), "UserPanel", PanelInterface.ptr()); ! PyDict_SetItemString(mpDictionary->ptr(), "FlightPortInfo", FlightPortInterface.ptr()); ! PyDict_SetItemString(mpDictionary->ptr(), "HookedTrackInfo", TrackInterface.ptr()); ! PyDict_SetItemString(mpDictionary->ptr(), "ScenarioManager", ScenarioInterface.ptr()); ! PyDict_SetItemString(mpDictionary->ptr(), "GroupInfo", GroupInterface.ptr()); ! PyDict_SetItemString(mpDictionary->ptr(), "TaskInterface", TaskInterfaceObject.ptr()); ! PyDict_SetItemString(mpDictionary->ptr(), "Y", PyInt_FromLong(2)); /* dict['Y']=2 */ // import AI script try { ! handle<>( PyRun_String("import sys\n" "import StringIO\n" "myout = StringIO.StringIO()\n" --- 1316,1334 ---- // add PlatformInterface to python environment as global var // called "UnitInfo" ! PyDict_SetItemString(main_namespace.ptr(), "UnitInfo", PlatformInterface.ptr()); ! PyDict_SetItemString(main_namespace.ptr(), "HookedUnitInfo", HookedPlatformInterface.ptr()); ! PyDict_SetItemString(main_namespace.ptr(), "UserMenu", MenuInterface.ptr()); ! PyDict_SetItemString(main_namespace.ptr(), "UserPanel", PanelInterface.ptr()); ! PyDict_SetItemString(main_namespace.ptr(), "FlightPortInfo", FlightPortInterface.ptr()); ! PyDict_SetItemString(main_namespace.ptr(), "HookedTrackInfo", TrackInterface.ptr()); ! PyDict_SetItemString(main_namespace.ptr(), "ScenarioManager", ScenarioInterface.ptr()); ! PyDict_SetItemString(main_namespace.ptr(), "GroupInfo", GroupInterface.ptr()); ! PyDict_SetItemString(main_namespace.ptr(), "TaskInterface", TaskInterfaceObject.ptr()); ! PyDict_SetItemString(main_namespace.ptr(), "Y", PyInt_FromLong(2)); /* dict['Y']=2 */ // import AI script try { ! handle<> ignored( PyRun_String("import sys\n" "import StringIO\n" "myout = StringIO.StringIO()\n" *************** *** 1342,1354 **** "outfile.close()\n" "errfile.close()\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); ! handle<>( PyRun_String("import AI\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); ! handle<>( PyRun_String("import Menu\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); ! handle<>( PyRun_String("print globals()\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } catch (error_already_set) --- 1342,1354 ---- "outfile.close()\n" "errfile.close()\n" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); ! handle<> ignored2( PyRun_String("import AI\n" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); ! handle<> ignored3( PyRun_String("import Menu\n" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); ! handle<> ignored4( PyRun_String("print globals()\n" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); } catch (error_already_set) *************** *** 1371,1375 **** { /*** print standard error to file ***/ ! handle<>( PyRun_String( "outfile = file('log\\pyout.txt', 'a')\n" "errfile = file('log\\pyerr.txt', 'a')\n" --- 1371,1375 ---- { /*** print standard error to file ***/ ! handle<> ignored( PyRun_String( "outfile = file('log\\pyout.txt', 'a')\n" "errfile = file('log\\pyerr.txt', 'a')\n" *************** *** 1378,1382 **** "outfile.close()\n" "errfile.close()\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } --- 1378,1382 ---- "outfile.close()\n" "errfile.close()\n" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); } Index: tcSubInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcSubInterface.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcSubInterface.cpp 14 Jul 2005 23:42:23 -0000 1.6 --- tcSubInterface.cpp 23 Mar 2006 01:11:02 -0000 1.7 *************** *** 2,6 **** ** @file tcSubInterface.cpp */ ! /* Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcSubInterface.cpp */ ! /* Copyright (C) 2004 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcGroupInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcGroupInterface.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcGroupInterface.cpp 1 Jun 2005 00:13:32 -0000 1.3 --- tcGroupInterface.cpp 23 Mar 2006 01:11:02 -0000 1.4 *************** *** 2,6 **** ** @file tcGroupInterface.cpp */ ! /* Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** @file tcGroupInterface.cpp */ ! /* Copyright (C) 2004 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcPanelInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPanelInterface.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcPanelInterface.cpp 1 Jun 2005 00:13:32 -0000 1.6 --- tcPanelInterface.cpp 23 Mar 2006 01:11:02 -0000 1.7 *************** *** 2,6 **** ** tcPanelInterface.cpp ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** tcPanelInterface.cpp ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. Index: tcPythonInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPythonInterface.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcPythonInterface.cpp 25 Jun 2005 22:10:36 -0000 1.9 --- tcPythonInterface.cpp 23 Mar 2006 01:11:02 -0000 1.10 *************** *** 2,6 **** ** tcPythonInterface.cpp ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** tcPythonInterface.cpp ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 94,98 **** tcTest::mpOutside = &outside; ! PyDict_SetItemString(mpDictionary->ptr(), "Y", PyInt_FromLong(2)); /* dict['Y']=2 */ object class_a = class_<tcTest>("test") --- 94,98 ---- tcTest::mpOutside = &outside; ! PyDict_SetItemString(main_namespace.ptr(), "Y", PyInt_FromLong(2)); /* dict['Y']=2 */ object class_a = class_<tcTest>("test") *************** *** 107,111 **** instance_a.attr("x") = 77; ! PyDict_SetItemString(mpDictionary->ptr(), "A", instance_a.ptr()); try { --- 107,111 ---- instance_a.attr("x") = 77; ! PyDict_SetItemString(main_namespace.ptr(), "A", instance_a.ptr()); try { *************** *** 119,123 **** "outfile.write('A.geto(1) is '+str(A.geto(1))+'\\n')\n" "outfile.close()\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); handle<>( PyRun_String( --- 119,123 ---- "outfile.write('A.geto(1) is '+str(A.geto(1))+'\\n')\n" "outfile.close()\n" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); handle<>( PyRun_String( *************** *** 125,129 **** "A.setytox2()\n" "A.setx(A.geto(1))\n" ! , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } catch(error_already_set) { --- 125,129 ---- "A.setytox2()\n" "A.setx(A.geto(1))\n" ! , Py_file_input, main_namespace.ptr(), main_namespace.ptr()) ); } catch(error_already_set) { *************** *** 160,167 **** ! tcPythonInterface::tcPythonInterface(void) { Py_Initialize(); // untested code: char *path, *newpath; --- 160,173 ---- ! tcPythonInterface::tcPythonInterface() { Py_Initialize(); + + + main_module = object(handle<>(borrowed(PyImport_AddModule("__main__")))); + + main_namespace = main_module.attr("__dict__"); + // untested code: char *path, *newpath; *************** *** 186,191 **** /* create fresh dictionary */ ! mpDictionary = new dict(handle<>(borrowed(PyDict_New()))); ! PyDict_SetItemString(mpDictionary->ptr(), "__builtins__", PyEval_GetBuiltins()); } --- 192,197 ---- /* create fresh dictionary */ ! //mpDictionary = new dict(handle<>(borrowed(PyDict_New()))); ! PyDict_SetItemString(main_namespace.ptr(), "__builtins__", PyEval_GetBuiltins()); } *************** *** 204,208 **** ); */ ! if (mpDictionary != NULL) {delete mpDictionary;} Py_Finalize(); } --- 210,214 ---- ); */ ! Py_Finalize(); } |