satdir.h File Reference

Low level Saturn directory access with high level C API on top. More...

Go to the source code of this file.

Data Structures

struct  _sat_obj_dscr
 A Saturn domain Object descriptor. More...
struct  _sat_dir_entry
 A Saturn domain directory entry, modeled for C access. More...
struct  _sat_dir_node
 A Saturn doamin directory node, modeled for C access. More...
struct  _sat_dir_slist
 A generic string list. More...

Defines

#define SAT_CONTEXT   0x8071b
#define SAT_USEROB   0x80711
#define sat_dir_getreal(p, v)   _sat_dir_fetchreal((p),(v),"g")
 Get real at p(ath) or default v(alue).
#define sat_dir_rclreal(p, v)   _sat_dir_fetchreal((p),(v),"r")
 Recall real at p(ath) or default v(alue).

Typedefs

typedef _sat_obj_dscr SAT_OBJ_DSCR
 A Saturn domain Object descriptor.
typedef _sat_dir_entry SAT_DIR_ENTRY
 A Saturn domain directory entry, modeled for C access.
typedef _sat_dir_node SAT_DIR_NODE
 A Saturn doamin directory node, modeled for C access.
typedef _sat_dir_slist SAT_DIR_SLIST
 A generic string list.

Functions

int sat_skipob (int objaddr)
int sat_objgetdir (int objaddr)
int sat_dircurrent ()
int sat_objcurdir ()
int sat_dirhome ()
int sat_objhome ()
int sat_dirfindfirst (int diraddr)
int sat_dirfindnext (int diritem)
int sat_itemgetdir (int itemaddr)
int sat_sknameup (int itemaddr)
int sat_sknamedn (int objaddr)
int sat_objgetitem (int objptr)
int sat_itemgetname (int diritem, char *name)
SAT_DIR_NODE_sat_find_path (char *path)
 Find the internal directory node for path "path".
char * _sat_dir_path (SAT_DIR_NODE *p)
 return a string representation of the path leading to node P
SAT_DIR_NODE_sat_dir_getroot ()
 PRIVATE DON'T CALL.
SAT_DIR_NODE_sat_dir_getcwd ()
 PRIVATE DON'T CALL.
void _sat_dir_destroy_slist (SAT_DIR_SLIST *s)
 Destroy a string list, built by sat_dir_searchobject(). Frees all associated memory.
void _sat_dir_split_path (char *path, char **dir, char **base)
 Split a pathname into dir and base components. Usually not to be called directly.
int _sat_dir_getprolog (SAT_OBJ_DSCR *obj)
void sat_dir_open ()
 Open (create) the internal directory structures. Not to be called directly!
void sat_dir_close ()
char * sat_dir_curdir ()
 return a string representation of the current (working) directory
int sat_dir_chdir (char *path)
 Change the internal path (not calculator!) to path.
SAT_OBJ_DSCRsat_dir_getobject (char *path)
 Return a pointer to an object descriptor for object at path.
SAT_OBJ_DSCRsat_dir_rclobject (char *path)
 Similar to sat_dir_getobject, but with RCL semantics. I.e. if the object is not found in the cureent dir, the search continues up the path towards root.
int sat_dir_searchobject (char *name, SAT_DIR_SLIST **path_list)
 Search for object named "name" down the whole directory tree.
int sat_obj_is_real (SAT_OBJ_DSCR *obj)
 Logical inquiry function, whether an object represents a REAL.
double _sat_dir_fetchreal (char *path, double defval, char *mode)
 Return the double object at path or defval if not found.

Variables

SAT_DIR_NODE__sat_cwd
SAT_DIR_NODE__sat_root


Detailed Description

Low level Saturn directory access with high level C API on top.

Todo:
Add low level API documentation

Definition in file satdir.h.


Define Documentation

#define SAT_CONTEXT   0x8071b

Definition at line 59 of file satdir.h.

#define sat_dir_getreal ( p,
 )     _sat_dir_fetchreal((p),(v),"g")

Get real at p(ath) or default v(alue).

Definition at line 317 of file satdir.h.

#define sat_dir_rclreal ( p,
 )     _sat_dir_fetchreal((p),(v),"r")

Recall real at p(ath) or default v(alue).

Definition at line 323 of file satdir.h.

#define SAT_USEROB   0x80711

Definition at line 60 of file satdir.h.


Typedef Documentation

typedef struct _sat_dir_entry SAT_DIR_ENTRY

A Saturn domain directory entry, modeled for C access.

Directory entries are records consisting of a pointer to an Object descriptor, and a linked list pointer to all directory elements.

  typedef
      struct _sat_dir_entry {
          SAT_OBJ_DSCR *sat_obj;       
          struct _sat_dir_entry *next;
  } SAT_DIR_ENTRY;

