[380a17b] | 1 | //////////////////////////////////////////////////////////////// |
---|
[3686937] | 2 | version="version template.lib 4.0.0.0 Jun_2013 "; // $Id$ |
---|
[5ecf042] | 3 | category="Miscellaneous"; |
---|
[8bb77b] | 4 | // summary description of the library |
---|
[ee118e] | 5 | info=" |
---|
[8bb77b] | 6 | LIBRARY: template.lib A Template for a Singular Library |
---|
[ee118e] | 7 | AUTHOR: Olaf Bachmann, email: obachman@mathematik.uni-kl.de |
---|
| 8 | |
---|
[6ac11f] | 9 | SEE ALSO: standard_lib, Libraries, |
---|
[f5c66c] | 10 | Typesetting of help and info strings |
---|
[ee118e] | 11 | |
---|
[3d276d] | 12 | KEYWORDS: library, template.lib; template.lib; library, info string |
---|
| 13 | |
---|
[ee118e] | 14 | PROCEDURES: |
---|
| 15 | mdouble(int) return double of int argument |
---|
[04fc6d] | 16 | mtriple(int) return three times int argument |
---|
[ee118e] | 17 | msum([int,..,int]) sum of int arguments |
---|
| 18 | "; |
---|
| 19 | //////////////////////////////////////////////////////////////////// |
---|
| 20 | proc mdouble(int i) |
---|
[8bb77b] | 21 | "USAGE: mdouble(i); i int |
---|
[b9b906] | 22 | RETURN: int: i+i |
---|
[04fc6d] | 23 | NOTE: Help string is in pure ASCII. |
---|
| 24 | This line starts on a new line since previous line is short. |
---|
| 25 | No new line here. |
---|
| 26 | SEE ALSO: msum, mtriple, Typesetting of help and info strings |
---|
[b9b906] | 27 | KEYWORDS: procedure, ASCII help |
---|
[8bb77b] | 28 | EXAMPLE: example mdouble; shows an example" |
---|
[ee118e] | 29 | { |
---|
| 30 | return (i + i); |
---|
| 31 | } |
---|
| 32 | example |
---|
| 33 | { "EXAMPLE:"; echo = 2; |
---|
| 34 | mdouble(0); |
---|
| 35 | mdouble(-1); |
---|
| 36 | } |
---|
| 37 | //////////////////////////////////////////////////////////////////// |
---|
[04fc6d] | 38 | proc mtriple(int i) |
---|
[ee118e] | 39 | "@c we do texinfo here |
---|
| 40 | @table @asis |
---|
| 41 | @item @strong{Usage:} |
---|
[04fc6d] | 42 | @code{mtriple(i)}; @code{i} int |
---|
[ee118e] | 43 | |
---|
| 44 | @item @strong{Return:} |
---|
| 45 | int: @math{i+i+i} |
---|
| 46 | @item @strong{Note:} |
---|
[04fc6d] | 47 | Help is in pure Texinfo. |
---|
[ee118e] | 48 | @*This help string is written in texinfo, which enables you to use, |
---|
[27d4bb] | 49 | among others, the @@math command for mathematical typesetting |
---|
[04fc6d] | 50 | (for instance, to print @math{\alpha, \beta}). |
---|
| 51 | @*Texinfo also gives more control over the layout, but is, admittingly, |
---|
[ee118e] | 52 | more cumbersome to write. |
---|
| 53 | @end table |
---|
| 54 | @c use @c ref contstuct for references |
---|
[726d50] | 55 | @cindex procedure, texinfo help |
---|
[ee118e] | 56 | @c ref |
---|
[dcc635] | 57 | @strong{See also:} |
---|
[f5c66c] | 58 | @ref{mdouble}, @ref{msum}, @ref{Typesetting of help and info strings} |
---|
[ee118e] | 59 | @c ref |
---|
| 60 | " |
---|
| 61 | { |
---|
| 62 | return (i + i + i); |
---|
| 63 | } |
---|
| 64 | example |
---|
| 65 | { "EXAMPLE:"; echo = 2; |
---|
[04fc6d] | 66 | mtriple(0); |
---|
| 67 | mtriple(-1); |
---|
[ee118e] | 68 | } |
---|
| 69 | //////////////////////////////////////////////////////////////////// |
---|
| 70 | proc msum(list #) |
---|
| 71 | "USAGE: msum([i_1,..,i_n]); @code{i_1,..,i_n} def |
---|
| 72 | RETURN: Sum of int arguments |
---|
[04fc6d] | 73 | NOTE: This help string is written in a mixture of ASCII and texinfo. |
---|
| 74 | @* Use @ref for references (e.g., @pxref{mtriple}). |
---|
| 75 | @* Use @code for typewriter font (e.g., @code{i_1}). |
---|
| 76 | @* Use @math for simple math mode typesetting (e.g., @math{i_1}). |
---|
| 77 | @* Warning: Parenthesis like } are not allowed inside @math and @code. |
---|
[27d4bb] | 78 | @* Use @example for indented, preformatted text typesetting in |
---|
[04fc6d] | 79 | typewriter font: |
---|
[3d276d] | 80 | @example |
---|
[b9b906] | 81 | this --> that |
---|
[3d276d] | 82 | @end example |
---|
[04fc6d] | 83 | Use @format for preformatted text typesetting in normal font: |
---|
[3d276d] | 84 | @format |
---|
| 85 | this --> that |
---|
| 86 | @end format |
---|
[04fc6d] | 87 | Use @texinfo for text in pure texinfo: |
---|
[3d276d] | 88 | @texinfo |
---|
| 89 | @expansion{} |
---|
[b9b906] | 90 | @tex |
---|
[3d276d] | 91 | $i_{1,1}$ |
---|
| 92 | @end tex |
---|
| 93 | |
---|
| 94 | @end texinfo |
---|
[04fc6d] | 95 | Note that |
---|
| 96 | automatic linebreaking is still in affect (like in this line). |
---|
| 97 | SEE ALSO: mdouble, mtriple, Typesetting of help and info strings |
---|
[b9b906] | 98 | KEYWORDS: procedure, ASCII/Texinfo help |
---|
[ee118e] | 99 | EXAMPLE: example msum; shows an example" |
---|
| 100 | { |
---|
| 101 | if (size(#) == 0) { return (0);} |
---|
| 102 | if (size(#) == 1) { return (#[1]);} |
---|
| 103 | int i; |
---|
| 104 | def s = #[1]; |
---|
| 105 | for (i=2; i<=size(#); i++) |
---|
| 106 | { |
---|
| 107 | s = s + #[i]; |
---|
| 108 | } |
---|
| 109 | return (s); |
---|
| 110 | } |
---|
| 111 | example |
---|
| 112 | { "EXAMPLE:"; echo = 2; |
---|
| 113 | msum(); |
---|
| 114 | msum(4); |
---|
| 115 | msum(1,2,3,4); |
---|
| 116 | } |
---|