From 801b7dd0d9ce3addb1855a014b792e8feae3d14b Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Thu, 16 Sep 2021 16:22:33 -0400 Subject: [PATCH] Added some comments. --- resources/lite_xl_plugin_api.h | 41 +++++++++++++++++++++++++++++----- src/api/system.c | 4 ++-- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/resources/lite_xl_plugin_api.h b/resources/lite_xl_plugin_api.h index bd2d3dba..ba9b053f 100644 --- a/resources/lite_xl_plugin_api.h +++ b/resources/lite_xl_plugin_api.h @@ -1,13 +1,44 @@ #ifndef LITE_XL_PLUGIN_API #define LITE_XL_PLUGIN_API -/* This file was automatically generated by the below code. Do not modify directly. -#!/bin/sh -# Takes lua folder, outputs a header file that includes all the necessary macros for writing a lite plugin. -# Takes a minimal approach, and strips out problematic functions. Should be good enough for most purposes. +/* +The lite_xl plugin API is quite simple. Any shared library can be a plugin file, so long +as it has an entrypoint that looks like the following, where xxxxx is the plugin name: +#include "lite_xl_plugin_api.h" + +int lua_open_xxxxx(lua_State* L, void* XL) { + lite_xl_plugin_init(XL); + ... + return 1; +} + +In linux, to compile this file, you'd do: 'gcc -o xxxxx.so -shared xxxxx.c'. Simple! +Due to the way the API is structured, you *should not* link or include lua libraries. + +This file was automatically generated by the below code. Do NOT MODIFY DIRECTLY. + + +#!/bin/sh echo "#ifndef LITE_XL_PLUGIN_API" echo "#define LITE_XL_PLUGIN_API" -echo "/* This file was automatically generated by the below code. Do not modify directly." +echo "/* " +echo "The lite_xl plugin API is quite simple. Any shared library can be a plugin file, so long" +echo "as it has an entrypoint that looks like the following, where xxxxx is the plugin name:" +echo +echo '#include "lite_xl_plugin_api.h"' +echo +echo "int lua_open_xxxxx(lua_State* L, void* XL) {" +echo " lite_xl_plugin_init(XL);" +echo " ..." +echo " return 1;" +echo "}" +echo +echo "In linux, to compile this file, you'd do: 'gcc -o xxxxx.so -shared xxxxx.c'. Simple!" +echo "Due to the way the API is structured, you *should not* link or include lua libraries." +echo +echo "This file was automatically generated by the below code. Do NOT MODIFY DIRECTLY." +echo +echo cat $0 echo "*""/" echo "#include " diff --git a/src/api/system.c b/src/api/system.c index 01cf72a7..e5ec18cd 100644 --- a/src/api/system.c +++ b/src/api/system.c @@ -637,8 +637,8 @@ static int f_set_window_opacity(lua_State *L) { return 1; } - - +// Symbol table for native plugin loading. Allows for a statically +// bound lua library to be used by native plugins. typedef struct { const char* symbol; void* address;