projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Reinstate some lost functions.
[apps/madmutt.git]
/
tools
/
cpkg2c.mll
diff --git
a/tools/cpkg2c.mll
b/tools/cpkg2c.mll
index
0eccf47
..
8355199
100644
(file)
--- a/
tools/cpkg2c.mll
+++ b/
tools/cpkg2c.mll
@@
-22,11
+22,8
@@
module H = Hashtbl
module B = Buffer
module H = Hashtbl
module B = Buffer
- type 'a anchor = ('a * string * int)
-
+ type 'a anchor = ('a * string * int)
let t1 (a, _, _) = a
let t1 (a, _, _) = a
- let t2 (_, a, _) = a
- let t3 (_, _, a) = a
let die lpos fpos s =
output_string stderr (sprintf "%s:%d: %s\n" fpos lpos s);
let die lpos fpos s =
output_string stderr (sprintf "%s:%d: %s\n" fpos lpos s);
@@
-160,7
+157,6
@@
let sp = [' ''\t']
let typdecl = sp* ("const" sp+)? ident sp*
(* }}} *)
let typdecl = sp* ("const" sp+)? ident sp*
(* }}} *)
-
(* entry point {{{ *)
rule cLine lpos fpos buf = parse
(* entry point {{{ *)
rule cLine lpos fpos buf = parse
@@
-332,6
+328,8
@@
and ext_bodycode buf = parse
(* }}} *)
{
(* }}} *)
{
+(* templating functions {{{ *)
+
let upper = String.uppercase
let tplize tpl v =
Str.global_replace (Str.regexp_string "$L") "L" (
let upper = String.uppercase
let tplize tpl v =
Str.global_replace (Str.regexp_string "$L") "L" (
@@
-526,7
+524,7
@@
int luaopen_%s(lua_State *L)
luaL_newmetatable(L, \"%s\");
mt = lua_gettop(L);
luaL_newmetatable(L, \"%s\");
mt = lua_gettop(L);
- lua_pushliteral(L, \"
%s
\");
+ lua_pushliteral(L, \"
__index
\");
lua_pushvalue(L, mt); /* upvalue 1 */
lua_pushvalue(L, methods); /* upvalue 2 */
lua_pushcclosure(L, &luaM_%s_index, 2);
lua_pushvalue(L, mt); /* upvalue 1 */
lua_pushvalue(L, methods); /* upvalue 2 */
lua_pushcclosure(L, &luaM_%s_index, 2);
@@
-543,13
+541,15
@@
int luaopen_%s(lua_State *L)
lua_setmetatable(L, methods);
lua_setmetatable(L, methods);
- lua_pop(L,
1); /* drop mt
*/
- return 1;
/* return methods */
+ lua_pop(L,
2); /* drop mt + methods
*/
+ return 1;
}
")
in List.iter do_c_aux
}
")
in List.iter do_c_aux
+(* }}} *)
+
let usage () =
output_string stderr "usage: cpkg2c (-h | -c) file.cpkg\n";
exit 1
let usage () =
output_string stderr "usage: cpkg2c (-h | -c) file.cpkg\n";
exit 1