[Erlang Systems]

8 Programming own composit function

8.1 CORBA_Environment setting

Here is the complete definition of the CORBA_Environment structure, defined in file "ic.h" :

/* Environment definition */
typedef struct {

  /*----- CORBA compatibility part ---------------------------------------*/
  CORBA_exception_type   _major;          /* Exception tag, initially set 
                                             to CORBA_NO_EXCEPTION        */

  /*----- External Implementation part - initiated by the user -----------*/
  int                    _fd;             /* File descriptor              */
  char                  *_inbuf;          /* Pointer to buffer for input  */
  int                    _inbufsz;        /* Max size of input buffer     */
  char                  *_outbuf;         /* Pointer to buffer for output */
  char                   _regname[256];   /* Pointer for registered name  */
  erlang_pid            *_to_pid;         /* Process identity for caller  */
  erlang_pid            *_from_pid;       /* Process identity for callee  */ 


  /*----- Internal Implementation part - used by the server/client -------*/
  int                    _iin;            /* Index for input buffer       */
  int                    _iout;           /* Index for output buffer      */
  char                   _operation[256]; /* Pointer for operation name   */
  int                    _received;       /* Used to count parameters     */
  erlang_pid             _caller;         /* Used to identify the caller  */
  erlang_ref             _unique;         /* Used to identify the call    */
  CORBA_char            *_exc_id;         /* Exception id field           */
  void                  *_exc_value;      /* Exception value field        */
  
} CORBA_Environment;

#endif
    

The structure is semantically divided into three areas :

Observe that the advanced user that wishes to write it's own composit functions have to have good knowledge of Erl_interface or/and EI-* functions.

8.2 The Corba Compatibility area of CORBA_Environment

Containes only one (1) field, the _major which is defined as a CORBA_Exception_type. The CORBA_Exception type is forced to be an integer type due to implementation details and in the current version can be one of :

The current definition of these values looks like :

      
#ifndef CORBA_NO_EXCEPTION
#define CORBA_NO_EXCEPTION      0
#endif

#ifndef CORBA_SYSTEM_EXCEPTION
#define CORBA_SYSTEM_EXCEPTION -1
#endif

    

8.3 The External Implementation area of CORBA_Environment

This area contains seven (7) fields :

8.4 The Internal Implementation area of CORBA_Environment

This area contains eight (8) fields :

The advanced user that defines it's own composit/switch functions have to update/support these values at a way similat to the use of these in the generated code.

8.5 Setting System Exceptions

If the advanced user wishes to set own system exceptions at critical positions on the code, it is strongly recommended to use one of the current values :

The value of the _exc_value field should be then set to a string that explains the problem in an informative way. The user should use the functions CORBA_exc_set/4 and CORBA_exception_free/1 to free the exception. The user have to use CORBA_exception_id/1 and CORBA_exception_value/1 to access exception information. Prototypes for these functions are declared in "ic.h"

8.6 Guidlines for the advanced user :

Here are some guidelines for the composit function programmer:


Copyright © 1991-98 Ericsson Telecom AB