l0n0lc 0.8.2__tar.gz → 0.8.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: l0n0lc
3
- Version: 0.8.2
3
+ Version: 0.8.3
4
4
  Summary: 一个将python函数翻译为c++函数并运行的jit编译器
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Requires-Python: >=3.10
@@ -80,7 +80,8 @@ 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
- while (1):
83
+ vv = True
84
+ while (vv):
84
85
  py_cin(v)
85
86
  if v > 100:
86
87
  break
@@ -121,22 +122,22 @@ test编译的函数 39
121
122
  ```bash
122
123
  ls -al ./l0n0lcoutput
123
124
  total 96
124
- drwxr-xr-x 2 root root 4096 Sep 12 01:46 .
125
- drwxrwxrwx 11 1000 1000 4096 Sep 12 01:46 ..
126
- -rw-r--r-- 1 root root 1233 Sep 12 01:46 test_add_@3ecbfe0013e83ebc.cpp
127
- -rw-r--r-- 1 root root 246 Sep 12 01:46 test_add_@3ecbfe0013e83ebc.h
128
- -rwxr-xr-x 1 root root 29904 Sep 12 01:46 test_add_@3ecbfe0013e83ebc.so
129
- -rw-r--r-- 1 root root 121 Sep 12 01:46 test_other_fn_@75fdd928ab58a8e3.cpp
130
- -rw-r--r-- 1 root root 93 Sep 12 01:46 test_other_fn_@75fdd928ab58a8e3.h
131
- -rwxr-xr-x 1 root root 15616 Sep 12 01:46 test_other_fn_@75fdd928ab58a8e3.so
132
- -rw-r--r-- 1 root root 185 Sep 12 01:46 test编译的函数_@3bf4501e0408a243.cpp
133
- -rw-r--r-- 1 root root 151 Sep 12 01:46 test编译的函数_@3bf4501e0408a243.h
134
- -rwxr-xr-x 1 root root 15656 Sep 12 01:46 test编译的函数_@3bf4501e0408a243.so
125
+ drwxr-xr-x 2 root root 4096 Sep 16 01:38 .
126
+ drwxrwxrwx 11 1000 1000 4096 Sep 16 01:36 ..
127
+ -rw-r--r-- 1 root root 1252 Sep 16 01:38 test_add_@05ade4b088e9b383.cpp
128
+ -rw-r--r-- 1 root root 246 Sep 16 01:38 test_add_@05ade4b088e9b383.h
129
+ -rwxr-xr-x 1 root root 29904 Sep 16 01:38 test_add_@05ade4b088e9b383.so
130
+ -rw-r--r-- 1 root root 121 Sep 16 01:38 test_other_fn_@75fdd928ab58a8e3.cpp
131
+ -rw-r--r-- 1 root root 93 Sep 16 01:38 test_other_fn_@75fdd928ab58a8e3.h
132
+ -rwxr-xr-x 1 root root 15616 Sep 16 01:38 test_other_fn_@75fdd928ab58a8e3.so
133
+ -rw-r--r-- 1 root root 185 Sep 16 01:36 test编译的函数_@3bf4501e0408a243.cpp
134
+ -rw-r--r-- 1 root root 151 Sep 16 01:36 test编译的函数_@3bf4501e0408a243.h
135
+ -rwxr-xr-x 1 root root 15656 Sep 16 01:36 test编译的函数_@3bf4501e0408a243.so
135
136
 
136
137
  ```
137
- ## 5. test_add_@3ecbfe0013e83ebc.cpp
138
+ ## 5. test_add_@05ade4b088e9b383.cpp
138
139
  ```c++
139
- #include "test_add_@3ecbfe0013e83ebc.h"
140
+ #include "test_add_@05ade4b088e9b383.h"
140
141
  extern "C" int64_t test_add (int64_t a, int64_t b)
141
142
  {
142
143
  if ((a > 1))
@@ -175,7 +176,8 @@ extern "C" int64_t test_add (int64_t a, int64_t b)
175
176
  std::cout<< u8"test_other_fn" << " "<< test_other_fn(a,b) << " "<< std::endl;
176
177
  std::cout<< u8"test编译的函数" << " "<< function_74657374e7bc96e8af91e79a84e587bde695b0(a,b) << " "<< std::endl;
177
178
  auto v = 0;
178
- while (1)
179
+ auto vv = true;
180
+ while (vv)
179
181
  {
180
182
  std::cout << u8"请输入>>>"; std::cin >> v;
181
183
  if ((v > 100))
@@ -193,7 +195,7 @@ extern "C" int64_t test_add (int64_t a, int64_t b)
193
195
  }
194
196
 
195
197
  ```
