ENUMERATES(3X)

NAME
enumerates - enumerate variable definitions

SYNOPSIS
#include enumerates.f83

enumerates

DESCRIPTION
Allows definition of enumerate variable sets. Creates constants with the values zero and upwards.

: >enum ( enum -- entry) immediate
    Used in the following form:
    <enum-item-value> >enum <enum-type-name> ( enum -- entry)
    to map an enumerate value back to its corresponding entry. If the entry is not found "nil" returned. The enumerate type maintains a pointer to the list of defined enumerates.

: enum ( -- )
    Used within an "enum.type" definition to declare an enumerate.
    enum <enum-item-name> ( -- enum)
    The value of the items are zero and upwards.

: enum.end ( -- )
    Used in the following structure:
    enum.type <enum-type-name>
    { enum <enum-item-name> ( -- enum) }
    enum.end
    to terminate a "enum.type" definition.

: enum.type ( -- )
    Used in the following structure:
    enum.type <enum-type-name> ( -- )
    { enum <enum-item-name> ( -- enum) }
    enum.end
    to start the definition of an enumerate variable and identifiers. The items start with the value zero. The type may later be used to define variables:
    <enum-type-name> <enum-variable-name> ( -- addr)
    The enumerate variable corresponds to a normal forth "variable" and may be accessed with the functions "@" and "!".

vocabulary enumerates ( -- )
    Vocabulary for enumerate definitions. Include into the search set, "context", to allow access to this language extension.

INTERNALS
Private definitions in the enumerates vocabulary;

: (>enum) ( enum enum.type -- entry) private
    Performs the run-time action of locating an enumerate entry given it's value, "enum", and the enumerate type it is a member of, "enum.type". Compiled by the word ">enum".

SEE ALSO
tile(1), forth(3X).

EXAMPLES
The tile forth kernel entries have the following code types:

    enum.type CODES ( -- )
    enum CODE ( -- enum)
    enum COLON ( -- enum)
    enum VARIABLE ( -- enum)
    enum CONSTANT ( -- enum)
    enum VOCABULARY ( -- enum)
    enum CREATE ( -- enum)
    enum USER ( -- enum)
    enum LOCAL ( -- enum)
    enum FORWARD ( -- enum)
    enum FIELD ( -- enum)
    enum EXCEPTION ( -- enum)
    enum.end

NOTE
The function list is sorted in ASCII order. The type and mode of the entry is indicated together with the parameter stack effect.

COPYING
Copyright (C) 1990 Mikael R.K. Patel

Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.

Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the section entitled "GNU General Public License" is included exactly as in the original, and provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that the section entitled "GNU General Public License" may be included in a translation approved by the author instead of in the original English.

AUTHOR
Mikael R.K. Patel
Computer Aided Design Laboratory (CADLAB)
Department of Computer and Information Science
Linkoping University
S-581 83 LINKOPING
SWEDEN
Email: mip@ida.liu.se