-
Notifications
You must be signed in to change notification settings - Fork 27
/
git2.nobj.lua
119 lines (105 loc) · 2.76 KB
/
git2.nobj.lua
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
108
109
110
111
112
113
114
115
116
117
118
basetype "git_time_t" "integer" "0"
-- really? is this it?
basetype "git_config_level_t" "integer" "0"
c_module "git2" {
-- module settings.
use_globals = false,
hide_meta_info = false, --true,
include "git2.h",
c_source "module_init_src" [[
git_libgit2_init();
]],
doc[[
See <a href="http://libgit2.github.com/libgit2/#HEAD">libgit2 API docs</a>.
]],
-- Error codes
export_definitions {
OK = "GIT_OK",
ERROR = "GIT_ERROR",
ENOTFOUND = "GIT_ENOTFOUND",
EEXISTS = "GIT_EEXISTS",
EAMBIGUOUS = "GIT_EAMBIGUOUS",
EBUFS = "GIT_EBUFS",
PASSTHROUGH = "GIT_PASSTHROUGH",
REVWALKOVER = "GIT_REVWALKOVER",
},
-- reference types
constants {
REF_INVALID = 0, -- Invalid reference */
REF_OID = 1, -- A reference which points at an object id */
REF_SYMBOLIC = 2, -- A reference which points at another reference */
REF_PACKED = 4,
REF_HAS_PEEL = 8,
REF_LISTALL = 0x07, -- GIT_REF_OID|GIT_REF_SYMBOLIC|GIT_REF_PACKED,
},
c_function "version" {
var_out{ "<any>", "ver" },
c_source[[
int major, minor, patch;
git_libgit2_version(&(major), &(minor), &(patch));
/* return version as a table: { major, minor, patch } */
lua_createtable(L, 3, 0);
lua_pushinteger(L, major);
lua_rawseti(L, -2, 1);
lua_pushinteger(L, minor);
lua_rawseti(L, -2, 2);
lua_pushinteger(L, patch);
lua_rawseti(L, -2, 3);
]],
},
subfiles {
"src/strarray.nobj.lua",
"src/error.nobj.lua",
"src/repository.nobj.lua",
"src/config.nobj.lua",
"src/odb_object.nobj.lua",
"src/oid.nobj.lua",
"src/oid_shorten.nobj.lua",
"src/odb.nobj.lua",
"src/odb_backend.nobj.lua",
"src/index.nobj.lua",
"src/index_entry.nobj.lua",
"src/index_entry_unmerged.nobj.lua",
"src/object.nobj.lua",
"src/blob.nobj.lua",
"src/signature.nobj.lua",
"src/commit.nobj.lua",
"src/tree.nobj.lua",
"src/tree_entry.nobj.lua",
"src/tag.nobj.lua",
"src/revwalk.nobj.lua",
"src/reference.nobj.lua",
},
}
--
-- Load parsed libgit2 docs.
--
local json = require"json"
local file = io.open("docs/libgit2.json", "r")
local libgit2_docs = json.decode(file:read("*a"))
file:close()
local lg_funcs = libgit2_docs.functions
-- Copy docs from libgit2
reg_stage_parser("pre_gen",{
c_call = function(self, rec, parent)
local func = lg_funcs[rec.cfunc]
if not func then return end
-- copy C function description
parent:add_record(doc(
'<p>Calls <a href="http://libgit2.github.com/libgit2/#HEAD/group/' ..
func.group .. '/' .. rec.cfunc .. '">' .. rec.cfunc .. '</a>:<p>' ..
'<p>' .. func.comments:gsub("\n\n", "<p>")
))
-- copy C arg description
local var_map = parent.var_map
local args = func.args
for i=1,#args do
local arg = args[i]
local name = arg.name
local var = var_map[name]
if var then
var.desc = arg.comment
end
end
end,
})