As shown, a place in the esys tree is reserved to also support LuaJit.
The first addition to the Kindle's Lua resources adds the POSIX module and the bitop module (required by POSIX under Lua, but not under LuaJit).
Both are borrowed from Debian's Jessie build for ARMel (soft float).
Code:
core2quad lua-posix $ tree esys
esys
└── usr
├── lib
│ ├── lua5.1
│ │ ├── bit.so
│ │ └── posix_c.so
│ └── luajit
└── share
├── doc
│ ├── lua-bitop
│ │ ├── changelog.Debian.gz
│ │ └── copyright
│ └── lua-posix
│ ├── changelog.Debian.gz
│ ├── changelog.gz
│ └── copyright
├── lua5.1
│ └── posix.lua
└── luajit
10 directories, 8 files
The second addition to the Kindle's Lua resources adds the PenLight module and the two required modules, lua-expat and lua-filesystem.
The module lua-expat in turn requires the system library libexpat.so, which I am not including in the hope that the one installed on the Kindle is a new enough version.
All are borrowed from Debian's Jessie build for ARMel (soft float).
Code:
core2quad lua-penlight $ tree esys
esys
└── usr
├── lib
│ ├── lua5.1
│ │ ├── lfs.so
│ │ └── lxp.so
│ └── luajit
└── share
├── doc
│ ├── lua-expat
│ │ ├── changelog.Debian.gz
│ │ └── copyright
│ ├── lua-filesystem
│ │ ├── changelog.Debian.gz
│ │ └── copyright
│ └── lua-penlight
│ ├── changelog.Debian.gz
│ └── copyright
├── lua5.1
│ ├── lxp
│ │ └── lom.lua
│ └── pl
│ ├── app.lua
│ ├── array2d.lua
│ ├── class.lua
│ ├── compat.lua
│ ├── comprehension.lua
│ ├── config.lua
│ ├── data.lua
│ ├── Date.lua
│ ├── dir.lua
│ ├── file.lua
│ ├── func.lua
│ ├── import_into.lua
│ ├── init.lua
│ ├── input.lua
│ ├── lapp.lua
│ ├── lexer.lua
│ ├── List.lua
│ ├── luabalanced.lua
│ ├── Map.lua
│ ├── MultiMap.lua
│ ├── operator.lua
│ ├── OrderedMap.lua
│ ├── path.lua
│ ├── permute.lua
│ ├── pretty.lua
│ ├── seq.lua
│ ├── Set.lua
│ ├── sip.lua
│ ├── strict.lua
│ ├── stringio.lua
│ ├── stringx.lua
│ ├── tablex.lua
│ ├── template.lua
│ ├── test.lua
│ ├── text.lua
│ ├── utils.lua
│ └── xml.lua
└── luajit
13 directories, 46 files
One of the additions to the KUAL menu will be a "Debug Helper" sub-menu.
The first helper added to that sub-menu will be buttons to enable and disable the factory debug, search bar, shortcuts.
The buttons for selecting the cpu governor will also be moved there from "Helper+".
With the addition of a cpu controls report button (as requested elsewhere here).
That addition to the KUAL extensions will look like this:
Code:
core2quad Kindle $ tree extensions
extensions
└── DebugHelper
├── bin
│ └── debug-shortcuts.lua
├── config.xml
├── esys.lua
└── menu.json
2 directories, 4 files
Note that the usual KUAL extension layout template has an added file, the file named: esys.lua
That file "hot fixes" the Lua search paths that Lab126's build of Lua screwed up and at the same time, adds our esys paths.
The contents of that file do not need to be changed, it can just be copied as-is to any other button extension implemented in Lua.
BUT
That file can include any strange and wonderful Lua initialization that your button set implementation requires.
To make all of this work, more or less transparently, requires that your Lua script file contain the following first line:
Code:
#!/usr/bin/lua -lesys
-- Whatever you would otherwise write follows
For example:
That first line in the debug-shortcuts.lua script file above will cause the Kindle's, Lab126 build of Lua, to pre-load (and execute) the script named: esys.lua found in the current directory.
When KUAL executes one of these extension buttons, the current working directory is: extensions/DebugHelper.
In other words, the Lua initial configuration file resides right alongside the menu configuration files in each menu extension directory.
Edit 1:
*) Boiler-plate esys.lua file corrected and tested. Works as intended.
*) Added base module tree for POSIX module. Minimal testing - at least it doesn't seg-fault (yeah! Debian).
Edit 2:
*) Tested most functions in the POSIX module.
*) Updated the esys archive to also include lua-filesystem (borrowed from Debian/Jessie)
Edit 3:
*) Split the base modules into two parts (and moved lfs to the second part).
*) Once again, fixed my esys.lua initialization file (I had over-simplified it).
*) Even lxp and lxp.lom are working, so it must be finding the system libexpat.so library 'good enough'.
Edit 4:
*) Reverted to lfs-1.6.2 from lfs-1.6.3 for PenLight support.
There now, that **should** be the basics of handling any Linux text file or application output (some of that stuff in /proc/* and /sys/* is extra funky).
Also with basic support of xml and html i/o.
Lab126 already provided us with json encode/decode.