IncludeCPP 4.6.0__py3-none-any.whl → 4.9.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.
Files changed (35) hide show
  1. includecpp/CHANGELOG.md +241 -0
  2. includecpp/__init__.py +89 -3
  3. includecpp/__init__.pyi +2 -1
  4. includecpp/cli/commands.py +1747 -266
  5. includecpp/cli/config_parser.py +1 -1
  6. includecpp/core/build_manager.py +64 -13
  7. includecpp/core/cpp_api_extensions.pyi +43 -270
  8. includecpp/core/cssl/CSSL_DOCUMENTATION.md +1799 -1445
  9. includecpp/core/cssl/cpp/build/api.pyd +0 -0
  10. includecpp/core/cssl/cpp/build/api.pyi +274 -0
  11. includecpp/core/cssl/cpp/build/cssl_core.pyi +0 -99
  12. includecpp/core/cssl/cpp/cssl_core.cp +2 -23
  13. includecpp/core/cssl/cssl_builtins.py +2116 -171
  14. includecpp/core/cssl/cssl_builtins.pyi +1324 -104
  15. includecpp/core/cssl/cssl_compiler.py +4 -1
  16. includecpp/core/cssl/cssl_modules.py +605 -6
  17. includecpp/core/cssl/cssl_optimizer.py +12 -1
  18. includecpp/core/cssl/cssl_parser.py +1048 -52
  19. includecpp/core/cssl/cssl_runtime.py +2041 -131
  20. includecpp/core/cssl/cssl_syntax.py +405 -277
  21. includecpp/core/cssl/cssl_types.py +5891 -1655
  22. includecpp/core/cssl_bridge.py +427 -4
  23. includecpp/core/error_catalog.py +54 -10
  24. includecpp/core/homeserver.py +1037 -0
  25. includecpp/generator/parser.cpp +203 -39
  26. includecpp/generator/parser.h +15 -1
  27. includecpp/templates/cpp.proj.template +1 -1
  28. includecpp/vscode/cssl/snippets/cssl.snippets.json +163 -0
  29. includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json +87 -12
  30. {includecpp-4.6.0.dist-info → includecpp-4.9.3.dist-info}/METADATA +81 -10
  31. {includecpp-4.6.0.dist-info → includecpp-4.9.3.dist-info}/RECORD +35 -33
  32. {includecpp-4.6.0.dist-info → includecpp-4.9.3.dist-info}/WHEEL +1 -1
  33. {includecpp-4.6.0.dist-info → includecpp-4.9.3.dist-info}/entry_points.txt +0 -0
  34. {includecpp-4.6.0.dist-info → includecpp-4.9.3.dist-info}/licenses/LICENSE +0 -0
  35. {includecpp-4.6.0.dist-info → includecpp-4.9.3.dist-info}/top_level.txt +0 -0
@@ -62,7 +62,7 @@ class CppProjectConfig:
62
62
 
63
63
  def _get_appdata_path(self) -> Path:
64
64
  if platform.system() == "Windows":
65
- base = Path(os.getenv('APPDATA', ''))
65
+ base = Path(os.getenv('APPDATA', Path.home() / 'AppData' / 'Roaming'))
66
66
  else:
67
67
  base = Path.home() / ".local" / "share" / "includecpp"
68
68
  return base
@@ -177,15 +177,16 @@ class BuildManager:
177
177
  env["MSYSTEM"] = "MINGW64"
178
178
  env["PKG_CONFIG_PATH"] = "/mingw64/lib/pkgconfig:/mingw64/share/pkgconfig"
179
179
 
180
- # Prepend MSYS2 paths
180
+ # Prepend MSYS2 paths - check MSYS2_ROOT env var first, then default
181
+ msys_root = os.environ.get("MSYS2_ROOT", "C:/msys64")
181
182
  msys_paths = [
182
- "C:/msys64/mingw64/bin",
183
- "C:/msys64/usr/local/bin",
184
- "C:/msys64/usr/bin",
185
- "C:/msys64/bin"
183
+ f"{msys_root}/mingw64/bin",
184
+ f"{msys_root}/usr/local/bin",
185
+ f"{msys_root}/usr/bin",
186
+ f"{msys_root}/bin"
186
187
  ]
187
188
  existing_path = env.get("PATH", "")
188
- env["PATH"] = ";".join(msys_paths) + ";" + existing_path
189
+ env["PATH"] = os.pathsep.join(msys_paths) + os.pathsep + existing_path
189
190
 
190
191
  BuildManager._msys2_env_cache = env
191
192
  return env
@@ -387,9 +388,11 @@ target_include_directories(api PRIVATE
387
388
  )
