Author: JonNeal Date: 2008-04-04 01:54:41 -0400 (Fri, 04 Apr 2008) New Revision: 1225
Added: trunk/pysoy/src/actions/Action.pym trunk/pysoy/src/actions/Callback.pym trunk/pysoy/src/actions/Force.pym trunk/pysoy/src/actions/Quit.pym trunk/pysoy/src/actions/Stdout.pym trunk/pysoy/src/actions/__init__.pym Removed: trunk/pysoy/src/actions/Action.pxi trunk/pysoy/src/actions/Callback.pxi trunk/pysoy/src/actions/Force.pxi trunk/pysoy/src/actions/Quit.pxi trunk/pysoy/src/actions/Stdout.pxi Modified: trunk/pysoy/src/actions/soy.actions.pyx Log: Ticket #954 : * Migrated soy.actions to PyMill Deleted: trunk/pysoy/src/actions/Action.pxi =================================================================== --- trunk/pysoy/src/actions/Action.pxi 2008-04-04 05:50:29 UTC (rev 1224) +++ trunk/pysoy/src/actions/Action.pxi 2008-04-04 05:54:41 UTC (rev 1225) @@ -1,44 +0,0 @@ -# PySoy action.Action class -# -# Copyright (C) 2006,2007,2008 PySoy Group -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program; if not, see http://www.gnu.org/licenses -# -# $Id$ - -cdef class Action : - '''PySoy Action - - This is the base Action class which all actions must inherit. - It serves no other function. - ''' - - ############################################################################ - # - # Python functions - # - - def __repr__(self) : - return '<%s>' % self.__class__.__name__ - - - ############################################################################ - # - # C functions - # - - cdef void _perform(self, unsigned int _duration) : - # - # Action does nothing, this function is here only to be replaced - return Copied: trunk/pysoy/src/actions/Action.pym (from rev 1223, trunk/pysoy/src/actions/Action.pxi) =================================================================== --- trunk/pysoy/src/actions/Action.pym (rev 0) +++ trunk/pysoy/src/actions/Action.pym 2008-04-04 05:54:41 UTC (rev 1225) @@ -0,0 +1,44 @@ +# PySoy action.Action class +# +# Copyright (C) 2006,2007,2008 PySoy Group +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program; if not, see http://www.gnu.org/licenses +# +# $Id$ + +cdef class Action : + '''PySoy Action + + This is the base Action class which all actions must inherit. + It serves no other function. + ''' + + ############################################################################ + # + # Python functions + # + + def __repr__(self) : + return '<%s>' % self.__class__.__name__ + + + ############################################################################ + # + # C functions + # + + cdef void _perform(self, unsigned int _duration) : + # + # Action does nothing, this function is here only to be replaced + return Deleted: trunk/pysoy/src/actions/Callback.pxi =================================================================== --- trunk/pysoy/src/actions/Callback.pxi 2008-04-04 05:50:29 UTC (rev 1224) +++ trunk/pysoy/src/actions/Callback.pxi 2008-04-04 05:54:41 UTC (rev 1225) @@ -1,54 +0,0 @@ -# PySoy action.Callback class -# -# Copyright (C) 2006,2007,2008 PySoy Group -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program; if not, see http://www.gnu.org/licenses -# -# $Id$ - -cimport py - -cdef class Callback (Action) : - '''soy.actions.Callback - - This is a Python callback action. - ''' - - ############################################################################ - # - # Python functions - # - - def __cinit__(self, callback) : - self._callback = callback - - - ############################################################################ - # - # C functions - # - - cdef void _perform(self, unsigned int _duration): - cdef soy._internals.AsyncQueue _queue - _queue = soy._internals._getQueue() - # - # We're pushing this as a <void*>, thus, we must manually INCREF it - # so Python doesn't garbage-collect before it's executed. It'll be - # DECREF'ed by the EventLoop thread. - py.Py_INCREF(self._callback) - # - # Add a pointer to the function to the callback queue and return. - # In most cases the EventLoop thread is waiting for an item to be - # added so this will be executed immediately. - _queue._push(<void*> self._callback) Copied: trunk/pysoy/src/actions/Callback.pym (from rev 1223, trunk/pysoy/src/actions/Callback.pxi) =================================================================== --- trunk/pysoy/src/actions/Callback.pym (rev 0) +++ trunk/pysoy/src/actions/Callback.pym 2008-04-04 05:54:41 UTC (rev 1225) @@ -0,0 +1,54 @@ +# PySoy action.Callback class +# +# Copyright (C) 2006,2007,2008 PySoy Group +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program; if not, see http://www.gnu.org/licenses +# +# $Id$ + +cimport py + +cdef class Callback (Action) : + '''soy.actions.Callback + + This is a Python callback action. + ''' + + ############################################################################ + # + # Python functions + # + + def __cinit__(self, callback) : + self._callback = callback + + + ############################################################################ + # + # C functions + # + + cdef void _perform(self, unsigned int _duration): + cdef soy._internals.AsyncQueue _queue + _queue = soy._internals._getQueue() + # + # We're pushing this as a <void*>, thus, we must manually INCREF it + # so Python doesn't garbage-collect before it's executed. It'll be + # DECREF'ed by the EventLoop thread. + py.Py_INCREF(self._callback) + # + # Add a pointer to the function to the callback queue and return. + # In most cases the EventLoop thread is waiting for an item to be + # added so this will be executed immediately. + _queue._push(<void*> self._callback) Deleted: trunk/pysoy/src/actions/Force.pxi =================================================================== --- trunk/pysoy/src/actions/Force.pxi 2008-04-04 05:50:29 UTC (rev 1224) +++ trunk/pysoy/src/actions/Force.pxi 2008-04-04 05:54:41 UTC (rev 1225) @@ -1,49 +0,0 @@ -# PySoy's action.Force class -# -# Copyright (C) 2006,2007,2008 PySoy Group -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program; if not, see http://www.gnu.org/licenses -# -# $Id$ - -cdef class Force (Action) : - '''soy.actions.Force - - Adds velocity to it's target. - First argument is the force's target, an instance of soy.bodies.Body. - ''' - - ############################################################################ - # - # Python functions - # - - def __cinit__(self, target, xforce, yforce, zforce, *args, **kw) : - if not isinstance(target, soy.bodies.Body) : - raise TypeError('first argument must be an instance of soy.bodies.Body') - self._target = target - self._vector[0] = xforce - self._vector[1] = yforce - self._vector[2] = zforce - - - ############################################################################ - # - # C functions - # - - cdef void _perform(self, unsigned int _duration) : - # - # Body._addForce calls ode.dBodyAddForce on itself with proper locking - (<soy.bodies.Body> self._target)._addForce(self._vector) Copied: trunk/pysoy/src/actions/Force.pym (from rev 1223, trunk/pysoy/src/actions/Force.pxi) =================================================================== --- trunk/pysoy/src/actions/Force.pym (rev 0) +++ trunk/pysoy/src/actions/Force.pym 2008-04-04 05:54:41 UTC (rev 1225) @@ -0,0 +1,49 @@ +# PySoy's action.Force class +# +# Copyright (C) 2006,2007,2008 PySoy Group +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program; if not, see http://www.gnu.org/licenses +# +# $Id$ + +cdef class Force (Action) : + '''soy.actions.Force + + Adds velocity to it's target. + First argument is the force's target, an instance of soy.bodies.Body. + ''' + + ############################################################################ + # + # Python functions + # + + def __cinit__(self, target, xforce, yforce, zforce, *args, **kw) : + if not isinstance(target, soy.bodies.Body) : + raise TypeError('first argument must be an instance of soy.bodies.Body') + self._target = target + self._vector[0] = xforce + self._vector[1] = yforce + self._vector[2] = zforce + + + ############################################################################ + # + # C functions + # + + cdef void _perform(self, unsigned int _duration) : + # + # Body._addForce calls ode.dBodyAddForce on itself with proper locking + (<soy.bodies.Body> self._target)._addForce(self._vector) Deleted: trunk/pysoy/src/actions/Quit.pxi =================================================================== --- trunk/pysoy/src/actions/Quit.pxi 2008-04-04 05:50:29 UTC (rev 1224) +++ trunk/pysoy/src/actions/Quit.pxi 2008-04-04 05:54:41 UTC (rev 1225) @@ -1,33 +0,0 @@ -# PySoy actions.Quit class -# -# Copyright (C) 2006,2007,2008 PySoy Group -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program; if not, see http://www.gnu.org/licenses -# -# $Id$ - -cdef class Quit (Action) : - '''PySoy Quit - - When called PySoy will quit. There are no arguments to this class. - See soy.actions.Action for more information. - ''' - - ############################################################################ - # - # C functions - # - - cdef void _perform(self, unsigned int _duration) : - stdio.c_raise(15) Copied: trunk/pysoy/src/actions/Quit.pym (from rev 1223, trunk/pysoy/src/actions/Quit.pxi) =================================================================== --- trunk/pysoy/src/actions/Quit.pym (rev 0) +++ trunk/pysoy/src/actions/Quit.pym 2008-04-04 05:54:41 UTC (rev 1225) @@ -0,0 +1,33 @@ +# PySoy actions.Quit class +# +# Copyright (C) 2006,2007,2008 PySoy Group +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program; if not, see http://www.gnu.org/licenses +# +# $Id$ + +cdef class Quit (Action) : + '''PySoy Quit + + When called PySoy will quit. There are no arguments to this class. + See soy.actions.Action for more information. + ''' + + ############################################################################ + # + # C functions + # + + cdef void _perform(self, unsigned int _duration) : + stdio.c_raise(15) Deleted: trunk/pysoy/src/actions/Stdout.pxi =================================================================== --- trunk/pysoy/src/actions/Stdout.pxi 2008-04-04 05:50:29 UTC (rev 1224) +++ trunk/pysoy/src/actions/Stdout.pxi 2008-04-04 05:54:41 UTC (rev 1225) @@ -1,42 +0,0 @@ -# PySoy actions.Quit class -# -# Copyright (C) 2006,2007,2008 PySoy Group -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program; if not, see http://www.gnu.org/licenses -# -# $Id: Print.pxi 732 2008-01-01 22:37:47Z DavidCzech $ - -cdef class Stdout (Action): - '''PySoy Print - - When called PySoy will print to stdout. There is an argument for what text to print. - See soy.actions.Action for more information. - ''' - - ############################################################################ - # - # Python functions - # - - def __cinit__(self,text,*args, **kw) : - self._text = text - - - ############################################################################ - # - # C functions - # - - cdef void _perform(self, unsigned int _duration) : - stdio.printf("%s\n", self._text) Copied: trunk/pysoy/src/actions/Stdout.pym (from rev 1223, trunk/pysoy/src/actions/Stdout.pxi) =================================================================== --- trunk/pysoy/src/actions/Stdout.pym (rev 0) +++ trunk/pysoy/src/actions/Stdout.pym 2008-04-04 05:54:41 UTC (rev 1225) @@ -0,0 +1,42 @@ +# PySoy actions.Quit class +# +# Copyright (C) 2006,2007,2008 PySoy Group +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program; if not, see http://www.gnu.org/licenses +# +# $Id: Print.pxi 732 2008-01-01 22:37:47Z DavidCzech $ + +cdef class Stdout (Action): + '''PySoy Print + + When called PySoy will print to stdout. There is an argument for what text to print. + See soy.actions.Action for more information. + ''' + + ############################################################################ + # + # Python functions + # + + def __cinit__(self,text,*args, **kw) : + self._text = text + + + ############################################################################ + # + # C functions + # + + cdef void _perform(self, unsigned int _duration) : + stdio.printf("%s\n", self._text) Copied: trunk/pysoy/src/actions/__init__.pym (from rev 1223, trunk/pysoy/src/stubs/Stub.pxi) =================================================================== --- trunk/pysoy/src/actions/__init__.pym (rev 0) +++ trunk/pysoy/src/actions/__init__.pym 2008-04-04 05:54:41 UTC (rev 1225) @@ -0,0 +1,21 @@ +# PySoy's stubs.Stub +# +# Copyright (C) 2006,2007,2008 PySoy Group +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program; if not, see http://www.gnu.org/licenses +# +# $Id$ + +cimport ode +cimport stdio Modified: trunk/pysoy/src/actions/soy.actions.pyx =================================================================== --- trunk/pysoy/src/actions/soy.actions.pyx 2008-04-04 05:50:29 UTC (rev 1224) +++ trunk/pysoy/src/actions/soy.actions.pyx 2008-04-04 05:54:41 UTC (rev 1225) @@ -23,11 +23,8 @@ 'by '+'$Author$'[9:-2] __version__ = 'Trunk (r'+'$Rev$'[6:-2]+')' -cimport ode -cimport stdio - -include "Action.pxi" -include "Callback.pxi" -include "Force.pxi" -include "Quit.pxi" -include "Stdout.pxi" +include "Action.pym" +include "Callback.pym" +include "Force.pym" +include "Quit.pym" +include "Stdout.pym" _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn