Menu

[r45]: / trunk / python / old / python-interface.php  Maximize  Restore  History

Download this file

68 lines (53 with data), 1.0 kB

 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
<?php
function python_print($a) {
if (is_object($a)) {
$n=$a->name;global ${$n};echo ${$n};
} else {
echo $a;
}
}
function python_command($cmd,$parms) {
switch($cmd) {
case "print": echo $parms; break;
}
}
function python_for() {
echo "START-FOR";
}
function python_for_end() {
echo "END-FOR";
}
function python_assign($a,$b,$c) {
if ($b=="=") {
if (is_object($a)) {
if (is_object($c)) {
} else {
$n=$a->name;global ${$n};${$n}=$c;
}
}
}
}
function python_list($v) {
echo "List: ";
var_dump($v);
return 1;
}
function python_mod($a,$b){return is_integer($a)?$a%$b:$a;}
function python_class_start($a) {
$name = $a->name;
var_dump($a);
}
function python_class_end($a) {
$name = $a->name;
$classfile = __PHPYTHON_CACHE_PATH__.$name.'.class';
$classcode = '<?php
class '.$name.' {
}';
file_put_contents($classfile,$classcode);
require_once($classfile);
}
function python_def_start($a) {
var_dump($a);
}
function python_def_end($a) {
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.