First commit of compilable code for OS4

This commit is contained in:
George Sokianos 2021-12-21 17:52:44 +00:00
parent b086db24e8
commit c155f797cf
79 changed files with 125 additions and 3 deletions

0
data/colors/fall.lua Normal file → Executable file
View File

0
data/colors/summer.lua Normal file → Executable file
View File

0
data/core/command.lua Normal file → Executable file
View File

0
data/core/commands/command.lua Normal file → Executable file
View File

0
data/core/commands/core.lua Normal file → Executable file
View File

0
data/core/commands/doc.lua Normal file → Executable file
View File

0
data/core/commands/drawwhitespace.lua Normal file → Executable file
View File

0
data/core/commands/files.lua Normal file → Executable file
View File

0
data/core/commands/findreplace.lua Normal file → Executable file
View File

0
data/core/commands/root.lua Normal file → Executable file
View File

0
data/core/commandview.lua Normal file → Executable file
View File

0
data/core/common.lua Normal file → Executable file
View File

0
data/core/config.lua Normal file → Executable file
View File

0
data/core/doc/highlighter.lua Normal file → Executable file
View File

0
data/core/doc/init.lua Normal file → Executable file
View File

0
data/core/doc/search.lua Normal file → Executable file
View File

0
data/core/doc/translate.lua Normal file → Executable file
View File

0
data/core/docview.lua Normal file → Executable file
View File

View File

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

0
data/core/keymap-macos.lua Normal file → Executable file
View File

0
data/core/keymap.lua Normal file → Executable file
View File

0
data/core/logview.lua Normal file → Executable file
View File

0
data/core/modkeys-generic.lua Normal file → Executable file
View File

0
data/core/modkeys-macos.lua Normal file → Executable file
View File

0
data/core/nagview.lua Normal file → Executable file
View File

0
data/core/object.lua Normal file → Executable file
View File

0
data/core/rootview.lua Normal file → Executable file
View File

0
data/core/start.lua Normal file → Executable file
View File

0
data/core/statusview.lua Normal file → Executable file
View File

0
data/core/strict.lua Normal file → Executable file
View File

0
data/core/style.lua Normal file → Executable file
View File

0
data/core/syntax.lua Normal file → Executable file
View File

0
data/core/titleview.lua Normal file → Executable file
View File

0
data/core/tokenizer.lua Normal file → Executable file
View File

0
data/core/view.lua Normal file → Executable file
View File

0
data/fonts/FiraSans-Regular.ttf Normal file → Executable file
View File

0
data/fonts/JetBrainsMono-Regular.ttf Normal file → Executable file
View File

0
data/fonts/icons.ttf Normal file → Executable file
View File

0
data/plugins/autocomplete.lua Normal file → Executable file
View File

0
data/plugins/autoreload.lua Normal file → Executable file
View File

0
data/plugins/detectindent.lua Normal file → Executable file
View File

0
data/plugins/language_c.lua Normal file → Executable file
View File

0
data/plugins/language_cpp.lua Normal file → Executable file
View File

0
data/plugins/language_css.lua Normal file → Executable file
View File

0
data/plugins/language_html.lua Normal file → Executable file
View File

0
data/plugins/language_js.lua Normal file → Executable file
View File

0
data/plugins/language_lua.lua Normal file → Executable file
View File

0
data/plugins/language_md.lua Normal file → Executable file
View File

0
data/plugins/language_python.lua Normal file → Executable file
View File

0
data/plugins/language_xml.lua Normal file → Executable file
View File

0
data/plugins/macro.lua Normal file → Executable file
View File

0
data/plugins/projectsearch.lua Normal file → Executable file
View File

0
data/plugins/quote.lua Normal file → Executable file
View File

0
data/plugins/reflow.lua Normal file → Executable file
View File

0
data/plugins/tabularize.lua Normal file → Executable file
View File

0
data/plugins/toolbarview.lua Normal file → Executable file
View File

0
data/plugins/treeview.lua Normal file → Executable file
View File

0
data/plugins/trimwhitespace.lua Normal file → Executable file
View File

0
data/plugins/workspace.lua Normal file → Executable file
View File

46
os4build.sh Executable file
View File

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

0
src/api/api.c Normal file → Executable file
View File

0
src/api/api.h Normal file → Executable file
View File

0
src/api/cp_replace.c Normal file → Executable file
View File

0
src/api/renderer.c Normal file → Executable file
View File

0
src/api/renderer_font.c Normal file → Executable file
View File

View File

@ -12,6 +12,10 @@
#include <windows.h>
#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);

0
src/bundle_open.m Normal file → Executable file
View File

0
src/fontdesc.c Normal file → Executable file
View File

0
src/fontdesc.h Normal file → Executable file
View File

View File

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

0
src/meson.build Normal file → Executable file
View File

49
src/platform/amigaos4.c Normal file
View File

@ -0,0 +1,49 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#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;
}

10
src/platform/amigaos4.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef _AMIGAOS4_H
#define _AMIGAOS4_H
#include <proto/dos.h>
#include <proto/exec.h>
char *_fullpath(const char *);
#endif

0
src/rencache.c Normal file → Executable file
View File

0
src/rencache.h Normal file → Executable file
View File

0
src/renderer.c Normal file → Executable file
View File

0
src/renderer.h Normal file → Executable file
View File

0
src/renwindow.c Normal file → Executable file
View File

0
src/renwindow.h Normal file → Executable file
View File