├── .devcontainer ├── Dockerfile ├── devcontainer.json └── setup.sh ├── .github ├── CODEOWNERS ├── dependabot.yml ├── logo.svg ├── logo_wide.svg └── workflows │ └── all.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── LICENSE.txt ├── README.md ├── SECURITY.md ├── build.bat ├── build.sh ├── changelog ├── 0.1.10.md ├── 0.1.11.md ├── 0.1.12.md ├── 0.1.13.md ├── 0.1.2.md ├── 0.1.3.md ├── 0.1.4.md ├── 0.1.5.md ├── 0.1.6.md ├── 0.1.7.md ├── 0.1.8.md ├── 0.1.9.md ├── 0.2.0.md ├── 0.2.1.md ├── 0.2.2.md ├── 0.2.3.md ├── 0.3.0.md ├── 0.3.1.md ├── 0.3.2.md ├── 0.3.3.md ├── 0.3.4.md ├── 0.3.5.md ├── 0.4.0.md ├── 0.4.1.md ├── 0.5.0.md ├── 0.5.1.md ├── 0.5.2.md ├── 0.6.0.md ├── 0.6.1.md ├── 0.6.10.md ├── 0.6.11.md ├── 0.6.12.md ├── 0.6.13.md ├── 0.6.14.md ├── 0.6.15.md ├── 0.6.16.md ├── 0.6.17.md ├── 0.6.18.md ├── 0.6.19.md ├── 0.6.2.md ├── 0.6.20.md ├── 0.6.21.md ├── 0.6.22.md ├── 0.6.23.md ├── 0.6.24.md ├── 0.6.25.md ├── 0.6.26.md ├── 0.6.27.md ├── 0.6.28.md ├── 0.6.29.md ├── 0.6.3.md ├── 0.6.30.md ├── 0.6.31.md ├── 0.6.32.md ├── 0.6.33.md ├── 0.6.34.md ├── 0.6.35.md ├── 0.6.36.md ├── 0.6.37.md ├── 0.6.4.md ├── 0.6.5.md ├── 0.6.6.md ├── 0.6.7.md ├── 0.6.8.md ├── 0.6.9.md ├── 0.7.0.md ├── 0.7.1.md ├── 0.7.10.md ├── 0.7.11.md ├── 0.7.12.md ├── 0.7.13.md ├── 0.7.14.md ├── 0.7.15.md ├── 0.7.16.md ├── 0.7.17.md ├── 0.7.18.md ├── 0.7.19.md ├── 0.7.2.md ├── 0.7.20.md ├── 0.7.21.md ├── 0.7.22.md ├── 0.7.23.md ├── 0.7.24.md ├── 0.7.25.md ├── 0.7.26.md ├── 0.7.27.md ├── 0.7.28.md ├── 0.7.29.md ├── 0.7.3.md ├── 0.7.30.md ├── 0.7.31.md ├── 0.7.32.md ├── 0.7.4.md ├── 0.7.5.md ├── 0.7.6.md ├── 0.7.7.md ├── 0.7.8.md ├── 0.7.9.md ├── 0.8.0.md ├── 0.8.1.md ├── 0.8.2.md ├── 0.8.3.md ├── 0.8.4.md ├── 0.8.5.md ├── 0.8.6.md ├── 0.8.7.md ├── 0.8.8.md ├── 0.8.9.md └── latest.md ├── docs └── sll.md ├── examples ├── _internal_test │ ├── background_audit_logger.sll │ ├── import.sll │ └── test.sll ├── add_two_numbers │ └── main.sll ├── address_info_lookup │ └── main.sll ├── audit_library │ ├── _compile.sll │ ├── lib.c │ └── main.sll ├── fibonacci │ └── main.sll ├── fibonacci_recursive │ └── main.sll ├── file_size │ └── main.sll ├── fizzbuzz │ └── main.sll ├── gfx_triangle │ ├── main.sll │ └── shaders │ │ ├── fragment.frag │ │ └── vertex.vert ├── hello_world │ └── main.sll ├── list_files │ └── main.sll ├── multiplication_table │ └── main.sll ├── quiz_game │ ├── data.json │ └── main.sll ├── signum_function │ └── main.sll └── window │ └── main.sll ├── src ├── _build │ ├── api.sll │ ├── assembly.sll │ ├── build.sll │ ├── bundle.ps1 │ ├── bundle.sh │ ├── config.sll │ ├── documentation.sll │ ├── hashlist.sll │ ├── header.sll │ ├── main.sll │ ├── operator_parser.sll │ ├── optimizer.sll │ ├── setup_win.ps1 │ ├── shader.sll │ ├── util.sll │ └── website.sll ├── cli │ ├── linux.c │ ├── rsrc │ │ ├── app.rc │ │ └── main_icon.ico │ └── windows.c ├── ext │ ├── clib │ │ ├── function.asm │ │ ├── function_table.c │ │ ├── include │ │ │ └── clib │ │ │ │ ├── common.h │ │ │ │ ├── function.h │ │ │ │ └── library.h │ │ ├── lib │ │ │ ├── _library.sll │ │ │ ├── _load_library.sll │ │ │ ├── _setup_extension_libraries.sll │ │ │ ├── clib.sll │ │ │ ├── function.sll │ │ │ ├── header │ │ │ │ ├── stddef.sll │ │ │ │ └── stdint.sll │ │ │ ├── library.sll │ │ │ └── types.sll │ │ ├── library.c │ │ └── main.c │ ├── ds4 │ │ ├── .extension_data.json │ │ ├── function_table.c │ │ ├── include │ │ │ └── ds4 │ │ │ │ ├── common.h │ │ │ │ └── device.h │ │ ├── install │ │ │ └── linux.sh │ │ ├── lib │ │ │ ├── _load_library.sll │ │ │ └── device.sll │ │ └── platform │ │ │ ├── darwin │ │ │ └── main.c │ │ │ ├── linux │ │ │ └── main.c │ │ │ └── windows │ │ │ └── main.c │ ├── font │ │ ├── .extension_data.json │ │ ├── function_table.c │ │ ├── include │ │ │ └── font │ │ │ │ ├── common.h │ │ │ │ └── true_type.h │ │ ├── install │ │ │ ├── darwin.sh │ │ │ ├── linux.sh │ │ │ └── windows.bat │ │ ├── lib │ │ │ ├── _load_library.sll │ │ │ ├── atlas.sll │ │ │ ├── rendered_text.sll │ │ │ └── true_type.sll │ │ ├── main.c │ │ ├── platform │ │ │ ├── darwin │ │ │ │ └── true_type.c │ │ │ ├── linux │ │ │ │ └── true_type.c │ │ │ └── windows │ │ │ │ └── true_type.c │ │ ├── stb_truetype.c │ │ └── truetype.c │ ├── gfx │ │ ├── .extension_data.json │ │ ├── buffer.c │ │ ├── color.c │ │ ├── context.c │ │ ├── function_table.c │ │ ├── include │ │ │ └── gfx │ │ │ │ ├── buffer.h │ │ │ │ ├── color.h │ │ │ │ ├── common.h │ │ │ │ ├── context.h │ │ │ │ ├── memory.h │ │ │ │ ├── pipeline.h │ │ │ │ ├── sampler.h │ │ │ │ ├── shader.h │ │ │ │ ├── texture.h │ │ │ │ ├── util.h │ │ │ │ ├── vulkan.h │ │ │ │ └── vulkan_functions.h │ │ ├── install │ │ │ ├── darwin.sh │ │ │ ├── linux.sh │ │ │ └── windows.bat │ │ ├── lib │ │ │ ├── _color.sll │ │ │ ├── _load_library.sll │ │ │ ├── _setup_window_integration.sll │ │ │ ├── buffer.sll │ │ │ ├── color.sll │ │ │ ├── context.sll │ │ │ ├── data_type.sll │ │ │ ├── gfx.sll │ │ │ ├── pipeline.sll │ │ │ ├── sampler.sll │ │ │ ├── shader.sll │ │ │ ├── stage.sll │ │ │ ├── texture.sll │ │ │ └── vulkan.sll │ │ ├── main.c │ │ ├── memory.c │ │ ├── pipeline.c │ │ ├── sampler.c │ │ ├── shader.c │ │ ├── texture.c │ │ ├── util.c │ │ ├── vulkan.c │ │ └── vulkan_functions.c │ ├── http │ │ └── lib │ │ │ └── mime.sll │ ├── ui │ │ ├── .extension_data.json │ │ ├── lib │ │ │ ├── _element_types.sll │ │ │ ├── _ui_type.sll │ │ │ ├── _util.sll │ │ │ ├── core.sll │ │ │ ├── element.sll │ │ │ ├── element │ │ │ │ ├── button.sll │ │ │ │ ├── color.sll │ │ │ │ ├── container.sll │ │ │ │ ├── gradient.sll │ │ │ │ ├── slider.sll │ │ │ │ ├── text.sll │ │ │ │ └── texture.sll │ │ │ ├── layout.sll │ │ │ ├── position.sll │ │ │ ├── rgb.sll │ │ │ ├── serialize.sll │ │ │ ├── shader │ │ │ │ ├── _fragment_shader.sll │ │ │ │ └── _vertex_shader.sll │ │ │ ├── texture.sll │ │ │ └── ui.sll │ │ └── shader │ │ │ ├── fragment.frag │ │ │ └── vertex.vert │ └── window_manager │ │ ├── .extension_data.json │ │ ├── function_table.c │ │ ├── include │ │ └── window_manager │ │ │ ├── common.h │ │ │ ├── cursor.h │ │ │ ├── display.h │ │ │ ├── event.h │ │ │ ├── keyboard.h │ │ │ ├── platform │ │ │ ├── linux.h │ │ │ └── windows.h │ │ │ └── window.h │ │ ├── install │ │ └── linux.sh │ │ ├── lib │ │ ├── _load_library.sll │ │ ├── cursor.sll │ │ ├── display.sll │ │ ├── event.sll │ │ ├── geometry.sll │ │ ├── image.sll │ │ ├── keyboard.sll │ │ ├── range.sll │ │ ├── util.sll │ │ ├── window.sll │ │ └── window_manager.sll │ │ ├── main.c │ │ └── platform │ │ ├── darwin │ │ ├── cursor.c │ │ ├── display.c │ │ ├── event.c │ │ ├── keyboard.c │ │ ├── main.c │ │ └── window.c │ │ ├── linux │ │ ├── cursor.c │ │ ├── display.c │ │ ├── event.c │ │ ├── keyboard.c │ │ ├── main.c │ │ └── window.c │ │ └── windows │ │ ├── cursor.c │ │ ├── display.c │ │ ├── event.c │ │ ├── keyboard.c │ │ ├── main.c │ │ └── window.c ├── fuzzer │ ├── debug_main.c │ └── main.c ├── sll │ ├── allocator.c │ ├── api │ │ ├── _function_table.c │ │ ├── array.c │ │ ├── atexit.c │ │ ├── audit.c │ │ ├── base64.c │ │ ├── date.c │ │ ├── error.c │ │ ├── file.c │ │ ├── hash.c │ │ ├── int.c │ │ ├── json.c │ │ ├── log.c │ │ ├── map.c │ │ ├── math.c │ │ ├── object.c │ │ ├── path.c │ │ ├── process.c │ │ ├── random.c │ │ ├── serial.c │ │ ├── socket.c │ │ ├── sort.c │ │ ├── string.c │ │ ├── struct.c │ │ ├── sys.c │ │ ├── thread.c │ │ ├── time.c │ │ ├── vm.c │ │ └── weakref.c │ ├── api_call.asm │ ├── api_call.c │ ├── array.c │ ├── assembly.c │ ├── audit.c │ ├── barrier.c │ ├── bundle.c │ ├── cli.c │ ├── compilation_data.c │ ├── complex.c │ ├── compression.c │ ├── container.c │ ├── cpuid_check.asm │ ├── critical.c │ ├── data.c │ ├── data │ │ ├── assembly_optimizer.txt │ │ ├── cpuid_error.txt │ │ ├── critical_error.txt │ │ ├── help_text.txt │ │ ├── memory_fail.txt │ │ ├── operator_parser.txt │ │ └── optimizer.txt │ ├── debug.c │ ├── debug_data.c │ ├── environment.c │ ├── error.c │ ├── file.c │ ├── gc.c │ ├── handle_container.c │ ├── identifier.c │ ├── ift.c │ ├── include │ │ └── sll │ │ │ ├── _file_descriptor.h │ │ │ ├── _internal │ │ │ ├── allocator.h │ │ │ ├── api │ │ │ │ ├── atexit.h │ │ │ │ ├── file.h │ │ │ │ ├── hash.h │ │ │ │ ├── json.h │ │ │ │ ├── math.h │ │ │ │ ├── serial.h │ │ │ │ └── string.h │ │ │ ├── api_call.h │ │ │ ├── assembly.h │ │ │ ├── attribute.h │ │ │ ├── audit.h │ │ │ ├── barrier.h │ │ │ ├── bundle.h │ │ │ ├── cli.h │ │ │ ├── common.h │ │ │ ├── common.inc │ │ │ ├── complex.h │ │ │ ├── dispatcher.h │ │ │ ├── environment.h │ │ │ ├── error.h │ │ │ ├── file.h │ │ │ ├── gc.h │ │ │ ├── init.h │ │ │ ├── intrinsics.h │ │ │ ├── lock.h │ │ │ ├── log.h │ │ │ ├── magic_number.h │ │ │ ├── memory.h │ │ │ ├── new_object.h │ │ │ ├── operator.h │ │ │ ├── optimizer.h │ │ │ ├── parse.h │ │ │ ├── parse_args.h │ │ │ ├── platform.h │ │ │ ├── print.h │ │ │ ├── sandbox.h │ │ │ ├── scheduler.h │ │ │ ├── semaphore.h │ │ │ ├── stack.h │ │ │ ├── static_object.h │ │ │ ├── static_string.h │ │ │ ├── string.h │ │ │ ├── string_format.h │ │ │ ├── thread.h │ │ │ ├── unify.h │ │ │ ├── util.h │ │ │ ├── var_arg.h │ │ │ ├── vm.h │ │ │ └── weakref.h │ │ │ ├── _object_func.h │ │ │ ├── _object_types.h │ │ │ ├── _size_types.h │ │ │ ├── _socket_types.h │ │ │ ├── _string_types.h │ │ │ ├── _thread_type.h │ │ │ ├── abi.h │ │ │ ├── allocator.h │ │ │ ├── api │ │ │ ├── array.h │ │ │ ├── atexit.h │ │ │ ├── audit.h │ │ │ ├── base64.h │ │ │ ├── date.h │ │ │ ├── error.h │ │ │ ├── file.h │ │ │ ├── hash.h │ │ │ ├── int.h │ │ │ ├── json.h │ │ │ ├── log.h │ │ │ ├── map.h │ │ │ ├── math.h │ │ │ ├── object.h │ │ │ ├── path.h │ │ │ ├── process.h │ │ │ ├── random.h │ │ │ ├── serial.h │ │ │ ├── socket.h │ │ │ ├── sort.h │ │ │ ├── string.h │ │ │ ├── struct.h │ │ │ ├── sys.h │ │ │ ├── thread.h │ │ │ ├── time.h │ │ │ ├── vm.h │ │ │ └── weakref.h │ │ │ ├── array.h │ │ │ ├── assembly.h │ │ │ ├── audit.h │ │ │ ├── barrier.h │ │ │ ├── bundle.h │ │ │ ├── cli.h │ │ │ ├── common.h │ │ │ ├── complex.h │ │ │ ├── compression.h │ │ │ ├── container.h │ │ │ ├── data.h │ │ │ ├── debug.h │ │ │ ├── environment.h │ │ │ ├── error.h │ │ │ ├── file.h │ │ │ ├── gc.h │ │ │ ├── generated │ │ │ ├── assembly_optimizer.h │ │ │ ├── cpuid_error.h │ │ │ ├── critical_error.h │ │ │ ├── help_text.h │ │ │ ├── memory_fail.h │ │ │ ├── operator_parser.h │ │ │ └── optimizer.h │ │ │ ├── identifier.h │ │ │ ├── ift.h │ │ │ ├── init.h │ │ │ ├── io.h │ │ │ ├── location.h │ │ │ ├── lock.h │ │ │ ├── log.h │ │ │ ├── map.h │ │ │ ├── memory.h │ │ │ ├── new_object.h │ │ │ ├── node.h │ │ │ ├── object.h │ │ │ ├── operator.h │ │ │ ├── optimizer.h │ │ │ ├── parse_args.h │ │ │ ├── platform │ │ │ ├── _dispatcher.h │ │ │ ├── environment.h │ │ │ ├── event.h │ │ │ ├── file.h │ │ │ ├── library.h │ │ │ ├── lock.h │ │ │ ├── memory.h │ │ │ ├── path.h │ │ │ ├── process.h │ │ │ ├── socket.h │ │ │ ├── thread.h │ │ │ ├── time.h │ │ │ └── util.h │ │ │ ├── sandbox.h │ │ │ ├── scheduler.h │ │ │ ├── search_path.h │ │ │ ├── semaphore.h │ │ │ ├── socket.h │ │ │ ├── static_object.h │ │ │ ├── string.h │ │ │ ├── string_table.h │ │ │ ├── thread.h │ │ │ ├── types.h │ │ │ ├── var_arg.h │ │ │ ├── version.h │ │ │ ├── vm.h │ │ │ └── weakref.h │ ├── init.c │ ├── io │ │ ├── read.c │ │ └── write.c │ ├── io_dispatcher.c │ ├── lib │ │ ├── _file.sll │ │ ├── _internal.sll │ │ ├── _socket.sll │ │ ├── array.sll │ │ ├── atexit.sll │ │ ├── audit.sll │ │ ├── base64.sll │ │ ├── data_file.sll │ │ ├── date.sll │ │ ├── error.sll │ │ ├── error_codes.sll │ │ ├── file.sll │ │ ├── float.sll │ │ ├── hash.sll │ │ ├── hmac.sll │ │ ├── input.sll │ │ ├── int.sll │ │ ├── json.sll │ │ ├── log.sll │ │ ├── map.sll │ │ ├── math.sll │ │ ├── object.sll │ │ ├── path.sll │ │ ├── process.sll │ │ ├── random.sll │ │ ├── serial.sll │ │ ├── socket.sll │ │ ├── sort.sll │ │ ├── statistics.sll │ │ ├── string.sll │ │ ├── struct.sll │ │ ├── sys.sll │ │ ├── thread.sll │ │ ├── time.sll │ │ ├── types.sll │ │ ├── uuid.sll │ │ ├── vm.sll │ │ └── weakref.sll │ ├── location.c │ ├── lock.c │ ├── log.c │ ├── map.c │ ├── map_container.c │ ├── memory.c │ ├── metadata.c │ ├── new_object.c │ ├── object.c │ ├── operator │ │ ├── access.c │ │ ├── add.c │ │ ├── assign.c │ │ ├── bitwise.c │ │ ├── bool.c │ │ ├── cast.c │ │ ├── compare.c │ │ ├── copy.c │ │ ├── div.c │ │ ├── equal.c │ │ ├── inc_dec.c │ │ ├── includes.c │ │ ├── length.c │ │ ├── modulo.c │ │ ├── mult.c │ │ ├── shift.c │ │ └── subtract.c │ ├── optimizer.c │ ├── padding.c │ ├── parse.c │ ├── parse_args.c │ ├── platform │ │ ├── linux │ │ │ ├── dispatcher.h │ │ │ ├── environment.c │ │ │ ├── event.c │ │ │ ├── file.c │ │ │ ├── library.c │ │ │ ├── lock.c │ │ │ ├── memory.c │ │ │ ├── path.c │ │ │ ├── process.c │ │ │ ├── thread.c │ │ │ ├── time.c │ │ │ └── util.c │ │ ├── shared │ │ │ └── socket.c │ │ └── windows │ │ │ ├── dispatcher.h │ │ │ ├── environment.c │ │ │ ├── event.c │ │ │ ├── file.c │ │ │ ├── library.c │ │ │ ├── lock.c │ │ │ ├── memory.c │ │ │ ├── path.c │ │ │ ├── process.c │ │ │ ├── thread.c │ │ │ ├── time.c │ │ │ └── util.c │ ├── print.c │ ├── sandbox.c │ ├── scheduler.c │ ├── search_path.c │ ├── semaphore.c │ ├── size.c │ ├── skip.c │ ├── socket.c │ ├── stack.c │ ├── static_object.c │ ├── string.c │ ├── string_format.c │ ├── string_table.c │ ├── thread.c │ ├── unify.c │ ├── var_arg.c │ ├── version.c │ ├── vm.c │ └── weakref.c └── web │ ├── 404.html │ ├── apt.sh │ ├── apt_nightly.sh │ ├── css │ └── docs.css │ ├── docs.html │ └── js │ └── docs.js ├── syntax └── sublime │ ├── sll_markdown_syntax │ └── SllMarkdown.sublime-syntax │ └── sll_syntax │ ├── Comments.tmPreferences │ └── sll.sublime-syntax └── tests ├── _common.sll ├── _random.sll ├── _runner.sll ├── api ├── test_array.sll ├── test_audit.sll ├── test_base64.sll ├── test_data_file.sll └── test_date.sll ├── ext ├── clib │ └── temporary.sll ├── gfx │ └── temporary.sll └── window │ └── temporary.sll └── symbols ├── _export_test_source_file.sll ├── test_access_copy.sll ├── test_access_double.sll ├── test_access_single.sll ├── test_access_triple.sll ├── test_bit_not.sll ├── test_bool.sll ├── test_break.sll ├── test_comma.sll ├── test_continue.sll ├── test_declaration.sll ├── test_deep_copy.sll ├── test_export.sll ├── test_length.sll ├── test_not.sll └── test_ref.sll /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VARIANT="jammy" 2 | FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT} 3 | COPY setup.sh /tmp/setup.sh 4 | RUN bash /tmp/setup.sh 5 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ubuntu", 3 | "build": { 4 | "dockerfile": "Dockerfile", 5 | "args": { 6 | "VARIANT": "ubuntu-22.04" 7 | } 8 | }, 9 | "remoteUser": "vscode", 10 | "features": { 11 | "git": "latest" 12 | }, 13 | "mounts": [ 14 | "source=sll-bashhistory,target=/commandhistory,type=volume" 15 | ], 16 | "onCreateCommand": "[ -d build/ext ]&&rm -rf build/ext" 17 | } 18 | -------------------------------------------------------------------------------- /.devcontainer/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | apt-get update 3 | export DEBIAN_FRONTEND=noninteractive 4 | apt-get -y install --no-install-recommends nasm gcc 5 | apt-get clean 6 | rm -rf /var/lib/apt/lists/* 7 | mkdir /commandhistory 8 | touch /commandhistory/.bash_history 9 | chown -R vscode /commandhistory 10 | echo "export PROMPT_COMMAND='history -a'&&export HISTFILE=/commandhistory/.bash_history" >> "/home/vscode/.bashrc" 11 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @krzem5 2 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "daily" 7 | -------------------------------------------------------------------------------- /.github/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | build 3 | *.dll 4 | *.so 5 | *.zip 6 | *.spv 7 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2021-2025 The Sl-Lang Organization 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # The SL Programing Language 2 | [![sll logo](.github/logo_wide.svg)](https://github.com/sl-lang/sll) 3 | ***Sll is a simple yet powerful programing language intended for beginner as well as advanced software developers.*** 4 | 5 | The documentation is located [here](docs/sll.md). 6 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Currently, SLL is not production-ready, so only the latest version is supported. 6 | 7 | ## Reporting a Vulnerability 8 | 9 | Security vulnerabilities must not be reported in a public space, such as an Issue or a PR. Instead, they must be send directly to the following email address: krzem5.dev@gmail.com. Please include the following phrase in the title of the email: `SLL Vulnerability`. In the email, include a short description of the vulnerability, how to reproduce it and a proof of concept. 10 | -------------------------------------------------------------------------------- /build.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | if not exist build mkdir build 3 | if not exist build\_sll_runtime_windows ( 4 | mkdir build\_sll_runtime_windows 5 | curl -o build\_sll_runtime_windows\windows.zip "https://sl-lang.github.io/bin/windows.zip" 6 | powershell -command "Expand-Archive -Force 'build\_sll_runtime_windows\windows.zip' 'build\_sll_runtime_windows\'" 7 | del /f /q build\_sll_runtime_windows\windows.zip 8 | ) 9 | if not exist build\_build_script.sla ( 10 | build\_sll_runtime_windows\sll.exe src\_build\main.sll -I "@build-script|src\_build" -O -x 5 -r -R -a -o build/_build_script 11 | ) 12 | build\_sll_runtime_windows\sll.exe build\_build_script.sla -A %* 13 | if errorlevel -1073741819 exit /b 0 14 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | [ ! -d "build" ]&&mkdir build 3 | if [ "$(uname -s)" == "Darwin" ]; then 4 | platform="darwin" 5 | else 6 | platform="linux" 7 | fi 8 | if [ ! -d "build/_sll_runtime_$platform" ]; then 9 | mkdir "build/_sll_runtime_$platform" 10 | curl -o "build/_sll_runtime_$platform/$platform.zip" "https://sl-lang.github.io/bin/$platform.zip" 11 | unzip -qq -o "build/_sll_runtime_$platform/$platform.zip" -d "build/_sll_runtime_$platform/" 12 | rm -f "build/_sll_runtime_$platform/$platform.zip" 13 | fi 14 | if [[ ! -f "build/_build_script.sla" || "$SLL_FORCE_REBUILD" != "" ]]; then 15 | "build/_sll_runtime_$platform/sll" src/_build/main.sll -I "@build-script|src/_build" -O -x 5 -r -R -a -o build/_build_script 16 | fi 17 | "build/_sll_runtime_$platform/sll" build/_build_script.sla -A "$@" 18 | [[ "$?" == "0" || "$?" == "6" ]]&&exit 0 19 | -------------------------------------------------------------------------------- /changelog/0.1.10.md: -------------------------------------------------------------------------------- 1 | # Sll [0.1.10] - 2021-07-01 2 | 3 | ## Changed 4 | 5 | - Replaced `printf()` call in the CLI now print data using `print_str`, `print_str_const` and `print_int` 6 | 7 | [0.1.10]: https://github.com/sl-lang/sll/compare/sll-v0.1.9...sll-v0.1.10 8 | -------------------------------------------------------------------------------- /changelog/0.1.11.md: -------------------------------------------------------------------------------- 1 | # Sll [0.1.11] - 2021-07-02 2 | 3 | ## Changed 4 | 5 | - CLI now executes the code by default 6 | - Rewritten help documentation 7 | 8 | [0.1.11]: https://github.com/sl-lang/sll/compare/sll-v0.1.10...sll-v0.1.11 9 | -------------------------------------------------------------------------------- /changelog/0.1.12.md: -------------------------------------------------------------------------------- 1 | # Sll [0.1.12] - 2021-07-02 2 | 3 | ## Changed 4 | 5 | - Added builder script option for code generation (`--generate-code`) 6 | 7 | [0.1.12]: https://github.com/sl-lang/sll/compare/sll-v0.1.11...sll-v0.1.12 8 | -------------------------------------------------------------------------------- /changelog/0.1.13.md: -------------------------------------------------------------------------------- 1 | # Sll [0.1.13] - 2021-07-02 2 | 3 | *Nothing* 4 | 5 | [0.1.13]: https://github.com/sl-lang/sll/compare/sll-v0.1.12...sll-v0.1.13 6 | -------------------------------------------------------------------------------- /changelog/0.1.2.md: -------------------------------------------------------------------------------- 1 | # Sll [0.1.2] - 2021-06-15 2 | 3 | Unfortunately, no versions were assigned before 2021-06-15 (:disappointed:), so the change log for version 0.1.2 (and below) consists of everything added up to that point. 4 | 5 | [0.1.2]: https://github.com/sl-lang/sll/tree/v0.1.2 6 | -------------------------------------------------------------------------------- /changelog/0.1.3.md: -------------------------------------------------------------------------------- 1 | # Sll [0.1.3] - 2021-06-16 2 | 3 | ## Added 4 | 5 | - Options for printing the help message 6 | - Semantic versioning 7 | 8 | [0.1.3]: https://github.com/sl-lang/sll/compare/lll-v0.1.2...lll-v0.1.3 9 | -------------------------------------------------------------------------------- /changelog/0.1.4.md: -------------------------------------------------------------------------------- 1 | # Sll [0.1.4] - 2021-06-16 2 | 3 | ## Added 4 | 5 | - Support for functions 6 | 7 | ## Changed 8 | 9 | - Rewritten the syntax highlight 10 | 11 | [0.1.4]: https://github.com/sl-lang/sll/compare/lll-v0.1.3...lll-v0.1.4 12 | -------------------------------------------------------------------------------- /changelog/0.1.5.md: -------------------------------------------------------------------------------- 1 | # Sll [0.1.5] - 2021-06-17 2 | 3 | ## Added 4 | 5 | - Functions tables are now used to store function arguments 6 | 7 | ## Changed 8 | 9 | - Functions and loops have inner scopes 10 | 11 | [0.1.5]: https://github.com/sl-lang/sll/compare/lll-v0.1.4...lll-v0.1.5 12 | -------------------------------------------------------------------------------- /changelog/0.1.6.md: -------------------------------------------------------------------------------- 1 | # Sll [0.1.6] - 2021-06-18 2 | 3 | ## Added 4 | 5 | - List of volatile CPU registers 6 | 7 | ## Changed 8 | 9 | - API functions are now marked with `__LLL_API_FUNCTION` 10 | - Volatile CPU registers are now saved across function calls 11 | 12 | ## Removed 13 | 14 | - Declarations of unused private functions 15 | 16 | [0.1.6]: https://github.com/sl-lang/sll/compare/lll-v0.1.5...lll-v0.1.6 17 | -------------------------------------------------------------------------------- /changelog/0.1.7.md: -------------------------------------------------------------------------------- 1 | # Sll [0.1.7] - 2021-07-01 2 | 3 | ## Changed 4 | 5 | - Changed from the MIT License to the BSD 3-Clause License 6 | - Implemented code generation for functions 7 | 8 | [0.1.7]: https://github.com/sl-lang/sll/compare/lll-v0.1.6...lll-v0.1.7 9 | -------------------------------------------------------------------------------- /changelog/0.1.8.md: -------------------------------------------------------------------------------- 1 | # Sll [0.1.8] - 2021-07-01 2 | 3 | ## Added 4 | 5 | - Function for executing code (`lll_run_compiled_object`) 6 | - Options for running the program (`-r` / `-r0`) and generating output (`-g` / `-g0`) 7 | 8 | ## Changed 9 | 10 | - Moved the example file to the [`example/`][0.1.8/example] directory 11 | - The help string has been moved to a separate file ([`rsrc/help.txt`][0.1.8/rsrc/help.txt]) 12 | 13 | [0.1.8]: https://github.com/sl-lang/sll/compare/lll-v0.1.7...lll-v0.1.8 14 | [0.1.8/example]: https://github.com/sl-lang/sll/blob/sll-v0.1.8/example 15 | [0.1.8/rsrc/help.txt]: https://github.com/sl-lang/sll/blob/sll-v0.1.8/rsrc/help.txt 16 | -------------------------------------------------------------------------------- /changelog/0.1.9.md: -------------------------------------------------------------------------------- 1 | # Sll [0.1.9] - 2021-07-01 2 | 3 | ## Changed 4 | 5 | - Fixed bugs in the builder script 6 | 7 | [0.1.9]: https://github.com/sl-lang/sll/compare/lll-v0.1.8...sll-v0.1.9 8 | -------------------------------------------------------------------------------- /changelog/0.2.0.md: -------------------------------------------------------------------------------- 1 | # Sll [0.2.0] - 2021-07-03 2 | 3 | ## Added 4 | 5 | - Different structures for each object type 6 | 7 | ## Removed 8 | 9 | - Object conversion functions 10 | 11 | [0.2.0]: https://github.com/sl-lang/sll/compare/sll-v0.1.13...lll-v0.2.0 12 | -------------------------------------------------------------------------------- /changelog/0.2.1.md: -------------------------------------------------------------------------------- 1 | # Sll [0.2.1] - 2021-07-03 2 | 3 | ## Added 4 | 5 | - Debug object also store the line and column number 6 | 7 | ## Changed 8 | 9 | - All integer are now stored as 64-bit value 10 | 11 | [0.2.1]: https://github.com/sl-lang/sll/compare/lll-v0.2.0...lll-v0.2.1 12 | -------------------------------------------------------------------------------- /changelog/0.2.2.md: -------------------------------------------------------------------------------- 1 | # Sll [0.2.2] - 2021-07-23 2 | 3 | ## Changed 4 | 5 | - All object are now 8-byte aligned 6 | - Identifier list compassion has been sped up 7 | - Renamed some options 8 | 9 | [0.2.2]: https://github.com/sl-lang/sll/compare/lll-v0.2.1...lll-v0.2.2 10 | -------------------------------------------------------------------------------- /changelog/0.2.3.md: -------------------------------------------------------------------------------- 1 | # Sll [0.2.3] - 2021-07-25 2 | 3 | ## Changed 4 | 5 | - Rewritten the help document 6 | 7 | ## Removed 8 | 9 | - Object modifiers 10 | - Unused macros related to assembly generation 11 | 12 | [0.2.3]: https://github.com/sl-lang/sll/compare/lll-v0.2.2...lll-v0.2.3 13 | -------------------------------------------------------------------------------- /changelog/0.3.0.md: -------------------------------------------------------------------------------- 1 | # Sll [0.3.0] - 2021-07-25 2 | 3 | ## Changed 4 | 5 | - Integers are now encoded differently 6 | 7 | [0.3.0]: https://github.com/sl-lang/sll/compare/lll-v0.2.3...lll-v0.3.0 8 | -------------------------------------------------------------------------------- /changelog/0.3.1.md: -------------------------------------------------------------------------------- 1 | # Sll [0.3.1] - 2021-07-25 2 | 3 | ## Changed 4 | 5 | - Fixed bugs related to bit shifting of narrow types in variable-length integer encoding 6 | - Fixed other bugs 7 | 8 | [0.3.1]: https://github.com/sl-lang/sll/compare/lll-v0.3.0...lll-v0.3.1 9 | -------------------------------------------------------------------------------- /changelog/0.3.2.md: -------------------------------------------------------------------------------- 1 | # Sll [0.3.2] - 2021-07-25 2 | 3 | ## Added 4 | 5 | - `_create_string` function 6 | - `lll_merge_import` function merges string 7 | 8 | ## Changed 9 | 10 | - Renamed `uintXX_t` to custom types 11 | 12 | [0.3.2]: https://github.com/sl-lang/sll/compare/lll-v0.3.1...lll-v0.3.2 13 | -------------------------------------------------------------------------------- /changelog/0.3.3.md: -------------------------------------------------------------------------------- 1 | # Sll [0.3.3] - 2021-07-26 2 | 3 | ## Added 4 | 5 | - Two new types: `lll_float_t` and `lll_time_t` 6 | 7 | ## Changed 8 | 9 | - Moved `_create_string` and `_object_size` functions to [`src/lll_lib/util.c`][0.3.3/src/lll_lib/util.c] 10 | 11 | [0.3.3]: https://github.com/sl-lang/sll/compare/lll-v0.3.2...lll-v0.3.3 12 | [0.3.3/src/lll_lib/util.c]: https://github.com/sl-lang/sll/blob/sll-v0.3.3/src/lll_lib/util.c 13 | -------------------------------------------------------------------------------- /changelog/0.3.4.md: -------------------------------------------------------------------------------- 1 | # Sll [0.3.4] - 2021-07-27 2 | 3 | ## Added 4 | 5 | - `lll_optimize_metadata` function 6 | - Option for language generation (`-g`) 7 | - Option for saving the compiled object (`-c`) 8 | 9 | [0.3.4]: https://github.com/sl-lang/sll/compare/lll-v0.3.3...lll-v0.3.4 10 | -------------------------------------------------------------------------------- /changelog/0.3.5.md: -------------------------------------------------------------------------------- 1 | # Sll [0.3.5] - 2021-07-28 2 | 3 | ## Added 4 | 5 | - Ability to save the generated assembly code (option `-a`) 6 | - Assembly generator and related structures, types, functions and macros 7 | - Option for printing assembly (`-P`) 8 | 9 | [0.3.5]: https://github.com/sl-lang/sll/compare/lll-v0.3.4...lll-v0.3.5 10 | -------------------------------------------------------------------------------- /changelog/0.4.0.md: -------------------------------------------------------------------------------- 1 | # Sll [0.4.0] - 2021-07-28 2 | 3 | ## Added 4 | 5 | - Assembly instructions used for pushing the current instruction index and for storing a variable and removing it of the stack 6 | - Implemented `lll_run_assembly` 7 | 8 | ## Changed 9 | 10 | - Assembly instruction data is now saved and read from files 11 | - Assembly instruction that modify the instruction index can jump to relative offsets 12 | 13 | ## Removed 14 | 15 | - Unimplemented language-generation functions and CLI arguments 16 | 17 | [0.4.0]: https://github.com/sl-lang/sll/compare/lll-v0.3.5...lll-v0.4.0 18 | -------------------------------------------------------------------------------- /changelog/0.4.1.md: -------------------------------------------------------------------------------- 1 | # Sll [0.4.1] - 2021-07-29 2 | 3 | ## Added 4 | 5 | - A level-3 optimization (`-O3`), which performs global optimization of the compiled object 6 | - Assembly instructions for returning different types 7 | - Errors related to invalid instructions, stack corruption and an invalid instruction index 8 | - `LLL_ASSEMBLY_INSTRUCTION_TYPE_POP_ROT` instruction 9 | - Two new operators: `(@)` (exit) and `(@@)` (return) 10 | 11 | ## Changed 12 | 13 | - In a debug build, the `UNREACHABLE()` macro expands into `ASSERT(!"Unreachable")` 14 | - Operator assembly instruction can be used directly on a variable 15 | 16 | ## Removed 17 | 18 | - `LLL_ASSEMBLY_INSTRUCTION_TYPE_PUSH_NIL` instruction 19 | - `lll_optimize_object` function 20 | - `LLL_RUNTIME_OBJECT_TYPE_TRUE` and `LLL_RUNTIME_OBJECT_TYPE_FALSE` runtime object types 21 | 22 | [0.4.1]: https://github.com/sl-lang/sll/compare/lll-v0.4.0...lll-v0.4.1 23 | -------------------------------------------------------------------------------- /changelog/0.5.0.md: -------------------------------------------------------------------------------- 1 | # Sll [0.5.0] - 2021-07-30 2 | 3 | ## Added 4 | 5 | - Assembly instructions used to store small integer values (`-1`, `0`, `1`, `2`, `3` and `4`) 6 | - `lll_optimize_object` function 7 | - Two new operators: `(>-)` (do-while loop) and `(><)` (infinite loop) 8 | 9 | ## Changed 10 | 11 | - Every single object uses the same structure 12 | - `lll_optimize_metadata` function has been moved from [`src/lll_lib/optimize.c`][0.4.1/src/lll_lib/optimize.c] to [`src/lll_lib/metadata.c`][0.5.0/src/lll_lib/metadata.c] 13 | - `lll_remove padding` function has been moved to [`src/lll_lib/padding.c`][0.5.0/src/lll_lib/padding.c] 14 | 15 | ## Removed 16 | 17 | - `LLL_OBJECT_TYPE_NIL`: `nil` values get compiled directly into zeros 18 | 19 | [0.5.0]: https://github.com/sl-lang/sll/compare/lll-v0.4.1...lll-v0.5.0 20 | [0.5.0/src/lll_lib/metadata.c]: https://github.com/sl-lang/sll/blob/sll-v0.5.0/src/lll_lib/metadata.c 21 | [0.5.0/src/lll_lib/padding.c]: https://github.com/sl-lang/sll/blob/sll-v0.5.0/src/lll_lib/padding.c 22 | [0.4.1/src/lll_lib/optimize.c]: https://github.com/sl-lang/sll/blob/sll-v0.4.1/src/lll_lib/optimize.c 23 | -------------------------------------------------------------------------------- /changelog/0.5.1.md: -------------------------------------------------------------------------------- 1 | # Sll [0.5.1] - 2021-07-30 2 | 3 | ## Changed 4 | 5 | - Function `lll_run_assembly` has been renamed to `lll_execute_assembly` 6 | - `lll_compare_runtime_object`, `lll_create_string`, `lll_runtime_object_size` and `lll_runtime_object_nonzero` functions are now public 7 | - Runtime object functions (`lll_compare_runtime_object` and `lll_runtime_object_nonzero`) have been moved to [`src/lll_lib/object.c`][0.5.1/src/lll_lib/object.c] 8 | 9 | [0.5.1]: https://github.com/sl-lang/sll/compare/lll-v0.5.0...lll-v0.5.1 10 | [0.5.1/src/lll_lib/object.c]: https://github.com/sl-lang/sll/blob/sll-v0.5.1/src/lll_lib/object.c 11 | -------------------------------------------------------------------------------- /changelog/0.5.2.md: -------------------------------------------------------------------------------- 1 | # Sll [0.5.2] - 2021-07-31 2 | 3 | ## Changed 4 | 5 | - `(@@)` (return) operator now compiles into the exit operator (`(@)`) if used outside of a function 6 | - `ASSERT` macro now only works in debug builds 7 | - VM now uses a call stack instead of the `LLL_ASSEMBLY_INSTRUCTION_TYPE_PUSH_II` instruction 8 | - VM now uses a stack index instead of a moving pointer 9 | 10 | [0.5.2]: https://github.com/sl-lang/sll/compare/lll-v0.5.1...lll-v0.5.2 11 | -------------------------------------------------------------------------------- /changelog/0.6.0.md: -------------------------------------------------------------------------------- 1 | # Sll [0.6.0] - 2021-07-31 2 | 3 | ## Added 4 | 5 | - CLI tries to load files from the `/lib/` directory 6 | - Internal functions 7 | - `lll_api_get_time` function in [`src/lll_lib/api/time.c`][0.6.0/src/lll_lib/api/time.c] 8 | - [`src/include/lll_lib_api.h`][0.6.0/src/include/lll_lib_api.h] 9 | - [`src/lll_lib/lib/time.lll`][0.6.0/src/lll_lib/lib/time.lll] 10 | 11 | ## Changed 12 | 13 | - Fixed the builder script 14 | 15 | [0.6.0]: https://github.com/sl-lang/sll/compare/lll-v0.5.2...lll-v0.6.0 16 | [0.6.0/src/include/lll_lib_api.h]: https://github.com/sl-lang/sll/blob/sll-v0.6.0/src/include/lll_lib_api.h 17 | [0.6.0/src/lll_lib/api/time.c]: https://github.com/sl-lang/sll/blob/sll-v0.6.0/src/lll_lib/api/time.c 18 | [0.6.0/src/lll_lib/lib/time.lll]: https://github.com/sl-lang/sll/blob/sll-v0.6.0/src/lll_lib/lib/time.lll 19 | -------------------------------------------------------------------------------- /changelog/0.6.1.md: -------------------------------------------------------------------------------- 1 | # Sll [0.6.1] - 2021-08-01 2 | 3 | ## Added 4 | 5 | - Ability to export identifiers 6 | - Export operator (`(##)`) 7 | 8 | ## Changed 9 | 10 | - Changed some structure and type definitions 11 | 12 | [0.6.1]: https://github.com/sl-lang/sll/compare/lll-v0.6.0...lll-v0.6.1 13 | -------------------------------------------------------------------------------- /changelog/0.6.11.md: -------------------------------------------------------------------------------- 1 | # Sll [0.6.11] - 2021-08-18 2 | 3 | ## Added 4 | 5 | - Functions now store their inner scope id 6 | - Jump instructions are no longer generated in unreachable locations 7 | - Macro constants for limits of sll types (`SLL_MAX_xxx`) 8 | - Support for variadic macros in the build script 9 | 10 | ## Changed 11 | 12 | - `sll_arg_count_t` and `sll_statement_count_t` are now 32-bit values 13 | - The sll library is now named `sll-{major}.{minor}.{patch}` instead of `sll` 14 | 15 | ## Removed 16 | 17 | - Coverage data is now an experimental feature and has been moved to a [different branch][test-coverage] 18 | 19 | [0.6.11]: https://github.com/sl-lang/sll/compare/sll-v0.6.10...sll-v0.6.11 20 | [test-coverage]: https://github.com/sl-lang/sll/tree/test-coverage 21 | -------------------------------------------------------------------------------- /changelog/0.6.14.md: -------------------------------------------------------------------------------- 1 | # Sll [0.6.14] - 2021-08-24 2 | 3 | ## Added 4 | 5 | - Ability to execute code directly from the command line with the `-s` option ([#19]) 6 | - The `restrict` keyword ([#18]) 7 | - The `SLL_VERSION_HAS_SHA` macro is defined when the `SLL_VERSION_SHA` and `SLL_VERSION_FULL_SHA` macros hold the commit sha-1 value 8 | 9 | ## Changed 10 | 11 | - Moved the CLI code into its own folder ([`src/cli/`][0.6.14/src/cli]) 12 | - Reverted from the BSD 3-Clause License to the MIT License 13 | - The order of arguments in an API function (Used to be `output, argument count, argument data` and now is `argument data, argument count, output`) 14 | 15 | ## Removed 16 | 17 | - CLI no-logo (`-L`) option 18 | - Useless clean-up code in [`src/sll/parse.c`][0.6.14/src/sll/parse.c] ([#20]) 19 | 20 | [0.6.14]: https://github.com/sl-lang/sll/compare/sll-v0.6.13...sll-v0.6.14 21 | [#20]: https://github.com/sl-lang/sll/issues/20 22 | [#19]: https://github.com/sl-lang/sll/issues/19 23 | [#18]: https://github.com/sl-lang/sll/issues/18 24 | [0.6.14/src/cli]: https://github.com/sl-lang/sll/blob/sll-v0.6.14/src/cli 25 | [0.6.14/src/sll/parse.c]: https://github.com/sl-lang/sll/blob/sll-v0.6.14/src/sll/parse.c 26 | -------------------------------------------------------------------------------- /changelog/0.6.2.md: -------------------------------------------------------------------------------- 1 | # Sll [0.6.2] - 2021-08-01 2 | 3 | ## Added 4 | 5 | - Implemented identifier exporting (the `(##)` operator) 6 | - `LLL_ASSEMBLY_INSTRUCTION)TYPE_CALL_POP` instruction 7 | - New operator: `(--)` (import) 8 | 9 | ## Changed 10 | 11 | - Bugs in the optimizer have been fixed 12 | - Internal function `time` has been renamed to `time_current` 13 | - `lll_parse_all_object` not requires a function used to load external files 14 | 15 | ## Removed 16 | 17 | - Option to merge modules (`-m`). Modules are now merged automatically 18 | - Types and functions related to import tables 19 | 20 | [0.6.2]: https://github.com/sl-lang/sll/compare/lll-v0.6.1...lll-v0.6.2 21 | -------------------------------------------------------------------------------- /changelog/0.6.21.md: -------------------------------------------------------------------------------- 1 | # Sll [0.6.21] - 2021-10-04 2 | 3 | ## Added 4 | 5 | - All operators are now properly optimized 6 | - Hash module ([#23]) 7 | - Implemented **ALL** operators ([#14]) 8 | - Implemented `sll_array_and_array`, `sll_array_combinations`, `sll_array_equal`, `sll_array_equal_map`, `sll_array_or_array`, `sll_array_xor_array`, `sll_array_range`, `sll_array_string_combinations`, `sll_map_add_array`, `sll_map_add_string`, `sll_map_and`, `sll_map_and_array`, `sll_map_and_string`, `sll_map_equal`, `sll_string_duplicate`, `sll_string_equal_array`, `sll_string_equal_map`, `sll_string_from_int`, `sll_string_replace_char` and `sll_string_split_char` 9 | - Internal function can now be declared as `SLL_INTERNAL_FUNCTION_FLAG_COMPILATION_CALL`, which would make them be at compile-time 10 | - Memory API & reference operator ([#42]) 11 | 12 | ## Changed 13 | 14 | - Bug fixes in the optimizer 15 | - `sll_operator_add` now correctly combines objects with strings and arrays 16 | 17 | [0.6.21]: https://github.com/sl-lang/sll/compare/sll-v0.6.20...sll-v0.6.21 18 | [#42]: https://github.com/sl-lang/sll/issues/42 19 | [#23]: https://github.com/sl-lang/sll/issues/23 20 | [#14]: https://github.com/sl-lang/sll/issues/14 21 | -------------------------------------------------------------------------------- /changelog/0.6.5.md: -------------------------------------------------------------------------------- 1 | # Sll [0.6.5] - 2021-08-03 2 | 3 | ## Added 4 | 5 | - Ability to create an input stream from a buffer (`lll_stream_create_input_from_buffer`) 6 | - Standalone compilation mode 7 | 8 | ## Changed 9 | 10 | - Rewritten [`build.py`][0.6.5/build.py] 11 | 12 | [0.6.5]: https://github.com/sl-lang/sll/compare/lll-v0.6.4...lll-v0.6.5 13 | [0.6.5/build.py]: https://github.com/sl-lang/sll/blob/sll-v0.6.5/build.py 14 | -------------------------------------------------------------------------------- /changelog/0.6.6.md: -------------------------------------------------------------------------------- 1 | # Sll [0.6.6] - 2021-08-07 2 | 3 | ## Added 4 | 5 | - A static zero-length string to reduce object allocation 6 | - More verbose logs generated 7 | - Platform name string (`lll_platform_string`) 8 | - String release function (`lll_string_release`) 9 | - The ability to pass arguments into the VM (`-A` option, `lll_set_argument_count` and `lll_set_argument` functions) 10 | - Two new assembly instructions: `LLL_ASSEMBLY_INSTRUCTION_TYPE_CALL_ZERO` and `LLL_ASSEMBLY_INSTRUCTION_TYPE_CALL_ONE` 11 | 12 | ## Changed 13 | 14 | - Renamed [`src/lll_lib`][0.6.5/src/lll_lib] to [`src/lll`][0.6.6/src/lll] 15 | - The build script properly indents output from child processes 16 | - Updated the assembly optimizer 17 | - Updated the optimizer 18 | 19 | ## Removed 20 | 21 | - String comparison and conversion functions 22 | - Unused file constants: `LLL_API_FILE_APPEND`, `LLL_API_FILE_READ` and `LLL_API_FILE_WRITE` 23 | 24 | [0.6.6]: https://github.com/sl-lang/sll/compare/lll-v0.6.5...lll-v0.6.6 25 | [0.6.6/src/lll]: https://github.com/sl-lang/sll/blob/sll-v0.6.6/src/lll 26 | [0.6.5/src/lll_lib]: https://github.com/sl-lang/sll/blob/sll-v0.6.5/src/lll_lib 27 | -------------------------------------------------------------------------------- /changelog/0.6.7.md: -------------------------------------------------------------------------------- 1 | # Sll [0.6.7] - 2021-08-07 2 | 3 | ## Added 4 | 5 | - New type: `lll_bool_t` 6 | - Path-related functions: `lll_api_path_absolute`, `lll_api_path_exists`, `lll_api_path_is_dir`, `lll_api_path_relative` and `lll_api_path_size` 7 | - Platform-dependent path functions: `lll_platform_path_absolute`, `lll_platform_path_exists` and `lll_platform_path_is_directory` 8 | 9 | ## Changed 10 | 11 | - Minor fixes to the build script 12 | 13 | [0.6.7]: https://github.com/sl-lang/sll/compare/lll-v0.6.6...lll-v0.6.7 14 | -------------------------------------------------------------------------------- /changelog/0.6.8.md: -------------------------------------------------------------------------------- 1 | # Sll [0.6.8] - 2021-08-07 2 | 3 | ## Changed 4 | 5 | - Moved [`build.py`][0.6.7/build.py] to [`src/_build/main.py`][0.6.8/src/_build/main.py] 6 | 7 | [0.6.8]: https://github.com/sl-lang/sll/compare/lll-v0.6.7...lll-v0.6.8 8 | [0.6.8/src/_build/main.py]: https://github.com/sl-lang/sll/blob/sll-v0.6.8/src/_build/main.py 9 | [0.6.7/build.py]: https://github.com/sl-lang/sll/blob/sll-v0.6.7/build.py 10 | -------------------------------------------------------------------------------- /changelog/0.7.19.md: -------------------------------------------------------------------------------- 1 | # Sll [0.7.19] - 2022-05-28 2 | 3 | ## Added 4 | 5 | - CLI option to enable optimizations: `-O` or `--optimize` 6 | - CLI option to specify the number of optimization rounds: `-x` or `--optimization-rounds` 7 | - Compilation data optimizer 8 | - Implemented `sll_optimization_round_count_t` and `sll_optimize_source_file` 9 | - More tests ([#8]) 10 | 11 | ## Changed 12 | 13 | - Build script is now compiled to assembly only once 14 | - Fixed `sll_string_prepend_char` and `sll_string_remove` 15 | - Fixed file change tracking in the build script 16 | - Fixed file path string index generated by `sll_unify_compilation_data` 17 | - Renamed arguments of multiple functions 18 | - Renamed CLI bundle output switch from `-O` to `-B` 19 | - Renamed fields of multiple types 20 | - Strings passed to `sll_add_string` are now always release 21 | - Translated the build script to Sll ([#75]) 22 | 23 | ## Removed 24 | 25 | - Duplicated functions: `sll_array_from_length` and `sll_array_join` 26 | - Unused functions: `sll_create_string` and `sll_create_object_string` 27 | 28 | [0.7.19]: https://github.com/sl-lang/sll/compare/sll-v0.7.18...sll-v0.7.19 29 | [#8]: https://github.com/sl-lang/sll/issues/8 30 | [#75]: https://github.com/sl-lang/sll/issues/75 31 | -------------------------------------------------------------------------------- /changelog/0.7.2.md: -------------------------------------------------------------------------------- 1 | # Sll [0.7.2] - 2022-02-04 2 | 3 | ## Added 4 | 5 | - Implemented `file$FLAG_NO_BUFFER` 6 | - Implemented `SLL_ASSEMBLY_FUNCTION_GET_ARGUMENT_COUNT`, `SLL_ASSEMBLY_FUNCTION_IS_VAR_ARG`, `SLL_FUNCTION_GET_ARGUMENT_COUNT`, `SLL_FUNCTION_GET_ARGUMENT_COUNT_RAW`, `SLL_FUNCTION_IS_VAR_ARG` and variable argument functions (`@@last-argument-name@@`) 7 | - Implemented `sll_object_to_array` and casting between custom types 8 | - New sandbox flags: `SLL_SANDBOX_FLAG_DISABLE_ENVIRONMENT`, `SLL_SANDBOX_FLAG_DISABLE_LOAD_LIBRARY`, `SLL_SANDBOX_FLAG_ENABLE_BUFFER_FILES`, `SLL_SANDBOX_FLAG_ENABLE_FILE_RENAME` and `SLL_SANDBOX_FLAG_ENABLE_FILE_COPY` 9 | 10 | ## Changed 11 | 12 | - Fixed constant string modification 13 | - Flags returned by `sll_get_sandbox_flags` and `sys$get_sandbox_flags` are a list of strings 14 | - Incorrect return code when printing help or version in the CLI 15 | - Renamed `sll_set_sandbox_flags` to `sll_set_sandbox_flag` 16 | - Setting a sandbox flag via `sll_set_sandbox_flag` no longer returns the current flags 17 | 18 | ## Removed 19 | 20 | - Call to an internal initializer function in `process.sll` 21 | - Internal sandbox flag values: `FLAG_DISABLE_FILE_IO`, `FLAG_ENABLE_STDIN_IO`, `FLAG_ENABLE_STDOUT_IO`, `FLAG_DISABLE_PATH_API` and `FLAG_DISABLE_PROCESS_API` 22 | - Unused `sort$default_sort_func` 23 | 24 | [0.7.2]: https://github.com/sl-lang/sll/compare/sll-v0.7.1...sll-v0.7.2 25 | -------------------------------------------------------------------------------- /changelog/0.7.20.md: -------------------------------------------------------------------------------- 1 | # Sll [0.7.20] - 2022-06-04 2 | 3 | ## Added 4 | 5 | - Ability to use assembly in extension modules 6 | - C interface library: `clib` ([#286]) 7 | - Implemented `audit$register_event` 8 | - Implemented `sll_gc_add_root`, `sll_gc_add_roots`, `sll_gc_collect`, `sll_gc_remove_root` and `sll_gc_remove_roots` ([#287]) 9 | - Implemented `SLL_ERROR_STRING`, `sll_error_from_string_pointer`, `sll_error_get_string_pointer` and `error$ERROR_STRING` 10 | - Tests ([#285]) 11 | 12 | ## Changed 13 | 14 | - Current dynamic library handle can be obtained by calling `sll_platform_load_library` with a `NULL` file path argument 15 | - Fixed CLI output when supplied a directory 16 | - Fixed issues with constant rebuilding of assembly files 17 | - Fixed memory leaks caused by circular references ([#287]) 18 | - Fixed stringification of circular references 19 | - Renamed `audit$BUILTIN_EVENTS` to `audit$EVENT_ARGUMENTS` 20 | - Thread, lock, barrier and semaphore creation functions now return error objects 21 | 22 | ## Removed 23 | 24 | - Deprecated `apt-key` is no longer used for repository keys 25 | 26 | [0.7.20]: https://github.com/sl-lang/sll/compare/sll-v0.7.19...sll-v0.7.20 27 | [#287]: https://github.com/sl-lang/sll/issues/287 28 | [#286]: https://github.com/sl-lang/sll/issues/286 29 | [#285]: https://github.com/sl-lang/sll/issues/285 30 | -------------------------------------------------------------------------------- /changelog/0.7.21.md: -------------------------------------------------------------------------------- 1 | # Sll [0.7.21] - 2022-06-11 2 | 3 | ## Added 4 | 5 | - CLI option to treat warnings as errors: `-E` or `--enable-errors` 6 | 7 | ## Changed 8 | 9 | - Build script compilation now uses optimization 10 | - Fixed `sll_object_get_field`, `sll_object_set_field` and `sll_object_to_array` to use the provided type table 11 | - Fixed issue with backslash escaping in `sll_api_process_start` 12 | - Funcion `sll_get_location` now accepts `NULL` arguments 13 | - Renamed `call_stack_type$return` to `call_stack_type$location` 14 | 15 | ## Removed 16 | 17 | - Call stack frames no longer contain the name of the function 18 | - Verbose output from module compilation 19 | 20 | [0.7.21]: https://github.com/sl-lang/sll/compare/sll-v0.7.20...sll-v0.7.21 21 | -------------------------------------------------------------------------------- /changelog/0.7.25.md: -------------------------------------------------------------------------------- 1 | # Sll [0.7.25] - 2022-07-09 2 | 3 | ## Added 4 | 5 | - Argument parsing modifier to parse signed integers: `-` 6 | - Cursor and window management APIs to the window extenion module 7 | - More optimizer rules 8 | 9 | ## Changed 10 | 11 | - Build script no longer uses nightly releases 12 | - Fixed `file$read` with asynchronous files 13 | - Fixed `sll_string_prepend_char` 14 | - Fixed changed file detection in the build script 15 | 16 | [0.7.25]: https://github.com/sl-lang/sll/compare/sll-v0.7.24...sll-v0.7.25 17 | -------------------------------------------------------------------------------- /changelog/0.7.26.md: -------------------------------------------------------------------------------- 1 | # Sll [0.7.26] - 2022-07-16 2 | 3 | ## Added 4 | 5 | - Ability to change window icons: `window_window$set_icon` 6 | - Funcion to retrive the platform-specific window context: `window_util$get_context` 7 | - Map containers: `SLL_MAP_CONTAINER_FLAG_XOR`, `SLL_MAP_CONTAINER_HASH_XOR`, `sll_map_container_hash_callback_t`, `sll_map_container_equal_t`, `sll_map_container_filter_callback_t`, `sll_map_container_t`, `sll_map_container_clear`, `sll_map_container_contains`, `sll_map_container_deinit`, `sll_map_container_delete`, `sll_map_container_filter`, `sll_map_container_get`, `sll_map_container_init`, `sll_map_container_iter`, `sll_map_container_iter_clear` and `sll_map_container_set` 8 | - New error: `SLL_ERROR_NOT_A_SOCKET` 9 | - Sll file handles created by `sll_file_to_handle` can now allocate file objects 10 | - Socket API 11 | 12 | ## Changed 13 | 14 | - Fixed variable deletion after infinite loops 15 | - Improved performance of API calls 16 | 17 | ## Removed 18 | 19 | - Obsolete TLS API 20 | 21 | [0.7.26]: https://github.com/sl-lang/sll/compare/sll-v0.7.25...sll-v0.7.26 22 | -------------------------------------------------------------------------------- /changelog/0.7.27.md: -------------------------------------------------------------------------------- 1 | # Sll [0.7.27] - 2022-07-23 2 | 3 | ## Added 4 | 5 | - Identifier type: `sll_identifier_table_length_t` 6 | 7 | ## Changed 8 | 9 | - Fixed critical uninitialized memory access bugs in API calls 10 | - Unified small and long identifier tables 11 | 12 | ## Removed 13 | 14 | - Identifier functiond: `sll_identifier_add_index`, `sll_identifier_create`, `sll_identifier_get_array_id`, `sll_identifier_get_array_index` 15 | - Identifier macros: `SLL_MAX_IDENTIFIER_LIST_LENGTH`, `SLL_MAX_SHORT_IDENTIFIER_LENGTH`, `SLL_IDENTIFIER_GET_ARRAY_ID`, `SLL_IDENTIFIER_GET_ARRAY_INDEX`, `SLL_IDENTIFIER_ADD_INDEX` and `SLL_CREATE_IDENTIFIER` 16 | - Identifier types: `sll_identifier_list_t` and `sll_identifier_list_length_t` 17 | 18 | [0.7.27]: https://github.com/sl-lang/sll/compare/sll-v0.7.26...sll-v0.7.27 19 | -------------------------------------------------------------------------------- /changelog/0.7.28.md: -------------------------------------------------------------------------------- 1 | # Sll [0.7.28] - 2022-07-30 2 | 3 | ## Added 4 | 5 | - Error raised during library initialization failure: `SLL_ERROR_INITIALIZATION` 6 | - Implemented `error$ERROR_INITIALIZATION` and `error$ERROR_NOT_A_SOCKET` 7 | - Implemented `sll_platform_socket_read` and `sll_platform_socket_write` 8 | - Implemented `sll_std_file_type_t` 9 | - Macro for checking if a node has children: `SLL_NODE_HAS_CHILDREN` 10 | 11 | ## Changed 12 | 13 | - Fixed API calls with multiples of 256 arguments 14 | - Fixed crashes related to modified registers in CLib function calls 15 | - Fixed file deadlocks 16 | - Fixed issue with environment variable creation via `sll_set_environment_variable` 17 | - Fixed socket address info lookup errors 18 | - *\[Windows only\]* Fixed socket initialization 19 | - Fixed unwanted frames in `error$create` and `error$from_internal` 20 | - Object type (`sll_object_t`) is now a pointer to a structure 21 | 22 | ## Removed 23 | 24 | - Unused macro constant: `SLL_MAX_SIZE` 25 | - Unused macros: `SLL_IS_OBJECT_TYPE_IF` and `SLL_IS_OBJECT_TYPE_NOT_TYPE` 26 | 27 | [0.7.28]: https://github.com/sl-lang/sll/compare/sll-v0.7.27...sll-v0.7.28 28 | -------------------------------------------------------------------------------- /changelog/0.7.29.md: -------------------------------------------------------------------------------- 1 | # Sll [0.7.29] - 2022-08-06 2 | 3 | ## Changed 4 | 5 | - Array and map elements now properly get generated when used as conditional ([#289]) 6 | - Assembly instruction and node types (`sll_assembly_instruction_t` and `sll_node_t`) are now pointers to structures 7 | 8 | ## Removed 9 | 10 | - Deprecated function: `sll_skip_node_const` 11 | 12 | [0.7.29]: https://github.com/sl-lang/sll/compare/sll-v0.7.28...sll-v0.7.29 13 | [#289]: https://github.com/sl-lang/sll/issues/289 14 | -------------------------------------------------------------------------------- /changelog/0.7.30.md: -------------------------------------------------------------------------------- 1 | # Sll [0.7.30] - 2022-08-13 2 | 3 | ## Changed 4 | 5 | - Fixed CLI invalid memory access 6 | 7 | [0.7.30]: https://github.com/sl-lang/sll/compare/sll-v0.7.29...sll-v0.7.30 8 | -------------------------------------------------------------------------------- /changelog/0.7.31.md: -------------------------------------------------------------------------------- 1 | # Sll [0.7.31] - 2022-08-20 2 | 3 | ## Added 4 | 5 | - GFX extension 6 | - Implemented `sll_error_raise` and `sll_error_raise_bool` 7 | - Implemented `clib/clib.sll`, `gfx/gfx.sll` and `window_manager/window_manager.sll` 8 | - Implemneted `weakref$NIL_REF` 9 | 10 | ## Changed 11 | 12 | - Renamed the `window` extension to `window_manager` 13 | 14 | ## Removed 15 | 16 | - Empty file: `clib/structure.sll` 17 | 18 | [0.7.31]: https://github.com/sl-lang/sll/compare/sll-v0.7.30...sll-v0.7.31 19 | -------------------------------------------------------------------------------- /changelog/0.7.32.md: -------------------------------------------------------------------------------- 1 | # Sll [0.7.32] - 2022-08-27 2 | 3 | ## Added 4 | 5 | - Ability to add documentation comments to type declarations 6 | - GFX buffers, pipelines and shaders 7 | - GFX code examples 8 | - Implemented `weakref$get_default` 9 | 10 | ## Changed 11 | 12 | - Fixed `path$size` 13 | - Fixed bug with the following string formatting expression: `%+f` 14 | - Fixed weak reference object reference counting bugs 15 | - Fixed window manager mouse button flags 16 | - Sequential documentation comments are now concatenated instead of being ignored 17 | 18 | [0.7.32]: https://github.com/sl-lang/sll/compare/sll-v0.7.31...sll-v0.7.32 19 | -------------------------------------------------------------------------------- /changelog/0.8.0.md: -------------------------------------------------------------------------------- 1 | # Sll [0.8.0] - 2022-09-03 2 | 3 | ## Added 4 | 5 | - Support for BGR and BGRA data types: `gfx:data_type$FLAG_BGR` 6 | - UI extension 7 | - Uniform buffer, texture and sampler support to the GFX extension 8 | 9 | ## Changed 10 | 11 | - Fixed GFX buffer allocation granularity 12 | - Fixed Vulkan pipeline descriptor allocation 13 | - Vulkan error `VK_ERROR_OUT_OF_DATE_KHR` is now properly handled 14 | 15 | [0.8.0]: https://github.com/sl-lang/sll/compare/sll-v0.7.32...sll-v0.8.0 16 | -------------------------------------------------------------------------------- /changelog/0.8.1.md: -------------------------------------------------------------------------------- 1 | # Sll [0.8.1] - 2022-09-10 2 | 3 | ## Added 4 | 5 | - Ability to add etxtures to the UI 6 | - Ability to create UI elements without the parent UI, for layout calculation purposes 7 | - Ability to serialize and deserialize UI: `ui:serialize$serialize` and `ui:serialize$deserialize` 8 | - Functions to update descriptors and push constants: `gfx:pipeline$update_descriptor` and `gfx:pipeline$update_push_constant` 9 | - Implemented filter layouts in the UI extension 10 | - Push constant allocation to the GFX pipeline config 11 | - Support for shader arrays in GFX pipeline config 12 | - UI elements: `ui:element:button`, `ui:element:slider` and `ui:element:texture` 13 | 14 | ## Updated 15 | 16 | - All UI layout functions and types are now located in `ui/layout.sll` 17 | - Fixed incorrect window callback calls 18 | - Fixed window manager event loop crashes 19 | - Fixed window manager mouse-button related events 20 | - *\[Linux Only\]* Fixed X11 lag when using a GFX context 21 | - *\[Linux Only\]* Fixed X11 negative mouse position overflow 22 | - Merged `ui/position.sll` and `ui/size.sll` 23 | - Renamed `ui:element:rectangle` to `ui:element:color` 24 | 25 | ## Removed 26 | 27 | - Unneeded file: `ui/size.sll` 28 | - Window manager geometry-change callabck: `window_manager_window_type$callbacks$geometry` 29 | 30 | [0.8.1]: https://github.com/sl-lang/sll/compare/sll-v0.8.0...sll-v0.8.1 31 | -------------------------------------------------------------------------------- /changelog/0.8.2.md: -------------------------------------------------------------------------------- 1 | # Sll [0.8.2] - 2022-09-17 2 | 3 | ## Added 4 | 5 | - Ability to enable GFX debug mode in `ui:core$create` and `ui:serialize$deserialize` 6 | - Ability to specify element-specific callbacks in the UI: `element$base$callbacks` 7 | - DS4 controller interface library: `ds4` 8 | - Font rasterizer library: `font` 9 | - Format code to read a 32-bit float from an array of structures: `F` 10 | - Moved all UI color-related types and functions to `ui/rgb.sll` 11 | - New UI elements: `ui:element:gradient` and `ui:element:text` 12 | 13 | ## Changed 14 | 15 | - Fixed dynamic file buffers 16 | - Fixed GFX stale object references and danagling pointers 17 | - Fixed signed `dats_file` read functions 18 | - Fixed UI serialization of named elements 19 | - Fixed UI slider movement and resizing 20 | - Floored division resulting in a floating-point number is now be correctly rounded down 21 | - Improved GFX texture synchronization performance 22 | - Improved performance of UI renderer 23 | - Improved UI serializer algorithm 24 | - Renamed `ui:core$set_background` to `ui:core$set_background_color` 25 | - UI `ui:element:color` element now accepts per-vertex colors 26 | - UI color and position types are now serializeable 27 | 28 | [0.8.2]: https://github.com/sl-lang/sll/compare/sll-v0.8.1...sll-v0.8.2 29 | -------------------------------------------------------------------------------- /changelog/0.8.3.md: -------------------------------------------------------------------------------- 1 | # Sll [0.8.3] - 2022-09-24 2 | 3 | ## Added 4 | 5 | - Ability to properly scale fonts 6 | - Ability to render only part of a GFX index buffer 7 | 8 | ## Changed 9 | 10 | - Fixed font atlas generaion 11 | - Fixed transparent UI textures & fonts 12 | - Improved font atlas creation 13 | - Improved font load times 14 | - Internal font glyph representation is now independent of the font size 15 | - Restructured the `font` module 16 | 17 | [0.8.3]: https://github.com/sl-lang/sll/compare/sll-v0.8.2...sll-v0.8.3 18 | -------------------------------------------------------------------------------- /changelog/0.8.4.md: -------------------------------------------------------------------------------- 1 | # Sll [0.8.4] - 2022-10-01 2 | 3 | ## Changed 4 | 5 | - Fixed stringification of `statistics$linear_regression_type` 6 | 7 | [0.8.4]: https://github.com/sl-lang/sll/compare/sll-v0.8.3...sll-v0.8.4 8 | -------------------------------------------------------------------------------- /changelog/0.8.5.md: -------------------------------------------------------------------------------- 1 | # Sll [0.8.5] - 2022-10-08 2 | 3 | *Nothing* 4 | 5 | [0.8.5]: https://github.com/sl-lang/sll/compare/sll-v0.8.4...sll-v0.8.5 6 | -------------------------------------------------------------------------------- /changelog/0.8.6.md: -------------------------------------------------------------------------------- 1 | # Sll [0.8.6] - 2022-10-15 2 | 3 | *Nothing* 4 | 5 | [0.8.6]: https://github.com/sl-lang/sll/compare/sll-v0.8.5...sll-v0.8.6 6 | -------------------------------------------------------------------------------- /changelog/0.8.7.md: -------------------------------------------------------------------------------- 1 | # Sll [0.8.7] - 2022-10-22 2 | 3 | *Nothing* 4 | 5 | [0.8.7]: https://github.com/sl-lang/sll/compare/sll-v0.8.6...sll-v0.8.7 6 | 7 | -------------------------------------------------------------------------------- /changelog/0.8.8.md: -------------------------------------------------------------------------------- 1 | # Sll [0.8.8] - 2022-10-30 2 | 3 | *Nothing* 4 | 5 | [0.8.8]: https://github.com/sl-lang/sll/compare/sll-v0.8.7...sll-v0.8.8 6 | 7 | -------------------------------------------------------------------------------- /changelog/0.8.9.md: -------------------------------------------------------------------------------- 1 | # Sll [0.8.9] - 2022-11-06 2 | 3 | *Nothing* 4 | 5 | [0.8.9]: https://github.com/sl-lang/sll/compare/sll-v0.8.8...sll-v0.8.9 6 | 7 | -------------------------------------------------------------------------------- /changelog/latest.md: -------------------------------------------------------------------------------- 1 | # Sll [0.8.10] - Ongoing 2 | 3 | *Nothing* 4 | 5 | [0.8.10]: https://github.com/sl-lang/sll/compare/sll-v0.8.9...main 6 | 7 | -------------------------------------------------------------------------------- /examples/_internal_test/background_audit_logger.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "atexit.sll" 3 | "audit.sll" 4 | "file.sll" 5 | "string.sll" 6 | "types.sll" 7 | ) 8 | 9 | 10 | 11 | (= logger_file (<- file$open "build/audit_log.txt" "w")) 12 | (= max_len 0) 13 | 14 | 15 | 16 | (<- audit$register (,,, name args 17 | (? (> ($ name) max_len) (= max_len ($ name))) 18 | (<- file$write logger_file (+ 19 | (<- string$pad_left (+ 20 | name 21 | ':' 22 | ) (+ max_len 2)) 23 | (<- string$str args) 24 | '\n' 25 | )) 26 | )) 27 | (<- atexit$register (,,, 28 | (<- file$close logger_file) 29 | )) 30 | -------------------------------------------------------------------------------- /examples/_internal_test/import.sll: -------------------------------------------------------------------------------- 1 | (:> "Loaded!\n") 2 | (<- (,,, (:> "External Function\n"))) 3 | (-> (= i 0) (< i 10) { 4 | (:> "i = " i "\n") 5 | (++ i) 6 | }) 7 | -------------------------------------------------------------------------------- /examples/add_two_numbers/main.sll: -------------------------------------------------------------------------------- 1 | ; Sll Number Addition Example 2 | ; @krzem5, 2021-10-31 3 | 4 | 5 | 6 | (= a 5) 7 | (= b 4) 8 | 9 | 10 | 11 | (:> a " + " b " = " (+ a b) "\n") 12 | -------------------------------------------------------------------------------- /examples/address_info_lookup/main.sll: -------------------------------------------------------------------------------- 1 | ; Sll `socket$getaddrinfo` example 2 | ; @krzem5, 2022-07-24 3 | 4 | 5 | 6 | (--- "socket.sll") 7 | 8 | 9 | 10 | (= NODE "www.example.com") 11 | (= SERVICE "80") 12 | 13 | 14 | 15 | (:> (<- socket$getaddrinfo NODE SERVICE) '\n') 16 | -------------------------------------------------------------------------------- /examples/audit_library/_compile.sll: -------------------------------------------------------------------------------- 1 | ; Sll Audit Library Example 2 | ; @krzem5, 2022-04-05 3 | 4 | 5 | 6 | (--- 7 | "process.sll" 8 | "string.sll" 9 | "sys.sll" 10 | ) 11 | 12 | 13 | 14 | (<- process$start (?: (=== sys$PLATFORM "windows") 15 | [ 16 | "cl.exe" 17 | "/nologo" 18 | "/I" "build" 19 | "/D_USRDLL" 20 | "/D_WINDLL" 21 | "examples/audit_library/lib.c" 22 | (<- string$format "build/sll-%u.%u.%u.lib" sys$VERSION$major sys$VERSION$minor sys$VERSION$patch) 23 | "/Fobuild/lib.obj" 24 | "/link" 25 | "/DLL" 26 | "/OUT:build/lib.dll" 27 | ] 28 | [ 29 | "gcc" 30 | "-shared" 31 | "-fvisibility=hidden" 32 | "-fPIC" 33 | "-I" "build" 34 | (<- string$format "build/sll-%u.%u.%u.so" sys$VERSION$major sys$VERSION$minor sys$VERSION$patch) 35 | "examples/audit_library/lib.c" 36 | "-o" "build/lib.so" 37 | ] 38 | )) 39 | 40 | (<- process$start [ 41 | (?: (=== sys$PLATFORM "windows") "build/sll.exe" "build/sll") 42 | "-L" (+ "build/lib." sys$LIBRARY_EXTENSION) 43 | "-v" 44 | "examples/audit_library/main.sll" 45 | ]) 46 | -------------------------------------------------------------------------------- /examples/audit_library/lib.c: -------------------------------------------------------------------------------- 1 | /* 2 | Sll Audit Library Example 3 | @krzem5, 2022-04-05 4 | */ 5 | 6 | 7 | 8 | #include 9 | #include 10 | 11 | 12 | 13 | #ifdef _MSC_VER 14 | #define EXPORT_SYMBOL __declspec(dllexport) 15 | #else 16 | #define EXPORT_SYMBOL __attribute__((visibility("default"))) 17 | #endif 18 | 19 | 20 | 21 | EXPORT_SYMBOL void SLL_ABI_AUDIT_CALL(const sll_string_t* nm,const sll_array_t* args){ 22 | sll_file_write_format(sll_stdout,SLL_CHAR("!!! {%s} "),NULL,nm->data); 23 | sll_object_t tmp=sll_array_to_object(args); 24 | sll_string_t str; 25 | sll_api_string_convert(&tmp,1,&str); 26 | sll_release_object(tmp); 27 | sll_file_write(sll_stderr,str.data,str.length*sizeof(sll_char_t),NULL); 28 | sll_free_string(&str); 29 | sll_file_write_char(sll_stderr,'\n',NULL); 30 | } 31 | 32 | 33 | 34 | EXPORT_SYMBOL void SLL_ABI_AUDIT_INIT(void){ 35 | SLL_LOG("Load Audit library..."); 36 | } 37 | -------------------------------------------------------------------------------- /examples/audit_library/main.sll: -------------------------------------------------------------------------------- 1 | ; Sll Audit Library Example 2 | ; @krzem5, 2022-04-05 3 | 4 | 5 | 6 | (--- "path.sll") 7 | 8 | 9 | 10 | (:> (<- path$list_dir "." false) '\n') 11 | -------------------------------------------------------------------------------- /examples/fibonacci/main.sll: -------------------------------------------------------------------------------- 1 | ; Sll Fibonacci Sequence Example 2 | ; @krzem5, 2021-10-31 3 | 4 | 5 | 6 | (= fib (,,, n { 7 | (= a 1) 8 | (= b 1) 9 | (-> (= i 1) (< i n) { 10 | (= c (+ a b)) 11 | (= a b) 12 | (= b c) 13 | (++ i) 14 | }) 15 | (@@ b) 16 | })) 17 | 18 | 19 | 20 | (= N 10) 21 | (:> "fib(" N ") = " (<- fib N) "\n") 22 | -------------------------------------------------------------------------------- /examples/fibonacci_recursive/main.sll: -------------------------------------------------------------------------------- 1 | ; Sll Recursive Fibonacci Sequence Example 2 | ; @krzem5, 2021-10-31 3 | 4 | 5 | 6 | (= fib (,,, n { 7 | (? 8 | (< n 2)(@@ n) 9 | (@@ (+ (<- fib (- n 1)) (<- fib (- n 2)))) 10 | ) 11 | })) 12 | 13 | 14 | 15 | (= N 10) 16 | (:> "fib(" N ") = " (<- fib N) "\n") 17 | -------------------------------------------------------------------------------- /examples/file_size/main.sll: -------------------------------------------------------------------------------- 1 | ; Sll File Size Example 2 | ; @krzem5, 2021-12-01 3 | 4 | 5 | 6 | (--- "path.sll") 7 | 8 | 9 | 10 | (= FILE_PATH "./main.sll") 11 | 12 | (:> "Size of '" (<- path$absolute FILE_PATH) "' is " (<- path$size FILE_PATH) " bytes.\n") 13 | -------------------------------------------------------------------------------- /examples/fizzbuzz/main.sll: -------------------------------------------------------------------------------- 1 | ; Sll FizzBuzz Problem Example 2 | ; @krzem5, 2021-12-29 3 | 4 | 5 | 6 | (= N 20) 7 | 8 | 9 | 10 | (-> (= i 1) (<= i N) { 11 | (= num 1) 12 | (? (% i 3) { 13 | (= num 0) 14 | (:> "Fizz") 15 | }) 16 | (? (% i 5) { 17 | (:> "Buzz") 18 | } num { 19 | (:> i) 20 | }) 21 | (:> "\n") 22 | (++ i) 23 | }) 24 | -------------------------------------------------------------------------------- /examples/gfx_triangle/shaders/fragment.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | 4 | 5 | layout (location=0) in vec3 in_color; 6 | layout (location=0) out vec4 out_color; 7 | 8 | 9 | 10 | void main(){ 11 | out_color=vec4(in_color,1.0); 12 | } 13 | -------------------------------------------------------------------------------- /examples/gfx_triangle/shaders/vertex.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | 4 | 5 | layout (location=0) in vec3 in_pos; 6 | layout (location=1) in vec3 in_color; 7 | layout (location=0) out vec3 out_color; 8 | 9 | 10 | 11 | void main(void){ 12 | out_color=in_color; 13 | gl_Position=vec4(in_pos.xyz,1.0); 14 | } 15 | -------------------------------------------------------------------------------- /examples/hello_world/main.sll: -------------------------------------------------------------------------------- 1 | ; Sll Hello World Example 2 | ; @krzem5, 2021-10-29 3 | 4 | 5 | 6 | (:> "Hello, World!\n") 7 | -------------------------------------------------------------------------------- /examples/list_files/main.sll: -------------------------------------------------------------------------------- 1 | ; Sll Recursive File Listing Example 2 | ; @krzem5, 2022-01-07 3 | 4 | 5 | 6 | (--- 7 | "path.sll" 8 | "sort.sll" 9 | ) 10 | 11 | 12 | 13 | (= file_and_size_type (&: 14 | (~ string_type) fp 15 | (~ int_type) sz 16 | )) 17 | 18 | 19 | 20 | (= FILE_DIRECTORY ".") 21 | 22 | 23 | 24 | (= format_bytes (,,, sz (@@ (?: 25 | (< sz (<< 1 10)) (+ sz " b") 26 | (< sz (<< 1 20)) (+ (>> sz 10) " kb") 27 | (< sz (<< 1 30)) (+ (>> sz 20) " Mb") 28 | (+ (>> sz 30) " Gb") 29 | )))) 30 | 31 | 32 | 33 | (= file_list (<- path$list_dir FILE_DIRECTORY true)) 34 | (= array ([> (= i 0) (< i ($ file_list)) 35 | (= k (: file_list i)) 36 | (++ i) 37 | (. file_and_size_type 38 | (<- path$absolute k) 39 | (<- path$size k) 40 | ) 41 | )) 42 | (<- sort$sort array false true (,,, k (@@ k$sz))) 43 | (-> (= i 0) (< i ($ array)) 44 | (= e (: array i)) 45 | (:> e$fp " -> " (<- format_bytes e$sz) "\n") 46 | (++ i) 47 | ) 48 | -------------------------------------------------------------------------------- /examples/multiplication_table/main.sll: -------------------------------------------------------------------------------- 1 | ; Sll Multiplication Table Calculator Example 2 | ; @krzem5, 2021-10-31 3 | 4 | 5 | 6 | (= N 10) 7 | (-> (= i 1) (<= i N) { 8 | (-> (= j 1) (<= j N) { 9 | (:> i " * " j " = " (* i j) "\n") 10 | (++ j) 11 | }) 12 | (++ i) 13 | }) 14 | -------------------------------------------------------------------------------- /examples/quiz_game/data.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "Computer Component Trivia", 4 | "questions": [ 5 | { 6 | "text": "What does 'PCI' stand for?", 7 | "answers": [ 8 | "Preconnetion Checksum Insertion", 9 | "Port Connection Interface", 10 | "Peripheral Component Interconnect", 11 | "Packet Counter Injection" 12 | ], 13 | "correct": 2 14 | }, 15 | { 16 | "text": "What does the Southbridge connect?", 17 | "answers": [ 18 | "PSU to the CPU", 19 | "USB to the Northbridge", 20 | "Northbridge to the CPU", 21 | "RAM to the BIOS" 22 | ], 23 | "correct": 1 24 | } 25 | ] 26 | }, 27 | { 28 | "name": "Computer History Trivia", 29 | "questions": [ 30 | { 31 | "text": "When was the first computer invented?", 32 | "answers": [ 33 | "1941", 34 | "1943", 35 | "1945" 36 | ], 37 | "correct": 1 38 | }, 39 | { 40 | "text": "What was the first computer to use a color display?", 41 | "answers": [ 42 | "Apple I", 43 | "ENIAC", 44 | "Windows 95" 45 | ], 46 | "correct": 0 47 | }, 48 | { 49 | "text": "When was the Touch Screen invented?", 50 | "answers": [ 51 | "1973", 52 | "2001", 53 | "1948", 54 | "1965" 55 | ], 56 | "correct": 3 57 | } 58 | ] 59 | } 60 | ] 61 | -------------------------------------------------------------------------------- /examples/signum_function/main.sll: -------------------------------------------------------------------------------- 1 | ; Sll Signum Function Implementation Example 2 | ; @krzem5, 2021-10-31 3 | 4 | 5 | 6 | (= signum (,,, x 7 | (? 8 | (< x 0) (@@ -1) 9 | (= x 0) (@@ 0) 10 | (@@ 1) 11 | ) 12 | )) 13 | 14 | 15 | 16 | (= x 5) 17 | (:> "signum(" x ") = " (<- signum x) "\n") 18 | -------------------------------------------------------------------------------- /examples/window/main.sll: -------------------------------------------------------------------------------- 1 | ; Sll Simple Window Example 2 | ; @krzem5, 2022-07-08 3 | 4 | 5 | 6 | (--- 7 | "window_manager/event.sll" 8 | "window_manager/keyboard.sll" 9 | "window_manager/window.sll" 10 | ) 11 | 12 | 13 | 14 | (= window (<- window_manager:window$create [0 0 900 600] nil "Example Window" true)) 15 | (= window$callbacks$key_down (,,, window key 16 | (? (=== key window_manager:keyboard$KEY_ESCAPE) (<- window_manager:window$destroy window)) 17 | )) 18 | (>< 19 | (<- window_manager:event$poll true) 20 | ) 21 | -------------------------------------------------------------------------------- /src/_build/bundle.ps1: -------------------------------------------------------------------------------- 1 | Set-Location -Path "build" 2 | $version = (Get-Content version -Raw) 3 | $config = @{ 4 | Path = "sll.exe", "sllw.exe", "sll-$version.dll", "sll-$version.lib", "lib\", "lib_debug\", "sys_lib\" 5 | CompressionLevel = "Optimal" 6 | DestinationPath = "..\windows.zip" 7 | } 8 | Compress-Archive @config 9 | Set-Location -Path ".." 10 | -------------------------------------------------------------------------------- /src/_build/bundle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ "$(uname -s)" == "Darwin" ]; then 3 | platform="darwin" 4 | else 5 | platform="linux" 6 | fi 7 | ( 8 | cd build||exit 9 | zip -9 "../$platform.zip" sll "sll-$(cat version).so" sll.h $(find . -name "*.slb" -type f -and -not -path "./_sll_runtime*/*" -or -name "*.*" -path "./sys_lib/*") 10 | ) 11 | -------------------------------------------------------------------------------- /src/_build/setup_win.ps1: -------------------------------------------------------------------------------- 1 | Invoke-WebRequest "https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/win64/nasm-2.15.05-win64.zip" -OutFile "$ENV:TMP/nasm.zip" 2 | Expand-Archive -Force -LiteralPath "$ENV:TMP/nasm.zip" -DestinationPath "$ENV:TMP/nasm" 3 | $vcvarsall = (& "${Env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -products '*' -latest -prerelease -property installationPath) + "\VC\Auxiliary\Build\vcvarsall.bat" 4 | foreach ($elem in @(& "$vcvarsall" x64 "&&" set)) { 5 | $elem=$elem.Split("=") 6 | if ($elem[0] -eq "PATH"){ 7 | $PATH=$elem[1] 8 | } 9 | elseif ($elem[0] -eq "INCLUDE"){ 10 | $INCLUDE=$elem[1] 11 | } 12 | elseif ($elem[0] -eq "LIB"){ 13 | $LIB=$elem[1] 14 | } 15 | elseif ($elem[0] -eq "LIBPATH"){ 16 | $LIBPATH=$elem[1] 17 | } 18 | } 19 | Add-Content "$ENV:GITHUB_ENV" "`nPATH=$ENV:TMP/nasm/nasm-2.15.05/;$PATH`nINCLUDE=$INCLUDE`nLIB=$LIB`nLIBPATH=$LIBPATH`n" 20 | -------------------------------------------------------------------------------- /src/_build/shader.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "@build-script/config.sll" 3 | "@build-script/util.sll" 4 | "file.sll" 5 | "log.sll" 6 | "path.sll" 7 | "string.sll" 8 | "types.sll" 9 | ) 10 | 11 | 12 | 13 | (= shader_module_type (&: 14 | (~ func_type) compile 15 | )) 16 | 17 | 18 | 19 | (= compile (,,, source_file_path target_file_path 20 | (<- log$log "Compiling GLSL shader from '" source_file_path "'...") 21 | (<- log$log " Compiling shader...") 22 | (? (<- util$execute (+ config$GLSL_COMPILATION_COMMAND [source_file_path])) (<- util$fail_and_exit)) 23 | (<- log$log " Loading compiled shader...") 24 | (= data (<- file$read (<- file$open config$GLSL_COMPILATION_SHADER_FILE_PATH "r"))) 25 | (= name (: (<- path$split target_file_path) 1)) 26 | (= name (<- string$upper_case (: name 0 (<- string$index name '.')))) 27 | (<- log$log " Generating code in '" target_file_path "' as '" name "'...") 28 | (= fh (<- file$open target_file_path "w")) 29 | (<- file$write fh "(= " name ' ' (: (<- string$str [data]) 1 -1) ")\n(## " name ")\n") 30 | )) 31 | 32 | 33 | 34 | (= shader (. shader_module_type 35 | compile 36 | )) 37 | (## shader) 38 | -------------------------------------------------------------------------------- /src/cli/rsrc/app.rc: -------------------------------------------------------------------------------- 1 | EXEICON ICON "main_icon.ico" 2 | -------------------------------------------------------------------------------- /src/cli/rsrc/main_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sl-lang/sll/977da513783b100167f25ad5c45f9934108e2420/src/cli/rsrc/main_icon.ico -------------------------------------------------------------------------------- /src/ext/clib/function_table.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | 7 | 8 | static const sll_internal_function_descriptor_t _internal_function_table[]={ 9 | { 10 | SLL_CHAR("clib:function_call"), 11 | clib_api_function_call, 12 | SLL_CHAR("QQ#a|o") 13 | }, 14 | { 15 | SLL_CHAR("clib:library_get_loaded_list"), 16 | clib_api_library_get_loaded_list, 17 | SLL_CHAR("|a") 18 | }, 19 | { 20 | SLL_CHAR("clib:library_get_sll_handle"), 21 | clib_api_library_get_sll_handle, 22 | SLL_CHAR("|Q") 23 | }, 24 | { 25 | SLL_CHAR("clib:library_load"), 26 | clib_api_library_load, 27 | SLL_CHAR("#s|~a") 28 | }, 29 | { 30 | SLL_CHAR("clib:library_lookup_symbol"), 31 | clib_api_library_lookup_symbol, 32 | SLL_CHAR("Q#s|Q") 33 | }, 34 | { 35 | SLL_CHAR("clib:library_unload"), 36 | clib_api_library_unload, 37 | SLL_CHAR("Q|Q") 38 | } 39 | }; 40 | 41 | 42 | 43 | static const sll_internal_function_table_descriptor_t _internal_function_table_descriptor_data={ 44 | (const sll_internal_function_descriptor_t*)(&_internal_function_table), 45 | 6 46 | }; 47 | 48 | 49 | 50 | __CLIB_EXTERNAL const sll_internal_function_table_descriptor_t* SLL_ABI_INTERNAL_FUNCTION_TABLE_DESCRIPTOR=&_internal_function_table_descriptor_data; 51 | -------------------------------------------------------------------------------- /src/ext/clib/include/clib/common.h: -------------------------------------------------------------------------------- 1 | #ifndef __CLIB_COMMON_H__ 2 | #define __CLIB_COMMON_H__ 1 3 | 4 | 5 | 6 | #ifdef __SLL_BUILD_WINDOWS 7 | #define __CLIB_EXTERNAL __declspec(dllexport) 8 | #define __CLIB_API_CALL 9 | #else 10 | #define __CLIB_EXTERNAL __attribute__((visibility("default"))) 11 | #define __CLIB_API_CALL __attribute__((ms_abi)) 12 | #endif 13 | 14 | 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /src/ext/clib/include/clib/function.h: -------------------------------------------------------------------------------- 1 | #ifndef __CLIB_FUNCTION_H__ 2 | #define __CLIB_FUNCTION_H__ 1 3 | #include 4 | #include 5 | 6 | 7 | 8 | __CLIB_API_CALL sll_object_t clib_api_function_call(void* address,sll_bool_t return_type,const sll_array_t* args); 9 | 10 | 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /src/ext/clib/include/clib/library.h: -------------------------------------------------------------------------------- 1 | #ifndef __CLIB_LIBRARY_H__ 2 | #define __CLIB_LIBRARY_H__ 1 3 | #include 4 | #include 5 | 6 | 7 | 8 | __CLIB_API_CALL void clib_api_library_get_loaded_list(sll_array_t* out); 9 | 10 | 11 | 12 | __CLIB_API_CALL sll_library_handle_t clib_api_library_get_sll_handle(void); 13 | 14 | 15 | 16 | __CLIB_API_CALL sll_error_t clib_api_library_load(const sll_string_t* name,sll_library_handle_t* out); 17 | 18 | 19 | 20 | __CLIB_API_CALL void* clib_api_library_lookup_symbol(sll_library_handle_t lib,const sll_string_t* name); 21 | 22 | 23 | 24 | __CLIB_API_CALL sll_error_t clib_api_library_unload(sll_library_handle_t lib); 25 | 26 | 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/ext/clib/lib/_library.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "map.sll" 3 | "string.sll" 4 | "types.sll" 5 | ) 6 | 7 | 8 | 9 | (= _lib_map <>) 10 | 11 | 12 | 13 | (= clib_library_type (&: 14 | (,,, data 15 | (@@ (?: data$_handle 16 | (<- string$format "" data$_handle data$file_path) 17 | (<- string$format "" data$file) 18 | )) 19 | ) @@string@@ 20 | (,,, data 21 | (? (! data$_handle) (@@ false)) 22 | (<- map$remove _lib_map data$file_path) 23 | (<- (... "clib:unload_library") data$_handle) 24 | ) @@delete@@ 25 | (~ string_type) file_path 26 | (~ map_type) symbols 27 | int_type _handle 28 | )) 29 | 30 | 31 | 32 | (## _lib_map clib_library_type) 33 | -------------------------------------------------------------------------------- /src/ext/clib/lib/_load_library.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "audit.sll" 3 | "path.sll" 4 | "string.sll" 5 | "sys.sll" 6 | "thread.sll" 7 | ) 8 | 9 | 10 | 11 | (= library_file_path (<- path$join 12 | (: (<- path$split sys$LIBRARY) 0) 13 | (<- string$format "sys_lib/clib-%u.%u.%u%s" sys$VERSION$major sys$VERSION$minor sys$VERSION$patch sys$LIBRARY_EXTENSION) 14 | )) 15 | (= err (<- sys$load_library library_file_path)) 16 | (? err { 17 | (:> "Error while loading library '" library_file_path "':\n" err '\n') 18 | (@@ 1) 19 | }) 20 | 21 | (<- audit$register_event "clib.library.load" "name" "handle" "module_path") 22 | (<- audit$register_event "clib.library.load.error" "name" "error") 23 | (<- audit$register_event "clib.library.lookup" "handle" "name" "address") 24 | (<- audit$register_event "clib.library.unlookup" "handle") 25 | -------------------------------------------------------------------------------- /src/ext/clib/lib/_setup_extension_libraries.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "clib/_library.sll" 3 | "clib/_load_library.sll" 4 | "array.sll" 5 | "audit.sll" 6 | "weakref.sll" 7 | ) 8 | 9 | 10 | 11 | (= _loaded_ext_libraries (<- (... "clib:library_get_loaded_list"))) 12 | (= _ext_lib_objects []) 13 | (-> (= i 0) (< i ($ _loaded_ext_libraries)) 14 | (= data (: _loaded_ext_libraries i)) 15 | (= lib (. clib_library_type 16 | (: data 0) 17 | <> 18 | (: data 1) 19 | )) 20 | (= (: _lib_map (: data 0)) (<- weakref$ref lib)) 21 | (<- array$push _ext_lib_objects lib) 22 | (++ i) 23 | ) 24 | 25 | (<- audit$register (,,, name data 26 | (? (!== name "sll.sys.library.load") (@@)) 27 | (= lib (. clib_library_type 28 | data$path 29 | <> 30 | data$handle 31 | )) 32 | (= (: _lib_map data$path) (<- weakref$ref lib)) 33 | (<- array$push _ext_lib_objects lib) 34 | )) 35 | -------------------------------------------------------------------------------- /src/ext/clib/lib/clib.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "clib/function.sll" 3 | "clib/library.sll" 4 | "clib/types.sll" 5 | ) 6 | 7 | 8 | 9 | (= clib_module_type (&: 10 | (~ (:? clib:function)) function 11 | (~ (:? clib:library)) library 12 | (~ (:? clib:types)) types 13 | )) 14 | 15 | 16 | 17 | (= clib (. clib_module_type 18 | clib:function 19 | clib:library 20 | clib:types 21 | )) 22 | (## clib) 23 | -------------------------------------------------------------------------------- /src/ext/clib/lib/header/stddef.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "clib/types.sll" 3 | "types.sll" 4 | ) 5 | 6 | 7 | 8 | (= stddef.h_module_type (&: 9 | (~ clib:types$clib_type) max_align_t 10 | (~ clib:types$clib_type) ptrdiff_t 11 | (~ clib:types$clib_type) size_t 12 | (~ clib:types$clib_type) ssize_t 13 | (~ clib:types$clib_type) wchar_t 14 | (~ clib:types$clib_type) wint_t 15 | (~ object_type) NULL 16 | )) 17 | 18 | 19 | 20 | (= stddef.h (. stddef.h_module_type 21 | clib:types$unsigned_long_long_int 22 | clib:types$long_long_int 23 | clib:types$unsigned_long_long_int 24 | clib:types$long_long_int 25 | clib:types$int 26 | clib:types$unsigned_int 27 | nil 28 | )) 29 | (## stddef.h) 30 | -------------------------------------------------------------------------------- /src/ext/clib/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | 6 | __CLIB_EXTERNAL sll_bool_t SLL_ABI_INIT(sll_version_t version){ 7 | return (version==SLL_VERSION); 8 | } 9 | -------------------------------------------------------------------------------- /src/ext/ds4/.extension_data.json: -------------------------------------------------------------------------------- 1 | { 2 | "installation_scripts": { 3 | "linux": "install/linux.sh" 4 | }, 5 | "platform_directories": { 6 | "darwin": "platform/darwin", 7 | "linux": "platform/linux", 8 | "windows": "platform/windows" 9 | }, 10 | "extra_link_options": { 11 | "linux": ["-ludev"], 12 | "windows": ["setupapi.lib","hid.lib"] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/ext/ds4/function_table.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | 6 | 7 | static const sll_internal_function_descriptor_t _internal_function_table[]={ 8 | { 9 | SLL_CHAR("ds4:device_list"), 10 | ds4_api_device_list, 11 | SLL_CHAR("|a") 12 | } 13 | }; 14 | 15 | 16 | 17 | static const sll_internal_function_table_descriptor_t _internal_function_table_descriptor_data={ 18 | (const sll_internal_function_descriptor_t*)(&_internal_function_table), 19 | 1 20 | }; 21 | 22 | 23 | 24 | __DS4_EXTERNAL const sll_internal_function_table_descriptor_t* SLL_ABI_INTERNAL_FUNCTION_TABLE_DESCRIPTOR=&_internal_function_table_descriptor_data; 25 | -------------------------------------------------------------------------------- /src/ext/ds4/include/ds4/common.h: -------------------------------------------------------------------------------- 1 | #ifndef __DS4_COMMON_H__ 2 | #define __DS4_COMMON_H__ 1 3 | 4 | 5 | 6 | #ifdef __SLL_BUILD_WINDOWS 7 | #define __DS4_EXTERNAL __declspec(dllexport) 8 | #define __DS4_API_CALL 9 | #else 10 | #define __DS4_EXTERNAL __attribute__((visibility("default"))) 11 | #define __DS4_API_CALL __attribute__((ms_abi)) 12 | #endif 13 | 14 | 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /src/ext/ds4/include/ds4/device.h: -------------------------------------------------------------------------------- 1 | #ifndef __DS4_DEVICE_H__ 2 | #define __DS4_DEVICE_H__ 1 3 | #include 4 | #include 5 | 6 | 7 | 8 | __DS4_API_CALL void ds4_api_device_list(sll_array_t* out); 9 | 10 | 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /src/ext/ds4/install/linux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | required_packages=( "udev" "libudev-dev" ) 3 | packages_to_install="" 4 | for pkg in "${required_packages[@]}"; do 5 | if [ "" = "$(dpkg-query -W --showformat='${Status}\n' $pkg|grep "install ok installed")" ]; then 6 | packages_to_install+=" $pkg" 7 | fi 8 | done 9 | if [ "" != "$packages_to_install" ]; then 10 | sudo apt update 11 | export DEBIAN_FRONTEND=noninteractive 12 | eval "sudo apt -y install --no-install-recommends$packages_to_install" 13 | fi 14 | -------------------------------------------------------------------------------- /src/ext/ds4/lib/_load_library.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "path.sll" 3 | "string.sll" 4 | "sys.sll" 5 | ) 6 | 7 | 8 | 9 | (= library_file_path (<- path$join 10 | (: (<- path$split sys$LIBRARY) 0) 11 | (<- string$format "sys_lib/ds4-%u.%u.%u%s" sys$VERSION$major sys$VERSION$minor sys$VERSION$patch sys$LIBRARY_EXTENSION) 12 | )) 13 | (= err (<- sys$load_library library_file_path)) 14 | (? err { 15 | (:> "Error while loading library '" library_file_path "':\n" err '\n') 16 | (@@ 1) 17 | }) 18 | -------------------------------------------------------------------------------- /src/ext/ds4/platform/darwin/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | 6 | __DS4_API_CALL void ds4_api_device_list(sll_array_t* out){ 7 | SLL_INIT_ARRAY(out); 8 | } 9 | 10 | 11 | 12 | __DS4_EXTERNAL sll_bool_t SLL_ABI_INIT(sll_version_t version){ 13 | return (version==SLL_VERSION); 14 | } 15 | -------------------------------------------------------------------------------- /src/ext/font/.extension_data.json: -------------------------------------------------------------------------------- 1 | { 2 | "required_extensions": [ 3 | "gfx" 4 | ], 5 | "installation_scripts": { 6 | "darwin": "install/darwin.sh", 7 | "linux": "install/linux.sh", 8 | "windows": "install\\windows.bat" 9 | }, 10 | "platform_directories": { 11 | "darwin": "platform/darwin", 12 | "linux": "platform/linux", 13 | "windows": "platform/windows" 14 | }, 15 | "extra_options": { 16 | "darwin": ["-I","build/ext/font_darwin/stb_libraries"], 17 | "linux": ["-I","build/ext/font_linux/stb_libraries"], 18 | "windows": ["/I","build/ext/font_windows/stb_libraries"] 19 | }, 20 | "extra_link_options": { 21 | "linux": ["-lfontconfig"] 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/ext/font/function_table.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | 6 | 7 | static const sll_internal_function_descriptor_t _internal_function_table[]={ 8 | { 9 | SLL_CHAR("font:true_type_create"), 10 | font_api_true_type_create, 11 | SLL_CHAR("#s|a") 12 | }, 13 | { 14 | SLL_CHAR("font:true_type_find"), 15 | font_api_true_type_find, 16 | SLL_CHAR("#s|s") 17 | } 18 | }; 19 | 20 | 21 | 22 | static const sll_internal_function_table_descriptor_t _internal_function_table_descriptor_data={ 23 | (const sll_internal_function_descriptor_t*)(&_internal_function_table), 24 | 2 25 | }; 26 | 27 | 28 | 29 | __FONT_EXTERNAL const sll_internal_function_table_descriptor_t* SLL_ABI_INTERNAL_FUNCTION_TABLE_DESCRIPTOR=&_internal_function_table_descriptor_data; 30 | -------------------------------------------------------------------------------- /src/ext/font/include/font/common.h: -------------------------------------------------------------------------------- 1 | #ifndef __FONT_COMMON_H__ 2 | #define __FONT_COMMON_H__ 1 3 | #include 4 | 5 | 6 | 7 | #ifdef __SLL_BUILD_WINDOWS 8 | #define __FONT_EXTERNAL __declspec(dllexport) 9 | #define __FONT_API_CALL 10 | #else 11 | #define __FONT_EXTERNAL __attribute__((visibility("default"))) 12 | #define __FONT_API_CALL __attribute__((ms_abi)) 13 | #endif 14 | 15 | 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/ext/font/include/font/true_type.h: -------------------------------------------------------------------------------- 1 | #ifndef __FONT_TRUE_TYPE_H__ 2 | #define __FONT_TRUE_TYPE_H__ 1 3 | #include 4 | #include 5 | 6 | 7 | 8 | __FONT_API_CALL void font_api_true_type_create(const sll_string_t* data,sll_array_t* out); 9 | 10 | 11 | 12 | __FONT_API_CALL void font_api_true_type_find(const sll_string_t* name,sll_string_t* out); 13 | 14 | 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /src/ext/font/install/darwin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mkdir "build/ext/font_darwin/stb_libraries" 3 | git clone https://github.com/nothings/stb.git "build/ext/font_darwin/stb_libraries" 4 | -------------------------------------------------------------------------------- /src/ext/font/install/linux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | required_packages=( "libfontconfig1" "libfontconfig-dev" ) 3 | packages_to_install="" 4 | for pkg in "${required_packages[@]}"; do 5 | if [ "" = "$(dpkg-query -W --showformat='${Status}\n' $pkg|grep "install ok installed")" ]; then 6 | packages_to_install+=" $pkg" 7 | fi 8 | done 9 | if [ "" != "$packages_to_install" ]; then 10 | sudo apt update 11 | export DEBIAN_FRONTEND=noninteractive 12 | eval "sudo apt -y install --no-install-recommends$packages_to_install" 13 | fi 14 | mkdir "build/ext/font_linux/stb_libraries" 15 | git clone https://github.com/nothings/stb.git "build/ext/font_linux/stb_libraries" 16 | -------------------------------------------------------------------------------- /src/ext/font/install/windows.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | mkdir build\ext\font_windows\stb_libraries 3 | git clone "https://github.com/nothings/stb.git" build\ext\font_windows\stb_libraries 4 | -------------------------------------------------------------------------------- /src/ext/font/lib/_load_library.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "path.sll" 3 | "string.sll" 4 | "sys.sll" 5 | ) 6 | 7 | 8 | 9 | (= library_file_path (<- path$join 10 | (: (<- path$split sys$LIBRARY) 0) 11 | (<- string$format "sys_lib/font-%u.%u.%u%s" sys$VERSION$major sys$VERSION$minor sys$VERSION$patch sys$LIBRARY_EXTENSION) 12 | )) 13 | (= err (<- sys$load_library library_file_path)) 14 | (? err { 15 | (:> "Error while loading library '" library_file_path "':\n" err '\n') 16 | (@@ 1) 17 | }) 18 | -------------------------------------------------------------------------------- /src/ext/font/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | 6 | __FONT_EXTERNAL sll_bool_t SLL_ABI_INIT(sll_version_t version){ 7 | return (version==SLL_VERSION); 8 | } 9 | -------------------------------------------------------------------------------- /src/ext/font/platform/darwin/true_type.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | 6 | 7 | __FONT_API_CALL void font_api_true_type_find(const sll_string_t* name,sll_string_t* out){ 8 | SLL_INIT_STRING(out); 9 | } 10 | -------------------------------------------------------------------------------- /src/ext/font/platform/linux/true_type.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | 7 | 8 | __FONT_API_CALL void font_api_true_type_find(const sll_string_t* name,sll_string_t* out){ 9 | SLL_INIT_STRING(out); 10 | FcPattern* pattern=FcNameParse(name->data); 11 | FcConfigSubstitute(0,pattern,FcMatchPattern); 12 | FcDefaultSubstitute(pattern); 13 | FcResult tmp; 14 | FcPattern* match=FcFontMatch(NULL,pattern,&tmp); 15 | FcPatternDestroy(pattern); 16 | if (!match){ 17 | return; 18 | } 19 | FcChar8* ptr; 20 | if (FcPatternGetString(match,FC_FILE,0,&ptr)==FcResultMatch){ 21 | sll_string_from_pointer(SLL_CHAR(ptr),out); 22 | } 23 | FcPatternDestroy(match); 24 | FcFini(); 25 | } 26 | -------------------------------------------------------------------------------- /src/ext/font/platform/windows/true_type.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | 6 | 7 | __FONT_API_CALL void font_api_true_type_find(const sll_string_t* name,sll_string_t* out){ 8 | SLL_INIT_STRING(out); 9 | } 10 | -------------------------------------------------------------------------------- /src/ext/font/stb_truetype.c: -------------------------------------------------------------------------------- 1 | #define STB_TRUETYPE_IMPLEMENTATION 1 2 | #include 3 | -------------------------------------------------------------------------------- /src/ext/gfx/.extension_data.json: -------------------------------------------------------------------------------- 1 | { 2 | "required_extensions": [ 3 | "window_manager" 4 | ], 5 | "installation_scripts": { 6 | "darwin": "install/darwin.sh", 7 | "linux": "install/linux.sh", 8 | "windows": "install\\windows.bat" 9 | }, 10 | "extra_options": { 11 | "darwin": ["-D","VK_NO_PROTOTYPES","-D","VK_USE_PLATFORM_MACOS_MVK","-D","GFX_VULKAN_SYSTEM_SURFACE_CREATION_FUNCTION=vkCreateMacOSSurfaceMVK","-D","GFX_VULKAN_REQUIRED_EXTENSION_NAME=\"VK_MVK_macos_surface\"","-I","build/ext/gfx_darwin/vulkan_headers/include"], 12 | "linux": ["-D","VK_NO_PROTOTYPES","-D","VK_USE_PLATFORM_XCB_KHR","-D","GFX_VULKAN_SYSTEM_SURFACE_CREATION_FUNCTION=vkCreateXcbSurfaceKHR","-D","GFX_VULKAN_REQUIRED_EXTENSION_NAME=\"VK_KHR_xcb_surface\"","-I","build/ext/gfx_linux/vulkan_headers/include"], 13 | "windows": ["/D","VK_NO_PROTOTYPES","/D","VK_USE_PLATFORM_WIN32_KHR","/D","GFX_VULKAN_SYSTEM_SURFACE_CREATION_FUNCTION=vkCreateWin32SurfaceKHR","/D","GFX_VULKAN_REQUIRED_EXTENSION_NAME=\"VK_KHR_win32_surface\"","/I","build/ext/gfx_windows/vulkan_headers/include"] 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ext/gfx/color.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | 6 | 7 | __GFX_API_CALL void gfx_api_color_set_clear_color(gfx_context_t ctx_id,sll_float_t red,sll_float_t green,sll_float_t blue,sll_float_t alpha){ 8 | gfx_context_data_t* ctx=SLL_HANDLE_CONTAINER_GET(&gfx_context_data,ctx_id); 9 | if (!ctx){ 10 | return; 11 | } 12 | ctx->surface.clear_color[0]=(float)red; 13 | ctx->surface.clear_color[1]=(float)green; 14 | ctx->surface.clear_color[2]=(float)blue; 15 | ctx->surface.clear_color[3]=(float)alpha; 16 | } 17 | -------------------------------------------------------------------------------- /src/ext/gfx/include/gfx/color.h: -------------------------------------------------------------------------------- 1 | #ifndef __GFX_COLOR_H__ 2 | #define __GFX_COLOR_H__ 1 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | 9 | __GFX_API_CALL void gfx_api_color_set_clear_color(gfx_context_t ctx_id,sll_float_t red,sll_float_t green,sll_float_t blue,sll_float_t alpha); 10 | 11 | 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /src/ext/gfx/include/gfx/common.h: -------------------------------------------------------------------------------- 1 | #ifndef __GFX_COMMON_H__ 2 | #define __GFX_COMMON_H__ 1 3 | #include 4 | 5 | 6 | 7 | #ifdef __SLL_BUILD_WINDOWS 8 | #define __GFX_EXTERNAL __declspec(dllexport) 9 | #define __GFX_API_CALL 10 | #else 11 | #define __GFX_EXTERNAL __attribute__((visibility("default"))) 12 | #define __GFX_API_CALL __attribute__((ms_abi)) 13 | #endif 14 | 15 | 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/ext/gfx/include/gfx/memory.h: -------------------------------------------------------------------------------- 1 | #ifndef __GFX_MEMORY_H__ 2 | #define __GFX_MEMORY_H__ 1 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | 9 | VkDeviceMemory _allocate_device_memory(const gfx_context_data_t* ctx,sll_size_t size,uint32_t type); 10 | 11 | 12 | 13 | void _deallocate_device_memory(const gfx_context_data_t* ctx,VkDeviceMemory handle); 14 | 15 | 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/ext/gfx/include/gfx/sampler.h: -------------------------------------------------------------------------------- 1 | #ifndef __GFX_SAMPLER_H__ 2 | #define __GFX_SAMPLER_H__ 1 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | 10 | #define GFX_SAMPLER_FILTER_TYPE_NEAREST 0 11 | #define GFX_SAMPLER_FILTER_TYPE_LINEAR 1 12 | #define GFX_SAMPLER_FILTER_TYPE_CUBIC 2 13 | 14 | #define GFX_ADDRESS_MODE_TYPE_REPEAT 0 15 | #define GFX_ADDRESS_MODE_TYPE_CLAMP 1 16 | #define GFX_ADDRESS_MODE_TYPE_MASK 1 17 | 18 | #define GFX_ADDRESS_MODE_FLAG_MIRROR 2 19 | 20 | 21 | 22 | typedef uint8_t gfx_sampler_address_mode_t; 23 | 24 | 25 | 26 | typedef uint8_t gfx_sampler_filter_t; 27 | 28 | 29 | 30 | typedef struct _GFX_SAMPLER_DATA{ 31 | VkSampler handle; 32 | } gfx_sampler_data_t; 33 | 34 | 35 | 36 | typedef sll_size_t gfx_sampler_t; 37 | 38 | 39 | 40 | void _delete_sampler(const gfx_context_data_t* ctx,gfx_sampler_data_t* sampler); 41 | 42 | 43 | 44 | __GFX_API_CALL gfx_sampler_t gfx_api_sampler_create(gfx_context_t ctx_id,gfx_sampler_filter_t upscale_filter,gfx_sampler_filter_t downscale_filter,gfx_sampler_address_mode_t address_mode_x,gfx_sampler_address_mode_t address_mode_y,gfx_sampler_address_mode_t address_mode_z); 45 | 46 | 47 | 48 | __GFX_API_CALL void gfx_api_sampler_delete(gfx_context_t ctx_id,gfx_sampler_t sampler_id); 49 | 50 | 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/ext/gfx/include/gfx/shader.h: -------------------------------------------------------------------------------- 1 | #ifndef __GFX_SHADER_H__ 2 | #define __GFX_SHADER_H__ 1 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | 11 | #define GFX_SHADER_MAX_NAME_LENGTH 255 12 | 13 | 14 | 15 | typedef struct _GFX_SHADER_DATA{ 16 | gfx_shader_stage_t type; 17 | VkShaderModule handle; 18 | sll_char_t entry_point[GFX_SHADER_MAX_NAME_LENGTH+1]; 19 | VkPipelineShaderStageCreateInfo pipeline_shader_creation_info; 20 | } gfx_shader_data_t; 21 | 22 | 23 | 24 | typedef sll_size_t gfx_shader_t; 25 | 26 | 27 | 28 | void _delete_shader(const gfx_context_data_t* ctx,gfx_shader_data_t* shader); 29 | 30 | 31 | 32 | __GFX_API_CALL gfx_shader_t gfx_api_shader_create(gfx_context_t ctx_id,const sll_string_t* bytecode,gfx_shader_stage_t type,const sll_string_t* entry_point); 33 | 34 | 35 | 36 | __GFX_API_CALL void gfx_api_shader_delete(gfx_context_t ctx_id,gfx_shader_t shader_id); 37 | 38 | 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/ext/gfx/include/gfx/texture.h: -------------------------------------------------------------------------------- 1 | #ifndef __GFX_TEXTURE_H__ 2 | #define __GFX_TEXTURE_H__ 1 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | 12 | typedef struct _GFX_TEXTURE_DATA{ 13 | const gfx_buffer_data_t* data_buffer; 14 | VkFormat format; 15 | VkExtent3D size; 16 | VkImageLayout layout; 17 | VkImage handle; 18 | VkImageView view; 19 | VkDeviceMemory memory; 20 | uint64_t last_index; 21 | } gfx_texture_data_t; 22 | 23 | 24 | 25 | typedef sll_size_t gfx_texture_t; 26 | 27 | 28 | 29 | void _delete_texture(const gfx_context_data_t* ctx,gfx_texture_data_t* texture); 30 | 31 | 32 | 33 | __GFX_API_CALL gfx_texture_t gfx_api_texture_create(gfx_context_t ctx_id,const sll_array_t* size,gfx_data_format_t format,gfx_buffer_t buffer_id); 34 | 35 | 36 | 37 | __GFX_API_CALL void gfx_api_texture_delete(gfx_context_t ctx_id,gfx_texture_t texture_id); 38 | 39 | 40 | 41 | __GFX_API_CALL void gfx_api_texture_sync(gfx_context_t ctx_id,gfx_texture_t texture_id); 42 | 43 | 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/ext/gfx/include/gfx/vulkan.h: -------------------------------------------------------------------------------- 1 | #ifndef __GFX_VULKAN_H__ 2 | #define __GFX_VULKAN_H__ 1 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | 9 | #define VULKAN_CALL(err) \ 10 | do{ \ 11 | VkResult __err=(err); \ 12 | if (__err){ \ 13 | _check_error_code(_VULKAN_CALL_STR(err),__err); \ 14 | } \ 15 | } while (0) 16 | #define _VULKAN_CALL_STR(err) _VULKAN_CALL_STR_(err) 17 | #define _VULKAN_CALL_STR_(err) #err 18 | 19 | 20 | 21 | extern const char* vulkan_validation_layer_name; 22 | 23 | 24 | 25 | void _check_error_code(const char* str,VkResult err); 26 | 27 | 28 | 29 | void _deinit_vulkan(void); 30 | 31 | 32 | 33 | sll_bool_t _init_vulkan(void); 34 | 35 | 36 | 37 | __GFX_API_CALL void gfx_api_vulkan_get_extensions(sll_array_t* out); 38 | 39 | 40 | 41 | __GFX_API_CALL void gfx_api_vulkan_get_version(sll_array_t* out); 42 | 43 | 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/ext/gfx/install/darwin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | curl -L -o "build/ext/gfx_darwin/glslang.zip" "https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-osx-x86_64-Release.zip" 3 | unzip build/ext/gfx_darwin/glslang.zip -d build/ext/gfx_darwin/glslang 4 | mkdir "build/ext/gfx_darwin/vulkan_headers" 5 | git clone https://github.com/KhronosGroup/Vulkan-Headers.git "build/ext/gfx_darwin/vulkan_headers" 6 | -------------------------------------------------------------------------------- /src/ext/gfx/install/linux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | curl -L -o "build/ext/gfx_linux/glslang.zip" "https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-linux-Release.zip" 3 | unzip build/ext/gfx_linux/glslang.zip -d build/ext/gfx_linux/glslang 4 | mkdir "build/ext/gfx_linux/vulkan_headers" 5 | git clone https://github.com/KhronosGroup/Vulkan-Headers.git "build/ext/gfx_linux/vulkan_headers" 6 | -------------------------------------------------------------------------------- /src/ext/gfx/install/windows.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | curl -L -o "build/ext/gfx_windows/glslang.zip" "https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-windows-x64-Release.zip" 3 | powershell Expand-Archive build/ext/gfx_windows/glslang.zip -DestinationPath build/ext/gfx_windows/glslang 4 | mkdir build\ext\gfx_windows\vulkan_headers 5 | git clone "https://github.com/KhronosGroup/Vulkan-Headers.git" build\ext\gfx_windows\vulkan_headers 6 | -------------------------------------------------------------------------------- /src/ext/gfx/lib/_color.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "string.sll" 3 | "types.sll" 4 | ) 5 | 6 | 7 | 8 | (= gfx_color_type (&: 9 | (,,, data 10 | (@@ (<- string$format "" 11 | data$red 12 | data$green 13 | data$blue 14 | data$alpha 15 | )) 16 | ) @@string@@ 17 | float_type red 18 | float_type green 19 | float_type blue 20 | float_type alpha 21 | )) 22 | 23 | 24 | 25 | (## gfx_color_type) 26 | -------------------------------------------------------------------------------- /src/ext/gfx/lib/_load_library.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "path.sll" 3 | "string.sll" 4 | "sys.sll" 5 | ) 6 | 7 | 8 | 9 | (= library_file_path (<- path$join 10 | (: (<- path$split sys$LIBRARY) 0) 11 | (<- string$format "sys_lib/gfx-%u.%u.%u%s" sys$VERSION$major sys$VERSION$minor sys$VERSION$patch sys$LIBRARY_EXTENSION) 12 | )) 13 | (= err (<- sys$load_library library_file_path)) 14 | (? err { 15 | (:> "Error while loading library '" library_file_path "':\n" err '\n') 16 | (@@ 1) 17 | }) 18 | -------------------------------------------------------------------------------- /src/ext/gfx/lib/_setup_window_integration.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "gfx/_load_library.sll" 3 | "weakref.sll" 4 | "window_manager/util.sll" 5 | ) 6 | 7 | 8 | 9 | (= window_manager:util$__gfx_callbacks$destroy (,,, window 10 | (= ctx (<- weakref$get_default window$_gfx_context)) 11 | (= window$_gfx_context weakref$NIL_REF) 12 | (? ctx (<- (... "gfx:context_delete") ctx$_handle)) 13 | )) 14 | 15 | (= window_manager:util$__gfx_callbacks$resize (,,, window 16 | (= ctx (<- weakref$get_default window$_gfx_context)) 17 | (? ctx (<- (... "gfx:context_resize") ctx$_handle)) 18 | )) 19 | -------------------------------------------------------------------------------- /src/ext/gfx/lib/gfx.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "gfx/buffer.sll" 3 | "gfx/color.sll" 4 | "gfx/context.sll" 5 | "gfx/data_type.sll" 6 | "gfx/pipeline.sll" 7 | "gfx/sampler.sll" 8 | "gfx/shader.sll" 9 | "gfx/texture.sll" 10 | "gfx/vulkan.sll" 11 | ) 12 | 13 | 14 | 15 | (= gfx_module_type (&: 16 | (~ (:? gfx:buffer)) buffer 17 | (~ (:? gfx:color)) color 18 | (~ (:? gfx:context)) context 19 | (~ (:? gfx:data_type)) data_type 20 | (~ (:? gfx:pipeline)) pipeline 21 | (~ (:? gfx:sampler)) sampler 22 | (~ (:? gfx:shader)) shader 23 | (~ (:? gfx:texture)) texture 24 | (~ (:? gfx:vulkan)) vulkan 25 | )) 26 | 27 | 28 | 29 | (= gfx (. gfx_module_type 30 | gfx:buffer 31 | gfx:color 32 | gfx:context 33 | gfx:data_type 34 | gfx:pipeline 35 | gfx:sampler 36 | gfx:shader 37 | gfx:texture 38 | gfx:vulkan 39 | )) 40 | (## gfx) 41 | -------------------------------------------------------------------------------- /src/ext/gfx/lib/vulkan.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "gfx/_load_library.sll" 3 | "string.sll" 4 | "types.sll" 5 | ) 6 | 7 | 8 | 9 | (= gfx_vulkan_version_type (&: 10 | (,,, data 11 | (@@ (<- string$format "%u.%u.%u.%u" data$revision data$major data$minor data$patch)) 12 | ) @@string@@ 13 | (~ int_type) revision 14 | (~ int_type) major 15 | (~ int_type) minor 16 | (~ int_type) patch 17 | )) 18 | 19 | (= gfx_vulkan_module_type (&: 20 | (~ type_type) gfx_vulkan_version_type 21 | (~ func_type) get_extensions 22 | (~ func_type) get_version 23 | )) 24 | 25 | 26 | 27 | (= get_extensions (,,, 28 | (@@ (<- (... "gfx:vulkan_get_extensions"))) 29 | )) 30 | 31 | (= get_version (,,, 32 | (@@ (:: (<- (... "gfx:vulkan_get_version")) gfx_vulkan_version_type)) 33 | )) 34 | 35 | 36 | 37 | (= gfx:vulkan (. gfx_vulkan_module_type 38 | gfx_vulkan_version_type 39 | get_extensions 40 | get_version 41 | )) 42 | (## gfx:vulkan) 43 | -------------------------------------------------------------------------------- /src/ext/gfx/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | 7 | 8 | __GFX_EXTERNAL sll_bool_t SLL_ABI_INIT(sll_version_t version){ 9 | if (version!=SLL_VERSION||!_init_vulkan()){ 10 | return 0; 11 | } 12 | SLL_HANDLE_CONTAINER_INIT(&gfx_context_data); 13 | return 1; 14 | } 15 | 16 | 17 | 18 | __GFX_EXTERNAL void SLL_ABI_DEINIT(void){ 19 | SLL_HANDLE_CONTAINER_ITER_CLEAR(&gfx_context_data,gfx_context_data_t,ctx,{ 20 | _delete_context(ctx); 21 | }); 22 | _deinit_vulkan(); 23 | } 24 | -------------------------------------------------------------------------------- /src/ext/gfx/memory.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | 7 | 8 | VkDeviceMemory _allocate_device_memory(const gfx_context_data_t* ctx,sll_size_t size,uint32_t type){ 9 | VkMemoryAllocateInfo memory_allocation_info={ 10 | VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, 11 | NULL, 12 | size, 13 | type 14 | }; 15 | VkDeviceMemory out; 16 | VULKAN_CALL(ctx->function_table.vkAllocateMemory(ctx->device.logical,&memory_allocation_info,NULL,&out)); 17 | return out; 18 | } 19 | 20 | 21 | 22 | void _deallocate_device_memory(const gfx_context_data_t* ctx,VkDeviceMemory handle){ 23 | ctx->function_table.vkFreeMemory(ctx->device.logical,handle,NULL); 24 | } 25 | -------------------------------------------------------------------------------- /src/ext/ui/.extension_data.json: -------------------------------------------------------------------------------- 1 | { 2 | "required_extensions": [ 3 | "font", 4 | "gfx", 5 | "window_manager" 6 | ], 7 | "shaders": { 8 | "shader/fragment.frag": "lib/shader/_fragment_shader.sll", 9 | "shader/vertex.vert": "lib/shader/_vertex_shader.sll" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/ext/ui/lib/_element_types.sll: -------------------------------------------------------------------------------- 1 | (= _element_type_data <>) 2 | (= _element_name_to_type <>) 3 | 4 | 5 | 6 | (## _element_type_data _element_name_to_type) 7 | -------------------------------------------------------------------------------- /src/ext/ui/lib/_ui_type.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "font/atlas.sll" 3 | "gfx/buffer.sll" 4 | "gfx/context.sll" 5 | "gfx/pipeline.sll" 6 | "string.sll" 7 | "types.sll" 8 | "ui/rgb.sll" 9 | "window_manager/window.sll" 10 | ) 11 | 12 | 13 | 14 | (= ui_event_target_type (&: 15 | (~ func_type) callback 16 | (~ object_type) element 17 | )) 18 | 19 | (= ui_event_targets_type (&: 20 | array_type button 21 | array_type key 22 | array_type mouse 23 | array_type render 24 | )) 25 | 26 | (= ui_type (&: 27 | (,,, data 28 | (@@ (<- string$format "" 29 | (:: data$window string_type) 30 | (:: data$root string_type) 31 | )) 32 | ) @@string@@ 33 | (~ window_manager:window$window_manager_window_type) window 34 | object_type root 35 | (~ gfx:context$gfx_context_type) context 36 | ui:rgb$ui_rgb_type background_color 37 | gfx:buffer$gfx_buffer_type _vertex_buffer 38 | gfx:buffer$gfx_buffer_type _index_buffer 39 | gfx:buffer$gfx_buffer_type _uniform_buffer 40 | int_type _buffer_update_flags 41 | (~ gfx:pipeline$gfx_pipeline_type) _pipeline 42 | int_type _max_z_index 43 | ui_event_targets_type _event_targets 44 | array_type _textures 45 | array_type _elements 46 | map_type _name_to_element 47 | map_type _element_to_name 48 | font:atlas$font_atlas_type _font_atlas 49 | )) 50 | 51 | 52 | 53 | (## ui_event_target_type ui_type) 54 | -------------------------------------------------------------------------------- /src/ext/ui/lib/element/container.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "string.sll" 3 | "types.sll" 4 | "ui/element.sll" 5 | ) 6 | 7 | 8 | 9 | (= ui_container_element_type (&: 10 | (,,, data 11 | (@@ (<- string$format "" 12 | (:: data$base string_type) 13 | )) 14 | ) @@string@@ 15 | (~ ui:element$ui_element_type) base 16 | )) 17 | 18 | (= ui_container_element_module_type (&: 19 | (~ type_type) ui_container_element_type 20 | (~ func_type) create 21 | (~ func_type) delete 22 | )) 23 | 24 | 25 | 26 | (= create (,,, ui position_layout parent 27 | (= out (. ui_container_element_type 28 | (<- ui:element$create ui position_layout) 29 | )) 30 | (? parent (<- ui:element$set_parent out parent)) 31 | (<- ui:element$setup out) 32 | (@@ out) 33 | )) 34 | 35 | (= delete (,,, container 36 | (? (! container) (@@)) 37 | (= container (:: container ui_container_element_type)) 38 | (<- ui:element$delete container) 39 | )) 40 | 41 | 42 | 43 | (<- ui:element$register_element ui_container_element_type "ui:element:container" (. ui:element$ui_element_callbacks_type 44 | nil 45 | nil 46 | nil 47 | nil 48 | nil 49 | nil 50 | nil 51 | )) 52 | 53 | 54 | 55 | (= ui:element:container (. ui_container_element_module_type 56 | ui_container_element_type 57 | create 58 | delete 59 | )) 60 | (## ui:element:container) 61 | -------------------------------------------------------------------------------- /src/ext/ui/lib/rgb.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "string.sll" 3 | "types.sll" 4 | ) 5 | 6 | 7 | 8 | (= ui_rgb_type (&: 9 | (,,, data 10 | (@@ (<- string$format "(%f %f %f)" 11 | data$red 12 | data$green 13 | data$blue 14 | )) 15 | ) @@string@@ 16 | float_type red 17 | float_type green 18 | float_type blue 19 | )) 20 | 21 | (= ui_rgb_module_type (&: 22 | (~ type_type) ui_rgb_type 23 | )) 24 | 25 | 26 | 27 | (= ui:rgb (. ui_rgb_module_type 28 | ui_rgb_type 29 | )) 30 | (## ui:rgb) 31 | -------------------------------------------------------------------------------- /src/ext/ui/lib/ui.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "ui/core.sll" 3 | "ui/element.sll" 4 | "ui/element/button.sll" 5 | "ui/element/color.sll" 6 | "ui/element/container.sll" 7 | "ui/element/gradient.sll" 8 | "ui/element/slider.sll" 9 | "ui/element/text.sll" 10 | "ui/element/texture.sll" 11 | "ui/layout.sll" 12 | "ui/position.sll" 13 | "ui/rgb.sll" 14 | "ui/serialize.sll" 15 | "ui/texture.sll" 16 | ) 17 | 18 | 19 | 20 | (= ui_module_type (&: 21 | (~ (:? ui:core)) core 22 | (~ (:? ui:element)) element 23 | (~ (:? ui:element:button)) element:button 24 | (~ (:? ui:element:color)) element:color 25 | (~ (:? ui:element:container)) element:container 26 | (~ (:? ui:element:gradient)) element:gradient 27 | (~ (:? ui:element:slider)) element:slider 28 | (~ (:? ui:element:text)) element:text 29 | (~ (:? ui:element:texture)) element:texture 30 | (~ (:? ui:layout)) layout 31 | (~ (:? ui:position)) position 32 | (~ (:? ui:rgb)) rgb 33 | (~ (:? ui:serialize)) serialize 34 | (~ (:? ui:texture)) texture 35 | )) 36 | 37 | 38 | 39 | (= ui (. ui_module_type 40 | ui:core 41 | ui:element 42 | ui:element:button 43 | ui:element:color 44 | ui:element:container 45 | ui:element:gradient 46 | ui:element:slider 47 | ui:element:text 48 | ui:element:texture 49 | ui:layout 50 | ui:position 51 | ui:rgb 52 | ui:serialize 53 | ui:texture 54 | )) 55 | (## ui) 56 | -------------------------------------------------------------------------------- /src/ext/ui/shader/fragment.frag: -------------------------------------------------------------------------------- 1 | #version 450 core 2 | 3 | 4 | 5 | layout (location=0) in vec3 in_data; 6 | layout (location=0) out vec4 out_color; 7 | layout (binding=1) uniform sampler2D texture_sampler[4096]; 8 | 9 | 10 | 11 | void main(void){ 12 | if (in_data.z>=0){ 13 | out_color=vec4(in_data,1.0); 14 | } 15 | else{ 16 | uint id=uint(-in_data.z-1); 17 | out_color=texture(texture_sampler[id],in_data.xy); 18 | if (id==0){ 19 | out_color=vec4(1.0,1.0,1.0,out_color.r); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/ext/ui/shader/vertex.vert: -------------------------------------------------------------------------------- 1 | #version 450 core 2 | 3 | 4 | 5 | layout (location=0) in vec3 in_pos; 6 | layout (location=1) in vec3 in_data; 7 | layout (location=0) out vec3 out_data; 8 | layout (binding=0) uniform transform_buffer{ 9 | mat4 transform; 10 | }; 11 | 12 | 13 | 14 | void main(void){ 15 | gl_Position=vec4(in_pos,1.0)*transform; 16 | out_data=in_data; 17 | } 18 | -------------------------------------------------------------------------------- /src/ext/window_manager/.extension_data.json: -------------------------------------------------------------------------------- 1 | { 2 | "installation_scripts": { 3 | "linux": "install/linux.sh" 4 | }, 5 | "platform_directories": { 6 | "darwin": "platform/darwin", 7 | "linux": "platform/linux", 8 | "windows": "platform/windows" 9 | }, 10 | "extra_link_options": { 11 | "darwin": ["-framework","ApplicationServices"], 12 | "linux": ["-lxcb","-lxcb-randr","-lxcb-xkb","-lxcb-icccm","-lxcb-cursor"], 13 | "windows": ["user32.lib"] 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/ext/window_manager/include/window_manager/common.h: -------------------------------------------------------------------------------- 1 | #ifndef __WINDOW_MANAGER_COMMON_H__ 2 | #define __WINDOW_MANAGER_COMMON_H__ 1 3 | #include 4 | 5 | 6 | 7 | #ifdef __SLL_BUILD_WINDOWS 8 | #define __WINDOW_MANAGER_EXTERNAL __declspec(dllexport) 9 | #define __WINDOW_MANAGER_API_CALL 10 | #else 11 | #define __WINDOW_MANAGER_EXTERNAL __attribute__((visibility("default"))) 12 | #define __WINDOW_MANAGER_API_CALL __attribute__((ms_abi)) 13 | #endif 14 | 15 | 16 | 17 | void _deinit_platform(void); 18 | 19 | 20 | 21 | sll_bool_t _init_platform(void); 22 | 23 | 24 | 25 | __WINDOW_MANAGER_API_CALL void* window_api_get_context(void); 26 | 27 | 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/ext/window_manager/include/window_manager/cursor.h: -------------------------------------------------------------------------------- 1 | #ifndef __WINDOW_MANAGER_CURSOR_H__ 2 | #define __WINDOW_MANAGER_CURSOR_H__ 1 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | 10 | #define WINDOW_CURSOR_HIDDEN 0 11 | #define WINDOW_CURSOR_DEFAULT 1 12 | #define WINDOW_CURSOR_CROSS 2 13 | #define WINDOW_CURSOR_I_BEAM 3 14 | #define WINDOW_CURSOR_WAIT 4 15 | #define WINDOW_CURSOR_BUSY 5 16 | #define WINDOW_CURSOR_FORBIDDEN 6 17 | #define WINDOW_CURSOR_POINTER 7 18 | #define WINDOW_CURSOR_RESIZE_VERTICAL 8 19 | #define WINDOW_CURSOR_RESIZE_HORIZONTAL 9 20 | #define WINDOW_CURSOR_RESIZE_DIAGONAL_BT 10 21 | #define WINDOW_CURSOR_RESIZE_DIAGONAL_TB 11 22 | #define WINDOW_CURSOR_RESIZE_ALL 12 23 | #define WINDOW_CURSOR_HELP 13 24 | 25 | #define WINDOW_MAX_CURSOR WINDOW_CURSOR_HELP 26 | 27 | 28 | 29 | typedef uint32_t window_cursor_t; 30 | 31 | 32 | 33 | __WINDOW_MANAGER_API_CALL void window_api_cursor_apply_to_window(window_handle_t id,window_cursor_t cursor); 34 | 35 | 36 | 37 | __WINDOW_MANAGER_API_CALL void window_api_cursor_get_position(sll_array_t* out); 38 | 39 | 40 | 41 | __WINDOW_MANAGER_API_CALL void window_api_cursor_set_position(int32_t x,int32_t y); 42 | 43 | 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/ext/window_manager/include/window_manager/display.h: -------------------------------------------------------------------------------- 1 | #ifndef __WINDOW_MANAGER_DISPLAY_H__ 2 | #define __WINDOW_MANAGER_DISPLAY_H__ 1 3 | #include 4 | #include 5 | 6 | 7 | 8 | #define WINDOW_DISPLAY_FLAG_ACTIVE 1 9 | #define WINDOW_DISPLAY_FLAG_MAIN_DISPLAY 2 10 | 11 | 12 | 13 | __WINDOW_MANAGER_API_CALL void window_api_display_enumerate(sll_array_t* out); 14 | 15 | 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/ext/window_manager/include/window_manager/event.h: -------------------------------------------------------------------------------- 1 | #ifndef __WINDOW_MANAGER_EVENT_H__ 2 | #define __WINDOW_MANAGER_EVENT_H__ 1 3 | #include 4 | #include 5 | 6 | 7 | 8 | #define WINDOW_EVENT_ERROR 0 9 | #define WINDOW_EVENT_KEY 1 10 | #define WINDOW_EVENT_BUTTON 2 11 | #define WINDOW_EVENT_MOUSE 3 12 | #define WINDOW_EVENT_MOUSE_LEAVE 4 13 | #define WINDOW_EVENT_FOCUS 5 14 | #define WINDOW_EVENT_GEOMETRY 6 15 | #define WINDOW_EVENT_SCROLL 7 16 | #define WINDOW_EVENT_REDRAW 8 17 | #define WINDOW_EVENT_CLOSE 9 18 | #define WINDOW_EVENT_STATE 10 19 | #define WINDOW_EVENT_POSITION 11 20 | #define WINDOW_EVENT_SIZE 12 21 | 22 | 23 | 24 | __WINDOW_MANAGER_API_CALL void window_api_event_poll(sll_bool_t blocking,sll_array_t* out); 25 | 26 | 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/ext/window_manager/include/window_manager/platform/linux.h: -------------------------------------------------------------------------------- 1 | #ifndef __WINDOW_MANAGER_PLATFORM_LINUX_H__ 2 | #define __WINDOW_MANAGER_PLATFORM_LINUX_H__ 1 3 | #include 4 | #include 5 | 6 | 7 | 8 | #define FORMAT_COLOR_BITS(r,g,b,a) ((((uint32_t)(r))<<16)|(((uint32_t)(g))<<8)|((uint32_t)(b))|(((uint32_t)(a))<<24)) 9 | 10 | 11 | 12 | extern xcb_connection_t* _xcb_conn; 13 | extern xcb_screen_t* _xcb_screen; 14 | extern xcb_atom_t _xcb_net_wm_icon; 15 | extern xcb_atom_t _xcb_net_wm_ping; 16 | extern xcb_atom_t _xcb_net_wm_state; 17 | extern xcb_atom_t _xcb_net_wm_state_fullscreen; 18 | extern xcb_atom_t _xcb_net_wm_state_hidden; 19 | extern xcb_atom_t _xcb_net_wm_state_maximized_horz; 20 | extern xcb_atom_t _xcb_net_wm_state_maximized_vert; 21 | extern xcb_atom_t _xcb_wm_change_state; 22 | extern xcb_atom_t _xcb_wm_delete_window; 23 | extern xcb_atom_t _xcb_wm_protocols; 24 | extern xcb_cursor_t _xcb_cursors[WINDOW_MAX_CURSOR+1]; 25 | extern sll_map_container_t _window_to_parent; 26 | 27 | 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/ext/window_manager/include/window_manager/platform/windows.h: -------------------------------------------------------------------------------- 1 | #ifndef __WINDOW_MANAGER_PLATFORM_WINDOWS_H__ 2 | #define __WINDOW_MANAGER_PLATFORM_WINDOWS_H__ 1 3 | #include 4 | #include 5 | 6 | 7 | 8 | extern void* _winapi_hinstance; 9 | extern sll_map_container_t _window_size_constraints; 10 | 11 | 12 | 13 | typedef struct _WINDOW_SIZE_CONSTRAINTS{ 14 | uint32_t min_w; 15 | uint32_t min_h; 16 | uint32_t max_w; 17 | uint32_t max_h; 18 | } window_size_constraints_t; 19 | 20 | 21 | 22 | unsigned __int64 _window_wnd_proc(void* id,unsigned int msg,unsigned __int64 w_param,__int64 l_param); 23 | 24 | 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/ext/window_manager/install/linux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | required_packages=( "libxcb-randr0" "libxcb-randr0-dev" "libxcb-xkb-dev" "libxcb-icccm4" "libxcb-icccm4-dev" "libxcb-cursor0" "libxcb-cursor-dev" ) 3 | packages_to_install="" 4 | for pkg in "${required_packages[@]}"; do 5 | if [ "" = "$(dpkg-query -W --showformat='${Status}\n' $pkg|grep "install ok installed")" ]; then 6 | packages_to_install+=" $pkg" 7 | fi 8 | done 9 | if [ "" != "$packages_to_install" ]; then 10 | sudo apt update 11 | export DEBIAN_FRONTEND=noninteractive 12 | eval "sudo apt -y install --no-install-recommends$packages_to_install" 13 | fi 14 | -------------------------------------------------------------------------------- /src/ext/window_manager/lib/_load_library.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "audit.sll" 3 | "path.sll" 4 | "string.sll" 5 | "sys.sll" 6 | ) 7 | 8 | 9 | 10 | (= library_file_path (<- path$join 11 | (: (<- path$split sys$LIBRARY) 0) 12 | (<- string$format "sys_lib/window_manager-%u.%u.%u%s" sys$VERSION$major sys$VERSION$minor sys$VERSION$patch sys$LIBRARY_EXTENSION) 13 | )) 14 | (= err (<- sys$load_library library_file_path)) 15 | (? err { 16 | (:> "Error while loading library '" library_file_path "':\n" err '\n') 17 | (@@ 1) 18 | }) 19 | 20 | (<- audit$register_event "window_manager.create" "window_id") 21 | (<- audit$register_event "window_manager.destroy" "window_id") 22 | (<- audit$register_event "window_manager.display.enumerate") 23 | -------------------------------------------------------------------------------- /src/ext/window_manager/lib/geometry.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "string.sll" 3 | "types.sll" 4 | ) 5 | 6 | 7 | 8 | (= window_manager_geometry_type (&: 9 | (,,, data 10 | (? (< data$width 0) { 11 | (= data$width (- 0 data$width)) 12 | (= data$x (- data$x data$width)) 13 | }) 14 | (? (< data$height 0) { 15 | (= data$height (- 0 data$height)) 16 | (= data$y (- data$y data$height)) 17 | }) 18 | ) @@init@@ 19 | (,,, data 20 | (@@ (<- string$format "%llux%llu%+lld%+lld" 21 | data$width 22 | data$height 23 | data$x 24 | data$y 25 | )) 26 | ) @@string@@ 27 | int_type x 28 | int_type y 29 | int_type width 30 | int_type height 31 | )) 32 | 33 | (= window_manager_geometry_module_type (&: 34 | (~ type_type) window_manager_geometry_type 35 | (~ func_type) from_corners 36 | )) 37 | 38 | 39 | 40 | (= from_corners (,,, x1 y1 x2 y2 41 | (? (< x2 x1) { 42 | (= tmp x1) 43 | (= x1 x2) 44 | (= x2 tmp) 45 | }) 46 | (? (< y2 y1) { 47 | (= tmp y1) 48 | (= y1 y2) 49 | (= y2 tmp) 50 | }) 51 | (@@ (. window_manager_geometry_type 52 | x1 53 | y1 54 | (- x2 x1) 55 | (- y2 y1) 56 | )) 57 | )) 58 | 59 | 60 | 61 | (= window_manager:geometry (. window_manager_geometry_module_type 62 | window_manager_geometry_type 63 | from_corners 64 | )) 65 | (## window_manager:geometry) 66 | -------------------------------------------------------------------------------- /src/ext/window_manager/lib/range.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "string.sll" 3 | "types.sll" 4 | ) 5 | 6 | 7 | 8 | (= window_manager_range_type (&: 9 | (,,, data 10 | (? (> data$max data$min) (@@)) 11 | (= tmp data$max) 12 | (= data$max data$min) 13 | (= data$min tmp) 14 | ) @@init@@ 15 | (,,, data 16 | (@@ (<- string$format "[%lld;%lld]" 17 | data$min 18 | data$max 19 | )) 20 | ) @@string@@ 21 | int_type min 22 | int_type max 23 | )) 24 | 25 | (= window_manager_range_module_type (&: 26 | (~ type_type) window_manager_range_type 27 | )) 28 | 29 | 30 | 31 | (= window_manager:range (. window_manager_range_module_type 32 | window_manager_range_type 33 | )) 34 | (## window_manager:range) 35 | -------------------------------------------------------------------------------- /src/ext/window_manager/lib/util.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "window_manager/_load_library.sll" 3 | "types.sll" 4 | ) 5 | 6 | 7 | 8 | (= window_manager_gfx_callbacks_type (&: 9 | func_type destroy 10 | func_type resize 11 | )) 12 | 13 | (= window_manager_util_module_type (&: 14 | window_manager_gfx_callbacks_type __gfx_callbacks 15 | (~ func_type) get_context 16 | )) 17 | 18 | 19 | 20 | (= __gfx_callbacks (. window_manager_gfx_callbacks_type)) 21 | 22 | (= get_context (... "window:get_context")) 23 | 24 | 25 | 26 | (= window_manager:util (. window_manager_util_module_type 27 | __gfx_callbacks 28 | get_context 29 | )) 30 | (## window_manager:util) 31 | -------------------------------------------------------------------------------- /src/ext/window_manager/lib/window_manager.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "window_manager/cursor.sll" 3 | "window_manager/display.sll" 4 | "window_manager/event.sll" 5 | "window_manager/geometry.sll" 6 | "window_manager/image.sll" 7 | "window_manager/keyboard.sll" 8 | "window_manager/range.sll" 9 | "window_manager/util.sll" 10 | "window_manager/window.sll" 11 | ) 12 | 13 | 14 | 15 | (= window_manger_module_type (&: 16 | (~ (:? window_manager:cursor)) cursor 17 | (~ (:? window_manager:display)) display 18 | (~ (:? window_manager:event)) event 19 | (~ (:? window_manager:geometry)) geometry 20 | (~ (:? window_manager:image)) image 21 | (~ (:? window_manager:keyboard)) keyboard 22 | (~ (:? window_manager:range)) range 23 | (~ (:? window_manager:util)) util 24 | (~ (:? window_manager:window)) window 25 | )) 26 | 27 | 28 | 29 | (= window_manger (. window_manger_module_type 30 | window_manager:cursor 31 | window_manager:display 32 | window_manager:event 33 | window_manager:geometry 34 | window_manager:image 35 | window_manager:keyboard 36 | window_manager:range 37 | window_manager:util 38 | window_manager:window 39 | )) 40 | (## window_manger) 41 | -------------------------------------------------------------------------------- /src/ext/window_manager/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | 6 | 7 | __WINDOW_MANAGER_EXTERNAL sll_bool_t SLL_ABI_INIT(sll_version_t version){ 8 | if (version!=SLL_VERSION||!_init_platform()){ 9 | return 0; 10 | } 11 | sll_zero_memory(_scancode_to_keycode,512*sizeof(window_key_t)); 12 | sll_zero_memory(_keycode_to_scancode,(WINDOW_MAX_KEY+1)*sizeof(window_scancode_t)); 13 | _setup_key_mapping(); 14 | for (window_scancode_t i=0;i<512;i++){ 15 | if (_scancode_to_keycode[i]){ 16 | _keycode_to_scancode[_scancode_to_keycode[i]]=i; 17 | } 18 | } 19 | return 1; 20 | } 21 | 22 | 23 | 24 | __WINDOW_MANAGER_EXTERNAL void SLL_ABI_DEINIT(void){ 25 | _deinit_platform(); 26 | } 27 | -------------------------------------------------------------------------------- /src/ext/window_manager/platform/darwin/cursor.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | 9 | __WINDOW_MANAGER_API_CALL void window_api_cursor_apply_to_window(window_handle_t id,window_cursor_t cursor){ 10 | } 11 | 12 | 13 | 14 | __WINDOW_MANAGER_API_CALL void window_api_cursor_get_position(sll_array_t* out){ 15 | SLL_INIT_ARRAY(out); 16 | } 17 | 18 | 19 | 20 | __WINDOW_MANAGER_API_CALL void window_api_cursor_set_position(int32_t x,int32_t y){ 21 | } 22 | -------------------------------------------------------------------------------- /src/ext/window_manager/platform/darwin/display.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | 9 | __WINDOW_MANAGER_API_CALL void window_api_display_enumerate(sll_array_t* out){ 10 | uint32_t count; 11 | if (CGGetOnlineDisplayList(0,NULL,&count)!=kCGErrorSuccess){ 12 | SLL_INIT_ARRAY(out); 13 | return; 14 | } 15 | CGDirectDisplayID* data=sll_allocate_stack(count*sizeof(CGDirectDisplayID)); 16 | if (CGGetOnlineDisplayList(count,data,&count)!=kCGErrorSuccess){ 17 | sll_deallocate(data); 18 | SLL_INIT_ARRAY(out); 19 | return; 20 | } 21 | CGDirectDisplayID main_id=CGMainDisplayID(); 22 | sll_array_create(count,out); 23 | for (uint32_t i=0;idata[i]=sll_new_object(SLL_CHAR("u[hhuu]fi"),id,(int32_t)(rect.origin.x),(int32_t)(rect.origin.y),(uint32_t)(rect.size.width),(uint32_t)(rect.size.height),CGDisplayRotation(id),flags); 34 | } 35 | sll_deallocate(data); 36 | } 37 | -------------------------------------------------------------------------------- /src/ext/window_manager/platform/darwin/event.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | 6 | __WINDOW_MANAGER_API_CALL void window_api_event_poll(sll_bool_t blocking,sll_array_t* out){ 7 | SLL_INIT_ARRAY(out); 8 | } 9 | -------------------------------------------------------------------------------- /src/ext/window_manager/platform/darwin/keyboard.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | 5 | window_key_t _scancode_to_keycode[512]; 6 | window_scancode_t _keycode_to_scancode[WINDOW_MAX_KEY+1]; 7 | 8 | 9 | 10 | void _setup_key_mapping(void){ 11 | } 12 | -------------------------------------------------------------------------------- /src/ext/window_manager/platform/darwin/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | 6 | void _deinit_platform(void){ 7 | } 8 | 9 | 10 | 11 | sll_bool_t _init_platform(void){ 12 | return 1; 13 | } 14 | 15 | 16 | 17 | __WINDOW_MANAGER_API_CALL void* window_api_get_context(void){ 18 | return NULL; 19 | } 20 | -------------------------------------------------------------------------------- /src/ext/window_manager/platform/darwin/window.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | 7 | 8 | __WINDOW_MANAGER_API_CALL window_handle_t window_api_window_create(int32_t x,int32_t y,uint32_t w,uint32_t h,window_handle_t parent){ 9 | return (window_handle_t)0; 10 | } 11 | 12 | 13 | 14 | __WINDOW_MANAGER_API_CALL void window_api_window_destroy(window_handle_t id){ 15 | } 16 | 17 | 18 | 19 | __WINDOW_MANAGER_API_CALL void window_api_window_set_geometry(window_handle_t id,int32_t x,int32_t y,uint32_t w,uint32_t h){ 20 | } 21 | 22 | 23 | 24 | __WINDOW_MANAGER_API_CALL void window_api_window_set_icon(window_handle_t id,uint32_t width,const sll_string_t* data){ 25 | } 26 | 27 | 28 | 29 | __WINDOW_MANAGER_API_CALL void window_api_window_set_size_constraints(window_handle_t id,uint32_t min_w,uint32_t min_h,uint32_t max_w,uint32_t max_h){ 30 | } 31 | 32 | 33 | 34 | __WINDOW_MANAGER_API_CALL void window_api_window_set_state(window_handle_t id,window_state_t state){ 35 | } 36 | 37 | 38 | 39 | __WINDOW_MANAGER_API_CALL void window_api_window_set_title(window_handle_t id,const sll_string_t* name){ 40 | } 41 | 42 | 43 | 44 | __WINDOW_MANAGER_API_CALL void window_api_window_set_visibility(window_handle_t id,sll_bool_t show){ 45 | } 46 | -------------------------------------------------------------------------------- /src/ext/window_manager/platform/linux/cursor.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | 12 | __WINDOW_MANAGER_API_CALL void window_api_cursor_apply_to_window(window_handle_t id,window_cursor_t cursor){ 13 | if (cursor>WINDOW_MAX_CURSOR){ 14 | cursor=WINDOW_CURSOR_DEFAULT; 15 | } 16 | xcb_change_window_attributes(_xcb_conn,(int)(intptr_t)id,XCB_CW_CURSOR,_xcb_cursors+cursor); 17 | xcb_flush(_xcb_conn); 18 | } 19 | 20 | 21 | 22 | __WINDOW_MANAGER_API_CALL void window_api_cursor_get_position(sll_array_t* out){ 23 | xcb_query_pointer_reply_t* data=xcb_query_pointer_reply(_xcb_conn,xcb_query_pointer(_xcb_conn,_xcb_screen->root),NULL); 24 | sll_new_object_array(SLL_CHAR("uu"),out,data->root_x,data->root_y); 25 | free(data); 26 | } 27 | 28 | 29 | 30 | __WINDOW_MANAGER_API_CALL void window_api_cursor_set_position(int32_t x,int32_t y){ 31 | xcb_warp_pointer(_xcb_conn,XCB_NONE,_xcb_screen->root,0,0,0,0,x,y); 32 | xcb_flush(_xcb_conn); 33 | } 34 | -------------------------------------------------------------------------------- /src/ext/window_manager/platform/windows/cursor.c: -------------------------------------------------------------------------------- 1 | #undef NOUSER 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | 11 | __WINDOW_MANAGER_API_CALL void window_api_cursor_apply_to_window(window_handle_t id,window_cursor_t cursor){ 12 | ShowCursor(cursor!=WINDOW_CURSOR_HIDDEN); 13 | } 14 | 15 | 16 | 17 | __WINDOW_MANAGER_API_CALL void window_api_cursor_get_position(sll_array_t* out){ 18 | POINT pos; 19 | GetCursorPos(&pos); 20 | sll_new_object_array(SLL_CHAR("hh"),out,pos.x,pos.y); 21 | } 22 | 23 | 24 | 25 | __WINDOW_MANAGER_API_CALL void window_api_cursor_set_position(int32_t x,int32_t y){ 26 | SetCursorPos(x,y); 27 | } 28 | -------------------------------------------------------------------------------- /src/ext/window_manager/platform/windows/main.c: -------------------------------------------------------------------------------- 1 | #undef NOUSER 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | 10 | void* _winapi_hinstance; 11 | sll_map_container_t _window_size_constraints; 12 | 13 | 14 | 15 | void _deinit_platform(void){ 16 | sll_map_container_deinit(&_window_size_constraints); 17 | UnregisterClassA("_sll_window_extension_default_class",_winapi_hinstance); 18 | } 19 | 20 | 21 | 22 | sll_bool_t _init_platform(void){ 23 | _winapi_hinstance=GetModuleHandle(NULL); 24 | sll_map_container_init(NULL,NULL,&_window_size_constraints); 25 | WNDCLASSA wnd_class={ 26 | 0, 27 | _window_wnd_proc, 28 | 0, 29 | 0, 30 | _winapi_hinstance, 31 | NULL, 32 | LoadCursorA(_winapi_hinstance,MAKEINTRESOURCE(IDC_ARROW)), 33 | NULL, 34 | NULL, 35 | "_sll_window_extension_default_class" 36 | }; 37 | RegisterClassA(&wnd_class); 38 | SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); 39 | return 1; 40 | } 41 | 42 | 43 | 44 | __WINDOW_MANAGER_API_CALL void* window_api_get_context(void){ 45 | return _winapi_hinstance; 46 | } 47 | -------------------------------------------------------------------------------- /src/fuzzer/debug_main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | 6 | int __lsan_is_turned_off(void){ 7 | return 1; 8 | } 9 | 10 | 11 | 12 | const char* __asan_default_options(void){ 13 | return "handle_abort=1:log_path=stderr"; 14 | } 15 | 16 | 17 | 18 | int main(int argc,const char*const* argv){ 19 | char cwd[SLL_API_MAX_FILE_PATH_LENGTH]; 20 | getcwd(cwd,SLL_API_MAX_FILE_PATH_LENGTH); 21 | argv++; 22 | argc--; 23 | while (argc){ 24 | const sll_char_t* args[2]={ 25 | SLL_CHAR("-s"), 26 | SLL_CHAR(*argv) 27 | }; 28 | (void)sll_cli_main(2,args); 29 | argv++; 30 | argc--; 31 | chdir(cwd); 32 | } 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /src/sll/api/log.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | 13 | 14 | __SLL_EXTERNAL __SLL_API_CALL __SLL_CHECK_OUTPUT sll_bool_t sll_api_log_log(const sll_object_t* args,sll_arg_count_t arg_count){ 15 | sll_string_index_t fp; 16 | sll_string_index_t fn; 17 | sll_file_offset_t ln=sll_get_location(sll_current_runtime_data->assembly_data,sll_thread_get_instruction_index(SLL_UNKNOWN_THREAD_INDEX),&fp,&fn); 18 | sll_string_t s; 19 | sll_api_string_convert(args,arg_count,&s); 20 | sll_bool_t out=sll_log_raw((fp==SLL_MAX_STRING_INDEX?SLL_CHAR("@console"):(sll_current_runtime_data->assembly_data->string_table.data+fp)->data),(fn==SLL_MAX_STRING_INDEX?SLL_CHAR("@code"):(sll_current_runtime_data->assembly_data->string_table.data+fn)->data),ln,0,&s); 21 | sll_free_string(&s); 22 | return out; 23 | } 24 | 25 | 26 | 27 | __SLL_EXTERNAL __SLL_API_CALL __SLL_CHECK_OUTPUT sll_bool_t sll_api_log_set(const sll_string_t* file,const sll_string_t* func,sll_logger_flags_t flags,sll_bool_t state){ 28 | return sll_set_log_flags((file?file->data:NULL),(func?func->data:NULL),flags,state); 29 | } 30 | -------------------------------------------------------------------------------- /src/sll/api/map.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | 9 | __SLL_EXTERNAL __SLL_API_CALL void sll_api_map_extend(sll_map_t* map,const sll_map_t* new){ 10 | sll_map_join(NULL,new,map); 11 | } 12 | 13 | 14 | 15 | __SLL_EXTERNAL __SLL_API_CALL __SLL_CHECK_OUTPUT sll_map_length_t sll_api_map_remove(sll_map_t* map,sll_object_t key){ 16 | SLL_RELEASE(sll_map_remove(NULL,key,map)); 17 | return map->length; 18 | } 19 | -------------------------------------------------------------------------------- /src/sll/api/object.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | 12 | __SLL_EXTERNAL __SLL_API_CALL __SLL_CHECK_OUTPUT sll_object_t sll_api_object_new(const sll_string_t* format,const sll_object_t* args,sll_arg_count_t length){ 13 | sll_var_arg_list_t va_list; 14 | SLL_VAR_ARG_INIT_SLL(&va_list,args,length); 15 | sll_audit(SLL_CHAR("sll.object.new"),SLL_CHAR("sO+"),format,args,length); 16 | return sll_new_object_list(format->data,format->length,&va_list); 17 | } 18 | -------------------------------------------------------------------------------- /src/sll/api/struct.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | 7 | 8 | __SLL_EXTERNAL __SLL_API_CALL __SLL_CHECK_OUTPUT sll_float_t sll_api_struct_double_from_bits(__SLL_U64 value){ 9 | f64_data_t dt={ 10 | .data=value 11 | }; 12 | return dt.value; 13 | } 14 | 15 | 16 | 17 | __SLL_EXTERNAL __SLL_API_CALL __SLL_CHECK_OUTPUT sll_float_t sll_api_struct_float_from_bits(__SLL_U32 value){ 18 | f32_data_t dt={ 19 | .data=value 20 | }; 21 | return dt.value; 22 | } 23 | 24 | 25 | 26 | __SLL_EXTERNAL __SLL_API_CALL __SLL_CHECK_OUTPUT sll_integer_t sll_api_struct_double_to_bits(sll_float_t value){ 27 | f64_data_t dt={ 28 | .value=value 29 | }; 30 | return dt.data; 31 | } 32 | 33 | 34 | 35 | __SLL_EXTERNAL __SLL_API_CALL __SLL_CHECK_OUTPUT sll_integer_t sll_api_struct_float_to_bits(sll_float_t value){ 36 | f32_data_t dt={ 37 | .value=(__SLL_F32)value 38 | }; 39 | return dt.data; 40 | } 41 | -------------------------------------------------------------------------------- /src/sll/api/time.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | 12 | __SLL_EXTERNAL __SLL_API_CALL __SLL_CHECK_OUTPUT sll_time_t sll_api_time_current(void){ 13 | return sll_platform_get_current_time(); 14 | } 15 | 16 | 17 | 18 | __SLL_EXTERNAL __SLL_API_CALL __SLL_CHECK_OUTPUT sll_time_t sll_api_time_sleep(const sll_number_t* time){ 19 | sll_time_t st=sll_platform_get_current_time(); 20 | sll_platform_sleep((time->type==SLL_PARSE_ARGS_TYPE_INT?time->data.int_:(sll_integer_t)round(time->data.float_))); 21 | return sll_platform_get_current_time()-st; 22 | } 23 | -------------------------------------------------------------------------------- /src/sll/compression.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | 10 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_compressed_integer_t sll_compress_integer(sll_size_t int_){ 11 | if (int_<128){ 12 | return int_; 13 | } 14 | sll_size_t offset=0; 15 | __SLL_U32 shift=FIND_LAST_SET_BIT(int_); 16 | SLL_ASSERT(shift>=7); 17 | if (int_&(int_-1)){ 18 | __SLL_U32 new_shift=shift-1; 19 | sll_size_t exp=1ull<>58||FIND_LAST_SET_BIT(offset)>=new_shift-5){ 28 | return int_; 29 | } 30 | } 31 | return (shift==64?0:shift-6)|(offset<<6); 32 | } 33 | 34 | 35 | 36 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_size_t sll_decompress_integer(sll_compressed_integer_t compressed_int){ 37 | sll_size_t out=compressed_int>>7; 38 | if (compressed_int&64){ 39 | out=~out; 40 | } 41 | sll_size_t shift=compressed_int&63; 42 | if (shift){ 43 | out+=1ull<<(shift+6); 44 | } 45 | return out; 46 | } 47 | -------------------------------------------------------------------------------- /src/sll/cpuid_check.asm: -------------------------------------------------------------------------------- 1 | [BITS 64] 2 | section .text 3 | %include "sll/_internal/common.inc" 4 | 5 | 6 | 7 | %define CPUID_PROCESSOR_INFO 1 8 | %define CPUID_EXTENDED_FEATURES 7 9 | 10 | %define CPUID_AVX_TYPE CPUID_PROCESSOR_INFO 11 | %define CPUID_AVX_BIT 27 12 | %define CPUID_AVX_REGISTER ecx 13 | %define CPUID_AVX2_TYPE CPUID_EXTENDED_FEATURES 14 | %define CPUID_AVX2_BIT 5 15 | %define CPUID_AVX2_REGISTER ebx 16 | 17 | 18 | 19 | __SLL_EXPORT _check_cpuid_flags 20 | xor r8d, r8d 21 | %ifndef __SLL_BUILD_DARWIN 22 | mov r9, rbx 23 | mov eax, CPUID_AVX_TYPE 24 | xor ecx, ecx 25 | cpuid 26 | bt CPUID_AVX_REGISTER, CPUID_AVX_BIT 27 | setnc r8b 28 | mov eax, CPUID_AVX2_TYPE 29 | xor ecx, ecx 30 | cpuid 31 | bt CPUID_AVX2_REGISTER, CPUID_AVX2_BIT 32 | setnc r8b 33 | mov rbx, r9 34 | %endif 35 | mov eax, r8d 36 | ret 37 | -------------------------------------------------------------------------------- /src/sll/critical.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | 11 | __SLL_NO_RETURN void _critical_failure(const sll_char_t* name,sll_error_t err){ 12 | sll_file_descriptor_t fd=sll_platform_get_default_stream_descriptor(SLL_PLATFORM_STREAM_ERROR); 13 | sll_platform_file_write(fd,CRITICAL_ERROR_START,CRITICAL_ERROR_START_SIZE,NULL); 14 | sll_platform_file_write(fd,name,sll_string_length(name),NULL); 15 | if (err!=SLL_NO_ERROR){ 16 | sll_char_t buffer[16]; 17 | __SLL_U32 i=16; 18 | while (i){ 19 | i--; 20 | buffer[i]=(err&15)+48; 21 | if (buffer[i]>57){ 22 | buffer[i]+=39; 23 | } 24 | err>>=4; 25 | } 26 | sll_platform_file_write(fd,buffer,16,NULL); 27 | } 28 | sll_platform_file_write(fd,CRITICAL_ERROR_END,CRITICAL_ERROR_END_SIZE,NULL); 29 | _force_exit_platform(); 30 | } 31 | -------------------------------------------------------------------------------- /src/sll/data/cpuid_error.txt: -------------------------------------------------------------------------------- 1 | Required CPU flags to execute this library (AVX and AVX2) are not present on the current system. 2 | -------------------------------------------------------------------------------- /src/sll/data/critical_error.txt: -------------------------------------------------------------------------------- 1 | The following critical function call returned an error: 2 | $$$ 3 | If you belive that this is not an issue with your system and/or 4 | code, create a new issue at https://github.com/sl-lang/sll/issues 5 | with the label 'bug' and any other that may apply. 6 | -------------------------------------------------------------------------------- /src/sll/data/memory_fail.txt: -------------------------------------------------------------------------------- 1 | Due to the lack of system memory or an ambitious allocation size, 2 | the following function call failed to process the requested data: 3 | $$$ 4 | If you belive that this is not an issue with your system and/or 5 | code, create a new issue at https://github.com/sl-lang/sll/issues 6 | with the labels 'bug', 'memory-fail' and any other that may apply. 7 | -------------------------------------------------------------------------------- /src/sll/data/operator_parser.txt: -------------------------------------------------------------------------------- 1 | ! not 2 | !! bool 3 | !. thread_id 4 | !<* thread_lock 5 | !<+ thread_semaphore 6 | !<- read_blocking 7 | !<. read_blocking_char 8 | !<< thread_wait 9 | !<= thread_barrier_eq 10 | !<> thread_barrier_geq 11 | != not_equal 12 | !== strict_not_equal 13 | !@@ thread_exit 14 | # operation_list variable_declaration 15 | ## operation_list export 16 | $ length 17 | % mod 18 | %% ref 19 | & bit_and 20 | && and 21 | &: decl #declaration 22 | &:? nameof_type 23 | * mult 24 | *** inline_func $function 25 | + add 26 | ++ inc 27 | , comma 28 | ,,, func $function 29 | - sub 30 | -- dec 31 | --- operation_list import 32 | -> for $loop 33 | . new 34 | ... internal_func 35 | .? nameof 36 | / div 37 | // floor_div 38 | : access 39 | :! deep_copy 40 | :: cast 41 | :> print 42 | :? typeof 43 | < less 44 | <- call 45 | <-* call_array 46 | << bit_left_shift 47 | <<< continue 48 | <= less_equal 49 | = assign 50 | == equal 51 | === strict_equal 52 | > more 53 | >- while $loop 54 | >< loop 55 | >= more_equal 56 | >> bit_right_shift 57 | ? if 58 | ?: inline_if 59 | ?? switch 60 | @ break 61 | @@ return 62 | [< while_array $loop 63 | [> for_array $loop 64 | ^ bit_xor 65 | {< while_map $loop 66 | {> for_map $loop 67 | | bit_or 68 | |: has 69 | || or 70 | ~ bit_not 71 | -------------------------------------------------------------------------------- /src/sll/debug.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | 12 | 13 | __SLL_EXTERNAL void sll_debug_print_assembly(const sll_assembly_data_t* assembly_data){ 14 | sll_print_assembly(assembly_data,sll_stdout); 15 | sll_file_write_char(sll_stdout,'\n',NULL); 16 | } 17 | 18 | 19 | 20 | __SLL_EXTERNAL void sll_debug_print_node(sll_node_t node,const sll_source_file_t* source_file){ 21 | sll_print_node(source_file,NULL,node,sll_stdout); 22 | sll_file_write_char(sll_stdout,'\n',NULL); 23 | } 24 | 25 | 26 | 27 | __SLL_EXTERNAL void sll_debug_print_object(sll_object_t object){ 28 | if (object->type==SLL_OBJECT_TYPE_STRING){ 29 | sll_file_write(sll_stdout,object->data.string.data,object->data.string.length*sizeof(sll_char_t),NULL); 30 | } 31 | else{ 32 | sll_string_t str; 33 | sll_api_string_convert(&object,1,&str); 34 | sll_file_write(sll_stdout,str.data,str.length*sizeof(sll_char_t),NULL); 35 | sll_free_string(&str); 36 | } 37 | sll_file_write_char(sll_stdout,'\n',NULL); 38 | } 39 | -------------------------------------------------------------------------------- /src/sll/identifier.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | 7 | 8 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_string_index_t sll_identifier_get_string_index(sll_identifier_t* identifier){ 9 | return SLL_IDENTIFIER_GET_STRING_INDEX(identifier); 10 | } 11 | 12 | 13 | 14 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_bool_t sll_identifier_is_tls(sll_identifier_t* identifier){ 15 | return SLL_IDENTIFIER_IS_TLS(identifier); 16 | } 17 | 18 | 19 | 20 | __SLL_EXTERNAL void sll_identifier_set_string_index(sll_identifier_t* identifier,sll_string_index_t name_string_index,sll_bool_t tls){ 21 | SLL_IDENTIFIER_SET_STRING_INDEX(identifier,name_string_index,tls); 22 | } 23 | 24 | 25 | 26 | __SLL_EXTERNAL void sll_identifier_update_string_index(sll_identifier_t* identifier,sll_string_index_t name_string_index){ 27 | SLL_IDENTIFIER_UPDATE_STRING_INDEX(identifier,name_string_index); 28 | } 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/sll/include/sll/_file_descriptor.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__FILE_DESCRIPTOR_H__ 2 | #define __SLL__FILE_DESCRIPTOR_H__ 1 3 | 4 | 5 | 6 | /** 7 | * \flags type var 8 | * \name sll_file_descriptor_t 9 | * \group platform 10 | * \subgroup platform-file 11 | * \desc Docs! 12 | * \type void* 13 | */ 14 | typedef void* sll_file_descriptor_t; 15 | 16 | 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/allocator.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_ALLOCATOR_H__ 2 | #define __SLL__INTERNAL_ALLOCATOR_H__ 1 3 | #include 4 | 5 | 6 | 7 | #define ALLOCATOR_HEADER_GET_SIZE(h) ((h)->data) 8 | #define ALLOCATOR_HEADER_INIT(h,sz) \ 9 | do{ \ 10 | (h)->data=(sz); \ 11 | } while (0) 12 | 13 | 14 | 15 | typedef struct _ALLOCATOR_HEADER{ 16 | __SLL_U64 data; 17 | } allocator_header_t; 18 | 19 | 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/api/atexit.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_API_ATEXIT_H__ 2 | #define __SLL__INTERNAL_API_ATEXIT_H__ 1 3 | #include 4 | #include 5 | 6 | 7 | 8 | typedef struct _ATEXIT_FUNCTION{ 9 | sll_integer_t function; 10 | sll_arg_count_t arg_count; 11 | sll_object_t args[]; 12 | } atexit_function_t; 13 | 14 | 15 | 16 | void _atexit_execute(void); 17 | 18 | 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/api/file.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_API_FILE_H__ 2 | #define __SLL__INTERNAL_API_FILE_H__ 1 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | 9 | typedef union _EXTENDED_FILE_DATA{ 10 | sll_file_t struct_; 11 | sll_file_t* pointer; 12 | } extended_file_data_t; 13 | 14 | 15 | 16 | typedef struct _EXTENDED_FILE{ 17 | extended_file_data_t data; 18 | sll_reference_count_t reference_count; 19 | sll_bool_t is_pointer; 20 | void* data_pointer; 21 | } extended_file_t; 22 | 23 | 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/api/hash.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_API_HASH_H__ 2 | #define __SLL__INTERNAL_API_HASH_H__ 1 3 | 4 | 5 | 6 | #define MD5_STEP0(b,c,d) (d^(b&(c^d))) 7 | #define MD5_STEP1(b,c,d) (c^(d&(b^c))) 8 | #define MD5_STEP2(b,c,d) (b^c^d) 9 | #define MD5_STEP3(b,c,d) (c^(b|(~d))) 10 | #define MD5_STEP(a,b,c,d,t,s,v) a=ROTATE_BITS(a+MD5_STEP##t(b,c,d)+v,s)+b 11 | 12 | #define SHA1_STEP0(b,c,d) (d^(b&(c^d)))+0x5a827999 13 | #define SHA1_STEP1(b,c,d) (b^c^d)+0x6ed9eba1 14 | #define SHA1_STEP2(b,c,d) ((b&c)|(b&d)|(c&d))+0x8f1bbcdc 15 | #define SHA1_STEP3(b,c,d) (b^c^d)+0xca62c1d6 16 | #define SHA1_STEP(a,b,c,d,e,fn,v) \ 17 | e=ROTATE_BITS(a,5)+SHA1_STEP##fn(b,c,d)+e+v; \ 18 | b=ROTATE_BITS(b,30); 19 | 20 | #define SHA256_STEP(a,b,c,d,e,f,g,h,v) \ 21 | t=(ROTATE_BITS_RIGHT(e,6)^ROTATE_BITS_RIGHT(e,11)^ROTATE_BITS_RIGHT(e,25))+(g^(e&(f^g)))+h+v; \ 22 | d+=t; \ 23 | h=t+(ROTATE_BITS_RIGHT(a,2)^ROTATE_BITS_RIGHT(a,13)^ROTATE_BITS_RIGHT(a,22))+((a&b)|((a|b)&c)); 24 | 25 | #define SHA512_STEP(a,b,c,d,e,f,g,h,v) \ 26 | t=(ROTATE_BITS_RIGHT64(e,14)^ROTATE_BITS_RIGHT64(e,18)^ROTATE_BITS_RIGHT64(e,41))+(g^(e&(f^g)))+h+v; \ 27 | d+=t; \ 28 | h=t+(ROTATE_BITS_RIGHT64(a,28)^ROTATE_BITS_RIGHT64(a,34)^ROTATE_BITS_RIGHT64(a,39))+((a&b)|((a|b)&c)); 29 | 30 | 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/api/json.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_API_JSON_H__ 2 | #define __SLL__INTERNAL_API_JSON_H__ 1 3 | #include 4 | 5 | 6 | 7 | #define JSON_NUMBER_INT 0 8 | #define JSON_NUMBER_FLOAT 1 9 | 10 | 11 | 12 | typedef union _JSON_NUMBER{ 13 | sll_integer_t int_; 14 | sll_float_t float_; 15 | } json_number_t; 16 | 17 | 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/api/math.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_API_MATH_H__ 2 | #define __SLL__INTERNAL_API_MATH_H__ 1 3 | 4 | 5 | 6 | #define PUSH_FACTOR(v,c) \ 7 | do{ \ 8 | i++; \ 9 | out=sll_reallocate(out,i*sizeof(sll_factor_t)); \ 10 | (out+i-1)->number=v; \ 11 | (out+i-1)->power=c; \ 12 | } while (0) 13 | 14 | #define WHEEL_STEP(x) \ 15 | if (!(n%f)){ \ 16 | j=0; \ 17 | do{ \ 18 | j++; \ 19 | n/=f; \ 20 | } while (!(n%f)); \ 21 | PUSH_FACTOR(f,j); \ 22 | } \ 23 | f+=x; \ 24 | if (f*f>n){ \ 25 | break; \ 26 | } 27 | 28 | #define WHEEL_STEP_EULER(x) \ 29 | if (!(n%f)){ \ 30 | do{ \ 31 | n/=f; \ 32 | } while (!(n%f)); \ 33 | out-=out/f; \ 34 | } \ 35 | f+=x; \ 36 | if (f*f>n){ \ 37 | break; \ 38 | } 39 | 40 | 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/api/serial.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_API_SERIAL_H__ 2 | #define __SLL__INTERNAL_API_SERIAL_H__ 1 3 | 4 | 5 | 6 | #define STRING_COMPRESSION_MIN_LENGTH 32 7 | #define STRING_COMPRESSION_OFFSET_BIT_COUNT 9 8 | #define STRING_COMPRESSION_LENGTH_BIT_COUNT 4 9 | 10 | 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/api/string.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_API_STRING_H__ 2 | #define __SLL__INTERNAL_API_STRING_H__ 1 3 | #include 4 | 5 | 6 | 7 | typedef struct _ADDRESS_LIST{ 8 | addr_t addr; 9 | struct _ADDRESS_LIST* next; 10 | } address_list_t; 11 | 12 | 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/api_call.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_API_CALL_H__ 2 | #define __SLL__INTERNAL_API_CALL_H__ 1 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | 13 | 14 | #define RETURN_VALUE_GET_TYPE(r) ((r)&0xff) 15 | #define RETURN_VALUE_FLAG_ERROR 256 16 | 17 | 18 | 19 | typedef union _API_RETURN_VALUE{ 20 | sll_integer_t int_; 21 | sll_float_t float_; 22 | sll_complex_t complex_; 23 | sll_number_t number; 24 | sll_string_t string; 25 | sll_array_t array; 26 | sll_map_t map; 27 | sll_object_t object; 28 | sll_error_t error; 29 | } api_return_value_t; 30 | 31 | 32 | 33 | sll_object_t _call_api_func(sll_function_index_t function,const sll_object_t* args,sll_arg_count_t arg_count); 34 | 35 | 36 | 37 | __SLL_API_CALL sll_integer_t _call_api_func_assembly(api_return_value_t* return_value,const bitmap_t* registers,const void* data,sll_arg_count_t arg_count,sll_internal_function_pointer_t function); 38 | 39 | 40 | 41 | void _parse_api_call_format(const sll_char_t* format,sll_internal_function_t* out); 42 | 43 | 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/attribute.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_ATTRIBUTE_H__ 2 | #define __SLL__INTERNAL_ATTRIBUTE_H__ 1 3 | 4 | 5 | 6 | #ifdef __SLL_BUILD_WINDOWS 7 | #define __SLL_FORCE_INLINE __inline __forceinline 8 | #define __SLL_NO_RETURN __declspec(noreturn) 9 | #define __SLL_TLS __declspec(thread) 10 | #else 11 | #define __SLL_FORCE_INLINE inline __attribute__((always_inline)) 12 | #define __SLL_NO_RETURN __attribute__((noreturn)) 13 | #define __SLL_TLS __thread 14 | #endif 15 | 16 | 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/audit.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_AUDIT_H__ 2 | #define __SLL__INTERNAL_AUDIT_H__ 1 3 | 4 | 5 | 6 | void _audit_cleanup(void); 7 | 8 | 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/barrier.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_BARRIER_H__ 2 | #define __SLL__INTERNAL_BARRIER_H__ 1 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | 11 | typedef struct _BARRIER{ 12 | sll_barrier_counter_t count; 13 | sll_thread_index_t first; 14 | thread_data_t* last; 15 | } barrier_t; 16 | 17 | 18 | 19 | void _barrier_deinit(void); 20 | 21 | 22 | 23 | void _barrier_init(void); 24 | 25 | 26 | 27 | sll_bool_t _barrier_wait(sll_integer_t barrier_index,sll_integer_t value,sll_bool_t greate_or_equal); 28 | 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/bundle.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_BUNDLE_H__ 2 | #define __SLL__INTERNAL_BUNDLE_H__ 1 3 | #include 4 | #include 5 | 6 | 7 | 8 | #define BUNDLE_DO_NOT_REMAP_IMPORT 0x80000000 9 | #define BUNDLE_GET_INDEX(x) ((*(x))&0x7fffffff) 10 | 11 | 12 | 13 | typedef struct _SOURCE_FILE_WITH_INDEX{ 14 | sll_source_file_t* source_file; 15 | sll_source_file_index_t index; 16 | } source_file_with_index_t; 17 | 18 | 19 | 20 | typedef struct _SOURCE_FILE_LIST{ 21 | source_file_with_index_t* data; 22 | sll_source_file_index_t length; 23 | } source_file_list_t; 24 | 25 | 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/cli.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_CLI_H__ 2 | #define __SLL__INTERNAL_CLI_H__ 1 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | 13 | 14 | #define CLI_VM_STACK_SIZE 131072 15 | #define CLI_VM_CALL_STACK_SIZE 256 16 | 17 | #define CLI_FLAG_SINGLE_OUTPUT SLL_CLI_FLAG_RESERVED0 18 | 19 | #define CLI_PATH_RESOLVER_TABLE_SIZE 512 20 | 21 | #if SLL_VERSION_HAS_SHA 22 | #define CLI_BUILD_TYPE_STRING "commit/"SLL_VERSION_SHA" [https://github.com/sl-lang/sll/tree/"SLL_VERSION_TAG"]" 23 | #else 24 | #define CLI_BUILD_TYPE_STRING "local" 25 | #endif 26 | 27 | 28 | 29 | typedef struct _CLI_INCLUDE_DIR{ 30 | sll_string_t name; 31 | sll_string_t path; 32 | } cli_include_dir_t; 33 | 34 | 35 | 36 | typedef struct _CLI_BUNDLE_SOURCE{ 37 | sll_char_t* name; 38 | sll_bundle_t bundle; 39 | } cli_bundle_source_t; 40 | 41 | 42 | 43 | typedef struct _CLI_AUDIT_LIBRARY{ 44 | const sll_char_t* name; 45 | sll_library_handle_t handle; 46 | } cli_audit_library_t; 47 | 48 | 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/common.inc: -------------------------------------------------------------------------------- 1 | %ifdef __SLL_BUILD_DARWIN 2 | %define __SLL_EXPORT_NAME(nm) _ %+ nm 3 | %else 4 | %define __SLL_EXPORT_NAME(nm) nm 5 | %endif 6 | %ifdef __SLL_BUILD_WINDOWS 7 | extern __chkstk 8 | %endif 9 | 10 | 11 | 12 | %macro __SLL_EXPORT 1 13 | global __SLL_EXPORT_NAME(%1) 14 | __SLL_EXPORT_NAME(%1) %+ : 15 | %endmacro 16 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/dispatcher.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_DISPATCHER_H__ 2 | #define __SLL__INTERNAL_DISPATCHER_H__ 1 3 | #ifndef __SLL_BUILD_WINDOWS 4 | #include 5 | #endif 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | 14 | 15 | #ifdef __SLL_BUILD_WINDOWS 16 | #define INIT_RAW_EVENT(raw,fd_) (*(raw)=(fd_)) 17 | #else 18 | #define INIT_RAW_EVENT(raw,fd_) \ 19 | do{ \ 20 | (raw)->fd=(int)ADDR((fd_)); \ 21 | (raw)->events=POLLIN; \ 22 | } while (0) 23 | #endif 24 | 25 | 26 | 27 | typedef __SLL_U32 event_list_length_t; 28 | 29 | 30 | 31 | typedef struct _EVENT_DATA{ 32 | sll_file_t* file; 33 | sll_thread_index_t thread_index; 34 | sll_string_length_t size; 35 | } event_data_t; 36 | 37 | 38 | 39 | #ifdef __SLL_BUILD_WINDOWS 40 | typedef void* raw_event_data_t; 41 | #else 42 | typedef struct pollfd raw_event_data_t; 43 | #endif 44 | 45 | 46 | 47 | void _io_dispatcher_deinit(void); 48 | 49 | 50 | 51 | void _io_dispatcher_init(void); 52 | 53 | 54 | 55 | void _io_dispatcher_queue(sll_file_t* file,sll_string_length_t sz); 56 | 57 | 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/environment.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_ENVIRONMENT_H__ 2 | #define __SLL__INTERNAL_ENVIRONMENT_H__ 1 3 | 4 | 5 | 6 | void _deinit_environment(void); 7 | 8 | 9 | 10 | void _init_environment(void); 11 | 12 | 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/error.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_ERROR_H__ 2 | #define __SLL__INTERNAL_ERROR_H__ 1 3 | #include 4 | #include 5 | #ifdef __SLL_BUILD_FUZZER 6 | #include 7 | #endif 8 | 9 | 10 | 11 | #ifdef __SLL_BUILD_FUZZER 12 | #define ERROR_PTR(e) \ 13 | do{ \ 14 | sll_error_t __err=(e); \ 15 | if (__err!=SLL_NO_ERROR){ \ 16 | SLL_LOG(">>> [%s:%u(%s)]: %.16llx\n",__FILE__,__LINE__,__func__,__err); \ 17 | } \ 18 | if (err){ \ 19 | *err=__err; \ 20 | } \ 21 | } while (0) 22 | #else 23 | #define ERROR_PTR(e) \ 24 | do{ \ 25 | if (err){ \ 26 | *err=(e); \ 27 | } \ 28 | } while (0) 29 | #endif 30 | 31 | #define ERROR_PTR_RESET ERROR_PTR(SLL_NO_ERROR) 32 | #define ERROR_PTR_SYSTEM ERROR_PTR(sll_platform_get_error()) 33 | #define DATA_IF_ERROR_PTR(x,v) (err&&*err!=SLL_NO_ERROR?(v):(x)) 34 | #define ZERO_IF_ERROR_PTR(x) DATA_IF_ERROR_PTR((x),0) 35 | 36 | #define ERROR_STRING_POINTER_TABLE_SIZE 32 37 | 38 | 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/file.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_FILE_H__ 2 | #define __SLL__INTERNAL_FILE_H__ 1 3 | #include 4 | #include 5 | 6 | 7 | 8 | #define FILE_DYNAMIC_BUFFER_ALLOC_SIZE 65536 9 | 10 | #define FILE_FLAG_MEMORY SLL_FILE_FLAG_RESERVED0 11 | #define FILE_FLAG_NO_RELEASE SLL_FILE_FLAG_RESERVED1 12 | #define FILE_FLAG_DYNAMIC_BUFFERS SLL_FILE_FLAG_RESERVED2 13 | #define FILE_FLAG_PASSIVE SLL_FILE_FLAG_RESERVED3 14 | #define FILE_FLAG_BOUND SLL_FILE_FLAG_RESERVED4 15 | 16 | #define FILE_BUFFER_SIZE 2097152 17 | 18 | #define FILE_BUFFER_POOL_SIZE 32 19 | 20 | #define DISABLE_FILE_HASH 255 21 | 22 | 23 | 24 | typedef struct _DYNAMIC_BUFFER_CHUNK{ 25 | sll_size_t size; 26 | struct _DYNAMIC_BUFFER_CHUNK* next; 27 | sll_char_t data[]; 28 | } dynamic_buffer_chunk_t; 29 | 30 | 31 | 32 | void _file_end_hash(sll_file_t* f); 33 | 34 | 35 | 36 | void _file_init_std_streams(void); 37 | 38 | 39 | 40 | void _file_release_std_streams(void); 41 | 42 | 43 | 44 | void _file_start_hash(sll_file_t* f); 45 | 46 | 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/init.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_INIT_H__ 2 | #define __SLL__INTERNAL_INIT_H__ 1 3 | #include 4 | 5 | 6 | 7 | #define MAX_CLEANUP_TABLE_SIZE 512 8 | 9 | 10 | 11 | void _cleanup_vm_exit_tables(void); 12 | 13 | 14 | 15 | __SLL_API_CALL sll_bool_t _check_cpuid_flags(void); 16 | 17 | 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/lock.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_LOCK_H__ 2 | #define __SLL__INTERNAL_LOCK_H__ 1 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | 11 | typedef struct _LOCK{ 12 | sll_thread_index_t lock; 13 | sll_thread_index_t first; 14 | thread_data_t* last; 15 | } lock_t; 16 | 17 | 18 | 19 | sll_bool_t _lock_wait(sll_integer_t lock_index); 20 | 21 | 22 | 23 | void _lock_deinit(void); 24 | 25 | 26 | 27 | void _lock_init(void); 28 | 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/log.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_LOG_H__ 2 | #define __SLL__INTERNAL_LOG_H__ 1 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | 10 | typedef struct _LOG_FUNCTION_DATA{ 11 | const sll_string_t name; 12 | sll_logger_flags_t flags; 13 | } log_function_data_t; 14 | 15 | 16 | 17 | typedef struct _LOG_FILE_DATA{ 18 | const sll_string_t name; 19 | sll_container_t functions; 20 | sll_logger_flags_t flags; 21 | } log_file_data_t; 22 | 23 | 24 | 25 | void _log_release_data(void); 26 | 27 | 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/magic_number.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_MAGIC_NUMBER_H__ 2 | #define __SLL__INTERNAL_MAGIC_NUMBER_H__ 1 3 | #include 4 | 5 | 6 | 7 | #define _CREATE_MAGIC_NUMBER(a,b,c,d) ((((magic_number_t)(d))<<24)|(((magic_number_t)(c))<<16)|(((magic_number_t)(b))<<8)|(a)) 8 | 9 | #define ASSEMBLY_FILE_MAGIC_NUMBER _CREATE_MAGIC_NUMBER('S','L','A',0) 10 | #define BUNDLE_FILE_MAGIC_NUMBER _CREATE_MAGIC_NUMBER('S','L','B',0) 11 | #define COMPLIED_OBJECT_FILE_MAGIC_NUMBER _CREATE_MAGIC_NUMBER('S','L','C',0) 12 | 13 | 14 | 15 | typedef __SLL_U32 magic_number_t; 16 | 17 | 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/new_object.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_NEW_OBJECT_H__ 2 | #define __SLL__INTERNAL_NEW_OBJECT_H__ 1 3 | #include 4 | 5 | 6 | 7 | #define NEW_OBJECT_FLAG_NO_ACQUIRE 1 8 | #define NEW_OBJECT_FLAG_ARRAY 2 9 | #define NEW_OBJECT_FLAG_DEREF 4 10 | 11 | 12 | 13 | typedef __SLL_U8 object_creation_flags_t; 14 | 15 | 16 | 17 | typedef struct _STRUCT_OFFSET_BUILDER{ 18 | sll_size_t* offset_data; 19 | sll_arg_count_t offset_count; 20 | void** converter_function_data; 21 | sll_arg_count_t converter_function_count; 22 | } struct_offset_builder_t; 23 | 24 | 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/optimizer.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_OPTIMIZER_H__ 2 | #define __SLL__INTERNAL_OPTIMIZER_H__ 1 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | 10 | #define SKIP_NODE_NOP(node) \ 11 | while ((node)->type==SLL_NODE_TYPE_NOP||(node)->type==SLL_NODE_TYPE_DBG||(node)->type==SLL_NODE_TYPE_CHANGE_STACK){ \ 12 | (node)=((node)->type==SLL_NODE_TYPE_CHANGE_STACK?(node)->data._next_node:(node)+1); \ 13 | } 14 | 15 | 16 | 17 | typedef __SLL_U8 child_level_count_t; 18 | 19 | 20 | 21 | typedef __SLL_U32 child_count_t; 22 | 23 | 24 | 25 | typedef struct __OPTIMIZER_NODE_CHILDREN_DATA{ 26 | sll_node_t node; 27 | struct __OPTIMIZER_NODE_CHILDREN_DATA* children; 28 | child_count_t child_count; 29 | __SLL_U32 child_type_bitmap[3]; 30 | } optimizer_node_children_data_t; 31 | 32 | 33 | 34 | void _delete_node(optimizer_node_children_data_t* data,sll_node_t parent); 35 | 36 | 37 | 38 | void _expand_node(optimizer_node_children_data_t* data,sll_node_t parent); 39 | 40 | 41 | 42 | void _set_nop(optimizer_node_children_data_t* data); 43 | 44 | 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/platform.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_PLATFORM_H__ 2 | #define __SLL__INTERNAL_PLATFORM_H__ 1 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | 10 | #define CSR_REGISTER_FLAGS 0x8040 11 | 12 | 13 | 14 | typedef __SLL_U32 file_list_length_t; 15 | 16 | 17 | 18 | typedef struct _EXECUTE_WRAPPER_DATA{ 19 | sll_internal_thread_function_t function; 20 | void* arg; 21 | void* lock; 22 | } execute_wrapper_data_t; 23 | 24 | 25 | 26 | typedef struct _FILE_LIST_DATA{ 27 | sll_string_t* data; 28 | file_list_length_t length; 29 | } file_list_data_t; 30 | 31 | 32 | 33 | #ifdef __SLL_BUILD_WINDOWS 34 | extern void* _win_dll_handle; 35 | #endif 36 | 37 | 38 | 39 | __SLL_NO_RETURN void _force_exit_platform(void); 40 | 41 | 42 | 43 | void _deinit_platform(void); 44 | 45 | 46 | 47 | void _deinit_platform_time(void); 48 | 49 | 50 | 51 | void _init_platform(void); 52 | 53 | 54 | 55 | void _init_platform_env(void); 56 | 57 | 58 | 59 | void _init_platform_time(void); 60 | 61 | 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/print.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_PRINT_H__ 2 | #define __SLL__INTERNAL_PRINT_H__ 1 3 | #include 4 | #include 5 | 6 | 7 | 8 | #define STATIC_STRING_LEN(s) (sizeof(s)/sizeof(char)-1) 9 | #define PRINT_STATIC_STRING(s,wf) sll_file_write((wf),(s),STATIC_STRING_LEN(s),NULL) 10 | 11 | 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/sandbox.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_SANDBOX_H__ 2 | #define __SLL__INTERNAL_SANDBOX_H__ 1 3 | #include 4 | 5 | 6 | 7 | extern sll_sandbox_flags_t _sandbox_flags; 8 | 9 | 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/semaphore.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_SEMAPHORE_H__ 2 | #define __SLL__INTERNAL_SEMAPHORE_H__ 1 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | 11 | typedef struct _SEMAPHORE{ 12 | sll_semaphore_counter_t count; 13 | sll_thread_index_t first; 14 | thread_data_t* last; 15 | } semaphore_t; 16 | 17 | 18 | 19 | void _semaphore_deinit(void); 20 | 21 | 22 | 23 | void _semaphore_init(void); 24 | 25 | 26 | 27 | sll_bool_t _semaphore_wait(sll_integer_t sempahore_index); 28 | 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/string_format.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_STRING_FORMAT_H__ 2 | #define __SLL__INTERNAL_STRING_FORMAT_H__ 1 3 | 4 | 5 | 6 | #define STRING_FORMAT_FLAG_PAD_ZERO 1 7 | #define STRING_FORMAT_FLAG_SIGN 2 8 | #define STRING_FORMAT_FLAG_SPACE_SIGN 4 9 | #define STRING_FORMAT_FLAG_JUSTIFY_LEFT 8 10 | #define STRING_FORMAT_FLAG_ALTERNATIVE_FORM 16 11 | #define STRING_FORMAT_FLAG_PERCISION 32 12 | #define STRING_FORMAT_FLAG_HH_BITS 64 13 | #define STRING_FORMAT_FLAG_H_BITS 128 14 | #define STRING_FORMAT_FLAG_L_BITS 256 15 | #define STRING_FORMAT_FLAG_LL_BITS 512 16 | #define STRING_FORMAT_FLAG_UPPERCASE 1024 17 | 18 | 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/unify.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_UNIFY_H__ 2 | #define __SLL__INTERNAL_UNIFY_H__ 1 3 | #include 4 | #include 5 | 6 | 7 | 8 | typedef struct _SOURCE_FILE_MAPPING_DATA{ 9 | sll_string_index_t* string_map; 10 | sll_function_index_t function_index_offset; 11 | sll_scope_t scope_offset; 12 | sll_identifier_index_t* identifier_index_offset; 13 | } source_file_mapping_data_t; 14 | 15 | 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/util.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_UTIL_H__ 2 | #define __SLL__INTERNAL_UTIL_H__ 1 3 | #include 4 | #include 5 | 6 | 7 | 8 | #define WRAP_ARRAY_INDEX(idx,len,var) \ 9 | sll_integer_t var=(idx); \ 10 | WRAP_ARRAY_INDEX_VAR(var,(len)); 11 | #define WRAP_ARRAY_INDEX_VAR(idx,len) \ 12 | do{ \ 13 | sll_integer_t __len=(len); \ 14 | if (idx<0){ \ 15 | idx+=__len; \ 16 | if (idx<0){ \ 17 | idx=-1; \ 18 | } \ 19 | } \ 20 | else if (idx>=__len){ \ 21 | idx=__len; \ 22 | } \ 23 | } while (0) 24 | 25 | 26 | 27 | typedef union _F32_DATA{ 28 | __SLL_F32 value; 29 | __SLL_U32 data; 30 | } f32_data_t; 31 | 32 | 33 | 34 | typedef union _F64_DATA{ 35 | __SLL_F64 value; 36 | __SLL_U64 data; 37 | } f64_data_t; 38 | 39 | 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/var_arg.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_VAR_ARG_H__ 2 | #define __SLL__INTERNAL_VAR_ARG_H__ 1 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | 9 | #define VAR_ARG_LIST_TYPE_STRUCT SLL_VAR_ARG_LIST_TYPE_RESERVED0 10 | 11 | 12 | 13 | typedef sll_object_t (*converter_func_t)(void* arg); 14 | 15 | 16 | 17 | sll_object_t _var_arg_converter(sll_var_arg_list_t* va); 18 | 19 | 20 | 21 | float _var_arg_get_float32(sll_var_arg_list_t* va); 22 | 23 | 24 | 25 | addr_t _var_arg_get_pointer(sll_var_arg_list_t* va); 26 | 27 | 28 | 29 | sll_size_t _var_arg_get_mask(sll_var_arg_list_t* va); 30 | 31 | 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/vm.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_VM_H__ 2 | #define __SLL__INTERNAL_VM_H__ 1 3 | #include 4 | #include 5 | 6 | 7 | 8 | #define EXECUTE_FUNCTION_NO_AUDIT_TERMINATE SLL_EXECUTE_FUNCTION_RESERVED0 9 | 10 | 11 | 12 | void _call_function(thread_data_t* thr,sll_function_index_t fn,sll_arg_count_t ac,sll_bool_t fr); 13 | 14 | 15 | 16 | void _release_var_data(void); 17 | 18 | 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /src/sll/include/sll/_internal/weakref.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__INTERNAL_WEAKREF_H__ 2 | #define __SLL__INTERNAL_WEAKREF_H__ 1 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | 9 | typedef struct _WEAKREF_OBJECT_DATA{ 10 | addr_t object; 11 | sll_weak_ref_destructor_t destructor; 12 | void* ctx; 13 | } weakref_object_data_t; 14 | 15 | 16 | 17 | void _weakref_cleanup_data(void); 18 | 19 | 20 | 21 | void _weakref_delete(sll_object_t o); 22 | 23 | 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/sll/include/sll/_size_types.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__SIZE_TYPES_H__ 2 | #define __SLL__SIZE_TYPES_H__ 1 3 | 4 | 5 | 6 | #define __SLL_S1 signed char 7 | #define __SLL_U1 _Bool 8 | #define __SLL_S8 signed char 9 | #define __SLL_U8 unsigned char 10 | #define __SLL_S16 signed short int 11 | #define __SLL_U16 unsigned short int 12 | #define __SLL_S32 signed int 13 | #define __SLL_U32 unsigned int 14 | #define __SLL_S64 signed long long int 15 | #define __SLL_U64 unsigned long long int 16 | 17 | 18 | 19 | #define __SLL_F32 float 20 | #define __SLL_F64 double 21 | 22 | 23 | 24 | #define __SLL_U1_MAX (1) 25 | #define __SLL_U8_MAX (255) 26 | #define __SLL_U16_MAX (65535) 27 | #define __SLL_U32_MAX (4294967295u) 28 | #define __SLL_U64_MAX (18446744073709551615ull) 29 | 30 | #define __SLL_S8_MIN (-128) 31 | #define __SLL_S16_MIN (-32768) 32 | #define __SLL_S32_MIN (-2147483647-1) 33 | #define __SLL_S64_MIN (-9223372036854775808ll) 34 | 35 | #define __SLL_S8_MAX (127) 36 | #define __SLL_S16_MAX (32767) 37 | #define __SLL_S32_MAX (2147483647) 38 | #define __SLL_S64_MAX (9223372036854775807ll) 39 | 40 | 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/sll/include/sll/_string_types.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__STRING_TYPES_H__ 2 | #define __SLL__STRING_TYPES_H__ 1 3 | #include 4 | #include 5 | 6 | 7 | 8 | /** 9 | * \flags type var 10 | * \name sll_char_t 11 | * \group string 12 | * \desc Docs! 13 | * \type __SLL_U8 14 | */ 15 | typedef __SLL_U8 sll_char_t; 16 | 17 | 18 | 19 | /** 20 | * \flags type var 21 | * \name sll_string_checksum_t 22 | * \group string 23 | * \desc Docs! 24 | * \type __SLL_U32 25 | */ 26 | typedef __SLL_U32 sll_string_checksum_t; 27 | 28 | 29 | 30 | /** 31 | * \flags type var 32 | * \name sll_string_length_t 33 | * \group string 34 | * \desc Docs! 35 | * \type __SLL_U32 36 | */ 37 | typedef __SLL_U32 sll_string_length_t; 38 | 39 | 40 | 41 | /** 42 | * \flags type var 43 | * \name sll_wide_char_t 44 | * \group string 45 | * \desc Docs! 46 | * \type __SLL_U32 47 | */ 48 | typedef __SLL_U32 sll_wide_char_t; 49 | 50 | 51 | 52 | /** 53 | * \flags type 54 | * \name sll_string_t 55 | * \group string 56 | * \desc Docs! 57 | * \arg sll_string_length_t length 58 | * \arg sll_string_checksum_t checksum 59 | * \arg sll_char_t* data 60 | */ 61 | typedef struct _SLL_STRING{ 62 | sll_string_length_t length; 63 | sll_string_checksum_t checksum; 64 | sll_char_t* data; 65 | } sll_string_t; 66 | 67 | 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /src/sll/include/sll/_thread_type.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL__THREAD_TYPE_H__ 2 | #define __SLL__THREAD_TYPE_H__ 1 3 | #include 4 | 5 | 6 | 7 | /** 8 | * \flags type var 9 | * \name sll_thread_index_t 10 | * \group thread 11 | * \desc Docs! 12 | * \type __SLL_U32 13 | */ 14 | typedef __SLL_U32 sll_thread_index_t; 15 | 16 | 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /src/sll/include/sll/api/atexit.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL_API_ATEXIT_H__ 2 | #define __SLL_API_ATEXIT_H__ 1 3 | #include 4 | #include 5 | #include 6 | /** 7 | * \flags group 8 | * \name Atexit API 9 | * \group atexit-api 10 | * \desc Docs! 11 | */ 12 | 13 | 14 | 15 | /** 16 | * \flags func 17 | * \name sll_api_atexit_register 18 | * \group atexit-api 19 | * \desc Docs! 20 | * \api io!| 21 | * \arg sll_integer_t function 22 | * \arg const sll_object_t* args 23 | * \arg sll_arg_count_t arg_count 24 | */ 25 | __SLL_EXTERNAL __SLL_API_CALL void sll_api_atexit_register(sll_integer_t function,const sll_object_t* args,sll_arg_count_t arg_count); 26 | 27 | 28 | 29 | /** 30 | * \flags check_output func 31 | * \name sll_api_atexit_unregister 32 | * \api i|b 33 | * \group atexit-api 34 | * \desc Docs! 35 | * \arg sll_integer_t function 36 | * \ret sll_bool_t 37 | */ 38 | __SLL_EXTERNAL __SLL_API_CALL __SLL_CHECK_OUTPUT sll_bool_t sll_api_atexit_unregister(sll_integer_t function); 39 | 40 | 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/sll/include/sll/api/audit.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL_API_AUDIT_H__ 2 | #define __SLL_API_AUDIT_H__ 1 3 | #include 4 | #include 5 | #include 6 | #include 7 | /** 8 | * \flags group 9 | * \name Audit API 10 | * \group audit-api 11 | * \desc Docs! 12 | */ 13 | 14 | 15 | 16 | /** 17 | * \flags func 18 | * \name sll_api_audit__init 19 | * \group array-api 20 | * \desc Docs! 21 | * \api i| 22 | * \arg sll_integer_t callback 23 | */ 24 | __SLL_EXTERNAL __SLL_API_CALL void sll_api_audit__init(sll_integer_t callback); 25 | 26 | 27 | 28 | /** 29 | * \flags func 30 | * \name sll_api_audit_audit 31 | * \group array-api 32 | * \desc Docs! 33 | * \api #s#so!| 34 | * \arg const sll_string_t* name 35 | * \arg const sll_string_t* format 36 | * \arg const sll_object_t* args 37 | * \arg sll_arg_count_t arg_count 38 | */ 39 | __SLL_EXTERNAL __SLL_API_CALL void sll_api_audit_audit(const sll_string_t* name,const sll_string_t* format,const sll_object_t* args,sll_arg_count_t arg_count); 40 | 41 | 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/sll/include/sll/api/base64.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL_API_BASE64_H__ 2 | #define __SLL_API_BASE64_H__ 1 3 | #include 4 | #include 5 | #include 6 | #include 7 | /** 8 | * \flags group 9 | * \name Base 64 API 10 | * \group base64-api 11 | * \desc Docs! 12 | */ 13 | 14 | 15 | 16 | /** 17 | * \flags check_output func 18 | * \name sll_api_base64_decode 19 | * \group base64-api 20 | * \desc Docs! 21 | * \api #s|~s 22 | * \arg const sll_string_t* string 23 | * \arg sll_string_t* out 24 | * \ret sll_error_t 25 | */ 26 | __SLL_EXTERNAL __SLL_API_CALL __SLL_CHECK_OUTPUT sll_error_t sll_api_base64_decode(const sll_string_t* string,sll_string_t* out); 27 | 28 | 29 | 30 | /** 31 | * \flags func 32 | * \name sll_api_base64_encode 33 | * \group base64-api 34 | * \desc Docs! 35 | * \api #s|s 36 | * \arg const sll_string_t* string 37 | * \arg sll_string_t* out 38 | */ 39 | __SLL_EXTERNAL __SLL_API_CALL void sll_api_base64_encode(const sll_string_t* string,sll_string_t* out); 40 | 41 | 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/sll/include/sll/api/error.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL_API_ERROR_H__ 2 | #define __SLL_API_ERROR_H__ 1 3 | #include 4 | #include 5 | #include 6 | #include 7 | /** 8 | * \flags group 9 | * \name Error API 10 | * \group error-api 11 | * \desc Docs! 12 | */ 13 | 14 | 15 | 16 | /** 17 | * \flags func 18 | * \name sll_api_error_get_call_stack 19 | * \group error-api 20 | * \desc Docs! 21 | * \api DD|a 22 | * \arg sll_call_stack_size_t pop 23 | * \arg sll_thread_index_t thread_index 24 | * \arg sll_array_t* out 25 | */ 26 | __SLL_EXTERNAL __SLL_API_CALL void sll_api_error_get_call_stack(sll_call_stack_size_t pop,sll_thread_index_t thread_index,sll_array_t* out); 27 | 28 | 29 | 30 | /** 31 | * \flags func 32 | * \name sll_api_error_get_error_string 33 | * \group error-api 34 | * \desc Docs! 35 | * \api Q|s 36 | * \arg sll_error_t err 37 | * \arg sll_string_t* out 38 | */ 39 | __SLL_EXTERNAL __SLL_API_CALL void sll_api_error_get_error_string(sll_error_t err,sll_string_t* out); 40 | 41 | 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/sll/include/sll/api/log.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL_API_LOG_H__ 2 | #define __SLL_API_LOG_H__ 1 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | /** 9 | * \flags group 10 | * \name Logging API 11 | * \group log-api 12 | * \desc Docs! 13 | */ 14 | 15 | 16 | 17 | /** 18 | * \flags check_output func 19 | * \name sll_api_log_log 20 | * \group log-api 21 | * \desc Docs! 22 | * \api o!|b 23 | * \arg const sll_object_t* args 24 | * \arg sll_arg_count_t arg_count 25 | * \ret sll_bool_t 26 | */ 27 | __SLL_EXTERNAL __SLL_API_CALL __SLL_CHECK_OUTPUT sll_bool_t sll_api_log_log(const sll_object_t* args,sll_arg_count_t arg_count); 28 | 29 | 30 | 31 | /** 32 | * \flags check_output func 33 | * \name sll_api_log_set 34 | * \group log-api 35 | * \desc Docs! 36 | * \api #@s#@sBb|b 37 | * \arg sll_string_t* file 38 | * \arg sll_string_t* func 39 | * \arg sll_logger_flags_t flags 40 | * \arg sll_bool_t state 41 | * \ret sll_bool_t 42 | */ 43 | __SLL_EXTERNAL __SLL_API_CALL __SLL_CHECK_OUTPUT sll_bool_t sll_api_log_set(const sll_string_t* file,const sll_string_t* func,sll_logger_flags_t flags,sll_bool_t state); 44 | 45 | 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/sll/include/sll/api/map.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL_API_MAP_H__ 2 | #define __SLL_API_MAP_H__ 1 3 | #include 4 | #include 5 | #include 6 | /** 7 | * \flags group 8 | * \name Map API 9 | * \group map-api 10 | * \desc Docs! 11 | */ 12 | 13 | 14 | 15 | /** 16 | * \flags func 17 | * \name sll_api_map_extend 18 | * \group map-api 19 | * \desc Docs! 20 | * \api m#m| 21 | * \arg sll_map_t* map 22 | * \arg const sll_map_t* new 23 | */ 24 | __SLL_EXTERNAL __SLL_API_CALL void sll_api_map_extend(sll_map_t* map,const sll_map_t* new); 25 | 26 | 27 | 28 | /** 29 | * \flags check_output func 30 | * \name sll_api_map_remove 31 | * \group map-api 32 | * \desc Docs! 33 | * \api mo|D 34 | * \arg sll_map_t* map 35 | * \arg sll_object_t key 36 | * \ret sll_map_length_t 37 | */ 38 | __SLL_EXTERNAL __SLL_API_CALL __SLL_CHECK_OUTPUT sll_map_length_t sll_api_map_remove(sll_map_t* map,sll_object_t key); 39 | 40 | 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/sll/include/sll/api/object.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL_API_OBJECT_H__ 2 | #define __SLL_API_OBJECT_H__ 1 3 | #include 4 | #include 5 | #include 6 | #include 7 | /** 8 | * \flags group 9 | * \name Object API 10 | * \group object-api 11 | * \desc Docs! 12 | */ 13 | 14 | 15 | 16 | /** 17 | * \flags check_output func 18 | * \name sll_api_object_new 19 | * \group object-api 20 | * \desc Docs! 21 | * \api #so!|o 22 | * \arg const sll_string_t* format 23 | * \arg const sll_object_t* args 24 | * \arg sll_arg_count_t lenngth 25 | * \ret sll_object_t 26 | */ 27 | __SLL_EXTERNAL __SLL_API_CALL __SLL_CHECK_OUTPUT sll_object_t sll_api_object_new(const sll_string_t* format,const sll_object_t* args,sll_arg_count_t lenngth); 28 | 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/sll/include/sll/api/sort.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL_API_SORT_H__ 2 | #define __SLL_API_SORT_H__ 1 3 | #include 4 | #include 5 | #include 6 | #include 7 | /** 8 | * \flags group 9 | * \name Sort API 10 | * \group sort-api 11 | * \desc Docs! 12 | */ 13 | 14 | 15 | 16 | /** 17 | * \flags check_output func 18 | * \name sll_api_sort_quicksort 19 | * \group sort-api 20 | * \desc Docs! 21 | * \api &abbi|o 22 | * \arg sll_object_t arr 23 | * \arg sll_bool_t reverse 24 | * \arg sll_bool_t inplace 25 | * \arg sll_integer_t key_fn 26 | * \ret sll_object_t 27 | */ 28 | __SLL_EXTERNAL __SLL_API_CALL __SLL_CHECK_OUTPUT sll_object_t sll_api_sort_quicksort(sll_object_t arr,sll_bool_t reverse,sll_bool_t inplace,sll_integer_t key_fn); 29 | 30 | 31 | 32 | /** 33 | * \flags func 34 | * \name sll_quicksort 35 | * \group sort-api 36 | * \desc Docs! 37 | * \arg sll_object_t* elements 38 | * \arg sll_array_length_t length 39 | * \arg sll_compare_result_t cmp 40 | * \arg sll_integer_t key_fn 41 | */ 42 | __SLL_EXTERNAL void sll_quicksort(sll_object_t* elements,sll_array_length_t length,sll_compare_result_t cmp,sll_integer_t key_fn); 43 | 44 | 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/sll/include/sll/api/time.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL_API_TIME_H__ 2 | #define __SLL_API_TIME_H__ 1 3 | #include 4 | #include 5 | #include 6 | #include 7 | /** 8 | * \flags group 9 | * \name Time API 10 | * \group time-api 11 | * \desc Docs! 12 | */ 13 | 14 | 15 | 16 | /** 17 | * \flags type var 18 | * \name sll_time_t 19 | * \group time-api 20 | * \desc Docs! 21 | * \type __SLL_U64 22 | */ 23 | typedef __SLL_U64 sll_time_t; 24 | 25 | 26 | 27 | /** 28 | * \flags check_output func 29 | * \name sll_api_time_current 30 | * \group time-api 31 | * \desc Docs! 32 | * \api |Q 33 | * \ret sll_time_t 34 | */ 35 | __SLL_EXTERNAL __SLL_API_CALL __SLL_CHECK_OUTPUT sll_time_t sll_api_time_current(void); 36 | 37 | 38 | 39 | /** 40 | * \flags check_output func 41 | * \name sll_api_time_sleep 42 | * \group time-api 43 | * \desc Docs! 44 | * \api x|Q 45 | * \arg const sll_number_t* time 46 | * \ret sll_time_t 47 | */ 48 | __SLL_EXTERNAL __SLL_API_CALL __SLL_CHECK_OUTPUT sll_time_t sll_api_time_sleep(const sll_number_t* time); 49 | 50 | 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/sll/include/sll/common.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL_COMMON_H__ 2 | #define __SLL_COMMON_H__ 1 3 | #ifdef __SLL_BUILD_WINDOWS 4 | #include 5 | #endif 6 | 7 | 8 | 9 | #ifdef __SLL_BUILD_WINDOWS 10 | #ifdef __SLL_COMPILATION__ 11 | #define __SLL_EXTERNAL __declspec(dllexport) 12 | #else 13 | #define __SLL_EXTERNAL __declspec(dllimport) 14 | #endif 15 | #define __SLL_CHECK_OUTPUT _Must_inspect_result_ 16 | #define __SLL_API_CALL 17 | #else 18 | #ifdef __SLL_COMPILATION__ 19 | #define __SLL_EXTERNAL __attribute__((visibility("default"))) 20 | #else 21 | #define __SLL_EXTERNAL 22 | #endif 23 | #define __SLL_CHECK_OUTPUT __attribute__((warn_unused_result)) 24 | #define __SLL_API_CALL __attribute__((ms_abi)) 25 | #endif 26 | 27 | 28 | 29 | #ifdef __SLL_COMPILATION__ 30 | #ifndef NULL 31 | #define NULL ((void*)0) 32 | #endif 33 | #endif 34 | 35 | 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/sll/include/sll/compression.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL_COMPRESSION_H__ 2 | #define __SLL_COMPRESSION_H__ 1 3 | #include 4 | #include 5 | #include 6 | /** 7 | * \flags group 8 | * \name Compression 9 | * \group compression 10 | * \desc Docs! 11 | */ 12 | 13 | 14 | 15 | /** 16 | * \flags type var 17 | * \name sll_compressed_integer_t 18 | * \group compression 19 | * \desc Docs! 20 | * \type __SLL_U64 21 | */ 22 | typedef __SLL_U64 sll_compressed_integer_t; 23 | 24 | 25 | 26 | /** 27 | * \flags check_output func 28 | * \name sll_compress_integer 29 | * \group compression 30 | * \desc Docs! 31 | * \arg sll_size_t int_ 32 | * \ret sll_compressed_integer_t 33 | */ 34 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_compressed_integer_t sll_compress_integer(sll_size_t int_); 35 | 36 | 37 | 38 | /** 39 | * \flags check_output func 40 | * \name sll_decompress_integer 41 | * \group compression 42 | * \desc Docs! 43 | * \arg sll_compressed_integer_t compressed_int 44 | * \ret sll_size_t 45 | */ 46 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_size_t sll_decompress_integer(sll_compressed_integer_t compressed_int); 47 | 48 | 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/sll/include/sll/debug.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL_DEBUG_H__ 2 | #define __SLL_DEBUG_H__ 1 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | /** 9 | * \flags group 10 | * \name Debug 11 | * \group debug 12 | * \desc Docs! 13 | */ 14 | 15 | 16 | 17 | /** 18 | * \flags func 19 | * \name sll_debug_print_assembly 20 | * \group debug 21 | * \desc Docs! 22 | * \arg const sll_assembly_data_t* assembly_data 23 | */ 24 | __SLL_EXTERNAL void sll_debug_print_assembly(const sll_assembly_data_t* assembly_data); 25 | 26 | 27 | 28 | /** 29 | * \flags func 30 | * \name sll_debug_print_node 31 | * \group debug 32 | * \desc Docs! 33 | * \arg sll_node_t node 34 | * \arg const sll_source_file_t* source_file 35 | */ 36 | __SLL_EXTERNAL void sll_debug_print_node(sll_node_t node,const sll_source_file_t* source_file); 37 | 38 | 39 | 40 | /** 41 | * \flags func 42 | * \name sll_debug_print_object 43 | * \group debug 44 | * \desc Docs! 45 | * \arg sll_object_t object 46 | */ 47 | __SLL_EXTERNAL void sll_debug_print_object(sll_object_t object); 48 | 49 | 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /src/sll/include/sll/generated/cpuid_error.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL_GENERATED_CPUID_ERROR_H__ 2 | #define __SLL_GENERATED_CPUID_ERROR_H__ 1 3 | #include 4 | 5 | 6 | 7 | #define CPUID_ERROR_SIZE 97 8 | 9 | 10 | 11 | static const sll_char_t CPUID_ERROR[]={ 12 | 0x52,0x65,0x71,0x75,0x69,0x72,0x65,0x64,0x20,0x43,0x50,0x55,0x20,0x66,0x6c,0x61, 13 | 0x67,0x73,0x20,0x74,0x6f,0x20,0x65,0x78,0x65,0x63,0x75,0x74,0x65,0x20,0x74,0x68, 14 | 0x69,0x73,0x20,0x6c,0x69,0x62,0x72,0x61,0x72,0x79,0x20,0x28,0x41,0x56,0x58,0x20, 15 | 0x61,0x6e,0x64,0x20,0x41,0x56,0x58,0x32,0x29,0x20,0x61,0x72,0x65,0x20,0x6e,0x6f, 16 | 0x74,0x20,0x70,0x72,0x65,0x73,0x65,0x6e,0x74,0x20,0x6f,0x6e,0x20,0x74,0x68,0x65, 17 | 0x20,0x63,0x75,0x72,0x72,0x65,0x6e,0x74,0x20,0x73,0x79,0x73,0x74,0x65,0x6d,0x2e, 18 | 0x0a 19 | }; 20 | 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/sll/include/sll/optimizer.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL_OPTIMIZER_H__ 2 | #define __SLL_OPTIMIZER_H__ 1 3 | #include 4 | #include 5 | #include 6 | #include 7 | /** 8 | * \flags group 9 | * \name Optimizer 10 | * \group optimizer 11 | * \desc Docs! 12 | */ 13 | 14 | 15 | 16 | /** 17 | * \flags type var 18 | * \name sll_optimization_round_count_t 19 | * \group optimizer 20 | * \desc Docs! 21 | * \type __SLL_U8 22 | */ 23 | typedef __SLL_U8 sll_optimization_round_count_t; 24 | 25 | 26 | 27 | /** 28 | * \flags func 29 | * \name sll_optimize_source_file 30 | * \group optimizer 31 | * \desc Docs! 32 | * \arg sll_source_file_t* source_file 33 | * \arg sll_optimization_round_count_t round_count 34 | */ 35 | __SLL_EXTERNAL void sll_optimize_source_file(sll_source_file_t* source_file,sll_optimization_round_count_t round_count); 36 | 37 | 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/sll/include/sll/platform/_dispatcher.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL_PLATFORM__DISPATCHER_H__ 2 | #define __SLL_PLATFORM__DISPATCHER_H__ 1 3 | #ifdef __SLL_BUILD_WINDOWS 4 | #include <../platform/windows/dispatcher.h> 5 | #else 6 | #include <../platform/linux/dispatcher.h> 7 | #endif 8 | #endif 9 | -------------------------------------------------------------------------------- /src/sll/include/sll/platform/environment.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL_PLATFORM_ENVIRONMENT_H__ 2 | #define __SLL_PLATFORM_ENVIRONMENT_H__ 1 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | /** 10 | * \flags subgroup 11 | * \name Environment 12 | * \group platform 13 | * \subgroup platform-env 14 | * \desc Docs! 15 | */ 16 | 17 | 18 | 19 | /** 20 | * \flags func 21 | * \name sll_platform_remove_environment_variable 22 | * \group platform 23 | * \subgroup platform-env 24 | * \desc Docs! 25 | * \arg const sll_char_t* k 26 | */ 27 | __SLL_EXTERNAL void sll_platform_remove_environment_variable(const sll_char_t* k); 28 | 29 | 30 | 31 | /** 32 | * \flags func 33 | * \name sll_platform_set_environment_variable 34 | * \group platform 35 | * \subgroup platform-env 36 | * \desc Docs! 37 | * \arg const sll_char_t* k 38 | * \arg const sll_char_t* v 39 | */ 40 | __SLL_EXTERNAL void sll_platform_set_environment_variable(const sll_char_t* k,const sll_char_t* v); 41 | 42 | 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/sll/include/sll/scheduler.h: -------------------------------------------------------------------------------- 1 | #ifndef __SLL_SCHEDULER_H__ 2 | #define __SLL_SCHEDULER_H__ 1 3 | #include 4 | #include 5 | #include 6 | #include 7 | /** 8 | * \flags group 9 | * \name Scheduler 10 | * \group scheduler 11 | * \desc Docs! 12 | */ 13 | 14 | 15 | 16 | /** 17 | * \flags check_output func 18 | * \name sll_get_cpu_index 19 | * \group scheduler 20 | * \desc Docs! 21 | * \ret sll_cpu_t 22 | */ 23 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_cpu_t sll_get_cpu_index(void); 24 | 25 | 26 | 27 | /** 28 | * \flags check_output func 29 | * \name sll_get_thread_index 30 | * \group scheduler 31 | * \desc Docs! 32 | * \ret sll_thread_index_t 33 | */ 34 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_thread_index_t sll_get_thread_index(void); 35 | 36 | 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/sll/lib/_file.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "string.sll" 3 | "types.sll" 4 | ) 5 | 6 | 7 | 8 | (= FLAG_READ 1) 9 | (= FLAG_WRITE 2) 10 | (= FLAG_APPEND 4) 11 | (= FLAG_NO_BUFFER 8) 12 | (= FLAG_FLUSH_ON_NEWLINE 16) 13 | 14 | (= FLAG_MASK (| FLAG_READ FLAG_WRITE FLAG_APPEND FLAG_NO_BUFFER FLAG_FLUSH_ON_NEWLINE)) 15 | 16 | 17 | 18 | (= file_type (&: 19 | (,,, data 20 | (<- (... "sll:file_inc_handle") data$_handle) 21 | ) @@copy@@ 22 | (,,, data 23 | (= m "") 24 | (? (& data$flags FLAG_APPEND) (= m (+ m 'A'))) 25 | (? 26 | (& data$flags FLAG_NO_BUFFER) (= m (+ m 'B')) 27 | (& data$flags FLAG_FLUSH_ON_NEWLINE) (= m (+ m 'N')) 28 | ) 29 | (? (& data$flags FLAG_READ) (= m (+ m 'R'))) 30 | (? (& data$flags FLAG_WRITE) (= m (+ m 'W'))) 31 | (@@ (<- string$format "" data$name m)) 32 | ) @@string@@ 33 | (,,, data 34 | (? (=== data$_handle -1) (@@)) 35 | (<- (... "sll:file_close") data$_handle) 36 | ) @@delete@@ 37 | (~ string_type) name 38 | (~ int_type) flags 39 | int_type _handle 40 | )) 41 | 42 | 43 | 44 | (## FLAG_READ FLAG_WRITE FLAG_APPEND FLAG_NO_BUFFER FLAG_FLUSH_ON_NEWLINE FLAG_MASK file_type) 45 | -------------------------------------------------------------------------------- /src/sll/lib/_internal.sll: -------------------------------------------------------------------------------- 1 | (= _PLATFORM (<- (... "sll:sys_get_platform"))) 2 | 3 | (= _MAX_PATH_SIZE (?: 4 | (=== _PLATFORM "windows") 256 5 | (=== _PLATFORM "darwin") 1024 6 | 4096 7 | )) 8 | 9 | (= _SANDBOX_FLAGS [ 10 | "no-file-io" 11 | "enable-stdin-io" 12 | "enable-stdout-io" 13 | "no-path" 14 | "no-process" 15 | "no-environment" 16 | "no-load-library" 17 | "buffer-files" 18 | "file-rename" 19 | "file-copy" 20 | "no-float-error-change" 21 | "file-delete" 22 | "no-thread" 23 | "no-random" 24 | "no-serial" 25 | "no-ref" 26 | ]) 27 | 28 | 29 | 30 | (## _MAX_PATH_SIZE _PLATFORM _SANDBOX_FLAGS) 31 | -------------------------------------------------------------------------------- /src/sll/lib/_socket.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "_file.sll" 3 | "string.sll" 4 | "types.sll" 5 | ) 6 | 7 | 8 | 9 | (= socket_address_type (&: 10 | (~ int_type) host 11 | (~ int_type) port 12 | )) 13 | 14 | (= socket_type (&: 15 | (,,, data 16 | (<- (... "sll:file_inc_handle") data$_handle) 17 | ) @@copy@@ 18 | (,,, data 19 | (? (=== data$_handle -1) (@@)) 20 | (<- (... "sll:file_close") data$_handle) 21 | ) @@delete@@ 22 | (,,, data 23 | (@@ (<- string$format "" data$_handle)) 24 | ) @@string@@ 25 | (~ int_type) address_family 26 | (~ int_type) type 27 | (~ int_type) protocol 28 | int_type flags 29 | int_type _handle 30 | socket_address_type address 31 | )) 32 | 33 | 34 | 35 | (## socket_type) 36 | -------------------------------------------------------------------------------- /src/sll/lib/array.sll: -------------------------------------------------------------------------------- 1 | (--- "types.sll") 2 | 3 | 4 | 5 | (= array_module_type (&: 6 | (~ func_type) count 7 | (~ func_type) create 8 | (~ func_type) extend 9 | (~ func_type) index 10 | (~ func_type) join 11 | (~ func_type) pop 12 | (~ func_type) push 13 | (~ func_type) remove 14 | (~ func_type) replace 15 | (~ func_type) reverse 16 | (~ func_type) shift 17 | (~ func_type) split 18 | (~ func_type) unshift 19 | )) 20 | 21 | 22 | 23 | (= count (... "sll:array_count")) 24 | 25 | (= create (... "sll:array_create")) 26 | 27 | (= extend (... "sll:array_extend")) 28 | 29 | (= index (... "sll:array_index")) 30 | 31 | (= join (... "sll:array_join")) 32 | 33 | (= pop (... "sll:array_pop")) 34 | 35 | (= push (... "sll:array_push")) 36 | 37 | (= remove (... "sll:array_remove")) 38 | 39 | (= replace (... "sll:array_replace")) 40 | 41 | (= reverse (... "sll:array_reverse")) 42 | 43 | (= shift (... "sll:array_shift")) 44 | 45 | (= split (... "sll:array_split")) 46 | 47 | (= unshift (... "sll:array_unshift")) 48 | 49 | 50 | 51 | (= array (. array_module_type 52 | count 53 | create 54 | extend 55 | index 56 | join 57 | pop 58 | push 59 | remove 60 | replace 61 | reverse 62 | shift 63 | split 64 | unshift 65 | )) 66 | (## array) 67 | -------------------------------------------------------------------------------- /src/sll/lib/atexit.sll: -------------------------------------------------------------------------------- 1 | (--- "types.sll") 2 | 3 | 4 | 5 | (= atexit_module_type (&: 6 | (~ func_type) register 7 | (~ func_type) unregister 8 | )) 9 | 10 | 11 | 12 | (= register (... "sll:atexit_register")) 13 | 14 | (= unregister (... "sll:atexit_unregister")) 15 | 16 | 17 | 18 | (= atexit (. atexit_module_type 19 | register 20 | unregister 21 | )) 22 | (## atexit) 23 | -------------------------------------------------------------------------------- /src/sll/lib/base64.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "error.sll" 3 | "types.sll" 4 | ) 5 | 6 | 7 | 8 | (= base64_module_type (&: 9 | (~ string_type) ALPHABET 10 | (~ string_type) ALPHABET_URL_SAFE 11 | (~ func_type) decode 12 | (~ func_type) encode 13 | )) 14 | 15 | 16 | 17 | (= ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/") 18 | (= ALPHABET_URL_SAFE "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_") 19 | 20 | 21 | 22 | (= decode (,,, data 23 | (? (=== data nil) (@@ nil)) 24 | (= data (:: data string_type)) 25 | (= out (<- (... "sll:base64_decode") data)) 26 | (@@ (?: (=== (:? out) int_type) 27 | (<- error$from_internal out <"string" data>) 28 | out 29 | )) 30 | ) 31 | 32 | (= encode (,,, data 33 | (? (=== data nil) (@@ nil)) 34 | (@@ (<- (... "sll:base64_encode") 35 | (:: data string_type) 36 | )) 37 | )) 38 | 39 | 40 | 41 | (= base64 (. base64_module_type 42 | ALPHABET 43 | ALPHABET_URL_SAFE 44 | decode 45 | encode 46 | )) 47 | (## base64) 48 | -------------------------------------------------------------------------------- /src/sll/lib/float.sll: -------------------------------------------------------------------------------- 1 | (--- "types.sll") 2 | 3 | 4 | 5 | (= float_data_type (&: 6 | int_type sign 7 | int_type mantissa 8 | int_type exponent 9 | )) 10 | 11 | (= float_module_type (&: 12 | (~ type_type) float_data_type 13 | (~ func_type) get_data 14 | (~ func_type) set_data 15 | )) 16 | 17 | 18 | 19 | (= get_data (,,, value 20 | (= bits (<- (... "sll:struct_double_to_bits") (:: value float_type))) 21 | (@@ (. float_data_type 22 | (+ (* (>> bits) 2) 1) 23 | (| (& bits 0xfffffffffffff) 0x10000000000000) 24 | (- (& (>> bits 52) 0x7ff) 1023) 25 | )) 26 | )) 27 | 28 | (= set_data (,,, float_data 29 | (= float_data (:: float_data float_data_type)) 30 | (@@ (<- (... "sll:struct_double_from_bits") (| 31 | (& float_data$mantissa 0xfffffffffffff) 32 | (<< (& (+ float_data$exponent 1023) 0x7ff) 52) 33 | (<< (- float_data$sign 1) 63) 34 | ))) 35 | )) 36 | 37 | 38 | 39 | (= float (. float_module_type 40 | float_data_type 41 | get_data 42 | set_data 43 | )) 44 | (## float) 45 | -------------------------------------------------------------------------------- /src/sll/lib/hmac.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "hash.sll" 3 | "types.sll" 4 | ) 5 | 6 | 7 | 8 | (= hmac_module_type (&: 9 | (~ func_type) hmac 10 | )) 11 | 12 | 13 | 14 | (= HMAC_IPAD 0x36) 15 | (= HMAC_OPAD 0x5c) 16 | 17 | 18 | 19 | (= hmac_f (,,, hash_func key data 20 | (= hash_func (:: hash_func hash$hash_type)) 21 | (= key (:: key string_type)) 22 | (= data (:: data string_type)) 23 | (? (> ($ key) hash_func$BLOCK_SIZE) { 24 | (= key_hash (<- hash_func$init)) 25 | (= key_hash (<- hash_func$update key_hash key)) 26 | (= key (+ 27 | (<- hash_func$digest key_hash) 28 | (* "\x00" (- hash_func$BLOCK_SIZE hash_func$DIGEST_SIZE)) 29 | )) 30 | } (< ($ key) hash_func$BLOCK_SIZE) { 31 | (= key (+ 32 | key 33 | (* "\x00" (- hash_func$BLOCK_SIZE ($ key))) 34 | )) 35 | }) 36 | (@@ (<- hash_func$digest (<- hash_func$update (<- hash_func$update (<- hash_func$init) 37 | (^ key HMAC_OPAD)) 38 | (<- hash_func$digest (<- hash_func$update (<- hash_func$update (<- hash_func$init) 39 | (^ key HMAC_IPAD)) 40 | data 41 | ))) 42 | )) 43 | )) 44 | 45 | 46 | 47 | (= hmac (. hmac_module_type 48 | hmac_f 49 | )) 50 | (## hmac) 51 | -------------------------------------------------------------------------------- /src/sll/lib/input.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "file.sll" 3 | "string.sll" 4 | "types.sll" 5 | ) 6 | 7 | 8 | 9 | (= input_module_type (&: 10 | (~ func_type) char 11 | (~ func_type) int 12 | (~ func_type) string 13 | )) 14 | 15 | 16 | 17 | (= char (,,, min max 18 | (= min (:: min char_type)) 19 | (= max (:: max char_type)) 20 | (? (=== min max '\x00') (= max '\xff')) 21 | (>< 22 | (= o nil) 23 | (>< 24 | (= c (<- file$read_char file$stdin)) 25 | (? 26 | (|| (=== c '\n') (=== c '\r')) (@) 27 | (=== o nil) (= o c) 28 | (!== o nil) (= o -1) 29 | ) 30 | ) 31 | (? (&& (=== (:? o) char_type) (>= o min) (<= o max)) (@@ o)) 32 | ) 33 | )) 34 | 35 | (= int (,,, min max 36 | (= min (:: min int_type)) 37 | (= max (:: max int_type)) 38 | (>< 39 | (= o '\x00') 40 | (>< 41 | (= c (<- file$read_char file$stdin)) 42 | (? 43 | (|| (=== c '\n') (=== c '\r')) (@) 44 | (! (|: string$DIGITS c)) (= o '\x01') 45 | (!== c '\x01') (= o (+ (* 10 (:: o int_type)) (- c 48))) 46 | ) 47 | ) 48 | (? (&& (=== (:? o) int_type) (|| (=== min max) (&& (>= o min) (<= o max)))) (@@ o)) 49 | ) 50 | )) 51 | 52 | (= string (,,, 53 | (= o "") 54 | (>< 55 | (= c (<- file$read_char file$stdin)) 56 | (? (|| (=== c '\n') (=== c '\r')) (@@ o)) 57 | (= o (+ o c)) 58 | ) 59 | )) 60 | 61 | 62 | 63 | (= input (. input_module_type 64 | char 65 | int 66 | string 67 | )) 68 | (## input) 69 | -------------------------------------------------------------------------------- /src/sll/lib/int.sll: -------------------------------------------------------------------------------- 1 | (--- "types.sll") 2 | 3 | 4 | 5 | (= int_module_type (&: 6 | (~ func_type) to_bin 7 | (~ func_type) to_dec 8 | (~ func_type) to_hex 9 | (~ func_type) to_oct 10 | )) 11 | 12 | 13 | 14 | (= to_bin (... "sll:int_to_bin")) 15 | 16 | (= to_dec (... "sll:int_to_dec")) 17 | 18 | (= to_hex (... "sll:int_to_hex")) 19 | 20 | (= to_oct (... "sll:int_to_oct")) 21 | 22 | 23 | 24 | (= int (. int_module_type 25 | to_bin 26 | to_dec 27 | to_hex 28 | to_oct 29 | )) 30 | (## int) 31 | -------------------------------------------------------------------------------- /src/sll/lib/json.sll: -------------------------------------------------------------------------------- 1 | (--- "types.sll") 2 | 3 | 4 | 5 | (= json_null (&: 6 | (,,, (@@ "null")) @@string@@ 7 | )) 8 | (= json_true (&: 9 | (,,, (@@ "true")) @@string@@ 10 | )) 11 | (= json_false (&: 12 | (,,, (@@ "false")) @@string@@ 13 | )) 14 | 15 | (= json_module_type (&: 16 | (~ json_null) null 17 | (~ json_true) true 18 | (~ json_false) false 19 | (~ func_type) parse 20 | (~ func_type) stringify 21 | )) 22 | 23 | 24 | 25 | (= json_null_o (. json_null)) 26 | (= json_true_o (. json_true)) 27 | (= json_false_o (. json_false)) 28 | 29 | (<- (... "sll:json__init") json_null_o json_true_o json_false_o) 30 | 31 | 32 | 33 | (= parse (... "sll:json_parse")) 34 | 35 | (= stringify (... "sll:json_stringify")) 36 | 37 | 38 | 39 | (= json (. json_module_type 40 | json_null_o 41 | json_true_o 42 | json_false_o 43 | parse 44 | stringify 45 | )) 46 | (## json) 47 | -------------------------------------------------------------------------------- /src/sll/lib/log.sll: -------------------------------------------------------------------------------- 1 | (--- "types.sll") 2 | 3 | 4 | 5 | (= log_module_type (&: 6 | (~ int_type) FLAG_DO_NOT_HIDE 7 | (~ int_type) FLAG_NO_HEADER 8 | (~ func_type) log 9 | (~ func_type) set_file 10 | (~ func_type) set_function 11 | (~ func_type) set_global 12 | )) 13 | 14 | 15 | 16 | (= FLAG_DO_NOT_HIDE 1) 17 | (= FLAG_NO_HEADER 2) 18 | 19 | 20 | 21 | (= log_log (... "sll:log_log")) 22 | 23 | (= set_file (,,, file flags set? 24 | (@@ (<- (... "sll:log_set") 25 | (:: file string_type) 26 | nil 27 | (:: flags int_type) 28 | (:: set? int_type) 29 | )) 30 | ) 31 | 32 | (= set_function (,,, file func flags set? 33 | (@@ (<- (... "sll:log_set") 34 | (:: file string_type) 35 | (:: func string_type) 36 | (:: flags int_type) 37 | (:: set? int_type) 38 | )) 39 | ) 40 | 41 | (= set_global (,,, flags set? 42 | (@@ (<- (... "sll:log_set") 43 | nil 44 | nil 45 | (:: flags int_type) 46 | (:: set? int_type) 47 | )) 48 | ) 49 | 50 | 51 | 52 | (= log (. log_module_type 53 | FLAG_DO_NOT_HIDE 54 | FLAG_NO_HEADER 55 | log_log 56 | set_file 57 | set_function 58 | set_global 59 | )) 60 | (## log) 61 | -------------------------------------------------------------------------------- /src/sll/lib/map.sll: -------------------------------------------------------------------------------- 1 | (--- "types.sll") 2 | 3 | 4 | 5 | (= map_module_type (&: 6 | (~ func_type) extend 7 | (~ func_type) remove 8 | )) 9 | 10 | 11 | 12 | (= extend (... "sll:map_extend")) 13 | 14 | (= remove (... "sll:map_remove")) 15 | 16 | 17 | 18 | (= map (. map_module_type 19 | extend 20 | remove 21 | )) 22 | (## map) 23 | -------------------------------------------------------------------------------- /src/sll/lib/object.sll: -------------------------------------------------------------------------------- 1 | (--- "types.sll") 2 | 3 | 4 | 5 | (= object_module_type (&: 6 | (~ func_type) new 7 | )) 8 | 9 | 10 | 11 | (= new (... "sll:object_new")) 12 | 13 | 14 | 15 | (= object (. object_module_type 16 | new 17 | )) 18 | (## object) 19 | -------------------------------------------------------------------------------- /src/sll/lib/sort.sll: -------------------------------------------------------------------------------- 1 | (--- "types.sll") 2 | 3 | 4 | 5 | (= sort_module_type (&: 6 | (~ func_type) sort 7 | )) 8 | 9 | 10 | 11 | (= quicksort (... "sll:sort_quicksort")) 12 | 13 | 14 | 15 | (= sort (. sort_module_type 16 | quicksort 17 | )) 18 | (## sort) 19 | -------------------------------------------------------------------------------- /src/sll/lib/time.sll: -------------------------------------------------------------------------------- 1 | (--- "types.sll") 2 | 3 | 4 | 5 | (= time_module_type (&: 6 | (~ func_type) time 7 | (~ func_type) time_ns 8 | (~ func_type) sleep 9 | (~ func_type) sleep_ns 10 | (~ func_type) time_function 11 | )) 12 | 13 | 14 | 15 | (= get (,,, 16 | (@@ (* 1e-9 (<- (... "sll:time_current")))) 17 | )) 18 | 19 | (= get_ns (... "sll:time_current")) 20 | 21 | (= sleep (,,, seconds 22 | (@@ (* 1e-9 (<- (... "sll:time_sleep") 23 | (:: (* (:: seconds float_type) 1e9) int_type) 24 | ))) 25 | )) 26 | 27 | (= sleep_ns (... "sll:time_sleep")) 28 | 29 | (= time_function (,,, function @@args@@ 30 | (= function (:: function int_type)) 31 | (= start (<- get)) 32 | (<-* function @@args@@) 33 | (= end (<- get)) 34 | (@@ (- end start)) 35 | )) 36 | 37 | 38 | 39 | (= time (. time_module_type 40 | get 41 | get_ns 42 | sleep 43 | sleep_ns 44 | time_function 45 | )) 46 | (## time) 47 | -------------------------------------------------------------------------------- /src/sll/lib/types.sll: -------------------------------------------------------------------------------- 1 | (= int_type 0) 2 | (= func_type 0) 3 | (= type_type 0) 4 | (= float_type 1) 5 | (= char_type 2) 6 | (= complex_type 3) 7 | (= string_type 4) 8 | (= array_type 5) 9 | (= map_type 6) 10 | (= map_key_type 7) 11 | (= map_value_type 8) 12 | (= self_type 0xfffffffe) 13 | (= object_type 0xffffffff) 14 | 15 | (## int_type func_type type_type float_type char_type complex_type string_type array_type map_type map_key_type map_value_type self_type object_type) 16 | -------------------------------------------------------------------------------- /src/sll/lib/vm.sll: -------------------------------------------------------------------------------- 1 | (--- "types.sll") 2 | 3 | 4 | 5 | (= location_type (&: 6 | (~ string_type) file 7 | (~ int_type) line 8 | (~ string_type) function 9 | )) 10 | 11 | (= vm_config_type (&: 12 | (~ int_type) stack_size 13 | (~ int_type) call_stack_size 14 | (~ int_type) in 15 | (~ int_type) out 16 | (~ int_type) err 17 | )) 18 | 19 | (= vm_module_type (&: 20 | (~ type_type) location_type 21 | (~ type_type) vm_config_type 22 | (~ func_type) get_config 23 | (~ func_type) get_instruction_count 24 | (~ func_type) get_instruction_index 25 | (~ func_type) get_location 26 | (~ func_type) get_ref_count 27 | )) 28 | 29 | 30 | 31 | (= get_config (,,, 32 | (@@ (:: (<- (... "sll:vm_get_config")) vm_config_type)) 33 | )) 34 | 35 | (= get_instruction_count (... "sll:vm_get_instruction_count")) 36 | 37 | (= get_instruction_index (... "sll:vm_get_instruction_index")) 38 | 39 | (= get_location (,,, @@loc@@ 40 | (@@ (:: (<- (... "sll:vm_get_location") 41 | (?: @@loc@@ (, 42 | (= off (:: (: @@loc@@ 0) int_type)) 43 | (?: (< off -1) 0 (+ off 1)) 44 | ) 0) 45 | ) location_type)) 46 | )) 47 | 48 | (= get_ref_count (... "sll:vm_get_ref_count")) 49 | 50 | 51 | 52 | (= vm (. vm_module_type 53 | location_type 54 | vm_config_type 55 | get_config 56 | get_instruction_count 57 | get_instruction_index 58 | get_location 59 | get_ref_count 60 | )) 61 | (## vm) 62 | -------------------------------------------------------------------------------- /src/sll/operator/bool.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | 7 | 8 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_bool_t sll_operator_bool(sll_object_t a){ 9 | switch (a->type){ 10 | case SLL_OBJECT_TYPE_INT: 11 | return !!a->data.int_; 12 | case SLL_OBJECT_TYPE_FLOAT: 13 | return !!a->data.float_; 14 | case SLL_OBJECT_TYPE_CHAR: 15 | return !!a->data.char_; 16 | case SLL_OBJECT_TYPE_COMPLEX: 17 | return (!!a->data.complex_.real)||(!!a->data.complex_.imag); 18 | case SLL_OBJECT_TYPE_STRING: 19 | return !!a->data.string.length; 20 | case SLL_OBJECT_TYPE_ARRAY: 21 | return !!a->data.array.length; 22 | case SLL_OBJECT_TYPE_MAP: 23 | return !!a->data.map.length; 24 | } 25 | return 1; 26 | } 27 | -------------------------------------------------------------------------------- /src/sll/operator/includes.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | 11 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_bool_t sll_operator_includes(sll_object_t a,sll_object_t b){ 12 | if (a->type==SLL_OBJECT_TYPE_STRING){ 13 | if (b->type==SLL_OBJECT_TYPE_CHAR){ 14 | return sll_string_includes_char(&(a->data.string),b->data.char_); 15 | } 16 | if (b->type==SLL_OBJECT_TYPE_STRING){ 17 | return sll_string_includes(&(a->data.string),&(b->data.string)); 18 | } 19 | } 20 | else if (a->type==SLL_OBJECT_TYPE_ARRAY){ 21 | return sll_array_includes(&(a->data.array),b); 22 | } 23 | else if (a->type==SLL_OBJECT_TYPE_MAP){ 24 | return sll_map_includes(&(a->data.map),b); 25 | } 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /src/sll/operator/length.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | 12 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_object_t sll_operator_len(sll_object_t a){ 13 | switch (a->type){ 14 | case SLL_OBJECT_TYPE_INT: 15 | return sll_int_to_object((a->data.int_<0?-a->data.int_:a->data.int_)); 16 | case SLL_OBJECT_TYPE_FLOAT: 17 | return sll_float_to_object(sll_math_abs(a->data.float_)); 18 | case SLL_OBJECT_TYPE_CHAR: 19 | return SLL_ACQUIRE_STATIC_INT(1); 20 | case SLL_OBJECT_TYPE_COMPLEX: 21 | return sll_float_to_object(COMPLEX_ABS(a->data.complex_)); 22 | case SLL_OBJECT_TYPE_STRING: 23 | return sll_int_to_object(a->data.string.length); 24 | case SLL_OBJECT_TYPE_ARRAY: 25 | return sll_int_to_object(a->data.array.length); 26 | case SLL_OBJECT_TYPE_MAP: 27 | return sll_int_to_object(a->data.map.length); 28 | } 29 | return SLL_ACQUIRE_STATIC_INT(0); 30 | } 31 | -------------------------------------------------------------------------------- /src/sll/platform/linux/lock.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | 12 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_error_t sll_platform_lock_acquire(sll_lock_handle_t l){ 13 | int err=pthread_mutex_lock(l); 14 | return (err?err|SLL_ERROR_FLAG_SYSTEM:SLL_NO_ERROR); 15 | } 16 | 17 | 18 | 19 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_lock_handle_t sll_platform_lock_create(sll_error_t* err){ 20 | ERROR_PTR_RESET; 21 | pthread_mutex_t mtx; 22 | int pthread_err=pthread_mutex_init(&mtx,NULL); 23 | if (pthread_err){ 24 | ERROR_PTR(pthread_err|SLL_ERROR_FLAG_SYSTEM); 25 | return NULL; 26 | } 27 | pthread_mutex_t* o=sll_allocate(sizeof(pthread_mutex_t)); 28 | *o=mtx; 29 | return o; 30 | } 31 | 32 | 33 | 34 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_error_t sll_platform_lock_delete(sll_lock_handle_t l){ 35 | int err=pthread_mutex_destroy(l); 36 | if (err){ 37 | return err|SLL_ERROR_FLAG_SYSTEM; 38 | } 39 | sll_deallocate(l); 40 | return SLL_NO_ERROR; 41 | } 42 | 43 | 44 | 45 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_error_t sll_platform_lock_release(sll_lock_handle_t l){ 46 | int err=pthread_mutex_unlock(l); 47 | return (err?err|SLL_ERROR_FLAG_SYSTEM:SLL_NO_ERROR); 48 | } 49 | -------------------------------------------------------------------------------- /src/sll/platform/windows/event.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | 10 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_event_handle_t sll_platform_event_create(sll_error_t* err){ 11 | ERROR_PTR_RESET; 12 | sll_event_handle_t o=(sll_event_handle_t)CreateEventA(NULL,FALSE,FALSE,NULL); 13 | if (!o){ 14 | ERROR_PTR_SYSTEM; 15 | } 16 | return o; 17 | } 18 | 19 | 20 | 21 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_error_t sll_platform_event_delete(sll_event_handle_t e){ 22 | return (CloseHandle((HANDLE)e)?SLL_NO_ERROR:sll_platform_get_error()); 23 | } 24 | 25 | 26 | 27 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_error_t sll_platform_event_set(sll_event_handle_t e){ 28 | return (SetEvent((HANDLE)e)?SLL_NO_ERROR:sll_platform_get_error()); 29 | } 30 | 31 | 32 | 33 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_error_t sll_platform_event_wait(sll_event_handle_t e){ 34 | return (WaitForSingleObject((HANDLE)e,INFINITE)==WAIT_OBJECT_0?SLL_NO_ERROR:sll_platform_get_error()); 35 | } 36 | -------------------------------------------------------------------------------- /src/sll/platform/windows/lock.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | 11 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_error_t sll_platform_lock_acquire(sll_lock_handle_t l){ 12 | return (WaitForSingleObject((HANDLE)l,INFINITE)==WAIT_OBJECT_0?SLL_NO_ERROR:sll_platform_get_error()); 13 | } 14 | 15 | 16 | 17 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_lock_handle_t sll_platform_lock_create(sll_error_t* err){ 18 | ERROR_PTR_RESET; 19 | sll_lock_handle_t* o=(sll_lock_handle_t)CreateMutexA(NULL,FALSE,NULL); 20 | if (!o){ 21 | ERROR_PTR_SYSTEM; 22 | } 23 | return o; 24 | } 25 | 26 | 27 | 28 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_error_t sll_platform_lock_delete(sll_lock_handle_t l){ 29 | return (CloseHandle((HANDLE)l)?SLL_NO_ERROR:sll_platform_get_error()); 30 | } 31 | 32 | 33 | 34 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_error_t sll_platform_lock_release(sll_lock_handle_t l){ 35 | return (ReleaseMutex((HANDLE)l)?SLL_NO_ERROR:sll_platform_get_error()); 36 | } 37 | -------------------------------------------------------------------------------- /src/sll/sandbox.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | 10 | sll_sandbox_flags_t _sandbox_flags=0; 11 | 12 | 13 | 14 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_bool_t sll_get_sandbox_flag(sll_sandbox_flag_t flag){ 15 | return !!((_scheduler_current_thread_index==SLL_UNKNOWN_THREAD_INDEX?_sandbox_flags:_scheduler_current_thread->sandbox)&(1ull<sandbox); 22 | } 23 | 24 | 25 | 26 | __SLL_EXTERNAL void sll_set_sandbox_flag(sll_sandbox_flag_t flag){ 27 | if (flag>SLL_MAX_SANDBOX_FLAG){ 28 | return; 29 | } 30 | sll_sandbox_flags_t mask=1ull<sandbox|=mask; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/sll/size.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | 6 | 7 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_node_offset_t sll_get_node_size(sll_node_t node){ 8 | sll_node_offset_t out=0; 9 | sll_node_offset_t stack=1; 10 | while (stack){ 11 | if (node->type==SLL_NODE_TYPE_CHANGE_STACK){ 12 | node=node->data._next_node; 13 | } 14 | if (node->type!=SLL_NODE_TYPE_DBG){ 15 | stack--; 16 | } 17 | if (SLL_NODE_HAS_CHILDREN(node)&&node->typedata.arg_count; 19 | } 20 | out++; 21 | node++; 22 | } 23 | return out; 24 | } 25 | -------------------------------------------------------------------------------- /src/sll/skip.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | 6 | 7 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_node_t sll_skip_node(sll_node_t node){ 8 | sll_node_offset_t stack=1; 9 | while (stack){ 10 | if (node->type==SLL_NODE_TYPE_CHANGE_STACK){ 11 | node=node->data._next_node; 12 | } 13 | if (node->type!=SLL_NODE_TYPE_DBG){ 14 | stack--; 15 | } 16 | if (SLL_NODE_HAS_CHILDREN(node)&&node->typedata.arg_count; 18 | } 19 | node++; 20 | } 21 | return node; 22 | } 23 | -------------------------------------------------------------------------------- /src/sll/string_table.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | 11 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_string_index_t sll_add_string(sll_string_table_t* string_table,sll_string_t* string){ 12 | for (sll_string_index_t i=0;ilength;i++){ 13 | if (STRING_EQUAL(string_table->data+i,string)){ 14 | sll_free_string(string); 15 | return i; 16 | } 17 | } 18 | string_table->length++; 19 | string_table->data=sll_reallocate(string_table->data,string_table->length*sizeof(sll_string_t)); 20 | *(string_table->data+string_table->length-1)=*string; 21 | return string_table->length-1; 22 | } 23 | -------------------------------------------------------------------------------- /src/sll/version.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | 7 | 8 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT sll_version_t sll_version(void){ 9 | return SLL_VERSION; 10 | } 11 | 12 | 13 | 14 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT const sll_char_t* sll_version_sha(void){ 15 | return SLL_CHAR(SLL_VERSION_SHA); 16 | } 17 | 18 | 19 | 20 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT const sll_char_t* sll_version_string(void){ 21 | return SLL_CHAR(SLL_VERSION_STRING); 22 | } 23 | 24 | 25 | 26 | __SLL_EXTERNAL __SLL_CHECK_OUTPUT const sll_char_t* sll_version_tag(void){ 27 | return SLL_CHAR(SLL_VERSION_TAG); 28 | } 29 | -------------------------------------------------------------------------------- /src/web/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Not Found 7 | 8 | 9 |

