-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmkdoc.bas
59 lines (49 loc) · 1.22 KB
/
mkdoc.bas
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
rem
rem generate api methods from api.json
rem
tload "api.json", s, 1
api = array(s)
func get_signature(method)
local result
if (method.rtn == "void") then
result = "void"
else if (method.rtn == "boolean" || method.rtn == "int") then
result = "int"
else if (method.rtn == "float") then
result = "float"
endif
result += " " + method.name + "("
if (method.signature != 0) then
result += method.signature
else if (method.arg == "void") then
result += "void"
else if (method.arg == "boolean" || method.arg == "int") then
result += "int"
else if (method.arg == "float") then
result += "float"
endif
result += ")"
return result
end
print "# IOIO for SmallBASIC"
print
print "see: https://github.com/ytai/ioio/wiki"
print
for obj in api
print "## " + obj.name
print
print obj.comment
if (obj.name != "IOIO") then
print
signature = "(pin)"
if (obj.signature) then signature = "(" + obj.signature + ")"
print "`io = ioio.open" + obj.name + signature + "`"
endif
print ""
print "| Name | Description |"
print "|---------|---------------|"
for method in obj.methods
print "|" + get_signature(method) + "|" + method.comment + "|"
next
print
next