105 lines
3.3 KiB
Text
105 lines
3.3 KiB
Text
$NetBSD: patch-ag,v 1.3 2006/08/14 22:40:53 wiz Exp $
|
|
|
|
--- mkexports.lua.orig 2003-07-13 21:10:03.000000000 +0000
|
|
+++ mkexports.lua
|
|
@@ -54,7 +54,7 @@ ct2desc={
|
|
["uint"] = "i",
|
|
}
|
|
|
|
-for d, t in desc2ct do
|
|
+for d, t in pairs(desc2ct) do
|
|
ct2desc[t]=d
|
|
end
|
|
|
|
@@ -111,7 +111,7 @@ function sort_classes(cls)
|
|
end
|
|
end
|
|
|
|
- for cls in classes do
|
|
+ for cls in pairs(classes) do
|
|
insert(cls)
|
|
end
|
|
|
|
@@ -375,7 +375,7 @@ static bool %s(%s (*fn)(), ExtlL2Param *
|
|
-- end blockwrite
|
|
|
|
-- Generate type checking code
|
|
- for k, t in info.itypes do
|
|
+ for k, t in pairs(info.itypes) do
|
|
if t~="" then
|
|
fprintf(h, " if(!chko(in, %d, &OBJDESCR(%s))) return FALSE;\n",
|
|
k-1, t)
|
|
@@ -404,7 +404,7 @@ function write_class_fns(h, cls, data)
|
|
fprintf(h, "\n\nstatic ExtlExportedFnSpec %s_exports[] = {\n", cls)
|
|
end
|
|
|
|
- for fn, info in data.fns do
|
|
+ for fn, info in pairs(data.fns) do
|
|
local ods, ids="NULL", "NULL"
|
|
if info.odesc~="v" then
|
|
ods='"' .. info.odesc .. '"'
|
|
@@ -433,7 +433,7 @@ function write_exports(h)
|
|
-- end blockwrite
|
|
|
|
-- Write class infos
|
|
- for c, data in classes do
|
|
+ for c, data in pairs(classes) do
|
|
-- WObj is defined in obj.h which we include.
|
|
if c~="" then
|
|
fprintf(h, "INTROBJ(%s);\n", c)
|
|
@@ -460,16 +460,16 @@ static bool chko(ExtlL2Param *in, int nd
|
|
-- end blockwrite
|
|
|
|
-- Write L2 call handlers
|
|
- for name, info in chnds do
|
|
+ for name, info in pairs(chnds) do
|
|
writechnd(h, name, info)
|
|
end
|
|
|
|
fprintf(h, "\n")
|
|
|
|
- for cls, data in classes do
|
|
+ for cls, data in pairs(classes) do
|
|
if data.fns then
|
|
-- Write function declarations
|
|
- for fn in data.fns do
|
|
+ for fn in pairs(data.fns) do
|
|
fprintf(h, "extern void %s();\n", fn)
|
|
end
|
|
-- Write function table
|
|
@@ -481,7 +481,7 @@ static bool chko(ExtlL2Param *in, int nd
|
|
|
|
local sorted_classes=sort_classes()
|
|
|
|
- for _, cls in sorted_classes do
|
|
+ for _, cls in pairs(sorted_classes) do
|
|
if cls=="" then
|
|
fprintf(h, " if(!extl_register_functions(exports)) return FALSE;\n");
|
|
elseif classes[cls].fns then
|
|
@@ -496,7 +496,7 @@ static bool chko(ExtlL2Param *in, int nd
|
|
fprintf(h, " return TRUE;\n}\n\nvoid %s_unregister_exports()\n{\n",
|
|
module);
|
|
|
|
- for _, cls in sorted_classes do
|
|
+ for _, cls in pairs(sorted_classes) do
|
|
if cls=="" then
|
|
fprintf(h, " extl_unregister_functions(exports);\n");
|
|
elseif classes[cls].fns then
|
|
@@ -569,7 +569,7 @@ function write_fndoc(h, fn, info)
|
|
end
|
|
fprintf(h, "%s(", fn);
|
|
local comma=""
|
|
- for i, varname in info.ivars do
|
|
+ for i, varname in pairs(info.ivars) do
|
|
fprintf(h, comma .. "%s", tohuman(string.sub(info.idesc, i, i),
|
|
info.itypes[i]))
|
|
if varname then
|
|
@@ -676,7 +676,7 @@ if table.getn(inputs)==0 then
|
|
error("No inputs")
|
|
end
|
|
|
|
-for _, ifnam in inputs do
|
|
+for _, ifnam in pairs(inputs) do
|
|
h, err=io.open(ifnam, "r")
|
|
if not h then
|
|
errorf("Could not open %s: %s", ifnam, err)
|