## ALP Programming Guide and Reference

[prev][next][parent][TOC]

### TYPEDEF (Create a User-Defined Type Name)

Defines a Typedef-TypeName that is an alias for another type declaration.

Syntax

    TypeName   TYPEDEF   Type - Declaration

Remarks

The TypeName entry is a unique globally-scoped Identifier that must be specified. Upon successful processing of the TYPEDEF directive, the TypeName entry is converted to a Typedef-TypeName which can then be used in expressions or as a directive in data allocation statements.

The TYPEDEF directive can be used to create a direct alias for another intrinsic type (a Scalar-TypeName, Record-TypeName, Structure-TypeName, Union-TypeName, or other Typedef-TypeName), a pointer to another type, or it can be used to create vector types (arrays).

Examples

The following are examples of TYPEDEF usage:

    CHAR        typedef   byte                    ;   CHAR   is   an   alias   for   intrinsic   type
    PCHAR       typedef   ptr   CHAR                ;   PCHAR   is   a   pointer   to   CHAR

    BUFFER _ T    struct
       pLetter   PCHAR     ?                       ;   current   position   in   buffer
       Letters   CHAR      " ABCDEF " , 0              ;   array   of   characters
    BUFFER _ T    ends

    BUFFER      typedef   BUFFER _ T                ;   alias   for   intrinsic   type
    PBUFFER     typedef   ptr   BUFFER _ T           ;   pointer   to   the   BUFFER   type

    DATA        SEGMENT
    HexChars    BUFFER    < >                      ;   allocate   structure   via   typedef
    pHexChars   PBUFFER   offset   HexChars        ;   point   to   the   allocated   structure
    DATA        ENDS