388
389
 
389
390
  if(MSVC)
390
- target_compile_options(api PRIVATE /W3 /O2 /EHsc /MT)
391
+ # /wd4018: disable signed/unsigned comparison warning (pybind11 enum issue)
392
+ target_compile_options(api PRIVATE /W3 /O2 /EHsc /MT /wd4018 /wd4267)
391
393
  else()
392
- target_compile_options(api PRIVATE -Wall -O3 -pthread)
394
+ # -Wno-sign-compare: disable signed/unsigned comparison warning (pybind11 enum issue)
395
+ target_compile_options(api PRIVATE -Wall -O3 -pthread -Wno-sign-compare)
393
396
  # MinGW on Windows: static linking for MinGW runtime and pthread
394
397
  if(WIN32)
395
398
  target_link_options(api PRIVATE -static-libgcc -static-libstdc++ -Wl,-Bstatic -lpthread -Wl,-Bdynamic -lws2_32)
@@ -718,7 +721,8 @@ endif()
718
721
  if platform.system() != "Windows":
719
722
  return
720
723
 
721
- msys_bin = Path("C:/msys64/mingw64/bin")
724
+ msys_root = os.environ.get("MSYS2_ROOT", "C:/msys64")
725
+ msys_bin = Path(msys_root) / "mingw64" / "bin"
722
726
  if not msys_bin.exists():
723
727
  return
724
728
 
@@ -1867,11 +1871,58 @@ endif()
1867
1871
 
1868
1872
  if dest.exists():
1869
1873
  backup = dest.with_suffix(dest.suffix + ".backup")
1870
- shutil.move(str(dest), str(backup))
1871
- if verbose:
1872
- print(f"Backed up old module: {backup}")
1874
+ try:
1875
+ shutil.move(str(dest), str(backup))
1876
+ if verbose:
1877
+ print(f"Backed up old module: {backup}")
1878
+ except PermissionError as e:
1879
+ raise CppBuildError(
1880
+ f"Cannot move existing module - file is locked!\n\n"
1881
+ f"File: {dest}\n\n"
1882
+ f"This usually means:\n"
1883
+ f" - A compiled .exe using this module is still running\n"
1884
+ f" - Another Python process has imported this module\n"
1885
+ f" - Your IDE/editor has the file open\n\n"
1886
+ f"Fix:\n"
1887
+ f" 1. Close any running .exe that uses this module\n"
1888
+ f" 2. Close Python REPL/scripts using this module\n"
1889
+ f" 3. Restart your IDE if it imported the module\n"
1890
+ f" 4. Then run 'includecpp rebuild' again\n\n"
1891
+ f"Original error: {e}"
1892
+ )
1893
+ except OSError as e:
1894
+ # Linux/Mac: ETXTBSY, EBUSY, etc.
1895
+ if e.errno in (16, 26): # EBUSY, ETXTBSY
1896
+ raise CppBuildError(
1897
+ f"Cannot move module - file is busy!\n\n"
1898
+ f"File: {dest}\n\n"
1899
+ f"A process is currently using this file.\n\n"
1900
+ f"Fix: Close any process using this module, then rebuild."
1901
+ )
1902
+ raise
1873
1903
 
1874
- shutil.copy2(str(api_pyd), str(dest))
1904
+ try:
1905
+ shutil.copy2(str(api_pyd), str(dest))
1906
+ except PermissionError as e:
1907
+ raise CppBuildError(
1908
+ f"Cannot write module - permission denied!\n\n"
1909
+ f"Destination: {dest}\n\n"
1910
+ f"Possible causes:\n"
1911
+ f" - File is locked by another process (close running .exe)\n"
1912
+ f" - Antivirus blocking the write\n"
1913
+ f" - Insufficient permissions\n\n"
1914
+ f"Fix: Close any process using '{dest.name}', then rebuild.\n\n"
1915
+ f"Original error: {e}"
1916
+ )
1917
+ except OSError as e:
1918
+ if e.errno in (16, 26): # EBUSY, ETXTBSY (Linux/Mac)
1919
+ raise CppBuildError(
1920
+ f"Cannot write module - file is busy!\n\n"
1921
+ f"File: {dest}\n"
1922
+ f"A process is currently using this file.\n\n"
1923
+ f"Fix: Close any process using this module, then rebuild."
1924
+ )
1925
+ raise
1875
1926
 
1876
1927
  if verbose:
1877
1928
  print(f"Installed module: {dest}")
@@ -6,306 +6,76 @@ DO NOT EDIT - Auto-generated by IncludeCPP build system.
6
6
 
