Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

sobject_p.h File Reference


Detailed Description

Private implementation include file for the simple objects library.

#include <sobject/sobject.h>
#include <sobject/dict.h>
#include <sobject/list.h>
#include <sobject/unicode.h>
#include <sobject/exc.h>
#include "sobj_sysdep_p.h"
#include "sobj_msg_p.h"

Include dependency graph for sobject_p.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Data Structures

struct  sobj_refcount
 Reference counting structure. More...
struct  sobj_binary
 Structure representing a binary simple object. More...
struct  sobj_array
 Structure representing an array object. More...
struct  sobj_vref
 Structure representing a variable referece object. More...
struct  sobj_expr
 Structure representing an expression object. More...
union  _sobj_u
 Union of simple object data fields. More...
struct  sobj
 Simple object instance structure. More...
struct  sobj_scan_input
 Structure representing an input source for a scanning operation. More...

Defines

#define RETAIN(OBJ)
 Increase the referece count of an object (retain the object).
#define UNRETAIN(OBJ)
 Decrease the referece count of an object without deletion on zero (unretain the object).
#define RELEASE(OBJ)
 Decrease the referece count of an object and delete ob zero (release the object).
#define DROP(OBJ)
 Delete an object if the referece counter is zero.
#define REFCOUNT(OBJ)   (((struct sobj_refcount *)(OBJ))->refcount & SOBJ_REFCOUNT_MASK)
 Get the current referece counter.
#define XRETAIN(OBJ)
 Increase the referece count of an object (retain the object).
#define XUNRETAIN(OBJ)
 Decrease the referece count of an object without deletion on zero (unretain the object).
#define XRELEASE(OBJ)
 Decrease the referece count of an object and delete ob zero (release the object).
#define XDROP(OBJ)
 Delete an object if the referece counter is zero.
#define SOBJ_TYPE_ISTRING   (9)
 Internal constant representing an inline string.
#define SOBJ_ISTRING_LENGTH   (sizeof(sobj_int64_t))
 The maximum length of inline strings, including the terminating null-character.
#define SOBJ_ASSERT(CONDITION, ENV, ACTION)
 Assertion macro for the simple object library.
#define sobj_abort(ENV)   (abort())
 Macro/function called for an abnormal program termination.
#define SOBJ_IS_STRING(X)
 Macro checking if a simple object is of type string.
#define SOBJ_GET_STRING(X)
 Get the string from a simple object of type string.
#define ASCII_ESC   ((char)0x1b)
 The ASCII ESC character.
#define ASCII_STX   ((char)0x2)
 The ASCII STX character.
#define ASCII_ETX   ((char)0x3)
 The ASCII ETX character.

Functions

sobjsobj_fl_alloc (void)
 Allocate a sobj instance from the freelist.
void sobj_fl_dealloc (struct sobj *)
 De-allocate a sobj instance.
sobjsobj_alloc (void)
 Allocate a new instance of a simple object.
int sobj_class_name_to_id (const char *)
 Get the class ID for the specified class name.
const char * sobj_class_id_to_name (int)
 Get the class name for a specified class ID.
sobjsobj_array_lookup (struct sobj_array *, struct sobj *, int *, struct sobj_env *)
 Internal function for performing lookup operations on plain array objects.
int sobj_getc_scan (struct sobj_scan_input *)
 Get the next character from the get function.
sobjsobj_text_unpack (struct sobj_env *, enum sobj_text_context, const char **, size_t)
 Unpack a text serialization of a simple object.
int sobj_text_unpack_scan (struct sobj_scan_input *)
 Scan for the end of a text serialization.
void sobj_text_pack (struct sobj *, enum sobj_serialization_mode, struct sobj_buffer *, struct sobj_env *)
 Create a text serialization of a simple object.
size_t sobj_text_pack_srep (struct sobj *, char *, ptrdiff_t)
 Pack a string representation of a simple object.
