hpstack.h File Reference

#include <stdarg.h>
#include <hpparser.h>
#include <saturn.h>

Go to the source code of this file.

Data Structures

struct  complex_t
 The type complex_t is used to store a complex value. Its attributes 're' and 'im' are directly accessible. More...

Defines

#define HPS_OK   0
 Return code OK.
#define HPS_ERROR_PAR   1
 Incorrect parameter passed to the function (e.g. NULL when a pointer is expected).
#define HPS_ERROR_STACK   2
 Incorrect stack size with regard to the asked action (e.g. empty stack while hps_drop() is called).
#define HPS_ERROR_OVERFLOW   3
 Overflow data (e.g. DOINT or DOHXS more than 19 digits, so can't be stored within a long long).
#define HPS_ERROR_SAT_MEMORY   4
 Unable to allocate an object within the Saturn memory.
#define HPS_ERROR_ARM_MEMORY   5
 Unable to allocate the required data within ARM memory.
#define HPS_ERROR_TYPE   6
 The object in the RPL stack is not of the type asked for (returned by hps_pick_type).
#define HPS_ERROR_NOT_IMPLEMENTED   99
 The type of the RPL object under processing is currently not supported by HPStack.
#define DOINT   0x2614
 Saturn data prologue: ZINT (Typical Exact Integer).
#define DOHXS   0x2a4e
 Saturn data prologue: UINT (HEX STRING).
#define DOREAL   0x2933
 Saturn data prologue: REAL.
#define DOCMP   0x2977
 Saturn data prologue: COMPLEX.
#define DOCSTR   0x2a2c
 Saturn data prologue: STRING.
#define DOLIST   0x2A74
 Saturn data prologue: LIST.
#define DOARRY   0x29e8
 Saturn data prologue: ARRAY.
#define DOMATRIX   0x2686
 Saturn data prologue: MATRIX.
#define DOIDNT   0x2e48
 Saturn data prologue: ID (variable name).
#define DOSYMB   0x2AB8
 Saturn data prologue: SYMBOLIC.
#define SEMI   0x312b
 Saturn composite object terminator: SEMI.
#define DOFUNC   0x01902
 Generic function identifier for parser (not a Saturn address).

Typedefs

typedef hpobj hpobj_t
 The type hpobj_t is used to store any RPL object converted into C structure.
typedef list list_t
 The type list_t is used to store a list object converted into C structure.
typedef list_t array_t
 The type array_t is used to store an array/matrix object converted into C structure.

Functions

int hps_init (unsigned *stack)
 Initializes the access to the RPL stack.
int hps_exit (unsigned stack)
 Finalizes the access to the RPL stack.
int hps_depth (int *depth)
 Gets the depth of the current RPL stack.
int hps_avail (int *avail)
 Gets the available number of levels for the RPL stack.
int hps_drop (void)
 Drops the top of the current RPL stack.
int hps_dropn (int levels)
 Drops the n first objects of the current RPL stack.
int hps_swap (void)
 Swaps the two first levels of the current RPL stack.
int hps_rot (void)
 Rotates the three first levels of the current RPL stack.
int hps_unrot (void)
 Unrotates the three first levels of the current RPL stack.
int hps_roll (int levels)
 Rolls the n first levels of the current RPL stack.
int hps_rolld (int levels)
 Rolls down the n first levels of the current RPL stack.
int hps_convert (int flag)
 Authorizes automatic conversion DOHXS -> DOINT -> DOREAL while picking a data from the stack.
int hps_pick_int (int level, long long *value)
 Picks a DOINT RPL object from the stack and puts its value into the variable passed as argument.
int hps_pick_uint (int level, unsigned long long *value)
 Picks a DOHXS RPL object from the stack and puts its value into the variable passed as argument.
int hps_pick_real (int level, double *value)
 Picks a DOREAL RPL object from the stack and puts its value into the variable passed as argument.
int hps_pick_complex (int level, complex_t *value)
 Picks a DOCMP RPL object from the stack and puts its value into the variable passed as argument.
int hps_pick_str (int level, char **value)
 Picks a DOCSTR RPL object from the stack and puts its value into the variable passed as argument.
int hps_pick_list (int level, list_t **value)
 Picks a DOLIST RPL object from the stack and puts its value into the variable passed as argument.
int hps_pick_array (int level, array_t **value)
 Picks a DOMATRIX or DOARRY RPL object from the stack and puts its value into the variable passed as argument.
int hps_pick_ident (int level, char **value)
 Picks a DOIDNT RPL object from the stack and puts its value into the variable passed as argument.
int hps_pick_symb (int level, entry_t **value)
 Picks a DOSYMB RPL object from the stack and puts its value into the variable passed as argument.
int hps_pop_int (long long *value)
 Pops an integer from the stack and puts its value into the variable passed as argument.
int hps_pop_uint (unsigned long long *value)
 Pops an unsigned integer from the stack and puts its value into the variable passed as argument.
int hps_pop_real (double *value)
 Pops a real from the stack and puts its value into the variable passed as argument.
int hps_pop_complex (complex_t *value)
 Pops a complex from the stack and puts its value into the variable passed as argument.
int hps_pop_str (char **value)
 Pops a string from the stack and puts its value into the variable passed as argument.
int hps_pop_list (list_t **value)
 Pops a list from the stack and puts its value into the variable passed as argument.
int hps_pop_array (array_t **value)
 Pops an array from the stack and puts its value into the variable passed as argument.
int hps_pop_ident (char **value)
 Pops an ident from the stack and puts its value into the variable passed as argument.
int hps_pop_symb (entry_t **value)
 Pops a symbolic expression from the stack and puts its value into the variable passed as argument.
int hps_push_int (long long value)
 Pushes an integer onto the stack.
int hps_push_uint (unsigned long long value)
 Pushes an unsigned integer onto the stack.
int hps_push_real (double value)
 Pushes a real onto the stack.
int hps_push_complex (complex_t *value)
 Pushes a complex onto the stack.
int hps_push_str (char *value)
 Pushes a string onto the stack.
int hps_push_list (list_t *value)
 Pushes a list onto the stack.
int hps_push_array (array_t *value)
 Pushes an array onto the stack.
int hps_push_ident (char *value)
 Pushes an ident onto the stack.
int hps_push_symb (entry_t *value)
 Pushes a symbolic expression onto the stack.
int hps_pick (int level, hpobj_t *obj)
 Picks a RPL object from the stack and stores it into a C hpobj_t object.
int hps_pick_type (int level, int type, void *data)
 Picks a RPL object of a given type from the stack and stores it into a C hpobj_t object.
int hps_pop (hpobj_t *obj)
 Pops a RPL object from the stack and stores it into a C hpobj_t object.
int hps_pop_type (int type, void *data)
 Pops a RPL object of a given type from the stack and stores it into a C hpobj_t object.
int hps_push (hpobj_t *obj)
 Pushes an object passed as parameter onto the stack.
int hps_push_type (int type, void *data)
 Pushes an object which type and data area passed as parameter onto the stack.
char * hps_error (int error)
 Returns a string associated with an error code.
int hps_list_create (list_t **list)
 Creates a C list_t object for storing a list.
int hps_list_destroy (list_t **list)
 Destroys a C list_t object.
int hps_list_add (list_t *list, hpobj_t *obj)
 Adds an element to the end of a list.
int hps_list_get (list_t *list, int ind, hpobj_t **obj)
 Gets the n-th element of a list.
int hps_list_get_int (list_t *list, int ind, long long *val)
 Gets the n-th element of a list if an 'int'.
int hps_list_get_uint (list_t *list, int ind, unsigned long long *val)
 Gets the n-th element of a list if an 'unsigned int'.
int hps_list_get_real (list_t *list, int ind, double *val)
 Gets the n-th element of a list if a 'real'.
int hps_list_get_str (list_t *list, int ind, char **val)
 Gets the n-th element of a list if a 'string'.
int hps_list_get_list (list_t *list, int ind, list_t **val)
 Gets the n-th element of a list if a 'list'.
int hps_list_get_array (list_t *list, int ind, array_t **val)
 Gets the n-th element of a list if a 'array'.
int hps_list_get_ident (list_t *list, int ind, char **val)
 Gets the n-th element of a list if a 'ident'.
int hps_list_get_symb (list_t *list, int ind, entry_t **val)
 Gets the n-th element of a list if a 'symb'.
int hps_list_add_type (list_t *list, int type, void *data)
 Adds an element of the specified type to the end of a list.
int hps_list_add_int (list_t *list, long long value)
 Adds an integer to the end of a list.
int hps_list_add_uint (list_t *list, unsigned long long value)
 Adds an unsigned integer to the end of a list.
int hps_list_add_real (list_t *list, double value)
 Adds a real to the end of a list.
int hps_list_add_complex (list_t *list, complex_t *value)
 Adds a complex to the end of a list.
int hps_list_add_str (list_t *list, char *value)
 Adds a string to the end of a list.
int hps_list_add_list (list_t *list, list_t *value)
 Adds a list to the end of a list.
int hps_list_add_array (list_t *list, array_t *value)
 Adds an array to the end of a list.
int hps_list_add_ident (list_t *list, char *value)
 Adds an ident to the end of a list.
int hps_array_create (array_t **array)
 Creates a C array_t object for storing an array.
int hps_array_build (array_t **array, void *data, int type, int nb,...)
 Creates a C array_t object from a C array of any dimension.
int hps_array_destroy (array_t **array)
 Destroys a C array_t object.
int hps_array_get (array_t *array, hpobj_t **obj, int nb,...)
 Gets an element from an array.
int hps_array_add (array_t *array, hpobj_t *obj)
 Adds an element to the end of a array.
int hps_array_add_type (array_t *array, int type, void *data)
 Adds an element of the specified type to the end of an array.
int hps_array_add_int (array_t *array, long long value)
 Adds an integer to the end of a array.
int hps_array_add_uint (array_t *array, unsigned long long value)
 Adds an unsigned integer to the end of a array.
int hps_array_add_real (array_t *array, double value)
 Adds a real to the end of a array.
int hps_array_add_complex (array_t *array, complex_t *value)
 Adds a complex to the end of a array.
int hps_array_add_str (array_t *array, char *value)
 Adds a string to the end of a array.
int hps_array_add_list (array_t *array, list_t *value)
 Adds a list to the end of a array.
int hps_array_add_array (array_t *array, array_t *value)
 Adds an array to the end of a array.
int hps_array_add_ident (array_t *array, char *value)
 Adds an ident to the end of a array.
int hps_obj_create (hpobj_t **obj)
 Creates a C hpobj_t object that will store a RPL object.
int hps_obj_create_type (int type, void *data, hpobj_t **obj)
 Creates a C hpobj_t object and initializes it with a type and a data.
int hps_obj_destroy (hpobj_t **obj)
 Destroys a C hpobj_t object, without destroying the objects pointed by (string, list or array).
int hps_obj_destroy_all (hpobj_t **obj)
 Destroys a C hpobj_t object including the objects pointed by (string, list or array).
int hps_obj_get (hpobj_t *obj, int *type, void **data)
 Gets the type and data of a C hpobj_t object.
int hps_obj_create_int (long long value, hpobj_t **obj)
 Creates a C hpobj_t object describing an 'int' data.
int hps_obj_create_uint (unsigned long long value, hpobj_t **obj)
 Creates a C hpobj_t object describing an 'unsigned int' data.
int hps_obj_create_real (double value, hpobj_t **obj)
 Creates a C hpobj_t object describing a 'real' data.
int hps_obj_create_complex (complex_t *value, hpobj_t **obj)
 Creates a C hpobj_t object describing a 'complex' data.
int hps_obj_create_str (char *value, hpobj_t **obj)
 Creates a C hpobj_t object describing a 'string' data.
int hps_obj_create_list (list_t *value, hpobj_t **obj)
 Creates a C hpobj_t object describing a 'list' data.
int hps_obj_create_array (array_t *value, hpobj_t **obj)
 Creates a C hpobj_t object describing a 'array' data.
int hps_obj_create_ident (char *value, hpobj_t **obj)
 Creates a C hpobj_t object describing an 'ident' data.


Detailed Description

Definition in file hpstack.h.


Function Documentation

char* hps_error int  error  ) 
 

Returns a string associated with an error code.

This function returns a string describing the error associated with the error code passed as parameter.

Parameters:
error The error code
Returns:
The string describing the error


Generated on Sat Sep 16 18:23:57 2006 for HPStack by  doxygen 1.4.5