make some stylistic changes

self printing isn't really needed now the script is in scripts/.
This will also fix a gcc warning
This commit is contained in:
takase1121 2021-11-06 20:36:33 +08:00
parent d0a54227d8
commit ad58f8898f
No known key found for this signature in database
GPG Key ID: 60EEFFC68EB3031B
1 changed files with 4 additions and 7 deletions

View File

@ -35,7 +35,7 @@ sym_regex='^LUA\(LIB\)\?_API\s\+\([^(]\+\)\s*(\([^)]\+\))\s\+(\([^)]\+\));'
# get funcptr declarations # get funcptr declarations
ptrize() { ptrize() {
grep '^LUA' | grep -v "$IGNORE_SYM" | sed -e "s/$sym_regex/static \2(*\3) (\4);/" grep '^LUA' | grep -v "$IGNORE_SYM" | sed -e "s/$sym_regex/static\t\2(*\3)\t(\4);/"
} }
import_sym() { import_sym() {
@ -66,9 +66,6 @@ decl_export() {
uncomment $1 | onelineize | export_sym uncomment $1 | onelineize | export_sym
} }
print_self() {
cat "$0" | sed -e 's#^#// #'
}
generate_header() { generate_header() {
local LUA_PATH="$1" local LUA_PATH="$1"
@ -85,13 +82,14 @@ generate_header() {
echo "}" echo "}"
echo "In linux, to compile this file, you'd do: 'gcc -o xxxxx.so -shared xxxxx.c'. Simple!" 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 "Due to the way the API is structured, you *should not* link or include lua libraries."
echo "This file was automatically generated by the below code. DO NOT MODIFY DIRECTLY." echo "This file was automatically generated. DO NOT MODIFY DIRECTLY."
echo "**/" echo "**/"
echo echo
print_self
echo echo
echo "#include <stdarg.h>" echo "#include <stdarg.h>"
echo "#include <stdio.h> // for BUFSIZ? this is kinda weird" echo "#include <stdio.h> // for BUFSIZ? this is kinda weird"
echo
echo
cat "$LUA_PATH/luaconf.h" cat "$LUA_PATH/luaconf.h"
decl "$LUA_PATH/lua.h" decl "$LUA_PATH/lua.h"
@ -119,7 +117,6 @@ generate_api_require() {
echo "This file is automatically generated. DO NOT MODIFY." echo "This file is automatically generated. DO NOT MODIFY."
echo "**/" echo "**/"
echo echo
print_self
echo echo
echo "#include <string.h>" echo "#include <string.h>"
echo "#include <stddef.h>" echo "#include <stddef.h>"