IncludeCPP 3.7.9__py3-none-any.whl → 3.7.25__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.
@@ -1,5 +1,5 @@
1
1
  """
2
- CSSL Data Types - Advanced container types for CSO Service Script Language
2
+ CSSL Data Types - Advanced container types for CSSL
3
3
 
4
4
  Types:
5
5
  - datastruct<T>: Universal container (lazy declarator) - can hold any type
@@ -64,6 +64,33 @@ class DataStruct(list):
64
64
  return target_type(self[0])
65
65
  return None
66
66
 
67
+ def length(self) -> int:
68
+ """Return datastruct length"""
69
+ return len(self)
70
+
71
+ def size(self) -> int:
72
+ """Return datastruct size (alias for length)"""
73
+ return len(self)
74
+
75
+ def push(self, item: Any) -> 'DataStruct':
76
+ """Push item to datastruct (alias for add)"""
77
+ self.append(item)
78
+ return self
79
+
80
+ def isEmpty(self) -> bool:
81
+ """Check if datastruct is empty"""
82
+ return len(self) == 0
83
+
84
+ def contains(self, item: Any) -> bool:
85
+ """Check if datastruct contains item"""
86
+ return item in self
87
+
88
+ def at(self, index: int) -> Any:
89
+ """Get item at index (safe access)"""
90
+ if 0 <= index < len(self):
91
+ return self[index]
92
+ return None
93
+
67
94
  def begin(self) -> int:
68
95
  """Return iterator to beginning (C++ style)"""
69
96
  return 0
@@ -99,6 +126,16 @@ class Stack(list):
99
126
  self.append(item)
100
127
  return self
101
128
 
129
+ def pop(self) -> Any:
130
+ """Pop and return top element from stack"""
131
+ if len(self) == 0:
132
+ return None
133
+ return super().pop()
134
+
135
+ def pop_back(self) -> Any:
136
+ """Pop and return top element (alias for pop)"""
137
+ return self.pop()
138
+
102
139
  def peek(self) -> Any:
103
140
  """View top item without removing"""
104
141
  return self[-1] if self else None
@@ -701,6 +738,39 @@ class List(list):
701
738
  self.extend([value] * count)
702
739
  return self
703
740
 
741
+ def map(self, func: Callable[[Any], Any]) -> 'List':
742
+ """Apply function to all elements"""
743
+ result = List(self._element_type)
744
+ result.extend(func(item) for item in self)
745
+ return result
746
+
747
+ def filter(self, predicate: Callable[[Any], bool]) -> 'List':
748
+ """Filter elements by predicate"""
749
+ result = List(self._element_type)
750
+ result.extend(item for item in self if predicate(item))
751
+ return result
752
+
753
+ def forEach(self, func: Callable[[Any], None]) -> 'List':
754
+ """Execute function for each element"""
755
+ for item in self:
756
+ func(item)
757
+ return self
758
+
759
+ def reduce(self, func: Callable[[Any, Any], Any], initial: Any = None) -> Any:
760
+ """Reduce list to single value"""
761
+ from functools import reduce as py_reduce
762
+ if initial is None:
763
+ return py_reduce(func, self)
764
+ return py_reduce(func, self, initial)
765
+
766
+ def every(self, predicate: Callable[[Any], bool]) -> bool:
767
+ """Check if all elements match predicate"""
768
+ return all(predicate(item) for item in self)
769
+
770
+ def some(self, predicate: Callable[[Any], bool]) -> bool:
771
+ """Check if any element matches predicate"""
772
+ return any(predicate(item) for item in self)
773
+
704
774
  def begin(self) -> int:
705
775
  """Return iterator to beginning"""
706
776
  return 0
@@ -1499,7 +1569,10 @@ class CSSLInstance:
1499
1569
  object.__setattr__(self, name, value)
1500
1570
 
1501
1571
  def __repr__(self):
1502
- return f"<CSSLInstance of '{self._class.name}'>"
1572
+ return f"<{self._class.name} instance at 0x{id(self):x}>"
1573
+
1574
+ def __str__(self):
1575
+ return f"<{self._class.name} instance at 0x{id(self):x}>"
1503
1576
 
1504
1577
 
1505
1578
  __all__ = [
@@ -11,6 +11,7 @@ v3.8.0 API:
11
11
  cssl.include(path, name) - Register for payload(name)
12
12
  """
