Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade header files to Lua 5.4 #1436

Merged
merged 8 commits into from Apr 11, 2023

Conversation

takase1121
Copy link
Member

@takase1121 takase1121 commented Mar 19, 2023

Old header. New Lua. Me compile no work.

Updated the function prototypes, macros and structures to Lua 5.4.
Polyfills for backward compatibility with other Lua versions are removed.
lite_xl_plugin_init is now extern so that dlls with multiple entrypoints (eventually) can use it.

I've tested this new header with cffi-lua and ltreesitter.
No warnings.

Requires #1440.

Almost all of the symbols in this file was from 5.2. This will obviously
not work because some function signatures have changed and some have
completely wrong return values, etc.
This commit updates the header files to Lua 5.4 based on the source code
and changes a few things.
@takase1121
Copy link
Member Author

I haven't exported more symbols from Lite XL side yet. I would do it in another PR. If you want it here, please tell me.

@takase1121 takase1121 requested a review from jgmdev March 20, 2023 01:16
@jgmdev
Copy link
Member

jgmdev commented Apr 7, 2023

Will give this a proper test later with some native plugins and see how it rolls

@jgmdev
Copy link
Member

jgmdev commented Apr 11, 2023

Tested by compiling the thread plugin and got a bunch of errors like this:

FAILED: thread.so.p/src_thread.c.o 
ccache cc -Ithread.so.p -I. -I.. -I../src -I/usr/include/SDL2 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c11 -O3 -fPIC -D_REENTRANT -DSDL_MAIN_HANDLED -MD -MQ thread.so.p/src_thread.c.o -MF thread.so.p/src_thread.c.o.d -o thread.so.p/src_thread.c.o -c ../src/thread.c
In file included from ../src/channel.h:8,
                 from ../src/thread.c:24:
../lite_xl_plugin_api.h:56:42: error: ISO C requires a named argument before ‘...’
   56 |     static ret __lite_xl_fallback_##name(...) { \
      |                                          ^~~
../lite_xl_plugin_api.h:993:1: note: in expansion of macro ‘SYMBOL_DECLARE’
  993 | SYMBOL_DECLARE(lua_State *, lua_newstate, lua_Alloc f, void *ud)
      | ^~~~~~~~~~~~~~
../lite_xl_plugin_api.h:56:42: error: ISO C requires a named argument before ‘...’
   56 |     static ret __lite_xl_fallback_##name(...) { \
      |                                          ^~~
../lite_xl_plugin_api.h:994:1: note: in expansion of macro ‘SYMBOL_DECLARE’
  994 | SYMBOL_DECLARE(void,        lua_close, lua_State *L)
      | ^~~~~~~~~~~~~~
../lite_xl_plugin_api.h:56:42: error: ISO C requires a named argument before ‘...’
   56 |     static ret __lite_xl_fallback_##name(...) { \
      |                                          ^~~
../lite_xl_plugin_api.h:995:1: note: in expansion of macro ‘SYMBOL_DECLARE’
  995 | SYMBOL_DECLARE(lua_State *, lua_newthread, lua_State *L)
      | ^~~~~~~~~~~~~~
../lite_xl_plugin_api.h:56:42: error: ISO C requires a named argument before ‘...’
   56 |     static ret __lite_xl_fallback_##name(...) { \
      |                                          ^~~

@takase1121
Copy link
Member Author

@jgmdev can you retry?

The fix should work on GCC and clang. Not sure about MSVC yet.

Copy link
Member

@jgmdev jgmdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with threads and encodings and now compiled without issues, lets merge this for now, any other fixes can be worked on another PR.

@jgmdev jgmdev merged commit c938241 into lite-xl:master Apr 11, 2023
8 checks passed
takase1121 added a commit to takase1121/lite-xl that referenced this pull request Aug 19, 2023
* refactor(native_api_header): upgrade header files to Lua 5.4.

Almost all of the symbols in this file was from 5.2. This will obviously
not work because some function signatures have changed and some have
completely wrong return values, etc.
This commit updates the header files to Lua 5.4 based on the source code
and changes a few things.

* refactor(plugin_api): move the header into include/

* fix(lite_xl_plugin_api.h): include stdlib to avoid errors with exit

* refactor(lite_xl_plugin_api.h): do not return in SYMBOL_WRAP_CALL

* fix(lite_xl_plugin_api.h): fix wrong way of passing varargs

* fix(lite_xl_plugin_api.h): fix differing lua_rawlen definition

* fix(lite_xl_plugin_api.h): fix fallback function signature

* fix(lite_xl_plugin_api.h): fix conversion from void * to function pointer
takase1121 added a commit to takase1121/lite-xl that referenced this pull request Aug 19, 2023
* refactor(native_api_header): upgrade header files to Lua 5.4.

Almost all of the symbols in this file was from 5.2. This will obviously
not work because some function signatures have changed and some have
completely wrong return values, etc.
This commit updates the header files to Lua 5.4 based on the source code
and changes a few things.

* refactor(plugin_api): move the header into include/

* fix(lite_xl_plugin_api.h): include stdlib to avoid errors with exit

* refactor(lite_xl_plugin_api.h): do not return in SYMBOL_WRAP_CALL

* fix(lite_xl_plugin_api.h): fix wrong way of passing varargs

* fix(lite_xl_plugin_api.h): fix differing lua_rawlen definition

* fix(lite_xl_plugin_api.h): fix fallback function signature

* fix(lite_xl_plugin_api.h): fix conversion from void * to function pointer
takase1121 added a commit to takase1121/lite-xl that referenced this pull request Aug 19, 2023
* refactor(native_api_header): upgrade header files to Lua 5.4.

Almost all of the symbols in this file was from 5.2. This will obviously
not work because some function signatures have changed and some have
completely wrong return values, etc.
This commit updates the header files to Lua 5.4 based on the source code
and changes a few things.

* refactor(plugin_api): move the header into include/

* fix(lite_xl_plugin_api.h): include stdlib to avoid errors with exit

* refactor(lite_xl_plugin_api.h): do not return in SYMBOL_WRAP_CALL

* fix(lite_xl_plugin_api.h): fix wrong way of passing varargs

* fix(lite_xl_plugin_api.h): fix differing lua_rawlen definition

* fix(lite_xl_plugin_api.h): fix fallback function signature

* fix(lite_xl_plugin_api.h): fix conversion from void * to function pointer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants