SetHashTable.c File Reference

#include "SetHashTable.h"
#include "machine.h"
#include "setHandleProperty.h"
#include "sciprint.h"

Include dependency graph for SetHashTable.c:

Go to the source code of this file.

Data Structures

struct  setHashTableCouple

Defines

#define NB_PROPERTIES   122

Functions

SetPropertyHashTablecreateScilabSetHashTable (void)
int callSetProperty (sciPointObj *pObj, int stackPointer, int valueType, int nbRow, int nbCol, char *propertyName)
void destroyScilabSetHashTable (void)

Variables

static BOOL setHashTableCreated = FALSE
static SetPropertyHashTablesetHashTable = NULL
static setHashTableCouple propertyTable [NB_PROPERTIES]


Define Documentation

#define NB_PROPERTIES   122

number of properties don't forget to modify it each time the propertyTable is modified.

Definition at line 38 of file SetHashTable.c.


Function Documentation

int callSetProperty ( sciPointObj pObj,
int  stackPointer,
int  valueType,
int  nbRow,
int  nbCol,
char *  propertyName 
)

call the function which the property propertyName of object pObj

Returns:
0 if successful -1 if an error occured in the get function 1 if the property was not found

Definition at line 198 of file SetHashTable.c.

References NULL, sciprint(), searchSetHashtable(), and setHashTable.

Referenced by sciSet().

00199 {
00200   setPropertyFunc accessor = searchSetHashtable( setHashTable, propertyName ) ;
00201   if ( accessor == NULL )
00202   {
00203     sciprint( "Unknown property.\n" ) ;
00204     return -1 ;
00205   }
00206   return accessor( pObj, stackPointer, valueType, nbRow, nbCol ) ;
00207 }

Here is the call graph for this function:

Here is the caller graph for this function:

SetPropertyHashTable* createScilabSetHashTable ( void   ) 

create the fill hash table already filled for set functions this use the singleton pattern since only one hashtable is useful.

Definition at line 170 of file SetHashTable.c.

References createSetHashTable(), i, insertSetHashtable(), NB_PROPERTIES, NULL, propertyTable, setHashTable, setHashTableCreated, and TRUE.

Referenced by loadGraphicModule().

00171 {
00172   int i ;
00173   if ( setHashTableCreated )
00174   {
00175     return setHashTable ;
00176   }
00177 
00178   /* create the hash table */
00179   setHashTable = createSetHashTable() ;
00180 
00181   if ( setHashTable == NULL )
00182   {
00183     return NULL ;
00184   }
00185 
00186   /* insert every couple */
00187   for ( i = 0 ; i < NB_PROPERTIES ; i++ )
00188   {
00189     insertSetHashtable( setHashTable, propertyTable[i].key, propertyTable[i].accessor ) ;
00190   }
00191 
00192   setHashTableCreated = TRUE ;
00193 
00194   return setHashTable ;
00195 
00196 }

Here is the call graph for this function:

Here is the caller graph for this function:

void destroyScilabSetHashTable ( void   ) 

Delete the scilab set hashtable

Definition at line 209 of file SetHashTable.c.

References destroySetHashTable(), FALSE, setHashTable, and setHashTableCreated.

Referenced by closeGraphicModule().

00210 {
00211   if ( !setHashTableCreated )
00212   {
00213     return ;
00214   }
00215 
00216   destroySetHashTable( setHashTable ) ;
00217   setHashTableCreated = FALSE ;
00218 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

setHashTableCouple propertyTable[NB_PROPERTIES] [static]

list of all property names and associated functions in scilab This is inserted in the hashTable

Definition at line 44 of file SetHashTable.c.

SetPropertyHashTable* setHashTable = NULL [static]

the get hashtable

Definition at line 21 of file SetHashTable.c.

Referenced by callSetProperty(), createScilabSetHashTable(), and destroyScilabSetHashTable().

BOOL setHashTableCreated = FALSE [static]

use for the singleton to know if the hashtable has already be created.

Definition at line 16 of file SetHashTable.c.

Referenced by createScilabSetHashTable(), and destroyScilabSetHashTable().


Generated on Sun Mar 4 15:45:00 2007 for Scilab [trunk] by  doxygen 1.5.1