kuroko: sync, necessary adjustments

This commit is contained in:
K. Lange 2023-12-14 23:07:55 +09:00
parent 6112ca05cb
commit 200573230f
4 changed files with 22 additions and 5 deletions

View File

@ -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 */
@ -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 {
@ -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");

View File

@ -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

View File

@ -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 \

2
kuroko

@ -1 +1 @@
Subproject commit fb6faaff1a2305d0d557ab0a9f1142b4ad97a8ef
Subproject commit 031ca32ab0f2d7411a4f031b35bff65310f6cfad