(*$DLL      ANIMAL can  be implemented as dynamic link library *)

DEFINITION MODULE ANIMAL;

(***************************************************************************
  OS/2 2.1 interface for SOM class Animal

  Copyright (c) 1994 by Juergen Neuhoff
****************************************************************************)

(*$XL+       Modula-2 language extensions: '_' allowed for symbol names *)
(*$CDECL+    C-style procedures                                         *)
(*$A         default alignment for record fields                        *)

IMPORT SOM;

(************************************************************************
  Additional TYPE- and CONST-declarations supporting Animal
*************************************************************************)

IMPORT OS2DEF;
IMPORT SYSTEM;

TYPE PSZ                    = OS2DEF.PSZ;


(*************************************************************************
  SOM class API for Animal, including type-bound procedures
**************************************************************************)

TYPE PSOMClass              = SOM.PSOMClass;
TYPE INTEGER4               = SOM.INTEGER4;
TYPE somMToken              = SOM.somMToken;
TYPE somDToken              = SOM.somDToken;
TYPE somMethodProc          = SOM.somMethodProc;
TYPE PAnimal                = POINTER TO Animal;
TYPE PM_Animal              = POINTER TO M_Animal;

CONST
  Animal_MajorVersion     = 0;
  Animal_MinorVersion     = 0;

TYPE
  AnimalClassDataStructure     = RECORD
    classObject                  : PSOMClass;
    setSound                     : somMToken;
    getGenus                     : somMToken;
    getSpecies                   : somMToken;
    talk                         : somMToken;
    display                      : somMToken;
                                 END;

VAR
  AnimalClassData : AnimalClassDataStructure;

TYPE
  (*$SOM+ *)
  Animal = RECORD( SOM.SOMObject ) END;
  (*$SOM- *)


PROCEDURE AnimalNewClass
(
  majorVersion  : INTEGER4;
  minorVersion  : INTEGER4
)               : PSOMClass;

PROCEDURE( Self : PAnimal ) setSound
(
  mySound      : OS2DEF.PSZ
);

PROCEDURE( Self : PAnimal ) getGenus() : OS2DEF.PSZ;

PROCEDURE( Self : PAnimal ) getSpecies() : OS2DEF.PSZ;

PROCEDURE( Self : PAnimal ) talk();

PROCEDURE( Self : PAnimal ) display();


(*************************************************************************
  SOM class API for M_Animal, including type-bound procedures
**************************************************************************)

CONST
  M_Animal_MajorVersion   = 0;
  M_Animal_MinorVersion   = 0;

TYPE
  M_AnimalClassDataStructure   = RECORD
    classObject                  : PSOMClass;
    newAnimal                    : somMToken;
                                 END;

VAR
  M_AnimalClassData : M_AnimalClassDataStructure;

TYPE
  (*$SOM+ *)
  M_Animal = RECORD( SOM.SOMClass ) END;
  (*$SOM- *)


PROCEDURE M_AnimalNewClass
(
  majorVersion : INTEGER4;
  minorVersion : INTEGER4
)              : PSOMClass;


PROCEDURE( Self : PM_Animal ) newAnimal
(
  sound         : OS2DEF.PSZ
)               : SYSTEM.ADDRESS;


END ANIMAL.
