codecin 6.0.1__tar.gz → 6.2.0__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.
- {codecin-6.0.1 → codecin-6.2.0}/CHANGELOG.md +102 -0
- {codecin-6.0.1/codecin.egg-info → codecin-6.2.0}/PKG-INFO +49 -1
- {codecin-6.0.1 → codecin-6.2.0}/README.md +48 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/__init__.py +1 -1
- {codecin-6.0.1 → codecin-6.2.0}/codecin/cin.py +189 -6
- {codecin-6.0.1 → codecin-6.2.0}/codecin/cli.py +5 -0
- codecin-6.2.0/codecin/cvm.py +590 -0
- codecin-6.2.0/codecin/mkn.py +834 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/version_gen.go +1 -1
- codecin-6.2.0/codecin/packaging/__init__.py +46 -0
- codecin-6.2.0/codecin/packaging/archive.py +177 -0
- codecin-6.2.0/codecin/packaging/model.py +519 -0
- codecin-6.2.0/codecin/packaging/store.py +372 -0
- codecin-6.2.0/codecin/packaging/toml.py +541 -0
- codecin-6.2.0/codecin/packaging/vcs.py +206 -0
- codecin-6.2.0/codecin/pic.py +1396 -0
- codecin-6.2.0/codecin/pic_api.py +371 -0
- codecin-6.2.0/codecin/pic_login.py +519 -0
- codecin-6.2.0/codecin/pic_registry.py +386 -0
- codecin-6.2.0/codecin/toolkit.py +26 -0
- {codecin-6.0.1 → codecin-6.2.0/codecin.egg-info}/PKG-INFO +49 -1
- {codecin-6.0.1 → codecin-6.2.0}/codecin.egg-info/SOURCES.txt +20 -0
- codecin-6.2.0/codecin.egg-info/entry_points.txt +5 -0
- {codecin-6.0.1 → codecin-6.2.0}/pyproject.toml +3 -0
- codecin-6.2.0/tests/test_v620_cvm.py +79 -0
- codecin-6.2.0/tests/test_v620_import.py +80 -0
- codecin-6.2.0/tests/test_v620_mkn.py +118 -0
- codecin-6.2.0/tests/test_v620_packaging.py +142 -0
- codecin-6.2.0/tests/test_v620_pic.py +113 -0
- codecin-6.2.0/tests/test_v620_pic_git.py +63 -0
- codecin-6.2.0/tests/test_v620_pic_registry.py +457 -0
- codecin-6.0.1/codecin.egg-info/entry_points.txt +0 -2
- {codecin-6.0.1 → codecin-6.2.0}/LICENSE +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/MANIFEST.in +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/aot.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/assembler.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/config.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/console.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/cpu.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/crom.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/disasm.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/environment.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/errors.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/isa.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/array.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/bigint.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/bits.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/bitset.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/codec.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/combin.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/conv.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/cppstd.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/cstd.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/csv.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/dp.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/ffi.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/fmt.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/frac.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/gostd.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/graph.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/gui.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/hash.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/heap.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/io.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/json.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/key.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/math.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/matrix.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/net.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/path.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/queue.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/rand.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/set.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/sort.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/stat.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/str.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/termux.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/test.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/text.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/time.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/token.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/tree.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/unionfind.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/validate.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/lib/vec.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/logger.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/memory.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/aot/aot.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/aot/stub_main.go.txt +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/build.ps1 +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/build.sh +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/compiler/codegen.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/compiler/compile_test.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/compiler/parser.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/compiler/syscalls.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/compiler/tokenizer.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/compiler/types.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/args.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/audio.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/audio_other.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/audio_test.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/audio_windows.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/canvas.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/console_other.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/console_windows.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/crom.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/encode.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/engine_test.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/ffi_nocgo.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/ffi_registry.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/ffi_unix.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/ffi_windows.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/gui.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/gui_stub.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/gui_test.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/gui_windows.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/gui_x11.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/host_test.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/hostcrypto.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/hostdesktop.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/hostnet.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/isa_gen.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/keyboard.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/keyboard_other.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/keyboard_stub.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/keyboard_termios_darwin.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/keyboard_termios_linux.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/keyboard_test.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/keyboard_windows.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/keyboard_windows_test.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/mem_other.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/mem_windows.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/native.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/netsock.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/ops_ext.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/stdin.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/stdin_other.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/stdin_windows.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/system.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/termux.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/engine/vm.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/go.mod +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/ir/ir.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native/main.go +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/native_codegen.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/object.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/optimizer.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/registers.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/stats.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/stdlib.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin/version.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin.egg-info/dependency_links.txt +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin.egg-info/requires.txt +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/codecin.egg-info/top_level.txt +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/examples/args_demo.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/examples/asm_constants.asm +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/examples/bitwise_builtins.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/examples/control_flow.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/examples/enum_range_for.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/examples/gui_demo.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/examples/literals_types.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/examples/local_audio.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/examples/modules_demo.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/examples/stdlib_demo.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/examples/system_interaction.cin +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/misc/vim/ftdetect/codecin.vim +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/misc/vim/syntax/cin.vim +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/misc/vim/syntax/codecinasm.vim +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/misc/vscode-cin/.vscodeignore +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/misc/vscode-cin/README.md +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/misc/vscode-cin/build.bat +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/misc/vscode-cin/language-configuration.json +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/misc/vscode-cin/package.json +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/misc/vscode-cin/snippets/cin.json +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/misc/vscode-cin/syntaxes/cin.tmLanguage.json +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/script/bump_version.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/script/check_paths.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/script/gen_isa_docs.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/script/gen_native_isa.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/setup.cfg +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/setup.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_aggregate_and_const.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_all_libs_together.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_aot.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_assembler_ext.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_bin_compat.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_cin_host.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_cin_host_ext.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_cin_new_features.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_cin_syntax.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_cin_syntax_ext.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_cin_system.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_cli.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_compiler_errors.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_environment.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_examples.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_features_ab.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_features_import.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_features_importloc.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_ffi_net.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_gui.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_index_subscript_type.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_isa_single_source.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_issue_regress.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_keyboard.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_lib_bigint.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_lib_bitset.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_lib_codec.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_lib_combin.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_lib_compat.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_lib_csv.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_lib_dp.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_lib_fmt.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_lib_frac.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_lib_graph.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_lib_heap.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_lib_path.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_lib_set.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_lib_text.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_lib_token.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_lib_tree.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_lib_unionfind.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_libs.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_libs_ext.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_literals_and_bom.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_native_codegen.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_native_hardening.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_native_lib_lookup.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_nested_subscript_codegen.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_no_go_cli.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_object_link.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_p0_fixes.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_packaging.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_paths_consistency.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_sparse_memory.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_struct_value_semantics.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_switch_semantics.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_version.py +0 -0
- {codecin-6.0.1 → codecin-6.2.0}/tests/test_workflows.py +0 -0
|
@@ -5,6 +5,108 @@
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [6.2.0] - 2026-10-23
|
|
9
|
+
|
|
10
|
+
一次以「工具链生态」为主题的发布:新增 **mkn**(Maven 风格构建)、**pic**
|
|
11
|
+
(pip 风格包管理,package.codecin.org.cn 中央注册/分发 + Cdifit 浏览器登录)
|
|
12
|
+
与 **cvm**(JVM 风格虚拟机/模块运行时),三者共享清单、依赖解析与可复现归档格式;
|
|
13
|
+
CIN 语言与 UCBC 指令集不变。
|
|
14
|
+
|
|
15
|
+
### 新增 (Added)
|
|
16
|
+
|
|
17
|
+
#### mkn:项目构建与依赖 (Maven 风格)
|
|
18
|
+
|
|
19
|
+
- 新增 `codecin/mkn.py` 与 `mkn` 命令:`new` / `init` / `build`(=`compile`) /
|
|
20
|
+
`run` / `test` / `package` / `install` / `deploy` / `add` / `tree` /
|
|
21
|
+
`verify` / `clean` 完整生命周期。
|
|
22
|
+
- `mkn.toml`(`[project]` / `[build]` / `[dependencies]`):标准目录
|
|
23
|
+
`src/main.cin`、`src/test/**`、`target/`;依赖支持版本约束、Git 仓库与本地路径。
|
|
24
|
+
- 依赖统一解析到项目 `pic_modules/`(`mkn` 复用 `pic` 的安装实现),并写入
|
|
25
|
+
`pic.lock`;本地仓库为 `$MKN_HOME/repository/<name>/<version>`。
|
|
26
|
+
- 自动区分应用/库:入口及 import 闭包中没有 `function main` 时,`mkn build`
|
|
27
|
+
产出可重定位 `.co` 对象而不是误报缺少 `main`。
|
|
28
|
+
- `mkn package` 生成确定性 `.mkn` 归档(含自动生成的 `pic.toml`、源码、
|
|
29
|
+
`target/*.bin|.co` 与 `META-INF/SHA256SUMS`)。
|
|
30
|
+
|
|
31
|
+
#### pic:中央注册/分发 + 浏览器登录 (pip 风格)
|
|
32
|
+
|
|
33
|
+
- 新增 `codecin/pic.py`、`codecin/pic_api.py`、`codecin/pic_login.py`、
|
|
34
|
+
`codecin/pic_registry.py` 与 `pic` 命令:`login` / `logout` / `whoami` /
|
|
35
|
+
`init` / `build` / `publish` / `install` / `uninstall` / `list` / `show` /
|
|
36
|
+
`freeze` / `search` / `registry` / `doctor`。
|
|
37
|
+
- **独立中央服务器 `package.codecin.org.cn`**:新增 `registry/` Go 服务,
|
|
38
|
+
提供包记录、版本列表、`.cinpkg` 制品上传/下载、yank、搜索与健康检查;
|
|
39
|
+
Cdifit (`https://www.cdifit.cn`) 仅用于登录/Token 校验,不再存储包数据。
|
|
40
|
+
- **首次使用登录**:`pic login` 在 `127.0.0.1` 随机端口启动临时 Web 服务并
|
|
41
|
+
打开浏览器;登录页使用相对布局(flex + `min(92vw, 26rem)`,无绝对定位),
|
|
42
|
+
支持密码与 2FA;令牌写入 `$PIC_HOME/auth.json` (0600),服务随后关闭。
|
|
43
|
+
无 `auth.json` 时首次运行任意 `pic` 命令会自动进入登录流程;`PIC_OFFLINE=1`
|
|
44
|
+
可离线绕过。
|
|
45
|
+
- **登录安全**:只绑定 loopback;同源 `Origin` + 随机 CSRF 校验;
|
|
46
|
+
`Cache-Control: no-store` / `X-Frame-Options: DENY`;密码不落盘、不写日志。
|
|
47
|
+
- **发布**:`pic publish --repo <git-url> --name <name>` 校验清单、生成
|
|
48
|
+
`.cinpkg`、创建 `v<version>` 标签,向中央服务器提交元数据并上传制品;
|
|
49
|
+
`--push` 推送标签,`--no-tag` 改用 Git 提交记录。
|
|
50
|
+
- **按名称安装**:从中央记录选版本 → 优先下载 `.cinpkg` 并校验 SHA-256,
|
|
51
|
+
否则回退 Git 拉取 → 重算源码/清单摘要与 `rev` 校验;任一不匹配则删除并拒绝。
|
|
52
|
+
仍然支持 `name@version`、`git+URL@ref`、本地路径、`.cinpkg`、`--project`
|
|
53
|
+
与 `-e/--editable`。
|
|
54
|
+
- **详细输出**:`pic publish` 输出 8 步(认证/清单/Git/构建/标签/本地缓存/
|
|
55
|
+
中央注册/完成),`pic install` 输出解析/锁定/路径/来源/提交/入口/import 提示;
|
|
56
|
+
`search`/`registry list` 显示服务器与结果数。
|
|
57
|
+
- **本地回退**:`PIC_OFFLINE=1` 或 `config.toml` 的 `offline=true` 时使用
|
|
58
|
+
`registry.json` 本地注册表;`pic registry add/remove` 保留为本地回退。
|
|
59
|
+
- 安装存储 `$PIC_HOME`(默认 `~/.pic`):`auth.json`、`config.toml`、
|
|
60
|
+
带自愈能力的 `index.json`、`packages/<name>/<version>/`、`cache/git/` 与
|
|
61
|
+
`cache/artifacts/`;归档安装前校验 `META-INF/SHA256SUMS`,解包拒绝绝对路径、
|
|
62
|
+
盘符、`..` 与符号链接。
|
|
63
|
+
|
|
64
|
+
#### CVM:虚拟机与 `.cvm` 模块 (JVM 风格)
|
|
65
|
+
|
|
66
|
+
- 新增 `codecin/cvm.py` 与 `cvm` 命令:`build` / `run` / `inspect` /
|
|
67
|
+
`verify` / `install` / `which` / `list` / `env`;对外运行时概念为 **CVM**,
|
|
68
|
+
`CPU` 仅保留为内部执行核。
|
|
69
|
+
- `.cvm` 模块(zip):`CVM-INF/MANIFEST.TOML` + `code/program.bin` (BIN v3) +
|
|
70
|
+
`META-INF/SHA256SUMS`;清单记录格式版本、引擎、ABI、模块名/版本与构建信息。
|
|
71
|
+
- 模块路径类似 `CLASSPATH`:`CVM_MODULE_PATH` + `$CVM_HOME/modules`;
|
|
72
|
+
`cvm install` / `which` 支持按名称解析模块。
|
|
73
|
+
- 支持从 `.cin/.asm/.pl/.bin` 或含 `mkn.toml` 的项目构建模块;校验和/字节码
|
|
74
|
+
magic 任一不匹配都会在装载阶段失败。
|
|
75
|
+
|
|
76
|
+
#### 包导入与共享基础设施
|
|
77
|
+
|
|
78
|
+
- CIN `import` 新增包解析:`import "hello"` 导入包入口,
|
|
79
|
+
`import "hello/util.cin"` 导入包内文件;搜索顺序为
|
|
80
|
+
相对路径 → 内置标准库 → 项目 `pic_modules/`/`.mkn/deps`/`.pic/packages` →
|
|
81
|
+
`CIN_PATH` → 全局 `$PIC_HOME/packages/<name>/<current>`。
|
|
82
|
+
- 新增 `codecin/packaging/`:零依赖 TOML 读写(兼容 Python 3.8)、清单与语义化
|
|
83
|
+
版本约束、包存储、Git 封装、确定性 zip/安全解包/校验和。
|
|
84
|
+
- 新增 `codecin/toolkit.py`:工具 CLI 的 UTF-8 标准输出初始化。
|
|
85
|
+
- 新增 console scripts:`mkn = codecin.mkn:main`、`pic = codecin.pic:main`、
|
|
86
|
+
`cvm = codecin.cvm:main`;`codecin --help` 增加工具链提示。
|
|
87
|
+
|
|
88
|
+
### 变更 (Changed)
|
|
89
|
+
|
|
90
|
+
- 版本号提升至 **6.2.0**(`codecin/__init__.py` 单一真源,
|
|
91
|
+
`codecin/native/engine/version_gen.go` 同步)。
|
|
92
|
+
- 裸名字 import 仍**优先命中内置标准库**(如 `import "math.cin"`),避免既有程序
|
|
93
|
+
被同名第三方包劫持;第三方包推荐使用无 `.cin` 后缀的包名形式。
|
|
94
|
+
- `pic` 首次运行(除 `login`/`logout`/`doctor`)要求登录 Cdifit;无 `auth.json`
|
|
95
|
+
时自动打开临时本地登录页。离线开发/CI 使用 `PIC_OFFLINE=1` 或
|
|
96
|
+
`pic --offline ...` 保持旧行为;`mkn` 按名称解析依赖同样走该登录。
|
|
97
|
+
- `mkn`/`pic`/`cvm` 的错误统一为 `prog: error: ...` 并返回退出码 1,不打印
|
|
98
|
+
Python traceback;`--help`/`--version` 退出码 0。
|
|
99
|
+
|
|
100
|
+
### 兼容性
|
|
101
|
+
|
|
102
|
+
- 现有 `codecin <program>` 参数、`.cin/.pl/.asm/.bin/.crom/.co/.colib` 格式、
|
|
103
|
+
ABI v2、BIN v3、CROM v4 全部不变;`tests/test_features_import.py` 的原有用例
|
|
104
|
+
保持通过。
|
|
105
|
+
- 原生库版本自报仍为旧值时不影响执行;`codecin --build-info` 会提示不一致,
|
|
106
|
+
重建原生库后即可一致。
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
8
110
|
## [6.0.1] - 2026-10-18
|
|
9
111
|
|
|
10
112
|
### 修复 (Fixed)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codecin
|
|
3
|
-
Version: 6.0
|
|
3
|
+
Version: 6.2.0
|
|
4
4
|
Summary: Code CIN - 高级语言与运行时 (CIN/PL/ASM 工具链 + Go 原生 VM + ARM64/RISC-V/FP/Vector 指令集)
|
|
5
5
|
Author: ByUsi Studio, 北啊呢
|
|
6
6
|
License-Expression: MIT
|
|
@@ -34,6 +34,54 @@ Code CIN 是一门简洁的类 C 高级语言及其跨平台运行时(VM)。
|
|
|
34
34
|
|
|
35
35
|
模块化包结构(`codecin/`,Go 侧 `codecin/native/`),全线日志与错误输出基于 **rich**(彩色表格、面板、traceback),`--debug` / `--log-level DEBUG` 提供超详细诊断。
|
|
36
36
|
|
|
37
|
+
## v6.2.0 工具链:mkn / pic / cvm
|
|
38
|
+
|
|
39
|
+
v6.2.0 在 `codecin` 之外提供三个独立命令,覆盖**构建 → 分发 → 运行**:
|
|
40
|
+
|
|
41
|
+
| 命令 | 类比 | 作用 |
|
|
42
|
+
|------|------|------|
|
|
43
|
+
| `mkn` | Maven | 项目清单、标准目录、生命周期、依赖解析、打包与本地仓库 |
|
|
44
|
+
| `pic` | pip | `package.codecin.org.cn` 中央注册/分发 + Cdifit 登录:发布登记标识名/Git 地址/版本列表/安全摘要并上传 `.cinpkg`,安装后可直接 `import` |
|
|
45
|
+
| `cvm` | JVM | Code CIN 虚拟机:构建/校验/运行 `.cvm` 模块,支持模块路径;`CPU` 仅作为内部执行核 |
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# 项目构建
|
|
49
|
+
mkn new demo && cd demo
|
|
50
|
+
mkn build
|
|
51
|
+
mkn run
|
|
52
|
+
mkn test
|
|
53
|
+
mkn package # target/demo-0.1.0.mkn
|
|
54
|
+
|
|
55
|
+
# 包管理 (首次使用会打开临时本地网页登录 Cdifit)
|
|
56
|
+
pic login
|
|
57
|
+
pic init hello
|
|
58
|
+
pic publish --repo https://github.com/you/cin-hello --name hello
|
|
59
|
+
pic install hello@^1.0 # 或 git+https://...、本地路径、.cinpkg
|
|
60
|
+
pic install hello --project # 安装到项目 pic_modules/,可直接 import
|
|
61
|
+
pic whoami
|
|
62
|
+
pic logout
|
|
63
|
+
|
|
64
|
+
# 虚拟机
|
|
65
|
+
cvm build src/main.cin -o app.cvm
|
|
66
|
+
cvm verify app.cvm
|
|
67
|
+
cvm run app.cvm -- arg1 arg2
|
|
68
|
+
cvm env
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`pic` 的中央注册/分发服务器是 **`package.codecin.org.cn`**(元数据、
|
|
72
|
+
`.cinpkg` 制品、版本/安全摘要);**Cdifit (`https://www.cdifit.cn`) 只负责
|
|
73
|
+
登录和 Token 校验**。服务端实现见 [registry/README.md](registry/README.md),
|
|
74
|
+
客户端可用 `PIC_REGISTRY_URL` 覆盖服务器地址。
|
|
75
|
+
|
|
76
|
+
安装后的包无需修改源码即可导入:
|
|
77
|
+
|
|
78
|
+
```cin
|
|
79
|
+
import "hello" // 包入口 (pic.toml 的 entry)
|
|
80
|
+
import "hello/util.cin" // 包内文件
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
完整设计、格式与验收标准见 [V6.2.0-PLAN.md](V6.2.0-PLAN.md)。
|
|
84
|
+
|
|
37
85
|
## 文档
|
|
38
86
|
|
|
39
87
|
**官方文档站**位于独立仓库
|
|
@@ -16,6 +16,54 @@ Code CIN 是一门简洁的类 C 高级语言及其跨平台运行时(VM)。
|
|
|
16
16
|
|
|
17
17
|
模块化包结构(`codecin/`,Go 侧 `codecin/native/`),全线日志与错误输出基于 **rich**(彩色表格、面板、traceback),`--debug` / `--log-level DEBUG` 提供超详细诊断。
|
|
18
18
|
|
|
19
|
+
## v6.2.0 工具链:mkn / pic / cvm
|
|
20
|
+
|
|
21
|
+
v6.2.0 在 `codecin` 之外提供三个独立命令,覆盖**构建 → 分发 → 运行**:
|
|
22
|
+
|
|
23
|
+
| 命令 | 类比 | 作用 |
|
|
24
|
+
|------|------|------|
|
|
25
|
+
| `mkn` | Maven | 项目清单、标准目录、生命周期、依赖解析、打包与本地仓库 |
|
|
26
|
+
| `pic` | pip | `package.codecin.org.cn` 中央注册/分发 + Cdifit 登录:发布登记标识名/Git 地址/版本列表/安全摘要并上传 `.cinpkg`,安装后可直接 `import` |
|
|
27
|
+
| `cvm` | JVM | Code CIN 虚拟机:构建/校验/运行 `.cvm` 模块,支持模块路径;`CPU` 仅作为内部执行核 |
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# 项目构建
|
|
31
|
+
mkn new demo && cd demo
|
|
32
|
+
mkn build
|
|
33
|
+
mkn run
|
|
34
|
+
mkn test
|
|
35
|
+
mkn package # target/demo-0.1.0.mkn
|
|
36
|
+
|
|
37
|
+
# 包管理 (首次使用会打开临时本地网页登录 Cdifit)
|
|
38
|
+
pic login
|
|
39
|
+
pic init hello
|
|
40
|
+
pic publish --repo https://github.com/you/cin-hello --name hello
|
|
41
|
+
pic install hello@^1.0 # 或 git+https://...、本地路径、.cinpkg
|
|
42
|
+
pic install hello --project # 安装到项目 pic_modules/,可直接 import
|
|
43
|
+
pic whoami
|
|
44
|
+
pic logout
|
|
45
|
+
|
|
46
|
+
# 虚拟机
|
|
47
|
+
cvm build src/main.cin -o app.cvm
|
|
48
|
+
cvm verify app.cvm
|
|
49
|
+
cvm run app.cvm -- arg1 arg2
|
|
50
|
+
cvm env
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
`pic` 的中央注册/分发服务器是 **`package.codecin.org.cn`**(元数据、
|
|
54
|
+
`.cinpkg` 制品、版本/安全摘要);**Cdifit (`https://www.cdifit.cn`) 只负责
|
|
55
|
+
登录和 Token 校验**。服务端实现见 [registry/README.md](registry/README.md),
|
|
56
|
+
客户端可用 `PIC_REGISTRY_URL` 覆盖服务器地址。
|
|
57
|
+
|
|
58
|
+
安装后的包无需修改源码即可导入:
|
|
59
|
+
|
|
60
|
+
```cin
|
|
61
|
+
import "hello" // 包入口 (pic.toml 的 entry)
|
|
62
|
+
import "hello/util.cin" // 包内文件
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
完整设计、格式与验收标准见 [V6.2.0-PLAN.md](V6.2.0-PLAN.md)。
|
|
66
|
+
|
|
19
67
|
## 文档
|
|
20
68
|
|
|
21
69
|
**官方文档站**位于独立仓库
|
|
@@ -590,7 +590,9 @@ def tokenize(source: str,
|
|
|
590
590
|
# ==================== import 预处理 (B3) ====================
|
|
591
591
|
# import "path.cin" 仅在文件顶部/列首识别。解析规则:
|
|
592
592
|
# * "./x.cin" / "../x.cin" -> 相对当前 .cin 文件所在目录;
|
|
593
|
-
# * 其余形式 -> codecin
|
|
593
|
+
# * 其余形式 -> 依次查找 codecin 内置标准库、项目依赖目录、
|
|
594
|
+
# CIN_PATH、已安装的 pic 包;
|
|
595
|
+
# * 包名 (无 .cin 后缀) 直接 import 该包的入口 (v6.2.0)。
|
|
594
596
|
# 同一文件每个编译仅包含一次, 循环引用报错。
|
|
595
597
|
|
|
596
598
|
_IMPORT_RE = re.compile(r'^import\s+["\']([^"\']+)["\']\s*;?\s*$')
|
|
@@ -603,19 +605,193 @@ _LIB_DIR = os.path.join(_CODECIN_ROOT, 'lib')
|
|
|
603
605
|
#: 相对引用的前缀: 必须以 "." 开头
|
|
604
606
|
_RELATIVE_PREFIXES = ('./', '../', '.\\', '..\\')
|
|
605
607
|
|
|
608
|
+
#: 项目内依赖目录 (按优先级): mkn / pic --project / 旧式隐藏目录
|
|
609
|
+
_PROJECT_DEP_DIRS = ('pic_modules', os.path.join('.mkn', 'deps'),
|
|
610
|
+
os.path.join('.pic', 'packages'))
|
|
611
|
+
|
|
612
|
+
#: 包名合法性 (与 packaging.model 保持一致, 这里不 import 以避免启动开销)
|
|
613
|
+
_PKG_NAME_RE = re.compile(r'^[A-Za-z][A-Za-z0-9_-]{0,63}$')
|
|
614
|
+
|
|
606
615
|
|
|
607
616
|
def _is_relative_import(name: str) -> bool:
|
|
608
617
|
"""``import "./x.cin"`` / ``import "../x.cin"`` 视为相对引用。"""
|
|
609
618
|
return name.startswith(_RELATIVE_PREFIXES)
|
|
610
619
|
|
|
611
620
|
|
|
621
|
+
def _cin_path_dirs() -> List[str]:
|
|
622
|
+
"""``CIN_PATH`` 环境变量中的 import 搜索目录 (``os.pathsep`` 分隔)。"""
|
|
623
|
+
raw = os.environ.get('CIN_PATH', '')
|
|
624
|
+
return [os.path.abspath(p) for p in raw.split(os.pathsep) if p.strip()]
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
def _project_roots(source_dir: str) -> List[str]:
|
|
628
|
+
"""从源文件目录向上收集包含 mkn.toml / pic.toml 的项目根 (近到远)。"""
|
|
629
|
+
roots: List[str] = []
|
|
630
|
+
path = os.path.abspath(source_dir)
|
|
631
|
+
while True:
|
|
632
|
+
if (os.path.isfile(os.path.join(path, 'mkn.toml'))
|
|
633
|
+
or os.path.isfile(os.path.join(path, 'pic.toml'))):
|
|
634
|
+
roots.append(path)
|
|
635
|
+
parent = os.path.dirname(path)
|
|
636
|
+
if parent == path:
|
|
637
|
+
break
|
|
638
|
+
path = parent
|
|
639
|
+
return roots
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
def _package_roots(source_dir: str) -> List[str]:
|
|
643
|
+
"""候选包根目录 (按优先级): 项目依赖 -> CIN_PATH -> 全局 pic 存储。"""
|
|
644
|
+
roots: List[str] = []
|
|
645
|
+
for project in _project_roots(source_dir):
|
|
646
|
+
for rel in _PROJECT_DEP_DIRS:
|
|
647
|
+
candidate = os.path.join(project, rel)
|
|
648
|
+
if os.path.isdir(candidate):
|
|
649
|
+
roots.append(candidate)
|
|
650
|
+
roots.extend(_cin_path_dirs())
|
|
651
|
+
|
|
652
|
+
home = os.environ.get('PIC_HOME') or os.path.join(
|
|
653
|
+
os.path.expanduser('~'), '.pic')
|
|
654
|
+
packages = os.path.join(home, 'packages')
|
|
655
|
+
if os.path.isdir(packages):
|
|
656
|
+
# 全局存储是 <name>/<version>/; 具体版本由解析器按 current 选择
|
|
657
|
+
roots.append(packages)
|
|
658
|
+
return roots
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
def _entry_from_package(pkg_dir: str, pkg: str,
|
|
662
|
+
hinted_file: Optional[str] = None) -> Optional[str]:
|
|
663
|
+
"""在包目录中解析入口文件: pic.toml 的 entry 优先, 再按约定回退。"""
|
|
664
|
+
base = pkg_dir
|
|
665
|
+
link = os.path.join(base, '.pic-link')
|
|
666
|
+
if os.path.isfile(link):
|
|
667
|
+
try:
|
|
668
|
+
with open(link, encoding='utf-8') as f:
|
|
669
|
+
target = f.read().strip()
|
|
670
|
+
if target:
|
|
671
|
+
base = os.path.abspath(target)
|
|
672
|
+
except OSError:
|
|
673
|
+
pass
|
|
674
|
+
if not os.path.isdir(base):
|
|
675
|
+
return None
|
|
676
|
+
|
|
677
|
+
if hinted_file:
|
|
678
|
+
for rel in (hinted_file, os.path.join('src', hinted_file)):
|
|
679
|
+
candidate = os.path.normpath(os.path.join(base, rel))
|
|
680
|
+
if os.path.isfile(candidate):
|
|
681
|
+
return candidate
|
|
682
|
+
|
|
683
|
+
manifest = os.path.join(base, 'pic.toml')
|
|
684
|
+
if os.path.isfile(manifest):
|
|
685
|
+
try:
|
|
686
|
+
from .packaging.model import load_package_manifest
|
|
687
|
+
meta = load_package_manifest(base, require_entry=False)
|
|
688
|
+
if meta.entry_path:
|
|
689
|
+
return meta.entry_path
|
|
690
|
+
except Exception:
|
|
691
|
+
# 清单损坏不应让 import 变成不可诊断的异常:
|
|
692
|
+
# 继续按目录约定查找, 最终在找不到时给出统一错误
|
|
693
|
+
pass
|
|
694
|
+
|
|
695
|
+
mkn_manifest = os.path.join(base, 'mkn.toml')
|
|
696
|
+
if os.path.isfile(mkn_manifest):
|
|
697
|
+
try:
|
|
698
|
+
from .packaging.model import load_mkn_manifest
|
|
699
|
+
project = load_mkn_manifest(base)
|
|
700
|
+
entry = project.entry_path
|
|
701
|
+
if entry:
|
|
702
|
+
return entry
|
|
703
|
+
except Exception:
|
|
704
|
+
pass
|
|
705
|
+
|
|
706
|
+
for rel in (os.path.join('src', f'{pkg}.cin'), f'{pkg}.cin',
|
|
707
|
+
os.path.join('src', 'main.cin'), 'main.cin'):
|
|
708
|
+
candidate = os.path.normpath(os.path.join(base, rel))
|
|
709
|
+
if os.path.isfile(candidate):
|
|
710
|
+
return candidate
|
|
711
|
+
return None
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
def _version_dirs(pkg_dir: str, root: str) -> List[str]:
|
|
715
|
+
"""全局存储 ``<name>/<version>`` 下的版本目录 (current 优先)。"""
|
|
716
|
+
try:
|
|
717
|
+
versions = [
|
|
718
|
+
v for v in os.listdir(pkg_dir)
|
|
719
|
+
if os.path.isdir(os.path.join(pkg_dir, v))
|
|
720
|
+
and re.fullmatch(r'\d+\.\d+\.\d+(?:[-+].*)?', v)
|
|
721
|
+
]
|
|
722
|
+
except OSError:
|
|
723
|
+
return []
|
|
724
|
+
current = None
|
|
725
|
+
if os.path.basename(root) == 'packages':
|
|
726
|
+
index_path = os.path.join(os.path.dirname(root), 'index.json')
|
|
727
|
+
try:
|
|
728
|
+
import json
|
|
729
|
+
with open(index_path, encoding='utf-8') as f:
|
|
730
|
+
index = json.load(f)
|
|
731
|
+
record = (index.get('packages') or {}).get(
|
|
732
|
+
os.path.basename(pkg_dir)) or {}
|
|
733
|
+
current = record.get('current')
|
|
734
|
+
except (OSError, ValueError, TypeError):
|
|
735
|
+
current = None
|
|
736
|
+
versions.sort(reverse=True)
|
|
737
|
+
if current in versions:
|
|
738
|
+
versions.remove(current)
|
|
739
|
+
versions.insert(0, current)
|
|
740
|
+
return [os.path.join(pkg_dir, v) for v in versions]
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
def _resolve_package_import(name: str,
|
|
744
|
+
source_dir: str) -> Optional[str]:
|
|
745
|
+
"""按包名解析 import; 找不到返回 None。"""
|
|
746
|
+
normalized = name.replace('\\', '/')
|
|
747
|
+
parts = [p for p in normalized.split('/') if p]
|
|
748
|
+
if not parts:
|
|
749
|
+
return None
|
|
750
|
+
|
|
751
|
+
pkg = parts[0]
|
|
752
|
+
hinted: Optional[str] = None
|
|
753
|
+
if len(parts) == 1 and pkg.endswith('.cin'):
|
|
754
|
+
# `import "hello.cin"` 也允许命中名为 hello 的包
|
|
755
|
+
pkg = pkg[:-4]
|
|
756
|
+
hinted = parts[0]
|
|
757
|
+
if not _PKG_NAME_RE.match(pkg):
|
|
758
|
+
return None
|
|
759
|
+
sub = '/'.join(parts[1:]) if len(parts) > 1 else ''
|
|
760
|
+
|
|
761
|
+
for root in _package_roots(source_dir):
|
|
762
|
+
pkg_dir = os.path.join(root, pkg)
|
|
763
|
+
if not os.path.isdir(pkg_dir):
|
|
764
|
+
continue
|
|
765
|
+
version_dirs = _version_dirs(pkg_dir, root)
|
|
766
|
+
if sub:
|
|
767
|
+
for base in [pkg_dir, os.path.join(pkg_dir, 'src'),
|
|
768
|
+
*(os.path.join(v, 'src') for v in version_dirs),
|
|
769
|
+
*version_dirs]:
|
|
770
|
+
candidate = os.path.normpath(
|
|
771
|
+
os.path.join(base, *sub.split('/')))
|
|
772
|
+
if os.path.isfile(candidate):
|
|
773
|
+
return candidate
|
|
774
|
+
continue
|
|
775
|
+
entry = _entry_from_package(pkg_dir, pkg, hinted)
|
|
776
|
+
if entry:
|
|
777
|
+
return entry
|
|
778
|
+
for version_dir in version_dirs:
|
|
779
|
+
entry = _entry_from_package(version_dir, pkg, hinted)
|
|
780
|
+
if entry:
|
|
781
|
+
return entry
|
|
782
|
+
return None
|
|
783
|
+
|
|
784
|
+
|
|
612
785
|
def _resolve_import(name: str, source_dir: str) -> str:
|
|
613
786
|
"""解析 import 目标路径。
|
|
614
787
|
|
|
615
|
-
规则 (B3):
|
|
788
|
+
规则 (B3 + v6.2.0 包导入):
|
|
616
789
|
* ``import "./x.cin"`` / ``import "../x.cin"`` —— 相对**当前 .cin 文件**所在目录;
|
|
617
|
-
*
|
|
618
|
-
|
|
790
|
+
* 其余形式先查 **codecin 内置标准库** ``codecin/lib/`` (``lib/`` 前缀保留
|
|
791
|
+
为兼容写法), 保持 "裸名字不会命中兄弟文件" 的既有语义;
|
|
792
|
+
* 再查项目依赖目录 (``pic_modules`` / ``.mkn/deps`` / ``.pic/packages``)、
|
|
793
|
+
``CIN_PATH`` 与全局 pic 包存储; ``import "hello"`` 直接导入包入口,
|
|
794
|
+
``import "hello/util.cin"`` 导入包内文件。
|
|
619
795
|
"""
|
|
620
796
|
if _is_relative_import(name):
|
|
621
797
|
cand = os.path.normpath(os.path.join(source_dir, name))
|
|
@@ -630,9 +806,16 @@ def _resolve_import(name: str, source_dir: str) -> str:
|
|
|
630
806
|
for cand in candidates:
|
|
631
807
|
if os.path.isfile(cand):
|
|
632
808
|
return cand
|
|
809
|
+
|
|
810
|
+
package = _resolve_package_import(name, source_dir)
|
|
811
|
+
if package:
|
|
812
|
+
return package
|
|
813
|
+
|
|
633
814
|
raise CompilerError(
|
|
634
|
-
f"Import file not found: {name!r} (
|
|
635
|
-
f"{os.path.join(_LIB_DIR, name)}
|
|
815
|
+
f"Import file not found: {name!r} (内置标准库已查找 "
|
|
816
|
+
f"{os.path.join(_LIB_DIR, name)}; 也未在项目 pic_modules/"
|
|
817
|
+
f"CIN_PATH/已安装 pic 包中找到)。"
|
|
818
|
+
f"如需导入第三方包, 先运行 `pic install <name>`。")
|
|
636
819
|
|
|
637
820
|
|
|
638
821
|
def _collect_module_lines(path: str, loaded: set, active: set,
|
|
@@ -28,6 +28,11 @@ HELP_INTRO = f"""{Colors.colorize(f'Code CIN v{__version__}', Colors.CYAN, True)
|
|
|
28
28
|
.pl Code CIN 汇编语言 (PL 关键字风格)
|
|
29
29
|
.asm Code CIN 汇编
|
|
30
30
|
.bin UCBC 字节码 (由 --compile 生成)
|
|
31
|
+
|
|
32
|
+
{Colors.colorize('Toolchain (v6.2.0):', Colors.YELLOW)}
|
|
33
|
+
mkn 项目构建/依赖 (Maven 风格)
|
|
34
|
+
pic 去中心化包管理 (pip 风格, 安装后可直接 import)
|
|
35
|
+
cvm CVM 虚拟机/模块运行时 (JVM 风格)
|
|
31
36
|
"""
|
|
32
37
|
|
|
33
38
|
|