IncludeCPP 4.0.2__py3-none-any.whl → 4.3.0__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/CHANGELOG.md +142 -0
- includecpp/DOCUMENTATION.md +446 -0
- includecpp/__init__.py +1 -1
- includecpp/__init__.pyi +4 -1
- includecpp/cli/commands.py +700 -86
- includecpp/core/ai_integration.py +46 -13
- includecpp/core/cpp_api_extensions.pyi +350 -0
- includecpp/core/cssl/CSSL_DOCUMENTATION.md +1535 -1316
- includecpp/core/cssl/cssl_builtins.py +230 -23
- includecpp/core/cssl/cssl_languages.py +1757 -0
- includecpp/core/cssl/cssl_parser.py +967 -126
- includecpp/core/cssl/cssl_runtime.py +1133 -84
- includecpp/core/cssl/cssl_syntax.py +88 -4
- includecpp/core/cssl/cssl_types.py +361 -1
- includecpp/core/cssl_bridge.py +194 -8
- includecpp/core/cssl_bridge.pyi +148 -10
- includecpp/generator/parser.cpp +121 -4
- includecpp/generator/parser.h +6 -0
- includecpp/vscode/cssl/package.json +43 -1
- includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json +178 -19
- includecpp-4.3.0.dist-info/METADATA +277 -0
- {includecpp-4.0.2.dist-info → includecpp-4.3.0.dist-info}/RECORD +26 -22
- includecpp-4.0.2.dist-info/METADATA +0 -908
- {includecpp-4.0.2.dist-info → includecpp-4.3.0.dist-info}/WHEEL +0 -0
- {includecpp-4.0.2.dist-info → includecpp-4.3.0.dist-info}/entry_points.txt +0 -0
- {includecpp-4.0.2.dist-info → includecpp-4.3.0.dist-info}/licenses/LICENSE +0 -0
- {includecpp-4.0.2.dist-info → includecpp-4.3.0.dist-info}/top_level.txt +0 -0
includecpp/CHANGELOG.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# IncludeCPP Changelog
|
|
2
|
+
|
|
3
|
+
## v4.3.0 (2026-01-08)
|
|
4
|
+
|
|
5
|
+
### New Features
|
|
6
|
+
- Payload namespace support: `payload("mylib", "libname")` loads definitions into `libname::`
|
|
7
|
+
- Auto-extension for payloads: `payload("engine")` finds `engine.cssl-pl`
|
|
8
|
+
- Namespaced class instantiation: `new Engine::GameEngine()`
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
- Fixed try/catch parsing (catch was interpreted as function call)
|
|
12
|
+
- Added finally block support for try/catch
|
|
13
|
+
- Division by zero now throws error instead of returning 0
|
|
14
|
+
- Modulo by zero now throws error
|
|
15
|
+
- List index out of bounds now throws error with helpful message
|
|
16
|
+
- Dict key not found now throws error
|
|
17
|
+
- try/catch now catches Python exceptions
|
|
18
|
+
- Fixed `embedded &$PyObject::method` replacement (this-> now works)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## v4.2.5 (2026-01-08)
|
|
23
|
+
|
|
24
|
+
### New Features
|
|
25
|
+
- Added `embedded` keyword for immediate function/class replacement
|
|
26
|
+
- Added `switch` for open parameters with pattern matching
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
- Fixed `OpenFind<type, "name">` returning function reference instead of value
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## v4.2.4 (2026-01-08)
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
- Fixed `%name` priority for `&function` overrides
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## v4.2.3 (2026-01-08)
|
|
41
|
+
|
|
42
|
+
### Bug Fixes
|
|
43
|
+
- Removed pagination from CLI documentation
|
|
44
|
+
- Fixed `&builtin` function override
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## v4.2.2 (2026-01-08)
|
|
49
|
+
|
|
50
|
+
### Bug Fixes
|
|
51
|
+
- Fixed bidirectional `lang$Instance` mutations
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## v4.2.1 (2026-01-08)
|
|
56
|
+
|
|
57
|
+
### CLI Improvements
|
|
58
|
+
- `--doc` and `--changelog` now load from local files
|
|
59
|
+
- Added `--changelog --N` and `--changelog --all` options
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## v4.2.0 (2026-01-08)
|
|
64
|
+
|
|
65
|
+
### New Features
|
|
66
|
+
- Multi-language support with `libinclude()` and `supports` keyword
|
|
67
|
+
- Cross-language instance sharing with `lang$InstanceName` syntax
|
|
68
|
+
- Language transformers for Python, JavaScript, Java, C#, C++
|
|
69
|
+
- SDK packages for C++, Java, C#, JavaScript
|
|
70
|
+
- Default parameter values in CSSL functions
|
|
71
|
+
|
|
72
|
+
### CLI
|
|
73
|
+
- Added `includecpp cssl sdk <lang>` command
|
|
74
|
+
- Added `--doc "searchterm"` for documentation search
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## v4.1.0 (2024-12-15)
|
|
79
|
+
|
|
80
|
+
### New Features
|
|
81
|
+
- CodeInfusion system with `<<==` and `+<<==` operators
|
|
82
|
+
- Class `overwrites` keyword
|
|
83
|
+
- `super()` and `super::method()` calls
|
|
84
|
+
- New containers: `combo<T>`, `iterator<T>`, `datastruct<T>`
|
|
85
|
+
- `python::pythonize()` for returning CSSL classes to Python
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## v4.0.3 (2024-11-20)
|
|
90
|
+
|
|
91
|
+
### New Features
|
|
92
|
+
- Universal instances with `instance<"name">`
|
|
93
|
+
- Python API: `getInstance()`, `createInstance()`, `deleteInstance()`
|
|
94
|
+
- Method injection with `+<<==`
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## v4.0.2 (2024-11-01)
|
|
99
|
+
|
|
100
|
+
### New Features
|
|
101
|
+
- Simplified API: `CSSL.run()`, `CSSL.module()`, `CSSL.script()`
|
|
102
|
+
- Shared objects with `cssl.share(obj, "name")` and `$name` syntax
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## v4.0.0 (2024-10-15)
|
|
107
|
+
|
|
108
|
+
### Major Release
|
|
109
|
+
- Complete rewrite of CSSL parser and runtime
|
|
110
|
+
- Generic container types: `stack<T>`, `vector<T>`, `map<K,V>`
|
|
111
|
+
- Class system with constructors and inheritance
|
|
112
|
+
- BruteInjection operators: `<==`, `+<==`, `-<==`
|
|
113
|
+
- Global variables with `@name`, captured variables with `%name`
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## v3.2.0 (2024-09-01)
|
|
118
|
+
|
|
119
|
+
### New Features
|
|
120
|
+
- CPPY code conversion (`includecpp cppy convert`)
|
|
121
|
+
- AI-assisted conversion with `--ai` flag
|
|
122
|
+
- Fast incremental builds with `--fast` flag
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## v3.1.0 (2024-08-01)
|
|
127
|
+
|
|
128
|
+
### New Features
|
|
129
|
+
- `includecpp auto` and `includecpp fix` commands
|
|
130
|
+
- `DEPENDS()` for module dependencies
|
|
131
|
+
- `TEMPLATE_FUNC()` for template instantiation
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## v3.0.0 (2024-07-01)
|
|
136
|
+
|
|
137
|
+
### Initial Release
|
|
138
|
+
- C++ to Python binding generation
|
|
139
|
+
- CSSL scripting language
|
|
140
|
+
- Plugin file format (.cp)
|
|
141
|
+
- CMake-based build system
|
|
142
|
+
- Cross-platform support (Windows, Linux, Mac)
|
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
# IncludeCPP Documentation
|
|
2
|
+
|
|
3
|
+
Version 4.3.0
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## What is IncludeCPP?
|
|
8
|
+
|
|
9
|
+
IncludeCPP lets you write C++ code and use it directly in Python. You write your C++ functions and classes, run a few commands, and then import them in Python like any other module.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Getting Started
|
|
14
|
+
|
|
15
|
+
### Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install IncludeCPP
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Create Your First Project
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
mkdir myproject
|
|
25
|
+
cd myproject
|
|
26
|
+
includecpp init
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
This creates three things:
|
|
30
|
+
- `cpp.proj` - Project settings
|
|
31
|
+
- `include/` - Your C++ source files go here
|
|
32
|
+
- `plugins/` - Generated binding files
|
|
33
|
+
|
|
34
|
+
### Write C++ Code
|
|
35
|
+
|
|
36
|
+
Create a file `include/math.cpp`:
|
|
37
|
+
|
|
38
|
+
```cpp
|
|
39
|
+
namespace includecpp {
|
|
40
|
+
|
|
41
|
+
int add(int a, int b) {
|
|
42
|
+
return a + b;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
class Counter {
|
|
46
|
+
public:
|
|
47
|
+
Counter() : value(0) {}
|
|
48
|
+
void increment() { value++; }
|
|
49
|
+
int get() { return value; }
|
|
50
|
+
private:
|
|
51
|
+
int value;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Important: All your code must be inside `namespace includecpp`. Anything outside is ignored.
|
|
58
|
+
|
|
59
|
+
### Generate Bindings
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
includecpp plugin math include/math.cpp
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
This creates `plugins/math.cp` with instructions for building the Python module.
|
|
66
|
+
|
|
67
|
+
### Build
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
includecpp rebuild
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Use in Python
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from includecpp import math
|
|
77
|
+
|
|
78
|
+
# Use function
|
|
79
|
+
result = math.add(5, 3)
|
|
80
|
+
print(result) # 8
|
|
81
|
+
|
|
82
|
+
# Use class
|
|
83
|
+
counter = math.Counter()
|
|
84
|
+
counter.increment()
|
|
85
|
+
counter.increment()
|
|
86
|
+
print(counter.get()) # 2
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Project Structure
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
myproject/
|
|
95
|
+
cpp.proj # Project configuration
|
|
96
|
+
include/ # Your C++ source files
|
|
97
|
+
math.cpp
|
|
98
|
+
utils.cpp
|
|
99
|
+
plugins/ # Generated binding files
|
|
100
|
+
math.cp
|
|
101
|
+
utils.cp
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## CLI Commands
|
|
107
|
+
|
|
108
|
+
### Basic Commands
|
|
109
|
+
|
|
110
|
+
| Command | Description |
|
|
111
|
+
|---------|-------------|
|
|
112
|
+
| `includecpp init` | Create new project |
|
|
113
|
+
| `includecpp plugin <name> <file>` | Generate bindings from C++ file |
|
|
114
|
+
| `includecpp rebuild` | Build all modules |
|
|
115
|
+
| `includecpp auto <name>` | Regenerate + rebuild in one step |
|
|
116
|
+
| `includecpp get <name>` | Show module API |
|
|
117
|
+
|
|
118
|
+
### Build Options
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
includecpp rebuild # Standard build
|
|
122
|
+
includecpp rebuild --fast # Skip unchanged files (~0.4s)
|
|
123
|
+
includecpp rebuild --clean # Full rebuild from scratch
|
|
124
|
+
includecpp rebuild --verbose # Show compiler output
|
|
125
|
+
includecpp rebuild -m mymodule # Build specific module only
|
|
126
|
+
includecpp rebuild -j 8 # Use 8 parallel jobs
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Build Times
|
|
130
|
+
|
|
131
|
+
| Scenario | Time |
|
|
132
|
+
|----------|------|
|
|
133
|
+
| Nothing changed (--fast) | ~0.4s |
|
|
134
|
+
| Source file changed | ~5-10s |
|
|
135
|
+
| Full rebuild | ~30s |
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Plugin File Format (.cp)
|
|
140
|
+
|
|
141
|
+
Plugin files define what gets exposed to Python. They're auto-generated but you can edit them.
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
SOURCE(math.cpp) math
|
|
145
|
+
|
|
146
|
+
PUBLIC(
|
|
147
|
+
math CLASS(Counter) {
|
|
148
|
+
CONSTRUCTOR()
|
|
149
|
+
METHOD(increment)
|
|
150
|
+
METHOD(get)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
math FUNC(add)
|
|
154
|
+
)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Directives
|
|
158
|
+
|
|
159
|
+
| Directive | Use |
|
|
160
|
+
|-----------|-----|
|
|
161
|
+
| `SOURCE(file) name` | Link source file to module name |
|
|
162
|
+
| `CLASS(Name)` | Expose a class |
|
|
163
|
+
| `STRUCT(Name)` | Expose a struct |
|
|
164
|
+
| `FUNC(name)` | Expose a function |
|
|
165
|
+
| `METHOD(name)` | Expose a method |
|
|
166
|
+
| `CONSTRUCTOR()` | Expose default constructor |
|
|
167
|
+
| `CONSTRUCTOR(int, string)` | Expose constructor with parameters |
|
|
168
|
+
| `FIELD(name)` | Expose member variable |
|
|
169
|
+
| `DEPENDS(mod1, mod2)` | Module dependencies |
|
|
170
|
+
|
|
171
|
+
### Overloaded Methods
|
|
172
|
+
|
|
173
|
+
When a class has multiple methods with the same name:
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
CLASS(Shape) {
|
|
177
|
+
METHOD_CONST(intersects, const Circle&)
|
|
178
|
+
METHOD_CONST(intersects, const Rect&)
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Templates
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
TEMPLATE_FUNC(maximum) TYPES(int, float, double)
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Creates: `maximum_int`, `maximum_float`, `maximum_double`
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Configuration
|
|
193
|
+
|
|
194
|
+
### cpp.proj
|
|
195
|
+
|
|
196
|
+
```json
|
|
197
|
+
{
|
|
198
|
+
"project": "MyProject",
|
|
199
|
+
"include": "/include",
|
|
200
|
+
"plugins": "/plugins",
|
|
201
|
+
"compiler": {
|
|
202
|
+
"standard": "c++17",
|
|
203
|
+
"optimization": "O3"
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
| Option | Description |
|
|
209
|
+
|--------|-------------|
|
|
210
|
+
| `project` | Project name |
|
|
211
|
+
| `include` | C++ source directory |
|
|
212
|
+
| `plugins` | Plugin file directory |
|
|
213
|
+
| `compiler.standard` | C++ standard (c++11, c++14, c++17, c++20) |
|
|
214
|
+
| `compiler.optimization` | Optimization level (O0, O1, O2, O3) |
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Using Modules in Python
|
|
219
|
+
|
|
220
|
+
### Direct Import
|
|
221
|
+
|
|
222
|
+
```python
|
|
223
|
+
from includecpp import math
|
|
224
|
+
|
|
225
|
+
result = math.add(1, 2)
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### CppApi
|
|
229
|
+
|
|
230
|
+
```python
|
|
231
|
+
from includecpp import CppApi
|
|
232
|
+
|
|
233
|
+
api = CppApi()
|
|
234
|
+
math = api.include("math")
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Requirements
|
|
240
|
+
|
|
241
|
+
- Python 3.9 or newer
|
|
242
|
+
- C++ compiler (g++, clang++, or MSVC)
|
|
243
|
+
- CMake
|
|
244
|
+
- pybind11 (installed automatically)
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Troubleshooting
|
|
249
|
+
|
|
250
|
+
### "Module not found"
|
|
251
|
+
|
|
252
|
+
Run `includecpp rebuild` to compile your modules.
|
|
253
|
+
|
|
254
|
+
### Build errors
|
|
255
|
+
|
|
256
|
+
- Check your C++ code compiles normally
|
|
257
|
+
- Make sure code is inside `namespace includecpp`
|
|
258
|
+
- Run `includecpp rebuild --verbose` for details
|
|
259
|
+
|
|
260
|
+
### Changes not showing
|
|
261
|
+
|
|
262
|
+
Run `includecpp rebuild --clean` to force a full rebuild.
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## Support
|
|
267
|
+
|
|
268
|
+
Report issues: https://github.com/liliassg/IncludeCPP/issues
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
includecpp bug # Report a bug
|
|
272
|
+
includecpp update # Update to latest version
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
# Experimental Features
|
|
278
|
+
|
|
279
|
+
The following features are experimental and may change between versions.
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## CSSL Scripting
|
|
284
|
+
|
|
285
|
+
CSSL (C-Style Scripting Language) is an embedded scripting language included with IncludeCPP.
|
|
286
|
+
|
|
287
|
+
### Basic Usage
|
|
288
|
+
|
|
289
|
+
```python
|
|
290
|
+
from includecpp import CSSL
|
|
291
|
+
|
|
292
|
+
CSSL.run('''
|
|
293
|
+
printl("Hello from CSSL!");
|
|
294
|
+
|
|
295
|
+
int x = 10;
|
|
296
|
+
for (i in range(0, 5)) {
|
|
297
|
+
x = x + i;
|
|
298
|
+
}
|
|
299
|
+
printl(x);
|
|
300
|
+
''')
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### Parameters and Return Values
|
|
304
|
+
|
|
305
|
+
```python
|
|
306
|
+
result = CSSL.run('''
|
|
307
|
+
int a = parameter.get(0);
|
|
308
|
+
int b = parameter.get(1);
|
|
309
|
+
parameter.return(a + b);
|
|
310
|
+
''', 5, 3)
|
|
311
|
+
|
|
312
|
+
print(result) # 8
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Sharing Python Objects
|
|
316
|
+
|
|
317
|
+
```python
|
|
318
|
+
from includecpp import CSSL
|
|
319
|
+
|
|
320
|
+
class Player:
|
|
321
|
+
def __init__(self):
|
|
322
|
+
self.health = 100
|
|
323
|
+
|
|
324
|
+
player = Player()
|
|
325
|
+
cssl = CSSL.CsslLang()
|
|
326
|
+
cssl.share(player, "player")
|
|
327
|
+
|
|
328
|
+
cssl.run('''
|
|
329
|
+
$player.health = $player.health - 10;
|
|
330
|
+
printl($player.health);
|
|
331
|
+
''')
|
|
332
|
+
|
|
333
|
+
print(player.health) # 90 - Changed!
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### Data Types
|
|
337
|
+
|
|
338
|
+
```cssl
|
|
339
|
+
int x = 42;
|
|
340
|
+
float pi = 3.14;
|
|
341
|
+
string name = "test";
|
|
342
|
+
bool active = true;
|
|
343
|
+
|
|
344
|
+
array<int> numbers;
|
|
345
|
+
numbers.push(1);
|
|
346
|
+
numbers.push(2);
|
|
347
|
+
|
|
348
|
+
list items = [1, 2, 3];
|
|
349
|
+
dict data = {"key": "value"};
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### Control Flow
|
|
353
|
+
|
|
354
|
+
```cssl
|
|
355
|
+
if (x > 10) {
|
|
356
|
+
printl("big");
|
|
357
|
+
} elif (x > 5) {
|
|
358
|
+
printl("medium");
|
|
359
|
+
} else {
|
|
360
|
+
printl("small");
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
for (i in range(0, 10)) {
|
|
364
|
+
printl(i);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
while (count < 5) {
|
|
368
|
+
count = count + 1;
|
|
369
|
+
}
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### Functions
|
|
373
|
+
|
|
374
|
+
```cssl
|
|
375
|
+
define greet(name) {
|
|
376
|
+
printl("Hello, " + name + "!");
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
int add(int a, int b) {
|
|
380
|
+
return a + b;
|
|
381
|
+
}
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### Classes
|
|
385
|
+
|
|
386
|
+
```cssl
|
|
387
|
+
class Person {
|
|
388
|
+
string name;
|
|
389
|
+
int age;
|
|
390
|
+
|
|
391
|
+
constr Person(string n, int a) {
|
|
392
|
+
this->name = n;
|
|
393
|
+
this->age = a;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
void greet() {
|
|
397
|
+
printl("I am " + this->name);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
person = new Person("Alice", 30);
|
|
402
|
+
person.greet();
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
### Payloads
|
|
406
|
+
|
|
407
|
+
Load reusable CSSL code from files:
|
|
408
|
+
|
|
409
|
+
```cssl
|
|
410
|
+
payload("helpers"); // Loads helpers.cssl-pl
|
|
411
|
+
payload("mylib", "mylib"); // Loads into namespace mylib::
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
With namespaces:
|
|
415
|
+
```cssl
|
|
416
|
+
payload("engine", "Engine");
|
|
417
|
+
myengine = new Engine::GameEngine();
|
|
418
|
+
Engine::init();
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
## AI Commands
|
|
424
|
+
|
|
425
|
+
OpenAI-powered code assistance (requires API key).
|
|
426
|
+
|
|
427
|
+
```bash
|
|
428
|
+
includecpp ai key sk-your-key
|
|
429
|
+
includecpp ai enable
|
|
430
|
+
|
|
431
|
+
includecpp ai ask "where is collision detection?"
|
|
432
|
+
includecpp ai optimize mymodule
|
|
433
|
+
includecpp fix --ai mymodule
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
## CPPY Conversion
|
|
439
|
+
|
|
440
|
+
Convert code between Python and C++.
|
|
441
|
+
|
|
442
|
+
```bash
|
|
443
|
+
includecpp cppy convert math.py --cpp
|
|
444
|
+
includecpp cppy convert utils.cpp --py
|
|
445
|
+
includecpp cppy convert file.py --cpp --ai
|
|
446
|
+
```
|
includecpp/__init__.py
CHANGED
includecpp/__init__.pyi
CHANGED
|
@@ -147,7 +147,10 @@ __version__: str
|
|
|
147
147
|
# Dynamic module access via: from includecpp import <module_name>
|
|
148
148
|
# Auto-generated module declarations
|
|
149
149
|
# These allow: from includecpp import <module_name>
|
|
150
|
-
|
|
150
|
+
fast_list: Fast_listModuleWrapper
|
|
151
|
+
game_math: Game_mathModuleWrapper
|
|
152
|
+
solar_system: Solar_systemModuleWrapper
|
|
153
|
+
templates: TemplatesModuleWrapper
|
|
151
154
|
|
|
152
155
|
def __dir__() -> List[str]:
|
|
153
156
|
"""List available modules including dynamically loaded C++ modules."""
|