Skip to content

Commit

Permalink
kuroko: sync, necessary adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
klange committed Dec 14, 2023
1 parent 6112ca0 commit 2005732
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
21 changes: 19 additions & 2 deletions apps/bim.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ static uint32_t state = 0;
#define UTF8_ACCEPT 0
#define UTF8_REJECT 1

static inline uint32_t decode(uint32_t* state, uint32_t* codep, uint32_t byte) {
static inline uint32_t decode(uint32_t* state, uint32_t* codep, unsigned char byte) {
static int state_table[32] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xxxxxxx */
1,1,1,1,1,1,1,1, /* 10xxxxxx */
Expand Down Expand Up @@ -11128,7 +11128,7 @@ void import_directory(char * dirName) {
static void findBim(char * argv[]) {
/* Try asking /proc */
char * binpath = realpath("/proc/self/exe", NULL);
if (!binpath) {
if (!binpath || (access(binpath, X_OK) != 0)) {
if (strchr(argv[0], '/')) {
binpath = realpath(argv[0], NULL);
} else {
Expand Down Expand Up @@ -11466,6 +11466,23 @@ void initialize(void) {
krk_resetStack();

krk_startModule("<bim-syntax>");

#ifdef __toaru__
# define KUROKO_SEARCH_PATH "/lib/kuroko/"
#else
# define KUROKO_SEARCH_PATH "/usr/lib/kuroko/"
#endif

/* Try to import the shared object 'os' module. If we can't,
* try adjusting the module_paths to find it. */
krk_interpret(
"try:\n"
" import os\n"
"except:\n"
" import kuroko\n"
" if '" KUROKO_SEARCH_PATH "' not in kuroko.module_paths:\n"
" kuroko.module_paths.append('" KUROKO_SEARCH_PATH "')", "<bim-syntax>");

import_directory("syntax");
krk_startModule("<bim-themes>");
import_directory("themes");
Expand Down
2 changes: 1 addition & 1 deletion build/aarch64.mk
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ debug: system
BUILD_KRK=$(TOOLCHAIN)/local/bin/kuroko
$(TOOLCHAIN)/local/bin/kuroko: kuroko/src/*.c
mkdir -p $(TOOLCHAIN)/local/bin
cc -Ikuroko/src -DNO_RLINE -DKRK_STATIC_ONLY -DKRK_DISABLE_THREADS -o "${TOOLCHAIN}/local/bin/kuroko" kuroko/src/*.c
cc -Ikuroko/src -DKRK_BUNDLE_LIBS="BUNDLED(os);BUNDLED(fileio);" -DNO_RLINE -DKRK_STATIC_ONLY -DKRK_DISABLE_THREADS -o "${TOOLCHAIN}/local/bin/kuroko" kuroko/src/*.c kuroko/src/modules/module_os.c kuroko/src/modules/module_fileio.c

2 changes: 1 addition & 1 deletion build/x86_64.mk
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ fatbase/efi/boot/bootx64.efi: boot/efi64.so
BUILD_KRK=$(TOOLCHAIN)/local/bin/kuroko
$(TOOLCHAIN)/local/bin/kuroko: kuroko/src/*.c
mkdir -p $(TOOLCHAIN)/local/bin
cc -Ikuroko/src -DNO_RLINE -DKRK_STATIC_ONLY -DKRK_DISABLE_THREADS -o "${TOOLCHAIN}/local/bin/kuroko" kuroko/src/*.c
cc -Ikuroko/src -DKRK_BUNDLE_LIBS="BUNDLED(os);BUNDLED(fileio);" -DNO_RLINE -DKRK_STATIC_ONLY -DKRK_DISABLE_THREADS -o "${TOOLCHAIN}/local/bin/kuroko" kuroko/src/*.c kuroko/src/modules/module_os.c kuroko/src/modules/module_fileio.c

image.iso: cdrom/fat.img cdrom/boot.sys boot/mbr.S util/update-extents.krk | $(BUILD_KRK)
xorriso -as mkisofs -R -J -c bootcat \
Expand Down

0 comments on commit 2005732

Please sign in to comment.