typedef struct _sat_dir_node SAT_DIR_NODE

A Saturn doamin directory node, modeled for C access.

The Saturn domain directory is modeled as a n-ary tree, which is recursively defined with three pointers. parent for climbing up the hierarchy towards root, sibling for a chained list of directories on the same level and child for the next subtree beneath the current folder.

  typedef
      struct _sat_dir_node {
          char *name;
          truct _sat_dir_node *parent,*sibling,*child;
          struct _sat_dir_entry *object;
  } SAT_DIR_NODE;

typedef struct _sat_dir_slist SAT_DIR_SLIST

A generic string list.

  typedef
  struct _sat_dir_slist {
      char *str;
        struct _sat_dir_slist *next;
  } SAT_DIR_SLIST;

typedef struct _sat_obj_dscr SAT_OBJ_DSCR

A Saturn domain Object descriptor.

   typedef
   struct _sat_obj_dscr {
       char *name;
       unsigned addr;
   } SAT_OBJ_DSCR;


Function Documentation

void _sat_dir_destroy_slist ( SAT_DIR_SLIST s  ) 

Destroy a string list, built by sat_dir_searchobject(). Frees all associated memory.

Parameters:
s Pointer to string list

double _sat_dir_fetchreal ( char *  path,
double  defval,
char *  mode 
)

Return the double object at path or defval if not found.

Parameters:
path The path to the object
defval A default value to be returned, if not found
mode A string "g" (get) or "r" (recall), describing the fetch semantics
Returns:
A real value, either object or defval

SAT_DIR_NODE* _sat_dir_getcwd (  ) 

PRIVATE DON'T CALL.

int _sat_dir_getprolog ( SAT_OBJ_DSCR obj  ) 

SAT_DIR_NODE* _sat_dir_getroot (  ) 

PRIVATE DON'T CALL.

char * _sat_dir_path ( SAT_DIR_NODE p  ) 

return a string representation of the path leading to node P

void _sat_dir_split_path ( char *  path,
char **  dir,
char **  base 
)

Split a pathname into dir and base components. Usually not to be called directly.

Parameters:
path A string, representing a path
dir Address of pointer for the directory oart
base Address of pointer of the filename part

SAT_DIR_NODE * _sat_find_path ( char *  path  ) 

Find the internal directory node for path "path".

DON'T CALL EXPLICITLY

int sat_dir_chdir ( char *  path  ) 

Change the internal path (not calculator!) to path.

Returns:
0 if successful

void sat_dir_close (  ) 

char * sat_dir_curdir (  ) 

return a string representation of the current (working) directory

Returns:
A string, representing the current directory

SAT_OBJ_DSCR * sat_dir_getobject ( char *  path  ) 

Return a pointer to an object descriptor for object at path.

Parameters:
path Path to the object
Returns:
A pointer to a SAT_OBJ_DSCR or NULL if not found
path may be absolute or relative. If absolute, the search starts at root (HOME) Or at sat_dir_curdir(), if relative

sat_dir_open (  ) 

Open (create) the internal directory structures. Not to be called directly!

SAT_OBJ_DSCR * sat_dir_rclobject ( char *  path  ) 

Similar to sat_dir_getobject, but with RCL semantics. I.e. if the object is not found in the cureent dir, the search continues up the path towards root.

Parameters:
path Path to the object

int sat_dir_searchobject ( char *  name,
SAT_DIR_SLIST **  res 
)

Search for object named "name" down the whole directory tree.

Parameters:
name The object's name
path_list Address of a pointer to a string list
Returns:
The number of found objects and a result set (string list) res, containing the full paths

int sat_dircurrent (  ) 

int sat_dirfindfirst ( int  diraddr  ) 

int sat_dirfindnext ( int  diritem  ) 

int sat_dirhome (  ) 

int sat_itemgetdir ( int  itemaddr  ) 

int sat_itemgetname ( int  diritem,
char *  name 
)

int sat_obj_is_real ( SAT_OBJ_DSCR obj  ) 

Logical inquiry function, whether an object represents a REAL.

Parameters:
obj Pointer to an Object descriptor
Returns:
non zero if obj is a real, zero otherwise

int sat_objcurdir (  ) 

int sat_objgetdir ( int  objaddr  ) 

int sat_objgetitem ( int  objptr  ) 

int sat_objhome (  ) 

int sat_skipob ( int  objaddr  ) 

int sat_sknamedn ( int  objaddr  ) 

int sat_sknameup ( int  itemaddr  ) 


Variable Documentation

SAT_DIR_NODE* __sat_cwd

SAT_DIR_NODE * __sat_root


Generated on Sat Feb 17 00:05:26 2007 for HP-GCCLibrary by  doxygen 1.5.0