sobjsobj_bin_unpack (struct sobj_env *, const char **, ptrdiff_t, size_t)
 Internal function for binary deserialization.
int sobj_bin_unpack_scan (struct sobj_scan_input *)
 Scan for the end of a binary serialization.
void sobj_bin_pack (struct sobj *, struct sobj_buffer *, struct sobj_env *)
 Internal function for creating a binary serialization.
sobjsobj_pack_do_callback (struct sobj *, struct sobj_env *)
 Internal function performing the ClassEnv::pack() callback.
sobjsobj_unpack_do_callback (struct sobj *, struct sobj_env *)
 Internal function performing the ClassEnv::unpack() callback.
int sobj_char_encode_utf8 (unsigned, char *)
 Encode a UNICODE code point to a UTF-8 sequence.
const char * sobj_char_html_cref (unsigned)
 Return the character reference for the specified code point.
sobjsobj_pexpr_parse (struct sobj_env *, const char **, int)
 Internal function for parsing a text serialization of an expression object.
void sobj_op_sign (enum sobj_expr_type, bool, char *, char *, char *, enum sobj_text_context *, int *)
 Get operator sign information for an operator.
int sobj_op_bin_code (enum sobj_expr_type)
 Get the binary serialization code for an operator.
int sobj_op_n (enum sobj_expr_type)
 Get the number of operands for an operator.
sobjsobj_addr_set (struct sobj *, struct sobj *, struct sobj *, bool, struct sobj_env *)
 Internal function performing a set operation.
sobjsobj_addr_get (struct sobj *, struct sobj *, bool, struct sobj_env *)
 Internal function performing a get operation.
size_t sobj_ucx_vref_quote (const char *, bool, char *, ptrdiff_t)
 Quote a variable referece in an extended string.
size_t sobj_ucx_vref_resolve (const char *, struct sobj_env *, struct sobj_buffer *)
 Resolve a variable referece in an extended UNICODE string.
void sobj_debug_log (const char *,...)
 Write a log message to a log file.
void sobj_dump (struct sobj *)
 Dump an object representation to standard error.
void sobj_xdump (struct sobj *)
 Dump an object structure representation of an object to standard error.
void sobj_xdump_fp (struct sobj *, FILE *)
 Dump an object structure representation of an object to a specified C stream.
void sobj_env_cleanup (void)
 Final cleanup function.
void sobj_stdenv_cleanup (void)
 Static cleanup function for the standard environment module.
void sobj_fl_cleanup (void)
 Final cleanup function for the freelists.
void sobj_debug_cleanup (void)
 Cleanup function.

Variables

volatile bool sobj_debug
 Flag indicating if the library is being debugged.
const char ASCII_ESC
 The ASCII ESC character.
const char ASCII_STX
 The ASCII STX character.
const char ASCII_ETX
 The ASCII ETX character.


Define Documentation

#define ASCII_ESC   ((char)0x1b)
 

The ASCII ESC character.

#define ASCII_ETX   ((char)0x3)
 

The ASCII ETX character.

#define ASCII_STX   ((char)0x2)
 

The ASCII STX character.

#define DROP OBJ   ) 
 

Value:

do {                                                                    \
    struct sobj_refcount *_sobj_refcount;                               \
    _sobj_refcount = (struct sobj_refcount *)(OBJ);                     \
    if ((_sobj_refcount->refcount & SOBJ_REFCOUNT_MASK) == 0            \
        && _sobj_refcount->del)                                         \
      _sobj_refcount->del(_sobj_refcount);                              \
  } while (false)
Delete an object if the referece counter is zero.

The macro does nothing if the referece counter of the specified object is non-zero.

Parameters:
OBJ A referece counted object.

#define REFCOUNT OBJ   )     (((struct sobj_refcount *)(OBJ))->refcount & SOBJ_REFCOUNT_MASK)
 

Get the current referece counter.

Parameters:
OBJ A referece counted object.

