This repository has been archived by the owner on Nov 20, 2020. It is now read-only.
forked from luaposix/luaposix
-
Notifications
You must be signed in to change notification settings - Fork 3
/
README
107 lines (67 loc) · 3.12 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
luaposix
--------
https://github.com/luaposix/luaposix
luaposix is a POSIX binding, including curses, for Lua 5.1 and 5.2;
like most libraries it simply binds to C APIs on the underlying
system, so it won't work on a non-POSIX system. However, it does try
to detect the level of POSIX conformance of the underlying system and
bind only available APIs.
luaposix is released under the MIT license, like Lua (see COPYING;
it's basically the same as the BSD license). There is no warranty.
Please report bugs and make suggestions by opening an issue on the
github tracker.
Installation
------------
With Lua 5.1, luaposix requires the bitop library from http://bitop.luajit.org/
(On Lua 5.2 it will work whether bitop is installed or not.)
luaposix uses the GNU build system. For detailed instructions, see
INSTALL. For a quick start:
[If using git sources:
./bootstrap
]
./configure && make [&& make install]
You may need to supply non-default paths (e.g. if you are using a
system that supports more than one version of Lua):
For example, on Debian or Ubuntu:
CPPFLAGS='-I/usr/include/lua5.1' ./configure --libdir=/usr/local/lib/lua/5.1 --datadir=/usr/local/share/lua/5.1 --with-lua-suffix=5.1
To run some tests:
make check
lunit is required for some of the tests. For a version of lunit that
works with Lua 5.2, see: https://github.com/dcurrie/lunit.git
Use
---
The library is split into two modules. The basic POSIX APIs are in
"posix"; the curses APIs in "curses".
There is HTML documentation; to obtain it, run:
make doc
The posix module documentation requires LDoc, from
https://github.com/stevedonovan/LDoc
It includes links to online man pages. All the HTML documentation is
online at:
http://luaposix.github.com/luaposix/
You can find an authoritative online POSIX reference at:
http://www.opengroup.org/onlinepubs/007904875/toc.htm
Example code
------------
See the example program tree.lua, along with the tests in
tests-*.lua.
For a complete application, see the lua branch of GNU Zile's (a
cut-down Emacs clone) git repository at:
http://git.savannah.gnu.org/cgit/zile.git/log/?h=lua
Bugs reports & patches
----------------------
Bug reports and patches are most welcome. Please use the github issue
tracker (see URL at top). There is no strict coding style, but please
bear in mind the following points when writing new code:
0. Follow existing code. There are a lot of useful patterns and
avoided traps there.
1. 8-character indentation using TABs. Not my favourite either, but
better than reformatting the code and losing much of the ability to
follow the version control history.
2. No non-POSIX APIs; no platform-specific code. When wrapping APIs
introduced in POSIX 2001 or later, add an appropriate #if. If your
platform isn't quite POSIX, you may find a gnulib module to bridge
the gap. If absolutely necessary, use autoconf feature tests.
3. Thin wrappers: although some existing code contradicts this, wrap
POSIX APIs in the simplest way possible. If necessary, more
convenient wrappers can be added in Lua (posix.lua).