13
13
 
14
+ import atexit
14
15
  import os
15
16
  import pickle
16
17
  import random
@@ -33,6 +34,23 @@ def _get_share_directory() -> Path:
33
34
  return share_dir
34
35
 
35
36
 
37
+ def _cleanup_shared_objects() -> None:
38
+ """Clean up all shared object marker files on process exit."""
39
+ try:
40
+ share_dir = _get_share_directory()
41
+ if share_dir.exists():
42
+ for f in share_dir.glob('*.shareobj*'):
43
+ try:
44
+ f.unlink()
45
+ except Exception:
46
+ pass
47
+ except Exception:
48
+ pass
49
+
50
+ # Register cleanup on process exit
51
+ atexit.register(_cleanup_shared_objects)
52
+
53
+
36
54
  # Global live object registry - holds actual object references for live sharing
37
55
  _live_objects: Dict[str, Any] = {}
38
56
 
@@ -404,12 +422,19 @@ class CsslLang:
404
422
  """
405
423
  runtime = self._get_runtime()
406
424
 
407
- # Check if it's a file path
408
- path = Path(path_or_code)
409
- if path.exists() and path.suffix in ('.cssl', '.cssl-mod', '.cssl-pl'):
410
- source = path.read_text(encoding='utf-8')
411
- else:
412
- source = path_or_code
425
+ # Check if it's a file path (not code)
426
+ # Code detection: contains newlines, semicolons, or braces = definitely code
427
+ is_likely_code = '\n' in path_or_code or ';' in path_or_code or '{' in path_or_code
428
+ source = path_or_code
429
+
430
+ if not is_likely_code:
431
+ try:
432
+ path = Path(path_or_code)
433
+ if path.exists() and path.suffix in ('.cssl', '.cssl-mod', '.cssl-pl'):
434
+ source = path.read_text(encoding='utf-8')
435
+ except OSError:
436
+ # Path too long or invalid - treat as code
437
+ pass
413
438
 
414
439
  # Set arguments in runtime scope
415
440
  from .cssl import Parameter
@@ -1064,6 +1089,38 @@ def shared(name: str) -> Optional[Any]:
1064
1089
  return get_shared(name)
1065
1090
 
1066
1091
 
1092
+ def cleanup_shared() -> int:
1093
+ """
1094
+ Manually clean up all shared object marker files.
1095
+
1096
+ Call this to remove stale .shareobj files from %APPDATA%/IncludeCPP/shared_objects/
1097
+ that may have accumulated from previous sessions.
1098
+
1099
+ Returns:
1100
+ Number of files deleted
1101
+ """
1102
+ global _live_objects, _global_shared_objects
1103
+
1104
+ count = 0
1105
+ try:
1106
+ share_dir = _get_share_directory()
1107
+ if share_dir.exists():
1108
+ for f in share_dir.glob('*.shareobj*'):
1109
+ try:
1110
+ f.unlink()
1111
+ count += 1
1112
+ except Exception:
1113
+ pass
1114
+ except Exception:
1115
+ pass
1116
+
1117
+ # Clear in-memory registries
1118
+ _live_objects.clear()
1119
+ _global_shared_objects.clear()
1120
+
1121
+ return count
1122
+
1123
+
1067
1124
  # Singleton for convenience
1068
1125
  _default_instance: Optional[CsslLang] = None
1069
1126
 
@@ -1308,4 +1365,5 @@ __all__ = [
1308
1365
  'unshare',
1309
1366
  'shared',
1310
1367
  'get_shared',
1368
+ 'cleanup_shared',
1311
1369
  ]
@@ -0,0 +1,133 @@
1
+ // CSSL Language Extension for VS Code
2
+ // Provides run functionality for .cssl files
3
+
4
+ const vscode = require('vscode');
5
+ const path = require('path');
6
+ const { spawn } = require('child_process');
7
+
8
+ let outputChannel;
9
+
10
+ function activate(context) {
11
+ // Create output channel for CSSL
12
+ outputChannel = vscode.window.createOutputChannel('CSSL');
13
+
14
+ // Register the run command
15
+ const runCommand = vscode.commands.registerCommand('cssl.runFile', async () => {
16
+ const editor = vscode.window.activeTextEditor;
17
+
18
+ if (!editor) {
19
+ vscode.window.showErrorMessage('No active editor found');
20
+ return;
21
+ }
22
+
23
+ const document = editor.document;
24
+ const filePath = document.fileName;
25
+ const ext = path.extname(filePath).toLowerCase();
26
+
27
+ // Only allow .cssl files (not .cssl-mod or .cssl-pl)
28
+ if (ext !== '.cssl') {
29
+ vscode.window.showWarningMessage('Only .cssl files can be executed. Modules (.cssl-mod) and Payloads (.cssl-pl) cannot be run directly.');
30
+ return;
31
+ }
32
+
33
+ // Save the file before running
34
+ if (document.isDirty) {
35
+ await document.save();
36
+ }
37
+
38
+ // Get configuration
39
+ const config = vscode.workspace.getConfiguration('cssl');
40
+ const pythonPath = config.get('pythonPath', 'python');
41
+ const showOutput = config.get('showOutput', true);
42
+
43
+ // Show output channel
44
+ if (showOutput) {
45
+ outputChannel.show(true);
46
+ }
47
+
48
+ outputChannel.clear();
49
+ outputChannel.appendLine(`[CSSL] Running: ${path.basename(filePath)}`);
50
+ outputChannel.appendLine(`[CSSL] Path: ${filePath}`);
51
+ outputChannel.appendLine('─'.repeat(50));
52
+
53
+ // Run the CSSL file using includecpp cssl run
54
+ const args = ['-m', 'includecpp', 'cssl', 'run', filePath];
55
+
56
+ const process = spawn(pythonPath, args, {
57
+ cwd: path.dirname(filePath),
58
+ env: { ...process.env }
59
+ });
60
+
61
+ let hasError = false;
62
+
63
+ process.stdout.on('data', (data) => {
64
+ outputChannel.append(data.toString());
65
+ });
66
+
67
+ process.stderr.on('data', (data) => {
68
+ hasError = true;
69
+ outputChannel.append(data.toString());
70
+ });
71
+
72
+ process.on('close', (code) => {
73
+ outputChannel.appendLine('');
74
+ outputChannel.appendLine('─'.repeat(50));
75
+ if (code === 0) {
76
+ outputChannel.appendLine(`[CSSL] Finished successfully`);
77
+ } else {
78
+ outputChannel.appendLine(`[CSSL] Exited with code: ${code}`);
79
+ }
80
+ });
81
+
82
+ process.on('error', (err) => {
83
+ outputChannel.appendLine(`[CSSL] Error: ${err.message}`);
84
+ vscode.window.showErrorMessage(`Failed to run CSSL: ${err.message}. Make sure IncludeCPP is installed (pip install includecpp).`);
85
+ });
86
+ });
87
+
88
+ context.subscriptions.push(runCommand);
89
+ context.subscriptions.push(outputChannel);
90
+
91
+ // Register task provider for CSSL
92
+ const taskProvider = vscode.tasks.registerTaskProvider('cssl', {
93
+ provideTasks: () => {
94
+ return [];
95
+ },
96
+ resolveTask: (task) => {
97
+ if (task.definition.type === 'cssl') {
98
+ const config = vscode.workspace.getConfiguration('cssl');
99
+ const pythonPath = config.get('pythonPath', 'python');
100
+ const file = task.definition.file;
101
+
102
+ const execution = new vscode.ShellExecution(
103
+ `${pythonPath} -m includecpp cssl run "${file}"`
104
+ );
105
+
106
+ return new vscode.Task(
107
+ task.definition,
108
+ vscode.TaskScope.Workspace,
109
+ 'Run CSSL',
110
+ 'cssl',
111
+ execution,
112
+ []
113
+ );
114
+ }
115
+ return undefined;
116
+ }
117
+ });
118
+
119
+ context.subscriptions.push(taskProvider);
120
+
121
+ console.log('CSSL extension activated');
122
+ }
123
+
124
+ function deactivate() {
125
+ if (outputChannel) {
126
+ outputChannel.dispose();
127
+ }
128
+ }
129
+
130
+ module.exports = {
131
+ activate,
132
+ deactivate
133
+ };
Binary file
@@ -1,35 +1,60 @@
1
1
  {
2
2
  "name": "cssl",
3
- "displayName": "CSSL - CSO Service Script Language",
3
+ "displayName": "CSSL Language",
4
4
  "description": "Professional syntax highlighting, snippets, and language support for CSSL scripts (.cssl, .cssl-pl, .cssl-mod)",
5
- "version": "1.1.0",
5
+ "version": "1.3.0",
6
6
  "publisher": "IncludeCPP",
7
- "icon": "images/cssl-icon.png",
7
+ "icon": "images/cssl.png",
8
8
  "engines": {
9
9
  "vscode": "^1.60.0"
10
10
  },
11
11
  "categories": [
12
12
  "Programming Languages",
13
- "Snippets"
13
+ "Snippets",
14
+ "Debuggers"
14
15
  ],
15
16
  "keywords": [
16
17
  "cssl",
17
- "cso",
18
18
  "script",
19
19
  "includecpp",
20
20
  "c++",
21
- "python"
21
+ "python",
22
+ "run"
22
23
  ],
24
+ "activationEvents": [
25
+ "onLanguage:cssl"
26
+ ],
27
+ "main": "./extension.js",
23
28
  "contributes": {
24
29
  "languages": [
25
30
  {
26
31
  "id": "cssl",
27
- "aliases": ["CSSL", "cssl", "CSO Service Script"],
28
- "extensions": [".cssl", ".cssl-pl", ".cssl-mod"],
32
+ "aliases": ["CSSL", "cssl"],
33
+ "extensions": [".cssl"],
34
+ "configuration": "./language-configuration.json",
35
+ "icon": {
36
+ "light": "./images/cssl.png",
37
+ "dark": "./images/cssl.png"
38
+ }
39
+ },
40
+ {
41
+ "id": "cssl-mod",
42
+ "aliases": ["CSSL Module", "cssl-mod"],
43
+ "extensions": [".cssl-mod"],
44
+ "configuration": "./language-configuration.json",
45
+ "icon": {
46
+ "light": "./images/cssl_pl.png",
47
+ "dark": "./images/cssl_pl.png"
48
+ }
49
+ },
50
+ {
51
+ "id": "cssl-pl",
52
+ "aliases": ["CSSL Payload", "cssl-pl"],
53
+ "extensions": [".cssl-pl"],
29
54
  "configuration": "./language-configuration.json",
30
55
  "icon": {
31
- "light": "./images/cssl-icon.png",
32
- "dark": "./images/cssl-icon.png"
56
+ "light": "./images/cssl_pl.png",
57
+ "dark": "./images/cssl_pl.png"
33
58
  }
34
59
  }
35
60
  ],
@@ -38,13 +63,94 @@
38
63
  "language": "cssl",
39
64
  "scopeName": "source.cssl",
40
65
  "path": "./syntaxes/cssl.tmLanguage.json"
66
+ },
67
+ {
68
+ "language": "cssl-mod",
69
+ "scopeName": "source.cssl",
70
+ "path": "./syntaxes/cssl.tmLanguage.json"
71
+ },
72
+ {
73
+ "language": "cssl-pl",
74
+ "scopeName": "source.cssl",
75
+ "path": "./syntaxes/cssl.tmLanguage.json"
41
76
  }
42
77
  ],
43
78
  "snippets": [
44
79
  {
45
80
  "language": "cssl",
46
81
  "path": "./snippets/cssl.snippets.json"
82
+ },
83
+ {
84
+ "language": "cssl-mod",
85
+ "path": "./snippets/cssl.snippets.json"
86
+ },
87
+ {
88
+ "language": "cssl-pl",
89
+ "path": "./snippets/cssl.snippets.json"
90
+ }
91
+ ],
92
+ "commands": [
93
+ {
94
+ "command": "cssl.runFile",
95
+ "title": "Run CSSL File",
96
+ "icon": "$(play)",
97
+ "enablement": "resourceExtname == .cssl"
98
+ }
99
+ ],
100
+ "menus": {
101
+ "editor/title/run": [
102
+ {
103
+ "command": "cssl.runFile",
104
+ "when": "resourceExtname == .cssl",
105
+ "group": "navigation"
106
+ }
107
+ ],
108
+ "editor/context": [
109
+ {
110
+ "command": "cssl.runFile",
111
+ "when": "resourceExtname == .cssl",
112
+ "group": "1_run"
113
+ }
114
+ ]
115
+ },
116
+ "keybindings": [
117
+ {
118
+ "command": "cssl.runFile",
119
+ "key": "f5",
120
+ "when": "resourceExtname == .cssl && !inDebugMode"
121
+ },
122
+ {
123
+ "command": "cssl.runFile",
124
+ "key": "ctrl+f5",
125
+ "when": "resourceExtname == .cssl"
126
+ }
127
+ ],
128
+ "taskDefinitions": [
129
+ {
130
+ "type": "cssl",
131
+ "required": ["file"],
132
+ "properties": {
133
+ "file": {
134
+ "type": "string",
135
+ "description": "The CSSL file to run"
136
+ }
137
+ }
138
+ }
139
+ ],
140
+ "configuration": {
141
+ "title": "CSSL",
142
+ "properties": {
143
+ "cssl.pythonPath": {
144
+ "type": "string",
145
+ "default": "python",
146
+ "description": "Path to Python executable"
147
+ },
148
+ "cssl.showOutput": {
149
+ "type": "boolean",
150
+ "default": true,
151
+ "description": "Show output panel when running CSSL files"
152
+ }
47
153
  }
48
- ]
154
+ }
49
155
  }
50
156
  }
@@ -27,17 +27,20 @@
27
27
  { "include": "#function-calls" },
28
28
  { "include": "#builtins" },
29
29
  { "include": "#operators" },
30
- { "include": "#constants" }
30
+ { "include": "#constants" },
31
+ { "include": "#variables" }
31
32
  ],
32
33
  "repository": {
33
34
  "super-functions": {
34
35
  "patterns": [
35
36
  {
36
- "name": "markup.bold.super.builtin.cssl",
37
+ "comment": "#$run, #$exec, #$printl - yellow/gold color",
38
+ "name": "entity.name.tag.super.cssl",
37
39
  "match": "#\\$(run|exec|printl|init)\\b"
38
40
  },
39
41
  {
40
- "name": "markup.bold.super.call.cssl",
42
+ "comment": "#$anyFunction - yellow/gold color",
43
+ "name": "entity.name.tag.super.cssl",
41
44
  "match": "#\\$[a-zA-Z_][a-zA-Z0-9_]*"
42
45
  }
43
46
  ]
@@ -122,6 +125,9 @@
122
125
  { "include": "#class-member-declaration" },
123
126
  { "include": "#types" },
124
127
  { "include": "#this-access" },
128
+ { "include": "#captured-references" },
129
+ { "include": "#global-references" },
130
+ { "include": "#shared-references" },
125
131
  { "include": "#strings" },
126
132
  { "include": "#numbers" },
127
133
  { "include": "#keywords" },
@@ -267,23 +273,23 @@
267
273
  "injection-operators": {
268
274
  "patterns": [
269
275
  {
270
- "comment": "Infuse operators <<== (REPLACE) - orange/gold color",
271
- "name": "markup.inserted.infuse.cssl",
276
+ "comment": "Infuse operators <<== (REPLACE) - orange color",
277
+ "name": "constant.character.escape.infuse.cssl",
272
278
  "match": "(\\+<<==|<<==|-<<==)"
273
279
  },
274
280
  {
275
- "comment": "Infuse out operators ==>> - orange/gold color",
276
- "name": "markup.inserted.infuse.out.cssl",
281
+ "comment": "Infuse out operators ==>> - orange color",
282
+ "name": "constant.character.escape.infuse.out.cssl",
277
283
  "match": "(==>>\\+|==>>|-==>>)"
278
284
  },
279
285
  {
280
286
  "comment": "Brute injection <== (ADD) - cyan/blue color",
281
- "name": "support.constant.brute.cssl",
287
+ "name": "support.function.brute.cssl",
282
288
  "match": "(\\+<==|<==|-<==)"
283
289
  },
284
290
  {
285
291
  "comment": "Brute injection out ==> - cyan/blue color",
286
- "name": "support.constant.brute.out.cssl",
292
+ "name": "support.function.brute.out.cssl",
287
293
  "match": "(==>\\+|==>|-==>)"
288
294
  },
289
295
  {
@@ -351,23 +357,30 @@
351
357
  "captured-references": {
352
358
  "patterns": [
353
359
  {
354
- "name": "variable.other.captured.cssl",
355
- "match": "%[a-zA-Z_][a-zA-Z0-9_]*"
360
+ "comment": "%identifier - % is light blue/cyan, identifier is pink",
361
+ "match": "(%)([a-zA-Z_][a-zA-Z0-9_]*)",
362
+ "captures": {
363
+ "1": { "name": "support.type.cssl" },
364
+ "2": { "name": "entity.other.inherited-class.cssl" }
365
+ }
356
366
  }
357
367
  ]
358
368
  },
359
369
  "global-references": {
360
370
  "patterns": [
361
371
  {
362
- "name": "variable.other.global.cssl",
372
+ "comment": "@identifier - magenta color (full)",
373
+ "name": "constant.other.symbol.cssl",
363
374
  "match": "@[a-zA-Z_][a-zA-Z0-9_]*"
364
375
  },
365
376
  {
366
- "name": "variable.other.global-decl.cssl",
377
+ "comment": "r@identifier - magenta color",
378
+ "name": "constant.other.symbol.cssl",
367
379
  "match": "r@[a-zA-Z_][a-zA-Z0-9_]*"
368
380
  },
369
381
  {
370
- "name": "variable.other.self-ref.cssl",
382
+ "comment": "s@identifier - magenta color",
383
+ "name": "constant.other.symbol.cssl",
371
384
  "match": "s@[a-zA-Z_][a-zA-Z0-9_]*"
372
385
  }
373
386
  ]
@@ -375,11 +388,21 @@
375
388
  "shared-references": {
376
389
  "patterns": [
377
390
  {
378
- "name": "variable.other.shared.cssl",
391
+ "comment": "$identifier - same color as 'new' keyword (full)",
392
+ "name": "keyword.operator.new.cssl",
379
393
  "match": "\\$[a-zA-Z_][a-zA-Z0-9_]*"
380
394
  }
381
395
  ]
382
396
  },
397
+ "variables": {
398
+ "patterns": [
399
+ {
400
+ "comment": "Regular variables - pink/salmon color",
401
+ "name": "entity.other.inherited-class.cssl",
402
+ "match": "\\b[a-z_][a-zA-Z0-9_]*\\b"
403
+ }
404
+ ]
405
+ },
383
406
  "instance-references": {
384
407
  "patterns": [
385
408
  {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: IncludeCPP
3
- Version: 3.7.9
3
+ Version: 3.7.25
4
4
  Summary: Professional C++ Python bindings with type-generic templates, pystubs and native threading
5
5
  Home-page: https://github.com/liliassg/IncludeCPP
6
6
  Author: Lilias Hatterscheidt
@@ -623,7 +623,7 @@ Then check **"Enable Experimental Features"** and save.
623
623
 
624
624
  Use at your own discretion. Report issues at: https://github.com/liliassg/IncludeCPP/issues
625
625
 
626
- # CSSL - CSO Service Script Language
626
+ # CSSL - C-Style Scripting Language
627
627
 
628
628
  IncludeCPP includes CSSL, a scripting language with advanced data manipulation features.
629
629