Changeset 579 for trunk/zoo-project/zoo-kernel/service_internal_python.c
- Timestamp:
- Feb 12, 2015, 5:01:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service_internal_python.c
r576 r579 1 /* *1 /* 2 2 * Author : Gérald FENOY 3 3 * … … 25 25 #include "service_internal_python.h" 26 26 27 /** 28 * The state for the zoo Python module 29 */ 27 30 struct module_state { 28 31 PyObject *error; 29 32 }; 30 33 … … 43 46 #endif 44 47 48 /** 49 * The exception for the zoo Python module 50 */ 45 51 static PyObject* ZooError; 46 52 53 /** 54 * Function definitions for the zoo Python Module 55 * 56 * Define the following functions available from a service loaded and running 57 * from the ZOO-Kernel Python environment: 58 * - "_" corresponding to the PythonTranslate function 59 * - "updte_status" corresponding to the PythonUpdateStatus function 60 * @see PythonTranslate, PythonUpdateStatus 61 */ 47 62 PyMethodDef zooMethods[] = { 48 63 {"_", PythonTranslate, METH_VARARGS, "Translate a string using the zoo-services textdomain."}, … … 76 91 #endif 77 92 93 /** 94 * Function to create and initialize the zoo Python module 95 * 96 * @return the Python module (for Python versions < 3, nothing for version >=3) 97 */ 78 98 PyMODINIT_FUNC init_zoo(){ 79 99 PyObject *tmp,*d; … … 115 135 } 116 136 137 /** 138 * Loading a Python module then run the function corresponding to the service 139 * by passing the conf, inputs and outputs parameters by reference. 140 * 141 * @param main_conf the conf maps containing the main.cfg settings 142 * @param request the map containing the HTTP request 143 * @param s the service structure 144 * @param real_inputs the maps containing the inputs 145 * @param real_outputs the maps containing the outputs 146 */ 117 147 int zoo_python_support(maps** main_conf,map* request,service* s,maps **real_inputs,maps **real_outputs){ 118 148 char *pythonpath; … … 271 301 } 272 302 303 /** 304 * Repport Python error which may occur on loading the Python module or at 305 * runtime. 306 * 307 * @param m the conf maps containing the main.cfg settings 308 * @param module the service name 309 * @param load 1 if the Python module was not loaded yet 310 */ 273 311 void PythonZooReport(maps* m,const char* module,int load){ 274 312 PyObject *pName, *pModule, *pFunc; … … 335 373 } 336 374 375 /** 376 * Convert a maps to a Python dictionary 377 * 378 * @param t the maps to convert 379 * @return a new PyDictObject containing the converted maps 380 * @see PyDict_FromMap 381 * @warning make sure to free ressources returned by this function 382 */ 337 383 PyDictObject* PyDict_FromMaps(maps* t){ 338 384 PyObject* res=PyDict_New( ); … … 351 397 } 352 398 399 /** 400 * Convert a map to a Python dictionary 401 * 402 * @param t the map to convert 403 * @return a new PyDictObject containing the converted maps 404 * @warning make sure to free ressources returned by this function 405 */ 353 406 PyDictObject* PyDict_FromMap(map* t){ 354 407 PyObject* res=PyDict_New( ); … … 461 514 } 462 515 516 /** 517 * Convert a Python dictionary to a maps 518 * 519 * @param t the PyDictObject to convert 520 * @return a new maps containing the converted PyDictObject 521 * @warning make sure to free ressources returned by this function 522 */ 463 523 maps* mapsFromPyDict(PyDictObject* t){ 464 524 maps* res=NULL; … … 501 561 } 502 562 563 /** 564 * Convert a Python dictionary to a map 565 * 566 * @param t the PyDictObject to convert 567 * @return a new map containing the converted PyDictObject 568 * @warning make sure to free ressources returned by this function 569 */ 503 570 map* mapFromPyDict(PyDictObject* t){ 504 571 map* res=NULL; … … 540 607 } 541 608 609 /** 610 * Use the ZOO-Services messages translation function from the Python 611 * environment 612 * 613 * @param self the Python object on which we can run the method 614 * @param args the Python arguments given from the Python environment 615 * @return a new Python string containing the translated value to the Python 616 * environment 617 * @see _ss 618 */ 542 619 PyObject* 543 620 PythonTranslate(PyObject* self, PyObject* args) … … 553 630 } 554 631 632 /** 633 * Update the ongoing status of a running service from the Python environment 634 * 635 * @param self the Python object on which we can run the method 636 * @param args the Python arguments given from the Python environment 637 * @return None to the Python environment 638 * @see _updateStatus 639 */ 555 640 PyObject* 556 641 PythonUpdateStatus(PyObject* self, PyObject* args)
Note: See TracChangeset
for help on using the changeset viewer.