#define RELEASE OBJ   ) 
 

Value:

do {                                                                    \
    struct sobj_refcount *_sobj_refcount;                               \
    _sobj_refcount = (struct sobj_refcount *)(OBJ);                     \
    --_sobj_refcount->refcount;                                         \
    if ((_sobj_refcount->refcount & SOBJ_REFCOUNT_MASK) == 0            \
        && _sobj_refcount->del)                                         \
      _sobj_refcount->del(_sobj_refcount);                              \
  } while (false)
Decrease the referece count of an object and delete ob zero (release the object).

This macro will call the destructor callback function of the specified object if the referece counter is decreased to zero.

Parameters:
OBJ A referece counted object.

#define RETAIN OBJ   ) 
 

Value:

do {                                                                    \
    ++((struct sobj_refcount *)(OBJ))->refcount;                        \
  } while (false)
Increase the referece count of an object (retain the object).

Parameters:
OBJ A referece counted object.

#define sobj_abort ENV   )     (abort())
 

Macro/function called for an abnormal program termination.

Parameters:
ENV Environment object used for error reporting. The macro/function may or may not use the specified environment. A null-pointer represents the default environment.

#define SOBJ_ASSERT CONDITION,
ENV,
ACTION   ) 
 

Value:

do {                                                                    \
    if (!(CONDITION)) {                                                 \
      msg_runtime_error((ENV),                                          \
          "failed assertion '" #CONDITION "'");                         \
      if (sobj_debug) sobj_abort(ENV);                                  \
      ACTION;                                                           \
    }                                                                   \
  } while (false)
Assertion macro for the simple object library.

If the specified condition is false, a runtime error message is issued and the specified action is taken. The action may be a call to sobj_abort(), a statement indicating an error to the runtime environment (e.g. a return -1), or a statement correcting the problem.

If the specified action is taken is determined by the global sobj_debug flag. If this flag is set, the sobj_abort() function is called whenever an assertion fails.

Parameters:
CONDITION The condition checked by the assertion. The specified expression is evaluated exactly once.
ENV The environment object used for error reporting. A null-pointer represents the default environment.
ACTION If the asserted condition is false and the sobj_debug flag is clear, the specified action is taken. ACTION is a C statement. A trailing semicolon may be omitted.

#define SOBJ_GET_STRING  ) 
 

Value:

(                                               \
    (X)->type == SOBJ_TYPE_STRING ? (X)->u.string : (X)->u.istring)
Get the string from a simple object of type string.

Parameters:
X The string object.
Returns:
Pointer to the string value of the object.

#define SOBJ_IS_STRING  ) 
 

Value:

(                                               \
    (X)->type == SOBJ_TYPE_STRING || (X)->type == SOBJ_TYPE_ISTRING)
Macro checking if a simple object is of type string.

Parameters:
X The simple object instance to be checked.

#define SOBJ_ISTRING_LENGTH   (sizeof(sobj_int64_t))
 

The maximum length of inline strings, including the terminating null-character.

#define SOBJ_TYPE_ISTRING   (9)
 

Internal constant representing an inline string.

#define UNRETAIN OBJ   ) 
 

Value:

do {                                                                    \
    --((struct sobj_refcount *)(OBJ))->refcount;                        \
  } while (false)
Decrease the referece count of an object without deletion on zero (unretain the object).

This macro will not delete the specified object if the referece counted is decreased to zero.

Parameters:
OBJ A referece counted object.

#define XDROP OBJ   ) 
 

Value:

do {                                                                    \
    void *_sobj_object = (OBJ);                                         \
    if (_sobj_object) DROP(_sobj_object);                               \
  } while (false)
Delete an object if the referece counter is zero.

Parameters:
OBJ A referece counted object or a null-pointer.

#define XRELEASE OBJ   ) 
 

Value:

do {                                                                    \
    void *_sobj_object = (OBJ);                                         \
    if (_sobj_object) RELEASE(_sobj_object);                            \
  } while (false)
Decrease the referece count of an object and delete ob zero (release the object).

This macro will call the destructor callback function of the specified object if the referece counter is decreased to zero.

Parameters:
OBJ A referece counted object or a null-pointer.

#define XRETAIN OBJ   ) 
 

Value:

do {                                                                    \
    void *_sobj_object = (OBJ);                                         \
    if (_sobj_object) RETAIN(_sobj_object);                             \
  } while (false)
Increase the referece count of an object (retain the object).

Parameters:
OBJ A referece counted object or a null-pointer.

#define XUNRETAIN OBJ   ) 
 

Value:

do {                                                                    \
    void *_sobj_object = (OBJ);                                         \
    if (_sobj_object) UNRETAIN(_sobj_object);                           \
  } while (false)
Decrease the referece count of an object without deletion on zero (unretain the object).

This macro will not delete the specified object if the referece counted is decreased to zero.

Parameters:
OBJ A referece counted object or a null-pointer.


Function Documentation

struct sobj* sobj_addr_get struct sobj self,
struct sobj address,
bool  pure,
struct sobj_env env
 

Internal function performing a get operation.

Parameters:
self The object the get method was called on.
address The address of the get operation.
pure Flag indicating if a pure address resolution should be performed. If this flag is set, the object returned is either a propper subjobject of the called object or a null-pointer. The pure flag has the following effects:
  • Slice indices are not resolved (i.e. a null-pointer is returned).
  • Quoted addresses (unary plus) are not resolved.
  • No expression objects are created when a key or index is not found or out of bounds.
  • No self selection is performed, i.e. a null-pointer is returned if the address can't be resolved. (Self selection: In a non-pure get operation, the selected object may be the address itself if no other resolution rule matches.)
env The environment. This may be a null-pointer.
Returns:
The function returns the selected object. If the pure flag is set, this may be a null-pointer. Note that the function will never return a null-pointer if the pure flag is clear.

struct sobj* sobj_addr_set struct sobj self,
struct sobj address,
struct sobj value,
bool  slice,
struct sobj_env env
 

Internal function performing a set operation.

Parameters:
self The object the set method was called on.
address The address of the set operation.
value The value to be substituted in place of the addressed subjobject.
slice Flag indicating sliced operation. The specified value is interpreted as a slice.
env The environment. This may be a null-pointer.
Returns:
The function returns the modified object on success and a null-pointer on failure.

struct sobj* sobj_alloc void   ) 
 

