#include <string.h>#include <stdio.h>#include "core_math.h"#include "../../../string/includes/men_Sutils.h"#include "link.h"#include "addinter.h"#include "Os_specific.h"#include "stack-def.h"#include "MALLOC.h"#include "sciprint.h"#include "Funtab.h"#include "warningmode.h"#include <stdlib.h>Include dependency graph for addinter.c:

Go to the source code of this file.
Defines | |
| #define | OK 1 |
| #define | FAIL 0 |
| #define | MAXINTERF 50 |
| #define | INTERFSIZE 25 |
| #define | debug C2F(iop).ddt==1 |
| #define | nsiz 6 |
| #define | MAX_ENV 256 |
Functions | |
| int | C2F (namstr) |
| static void | SciInterInit (void) |
| static void DynFuntab | __PARAMS ((int *Scistring, int *ptrstrings, int *nstring, int k1)) |
| static void | ShowInterf (void) |
| void C2F() | addinter (int *iflag, int *descla, int *ptrdescla, int *nvla, char *iname, int *desc, int *ptrdesc, int *nv, char *c_cpp, int *lib_cpp, int *err) |
| void | RemoveInterf (int Nshared) |
| static void | DynFuntab (int *Scistring, int *ptrstrings, int *nstring, int k1) |
| void C2F() | userlk (integer *k) |
| int | SciLibLoad (int num_names, char **names, char **files, int *nums, int *err) |
| void | BuildName (char *name, char *str) |
| void | CallDynInterf (int *pos, int num_names, int namepos, char **names, int *nums, char **files) |
Variables | |
| Iel | |
| Iel | DynInterf [MAXINTERF] |
| static int | LastInterf = 0 |
| int | Use_cpp_code |
| char * | Use_c_cpp |
| #define debug C2F(iop).ddt==1 |
Referenced by CreateCppShared(), CreateShared(), Panic(), Sci_dlopen(), Sci_dlsym(), and ShowInterf().
| #define FAIL 0 |
| #define INTERFSIZE 25 |
Referenced by addinter(), C2F(), and SciLibLoad().
| #define MAX_ENV 256 |
Definition at line 358 of file addinter.c.
Referenced by BuildName(), cluni0(), and GetIndexLastModifiedFileInList().
| #define MAXINTERF 50 |
Referenced by addinter(), SciInterInit(), and SciLibLoad().
| #define nsiz 6 |
Definition at line 228 of file addinter.c.
| #define OK 1 |
| void C2F() addinter | ( | int * | iflag, | |
| int * | descla, | |||
| int * | ptrdescla, | |||
| int * | nvla, | |||
| char * | iname, | |||
| int * | desc, | |||
| int * | ptrdesc, | |||
| int * | nv, | |||
| char * | c_cpp, | |||
| int * | lib_cpp, | |||
| int * | err | |||
| ) |
Definition at line 59 of file addinter.c.
References C2F, DynFuntab(), err, FREE, i, INTERFSIZE, isciulink(), LinkStatus(), MALLOC, Max, MAXINTERF, names, Nshared, NULL, ok, rhs, SciInterInit(), ScilabMStr2CM(), SciLink(), SciLinkInit(), SearchInDynLinks(), and ShowInterf().
00064 : desc, ptrdesc, nv */ 00065 /* for cpp library: c_cpp */ 00066 /* C++ compiler lib_cpp */ 00067 /* the files are given by a previously loaded libary with number iflag */ 00068 /* (if iflag == -1 (int *descla, int *ptrdescla, int *nvla) are used ) */ 00069 { 00070 int i,rhs=2,ilib=0,inum; 00071 char **files,*names[2]; 00072 *err=0; 00073 files=NULL; /* Initialisation pour Windows */ 00074 00075 Use_cpp_code=*lib_cpp; 00076 Use_c_cpp = (char *) MALLOC((strlen(c_cpp) +1) * sizeof(char)); 00077 strcpy(Use_c_cpp,c_cpp); 00078 00079 if ( *iflag == -1 ) 00080 { 00081 ScilabMStr2CM(descla,nvla,ptrdescla,&files,err); 00082 if ( *err == 1) return; 00083 } 00084 00085 names[0]=iname; 00086 names[1]=(char *)0; 00087 00088 SciLinkInit(); 00089 SciInterInit(); 00090 00093 for ( i = 0 ; i < LastInterf ; i++) 00094 { 00095 if (strcmp(iname,DynInterf[i].name)==0) 00096 { 00098 if ( LinkStatus() == 1) 00099 { 00100 C2F(isciulink)(&DynInterf[i].Nshared); 00101 } 00102 break; 00103 } 00104 } 00105 00107 inum=-1; 00108 for ( i = 0 ; i < LastInterf ; i++) 00109 { 00110 if ( DynInterf[i].ok == 0 ) inum= i; 00111 } 00112 inum = ( inum == -1 ) ? LastInterf : inum ; 00113 00116 if ( inum >= MAXINTERF ) 00117 { 00118 /* sciprint("Maximum number of dynamic interfaces %d\r\n",MAXINTERF); 00119 sciprint("has been reached\r\n");*/ 00120 *err=1; 00121 return; 00122 } 00123 00124 if ( *iflag == -1 ) { 00125 /* link then search */ 00126 SciLink(0,&rhs,&ilib,files,names,"f"); 00127 if ( ilib < 0 ) 00128 { 00129 *err=ilib; return; 00130 } 00131 } else { 00132 /* search in already loaded library number ilib */ 00133 ilib = Max(*iflag,0); 00134 SciLink(1,&rhs,&ilib,files,names,"f"); 00135 if ( ilib < 0 ) 00136 { 00137 *err=ilib; return; 00138 } 00139 } 00140 00142 DynInterf[inum].Nshared = ilib; 00143 00144 if ( SearchInDynLinks(names[0],&DynInterf[inum].func) < 0 ) 00145 { 00146 /*sciprint("addinter failed for %s Not found!\r\n",iname);*/ 00147 *err=2; 00148 return; 00149 } 00150 else 00151 { 00152 strncpy(DynInterf[inum].name,iname,INTERFSIZE); 00153 DynInterf[inum].ok = 1; 00154 } 00155 if ( inum == LastInterf ) LastInterf++; 00156 00160 DynFuntab(desc,ptrdesc,nv,inum+1); 00161 00162 if ( *iflag == -1 ) { 00163 for (i=0;i< *nvla;i++) FREE(files[i]); FREE(files); 00164 } 00165 ShowInterf(); 00166 }
Here is the call graph for this function:

