From 4a5d6540e36a3e05ed7d53b4079b9f9605a012ed Mon Sep 17 00:00:00 2001 From: Hugo Musso Gualandi Date: Fri, 9 Aug 2024 19:26:52 -0300 Subject: [PATCH 1/2] Remove trailing whitespace --- spec/tracebacks/anon_lua/module.c | 10 +++++----- spec/tracebacks/depth_recursion/module.c | 14 +++++++------- spec/tracebacks/dispatch/module.c | 10 +++++----- spec/tracebacks/ellipsis/module.c | 10 +++++----- spec/tracebacks/multimod/module_a.c | 6 +++--- spec/tracebacks/multimod/module_b.c | 4 ++-- spec/tracebacks/multimod/module_include.h | 2 +- spec/tracebacks/singular/module.c | 6 +++--- 8 files changed, 31 insertions(+), 31 deletions(-) diff --git a/spec/tracebacks/anon_lua/module.c b/spec/tracebacks/anon_lua/module.c index 75d0a37..1a392a8 100644 --- a/spec/tracebacks/anon_lua/module.c +++ b/spec/tracebacks/anon_lua/module.c @@ -1,8 +1,8 @@ -/* +/* * Copyright (c) 2024, The Pallene Developers * Pallene Tracer is licensed under the MIT license. * Please refer to the LICENSE and AUTHORS files for details - * SPDX-License-Identifier: MIT + * SPDX-License-Identifier: MIT */ /* Static use of the library would suffice. */ @@ -15,7 +15,7 @@ pt_fnstack_t *fnstack = lua_touserdata(L, \ lua_upvalueindex(1)) #else -#define MODULE_GET_FNSTACK +#define MODULE_GET_FNSTACK #endif // PT_DEBUG /* ---------------- LUA INTERFACE FUNCTIONS ---------------- */ @@ -71,10 +71,10 @@ int module_fn_1_lua(lua_State *L) { /* In Lua interface frames, we always have a finalizer object pushed to the stack by `FIB_LUA_FRAMEENTER()`. */ - if(luai_unlikely(top < 1)) + if(luai_unlikely(top < 1)) luaL_error(L, "Expected atleast 1 parameters"); - if(luai_unlikely(lua_isfunction(L, 1) == 0)) + if(luai_unlikely(lua_isfunction(L, 1) == 0)) luaL_error(L, "Expected parameter 1 to be a function"); /* Now dispatch to an actual C function. */ diff --git a/spec/tracebacks/depth_recursion/module.c b/spec/tracebacks/depth_recursion/module.c index 73901cb..4e162a2 100644 --- a/spec/tracebacks/depth_recursion/module.c +++ b/spec/tracebacks/depth_recursion/module.c @@ -1,8 +1,8 @@ -/* +/* * Copyright (c) 2024, The Pallene Developers * Pallene Tracer is licensed under the MIT license. * Please refer to the LICENSE and AUTHORS files for details - * SPDX-License-Identifier: MIT + * SPDX-License-Identifier: MIT */ /* Static use of the library would suffice. */ @@ -15,7 +15,7 @@ pt_fnstack_t *fnstack = lua_touserdata(L, \ lua_upvalueindex(1)) #else -#define MODULE_GET_FNSTACK +#define MODULE_GET_FNSTACK #endif // PT_DEBUG /* ---------------- LUA INTERFACE FUNCTIONS ---------------- */ @@ -46,7 +46,7 @@ void module_fn(lua_State *L, int depth) { lua_pushvalue(L, 1); - if(depth == 0) + if(depth == 0) lua_pushinteger(L, depth); else lua_pushinteger(L, depth - 1); @@ -63,14 +63,14 @@ int module_fn_lua(lua_State *L) { MODULE_LUA_FRAMEENTER(module_fn_lua); /* Look at the macro definitions. */ - if(luai_unlikely(top < 2)) + if(luai_unlikely(top < 2)) luaL_error(L, "Expected atleast 2 parameters"); /* ---- `lua_fn` ---- */ - if(luai_unlikely(lua_isfunction(L, 1) == 0)) + if(luai_unlikely(lua_isfunction(L, 1) == 0)) luaL_error(L, "Expected the first parameter to be a function"); - if(luai_unlikely(lua_isinteger(L, 2) == 0)) + if(luai_unlikely(lua_isinteger(L, 2) == 0)) luaL_error(L, "Expected the second parameter to be an integer"); int depth = lua_tointeger(L, 2); diff --git a/spec/tracebacks/dispatch/module.c b/spec/tracebacks/dispatch/module.c index c14317b..7e97ea6 100644 --- a/spec/tracebacks/dispatch/module.c +++ b/spec/tracebacks/dispatch/module.c @@ -1,8 +1,8 @@ -/* +/* * Copyright (c) 2024, The Pallene Developers * Pallene Tracer is licensed under the MIT license. * Please refer to the LICENSE and AUTHORS files for details - * SPDX-License-Identifier: MIT + * SPDX-License-Identifier: MIT */ /* Static use of the library would suffice. */ @@ -15,7 +15,7 @@ pt_fnstack_t *fnstack = lua_touserdata(L, \ lua_upvalueindex(1)) #else -#define MODULE_GET_FNSTACK +#define MODULE_GET_FNSTACK #endif // PT_DEBUG /* ---------------- LUA INTERFACE FUNCTIONS ---------------- */ @@ -71,10 +71,10 @@ int module_fn_1_lua(lua_State *L) { /* In Lua interface frames, we always have a finalizer object pushed to the stack by `FIB_LUA_FRAMEENTER()`. */ - if(luai_unlikely(top < 1)) + if(luai_unlikely(top < 1)) luaL_error(L, "Expected atleast 1 parameters"); - if(luai_unlikely(lua_isfunction(L, 1) == 0)) + if(luai_unlikely(lua_isfunction(L, 1) == 0)) luaL_error(L, "Expected parameter 1 to be a function"); /* Now dispatch to an actual C function. */ diff --git a/spec/tracebacks/ellipsis/module.c b/spec/tracebacks/ellipsis/module.c index 6dcbcf5..1fb42d3 100644 --- a/spec/tracebacks/ellipsis/module.c +++ b/spec/tracebacks/ellipsis/module.c @@ -1,8 +1,8 @@ -/* +/* * Copyright (c) 2024, The Pallene Developers * Pallene Tracer is licensed under the MIT license. * Please refer to the LICENSE and AUTHORS files for details - * SPDX-License-Identifier: MIT + * SPDX-License-Identifier: MIT */ /* Static use of the library would suffice. */ @@ -15,7 +15,7 @@ pt_fnstack_t *fnstack = lua_touserdata(L, \ lua_upvalueindex(1)) #else -#define MODULE_GET_FNSTACK +#define MODULE_GET_FNSTACK #endif // PT_DEBUG /* ---------------- LUA INTERFACE FUNCTIONS ---------------- */ @@ -59,11 +59,11 @@ int module_fn_lua(lua_State *L) { MODULE_LUA_FRAMEENTER(module_fn_lua); /* Look at the macro definitions. */ - if(luai_unlikely(top < 1)) + if(luai_unlikely(top < 1)) luaL_error(L, "Expected atleast 1 parameters"); /* ---- `lua_fn` ---- */ - if(luai_unlikely(lua_isfunction(L, 1) == 0)) + if(luai_unlikely(lua_isfunction(L, 1) == 0)) luaL_error(L, "Expected the first parameter to be a function"); /* Dispatch. */ diff --git a/spec/tracebacks/multimod/module_a.c b/spec/tracebacks/multimod/module_a.c index 7b09776..6417b3e 100644 --- a/spec/tracebacks/multimod/module_a.c +++ b/spec/tracebacks/multimod/module_a.c @@ -1,8 +1,8 @@ -/* +/* * Copyright (c) 2024, The Pallene Developers * Pallene Tracer is licensed under the MIT license. * Please refer to the LICENSE and AUTHORS files for details - * SPDX-License-Identifier: MIT + * SPDX-License-Identifier: MIT */ #define PT_IMPLEMENTATION @@ -29,7 +29,7 @@ int some_mod_fn_lua(lua_State *L) { MODULE_LUA_FRAMEENTER(some_mod_fn_lua); /* Look at the macro definition. */ - if(luai_unlikely(top < 1)) + if(luai_unlikely(top < 1)) luaL_error(L, "Expected atleast 1 argument"); if(luai_unlikely(lua_isfunction(L, 1) == 0)) diff --git a/spec/tracebacks/multimod/module_b.c b/spec/tracebacks/multimod/module_b.c index cdbd15f..7729bca 100644 --- a/spec/tracebacks/multimod/module_b.c +++ b/spec/tracebacks/multimod/module_b.c @@ -1,8 +1,8 @@ -/* +/* * Copyright (c) 2024, The Pallene Developers * Pallene Tracer is licensed under the MIT license. * Please refer to the LICENSE and AUTHORS files for details - * SPDX-License-Identifier: MIT + * SPDX-License-Identifier: MIT */ #define PT_IMPLEMENTATION diff --git a/spec/tracebacks/multimod/module_include.h b/spec/tracebacks/multimod/module_include.h index 89f4fd7..641a754 100644 --- a/spec/tracebacks/multimod/module_include.h +++ b/spec/tracebacks/multimod/module_include.h @@ -7,7 +7,7 @@ pt_fnstack_t *fnstack = lua_touserdata(L, \ lua_upvalueindex(1)) #else -#define MODULE_GET_FNSTACK +#define MODULE_GET_FNSTACK #endif // PT_DEBUG /* ---------------- LUA INTERFACE FUNCTIONS ---------------- */ diff --git a/spec/tracebacks/singular/module.c b/spec/tracebacks/singular/module.c index 164e374..454faf6 100644 --- a/spec/tracebacks/singular/module.c +++ b/spec/tracebacks/singular/module.c @@ -1,8 +1,8 @@ -/* +/* * Copyright (c) 2024, The Pallene Developers * Pallene Tracer is licensed under the MIT license. * Please refer to the LICENSE and AUTHORS files for details - * SPDX-License-Identifier: MIT + * SPDX-License-Identifier: MIT */ /* Static use of the library would suffice. */ @@ -15,7 +15,7 @@ pt_fnstack_t *fnstack = lua_touserdata(L, \ lua_upvalueindex(1)) #else -#define MODULE_GET_FNSTACK +#define MODULE_GET_FNSTACK #endif // PT_DEBUG /* ---------------- FOR C INTERFACE FUNCTIONS ---------------- */ From 98783f6947a4b67eea119013e87d4234190fb2a0 Mon Sep 17 00:00:00 2001 From: Hugo Musso Gualandi Date: Fri, 9 Aug 2024 19:28:04 -0300 Subject: [PATCH 2/2] Add editorconfig, to prevent future whitespace problems TODO: add CONTRIBUTING documentation explaining how to use it, or link to the documentation from the Pallene repository. Fixes #16 --- .editorconfig | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..8c890ce --- /dev/null +++ b/.editorconfig @@ -0,0 +1,24 @@ +# EditorConfig is awesome: http://EditorConfig.org +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 100 + +[spec/translator_spec.lua] +trim_trailing_whitespace = false + +[*.md] +max_line_length = off + +[{Makefile,makefile}] +indent_style = tab +indent_size = 8 + +[COMMIT_EDITMSG] +max_line_length=72