7
7
  from typing import Any, List, Dict, Optional, Union, Protocol, overload
8
8
 
9
- class Cssl_coreModuleWrapper(Protocol):
10
- """Type hints for cssl_core module wrapper (VSCode autocomplete support)."""
9
+ class Cssl_runnerModuleWrapper(Protocol):
10
+ """Type hints for cssl_runner module wrapper (VSCode autocomplete support)."""
11
11
 
12
12
  def getInfo(self) -> Dict[str, Any]:
13
- """Get cssl_core module information."""
13
+ """Get cssl_runner module information."""
14
14
  ...
15
15
 
16
- class Lexer:
17
- """C++ class: Lexer"""
16
+ def GetCsslDataStruct(self, *args: Any, **kwargs: Any) -> Any:
17
+ """C++ function: GetCsslDataStruct"""
18
+ ...
18
19
 
19
- def __init__(self, arg0: str) -> None:
20
- """Initialize Lexer instance"""
21
- ...
20
+ def example_function(self, *args: Any, **kwargs: Any) -> Any:
21
+ """C++ function: example_function"""
22
+ ...
22
23
 
23
- def tokenize(self, *args: Any, **kwargs: Any) -> Any:
24
- """C++ method: tokenize"""
25
- ...
24
+ def get_vector(self, *args: Any, **kwargs: Any) -> Any:
25
+ """C++ function: get_vector"""
26
+ ...
26
27
 
28
+ def one(self, *args: Any, **kwargs: Any) -> Any:
29
+ """C++ function: one"""
30
+ ...
27
31
 
28
- class Token:
29
- """C++ class: Token"""
30
32
 
31
- @overload
32
- def __init__(self) -> None: ...
33
- @overload
34
- def __init__(self, arg0: int, arg1: int, arg2: int) -> None: ...
35
- @overload
36
- def __init__(self, arg0: int, arg1: str, arg2: int, arg3: int) -> None: ...
37
- @overload
38
- def __init__(self, arg0: int, arg1: float, arg2: int, arg3: int) -> None: ...
39
- @overload
40
- def __init__(self, arg0: int, arg1: bool, arg2: int, arg3: int) -> None: ...
41
33
 
42
- def __init__(self, *args: Any, **kwargs: Any) -> None:
43
- """Initialize Token instance"""
44
- ...
34
+ class MycppModuleWrapper(Protocol):
35
+ """Type hints for mycpp module wrapper (VSCode autocomplete support)."""
45
36
 
46
- pass
37
+ def getInfo(self) -> Dict[str, Any]:
38
+ """Get mycpp module information."""
39
+ ...
47
40
 
48
- class Interpreter:
49
- """C++ class: Interpreter"""
41
+ class Counter:
42
+ """C++ class: Counter"""
50
43
 
51
44
  def __init__(self) -> None:
52
- """Initialize Interpreter instance"""
53
- ...
54
-
55
- def run(self, *args: Any, **kwargs: Any) -> Any:
56
- """C++ method: run"""
57
- ...
58
-
59
- def run_string(self, *args: Any, **kwargs: Any) -> Any:
60
- """C++ method: run_string"""
61
- ...
62
-
63
-
64
- class Value:
65
- """C++ class: Value"""
66
-
67
- @overload
68
- def __init__(self) -> None: ...
69
- @overload
70
- def __init__(self, arg0: bool) -> None: ...
71
- @overload
72
- def __init__(self, arg0: Any) -> None: ...
73
- @overload
74
- def __init__(self, arg0: float) -> None: ...
75
- @overload
76
- def __init__(self, arg0: str) -> None: ...
77
-
78
- def __init__(self, *args: Any, **kwargs: Any) -> None:
79
- """Initialize Value instance"""
80
- ...
81
-
82
- def as_bool(self, *args: Any, **kwargs: Any) -> Any:
83
- """C++ method: as_bool"""
84
- ...
85
-
86
- def as_float(self, *args: Any, **kwargs: Any) -> Any:
87
- """C++ method: as_float"""
88
- ...
89
-
90
- def as_int(self, *args: Any, **kwargs: Any) -> Any:
91
- """C++ method: as_int"""
92
- ...
93
-
94
- def as_string(self, *args: Any, **kwargs: Any) -> Any:
95
- """C++ method: as_string"""
96
- ...
97
-
98
- def get_type(self, *args: Any, **kwargs: Any) -> Any:
99
- """C++ method: get_type"""
100
- ...
101
-
102
- def is_bool(self, *args: Any, **kwargs: Any) -> Any:
103
- """C++ method: is_bool"""
45
+ """Initialize Counter instance"""
104
46
  ...
105
47
 
