Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals  

Data


Files

file  data/type.c
 plint data types.

file  plint/data/types.h
 plint data typedefs.


Modules

Garbage Collection
Variables' Values
Variables

Data Structures

struct  _plint_idx
struct  _plint_ite
 iterator structure. More...

struct  _plint_range
 a positive integer range. More...

union  _plint_2pt
 2points value. More...

struct  _plint_num
 number value. More...

struct  _plint_pnt
 point value. More...

struct  _plint_str
 string value. More...

struct  _plint_tab
 array value. More...


Data:Values:Memory Iterators

#define _plint_ite_crt(__t__, __i__...)   ((__i__).crt.__t__)
#define _plint_ite_mem(__t__, __i__...)   ((__i__).mem.__t__)

Defines

#define _PLINT_ITE_INIT(__typ__, __mem__...)   { typ: PLINT_##__typ__, mem: { __typ__: __mem__ } }

Typedefs

typedef _plint_value plint_val_t
 the value union. More...


Functions

int plint_ref_idx (plint_mem_t *PMEMORY, plint_ref_t *PREFERENCE)
 reference indexing. More...

void plint_idx_get (plint_idx_t *INDEX)
void plint_ite_free (plint_ite_t *PITERATOR)
 frees a memory iterator. More...

void plint_ite_start (plint_ite_t *PITERATOR)
 starts a memory iteration. More...

plint_ref_t plint_ite_data (plint_ite_t *PITERATOR)
 returns the current iteration data. More...

int plint_ite_next (plint_ite_t *PITERATOR)
 steps to the next iteration. More...

void plint_ite_break (plint_ite_t *PITERATOR)
 breaks an iteration. More...

void plint_ite_sync (plint_ite_t *PITERATOR)
 synchronize an iteration with memory intrinsec iterators. More...

int plint_ite_done (plint_ite_t *PITERATOR)
 test to see if an iteration has stopped. More...

void plint_ite_stop (plint_ite_t *PITERATOR)
 stops an iteration. More...


Variables

plint_ptr_t plint_ptr_nul = 0
 ground (unique copy of a nul value).


Typedef Documentation

typedef union _plint_value plint_val_t
 

the value union.

an alias for _plint_value

Definition at line 109 of file plint/data/types.h.


Function Documentation

int plint_ref_idx plint_mem_t   pmem,
plint_ref_t   pref
 

reference indexing.

applies a series of indexes on the previous reference result

Remarks:
the caller must be prepared to supply a series of indexes
Parameters:
PMEMORY  [in/out] on success, this must hold the memory of the reference
PREFERENCE  [in/out] - the reference to index, also the result
Returns:
false if couldn't index, true otherwise
Exceptions:
abort  if unknown index type

Definition at line 14 of file index.c.h.

00015 {
00016   plint_idx_t i;
00017 
00018   for (; *pref ;)
00019     switch ((plint_ref_var(*pref))->key->get(&i), i.type)
00020       {
00021       case PLINT_idx_int:
00022         assert(plint_typ_equ(i.typ, PLINT_num_int));
00023         plint_ref_var(*pref)->key->idx(pmem, pref, i.val.num_int);
00024         break;
00025 
00026       case PLINT_idx_fld:
00027         assert(plint_typ_equ(i.typ, PLINT_str));
00028         plint_ref_var(*pref)->key->fld(pmem, pref, i.val.str);
00029         break;
00030 
00031       case PLINT_idx_key:
00032         plint_ref_var(*pref)->key->key(pmem, pref, &i.val, i.typ);
00033         break;
00034 
00035       case PLINT_idx_end:
00036         return !0;
00037 
00038       default:
00039         assert(0);
00040 
00041       }
00042 
00043   return 0;
00044 }

void plint_ite_free plint_ite_t   ite
 

frees a memory iterator.

Parameters:
PITERATOR  the iterator
Returns:
nothing
Exceptions:
abort  if iterator is not over a memory

Definition at line 15 of file iterator.c.h.

00016 {
00017   switch (ite->typ)
00018     {
00019     case PLINT_nul: break;
00020 
00021 #define PLINT_CASE_ITE(__typ__) \
00022     case PLINT_##__typ__: plint_##__typ__##_fre(plint_ite_##__typ__(*ite)); break
00023 
00024      PLINT_CASE_ITE(tab);
00025      PLINT_CASE_ITE(hsh);
00026 #undef PLINT_CASE_ITE
00027 
00028     default:
00029       assert(0);
00030     }
00031 }

void plint_ite_start plint_ite_t   ite
 

starts a memory iteration.

Parameters:
PITERATOR  the iterator
Returns:
nothing
Remarks:
can immediately stop if the memory is empty
Exceptions:
abort  if iterator is not over a memory

