-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathffi_reflect.html
118 lines (108 loc) · 5.5 KB
/
ffi_reflect.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title> ffi_reflect - luajit ffi reflection </title>
<script src="jquery.js"></script>
<script src="jquery-cookie.js"></script>
<script src="jquery-tablesorter.js"></script>
<script src="strftime.js"></script>
<script src="mustache.js"></script>
<script src="config.js"></script>
<script src="main.js"></script>
<link rel="stylesheet" type="text/css" href="templates/reset.css" />
<link rel="stylesheet" type="text/css" href="templates/hack.css" />
<link rel="stylesheet" type="text/css" id="lights_css" />
<script>
var DOCNAME = 'ffi_reflect'
var PROJECT = 'ffi_reflect'
//set the lights before rendering starts
set_lights()
</script>
</head>
<body>
<header>
<div class="container">
<div class="btn-container btn-lights-container">
<a href="#" class="btn btn-lights" id="lights">lights</a>
</div>
<div class="btn-container btn-home-container">
<a href="/" class="btn btn-home">luapower</a>
</div>
<table id="header_table">
<tr>
<td style="vertical-align: middle;" width="100%">
<h1> ffi_reflect </h1>
<h2> luajit ffi reflection </h2>
</td>
<td style="vertical-align: middle;" align="right" style="height: 150px">
<table><tr><td>
<div class="doc" id="package_info_container">
<div id="package_info"> </div>
<div id="commit_log"> </div>
</div>
<a href="https://github.com/luapower/ffi_reflect" class="btn btn-rightside btn-github"><span class="icon"></span>View on GitHub</a>
</td></tr><tr><td>
<a href="https://github.com/luapower/ffi_reflect/tarball/master" class="btn btn-rightside">Download as .tar.gz</a>
</td></tr><tr><td>
<a href="https://github.com/luapower/ffi_reflect/zipball/master" class="btn btn-rightside">Download as .zip</a>
</td></tr></table>
</td>
</tr>
</table>
<div class="btn-container btn-discuss-container">
<a href="https://github.com/luapower/ffi_reflect/issues/new" target="_blank"
class="btn btn-rightside btn-discuss"><span class="icon"></span>Discuss</a>
</div>
</div>
</header>
<div class="bg-container">
<div class="bg-center-container">
<div class="bg bg-ffi_reflect" style="background-image: url('bg/ffi_reflect.png');"></div>
</div>
</div>
<div class="under-header">
<div class="container">
<div id="toc_container" class="toc_container doc"></div>
<button id=tab1_button class="tab_button hidden">Documentation</button>
<button id=tab2_button class="tab_button hidden">Package Info</button>
<div id="tabs_cointainer">
<div id="tab1_container">
<section class="doc">
<span id="module_info"></span>
<blockquote>
<p><strong>NOTE</strong>: This is a fork of the reflect module by Peter Cawley, developed <a href="https://github.com/corsix/ffi-reflect">here</a>.</p>
</blockquote>
<p>Quick examples:</p>
<pre class="sourceCode lua"><code class="sourceCode lua"><span class="kw">local</span> <span class="kw">ffi</span> <span class="ot">=</span> <span class="fu">require</span> <span class="st">"ffi"</span>
<span class="kw">local</span> <span class="kw">reflect</span> <span class="ot">=</span> <span class="fu">require</span> <span class="st">"ffi_reflect"</span>
<span class="kw">ffi</span><span class="ot">.</span>cdef <span class="st">'int sc(const char*, const char*) __asm__("strcmp");'</span>
<span class="fu">print</span><span class="ot">(</span><span class="kw">reflect</span><span class="ot">.</span>typeof<span class="ot">(</span><span class="kw">ffi</span><span class="ot">.</span><span class="kw">C</span><span class="ot">.</span><span class="kw">sc</span><span class="ot">).</span><span class="kw">sym_name</span><span class="ot">)</span> <span class="co">--> "strcmp"</span>
<span class="kw">for</span> <span class="kw">refct</span> <span class="kw">in</span> <span class="kw">reflect</span><span class="ot">.</span>typeof<span class="st">"int(*)(int x, int y)"</span><span class="ot">.</span><span class="kw">element_type</span>:arguments<span class="ot">()</span> <span class="kw">do</span>
<span class="fu">print</span><span class="ot">(</span><span class="kw">refct</span><span class="ot">.</span><span class="kw">name</span><span class="ot">)</span>
<span class="kw">end</span> <span class="co">--> x, y</span>
<span class="kw">t</span> <span class="ot">=</span> <span class="ot">{}</span>
<span class="fu">assert</span><span class="ot">(</span><span class="kw">reflect</span><span class="ot">.</span>getmetatable<span class="ot">(</span><span class="kw">ffi</span><span class="ot">.</span>metatype<span class="ot">(</span><span class="st">"struct {}"</span><span class="ot">,</span> <span class="kw">t</span><span class="ot">))</span> <span class="ot">==</span> <span class="kw">t</span><span class="ot">)</span></code></pre>
<p>For the full API reference, see <a href="http://corsix.github.io/ffi-reflect/">http://corsix.github.io/ffi-reflect/</a>.</p>
</section>
</div>
<div id="tab2_container" class="doc"></div>
</div>
</div>
<div class="container">
<footer>
<div id="disqus_thread"></div>
<div class="faint">cosmin.apreutesei@gmail.com | <a href="http://unlicense.org/">public domain</a></div>
</footer>
</div>
</div>
<script type="text/x-mustache" id=info_tab_template>
<h3>Modules</h3>
<ul>
{{#module_array}}
<li>{{name}}</li>
{{/module_array}}
</ul>
</script>
</body>
</html>