Allocate a new instance of a simple object.

Returns:
The new instance.

struct sobj* sobj_array_lookup struct sobj_array sobj_array,
struct sobj key,
int *  index_ref,
struct sobj_env env
 

Internal function for performing lookup operations on plain array objects.

Plain array objects may reference a dictionary object to speed-up string key lookups (sobj_dict). If the array object exceeds a predefined size limit and no dictionary object has been created yet, a speed-up dictionary will be created and stored in the array object.

Parameters:
sobj_array The plain array object.
key The key for the lookup operation.
index_ref If index_ref is not a null-pointer and an element is bound to the specified key, the index of the element is stored to *index_ref.
env The environment. This may be a null-pointer.

void sobj_bin_pack struct sobj sobj,
struct sobj_buffer buffer,
struct sobj_env env
 

Internal function for creating a binary serialization.

Parameters:
sobj The called object. The caller must own a reference to the object, since this function will RETAIN and RELEASE (!) this object.
buffer The byte buffer receiving the serialization. This may not be a null-pointer.
env The environment. This may be a null-pointer.

struct sobj* sobj_bin_unpack struct sobj_env env,
const char **  ptr,
ptrdiff_t  length,
size_t  offset
 

Internal function for binary deserialization.

Parameters:
env The environment. This may be a null-pointer.
ptr The callers pointer to the serialization buffer.
length The length of the serialization buffer, relative to *ptr.
offset The offset of *ptr relative to the complete serialization (for error reporting).
Returns:
The function returns the deserialized object or a null-pointer on error.

