IncludeCPP 3.7.3__py3-none-any.whl
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.
- includecpp/__init__.py +59 -0
- includecpp/__init__.pyi +255 -0
- includecpp/__main__.py +4 -0
- includecpp/cli/__init__.py +4 -0
- includecpp/cli/commands.py +8270 -0
- includecpp/cli/config_parser.py +127 -0
- includecpp/core/__init__.py +19 -0
- includecpp/core/ai_integration.py +2132 -0
- includecpp/core/build_manager.py +2416 -0
- includecpp/core/cpp_api.py +376 -0
- includecpp/core/cpp_api.pyi +95 -0
- includecpp/core/cppy_converter.py +3448 -0
- includecpp/core/cssl/CSSL_DOCUMENTATION.md +2075 -0
- includecpp/core/cssl/__init__.py +42 -0
- includecpp/core/cssl/cssl_builtins.py +2271 -0
- includecpp/core/cssl/cssl_builtins.pyi +1393 -0
- includecpp/core/cssl/cssl_events.py +621 -0
- includecpp/core/cssl/cssl_modules.py +2803 -0
- includecpp/core/cssl/cssl_parser.py +2575 -0
- includecpp/core/cssl/cssl_runtime.py +3051 -0
- includecpp/core/cssl/cssl_syntax.py +488 -0
- includecpp/core/cssl/cssl_types.py +1512 -0
- includecpp/core/cssl_bridge.py +882 -0
- includecpp/core/cssl_bridge.pyi +488 -0
- includecpp/core/error_catalog.py +802 -0
- includecpp/core/error_formatter.py +1016 -0
- includecpp/core/exceptions.py +97 -0
- includecpp/core/path_discovery.py +77 -0
- includecpp/core/project_ui.py +3370 -0
- includecpp/core/settings_ui.py +326 -0
- includecpp/generator/__init__.py +1 -0
- includecpp/generator/parser.cpp +1903 -0
- includecpp/generator/parser.h +281 -0
- includecpp/generator/type_resolver.cpp +363 -0
- includecpp/generator/type_resolver.h +68 -0
- includecpp/py.typed +0 -0
- includecpp/templates/cpp.proj.template +18 -0
- includecpp/vscode/__init__.py +1 -0
- includecpp/vscode/cssl/__init__.py +1 -0
- includecpp/vscode/cssl/language-configuration.json +38 -0
- includecpp/vscode/cssl/package.json +50 -0
- includecpp/vscode/cssl/snippets/cssl.snippets.json +1080 -0
- includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json +341 -0
- includecpp-3.7.3.dist-info/METADATA +1076 -0
- includecpp-3.7.3.dist-info/RECORD +49 -0
- includecpp-3.7.3.dist-info/WHEEL +5 -0
- includecpp-3.7.3.dist-info/entry_points.txt +2 -0
- includecpp-3.7.3.dist-info/licenses/LICENSE +21 -0
- includecpp-3.7.3.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
"""
|
|
2
|
+
CSSL Bridge - Type Stubs for Python API
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import threading
|
|
6
|
+
from typing import Any, List, Optional, Callable, Dict
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class CSSLModule:
|
|
10
|
+
"""
|
|
11
|
+
A callable CSSL module that executes code with arguments.
|
|
12
|
+
|
|
13
|
+
Created via CSSL.module() - the code is executed each time the module is called,
|
|
14
|
+
with arguments accessible via parameter.get(index).
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
def __init__(self, cssl_instance: 'CsslLang', code: str) -> None: ...
|
|
18
|
+
def __call__(self, *args: Any) -> Any:
|
|
19
|
+
"""Execute the module code with the given arguments."""
|
|
20
|
+
...
|
|
21
|
+
def __repr__(self) -> str: ...
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class CSSLFunctionModule:
|
|
25
|
+
"""
|
|
26
|
+
A CSSL module with accessible functions as methods.
|
|
27
|
+
|
|
28
|
+
Created via CSSL.makemodule() - functions defined in the CSSL code
|
|
29
|
+
become callable attributes on this module.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
def __init__(self, cssl_instance: 'CsslLang', code: str) -> None: ...
|
|
33
|
+
def __getattr__(self, name: str) -> Callable[..., Any]:
|
|
34
|
+
"""Get a function from the module."""
|
|
35
|
+
...
|
|
36
|
+
def __dir__(self) -> List[str]:
|
|
37
|
+
"""List available functions."""
|
|
38
|
+
...
|
|
39
|
+
def __repr__(self) -> str: ...
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class CsslLang:
|
|
43
|
+
"""
|
|
44
|
+
CSSL Language interface for Python.
|
|
45
|
+
|
|
46
|
+
Usage:
|
|
47
|
+
from includecpp import CSSL
|
|
48
|
+
cssl = CSSL.CsslLang()
|
|
49
|
+
result = cssl.exec("script.cssl", arg1, arg2)
|
|
50
|
+
cssl.T_exec("async_script.cssl", arg1) # Threaded
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
def __init__(self, output_callback: Optional[Callable[[str, str], None]] = ...) -> None:
|
|
54
|
+
"""
|
|
55
|
+
Initialize CSSL runtime.
|
|
56
|
+
|
|
57
|
+
Args:
|
|
58
|
+
output_callback: Optional callback for output (text, level)
|
|
59
|
+
"""
|
|
60
|
+
...
|
|
61
|
+
|
|
62
|
+
def exec(self, path_or_code: str, *args: Any) -> Any:
|
|
63
|
+
"""
|
|
64
|
+
Execute CSSL code or file.
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
path_or_code: Path to .cssl file or CSSL code string
|
|
68
|
+
*args: Arguments to pass to the script
|
|
69
|
+
|
|
70
|
+
Returns:
|
|
71
|
+
Execution result
|
|
72
|
+
"""
|
|
73
|
+
...
|
|
74
|
+
|
|
75
|
+
def T_exec(
|
|
76
|
+
self,
|
|
77
|
+
path_or_code: str,
|
|
78
|
+
*args: Any,
|
|
79
|
+
callback: Optional[Callable[[Any], None]] = ...
|
|
80
|
+
) -> threading.Thread:
|
|
81
|
+
"""
|
|
82
|
+
Execute CSSL code asynchronously in a thread.
|
|
83
|
+
|
|
84
|
+
Args:
|
|
85
|
+
path_or_code: Path to .cssl file or CSSL code string
|
|
86
|
+
*args: Arguments to pass to the script
|
|
87
|
+
callback: Optional callback when execution completes
|
|
88
|
+
|
|
89
|
+
Returns:
|
|
90
|
+
Thread object
|
|
91
|
+
"""
|
|
92
|
+
...
|
|
93
|
+
|
|
94
|
+
def wait_all(self, timeout: Optional[float] = ...) -> None:
|
|
95
|
+
"""Wait for all async executions to complete."""
|
|
96
|
+
...
|
|
97
|
+
|
|
98
|
+
def get_output(self) -> List[str]:
|
|
99
|
+
"""Get output buffer from last execution."""
|
|
100
|
+
...
|
|
101
|
+
|
|
102
|
+
def clear_output(self) -> None:
|
|
103
|
+
"""Clear output buffer."""
|
|
104
|
+
...
|
|
105
|
+
|
|
106
|
+
def set_global(self, name: str, value: Any) -> None:
|
|
107
|
+
"""Set a global variable in CSSL runtime."""
|
|
108
|
+
...
|
|
109
|
+
|
|
110
|
+
def get_global(self, name: str) -> Any:
|
|
111
|
+
"""Get a global variable from CSSL runtime."""
|
|
112
|
+
...
|
|
113
|
+
|
|
114
|
+
def module(self, code: str) -> CSSLModule:
|
|
115
|
+
"""
|
|
116
|
+
Create a callable CSSL module from code.
|
|
117
|
+
|
|
118
|
+
Usage:
|
|
119
|
+
module = cssl.module('''
|
|
120
|
+
printl(parameter.get(0));
|
|
121
|
+
''')
|
|
122
|
+
module("Hello") # Prints "Hello"
|
|
123
|
+
|
|
124
|
+
Args:
|
|
125
|
+
code: CSSL code string
|
|
126
|
+
|
|
127
|
+
Returns:
|
|
128
|
+
CSSLModule - a callable module
|
|
129
|
+
"""
|
|
130
|
+
...
|
|
131
|
+
|
|
132
|
+
def makemodule(self, code: str) -> CSSLFunctionModule:
|
|
133
|
+
"""
|
|
134
|
+
Create a CSSL module with accessible functions.
|
|
135
|
+
|
|
136
|
+
Usage:
|
|
137
|
+
module = cssl.makemodule('''
|
|
138
|
+
string greet(string name) {
|
|
139
|
+
return "Hello, " + name + "!";
|
|
140
|
+
}
|
|
141
|
+
''')
|
|
142
|
+
module.greet("World") # Returns "Hello, World!"
|
|
143
|
+
|
|
144
|
+
Args:
|
|
145
|
+
code: CSSL code string with function definitions
|
|
146
|
+
|
|
147
|
+
Returns:
|
|
148
|
+
CSSLFunctionModule - module with callable function attributes
|
|
149
|
+
"""
|
|
150
|
+
...
|
|
151
|
+
|
|
152
|
+
def share(self, instance: Any, name: str = ...) -> str:
|
|
153
|
+
"""
|
|
154
|
+
Share a Python object with CSSL (LIVE sharing).
|
|
155
|
+
|
|
156
|
+
Changes in CSSL reflect back to Python immediately.
|
|
157
|
+
|
|
158
|
+
Args can be passed in either order:
|
|
159
|
+
cssl.share(my_object, "name") # Preferred
|
|
160
|
+
cssl.share("name", my_object) # Also works
|
|
161
|
+
|
|
162
|
+
Usage:
|
|
163
|
+
class Counter:
|
|
164
|
+
def __init__(self):
|
|
165
|
+
self.value = 0
|
|
166
|
+
|
|
167
|
+
counter = Counter()
|
|
168
|
+
cssl.share(counter, "cnt")
|
|
169
|
+
cssl.exec('''
|
|
170
|
+
$cnt.value = $cnt.value + 1;
|
|
171
|
+
''')
|
|
172
|
+
print(counter.value) # 1
|
|
173
|
+
|
|
174
|
+
Args:
|
|
175
|
+
instance: Python object to share
|
|
176
|
+
name: Name to reference in CSSL as $name
|
|
177
|
+
|
|
178
|
+
Returns:
|
|
179
|
+
Path to the shared object marker file
|
|
180
|
+
"""
|
|
181
|
+
...
|
|
182
|
+
|
|
183
|
+
def unshare(self, name: str) -> bool:
|
|
184
|
+
"""
|
|
185
|
+
Remove a shared object.
|
|
186
|
+
|
|
187
|
+
Args:
|
|
188
|
+
name: Name of the shared object to remove
|
|
189
|
+
|
|
190
|
+
Returns:
|
|
191
|
+
True if removed, False if not found
|
|
192
|
+
"""
|
|
193
|
+
...
|
|
194
|
+
|
|
195
|
+
def code(self, name: str, code: str) -> None:
|
|
196
|
+
"""
|
|
197
|
+
Register inline CSSL code as a named payload.
|
|
198
|
+
|
|
199
|
+
Usage:
|
|
200
|
+
cssl.code("helpers", '''
|
|
201
|
+
void log(string msg) {
|
|
202
|
+
printl("[LOG] " + msg);
|
|
203
|
+
}
|
|
204
|
+
''')
|
|
205
|
+
cssl.exec('''
|
|
206
|
+
payload("helpers");
|
|
207
|
+
@log("Hello");
|
|
208
|
+
''')
|
|
209
|
+
|
|
210
|
+
Args:
|
|
211
|
+
name: Name for the payload
|
|
212
|
+
code: CSSL code string
|
|
213
|
+
"""
|
|
214
|
+
...
|
|
215
|
+
|
|
216
|
+
def get_shared(self, name: str) -> Optional[Any]:
|
|
217
|
+
"""
|
|
218
|
+
Get a shared object by name (for Python-side access).
|
|
219
|
+
|
|
220
|
+
Returns the actual live object reference, not a copy.
|
|
221
|
+
|
|
222
|
+
Args:
|
|
223
|
+
name: Name of the shared object
|
|
224
|
+
|
|
225
|
+
Returns:
|
|
226
|
+
The live shared object or None if not found
|
|
227
|
+
"""
|
|
228
|
+
...
|
|
229
|
+
|
|
230
|
+
def shared(self, name: str) -> Optional[Any]:
|
|
231
|
+
"""
|
|
232
|
+
Get a shared object by name (alias for get_shared).
|
|
233
|
+
|
|
234
|
+
Returns the actual live object reference, not a copy.
|
|
235
|
+
Works with both Python cssl.share() and CSSL ==> $name shared objects.
|
|
236
|
+
|
|
237
|
+
Usage:
|
|
238
|
+
from includecpp import CSSL
|
|
239
|
+
cssl = CSSL.CsslLang()
|
|
240
|
+
|
|
241
|
+
# Share an object
|
|
242
|
+
my_obj = {"value": 42}
|
|
243
|
+
cssl.share(my_obj, "data")
|
|
244
|
+
|
|
245
|
+
# Retrieve it later
|
|
246
|
+
obj = cssl.shared("data")
|
|
247
|
+
print(obj["value"]) # 42
|
|
248
|
+
|
|
249
|
+
Args:
|
|
250
|
+
name: Name of the shared object (without $ prefix)
|
|
251
|
+
|
|
252
|
+
Returns:
|
|
253
|
+
The live shared object or None if not found
|
|
254
|
+
"""
|
|
255
|
+
...
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
def get_cssl() -> CsslLang:
|
|
259
|
+
"""Get default CSSL instance."""
|
|
260
|
+
...
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def exec(path_or_code: str, *args: Any) -> Any:
|
|
264
|
+
"""
|
|
265
|
+
Execute CSSL code or file.
|
|
266
|
+
|
|
267
|
+
Usage:
|
|
268
|
+
from includecpp import CSSL
|
|
269
|
+
CSSL.exec("script.cssl", arg1, arg2)
|
|
270
|
+
CSSL.exec("printl('Hello World');")
|
|
271
|
+
|
|
272
|
+
Args:
|
|
273
|
+
path_or_code: Path to .cssl file or CSSL code string
|
|
274
|
+
*args: Arguments to pass to the script
|
|
275
|
+
|
|
276
|
+
Returns:
|
|
277
|
+
Execution result
|
|
278
|
+
"""
|
|
279
|
+
...
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
def T_exec(
|
|
283
|
+
path_or_code: str,
|
|
284
|
+
*args: Any,
|
|
285
|
+
callback: Optional[Callable[[Any], None]] = ...
|
|
286
|
+
) -> threading.Thread:
|
|
287
|
+
"""
|
|
288
|
+
Execute CSSL code asynchronously in a thread.
|
|
289
|
+
|
|
290
|
+
Usage:
|
|
291
|
+
from includecpp import CSSL
|
|
292
|
+
CSSL.T_exec("async_script.cssl", arg1, callback=on_done)
|
|
293
|
+
|
|
294
|
+
Args:
|
|
295
|
+
path_or_code: Path to .cssl file or CSSL code string
|
|
296
|
+
*args: Arguments to pass to the script
|
|
297
|
+
callback: Optional callback when execution completes
|
|
298
|
+
|
|
299
|
+
Returns:
|
|
300
|
+
Thread object
|
|
301
|
+
"""
|
|
302
|
+
...
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
def set_global(name: str, value: Any) -> None:
|
|
306
|
+
"""Set a global variable in CSSL runtime."""
|
|
307
|
+
...
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
def get_global(name: str) -> Any:
|
|
311
|
+
"""Get a global variable from CSSL runtime."""
|
|
312
|
+
...
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
def get_output() -> List[str]:
|
|
316
|
+
"""Get output buffer from last execution."""
|
|
317
|
+
...
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
def clear_output() -> None:
|
|
321
|
+
"""Clear output buffer."""
|
|
322
|
+
...
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
# Aliases to avoid conflict with Python builtin exec
|
|
326
|
+
def _exec(code: str, *args: Any) -> Any:
|
|
327
|
+
"""
|
|
328
|
+
Execute CSSL code directly (alias for exec).
|
|
329
|
+
|
|
330
|
+
Supports triple-quoted docstrings for inline CSSL code:
|
|
331
|
+
|
|
332
|
+
Usage:
|
|
333
|
+
from includecpp import CSSL
|
|
334
|
+
CSSL._exec('''
|
|
335
|
+
global base = include("abc.cssl-mod");
|
|
336
|
+
|
|
337
|
+
void TestFunc() {
|
|
338
|
+
printl("hey");
|
|
339
|
+
@base.RechneWas(4, 5);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
TestFunc();
|
|
343
|
+
''')
|
|
344
|
+
|
|
345
|
+
Args:
|
|
346
|
+
code: CSSL code string (supports triple-quoted docstrings)
|
|
347
|
+
*args: Arguments to pass to the script
|
|
348
|
+
|
|
349
|
+
Returns:
|
|
350
|
+
Execution result
|
|
351
|
+
"""
|
|
352
|
+
...
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
def _T_exec(
|
|
356
|
+
code: str,
|
|
357
|
+
*args: Any,
|
|
358
|
+
callback: Optional[Callable[[Any], None]] = ...
|
|
359
|
+
) -> threading.Thread:
|
|
360
|
+
"""
|
|
361
|
+
Execute CSSL code asynchronously in a thread (alias for T_exec).
|
|
362
|
+
|
|
363
|
+
Args:
|
|
364
|
+
code: CSSL code string
|
|
365
|
+
*args: Arguments to pass to the script
|
|
366
|
+
callback: Optional callback when execution completes
|
|
367
|
+
|
|
368
|
+
Returns:
|
|
369
|
+
Thread object
|
|
370
|
+
"""
|
|
371
|
+
...
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
def module(code: str) -> CSSLModule:
|
|
375
|
+
"""
|
|
376
|
+
Create a callable CSSL module from code.
|
|
377
|
+
|
|
378
|
+
Usage:
|
|
379
|
+
from includecpp import CSSL
|
|
380
|
+
greet = CSSL.module('''
|
|
381
|
+
printl("Hello, " + parameter.get(0) + "!");
|
|
382
|
+
''')
|
|
383
|
+
greet("World") # Prints "Hello, World!"
|
|
384
|
+
|
|
385
|
+
Args:
|
|
386
|
+
code: CSSL code string
|
|
387
|
+
|
|
388
|
+
Returns:
|
|
389
|
+
CSSLModule - a callable module
|
|
390
|
+
"""
|
|
391
|
+
...
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
def makemodule(code: str) -> CSSLFunctionModule:
|
|
395
|
+
"""
|
|
396
|
+
Create a CSSL module with accessible functions.
|
|
397
|
+
|
|
398
|
+
Usage:
|
|
399
|
+
from includecpp import CSSL
|
|
400
|
+
math_mod = CSSL.makemodule('''
|
|
401
|
+
int add(int a, int b) {
|
|
402
|
+
return a + b;
|
|
403
|
+
}
|
|
404
|
+
''')
|
|
405
|
+
math_mod.add(2, 3) # Returns 5
|
|
406
|
+
|
|
407
|
+
Args:
|
|
408
|
+
code: CSSL code string with function definitions
|
|
409
|
+
|
|
410
|
+
Returns:
|
|
411
|
+
CSSLFunctionModule - module with callable function attributes
|
|
412
|
+
"""
|
|
413
|
+
...
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
def share(instance: Any, name: str = ...) -> str:
|
|
417
|
+
"""
|
|
418
|
+
Share a Python object globally for all CSSL instances (LIVE sharing).
|
|
419
|
+
|
|
420
|
+
Changes made through CSSL will reflect back to the original object.
|
|
421
|
+
|
|
422
|
+
Args can be passed in either order:
|
|
423
|
+
share(my_object, "name") # Preferred
|
|
424
|
+
share("name", my_object) # Also works
|
|
425
|
+
|
|
426
|
+
Args:
|
|
427
|
+
instance: Python object to share
|
|
428
|
+
name: Name to reference in CSSL as $name
|
|
429
|
+
|
|
430
|
+
Returns:
|
|
431
|
+
Path to the shared object marker file
|
|
432
|
+
"""
|
|
433
|
+
...
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
def unshare(name: str) -> bool:
|
|
437
|
+
"""
|
|
438
|
+
Remove a globally shared object.
|
|
439
|
+
|
|
440
|
+
Args:
|
|
441
|
+
name: Name of the shared object to remove
|
|
442
|
+
|
|
443
|
+
Returns:
|
|
444
|
+
True if removed, False if not found
|
|
445
|
+
"""
|
|
446
|
+
...
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
def get_shared(name: str) -> Optional[Any]:
|
|
450
|
+
"""
|
|
451
|
+
Get a globally shared object by name.
|
|
452
|
+
|
|
453
|
+
Args:
|
|
454
|
+
name: Name of the shared object
|
|
455
|
+
|
|
456
|
+
Returns:
|
|
457
|
+
The live shared object or None if not found
|
|
458
|
+
"""
|
|
459
|
+
...
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
def shared(name: str) -> Optional[Any]:
|
|
463
|
+
"""
|
|
464
|
+
Get a shared object by name (alias for get_shared).
|
|
465
|
+
|
|
466
|
+
Works with both Python share() and CSSL ==> $name shared objects.
|
|
467
|
+
|
|
468
|
+
Usage:
|
|
469
|
+
from includecpp import CSSL
|
|
470
|
+
|
|
471
|
+
# Share an object
|
|
472
|
+
my_obj = {"value": 42}
|
|
473
|
+
CSSL.share(my_obj, "data")
|
|
474
|
+
|
|
475
|
+
# Retrieve it later
|
|
476
|
+
obj = CSSL.shared("data")
|
|
477
|
+
print(obj["value"]) # 42
|
|
478
|
+
|
|
479
|
+
Args:
|
|
480
|
+
name: Name of the shared object (without $ prefix)
|
|
481
|
+
|
|
482
|
+
Returns:
|
|
483
|
+
The live shared object or None if not found
|
|
484
|
+
"""
|
|
485
|
+
...
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
__all__: List[str]
|