Not Found

10 | 11 | 12 | -------------------------------------------------------------------------------- /src/web/apt.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | [ ! -d "/usr/local/share/keyrings" ]&&mkdir /usr/local/share/keyrings 3 | curl -s "https://sl-lang.github.io/pkg/apt/key.asc" > /usr/local/share/keyrings/sll.asc 4 | rm -f /tmp/sll-keyring.gpg 5 | echo "deb [signed-by=/usr/local/share/keyrings/sll.asc] https://sl-lang.github.io/ pkg/apt/unstable/" > /etc/apt/sources.list.d/sll.list 6 | apt update 7 | export DEBIAN_FRONTEND=noninteractive 8 | sudo apt -y install --no-install-recommends sll 9 | -------------------------------------------------------------------------------- /src/web/apt_nightly.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | [ ! -d "/usr/local/share/keyrings" ]&&mkdir /usr/local/share/keyrings 3 | curl -s "https://sl-lang.github.io/pkg/apt/key.asc" > /usr/local/share/keyrings/sll.asc 4 | rm -f /tmp/sll-keyring.gpg 5 | echo "deb [signed-by=/usr/local/share/keyrings/sll.asc] https://sl-lang.github.io/ pkg/apt/nightly/" > /etc/apt/sources.list.d/sll.list 6 | apt update 7 | export DEBIAN_FRONTEND=noninteractive 8 | sudo apt -y install --no-install-recommends sll 9 | -------------------------------------------------------------------------------- /src/web/docs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Sll documentation 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | {{DATA}} 16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /src/web/js/docs.js: -------------------------------------------------------------------------------- 1 | document.addEventListener("DOMContentLoaded",_=>{ 2 | let e=document.getElementById(window.location.hash.substr(1)); 3 | if (e){ 4 | e.scrollIntoView(); 5 | } 6 | }); 7 | -------------------------------------------------------------------------------- /syntax/sublime/sll_markdown_syntax/SllMarkdown.sublime-syntax: -------------------------------------------------------------------------------- 1 | %YAML 1.2 2 | --- 3 | name: Markdown (with Sll) 4 | file_extensions: 5 | - md 6 | - mdown 7 | - markdown 8 | - markdn 9 | scope: text.html.markdown 10 | extends: Packages/Markdown/Markdown.sublime-syntax 11 | contexts: 12 | fenced-syntaxes: 13 | - meta_prepend: true 14 | - match: '(?x){{fenced_code_block_start}}((?i:sll)){{fenced_code_block_trailing_infostring_characters}}' 15 | captures: 16 | 0: meta.code-fence.definition.begin.sll.markdown-gfm 17 | 2: punctuation.definition.raw.code-fence.begin.markdown 18 | 5: constant.other.language-name.markdown 19 | embed: scope:source.sll 20 | embed_scope: markup.raw.code-fence.sll.markdown-gfm 21 | escape: '{{code_fence_escape}}' 22 | escape_captures: 23 | 0: meta.code-fence.definition.end.sll.markdown-gfm 24 | 1: punctuation.definition.raw.code-fence.end.markdown 25 | -------------------------------------------------------------------------------- /syntax/sublime/sll_syntax/Comments.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | name 5 | Comments (SLL) 6 | scope 7 | source.sll 8 | settings 9 | 10 | shellVariables 11 | 12 | 13 | name 14 | TM_COMMENT_START 15 | value 16 | ; 17 | 18 | 19 | name 20 | TM_COMMENT_START_2 21 | value 22 | |# 23 | 24 | 25 | name 26 | TM_COMMENT_END_2 27 | value 28 | #| 29 | 30 | 31 | name 32 | TM_COMMENT_DISABLE_INDENT_2 33 | value 34 | yes 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /tests/ext/clib/temporary.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "@test/_common.sll" 3 | "clib/library.sll" 4 | ) 5 | 6 | 7 | 8 | (= empty_test (,,, 9 | (<- expect true true) 10 | )) 11 | 12 | 13 | 14 | (<- run "CLib extension" (,,, 15 | (<- empty_test) 16 | )) 17 | -------------------------------------------------------------------------------- /tests/ext/gfx/temporary.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "@test/_common.sll" 3 | "gfx/gfx.sll" 4 | ) 5 | 6 | 7 | 8 | (= empty_test (,,, 9 | (<- expect true true) 10 | )) 11 | 12 | 13 | 14 | (<- run "GFX extension" (,,, 15 | (<- empty_test) 16 | )) 17 | -------------------------------------------------------------------------------- /tests/ext/window/temporary.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "@test/_common.sll" 3 | "window_manager/window.sll" 4 | ) 5 | 6 | 7 | 8 | (= empty_test (,,, 9 | (<- expect true true) 10 | )) 11 | 12 | 13 | 14 | (<- run "Window extension" (,,, 15 | (<- empty_test) 16 | )) 17 | -------------------------------------------------------------------------------- /tests/symbols/_export_test_source_file.sll: -------------------------------------------------------------------------------- 1 | (= export_symbol_var 123) 2 | (= export_symbol_var_a 'a') 3 | (= export_symbol_var_b 'b') 4 | 5 | 6 | 7 | (##) 8 | (## export_symbol_var) 9 | (## export_symbol_var_a export_symbol_var_b) 10 | -------------------------------------------------------------------------------- /tests/symbols/test_break.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "@test/_common.sll" 3 | "types.sll" 4 | ) 5 | 6 | 7 | 8 | (= test_no_operands (,,, 9 | (= i 0) 10 | (-> nil (< i 10) 11 | (? (=== i 5) (@)) 12 | (++ i) 13 | ) 14 | (<- expect i 5) 15 | )) 16 | 17 | (= test_multple_operands (,,, 18 | (= i 0) 19 | (-> nil (< i 10) 20 | (? (=== i 5) (@ i 'a' 58)) 21 | (++ i) 22 | ) 23 | (<- expect i 5) 24 | )) 25 | 26 | 27 | 28 | (<- run "Break operator (@)" (,,, 29 | (<- test_no_operands) 30 | (<- test_multple_operands) 31 | )) 32 | -------------------------------------------------------------------------------- /tests/symbols/test_comma.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "@test/_common.sll" 3 | "types.sll" 4 | ) 5 | 6 | 7 | 8 | (= TEST_VALUES [ 9 | true 10 | -589 11 | 309.4e-6 12 | '\x8f' 13 | -23.22-99.5i 14 | "abc_test_string" 15 | [4 5 6 7 8] 16 | <"start" 'A' "end" 'Z'> 17 | ]) 18 | 19 | 20 | 21 | (= test_no_operands (,,, 22 | (<- expect (,) nil) 23 | )) 24 | 25 | (= test_one_operand (,,, 26 | (-> (= i 0) (< i ($ TEST_VALUES)) 27 | (<- expect (, (: TEST_VALUES i)) (: TEST_VALUES i) [(: TEST_VALUES i)]) 28 | (++ i) 29 | ) 30 | )) 31 | 32 | (= test_multple_operands (,,, 33 | (-> (= i 0) (< i ($ TEST_VALUES)) 34 | (-> (= j 0) (< j ($ TEST_VALUES)) 35 | (<- expect (, (: TEST_VALUES j) (: TEST_VALUES i)) (: TEST_VALUES i) [(: TEST_VALUES j) (: TEST_VALUES i)]) 36 | (++ j) 37 | ) 38 | (++ i) 39 | ) 40 | )) 41 | 42 | 43 | 44 | (<- run "Continue operator (<<<)" (,,, 45 | (<- test_no_operands) 46 | (<- test_one_operand) 47 | (<- test_multple_operands) 48 | )) 49 | -------------------------------------------------------------------------------- /tests/symbols/test_continue.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "@test/_common.sll" 3 | "array.sll" 4 | "types.sll" 5 | ) 6 | 7 | 8 | 9 | (= test_no_operands (,,, 10 | (= arr []) 11 | (-> (= i 0) (< i 10) 12 | (= j i) 13 | (++ i) 14 | (? (=== j 5) (<<<)) 15 | (<- array$push arr j) 16 | ) 17 | (<- expect arr [0 1 2 3 4 6 7 8 9]) 18 | )) 19 | 20 | (= test_multple_operands (,,, 21 | (= arr []) 22 | (-> (= i 0) (< i 10) 23 | (= j i) 24 | (++ i) 25 | (? (=== j 5) (<<< j 'a' 58)) 26 | (<- array$push arr j) 27 | ) 28 | (<- expect arr [0 1 2 3 4 6 7 8 9]) 29 | )) 30 | 31 | 32 | 33 | (<- run "Continue operator (<<<)" (,,, 34 | (<- test_no_operands) 35 | (<- test_multple_operands) 36 | )) 37 | -------------------------------------------------------------------------------- /tests/symbols/test_declaration.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "@test/_common.sll" 3 | "types.sll" 4 | ) 5 | 6 | 7 | 8 | (= test_no_operands (,,, 9 | (<- expect (#) nil) 10 | )) 11 | 12 | (= test_one_operand (,,, 13 | (<- expect (# var) nil) 14 | (<- expect var nil) 15 | (-> (= i 0) (< i 5) 16 | (= var i) 17 | (++ i) 18 | ) 19 | (<- expect var 4) 20 | )) 21 | 22 | (= test_multple_operands (,,, 23 | (<- expect (# var_a var_b) nil) 24 | (<- expect var_a nil) 25 | (-> (= i 0) (< i 5) 26 | (= var_a i) 27 | (-> (= j 0) (< j 5) 28 | (= var_b (* var_a j)) 29 | (++ j) 30 | ) 31 | (++ i) 32 | ) 33 | (<- expect var_a 4) 34 | (<- expect var_b 16) 35 | )) 36 | 37 | 38 | 39 | (<- run "Declaration operator (#)" (,,, 40 | (<- test_no_operands) 41 | (<- test_one_operand) 42 | (<- test_multple_operands) 43 | )) 44 | -------------------------------------------------------------------------------- /tests/symbols/test_export.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "@test/_common.sll" 3 | "@test/symbols/_export_test_source_file.sll" 4 | "types.sll" 5 | ) 6 | 7 | 8 | 9 | (= test_one_operand (,,, 10 | (<- expect export_symbol_var 123) 11 | )) 12 | 13 | (= test_multple_operands (,,, 14 | (<- expect export_symbol_var_a 'a') 15 | (<- expect export_symbol_var_b 'b') 16 | )) 17 | 18 | 19 | 20 | (<- run "Export operator (##)" (,,, 21 | (<- test_one_operand) 22 | (<- test_multple_operands) 23 | )) 24 | -------------------------------------------------------------------------------- /tests/symbols/test_ref.sll: -------------------------------------------------------------------------------- 1 | (--- 2 | "@test/_common.sll" 3 | "types.sll" 4 | ) 5 | 6 | 7 | 8 | (= test_no_operands (,,, 9 | (<- expect (%%) 0) 10 | )) 11 | 12 | (= test_one_operand (,,, 13 | (= var_a 56) 14 | (= var_b 'A') 15 | (<- expect_not_equal (%% var_a) (%% var_b)) 16 | )) 17 | 18 | (= test_multple_operands (,,, 19 | (= var_a 56) 20 | (= var_b 'A') 21 | (<- expect_not_equal (%% var_a "AA") (%% var_b "BB")) 22 | )) 23 | 24 | 25 | 26 | (<- run "Reference operator (%%)" (,,, 27 | (<- test_no_operands) 28 | (<- test_one_operand) 29 | (<- test_multple_operands) 30 | )) 31 | --------------------------------------------------------------------------------