int sobj_bin_unpack_scan struct sobj_scan_input input  ) 
 

Scan for the end of a binary serialization.

Parameters:
input The scan input.
Return values:
0 Success.
-1 The get function returned -1 (indicating EOF or error).

int sobj_char_encode_utf8 unsigned  code,
char *  buffer
 

Encode a UNICODE code point to a UTF-8 sequence.

The function takes a (non-null) UNICODE code point and translates it to a UTF-8 sequence. The function does not check if the code point is valid. For code points beyond 0x1fffff, the function will create non-UNICODE 5 and 6 byte UTF-8 sequences (as defined in ISO/IEC 10646-1). The generated sequences will be null-terminated.

Parameters:
code The code point. This may not be null.
buffer Pointer to the buffer receiving the UTF-8 sequence, or a null-pointer. If not a null-pointer, the UTF-8 sequence is stored to buffer[]. In the general case, this should be 7 bytes long (6 bytes for the UTF-8 sequence plus the terminating null-character).
Returns:
The function returns the length of the UTF-8 sequence, not counting the terminating null-character.

const char* sobj_char_html_cref unsigned  code  ) 
 

Return the character reference for the specified code point.

The function translates a UNICODE code point to a HTML character reference.

Parameters:
code The UNICODE code point.
Returns:
The function returns the character reference name (without the ampersand and the semicolon). If no character reference is available for the specified code point, a null-pointer is returned.

const char* sobj_class_id_to_name int  id  ) 
 

Get the class name for a specified class ID.

Parameters:
id The class ID. It is a fatal runtime error if the specified ID is not assigned.
Returns:
The requested class name. For the class ID 0 a null-pointer is returned.
Note:
The pointer returned is a pointer to the string stored in the ID table. This is safe, even in a multi-threading environment, since class names can only be added to the table, but not removed.

int sobj_class_name_to_id const char *  name  ) 
 

Get the class ID for the specified class name.

If the specified class name is unknown, a new class ID is assigned to the specified name.

Parameters:
name The class name. If this is a null-pointer or an empty string, the corresponding class ID will be 0.
Returns:
The class ID. 0 if the specified name is a null-pointer or an empty string.

void sobj_debug_cleanup void   ) 
 

Cleanup function.

This is the cleanup function called by sobj_cleanup().

See also:
sobj_cleanup().

void sobj_debug_log const char *  format,
  ...
 

Write a log message to a log file.

The function appends the specified log message to a log file specified in the environment variable SOBJ_DEBUG_FILENAME. If this environment variable is not set, the log message is discarded (i.e. the call has no effect).

Parameters:
format printf-style format string.

void sobj_dump struct sobj sobj  ) 
 

Dump an object representation to standard error.

The function uses the SOBJ_SER_TEXT_DISPLAY mode (i.e. the ClassEnv::pack() call is skipped).

Parameters:
sobj The object to be dumped.
See also:
sobj_xdump().

void sobj_env_cleanup void   ) 
 

Final cleanup function.

struct sobj* sobj_fl_alloc void   ) 
 

Allocate a sobj instance from the freelist.

Returns:
The allocated (un-initialized) instance.

void sobj_fl_cleanup void   ) 
 

Final cleanup function for the freelists.

The function checks if all allocated objects have been put back to the freelist. If a freelist is incomplete, the freelist blocks are not de-allocated.

void sobj_fl_dealloc struct sobj sobj  ) 
 

De-allocate a sobj instance.

The instance is added to the freelist.

Parameters:
sobj The de-allocated instance.

int sobj_getc_scan struct sobj_scan_input input  ) 
 

Get the next character from the get function.

Parameters:
input The input source.
Returns:
The next character or -1 on EOF or error.

int sobj_op_bin_code enum sobj_expr_type  op  ) 
 