| void BuildName | ( | char * | name, | |
| char * | str | |||
| ) |
| int C2F | ( | namstr | ) |
Definition at line 23 of file addinter.c.
References INTERFSIZE, Nshared, ok, and void().
00038 { 00039 char name[INTERFSIZE]; 00040 void (*func)(); 00041 int Nshared; 00042 int ok; 00043 } Iel;
Here is the call graph for this function:

| void CallDynInterf | ( | int * | pos, | |
| int | num_names, | |||
| int | namepos, | |||
| char ** | names, | |||
| int * | nums, | |||
| char ** | files | |||
| ) |
Definition at line 368 of file addinter.c.
References C2F, err, error, getWarningMode(), ok, SciLibLoad(), and sciprint().
00370 { 00371 int imes = 9999; 00372 if ( *pos == -1 || DynInterf[*pos].ok == 0) 00373 { 00375 int err=0; 00376 SciLibLoad(num_names,names,files,nums,&err); 00377 if (err != 1) *pos = nums[namepos]; 00378 } 00379 if ( DynInterf[*pos].ok == 1 ) 00380 (*DynInterf[*pos].func)(); 00381 else 00382 { 00383 if (getWarningMode()) sciprint("Interface %s not linked\r\n",DynInterf[*pos].name); 00384 C2F(error)(&imes); 00385 } 00386 }
Here is the call graph for this function:

