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

View File

@ -13,7 +13,8 @@ function dirwatch.new()
scanned = {}, scanned = {},
watched = {}, watched = {},
reverse_watched = {}, reverse_watched = {},
monitor = dirmonitor.new(), -- monitor = dirmonitor.new(),
monitor = 0,
windows_watch_top = nil, windows_watch_top = nil,
windows_watch_count = 0 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 not self.watched[directory] and not self.scanned[directory] then
if PLATFORM == "Windows" then if PLATFORM == "Windows" then
if not self.windows_watch_top or directory:find(self.windows_watch_top, 1, true) ~= 1 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. -- Get the highest level of directory that is common to this directory, and the original.
local target = directory local target = directory
while self.windows_watch_top and self.windows_watch_top:find(target, 1, true) ~= 1 do while self.windows_watch_top and self.windows_watch_top:find(target, 1, true) ~= 1 do
target = common.dirname(target) target = common.dirname(target)
end end
if target ~= self.windows_watch_top then if target ~= self.windows_watch_top then
local value = self.monitor:watch(target) local value = self.monitor:watch(target)
if value and value < 0 then if value and value < 0 then
return self:scan(directory) return self:scan(directory)
end end
self.windows_watch_top = target self.windows_watch_top = target
self.windows_watch_count = self.windows_watch_count + 1 self.windows_watch_count = self.windows_watch_count + 1
end end
end end
self.watched[directory] = true self.watched[directory] = true
else 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. -- If for whatever reason, we can't watch this directory, revert back to scanning.
-- Don't bother trying to find out why, for now. -- Don't bother trying to find out why, for now.
if value and value < 0 then if value and value < 0 then
@ -218,3 +221,4 @@ end
return dirwatch return dirwatch

View File

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

View File