196
- ## 6. test_add_@3ecbfe0013e83ebc.h
198
+ ## 6. test_add_@05ade4b088e9b383.h
197
199
  ```c++
198
200
  #include "test_other_fn_@75fdd928ab58a8e3.h"
199
201
  #include "test编译的函数_@3bf4501e0408a243.h"
@@ -70,7 +70,8 @@ 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
- while (1):
73
+ vv = True
74
+ while (vv):
74
75
  py_cin(v)
75
76
  if v > 100:
76
77
  break
@@ -111,22 +112,22 @@ test编译的函数 39
111
112
  ```bash
112
113
  ls -al ./l0n0lcoutput
113
114
  total 96
114
- drwxr-xr-x 2 root root 4096 Sep 12 01:46 .
115
- drwxrwxrwx 11 1000 1000 4096 Sep 12 01:46 ..
116
- -rw-r--r-- 1 root root 1233 Sep 12 01:46 test_add_@3ecbfe0013e83ebc.cpp
117
- -rw-r--r-- 1 root root 246 Sep 12 01:46 test_add_@3ecbfe0013e83ebc.h
118
- -rwxr-xr-x 1 root root 29904 Sep 12 01:46 test_add_@3ecbfe0013e83ebc.so
119
- -rw-r--r-- 1 root root 121 Sep 12 01:46 test_other_fn_@75fdd928ab58a8e3.cpp
120
- -rw-r--r-- 1 root root 93 Sep 12 01:46 test_other_fn_@75fdd928ab58a8e3.h
121
- -rwxr-xr-x 1 root root 15616 Sep 12 01:46 test_other_fn_@75fdd928ab58a8e3.so
122
- -rw-r--r-- 1 root root 185 Sep 12 01:46 test编译的函数_@3bf4501e0408a243.cpp
123
- -rw-r--r-- 1 root root 151 Sep 12 01:46 test编译的函数_@3bf4501e0408a243.h
124
- -rwxr-xr-x 1 root root 15656 Sep 12 01:46 test编译的函数_@3bf4501e0408a243.so
115
+ drwxr-xr-x 2 root root 4096 Sep 16 01:38 .
116
+ drwxrwxrwx 11 1000 1000 4096 Sep 16 01:36 ..
117
+ -rw-r--r-- 1 root root 1252 Sep 16 01:38 test_add_@05ade4b088e9b383.cpp
118
+ -rw-r--r-- 1 root root 246 Sep 16 01:38 test_add_@05ade4b088e9b383.h
119
+ -rwxr-xr-x 1 root root 29904 Sep 16 01:38 test_add_@05ade4b088e9b383.so
120
+ -rw-r--r-- 1 root root 121 Sep 16 01:38 test_other_fn_@75fdd928ab58a8e3.cpp
121
+ -rw-r--r-- 1 root root 93 Sep 16 01:38 test_other_fn_@75fdd928ab58a8e3.h
122
+ -rwxr-xr-x 1 root root 15616 Sep 16 01:38 test_other_fn_@75fdd928ab58a8e3.so
123
+ -rw-r--r-- 1 root root 185 Sep 16 01:36 test编译的函数_@3bf4501e0408a243.cpp
124
+ -rw-r--r-- 1 root root 151 Sep 16 01:36 test编译的函数_@3bf4501e0408a243.h
125
+ -rwxr-xr-x 1 root root 15656 Sep 16 01:36 test编译的函数_@3bf4501e0408a243.so
125
126
 
126
127
  ```
127
- ## 5. test_add_@3ecbfe0013e83ebc.cpp
128
+ ## 5. test_add_@05ade4b088e9b383.cpp
128
129
  ```c++
129
- #include "test_add_@3ecbfe0013e83ebc.h"
130
+ #include "test_add_@05ade4b088e9b383.h"
130
131
  extern "C" int64_t test_add (int64_t a, int64_t b)