106
- def is_dict(self, *args: Any, **kwargs: Any) -> Any:
107
- """C++ method: is_dict"""
48
+ def decrement(self, *args: Any, **kwargs: Any) -> Any:
49
+ """C++ method: decrement"""
108
50
  ...
109
51
 
110
- def is_float(self, *args: Any, **kwargs: Any) -> Any:
111
- """C++ method: is_float"""
52
+ def getValue(self, *args: Any, **kwargs: Any) -> Any:
53
+ """C++ method: getValue"""
112
54
  ...
113
55
 
114
- def is_int(self, *args: Any, **kwargs: Any) -> Any:
115
- """C++ method: is_int"""
56
+ def increment(self, *args: Any, **kwargs: Any) -> Any:
57
+ """C++ method: increment"""
116
58
  ...
117
59
 
118
- def is_list(self, *args: Any, **kwargs: Any) -> Any:
119
- """C++ method: is_list"""
60
+ def reset(self, *args: Any, **kwargs: Any) -> Any:
61
+ """C++ method: reset"""
120
62
  ...
121
63
 
122
- def is_null(self, *args: Any, **kwargs: Any) -> Any:
123
- """C++ method: is_null"""
64
+ def setValue(self, *args: Any, **kwargs: Any) -> Any:
65
+ """C++ method: setValue"""
124
66
  ...
125
67
 
126
- def is_number(self, *args: Any, **kwargs: Any) -> Any:
127
- """C++ method: is_number"""
128
- ...
129
-
130
- def is_string(self, *args: Any, **kwargs: Any) -> Any:
131
- """C++ method: is_string"""
132
- ...
133
-
134
- def to_bool(self, *args: Any, **kwargs: Any) -> Any:
135
- """C++ method: to_bool"""
136
- ...
137
-
138
- def to_string(self, *args: Any, **kwargs: Any) -> Any:
139
- """C++ method: to_string"""
140
- ...
141
-
142
-
143
- def run_cssl(self, *args: Any, **kwargs: Any) -> Any:
144
- """C++ function: run_cssl"""
145
- ...
146
-
147
- def version(self, *args: Any, **kwargs: Any) -> Any:
148
- """C++ function: version"""
149
- ...
150
-
151
- def is_keyword(self, *args: Any, **kwargs: Any) -> Any:
152
- """C++ function: is_keyword"""
153
- ...
154
-
155
- def str_concat(self, *args: Any, **kwargs: Any) -> Any:
156
- """C++ function: str_concat"""
157
- ...
158
-
159
- def str_contains(self, *args: Any, **kwargs: Any) -> Any:
160
- """C++ function: str_contains"""
161
- ...
162
-
163
- def str_join(self, *args: Any, **kwargs: Any) -> Any:
164
- """C++ function: str_join"""
165
- ...
166
-
167
- def str_lower(self, *args: Any, **kwargs: Any) -> Any:
168
- """C++ function: str_lower"""
169
- ...
170
-
171
- def str_replace(self, *args: Any, **kwargs: Any) -> Any:
172
- """C++ function: str_replace"""
173
- ...
174
-
175
- def str_split(self, *args: Any, **kwargs: Any) -> Any:
176
- """C++ function: str_split"""
177
- ...
178
-
179
- def str_trim(self, *args: Any, **kwargs: Any) -> Any:
180
- """C++ function: str_trim"""
181
- ...
182
-
183
- def str_upper(self, *args: Any, **kwargs: Any) -> Any:
184
- """C++ function: str_upper"""
185
- ...
186
-
187
- def str_reverse(self, *args: Any, **kwargs: Any) -> Any:
188
- """C++ function: str_reverse"""
189
- ...
190
-
191
- def str_len(self, *args: Any, **kwargs: Any) -> Any:
192
- """C++ function: str_len"""
193
- ...
194
-
195
- def str_repeat(self, *args: Any, **kwargs: Any) -> Any:
196
- """C++ function: str_repeat"""
197
- ...
198
-
199
- def str_startswith(self, *args: Any, **kwargs: Any) -> Any:
200
- """C++ function: str_startswith"""
201
- ...
202
-
203
- def str_endswith(self, *args: Any, **kwargs: Any) -> Any:
204
- """C++ function: str_endswith"""
205
- ...
206
-
207
- def str_indexof(self, *args: Any, **kwargs: Any) -> Any:
208
- """C++ function: str_indexof"""
209
- ...
210
-
211
- def str_substr(self, *args: Any, **kwargs: Any) -> Any:
212
- """C++ function: str_substr"""
213
- ...
214
68
 
