LoadFunctionsTab.c File Reference

#include "MALLOC.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "machine.h"
#include "hashtable_core.h"
#include "getmodules.h"
#include "setgetSCIpath.h"
#include "LoadFunctionsTab.h"

Include dependency graph for LoadFunctionsTab.c:

Go to the source code of this file.

Defines

#define FORMATFILENAME   "%s/modules/%s/sci_gateway/%s"
#define LineMaxSize   1024

Functions

int C2F (cvname)
static int Add_a_Scilab_primitive_in_hashtable (char *str, int *dataI, int *data)
static int Load_primitives_from_file (char *filename)

Variables

static int firstentry = 0


Define Documentation

#define FORMATFILENAME   "%s/modules/%s/sci_gateway/%s"

Referenced by C2F().

#define LineMaxSize   1024


Function Documentation

static int Add_a_Scilab_primitive_in_hashtable ( char *  str,
int dataI,
int data 
) [static]

Definition at line 56 of file LoadFunctionsTab.c.

References action_hashtable_scilab_functions(), C2F, cvname(), nsiz, and SCI_HFUNCTIONS_ENTER.

Referenced by Load_primitives_from_file().

00057 {
00058         int ldata;
00059         int id[nsiz];
00060         int zero=0;
00061         C2F(cvname)(id,str,&zero,strlen(str));
00062         ldata= (*dataI)*100+*data;
00063         return( action_hashtable_scilab_functions(id,str,&ldata,SCI_HFUNCTIONS_ENTER));
00064 }

Here is the call graph for this function:

Here is the caller graph for this function:

int C2F ( cvname   ) 

Definition at line 17 of file LoadFunctionsTab.c.

References firstentry, FORMATFILENAME, FREE, getmodules(), getSCIpath(), j, len, Load_primitives_from_file(), MALLOC, MODULESLIST::ModuleList, NULL, and MODULESLIST::numberofModules.

00024 {
00025         struct MODULESLIST *Modules=NULL;
00026         char *SciPath=NULL;
00027         
00028         int j=0;
00029 
00030         if ( firstentry != 0 ) return;
00031 
00032         SciPath=getSCIpath();
00033         Modules=getmodules();
00034         /* je ne libere pas Modules pour accelerer le prochain appel ŕ getmodule */
00035         /* liberé dans sciquit.c */
00036 
00037         for (j=0;j<Modules->numberofModules;j++)
00038         {
00039                 #define FORMATFILENAME "%s/modules/%s/sci_gateway/%s"
00040                 char *filename_primitives_list=NULL;
00041                 int len=strlen(FORMATFILENAME)+strlen(SciPath)+strlen(Modules->ModuleList[j])*2;
00042 
00043                 filename_primitives_list=(char*)MALLOC((len+1)*sizeof(char));
00044                 sprintf(filename_primitives_list,FORMATFILENAME,SciPath,Modules->ModuleList[j],Modules->ModuleList[j]);
00045 
00046                 Load_primitives_from_file(filename_primitives_list);
00047 
00048                 if (filename_primitives_list) { FREE(filename_primitives_list);filename_primitives_list=NULL;}
00049         }
00050 
00051         if (SciPath){FREE(SciPath);SciPath=NULL;}
00052         firstentry = 1;
00053 
00054 }

Here is the call graph for this function:

static int Load_primitives_from_file ( char *  filename  )  [static]

Definition at line 66 of file LoadFunctionsTab.c.

References Add_a_Scilab_primitive_in_hashtable(), data, FALSE, FileExist(), LineMaxSize, MAXLENGHTFUNCTIONNAME, retval(), and TRUE.

Referenced by C2F().

00067 {
00068         BOOL bOK=FALSE;
00069         if (FileExist(filename))
00070         {
00071                 #define LineMaxSize 1024
00072                 char Line[LineMaxSize];
00073                 FILE *pFile;
00074                 int dataI=0;
00075                 int data=0;
00076                 char namefunction[MAXLENGHTFUNCTIONNAME];
00077 
00078                 pFile=fopen(filename,"rt");
00079                 while (fgets(Line, LineMaxSize,pFile))
00080                 {
00081                         if (Line[0]!=';')
00082                         {
00083                                 int retval=0;
00084                                 retval=sscanf(Line,"%d %d %s",&dataI,&data,namefunction);
00085                                 if (retval == 3)
00086                                 {
00087                                         Add_a_Scilab_primitive_in_hashtable(namefunction,&dataI,&data);
00088                                 }
00089                         }
00090                 }
00091                 fclose(pFile);
00092                 bOK=TRUE;
00093         }
00094         return bOK;
00095 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

int firstentry = 0 [static]

Definition at line 15 of file LoadFunctionsTab.c.

Referenced by C2F(), MenuFixCurrentWin(), MenuSelect(), NotTTyRead(), prtdlg(), and Size2Scilab().


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