This commit is contained in:
Ingy döt Net 2013-10-27 22:24:23 +00:00
parent 6f050a029e
commit 776bba907c
3887 changed files with 59894 additions and 7280 deletions

View file

@ -1,29 +1,42 @@
/**
* This is a documentation comment for somefunc and somefunc2.
* Does not need to be preceded by '*' in every line - this is done purely for code style
* $(DDOC_COMMENT comment inside a documentation comment (results in a HTML comment not displayed by the browser))
* Header:
* content (does not need to be tabbed out; this is done for clarity of the comments and has no effect on the
* resulting documentation)
* Params:
* arg1 = Something (listed as "int <i>arg1</i> Something")
* arg2 = Something else
* Returns:
* Nothing
* TODO:
* Nothing at all
* BUGS:
* None found
*/
void somefunc(int arg1, int arg2)
{
}
// this groups this function with the above (both have the same doc and are listed together)
This is a documentation comment for someFunc and someFunc2.
$(DDOC_COMMENT comment inside a documentation comment
(results in a HTML comment not displayed by the browser))
Header:
content (does not need to be tabbed out; this is done for clarity
of the comments and has no effect on the resulting documentation)
Params:
arg1 = Something (listed as "int <i>arg1</i> Something")
arg2 = Something else
Returns:
Nothing
TODO:
Nothing at all
BUG:
None found
*/
void someFunc(int arg1, int arg2) {}
// This groups this function with the above (both have the
// same doc and are listed together)
/// ditto
void somefunc2(int arg1, int arg2)
{
void someFunc2(int arg1, int arg2) {}
/// Sum function.
int sum(in int x, in int y) pure nothrow {
return x + y;
}
// These unittests will become part of sum documentation:
///
unittest {
assert(sum(2, 3) == 5);
}
/++ Another documentation comment +/
void main()
{
}
void main() {}

View file

@ -0,0 +1,25 @@
:- object(set(_Type),
extends(set)).
% the info/1 directive is the main directive for documenting an entity
% its value is a list of Key-Value pairs; the set of keys is user-extendable
:- info([
version is 1.2,
author is 'A. Coder',
date is 2013/10/13,
comment is 'Set predicates with elements constrained to a single type.',
parnames is ['Type']
]).
% the info/2 directive is the main directive for documenting predicates
% its second value is a list of Key-Value pairs; the set of keys is user-extendable
:- public(intersection/3).
:- mode(intersection(+set, +set, ?set), zero_or_one).
:- info(intersection/3, [
comment is 'Returns the intersection of Set1 and Set2.',
argnames is ['Set1', 'Set2', 'Intersection']
]).
...
:- end_object.

View file

@ -0,0 +1,36 @@
/*REXX program to show how to display embedded documention in REXX code.*/
parse arg doc
doc=space(doc)
if doc=='?' then call help /*show doc if arg is a single ? */
/*════════════════════════regular═══════════════════════════════════════*/
/*════════════════════════════════mainline══════════════════════════════*/
/*═════════════════════════════════════════code═════════════════════════*/
/*══════════════════════════════════════════════here.═══════════════════*/
exit
/*──────────────────────────────────HELP subroutine─────────────────────*/
help: help=0; do j=1 for sourceline()
_=sourceline(j)
if _=='<help>' then do; help=1; iterate; end
if _=='</help>' then exit
if help then say _
end /*j*/
exit /*stick a fork in it, we're done.*/
/*──────────────────────────────────start of the in─line documentation.
<help>
To use the YYYY program, enter:
YYYY numberOfItems
YYYY (with no args for the default)
YYYY ? (to see this documentation)
where:
numberOfItems is the number of items to be processed.
If no "numberOfItems" are entered, the default of 100 is used.
</help>
end of the inline documentation. */

View file

@ -0,0 +1,19 @@
/* REXX ***************************************************************
* 13.10.2013 Walter Pachl another way to show documentation
* no tags and good enough if only one documentation block
**********************************************************************/
beghelp=here()+1 /* line where the docmentation begins
Documentation
any test explaining the program's invocaion and workings
---
and where it ends */
endhelp=here()-2
If arg(1)='?' Then Do
Do i=beghelp To endhelp
Say sourceline(i)
End
Exit
End
say 'the program would be here!'
Exit
here: return sigl /* returns the invocation's line number */