mirror of
https://github.com/nmap/nmap.git
synced 2025-12-28 02:19:04 +00:00
Added C module NSEDoc generation documentation.
This commit is contained in:
@@ -1949,6 +1949,42 @@ categories = {"discovery", "external"}
|
||||
from the contents of a comment. @release has not been used with
|
||||
NSEDoc. -->
|
||||
</sect2>
|
||||
<sect2 id="nse-documentation-c">
|
||||
<title>NSE Documentation for C Modules</title>
|
||||
<para>
|
||||
NSEDoc documentation can be written for libraries as well as scripts.
|
||||
While Lua modules can be documented in much the same way as your
|
||||
scripts, a C module requires special consideration. You must write
|
||||
a ".luadoc" file to accompany the C module in order for it to be
|
||||
documented. The file will list all functions for the C module as though
|
||||
they were written in Lua. You may however remove certain syntactical
|
||||
structures (particularly, <literal>end</literal>) when writing this
|
||||
document. The following example demonstrates how documentation was
|
||||
written for the C bit module.
|
||||
</para>
|
||||
<!-- From bit.luadoc -->
|
||||
<example id="nse-documentation-cdoc">
|
||||
<title>Documentation for the C "bit" module</title>
|
||||
<programlisting>
|
||||
--- Return the one's complement of a.
|
||||
-- @param a Number.
|
||||
-- @return The one's complement of a.
|
||||
function bit.bnot(a)
|
||||
|
||||
--- Returns the bitwise and of all its arguments.
|
||||
-- @param ... A variable number of Numbers to and.
|
||||
-- @return The anded result.
|
||||
function bit.band(...)
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
It is important to note that this documentation is being written for
|
||||
a simple documentation parser and <i>not</i> Lua. The functions,
|
||||
bit.bnot and bit.band, are placed there to assist in generating the
|
||||
documentation. You may use the @class tag to also help the parser
|
||||
know what it is you are documenting, especially for tables.
|
||||
</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="nse-vscan">
|
||||
|
||||
Reference in New Issue
Block a user