11 Commits

Author SHA1 Message Date
410222b82a Fix minor bugs 2026-01-31 10:54:03 +00:00
f93afc0d14 Make binary portable and other fixes 2026-01-31 10:25:39 +00:00
86d5b7a021 Fix dependancies and precompile ruby module 2026-01-29 23:21:47 +00:00
78949bc770 Remove unneccesary dependancy
Signed-off-by: Syed Daanish <me@syedm.dev>
2026-01-29 15:00:57 +00:00
17a04bdddc Fix url 2026-01-29 13:59:55 +00:00
eafed64bea Use embedded mruby for portablity 2026-01-29 13:52:46 +00:00
9757a8db31 Fix installation stuff 2026-01-28 23:16:59 +00:00
cef357ffdc Fixes 2026-01-28 22:19:32 +00:00
515d5559a7 Allow ruby versions 3.2 and 3.4 for installation 2026-01-28 22:12:37 +00:00
1312c09501 Fix bug 2026-01-28 19:01:45 +00:00
b018877c03 Cleanup 2026-01-28 19:00:34 +00:00
40 changed files with 1392 additions and 616 deletions

View File

@@ -1,7 +1,8 @@
CompileFlags:
Add: [-I/home/syed/main/crib/include, -I/home/syed/main/crib/libs, -I/usr/include/ruby-3.4.0, -I/usr/include/ruby-3.4.0/x86_64-linux, c++20]
Add: [
-I/home/syed/main/crib/include,
-I/home/syed/main/crib/libs,
-std=c++23
]
Remove: []
Compiler: clang++
HeaderInsertion:
Policy: Never

2
.gitattributes vendored
View File