Get the binary serialization code for an operator.

Parameters:
op The operator (represented by an expression type).
Returns:
The binary serialization code.

int sobj_op_n enum sobj_expr_type  op  ) 
 

Get the number of operands for an operator.

Parameters:
op The operator (represented by an expression type).
Returns:
The number of operands.

void sobj_op_sign enum sobj_expr_type  op,
bool  compact,
char *  op_sign_0,
char *  op_sign_1,
char *  op_sign_2,
enum sobj_text_context op2_context,
int *  op_n
 

Get operator sign information for an operator.

Parameters:
op The operator (represented by an expression type).
compact Flag indicating if the compact variant of the operator sign is requested.
op_sign_0 Buffer receiving the first part of the operator sign. This part is put before the first operand.
op_sign_1 Buffer receiving the second part of the operator sign. This part is put after the first operand and before the second operand (if the operator has more than one operand).
op_sign_2 Buffer receiving the third part of the operator sign. This part is put after the second operand.
op2_context If this is not a null-pointer, the parsing context for the second operand is stored to *op2_context.
op_n If this is not a null-pointer, the number of operands is stored to *op_n.
Note:
The buffers receiving the operator signs must be large enough to hold the copy. The buffer sizes should be at least 8 bytes.

struct sobj* sobj_pack_do_callback struct sobj sobj,
struct sobj_env env
 

Internal function performing the ClassEnv::pack() callback.

The function processes the passed object sobj recursively, calling the ClassEnv::pack() callback on the leaf objects first.

Parameters:
sobj The called object. The function will steal a reference if the object is replaced by the callback.
env The environment. This may not be a null-pointer.
Returns:
The callback object or a new reference to the replaced object. If the ClassEnv::pack() callback returns null, an error message is issued and the called object sobj is returned as is.
Note:
The function handles references in a way that the following sequence works:
          RETAIN(x);
          x = sobj_pack_do_callback(x, env);
          // Code
          RELEASE(x);

Never call this function without owning a reference to the called object sobj.

struct sobj* sobj_pexpr_parse struct sobj_env env,
const char **  ptr,
int  offset
 

Internal function for parsing a text serialization of an expression object.

Parameters:
env The environment (for error reporting). This may be a null-pointer.
ptr Pointer to the callers parsing pointer into the text serialization. *ptr should point to the first character of the expression serialization. On success *ptr will be advanced to the first character following the expression serialization.
offset The offset of the first character of the expression serialization relative to the first character of the entire serialization (required for error reporting).
Returns:
On success, a simple object representing the expression is returned. In case of a parsing error, a null-pointer is returned.

void sobj_stdenv_cleanup void   ) 
 

Static cleanup function for the standard environment module.

This function is called with the first call to sobj_env_STANDARD()<c/sobj_env_STANDARD.

void sobj_text_pack struct sobj sobj,
enum sobj_serialization_mode  mode,
struct sobj_buffer buffer,
struct sobj_env env
 

Create a text serialization of a simple object.

Parameters:
sobj The called object. The caller must own a reference to the object, since this function will RETAIN and RELEASE (!) this object.
mode The serialization mode. This must be one of the text serialization modes SOBJ_SER_TEXT, SOBJ_SER_TEXT_COMPACT, SOBJ_SER_TEXT_PRETTY, SOBJ_SER_TEXT_DISPLAY.
buffer Buffer receiving the text serialization.
env The environment object (required for the ClassEnv::pack() aka sobj_env_class::so_pack callback). A null-pointer prevents the callback.

size_t sobj_text_pack_srep struct sobj sobj,
char *  buffer,
ptrdiff_t  buffer_length
 

Pack a string representation of a simple object.

Parameters:
sobj The simple object instance.
buffer Buffer receiving the string representation. This may be a null-pointer.
buffer_length The length of the output buffer (in bytes).
Returns:
The number of bytes required for the string representation (not counting the terminating null-byte).

