All Kiki objects are managed by the C++ code, even if they are constructed from Python. The SWIG bindings tried to make this clear by inhibiting the generation of destructors, but this causes run-time warnings with current SWIG. This is an alternative method. Peter De Wachter (pdewacht@gmail.com) placed in the public domain Status: submitted upstream --- a/SWIG/KikiItems.i +++ b/SWIG/KikiItems.i @@ -1,7 +1,4 @@ - // __________________________________________________________________________________________________ -%nodefault; - class KikiFace { public: // ........................................................................ PUBLIC @@ -10,7 +7,7 @@ }; // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiWire::KikiWire() %{self.thisown = 0%} class KikiWire : public KikiObject { @@ -33,7 +30,7 @@ %} // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiGear::KikiGear() %{self.thisown = 0%} class KikiGear : public KikiObject, public KikiFace { @@ -55,7 +52,7 @@ %} // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiValve::KikiValve() %{self.thisown = 0%} class KikiValve : public KikiObject, public KikiFace { @@ -74,7 +71,7 @@ %} // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiMotorCylinder::KikiMotorCylinder() %{self.thisown = 0%} class KikiMotorCylinder : public KikiObject { @@ -85,7 +82,7 @@ }; // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiMotorGear::KikiMotorGear() %{self.thisown = 0%} class KikiMotorGear : public KikiGear { @@ -96,7 +93,7 @@ }; // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiGenerator::KikiGenerator() %{self.thisown = 0%} class KikiGenerator : public KikiGear { @@ -107,7 +104,7 @@ }; // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiLight::KikiLight() %{self.thisown = 0%} class KikiLight : public KikiObject { @@ -126,7 +123,7 @@ %} // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiCellText::KikiCellText(const std::string &) %{self.thisown = 0%} class KikiCellText : public KikiObject, public KikiText { @@ -146,7 +143,7 @@ %} // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiStone::KikiStone() %{self.thisown = 0%} class KikiStone : public KikiObject { @@ -164,7 +161,7 @@ %} // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiWireStone::KikiWireStone() %{self.thisown = 0%} class KikiWireStone : public KikiStone { @@ -182,7 +179,7 @@ %} // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiWall::KikiWall() %{self.thisown = 0%} class KikiWall : public KikiObject { @@ -200,7 +197,7 @@ %} // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiBomb::KikiBomb() %{self.thisown = 0%} class KikiBomb : public KikiObject { @@ -218,7 +215,7 @@ %} // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiSwitch::KikiSwitch() %{self.thisown = 0%} class KikiSwitch : public KikiObject { @@ -240,7 +237,7 @@ %} // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiGate::KikiGate() %{self.thisown = 0%} class KikiGate : public KikiSwitch { @@ -258,7 +255,7 @@ %} // __________________________________________________________________________________________________ -%nodefault; +%nodefaultctor KikiAtom; class KikiAtom : public KikiObject { @@ -269,7 +266,7 @@ }; // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiMovesAtom::KikiMovesAtom() %{self.thisown = 0%} class KikiMovesAtom : public KikiAtom { @@ -279,7 +276,7 @@ // __________________________________________________________________________________________________ /* -%nodefault; +%feature("pythonappend") KikiHealthAtom::KikiHealthAtom() %{self.thisown = 0%} class KikiHealthAtom : public KikiAtom { @@ -297,7 +294,7 @@ %} // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiEnergyAtom::KikiEnergyAtom() %{self.thisown = 0%} class KikiEnergyAtom : public KikiAtom { @@ -315,6 +312,8 @@ %} */ // __________________________________________________________________________________________________ +%feature("pythonappend") KikiValueAtom::KikiValueAtom() %{self.thisown = 0%} + class KikiValueAtom : public KikiAtom { public: // ........................................................................ PUBLIC @@ -325,7 +324,7 @@ }; // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiSpikes::KikiSpikes() %{self.thisown = 0%} class KikiSpikes : public KikiObject { @@ -343,7 +342,7 @@ %} // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiBullet::KikiBullet() %{self.thisown = 0%} class KikiBullet : public KikiObject { --- a/SWIG/KConsole.i +++ b/SWIG/KConsole.i @@ -1,6 +1,6 @@ // -------------------------------------------------------------------------------------------------------- -%nodefault; +%nodefault KConsole; class KConsole : public KWindow { --- a/SWIG/KEventHandler.i +++ b/SWIG/KEventHandler.i @@ -1,6 +1,6 @@ // -------------------------------------------------------------------------------------------------------- -%nodefault; +%nodefault KEventHandler; class KEventHandler { --- a/SWIG/KWindow.i +++ b/SWIG/KWindow.i @@ -1,6 +1,6 @@ // -------------------------------------------------------------------------------------------------------- -%nodefault; +%nodefault KWindow; class KWindow { --- a/SWIG/KikiAction.i +++ b/SWIG/KikiAction.i @@ -1,5 +1,8 @@ // -------------------------------------------------------------------------------------------------------- +%feature("pythonappend") KikiAction::KikiAction(KikiObject *) %{self.thisown = 0%} +%feature("pythonappend") KikiAction::KikiAction(KikiObject *, int id, const std::string &) %{self.thisown = 0%} + class KikiAction { public: // ........................................................................ PUBLIC --- a/SWIG/KikiBot.i +++ b/SWIG/KikiBot.i @@ -1,6 +1,6 @@ // __________________________________________________________________________________________________ -%nodefault; +%nodefault KikiBotStatus; class KikiBotStatus { @@ -26,7 +26,7 @@ }; // __________________________________________________________________________________________________ -%nodefault; +%nodefault KikiBotFume; class KikiBotFume : public KikiObject { @@ -36,7 +36,7 @@ }; // __________________________________________________________________________________________________ -%nodefault; +%nodefault KikiBot; class KikiBot : public KikiObject { @@ -51,4 +51,4 @@ void setMove ( bool ); KikiBotStatus * getStatus (); -}; \ No newline at end of file +}; --- a/SWIG/KikiController.i +++ b/SWIG/KikiController.i @@ -1,6 +1,6 @@ // __________________________________________________________________________________________________ -%nodefault; +%nodefault KikiController; class KikiController : public KEventHandler, public KikiActionObject { --- a/SWIG/KikiEvent.i +++ b/SWIG/KikiEvent.i @@ -1,6 +1,6 @@ // -------------------------------------------------------------------------------------------------------- -%nodefault; +%feature("pythonappend") KikiEvent::KikiEvent(KikiObject *, const std::string &) %{self.thisown = 0%} class KikiEvent { --- a/SWIG/KikiGUI.i +++ b/SWIG/KikiGUI.i @@ -1,13 +1,13 @@ // __________________________________________________________________________________________________ -%nodefault; +%nodefault KikiGUI; class KikiGUI : public KWindow { }; // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiScreenText::KikiScreenText() %{self.thisown = 0%} class KikiScreenText : public KikiText, public KikiActionObject { @@ -21,7 +21,7 @@ }; // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiMenu::KikiMenu() %{self.thisown = 0%} class KikiMenu : public KikiScreenText { @@ -35,7 +35,7 @@ }; // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiColumnMenu::KikiColumnMenu() %{self.thisown = 0%} class KikiColumnMenu : public KikiMenu { @@ -45,7 +45,7 @@ }; // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiScrollMenu::KikiScrollMenu() %{self.thisown = 0%} class KikiScrollMenu : public KikiColumnMenu { @@ -58,7 +58,7 @@ }; // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiPageText::KikiPageText(const std::string &, bool) %{self.thisown = 0%} class KikiPageText : public KikiScreenText { --- a/SWIG/KikiMutant.i +++ b/SWIG/KikiMutant.i @@ -1,6 +1,6 @@ // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiMutant::KikiMutant() %{self.thisown = 0%} class KikiMutant : public KikiBot { --- a/SWIG/KikiObject.i +++ b/SWIG/KikiObject.i @@ -1,6 +1,6 @@ // __________________________________________________________________________________________________ -%nodefault; +%nodefault KikiActionObject; class KikiActionObject { @@ -21,7 +21,7 @@ }; // __________________________________________________________________________________________________ -%nodefault; +%nodefault KikiObject; class KikiObject : public KikiActionObject { --- a/SWIG/KikiPlayer.i +++ b/SWIG/KikiPlayer.i @@ -1,6 +1,6 @@ // __________________________________________________________________________________________________ -%nodefault; +%nodefault KikiStatusDisplay; class KikiStatusDisplay { @@ -11,7 +11,7 @@ }; // __________________________________________________________________________________________________ -%nodefault; +%nodefault KikiPlayback; class KikiPlayback { @@ -22,7 +22,7 @@ }; // __________________________________________________________________________________________________ -%nodefault; +%nodefault KikiPlayer; class KikiPlayer : public KikiBot { --- a/SWIG/KikiPython.i +++ b/SWIG/KikiPython.i @@ -1,6 +1,6 @@ // -------------------------------------------------------------------------------------------------------- -%nodefault; +%nodefault KikiPythonWidget; class KikiPythonWidget { @@ -20,7 +20,7 @@ }; // -------------------------------------------------------------------------------------------------------- -%nodefault; +%nodefault KikiPython; class KikiPython : public KWindow { --- a/SWIG/KikiSound.i +++ b/SWIG/KikiSound.i @@ -1,6 +1,6 @@ // __________________________________________________________________________________________________ -%nodefault; +%nodefault KikiSound; class KikiSound { --- a/SWIG/KikiText.i +++ b/SWIG/KikiText.i @@ -1,6 +1,6 @@ // __________________________________________________________________________________________________ -%nodefault; +%feature("pythonappend") KikiText::KikiText() %{self.thisown = 0%} class KikiText { --- a/SWIG/KikiTypes.i +++ b/SWIG/KikiTypes.i @@ -149,7 +149,7 @@ }; // -------------------------------------------------------------------------------------------------------- -%nodefault; +%nodefault KProjection; class KProjection { @@ -163,7 +163,7 @@ }; // -------------------------------------------------------------------------------------------------------- -%nodefault; +%nodefault KKey; struct KKey { --- a/SWIG/KikiWorld.i +++ b/SWIG/KikiWorld.i @@ -1,6 +1,6 @@ // __________________________________________________________________________________________________ -%nodefault; +%nodefault KikiWorld; class KikiWorld {