Fixes to make the 2.1 branch working on OS4 - WIP

This commit is contained in:
George Sokianos 2022-04-04 11:31:17 +01:00
parent aa14bd6a88
commit ab72e26080
7 changed files with 149 additions and 114 deletions

View File

@ -5,17 +5,20 @@
#
LiteXL_OBJ := \
src/dirmonitor.o src/main.o src/rencache.o src/renderer.o \
src/renwindow.o src/api/api.o src/api/regex.o \
src/api/renderer.o src/api/system.o src/platform/amigaos4.o
src/main.o src/rencache.o src/renderer.o src/renwindow.o \
src/api/dirmonitor/os4.o \
src/api/api.o src/api/dirmonitor.o src/api/regex.o \
src/api/renderer.o src/api/system.o \
src/platform/amigaos4.o
# src/api/process.o
outfile := lite
compiler := gcc
cxxcompiler := g++
INCPATH := -Isrc -Ilib/dmon -I/sdk/local/newlib/include/SDL2 -I/sdk/local/common/include/freetype2
DFLAGS := -D__USE_INLINE__ -DLITE_XL_DATA_USE_EXEDIR
DFLAGS := -D__USE_INLINE__ -DLITE_XL_DATA_USE_EXEDIR -DDIRMONITOR_BACKEND=os4 -DDIRMONITOR_OS4
# -DLITE_USE_SDL_RENDERER
# -Wextra -Wall
CFLAGS := -Werror -Wwrite-strings -O3 -g -std=gnu11 -fno-strict-aliasing
@ -43,10 +46,8 @@ LiteXL: $(LiteXL_OBJ)
@echo "Compiling $<"
@$(compiler) -c $< -o $*.o $(CFLAGS) $(INCPATH) $(DFLAGS)
src/dirmonitor.o: src/dirmonitor.c src/platform/amigaos4.h
src/main.o: src/main.c src/api/api.h src/rencache.h \
src/renderer.h src/platform/amigaos4.h src/dirmonitor.h
src/renderer.h src/platform/amigaos4.h
src/rencache.o: src/rencache.c
@ -54,8 +55,12 @@ src/renderer.o: src/renderer.c
src/renwindow.o: src/renwindow.c
src/api/dirmonitor/os4.o: src/api/dirmonitor/os4.c
src/api/api.o: src/api/api.c
src/api/dirmonitor.o: src/api/dirmonitor.c src/api/dirmonitor/os4.c
src/api/regex.o: src/api/regex.c
src/api/renderer.o: src/api/renderer.c
@ -65,8 +70,6 @@ src/api/system.o: src/api/system.c
src/platform/amigaos4.o: src/platform/amigaos4.c
release:
mkdir -p release/LiteXL
cp release_files/* release/LiteXL/ -r
@ -79,3 +82,4 @@ release:
cp README_OS4.md release/LiteXL/
cp LICENSE release/LiteXL/
lha -aeqr3 a LiteXL.lha release/

View File

@ -13,7 +13,8 @@ function dirwatch.new()
scanned = {},
watched = {},
reverse_watched = {},
monitor = dirmonitor.new(),
-- monitor = dirmonitor.new(),
monitor = 0,
windows_watch_top = nil,
windows_watch_count = 0
}
@ -52,7 +53,9 @@ function dirwatch:watch(directory, bool)
end
self.watched[directory] = true
else
local value = self.monitor:watch(directory)
-- TODO: Fix value to get it from monitor
-- local value = self.monitor:watch(directory)
local value = -1
-- If for whatever reason, we can't watch this directory, revert back to scanning.
-- Don't bother trying to find out why, for now.
if value and value < 0 then
@ -218,3 +221,4 @@ end
return dirwatch

View File

@ -1321,3 +1321,4 @@ end
return core

View File

@ -4,14 +4,14 @@ int luaopen_system(lua_State *L);
int luaopen_renderer(lua_State *L);
int luaopen_regex(lua_State *L);
// int luaopen_process(lua_State *L);
// int luaopen_dirmonitor(lua_State* L);
int luaopen_dirmonitor(lua_State* L);
static const luaL_Reg libs[] = {
{ "system", luaopen_system },
{ "renderer", luaopen_renderer },
{ "regex", luaopen_regex },
// { "process", luaopen_process },
// { "dirmonitor", luaopen_dirmonitor },
{ "dirmonitor", luaopen_dirmonitor },
{ NULL, NULL }
};

View File

@ -5,6 +5,8 @@
#elif __linux__
#include <sys/inotify.h>
#include <limits.h>
#elif __amigaos4__
// #define DIRMONITOR_BACKEND 'os4'
#else
#include <sys/event.h>
#endif
@ -94,3 +96,4 @@ int luaopen_dirmonitor(lua_State* L) {
lua_setfield(L, -2, "__index");
return 1;
}

23
src/api/dirmonitor/os4.c Normal file
View File

@ -0,0 +1,23 @@
#include <stdlib.h>
struct dirmonitor {
};
struct dirmonitor* init_dirmonitor_os4() {
return NULL;
}
void deinit_dirmonitor_os4(struct dirmonitor* monitor) {
}
int check_dirmonitor_os4(struct dirmonitor* monitor, int (*change_callback)(int, const char*, void*), void* data) {
return -1;
}
int add_dirmonitor_os4(struct dirmonitor* monitor, const char* path) {
return -1;
}
void remove_dirmonitor_os4(struct dirmonitor* monitor, int fd) {
}