215
- def str_cmp(self, *args: Any, **kwargs: Any) -> Any:
216
- """C++ function: str_cmp"""
69
+ def circle_area(self, *args: Any, **kwargs: Any) -> Any:
70
+ """C++ function: circle_area"""
217
71
  ...
218
72
 
219
- def math_clamp(self, *args: Any, **kwargs: Any) -> Any:
220
- """C++ function: math_clamp"""
73
+ def factorial(self, *args: Any, **kwargs: Any) -> Any:
74
+ """C++ function: factorial"""
221
75
  ...
222
76
 
223
- def math_ipow(self, *args: Any, **kwargs: Any) -> Any:
224
- """C++ function: math_ipow"""
225
- ...
226
-
227
- def math_pow(self, *args: Any, **kwargs: Any) -> Any:
228
- """C++ function: math_pow"""
229
- ...
230
-
231
- def math_mod(self, *args: Any, **kwargs: Any) -> Any:
232
- """C++ function: math_mod"""
233
- ...
234
-
235
- def math_abs(self, *args: Any, **kwargs: Any) -> Any:
236
- """C++ function: math_abs"""
237
- ...
238
-
239
- def math_min(self, *args: Any, **kwargs: Any) -> Any:
240
- """C++ function: math_min"""
241
- ...
242
-
243
- def math_max(self, *args: Any, **kwargs: Any) -> Any:
244
- """C++ function: math_max"""
245
- ...
246
-
247
- def math_floor(self, *args: Any, **kwargs: Any) -> Any:
248
- """C++ function: math_floor"""
249
- ...
250
-
251
- def math_ceil(self, *args: Any, **kwargs: Any) -> Any:
252
- """C++ function: math_ceil"""
253
- ...
254
-
255
- def array_sum(self, *args: Any, **kwargs: Any) -> Any:
256
- """C++ function: array_sum"""
257
- ...
258
-
259
- def array_isum(self, *args: Any, **kwargs: Any) -> Any:
260
- """C++ function: array_isum"""
261
- ...
262
-
263
- def array_avg(self, *args: Any, **kwargs: Any) -> Any:
264
- """C++ function: array_avg"""
265
- ...
266
-
267
- def array_min(self, *args: Any, **kwargs: Any) -> Any:
268
- """C++ function: array_min"""
269
- ...
270
-
271
- def array_max(self, *args: Any, **kwargs: Any) -> Any:
272
- """C++ function: array_max"""
273
- ...
274
-
275
- def range(self, *args: Any, **kwargs: Any) -> Any:
276
- """C++ function: range"""
277
- ...
278
-
279
- def loop_check_lt(self, *args: Any, **kwargs: Any) -> Any:
280
- """C++ function: loop_check_lt"""
281
- ...
282
-
283
- def loop_check_le(self, *args: Any, **kwargs: Any) -> Any:
284
- """C++ function: loop_check_le"""
285
- ...
286
-
287
- def loop_check_gt(self, *args: Any, **kwargs: Any) -> Any:
288
- """C++ function: loop_check_gt"""
289
- ...
290
-
291
- def loop_check_ge(self, *args: Any, **kwargs: Any) -> Any:
292
- """C++ function: loop_check_ge"""
293
- ...
294
-
295
- def num_cmp(self, *args: Any, **kwargs: Any) -> Any:
296
- """C++ function: num_cmp"""
297
- ...
298
-
299
- def eq_int(self, *args: Any, **kwargs: Any) -> Any:
300
- """C++ function: eq_int"""
301
- ...
302
-
303
- def eq_float(self, *args: Any, **kwargs: Any) -> Any:
304
- """C++ function: eq_float"""
305
- ...
306
-
307
- def eq_str(self, *args: Any, **kwargs: Any) -> Any:
308
- """C++ function: eq_str"""
77
+ def reverse_string(self, *args: Any, **kwargs: Any) -> Any:
78
+ """C++ function: reverse_string"""
309
79
  ...
310
80
 
311
81
 
@@ -328,7 +98,10 @@ class CppApi:
328
98
  ...
329
99
 
330
100
  @overload
331
- def include(self, module_name: str = "cssl_core", auto_update: Optional[bool] = None) -> Cssl_coreModuleWrapper: ...
101
+ def include(self, module_name: str = "cssl_runner", auto_update: Optional[bool] = None) -> Cssl_runnerModuleWrapper: ...
102
+
103
+ @overload
104
+ def include(self, module_name: str = "mycpp", auto_update: Optional[bool] = None) -> MycppModuleWrapper: ...
332
105
 
333
106
  @overload
334
107
  def include(self, module_name: str, auto_update: Optional[bool] = None) -> Any: ...