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

Python Module


Detailed Description

API for Python modules using the sobject Python module.

This module provides an API for interacting the the sobject Python module. It is intended for writers of other Python modules wanting to interact with the sobject Python module (e.g. creating or evaluating instances of the SObject Python class).

The public header for this API is the file <sobject/py.h>. Note that you have to define the preprocessor symbol MODULE_NAME before including the public header file, see documentation of <sobject/py.h> for details.


Files

file  py.h
 Include file for Python extension modules using the Python sobject extension.

Type Objects

#define SOBJ_PY_SObjectType   ((PyTypeObject *)SOBJ_PY_SYM(SObjectType))
 The type object for simple objects.
#define SOBJ_PY_ClassEnvType   ((PyTypeObject *)SOBJ_PY_SYM(ClassEnvType))
 The type object for class environment objects.
#define SOBJ_PY_EnvType   ((PyTypeObject *)SOBJ_PY_SYM(EnvType))
 The type objects for environment objects.

API Function Types

These function types are used by the Python module API.

typedef PyObject * sobj_py_wrap__fntype (struct sobj *sobj)
 Function type for the sobj_py_wrap() function.
typedef sobjsobj_py_unwrap__fntype (PyObject *pyobj)
 Function type for the sobj_py_unwrap() function.
typedef int sobj_py_Check__fntype (PyObject *pyobj)
 Function type for the type check functions.
typedef sobjsobj_py_PyObject_to_sobj__fntype (PyObject *pyobj, const char *cn)
 Function type for the sobj_py_PyObject_to_sobj() function.

Defines

#define sobj_py_wrap   ((sobj_py_wrap__fntype *)SOBJ_PY_SYM(wrap))
 Wrap a simple object into a Python object.
#define sobj_py_unwrap   ((sobj_py_unwrap__fntype *)SOBJ_PY_SYM(unwrap))
 Unwrap a simple object from a Python object.
#define sobj_py_PyObject_to_sobj   ((sobj_py_PyObject_to_sobj__fntype *)SOBJ_PY_SYM(PyObject_to_sobj))
 Convert a Python object to a simple object.
#define sobj_py_SObject_Check   ((sobj_py_Check__fntype *)SOBJ_PY_SYM(SObject_Check))
 Check if a Python object is an instance of a simple object.
#define sobj_py_ClassEnv_Check   ((sobj_py_Check__fntype *)SOBJ_PY_SYM(ClassEnv_Check))
 Check if a Python object is an instance of a simple object class environment.
#define sobj_py_Env_Check   ((sobj_py_Check__fntype *)SOBJ_PY_SYM(Env_Check))
 Check if a Python object is an instance of a simple object environment.
#define sobj_py_SObject_CheckExact   ((sobj_py_Check__fntype *)SOBJ_PY_SYM(SObject_CheckExact))
 Check if a Python object is an exact instance of a simple object.
#define sobj_py_ClassEnv_CheckExact   ((sobj_py_Check__fntype *)SOBJ_PY_SYM(ClassEnv_CheckExact))
 Check if a Python object is an exact instance of a simple object class environment.
#define sobj_py_Env_CheckExact   ((sobj_py_Check__fntype *)SOBJ_PY_SYM(Env_CheckExact))
 Check if a Python object is an exact instance of a simple object environment.


Define Documentation

#define sobj_py_ClassEnv_Check   ((sobj_py_Check__fntype *)SOBJ_PY_SYM(ClassEnv_Check))
 

Check if a Python object is an instance of a simple object class environment.

This macro expands to a function pointer. See the function type documentation sobj_py_Check__fntype for the parameter documentation.

#define sobj_py_ClassEnv_CheckExact   ((sobj_py_Check__fntype *)SOBJ_PY_SYM(ClassEnv_CheckExact))
 

Check if a Python object is an exact instance of a simple object class environment.

This macro expands to a function pointer. See the function type documentation sobj_py_Check__fntype for the parameter documentation.

#define SOBJ_PY_ClassEnvType   ((PyTypeObject *)SOBJ_PY_SYM(ClassEnvType))
 

The type object for class environment objects.

#define sobj_py_Env_Check   ((sobj_py_Check__fntype *)SOBJ_PY_SYM(Env_Check))
 

Check if a Python object is an instance of a simple object environment.

This macro expands to a function pointer. See the function type documentation sobj_py_Check__fntype for the parameter documentation.

#define sobj_py_Env_CheckExact   ((sobj_py_Check__fntype *)SOBJ_PY_SYM(Env_CheckExact))
 