@@ -1 +1 @@
/libs/unicode_width/** linguist-vendored
/libs/** linguist-vendored

1
.gitignore vendored
View File

@@ -3,6 +3,7 @@
*.a
*.o
*.so
!libs/libruby/libruby.so
*.yml
.vscode

4
.gitmodules vendored
View File

@@ -2,7 +2,3 @@
path = libs/libgrapheme
url = git://git.suckless.org/libgrapheme
ignore = dirty
[submodule "libs/utfcpp"]
path = libs/utfcpp
url = https://github.com/nemtrif/utfcpp.git
ignore = dirty

View File

@@ -9,28 +9,30 @@ TARGET_RELEASE := $(BIN_DIR)/crib
PCH_DEBUG := $(OBJ_DIR)/debug/pch.h.gch
PCH_RELEASE := $(OBJ_DIR)/release/pch.h.gch
GENERATED_HEADER := $(INCLUDE_DIR)/scripting/ruby_compiled.h
CCACHE := ccache
CXX := $(CCACHE) clang++
CC := $(CCACHE) musl-clang
CFLAGS_DEBUG :=\
-std=c++23 -Wall -Wextra -Wno-c23-extensions \
-O0 -fno-inline -gsplit-dwarf\
-g -fno-omit-frame-pointer\
-std=c++20 -Wall -Wextra \
-O0 -fno-inline -gsplit-dwarf \
-g -fno-omit-frame-pointer \
-Wno-unused-command-line-argument \
-I./include -I./libs \
-I/usr/include/ruby-3.4.0 -I/usr/include/ruby-3.4.0/x86_64-linux
-fsanitize=address \
-I./include -I./libs
CFLAGS_RELEASE :=\
-std=c++23 -O3 -march=native \
-fno-rtti -fstrict-aliasing \
-static --target=x86_64-linux-musl \
-std=c++20 -O3 -march=x86-64 -mtune=generic \
-fno-rtti \
-ffast-math -flto=thin \
-fvisibility=hidden -fuse-ld=lld \
-fvisibility=hidden \
-fomit-frame-pointer -DNDEBUG -s \
-mllvm -vectorize-loops \
-fno-unwind-tables -fno-asynchronous-unwind-tables\
-Wno-unused-command-line-argument \
-Wno-c23-extensions \
-I./include -I./libs \
-I/usr/include/ruby-3.4.0 -I/usr/include/ruby-3.4.0/x86_64-linux
-I./include -I./libs
PCH_CFLAGS_DEBUG := $(CFLAGS_DEBUG) -x c++-header
PCH_CFLAGS_RELEASE := $(CFLAGS_RELEASE) -x c++-header
@@ -40,9 +42,13 @@ UNICODE_SRC := $(wildcard libs/unicode_width/*.c)
UNICODE_OBJ_DEBUG := $(patsubst libs/unicode_width/%.c,$(OBJ_DIR)/debug/unicode_width/%.o,$(UNICODE_SRC))
UNICODE_OBJ_RELEASE := $(patsubst libs/unicode_width/%.c,$(OBJ_DIR)/release/unicode_width/%.o,$(UNICODE_SRC))
LIBS := \
LIBS_RELEASE := \
libs/libgrapheme/libgrapheme.a \
-Wl,-Bstatic -lpcre2-8 -Wl,-Bdynamic -lmagic -lruby
-Wl,-Bstatic,--gc-sections -lpcre2-8 -lmruby
LIBS_DEBUG := \
libs/libgrapheme/libgrapheme.a \
-Wl,-Bdynamic -lpcre2-8 -lmruby
SRC := $(wildcard $(SRC_DIR)/**/*.cc) $(wildcard $(SRC_DIR)/*.cc)
OBJ_DEBUG := $(patsubst $(SRC_DIR)/%.cc,$(OBJ_DIR)/debug/%.o,$(SRC))
@@ -59,6 +65,9 @@ test: $(TARGET_DEBUG)
release: $(TARGET_RELEASE)
$(GENERATED_HEADER): $(INCLUDE_DIR)/syntax/tokens.def $(INCLUDE_DIR)/scripting/libcrib.rb src/ruby_compile.sh
src/ruby_compile.sh
$(PCH_DEBUG): $(INCLUDE_DIR)/pch.h
mkdir -p $(dir $@)
$(CXX) $(PCH_CFLAGS_DEBUG) -o $@ $<
@@ -69,27 +78,27 @@ $(PCH_RELEASE): $(INCLUDE_DIR)/pch.h
$(TARGET_DEBUG): $(PCH_DEBUG) $(OBJ_DEBUG) $(UNICODE_OBJ_DEBUG)
mkdir -p $(BIN_DIR)
$(CXX) $(CFLAGS_DEBUG) -o $@ $(OBJ_DEBUG) $(UNICODE_OBJ_DEBUG) $(LIBS)
$(CXX) $(CFLAGS_DEBUG) -o $@ $(OBJ_DEBUG) $(UNICODE_OBJ_DEBUG) $(LIBS_DEBUG)
$(TARGET_RELEASE): $(PCH_RELEASE) $(OBJ_RELEASE) $(UNICODE_OBJ_RELEASE)
mkdir -p $(BIN_DIR)
$(CXX) $(CFLAGS_RELEASE) -o $@ $(OBJ_RELEASE) $(UNICODE_OBJ_RELEASE) $(LIBS)
$(CXX) $(CFLAGS_RELEASE) -o $@ $(OBJ_RELEASE) $(UNICODE_OBJ_RELEASE) $(LIBS_RELEASE)
$(OBJ_DIR)/debug/%.o: $(SRC_DIR)/%.cc $(PCH_DEBUG)
$(OBJ_DIR)/debug/%.o: $(SRC_DIR)/%.cc $(PCH_DEBUG) $(GENERATED_HEADER)
mkdir -p $(dir $@)
$(CXX) $(CFLAGS_DEBUG) -include $(INCLUDE_DIR)/pch.h -MMD -MP -c $< -o $@
$(OBJ_DIR)/release/%.o: $(SRC_DIR)/%.cc $(PCH_RELEASE)
$(OBJ_DIR)/release/%.o: $(SRC_DIR)/%.cc $(PCH_RELEASE) $(GENERATED_HEADER)
mkdir -p $(dir $@)
$(CXX) $(CFLAGS_RELEASE) -include $(INCLUDE_DIR)/pch.h -MMD -MP -c $< -o $@
$(OBJ_DIR)/debug/unicode_width/%.o: libs/unicode_width/%.c
mkdir -p $(dir $@)
$(CXX) $(CFLAGS_DEBUG) -MMD -MP -c $< -o $@
$(CC) -MMD -MP -c $< -o $@
$(OBJ_DIR)/release/unicode_width/%.o: libs/unicode_width/%.c
mkdir -p $(dir $@)
$(CXX) $(CFLAGS_RELEASE) -MMD -MP -c $< -o $@
$(CC) -MMD -MP -c $< -o $@
DEP_DEBUG += $(UNICODE_OBJ_DEBUG:.o=.d)
DEP_RELEASE += $(UNICODE_OBJ_RELEASE:.o=.d)

View File

@@ -12,6 +12,18 @@ It aims to be complete general purpose IDE.<br>
(It is still very much a work in progress so a lot of things may seem incomplete)<br>
For now it is just a single file editor. I plan to add a multi-file support with file pickers and tabs soon.<br>
## Installation
Binary can be installed with the following command:
```bash
curl https://syedm.dev/crib | sh
```
It requires `libmagic` to be installed (most systems have it preinstalled).<br>
Currently only for Linux.<br>
*Tested with arch linux and ubuntu*<br>
## Building
### Get started
@@ -40,10 +52,10 @@ Make sure you have the following dependencies installed (apart from the standard
#include <pcre2.h>
```
* **libmagic**
Install it so that you can include it in your code (most *nix systems have it installed):
* **[mruby](https://github.com/mruby/mruby)**
Install it via your package manager. Once installed, the header should be available as:
```cpp
#include <magic.h>
#include <mruby.h>
```
It also uses `xclip` at runtime for copying/pasting *(TODO: make it os portable)*.
@@ -54,7 +66,6 @@ And any modern terminal should work fine - preferably `kitty` or `wezterm`.<br>
Some other dependancies are added as submodules or copied.<br>
- `unicode_width` is compiled by the makefile so nothing to do there.<br>
- `libgrapheme` needs to be compiled using `make` in it's folder.<br>
- ``
#### LSPs
@@ -134,7 +145,7 @@ TODO: add keybind information on how to set in `config/main.rb`
- current line highlighting
- all instances of current word under cursor highlighting
#### syntax highlighting and filetype detection (using extention or libmagic) for:
#### syntax highlighting and filetype detection for:
- ruby
<!-- TODO: -->
<!-- - bash -->

View File

@@ -4,11 +4,13 @@ Copyright 2025 Syed Daanish
##### BTW Check each lsp with each of the features implemented
* Static link pcre2-8 and libmagic and add precompiled libmagic magic database for better file detection
* [ ] Make a proper qeued system for bar contents from ruby
* [ ] Allow clipbaord setting & alpha in ini files
* [ ] Make warning before ctrl+q for saving
* [ ] **LSP Bug:** Check why `fish-lsp` is behaving so off with completions filtering.
* [ ] **Critical Crash:** Fix bug where closing immediately while LSP is still loading hangs and then segfaults (especially on slow ones like fish-lsp where quick edits and exit can hang).
* [ ] **Line move:** fix the move line functions to work without the calculations from folds as folds are removed.
* [ ] **Editor Indentation Fix:** - Main : merger indentation with the parser for more accurate results.
* [ ] Fix bug where enter at start of line with ending type crashes
* [ ] Keep cache of language maps in engine to reduce lookup time.
* [ ] In indents add function to support tab which indents if before any content and inserts a pure \t otherwise.
* [ ] And backspace which undents if before any content.

View File

@@ -2,6 +2,8 @@
# This can also be used to do speacail configs for different projects.
# its ruby guys script whatever you want.
# puts "Loading main config..."
C.startup do
puts "Starting crib..."
end
@@ -47,30 +49,30 @@ C.theme = {
:brace5 => { fg: 0xFF0F0F }
}
# # TODO: to be done once a proper api for binding and window drawing is made
# # The binds will be connected to either `editor` or windows where editor can
# # only use a preset set of stuff to bind while teh windows are purely custom
# # # this part uses dsl bindings to define the bind function
# # # Hopefully extend to give more context/power to bindings
# # # but try to keep simple for performance
# # # for default keybindings
# # C.bind [:normal, :select], :a => "insert_mode"
# # # for custom keybindings
# # C.bind :select, [:x, :c] do
# # puts "cut"
# # end
# # C.bind :jumper do
# # set [:x, :c] do
# # puts "jump to first bookmark"
# # end
# # end
# # # they can also be defined conditionally
# # # This code is just an example and doesnt actually work
# # if using_tmux?
# # bind :C-p do
# # system("tmux select-pane -U")
# # end
# # end
# TODO: to be done once a proper api for binding and window drawing is made
# The binds will be connected to either `editor` or windows where editor can
# only use a preset set of stuff to bind while teh windows are purely custom
# # this part uses dsl bindings to define the bind function
# # Hopefully extend to give more context/power to bindings
# # but try to keep simple for performance
# # for default keybindings
# C.bind [:normal, :select], :a => "insert_mode"
# # for custom keybindings
# C.bind :select, [:x, :c] do
# puts "cut"
# end
# C.bind :jumper do
# set [:x, :c] do
# puts "jump to first bookmark"
# end
# end
# # they can also be defined conditionally
# # This code is just an example and doesnt actually work
# if using_tmux?
# bind :C-p do
# system("tmux select-pane -U")
# end
# end
# This can, for example, be modified by user bindings during runtime
# TODO: dynamic registration to actually be implemented once keybinds and extentions are implemented
@@ -82,20 +84,19 @@ C.theme = {
# symbol: "󰴭 ",
# extensions: ["rb"],
# filenames: ["Gemfile"],
# mimetypes: ["text/x-ruby"],
# lsp: "solargraph"
# }
C.line_endings = :auto_unix # or :unix or :windows or :auto_windows
# C.extra_highlights do |_line, _idx|
# # the return can be an array of
# # [fg, bg. flags, start, end]
# # where fg and bg are integers (using 24 bit color)
# # and flags is a bitmask of bold/underline/italic etc
# # and start and end are integers strictly inside the line
# return []
# end
C.extra_highlights do |_line, _idx|
# the return can be an array of
# [fg, bg. flags, start, end]
# where fg and bg are integers (using 24 bit color)
# and flags is a bitmask of bold/underline/italic etc
# and start and end are integers strictly inside the line
return []
end
# The highlighter will be aplied to the language as long as the langauge is defined in C.languages
C.highlighters[:ruby_n] = {

View File

@@ -27,9 +27,10 @@ struct CompletionSession {
bool active = false;
Coord hook;
std::optional<std::string> prefix;
uint8_t select = 0;
uint32_t select = 0;
uint32_t scroll = 0;
std::vector<CompletionItem> items;
std::vector<uint8_t> visible;
std::vector<uint32_t> visible;
bool complete = true;
std::optional<char> trigger_char;
uint8_t trigger = 0;

View File

@@ -17,11 +17,9 @@
#define WORD 1
#define LINE 2
#define EXTRA_META 4
#define EXTRA_META 2
#define INDENT_WIDTH 2
// autocomplete lua// Bracket closing / tab on enter
struct Editor {
std::string filename;
std::string uri;
@@ -31,7 +29,7 @@ struct Editor {
uint32_t cursor_preffered;
Coord selection;
bool selection_active;
bool unix_eol; // false for windows
bool unix_eol;
int selection_type;
Coord position;
Coord size;

View File

@@ -80,6 +80,7 @@ void lsp_worker();
std::shared_ptr<LSPInstance> get_or_init_lsp(std::string lsp_id);
void clean_lsp(std::shared_ptr<LSPInstance> lsp, std::string lsp_id);
void close_lsp(std::string lsp_id);
std::optional<json> read_lsp_message(int fd);
void open_editor(std::shared_ptr<LSPInstance> lsp,
std::pair<Language, Editor *> entry);

View File

@@ -2,6 +2,7 @@
#define MAIN_H
#include "pch.h"
#include "ui/bar.h"
#define NORMAL 0
#define INSERT 1
@@ -13,5 +14,6 @@ extern std::atomic<bool> running;
extern std::atomic<uint8_t> mode;
extern std::vector<struct Editor *> editors;
extern uint8_t current_editor;
extern Bar bar;
#endif

View File

@@ -4,11 +4,12 @@
#define PCRE2_CODE_UNIT_WIDTH 8
#define PCRE_WORKSPACE_SIZE 512
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#include <ruby.h>
#pragma clang diagnostic pop
#include <magic.h>
#include <mruby.h>
#include <mruby/array.h>
#include <mruby/compile.h>
#include <mruby/hash.h>
#include <mruby/irep.h>
#include <mruby/string.h>
#include <nlohmann/json.hpp>
#include <pcre2.h>
extern "C" {

View File

@@ -4,19 +4,42 @@
#include "syntax/decl.h"
#include "utils/utils.h"
extern std::unordered_map<std::string, std::pair<VALUE, VALUE>>
extern std::unordered_map<std::string, std::pair<mrb_value, mrb_value>>
custom_highlighters;
struct BarLight {
uint32_t start;
uint32_t end;
Highlight highlight;
};
struct BarLine {
std::string line;
std::vector<BarLight> highlights;
Highlight get_highlight(uint32_t x) {
for (auto &hl : highlights) {
if (hl.start <= x && x <= hl.end)
return hl.highlight;
}
return {0xFFFFFF, 0, 0};
}
};
void setup_ruby_bindings(mrb_state *mrb, RClass *C_module);
void ruby_start();
void ruby_shutdown();
void ruby_log(std::string msg);
void load_theme();
void load_languages_info();
uint8_t read_line_endings();
void load_custom_highlighters();
VALUE parse_custom(std::vector<Token> *tokens, VALUE parser_block,
const char *line, uint32_t len, VALUE state,
uint32_t line_num);
bool custom_compare(VALUE match_block, VALUE state1, VALUE state2);
mrb_value parse_custom(std::vector<Token> *tokens, mrb_value parser_block,
const char *line, uint32_t len, mrb_value state,
uint32_t c_line);
bool custom_compare(mrb_value match_block, mrb_value state1, mrb_value state2);
BarLine bar_contents(uint8_t mode, std::string lang_name, uint32_t warnings,
std::string lsp_name, std::string filename,
std::string foldername, uint32_t line, uint32_t max_line,
uint32_t width);
#endif

View File

@@ -36,256 +36,186 @@ module C
color: 0x555555,
symbol: "",
extensions: ["c"],
filenames: [],
mimetypes: ["text/x-c"],
lsp: "clangd"
},
cpp: {
color: 0x00599C,
symbol: "",
extensions: ["cpp", "cc", "cxx"],
filenames: [],
mimetypes: ["text/x-cpp"],
lsp: "clangd"
},
h: {
color: 0xA8B9CC,
symbol: "",
extensions: ["h", "hpp"],
filenames: [],
mimetypes: ["text/x-c-header"],
lsp: "clangd"
},
css: {
color: 0x36a3d9,
symbol: "",
extensions: ["css"],
filenames: [],
mimetypes: ["text/css"],
lsp: "vscode-css-language-server"
},
fish: {
color: 0x4d5a5e,
symbol: "",
extensions: ["fish"],
filenames: [],
mimetypes: ["application/x-fish"],
lsp: "fish-lsp"
},
go: {
color: 0x00add8,
symbol: "",
extensions: ["go"],
filenames: [],
mimetypes: ["text/x-go"],
lsp: "gopls"
},
gomod: {
color: 0x00add8,
symbol: "",
extensions: ["mod"],
filenames: [],
mimetypes: ["text/x-go-mod"],
lsp: "gopls"
},
haskell: {
color: 0xa074c4,
symbol: "",
extensions: ["hs", "lhs"],
filenames: [],
mimetypes: ["text/x-haskell"],
lsp: "haskell-language-server"
},
html: {
color: 0xef8a91,
symbol: "",
extensions: ["html", "htm"],
filenames: [],
mimetypes: ["text/html"],
lsp: "emmet-language-server"
},
javascript: {
color: 0xf0df8a,
symbol: "",
extensions: ["js"],
filenames: [],
mimetypes: ["application/javascript"],
lsp: "typescript-language-server"
},
typescript: {
color: 0x36a3d9,
symbol: "",
extensions: ["ts"],
filenames: [],
mimetypes: ["application/typescript"],
lsp: "typescript-language-server"
},
json: {
color: 0xcbcb41,
symbol: "{}",
extensions: ["json"],
filenames: [],
mimetypes: ["application/json"],
lsp: "vscode-json-language-server"
},
jsonc: {
color: 0xcbcb41,
symbol: "{}",
extensions: ["jsonc"],
filenames: [],
mimetypes: ["application/json"],
lsp: "vscode-json-language-server"
},
erb: {
color: 0x6e1516,
symbol: "",
extensions: ["erb"],
filenames: [],
mimetypes: ["text/x-erb"],
lsp: "ruby-lsp"
},
lua: {
color: 0x36a3d9,
symbol: "󰢱 ",
extensions: ["lua"],
filenames: [],
mimetypes: ["text/x-lua"],
lsp: "lua-language-server"
},
python: {
color: 0x95e6cb,
symbol: "󰌠 ",
extensions: ["py"],
filenames: [],
mimetypes: ["text/x-python"],
lsp: "pyright"
},
rust: {
color: 0xdea584,
symbol: "󱘗 ",
extensions: ["rs"],
filenames: [],
mimetypes: ["text/x-rust"],
lsp: "rust-analyzer"
},
php: {
color: 0xa074c4,
symbol: "󰌟 ",
extensions: ["php"],
filenames: [],
mimetypes: ["application/x-php"],
lsp: "intelephense"
},
markdown: {
color: 0x36a3d9,
symbol: "",
extensions: ["md", "markdown"],
filenames: [],
mimetypes: ["text/markdown"],
lsp: "marksman"
},
nginx: {
color: 0x6d8086,
symbol: "",
extensions: ["conf"],
filenames: [],
mimetypes: ["text/nginx"],
lsp: "nginx-language-server"
},
toml: {
color: 0x36a3d9,
symbol: "",
extensions: ["toml"],
filenames: [],
mimetypes: ["application/toml"],
lsp: "taplo"
},
yaml: {
color: 0x6d8086,
symbol: "",
extensions: ["yml", "yaml"],
filenames: [],
mimetypes: ["text/yaml"],
lsp: "yaml-language-server"
},
sql: {
color: 0xdad8d8,
symbol: "",
extensions: ["sql"],
filenames: [],
mimetypes: ["text/x-sql"],
lsp: "sqls"
},
make: {
color: 0x4e5c61,
symbol: "",
extensions: ["Makefile", "makefile"],
filenames: [],
mimetypes: ["text/x-makefile"],
lsp: "make-language-server"
},
gdscript: {
color: 0x6d8086,
symbol: "",
extensions: ["gd"],
filenames: [],
mimetypes: ["text/x-gdscript"],
lsp: nil
extensions: ["gd"]
},
man: {
color: 0xdad8d8,
symbol: "",
extensions: ["man"],
filenames: [],
mimetypes: ["application/x-troff-man"],
lsp: nil
extensions: ["man"]
},
diff: {
color: 0xDD4C35,
symbol: "",
extensions: ["diff", "patch"],
filenames: [],
mimetypes: ["text/x-diff"],
lsp: nil
extensions: ["diff", "patch"]
},
gitattributes: {
color: 0xF05032,
symbol: "",
extensions: ["gitattributes"],
filenames: [],
mimetypes: [],
lsp: nil
extensions: ["gitattributes"]
},
gitignore: {
color: 0xF05032,
symbol: "",
extensions: ["gitignore"],
filenames: [],
mimetypes: [],
lsp: nil
extensions: ["gitignore"]
},
regex: {
color: 0x9E9E9E,
symbol: ".*",
extensions: ["regex"],
filenames: [],
mimetypes: [],
lsp: nil
extensions: ["regex"]
},
ini: {
color: 0x6d8086,
symbol: "",
extensions: ["ini"],
filenames: [],
mimetypes: [],
lsp: nil
extensions: ["ini"]
},
ruby: {
color: 0xff8087,
symbol: "󰴭 ",
extensions: ["rb"],
filenames: ["Gemfile"],
mimetypes: ["text/x-ruby"],
lsp: "solargraph"
},
bash: {
@@ -293,7 +223,6 @@ module C
symbol: "",
extensions: ["sh"],
filenames: ["bash_profile", "bashrc"],
mimetypes: ["text/x-sh"],
lsp: "bash-language-server"
}
}
@@ -307,10 +236,8 @@ module C
:interpolation => { fg: 0x7DCFFF },
:regexp => { fg: 0xD2A6FF },
:number => { fg: 0xE6C08A },
# rubocop:disable Lint/BooleanSymbol
:true => { fg: 0x7AE93C },
:false => { fg: 0xEF5168 },
# rubocop:enable Lint/BooleanSymbol
:char => { fg: 0xFFAF70 },
:keyword => { fg: 0xFF8F40 },
:keywordoperator => { fg: 0xF07178 },
@@ -333,14 +260,54 @@ module C
@key_handlers = {}
@key_binds = {}
@highlighters = {}
@log_queue = []
@b_startup = nil
@b_shutdown = nil
@b_bar = lambda do |info|
# mode, lang_name, warnings, lsp_name, filename, foldername, line, max_line, width
# puts info.inspect
mode_color = 0x82AAFF
mode_symbol = " "
case info[:mode]
when :normal
mode_color = 0x82AAFF
mode_symbol = ""
when :insert
mode_color = 0xFF8F40
mode_symbol = "󱓧 "
when :select
mode_color = 0x9ADE7A
mode_symbol = "󱩧 "
when :runner
mode_color = 0xFFD700
mode_symbol = ""
when :jumper
mode_color = 0xF29CC3
mode_symbol = ""
end
lang_info = C.languages[info[:lang_name]]
filename = File.basename(info[:filename])
starting = " #{mode_symbol} #{info[:mode].to_s.upcase}  #{lang_info[:symbol]}#{filename}"
highlights = []
highlights << { fg: 0x0b0e14, bg: mode_color, flags: 1 << 1, start: 0, length: 10 }
highlights << { fg: mode_color, bg: 0x33363c, start: 10, length: 1 }
highlights << { fg: 0x33363c, bg: 0x24272d, start: 11, length: 1 }
highlights << { fg: lang_info[:color], bg: 0x24272d, start: 13, length: 2 }
highlights << { fg: 0xced4df, bg: 0x24272d, start: 15, length: filename.length }
highlights << { fg: 0x24272d, bg: 0x000000, start: 15 + filename.length, length: 1 }
return {
text: starting,
highlights: highlights
}
end
class << self
attr_accessor :theme, :lsp_config, :languages,
:line_endings, :highlighters
attr_reader :b_startup, :b_shutdown, :b_extra_highlights
attr_reader :b_startup, :b_shutdown, :b_extra_highlights, :b_bar
# def bar=(block)
# @b_bar = block
# end
def startup(&block)
@b_startup = block
@@ -350,17 +317,6 @@ module C
@b_shutdown = block
end
def queue_log(msg)
@log_queue << msg
end
def log_all
@log_queue.each do |msg|
puts msg
end
@log_queue = []
end
def extra_highlights(&block)
@b_extra_highlights = block
end
@@ -396,5 +352,3 @@ module C
end
end
end
at_exit { C.log_all }

View File

@@ -0,0 +1,611 @@
#pragma once
constexpr unsigned char _tmp___crib_precompiled_mrb[] = {
0x52, 0x49, 0x54, 0x45, 0x30, 0x33, 0x30, 0x30, 0x00, 0x00, 0x1c, 0x69,
0x4d, 0x41, 0x54, 0x5a, 0x30, 0x30, 0x30, 0x30, 0x49, 0x52, 0x45, 0x50,
0x00, 0x00, 0x1b, 0x81, 0x30, 0x33, 0x30, 0x30, 0x00, 0x00, 0x00, 0x34,
0x00, 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13,
0x11, 0x01, 0x5d, 0x01, 0x00, 0x5e, 0x01, 0x00, 0x11, 0x01, 0x5d, 0x01,
0x01, 0x5e, 0x01, 0x01, 0x38, 0x01, 0x69, 0x00, 0x00, 0x00, 0x02, 0x00,
0x06, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x00, 0x00, 0x01, 0x43, 0x00,
0x00, 0x00, 0x03, 0xfd, 0x00, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x3c, 0x06, 0x01, 0x1e, 0x01, 0x00, 0x07, 0x01, 0x1e,
0x01, 0x01, 0x08, 0x01, 0x1e, 0x01, 0x02, 0x09, 0x01, 0x1e, 0x01, 0x03,
0x0a, 0x01, 0x1e, 0x01, 0x04, 0x0b, 0x01, 0x1e, 0x01, 0x05, 0x0c, 0x01,
0x1e, 0x01, 0x06, 0x0d, 0x01, 0x1e, 0x01, 0x07, 0x03, 0x01, 0x08, 0x1e,
0x01, 0x08, 0x03, 0x01, 0x09, 0x1e, 0x01, 0x09, 0x03, 0x01, 0x0a, 0x1e,
0x01, 0x0a, 0x03, 0x01, 0x0b, 0x1e, 0x01, 0x0b, 0x03, 0x01, 0x0c, 0x1e,
0x01, 0x0c, 0x03, 0x01, 0x0d, 0x1e, 0x01, 0x0d, 0x03, 0x01, 0x0e, 0x1e,
0x01, 0x0e, 0x03, 0x01, 0x0f, 0x1e, 0x01, 0x0f, 0x03, 0x01, 0x10, 0x1e,
0x01, 0x10, 0x03, 0x01, 0x11, 0x1e, 0x01, 0x11, 0x03, 0x01, 0x12, 0x1e,
0x01, 0x12, 0x03, 0x01, 0x13, 0x1e, 0x01, 0x13, 0x03, 0x01, 0x14, 0x1e,
0x01, 0x14, 0x03, 0x01, 0x15, 0x1e, 0x01, 0x15, 0x03, 0x01, 0x16, 0x1e,
0x01, 0x16, 0x03, 0x01, 0x17, 0x1e, 0x01, 0x17, 0x03, 0x01, 0x18, 0x1e,
0x01, 0x18, 0x03, 0x01, 0x19, 0x1e, 0x01, 0x19, 0x03, 0x01, 0x1a, 0x1e,
0x01, 0x1a, 0x03, 0x01, 0x1b, 0x1e, 0x01, 0x1b, 0x03, 0x01, 0x1c, 0x1e,
0x01, 0x1c, 0x03, 0x01, 0x1d, 0x1e, 0x01, 0x1d, 0x03, 0x01, 0x1e, 0x1e,
0x01, 0x1e, 0x03, 0x01, 0x1f, 0x1e, 0x01, 0x1f, 0x03, 0x01, 0x20, 0x1e,
0x01, 0x20, 0x03, 0x01, 0x21, 0x1e, 0x01, 0x21, 0x03, 0x01, 0x22, 0x1e,
0x01, 0x22, 0x03, 0x01, 0x23, 0x1e, 0x01, 0x23, 0x03, 0x01, 0x24, 0x1e,
0x01, 0x24, 0x03, 0x01, 0x25, 0x1e, 0x01, 0x25, 0x03, 0x01, 0x26, 0x1e,
0x01, 0x26, 0x03, 0x01, 0x27, 0x1e, 0x01, 0x27, 0x03, 0x01, 0x28, 0x1e,
0x01, 0x28, 0x03, 0x01, 0x29, 0x1e, 0x01, 0x29, 0x03, 0x01, 0x2a, 0x1e,
0x01, 0x2a, 0x03, 0x01, 0x2b, 0x1e, 0x01, 0x2b, 0x03, 0x01, 0x2c, 0x1e,
0x01, 0x2c, 0x03, 0x01, 0x2d, 0x1e, 0x01, 0x2d, 0x03, 0x01, 0x2e, 0x1e,
0x01, 0x2e, 0x03, 0x01, 0x2f, 0x1e, 0x01, 0x2f, 0x03, 0x01, 0x30, 0x1e,
0x01, 0x30, 0x03, 0x01, 0x31, 0x1e, 0x01, 0x31, 0x03, 0x01, 0x32, 0x1e,
0x01, 0x32, 0x03, 0x01, 0x33, 0x1e, 0x01, 0x33, 0x03, 0x01, 0x34, 0x1e,
0x01, 0x34, 0x2d, 0x01, 0x35, 0x00, 0x38, 0x01, 0x00, 0x00, 0x00, 0x36,
0x00, 0x06, 0x4b, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x00, 0x00, 0x09, 0x4b,
0x5f, 0x53, 0x48, 0x45, 0x42, 0x41, 0x4e, 0x47, 0x00, 0x00, 0x09, 0x4b,
0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x45, 0x4e, 0x54, 0x00, 0x00, 0x07, 0x4b,
0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x00, 0x00, 0x08, 0x4b, 0x5f, 0x53,
0x54, 0x52, 0x49, 0x4e, 0x47, 0x00, 0x00, 0x08, 0x4b, 0x5f, 0x45, 0x53,
0x43, 0x41, 0x50, 0x45, 0x00, 0x00, 0x0f, 0x4b, 0x5f, 0x49, 0x4e, 0x54,
0x45, 0x52, 0x50, 0x4f, 0x4c, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x00,
0x08, 0x4b, 0x5f, 0x52, 0x45, 0x47, 0x45, 0x58, 0x50, 0x00, 0x00, 0x08,
0x4b, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x00, 0x00, 0x06, 0x4b,
0x5f, 0x54, 0x52, 0x55, 0x45, 0x00, 0x00, 0x07, 0x4b, 0x5f, 0x46, 0x41,
0x4c, 0x53, 0x45, 0x00, 0x00, 0x06, 0x4b, 0x5f, 0x43, 0x48, 0x41, 0x52,
0x00, 0x00, 0x09, 0x4b, 0x5f, 0x4b, 0x45, 0x59, 0x57, 0x4f, 0x52, 0x44,
0x00, 0x00, 0x11, 0x4b, 0x5f, 0x4b, 0x45, 0x59, 0x57, 0x4f, 0x52, 0x44,
0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x00, 0x00, 0x0a, 0x4b,
0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x00, 0x00, 0x0a,
0x4b, 0x5f, 0x46, 0x55, 0x4e, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x00,
0x06, 0x4b, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x00, 0x00, 0x0a, 0x4b, 0x5f,
0x43, 0x4f, 0x4e, 0x53, 0x54, 0x41, 0x4e, 0x54, 0x00, 0x00, 0x12, 0x4b,
0x5f, 0x56, 0x41, 0x52, 0x49, 0x41, 0x42, 0x4c, 0x45, 0x49, 0x4e, 0x53,
0x54, 0x41, 0x4e, 0x43, 0x45, 0x00, 0x00, 0x10, 0x4b, 0x5f, 0x56, 0x41,
0x52, 0x49, 0x41, 0x42, 0x4c, 0x45, 0x47, 0x4c, 0x4f, 0x42, 0x41, 0x4c,
0x00, 0x00, 0x0c, 0x4b, 0x5f, 0x41, 0x4e, 0x4e, 0x4f, 0x54, 0x41, 0x54,
0x49, 0x4f, 0x4e, 0x00, 0x00, 0x0b, 0x4b, 0x5f, 0x44, 0x49, 0x52, 0x45,
0x43, 0x54, 0x49, 0x56, 0x45, 0x00, 0x00, 0x07, 0x4b, 0x5f, 0x4c, 0x41,
0x42, 0x45, 0x4c, 0x00, 0x00, 0x08, 0x4b, 0x5f, 0x42, 0x52, 0x41, 0x43,
0x45, 0x31, 0x00, 0x00, 0x08, 0x4b, 0x5f, 0x42, 0x52, 0x41, 0x43, 0x45,
0x32, 0x00, 0x00, 0x08, 0x4b, 0x5f, 0x42, 0x52, 0x41, 0x43, 0x45, 0x33,
0x00, 0x00, 0x08, 0x4b, 0x5f, 0x42, 0x52, 0x41, 0x43, 0x45, 0x34, 0x00,
0x00, 0x08, 0x4b, 0x5f, 0x42, 0x52, 0x41, 0x43, 0x45, 0x35, 0x00, 0x00,
0x0a, 0x4b, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x49, 0x4e, 0x47, 0x31, 0x00,
0x00, 0x0a, 0x4b, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x49, 0x4e, 0x47, 0x32,
0x00, 0x00, 0x0a, 0x4b, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x49, 0x4e, 0x47,
0x33, 0x00, 0x00, 0x0a, 0x4b, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x49, 0x4e,
0x47, 0x34, 0x00, 0x00, 0x0a, 0x4b, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x49,
0x4e, 0x47, 0x35, 0x00, 0x00, 0x0a, 0x4b, 0x5f, 0x48, 0x45, 0x41, 0x44,
0x49, 0x4e, 0x47, 0x36, 0x00, 0x00, 0x0c, 0x4b, 0x5f, 0x42, 0x4c, 0x4f,
0x43, 0x4b, 0x51, 0x55, 0x4f, 0x54, 0x45, 0x00, 0x00, 0x06, 0x4b, 0x5f,
0x4c, 0x49, 0x53, 0x54, 0x00, 0x00, 0x0a, 0x4b, 0x5f, 0x4c, 0x49, 0x53,
0x54, 0x49, 0x54, 0x45, 0x4d, 0x00, 0x00, 0x06, 0x4b, 0x5f, 0x43, 0x4f,
0x44, 0x45, 0x00, 0x00, 0x0e, 0x4b, 0x5f, 0x4c, 0x41, 0x4e, 0x47, 0x55,
0x41, 0x47, 0x45, 0x4e, 0x41, 0x4d, 0x45, 0x00, 0x00, 0x0b, 0x4b, 0x5f,
0x4c, 0x49, 0x4e, 0x4b, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x00, 0x00, 0x0c,
0x4b, 0x5f, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x4c, 0x41, 0x42, 0x45, 0x4c,
0x00, 0x00, 0x06, 0x4b, 0x5f, 0x4c, 0x49, 0x4e, 0x4b, 0x00, 0x00, 0x07,
0x4b, 0x5f, 0x54, 0x41, 0x42, 0x4c, 0x45, 0x00, 0x00, 0x0d, 0x4b, 0x5f,
0x54, 0x41, 0x42, 0x4c, 0x45, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x00,
0x00, 0x08, 0x4b, 0x5f, 0x49, 0x54, 0x41, 0x4c, 0x49, 0x43, 0x00, 0x00,
0x06, 0x4b, 0x5f, 0x42, 0x4f, 0x4c, 0x44, 0x00, 0x00, 0x0b, 0x4b, 0x5f,
0x55, 0x4e, 0x44, 0x45, 0x52, 0x4c, 0x49, 0x4e, 0x45, 0x00, 0x00, 0x0f,
0x4b, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4b, 0x45, 0x54, 0x48, 0x52, 0x4f,
0x55, 0x47, 0x48, 0x00, 0x00, 0x10, 0x4b, 0x5f, 0x48, 0x4f, 0x52, 0x49,
0x58, 0x4f, 0x4e, 0x54, 0x41, 0x4c, 0x52, 0x55, 0x4c, 0x45, 0x00, 0x00,
0x05, 0x4b, 0x5f, 0x54, 0x41, 0x47, 0x00, 0x00, 0x0b, 0x4b, 0x5f, 0x41,
0x54, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x45, 0x00, 0x00, 0x0b, 0x4b,
0x5f, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x44, 0x4f, 0x4e, 0x45, 0x00, 0x00,
0x0e, 0x4b, 0x5f, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x4e, 0x4f, 0x54, 0x44,
0x4f, 0x4e, 0x45, 0x00, 0x00, 0x06, 0x66, 0x72, 0x65, 0x65, 0x7a, 0x65,
0x00, 0x00, 0x00, 0x0f, 0x61, 0x00, 0x01, 0x00, 0x4c, 0x00, 0x02, 0x00,
0x00, 0x00, 0x00, 0x07, 0x6f, 0x51, 0x01, 0x00, 0x51, 0x02, 0x01, 0x51,
0x03, 0x02, 0x51, 0x04, 0x03, 0x51, 0x05, 0x04, 0x51, 0x06, 0x05, 0x51,
0x07, 0x06, 0x51, 0x08, 0x07, 0x47, 0x02, 0x07, 0x51, 0x03, 0x08, 0x47,
0x04, 0x00, 0x51, 0x05, 0x09, 0x51, 0x06, 0x0a, 0x47, 0x06, 0x01, 0x51,
0x07, 0x0b, 0x51, 0x08, 0x0c, 0x47, 0x08, 0x01, 0x51, 0x09, 0x0d, 0x51,
0x0a, 0x0e, 0x47, 0x0a, 0x01, 0x51, 0x0b, 0x0f, 0x51, 0x0c, 0x0e, 0x47,
0x0c, 0x01, 0x51, 0x0d, 0x10, 0x51, 0x0e, 0x0c, 0x47, 0x0e, 0x01, 0x51,
0x0f, 0x11, 0x51, 0x10, 0x12, 0x47, 0x10, 0x01, 0x51, 0x11, 0x13, 0x51,
0x12, 0x14, 0x47, 0x12, 0x01, 0x51, 0x13, 0x15, 0x51, 0x14, 0x0e, 0x47,
0x14, 0x01, 0x51, 0x15, 0x16, 0x51, 0x16, 0x0e, 0x47, 0x16, 0x01, 0x51,
0x17, 0x17, 0x47, 0x18, 0x00, 0x51, 0x19, 0x18, 0x51, 0x1a, 0x0e, 0x47,
0x1a, 0x01, 0x51, 0x1b, 0x19, 0x47, 0x1c, 0x00, 0x51, 0x1d, 0x1a, 0x51,
0x1e, 0x0e, 0x47, 0x1e, 0x01, 0x51, 0x1f, 0x1b, 0x51, 0x20, 0x1c, 0x47,
0x20, 0x01, 0x51, 0x21, 0x1d, 0x47, 0x22, 0x00, 0x51, 0x23, 0x1e, 0x51,
0x24, 0x14, 0x51, 0x25, 0x0a, 0x47, 0x24, 0x02, 0x51, 0x25, 0x1f, 0x51,
0x26, 0x0e, 0x47, 0x26, 0x01, 0x51, 0x27, 0x20, 0x51, 0x28, 0x12, 0x47,
0x28, 0x01, 0x51, 0x29, 0x21, 0x47, 0x2a, 0x00, 0x51, 0x2b, 0x22, 0x51,
0x2c, 0x23, 0x51, 0x2d, 0x24, 0x51, 0x2e, 0x0a, 0x47, 0x2c, 0x03, 0x53,
0x01, 0x16, 0x1a, 0x01, 0x00, 0x10, 0x01, 0x01, 0x10, 0x02, 0x02, 0x0f,
0x03, 0x00, 0x55, 0x55, 0x55, 0x10, 0x04, 0x03, 0x51, 0x05, 0x25, 0x10,
0x06, 0x04, 0x51, 0x07, 0x26, 0x47, 0x07, 0x01, 0x10, 0x08, 0x05, 0x51,
0x09, 0x00, 0x53, 0x02, 0x04, 0x10, 0x03, 0x06, 0x10, 0x04, 0x02, 0x0e,
0x05, 0x59, 0x9c, 0x10, 0x06, 0x03, 0x51, 0x07, 0x27, 0x10, 0x08, 0x04,
0x51, 0x09, 0x28, 0x51, 0x0a, 0x29, 0x51, 0x0b, 0x2a, 0x47, 0x09, 0x03,
0x10, 0x0a, 0x05, 0x51, 0x0b, 0x00, 0x53, 0x04, 0x04, 0x10, 0x05, 0x07,
0x10, 0x06, 0x02, 0x0f, 0x07, 0x00, 0xa8, 0xb9, 0xcc, 0x10, 0x08, 0x03,
0x51, 0x09, 0x2b, 0x10, 0x0a, 0x04, 0x51, 0x0b, 0x2c, 0x51, 0x0c, 0x2d,
0x47, 0x0b, 0x02, 0x10, 0x0c, 0x05, 0x51, 0x0d, 0x00, 0x53, 0x06, 0x04,
0x10, 0x07, 0x08, 0x10, 0x08, 0x02, 0x0f, 0x09, 0x00, 0x36, 0xa3, 0xd9,
0x10, 0x0a, 0x03, 0x51, 0x0b, 0x2e, 0x10, 0x0c, 0x04, 0x51, 0x0d, 0x2f,
0x47, 0x0d, 0x01, 0x10, 0x0e, 0x05, 0x51, 0x0f, 0x0d, 0x53, 0x08, 0x04,
0x10, 0x09, 0x09, 0x10, 0x0a, 0x02, 0x0f, 0x0b, 0x00, 0x4d, 0x5a, 0x5e,
0x10, 0x0c, 0x03, 0x51, 0x0d, 0x30, 0x10, 0x0e, 0x04, 0x51, 0x0f, 0x31,
0x47, 0x0f, 0x01, 0x10, 0x10, 0x05, 0x51, 0x11, 0x10, 0x53, 0x0a, 0x04,
0x10, 0x0b, 0x0a, 0x10, 0x0c, 0x02, 0x0f, 0x0d, 0x00, 0x00, 0xad, 0xd8,
0x10, 0x0e, 0x03, 0x51, 0x0f, 0x32, 0x10, 0x10, 0x04, 0x51, 0x11, 0x33,
0x47, 0x11, 0x01, 0x10, 0x12, 0x05, 0x51, 0x13, 0x11, 0x53, 0x0c, 0x04,
0x10, 0x0d, 0x0b, 0x10, 0x0e, 0x02, 0x0f, 0x0f, 0x00, 0x00, 0xad, 0xd8,
0x10, 0x10, 0x03, 0x51, 0x11, 0x32, 0x10, 0x12, 0x04, 0x51, 0x13, 0x34,
0x47, 0x13, 0x01, 0x10, 0x14, 0x05, 0x51, 0x15, 0x11, 0x53, 0x0e, 0x04,
0x10, 0x0f, 0x0c, 0x10, 0x10, 0x02, 0x0f, 0x11, 0x00, 0xa0, 0x74, 0xc4,
0x10, 0x12, 0x03, 0x51, 0x13, 0x35, 0x10, 0x14, 0x04, 0x51, 0x15, 0x36,
0x51, 0x16, 0x37, 0x47, 0x15, 0x02, 0x10, 0x16, 0x05, 0x51, 0x17, 0x13,
0x53, 0x10, 0x04, 0x10, 0x11, 0x0d, 0x10, 0x12, 0x02, 0x0f, 0x13, 0x00,
0xef, 0x8a, 0x91, 0x10, 0x14, 0x03, 0x51, 0x15, 0x38, 0x10, 0x16, 0x04,
0x51, 0x17, 0x39, 0x51, 0x18, 0x3a, 0x47, 0x17, 0x02, 0x10, 0x18, 0x05,
0x51, 0x19, 0x15, 0x53, 0x12, 0x04, 0x10, 0x13, 0x0e, 0x10, 0x14, 0x02,
0x0f, 0x15, 0x00, 0xf0, 0xdf, 0x8a, 0x10, 0x16, 0x03, 0x51, 0x17, 0x3b,
0x10, 0x18, 0x04, 0x51, 0x19, 0x3c, 0x47, 0x19, 0x01, 0x10, 0x1a, 0x05,
0x51, 0x1b, 0x16, 0x53, 0x14, 0x04, 0x10, 0x15, 0x0f, 0x10, 0x16, 0x02,
0x0f, 0x17, 0x00, 0x36, 0xa3, 0xd9, 0x10, 0x18, 0x03, 0x51, 0x19, 0x3d,
0x10, 0x1a, 0x04, 0x51, 0x1b, 0x3e, 0x47, 0x1b, 0x01, 0x10, 0x1c, 0x05,
0x51, 0x1d, 0x16, 0x53, 0x16, 0x04, 0x10, 0x17, 0x10, 0x10, 0x18, 0x02,
0x0f, 0x19, 0x00, 0xcb, 0xcb, 0x41, 0x10, 0x1a, 0x03, 0x51, 0x1b, 0x3f,
0x10, 0x1c, 0x04, 0x51, 0x1d, 0x40, 0x47, 0x1d, 0x01, 0x10, 0x1e, 0x05,
0x51, 0x1f, 0x0f, 0x53, 0x18, 0x04, 0x10, 0x19, 0x11, 0x10, 0x1a, 0x02,
0x0f, 0x1b, 0x00, 0xcb, 0xcb, 0x41, 0x10, 0x1c, 0x03, 0x51, 0x1d, 0x3f,
0x10, 0x1e, 0x04, 0x51, 0x1f, 0x41, 0x47, 0x1f, 0x01, 0x10, 0x20, 0x05,
0x51, 0x21, 0x0f, 0x53, 0x1a, 0x04, 0x10, 0x1b, 0x12, 0x10, 0x1c, 0x02,
0x0f, 0x1d, 0x00, 0x6e, 0x15, 0x16, 0x10, 0x1e, 0x03, 0x51, 0x1f, 0x38,
0x10, 0x20, 0x04, 0x51, 0x21, 0x42, 0x47, 0x21, 0x01, 0x10, 0x22, 0x05,
0x51, 0x23, 0x08, 0x53, 0x1c, 0x04, 0x10, 0x1d, 0x13, 0x10, 0x1e, 0x02,
0x0f, 0x1f, 0x00, 0x36, 0xa3, 0xd9, 0x10, 0x20, 0x03, 0x51, 0x21, 0x43,
0x10, 0x22, 0x04, 0x51, 0x23, 0x44, 0x47, 0x23, 0x01, 0x10, 0x24, 0x05,
0x51, 0x25, 0x17, 0x53, 0x1e, 0x04, 0x10, 0x1f, 0x14, 0x10, 0x20, 0x02,
0x0f, 0x21, 0x00, 0x95, 0xe6, 0xcb, 0x10, 0x22, 0x03, 0x51, 0x23, 0x45,
0x10, 0x24, 0x04, 0x51, 0x25, 0x46, 0x47, 0x25, 0x01, 0x10, 0x26, 0x05,
0x51, 0x27, 0x47, 0x53, 0x20, 0x04, 0x10, 0x21, 0x15, 0x10, 0x22, 0x02,
0x0f, 0x23, 0x00, 0xde, 0xa5, 0x84, 0x10, 0x24, 0x03, 0x51, 0x25, 0x48,
0x10, 0x26, 0x04, 0x51, 0x27, 0x49, 0x47, 0x27, 0x01, 0x10, 0x28, 0x05,
0x51, 0x29, 0x19, 0x53, 0x22, 0x04, 0x10, 0x23, 0x16, 0x10, 0x24, 0x02,
0x0f, 0x25, 0x00, 0xa0, 0x74, 0xc4, 0x10, 0x26, 0x03, 0x51, 0x27, 0x4a,
0x10, 0x28, 0x04, 0x51, 0x29, 0x4b, 0x47, 0x29, 0x01, 0x10, 0x2a, 0x05,
0x51, 0x2b, 0x1a, 0x53, 0x24, 0x04, 0x10, 0x25, 0x17, 0x10, 0x26, 0x02,
0x0f, 0x27, 0x00, 0x36, 0xa3, 0xd9, 0x10, 0x28, 0x03, 0x51, 0x29, 0x4c,
0x10, 0x2a, 0x04, 0x51, 0x2b, 0x4d, 0x51, 0x2c, 0x4e, 0x47, 0x2b, 0x02,
0x10, 0x2c, 0x05, 0x51, 0x2d, 0x1b, 0x53, 0x26, 0x04, 0x10, 0x27, 0x18,
0x10, 0x28, 0x02, 0x0f, 0x29, 0x00, 0x6d, 0x80, 0x86, 0x10, 0x2a, 0x03,
0x51, 0x2b, 0x4f, 0x10, 0x2c, 0x04, 0x51, 0x2d, 0x50, 0x47, 0x2d, 0x01,
0x10, 0x2e, 0x05, 0x51, 0x2f, 0x1d, 0x53, 0x28, 0x04, 0x10, 0x29, 0x19,
0x10, 0x2a, 0x02, 0x0f, 0x2b, 0x00, 0x36, 0xa3, 0xd9, 0x10, 0x2c, 0x03,
0x51, 0x2d, 0x51, 0x10, 0x2e, 0x04, 0x51, 0x2f, 0x52, 0x47, 0x2f, 0x01,
0x10, 0x30, 0x05, 0x51, 0x31, 0x1e, 0x53, 0x2a, 0x04, 0x10, 0x2b, 0x1a,
0x10, 0x2c, 0x02, 0x0f, 0x2d, 0x00, 0x6d, 0x80, 0x86, 0x10, 0x2e, 0x03,
0x51, 0x2f, 0x4f, 0x10, 0x30, 0x04, 0x51, 0x31, 0x53, 0x51, 0x32, 0x54,
0x47, 0x31, 0x02, 0x10, 0x32, 0x05, 0x51, 0x33, 0x1f, 0x53, 0x2c, 0x04,
0x10, 0x2d, 0x1b, 0x10, 0x2e, 0x02, 0x0f, 0x2f, 0x00, 0xda, 0xd8, 0xd8,
0x10, 0x30, 0x03, 0x51, 0x31, 0x55, 0x10, 0x32, 0x04, 0x51, 0x33, 0x56,
0x47, 0x33, 0x01, 0x10, 0x34, 0x05, 0x51, 0x35, 0x20, 0x53, 0x2e, 0x04,
0x10, 0x2f, 0x1c, 0x10, 0x30, 0x02, 0x0f, 0x31, 0x00, 0x4e, 0x5c, 0x61,
0x10, 0x32, 0x03, 0x51, 0x33, 0x57, 0x10, 0x34, 0x04, 0x51, 0x35, 0x58,
0x51, 0x36, 0x59, 0x47, 0x35, 0x02, 0x10, 0x36, 0x05, 0x51, 0x37, 0x21,
0x53, 0x30, 0x04, 0x10, 0x31, 0x1d, 0x10, 0x32, 0x02, 0x0f, 0x33, 0x00,
0x6d, 0x80, 0x86, 0x10, 0x34, 0x03, 0x51, 0x35, 0x5a, 0x10, 0x36, 0x04,
0x51, 0x37, 0x5b, 0x47, 0x37, 0x01, 0x53, 0x32, 0x03, 0x10, 0x33, 0x1e,
0x10, 0x34, 0x02, 0x0f, 0x35, 0x00, 0xda, 0xd8, 0xd8, 0x10, 0x36, 0x03,
0x51, 0x37, 0x5c, 0x10, 0x38, 0x04, 0x51, 0x39, 0x5d, 0x47, 0x39, 0x01,
0x53, 0x34, 0x03, 0x10, 0x35, 0x1f, 0x10, 0x36, 0x02, 0x0f, 0x37, 0x00,
0xdd, 0x4c, 0x35, 0x10, 0x38, 0x03, 0x51, 0x39, 0x5e, 0x10, 0x3a, 0x04,
0x51, 0x3b, 0x5f, 0x51, 0x3c, 0x60, 0x47, 0x3b, 0x02, 0x53, 0x36, 0x03,
0x10, 0x37, 0x20, 0x10, 0x38, 0x02, 0x0f, 0x39, 0x00, 0xf0, 0x50, 0x32,
0x10, 0x3a, 0x03, 0x51, 0x3b, 0x61, 0x10, 0x3c, 0x04, 0x51, 0x3d, 0x62,
0x47, 0x3d, 0x01, 0x53, 0x38, 0x03, 0x10, 0x39, 0x21, 0x10, 0x3a, 0x02,
0x0f, 0x3b, 0x00, 0xf0, 0x50, 0x32, 0x10, 0x3c, 0x03, 0x51, 0x3d, 0x61,
0x10, 0x3e, 0x04, 0x51, 0x3f, 0x63, 0x47, 0x3f, 0x01, 0x53, 0x3a, 0x03,
0x10, 0x3b, 0x22, 0x10, 0x3c, 0x02, 0x0f, 0x3d, 0x00, 0x9e, 0x9e, 0x9e,
0x10, 0x3e, 0x03, 0x51, 0x3f, 0x64, 0x10, 0x40, 0x04, 0x51, 0x41, 0x65,
0x47, 0x41, 0x01, 0x53, 0x3c, 0x03, 0x10, 0x3d, 0x23, 0x10, 0x3e, 0x02,
0x0f, 0x3f, 0x00, 0x6d, 0x80, 0x86, 0x10, 0x40, 0x03, 0x51, 0x41, 0x4f,
0x10, 0x42, 0x04, 0x51, 0x43, 0x66, 0x47, 0x43, 0x01, 0x53, 0x3e, 0x03,
0x10, 0x3f, 0x24, 0x10, 0x40, 0x02, 0x0f, 0x41, 0x00, 0xff, 0x80, 0x87,
0x10, 0x42, 0x03, 0x51, 0x43, 0x67, 0x10, 0x44, 0x04, 0x51, 0x45, 0x68,
0x47, 0x45, 0x01, 0x10, 0x46, 0x25, 0x51, 0x47, 0x69, 0x47, 0x47, 0x01,
0x10, 0x48, 0x05, 0x51, 0x49, 0x09, 0x53, 0x40, 0x05, 0x10, 0x41, 0x26,
0x10, 0x42, 0x02, 0x0f, 0x43, 0x00, 0x4d, 0x5a, 0x5e, 0x10, 0x44, 0x03,
0x51, 0x45, 0x6a, 0x10, 0x46, 0x04, 0x51, 0x47, 0x6b, 0x47, 0x47, 0x01,
0x10, 0x48, 0x25, 0x51, 0x49, 0x6c, 0x51, 0x4a, 0x6d, 0x47, 0x49, 0x02,
0x10, 0x4a, 0x05, 0x51, 0x4b, 0x0b, 0x53, 0x42, 0x05, 0x53, 0x01, 0x21,
0x1a, 0x01, 0x27, 0x10, 0x01, 0x28, 0x10, 0x02, 0x29, 0x0f, 0x03, 0x00,
0xee, 0xee, 0xee, 0x53, 0x02, 0x01, 0x10, 0x03, 0x2a, 0x10, 0x04, 0x29,
0x0f, 0x05, 0x00, 0x7d, 0xcf, 0xff, 0x53, 0x04, 0x01, 0x10, 0x05, 0x2b,
0x10, 0x06, 0x29, 0x0f, 0x07, 0x00, 0xef, 0x51, 0x68, 0x53, 0x06, 0x01,
0x10, 0x07, 0x2c, 0x10, 0x08, 0x29, 0x0f, 0x09, 0x00, 0xaa, 0xaa, 0xaa,
0x10, 0x0a, 0x2d, 0x13, 0x0b, 0x53, 0x08, 0x02, 0x10, 0x09, 0x2e, 0x10,
0x0a, 0x29, 0x0f, 0x0b, 0x00, 0xaa, 0xd9, 0x4c, 0x53, 0x0a, 0x01, 0x10,
0x0b, 0x2f, 0x10, 0x0c, 0x29, 0x0f, 0x0d, 0x00, 0x7d, 0xcf, 0xff, 0x53,
0x0c, 0x01, 0x10, 0x0d, 0x30, 0x10, 0x0e, 0x29, 0x0f, 0x0f, 0x00, 0x7d,
0xcf, 0xff, 0x53, 0x0e, 0x01, 0x10, 0x0f, 0x31, 0x10, 0x10, 0x29, 0x0f,
0x11, 0x00, 0xd2, 0xa6, 0xff, 0x53, 0x10, 0x01, 0x10, 0x11, 0x32, 0x10,
0x12, 0x29, 0x0f, 0x13, 0x00, 0xe6, 0xc0, 0x8a, 0x53, 0x12, 0x01, 0x10,
0x13, 0x33, 0x10, 0x14, 0x29, 0x0f, 0x15, 0x00, 0x7a, 0xe9, 0x3c, 0x53,
0x14, 0x01, 0x10, 0x15, 0x34, 0x10, 0x16, 0x29, 0x0f, 0x17, 0x00, 0xef,
0x51, 0x68, 0x53, 0x16, 0x01, 0x10, 0x17, 0x35, 0x10, 0x18, 0x29, 0x0f,
0x19, 0x00, 0xff, 0xaf, 0x70, 0x53, 0x18, 0x01, 0x10, 0x19, 0x36, 0x10,
0x1a, 0x29, 0x0f, 0x1b, 0x00, 0xff, 0x8f, 0x40, 0x53, 0x1a, 0x01, 0x10,
0x1b, 0x37, 0x10, 0x1c, 0x29, 0x0f, 0x1d, 0x00, 0xf0, 0x71, 0x78, 0x53,
0x1c, 0x01, 0x10, 0x1d, 0x38, 0x10, 0x1e, 0x29, 0x0f, 0x1f, 0x00, 0xff,
0xff, 0xff, 0x10, 0x20, 0x2d, 0x13, 0x21, 0x53, 0x1e, 0x02, 0x10, 0x1f,
0x39, 0x10, 0x20, 0x29, 0x0f, 0x21, 0x00, 0xff, 0xaf, 0x70, 0x53, 0x20,
0x01, 0x10, 0x21, 0x3a, 0x10, 0x22, 0x29, 0x0f, 0x23, 0x00, 0xf0, 0x71,
0x78, 0x53, 0x22, 0x01, 0x10, 0x23, 0x3b, 0x10, 0x24, 0x29, 0x0f, 0x25,
0x00, 0x7d, 0xcf, 0xff, 0x53, 0x24, 0x01, 0x10, 0x25, 0x3c, 0x10, 0x26,
0x29, 0x0f, 0x27, 0x00, 0x95, 0xe6, 0xcb, 0x53, 0x26, 0x01, 0x10, 0x27,
0x3d, 0x10, 0x28, 0x29, 0x0f, 0x29, 0x00, 0xf0, 0x71, 0x78, 0x53, 0x28,
0x01, 0x10, 0x29, 0x3e, 0x10, 0x2a, 0x29, 0x0f, 0x2b, 0x00, 0x7d, 0xcf,
0xff, 0x53, 0x2a, 0x01, 0x10, 0x2b, 0x3f, 0x10, 0x2c, 0x29, 0x0f, 0x2d,
0x00, 0xff, 0x8f, 0x40, 0x53, 0x2c, 0x01, 0x10, 0x2d, 0x40, 0x10, 0x2e,
0x29, 0x0f, 0x2f, 0x00, 0xd2, 0xa6, 0xff, 0x53, 0x2e, 0x01, 0x10, 0x2f,
0x41, 0x10, 0x30, 0x29, 0x0f, 0x31, 0x00, 0xd2, 0xa6, 0xff, 0x53, 0x30,
0x01, 0x10, 0x31, 0x42, 0x10, 0x32, 0x29, 0x0f, 0x33, 0x00, 0xff, 0xaf,
0xaf, 0x53, 0x32, 0x01, 0x10, 0x33, 0x43, 0x10, 0x34, 0x29, 0x0f, 0x35,
0x00, 0xff, 0xff, 0x00, 0x53, 0x34, 0x01, 0x10, 0x35, 0x44, 0x10, 0x36,
0x29, 0x0f, 0x37, 0x00, 0x0f, 0xff, 0x0f, 0x53, 0x36, 0x01, 0x10, 0x37,
0x45, 0x10, 0x38, 0x29, 0x0f, 0x39, 0x00, 0xff, 0x0f, 0x0f, 0x53, 0x38,
0x01, 0x53, 0x01, 0x1c, 0x1a, 0x01, 0x46, 0x10, 0x01, 0x47, 0x1a, 0x01,
0x48, 0x53, 0x01, 0x00, 0x1a, 0x01, 0x49, 0x53, 0x01, 0x00, 0x1a, 0x01,
0x4a, 0x53, 0x01, 0x00, 0x1a, 0x01, 0x4b, 0x11, 0x01, 0x1a, 0x01, 0x4c,
0x11, 0x01, 0x1a, 0x01, 0x4d, 0x57, 0x02, 0x00, 0x2e, 0x01, 0x4e, 0x00,
0x1a, 0x01, 0x4f, 0x12, 0x01, 0x62, 0x01, 0x5e, 0x01, 0x01, 0x38, 0x01,
0x00, 0x6e, 0x00, 0x00, 0x06, 0x63, 0x6c, 0x61, 0x6e, 0x67, 0x64, 0x00,
0x00, 0x00, 0x12, 0x2d, 0x2d, 0x62, 0x61, 0x63, 0x6b, 0x67, 0x72, 0x6f,
0x75, 0x6e, 0x64, 0x2d, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x00, 0x00, 0x00,
0x0c, 0x2d, 0x2d, 0x63, 0x6c, 0x61, 0x6e, 0x67, 0x2d, 0x74, 0x69, 0x64,
0x79, 0x00, 0x00, 0x00, 0x1b, 0x2d, 0x2d, 0x63, 0x6f, 0x6d, 0x70, 0x6c,
0x65, 0x74, 0x69, 0x6f, 0x6e, 0x2d, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x3d,
0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x00, 0x00, 0x00, 0x18,
0x2d, 0x2d, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2d, 0x69, 0x6e, 0x73,
0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x6e, 0x65, 0x76, 0x65, 0x72,
0x00, 0x00, 0x00, 0x14, 0x2d, 0x2d, 0x70, 0x63, 0x68, 0x2d, 0x73, 0x74,
0x6f, 0x72, 0x61, 0x67, 0x65, 0x3d, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79,
0x00, 0x00, 0x00, 0x12, 0x2d, 0x2d, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x2d,
0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x3d, 0x35, 0x30, 0x00, 0x00,
0x00, 0x0b, 0x2d, 0x2d, 0x6c, 0x6f, 0x67, 0x3d, 0x65, 0x72, 0x72, 0x6f,
0x72, 0x00, 0x00, 0x00, 0x08, 0x72, 0x75, 0x62, 0x79, 0x2d, 0x6c, 0x73,
0x70, 0x00, 0x00, 0x00, 0x0a, 0x73, 0x6f, 0x6c, 0x61, 0x72, 0x67, 0x72,
0x61, 0x70, 0x68, 0x00, 0x00, 0x00, 0x05, 0x73, 0x74, 0x64, 0x69, 0x6f,
0x00, 0x00, 0x00, 0x14, 0x62, 0x61, 0x73, 0x68, 0x2d, 0x6c, 0x61, 0x6e,
0x67, 0x75, 0x61, 0x67, 0x65, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
0x00, 0x00, 0x00, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x00, 0x00, 0x00,
0x1a, 0x76, 0x73, 0x63, 0x6f, 0x64, 0x65, 0x2d, 0x63, 0x73, 0x73, 0x2d,
0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x2d, 0x73, 0x65, 0x72,
0x76, 0x65, 0x72, 0x00, 0x00, 0x00, 0x07, 0x2d, 0x2d, 0x73, 0x74, 0x64,
0x69, 0x6f, 0x00, 0x00, 0x00, 0x1b, 0x76, 0x73, 0x63, 0x6f, 0x64, 0x65,
0x2d, 0x6a, 0x73, 0x6f, 0x6e, 0x2d, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61,
0x67, 0x65, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x00, 0x00, 0x00,
0x08, 0x66, 0x69, 0x73, 0x68, 0x2d, 0x6c, 0x73, 0x70, 0x00, 0x00, 0x00,
0x05, 0x67, 0x6f, 0x70, 0x6c, 0x73, 0x00, 0x00, 0x00, 0x05, 0x73, 0x65,
0x72, 0x76, 0x65, 0x00, 0x00, 0x00, 0x17, 0x68, 0x61, 0x73, 0x6b, 0x65,
0x6c, 0x6c, 0x2d, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x2d,
0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x00, 0x00, 0x00, 0x03, 0x6c, 0x73,
0x70, 0x00, 0x00, 0x00, 0x15, 0x65, 0x6d, 0x6d, 0x65, 0x74, 0x2d, 0x6c,
0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x2d, 0x73, 0x65, 0x72, 0x76,
0x65, 0x72, 0x00, 0x00, 0x00, 0x1a, 0x74, 0x79, 0x70, 0x65, 0x73, 0x63,
0x72, 0x69, 0x70, 0x74, 0x2d, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67,
0x65, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x00, 0x00, 0x00, 0x13,
0x6c, 0x75, 0x61, 0x2d, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65,
0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x00, 0x00, 0x00, 0x12, 0x70,
0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x2d, 0x6c, 0x61, 0x6e, 0x67, 0x73,
0x65, 0x72, 0x76, 0x65, 0x72, 0x00, 0x00, 0x00, 0x0d, 0x72, 0x75, 0x73,
0x74, 0x2d, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x7a, 0x65, 0x72, 0x00, 0x00,
0x00, 0x0c, 0x69, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x68, 0x65, 0x6e,
0x73, 0x65, 0x00, 0x00, 0x00, 0x08, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x6d,
0x61, 0x6e, 0x00, 0x00, 0x00, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
0x00, 0x00, 0x00, 0x15, 0x6e, 0x67, 0x69, 0x6e, 0x78, 0x2d, 0x6c, 0x61,
0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65,
0x72, 0x00, 0x00, 0x00, 0x05, 0x74, 0x61, 0x70, 0x6c, 0x6f, 0x00, 0x00,
0x00, 0x14, 0x79, 0x61, 0x6d, 0x6c, 0x2d, 0x6c, 0x61, 0x6e, 0x67, 0x75,
0x61, 0x67, 0x65, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x00, 0x00,
0x00, 0x04, 0x73, 0x71, 0x6c, 0x73, 0x00, 0x00, 0x00, 0x14, 0x6d, 0x61,
0x6b, 0x65, 0x2d, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x2d,
0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x00, 0x00, 0x00, 0x13, 0x73, 0x71,
0x6c, 0x2d, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x2d, 0x73,
0x65, 0x72, 0x76, 0x65, 0x72, 0x00, 0x00, 0x00, 0x02, 0x75, 0x70, 0x00,
0x00, 0x00, 0x08, 0x2d, 0x2d, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x00,
0x00, 0x00, 0x04, 0xee, 0x98, 0x9e, 0x20, 0x00, 0x00, 0x00, 0x01, 0x63,
0x00, 0x00, 0x00, 0x04, 0xee, 0x98, 0x9d, 0x20, 0x00, 0x00, 0x00, 0x03,
0x63, 0x70, 0x70, 0x00, 0x00, 0x00, 0x02, 0x63, 0x63, 0x00, 0x00, 0x00,
0x03, 0x63, 0x78, 0x78, 0x00, 0x00, 0x00, 0x04, 0xef, 0x83, 0xbd, 0x20,
0x00, 0x00, 0x00, 0x01, 0x68, 0x00, 0x00, 0x00, 0x03, 0x68, 0x70, 0x70,
0x00, 0x00, 0x00, 0x04, 0xee, 0x9a, 0xb8, 0x20, 0x00, 0x00, 0x00, 0x03,
0x63, 0x73, 0x73, 0x00, 0x00, 0x00, 0x04, 0xee, 0xb9, 0x81, 0x20, 0x00,
0x00, 0x00, 0x04, 0x66, 0x69, 0x73, 0x68, 0x00, 0x00, 0x00, 0x04, 0xee,
0x98, 0xa7, 0x20, 0x00, 0x00, 0x00, 0x02, 0x67, 0x6f, 0x00, 0x00, 0x00,
0x03, 0x6d, 0x6f, 0x64, 0x00, 0x00, 0x00, 0x04, 0xee, 0x9d, 0xb7, 0x20,
0x00, 0x00, 0x00, 0x02, 0x68, 0x73, 0x00, 0x00, 0x00, 0x03, 0x6c, 0x68,
0x73, 0x00, 0x00, 0x00, 0x04, 0xef, 0x84, 0xa1, 0x20, 0x00, 0x00, 0x00,
0x04, 0x68, 0x74, 0x6d, 0x6c, 0x00, 0x00, 0x00, 0x03, 0x68, 0x74, 0x6d,
0x00, 0x00, 0x00, 0x04, 0xef, 0x8b, 0xaf, 0x20, 0x00, 0x00, 0x00, 0x02,
0x6a, 0x73, 0x00, 0x00, 0x00, 0x04, 0xee, 0x9a, 0x9d, 0x20, 0x00, 0x00,
0x00, 0x02, 0x74, 0x73, 0x00, 0x00, 0x00, 0x02, 0x7b, 0x7d, 0x00, 0x00,
0x00, 0x04, 0x6a, 0x73, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x6a, 0x73,
0x6f, 0x6e, 0x63, 0x00, 0x00, 0x00, 0x03, 0x65, 0x72, 0x62, 0x00, 0x00,
0x00, 0x05, 0xf3, 0xb0, 0xa2, 0xb1, 0x20, 0x00, 0x00, 0x00, 0x03, 0x6c,
0x75, 0x61, 0x00, 0x00, 0x00, 0x05, 0xf3, 0xb0, 0x8c, 0xa0, 0x20, 0x00,
0x00, 0x00, 0x02, 0x70, 0x79, 0x00, 0x00, 0x00, 0x07, 0x70, 0x79, 0x72,
0x69, 0x67, 0x68, 0x74, 0x00, 0x00, 0x00, 0x05, 0xf3, 0xb1, 0x98, 0x97,
0x20, 0x00, 0x00, 0x00, 0x02, 0x72, 0x73, 0x00, 0x00, 0x00, 0x05, 0xf3,
0xb0, 0x8c, 0x9f, 0x20, 0x00, 0x00, 0x00, 0x03, 0x70, 0x68, 0x70, 0x00,
0x00, 0x00, 0x04, 0xee, 0xba, 0xab, 0x20, 0x00, 0x00, 0x00, 0x02, 0x6d,
0x64, 0x00, 0x00, 0x00, 0x08, 0x6d, 0x61, 0x72, 0x6b, 0x64, 0x6f, 0x77,
0x6e, 0x00, 0x00, 0x00, 0x04, 0xee, 0x98, 0x95, 0x20, 0x00, 0x00, 0x00,
0x04, 0x63, 0x6f, 0x6e, 0x66, 0x00, 0x00, 0x00, 0x04, 0xee, 0x9a, 0xb2,
0x20, 0x00, 0x00, 0x00, 0x04, 0x74, 0x6f, 0x6d, 0x6c, 0x00, 0x00, 0x00,
0x03, 0x79, 0x6d, 0x6c, 0x00, 0x00, 0x00, 0x04, 0x79, 0x61, 0x6d, 0x6c,
0x00, 0x00, 0x00, 0x04, 0xee, 0x99, 0x8d, 0x20, 0x00, 0x00, 0x00, 0x03,
0x73, 0x71, 0x6c, 0x00, 0x00, 0x00, 0x04, 0xee, 0x99, 0xb3, 0x20, 0x00,
0x00, 0x00, 0x08, 0x4d, 0x61, 0x6b, 0x65, 0x66, 0x69, 0x6c, 0x65, 0x00,
0x00, 0x00, 0x08, 0x6d, 0x61, 0x6b, 0x65, 0x66, 0x69, 0x6c, 0x65, 0x00,
0x00, 0x00, 0x04, 0xee, 0x99, 0x9f, 0x20, 0x00, 0x00, 0x00, 0x02, 0x67,
0x64, 0x00, 0x00, 0x00, 0x04, 0xef, 0x80, 0xad, 0x20, 0x00, 0x00, 0x00,
0x03, 0x6d, 0x61, 0x6e, 0x00, 0x00, 0x00, 0x04, 0xee, 0x9c, 0xa8, 0x20,
0x00, 0x00, 0x00, 0x04, 0x64, 0x69, 0x66, 0x66, 0x00, 0x00, 0x00, 0x05,
0x70, 0x61, 0x74, 0x63, 0x68, 0x00, 0x00, 0x00, 0x04, 0xee, 0x99, 0x9d,
0x20, 0x00, 0x00, 0x00, 0x0d, 0x67, 0x69, 0x74, 0x61, 0x74, 0x74, 0x72,
0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x00, 0x00, 0x00, 0x09, 0x67, 0x69,
0x74, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x00, 0x00, 0x00, 0x02, 0x2e,
0x2a, 0x00, 0x00, 0x00, 0x05, 0x72, 0x65, 0x67, 0x65, 0x78, 0x00, 0x00,
0x00, 0x03, 0x69, 0x6e, 0x69, 0x00, 0x00, 0x00, 0x05, 0xf3, 0xb0, 0xb4,
0xad, 0x20, 0x00, 0x00, 0x00, 0x02, 0x72, 0x62, 0x00, 0x00, 0x00, 0x07,
0x47, 0x65, 0x6d, 0x66, 0x69, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x04, 0xee,
0xaf, 0x8a, 0x20, 0x00, 0x00, 0x00, 0x02, 0x73, 0x68, 0x00, 0x00, 0x00,
0x0c, 0x62, 0x61, 0x73, 0x68, 0x5f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c,
0x65, 0x00, 0x00, 0x00, 0x06, 0x62, 0x61, 0x73, 0x68, 0x72, 0x63, 0x00,
0x00, 0x50, 0x00, 0x0b, 0x40, 0x6c, 0x73, 0x70, 0x5f, 0x63, 0x6f, 0x6e,
0x66, 0x69, 0x67, 0x00, 0x00, 0x01, 0x63, 0x00, 0x00, 0x05, 0x63, 0x6f,
0x6c, 0x6f, 0x72, 0x00, 0x00, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c,
0x00, 0x00, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e,
0x73, 0x00, 0x00, 0x03, 0x6c, 0x73, 0x70, 0x00, 0x00, 0x03, 0x63, 0x70,
0x70, 0x00, 0x00, 0x01, 0x68, 0x00, 0x00, 0x03, 0x63, 0x73, 0x73, 0x00,
0x00, 0x04, 0x66, 0x69, 0x73, 0x68, 0x00, 0x00, 0x02, 0x67, 0x6f, 0x00,
0x00, 0x05, 0x67, 0x6f, 0x6d, 0x6f, 0x64, 0x00, 0x00, 0x07, 0x68, 0x61,
0x73, 0x6b, 0x65, 0x6c, 0x6c, 0x00, 0x00, 0x04, 0x68, 0x74, 0x6d, 0x6c,
0x00, 0x00, 0x0a, 0x6a, 0x61, 0x76, 0x61, 0x73, 0x63, 0x72, 0x69, 0x70,
0x74, 0x00, 0x00, 0x0a, 0x74, 0x79, 0x70, 0x65, 0x73, 0x63, 0x72, 0x69,
0x70, 0x74, 0x00, 0x00, 0x04, 0x6a, 0x73, 0x6f, 0x6e, 0x00, 0x00, 0x05,
0x6a, 0x73, 0x6f, 0x6e, 0x63, 0x00, 0x00, 0x03, 0x65, 0x72, 0x62, 0x00,
0x00, 0x03, 0x6c, 0x75, 0x61, 0x00, 0x00, 0x06, 0x70, 0x79, 0x74, 0x68,
0x6f, 0x6e, 0x00, 0x00, 0x04, 0x72, 0x75, 0x73, 0x74, 0x00, 0x00, 0x03,
0x70, 0x68, 0x70, 0x00, 0x00, 0x08, 0x6d, 0x61, 0x72, 0x6b, 0x64, 0x6f,
0x77, 0x6e, 0x00, 0x00, 0x05, 0x6e, 0x67, 0x69, 0x6e, 0x78, 0x00, 0x00,
0x04, 0x74, 0x6f, 0x6d, 0x6c, 0x00, 0x00, 0x04, 0x79, 0x61, 0x6d, 0x6c,
0x00, 0x00, 0x03, 0x73, 0x71, 0x6c, 0x00, 0x00, 0x04, 0x6d, 0x61, 0x6b,
0x65, 0x00, 0x00, 0x08, 0x67, 0x64, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
0x00, 0x00, 0x03, 0x6d, 0x61, 0x6e, 0x00, 0x00, 0x04, 0x64, 0x69, 0x66,
0x66, 0x00, 0x00, 0x0d, 0x67, 0x69, 0x74, 0x61, 0x74, 0x74, 0x72, 0x69,
0x62, 0x75, 0x74, 0x65, 0x73, 0x00, 0x00, 0x09, 0x67, 0x69, 0x74, 0x69,
0x67, 0x6e, 0x6f, 0x72, 0x65, 0x00, 0x00, 0x05, 0x72, 0x65, 0x67, 0x65,
0x78, 0x00, 0x00, 0x03, 0x69, 0x6e, 0x69, 0x00, 0x00, 0x04, 0x72, 0x75,
0x62, 0x79, 0x00, 0x00, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d,
0x65, 0x73, 0x00, 0x00, 0x04, 0x62, 0x61, 0x73, 0x68, 0x00, 0x00, 0x0a,
0x40, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x73, 0x00, 0x00,
0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x00, 0x00, 0x02, 0x66,
0x67, 0x00, 0x00, 0x07, 0x73, 0x68, 0x65, 0x62, 0x61, 0x6e, 0x67, 0x00,
0x00, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x00, 0x00, 0x07, 0x63, 0x6f,
0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x00, 0x00, 0x06, 0x69, 0x74, 0x61, 0x6c,
0x69, 0x63, 0x00, 0x00, 0x06, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x00,
0x00, 0x06, 0x65, 0x73, 0x63, 0x61, 0x70, 0x65, 0x00, 0x00, 0x0d, 0x69,
0x6e, 0x74, 0x65, 0x72, 0x70, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x00, 0x00, 0x06, 0x72, 0x65, 0x67, 0x65, 0x78, 0x70, 0x00, 0x00, 0x06,
0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x00, 0x00, 0x04, 0x74, 0x72, 0x75,
0x65, 0x00, 0x00, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x00, 0x00, 0x04,
0x63, 0x68, 0x61, 0x72, 0x00, 0x00, 0x07, 0x6b, 0x65, 0x79, 0x77, 0x6f,
0x72, 0x64, 0x00, 0x00, 0x0f, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64,
0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x00, 0x00, 0x08, 0x6f,
0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x00, 0x00, 0x08, 0x66, 0x75,
0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x04, 0x74, 0x79, 0x70,
0x65, 0x00, 0x00, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74,
0x00, 0x00, 0x10, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x69,
0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x00, 0x00, 0x0e, 0x76, 0x61,
0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c,
0x00, 0x00, 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x00, 0x00, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x76,
0x65, 0x00, 0x00, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x00, 0x00, 0x06,
0x62, 0x72, 0x61, 0x63, 0x65, 0x31, 0x00, 0x00, 0x06, 0x62, 0x72, 0x61,
0x63, 0x65, 0x32, 0x00, 0x00, 0x06, 0x62, 0x72, 0x61, 0x63, 0x65, 0x33,
0x00, 0x00, 0x06, 0x62, 0x72, 0x61, 0x63, 0x65, 0x34, 0x00, 0x00, 0x06,
0x62, 0x72, 0x61, 0x63, 0x65, 0x35, 0x00, 0x00, 0x06, 0x40, 0x74, 0x68,
0x65, 0x6d, 0x65, 0x00, 0x00, 0x09, 0x61, 0x75, 0x74, 0x6f, 0x5f, 0x75,
0x6e, 0x69, 0x78, 0x00, 0x00, 0x0d, 0x40, 0x6c, 0x69, 0x6e, 0x65, 0x5f,
0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x00, 0x00, 0x0d, 0x40, 0x6b,
0x65, 0x79, 0x5f, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x73, 0x00,
0x00, 0x0a, 0x40, 0x6b, 0x65, 0x79, 0x5f, 0x62, 0x69, 0x6e, 0x64, 0x73,
0x00, 0x00, 0x0d, 0x40, 0x68, 0x69, 0x67, 0x68, 0x6c, 0x69, 0x67, 0x68,
0x74, 0x65, 0x72, 0x73, 0x00, 0x00, 0x0a, 0x40, 0x62, 0x5f, 0x73, 0x74,
0x61, 0x72, 0x74, 0x75, 0x70, 0x00, 0x00, 0x0b, 0x40, 0x62, 0x5f, 0x73,
0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x00, 0x00, 0x06, 0x6c, 0x61,
0x6d, 0x62, 0x64, 0x61, 0x00, 0x00, 0x06, 0x40, 0x62, 0x5f, 0x62, 0x61,
0x72, 0x00, 0x00, 0x00, 0x03, 0x47, 0x00, 0x09, 0x00, 0x14, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x17, 0x34, 0x04, 0x00, 0x00, 0x0f, 0x03,
0x00, 0x82, 0xaa, 0xff, 0x51, 0x04, 0x00, 0x01, 0x09, 0x01, 0x10, 0x0a,
0x00, 0x23, 0x09, 0x10, 0x0a, 0x01, 0x01, 0x0b, 0x09, 0x2f, 0x0a, 0x02,
0x01, 0x26, 0x0a, 0x00, 0x03, 0x25, 0x00, 0x0c, 0x0f, 0x03, 0x00, 0x82,
0xaa, 0xff, 0x51, 0x04, 0x01, 0x25, 0x00, 0x74, 0x10, 0x0a, 0x03, 0x01,
0x0b, 0x09, 0x2f, 0x0a, 0x02, 0x01, 0x26, 0x0a, 0x00, 0x03, 0x25, 0x00,
0x0c, 0x0f, 0x03, 0x00, 0xff, 0x8f, 0x40, 0x51, 0x04, 0x02, 0x25, 0x00,
0x57, 0x10, 0x0a, 0x04, 0x01, 0x0b, 0x09, 0x2f, 0x0a, 0x02, 0x01, 0x26,
0x0a, 0x00, 0x03, 0x25, 0x00, 0x0c, 0x0f, 0x03, 0x00, 0x9a, 0xde, 0x7a,
0x51, 0x04, 0x03, 0x25, 0x00, 0x3a, 0x10, 0x0a, 0x05, 0x01, 0x0b, 0x09,
0x2f, 0x0a, 0x02, 0x01, 0x26, 0x0a, 0x00, 0x03, 0x25, 0x00, 0x0c, 0x0f,
0x03, 0x00, 0xff, 0xd7, 0x00, 0x51, 0x04, 0x04, 0x25, 0x00, 0x1d, 0x10,
0x0a, 0x06, 0x01, 0x0b, 0x09, 0x2f, 0x0a, 0x02, 0x01, 0x26, 0x0a, 0x00,
0x03, 0x25, 0x00, 0x0c, 0x0f, 0x03, 0x00, 0xf2, 0x9c, 0xc3, 0x51, 0x04,
0x05, 0x25, 0x00, 0x00, 0x1d, 0x09, 0x07, 0x2f, 0x09, 0x08, 0x00, 0x01,
0x0a, 0x01, 0x10, 0x0b, 0x09, 0x23, 0x0a, 0x23, 0x09, 0x01, 0x05, 0x09,
0x1d, 0x09, 0x0a, 0x01, 0x0a, 0x01, 0x10, 0x0b, 0x0b, 0x23, 0x0a, 0x2f,
0x09, 0x0c, 0x01, 0x01, 0x06, 0x09, 0x51, 0x09, 0x06, 0x01, 0x0a, 0x04,
0x52, 0x09, 0x51, 0x0a, 0x06, 0x52, 0x09, 0x01, 0x0a, 0x01, 0x10, 0x0b,
0x00, 0x23, 0x0a, 0x2f, 0x0a, 0x0d, 0x00, 0x2f, 0x0a, 0x0e, 0x00, 0x52,
0x09, 0x51, 0x0a, 0x07, 0x52, 0x09, 0x01, 0x0a, 0x05, 0x10, 0x0b, 0x0f,
0x23, 0x0a, 0x52, 0x09, 0x51, 0x0a, 0x08, 0x52, 0x09, 0x01, 0x0a, 0x06,
0x52, 0x09, 0x51, 0x0a, 0x09, 0x52, 0x09, 0x01, 0x07, 0x09, 0x47, 0x08,
0x00, 0x01, 0x09, 0x08, 0x10, 0x0a, 0x10, 0x0f, 0x0b, 0x00, 0x0b, 0x0e,
0x14, 0x10, 0x0c, 0x11, 0x01, 0x0d, 0x03, 0x10, 0x0e, 0x12, 0x08, 0x0f,
0x10, 0x10, 0x13, 0x06, 0x11, 0x10, 0x12, 0x14, 0x03, 0x13, 0x0a, 0x53,
0x0a, 0x05, 0x2f, 0x09, 0x15, 0x01, 0x01, 0x09, 0x08, 0x10, 0x0a, 0x10,
0x01, 0x0b, 0x03, 0x10, 0x0c, 0x11, 0x0f, 0x0d, 0x00, 0x33, 0x36, 0x3c,
0x10, 0x0e, 0x13, 0x03, 0x0f, 0x0a, 0x10, 0x10, 0x14, 0x07, 0x11, 0x53,
0x0a, 0x04, 0x2f, 0x09, 0x15, 0x01, 0x01, 0x09, 0x08, 0x10, 0x0a, 0x10,
0x0f, 0x0b, 0x00, 0x33, 0x36, 0x3c, 0x10, 0x0c, 0x11, 0x0f, 0x0d, 0x00,
0x24, 0x27, 0x2d, 0x10, 0x0e, 0x13, 0x03, 0x0f, 0x0b, 0x10, 0x10, 0x14,
0x07, 0x11, 0x53, 0x0a, 0x04, 0x2f, 0x09, 0x15, 0x01, 0x01, 0x09, 0x08,
0x10, 0x0a, 0x10, 0x01, 0x0b, 0x05, 0x10, 0x0c, 0x16, 0x23, 0x0b, 0x10,
0x0c, 0x11, 0x0f, 0x0d, 0x00, 0x24, 0x27, 0x2d, 0x10, 0x0e, 0x13, 0x03,
0x0f, 0x0d, 0x10, 0x10, 0x14, 0x08, 0x11, 0x53, 0x0a, 0x04, 0x2f, 0x09,
0x15, 0x01, 0x01, 0x09, 0x08, 0x10, 0x0a, 0x10, 0x0f, 0x0b, 0x00, 0xce,
0xd4, 0xdf, 0x10, 0x0c, 0x11, 0x0f, 0x0d, 0x00, 0x24, 0x27, 0x2d, 0x10,
0x0e, 0x13, 0x03, 0x0f, 0x0f, 0x10, 0x10, 0x14, 0x01, 0x11, 0x06, 0x2f,
0x11, 0x14, 0x00, 0x53, 0x0a, 0x04, 0x2f, 0x09, 0x15, 0x01, 0x01, 0x09,
0x08, 0x10, 0x0a, 0x10, 0x0f, 0x0b, 0x00, 0x24, 0x27, 0x2d, 0x10, 0x0c,
0x11, 0x06, 0x0d, 0x10, 0x0e, 0x13, 0x03, 0x0f, 0x0f, 0x01, 0x10, 0x06,
0x2f, 0x10, 0x14, 0x00, 0x3c, 0x0f, 0x10, 0x10, 0x14, 0x07, 0x11, 0x53,
0x0a, 0x04, 0x2f, 0x09, 0x15, 0x01, 0x10, 0x09, 0x17, 0x01, 0x0a, 0x07,
0x10, 0x0b, 0x18, 0x01, 0x0c, 0x08, 0x53, 0x09, 0x02, 0x39, 0x09, 0x38,
0x09, 0x00, 0x0a, 0x00, 0x00, 0x02, 0x20, 0x20, 0x00, 0x00, 0x00, 0x04,
0xee, 0x99, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x05, 0xf3, 0xb1, 0x93, 0xa7,
0x20, 0x00, 0x00, 0x00, 0x05, 0xf3, 0xb1, 0xa9, 0xa7, 0x20, 0x00, 0x00,
0x00, 0x04, 0xef, 0x84, 0xa0, 0x20, 0x00, 0x00, 0x00, 0x04, 0xee, 0xba,
0xa2, 0x20, 0x00, 0x00, 0x00, 0x01, 0x20, 0x00, 0x00, 0x00, 0x08, 0x20,
0xee, 0x82, 0xb4, 0xee, 0x82, 0xb4, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0xee, 0x82, 0xb4, 0x00, 0x00, 0x19, 0x00, 0x04, 0x6d,
0x6f, 0x64, 0x65, 0x00, 0x00, 0x06, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c,
0x00, 0x00, 0x03, 0x3d, 0x3d, 0x3d, 0x00, 0x00, 0x06, 0x69, 0x6e, 0x73,
0x65, 0x72, 0x74, 0x00, 0x00, 0x06, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74,
0x00, 0x00, 0x06, 0x72, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x00, 0x00, 0x06,
0x6a, 0x75, 0x6d, 0x70, 0x65, 0x72, 0x00, 0x00, 0x01, 0x43, 0x00, 0x00,
0x09, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x73, 0x00, 0x00,
0x09, 0x6c, 0x61, 0x6e, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x00,
0x04, 0x46, 0x69, 0x6c, 0x65, 0x00, 0x00, 0x08, 0x66, 0x69, 0x6c, 0x65,
0x6e, 0x61, 0x6d, 0x65, 0x00, 0x00, 0x08, 0x62, 0x61, 0x73, 0x65, 0x6e,
0x61, 0x6d, 0x65, 0x00, 0x00, 0x04, 0x74, 0x6f, 0x5f, 0x73, 0x00, 0x00,
0x06, 0x75, 0x70, 0x63, 0x61, 0x73, 0x65, 0x00, 0x00, 0x06, 0x73, 0x79,
0x6d, 0x62, 0x6f, 0x6c, 0x00, 0x00, 0x02, 0x66, 0x67, 0x00, 0x00, 0x02,
0x62, 0x67, 0x00, 0x00, 0x05, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x00, 0x00,
0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x00, 0x00, 0x06, 0x6c, 0x65, 0x6e,
0x67, 0x74, 0x68, 0x00, 0x00, 0x02, 0x3c, 0x3c, 0x00, 0x00, 0x05, 0x63,
0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x04, 0x74, 0x65, 0x78, 0x74, 0x00,
0x00, 0x0a, 0x68, 0x69, 0x67, 0x68, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x73,
0x00, 0x00, 0x00, 0x01, 0x1b, 0x00, 0x01, 0x00, 0x08, 0x00, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x45, 0x10, 0x02, 0x00, 0x10, 0x03, 0x01, 0x10,
0x04, 0x02, 0x10, 0x05, 0x03, 0x10, 0x06, 0x04, 0x2d, 0x01, 0x05, 0x05,
0x10, 0x02, 0x06, 0x10, 0x03, 0x07, 0x10, 0x04, 0x08, 0x10, 0x05, 0x09,
0x2d, 0x01, 0x0a, 0x04, 0x63, 0x01, 0x58, 0x02, 0x00, 0x5f, 0x01, 0x0b,
0x63, 0x01, 0x58, 0x02, 0x01, 0x5f, 0x01, 0x0c, 0x63, 0x01, 0x58, 0x02,
0x02, 0x5f, 0x01, 0x0d, 0x63, 0x01, 0x58, 0x02, 0x03, 0x5f, 0x01, 0x0e,
0x38, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x05, 0x74, 0x68, 0x65, 0x6d,
0x65, 0x00, 0x00, 0x0a, 0x6c, 0x73, 0x70, 0x5f, 0x63, 0x6f, 0x6e, 0x66,
0x69, 0x67, 0x00, 0x00, 0x09, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67,
0x65, 0x73, 0x00, 0x00, 0x0c, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x65, 0x6e,
0x64, 0x69, 0x6e, 0x67, 0x73, 0x00, 0x00, 0x0c, 0x68, 0x69, 0x67, 0x68,
0x6c, 0x69, 0x67, 0x68, 0x74, 0x65, 0x72, 0x73, 0x00, 0x00, 0x0d, 0x61,
0x74, 0x74, 0x72, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72,
0x00, 0x00, 0x09, 0x62, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x75, 0x70,
0x00, 0x00, 0x0a, 0x62, 0x5f, 0x73, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77,
0x6e, 0x00, 0x00, 0x12, 0x62, 0x5f, 0x65, 0x78, 0x74, 0x72, 0x61, 0x5f,
0x68, 0x69, 0x67, 0x68, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x73, 0x00, 0x00,
0x05, 0x62, 0x5f, 0x62, 0x61, 0x72, 0x00, 0x00, 0x0b, 0x61, 0x74, 0x74,
0x72, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x65, 0x72, 0x00, 0x00, 0x07, 0x73,
0x74, 0x61, 0x72, 0x74, 0x75, 0x70, 0x00, 0x00, 0x08, 0x73, 0x68, 0x75,
0x74, 0x64, 0x6f, 0x77, 0x6e, 0x00, 0x00, 0x10, 0x65, 0x78, 0x74, 0x72,
0x61, 0x5f, 0x68, 0x69, 0x67, 0x68, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x73,
0x00, 0x00, 0x04, 0x62, 0x69, 0x6e, 0x64, 0x00, 0x00, 0x00, 0x00, 0x2d,
0x00, 0x02, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c,
0x34, 0x00, 0x00, 0x01, 0x01, 0x02, 0x01, 0x1a, 0x02, 0x00, 0x38, 0x02,
0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x40, 0x62, 0x5f, 0x73, 0x74, 0x61,
0x72, 0x74, 0x75, 0x70, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x02, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x34, 0x00, 0x00,
0x01, 0x01, 0x02, 0x01, 0x1a, 0x02, 0x00, 0x38, 0x02, 0x00, 0x00, 0x00,
0x01, 0x00, 0x0b, 0x40, 0x62, 0x5f, 0x73, 0x68, 0x75, 0x74, 0x64, 0x6f,
0x77, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x02, 0x00, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x34, 0x00, 0x00, 0x01, 0x01,
0x02, 0x01, 0x1a, 0x02, 0x00, 0x38, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00,
0x13, 0x40, 0x62, 0x5f, 0x65, 0x78, 0x74, 0x72, 0x61, 0x5f, 0x68, 0x69,
0x67, 0x68, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x73, 0x00, 0x00, 0x00, 0x01,
0x43, 0x00, 0x07, 0x00, 0x0a, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0xc1, 0x34, 0x04, 0x40, 0x01, 0x25, 0x00, 0x06, 0x25, 0x00, 0x05, 0x25,
0x00, 0x04, 0x11, 0x02, 0x11, 0x03, 0x01, 0x07, 0x01, 0x1d, 0x08, 0x00,
0x2f, 0x07, 0x01, 0x01, 0x26, 0x07, 0x00, 0x07, 0x01, 0x07, 0x01, 0x48,
0x01, 0x07, 0x01, 0x01, 0x07, 0x02, 0x28, 0x07, 0x00, 0x03, 0x25, 0x00,
0x33, 0x12, 0x05, 0x1d, 0x07, 0x02, 0x2f, 0x07, 0x03, 0x00, 0x01, 0x06,
0x07, 0x01, 0x07, 0x06, 0x10, 0x08, 0x04, 0x57, 0x09, 0x00, 0x30, 0x07,
0x05, 0x01, 0x2d, 0x07, 0x06, 0x00, 0x27, 0x07, 0x00, 0x0d, 0x01, 0x07,
0x06, 0x01, 0x08, 0x04, 0x30, 0x07, 0x07, 0x00, 0x25, 0x00, 0x02, 0x11,
0x07, 0x25, 0x00, 0x5c, 0x2d, 0x07, 0x06, 0x00, 0x27, 0x07, 0x00, 0x22,
0x01, 0x07, 0x02, 0x1d, 0x08, 0x00, 0x2f, 0x07, 0x01, 0x01, 0x26, 0x07,
0x00, 0x07, 0x01, 0x07, 0x02, 0x48, 0x02, 0x07, 0x01, 0x01, 0x07, 0x01,
0x57, 0x08, 0x01, 0x30, 0x07, 0x08, 0x00, 0x25, 0x00, 0x32, 0x01, 0x07,
0x03, 0x1d, 0x08, 0x09, 0x2f, 0x07, 0x01, 0x01, 0x27, 0x07, 0x00, 0x22,
0x01, 0x07, 0x02, 0x1d, 0x08, 0x00, 0x2f, 0x07, 0x01, 0x01, 0x26, 0x07,
0x00, 0x07, 0x01, 0x07, 0x02, 0x48, 0x02, 0x07, 0x01, 0x01, 0x07, 0x01,
0x57, 0x08, 0x02, 0x30, 0x07, 0x08, 0x00, 0x25, 0x00, 0x02, 0x11, 0x07,
0x38, 0x07, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x05, 0x41, 0x72, 0x72, 0x61,
0x79, 0x00, 0x00, 0x05, 0x69, 0x73, 0x5f, 0x61, 0x3f, 0x00, 0x00, 0x06,
0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x00, 0x00, 0x03, 0x6e, 0x65, 0x77,
0x00, 0x00, 0x03, 0x73, 0x65, 0x74, 0x00, 0x00, 0x17, 0x64, 0x65, 0x66,
0x69, 0x6e, 0x65, 0x5f, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x74, 0x6f,
0x6e, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x00, 0x00, 0x0c, 0x62,
0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x67, 0x69, 0x76, 0x65, 0x6e, 0x3f, 0x00,
0x00, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x65,
0x78, 0x65, 0x63, 0x00, 0x00, 0x04, 0x65, 0x61, 0x63, 0x68, 0x00, 0x00,
0x06, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x00, 0x3e,
0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23,
0x34, 0x04, 0x20, 0x01, 0x25, 0x00, 0x03, 0x25, 0x00, 0x02, 0x11, 0x02,
0x21, 0x04, 0x05, 0x00, 0x21, 0x05, 0x01, 0x00, 0x01, 0x06, 0x01, 0x01,
0x07, 0x02, 0x01, 0x08, 0x03, 0x30, 0x04, 0x00, 0x03, 0x38, 0x04, 0x00,
0x00, 0x00, 0x01, 0x00, 0x04, 0x62, 0x69, 0x6e, 0x64, 0x00, 0x00, 0x00,
0x00, 0x2c, 0x00, 0x03, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x11, 0x34, 0x04, 0x00, 0x00, 0x21, 0x03, 0x02, 0x00, 0x57, 0x04,
0x00, 0x30, 0x03, 0x00, 0x00, 0x38, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00,
0x04, 0x65, 0x61, 0x63, 0x68, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x03,
0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x34, 0x04,
0x00, 0x00, 0x19, 0x03, 0x00, 0x21, 0x04, 0x01, 0x00, 0x01, 0x05, 0x03,
0x01, 0x06, 0x04, 0x2f, 0x05, 0x01, 0x01, 0x26, 0x05, 0x00, 0x07, 0x53,
0x05, 0x00, 0x2f, 0x03, 0x02, 0x02, 0x19, 0x03, 0x00, 0x21, 0x04, 0x01,
0x00, 0x23, 0x03, 0x01, 0x04, 0x01, 0x01, 0x05, 0x03, 0x01, 0x06, 0x04,
0x2f, 0x05, 0x01, 0x01, 0x26, 0x05, 0x00, 0x07, 0x47, 0x05, 0x00, 0x2f,
0x03, 0x02, 0x02, 0x19, 0x03, 0x00, 0x21, 0x04, 0x01, 0x00, 0x23, 0x03,
0x01, 0x04, 0x01, 0x23, 0x03, 0x21, 0x04, 0x04, 0x01, 0x2f, 0x03, 0x03,
0x01, 0x38, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0d, 0x40, 0x6b, 0x65,
0x79, 0x5f, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x73, 0x00, 0x00,
0x02, 0x5b, 0x5d, 0x00, 0x00, 0x03, 0x5b, 0x5d, 0x3d, 0x00, 0x00, 0x02,
0x3c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x03, 0x00, 0x05, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x34, 0x04, 0x00, 0x00, 0x21,
0x03, 0x02, 0x00, 0x57, 0x04, 0x00, 0x30, 0x03, 0x00, 0x00, 0x38, 0x03,
0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x65, 0x61, 0x63, 0x68, 0x00, 0x00,
0x00, 0x00, 0x8a, 0x00, 0x03, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x59, 0x34, 0x04, 0x00, 0x00, 0x19, 0x03, 0x00, 0x21, 0x04,
0x01, 0x00, 0x01, 0x05, 0x03, 0x01, 0x06, 0x04, 0x2f, 0x05, 0x01, 0x01,
0x26, 0x05, 0x00, 0x07, 0x53, 0x05, 0x00, 0x2f, 0x03, 0x02, 0x02, 0x19,
0x03, 0x00, 0x21, 0x04, 0x01, 0x00, 0x23, 0x03, 0x01, 0x04, 0x01, 0x01,
0x05, 0x03, 0x01, 0x06, 0x04, 0x2f, 0x05, 0x01, 0x01, 0x26, 0x05, 0x00,
0x07, 0x47, 0x05, 0x00, 0x2f, 0x03, 0x02, 0x02, 0x19, 0x03, 0x00, 0x21,
0x04, 0x01, 0x00, 0x23, 0x03, 0x01, 0x04, 0x01, 0x23, 0x03, 0x21, 0x04,
0x03, 0x01, 0x2f, 0x03, 0x03, 0x01, 0x38, 0x03, 0x00, 0x00, 0x00, 0x04,
0x00, 0x0a, 0x40, 0x6b, 0x65, 0x79, 0x5f, 0x62, 0x69, 0x6e, 0x64, 0x73,
0x00, 0x00, 0x02, 0x5b, 0x5d, 0x00, 0x00, 0x03, 0x5b, 0x5d, 0x3d, 0x00,
0x00, 0x02, 0x3c, 0x3c, 0x00, 0x4c, 0x56, 0x41, 0x52, 0x00, 0x00, 0x00,
0xcc, 0x00, 0x00, 0x00, 0x12, 0x00, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x00,
0x0a, 0x6d, 0x6f, 0x64, 0x65, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00,
0x0b, 0x6d, 0x6f, 0x64, 0x65, 0x5f, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c,
0x00, 0x09, 0x6c, 0x61, 0x6e, 0x67, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x00,
0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x08, 0x73,
0x74, 0x61, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x00, 0x0a, 0x68, 0x69, 0x67,
0x68, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x73, 0x00, 0x05, 0x62, 0x6c, 0x6f,
0x63, 0x6b, 0x00, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x73, 0x00, 0x04, 0x6b,
0x65, 0x79, 0x73, 0x00, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x00,
0x03, 0x61, 0x70, 0x70, 0x00, 0x03, 0x64, 0x73, 0x6c, 0x00, 0x01, 0x6b,
0x00, 0x03, 0x61, 0x63, 0x74, 0x00, 0x03, 0x62, 0x6c, 0x6b, 0x00, 0x04,
0x6d, 0x6f, 0x64, 0x65, 0x00, 0x03, 0x6b, 0x65, 0x79, 0x00, 0x00, 0xff,
0xff, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x04, 0x00, 0x05, 0x00,
0x06, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x08, 0x00, 0x09, 0x00,
0x0a, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x0c, 0x00, 0x0d, 0x00, 0x0e, 0x00,
0x0f, 0x00, 0x10, 0xff, 0xff, 0x00, 0x11, 0xff, 0xff, 0x00, 0x10, 0xff,
0xff, 0x00, 0x11, 0xff, 0xff, 0x45, 0x4e, 0x44, 0x00, 0x00, 0x00, 0x00,
0x08
};
constexpr unsigned int _tmp___crib_precompiled_mrb_len = 7273;

View File

@@ -26,24 +26,6 @@ const std::unordered_map<std::string, TokenKind> kind_map = {
#undef ADD
};
constexpr const char tokens_def[] = "module Tokens\n"
#define STRINGIFY_HELPER(x) #x
#define STRINGIFY(x) STRINGIFY_HELPER(x)
#define ADD(name) " " #name " = " STRINGIFY(__COUNTER__) "\n"
#include "syntax/tokens.def"
#undef ADD
#undef STRINGIFY
#undef STRINGIFY_HELPER
" freeze\n"
"end";
constexpr const char crib_module[] = {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wc23-extensions"
#embed "libcrib.rb"
#pragma clang diagnostic pop
, '\0'};
extern std::array<Highlight, TOKEN_KIND_COUNT> highlights;
struct Token {
@@ -59,9 +41,8 @@ struct LineData {
};
struct CustomState {
VALUE state;
CustomState(VALUE s) : state(s) { rb_gc_register_address(&state); }
~CustomState() { rb_gc_unregister_address(&state); }
mrb_value state;
CustomState(mrb_value s) : state(s) {}
};
#endif

View File

@@ -14,8 +14,8 @@ struct Parser {
uint32_t line_num);
bool (*state_match_func)(std::shared_ptr<void> state_1,
std::shared_ptr<void> state_2);
VALUE parser_block = Qnil;
VALUE match_block = Qnil;
mrb_value parser_block = mrb_nil_value();
mrb_value match_block = mrb_nil_value();
bool is_custom{false};
std::atomic<uint32_t> scroll_max{UINT32_MAX - 2048};
std::atomic<bool> scroll_dirty{false};

View File

@@ -8,9 +8,13 @@
struct Bar {
Coord screen;
std::string command = "";
std::string log_line = "";
uint32_t cursor = 0;
BarLine bar_line;
std::mutex mtx;
Bar(Coord screen) : screen(screen) {}
void init(Coord screen) { this->screen = screen; }
void work();
void render();
void handle(KeyEvent event);
void log(std::string message);

View File

@@ -102,7 +102,6 @@ struct Language {
std::string name;
std::string lsp_name;
uint32_t color;
std::string symbol;
};
struct LSP {
@@ -112,7 +111,6 @@ struct LSP {
extern std::unordered_map<std::string, Language> languages;
extern std::unordered_map<std::string, std::string> language_extensions;
extern std::unordered_map<std::string, std::string> language_mimetypes;
extern std::unordered_map<std::string, LSP> lsps;
#define MAX(a, b) ((a) > (b) ? (a) : (b))
@@ -155,7 +153,6 @@ std::string path_to_file_uri(const std::string &path_str);
std::string filename_from_path(const std::string &path);
std::string get_exe_dir();
char *load_file(const char *path, uint32_t *out_len, bool *out_eol);
char *detect_file_type(const char *filename);
Language language_for_file(const char *filename);
void copy_to_clipboard(const char *text, size_t len);

View File

@@ -1,43 +1,39 @@
#!/usr/bin/env bash
set -e
#!/usr/bin/env sh
BINARY_NAME="crib"
GITHUB_URL="https://github.com/SyedM-dev/crib/releases/download/v0.0.1-alpha/crib-linux-x86_64"
set -eu
# 1⃣ Check dependencies
missing=()
command -v ruby >/dev/null 2>&1 || missing+=("ruby")
ldconfig -p | grep libmagic >/dev/null 2>&1 || missing+=("libmagic")
install() {
BINARY_NAME="crib"
BIN_URL="https://git.syedm.dev/SyedM/crib/releases/download/v0.0.2-alpha/crib"
if [ ${#missing[@]} -ne 0 ]; then
echo "Missing dependencies: ${missing[*]}"
echo "Install them using your package manager:"
echo "Ubuntu/Debian: sudo apt install ruby libmagic1"
echo "Arch: sudo pacman -S ruby file"
echo "Void: sudo xbps-install -Sy ruby file"
exit 1
fi
# 2⃣ Ask installation path
echo "Install locally (~/.local/bin) or globally (/usr/bin)? [l/g]"
read -r choice
case "$choice" in
l | L) INSTALL_DIR="$HOME/.local/bin" ;;
g | G) INSTALL_DIR="/usr/bin" ;;
*)
echo "Install or update locally (~/.local/bin) or globally (/usr/bin)? [l/g]"
read -r choice </dev/tty
case "$choice" in
l | L)
INSTALL_DIR="$HOME/.local/bin"
SUDO=""
;;
g | G)
INSTALL_DIR="/usr/bin"
SUDO="sudo"
;;
*)
echo "Invalid choice"
exit 1
;;
esac
esac
mkdir -p "$INSTALL_DIR"
$SUDO mkdir -p "$INSTALL_DIR"
# 3Download the binary
echo "Downloading binary..."
curl -L "$GITHUB_URL" -o "$INSTALL_DIR/$BINARY_NAME"
chmod +x "$INSTALL_DIR/$BINARY_NAME"
echo "Downloading binary..."
curl -L "$BIN_URL" -o /tmp/"$BINARY_NAME"
$SUDO install -m 755 /tmp/"$BINARY_NAME" "$INSTALL_DIR/$BINARY_NAME"
rm -f /tmp/"$BINARY_NAME"
# 4⃣ Optional: confirm
echo "$BINARY_NAME installed to $INSTALL_DIR"
echo "You can run it with: $BINARY_NAME"
echo "Remember to add $INSTALL_DIR to PATH if not already."
echo
echo "✔ Crib installed to $INSTALL_DIR"
echo "Run with: $BINARY_NAME"
echo "Add $INSTALL_DIR to PATH if needed."
}
install "$@"

1
libs/utfcpp vendored

Submodule libs/utfcpp deleted from cfc9112cee

View File

@@ -89,6 +89,7 @@ BASH
puts multi
# Arrays mixing everything
mixed = [
'🐍 Ruby + Python? sacrilege! 🐍',

View File

@@ -25,6 +25,23 @@ inline static std::string completion_prefix(Editor *editor) {
return prefix;
}
inline static void completion_adjust_scroll(CompletionSession &s) {
if (s.visible.empty())
return;
int vi = -1;
for (size_t i = 0; i < s.visible.size(); i++)
if (s.visible[i] == s.select) {
vi = (int)i;
break;
}
if (vi < 0)
return;
if ((uint32_t)vi < s.scroll)
s.scroll = vi;
else if ((uint32_t)vi >= s.scroll + 8)
s.scroll = vi - 7;
}
void completion_filter(Editor *editor) {
auto &session = editor->completion;
std::string prefix = completion_prefix(editor);
@@ -44,6 +61,8 @@ void completion_filter(Editor *editor) {
session.select) == session.visible.end())
session.select = session.visible[0];
session.box.hidden = false;
session.scroll = 0;
completion_adjust_scroll(session);
session.box.render_update();
}
@@ -417,6 +436,7 @@ void complete_next(Editor *editor) {
vi = (vi + 1) % s.visible.size();
s.select = s.visible[vi];
completion_resolve_doc(editor);
completion_adjust_scroll(editor->completion);
editor->completion.box.render_update();
}
@@ -431,6 +451,7 @@ void complete_prev(Editor *editor) {
vi = (vi + s.visible.size() - 1) % s.visible.size();
s.select = s.visible[vi];
completion_resolve_doc(editor);
completion_adjust_scroll(editor->completion);
editor->completion.box.render_update();
}

View File

@@ -1,6 +1,7 @@
#include "editor/editor.h"
#include "editor/decl.h"
#include "lsp/lsp.h"
#include "main.h"
#include "syntax/langs.h"
#include "utils/utils.h"
@@ -77,6 +78,8 @@ void save_file(Editor *editor) {
}
out.close();
free(str);
bar.log("Written " + std::to_string(char_count) + " bytes to " +
editor->filename);
if (editor->lsp) {
json save_msg = {{"jsonrpc", "2.0"},
{"method", "textDocument/didSave"},

View File

@@ -232,6 +232,4 @@ void handle_editor_event(Editor *editor, KeyEvent event) {
if (old_mode == mode || mode != INSERT)
handle_completion(editor, event);
ensure_scroll(editor);
if ((event.key_type == KEY_CHAR || event.key_type == KEY_PASTE) && event.c)
free(event.c);
}

View File

@@ -218,8 +218,8 @@ void IndentationEngine::insert_new_line(Coord cursor) {
if (is_end_full != kLangtoBlockEndsFull.end())
for (auto end : is_end_full->second)
if (end == trim(line)) {
cursor.col =
set_indent(cursor.row, (int64_t)indent_expected(cursor.row) - 1);
cursor.col = set_indent(
cursor.row, (int64_t)indent_expected(cursor.row) - (int64_t)1);
end_matched = true;
break;
}
@@ -286,7 +286,7 @@ void IndentationEngine::insert_new_line(Coord cursor) {
(indent == 1 ? std::string(c_indent, '\t')
: std::string(c_indent * indent, ' ')) +
ending;
else if (ending_valid)
else if (ending_valid && c_indent)
c_indent--;
}
auto is_end_set = kLangtoBlockStartsEnd.find(editor->lang.name);

View File

@@ -11,7 +11,7 @@ void render_editor(Editor *editor) {
uint32_t numlen =
EXTRA_META + static_cast<int>(std::log10(editor->root->line_count + 1));
uint32_t render_width = editor->size.col - numlen;
uint32_t render_x = editor->position.col + numlen;
uint32_t render_x = editor->position.col + numlen + 1;
std::vector<std::pair<uint32_t, char>> v;
for (size_t i = 0; i < 94; ++i)
if (editor->hooks[i] != 0)
@@ -146,16 +146,14 @@ void render_editor(Editor *editor) {
update(editor->position.row + rendered_rows, editor->position.col, hook,
0xAAAAAA, 0, 0);
char buf[16];
int len =
snprintf(buf, sizeof(buf), "%*u ", numlen - 3, line_index + 1);
int len = snprintf(buf, sizeof(buf), "%*u ", numlen, line_index + 1);
uint32_t num_color =
editor->cursor.row == line_index ? 0xFFFFFF : 0x555555;
for (int i = 0; i < len; i++)
update(editor->position.row + rendered_rows,
editor->position.col + i + 2, (char[2]){buf[i], 0}, num_color,
0, 0);
update(editor->position.row + rendered_rows, editor->position.col + i,
(char[2]){buf[i], 0}, num_color, 0, 0);
} else {
for (uint32_t i = 0; i < numlen; i++)
for (uint32_t i = 0; i < numlen + 1; i++)
update(editor->position.row + rendered_rows, editor->position.col + i,
" ", 0, 0, 0);
}
@@ -349,13 +347,12 @@ void render_editor(Editor *editor) {
update(editor->position.row + rendered_rows, editor->position.col, hook,
0xAAAAAA, 0, 0);
char buf[16];
int len = snprintf(buf, sizeof(buf), "%*u ", numlen - 3, line_index + 1);
int len = snprintf(buf, sizeof(buf), "%*u ", numlen, line_index + 1);
uint32_t num_color =
editor->cursor.row == line_index ? 0xFFFFFF : 0x555555;
for (int i = 0; i < len; i++)
update(editor->position.row + rendered_rows,
editor->position.col + i + 2, (char[2]){buf[i], 0}, num_color, 0,
0);
update(editor->position.row + rendered_rows, editor->position.col + i,
(char[2]){buf[i], 0}, num_color, 0, 0);
if (editor->cursor.row == line_index) {
cursor.row = editor->position.row + rendered_rows;
cursor.col = render_x;

View File

@@ -1,4 +1,5 @@
#include "lsp/lsp.h"
#include "main.h"
Queue<LSPOpenRequest> lsp_open_queue;

View File

@@ -155,40 +155,78 @@ std::shared_ptr<LSPInstance> get_or_init_lsp(std::string lsp_id) {
}
void close_lsp(std::string lsp_id) {
std::shared_lock active_lsps_lock(active_lsps_mtx);
std::shared_ptr<LSPInstance> lsp;
{
std::shared_lock lock(active_lsps_mtx);
auto it = active_lsps.find(lsp_id);
if (it == active_lsps.end())
return;
std::shared_ptr<LSPInstance> lsp = it->second;
active_lsps_lock.unlock();
lsp = it->second;
}
if (!lsp || lsp->pid == -1 || lsp->exited)
return;
lsp->exited = true;
lsp->initialized = false;
LSPPending *shutdown_pending = new LSPPending();
shutdown_pending->method = "shutdown";
shutdown_pending->callback = [lsp](Editor *, std::string, json) {
json exit = {{"jsonrpc", "2.0"}, {"method", "exit"}};
lsp_send(lsp, exit, nullptr);
auto send_raw = [&](const json &msg) {
std::string payload = msg.dump();
std::string header =
"Content-Length: " + std::to_string(payload.size()) + "\r\n\r\n";
std::string out = header + payload;
const char *ptr = out.data();
size_t remaining = out.size();
while (remaining > 0) {
ssize_t n = write(lsp->stdin_fd, ptr, remaining);
if (n <= 0) {
if (errno == EINTR)
continue;
break;
}
ptr += n;
remaining -= n;
}
};
json shutdown = {{"jsonrpc", "2.0"}, {"method", "shutdown"}};
lsp_send(lsp, shutdown, shutdown_pending);
std::thread t([lsp, lsp_id] {
std::this_thread::sleep_for(100ms);
std::unique_lock active_lsps_lock(active_lsps_mtx);
std::unique_lock lock(lsp->mtx);
if (lsp->pid != -1 && kill(lsp->pid, 0) == 0)
json shutdown = {{"jsonrpc", "2.0"}, {"id", 1}, {"method", "shutdown"}};
send_raw(shutdown);
{
pollfd pfd{lsp->stdout_fd, POLLIN, 0};
int timeout_ms = 300;
if (poll(&pfd, 1, timeout_ms) > 0) {
auto msg = read_lsp_message(lsp->stdout_fd);
(void)msg;
}
}
json exit_msg = {{"jsonrpc", "2.0"}, {"method", "exit"}};
send_raw(exit_msg);
const int max_wait_ms = 500;
int waited = 0;
while (waited < max_wait_ms) {
int status;
pid_t res = waitpid(lsp->pid, &status, WNOHANG);
if (res == lsp->pid)
break;
std::this_thread::sleep_for(std::chrono::milliseconds(10));
waited += 10;
}
if (kill(lsp->pid, 0) == 0) {
kill(lsp->pid, SIGKILL);
waitpid(lsp->pid, nullptr, 0);
}
close(lsp->stdin_fd);
close(lsp->stdout_fd);
{
std::unique_lock lock(lsp->mtx);
for (auto &kv : lsp->pending)
delete kv.second;
lsp->pending.clear();
}
for (auto &editor : lsp->editors) {
std::unique_lock editor_lock(editor->lsp_mtx);
editor->lsp = nullptr;
}
{
std::unique_lock lock(active_lsps_mtx);
active_lsps.erase(lsp_id);
});
t.detach();
}
}
void clean_lsp(std::shared_ptr<LSPInstance> lsp, std::string lsp_id) {

View File

@@ -16,7 +16,7 @@ void lsp_send(std::shared_ptr<LSPInstance> lsp, json message,
lsp->outbox.push(message);
}
static std::optional<json> read_lsp_message(int fd) {
std::optional<json> read_lsp_message(int fd) {
std::string header;
char c;
while (true) {

View File

@@ -9,6 +9,7 @@
std::atomic<bool> running{true};
Queue<KeyEvent> event_queue;
std::vector<Editor *> editors;
Bar bar;
uint8_t current_editor = 0;
std::atomic<uint8_t> mode = NORMAL;
@@ -36,7 +37,7 @@ inline uint8_t index_of(Editor *ed) {
return 0;
}
void input_listener(Bar bar) {
void input_listener() {
while (running) {
KeyEvent event = throttle(1ms, read_key);
if (event.key_type == KEY_NONE)
@@ -53,7 +54,6 @@ void input_listener(Bar bar) {
if (target) {
if (event.mouse_state == PRESS)
current_editor = index_of(target);
event.mouse_x -= target->position.col;
event.mouse_y -= target->position.row;
handle_editor_event(target, event);
@@ -64,18 +64,16 @@ void input_listener(Bar bar) {
} else {
bar.handle(event);
}
if ((event.key_type == KEY_CHAR || event.key_type == KEY_PASTE) && event.c)
free(event.c);
render:
render_editor(editors[current_editor]);
bar.render();
render_editor(editors[current_editor]);
throttle(4ms, render);
}
}
int main(int argc, char *argv[]) {
auto start = std::chrono::high_resolution_clock::now();
ruby_init();
ruby_start();
load_theme();
load_languages_info();
@@ -83,18 +81,10 @@ int main(int argc, char *argv[]) {
Coord screen = start_screen();
const char *filename = (argc > 1) ? argv[1] : "";
uint8_t eol = read_line_endings();
Editor *editor =
new_editor(filename, {0, 0}, {screen.row - 2, screen.col}, eol);
Bar bar(screen);
auto end = std::chrono::high_resolution_clock::now();
auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(end - start)
.count();
ruby_log("[LOG] STARTUP_TIME: " + std::to_string(static_cast<long long>(ms)) +
"ms");
bar.init(screen);
if (!editor) {
end_screen();
@@ -105,11 +95,13 @@ int main(int argc, char *argv[]) {
editors.push_back(editor);
current_editor = editors.size() - 1;
std::thread input_thread(input_listener, bar);
std::thread input_thread(input_listener);
std::thread lsp_thread(background_lsp);
while (running)
while (running) {
throttle(16ms, editor_worker, editors[current_editor]);
bar.work();
}
if (input_thread.joinable())
input_thread.join();
@@ -119,22 +111,10 @@ int main(int argc, char *argv[]) {
end_screen();
ruby_shutdown();
for (auto editor : editors)
free_editor(editor);
std::unique_lock lk(active_lsps_mtx);
lk.unlock();
while (true) {
lk.lock();
if (active_lsps.empty())
break;
lk.unlock();
throttle(16ms, lsp_worker);
}
ruby_shutdown();
rb_gc_start();
return ruby_cleanup(0);
return 0;
}

38
src/ruby_compile.sh Executable file
View File

@@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -e
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
INPUT="$SCRIPT_DIR/../include/syntax/tokens.def"
TMP="/tmp/__crib_precompiled.rb"
OUTPUT="/tmp/__crib_precompiled.mrb"
echo "module Tokens" >"$TMP"
counter=0
while read -r line; do
if [[ $line =~ ADD\(([^\)]+)\) ]]; then
name="${BASH_REMATCH[1]}"
echo " $name = $counter" >>"$TMP"
counter=$((counter + 1))
fi
done <"$INPUT"
{
echo " freeze"
echo "end"
echo
cat "$SCRIPT_DIR/../include/scripting/libcrib.rb"
} >>"$TMP"
mrbc -o$OUTPUT $TMP
{
echo "#pragma once"
xxd -i $OUTPUT | sed 's/^unsigned char /constexpr unsigned char /' |
sed 's/^unsigned int /constexpr unsigned int /'
} >"$SCRIPT_DIR/../include/scripting/ruby_compiled.h"
rm $TMP
rm $OUTPUT

View File

@@ -0,0 +1,10 @@
#include "main.h"
#include "scripting/decl.h"
mrb_value get_mode(mrb_state *mrb, mrb_value self) {
return mrb_fixnum_value(mode);
}
void setup_ruby_bindings(mrb_state *mrb, RClass *C_module) {
mrb_define_module_function(mrb, C_module, "mode", get_mode, MRB_ARGS_NONE());
}

View File

@@ -1,7 +1,11 @@
#include "main.h"
#include "scripting/decl.h"
#include "scripting/ruby_compiled.h"
#include "utils/utils.h"
#include <mruby/boxing_word.h>
std::unordered_map<std::string, std::pair<VALUE, VALUE>> custom_highlighters;
std::unordered_map<std::string, std::pair<mrb_value, mrb_value>>
custom_highlighters;
struct R_ThemeEntry {
std::string key;
@@ -16,41 +20,22 @@ struct R_ThemeEntry {
struct R_Language {
std::string name;
uint32_t color = 0xFFFFFF;
std::string symbol;
std::vector<std::string> extensions;
std::vector<std::string> filenames;
std::vector<std::string> mimetypes;
std::string lsp_command; // link to LSP by name
};
VALUE C_module = Qnil;
std::mutex ruby_mutex;
mrb_state *mrb = nullptr;
RClass *C_module;
namespace fs = std::filesystem;
static void ruby_load(const char *main_file) {
std::lock_guard lock(ruby_mutex);
ruby_init_loadpath();
int state = 0;
rb_load_protect(rb_str_new_cstr(main_file), 0, &state);
if (state) {
VALUE err = rb_errinfo();
rb_set_errinfo(Qnil);
fprintf(stderr, "%d: Failed to load Ruby file %s\n", state, main_file);
}
}
static void ruby_eval_string(const char *code) {
int state = 0;
rb_eval_string_protect(code, &state);
if (state) {
VALUE err = rb_errinfo();
rb_set_errinfo(Qnil);
fprintf(stderr, "Ruby eval failed\n");
}
}
void ruby_start() {
mrb = mrb_open();
if (!mrb) {
fprintf(stderr, "Failed to init mruby\n");
return;
}
fs::path exe_dir = get_exe_dir();
std::vector<fs::path> candidates;
candidates.emplace_back("./crib.rb");
@@ -68,138 +53,249 @@ void ruby_start() {
}
candidates.emplace_back(exe_dir / "../config/main.rb");
candidates.emplace_back(exe_dir / "../config/crib.rb");
ruby_eval_string(crib_module);
ruby_eval_string(tokens_def);
mrb_load_irep(mrb, _tmp___crib_precompiled_mrb);
C_module = mrb_module_get(mrb, "C");
setup_ruby_bindings(mrb, C_module);
for (const auto &p : candidates) {
if (fs::exists(p) && fs::is_regular_file(p)) {
ruby_load(p.string().c_str());
if (fs::exists(p)) {
FILE *f = fopen(p.string().c_str(), "r");
if (f) {
mrb_load_file(mrb, f);
if (mrb->exc)
exit(1);
fclose(f);
}
break;
}
}
C_module = rb_const_get(rb_cObject, rb_intern("C"));
if (C_module == Qnil)
return;
VALUE block = rb_funcall(C_module, rb_intern("b_startup"), 0);
if (block != Qnil)
rb_funcall(block, rb_intern("call"), 0);
mrb_value mod_val = mrb_obj_value(C_module);
mrb_value block = mrb_funcall(mrb, mod_val, "b_startup", 0);
if (!mrb_nil_p(block))
mrb_funcall(mrb, block, "call", 0);
}
void ruby_shutdown() {
std::lock_guard lock(ruby_mutex);
if (C_module == Qnil)
return;
VALUE block = rb_funcall(C_module, rb_intern("b_shutdown"), 0);
if (block != Qnil)
rb_funcall(block, rb_intern("call"), 0);
}
inline std::vector<std::string> ruby_array_to_vector(VALUE rb_array) {
std::vector<std::string> result;
if (NIL_P(rb_array) || !RB_TYPE_P(rb_array, T_ARRAY))
inline static std::vector<BarLight>
convert_highlights(mrb_state *mrb, mrb_value highlights_val) {
std::vector<BarLight> result;
if (!mrb_array_p(highlights_val))
return result;
for (long i = 0; i < RARRAY_LEN(rb_array); ++i) {
VALUE item = rb_ary_entry(rb_array, i);
if (RB_TYPE_P(item, T_STRING))
result.push_back(StringValueCStr(item));
mrb_int len = RARRAY_LEN(highlights_val);
for (mrb_int i = 0; i < len; i++) {
mrb_value item = mrb_ary_ref(mrb, highlights_val, i);
if (!mrb_hash_p(item))
continue;
auto get_sym = [&](const char *name) {
return mrb_symbol_value(mrb_intern_cstr(mrb, name));
};
mrb_value fg_v = mrb_hash_get(mrb, item, get_sym("fg"));
mrb_value bg_v = mrb_hash_get(mrb, item, get_sym("bg"));
mrb_value flags_v = mrb_hash_get(mrb, item, get_sym("flags"));
mrb_value start_v = mrb_hash_get(mrb, item, get_sym("start"));
mrb_value length_v = mrb_hash_get(mrb, item, get_sym("length"));
BarLight bl{};
if (!mrb_nil_p(fg_v))
bl.highlight.fg = (uint32_t)mrb_fixnum(fg_v);
if (!mrb_nil_p(bg_v))
bl.highlight.bg = (uint32_t)mrb_fixnum(bg_v);
if (!mrb_nil_p(flags_v))
bl.highlight.flags = (uint32_t)mrb_fixnum(flags_v);
uint32_t start = !mrb_nil_p(start_v) ? (uint32_t)mrb_fixnum(start_v) : 0;
uint32_t length = !mrb_nil_p(length_v) ? (uint32_t)mrb_fixnum(length_v) : 0;
bl.start = start;
bl.end = start + length;
result.push_back(bl);
}
return result;
}
void ruby_log(std::string msg) {
std::lock_guard lock(ruby_mutex);
VALUE str = rb_str_new(msg.c_str(), msg.size());
rb_funcall(C_module, rb_intern("queue_log"), 1, str);
BarLine bar_contents(uint8_t mode, std::string lang_name, uint32_t warnings,
std::string lsp_name, std::string filename,
std::string foldername, uint32_t line, uint32_t max_line,
uint32_t width) {
BarLine bar_line;
mrb_value info = mrb_hash_new(mrb);
mrb_value key_mode = mrb_symbol_value(mrb_intern_cstr(mrb, "mode"));
mrb_value val_mode;
switch (mode) {
case NORMAL:
val_mode = mrb_symbol_value(mrb_intern_cstr(mrb, "normal"));
break;
case INSERT:
val_mode = mrb_symbol_value(mrb_intern_cstr(mrb, "insert"));
break;
case SELECT:
val_mode = mrb_symbol_value(mrb_intern_cstr(mrb, "select"));
break;
case RUNNER:
val_mode = mrb_symbol_value(mrb_intern_cstr(mrb, "runner"));
break;
case JUMPER:
val_mode = mrb_symbol_value(mrb_intern_cstr(mrb, "jumper"));
break;
}
mrb_hash_set(mrb, info, key_mode, val_mode);
mrb_value key_lang_name = mrb_symbol_value(mrb_intern_cstr(mrb, "lang_name"));
mrb_value val_lang_name =
mrb_symbol_value(mrb_intern_cstr(mrb, lang_name.c_str()));
mrb_hash_set(mrb, info, key_lang_name, val_lang_name);
mrb_value key_filename = mrb_symbol_value(mrb_intern_cstr(mrb, "filename"));
mrb_value val_filename =
mrb_str_new(mrb, filename.c_str(), filename.length());
mrb_hash_set(mrb, info, key_filename, val_filename);
mrb_value key_width = mrb_symbol_value(mrb_intern_cstr(mrb, "width"));
mrb_value val_width = mrb_fixnum_value(width);
mrb_hash_set(mrb, info, key_width, val_width);
mrb_value mod_val = mrb_obj_value(C_module);
mrb_value block = mrb_funcall(mrb, mod_val, "b_bar", 0);
mrb_value val_line = mrb_funcall(mrb, block, "call", 1, info);
if (mrb->exc)
exit(1);
mrb_value text_val = mrb_hash_get(
mrb, val_line, mrb_symbol_value(mrb_intern_cstr(mrb, "text")));
const char *ptr = RSTRING_PTR(text_val);
mrb_int len = RSTRING_LEN(text_val);
bar_line.line = std::string(ptr, len);
mrb_value highlights_val = mrb_hash_get(
mrb, val_line, mrb_symbol_value(mrb_intern_cstr(mrb, "highlights")));
bar_line.highlights = convert_highlights(mrb, highlights_val);
return bar_line;
}
void ruby_shutdown() {
if (C_module == nullptr)
return;
mrb_value mod_val = mrb_obj_value(C_module);
mrb_value block = mrb_funcall(mrb, mod_val, "b_shutdown", 0);
if (!mrb_nil_p(block))
mrb_funcall(mrb, block, "call", 0);
mrb_close(mrb);
mrb = nullptr;
C_module = nullptr;
}
std::vector<std::string> array_to_vector(mrb_value ary) {
std::vector<std::string> result;
if (mrb_nil_p(ary) || mrb_type(ary) != MRB_TT_ARRAY)
return result;
mrb_int len = RARRAY_LEN(ary);
for (mrb_int i = 0; i < len; i++) {
mrb_value item = mrb_ary_ref(mrb, ary, i);
if (mrb_string_p(item))
result.push_back(std::string(RSTRING_PTR(item), RSTRING_LEN(item)));
}
return result;
}
void load_custom_highlighters() {
std::lock_guard lock(ruby_mutex);
if (C_module == Qnil)
if (!C_module)
return;
VALUE hashmap = rb_funcall(C_module, rb_intern("highlighters"), 0);
if (NIL_P(hashmap))
mrb_value mod_val = mrb_obj_value((struct RObject *)C_module);
mrb_value hashmap = mrb_funcall(mrb, mod_val, "highlighters", 0);
if (mrb_nil_p(hashmap) || mrb_type(hashmap) != MRB_TT_HASH)
return;
VALUE keys = rb_funcall(hashmap, rb_intern("keys"), 0);
for (long i = 0; i < RARRAY_LEN(keys); ++i) {
VALUE key_sym = rb_ary_entry(keys, i);
std::string key = rb_id2name(SYM2ID(key_sym));
VALUE val_hash = rb_hash_aref(hashmap, key_sym);
if (NIL_P(val_hash))
mrb_value keys = mrb_funcall(mrb, hashmap, "keys", 0);
mrb_int len = RARRAY_LEN(keys);
for (mrb_int i = 0; i < len; i++) {
mrb_value key_sym = mrb_ary_ref(mrb, keys, i);
mrb_sym sym_id = mrb_symbol(key_sym);
const char *key_cstr = mrb_sym_dump(mrb, sym_id);
std::string key(key_cstr);
mrb_value val_hash = mrb_hash_get(mrb, hashmap, key_sym);
if (mrb_nil_p(val_hash) || mrb_type(val_hash) != MRB_TT_HASH)
continue;
VALUE parse_block = rb_hash_aref(val_hash, ID2SYM(rb_intern("parser")));
VALUE match_block = rb_hash_aref(val_hash, ID2SYM(rb_intern("matcher")));
rb_gc_register_address(&match_block);
rb_gc_register_address(&parse_block);
mrb_sym parser_sym = mrb_intern_lit(mrb, "parser");
mrb_sym matcher_sym = mrb_intern_lit(mrb, "matcher");
mrb_value parse_block =
mrb_hash_get(mrb, val_hash, mrb_symbol_value(parser_sym));
mrb_value match_block =
mrb_hash_get(mrb, val_hash, mrb_symbol_value(matcher_sym));
custom_highlighters[key] = {parse_block, match_block};
}
}
bool custom_compare(VALUE match_block, VALUE state1, VALUE state2) {
std::lock_guard lock(ruby_mutex);
return RTEST(rb_funcall(match_block, rb_intern("call"), 2, state1, state2));
bool custom_compare(mrb_value match_block, mrb_value state1, mrb_value state2) {
if (mrb_type(match_block) != MRB_TT_PROC)
return false;
mrb_value ret = mrb_funcall(mrb, match_block, "call", 2, state1, state2);
return mrb_test(ret);
}
VALUE parse_custom(std::vector<Token> *tokens, VALUE parser_block,
const char *line, uint32_t len, VALUE state,
mrb_value parse_custom(std::vector<Token> *tokens, mrb_value parser_block,
const char *line, uint32_t len, mrb_value state,
uint32_t c_line) {
std::lock_guard lock(ruby_mutex);
tokens->clear();
if (NIL_P(parser_block))
return {};
VALUE ruby_line = rb_str_new(line, len);
VALUE line_idx = UINT2NUM(c_line);
VALUE tokens_and_state_hash = rb_funcall(parser_block, rb_intern("call"), 3,
ruby_line, state, line_idx);
VALUE tokens_rb =
rb_hash_aref(tokens_and_state_hash, ID2SYM(rb_intern("tokens")));
for (long i = 0; i < RARRAY_LEN(tokens_rb); ++i) {
VALUE token = rb_ary_entry(tokens_rb, i);
if (mrb_nil_p(parser_block))
return mrb_nil_value();
mrb_value ruby_line = mrb_str_new(mrb, line, len);
mrb_value line_idx = mrb_fixnum_value(c_line);
mrb_value tokens_and_state_hash =
mrb_funcall(mrb, parser_block, "call", 3, ruby_line, state, line_idx);
mrb_sym tokens_sym = mrb_intern_lit(mrb, "tokens");
mrb_value tokens_rb =
mrb_hash_get(mrb, tokens_and_state_hash, mrb_symbol_value(tokens_sym));
if (mrb_type(tokens_rb) == MRB_TT_ARRAY) {
mrb_int len_tokens = RARRAY_LEN(tokens_rb);
for (mrb_int i = 0; i < len_tokens; i++) {
mrb_value token = mrb_ary_ref(mrb, tokens_rb, i);
Token tok;
tok.type =
(TokenKind)NUM2INT(rb_hash_aref(token, ID2SYM(rb_intern("type"))));
tok.start = NUM2UINT(rb_hash_aref(token, ID2SYM(rb_intern("start"))));
tok.end = NUM2UINT(rb_hash_aref(token, ID2SYM(rb_intern("end"))));
tok.type = (TokenKind)mrb_fixnum(mrb_hash_get(
mrb, token, mrb_symbol_value(mrb_intern_lit(mrb, "type"))));
tok.start = (uint32_t)mrb_fixnum(mrb_hash_get(
mrb, token, mrb_symbol_value(mrb_intern_lit(mrb, "start"))));
tok.end = (uint32_t)mrb_fixnum(mrb_hash_get(
mrb, token, mrb_symbol_value(mrb_intern_lit(mrb, "end"))));
if (tok.type < TokenKind::Count && tok.end > tok.start && tok.end <= len)
tokens->push_back(tok);
}
return rb_hash_aref(tokens_and_state_hash, ID2SYM(rb_intern("state")));
}
mrb_sym state_sym = mrb_intern_lit(mrb, "state");
return mrb_hash_get(mrb, tokens_and_state_hash, mrb_symbol_value(state_sym));
}
static std::vector<R_ThemeEntry> read_theme() {
std::lock_guard lock(ruby_mutex);
std::vector<R_ThemeEntry> result;
if (C_module == Qnil)
if (!C_module)
return result;
VALUE theme_hash = rb_funcall(C_module, rb_intern("theme"), 0);
if (NIL_P(theme_hash))
mrb_value mod_val = mrb_obj_value((struct RObject *)C_module);
mrb_value theme_hash = mrb_funcall(mrb, mod_val, "theme", 0);
if (mrb_nil_p(theme_hash) || mrb_type(theme_hash) != MRB_TT_HASH)
return result;
VALUE keys = rb_funcall(theme_hash, rb_intern("keys"), 0);
for (long i = 0; i < RARRAY_LEN(keys); ++i) {
VALUE key_sym = rb_ary_entry(keys, i);
std::string key = rb_id2name(SYM2ID(key_sym));
VALUE val_hash = rb_hash_aref(theme_hash, key_sym);
if (NIL_P(val_hash))
mrb_value keys = mrb_funcall(mrb, theme_hash, "keys", 0);
mrb_int len_keys = RARRAY_LEN(keys);
for (mrb_int i = 0; i < len_keys; i++) {
mrb_value key_sym = mrb_ary_ref(mrb, keys, i);
mrb_sym sym_id = mrb_symbol(key_sym);
const char *key_cstr = mrb_sym_dump(mrb, sym_id);
std::string key(key_cstr);
mrb_value val_hash = mrb_hash_get(mrb, theme_hash, key_sym);
if (mrb_nil_p(val_hash) || mrb_type(val_hash) != MRB_TT_HASH)
continue;
R_ThemeEntry entry;
entry.key = key;
VALUE fg = rb_hash_aref(val_hash, ID2SYM(rb_intern("fg")));
VALUE bg = rb_hash_aref(val_hash, ID2SYM(rb_intern("bg")));
VALUE italic = rb_hash_aref(val_hash, ID2SYM(rb_intern("italic")));
VALUE bold = rb_hash_aref(val_hash, ID2SYM(rb_intern("bold")));
VALUE underline = rb_hash_aref(val_hash, ID2SYM(rb_intern("underline")));
VALUE strikethrough =
rb_hash_aref(val_hash, ID2SYM(rb_intern("strikethrough")));
if (!NIL_P(fg))
entry.fg = NUM2UINT(fg);
if (!NIL_P(bg))
entry.bg = NUM2UINT(bg);
if (!NIL_P(italic))
entry.italic = RTEST(italic);
if (!NIL_P(bold))
entry.bold = RTEST(bold);
if (!NIL_P(underline))
entry.underline = RTEST(underline);
if (!NIL_P(strikethrough))
entry.strikethrough = RTEST(strikethrough);
mrb_value fg = mrb_hash_get(mrb, val_hash,
mrb_symbol_value(mrb_intern_lit(mrb, "fg")));
mrb_value bg = mrb_hash_get(mrb, val_hash,
mrb_symbol_value(mrb_intern_lit(mrb, "bg")));
mrb_value italic = mrb_hash_get(
mrb, val_hash, mrb_symbol_value(mrb_intern_lit(mrb, "italic")));
mrb_value bold = mrb_hash_get(
mrb, val_hash, mrb_symbol_value(mrb_intern_lit(mrb, "bold")));
mrb_value underline = mrb_hash_get(
mrb, val_hash, mrb_symbol_value(mrb_intern_lit(mrb, "underline")));
mrb_value strikethrough = mrb_hash_get(
mrb, val_hash, mrb_symbol_value(mrb_intern_lit(mrb, "strikethrough")));
if (!mrb_nil_p(fg))
entry.fg = (uint32_t)mrb_fixnum(fg);
if (!mrb_nil_p(bg))
entry.bg = (uint32_t)mrb_fixnum(bg);
if (!mrb_nil_p(italic))
entry.italic = mrb_test(italic);
if (!mrb_nil_p(bold))
entry.bold = mrb_test(bold);
if (!mrb_nil_p(underline))
entry.underline = mrb_test(underline);
if (!mrb_nil_p(strikethrough))
entry.strikethrough = mrb_test(strikethrough);
result.push_back(entry);
}
return result;
@@ -251,17 +347,23 @@ void load_theme() {
std::vector<LSP> read_lsps() {
std::vector<LSP> result;
if (C_module == Qnil)
if (!C_module)
return result;
VALUE lsp_hash = rb_funcall(C_module, rb_intern("lsp_config"), 0);
if (NIL_P(lsp_hash))
mrb_value mod_val = mrb_obj_value((struct RObject *)C_module);
mrb_value lsp_hash = mrb_funcall(mrb, mod_val, "lsp_config", 0);
if (mrb_nil_p(lsp_hash) || mrb_type(lsp_hash) != MRB_TT_HASH)
return result;
VALUE keys = rb_funcall(lsp_hash, rb_intern("keys"), 0);
for (long i = 0; i < RARRAY_LEN(keys); ++i) {
VALUE key = rb_ary_entry(keys, i);
std::string cmd = StringValueCStr(key);
VALUE args_array = rb_hash_aref(lsp_hash, key);
std::vector<std::string> args = ruby_array_to_vector(args_array);
mrb_value keys = mrb_funcall(mrb, lsp_hash, "keys", 0);
mrb_int len_keys = RARRAY_LEN(keys);
for (mrb_int i = 0; i < len_keys; i++) {
mrb_value key = mrb_ary_ref(mrb, keys, i);
std::string cmd;
if (mrb_string_p(key))
cmd = std::string(RSTRING_PTR(key), RSTRING_LEN(key));
else if (mrb_symbol_p(key))
cmd = std::string(mrb_sym_dump(mrb, mrb_symbol(key)));
mrb_value args_array = mrb_hash_get(mrb, lsp_hash, key);
std::vector<std::string> args = array_to_vector(args_array);
result.push_back({cmd, args});
}
return result;
@@ -269,41 +371,45 @@ std::vector<LSP> read_lsps() {
std::vector<R_Language> read_languages() {
std::vector<R_Language> result;
if (C_module == Qnil)
if (!C_module)
return result;
VALUE lang_hash = rb_funcall(C_module, rb_intern("languages"), 0);
if (NIL_P(lang_hash))
mrb_value mod_val = mrb_obj_value((struct RObject *)C_module);
mrb_value lang_hash = mrb_funcall(mrb, mod_val, "languages", 0);
if (mrb_nil_p(lang_hash) || mrb_type(lang_hash) != MRB_TT_HASH)
return result;
VALUE keys = rb_funcall(lang_hash, rb_intern("keys"), 0);
for (long i = 0; i < RARRAY_LEN(keys); ++i) {
VALUE key = rb_ary_entry(keys, i);
VALUE val_hash = rb_hash_aref(lang_hash, key);
if (NIL_P(val_hash))
mrb_value keys = mrb_funcall(mrb, lang_hash, "keys", 0);
mrb_int len_keys = RARRAY_LEN(keys);
for (mrb_int i = 0; i < len_keys; i++) {
mrb_value key = mrb_ary_ref(mrb, keys, i);
mrb_value val_hash = mrb_hash_get(mrb, lang_hash, key);
if (mrb_nil_p(val_hash) || mrb_type(val_hash) != MRB_TT_HASH)
continue;
R_Language lang;
lang.name = rb_id2name(SYM2ID(key));
VALUE fg = rb_hash_aref(val_hash, ID2SYM(rb_intern("color")));
VALUE symbol = rb_hash_aref(val_hash, ID2SYM(rb_intern("symbol")));
VALUE extensions = rb_hash_aref(val_hash, ID2SYM(rb_intern("extensions")));
VALUE filenames = rb_hash_aref(val_hash, ID2SYM(rb_intern("filenames")));
VALUE mimetypes = rb_hash_aref(val_hash, ID2SYM(rb_intern("mimetypes")));
VALUE lsp = rb_hash_aref(val_hash, ID2SYM(rb_intern("lsp")));
if (!NIL_P(fg))
lang.color = NUM2UINT(fg);
if (!NIL_P(symbol))
lang.symbol = StringValueCStr(symbol);
lang.extensions = ruby_array_to_vector(extensions);
lang.filenames = ruby_array_to_vector(filenames);
lang.mimetypes = ruby_array_to_vector(mimetypes);
if (!NIL_P(lsp))
lang.lsp_command = StringValueCStr(lsp);
if (mrb_symbol_p(key))
lang.name = std::string(mrb_sym_dump(mrb, mrb_symbol(key)));
else if (mrb_string_p(key))
lang.name = std::string(RSTRING_PTR(key), RSTRING_LEN(key));
mrb_value fg = mrb_hash_get(mrb, val_hash,
mrb_symbol_value(mrb_intern_lit(mrb, "color")));
mrb_value extensions = mrb_hash_get(
mrb, val_hash, mrb_symbol_value(mrb_intern_lit(mrb, "extensions")));
mrb_value filenames = mrb_hash_get(
mrb, val_hash, mrb_symbol_value(mrb_intern_lit(mrb, "filenames")));
mrb_value lsp = mrb_hash_get(mrb, val_hash,
mrb_symbol_value(mrb_intern_lit(mrb, "lsp")));
if (!mrb_nil_p(fg))
lang.color = (uint32_t)mrb_fixnum(fg);
lang.extensions = array_to_vector(extensions);
if (!mrb_nil_p(filenames))
lang.filenames = array_to_vector(filenames);
if (!mrb_nil_p(lsp))
lang.lsp_command = std::string(RSTRING_PTR(lsp), RSTRING_LEN(lsp));
result.push_back(lang);
}
return result;
}
void load_languages_info() {
std::lock_guard lock(ruby_mutex);
auto langs = read_languages();
auto lsps_t = read_lsps();
languages.clear();
@@ -312,29 +418,26 @@ void load_languages_info() {
l.name = lang.name;
l.color = lang.color;
l.lsp_name = lang.lsp_command;
l.symbol = lang.symbol;
languages[lang.name] = l;
for (auto &ext : lang.extensions)
language_extensions[ext] = lang.name;
// TODO: seperate extensions and filenames
for (auto &filename : lang.filenames)
language_extensions[filename] = lang.name;
for (auto &mimetype : lang.mimetypes)
language_mimetypes[mimetype] = lang.name;
}
for (auto &lsp : lsps_t)
lsps[lsp.command] = lsp;
}
uint8_t read_line_endings() {
std::lock_guard lock(ruby_mutex);
if (C_module == Qnil)
if (!C_module)
return 1;
VALUE le = rb_funcall(C_module, rb_intern("line_endings"), 0);
if (!SYMBOL_P(le))
mrb_value mod_val = mrb_obj_value((struct RObject *)C_module);
mrb_value le = mrb_funcall(mrb, mod_val, "line_endings", 0);
if (!mrb_symbol_p(le))
return 1;
uint8_t flags = 1;
const char *name = rb_id2name(SYM2ID(le));
const char *name = mrb_sym_dump(mrb, mrb_symbol(le));
if (std::strcmp(name, "unix") == 0)
flags = 0b01;
else if (std::strcmp(name, "windows") == 0)

View File

@@ -2,7 +2,6 @@
#include "editor/editor.h"
#include "io/knot.h"
#include "main.h"
#include "ruby/internal/special_consts.h"
#include "syntax/decl.h"
#include "syntax/langs.h"
@@ -116,14 +115,14 @@ void Parser::work() {
}
std::shared_ptr<void> new_state{nullptr};
if (is_custom) {
VALUE state = Qnil;
mrb_value state = mrb_nil_value();
if (prev_state) {
std::shared_ptr<CustomState> state_ptr =
std::static_pointer_cast<CustomState>(prev_state);
state = state_ptr->state;
}
VALUE out_state = parse_custom(&line_data->tokens, parser_block, text,
r_len, state, c_line);
mrb_value out_state = parse_custom(&line_data->tokens, parser_block,
text, r_len, state, c_line);
std::shared_ptr<CustomState> out_state_ptr =
std::make_shared<CustomState>(out_state);
new_state = out_state_ptr;
@@ -152,11 +151,11 @@ void Parser::work() {
if (c_line < line_count && (line_data = line_tree.at(c_line))) {
bool done = false;
if (is_custom) {
VALUE in_state_v = Qnil;
mrb_value in_state_v = mrb_nil_value();
if (prev_state)
in_state_v =
std::static_pointer_cast<CustomState>(prev_state)->state;
VALUE out_state_v = Qnil;
mrb_value out_state_v = mrb_nil_value();
if (line_data->in_state)
out_state_v =
std::static_pointer_cast<CustomState>(line_data->in_state)

View File

@@ -1,66 +1,59 @@
#include "ui/bar.h"
#include "io/sysio.h"
#include "lsp/lsp.h"
#include "main.h"
#include "syntax/decl.h"
void Bar::work() {
std::lock_guard<std::mutex> lock(mtx);
Editor *editor = editors[current_editor];
bar_line =
bar_contents(mode, editor->lang.name, editor->warnings.size(),
editor->lsp ? editor->lsp->lsp->command : "",
editor->filename, editor->filename, editor->cursor.row + 1,
editor->root->line_count + 1, screen.col);
}
void Bar::log(std::string message) {
std::lock_guard<std::mutex> lock(mtx);
log_line = message;
}
void Bar::render() {
Editor *editor = editors[current_editor];
std::lock_guard<std::mutex> lock(mtx);
USING(LSPInstance);
uint32_t row = screen.row - 2;
uint32_t col = 0;
uint32_t width = screen.col;
UNUSED(width);
uint32_t color = 0;
uint32_t black = 0x0b0e14;
uint32_t grey = 0x33363c;
uint32_t dark_grey = 0x24272d;
uint32_t name_color = 0xced4df;
uint32_t lang_color = editor->lang.color;
const char *symbol = "󱓧 ";
const char *name = "EDITOR";
switch (mode) {
case NORMAL:
color = 0x82AAFF;
symbol = "";
name = "NORMAL";
break;
case INSERT:
color = 0xFF8F40;
symbol = "󱓧 ";
name = "INSERT";
break;
case SELECT:
color = 0x9ADE7A;
symbol = "󱩧 ";
name = "SELECT";
break;
case RUNNER:
color = 0xFFD700;
symbol = "";
name = "RUNNER";
break;
case JUMPER:
color = 0xF29CC3;
symbol = "";
name = "JUMPER";
break;
std::string &line = bar_line.line;
uint32_t i = 0;
uint32_t col = 0;
while (i < line.length()) {
uint32_t cluster_len =
grapheme_next_character_break_utf8(line.c_str() + i, line.length() - i);
std::string cluster = line.substr(i, cluster_len);
int width = display_width(cluster.c_str(), cluster_len);
Highlight highlight = bar_line.get_highlight(col);
update(row, col, cluster.c_str(), highlight.fg, highlight.bg,
highlight.flags);
col += width;
i += cluster_len;
for (int w = 1; w < width; w++)
update(row, col - w, "\x1b", highlight.fg, highlight.bg, highlight.flags);
}
update(row, col, " ", black, color, CF_BOLD);
update(row, ++col, symbol, black, color, CF_BOLD);
update(row, ++col, "\x1b", black, color, CF_BOLD);
update(row, ++col, " ", black, color, CF_BOLD);
for (uint32_t i = 0; i < 6; i++)
update(row, ++col, {name[i], 0}, black, color, CF_BOLD);
update(row, ++col, " ", black, color, CF_BOLD);
update(row, ++col, "", color, grey, CF_BOLD);
update(row, ++col, "", grey, dark_grey, CF_BOLD);
update(row, ++col, " ", name_color, dark_grey, CF_BOLD);
update(row, ++col, editor->lang.symbol, lang_color, dark_grey, 0);
update(row, ++col, "\x1b", lang_color, dark_grey, 0);
update(row, ++col, " ", name_color, dark_grey, CF_BOLD);
std::string filename = filename_from_path(editor->filename);
for (uint32_t i = 0; i < filename.length(); i++)
update(row, ++col, {filename[i], 0}, name_color, dark_grey, CF_BOLD);
update(row, ++col, " ", name_color, dark_grey, CF_BOLD);
update(row, ++col, "", dark_grey, 1, CF_BOLD);
while (col < width)
update(row, col++, " ", 0, 0, 0);
col = 0;
row++;
if (mode == RUNNER) {
update(row, col++, ":", 0xFFFFFF, 0, 0);
for (char c : command)
update(row, col++, (char[2]){c, 0}, 0xFFFFFF, 0, 0);
} else {
for (char c : log_line)
update(row, col++, (char[2]){c, 0}, 0xFFFFFF, 0, 0);
}
while (col < width)
update(row, col++, " ", 0, 0, 0);
}
void Bar::handle(KeyEvent event) {
@@ -68,11 +61,26 @@ void Bar::handle(KeyEvent event) {
if (event.c[0] == 0x1B) {
mode = NORMAL;
} else if (event.c[0] == '\n' || event.c[0] == '\r') {
// execute command while stripping starting `[:;]`
command = trim(command);
if (command == "w") {
save_file(editors[current_editor]);
} else if (command == "q") {
running = false;
} else if (command == "wq") {
save_file(editors[current_editor]);
running = false;
}
mode = NORMAL;
command = "";
} else if (isprint((unsigned char)(event.c[0]))) {
} else if (event.c[0] == 0x7F || event.c[0] == 0x08) { // backspace
command += event.c[0];
} else if (event.c[0] == 0x7F || event.c[0] == 0x08) {
if (command.length() > 0) {
command = command.substr(0, command.length() - 1);
} else {
mode = NORMAL;
command = "";
}
}
} else if (event.key_type == KEY_SPECIAL) {
switch (event.special_key) {

View File

@@ -71,7 +71,9 @@ void CompletionBox::render_update() {
uint32_t max_label_len = 0;
uint32_t max_detail_len = 0;
uint32_t max_kind_len = 0;
for (auto i : session->visible) {
for (uint32_t x = session->scroll;
x < session->scroll + 8 && x < session->visible.size(); x++) {
uint32_t i = session->visible[x];
if (i >= session->items.size())
continue;
auto &item = session->items[i];
@@ -81,7 +83,9 @@ void CompletionBox::render_update() {
max_kind_len =
MAX(max_kind_len, (uint32_t)item_kind_name(item.kind).size());
}
size.row = session->visible.size() + 2;
uint32_t total = session->visible.size();
uint32_t rows = MIN(total, 8);
size.row = rows + 2;
size.col = 2 + 2 + max_label_len + 1 + max_detail_len + 2 + max_kind_len + 1;
cells.assign(size.row * size.col, {" ", 0, 0, 0, 0, 0});
auto set = [&](uint32_t r, uint32_t c, const char *text, uint32_t fg,
@@ -95,8 +99,10 @@ void CompletionBox::render_update() {
for (uint32_t c = 1; c < size.col - 1; c++)
set(0, c, "", border_fg, 0, 0);
set(0, size.col - 1, "", border_fg, 0, 0);
for (uint32_t row_idx = 0; row_idx < session->visible.size(); row_idx++) {
uint32_t r = row_idx + 1;
uint32_t start = session->scroll;
uint32_t end = MIN(start + 8, session->visible.size());
for (uint32_t row_idx = start; row_idx < end; row_idx++) {
uint32_t r = (row_idx - start) + 1;
auto &item = session->items[session->visible[row_idx]];
uint32_t bg = (session->visible[row_idx] == session->select) ? sel_bg : 1;
uint32_t fg = 0xFFFFFF;
@@ -130,6 +136,12 @@ void CompletionBox::render_update() {
for (uint32_t c = 1; c < size.col - 1; c++)
set(bottom, c, "", border_fg, 0, 0);
set(bottom, size.col - 1, "", border_fg, 0, 0);
if (session->visible.size() > 8) {
std::string info = std::to_string(start + 1) + "-" + std::to_string(end) +
"/" + std::to_string(session->visible.size());
for (size_t i = 0; i < info.size() && i < size.col - 2; i++)
set(bottom, 1 + i, (char[2]){info[i], 0}, border_fg, 0, 0);
}
}
void CompletionBox::render(Coord pos) {

View File

@@ -2,7 +2,6 @@
std::unordered_map<std::string, Language> languages;
std::unordered_map<std::string, std::string> language_extensions;
std::unordered_map<std::string, std::string> language_mimetypes;
std::unordered_map<std::string, LSP> lsps;
void log(const char *fmt, ...) {
@@ -106,24 +105,6 @@ static std::string file_extension(const char *filename) {
return ext;
}
char *detect_file_type(const char *filename) {
magic_t magic = magic_open(MAGIC_MIME_TYPE);
if (!magic)
return nullptr;
if (magic_load(magic, nullptr) != 0) {
magic_close(magic);
return nullptr;
}
const char *type = magic_file(magic, filename);
if (!type) {
magic_close(magic);
return nullptr;
}
char *result = strdup(type);
magic_close(magic);
return result;
}
Language language_for_file(const char *filename) {
std::string ext = file_extension(filename);
std::string lang_name;
@@ -132,14 +113,6 @@ Language language_for_file(const char *filename) {
if (it != language_extensions.end())
return languages.find(it->second)->second;
}
char *mime = detect_file_type(filename);
if (mime) {
std::string mime_type(mime);
free(mime);
auto it = language_mimetypes.find(mime_type);
if (it != language_mimetypes.end())
return languages.find(it->second)->second;
}
return Language{};
}

View File

@@ -1,4 +1,3 @@
#include "utfcpp/source/utf8.h"
#include "utils/utils.h"
int display_width(const char *str, size_t len) {
@@ -99,42 +98,48 @@ uint32_t count_clusters(const char *line, size_t len, size_t from, size_t to) {
return count;
}
size_t utf8_offset_to_utf16(const char *utf8, size_t utf8_len,
size_t byte_offset) {
if (byte_offset > utf8_len)
return byte_offset;
const char *start = utf8;
const char *mid = utf8 + byte_offset;
if (!utf8::is_valid(start, mid))
assert(0 && "invalid utf8");
size_t utf16_offset = 0;
for (auto it = start; it < mid;) {
uint32_t codepoint = utf8::next(it, mid);
if (codepoint <= 0xFFFF)
utf16_offset += 1;
else
utf16_offset += 2;
size_t utf8_offset_to_utf16(const char *s, size_t utf8_len, size_t byte_pos) {
if (byte_pos > utf8_len)
return 0;
size_t utf16_units = 0;
size_t i = 0;
while (i < byte_pos) {
unsigned char c = s[i];
if ((c & 0x80) == 0x00) {
i += 1;
utf16_units += 1;
} else if ((c & 0xE0) == 0xC0) {
i += 2;
utf16_units += 1;
} else if ((c & 0xF0) == 0xE0) {
i += 3;
utf16_units += 1;
} else {
i += 4;
utf16_units += 2;
}
return utf16_offset;
}
return utf16_units;
}
size_t utf16_offset_to_utf8(const char *utf8, size_t utf8_len,
size_t utf16_offset) {
const char *start = utf8;
const char *end = utf8 + utf8_len;
const char *it = start;
size_t utf16_count = 0;
while (it < end) {
if (utf16_count >= utf16_offset)
break;
const char *prev = it;
uint32_t codepoint = utf8::next(it, end);
if (codepoint <= 0xFFFF)
utf16_count += 1;
else
utf16_count += 2;
if (utf16_count > utf16_offset)
return prev - start;
size_t utf16_offset_to_utf8(const char *s, size_t utf8_len, size_t utf16_pos) {
size_t utf16_units = 0;
size_t i = 0;
while (utf16_units < utf16_pos && i < utf8_len) {
unsigned char c = s[i];
if ((c & 0x80) == 0x00) {
i += 1;
utf16_units += 1;
} else if ((c & 0xE0) == 0xC0) {
i += 2;
utf16_units += 1;
} else if ((c & 0xF0) == 0xE0) {
i += 3;
utf16_units += 1;
} else {
i += 4;
utf16_units += 2;
}
return it - start;
}
return i;
}