l0n0lc 0.8.2__tar.gz → 0.8.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {l0n0lc-0.8.2 → l0n0lc-0.8.4}/PKG-INFO +22 -17
- {l0n0lc-0.8.2 → l0n0lc-0.8.4}/README.md +21 -16
- {l0n0lc-0.8.2 → l0n0lc-0.8.4}/l0n0lc/jit.py +14 -2
- {l0n0lc-0.8.2 → l0n0lc-0.8.4}/l0n0lc.egg-info/PKG-INFO +22 -17
- {l0n0lc-0.8.2 → l0n0lc-0.8.4}/pyproject.toml +1 -1
- {l0n0lc-0.8.2 → l0n0lc-0.8.4}/LICENSE +0 -0
- {l0n0lc-0.8.2 → l0n0lc-0.8.4}/l0n0lc/StdList.py +0 -0
- {l0n0lc-0.8.2 → l0n0lc-0.8.4}/l0n0lc/StdMap.py +0 -0
- {l0n0lc-0.8.2 → l0n0lc-0.8.4}/l0n0lc/__init__.py +0 -0
- {l0n0lc-0.8.2 → l0n0lc-0.8.4}/l0n0lc/c/345/237/272/347/241/200/345/244/204/347/220/206.py" +0 -0
- {l0n0lc-0.8.2 → l0n0lc-0.8.4}/l0n0lc//347/274/226/350/257/221.py" +0 -0
- {l0n0lc-0.8.2 → l0n0lc-0.8.4}/l0n0lc//351/200/232/347/224/250.py" +0 -0
- {l0n0lc-0.8.2 → l0n0lc-0.8.4}/l0n0lc.egg-info/SOURCES.txt +0 -0
- {l0n0lc-0.8.2 → l0n0lc-0.8.4}/l0n0lc.egg-info/dependency_links.txt +0 -0
- {l0n0lc-0.8.2 → l0n0lc-0.8.4}/l0n0lc.egg-info/top_level.txt +0 -0
- {l0n0lc-0.8.2 → l0n0lc-0.8.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: l0n0lc
|
3
|
-
Version: 0.8.
|
3
|
+
Version: 0.8.4
|
4
4
|
Summary: 一个将python函数翻译为c++函数并运行的jit编译器
|
5
5
|
Classifier: Programming Language :: Python :: 3
|
6
6
|
Requires-Python: >=3.10
|
@@ -80,7 +80,9 @@ def test_add(a: int, b: int) -> int:
|
|
80
80
|
print('test_other_fn', test_other_fn(a, b))
|
81
81
|
print('test编译的函数', test编译的函数(a, b))
|
82
82
|
v = 0
|
83
|
-
|
83
|
+
vv = True and (False or 1)
|
84
|
+
print('vv:', vv)
|
85
|
+
while (True):
|
84
86
|
py_cin(v)
|
85
87
|
if v > 100:
|
86
88
|
break
|
@@ -110,6 +112,7 @@ b 2
|
|
110
112
|
Hello World 13 3
|
111
113
|
test_other_fn 10
|
112
114
|
test编译的函数 39
|
115
|
+
vv: 1
|
113
116
|
请输入>>>输入的 1 小于等于100
|
114
117
|
请输入>>>输入的 2 小于等于100
|
115
118
|
请输入>>>输入的 100 小于等于100
|
@@ -121,22 +124,22 @@ test编译的函数 39
|
|
121
124
|
```bash
|
122
125
|
ls -al ./l0n0lcoutput
|
123
126
|
total 96
|
124
|
-
drwxr-xr-x 2 root root 4096 Sep
|
125
|
-
drwxrwxrwx 11 1000 1000 4096 Sep
|
126
|
-
-rw-r--r-- 1 root root
|
127
|
-
-rw-r--r-- 1 root root 246 Sep
|
128
|
-
-rwxr-xr-x 1 root root
|
129
|
-
-rw-r--r-- 1 root root 121 Sep
|
130
|
-
-rw-r--r-- 1 root root 93 Sep
|
131
|
-
-rwxr-xr-x 1 root root 15616 Sep
|
132
|
-
-rw-r--r-- 1 root root 185 Sep
|
133
|
-
-rw-r--r-- 1 root root 151 Sep
|
134
|
-
-rwxr-xr-x 1 root root 15656 Sep
|
127
|
+
drwxr-xr-x 2 root root 4096 Sep 16 01:49 .
|
128
|
+
drwxrwxrwx 11 1000 1000 4096 Sep 16 01:41 ..
|
129
|
+
-rw-r--r-- 1 root root 1318 Sep 16 01:49 test_add_@6a812a013615c16d.cpp
|
130
|
+
-rw-r--r-- 1 root root 246 Sep 16 01:49 test_add_@6a812a013615c16d.h
|
131
|
+
-rwxr-xr-x 1 root root 29968 Sep 16 01:49 test_add_@6a812a013615c16d.so
|
132
|
+
-rw-r--r-- 1 root root 121 Sep 16 01:49 test_other_fn_@75fdd928ab58a8e3.cpp
|
133
|
+
-rw-r--r-- 1 root root 93 Sep 16 01:49 test_other_fn_@75fdd928ab58a8e3.h
|
134
|
+
-rwxr-xr-x 1 root root 15616 Sep 16 01:49 test_other_fn_@75fdd928ab58a8e3.so
|
135
|
+
-rw-r--r-- 1 root root 185 Sep 16 01:41 test编译的函数_@3bf4501e0408a243.cpp
|
136
|
+
-rw-r--r-- 1 root root 151 Sep 16 01:41 test编译的函数_@3bf4501e0408a243.h
|
137
|
+
-rwxr-xr-x 1 root root 15656 Sep 16 01:41 test编译的函数_@3bf4501e0408a243.so
|
135
138
|
|
136
139
|
```
|
137
|
-
## 5. test_add_@
|
140
|
+
## 5. test_add_@6a812a013615c16d.cpp
|
138
141
|
```c++
|
139
|
-
#include "test_add_@
|
142
|
+
#include "test_add_@6a812a013615c16d.h"
|
140
143
|
extern "C" int64_t test_add (int64_t a, int64_t b)
|
141
144
|
{
|
142
145
|
if ((a > 1))
|
@@ -175,7 +178,9 @@ extern "C" int64_t test_add (int64_t a, int64_t b)
|
|
175
178
|
std::cout<< u8"test_other_fn" << " "<< test_other_fn(a,b) << " "<< std::endl;
|
176
179
|
std::cout<< u8"test编译的函数" << " "<< function_74657374e7bc96e8af91e79a84e587bde695b0(a,b) << " "<< std::endl;
|
177
180
|
auto v = 0;
|
178
|
-
|
181
|
+
auto vv = true&&false||1;
|
182
|
+
std::cout<< u8"vv:" << " "<< vv << " "<< std::endl;
|
183
|
+
while (true)
|
179
184
|
{
|
180
185
|
std::cout << u8"请输入>>>"; std::cin >> v;
|
181
186
|
if ((v > 100))
|
@@ -193,7 +198,7 @@ extern "C" int64_t test_add (int64_t a, int64_t b)
|
|
193
198
|
}
|
194
199
|
|
195
200
|
```
|
196
|
-
## 6. test_add_@
|
201
|
+
## 6. test_add_@6a812a013615c16d.h
|
197
202
|
```c++
|
198
203
|
#include "test_other_fn_@75fdd928ab58a8e3.h"
|
199
204
|
#include "test编译的函数_@3bf4501e0408a243.h"
|
@@ -70,7 +70,9 @@ def test_add(a: int, b: int) -> int:
|
|
70
70
|
print('test_other_fn', test_other_fn(a, b))
|
71
71
|
print('test编译的函数', test编译的函数(a, b))
|
72
72
|
v = 0
|
73
|
-
|
73
|
+
vv = True and (False or 1)
|
74
|
+
print('vv:', vv)
|
75
|
+
while (True):
|
74
76
|
py_cin(v)
|
75
77
|
if v > 100:
|
76
78
|
break
|
@@ -100,6 +102,7 @@ b 2
|
|
100
102
|
Hello World 13 3
|
101
103
|
test_other_fn 10
|
102
104
|
test编译的函数 39
|
105
|
+
vv: 1
|
103
106
|
请输入>>>输入的 1 小于等于100
|
104
107
|
请输入>>>输入的 2 小于等于100
|
105
108
|
请输入>>>输入的 100 小于等于100
|
@@ -111,22 +114,22 @@ test编译的函数 39
|
|
111
114
|
```bash
|
112
115
|
ls -al ./l0n0lcoutput
|
113
116
|
total 96
|
114
|
-
drwxr-xr-x 2 root root 4096 Sep
|
115
|
-
drwxrwxrwx 11 1000 1000 4096 Sep
|
116
|
-
-rw-r--r-- 1 root root
|
117
|
-
-rw-r--r-- 1 root root 246 Sep
|
118
|
-
-rwxr-xr-x 1 root root
|
119
|
-
-rw-r--r-- 1 root root 121 Sep
|
120
|
-
-rw-r--r-- 1 root root 93 Sep
|
121
|
-
-rwxr-xr-x 1 root root 15616 Sep
|
122
|
-
-rw-r--r-- 1 root root 185 Sep
|
123
|
-
-rw-r--r-- 1 root root 151 Sep
|
124
|
-
-rwxr-xr-x 1 root root 15656 Sep
|
117
|
+
drwxr-xr-x 2 root root 4096 Sep 16 01:49 .
|
118
|
+
drwxrwxrwx 11 1000 1000 4096 Sep 16 01:41 ..
|
119
|
+
-rw-r--r-- 1 root root 1318 Sep 16 01:49 test_add_@6a812a013615c16d.cpp
|
120
|
+
-rw-r--r-- 1 root root 246 Sep 16 01:49 test_add_@6a812a013615c16d.h
|
121
|
+
-rwxr-xr-x 1 root root 29968 Sep 16 01:49 test_add_@6a812a013615c16d.so
|
122
|
+
-rw-r--r-- 1 root root 121 Sep 16 01:49 test_other_fn_@75fdd928ab58a8e3.cpp
|
123
|
+
-rw-r--r-- 1 root root 93 Sep 16 01:49 test_other_fn_@75fdd928ab58a8e3.h
|
124
|
+
-rwxr-xr-x 1 root root 15616 Sep 16 01:49 test_other_fn_@75fdd928ab58a8e3.so
|
125
|
+
-rw-r--r-- 1 root root 185 Sep 16 01:41 test编译的函数_@3bf4501e0408a243.cpp
|
126
|
+
-rw-r--r-- 1 root root 151 Sep 16 01:41 test编译的函数_@3bf4501e0408a243.h
|
127
|
+
-rwxr-xr-x 1 root root 15656 Sep 16 01:41 test编译的函数_@3bf4501e0408a243.so
|
125
128
|
|
126
129
|
```
|
127
|
-
## 5. test_add_@
|
130
|
+
## 5. test_add_@6a812a013615c16d.cpp
|
128
131
|
```c++
|
129
|
-
#include "test_add_@
|
132
|
+
#include "test_add_@6a812a013615c16d.h"
|
130
133
|
extern "C" int64_t test_add (int64_t a, int64_t b)
|
131
134
|
{
|
132
135
|
if ((a > 1))
|
@@ -165,7 +168,9 @@ extern "C" int64_t test_add (int64_t a, int64_t b)
|
|
165
168
|
std::cout<< u8"test_other_fn" << " "<< test_other_fn(a,b) << " "<< std::endl;
|
166
169
|
std::cout<< u8"test编译的函数" << " "<< function_74657374e7bc96e8af91e79a84e587bde695b0(a,b) << " "<< std::endl;
|
167
170
|
auto v = 0;
|
168
|
-
|
171
|
+
auto vv = true&&false||1;
|
172
|
+
std::cout<< u8"vv:" << " "<< vv << " "<< std::endl;
|
173
|
+
while (true)
|
169
174
|
{
|
170
175
|
std::cout << u8"请输入>>>"; std::cin >> v;
|
171
176
|
if ((v > 100))
|
@@ -183,7 +188,7 @@ extern "C" int64_t test_add (int64_t a, int64_t b)
|
|
183
188
|
}
|
184
189
|
|
185
190
|
```
|
186
|
-
## 6. test_add_@
|
191
|
+
## 6. test_add_@6a812a013615c16d.h
|
187
192
|
```c++
|
188
193
|
#include "test_other_fn_@75fdd928ab58a8e3.h"
|
189
194
|
#include "test编译的函数_@3bf4501e0408a243.h"
|
@@ -71,6 +71,16 @@ class c函数调用:
|
|
71
71
|
return f'{self.函数名}({self.参数字符串})'
|
72
72
|
|
73
73
|
|
74
|
+
class c布尔:
|
75
|
+
def __init__(self, v) -> None:
|
76
|
+
self.v = v
|
77
|
+
|
78
|
+
def __str__(self) -> str:
|
79
|
+
if self.v:
|
80
|
+
return 'true'
|
81
|
+
return 'false'
|
82
|
+
|
83
|
+
|
74
84
|
class py2cpp编译器(ast.NodeVisitor):
|
75
85
|
def __init__(self, 被编译的函数: Callable, c编译器) -> None:
|
76
86
|
self.被编译的函数 = 被编译的函数
|
@@ -158,6 +168,8 @@ class py2cpp编译器(ast.NodeVisitor):
|
|
158
168
|
|
159
169
|
def 获取值(self, value):
|
160
170
|
if isinstance(value, ast.Constant):
|
171
|
+
if isinstance(value.value, bool):
|
172
|
+
return c布尔(value.value)
|
161
173
|
return value.value
|
162
174
|
|
163
175
|
if isinstance(value, ast.Name):
|
@@ -196,9 +208,9 @@ class py2cpp编译器(ast.NodeVisitor):
|
|
196
208
|
|
197
209
|
if isinstance(value, ast.BoolOp):
|
198
210
|
if isinstance(value.op, ast.And):
|
199
|
-
return '&&'.join([self.获取值(v) for v in value.values])
|
211
|
+
return '&&'.join([str(self.获取值(v)) for v in value.values])
|
200
212
|
if isinstance(value.op, ast.Or):
|
201
|
-
return '||'.join([self.获取值(v) for v in value.values])
|
213
|
+
return '||'.join([str(self.获取值(v)) for v in value.values])
|
202
214
|
|
203
215
|
if isinstance(value, ast.IfExp):
|
204
216
|
test = self.获取值(value.test)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: l0n0lc
|
3
|
-
Version: 0.8.
|
3
|
+
Version: 0.8.4
|
4
4
|
Summary: 一个将python函数翻译为c++函数并运行的jit编译器
|
5
5
|
Classifier: Programming Language :: Python :: 3
|
6
6
|
Requires-Python: >=3.10
|
@@ -80,7 +80,9 @@ def test_add(a: int, b: int) -> int:
|
|
80
80
|
print('test_other_fn', test_other_fn(a, b))
|
81
81
|
print('test编译的函数', test编译的函数(a, b))
|
82
82
|
v = 0
|
83
|
-
|
83
|
+
vv = True and (False or 1)
|
84
|
+
print('vv:', vv)
|
85
|
+
while (True):
|
84
86
|
py_cin(v)
|
85
87
|
if v > 100:
|
86
88
|
break
|
@@ -110,6 +112,7 @@ b 2
|
|
110
112
|
Hello World 13 3
|
111
113
|
test_other_fn 10
|
112
114
|
test编译的函数 39
|
115
|
+
vv: 1
|
113
116
|
请输入>>>输入的 1 小于等于100
|
114
117
|
请输入>>>输入的 2 小于等于100
|
115
118
|
请输入>>>输入的 100 小于等于100
|
@@ -121,22 +124,22 @@ test编译的函数 39
|
|
121
124
|
```bash
|
122
125
|
ls -al ./l0n0lcoutput
|
123
126
|
total 96
|
124
|
-
drwxr-xr-x 2 root root 4096 Sep
|
125
|
-
drwxrwxrwx 11 1000 1000 4096 Sep
|
126
|
-
-rw-r--r-- 1 root root
|
127
|
-
-rw-r--r-- 1 root root 246 Sep
|
128
|
-
-rwxr-xr-x 1 root root
|
129
|
-
-rw-r--r-- 1 root root 121 Sep
|
130
|
-
-rw-r--r-- 1 root root 93 Sep
|
131
|
-
-rwxr-xr-x 1 root root 15616 Sep
|
132
|
-
-rw-r--r-- 1 root root 185 Sep
|
133
|
-
-rw-r--r-- 1 root root 151 Sep
|
134
|
-
-rwxr-xr-x 1 root root 15656 Sep
|
127
|
+
drwxr-xr-x 2 root root 4096 Sep 16 01:49 .
|
128
|
+
drwxrwxrwx 11 1000 1000 4096 Sep 16 01:41 ..
|
129
|
+
-rw-r--r-- 1 root root 1318 Sep 16 01:49 test_add_@6a812a013615c16d.cpp
|
130
|
+
-rw-r--r-- 1 root root 246 Sep 16 01:49 test_add_@6a812a013615c16d.h
|
131
|
+
-rwxr-xr-x 1 root root 29968 Sep 16 01:49 test_add_@6a812a013615c16d.so
|
132
|
+
-rw-r--r-- 1 root root 121 Sep 16 01:49 test_other_fn_@75fdd928ab58a8e3.cpp
|
133
|
+
-rw-r--r-- 1 root root 93 Sep 16 01:49 test_other_fn_@75fdd928ab58a8e3.h
|
134
|
+
-rwxr-xr-x 1 root root 15616 Sep 16 01:49 test_other_fn_@75fdd928ab58a8e3.so
|
135
|
+
-rw-r--r-- 1 root root 185 Sep 16 01:41 test编译的函数_@3bf4501e0408a243.cpp
|
136
|
+
-rw-r--r-- 1 root root 151 Sep 16 01:41 test编译的函数_@3bf4501e0408a243.h
|
137
|
+
-rwxr-xr-x 1 root root 15656 Sep 16 01:41 test编译的函数_@3bf4501e0408a243.so
|
135
138
|
|
136
139
|
```
|
137
|
-
## 5. test_add_@
|
140
|
+
## 5. test_add_@6a812a013615c16d.cpp
|
138
141
|
```c++
|
139
|
-
#include "test_add_@
|
142
|
+
#include "test_add_@6a812a013615c16d.h"
|
140
143
|
extern "C" int64_t test_add (int64_t a, int64_t b)
|
141
144
|
{
|
142
145
|
if ((a > 1))
|
@@ -175,7 +178,9 @@ extern "C" int64_t test_add (int64_t a, int64_t b)
|
|
175
178
|
std::cout<< u8"test_other_fn" << " "<< test_other_fn(a,b) << " "<< std::endl;
|
176
179
|
std::cout<< u8"test编译的函数" << " "<< function_74657374e7bc96e8af91e79a84e587bde695b0(a,b) << " "<< std::endl;
|
177
180
|
auto v = 0;
|
178
|
-
|
181
|
+
auto vv = true&&false||1;
|
182
|
+
std::cout<< u8"vv:" << " "<< vv << " "<< std::endl;
|
183
|
+
while (true)
|
179
184
|
{
|
180
185
|
std::cout << u8"请输入>>>"; std::cin >> v;
|
181
186
|
if ((v > 100))
|
@@ -193,7 +198,7 @@ extern "C" int64_t test_add (int64_t a, int64_t b)
|
|
193
198
|
}
|
194
199
|
|
195
200
|
```
|
196
|
-
## 6. test_add_@
|
201
|
+
## 6. test_add_@6a812a013615c16d.h
|
197
202
|
```c++
|
198
203
|
#include "test_other_fn_@75fdd928ab58a8e3.h"
|
199
204
|
#include "test编译的函数_@3bf4501e0408a243.h"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|