FTables.c File Reference

#include <string.h>
#include "FTables.h"
#include "stack-c.h"
#include "stack2.h"
#include "sciprint.h"
#include "link.h"

Include dependency graph for FTables.c:

Go to the source code of this file.

Defines

#define FTable_H
#define a_chain   10
#define a_function   13

Functions

static int SearchComp __PARAMS ((FTAB *Ftab, char *op, void(**realop)()))
static void Emptyfunc __PARAMS ((void))
voidf GetFuncPtr (char *name, int n, FTAB *Table, voidf scifun, int *ifunc, int *lhs, int *rhs)
voidf SetFunction __PARAMS ((char *name, int *rep, FTAB *table))
voidf SetFunction (char *name, int *rep, FTAB *table)
static int SearchComp (FTAB *Ftab, char *op, void(**realop)())

Variables

static char buf [MAXNAME]


Define Documentation

#define a_chain   10

Definition at line 105 of file FTables.c.

Referenced by GetFuncPtr().

#define a_function   13

Definition at line 106 of file FTables.c.

Referenced by GetFuncPtr().

#define FTable_H

Definition at line 8 of file FTables.c.


Function Documentation

voidf SetFunction __PARAMS ( (char *name, int *rep, FTAB *table  ) 

static void Emptyfunc __PARAMS ( (void)   )  [static]

Definition at line 17 of file FTables.c.

00017 {}

static int SearchComp __PARAMS ( (FTAB *Ftab, char *op, void(**realop)())   )  [static]

voidf GetFuncPtr ( char *  name,
int  n,
FTAB Table,
voidf  scifun,
int ifunc,
int lhs,
int rhs 
)

Definition at line 108 of file FTables.c.

References a_chain, a_function, C2F, cstk, Error, f(), GetRhsVar, nrhs, rep, sciprint(), SetFunction(), type, and vartype.

Referenced by intex17c().

00109 {
00110   int type,rep,mm,nn,nlhs,nrhs;
00111   voidf f;
00112   type=C2F(vartype)(&n);
00113   switch ( type)
00114     {
00115     case a_chain :
00116       GetRhsVar(n, "c", &mm, &nn, ifunc);
00117       f = SetFunction(cstk(*ifunc),&rep,Table);
00118       if ( rep == 1 )
00119         {
00120           Scierror(999,"%s: external %s not found \r\n",name,cstk(*ifunc));
00121           return (voidf) 0;
00122         }  
00123       return f ;
00124     case  a_function :
00125       GetRhsVar(n, "f", &nlhs,&nrhs, ifunc);
00126       /*
00127       if ( nlhs != *lhs || nrhs != *rhs ) 
00128         {
00129           Scierror(999,"%s: given external has wrong (lhs,rhs) values (%d,%d), (%d,%d) required\r\n",name,
00130                    nlhs,nrhs,*lhs,*rhs);
00131           return (voidf) 0 ;
00132         }
00133       */
00134       return (voidf) scifun ;
00135     default:
00136       sciprint("Wrong parameter in %s ! (number %d)\r\n",name,n);
00137       Error(999);
00138       return (voidf) 0 ;
00139     }
00140 }

Here is the call graph for this function:

Here is the caller graph for this function:

static int SearchComp ( FTAB Ftab,
char *  op,
void(**)()  realop 
) [static]

Definition at line 59 of file FTables.c.

References FTAB::f, FAIL, i, j, name, and OK.

Referenced by SetFunction().

00060 {
00061   int i=0;
00062   while ( Ftab[i].name != (char *) 0) 
00063      {
00064        int j;
00065        j = strcmp(op,Ftab[i].name);
00066        if ( j == 0 )
00067          {
00068            *realop = Ftab[i].f;
00069            return(OK);
00070          }
00071        else
00072          { 
00073            if ( j <= 0)
00074              {
00075                /* sciprint("\nUnknow function <%s>\r\n",op); */
00076                return(FAIL);
00077              }
00078            else i++;
00079          }
00080      }
00081   /* sciprint("\n Unknow function <%s>\r\n",op); */
00082   return(FAIL);
00083 }

Here is the caller graph for this function:

voidf SetFunction ( char *  name,
int rep,
FTAB table 
)

Definition at line 26 of file FTables.c.

References buf, MAXNAME, OK, s, SearchComp(), SearchInDynLinks(), table, and void().

00027 {
00028   void (*loc)();
00029   char *s;
00030 
00031   strncpy(buf,name,MAXNAME);
00032   s=buf;
00033   while ( *s != ' ' && *s != '\0') { s++;};
00034   *s= '\0';
00035   if ( SearchComp(table,buf,&loc) == OK) 
00036     {
00037       *rep = 0;
00038       return(loc);
00039     }
00040   if ( SearchInDynLinks(buf,&loc) >= 0 )
00041     {
00042       *rep = 0;
00043       return(loc);
00044     }
00045   loc = Emptyfunc;
00046   *rep = 1;
00047   /* sciprint(" Function %s not found\r\n",name); */
00048   return(loc);
00049 }

Here is the call graph for this function:


Variable Documentation

char buf[MAXNAME] [static]

Definition at line 14 of file FTables.c.


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