Definition at line 40 of file iterator.c.h.

References plint_typ_t, and _plint_ite::typ.

00041 {
00042   switch (ite->typ)
00043     {
00044     case PLINT_tab: plint_ite_i(*ite) = plint_tab_n(plint_ite_tab(*ite)) ? 0 : (size_t)-1; break;
00045     case PLINT_hsh:
00046       hash_iter_first(plint_ite_hsh(*ite));
00047       plint_ite_hi(*ite) = hash_iter_tell(plint_ite_hsh(*ite));
00048       break;
00049 
00050     default:
00051       assert(0);
00052     }
00053 }

plint_ref_t plint_ite_data plint_ite_t   ite
 

returns the current iteration data.

Parameters:
PITERATOR  the iterator
Returns:
the reference to the current iteration index data
Return values:
0  if the memory is not (still) beeing iterated over
Exceptions:
abort  if iterator is not over a memory

Definition at line 62 of file iterator.c.h.

00063 {
00064   switch (ite->typ)
00065     {
00066     case PLINT_tab: return plint_ite_i(*ite)+plint_tab_a(plint_ite_tab(*ite));
00067     case PLINT_hsh: return hash_getdata(plint_ite_hi(*ite));
00068 
00069     default:
00070       assert(0);
00071     }
00072   return 0;
00073 }

int plint_ite_next plint_ite_t   ite
 

steps to the next iteration.

Parameters:
PITERATOR  the iterator
Returns:
true if there are other indexes
Remarks:
can immediately stop if there's no next index in memory
Exceptions:
abort  if iterator is not over a memory

Definition at line 82 of file iterator.c.h.

00083 {
00084   int next = 0;
00085   switch (ite->typ)
00086     {
00087     case PLINT_tab:
00088       if (++plint_ite_i(*ite) < plint_tab_n(plint_ite_tab(*ite)))
00089         next = !0;
00090       else
00091         plint_ite_i(*ite) = (size_t)-1;
00092       break;
00093 
00094     case PLINT_hsh:
00095       next = hash_iter_next(plint_ite_hsh(*ite));
00096       plint_ite_hi(*ite) = hash_iter_tell(plint_ite_hsh(*ite));
00097       break;
00098 
00099     default:
00100       assert(0);
00101     }
00102 
00103   return next;
00104 }

void plint_ite_break plint_ite_t   ite
 

breaks an iteration.

Parameters:
PITERATOR  the iterator
Returns:
nothing
Exceptions:
abort  if iterator is not over a memory

Definition at line 112 of file iterator.c.h.

00113 {
00114   switch (ite->typ)
00115     {
00116     case PLINT_tab: break;
00117     case PLINT_hsh: hash_iter_stop(plint_ite_hsh(*ite));
00118 
00119     default:
00120       assert(0);
00121     }
00122 }

void plint_ite_sync plint_ite_t   ite
 

synchronize an iteration with memory intrinsec iterators.

Parameters:
PITERATOR  the iterator
Returns:
nothing
Exceptions:
abort  if iterator is not over a memory

Definition at line 130 of file iterator.c.h.

00131 {
00132   switch (ite->typ)
00133     {
00134     case PLINT_tab: break;
00135     case PLINT_hsh: hash_iter_start(plint_ite_hsh(*ite), plint_ite_hi(*ite));
00136 
00137     default:
00138       assert(0);
00139     }
00140 }

int plint_ite_done plint_ite_t   ite
 

test to see if an iteration has stopped.

Parameters:
PITERATOR  the iterator
Returns:
true if the iteration is done
Exceptions:
abort  if iterator is not over a memory

Definition at line 148 of file iterator.c.h.

00149 {
00150   switch (ite->typ)
00151     {
00152     case PLINT_tab: return plint_ite_i(*ite) == (size_t)-1;
00153     case PLINT_hsh: return HASH_INDEX_ISBAD(plint_ite_hi(*ite));
00154     default:
00155       assert(0);
00156     }
00157 
00158   return 0;
00159 }

void plint_ite_stop plint_ite_t   ite
 

stops an iteration.

Parameters:
PITERATOR  the iterator
Returns:
nothing
Exceptions:
abort  if iterator is not over a memory

Definition at line 167 of file iterator.c.h.

00168 {
00169   switch (ite->typ)
00170     {
00171     case PLINT_tab: plint_ite_i(*ite) = (size_t)-1; break;
00172     case PLINT_hsh:
00173       hash_iter_stop(plint_ite_hsh(*ite));
00174       plint_ite_hi(*ite) = hash_iter_tell(plint_ite_hsh(*ite));
00175       break;
00176 
00177     default:
00178       assert(0);
00179     }
00180 }


Generated on Thu Jan 9 19:03:11 2003 for plint by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002