Fixes to make the 2.1 branch working on OS4 - WIP
This commit is contained in:
parent
aa14bd6a88
commit
ab72e26080
22
Makefile.os4
22
Makefile.os4
|
@ -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/
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
@ -36,23 +37,25 @@ function dirwatch:watch(directory, bool)
|
|||
if not self.watched[directory] and not self.scanned[directory] then
|
||||
if PLATFORM == "Windows" then
|
||||
if not self.windows_watch_top or directory:find(self.windows_watch_top, 1, true) ~= 1 then
|
||||
-- Get the highest level of directory that is common to this directory, and the original.
|
||||
local target = directory
|
||||
while self.windows_watch_top and self.windows_watch_top:find(target, 1, true) ~= 1 do
|
||||
target = common.dirname(target)
|
||||
end
|
||||
if target ~= self.windows_watch_top then
|
||||
local value = self.monitor:watch(target)
|
||||
if value and value < 0 then
|
||||
return self:scan(directory)
|
||||
end
|
||||
self.windows_watch_top = target
|
||||
self.windows_watch_count = self.windows_watch_count + 1
|
||||
end
|
||||
-- Get the highest level of directory that is common to this directory, and the original.
|
||||
local target = directory
|
||||
while self.windows_watch_top and self.windows_watch_top:find(target, 1, true) ~= 1 do
|
||||
target = common.dirname(target)
|
||||
end
|
||||
if target ~= self.windows_watch_top then
|
||||
local value = self.monitor:watch(target)
|
||||
if value and value < 0 then
|
||||
return self:scan(directory)
|
||||
end
|
||||
self.windows_watch_top = target
|
||||
self.windows_watch_count = self.windows_watch_count + 1
|
||||
end
|
||||
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
|
||||
|
||||
|
|
|
@ -1321,3 +1321,4 @@ end
|
|||
|
||||
|
||||
return core
|
||||
|
||||
|
|
|
@ -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 }
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
}
|
||||
|
Loading…
Reference in New Issue