l0n0lc 0.7.2__tar.gz → 0.7.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.7.2 → l0n0lc-0.7.4}/PKG-INFO +16 -13
- {l0n0lc-0.7.2 → l0n0lc-0.7.4}/README.md +15 -12
- {l0n0lc-0.7.2 → l0n0lc-0.7.4}/l0n0lc/jit.py +1 -2
- {l0n0lc-0.7.2 → l0n0lc-0.7.4}/l0n0lc.egg-info/PKG-INFO +16 -13
- {l0n0lc-0.7.2 → l0n0lc-0.7.4}/pyproject.toml +1 -1
- {l0n0lc-0.7.2 → l0n0lc-0.7.4}/LICENSE +0 -0
- {l0n0lc-0.7.2 → l0n0lc-0.7.4}/l0n0lc/StdList.py +0 -0
- {l0n0lc-0.7.2 → l0n0lc-0.7.4}/l0n0lc/StdMap.py +0 -0
- {l0n0lc-0.7.2 → l0n0lc-0.7.4}/l0n0lc/__init__.py +0 -0
- {l0n0lc-0.7.2 → l0n0lc-0.7.4}/l0n0lc/c/345/237/272/347/241/200/345/244/204/347/220/206.py" +0 -0
- {l0n0lc-0.7.2 → l0n0lc-0.7.4}/l0n0lc//347/274/226/350/257/221.py" +0 -0
- {l0n0lc-0.7.2 → l0n0lc-0.7.4}/l0n0lc//351/200/232/347/224/250.py" +0 -0
- {l0n0lc-0.7.2 → l0n0lc-0.7.4}/l0n0lc.egg-info/SOURCES.txt +0 -0
- {l0n0lc-0.7.2 → l0n0lc-0.7.4}/l0n0lc.egg-info/dependency_links.txt +0 -0
- {l0n0lc-0.7.2 → l0n0lc-0.7.4}/l0n0lc.egg-info/top_level.txt +0 -0
- {l0n0lc-0.7.2 → l0n0lc-0.7.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: l0n0lc
|
3
|
-
Version: 0.7.
|
3
|
+
Version: 0.7.4
|
4
4
|
Summary: 用python写c
|
5
5
|
Classifier: Programming Language :: Python :: 3
|
6
6
|
Requires-Python: >=3.10
|
@@ -29,6 +29,9 @@ def cpp_cout(*args):
|
|
29
29
|
code += '<< std::endl;'
|
30
30
|
return code
|
31
31
|
|
32
|
+
@lc.直接调用函数
|
33
|
+
def test_直接调用():
|
34
|
+
return 123
|
32
35
|
|
33
36
|
@lc.jit(每次运行都重新编译=True)
|
34
37
|
def test_add(a: int, b: int) -> int:
|
@@ -50,10 +53,10 @@ def test_add(a: int, b: int) -> int:
|
|
50
53
|
for i in range(3):
|
51
54
|
print(i, aa[i])
|
52
55
|
print('Hello World', a, b)
|
53
|
-
return a + b + 1
|
54
|
-
|
56
|
+
return a + b + 1 + test_直接调用()
|
55
57
|
|
56
58
|
print('结果:', test_add(1, 3))
|
59
|
+
|
57
60
|
```
|
58
61
|
## 执行hello_world.py
|
59
62
|
```bash
|
@@ -67,20 +70,20 @@ b 2
|
|
67
70
|
1 3
|
68
71
|
2 2
|
69
72
|
Hello World 13 3
|
70
|
-
结果:
|
73
|
+
结果: 140
|
71
74
|
```
|
72
75
|
## 查看生成的c++代码文件
|
73
76
|
```bash
|
74
|
-
$ ls -al l0n0lcoutput
|
75
|
-
total
|
76
|
-
drwxr-xr-x 2 root root 4096 Sep 11
|
77
|
-
drwxrwxrwx
|
78
|
-
-rw-r--r-- 1 root root
|
79
|
-
-rw-r--r-- 1 root root 150 Sep 11
|
80
|
-
-rwxr-xr-x 1 root root
|
77
|
+
$ ls -al l0n0lcoutput/
|
78
|
+
total 48
|
79
|
+
drwxr-xr-x 2 root root 4096 Sep 11 02:32 .
|
80
|
+
drwxrwxrwx 11 1000 1000 4096 Sep 11 02:32 ..
|
81
|
+
-rw-r--r-- 1 root root 794 Sep 11 02:32 test_add_@0bfbc28de3631ddd.cpp
|
82
|
+
-rw-r--r-- 1 root root 150 Sep 11 02:32 test_add_@0bfbc28de3631ddd.h
|
83
|
+
-rwxr-xr-x 1 root root 29496 Sep 11 02:32 test_add_@0bfbc28de3631ddd.so
|
81
84
|
```
|
82
85
|
|
83
|
-
## test_add_@
|
86
|
+
## test_add_@0bfbc28de3631ddd.h
|
84
87
|
|
85
88
|
```c++
|
86
89
|
#include <cmath>
|
@@ -91,7 +94,7 @@ drwxrwxrwx 12 1000 1000 4096 Sep 10 02:36 ..
|
|
91
94
|
extern "C" int64_t test_add (int64_t a, int64_t b);
|
92
95
|
```
|
93
96
|
|
94
|
-
## test_add_@
|
97
|
+
## test_add_@0bfbc28de3631ddd.cpp
|
95
98
|
```c++
|
96
99
|
#include "test_add_@141921ba1aaa0352.h"
|
97
100
|
extern "C" int64_t test_add (int64_t a, int64_t b)
|
@@ -19,6 +19,9 @@ def cpp_cout(*args):
|
|
19
19
|
code += '<< std::endl;'
|
20
20
|
return code
|
21
21
|
|
22
|
+
@lc.直接调用函数
|
23
|
+
def test_直接调用():
|
24
|
+
return 123
|
22
25
|
|
23
26
|
@lc.jit(每次运行都重新编译=True)
|
24
27
|
def test_add(a: int, b: int) -> int:
|
@@ -40,10 +43,10 @@ def test_add(a: int, b: int) -> int:
|
|
40
43
|
for i in range(3):
|
41
44
|
print(i, aa[i])
|
42
45
|
print('Hello World', a, b)
|
43
|
-
return a + b + 1
|
44
|
-
|
46
|
+
return a + b + 1 + test_直接调用()
|
45
47
|
|
46
48
|
print('结果:', test_add(1, 3))
|
49
|
+
|
47
50
|
```
|
48
51
|
## 执行hello_world.py
|
49
52
|
```bash
|
@@ -57,20 +60,20 @@ b 2
|
|
57
60
|
1 3
|
58
61
|
2 2
|
59
62
|
Hello World 13 3
|
60
|
-
结果:
|
63
|
+
结果: 140
|
61
64
|
```
|
62
65
|
## 查看生成的c++代码文件
|
63
66
|
```bash
|
64
|
-
$ ls -al l0n0lcoutput
|
65
|
-
total
|
66
|
-
drwxr-xr-x 2 root root 4096 Sep 11
|
67
|
-
drwxrwxrwx
|
68
|
-
-rw-r--r-- 1 root root
|
69
|
-
-rw-r--r-- 1 root root 150 Sep 11
|
70
|
-
-rwxr-xr-x 1 root root
|
67
|
+
$ ls -al l0n0lcoutput/
|
68
|
+
total 48
|
69
|
+
drwxr-xr-x 2 root root 4096 Sep 11 02:32 .
|
70
|
+
drwxrwxrwx 11 1000 1000 4096 Sep 11 02:32 ..
|
71
|
+
-rw-r--r-- 1 root root 794 Sep 11 02:32 test_add_@0bfbc28de3631ddd.cpp
|
72
|
+
-rw-r--r-- 1 root root 150 Sep 11 02:32 test_add_@0bfbc28de3631ddd.h
|
73
|
+
-rwxr-xr-x 1 root root 29496 Sep 11 02:32 test_add_@0bfbc28de3631ddd.so
|
71
74
|
```
|
72
75
|
|
73
|
-
## test_add_@
|
76
|
+
## test_add_@0bfbc28de3631ddd.h
|
74
77
|
|
75
78
|
```c++
|
76
79
|
#include <cmath>
|
@@ -81,7 +84,7 @@ drwxrwxrwx 12 1000 1000 4096 Sep 10 02:36 ..
|
|
81
84
|
extern "C" int64_t test_add (int64_t a, int64_t b);
|
82
85
|
```
|
83
86
|
|
84
|
-
## test_add_@
|
87
|
+
## test_add_@0bfbc28de3631ddd.cpp
|
85
88
|
```c++
|
86
89
|
#include "test_add_@141921ba1aaa0352.h"
|
87
90
|
extern "C" int64_t test_add (int64_t a, int64_t b)
|
@@ -556,9 +556,8 @@ class py2cpp编译器(ast.NodeVisitor):
|
|
556
556
|
|
557
557
|
def jit(jit编译器=None, c编译器=None, 每次运行都重新编译: bool = False):
|
558
558
|
def 编译函数(fn: Callable):
|
559
|
-
|
560
559
|
# print(ast.dump(语法树, indent=' '))
|
561
|
-
c语言函数编译器 = jit编译器
|
560
|
+
c语言函数编译器 = jit编译器(fn) if jit编译器 else py2cpp编译器(fn)
|
562
561
|
库文件名 = c语言函数编译器.获取库文件名()
|
563
562
|
# 检测是否已存在
|
564
563
|
if 每次运行都重新编译 or not os.path.exists(f'{通用信息.工作文件夹地址}/{库文件名}'):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: l0n0lc
|
3
|
-
Version: 0.7.
|
3
|
+
Version: 0.7.4
|
4
4
|
Summary: 用python写c
|
5
5
|
Classifier: Programming Language :: Python :: 3
|
6
6
|
Requires-Python: >=3.10
|
@@ -29,6 +29,9 @@ def cpp_cout(*args):
|
|
29
29
|
code += '<< std::endl;'
|
30
30
|
return code
|
31
31
|
|
32
|
+
@lc.直接调用函数
|
33
|
+
def test_直接调用():
|
34
|
+
return 123
|
32
35
|
|
33
36
|
@lc.jit(每次运行都重新编译=True)
|
34
37
|
def test_add(a: int, b: int) -> int:
|
@@ -50,10 +53,10 @@ def test_add(a: int, b: int) -> int:
|
|
50
53
|
for i in range(3):
|
51
54
|
print(i, aa[i])
|
52
55
|
print('Hello World', a, b)
|
53
|
-
return a + b + 1
|
54
|
-
|
56
|
+
return a + b + 1 + test_直接调用()
|
55
57
|
|
56
58
|
print('结果:', test_add(1, 3))
|
59
|
+
|
57
60
|
```
|
58
61
|
## 执行hello_world.py
|
59
62
|
```bash
|
@@ -67,20 +70,20 @@ b 2
|
|
67
70
|
1 3
|
68
71
|
2 2
|
69
72
|
Hello World 13 3
|
70
|
-
结果:
|
73
|
+
结果: 140
|
71
74
|
```
|
72
75
|
## 查看生成的c++代码文件
|
73
76
|
```bash
|
74
|
-
$ ls -al l0n0lcoutput
|
75
|
-
total
|
76
|
-
drwxr-xr-x 2 root root 4096 Sep 11
|
77
|
-
drwxrwxrwx
|
78
|
-
-rw-r--r-- 1 root root
|
79
|
-
-rw-r--r-- 1 root root 150 Sep 11
|
80
|
-
-rwxr-xr-x 1 root root
|
77
|
+
$ ls -al l0n0lcoutput/
|
78
|
+
total 48
|
79
|
+
drwxr-xr-x 2 root root 4096 Sep 11 02:32 .
|
80
|
+
drwxrwxrwx 11 1000 1000 4096 Sep 11 02:32 ..
|
81
|
+
-rw-r--r-- 1 root root 794 Sep 11 02:32 test_add_@0bfbc28de3631ddd.cpp
|
82
|
+
-rw-r--r-- 1 root root 150 Sep 11 02:32 test_add_@0bfbc28de3631ddd.h
|
83
|
+
-rwxr-xr-x 1 root root 29496 Sep 11 02:32 test_add_@0bfbc28de3631ddd.so
|
81
84
|
```
|
82
85
|
|
83
|
-
## test_add_@
|
86
|
+
## test_add_@0bfbc28de3631ddd.h
|
84
87
|
|
85
88
|
```c++
|
86
89
|
#include <cmath>
|
@@ -91,7 +94,7 @@ drwxrwxrwx 12 1000 1000 4096 Sep 10 02:36 ..
|
|
91
94
|
extern "C" int64_t test_add (int64_t a, int64_t b);
|
92
95
|
```
|
93
96
|
|
94
|
-
## test_add_@
|
97
|
+
## test_add_@0bfbc28de3631ddd.cpp
|
95
98
|
```c++
|
96
99
|
#include "test_add_@141921ba1aaa0352.h"
|
97
100
|
extern "C" int64_t test_add (int64_t a, int64_t b)
|
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
|