\input /home/gd/gnu/doc/texinfo

Test the @deffn constructs
**************************

Formatted on:

Source file:  /gd/gnu/doc/texinfo-deffn-test.texinfo

This file contains test samples of each of the definition commands.      Indices are at the end.

Test One of Each
****************

The first chapter contains one of each of the different kinds of command.

There are seven categories to deal with:

  * Generalized object oriented entitiies, i.e. @defop, @defcv.

  * Specialized object oriented entities, such as @defmethod, @defivar.

  * Generalized `regular' entities, i.e. @deffn, @defvr.

  * Specialized `regular' entities, such as @defvar, @defmac.

  * Generalized definitions for typed languages, i.e. @deftypefn, @deftypevr.

  * Specialized definitions for typed languages `regular' entities, such as @deftypefun and @deftypevar.

  * Generalized data type, i.e.  @deftp which is a `gotcha': it should not put what might be considered its `arguments' in upper case.  This is because the `arguments' are not necessarily arguments but may be names of aspects of the data type.  The canonical example is the dotted-pair in Lisp:

          @deftp {Data type} dotted-pair car cdr

Simple Variables
================

 -- Variable: variable-name

     DEFVAR          SHOULD BE:

     Variable: variable-name

 -- Variable-category: variable-name

     DEFVR          SHOULD BE:

     Variable-category: variable-name

Simple Functions
================

 -- Function: function-name args

     DEFUN           SHOULD BE:

     Function: function-name ARGS

 -- Function-category: function-name args

     DEFFN           SHOULD BE:

     Function-category: function-name ARGS

Class functions
===============

 -- Method on class: name arg

     DEFMETHOD         SHOULD BE:

     Method on class: name ARG

 -- Category on class: name arg

     DEFOP           SHOULD BE:

     Category on class: name ARG

Class Variables
===============

 -- Instance Variable of class: name

     DEFIVAR         SHOULD BE:

     Instance Variable of class: name

 -- Category of class: name

     DEFCV           SHOULD BE:

     Category of class: name

Data type
=========

 -- Data type: name aspects

     DEFTP           SHOULD BE:

     Data type: name aspects

Definitions for Typed Languages
===============================

 -- Library Function: int foobar (int FOO, float BAR)
     DEFTYPEFN           SHOULD BE:

     * Library Function: int foobar (int FOO, float BAR)

 -- Function: int foobar (int FOO, float BAR)
     DEFTYPEFUN           SHOULD BE:

     * Function: int foobar (int FOO, float BAR)

Every @deffn Construct
**********************

The second chapter contains a test for each and every command.

 -- Class Option of Window: border-pattern

     SHOULD LOOK LIKE * Class Option of Window: border-pattern

     Test for for @defcv.  This is from:

          @defcv {Class Option} Window  border-pattern

 -- Category: name args

     SHOULD LOOK LIKE * Category: name ARGS

     Test for @deffn.  This is from:

          @deffn Category name args

 -- Instance Variable of Window: border-pattern

     SHOULD LOOK LIKE * Instance Variable of Window: border-pattern

     Test for @defivar.  This is from:

          @defivar Window  border-pattern

     The @defivar command is equivalent to @defcv {Instance Variable} ...

 -- Instance Variable of Class-instance-var: name

     SHOULD BE * Instance Variable of Class-instance-var: name

     Another test of @defivar.  This is from:

          @defivar Class-instance-var name

 -- Macro: Name args

     SHOULD LOOK LIKE * Macro: Name ARGS

     Test for @defmac.  This is from:

          @defmac Name args

 -- Method on bar-class: bar-method argument

     SHOULD LOOK LIKE * Operation on bar-class: bar-method ARGUMENT

     Test for @defmethod.  This is from:

          @defmethod bar-class bar-method argument

     Note: the first argument is printed in roman type unless you put it in @code; you should do if it is the name of a class.

     The @defmethod command is equivalent to @defop Method ... and takes three arguments: the name of the class of the method, the name of the method, and its arguments.

 -- Exemplar on foo-class: frobnicate argument

     SHOULD LOOK LIKE * Exemplar on foo-class: frobnicate ARGUMENT

     Test for @defop.  This is from:

          @defop Exemplar foo-class frobnicate argument

 -- User Option: Option-name

     SHOULD LOOK LIKE * User Option: Option-name

     Test for @defopt.  This is from:

          @defopt Option-name

     The @defopt command is equivalent to @defvr {User Option} ....

 -- Special Form: Name args

     SHOULD LOOK LIKE * Special form: Name ARGS

     Test for @defspec.  This is from:

          @defspec Name args

     The @defspec command is equivalent to @deffn {Special Form} ....

 -- Class: window height width

     SHOULD LOOK LIKE * Class: window height width

     Test for @deftp.  This is from:

          @deftp Class window height width

Another test for @deftp:

 -- Data type: dotted-pair car cdr

     SHOULD LOOK LIKE * Data type: dotted-pair car cdr

     Test for @deftp.  This is from:

          @deftp {Data type} dotted-pair car cdr

 -- Library Function: int foobar (int FOO, float BAR)
     SHOULD LOOK LIKE * Library Function: int foobar (int FOO, float BAR)

     Test for @deftypefn.  This is from

          @deftypefn {Library Function} int foobar (int FOO, float BAR)

 -- Function: int foobar (int FOO, float BAR)
     SHOULD LOOK LIKE * Function: int foobar (int FOO, float BAR)

     Test for @deftypefun.  This is from

          @deftypefun int foobar (int FOO, float BAR)

 -- Global Flag: int enable
     SHOULD LOOK LIKE * Global Flag: int enable

     Test for @deftypevr.  This is from

          @deftypevr {Global Flag} int enable

 -- Variable: int foobar
     SHOULD LOOK LIKE * Variable: int foobar

     Test for @deftypevar.  This is from

          @deftypevr classification type name

 -- Function: Function-name args

     SHOULD LOOK LIKE * Function: Function-name ARGS

     Test for @defun.  This is from:

          @defun Function-name args

     The @defun command is equivalent to @deffn Function ....

 -- Variable: Variable-name

     SHOULD LOOK LIKE * Variable: Variable-name

     Test for @defvar.  This is from:

          @defvar Variable-name

     The @defvar command is equivalent to @defvr Variable ....

 -- Category: name

     SHOULD LOOK LIKE * Category: name

     Test for @defvr.  This is from:

          @defvr Category name

@deftypefun
***********

The @deftypefn series of commands are for defining functions and variables in C or any other language with types.

For example,

     @deftypefn {Library Function} int foobar (int FOO, float BAR)

produces the following in Info:

     * Library Function: int foobar (int FOO, float BAR)

TEST:

 -- Library Function: int foobar (int FOO, float BAR)
     ...

The template is:

     @deftypefn classification type name args

The specialized definition for typed functions is @deftypefun; you don't have to specify the classification:

     @deftypefun int foobar (int FOO, float BAR)

produces the following in Info:

     * Function: int foobar (int FOO, float BAR)

TEST:

 -- Function: int foobar (int FOO, float BAR)
     ...

The template is:

     @deftypefun DATA TYPE NAME ARGUMENTS...
     BODY-OF-DESCRIPTION
     @end deftypefun

The general definition command for typed variables is @deftypevr; it is used like this:

     @deftypevr {Global Flag} int enable

which produces the following in Info:

     * Global Flag: int enable

TEST:

 -- Global Flag: int enable
     ...

The template is:

     @deftypevr classification type name

The @deftypevar command is the specialized definition command for variables in typed languages.  The command is equivalent to @deftypevr Variable ....

     @deftypevar int foobar

produces the following in Info:

     * Variable: int foobar

TEST:

 -- Variable: int foobar
     ...

The template is:

     @deftypevar type name

Unusual Cases
*************

 -- operation on x-graphics-device-type: set-background-color color-name
 -- operation on x-graphics-device-type: set-foreground-color color-name
 -- operation on x-graphics-device-type: set-border-color color-name
 -- operation on x-graphics-device-type: set-mouse-color color-name
     This is a test of @defopx.  The four header lines should be indented identically with no blank lines between them or this text.

 -- Procedure: scode/make-lambda name required optional rest auxiliary declarations body
     This is a test of a long function definition.  There are enough arguments to require a continuation line.  The continuation line should be indented at twice the indentation of this text.