XCLE



Generic Object Container

Instructions manual


XCLE: eXtensible Concatenative Language Engine
Copyright (C) 2000-2006 Yann LANDRIN-SCHWEITZER a.k.a. Varkhan


This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


Author: Yann LANDRIN-SCHWEITZER
Contact: varkhan@varkhan.net
Homepage: http://www.varkhan.net/


Object type definitions


Macro XCLE_OT_VOID

XCLE_OT_VOID
The Void type identifier.



Macro XCLE_OT_INTG

XCLE_OT_INTG
The Intg type identifier.



Macro XCLE_OT_FLTP

XCLE_OT_FLTP
The Fltp type identifier.



Macro XCLE_OT_STRG

XCLE_OT_STRG
The Strg type identifier.



Macro XCLE_OT_LIST

XCLE_OT_LIST
The List type identifier.



Macro XCLE_OT_CODE

XCLE_OT_CODE
The Code type identifier.




Generic Object methods


Function XCLE_ObjectAlloc

XCLE_Object XCLE_ObjectAlloc(XCLE_Type typ) ;
Allocates an empty, undefined object.

Args:
typ: the type of object to allocate


Returns:
NULL: if no memory was available or the type was not recognized
else a new XCLE_Object of type 'typ'.


Errors:
ENOMEM: if no memory was available

OOPS:
Something was wrong here




Function XCLE_ObjectClone

XCLE_Object XCLE_ObjectClone(XCLE_Object obj) ;
Clones an object.

Args:
obj: object to clone


Returns:
NULL: if a NULL object was passed as argument, or no memory was available
else a cloned version of the object (flat copy).


Errors:
EINVAL: if a NULL object was passed as argument
ENOMEM: if no memory was available

OOPS:
Something was wrong here




Function XCLE_ObjectDnRef

XCLE_Object XCLE_ObjectDnRef(XCLE_Object obj) ;
Decreases the references count of an object.

Args:
obj: XCLE_Object to dereference


Returns:
NULL: if a NULL object was passed as argument
else the dereferenced object.


Errors:
EINVAL: if a NULL object was passed as argument



Function XCLE_ObjectFree

void XCLE_ObjectFree(XCLE_Object obj) ;
Frees an object if it is unreferenced.

Args:
obj: object to free


Note:
The object is freed if and only if its reference count has fallen to zero, meaning
no other referenced object and no object storage structure contains it anymore.




Function XCLE_ObjectType

XCLE_Type XCLE_ObjectType(XCLE_Object obj) ;
Returns the type of an object.

Args:
obj: object to query


Returns:
-1: if a NULL object was passed as argument
else the numeric identifier for the object's type.


Errors:
EINVAL: if a NULL object was passed as argument



Function XCLE_ObjectTypeName

char * XCLE_ObjectTypeName(XCLE_Type typ) ;
Returns a name for a numeric type identifier.

Args:
typ: numeric identifier for a type


Returns:
"": if an unknown type was given
else a string name for that type.




Function XCLE_ObjectEqual

unsigned char XCLE_ObjectEqual(XCLE_Object obj, XCLE_Object objw) ;
Tests the equality between objects.

Args:
obj: object to test
objw: reference object


Returns:
-1: if a NULL object was passed as argument
0: if the two objects were distinct
+1: if the two objects were equal


Errors:
EINVAL: if a NULL object was passed as argument



Macro XCLE_AnyToObject

XCLE_Object XCLE_AnyToObject(XCLE_<Type> obj) ;
Converts any object into its generic version.

Args:
obj: object to convert


Returns:
a generic object containing 'obj'




Function XCLE_ObjectTo<Type>

XCLE_<Type> XCLE_ObjectTo<Type>(XCLE_Object obj) ;
Transforms a generic object into a <Type> object, checking that the conversion is possible.

Args:
obj: the object to convert


Returns:
NULL: if the object was NULL, or of a different type
else the converted object.


Errors:
EINVAL: if the object was NULL, or of an incompatible type




Generated by textdoc2html - 2006-02-22