Check if a Python object is an exact instance of a simple object environment.

This macro expands to a function pointer. See the function type documentation sobj_py_Check__fntype for the parameter documentation.

#define SOBJ_PY_EnvType   ((PyTypeObject *)SOBJ_PY_SYM(EnvType))
 

The type objects for environment objects.

#define sobj_py_PyObject_to_sobj   ((sobj_py_PyObject_to_sobj__fntype *)SOBJ_PY_SYM(PyObject_to_sobj))
 

Convert a Python object to a simple object.

The specified Python object is converted to a simple object that represents the specified object best. Trivial types (i.e. numbers, strings, and None) are converted canonically (None maps to NIL); sequences and mappings are converted to arrays; simple objects are unwrapped.

If the specified object (or one of its nested subobjects) can't be converted, then the entire conversion fails and a null-pointer is returned.

This macro expands to a function pointer. See the function type documentation sobj_py_PyObject_to_sobj__fntype for the parameter documentation.

Returns:
The simple object resulting from the conversion. The object returned may be unreferenced (i.e. reference counter is 0). In case of a conversion error, a null-pointer is returned.

#define sobj_py_SObject_Check   ((sobj_py_Check__fntype *)SOBJ_PY_SYM(SObject_Check))
 

Check if a Python object is an instance of a simple object.

This macro expands to a function pointer. See the function type documentation sobj_py_Check__fntype for the parameter documentation.

#define sobj_py_SObject_CheckExact   ((sobj_py_Check__fntype *)SOBJ_PY_SYM(SObject_CheckExact))
 

Check if a Python object is an exact instance of a simple object.

This macro expands to a function pointer. See the function type documentation sobj_py_Check__fntype for the parameter documentation.

#define SOBJ_PY_SObjectType   ((PyTypeObject *)SOBJ_PY_SYM(SObjectType))
 

The type object for simple objects.

#define sobj_py_unwrap   ((sobj_py_unwrap__fntype *)SOBJ_PY_SYM(unwrap))
 

Unwrap a simple object from a Python object.

This macro expands to a function pointer. See the function type documentation sobj_py_unwrap__fntype for the parameter documentation.

Returns:
A borrowed reference to the simple object represented by the Python object. If the Python object is not a simple object instance, a null-pointer is returned.

#define sobj_py_wrap   ((sobj_py_wrap__fntype *)SOBJ_PY_SYM(wrap))
 

Wrap a simple object into a Python object.

This macro expands to a function pointer. See the function type documentation sobj_py_wrap__fntype for the parameter documentation.

Returns:
A new reference to a Python object representing the specified simple object.
See also:
sobj_py_wrap__fntype.


Typedef Documentation

typedef int sobj_py_Check__fntype(PyObject *pyobj)
 

Function type for the type check functions.

A pointer to a function of this type results form the expansion of the following macros:

Parameters:
pyobj The Python object to be checked.
Return values:
0 The specified object pyobj does not match the type.
1 The specified object pyobj matches the type.

typedef struct sobj* sobj_py_PyObject_to_sobj__fntype(PyObject *pyobj, const char *cn)
 

Function type for the sobj_py_PyObject_to_sobj() function.

A pointer to a function of this type results from the expansion of the sobj_py_PyObject_to_sobj macro.

Parameters:
pyobj The Python object to be converted.
cn The class name of the resulting simple object. A null-pointer indicates that the default class name should be used -- this is either an empty class name or the class name provided by the converted object (depending on the converted object).
Returns:
The simple object resulting from the conversion. The object returned may be unreferenced (i.e. reference counter is 0). In case of a conversion error, a null-pointer is returned.

typedef struct sobj* sobj_py_unwrap__fntype(PyObject *pyobj)
 

Function type for the sobj_py_unwrap() function.

A pointer to a function of this type results from the expansion of the sobj_py_unwrap macro.

Parameters:
pyobj The Python object to be unwrapped.
Returns:
A borrowed reference to the simple object represented by the specified Python object. If the specified Python object is not an instance of the simple object class, a null-pointer is returned.

typedef PyObject* sobj_py_wrap__fntype(struct sobj *sobj)
 

Function type for the sobj_py_wrap() function.

A pointer to a function of this type results from the expansion of the sobj_py_wrap macro.

Parameters:
sobj The simple object to be wrapped into a Python object.
Returns:
A new reference to a Python object representing the specified simple object.


Generated on Sat Jul 23 16:07:33 2005 for sobject by  doxygen 1.3.9.1