home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v5.zip / TOOLKT21 / SC / SOMOBJ.SC < prev    next >
Text File  |  1993-05-03  |  11KB  |  244 lines

  1.  
  2. # This file was generated by the SOM Compiler.
  3. # FileName: somobj.sc.
  4. # Generated using:
  5. #     SOM Precompiler spc: 1.22
  6. #     SOM Emitter emitcsc: 1.10
  7.  
  8. --  SOMObject: System Object Model root class
  9. --  Copyright (c) International Business Machines Corporation
  10. --                1991, 1992
  11.  
  12. class: SOMObject, 
  13.     external stem = somob, function prefix = somo_, major version = 1, 
  14.     minor version = 1, file stem = somobj;
  15.  
  16.     --  This is the SOM root class, all SOM classes must be descended from
  17.     --  <SOMObject>. <SOMObject> has no instance data so there is no
  18.     --  per-instance cost to to being descended from it.
  19.  
  20.  
  21. release order:
  22.     somInit, somUninit, somFree, 
  23.     somMissingMethod, somGetClassName, somGetClass, 
  24.     somIsA, somRespondsTo, somIsInstanceOf, 
  25.     somGetSize, somDumpSelf, somDumpSelfInt, 
  26.     somPrintSelf, somFreeObj, somDispatchV, 
  27.     somDispatchL, somDispatchA, somDispatchD;
  28.  
  29. methods:
  30. group: InitTerm;
  31.  
  32.     --  Initialization / Termination group
  33.  
  34.     void    somFree();
  35.  
  36.     --  Releases the storage associated with <self>, assuming that <self>
  37.     --  was created by <somNew> (or another class method that used
  38.     --  <somNew>).  No future references should be made to <self>.  Will
  39.     --  call <somUninit> on <self> before releasing the storage.
  40.     -- 
  41.     --  This method must only be called on objects created by <somNew> (see
  42.     --  the definition of <somClass>) and never on objects created by
  43.     --  <somRenew>.
  44.     -- 
  45.     --  It should not be necessary to override this method. (Override
  46.     --  <somUninit> instead.)
  47.  
  48.     void    somInit();
  49.  
  50.     --  Initializes <self>.  As instances of <SOMObject> do not have any
  51.     --  instance data there is nothing to initialize and you need not call
  52.     --  this method.  It is provided to induce consistency among
  53.     --  subclasses that require initialization.
  54.     -- 
  55.     --  <somInit> is called automatically as a side effect of object
  56.     --  creation (ie, by <somNew>).  If this effect is not desired, you
  57.     --  can supply your own version of <somNew> (in a user-written metaclass)
  58.     --  which does not invoke <somInit>.
  59.     -- 
  60.     --  When overriding this method you should always call the parent class
  61.     --  version of this method BEFORE doing your own initialization.
  62.  
  63.     void    somUninit();
  64.  
  65.     --  Un-initializes self.  As instances of <SOMObject> do not have any
  66.     --  instance data there is nothing to un-initialize and you need not
  67.     --  call this method.  It is provided to induce consistency among
  68.     --  subclasses that require un-initialization.
  69.     -- 
  70.     --  Use this method to clean up anything necessary such as dynamically
  71.     --  allocated storage. However this method does not release the actual
  72.     --  storage assigned to the object instance. This method is provided as
  73.     --  a complement to <somFree> which also releases the storage
  74.     --  associated with a dynamically allocated object. Usually you would
  75.     --  just call <somFree> which will always call <somUninit>. However, in
  76.     --  cases where <somRenew> (see the definition of <SOMClass>) was used
  77.     --  to create an object instance, <somFree> cannot be called and you
  78.     --  must call <somUninit> explicitly.
  79.     -- 
  80.     --  When overriding this method you should always call the parentclass
  81.     --  version of this method AFTER doing your own un-initialization.
  82.  
  83. group: Access;
  84.  
  85.     SOMClass *   somGetClass();
  86.  
  87.     --  Returns this object's class object.
  88.  
  89.     zString    somGetClassName();
  90.  
  91.     --  Returns a pointer to this object's class's name, as a NULL
  92.     --  terminated string.
  93.     -- 
  94.     --  It should not be necessary to override this method as it just
  95.     --  invokes the class object's method (<somGetName>) to get the name.
  96.  
  97.     integer4    somGetSize();
  98.  
  99.     --  Returns the size of this instance in bytes.
  100.  
  101. group: Testing;
  102.  
  103.     int    somIsA(SOMClass *aClassObj);
  104.  
  105.     --  Returns 1 (true) if <self>'s class is a descendent class of
  106.     --  <aClassObj> and 0 (false) otherwise.  Note: a class object is
  107.     --  considered to be descended from itself for the purposes of this
  108.     --  method.
  109.  
  110.     int    somIsInstanceOf(SOMClass *aClassObj);
  111.  
  112.     --  Returns 1 (true) if <self> is an instance of the specified
  113.     --  <aClassObj> and 0 (false) otherwise.
  114.  
  115.     int    somRespondsTo(IN somId mId);
  116.  
  117.     --  Returns 1 (true) if the indicated method is supported by this
  118.     --  object's class and 0 (false) otherwise.
  119.  
  120. group: Dynamic;
  121.  
  122.     --  These methods make it easier for very dynamic domains to bind to
  123.     --  the SOM object protocol boundry.
  124.     -- 
  125.     --  These methods determine the appropriate method procedure and then
  126.     --  call it with the arguments specified.  The default implementation
  127.     --  of these methods provided in this class simply lookup the method by
  128.     --  name and call it.  However, other classes may choose to implement
  129.     --  any form of lookup they wish.  For example, one could provide an
  130.     --  implementation of these methods that used the CLOS form of method
  131.     --  resolution. For domains that can do so it will generally be much
  132.     --  faster to invoke their methods directly rather than going through a
  133.     --  dispatch method.  However, all methods are reachable through the
  134.     --  dispatch methods.  SOM provides a small set of external procedures
  135.     --  that wrap these method calls so that the caller need never do method
  136.     --  resolution.
  137.     -- 
  138.     --  These methods are declared to take a variable length argument list,
  139.     --  but like all such methods the SOM object protocol boundry requires
  140.     --  that the variable part of the argument list be assembled into the
  141.     --  standard, platform-specific, data structure for variable argument
  142.     --  lists before the method is actually invoked.  This can be very
  143.     --  useful in domains that need to construct the argument list at
  144.     --  runtime. As they can invoke methods without being able to put the
  145.     --  constructed arguments in the normal form for a call.  This is
  146.     --  helpful because such an operation is usually impossible in most
  147.     --  high level languages and platform-specific assembler language
  148.     --  routines would have to be used.
  149.     -- 
  150.     --  Note: It was decided to have different methods for different return
  151.     --  value shapes. This avoids the memory mangement problems that would
  152.     --  arise in some domains if an additional parameter was required to
  153.     --  carry the return value.
  154.     -- 
  155.     --  Note: SOM does not support return values except for the four
  156.     --  families shown below. Within a family (such as integer) SOM only
  157.     --  supports the largest member.
  158.  
  159.     void    somDispatchV(INOUT somId methodId,
  160.         INOUT somId descriptor,
  161.         ...);
  162.  
  163.     --  Does not return a value.
  164.  
  165.     integer4    somDispatchL(INOUT somId methodId,
  166.         INOUT somId descriptor,
  167.         ...);
  168.  
  169.     --  Returns a 4 byte quanity in the normal manner that integer data is
  170.     --  returned. This 4 byte quanity can, of course, be something other
  171.     --  than an integer.
  172.  
  173.     void *   somDispatchA(INOUT somId methodId,
  174.         INOUT somId descriptor,
  175.         ...);
  176.  
  177.     --  Returns a data structure address in the normal manner that such data is
  178.     --  returned.
  179.  
  180.     float8    somDispatchD(INOUT somId methodId,
  181.         INOUT somId descriptor,
  182.         ...);
  183.  
  184.     --  Returns a 8 byte quanity in the normal manner that floating point
  185.     --  data is returned.
  186.  
  187. group: Development;
  188.  
  189.     --  The methods in this group are provided to support program
  190.     --  development.  They have been defined in such a way that most
  191.     --  development contexts will find them easy to expoit. However, some
  192.     --  contexts may need to customize their I/O facilities. We have
  193.     --  attempted to allow this customization in a very portable manner,
  194.     --  however not all contexts will be able to perform the customization
  195.     --  operations directly because they require passing function
  196.     --  parameters. We chose this approach because it allows great
  197.     --  platform-neutral flexibility and we felt that any provider of
  198.     --  development support would find it reasonable to provide the
  199.     --  customizations necessary for her/his specific development
  200.     --  environment.
  201.     -- 
  202.     --  The chosen approach relies on a character output routine.  An
  203.     --  external variable, <SOMOutCharRoutine>, points to this routine.  The
  204.     --  SOM environment provides an implementation of this routine that should
  205.     --  work in most development environments (it writes to the standard output
  206.     --  stream).  A development context can, however, assign a new value to
  207.     --  <SOMOutCharRoutine> and thereby redefine the output process.  SOM
  208.     --  provides no special support for doing this assigment.
  209.  
  210.     SOMObject *   somPrintSelf();
  211.  
  212.     --  Uses <SOMOutCharRoutine> to write a brief string with identifying
  213.     --  information about this object.  The default implementation just gives
  214.     --  the object's class name and its address in memory.
  215.     --  <self> is returned.
  216.  
  217.     void    somDumpSelf(int level);
  218.  
  219.     --  Uses <SOMOutCharRoutine> to write a detailed description of this object
  220.     --  and its current state.
  221.     -- 
  222.     --  <level> indicates the nesting level for describing compound objects
  223.     --  it must be greater than or equal to zero.  All lines in the
  224.     --  description will be preceeded by <2*level> spaces.
  225.     -- 
  226.     --  This routine only actually writes the data that concerns the object
  227.     --  as a whole, such as class, and uses <somDumpSelfInt> to describe
  228.     --  the object's current state.  This approach allows readable
  229.     --  descriptions of compound objects to be constructed.
  230.     -- 
  231.     --  Generally it is not necessary to override this method, if it is
  232.     --  overriden it generally must be completely replaced.
  233.  
  234.     void    somDumpSelfInt(int level);
  235.  
  236.     --  Uses <SOMOutCharRoutine> to write out the current state of this object.
  237.     --  Generally this method will need to be overridden.  When overriding
  238.     --  it, begin by calling the parent class form of this method and then
  239.     --  write out a description of your class's instance data. This will
  240.     --  result in a description of all the object's instance data going
  241.     --  from its root ancestor class to its specific class.
  242.  
  243. #include <somcls.sc> 
  244.