Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > b38d2da330d1936e5ab1307c039c4941 > files > 267

octave-doc-3.6.4-3.mga4.noarch.rpm

<html lang="en">
<head>
<title>Function Headers - GNU Octave</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Octave">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Tips-and-Standards.html#Tips-and-Standards" title="Tips and Standards">
<link rel="prev" href="Comment-Tips.html#Comment-Tips" title="Comment Tips">
<link rel="next" href="Documentation-Tips.html#Documentation-Tips" title="Documentation Tips">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<a name="Function-Headers"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Documentation-Tips.html#Documentation-Tips">Documentation Tips</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Comment-Tips.html#Comment-Tips">Comment Tips</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Tips-and-Standards.html#Tips-and-Standards">Tips and Standards</a>
<hr>
</div>

<h3 class="section">C.3 Conventional Headers for Octave Functions</h3>

<p><a name="index-header-comments-3408"></a>
Octave has conventions for using special comments in function files
to give information such as who wrote them.  This section explains these
conventions.

   <p>The top of the file should contain a copyright notice, followed by a
block of comments that can be used as the help text for the function. 
Here is an example:

<pre class="example">     ## Copyright (C) 1996, 1997, 2007 John W. Eaton
     ##
     ## This file is part of Octave.
     ##
     ## Octave is free software; you can redistribute it and/or
     ## modify it under the terms of the GNU General Public
     ## License as published by the Free Software Foundation;
     ## either version 3 of the License, or (at your option) any
     ## later version.
     ##
     ## Octave is distributed in the hope that it will be useful,
     ## but WITHOUT ANY WARRANTY; without even the implied
     ## warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     ## PURPOSE.  See the GNU General Public License for more
     ## details.
     ##
     ## You should have received a copy of the GNU General Public
     ## License along with Octave; see the file COPYING.  If not,
     ## see &lt;http://www.gnu.org/licenses/&gt;.
     
     ## usage: [IN, OUT, PID] = popen2 (COMMAND, ARGS)
     ##
     ## Start a subprocess with two-way communication.  COMMAND
     ## specifies the name of the command to start.  ARGS is an
     ## array of strings containing options for COMMAND.  IN and
     ## OUT are the file ids of the input and streams for the
     ## subprocess, and PID is the process id of the subprocess,
     ## or -1 if COMMAND could not be executed.
     ##
     ## Example:
     ##
     ##  [in, out, pid] = popen2 ("sort", "-nr");
     ##  fputs (in, "these\nare\nsome\nstrings\n");
     ##  fclose (in);
     ##  while (ischar (s = fgets (out)))
     ##    fputs (stdout, s);
     ##  endwhile
     ##  fclose (out);
</pre>
   <p>Octave uses the first block of comments in a function file that do not
appear to be a copyright notice as the help text for the file.  For
Octave to recognize the first comment block as a copyright notice, it
must start with the word `Copyright' after stripping the leading
comment characters.

   <p>After the copyright notice and help text come several <dfn>header
comment</dfn> lines, each beginning with &lsquo;<samp><span class="samp">## </span><var>header-name</var><span class="samp">:</span></samp>&rsquo;.  For
example,

<pre class="example">     ## Author: jwe
     ## Keywords: subprocesses input-output
     ## Maintainer: jwe
</pre>
   <p>Here is a table of the conventional possibilities for <var>header-name</var>:

     <dl>
<dt>&lsquo;<samp><span class="samp">Author</span></samp>&rsquo;<dd>This line states the name and net address of at least the principal
author of the library.

     <pre class="example">          ## Author: John W. Eaton &lt;jwe@octave.org&gt;
</pre>
     <br><dt>&lsquo;<samp><span class="samp">Maintainer</span></samp>&rsquo;<dd>This line should contain a single name/address as in the Author line, or
an address only, or the string &lsquo;<samp><span class="samp">jwe</span></samp>&rsquo;.  If there is no maintainer
line, the person(s) in the Author field are presumed to be the
maintainers.  The example above is mildly bogus because the maintainer
line is redundant.

     <p>The idea behind the &lsquo;<samp><span class="samp">Author</span></samp>&rsquo; and &lsquo;<samp><span class="samp">Maintainer</span></samp>&rsquo; lines is to make
possible a function to &ldquo;send mail to the maintainer&rdquo; without
having to mine the name out by hand.

     <p>Be sure to surround the network address with &lsquo;<samp><span class="samp">&lt;...&gt;</span></samp>&rsquo; if
you include the person's full name as well as the network address.

     <br><dt>&lsquo;<samp><span class="samp">Created</span></samp>&rsquo;<dd>This optional line gives the original creation date of the
file.  For historical interest only.

     <br><dt>&lsquo;<samp><span class="samp">Version</span></samp>&rsquo;<dd>If you wish to record version numbers for the individual Octave program,
put them in this line.

     <br><dt>&lsquo;<samp><span class="samp">Adapted-By</span></samp>&rsquo;<dd>In this header line, place the name of the person who adapted the
library for installation (to make it fit the style conventions, for
example).

     <br><dt>&lsquo;<samp><span class="samp">Keywords</span></samp>&rsquo;<dd>This line lists keywords.  Eventually, it will be used by an apropos
command to allow people will find your package when they're looking for
things by topic area.  To separate the keywords, you can use spaces,
commas, or both. 
</dl>

   <p>Just about every Octave function ought to have the &lsquo;<samp><span class="samp">Author</span></samp>&rsquo; and
&lsquo;<samp><span class="samp">Keywords</span></samp>&rsquo; header comment lines.  Use the others if they are
appropriate.  You can also put in header lines with other header
names&mdash;they have no standard meanings, so they can't do any harm.

   </body></html>