home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mod201j.zip / modula2.exe / os2demo / wpfoot / foot.def next >
Text File  |  1995-04-14  |  3KB  |  109 lines

  1. (*$DLL       to be implemented as a dynamic link library                *)
  2. (*$XL+       language extensions: '_' for names, OOP-facilities         *)
  3. (*$CDECL+    C-style procedures                                         *)
  4. (*$A         default alignment for record fields                        *)
  5.  
  6.  
  7. DEFINITION MODULE FOOT;
  8.  
  9. (***************************************************************************
  10.   OS/2 2.x/3.0 Workplace Shell interface for class 'Foot'.
  11.  
  12.   This is the Modula-2 version of a minimum WPS-class.
  13.  
  14.   Copyright (c) 1995 by Juergen Neuhoff
  15. ****************************************************************************)
  16.  
  17. IMPORT SOM;          (* needed for basic SOM features *)
  18.  
  19.  
  20.  
  21. (***************************************************************************
  22.   Additional IMPORT-, TYPE-, and CONST-declarations needed for the
  23.   interfaces of class 'Foot' and its metaclass.
  24. ****************************************************************************)
  25.  
  26. IMPORT WPABS;        (* this module contains the parent class interface *)
  27.  
  28.  
  29.  
  30. (***************************************************************************
  31.   SOM class API for 'Foot', including type-bound procedures
  32. ****************************************************************************)
  33.  
  34. (* These types are almost always needed for a SOM class description *)
  35.  
  36. TYPE PSOMClass         = SOM.PSOMClass;
  37. TYPE INTEGER4          = SOM.INTEGER4;
  38. TYPE somMToken         = SOM.somMToken;
  39. TYPE somDToken         = SOM.somDToken;
  40. TYPE somMethodProc     = SOM.somMethodProc;
  41. TYPE PFoot             = POINTER TO Foot;    (* instance pointer *)
  42. TYPE PM_WPAbstract     = WPABS.M_WPAbstract; (* metaclass pointer *)
  43.  
  44. (* major and minor version numbers for new SOM class 'Foot' *)
  45.  
  46. CONST
  47.   Foot_MajorVersion    = 1;
  48.   Foot_MinorVersion    = 1;
  49.  
  50.  
  51. (*
  52.  * Declare the C specific class data structure
  53.  *)
  54. TYPE
  55.   FootCClassDataStructure = RECORD
  56.     parentMtab              : SOM.somMethodTabs;
  57.     instanceDataToken       : SOM.somDToken;
  58.                             END;
  59. VAR
  60.   FootCClassData          : FootCClassDataStructure;
  61.  
  62.  
  63.  
  64. (* Every SOM class has a public <class>ClassData structure,
  65.    whose fields are tokens needed for method resolution.
  66.    In this example there are 14 token fields for the 14 methods
  67.    of the SOM class 'Foot'.
  68. *)
  69. TYPE
  70.   FootClassDataStructure    = RECORD
  71.     classObject               : PSOMClass;
  72.                               END;
  73.  
  74. VAR
  75.   FootClassData : FootClassDataStructure;
  76.  
  77.  
  78. (* Class 'Foot' is expressed as an extension of record type 'WPAbstract'
  79.    inheriting all record fields and type bound procedures.
  80.    The directive '$SOM+' tells the compiler to treat the new record
  81.    type 'Foot' as a SOM class, and not as an extended Modula-2 record.
  82. *)
  83. TYPE
  84.   (*$SOM+ *)
  85.   Foot = RECORD( WPABS.WPAbstract ) END;
  86.   (*$SOM- *)
  87.  
  88.  
  89. (* Every SOM class must have <class>NewClass procedure *)
  90.  
  91. PROCEDURE FootNewClass
  92. (
  93.   majorVersion  : INTEGER4;
  94.   minorVersion  : INTEGER4
  95. )               : PSOMClass;
  96.  
  97.  
  98. (* A SOM class may have type bound procedures (also known as methods).
  99.    For each of the following type bound procedures a corresponding
  100.    token field must have been specified in a previous <class>ClassData
  101.    record variable.
  102. *)
  103.  
  104. (* no type bound procedures for this sample class *)
  105.  
  106.  
  107.  
  108. END FOOT.
  109.