131
132
  {
132
133
  if ((a > 1))
@@ -165,7 +166,8 @@ extern "C" int64_t test_add (int64_t a, int64_t b)
165
166
  std::cout<< u8"test_other_fn" << " "<< test_other_fn(a,b) << " "<< std::endl;
166
167
  std::cout<< u8"test编译的函数" << " "<< function_74657374e7bc96e8af91e79a84e587bde695b0(a,b) << " "<< std::endl;
167
168
  auto v = 0;
168
- while (1)
169
+ auto vv = true;
170
+ while (vv)
169
171
  {
170
172
  std::cout << u8"请输入>>>"; std::cin >> v;
171
173
  if ((v > 100))
@@ -183,7 +185,7 @@ extern "C" int64_t test_add (int64_t a, int64_t b)
183
185
  }
184
186
 
185
187
  ```
186
- ## 6. test_add_@3ecbfe0013e83ebc.h
188
+ ## 6. test_add_@05ade4b088e9b383.h
187
189
  ```c++
188
190
  #include "test_other_fn_@75fdd928ab58a8e3.h"
189
191
  #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):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: l0n0lc
3
- Version: 0.8.2
3
+ Version: 0.8.3
4
4
  Summary: 一个将python函数翻译为c++函数并运行的jit编译器
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Requires-Python: >=3.10
@@ -80,7 +80,8 @@ 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
- while (1):
83
+ vv = True
84
+ while (vv):
84
85
  py_cin(v)
85
86
  if v > 100:
86
87
  break
@@ -121,22 +122,22 @@ test编译的函数 39
121
122
  ```bash
122
123
  ls -al ./l0n0lcoutput
123
124
  total 96
124
- drwxr-xr-x 2 root root 4096 Sep 12 01:46 .
125
- drwxrwxrwx 11 1000 1000 4096 Sep 12 01:46 ..
126
- -rw-r--r-- 1 root root 1233 Sep 12 01:46 test_add_@3ecbfe0013e83ebc.cpp
127
- -rw-r--r-- 1 root root 246 Sep 12 01:46 test_add_@3ecbfe0013e83ebc.h
128
- -rwxr-xr-x 1 root root 29904 Sep 12 01:46 test_add_@3ecbfe0013e83ebc.so
129
- -rw-r--r-- 1 root root 121 Sep 12 01:46 test_other_fn_@75fdd928ab58a8e3.cpp
130
- -rw-r--r-- 1 root root 93 Sep 12 01:46 test_other_fn_@75fdd928ab58a8e3.h
131
- -rwxr-xr-x 1 root root 15616 Sep 12 01:46 test_other_fn_@75fdd928ab58a8e3.so
132
- -rw-r--r-- 1 root root 185 Sep 12 01:46 test编译的函数_@3bf4501e0408a243.cpp
133
- -rw-r--r-- 1 root root 151 Sep 12 01:46 test编译的函数_@3bf4501e0408a243.h
134
- -rwxr-xr-x 1 root root 15656 Sep 12 01:46 test编译的函数_@3bf4501e0408a243.so
125
+ drwxr-xr-x 2 root root 4096 Sep 16 01:38 .
126
+ drwxrwxrwx 11 1000 1000 4096 Sep 16 01:36 ..
127
+ -rw-r--r-- 1 root root 1252 Sep 16 01:38 test_add_@05ade4b088e9b383.cpp
128
+ -rw-r--r-- 1 root root 246 Sep 16 01:38 test_add_@05ade4b088e9b383.h
129
+ -rwxr-xr-x 1 root root 29904 Sep 16 01:38 test_add_@05ade4b088e9b383.so
130
+ -rw-r--r-- 1 root root 121 Sep 16 01:38 test_other_fn_@75fdd928ab58a8e3.cpp
131
+ -rw-r--r-- 1 root root 93 Sep 16 01:38 test_other_fn_@75fdd928ab58a8e3.h
132
+ -rwxr-xr-x 1 root root 15616 Sep 16 01:38 test_other_fn_@75fdd928ab58a8e3.so
133
+ -rw-r--r-- 1 root root 185 Sep 16 01:36 test编译的函数_@3bf4501e0408a243.cpp
134
+ -rw-r--r-- 1 root root 151 Sep 16 01:36 test编译的函数_@3bf4501e0408a243.h
135
+ -rwxr-xr-x 1 root root 15656 Sep 16 01:36 test编译的函数_@3bf4501e0408a243.so
135
136
 
136
137
  ```
137
- ## 5. test_add_@3ecbfe0013e83ebc.cpp
138
+ ## 5. test_add_@05ade4b088e9b383.cpp
138
139
  ```c++
139
- #include "test_add_@3ecbfe0013e83ebc.h"
140
+ #include "test_add_@05ade4b088e9b383.h"
140
141
  extern "C" int64_t test_add (int64_t a, int64_t b)
141
142
  {
142
143
  if ((a > 1))
@@ -175,7 +176,8 @@ extern "C" int64_t test_add (int64_t a, int64_t b)
175
176
  std::cout<< u8"test_other_fn" << " "<< test_other_fn(a,b) << " "<< std::endl;
176
177
  std::cout<< u8"test编译的函数" << " "<< function_74657374e7bc96e8af91e79a84e587bde695b0(a,b) << " "<< std::endl;
177
178
  auto v = 0;
178
- while (1)
179
+ auto vv = true;
180
+ while (vv)
179
181
  {
180
182
  std::cout << u8"请输入>>>"; std::cin >> v;
181
183
  if ((v > 100))
@@ -193,7 +195,7 @@ extern "C" int64_t test_add (int64_t a, int64_t b)
193
195
  }
194
196
 
195
197
  ```
196
- ## 6. test_add_@3ecbfe0013e83ebc.h
198
+ ## 6. test_add_@05ade4b088e9b383.h
197
199
  ```c++
198
200
  #include "test_other_fn_@75fdd928ab58a8e3.h"
199
201
  #include "test编译的函数_@3bf4501e0408a243.h"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "l0n0lc"
3
- version = "0.8.2"
3
+ version = "0.8.3"
4
4
  description = "一个将python函数翻译为c++函数并运行的jit编译器"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
File without changes
File without changes
File without changes
File without changes
File without changes