├── .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 |
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 | [](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