Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
3
Task/Documentation/00-META.yaml
Normal file
3
Task/Documentation/00-META.yaml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
from: http://rosettacode.org/wiki/Documentation
|
||||
note: Software Engineering
|
||||
7
Task/Documentation/00-TASK.txt
Normal file
7
Task/Documentation/00-TASK.txt
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
Show how to insert documentation for classes, functions, and/or variables in your language. If this documentation is built-in to the language, note it. If this documentation requires external tools, note them.
|
||||
|
||||
|
||||
;See also:
|
||||
* Related task: [[Comments]]
|
||||
* Related task: [[Here_document]]
|
||||
<br><br>
|
||||
25
Task/Documentation/Ada/documentation.ada
Normal file
25
Task/Documentation/Ada/documentation.ada
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
with Ada.Text_Io; use Ada.Text_Io;
|
||||
|
||||
generic
|
||||
SortName : in String;
|
||||
type DataType is (<>);
|
||||
type SortArrayType is array (Integer range <>) of DataType;
|
||||
with procedure Sort (SortArray : in out SortArrayType;
|
||||
Comp, Write, Ex : in out Natural);
|
||||
|
||||
package Instrument is
|
||||
-- This generic package essentially accomplishes turning the sort
|
||||
-- procedures into first-class functions for this limited purpose.
|
||||
-- Obviously it doesn't change the way that Ada works with them;
|
||||
-- the same thing would have been much more straightforward to
|
||||
-- program in a language that had true first-class functions
|
||||
|
||||
package Dur_Io is new Fixed_Io(Duration);
|
||||
|
||||
procedure TimeSort (Arr : in out SortArrayType);
|
||||
|
||||
procedure Put;
|
||||
|
||||
procedure Put (File : in out File_Type);
|
||||
|
||||
end Instrument;
|
||||
13
Task/Documentation/Arturo/documentation.arturo
Normal file
13
Task/Documentation/Arturo/documentation.arturo
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
f: function [x :integer, y :integer][
|
||||
;; description: « takes two integers and adds them up
|
||||
;; options: [
|
||||
;; double: « also multiply by two
|
||||
;; ]
|
||||
;; returns: :integer
|
||||
|
||||
result: x+y
|
||||
if not? null? attr 'double -> result: result * 2
|
||||
return result
|
||||
]
|
||||
|
||||
info'f
|
||||
17
Task/Documentation/AutoHotkey/documentation.ahk
Normal file
17
Task/Documentation/AutoHotkey/documentation.ahk
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
;
|
||||
; Function: example_add
|
||||
; Description:
|
||||
; Adds two or three numbers (see [url=http://en.wikipedia.org/Number]Number [/url])
|
||||
; Syntax: example_add(number1, number2[, number3=0])
|
||||
; Parameters:
|
||||
; number1 - First number to add.
|
||||
; number2 - Second number to add.
|
||||
; number3 - (Optional) Third number to add. You can just omit this parameter.
|
||||
; Return Value:
|
||||
; sum of parameters
|
||||
; Example:
|
||||
; MsgBox % example_add(example_add(2, 3, 4), 5)
|
||||
;
|
||||
example_add(number1, number2, number3=0){
|
||||
return number1 + number2 + number3
|
||||
}
|
||||
20
Task/Documentation/C-sharp/documentation.cs
Normal file
20
Task/Documentation/C-sharp/documentation.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/// <summary>
|
||||
/// The XMLSystem class is here to help handle XML items in this site.
|
||||
/// </summary>
|
||||
public static class XMLSystem
|
||||
{
|
||||
static XMLSystem()
|
||||
{
|
||||
// Constructor
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A function to get the contents of an XML document.
|
||||
/// </summary>
|
||||
/// <param name="name">A valid name of an XML document in the data folder</param>
|
||||
/// <returns>An XmlDocument containing the contents of the XML file</returns>
|
||||
public static XmlDocument GetXML(string name)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
13
Task/Documentation/C/documentation.c
Normal file
13
Task/Documentation/C/documentation.c
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* \brief Perform addition on \p a and \p b.
|
||||
*
|
||||
* \param a One of the numbers to be added.
|
||||
* \param b Another number to be added.
|
||||
* \return The sum of \p a and \p b.
|
||||
* \code
|
||||
* int sum = add(1, 2);
|
||||
* \endcode
|
||||
*/
|
||||
int add(int a, int b) {
|
||||
return a + b;
|
||||
}
|
||||
57
Task/Documentation/COBOL/documentation-1.cobol
Normal file
57
Task/Documentation/COBOL/documentation-1.cobol
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
*>****L* cobweb/cobweb-gtk [0.2]
|
||||
*> Author:
|
||||
*> Author details
|
||||
*> Colophon:
|
||||
*> Part of the GnuCobol free software project
|
||||
*> Copyright (C) 2014 person
|
||||
*> Date 20130308
|
||||
*> Modified 20141003
|
||||
*> License GNU General Public License, GPL, 3.0 or greater
|
||||
*> Documentation licensed GNU FDL, version 2.1 or greater
|
||||
*> HTML Documentation thanks to ROBODoc --cobol
|
||||
*> Purpose:
|
||||
*> GnuCobol functional bindings to GTK+
|
||||
*> Main module includes paperwork output and self test
|
||||
*> Synopsis:
|
||||
*> |dotfile cobweb-gtk.dot
|
||||
*> |html <br />
|
||||
*> Functions include
|
||||
*> |exec cobcrun cobweb-gtk >cobweb-gtk.repository
|
||||
*> |html <pre>
|
||||
*> |copy cobweb-gtk.repository
|
||||
*> |html </pre>
|
||||
*> |exec rm cobweb-gtk.repository
|
||||
*> Tectonics:
|
||||
*> cobc -v -b -g -debug cobweb-gtk.cob voidcall_gtk.c
|
||||
*> `pkg-config --libs gtk+-3.0` -lvte2_90 -lyelp
|
||||
*> robodoc --cobol --src ./ --doc cobwebgtk --multidoc --rc robocob.rc --css cobodoc.css
|
||||
*> cobc -E -Ddocpass cobweb-gtk.cob
|
||||
*> make singlehtml # once Sphinx set up to read cobweb-gtk.i
|
||||
*> Example:
|
||||
*> COPY cobweb-gtk-preamble.
|
||||
*> procedure division.
|
||||
*> move TOP-LEVEL to window-type
|
||||
*> move 640 to width-hint
|
||||
*> move 480 to height-hint
|
||||
*> move new-window("window title", window-type,
|
||||
*> width-hint, height-hint)
|
||||
*> to gtk-window-data
|
||||
*> move gtk-go(gtk-window) to extraneous
|
||||
*> goback.
|
||||
*> Notes:
|
||||
*> The interface signatures changed between 0.1 and 0.2
|
||||
*> Screenshot:
|
||||
*> image:cobweb-gtk1.png
|
||||
*> Source:
|
||||
REPLACE ==FIELDSIZE== BY ==80==
|
||||
==AREASIZE== BY ==32768==
|
||||
==FILESIZE== BY ==65536==.
|
||||
|
||||
id identification division.
|
||||
program-id. cobweb-gtk.
|
||||
|
||||
...
|
||||
|
||||
done goback.
|
||||
end program cobweb-gtk.
|
||||
*>****
|
||||
16
Task/Documentation/COBOL/documentation-2.cobol
Normal file
16
Task/Documentation/COBOL/documentation-2.cobol
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
>>IF docpass NOT DEFINED
|
||||
|
||||
... code ...
|
||||
|
||||
>>ELSE
|
||||
!doc-marker!
|
||||
========
|
||||
:SAMPLE:
|
||||
========
|
||||
|
||||
.. contents::
|
||||
|
||||
Introduction
|
||||
------------
|
||||
ReStructuredText or other markup source ...
|
||||
>>END-IF
|
||||
7
Task/Documentation/Clojure/documentation.clj
Normal file
7
Task/Documentation/Clojure/documentation.clj
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
(def
|
||||
#^{:doc "Metadata can contain documentation and can be added to vars like this."}
|
||||
test1)
|
||||
|
||||
(defn test2
|
||||
"defn and some other macros allow you add documentation like this. Works the same way"
|
||||
[])
|
||||
14
Task/Documentation/Crystal/documentation.crystal
Normal file
14
Task/Documentation/Crystal/documentation.crystal
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# Any block of comments *directly* before (no blank lines) a module, class, or method is used as a doc comment
|
||||
# This one is for a module
|
||||
module Documentation
|
||||
|
||||
# This comment documents a class, *and* it uses markdown
|
||||
class Foo
|
||||
|
||||
# This comment doesn't do anything, because it isn't directly above a module, class, or method
|
||||
|
||||
# Finally, this comment documents a method
|
||||
def initialize
|
||||
end
|
||||
end
|
||||
end
|
||||
42
Task/Documentation/D/documentation.d
Normal file
42
Task/Documentation/D/documentation.d
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
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) {}
|
||||
|
||||
/// 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() {}
|
||||
10
Task/Documentation/Delphi/documentation.delphi
Normal file
10
Task/Documentation/Delphi/documentation.delphi
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
type
|
||||
/// <summary>Sample class.</summary>
|
||||
TMyClass = class
|
||||
public
|
||||
/// <summary>Converts a string into a number.</summary>
|
||||
/// <param name="aValue">String parameter</param>
|
||||
/// <returns>Numeric equivalent of aValue</returns>
|
||||
/// <exception cref="EConvertError">aValue is not a valid integer.</exception>
|
||||
function StringToNumber(aValue: string): Integer;
|
||||
end;
|
||||
8
Task/Documentation/E/documentation.e
Normal file
8
Task/Documentation/E/documentation.e
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
? /** This is an object with documentation */
|
||||
> def foo {
|
||||
> # ...
|
||||
> }
|
||||
# value: <foo>
|
||||
|
||||
? foo.__getAllegedType().getDocComment()
|
||||
# value: " This is an object with documentation "
|
||||
88
Task/Documentation/Eiffel/documentation-1.e
Normal file
88
Task/Documentation/Eiffel/documentation-1.e
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
note
|
||||
description: "Objects that model Times of Day: 00:00:00 - 23:59:59"
|
||||
author: "Eiffel Software Construction Students"
|
||||
|
||||
class
|
||||
TIME_OF_DAY
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Initialization
|
||||
|
||||
make
|
||||
-- Initialize to 00:00:00
|
||||
do
|
||||
hour := 0
|
||||
minute := 0
|
||||
second := 0
|
||||
ensure
|
||||
initialized: hour = 0 and
|
||||
minute = 0 and
|
||||
second = 0
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
hour: INTEGER
|
||||
-- Hour expressed as 24-hour value
|
||||
|
||||
minute: INTEGER
|
||||
-- Minutes past the hour
|
||||
|
||||
second: INTEGER
|
||||
-- Seconds past the minute
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_hour (h: INTEGER)
|
||||
-- Set the hour from `h'
|
||||
require
|
||||
argument_hour_valid: 0 <= h and h <= 23
|
||||
do
|
||||
hour := h
|
||||
ensure
|
||||
hour_set: hour = h
|
||||
minute_unchanged: minute = old minute
|
||||
second_unchanged: second = old second
|
||||
end
|
||||
|
||||
set_minute (m: INTEGER)
|
||||
-- Set the minute from `m'
|
||||
require
|
||||
argument_minute_valid: 0 <= m and m <= 59
|
||||
do
|
||||
minute := m
|
||||
ensure
|
||||
minute_set: minute = m
|
||||
hour_unchanged: hour = old hour
|
||||
second_unchanged: second = old second
|
||||
end
|
||||
|
||||
set_second (s: INTEGER)
|
||||
-- Set the second from `s'
|
||||
require
|
||||
argument_second_valid: 0 <= s and s <= 59
|
||||
do
|
||||
second := s
|
||||
ensure
|
||||
second_set: second = s
|
||||
hour_unchanged: hour = old hour
|
||||
minute_unchanged: minute = old minute
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
protected_routine
|
||||
-- A protected routine (not available to client classes)
|
||||
-- Will not be present in documentation (Contract) view
|
||||
do
|
||||
|
||||
end
|
||||
|
||||
invariant
|
||||
|
||||
hour_valid: 0 <= hour and hour <= 23
|
||||
minute_valid: 0 <= minute and minute <= 59
|
||||
second_valid: 0 <= second and second <= 59
|
||||
|
||||
end -- class TIME_OF_DAY
|
||||
63
Task/Documentation/Eiffel/documentation-2.e
Normal file
63
Task/Documentation/Eiffel/documentation-2.e
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
note
|
||||
description: "Objects that model Times of Day: 00:00:00 - 23:59:59"
|
||||
author: "Eiffel Software Construction Students"
|
||||
|
||||
class interface
|
||||
TIME_OF_DAY
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Initialization
|
||||
|
||||
make
|
||||
-- Initialize to 00:00:00
|
||||
ensure
|
||||
initialized: hour = 0 and minute = 0 and second = 0
|
||||
|
||||
feature -- Access
|
||||
|
||||
hour: INTEGER_32
|
||||
-- Hour expressed as 24-hour value
|
||||
|
||||
minute: INTEGER_32
|
||||
-- Minutes past the hour
|
||||
|
||||
second: INTEGER_32
|
||||
-- Seconds past the minute
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_hour (h: INTEGER_32)
|
||||
-- Set the hour from `h'
|
||||
require
|
||||
argument_hour_valid: 0 <= h and h <= 23
|
||||
ensure
|
||||
hour_set: hour = h
|
||||
minute_unchanged: minute = old minute
|
||||
second_unchanged: second = old second
|
||||
|
||||
set_minute (m: INTEGER_32)
|
||||
-- Set the minute from `m'
|
||||
require
|
||||
argument_minute_valid: 0 <= m and m <= 59
|
||||
ensure
|
||||
minute_set: minute = m
|
||||
hour_unchanged: hour = old hour
|
||||
second_unchanged: second = old second
|
||||
|
||||
set_second (s: INTEGER_32)
|
||||
-- Set the second from `s'
|
||||
require
|
||||
argument_second_valid: 0 <= s and s <= 59
|
||||
ensure
|
||||
second_set: second = s
|
||||
hour_unchanged: hour = old hour
|
||||
minute_unchanged: minute = old minute
|
||||
|
||||
invariant
|
||||
hour_valid: 0 <= hour and hour <= 23
|
||||
minute_valid: 0 <= minute and minute <= 59
|
||||
second_valid: 0 <= second and second <= 59
|
||||
|
||||
end -- class TIME_OF_DAY
|
||||
8
Task/Documentation/Elixir/documentation-1.elixir
Normal file
8
Task/Documentation/Elixir/documentation-1.elixir
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
def project do
|
||||
[app: :repo
|
||||
version: "0.1.0-dev",
|
||||
name: "REPO",
|
||||
source_url: "https://github.com/USER/REPO",
|
||||
homepage_url: "http://YOUR_PROJECT_HOMEPAGE"
|
||||
deps: deps]
|
||||
end
|
||||
10
Task/Documentation/Elixir/documentation-2.elixir
Normal file
10
Task/Documentation/Elixir/documentation-2.elixir
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
defmodule MyModule do
|
||||
@moduledoc """
|
||||
About MyModule
|
||||
|
||||
## Some Header
|
||||
|
||||
iex> MyModule.my_function
|
||||
:result
|
||||
"""
|
||||
end
|
||||
3
Task/Documentation/Emacs-Lisp/documentation-1.l
Normal file
3
Task/Documentation/Emacs-Lisp/documentation-1.l
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(defun hello (n)
|
||||
"Say hello to the user."
|
||||
(message "hello %d" n))
|
||||
2
Task/Documentation/Emacs-Lisp/documentation-2.l
Normal file
2
Task/Documentation/Emacs-Lisp/documentation-2.l
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
(defvar one-hundred 100
|
||||
"The number one hundred.")
|
||||
13
Task/Documentation/Fancy/documentation.fancy
Normal file
13
Task/Documentation/Fancy/documentation.fancy
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
def class Foo {
|
||||
"""
|
||||
This is a docstring. Every object in Fancy can have it's own docstring.
|
||||
Either defined in the source code, like this one, or by using the Object#docstring: method
|
||||
"""
|
||||
def a_method {
|
||||
"""
|
||||
Same for methods. They can have docstrings, too.
|
||||
"""
|
||||
}
|
||||
}
|
||||
Foo docstring println # prints docstring Foo class
|
||||
Foo instance_method: 'a_method . docstring println # prints method's docstring
|
||||
1
Task/Documentation/Forth/documentation-1.fth
Normal file
1
Task/Documentation/Forth/documentation-1.fth
Normal file
|
|
@ -0,0 +1 @@
|
|||
\ this is a comment
|
||||
1
Task/Documentation/Forth/documentation-2.fth
Normal file
1
Task/Documentation/Forth/documentation-2.fth
Normal file
|
|
@ -0,0 +1 @@
|
|||
: cubed ( n -- n^3 ) dup dup * * ;
|
||||
3
Task/Documentation/Fortran/documentation.f
Normal file
3
Task/Documentation/Fortran/documentation.f
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
SUBROUTINE SHOW(A,N) !Prints details to I/O unit LINPR.
|
||||
REAL*8 A !Distance to the next node.
|
||||
INTEGER N !Number of the current node.
|
||||
25
Task/Documentation/Go/documentation.go
Normal file
25
Task/Documentation/Go/documentation.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// Example serves as an example but does nothing useful.
|
||||
//
|
||||
// A package comment preceeds the package clause and explains the purpose
|
||||
// of the package.
|
||||
package example
|
||||
|
||||
// Exported variables.
|
||||
var (
|
||||
// lookie
|
||||
X, Y, Z int // popular names
|
||||
)
|
||||
|
||||
/* XP does nothing.
|
||||
|
||||
Here's a block comment. */
|
||||
func XP() { // here we go!
|
||||
// comments inside
|
||||
}
|
||||
|
||||
// Non-exported.
|
||||
func nonXP() {}
|
||||
|
||||
// Doc not extracted.
|
||||
|
||||
var MEMEME int
|
||||
6
Task/Documentation/Gri/documentation-1.gri
Normal file
6
Task/Documentation/Gri/documentation-1.gri
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
`My Hello Message'
|
||||
Print a greeting to the user.
|
||||
This is only a short greeting.
|
||||
{
|
||||
show "hello"
|
||||
}
|
||||
1
Task/Documentation/Gri/documentation-2.gri
Normal file
1
Task/Documentation/Gri/documentation-2.gri
Normal file
|
|
@ -0,0 +1 @@
|
|||
help My Hello Message
|
||||
26
Task/Documentation/Haskell/documentation.hs
Normal file
26
Task/Documentation/Haskell/documentation.hs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
-- |This is a documentation comment for the following function
|
||||
square1 :: Int -> Int
|
||||
square1 x = x * x
|
||||
|
||||
-- |It can even
|
||||
-- span multiple lines
|
||||
square2 :: Int -> Int
|
||||
square2 x = x * x
|
||||
|
||||
square3 :: Int -> Int
|
||||
-- ^You can put the comment underneath if you like, like this
|
||||
square3 x = x * x
|
||||
|
||||
{-|
|
||||
Haskell block comments
|
||||
are also supported
|
||||
-}
|
||||
square4 :: Int -> Int
|
||||
square4 x = x * x
|
||||
|
||||
-- |This is a documentation comment for the following datatype
|
||||
data Tree a = Leaf a | Node [Tree a]
|
||||
|
||||
-- |This is a documentation comment for the following type class
|
||||
class Foo a where
|
||||
bar :: a
|
||||
25
Task/Documentation/Icon/documentation.icon
Normal file
25
Task/Documentation/Icon/documentation.icon
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
############################################################################
|
||||
#
|
||||
# File: filename.icn
|
||||
#
|
||||
# Subject: Short Description
|
||||
#
|
||||
# Author: Author's name
|
||||
#
|
||||
# Date: Date
|
||||
#
|
||||
############################################################################
|
||||
#
|
||||
# This file is in the public domain. (or other license)
|
||||
#
|
||||
############################################################################
|
||||
#
|
||||
# Long form docmentation
|
||||
#
|
||||
############################################################################
|
||||
#
|
||||
# Links:
|
||||
#
|
||||
############################################################################
|
||||
|
||||
procedure x1() #: short description of procedure
|
||||
26
Task/Documentation/Isabelle/documentation.isabelle
Normal file
26
Task/Documentation/Isabelle/documentation.isabelle
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
theory Text
|
||||
imports Main
|
||||
begin
|
||||
|
||||
chapter ‹Presenting Theories›
|
||||
|
||||
text ‹This text will appear in the proof document.›
|
||||
|
||||
section ‹Some Examples.›
|
||||
|
||||
― ‹A marginal comment. The expression \<^term>‹True› holds.›
|
||||
|
||||
lemma True_is_True: "True" ..
|
||||
|
||||
text ‹
|
||||
The overall content of an Isabelle/Isar theory may alternate between formal
|
||||
and informal text.
|
||||
›
|
||||
|
||||
text_raw ‹Can also contain raw latex.›
|
||||
|
||||
text ‹This text will only compile if the fact @{thm True_is_True} holds.›
|
||||
|
||||
text ‹This text will only compile if the constant \<^const>‹True› is defined.›
|
||||
|
||||
end
|
||||
24
Task/Documentation/J/documentation.j
Normal file
24
Task/Documentation/J/documentation.j
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
NB. =========================================================
|
||||
NB.*apply v apply verb x to y
|
||||
apply=: 128!:2
|
||||
|
||||
NB. =========================================================
|
||||
NB.*def c : (explicit definition)
|
||||
def=: :
|
||||
|
||||
NB.*define a : 0 (explicit definition script form)
|
||||
define=: : 0
|
||||
|
||||
NB.*do v name for ".
|
||||
do=: ".
|
||||
|
||||
NB.*drop v name for }.
|
||||
drop=: }.
|
||||
|
||||
Note 1
|
||||
Note accepts multi-line descriptions.
|
||||
Definitions display the source.
|
||||
)
|
||||
|
||||
usleep
|
||||
3 : '''libc.so.6 usleep > i i''&(15!:0) >.y'
|
||||
22
Task/Documentation/Java/documentation.java
Normal file
22
Task/Documentation/Java/documentation.java
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* This is a class documentation comment. This text shows at the top of the page for this class
|
||||
* @author Joe Schmoe
|
||||
*/
|
||||
public class Doc{
|
||||
/**
|
||||
* This is a field comment for a variable
|
||||
*/
|
||||
private String field;
|
||||
|
||||
/**
|
||||
* This is a method comment. It has parameter tags (param), an exception tag (throws),
|
||||
* and a return value tag (return).
|
||||
*
|
||||
* @param num a number with the variable name "num"
|
||||
* @throws BadException when something bad happens
|
||||
* @return another number
|
||||
*/
|
||||
public int method(long num) throws BadException{
|
||||
//...code here
|
||||
}
|
||||
}
|
||||
2
Task/Documentation/Julia/documentation-1.julia
Normal file
2
Task/Documentation/Julia/documentation-1.julia
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
"Tell whether there are too foo items in the array."
|
||||
foo(xs::Array) = ...
|
||||
15
Task/Documentation/Julia/documentation-2.julia
Normal file
15
Task/Documentation/Julia/documentation-2.julia
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
"""
|
||||
bar(x[, y])
|
||||
|
||||
Compute the Bar index between `x` and `y`. If `y` is missing, compute
|
||||
the Bar index between all pairs of columns of `x`.
|
||||
|
||||
|
||||
|
||||
# Examples
|
||||
```julia-repl
|
||||
julia> bar([1, 2], [1, 2])
|
||||
1
|
||||
```
|
||||
"""
|
||||
function bar(x, y) ...
|
||||
19
Task/Documentation/Kotlin/documentation.kotlin
Normal file
19
Task/Documentation/Kotlin/documentation.kotlin
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* A group of *members*.
|
||||
* @author A Programmer.
|
||||
* @since version 1.1.51.
|
||||
*
|
||||
* This class has no useful logic; it's just a documentation example.
|
||||
*
|
||||
* @param T the type of a member in this group.
|
||||
* @property name the name of this group.
|
||||
* @constructor Creates an empty group.
|
||||
*/
|
||||
class Group<T>(val name: String) {
|
||||
/**
|
||||
* Adds a [member] to this group.
|
||||
* @throws AddException if the member can't be added.
|
||||
* @return the new size of the group.
|
||||
*/
|
||||
fun add(member: T): Int { ... }
|
||||
}
|
||||
9
Task/Documentation/Lambdatalk/documentation.lambdatalk
Normal file
9
Task/Documentation/Lambdatalk/documentation.lambdatalk
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
'{def add // define the name
|
||||
{lambda {:a :b} // for a function with two arguments
|
||||
{+ :a :b} // whose body calls the + primitive on them
|
||||
} // end function
|
||||
} // end define
|
||||
-> add
|
||||
|
||||
'{add 3 4} // call the function on two values
|
||||
-> 7 // the result
|
||||
25
Task/Documentation/Logtalk/documentation.logtalk
Normal file
25
Task/Documentation/Logtalk/documentation.logtalk
Normal 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.
|
||||
6
Task/Documentation/Lua/documentation.lua
Normal file
6
Task/Documentation/Lua/documentation.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
--- Converts degrees to radians (summary).
|
||||
-- Given an angle measure in degrees, return an equivalent angle measure in radians (long description).
|
||||
-- @param deg the angle measure in degrees
|
||||
-- @return the angle measure in radians
|
||||
-- @see rad2deg
|
||||
function deg2rad(deg) return deg*math.pi/180 end
|
||||
3
Task/Documentation/MATLAB/documentation.m
Normal file
3
Task/Documentation/MATLAB/documentation.m
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
function Gnash(GnashFile); %Convert to a "function". Data is placed in the "global" area.
|
||||
% My first MatLab attempt, to swallow data as produced by Gnash's DUMP
|
||||
%command in a comma-separated format. Such files start with a line
|
||||
5
Task/Documentation/Mathematica/documentation.math
Normal file
5
Task/Documentation/Mathematica/documentation.math
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
f[x_,y_] := x + y (* Function comment : adds two numbers *)
|
||||
f::usage = "f[x,y] gives the sum of x and y"
|
||||
|
||||
?f
|
||||
-> f[x,y] gives the sum of x and y
|
||||
1
Task/Documentation/Neko/documentation-1.neko
Normal file
1
Task/Documentation/Neko/documentation-1.neko
Normal file
|
|
@ -0,0 +1 @@
|
|||
/** ... **/
|
||||
1
Task/Documentation/Neko/documentation-2.neko
Normal file
1
Task/Documentation/Neko/documentation-2.neko
Normal file
|
|
@ -0,0 +1 @@
|
|||
<doc> ... </doc>
|
||||
5
Task/Documentation/Neko/documentation-3.neko
Normal file
5
Task/Documentation/Neko/documentation-3.neko
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/**
|
||||
result_set_conv_date : 'result -> function:1 -> void
|
||||
<doc>Set the function that will convert a Date or DateTime string
|
||||
to the corresponding value.</doc>
|
||||
**/
|
||||
31
Task/Documentation/Nim/documentation.nim
Normal file
31
Task/Documentation/Nim/documentation.nim
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
## Nim directly supports documentation using comments that start with two
|
||||
## hashes (##). To create the documentation run ``nim doc file.nim``.
|
||||
## ``nim doc2 file.nim`` is the same, but run after semantic checking, which
|
||||
## allows it to process macros and output more information.
|
||||
##
|
||||
## These are the comments for the entire module. We can have long descriptions
|
||||
## here. Syntax is reStructuredText. Only exported symbols (*) get
|
||||
## documentation created for them.
|
||||
##
|
||||
## Here comes a code block inside our documentation:
|
||||
##
|
||||
## .. code-block:: nim
|
||||
## var inputStrings : seq[string]
|
||||
## newSeq(inputStrings, 3)
|
||||
## inputStrings[0] = "The fourth"
|
||||
## inputStrings[1] = "assignment"
|
||||
## inputStrings[2] = "would crash"
|
||||
## #inputStrings[3] = "out of bounds"
|
||||
|
||||
type TPerson* = object
|
||||
## This type contains a description of a person
|
||||
name: string
|
||||
age: int
|
||||
|
||||
var numValues*: int ## \
|
||||
## `numValues` stores the number of values
|
||||
|
||||
proc helloWorld*(times: int) =
|
||||
## A useful procedure
|
||||
for i in 1..times:
|
||||
echo "hello world"
|
||||
9
Task/Documentation/Objeck/documentation.objeck
Normal file
9
Task/Documentation/Objeck/documentation.objeck
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#~
|
||||
Sets the named row value
|
||||
@param name name
|
||||
@param value value
|
||||
@return true of value was set, false otherwise
|
||||
~#
|
||||
method : public : Set(name : String, value : String) ~ Bool {
|
||||
return Set(@table->GetRowId(name), value);
|
||||
}
|
||||
11
Task/Documentation/Objective-C/documentation.m
Normal file
11
Task/Documentation/Objective-C/documentation.m
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*!
|
||||
@function add
|
||||
@abstract Adds two numbers
|
||||
@discussion Use add to sum two numbers.
|
||||
@param a an integer.
|
||||
@param b another integer.
|
||||
@return the sum of a and b
|
||||
*/
|
||||
int add(int a, int b) {
|
||||
return a + b;
|
||||
}
|
||||
16
Task/Documentation/Ol/documentation.ol
Normal file
16
Task/Documentation/Ol/documentation.ol
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
; note: use this script to generate a markdown file
|
||||
; sed -n 's/\s*;!\s*//gp'
|
||||
|
||||
(import (owl parse))
|
||||
|
||||
;! # Documentation
|
||||
|
||||
;! ## Functions
|
||||
|
||||
;! ### whitespace
|
||||
;! Returns a #true if argument is a space, newline, return or tab character.
|
||||
(define whitespace (byte-if (lambda (x) (has? '(#\tab #\newline #\space #\return) x))))
|
||||
|
||||
;! ### maybe-whitespaces
|
||||
;! Returns any amount (including 0) of whitespaces. Used as whitespace characters skipper in parses.
|
||||
(define maybe-whitespaces (greedy* whitespace))
|
||||
1
Task/Documentation/PARI-GP/documentation.parigp
Normal file
1
Task/Documentation/PARI-GP/documentation.parigp
Normal file
|
|
@ -0,0 +1 @@
|
|||
addhelp(funcName, "funcName(v, n): This is a description of the function named funcName.");
|
||||
12
Task/Documentation/Phix/documentation.phix
Normal file
12
Task/Documentation/Phix/documentation.phix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
(phixonline)-->
|
||||
<span style="color: #008080;">procedure</span> <span style="color: #000000;">StoreVar</span><span style="color: #0000FF;">(</span><span style="color: #004080;">integer</span> <span style="color: #000000;">N</span><span style="color: #0000FF;">,</span> <span style="color: #004080;">integer</span> <span style="color: #000000;">NTyp</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #000080;font-style:italic;">--
|
||||
-- Store a variable, applying any final operator as needed.
|
||||
-- If N is zero, PopFactor (ie store in a new temporary variable of
|
||||
-- the specified type). Otherwise N should be an index to symtab.
|
||||
-- If storeConst is 1, NTyp is ignored/overridden, otherwise it
|
||||
-- should usually be the declared or local type of N.
|
||||
-- </span>
|
||||
<span style="color: #0000FF;">...</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">procedure</span>
|
||||
<!--
|
||||
5
Task/Documentation/PicoLisp/documentation.l
Normal file
5
Task/Documentation/PicoLisp/documentation.l
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
: (doc 'car) # View documentation of a function
|
||||
|
||||
: (doc '+Entity) # View documentation of a class
|
||||
|
||||
: (doc '+ 'firefox) # Explicitly specify a browser
|
||||
1
Task/Documentation/PowerShell/documentation.psh
Normal file
1
Task/Documentation/PowerShell/documentation.psh
Normal file
|
|
@ -0,0 +1 @@
|
|||
help about_comment_based_help
|
||||
35
Task/Documentation/PureBasic/documentation.basic
Normal file
35
Task/Documentation/PureBasic/documentation.basic
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
; This is a small demo-code to demonstrate PureBasic’s internal
|
||||
; documentation system.
|
||||
|
||||
;- All Includes
|
||||
; By starting the line with ‘;-‘ marks that specific line as a special comment,
|
||||
; and this will be included in the overview, while normal comments will not.
|
||||
|
||||
IncludeFile "MyLibs.pbi"
|
||||
IncludeFile "Combustion_Data.pbi"
|
||||
|
||||
;-
|
||||
;- Start of functions and Macros
|
||||
;- Engeneering stuff
|
||||
|
||||
; A small function to calculate gas properties
|
||||
Procedure.f CalcR( p.f, V.f, T.f)
|
||||
ProcedureReturn p*V/T
|
||||
EndProcedure
|
||||
|
||||
; Example of a Macro
|
||||
; These are indicated by '+' in the overview
|
||||
Macro HalfPI()
|
||||
(#PI/2)
|
||||
EndMacro
|
||||
|
||||
;-
|
||||
;- - - - - - - - - - -
|
||||
;- IO-Functions
|
||||
|
||||
Procedure Write_and_Close( File, Text$)
|
||||
If IsFile(File)
|
||||
WriteString(File,Text$)
|
||||
CloseFile(file)
|
||||
EndIf
|
||||
EndProcedure
|
||||
8
Task/Documentation/Python/documentation-1.py
Normal file
8
Task/Documentation/Python/documentation-1.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
class Doc(object):
|
||||
"""
|
||||
This is a class docstring. Traditionally triple-quoted strings are used because
|
||||
they can span multiple lines and you can include quotation marks without escaping.
|
||||
"""
|
||||
def method(self, num):
|
||||
"""This is a method docstring."""
|
||||
pass
|
||||
11
Task/Documentation/Python/documentation-2.py
Normal file
11
Task/Documentation/Python/documentation-2.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
>>> def somefunction():
|
||||
"takes no args and returns None after doing not a lot"
|
||||
|
||||
|
||||
>>> help(somefunction)
|
||||
Help on function somefunction in module __main__:
|
||||
|
||||
somefunction()
|
||||
takes no args and returns None after doing not a lot
|
||||
|
||||
>>>
|
||||
1
Task/Documentation/R/documentation-1.r
Normal file
1
Task/Documentation/R/documentation-1.r
Normal file
|
|
@ -0,0 +1 @@
|
|||
example(package.skeleton)
|
||||
59
Task/Documentation/R/documentation-2.r
Normal file
59
Task/Documentation/R/documentation-2.r
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
\name{f}
|
||||
\Rdversion{1.1}
|
||||
\alias{f}
|
||||
%- Also NEED an '\alias' for EACH other topic documented here.
|
||||
\title{
|
||||
%% ~~function to do ... ~~
|
||||
}
|
||||
\description{
|
||||
%% ~~ A concise (1-5 lines) description of what the function does. ~~
|
||||
}
|
||||
\usage{
|
||||
f(x, y)
|
||||
}
|
||||
%- maybe also 'usage' for other objects documented here.
|
||||
\arguments{
|
||||
\item{x}{
|
||||
%% ~~Describe \code{x} here~~
|
||||
}
|
||||
\item{y}{
|
||||
%% ~~Describe \code{y} here~~
|
||||
}
|
||||
}
|
||||
\details{
|
||||
%% ~~ If necessary, more details than the description above ~~
|
||||
}
|
||||
\value{
|
||||
%% ~Describe the value returned
|
||||
%% If it is a LIST, use
|
||||
%% \item{comp1 }{Description of 'comp1'}
|
||||
%% \item{comp2 }{Description of 'comp2'}
|
||||
%% ...
|
||||
}
|
||||
\references{
|
||||
%% ~put references to the literature/web site here ~
|
||||
}
|
||||
\author{
|
||||
%% ~~who you are~~
|
||||
}
|
||||
\note{
|
||||
%% ~~further notes~~
|
||||
}
|
||||
|
||||
%% ~Make other sections like Warning with \section{Warning }{....} ~
|
||||
|
||||
\seealso{
|
||||
%% ~~objects to See Also as \code{\link{help}}, ~~~
|
||||
}
|
||||
\examples{
|
||||
##---- Should be DIRECTLY executable !! ----
|
||||
##-- ==> Define data, use random,
|
||||
##-- or do help(data=index) for the standard data sets.
|
||||
|
||||
## The function is currently defined as
|
||||
function(x,y) x+y
|
||||
}
|
||||
% Add one or more standard keywords, see file 'KEYWORDS' in the
|
||||
% R documentation directory.
|
||||
\keyword{ ~kwd1 }
|
||||
\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
|
||||
64
Task/Documentation/REBOL/documentation.rebol
Normal file
64
Task/Documentation/REBOL/documentation.rebol
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
REBOL [
|
||||
Title: "Documentation"
|
||||
URL: http://rosettacode.org/wiki/Documentation
|
||||
Purpose: {To demonstrate documentation of REBOL pograms.}
|
||||
]
|
||||
|
||||
; Notice the fields in the program header. The header is required for
|
||||
; valid REBOL programs, although the fields don't have to be filled
|
||||
; in. Standard fields are defined (see 'system/script/header'), but
|
||||
; I can also define other fields as I like and they'll be available
|
||||
; there.
|
||||
|
||||
; This is a comment. The semicolon can be inserted anywhere outside of
|
||||
; a string and will escape to end of line. See the inline comments
|
||||
; below.
|
||||
|
||||
; Functions can have a documentation string as the first part of the
|
||||
; argument definition block. Each argument can specify what types it
|
||||
; will accept as well as a description. All typing/documentation
|
||||
; entries are optional. Notice that local variables can be documented
|
||||
; as well.
|
||||
|
||||
sum: func [
|
||||
"Add numbers in block."
|
||||
data [block! list!] "List of numbers to add together."
|
||||
/average "Calculate average instead of sum."
|
||||
/local
|
||||
i "Iteration variable."
|
||||
x "Variable to hold results."
|
||||
] [
|
||||
x: 0 repeat i data [x: x + i]
|
||||
either average [x / length? data][x] ; Functions return last result.
|
||||
]
|
||||
|
||||
print [sum [1 2 3 4 5 6] crlf sum/average [7 8 9 10] crlf]
|
||||
|
||||
; The help message is constructed from the public information about
|
||||
; the function. Internal variable information isn't shown.
|
||||
|
||||
help sum print ""
|
||||
|
||||
; The source command provides the source to any user functions,
|
||||
; reconstructing the documentation strings if they're provided:
|
||||
|
||||
source sum print ""
|
||||
|
||||
; This is an object, describing a person, whose name is Bob.
|
||||
|
||||
bob: make object! [
|
||||
name: "Bob Sorkopath"
|
||||
age: 24
|
||||
hi: func ["Say hello."][print "Hello!"]
|
||||
]
|
||||
|
||||
; I can use the 'help' word to get a list of the fields of the object
|
||||
|
||||
help bob print ""
|
||||
|
||||
; If I want see the documentation or source for 'bob/hi', I have to
|
||||
; get a little tricky to get it from the object's namespace:
|
||||
|
||||
x: get in bob 'hi help x print ""
|
||||
|
||||
probe get in bob 'hi
|
||||
29
Task/Documentation/REXX/documentation-1.rexx
Normal file
29
Task/Documentation/REXX/documentation-1.rexx
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/*REXX program illustrates how to display embedded documentation (help) within REXX code*/
|
||||
parse arg doc /*obtain (all) the arguments from C.L. */
|
||||
if doc='?' then call help /*show documentation if arg=a single ? */
|
||||
/*■■■■■■■■■regular■■■■■■■■■■■■■■■■■■■■■■■■■*/
|
||||
/*■■■■■■■■■■■■■■■■■mainline■■■■■■■■■■■■■■■■*/
|
||||
/*■■■■■■■■■■■■■■■■■■■■■■■■■■code■■■■■■■■■■■*/
|
||||
/*■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■here.■■■■■*/
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
help: ?=0; do j=1 for sourceline(); _=sourceline(j) /*get a line of source.*/
|
||||
if _='<help>' then do; ?=1; iterate; end /*search for <help> */
|
||||
if _='</help>' then leave /* " " </help> */
|
||||
if ? then say _
|
||||
end /*j*/
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*══════════════════════════════════start of the in═line documentation AFTER the <help>
|
||||
<help>
|
||||
To use the YYYY program, enter one of:
|
||||
|
||||
YYYY numberOfItems
|
||||
YYYY (no arguments uses the default)
|
||||
YYYY ? (to see this documentation)
|
||||
|
||||
|
||||
─── where: numberOfItems is the number of items to be used.
|
||||
|
||||
If no "numberOfItems" are entered, the default of 100 is used.
|
||||
</help>
|
||||
════════════════════════════════════end of the in═line documentation BEFORE the </help> */
|
||||
19
Task/Documentation/REXX/documentation-2.rexx
Normal file
19
Task/Documentation/REXX/documentation-2.rexx
Normal 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 text explaining the program's invocation 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 */
|
||||
7
Task/Documentation/Racket/documentation.rkt
Normal file
7
Task/Documentation/Racket/documentation.rkt
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#lang scribble/manual
|
||||
(require (for-label "sandwiches.rkt"))
|
||||
|
||||
@defproc[(make-sandwich [ingredients (listof ingredient?)])
|
||||
sandwich?]{
|
||||
Returns a sandwich given the right ingredients.
|
||||
}
|
||||
11
Task/Documentation/Raku/documentation.raku
Normal file
11
Task/Documentation/Raku/documentation.raku
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#= it's yellow
|
||||
sub marine { ... }
|
||||
say &marine.WHY; # "it's yellow"
|
||||
|
||||
#= a shaggy little thing
|
||||
class Sheep {
|
||||
#= not too scary
|
||||
method roar { 'roar!' }
|
||||
}
|
||||
say Sheep.WHY; # "a shaggy little thing"
|
||||
say Sheep.^find_method('roar').WHY; # "not too scary"
|
||||
28
Task/Documentation/Retro/documentation.retro
Normal file
28
Task/Documentation/Retro/documentation.retro
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# Determine The Average Word Name Length
|
||||
|
||||
To determine the average length of a word name two values
|
||||
are needed. First, the total length of all names in the
|
||||
Dictionary:
|
||||
|
||||
~~~
|
||||
#0 [ d:name s:length + ] d:for-each
|
||||
~~~
|
||||
|
||||
And then the number of words in the Dictionary:
|
||||
|
||||
~~~
|
||||
#0 [ drop n:inc ] d:for-each
|
||||
~~~
|
||||
|
||||
With these, a simple division is all that's left.
|
||||
|
||||
~~~
|
||||
/
|
||||
~~~
|
||||
|
||||
Finally, display the results:
|
||||
|
||||
|
||||
~~~
|
||||
'Average_name_length:_%n\n s:format s:put
|
||||
~~~
|
||||
9
Task/Documentation/Ring/documentation.ring
Normal file
9
Task/Documentation/Ring/documentation.ring
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/*
|
||||
Multiply two numbers
|
||||
n1: an integer.
|
||||
n2: an integer.
|
||||
returns product of n1 and n2
|
||||
*/
|
||||
see mult(3, 5) + nl
|
||||
func mult n1, n2
|
||||
return n1*n2
|
||||
35
Task/Documentation/Ruby/documentation.rb
Normal file
35
Task/Documentation/Ruby/documentation.rb
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
=begin rdoc
|
||||
RDoc is documented here[http://www.ruby-doc.org/core/classes/RDoc.html].
|
||||
|
||||
This is a class documentation comment. This text shows at the top of the page
|
||||
for the class.
|
||||
|
||||
Comments can be written inside "=begin rdoc"/"end" blocks or
|
||||
in normal '#' comment blocks.
|
||||
|
||||
There are no '@parameters' like javadoc, but 'name-value' lists can be written:
|
||||
Author:: Joe Schmoe
|
||||
Date:: today
|
||||
=end
|
||||
|
||||
class Doc
|
||||
# This is a comment for a Constant
|
||||
Constant = nil
|
||||
|
||||
# This is a method comment. Parameters and return values can be named
|
||||
# with the "call-seq" directive.
|
||||
#
|
||||
# call-seq:
|
||||
# a_method(first_arg, second_arg) -> return_value
|
||||
#
|
||||
def a_method(arg1, arg2='default value')
|
||||
do_stuff
|
||||
end
|
||||
|
||||
# Class methods will be shown in a separate section of the generated documentation.
|
||||
def self.class_method
|
||||
Constant
|
||||
end
|
||||
end
|
||||
|
||||
# :include:boilerplate.txt
|
||||
57
Task/Documentation/Rust/documentation.rust
Normal file
57
Task/Documentation/Rust/documentation.rust
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
//! Documentation for the module
|
||||
//!
|
||||
//! **Lorem ipsum** dolor sit amet, consectetur adipiscing elit. Aenean a
|
||||
//! sagittis sapien, eu pellentesque ex. Nulla facilisi. Praesent eget sapien
|
||||
//! sollicitudin, laoreet ipsum at, fringilla augue. In hac habitasse platea
|
||||
//! dictumst. Nunc in neque sed magna suscipit mattis sed quis mi. Curabitur
|
||||
//! quis mi a ante mollis commodo. Sed tincidunt ut metus vel accumsan.
|
||||
#![doc(html_favicon_url = "https://example.com/favicon.ico")]
|
||||
#![doc(html_logo_url = "https://example.com/logo.png")]
|
||||
|
||||
/// Documentation for a constant
|
||||
pub const THINGY: u32 = 42;
|
||||
|
||||
/// Documentation for a Rust `enum` (tagged union)
|
||||
pub enum Whatsit {
|
||||
/// Documentation for the `Yo` variant
|
||||
Yo(Whatchamabob),
|
||||
/// Documentation for the `HoHo` variant
|
||||
HoHo,
|
||||
}
|
||||
|
||||
/// Documentation for a data structure
|
||||
pub struct Whatchamabob {
|
||||
/// Doodads do dad
|
||||
pub doodad: f64,
|
||||
/// Whether or not this is a thingamabob
|
||||
pub thingamabob: bool
|
||||
}
|
||||
|
||||
/// Documentation for a trait (interface)
|
||||
pub trait Frobnify {
|
||||
/// `Frobnify` something
|
||||
fn frob(&self);
|
||||
}
|
||||
|
||||
/// Documentation specific to this struct's implementation of `Frobnify`
|
||||
impl Frobnify for Whatchamabob {
|
||||
/// `Frobnify` the `Whatchamabob`
|
||||
fn frob(&self) {
|
||||
println!("Frobbed: {}", self.doodad);
|
||||
}
|
||||
}
|
||||
|
||||
/// Documentation for a function
|
||||
///
|
||||
/// Pellentesque sodales lacus nisi, in malesuada lectus vestibulum eget.
|
||||
/// Integer rhoncus imperdiet justo. Pellentesque egestas sem ac
|
||||
/// consectetur suscipit. Maecenas tempus dignissim purus, eu tincidunt mi
|
||||
/// tincidunt id. Morbi ac laoreet erat, eu ultricies neque. Fusce molestie
|
||||
/// urna quis nisl condimentum, sit amet fringilla nunc ornare. Pellentesque
|
||||
/// vestibulum ac nibh eu accumsan. In ornare orci at rhoncus finibus. Donec
|
||||
/// sed ipsum ex. Pellentesque ante nisl, pharetra id purus auctor, euismod
|
||||
/// semper erat. Nunc sit amet eros elit.
|
||||
pub fn main() {
|
||||
let foo = Whatchamabob{ doodad: 1.2, thingamabob: false };
|
||||
foo.frob();
|
||||
}
|
||||
121
Task/Documentation/SQL-PL/documentation.sql
Normal file
121
Task/Documentation/SQL-PL/documentation.sql
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
CREATE TABLESPACE myTs;
|
||||
|
||||
COMMENT ON TABLESPACE myTs IS 'Description of the tablespace.';
|
||||
|
||||
CREATE SCHEMA mySch;
|
||||
|
||||
COMMENT ON SCHEMA mySch IS 'Description of the schema.';
|
||||
|
||||
CREATE TYPE myType AS (col1 int) MODE DB2SQL;
|
||||
|
||||
COMMENT ON TYPE mytype IS 'Description of the type.';
|
||||
|
||||
CREATE TABLE myTab (
|
||||
myCol1 INT NOT NULL,
|
||||
myCol2 INT
|
||||
);
|
||||
|
||||
COMMENT ON TABLE myTab IS 'Description of the table.';
|
||||
COMMENT ON myTab (
|
||||
myCol1 IS 'Description of the column.',
|
||||
myCol2 IS 'Description of the column.'
|
||||
);
|
||||
|
||||
ALTER TABLE myTab ADD CONSTRAINT myConst PRIMARY KEY (myCol1);
|
||||
|
||||
COMMENT ON CONSTRAINT myTab.myConst IS 'Description of the constraint.';
|
||||
|
||||
CREATE INDEX myInd ON
|
||||
myTab (myCol2);
|
||||
|
||||
COMMENT ON INDEX myInd IS 'Description of the index.';
|
||||
|
||||
-- V11.1
|
||||
CREATE USAGE LIST myUsList FOR TABLE myTab;
|
||||
|
||||
COMMENT ON USAGE LISTmyUsList IS 'Description of the usage list.';
|
||||
|
||||
/**
|
||||
* Detailed description of the trigger.
|
||||
*/
|
||||
CREATE TRIGGER myTrig
|
||||
AFTER INSERT ON myTab
|
||||
REFERENCING NEW AS N
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
END;
|
||||
|
||||
COMMENT ON TRIGGER myTrig IS 'General description of the trigger.';
|
||||
|
||||
CREATE VARIABLE myVar INT;
|
||||
|
||||
COMMENT ON VARIABLE myVar IS 'General description of the variable.';
|
||||
|
||||
/**
|
||||
* General description of the function (reads until the first dot).
|
||||
* Detailed description of the function, until the first empty line.
|
||||
*
|
||||
* IN VAR1
|
||||
* Description of IN parameter in variable VAR1.
|
||||
* OUT VAR2
|
||||
* Description of OUT parameter in variable VAR2.
|
||||
* INOUT VAR3
|
||||
* Description of INOUT parameter in variable VAR3.
|
||||
* RETURNS Description of what it returns.
|
||||
*/
|
||||
CREATE FUNCTION myfun (
|
||||
IN VAR1 INT,
|
||||
OUT VAR2 INT,
|
||||
INOUT VAR3 INT)
|
||||
RETURNS INT
|
||||
BEGIN
|
||||
END;
|
||||
|
||||
/**
|
||||
* General description of the procedure (reads until the first dot).
|
||||
* Detailed description of the procedure, until the first empty line.
|
||||
*
|
||||
* IN VAR1
|
||||
* Description of IN parameter in variable VAR1.
|
||||
* OUT VAR2
|
||||
* Description of OUT parameter in variable VAR2.
|
||||
* INOUT VAR3
|
||||
* Description of INOUT parameter in variable VAR3.
|
||||
*/
|
||||
CREATE PROCEDURE myProc (
|
||||
IN VAR1 INT,
|
||||
OUT VAR2 INT,
|
||||
INOUT VAR3 INT)
|
||||
BEGIN
|
||||
END;
|
||||
|
||||
CREATE MODULE myMod;
|
||||
|
||||
COMMENT ON MODULE myMod IS 'General description of the module.';
|
||||
|
||||
/**
|
||||
* General description of the procedure (reads until the first dot).
|
||||
* Detailed description of the procedure, until the first empty line.
|
||||
*
|
||||
* IN VAR1
|
||||
* Description of IN parameter in variable VAR1.
|
||||
* OUT VAR2
|
||||
* Description of OUT parameter in variable VAR2.
|
||||
* INOUT VAR3
|
||||
* Description of INOUT parameter in variable VAR3.
|
||||
*/
|
||||
ALTER MODULE myMod
|
||||
ADD PROCEDURE myProc (
|
||||
IN VAR1 INT,
|
||||
OUT VAR2 INT,
|
||||
INOUT VAR3 INT)
|
||||
BEGIN
|
||||
END;
|
||||
|
||||
CREATE ROLE myRole;
|
||||
|
||||
COMMENT ON ROLE myRole IS 'Description of the role.';
|
||||
|
||||
CREATE SEQUENCE mySeq;
|
||||
|
||||
COMMENT ON ROLE mySeq IS 'Description of the sequence.';
|
||||
22
Task/Documentation/Scala/documentation.scala
Normal file
22
Task/Documentation/Scala/documentation.scala
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* This is a class documentation comment. This text shows at the top of the page for this class
|
||||
*
|
||||
* @author Joe Schmoe
|
||||
*/
|
||||
class Doc {
|
||||
/**
|
||||
* This is a field comment for a variable
|
||||
*/
|
||||
private val field = 0
|
||||
|
||||
/**
|
||||
* This is a method comment. It has parameter tags (param) and a return value tag (return).
|
||||
*
|
||||
* @param num a number with the variable name "num"
|
||||
* @return another number
|
||||
*/
|
||||
def method(num: Long): Int = {
|
||||
//...code here
|
||||
???
|
||||
}
|
||||
}
|
||||
1
Task/Documentation/Smalltalk/documentation.st
Normal file
1
Task/Documentation/Smalltalk/documentation.st
Normal file
|
|
@ -0,0 +1 @@
|
|||
FooClass comment: 'This is a comment ....'.
|
||||
3
Task/Documentation/Stata/documentation.stata
Normal file
3
Task/Documentation/Stata/documentation.stata
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
prog def hello
|
||||
di "Hello, World!"
|
||||
end
|
||||
9
Task/Documentation/Swift/documentation.swift
Normal file
9
Task/Documentation/Swift/documentation.swift
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
Adds two numbers
|
||||
:param: a an integer.
|
||||
:param: b another integer.
|
||||
:returns: the sum of a and b
|
||||
*/
|
||||
func add(a: Int, b: Int) -> Int {
|
||||
return a + b
|
||||
}
|
||||
18
Task/Documentation/Tcl/documentation.tcl
Normal file
18
Task/Documentation/Tcl/documentation.tcl
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#****f* RosettaCode/TclDocDemo
|
||||
# FUNCTION
|
||||
# TclDocDemo is a simple illustration of how to do documentation
|
||||
# of Tcl code using Robodoc.
|
||||
# SYNOPSYS
|
||||
# TclDocDemo foo bar
|
||||
# INPUTS
|
||||
# foo -- the first part of the message to print
|
||||
# bar -- the last part of the message to print
|
||||
# RESULT
|
||||
# No result
|
||||
# NOTES
|
||||
# Prints a message based on a template by filling in with the
|
||||
# supplied strings.
|
||||
#*****
|
||||
proc TclDocDemo {foo bar} {
|
||||
puts [format "%s -- %s" $foo $bar]
|
||||
}
|
||||
1
Task/Documentation/Unicon/documentation.unicon
Normal file
1
Task/Documentation/Unicon/documentation.unicon
Normal file
|
|
@ -0,0 +1 @@
|
|||
XYZ
|
||||
27
Task/Documentation/Wren/documentation.wren
Normal file
27
Task/Documentation/Wren/documentation.wren
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// The meaning of life!
|
||||
var mol = 42
|
||||
|
||||
// A function to add two numbers
|
||||
var add = Fn.new { |x, y| x + y }
|
||||
|
||||
/* A class with some string utilites */
|
||||
class StrUtil {
|
||||
// reverses an ASCII string
|
||||
static reverse(s) { s[-1..0] }
|
||||
|
||||
// capitalizes the first letter of an ASCII string
|
||||
static capitalize(s) {
|
||||
var firstByte = s[0].bytes[0]
|
||||
if (firstByte >= 97 && firstByte <= 122) {
|
||||
firstByte = firstByte - 32
|
||||
return String.fromByte(firstByte) + s[1..-1]
|
||||
}
|
||||
return s
|
||||
}
|
||||
}
|
||||
|
||||
// test code
|
||||
var smol = "meaning of life"
|
||||
System.print("'%(smol)' + 123 = %(add.call(mol, 123))")
|
||||
System.print("'%(smol)' reversed = %(StrUtil.reverse(smol))")
|
||||
System.print("'%(smol)' capitalized = %(StrUtil.capitalize(smol))")
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
10 LET a=10: REM a is the number of apples
|
||||
1000 DEF FN s(q)=q*q: REM s is a function that takes a single numeric parameter and returns its square
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
10 GOSUB 2000: REM call a subroutine to print the documentation
|
||||
1999 STOP
|
||||
2000 REM Print the documentation
|
||||
2010 LPRINT "a is the number of apples"
|
||||
2020 LPRINT "s is a function that takes a single numeric parameter and returns"
|
||||
2030 LPRINT "its square"
|
||||
2040 RETURN
|
||||
Loading…
Add table
Add a link
Reference in a new issue