source: git/Singular/LIB/template.lib @ 7de8e4

spielwiese
Last change on this file since 7de8e4 was b9b906, checked in by Hans Schönemann <hannes@…>, 23 years ago
*hannes: lib format revisited git-svn-id: file:///usr/local/Singular/svn/trunk@5078 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 3.3 KB
Line 
1////////////////////////////////////////////////////////////////////
2// version string automatically expanded by CVS
3
4version="$Id: template.lib,v 1.10 2001-01-16 13:48:46 Singular Exp $";
5category="Miscellaneous";
6// summary description of the library
7info="
8LIBRARY:   template.lib  A Template for a Singular Library
9AUTHOR:    Olaf Bachmann, email: obachman@mathematik.uni-kl.de
10
11SEE ALSO:  standard_lib, Guidelines for writing a library,
12           Typesetting of help strings
13
14KEYWORDS: library, template.lib; template.lib; library, info string
15
16PROCEDURES:
17  mdouble(int)           return double of int argument
18  mtripple(int)          return three times int argument
19  msum([int,..,int])     sum of int arguments
20";
21////////////////////////////////////////////////////////////////////
22proc mdouble(int i)
23"USAGE:    mdouble(i); i int
24RETURN:   int: i+i
25NOTE:     Help string is in pure ASCII
26          this line starts on a new line since previous line is short
27          mdouble(i): no new line
28SEE ALSO: msum, mtripple, Typesetting of help strings
29KEYWORDS: procedure, ASCII help
30EXAMPLE:  example mdouble; shows an example"
31{
32  return (i + i);
33}
34example
35{ "EXAMPLE:"; echo = 2;
36  mdouble(0);
37  mdouble(-1);
38}
39////////////////////////////////////////////////////////////////////
40proc mtripple(int i)
41"@c we do texinfo here
42@table @asis
43@item @strong{Usage:}
44@code{mtripple(i)}; @code{i} int
45
46@item @strong{Return:}
47int: @math{i+i+i}
48@item @strong{Note:}
49Help is in pure Texinfo
50@*This help string is written in texinfo, which enables you to use,
51among others, the @@math command for mathematical typesetting (like
52@math{\alpha, \beta}).
53@*It also gives more control over the layout, but is, admittingly,
54more cumbersome to write.
55@end table
56@c use @c ref contstuct for references
57@cindex procedure, texinfo help
58@c ref
59@strong{See also:}
60@ref{mdouble}, @ref{msum}, @ref{Typesetting of help strings}
61@c ref
62"
63{
64  return (i + i + i);
65}
66example
67{ "EXAMPLE:"; echo = 2;
68  mtripple(0);
69  mtripple(-1);
70}
71////////////////////////////////////////////////////////////////////
72proc msum(list #)
73"USAGE:  msum([i_1,..,i_n]); @code{i_1,..,i_n} def
74RETURN:  Sum of int arguments
75NOTE:    This help string is written in a mixture of ASCII and texinfo
76         @* Use a @ref constructs for references (like @pxref{mtripple})
77         @* Use @code  for typewriter font (like @code{i_1})
78         @* Use @math  for simple math mode typesetting (like @math{i_1}).
79         @* Note: No parenthesis like } are allowed inside @math and @code
80         @* Use @example for indented preformatted text typeset in typewriter
81         font like
82@example
83         this  --> that
84@end example
85        Use @format  for preformatted text typeset in normal font
86@format
87         this --> that
88@end format
89        Use @texinfo for text in pure texinfo
90@texinfo
91@expansion{}
92@tex
93$i_{1,1}$
94@end tex
95
96@end texinfo
97        Notice that
98        automatic linebreaking         is still in affect (like on this line).
99SEE ALSO: mdouble, mtripple, Typesetting of help strings
100KEYWORDS: procedure, ASCII/Texinfo help
101EXAMPLE: example msum; shows an example"
102{
103  if (size(#) == 0) { return (0);}
104  if (size(#) == 1) { return (#[1]);}
105  int i;
106  def s = #[1];
107  for (i=2; i<=size(#); i++)
108  {
109    s = s + #[i];
110  }
111  return (s);
112}
113example
114{ "EXAMPLE:"; echo = 2;
115  msum();
116  msum(4);
117  msum(1,2,3,4);
118}
Note: See TracBrowser for help on using the repository browser.