Definition at line 237 of file addinter.c.
References C2F, DynInterfStart, funtab(), i, and nsiz.
Referenced by addinter().
00238 { 00239 int id[nsiz],zero=0,trois=3,fptr,fptr1,quatre=4; 00240 int li=1,ni,*SciS,i; 00241 SciS= Scistring; 00242 for ( i=1 ; i < *nstring+1 ; i++) 00243 { 00244 ni=ptrstrings[i]-li; 00245 li=ptrstrings[i]; 00246 C2F(namstr)(id,SciS,&ni,&zero); 00247 fptr1= fptr= (DynInterfStart+k1)*100 +i; 00248 C2F(funtab)(id,&fptr1,&quatre,"NULL_NAME",0); /* clear previous def set fptr1 to 0*/ 00249 C2F(funtab)(id,&fptr,&trois,"NULL_NAME",0); /* reinstall */ 00250 SciS += ni; 00251 } 00252 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void RemoveInterf | ( | int | Nshared | ) |
| static void SciInterInit | ( | void | ) | [static] |
Definition at line 169 of file addinter.c.
References i, MAXINTERF, and ok.
Referenced by addinter(), and SciLibLoad().
00170 { 00171 static int first_entry=0; 00172 if ( first_entry == 0) 00173 { 00174 int i; 00175 for ( i= 0 ; i < MAXINTERF ; i++) 00176 DynInterf[i].ok=0; 00177 first_entry++; 00178 } 00179 }
Here is the caller graph for this function:

Definition at line 305 of file addinter.c.
References getWarningMode(), i, INTERFSIZE, j, MAXINTERF, Nshared, ok, rhs, SciInterInit(), SciLink(), SciLinkInit(), sciprint(), SearchInDynLinks(), and ShowInterf().
Referenced by CallDynInterf().
00306 { 00307 int i,rhs=2,inum,ilib=0,j; 00308 SciLinkInit(); 00309 SciInterInit(); 00310 *err=0; 00311 00312 for ( j=0 ; j < num_names ; j++) 00313 { 00315 inum=-1; 00316 for ( i = 0 ; i < LastInterf ; i++) 00317 { 00318 if ( DynInterf[i].ok == 0 ) inum= i; 00319 } 00320 inum = ( inum == -1 ) ? LastInterf : inum ; 00322 if ( inum >= MAXINTERF ) 00323 { 00324 if (getWarningMode()) sciprint("Maximum number of dynamic interfaces %d\r\n",MAXINTERF); 00325 if (getWarningMode()) sciprint("has been reached\r\n"); 00326 *err=1; 00327 return -1 ; 00328 } 00329 else 00330 nums[j]=inum; 00331 if ( inum == LastInterf ) LastInterf++; 00332 } 00333 SciLink(0,&rhs,&ilib,files,names,"f"); 00334 if ( ilib < 0 ) 00335 { 00336 *err=1; return -1; 00337 } 00340 for ( j=0 ; j < num_names ; j++) 00341 { 00342 DynInterf[nums[j]].Nshared = ilib; 00343 if ( SearchInDynLinks(names[0],&DynInterf[nums[j]].func) < 0 ) 00344 { 00345 if (getWarningMode()) sciprint("addinter failed for %s Not found!\r\n",names[j]); 00346 return -1; 00347 } 00348 else 00349 { 00350 strncpy(DynInterf[nums[j]].name,names[j],INTERFSIZE); 00351 DynInterf[nums[j]].ok = 1; 00352 } 00353 } 00354 ShowInterf(); 00355 return 0; 00356 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void ShowInterf | ( | void | ) | [static] |
Definition at line 218 of file addinter.c.
References debug, i, ok, and sciprint().
Referenced by addinter(), and SciLibLoad().
00219 { 00220 int i; 00221 for ( i = 0 ; i < LastInterf ; i++ ) 00222 { 00223 if ( DynInterf[i].ok == 1 ) 00224 if (debug) sciprint("Interface %d %s\r\n",i,DynInterf[i].name); 00225 } 00226 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void C2F() userlk | ( | integer * | k | ) |
Definition at line 260 of file addinter.c.
References C2F, DynInterfStart, error, ExceptionMessage(), getWarningMode(), ok, and sciprint().
Referenced by callinterf().
00261 { 00262 int k1 = *k - (DynInterfStart+1) ; 00263 int imes = 9999; 00264 if ( k1 >= LastInterf || k1 < 0 ) 00265 { 00266 if (getWarningMode()) sciprint("Invalid interface number %d",k1); 00267 C2F(error)(&imes); 00268 return; 00269 } 00270 if ( DynInterf[k1].ok == 1 ) 00271 { 00272 #ifdef _MSC_VER 00273 #ifndef _DEBUG 00274 _try 00275 { 00276 (*DynInterf[k1].func)(); 00277 } 00278 _except (EXCEPTION_EXECUTE_HANDLER) 00279 { 00280 ExceptionMessage(GetExceptionCode(),DynInterf[k1].name); 00281 } 00282 #else 00283 (*DynInterf[k1].func)(); 00284 #endif 00285 #else 00286 (*DynInterf[k1].func)(); 00287 #endif 00288 } 00289 else 00290 { 00291 if (getWarningMode()) sciprint("Interface %s not linked\r\n",DynInterf[k1].name); 00292 C2F(error)(&imes); 00293 return; 00294 } 00295 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 45 of file addinter.c.
Definition at line 43 of file addinter.c.
int LastInterf = 0 [static] |
Definition at line 46 of file addinter.c.
| char* Use_c_cpp |
1.5.1