aboutsummaryrefslogtreecommitdiff
path: root/luatoc.sh
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-06-05 12:27:13 (GMT)
committerPavel Labath <pavelo@centrum.sk>2011-11-01 09:52:46 (GMT)
commitfc21fd822e527dbd918c6565e0e2cea82b0466f4 (patch)
treeb658bf437fafb80d39986c77caebcaf608761964 /luatoc.sh
parente3fabc4cd47ac5479bca421a4d7b79c0c2d9e120 (diff)
downloadfluxbox_pavel-fc21fd822e527dbd918c6565e0e2cea82b0466f4.zip
fluxbox_pavel-fc21fd822e527dbd918c6565e0e2cea82b0466f4.tar.bz2
A rough version of resource implementation in lua
I added a new class, LResourceManager, which should handle loading and saving of resources like the old ResourceManager, only it does that with the help of lua. I moved the common features of the two managers (interface + a few functions) to a common base class ResourceManager_base. I augmented the Resource_base class with two new functions (setFromLua and pushToLua) which are used by the lua RM instead of getString and setFromString. Parts of the new RM are written in lua. To avoid loading scripts from a file at runtime I decided to link compiled lua code straight into the executable. For this purpose I created a small script which converts a binary file into a declaration of a C array of bytes.
Diffstat (limited to 'luatoc.sh')
-rwxr-xr-xluatoc.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/luatoc.sh b/luatoc.sh
new file mode 100755
index 0000000..cd6a231
--- /dev/null
+++ b/luatoc.sh
@@ -0,0 +1,14 @@
1if [ $# -ne 3 ]; then
2 echo "Usage: `basename $0` <input file> <output file> <variable name>"
3 exit 1
4fi
5
6{
7 echo "extern const char $3[] = {"
8 od --format=x1 --output-duplicates $1 \
9 | cut --delimiter=' ' --fields=2- --only-delimited \
10 | sed -e 's/^/ /' -e 's/\>/,/g' -e 's/\</0x/g'
11 echo "};"
12 echo
13 echo "extern const unsigned int $3_size = sizeof $3;"
14} > $2