@ -1,88 +1,88 @@
#define MyAppName "Lite XL" #define MyAppName "Lite XL"
#define MyAppVersion "@PROJECT_VERSION@" #define MyAppVersion "@PROJECT_VERSION@"
#define MyAppPublisher "Lite XL Team" #define MyAppPublisher "Lite XL Team"
#define MyAppURL "https://lite-xl.com" #define MyAppURL "https://lite-xl.com"
#define MyAppExeName "lite-xl.exe" #define MyAppExeName "lite-xl.exe"
#define BuildDir "@PROJECT_BUILD_DIR@" #define BuildDir "@PROJECT_BUILD_DIR@"
#define SourceDir "@PROJECT_SOURCE_DIR@" #define SourceDir "@PROJECT_SOURCE_DIR@"
; Use /dArch option to create a setup for a different architecture, e.g.: ; Use /dArch option to create a setup for a different architecture, e.g.:
; iscc /dArch=x86 innosetup.iss ; iscc /dArch=x86 innosetup.iss
#ifndef Arch #ifndef Arch
#define Arch "x64" #define Arch "x64"
#endif #endif
[Setup] [Setup]
; NOTE: The value of AppId uniquely identifies this application. ; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications. ; Do not use the same AppId value in installers for other applications.
; To generate a new GUID, click Tools | Generate GUID inside the InnoSetup IDE. ; To generate a new GUID, click Tools | Generate GUID inside the InnoSetup IDE.
AppId={{06761240-D97C-43DE-B9ED-C15F765A2D65} AppId={{06761240-D97C-43DE-B9ED-C15F765A2D65}
AppName={#MyAppName} AppName={#MyAppName}
AppVersion={#MyAppVersion} AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion} ;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher} AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL} AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL} AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL} AppUpdatesURL={#MyAppURL}
#if Arch=="x64" #if Arch=="x64"
ArchitecturesAllowed=x64 ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64 ArchitecturesInstallIn64BitMode=x64
#define ArchInternal "x86_64" #define ArchInternal "x86_64"
#else #else
#define ArchInternal "i686" #define ArchInternal "i686"
#endif #endif
AllowNoIcons=yes AllowNoIcons=yes
Compression=lzma Compression=lzma
SolidCompression=yes SolidCompression=yes
DefaultDirName={autopf}/{#MyAppName} DefaultDirName={autopf}/{#MyAppName}
DefaultGroupName={#MyAppPublisher} DefaultGroupName={#MyAppPublisher}
UninstallFilesDir={app} UninstallFilesDir={app}
; Uncomment the following line to run in non administrative install mode ; Uncomment the following line to run in non administrative install mode
; (install for current user only.) ; (install for current user only.)
;PrivilegesRequired=lowest ;PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=dialog PrivilegesRequiredOverridesAllowed=dialog
; The [Icons] "quicklaunchicon" entry uses {userappdata} ; The [Icons] "quicklaunchicon" entry uses {userappdata}
; but its [Tasks] entry has a proper IsAdminInstallMode Check. ; but its [Tasks] entry has a proper IsAdminInstallMode Check.
UsedUserAreasWarning=no UsedUserAreasWarning=no
OutputDir=. OutputDir=.
OutputBaseFilename=LiteXL-{#MyAppVersion}-{#ArchInternal}-setup OutputBaseFilename=LiteXL-{#MyAppVersion}-{#ArchInternal}-setup
;DisableDirPage=yes ;DisableDirPage=yes
;DisableProgramGroupPage=yes ;DisableProgramGroupPage=yes
LicenseFile={#SourceDir}/LICENSE LicenseFile={#SourceDir}/LICENSE
SetupIconFile={#SourceDir}/resources/icons/icon.ico SetupIconFile={#SourceDir}/resources/icons/icon.ico
WizardImageFile="{#SourceDir}/scripts/innosetup/wizard-modern-image.bmp" WizardImageFile="{#SourceDir}/scripts/innosetup/wizard-modern-image.bmp"
WizardSmallImageFile="{#SourceDir}/scripts/innosetup/litexl-55px.bmp" WizardSmallImageFile="{#SourceDir}/scripts/innosetup/litexl-55px.bmp"
[Languages] [Languages]
Name: "english"; MessagesFile: "compiler:Default.isl" Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks] [Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 6.1; Check: not IsAdminInstallMode Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 6.1; Check: not IsAdminInstallMode
Name: "portablemode"; Description: "Portable Mode"; Flags: unchecked Name: "portablemode"; Description: "Portable Mode"; Flags: unchecked
[Files] [Files]
Source: "{#BuildDir}/src/lite-xl.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "{#BuildDir}/src/lite-xl.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#BuildDir}/mingwLibs{#Arch}/*"; DestDir: "{app}"; Flags: ignoreversion ; Check: DirExists(ExpandConstant('{#BuildDir}/mingwLibs{#Arch}')) Source: "{#BuildDir}/mingwLibs{#Arch}/*"; DestDir: "{app}"; Flags: ignoreversion ; Check: DirExists(ExpandConstant('{#BuildDir}/mingwLibs{#Arch}'))
Source: "{#SourceDir}/data/*"; DestDir: "{app}/data"; Flags: ignoreversion recursesubdirs Source: "{#SourceDir}/data/*"; DestDir: "{app}/data"; Flags: ignoreversion recursesubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files ; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons] [Icons]
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Check: not WizardIsTaskSelected('portablemode') Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Check: not WizardIsTaskSelected('portablemode')
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"; Check: not WizardIsTaskSelected('portablemode') Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"; Check: not WizardIsTaskSelected('portablemode')
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon; Check: not WizardIsTaskSelected('portablemode') Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon; Check: not WizardIsTaskSelected('portablemode')
; Name: "{usersendto}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" ; Name: "{usersendto}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
[Run] [Run]
Filename: "{app}/{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent Filename: "{app}/{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
[Setup] [Setup]
Uninstallable=not WizardIsTaskSelected('portablemode') Uninstallable=not WizardIsTaskSelected('portablemode')

View File

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

View File

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