diff --git a/data/colors/fall.lua b/data/colors/fall.lua old mode 100644 new mode 100755 diff --git a/data/colors/summer.lua b/data/colors/summer.lua old mode 100644 new mode 100755 diff --git a/data/core/command.lua b/data/core/command.lua old mode 100644 new mode 100755 diff --git a/data/core/commands/command.lua b/data/core/commands/command.lua old mode 100644 new mode 100755 diff --git a/data/core/commands/core.lua b/data/core/commands/core.lua old mode 100644 new mode 100755 diff --git a/data/core/commands/doc.lua b/data/core/commands/doc.lua old mode 100644 new mode 100755 diff --git a/data/core/commands/drawwhitespace.lua b/data/core/commands/drawwhitespace.lua old mode 100644 new mode 100755 diff --git a/data/core/commands/files.lua b/data/core/commands/files.lua old mode 100644 new mode 100755 diff --git a/data/core/commands/findreplace.lua b/data/core/commands/findreplace.lua old mode 100644 new mode 100755 diff --git a/data/core/commands/root.lua b/data/core/commands/root.lua old mode 100644 new mode 100755 diff --git a/data/core/commandview.lua b/data/core/commandview.lua old mode 100644 new mode 100755 diff --git a/data/core/common.lua b/data/core/common.lua old mode 100644 new mode 100755 diff --git a/data/core/config.lua b/data/core/config.lua old mode 100644 new mode 100755 diff --git a/data/core/doc/highlighter.lua b/data/core/doc/highlighter.lua old mode 100644 new mode 100755 diff --git a/data/core/doc/init.lua b/data/core/doc/init.lua old mode 100644 new mode 100755 diff --git a/data/core/doc/search.lua b/data/core/doc/search.lua old mode 100644 new mode 100755 diff --git a/data/core/doc/translate.lua b/data/core/doc/translate.lua old mode 100644 new mode 100755 diff --git a/data/core/docview.lua b/data/core/docview.lua old mode 100644 new mode 100755 diff --git a/data/core/init.lua b/data/core/init.lua index 992eb5de..bceac53f 100644 --- a/data/core/init.lua +++ b/data/core/init.lua @@ -59,17 +59,20 @@ end function core.reschedule_project_scan() - if core.project_scan_thread_id then - core.threads[core.project_scan_thread_id].wake = 0 - end + -- if core.project_scan_thread_id then + -- core.threads[core.project_scan_thread_id].wake = 0 + -- end end function core.set_project_dir(new_dir, change_project_fn) +-- print("LUA DBG: before pcall " .. tostring(new_dir)) local chdir_ok = pcall(system.chdir, new_dir) +-- print("LUA DBG: after pcall " .. tostring(chdir_ok)) if chdir_ok then if change_project_fn then change_project_fn() end core.project_dir = normalize_path(new_dir) + -- print("LUA DBG: after normalize_path " .. tostring(new_dir) .. "\n" .. tostring(core.project_dir)) core.project_directories = {} core.add_project_directory(new_dir) core.project_files = {} @@ -503,6 +506,7 @@ function core.init() update_recents_project("remove", project_dir) end project_dir_abs = system.absolute_path(".") + -- print("LUA DBG: project_dir_abs " .. tostring(project_dir_abs)) if not core.set_project_dir(project_dir_abs) then system.show_fatal_error("Lite XL internal error", "cannot set project directory to cwd") os.exit(1) diff --git a/data/core/keymap-macos.lua b/data/core/keymap-macos.lua old mode 100644 new mode 100755 diff --git a/data/core/keymap.lua b/data/core/keymap.lua old mode 100644 new mode 100755 diff --git a/data/core/logview.lua b/data/core/logview.lua old mode 100644 new mode 100755 diff --git a/data/core/modkeys-generic.lua b/data/core/modkeys-generic.lua old mode 100644 new mode 100755 diff --git a/data/core/modkeys-macos.lua b/data/core/modkeys-macos.lua old mode 100644 new mode 100755 diff --git a/data/core/nagview.lua b/data/core/nagview.lua old mode 100644 new mode 100755 diff --git a/data/core/object.lua b/data/core/object.lua old mode 100644 new mode 100755 diff --git a/data/core/rootview.lua b/data/core/rootview.lua old mode 100644 new mode 100755 diff --git a/data/core/start.lua b/data/core/start.lua old mode 100644 new mode 100755 diff --git a/data/core/statusview.lua b/data/core/statusview.lua old mode 100644 new mode 100755 diff --git a/data/core/strict.lua b/data/core/strict.lua old mode 100644 new mode 100755 diff --git a/data/core/style.lua b/data/core/style.lua old mode 100644 new mode 100755 diff --git a/data/core/syntax.lua b/data/core/syntax.lua old mode 100644 new mode 100755 diff --git a/data/core/titleview.lua b/data/core/titleview.lua old mode 100644 new mode 100755 diff --git a/data/core/tokenizer.lua b/data/core/tokenizer.lua old mode 100644 new mode 100755 diff --git a/data/core/view.lua b/data/core/view.lua old mode 100644 new mode 100755 diff --git a/data/fonts/FiraSans-Regular.ttf b/data/fonts/FiraSans-Regular.ttf old mode 100644 new mode 100755 diff --git a/data/fonts/JetBrainsMono-Regular.ttf b/data/fonts/JetBrainsMono-Regular.ttf old mode 100644 new mode 100755 diff --git a/data/fonts/icons.ttf b/data/fonts/icons.ttf old mode 100644 new mode 100755 diff --git a/data/plugins/autocomplete.lua b/data/plugins/autocomplete.lua old mode 100644 new mode 100755 diff --git a/data/plugins/autoreload.lua b/data/plugins/autoreload.lua old mode 100644 new mode 100755 diff --git a/data/plugins/detectindent.lua b/data/plugins/detectindent.lua old mode 100644 new mode 100755 diff --git a/data/plugins/language_c.lua b/data/plugins/language_c.lua old mode 100644 new mode 100755 diff --git a/data/plugins/language_cpp.lua b/data/plugins/language_cpp.lua old mode 100644 new mode 100755 diff --git a/data/plugins/language_css.lua b/data/plugins/language_css.lua old mode 100644 new mode 100755 diff --git a/data/plugins/language_html.lua b/data/plugins/language_html.lua old mode 100644 new mode 100755 diff --git a/data/plugins/language_js.lua b/data/plugins/language_js.lua old mode 100644 new mode 100755 diff --git a/data/plugins/language_lua.lua b/data/plugins/language_lua.lua old mode 100644 new mode 100755 diff --git a/data/plugins/language_md.lua b/data/plugins/language_md.lua old mode 100644 new mode 100755 diff --git a/data/plugins/language_python.lua b/data/plugins/language_python.lua old mode 100644 new mode 100755 diff --git a/data/plugins/language_xml.lua b/data/plugins/language_xml.lua old mode 100644 new mode 100755 diff --git a/data/plugins/macro.lua b/data/plugins/macro.lua old mode 100644 new mode 100755 diff --git a/data/plugins/projectsearch.lua b/data/plugins/projectsearch.lua old mode 100644 new mode 100755 diff --git a/data/plugins/quote.lua b/data/plugins/quote.lua old mode 100644 new mode 100755 diff --git a/data/plugins/reflow.lua b/data/plugins/reflow.lua old mode 100644 new mode 100755 diff --git a/data/plugins/tabularize.lua b/data/plugins/tabularize.lua old mode 100644 new mode 100755 diff --git a/data/plugins/toolbarview.lua b/data/plugins/toolbarview.lua old mode 100644 new mode 100755 diff --git a/data/plugins/treeview.lua b/data/plugins/treeview.lua old mode 100644 new mode 100755 diff --git a/data/plugins/trimwhitespace.lua b/data/plugins/trimwhitespace.lua old mode 100644 new mode 100755 diff --git a/data/plugins/workspace.lua b/data/plugins/workspace.lua old mode 100644 new mode 100755 diff --git a/os4build.sh b/os4build.sh new file mode 100755 index 00000000..e3765653 --- /dev/null +++ b/os4build.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +cflags="-D__USE_INLINE__ -DLITE_XL_DATA_USE_EXEDIR -DLITE_USE_SDL_RENDERER -Wall -O3 -g -std=gnu11 -fno-strict-aliasing -Isrc -Ilib/font_renderer -I/sdk/local/newlib/include/SDL2 -lSDL2 -llua -lauto" +#cflags+=" $(pkg-config --cflags lua5.2) $(sdl2-config --cflags)" +lflags="-mcrt=newlib -static-libgcc -static-libstdc++ -lSDL2 -lagg -lfreetype -llua -lm -lpthread -athread=native" +#for package in libagg freetype2 lua5.2; do +# lflags+=" $(pkg-config --libs $package)" +#done +#lflags+=" $(sdl2-config --libs) -lm" + +#if [[ $* == *windows* ]]; then +# echo "cross compiling for windows is not yet supported" +# exit 1 +#else + outfile="lite" + compiler="gcc" + cxxcompiler="g++" +#fi + +#lib/font_renderer/build.sh || exit 1 +#libs=libfontrenderer.a +libs="-lfontrenderer" + +echo "compiling lite..." + +gcc -c $cflags src/fontdesc.c -o fontdesc.o +gcc -c $cflags src/main.c -o main.o +gcc -c $cflags src/rencache.c -o rencache.o +gcc -c $cflags src/renderer.c -o renderer.o +gcc -c $cflags src/renwindow.c -o renwindow.o + +gcc -c $cflags src/api/api.c -o api.o +gcc -c $cflags src/api/cp_replace.c -o cp_replace.o +gcc -c $cflags src/api/renderer.c -o apirenderer.o +gcc -c $cflags src/api/renderer_font.c -o renderer_font.o +gcc -c $cflags src/api/system.c -o system.o + +gcc -c $cflags src/platform/amigaos4.c -o amigaos4.o + +echo "linking..." +g++ -o $outfile *.o $libs $lflags + +echo "cleaning up..." +rm *.o +echo "done" + diff --git a/src/api/api.c b/src/api/api.c old mode 100644 new mode 100755 diff --git a/src/api/api.h b/src/api/api.h old mode 100644 new mode 100755 diff --git a/src/api/cp_replace.c b/src/api/cp_replace.c old mode 100644 new mode 100755 diff --git a/src/api/renderer.c b/src/api/renderer.c old mode 100644 new mode 100755 diff --git a/src/api/renderer_font.c b/src/api/renderer_font.c old mode 100644 new mode 100755 diff --git a/src/api/system.c b/src/api/system.c index 4b98509f..0bc62192 100644 --- a/src/api/system.c +++ b/src/api/system.c @@ -12,6 +12,10 @@ #include #endif +#ifdef __amigaos4__ + #include "platform/amigaos4.h" +#endif + extern SDL_Window *window; @@ -423,9 +427,14 @@ static int f_list_dir(lua_State *L) { #define realpath(x, y) _fullpath(y, x, MAX_PATH) #endif +#ifdef __amigaos4__ + #define realpath(x, y) _fullpath(x) +#endif + static int f_absolute_path(lua_State *L) { const char *path = luaL_checkstring(L, 1); char *res = realpath(path, NULL); + //printf("DBG: f_absolute_path() %s\n", res); if (!res) { return 0; } lua_pushstring(L, res); free(res); diff --git a/src/bundle_open.m b/src/bundle_open.m old mode 100644 new mode 100755 diff --git a/src/fontdesc.c b/src/fontdesc.c old mode 100644 new mode 100755 diff --git a/src/fontdesc.h b/src/fontdesc.h old mode 100644 new mode 100755 diff --git a/src/main.c b/src/main.c index 341f820b..e8e6779f 100644 --- a/src/main.c +++ b/src/main.c @@ -70,6 +70,10 @@ static void get_exe_filename(char *buf, int sz) { char exepath[size]; _NSGetExecutablePath(exepath, &size); realpath(exepath, buf); +#elif __amigaos4__ + #include "platform/amigaos4.h" + // TODO: Add code to get the name of the executable + strcpy(buf, _fullpath("PROGDIR:lite")); #else strcpy(buf, "./lite"); #endif diff --git a/src/meson.build b/src/meson.build old mode 100644 new mode 100755 diff --git a/src/platform/amigaos4.c b/src/platform/amigaos4.c new file mode 100644 index 00000000..138110a1 --- /dev/null +++ b/src/platform/amigaos4.c @@ -0,0 +1,49 @@ + +#include +#include +#include + +#include "amigaos4.h" + +// TODO: check if this is set in SDK +#define MAX_PATH_SIZE 255 + +char *_fullpath(const char *path) +{ + //rintf("DBG: _fullpath() %s\n", path); + + if (strcmp(path, ".")) + { + /* + STRPTR appPath = AllocVecTags(sizeof(char) * MAX_PATH_SIZE, + AVT_Type, MEMF_SHARED, + AVT_ClearWithValue, "\0", + TAG_DONE); + */ + char *appPath = malloc(sizeof(char) * MAX_PATH_SIZE); + + BPTR pathLock = Lock(path, SHARED_LOCK); + if (pathLock) + { + //BPTR parentLock = ParentDir(pathLock); + NameFromLock(pathLock, appPath, sizeof(char) * MAX_PATH_SIZE); + + //printf("DBG: apppath %s\n", appPath); + //UnLock(parentLock); + UnLock(pathLock); + + return appPath; + //return "ram:"; + } + //printf("DBG: pathLock failed\n"); + } + + // TODO: Deal with . path + if (!strcmp(path, ".")) + { + //printf("DBG: return app folder\n"); + return "Applications:Programming/workspace/MyProjects/lite-xl_v1.16.12"; + } + + return NULL; +} diff --git a/src/platform/amigaos4.h b/src/platform/amigaos4.h new file mode 100644 index 00000000..0468e25d --- /dev/null +++ b/src/platform/amigaos4.h @@ -0,0 +1,10 @@ +#ifndef _AMIGAOS4_H +#define _AMIGAOS4_H + +#include +#include + +char *_fullpath(const char *); + + +#endif diff --git a/src/rencache.c b/src/rencache.c old mode 100644 new mode 100755 diff --git a/src/rencache.h b/src/rencache.h old mode 100644 new mode 100755 diff --git a/src/renderer.c b/src/renderer.c old mode 100644 new mode 100755 diff --git a/src/renderer.h b/src/renderer.h old mode 100644 new mode 100755 diff --git a/src/renwindow.c b/src/renwindow.c old mode 100644 new mode 100755 diff --git a/src/renwindow.h b/src/renwindow.h old mode 100644 new mode 100755