Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
python_compile.h
Go to the documentation of this file.
1
#ifndef _PYTHON_COMPILE_H_
2
#define _PYTHON_COMPILE_H_
3
4
//Resets variable for use by python config.h
5
#ifdef _POSIX_C_SOURCE
6
#undef _POSIX_C_SOURCE
7
#endif
8
9
#include "
cs_python.h
"
10
#include "
hashtable.h
"
11
#include <string>
12
#include <compile.h>
13
14
extern
Hashtable< std::string, PyCodeObject, 1023 >
compiled_python
;
15
16
class
PythonBasicType
17
{
18
public
:
19
std::string
objects
;
20
long
objecti
;
21
double
objectd
;
22
enum
{
MYSTRING
,
MYLONG
,
MYDOUBLE
}
type
;
23
PythonBasicType
(
const
std::string &mystr )
24
{
25
type
=
MYSTRING
;
26
objects
= mystr;
27
}
28
PythonBasicType
(
const
long
mystr )
29
{
30
type
=
MYLONG
;
31
objecti
= mystr;
32
}
33
PythonBasicType
(
const
float
mystr )
34
{
35
type
=
MYDOUBLE
;
36
objectd
= mystr;
37
}
38
PyObject *
NewObject
()
const
39
{
40
switch
(
type
)
41
{
42
case
MYSTRING
:
43
return
PyString_FromString(
objects
.c_str() );
44
45
case
MYLONG
:
46
return
PyLong_FromLong(
objecti
);
47
48
case
MYDOUBLE
:
49
return
PyFloat_FromDouble(
objectd
);
50
}
51
return
NULL;
52
}
53
};
54
55
void
InterpretPython
(
const
std::string &filename );
56
PyCodeObject *
CompilePython
(
const
std::string &filename );
57
void
CompileRunPython
(
const
std::string &filename );
58
PyObject *
CreateTuple
(
const
std::vector< PythonBasicType > &values );
59
63
template
<
class
T >
64
class
BasicPointer
65
{
66
T *myitem;
67
public
:
BasicPointer
( T *myitem )
68
{
69
this->myitem = myitem;
70
}
71
T&
operator*
()
72
{
73
return
*myitem;
74
}
75
};
76
#endif
77
src
python
python_compile.h
Generated on Fri May 29 2015 23:07:38 for Vegastrike 0.5.1 rc1 by
1.8.4