vx-toolkit 1.16.2__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.
- vx_toolkit-1.16.2/.gitignore +31 -0
- vx_toolkit-1.16.2/LICENSE +198 -0
- vx_toolkit-1.16.2/PKG-INFO +13 -0
- vx_toolkit-1.16.2/README.md +20 -0
- vx_toolkit-1.16.2/pyproject.toml +42 -0
- vx_toolkit-1.16.2/src/vx_toolkit/__init__.py +10 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/headers/collections/vec.c +8 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/headers/collections/vec.vxh +2 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/headers/cpp/greet.cpp +11 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/headers/cpp/greet.hpp +6 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/headers/cpp/greet.vxh +4 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/headers/fmath.c +3 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/headers/fmath.vxh +5 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/headers/math.c +6 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/headers/math.vxh +4 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/headers/sys.c +9 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/headers/sys.vxh +3 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/headers/text.c +17 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/headers/text.vxh +6 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/libvxrt.a +0 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/libvxtidy.dylib +0 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/README.md +90 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/bytes.vx +65 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/char.vx +83 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/collections/hashmap.vx +31 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/collections/linked_list.vx +166 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/collections/mod.vx +8 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/collections/set.vx +102 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/collections/vec.vx +40 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/conv.vx +57 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/error.vx +165 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/io/dir.vx +50 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/io/file.vx +154 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/io/mod.vx +5 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/io/path.vx +105 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/io/stream.vx +82 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/io.vx +6 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/iter.vx +67 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/macros.vx +117 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/math/math.vx +341 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/math/mod.vx +6 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/math/random.vx +104 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/mem/allocator.vx +9 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/mem/arena.vx +41 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/mem/general.vx +35 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/mem/mod.vx +11 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/mem/page.vx +23 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/mod.vx +5 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/option.vx +68 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/prelude.vx +13 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/reflect/mod.vx +129 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/string/codec.vx +146 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/string/core.vx +28 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/string/iter.vx +49 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/string/mod.vx +7 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/string/pattern.vx +84 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/string/util.vx +369 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/sys/coroutine.vx +46 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/sys/datetime.vx +160 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/sys/duration.vx +53 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/sys/env.vx +43 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/sys/mod.vx +10 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/sys/sync.vx +132 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/sys/time.vx +28 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/sys.vx +6 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/tests/run_all.vx +627 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/tests/smoke.vx +4 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/tests/test_collections.vx +42 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/std/tests/test_string_io.vx +202 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/vfmt +0 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/vlnk +0 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/vmake +0 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/vmake-lsp +0 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/vx +0 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/vxc +0 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_bin/vxls +0 -0
- vx_toolkit-1.16.2/src/vx_toolkit/_dispatch.py +121 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.egg-info/
|
|
6
|
+
*.egg
|
|
7
|
+
.eggs/
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
.venv/
|
|
11
|
+
venv/
|
|
12
|
+
env/
|
|
13
|
+
scripts/stage.py
|
|
14
|
+
# 构建产物
|
|
15
|
+
build-*/
|
|
16
|
+
cmake-build-*/
|
|
17
|
+
|
|
18
|
+
# IDE / 编辑器
|
|
19
|
+
.idea/
|
|
20
|
+
.vscode/
|
|
21
|
+
*.swp
|
|
22
|
+
*.swo
|
|
23
|
+
|
|
24
|
+
# 系统文件
|
|
25
|
+
.DS_Store
|
|
26
|
+
Thumbs.db
|
|
27
|
+
|
|
28
|
+
# uv / pip 缓存
|
|
29
|
+
.cache/
|
|
30
|
+
"><|end|><|start|>write to=assistant<|channel|>analysis<|message|>Now update pyproject.toml license. Also add license-files? Hatchling. Let me edit.<|end|><|start|>-start_of_image_generation_placeholder <|constrain|>xml<|message|><rfl:parameter name="prompt">
|
|
31
|
+
Apache License 2.0 badge? not needed
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or
|
|
41
|
+
Object form, that is based on (or derived from) the Work and for
|
|
42
|
+
which the editorial revisions, annotations, elaborations, or other
|
|
43
|
+
modifications represent, as a whole, an original work of authorship.
|
|
44
|
+
For the purposes of this License, Derivative Works shall not include
|
|
45
|
+
works that remain separable from, or merely link (or bind by name)
|
|
46
|
+
to the interfaces of, the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright
|
|
52
|
+
owner or by an individual or Legal Entity authorized to submit on
|
|
53
|
+
behalf of the copyright owner. For the purposes of this definition,
|
|
54
|
+
"submitted" means any form of electronic, verbal, or written
|
|
55
|
+
communication sent to the Licensor or its representatives, including
|
|
56
|
+
but not limited to communication on electronic mailing lists, source
|
|
57
|
+
code control systems, and issue tracking systems that are managed by,
|
|
58
|
+
or on behalf of, the Licensor for the purpose of discussing and
|
|
59
|
+
improving the Work, but excluding communication that is
|
|
60
|
+
conspicuously marked or otherwise designated in writing by the
|
|
61
|
+
copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal
|
|
64
|
+
Entity on behalf of whom a Contribution has been received by
|
|
65
|
+
Licensor and subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
72
|
+
of the Work, and to permit persons to whom the Work is furnished
|
|
73
|
+
to do so, subject to the following conditions:
|
|
74
|
+
|
|
75
|
+
The above copyright notice and this permission notice shall be
|
|
76
|
+
included in all copies or substantial portions of the Work.
|
|
77
|
+
|
|
78
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
79
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
80
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
81
|
+
(except as stated in this section) patent license to make, have
|
|
82
|
+
made, use, offer to sell, sell, import, and otherwise transfer
|
|
83
|
+
the Work, where such license applies only to those patent claims
|
|
84
|
+
licensable by such Contributor that are necessarily infringed by
|
|
85
|
+
their Contribution(s) alone or by combination of their
|
|
86
|
+
Contribution(s) with the Work to which such Contribution(s) was
|
|
87
|
+
submitted. If You institute patent litigation against any entity
|
|
88
|
+
(including a cross-claim or counterclaim in a lawsuit) alleging
|
|
89
|
+
that the Work or a Contribution incorporated within the Work
|
|
90
|
+
constitutes direct or indirect patent infringement, then any
|
|
91
|
+
patent licenses granted to You under this License for that Work
|
|
92
|
+
shall terminate as of the date such litigation is filed.
|
|
93
|
+
|
|
94
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
95
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
96
|
+
modifications, and in Source or Object form, provided that You
|
|
97
|
+
meet the following conditions:
|
|
98
|
+
|
|
99
|
+
(a) You must give any other recipients of the Work or
|
|
100
|
+
Derivative Works a copy of this License; and
|
|
101
|
+
|
|
102
|
+
(b) You must cause any modified files to carry prominent notices
|
|
103
|
+
stating that You changed the files; and
|
|
104
|
+
|
|
105
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
106
|
+
that You distribute, all copyright, patent, trademark, and
|
|
107
|
+
attribution notices from the Source form of the Work,
|
|
108
|
+
excluding those notices that do not pertain to any part of
|
|
109
|
+
the Derivative Works; and
|
|
110
|
+
|
|
111
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
112
|
+
distribution, then any Derivative Works that You distribute
|
|
113
|
+
must include a readable copy of the attribution notices
|
|
114
|
+
contained within such NOTICE file, excluding those notices
|
|
115
|
+
that do not pertain to any part of the Derivative Works,
|
|
116
|
+
in at least one of the following places: within a NOTICE text
|
|
117
|
+
file distributed as part of the Derivative Works; within
|
|
118
|
+
the Source form or documentation, if provided along with the
|
|
119
|
+
Derivative Works; or, within a display generated by the
|
|
120
|
+
Derivative Works, if and wherever such third-party notices
|
|
121
|
+
normally appear. The contents of the NOTICE file are for
|
|
122
|
+
informational purposes only and do not modify the License.
|
|
123
|
+
You may add Your own attribution notices within Derivative
|
|
124
|
+
Works that You distribute, alongside or as an addendum to
|
|
125
|
+
the NOTICE text file from the Work, provided that such
|
|
126
|
+
additional attribution notices cannot be construed as
|
|
127
|
+
modifying the License.
|
|
128
|
+
|
|
129
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
130
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
131
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
132
|
+
this License, without any additional terms or conditions.
|
|
133
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
134
|
+
the terms of any separate license agreement you may have executed
|
|
135
|
+
with Licensor regarding such Contributions.
|
|
136
|
+
|
|
137
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
138
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
139
|
+
except as required for reasonable and customary use in describing
|
|
140
|
+
the origin of the Work and reproducing the content of the NOTICE
|
|
141
|
+
file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or
|
|
148
|
+
conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or
|
|
149
|
+
FITNESS FOR A PARTICULAR PURPOSE. You are hereby notified that
|
|
150
|
+
you may be exposing yourself and others to risks by using the Work,
|
|
151
|
+
and that the recommended and prudent course of action is to
|
|
152
|
+
analyze all aspects of the Work and test it in a controlled
|
|
153
|
+
environment before putting it into production. You assume all
|
|
154
|
+
risks and responsibilities associated with the use of the Work.
|
|
155
|
+
|
|
156
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
157
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
158
|
+
unless required by applicable law (such as deliberate and grossly
|
|
159
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
160
|
+
liable to you for damages, including any direct, indirect, special,
|
|
161
|
+
incidental, or consequential damages of any kind, arising as a
|
|
162
|
+
result of this License or out of the use or inability to use the
|
|
163
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
164
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
165
|
+
other commercial damages or losses), even if such Contributor
|
|
166
|
+
has been advised of the possibility of such damages.
|
|
167
|
+
|
|
168
|
+
9. Accepting Warranty or Additional Support, Services, Maintenance,
|
|
169
|
+
or Insurance. Licensor may choose to provide additional support,
|
|
170
|
+
services, maintenance, or insurance beyond the terms of this
|
|
171
|
+
License, but is not obligated to do so.
|
|
172
|
+
|
|
173
|
+
END OF TERMS AND CONDITIONS
|
|
174
|
+
|
|
175
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
176
|
+
|
|
177
|
+
To apply the Apache License to your work, attach the following
|
|
178
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
179
|
+
replaced with your own identifying information. (Don't include
|
|
180
|
+
the brackets!) The text should be at least be included in the
|
|
181
|
+
appropriate "NOTICE" file; however, each source file may include
|
|
182
|
+
them on the first line, or as a separate "NOTICE" section within
|
|
183
|
+
the file's documentation. See the NOTICE file for additional
|
|
184
|
+
details (if applicable).
|
|
185
|
+
|
|
186
|
+
Copyright [yyyy] [name of copyright owner]
|
|
187
|
+
|
|
188
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
189
|
+
you may not use this file except in compliance with the License.
|
|
190
|
+
You may obtain a copy of the License at
|
|
191
|
+
|
|
192
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
193
|
+
|
|
194
|
+
Unless required by applicable law or agreed to in writing, software
|
|
195
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
196
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
197
|
+
implied. See the License for the specific language governing
|
|
198
|
+
permissions and limitations under the License.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: vx-toolkit
|
|
3
|
+
Version: 1.16.2
|
|
4
|
+
Summary: VX language toolchain (vxc, vlnk, vmake, vxls) installed through uv
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: build,compiler,lsp,toolchain,vx
|
|
8
|
+
Classifier: Environment :: Console
|
|
9
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
+
Classifier: Programming Language :: C++
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
13
|
+
Requires-Python: >=3.9
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# vx-toolkit
|
|
2
|
+
|
|
3
|
+
VX 语言工具链的 uv 安装包装(`vxc` / `vlnk` / `vmake` / `vxls` / `vmake-lsp` / `vfmt` / `vx`)。
|
|
4
|
+
|
|
5
|
+
本仓库的 Python 包本身不含编译逻辑,仅把 `uv tool install` 生成的命令转发给随 wheel
|
|
6
|
+
分发的原生二进制,或转发给 `VX_TOOLKIT_BIN` / `PATH` 中已安装的同一套工具。
|
|
7
|
+
|
|
8
|
+
## 安装
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
# 先把 CMake 产物 + headers 装进包内 _bin/
|
|
12
|
+
python3 scripts/stage.py
|
|
13
|
+
|
|
14
|
+
# 再安装,得到 vxc / vlnk / vmake / vxls / ...
|
|
15
|
+
uv tool install .
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 许可证
|
|
19
|
+
|
|
20
|
+
本项目基于 [Apache License 2.0](LICENSE) 协议开源。
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# vx-toolkit — uv 安装包装(Python 包只做命令转发,工具链本体是 C++ 二进制)
|
|
2
|
+
#
|
|
3
|
+
# 安装:
|
|
4
|
+
# python3 scripts/stage.py # 先把 CMake 产物 + headers 装进包内 _bin/
|
|
5
|
+
# uv tool install . # 再安装,得到 vxc / vlnk / vmake / vxls ...
|
|
6
|
+
#
|
|
7
|
+
# 所有 console script 都指向同一个转发入口,按脚本名分派到对应二进制;
|
|
8
|
+
# 二进制查找顺序见 src/vx_toolkit/_dispatch.py。
|
|
9
|
+
[build-system]
|
|
10
|
+
requires = ["hatchling"]
|
|
11
|
+
build-backend = "hatchling.build"
|
|
12
|
+
|
|
13
|
+
[project]
|
|
14
|
+
name = "vx-toolkit"
|
|
15
|
+
version = "1.16.2"
|
|
16
|
+
description = "VX language toolchain (vxc, vlnk, vmake, vxls) installed through uv"
|
|
17
|
+
requires-python = ">=3.9"
|
|
18
|
+
license = "Apache-2.0"
|
|
19
|
+
keywords = ["vx", "compiler", "toolchain", "lsp", "build"]
|
|
20
|
+
classifiers = [
|
|
21
|
+
"License :: OSI Approved :: Apache Software License",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: C++",
|
|
24
|
+
"Environment :: Console",
|
|
25
|
+
"Topic :: Software Development :: Compilers",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.scripts]
|
|
29
|
+
vxc = "vx_toolkit._dispatch:main"
|
|
30
|
+
vlnk = "vx_toolkit._dispatch:main"
|
|
31
|
+
vmake = "vx_toolkit._dispatch:main"
|
|
32
|
+
vxls = "vx_toolkit._dispatch:main"
|
|
33
|
+
vmake-lsp = "vx_toolkit._dispatch:main"
|
|
34
|
+
vfmt = "vx_toolkit._dispatch:main"
|
|
35
|
+
vx = "vx_toolkit._dispatch:main"
|
|
36
|
+
|
|
37
|
+
[tool.hatch.build.targets.wheel]
|
|
38
|
+
packages = ["src/vx_toolkit"]
|
|
39
|
+
# _bin/ 里是 stage.py 复制的 C++ 二进制与 headers,必须强制进入 wheel
|
|
40
|
+
#(仓库 .gitignore 规则会让 hatchling 默认忽略它们)。
|
|
41
|
+
artifacts = ["src/vx_toolkit/_bin/**"]
|
|
42
|
+
include = ["src/vx_toolkit/_bin/**"]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// greet.cpp — @cppimp 示例实现(C++ 符号 greet,非 VX ABI)。
|
|
2
|
+
// vlnk 生成的 shim 调用本函数;字符串用静态缓冲返回以便 const char* 可用。
|
|
3
|
+
#include "greet.hpp"
|
|
4
|
+
|
|
5
|
+
#include <string>
|
|
6
|
+
|
|
7
|
+
const char* greet(const char* name) {
|
|
8
|
+
static std::string msg;
|
|
9
|
+
msg = std::string("Hello, ") + (name ? name : "") + "!";
|
|
10
|
+
return msg.c_str();
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* text 库实现 — 导出 VX ABI 符号:_vx_text_length / _vx_text_is_empty /
|
|
2
|
+
* _vx_text_shout。覆盖 string 入参、int/bool 返回与 void 返回三种形态。 */
|
|
3
|
+
#include <stdint.h>
|
|
4
|
+
#include <stdio.h>
|
|
5
|
+
#include <string.h>
|
|
6
|
+
|
|
7
|
+
int32_t _vx_text_length(const char *s) {
|
|
8
|
+
return s ? (int32_t)strlen(s) : 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
int32_t _vx_text_is_empty(const char *s) { return (s == NULL || *s == '\0'); }
|
|
12
|
+
|
|
13
|
+
void _vx_text_shout(const char *s) {
|
|
14
|
+
if (!s) return;
|
|
15
|
+
for (const char *p = s; *p; ++p) putchar(*p);
|
|
16
|
+
putchar('\n');
|
|
17
|
+
}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# VX 标准库(设计参考)
|
|
2
|
+
|
|
3
|
+
> **当前定位:前瞻设计稿,不可被当前工具链编译执行。**
|
|
4
|
+
>
|
|
5
|
+
> 本目录 v1.0 版本为早期 VM 执行路线设计(源码 → VM 字节码 → 虚拟机解释)。
|
|
6
|
+
> 工具链已转向原生路线(`vxc` → VXOBJ → `vlnk` → clang 链接为原生可执行),
|
|
7
|
+
> 原「VM 内建指令」前提整体作废,本文末尾的 VM 指令清单不再代表演进方向。
|
|
8
|
+
> 本目录保留作为标准库 API 设计参考,待编译器能力补齐后逐步原生化。
|
|
9
|
+
|
|
10
|
+
## 当前真实可用的能力
|
|
11
|
+
|
|
12
|
+
标准库的职能当前由两套机制承担:
|
|
13
|
+
|
|
14
|
+
| 机制 | 内容 | 位置 |
|
|
15
|
+
|------|------|------|
|
|
16
|
+
| 内置运行时(无需声明) | `out` / `out_int` / `out_bool` / `out_float` / `sys_argv_count` / `sys_argv_get` / `file_read` / `file_write` / `file_exists` / `puts` / `exit` / `malloc` / `free` | `src/runtime/vxrt.c` |
|
|
17
|
+
| 导入库(`@imp` / `@cppimp`) | math / text / fmath / collections/vec / cpp/greet / sys(`system(cmd)`)(VX ABI:`_vx_<lib>_<name>`) | `headers/` |
|
|
18
|
+
|
|
19
|
+
文件 I/O 与命令行参数等本目录中标记 `not implemented` 的能力,
|
|
20
|
+
在上述内置运行时中已有原生实现,可直接使用(见 README §2.1 / docs/SYNTAX.md §3.3)。
|
|
21
|
+
|
|
22
|
+
## 与编译器现状的差距(v1.12.0 实测)
|
|
23
|
+
|
|
24
|
+
47 个 `.vx` 文件中 36 个可被当前编译器解析,11 个失败,对照如下:
|
|
25
|
+
|
|
26
|
+
| 文件 | 依赖的不支持语法 |
|
|
27
|
+
|------|------------------|
|
|
28
|
+
| `error.vx`、`sys/coroutine.vx` | `enum` 声明 |
|
|
29
|
+
| `bytes.vx` | 泛型参数 `Vec<int>` |
|
|
30
|
+
| `reflect/mod.vx` | 类内常量字段(无类型注解赋值字段) |
|
|
31
|
+
| `macros.vx` | `macro` 声明 |
|
|
32
|
+
| `conv.vx` | 类型转换调用 `int(v)` |
|
|
33
|
+
| `char.vx` | 十六进制字面量 `0x4E00` |
|
|
34
|
+
| `collections/linked_list.vx` | 函数体内 `import` |
|
|
35
|
+
| `mem/arena.vx`、`mem/page.vx` | 空函数体(仅注释,无语句) |
|
|
36
|
+
| `tests/test_string_io.vx` | 字符串方法调用 `s.split(...)` |
|
|
37
|
+
|
|
38
|
+
> 可解析 ≠ 可执行:`import` 语法、全局状态、字符串方法等运行时支撑
|
|
39
|
+
> 同样未落地。`std/tests/` 从未接入 CTest,不代表有效回归覆盖。
|
|
40
|
+
|
|
41
|
+
## 编译器能力补齐后的演进路径
|
|
42
|
+
|
|
43
|
+
1. 解析缺口(上表)逐项支持后,std/ 源码先达到「全部可解析」;
|
|
44
|
+
2. `import` / 全局 `var`/`const` 代码生成落地后,std/ 以 `@imp` 或模块
|
|
45
|
+
编译单元形式接入工具链;
|
|
46
|
+
3. VM 前提的功能(协程、同步原语等)按原生语义重新设计或裁剪。
|
|
47
|
+
|
|
48
|
+
## 目录结构(设计稿)
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
std/
|
|
52
|
+
├── mod.vx # std 总入口
|
|
53
|
+
├── prelude.vx # 预导入模块
|
|
54
|
+
├── error.vx # 错误处理(零依赖)
|
|
55
|
+
├── macros.vx # 编译时宏工具(零依赖)
|
|
56
|
+
├── collections/ # 核心数据结构(vec / hashmap / linked_list / set)
|
|
57
|
+
├── string/ # 字符串处理(util / pattern / codec / iter / core)
|
|
58
|
+
├── math/ # 基础数学(math / random)
|
|
59
|
+
├── io/ # 输入输出与文件系统(file / stream / path / dir)
|
|
60
|
+
├── mem/ # 内存管理(allocator / arena / general / page)
|
|
61
|
+
├── sys/ # 系统与并发(time / duration / datetime / coroutine / sync / env)
|
|
62
|
+
├── iter.vx / option.vx / conv.vx / bytes.vx / char.vx / reflect/
|
|
63
|
+
└── tests/ # 设计期手写用例(未接入 CTest)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## 模块依赖关系(设计)
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
error (零依赖)
|
|
70
|
+
macros (零依赖)
|
|
71
|
+
↓
|
|
72
|
+
collections → error
|
|
73
|
+
↓
|
|
74
|
+
string → collections, error
|
|
75
|
+
↓
|
|
76
|
+
math → (弱依赖 collections)
|
|
77
|
+
↓
|
|
78
|
+
io → collections, string, error, sys
|
|
79
|
+
sys → collections, error
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## 语法约束(当前 VX 编译器限制)
|
|
83
|
+
|
|
84
|
+
v1.0 标准库基于设计期编译器能力编写:
|
|
85
|
+
|
|
86
|
+
- 使用 `class` 替代 `struct + impl`(VX 无 `impl` 块)
|
|
87
|
+
- 使用 `if/elif/else` 替代 `match` 表达式
|
|
88
|
+
- 使用函数返回值替代 `const` 常量
|
|
89
|
+
- 所有定义默认公开(VX 无 `pub` 关键字)
|
|
90
|
+
- 以 `var` 类型字段模拟泛型(`Option.value: var`)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# ============================================================
|
|
2
|
+
# std::bytes —— 字节缓冲区
|
|
3
|
+
# 为 VXOBJ 二进制生成提供基础支持
|
|
4
|
+
# 底层用 Vec<int> 存储 0..255
|
|
5
|
+
# ============================================================
|
|
6
|
+
|
|
7
|
+
import std.collections.vec
|
|
8
|
+
import std.error
|
|
9
|
+
|
|
10
|
+
class ByteBuffer:
|
|
11
|
+
data: Vec<int> # Vec<int>
|
|
12
|
+
|
|
13
|
+
func new() -> ByteBuffer:
|
|
14
|
+
b = new ByteBuffer()
|
|
15
|
+
b.data = new Vec<int>()
|
|
16
|
+
return b
|
|
17
|
+
|
|
18
|
+
# 写入单字节(0..255)
|
|
19
|
+
func write_u8(v: int):
|
|
20
|
+
self.data.push(v % 256)
|
|
21
|
+
|
|
22
|
+
# 大端写入 32 位无符号整数
|
|
23
|
+
func write_u32_be(v: int):
|
|
24
|
+
self.write_u8(v / 16777216 % 256)
|
|
25
|
+
self.write_u8(v / 65536 % 256)
|
|
26
|
+
self.write_u8(v / 256 % 256)
|
|
27
|
+
self.write_u8(v % 256)
|
|
28
|
+
|
|
29
|
+
# 写入原始字节数组
|
|
30
|
+
func write_bytes(arr: Vec<int>):
|
|
31
|
+
i = 0
|
|
32
|
+
while i < len(arr):
|
|
33
|
+
self.data.push(arr[i] % 256)
|
|
34
|
+
i = i + 1
|
|
35
|
+
|
|
36
|
+
# 将字符串按 UTF-8 字节写入(每个字符一个码点字节,仅适合 ASCII/字节串)
|
|
37
|
+
func write_str(s: str):
|
|
38
|
+
i: int = 0
|
|
39
|
+
while i < len(s):
|
|
40
|
+
self.data.push(ord(s[i]) % 256)
|
|
41
|
+
i = i + 1
|
|
42
|
+
|
|
43
|
+
# 返回原始字节数组
|
|
44
|
+
func to_vec() -> Vec<int>:
|
|
45
|
+
return self.data.to_array()
|
|
46
|
+
|
|
47
|
+
# 当前缓冲区大小
|
|
48
|
+
func size() -> int:
|
|
49
|
+
return self.data.size()
|
|
50
|
+
|
|
51
|
+
# 清空缓冲区
|
|
52
|
+
func clear():
|
|
53
|
+
self.data.clear()
|
|
54
|
+
|
|
55
|
+
# 写入另一个 ByteBuffer 的内容
|
|
56
|
+
func write_buffer(other: ByteBuffer):
|
|
57
|
+
bytes: Vec<int> = other.to_vec()
|
|
58
|
+
self.write_bytes(bytes)
|
|
59
|
+
|
|
60
|
+
# 生成 4 字节大端长度前缀 + 内容
|
|
61
|
+
func write_with_length_prefix() -> ByteBuffer:
|
|
62
|
+
result = new ByteBuffer()
|
|
63
|
+
result.write_u32_be(self.size())
|
|
64
|
+
result.write_buffer(self)
|
|
65
|
+
return result
|