Skip to content

Commit

Permalink
Wax 0.9-3
Browse files Browse the repository at this point in the history
* Adds wax.os.setenv()
* Adds wax.lazy() - for modules with lazy loadable functions
* Project tree changed to accomodate C sources and Lua
  files under the same directory
* Adds support for C functions as submodules inside project
* Changed the module configuration file format (etc/config.lua)
* Adds SPDX tag across the project
* Docs for wax C helper headers
  • Loading branch information
arkt8 committed Jun 21, 2023
1 parent 7ee5bfa commit 54cd162
Show file tree
Hide file tree
Showing 76 changed files with 6,130 additions and 4,687 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/lua
/lua_modules
/.luarocks
/wax
/out
/tree
**/*.o
Expand Down
683 changes: 661 additions & 22 deletions LICENSE

Large diffs are not rendered by default.

15 changes: 14 additions & 1 deletion contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@ with `--{` and `--}`

Use `./test/wax/json.lua` as reference.

For C code, basically documenting for extraction purposes are only needed on
the files under `src/w` folder. In this case, every comment is under multiline
comment in this way:

```
/*
//## This is a H2
//| This is the content
//$ void funsignature(lua_State *L)
*/
```




## Testing code
Expand Down Expand Up @@ -93,4 +106,4 @@ accostumed with other languages while also keeping code short for use in
different screens, from mobile to desktop and easy to open side by side in
different editors leaving to reader to choose how many spaces a indentation
level should be presented.
4 changes: 2 additions & 2 deletions doc/w8l.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ that it is a explanation on a prefix.
###### `waxL_export(lua_State *L, char *name, luaL_Reg *register)`

Register module functions.
- Lua 5.1 : `luaL_register`
- Lua 5.2+: `luaL_newlib`
- Lua 5.1 : `luaL_register`
- Lua 5.2+: `luaL_newlib`


###### `waxL_assert(lua_State *L, condition, char *msg)`
Expand Down
81 changes: 47 additions & 34 deletions etc/config.lua
Original file line number Diff line number Diff line change
@@ -1,40 +1,53 @@
-- SPDX-License-Identifier: AGPL-3.0-or-later
-- Copyright 2022-2023 - Thadeu de Paula and contributors

rockspec = 'wax-latest-1.rockspec'


bin = { }
modules = {
['wax'] = {
init = 'wax/init.lua',
args = 'wax/args.lua',
lazy = 'wax/lazy.lua',
compat = 'wax/compat.lua',
html = 'wax/html.lua',
table = 'wax/table.lua',
template = 'wax/template.lua',
was = 'wax/was.lua',
},

-- clib paths have are relative to `./src/`
-- ./src/ext - External dependencies (from other projects)
-- ./src/lib - The C code containing the Lua C Api logic
-- ./src/macros
clib = {
{
mod = "wax.csv",
src = { "csv.c" }
},
{
mod = "wax.fs",
src = { "fs.c" }
},
{
mod = "wax.json",
src = { "ext/json/cJSON.c", "json.c" }
},
{
mod = "wax.os",
src = { "os.c" }
},
{
mod = "wax.sql",
src = {"sql.c"},
lflags = "-lsqlite3"
},
{
mod = "wax.user",
src = { "user.c" }
},
}
cbin = {
-- {'target', 'code.c' }
['wax.csv'] = {
init = 'csv/init.lua',
initc = 'csv/init.c',
},

['wax.fs'] = {
init = 'fs/init.lua',
initc = 'fs/init.c',
},

['wax.json'] = {
init = 'json/init.lua',
initc = { 'json/_cjson/cJSON.c', 'json/init.c' },
},

['wax.os'] = {
init = 'os/init.lua',
initc = 'os/init.c',
},

['wax.sql'] = {
init = 'sql/init.lua',
initc = {'sql/init.c', lflags='-lsqlite3'}
},

['wax.user'] = {
init = 'user/init.lua',
initc = 'user/init.c'
}
}


cbin = { --[[{'target', 'code.c' }]] }

bin = { }
30 changes: 15 additions & 15 deletions etc/docker/luawax_debian.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ ARG LR_VERSION=luarocks-3.9.0

RUN apt-get -y update;
RUN apt-get -y --no-install-recommends install \
ncurses-bin \
lua5.1 liblua5.1-0-dev \
lua5.2 liblua5.2-dev \
lua5.3 liblua5.3-dev \
lua5.4 liblua5.4-dev \
luajit libluajit-5.1-dev \
curl ca-certificates \
build-essential libreadline-dev unzip gcc;
ncurses-bin \
lua5.1 liblua5.1-0-dev \
lua5.2 liblua5.2-dev \
lua5.3 liblua5.3-dev \
lua5.4 liblua5.4-dev \
luajit libluajit-5.1-dev \
curl ca-certificates \
build-essential libreadline-dev unzip gcc;

RUN curl \
"https://luarocks.github.io/luarocks/releases/$LR_VERSION.tar.gz" > /tmp/lr.tgz \
&& cd /tmp \
&& tar zxvf /tmp/lr.tgz \
&& cd $LR_VERSION && ./configure && make install
"https://luarocks.github.io/luarocks/releases/$LR_VERSION.tar.gz" > /tmp/lr.tgz \
&& cd /tmp \
&& tar zxvf /tmp/lr.tgz \
&& cd $LR_VERSION && ./configure && make install

RUN adduser \
--home /home/testuser \
--disabled-password \
--uid 2000 testuser;
--home /home/testuser \
--disabled-password \
--uid 2000 testuser;
20 changes: 10 additions & 10 deletions etc/example/template.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
hello!
]]
local stars = {
['Altair' ] = 'Aquila',
['Regulus'] = 'Leo',
['Pollux' ] = 'Gemini',
['Spica' ] = 'Virgo',
['Tupã' ] = 'Crux',
['Altair' ] = 'Aquila',
['Regulus'] = 'Leo',
['Pollux' ] = 'Gemini',
['Spica' ] = 'Virgo',
['Tupã' ] = 'Crux',
}

for i,v in ipairs(data) do
if stars[v] then
--[[{{v}} is a star on {{stars[v]}}]]
else
--[[{{v}} was not found in data]]
end
if stars[v] then
--[[{{v}} is a star on {{stars[v]}}]]
else
--[[{{v}} was not found in data]]
end
end
24 changes: 24 additions & 0 deletions etc/howlcfg.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
-- SPDX-License-Identifier: AGPL-3.0-or-later
-- Copyright 2022-2023 - Thadeu de Paula and contributors

howl_index = {
{doc='intro', src='/doc/intro.md'},
{doc='wax_arg', src='test/wax/arg.lua'},
{doc='wax_csv', src='test/wax/csv.lua'},
{doc='wax_fs', src='test/wax/fs.lua'},
{doc='wax_html', src='test/wax/html.lua'},
{doc='wax_json', src='test/wax/json.lua'},
{doc='wax_os', src='test/wax/os.lua'},
{doc='wax_sql', src='test/wax/sql.lua'},
{doc='wax_table', src='test/wax/table.lua'},
{doc='wax_template', src='test/wax/template.lua'},
{doc='wax_user', src='test/wax/user.lua'},

{doc='clib_wax', src='doc/lib_cool.md'},
{doc='clib_wax_arr', src='src/wax/arr.h'},

{doc='clib_wax_lua', src='src/wax/lua.h'}
}



52 changes: 26 additions & 26 deletions etc/rockspec/wax-0.9-1.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,42 @@ package = "wax"
version = "0.9-1"

source = {
url = "git+https://github.com/waxlab/wax",
tag = "v0.9-1"
url = "git+https://github.com/waxlab/wax",
tag = "v0.9-1"
}

description = {
homepage = "https://codeberg.org/waxlab/wax",
license = "MIT",
summary = "A crescent Lua library",
maintainer = "Thadeu de Paula",
detailed = "An alternative extension to Lua standard library",
homepage = "https://codeberg.org/waxlab/wax",
license = "MIT",
summary = "A crescent Lua library",
maintainer = "Thadeu A. C. de Paula",
detailed = "An alternative extension to Lua standard library",
}

dependencies = { "lua >= 5.1, < 5.5" }

local build_vars
= 'ROCKVER="'..version..'" '
..'CC="$(CC)" '
..'LD="$(LD)" '
..'CFLAGS="$(CFLAGS)" '
..'LIBFLAG="$(LIBFLAG)" '
..'LUA_BINDIR="$(LUA_BINDIR)" '
..'LUA_INCDIR="$(LUA_INCDIR)" '
..'OBJ_EXTENSION="$(OBJ_EXTENSION)" '
..'LIB_EXTENSION="$(LIB_EXTENSION)" '
..'LUA="$(LUA)" '
= 'ROCKVER="'..version..'" '
..'CC="$(CC)" '
..'LD="$(LD)" '
..'CFLAGS="$(CFLAGS)" '
..'LIBFLAG="$(LIBFLAG)" '
..'LUA_BINDIR="$(LUA_BINDIR)" '
..'LUA_INCDIR="$(LUA_INCDIR)" '
..'OBJ_EXTENSION="$(OBJ_EXTENSION)" '
..'LIB_EXTENSION="$(LIB_EXTENSION)" '
..'LUA="$(LUA)" '

local install_vars
= 'ROCKVER="'..version..'" '
..'INST_PREFIX="$(PREFIX)" '
..'INST_BINDIR="$(BINDIR)" '
..'INST_LIBDIR="$(LIBDIR)" '
..'INST_LUADIR="$(LUADIR)" '
..'INST_CONFDIR="$(CONFDIR)" '
= 'ROCKVER="'..version..'" '
..'INST_PREFIX="$(PREFIX)" '
..'INST_BINDIR="$(BINDIR)" '
..'INST_LIBDIR="$(LIBDIR)" '
..'INST_LUADIR="$(LUADIR)" '
..'INST_CONFDIR="$(CONFDIR)" '

build = {
type = 'command',
build_command = build_vars .. '$(LUA) etc/run/make.lua build',
install_command = install_vars .. '$(LUA) etc/run/make.lua install',
type = 'command',
build_command = build_vars .. '$(LUA) etc/run/make.lua build',
install_command = install_vars .. '$(LUA) etc/run/make.lua install',
}
52 changes: 26 additions & 26 deletions etc/rockspec/wax-0.9-2.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,42 @@ package = "wax"
version = "0.9-2"

source = {
url = "git+https://github.com/waxlab/wax",
tag = "v0.9-2"
url = "git+https://github.com/waxlab/wax",
tag = "v0.9-2"
}

description = {
homepage = "https://codeberg.org/waxlab/wax",
license = "MIT",
summary = "A crescent Lua library",
maintainer = "Thadeu de Paula",
detailed = "An alternative extension to Lua standard library",
homepage = "https://codeberg.org/waxlab/wax",
license = "MIT",
summary = "A crescent Lua library",
maintainer = "Thadeu A. C. de Paula",
detailed = "An alternative extension to Lua standard library",
}

dependencies = { "lua >= 5.1, < 5.5" }

local build_vars
= 'ROCKVER="'..version..'" '
..'CC="$(CC)" '
..'LD="$(LD)" '
..'CFLAGS="$(CFLAGS)" '
..'LIBFLAG="$(LIBFLAG)" '
..'LUA_BINDIR="$(LUA_BINDIR)" '
..'LUA_INCDIR="$(LUA_INCDIR)" '
..'OBJ_EXTENSION="$(OBJ_EXTENSION)" '
..'LIB_EXTENSION="$(LIB_EXTENSION)" '
..'LUA="$(LUA)" '
= 'ROCKVER="'..version..'" '
..'CC="$(CC)" '
..'LD="$(LD)" '
..'CFLAGS="$(CFLAGS)" '
..'LIBFLAG="$(LIBFLAG)" '
..'LUA_BINDIR="$(LUA_BINDIR)" '
..'LUA_INCDIR="$(LUA_INCDIR)" '
..'OBJ_EXTENSION="$(OBJ_EXTENSION)" '
..'LIB_EXTENSION="$(LIB_EXTENSION)" '
..'LUA="$(LUA)" '

local install_vars
= 'ROCKVER="'..version..'" '
..'INST_PREFIX="$(PREFIX)" '
..'INST_BINDIR="$(BINDIR)" '
..'INST_LIBDIR="$(LIBDIR)" '
..'INST_LUADIR="$(LUADIR)" '
..'INST_CONFDIR="$(CONFDIR)" '
= 'ROCKVER="'..version..'" '
..'INST_PREFIX="$(PREFIX)" '
..'INST_BINDIR="$(BINDIR)" '
..'INST_LIBDIR="$(LIBDIR)" '
..'INST_LUADIR="$(LUADIR)" '
..'INST_CONFDIR="$(CONFDIR)" '

build = {
type = 'command',
build_command = build_vars .. '$(LUA) etc/run/make.lua build',
install_command = install_vars .. '$(LUA) etc/run/make.lua install',
type = 'command',
build_command = build_vars .. '$(LUA) etc/run/make.lua build',
install_command = install_vars .. '$(LUA) etc/run/make.lua install',
}
Loading

0 comments on commit 54cd162

Please sign in to comment.