/***{{{******************************************************************* * This file is part of libco - object library for C * * Copyright (c) 2002 Peter Rockai (yenar) * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public * * License as published by the Free Software Foundation; either * * version 2 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 * * General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; see the file COPYING. If not, write to * * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, * * Boston, MA 02111-1307, USA. * *******************************************************************}}}***/ /* {{{ file description */ /** * @file python.c * @brief Interactive python bindings test. **/ /* }}} */ /* {{{ includes */ #include "co_vector.h" #include "test_util.h" #include /* }}} */ CO_OBJECT (co_test, default) { int id; }; #include "python.cometa" /* {{{ */ CO_METH (co_test, hello) { CO_METH_INI (co_test, hello); printf ("Hello world!\n"); CO_RETURN (int, 0); } /* }}} */ /* {{{ */ CO_METH (co_test, setid, int id) { CO_METH_INI (co_test, setid); td -> id = id; CO_RETURN (int, 0); } /* }}} */ /* {{{ */ CO_METH (co_test, printid) { CO_METH_INI (co_test, printid); printf ("%d\n", td -> id); CO_RETURN (int, 0); } /* }}} */ /* {{{ */ CO_METH (co_test, init) { co_test td; td = new (co_test_s); this -> data = td; CO_RETURN (int, 0); } /* }}} */ /* {{{ */ int main (int argc, char **argv) { co v; int i, j, last; co_vector_item item; co super; super = co_init (); __co_file_init_python_c (super); PyRun_SimpleString ("import co_test\n"); printf ("you can play with co_test objects now\n"); Py_Main (argc, argv); CO_M (super, destroy, 0); return 0; } /* }}} */