1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>NeL: pylib.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex"> <form class="search" action="search.php" method="get">
<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
<h1>pylib.h</h1><a href="a04869.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="preprocessor">#ifndef GAME_PYTHON_LIB_H</span>
00002 <span class="preprocessor"></span><span class="preprocessor">#define GAME_PYTHON_LIB_H</span>
00003 <span class="preprocessor"></span>
00009 <span class="comment">/* Copyright, 2000 Nevrax Ltd.</span>
00010 <span class="comment"> *</span>
00011 <span class="comment"> * This file is part of NEVRAX NEL.</span>
00012 <span class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</span>
00013 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
00014 <span class="comment"> * the Free Software Foundation; either version 2, or (at your option)</span>
00015 <span class="comment"> * any later version.</span>
00016 <span class="comment"></span>
00017 <span class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</span>
00018 <span class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</span>
00019 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span>
00020 <span class="comment"> * General Public License for more details.</span>
00021 <span class="comment"></span>
00022 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
00023 <span class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</span>
00024 <span class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</span>
00025 <span class="comment"> * MA 02111-1307, USA.</span>
00026 <span class="comment"> */</span>
00027
00028 <span class="preprocessor">#include <Python.h></span>
00029 <span class="preprocessor">#include "<a class="code" href="a04872.html">nel/ai/pyserver/pythonsupport.h</a>"</span>
00030 <span class="preprocessor">#include "<a class="code" href="a03963.html">nel/ai/c/abstract_interface.h</a>"</span>
00031
00032
00033 <span class="keyword">namespace </span>NLAIPYSERVER
00034 {
00035
<a name="l00036"></a><a class="code" href="a04869.html#a0">00036</a> <span class="preprocessor">#define PyCastMethod struct _object *(__cdecl *)(struct _object *,struct _object *)</span>
00037 <span class="preprocessor"></span>
<a name="l00038"></a><a class="code" href="a03263.html">00038</a> <span class="keyword">class </span><a class="code" href="a03263.html">CPyExport</a>
00039 {
00040 <span class="keyword">private</span>:
<a name="l00041"></a><a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExportr0">00041</a> <span class="keywordtype">bool</span> <a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExportr0">_DebugMode</a>;
00042
<a name="l00043"></a><a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExportd3">00043</a> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExportd3">getNameSpace</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *Name)<span class="keyword"> const</span>
00044 <span class="keyword"> </span>{
00045 <span class="keywordflow">return</span> Name == NULL ? <span class="stringliteral">"__main__"</span> : Name;
00046 }
00047
00048 PyObject *<a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExportd4">loadAttruibut</a>(<span class="keywordtype">char</span> *,<span class="keywordtype">char</span> *);
00049 PyObject *<a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExportd5">loadModule</a>(<span class="keywordtype">char</span> *);
00050 <a class="code" href="a04558.html#a10">sint32</a> <a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExportd0">convertResult</a>(PyObject *Result,<span class="keywordtype">char</span> *Format, <span class="keywordtype">void</span> *Target);
00051 PyObject *<a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExportd2">debugFunction</a>(PyObject *Func,PyObject *Arg);
00052 PyObject *<a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExportd1">debugCode</a>(<a class="code" href="a04558.html#a10">sint32</a> RunMode,<span class="keyword">const</span> <span class="keywordtype">char</span> *code,PyObject *ModDict);
00053 <span class="keywordtype">void</span> <a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExportd6">printLastError</a>();
00054
00055 <span class="keyword">public</span>:
00056
<a name="l00057"></a><a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExporta1">00057</a> <a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExporta1">CPyExport</a>()
00058 {
00059 <a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExportr0">_DebugMode</a> = <span class="keyword">false</span>;
00060 <span class="comment">//Py_Initialize(); </span>
00061 <a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExportr0">_DebugMode</a> = <span class="keyword">false</span>;
00062 }
00063
<a name="l00065"></a><a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExporta11">00065</a> <span class="keywordtype">bool</span> <a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExporta11">setDebug</a>()
00066 {
00067 <span class="keywordflow">return</span> (<a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExportr0">_DebugMode</a> = <span class="keyword">true</span>);
00068 }
00069
<a name="l00071"></a><a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExporta3">00071</a> <a class="code" href="a04558.html#a10">sint32</a> <a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExporta3">getDebugStat</a>()
00072 {
00073 <span class="keywordflow">return</span> <a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExportr0">_DebugMode</a>;
00074 }
00075
<a name="l00077"></a><a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExporta14">00077</a> <span class="keywordtype">bool</span> <a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExporta14">unSetDebug</a>()
00078 {
00079 <span class="keywordflow">return</span> (<a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExportr0">_DebugMode</a> = <span class="keyword">false</span>);
00080 }
00081
00082
<a name="l00084"></a><a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExporta7">00084</a> <span class="keywordtype">bool</span> <a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExporta7">isDebug</a>()
00085 {
00086 <span class="keywordflow">return</span> (<a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExportr0">_DebugMode</a> == <span class="keyword">true</span>);
00087 }
00088
00118 <a class="code" href="a04558.html#a10">sint32</a> <a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExporta8">runCode</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *Code,<span class="keywordtype">char</span> *NameSpace = NULL,<a class="code" href="a04558.html#a10">sint32</a> ModeExec = Py_file_input,<span class="keywordtype">char</span> *Format = NULL,<span class="keywordtype">void</span> *ResultTarget = NULL,<a class="code" href="a04558.html#a10">sint32</a> Error = <span class="keyword">true</span> );
00119
00143 <a class="code" href="a04558.html#a10">sint32</a> <a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExporta10">runMethod</a>(PyObject *Obj,<span class="keywordtype">char</span> *MethodName,<span class="keywordtype">char</span> *ResFormat, <span class="keywordtype">void</span> *ResTarget,<span class="keywordtype">char</span> *Format,...);
00144
00160 <a class="code" href="a04558.html#a10">sint32</a> <a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExporta9">runFunction</a>(<span class="keywordtype">char</span> *ModuleName,<span class="keywordtype">char</span> *MethodName,<span class="keywordtype">char</span> *ResFormat, <span class="keywordtype">void</span> *ResTarget,<span class="keywordtype">char</span> *Format,...);
00161
00162
00185 <a class="code" href="a04558.html#a10">sint32</a> <a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExporta5">getMembreValue</a>(PyObject *Obj,<span class="keywordtype">char</span> *AttribName,<span class="keywordtype">char</span> *ResFormat, <span class="keywordtype">void</span> *ResTarget);
00186
00187
00206 <a class="code" href="a04558.html#a10">sint32</a> <a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExporta13">setMembreValue</a>(PyObject *Obj,<span class="keywordtype">char</span> *AttribName,<span class="keywordtype">char</span> *ResFormat, ...);
00207
00208
00210 <span class="keywordtype">char</span> *<a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExporta2">getCodeFromFile</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *FileName);
00211
00212
00213 <a class="code" href="a04558.html#a10">sint32</a> <a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExporta4">getGlobal</a>(<span class="keywordtype">char</span> *NameSpace,<span class="keywordtype">char</span> *VarName,<span class="keywordtype">char</span> *Format,<span class="keywordtype">void</span> *VarValue); <span class="comment">// la meme chose que GetMembreValue mais sur un module</span>
00214 <a class="code" href="a04558.html#a10">sint32</a> <a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExporta12">setGlobal</a>(<span class="keywordtype">char</span> *NameSpace,<span class="keywordtype">char</span> *VarName,<span class="keywordtype">char</span> *Format, ...); <span class="comment">// la meme chose que SetMembreValue mais sur un module</span>
00215 PyObject *<a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExporta0">addModule</a>(<span class="keywordtype">char</span> *,PyMethodDef *);
00216 PyObject *<a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExporta6">getRefVar</a>(<span class="keywordtype">char</span> *VarName);
00217
<a name="l00218"></a><a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExporta15">00218</a> <a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExporta15">~CPyExport</a>()
00219 {
00220
00221 }
00222
00223 <span class="keyword">public</span>:
00224 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="a03263.html#NLAIPYSERVER_1_1CPyExporte0">getPathSeparator</a>();
00225 };
00226
00227
00228 CPyExport *<a class="code" href="a05372.html#a7">initPythonLib</a>(<a class="code" href="a03859.html">NLAIC::IIO</a> *Interface,<span class="keywordtype">char</span> *pathWay);
00229 <span class="keywordtype">void</span> <a class="code" href="a05372.html#a8">endPythonInterface</a>(CPyExport *Interface);
00230 }
00231 <span class="preprocessor">#endif</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 06:35:04 2004 for NeL by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 >
</a>1.3.6 </small></address>
</body>
</html>
|