struct sobj* sobj_text_unpack struct sobj_env env,
enum sobj_text_context  context,
const char **  ptr,
size_t  offset
 

Unpack a text serialization of a simple object.

The function unpacks a full text serialization of a simple object.

Parameters:
env The environment. This may be a null-pointer.
context The text serialization context.
ptr Pointer into the text serialization. The text serialization is exprected to be null-terminated.
offset The offset of *ptr relative to the text serialization.
Returns:
The function returns an sobj with a refcount of 0. If no simple object serialization is recognized, a null-pointer is returned.
Note:
In string context (SOBJ_CTX_STRING), the function will always return an instance of a simple object.

int sobj_text_unpack_scan struct sobj_scan_input input  ) 
 

Scan for the end of a text serialization.

Parameters:
input The scan input.
Return values:
0 Success.
-1 The get function returned -1 (indicating EOF or error).

size_t sobj_ucx_vref_quote const char *  ucx,
bool  embedded,
char *  buffer,
ptrdiff_t  buffer_length
 

Quote a variable referece in an extended string.

The function quotes a variable referece in an extended string.

Parameters:
ucx The extended UNICODE string vref.
embedded Flag indicating if the vref is embedded within an extended string. If embedded is true, ucx points to the ESC-STX sequences introducing the embedded vref. If embedded is false, ucx points to the first character of the referece string.
buffer The buffer receiving the quoted variable referece, including a terminating null-byte. If this is a null-pointer, no output is generated.
buffer_length The size of the specified buffer. If this is 0 or negative, no output is generated.
Returns:
The function returns the number of bytes requires to store the quoted variable referece, not counting the terminating null-byte.

size_t sobj_ucx_vref_resolve const char *  ucx,
struct sobj_env env,
struct sobj_buffer buffer
 

Resolve a variable referece in an extended UNICODE string.

The function recursively resolves a variable referece in an extended UNICODE string.

Parameters:
ucx Pointer to the first character of a variable referece.
env The environment. This may be a null-pointer.
buffer The buffer receiving the resolved string, not including a terminating null-byte. The resolved string is appended to the buffer.
Returns:
The function returns the number of bytes of the resolved variable referece.
Note:
The string created will not be null-terminated.

struct sobj* sobj_unpack_do_callback struct sobj sobj,
struct sobj_env env
 

Internal function performing the ClassEnv::unpack() callback.

In contrast to the sobj_pack_do_callback() function, the callback is not callback on the subobjects first. This is because of the recursive object construction processes already processes the subobjects in the correct order.

Parameters:
sobj The called object. The function will steal a reference if the object is replaced by the callback.
env The environment object. This may not be a null-pointer.
Returns:
The callback object or a new reference to the replaced object. If the ClassEnv::unpack() callback returns null, an error message is issued and the called object sobj is returned as is.
Note:
The function handles references in a way that the following sequence works:
          RETAIN(x);
          x = sobj_unpack_do_callback(x, env);
          // Code
          RELEASE(x);

Never call this function without owning a reference to the called object sobj.

void sobj_xdump struct sobj sobj  ) 
 

Dump an object structure representation of an object to standard error.

Parameters:
sobj The object to be dumped.
See also:
sobj_xdump_fp().

void sobj_xdump_fp struct sobj sobj,
FILE *  out
 

Dump an object structure representation of an object to a specified C stream.

Parameters:
sobj The object to be dumped.
out The output stream.


Variable Documentation

const char ASCII_ESC
 

The ASCII ESC character.

const char ASCII_ETX
 

The ASCII ETX character.

const char ASCII_STX
 

The ASCII STX character.

volatile bool sobj_debug
 

Flag indicating if the library is being debugged.

This flag may be set at runtime using a debugger. It causes the sobj_abort() function to be called in case of a failed assertion.


Generated on Sat Jul 23 16:05:54 2005 for sobject by  doxygen 1.3.9.1