inisci-c.c File Reference

#include <sys/utsname.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "machine.h"
#include "Os_specific.h"
#include "core_math.h"
#include "setgetSCIpath.h"
#include "MALLOC.h"
#include "inisci-c.h"
#include "SCIHOME.h"

Include dependency graph for inisci-c.c:

Go to the source code of this file.

Defines

#define ModelicacNameWindows   "/modules/scicos/bin/modelicac.exe"
#define ModelicacNameLinux   "/modules/scicos/bin/modelicac"
#define JavaSciName   "libjavasci"

Functions

int C2F() withtk (int *rep)
BOOL FileExist (char *filename)
int C2F() withpvm (int *rep)
int C2F() withgtk (int *rep)
int C2F() withscicos (int *rep)
int C2F() withmodelicac (int *rep)
int C2F() withjavasci (int *rep)
int C2F() withmsdos (int *rep)
int C2F() getcomp (char *buf, int *nbuf, long int lbuf)
int SetSci ()
int C2F() getsci (char *buf, int *nbuf, long int lbuf)
int C2F() getscihome (char *buf, int *nbuf, long int lbuf)
int C2F() gettmpdir (char *buf, int *nbuf, long int lbuf)
BOOL ExistModelicac (void)
int ExistJavaSciUnix (void)
int C2F() withgui (int *rep)
void SetWITH_GUI (BOOL ON)
BOOL GetWITH_GUI (void)

Variables

static BOOL WITH_GUI = TRUE


Define Documentation

#define JavaSciName   "libjavasci"

Referenced by ExistJavaSciUnix().

#define ModelicacNameLinux   "/modules/scicos/bin/modelicac"

Referenced by ExistModelicac().

#define ModelicacNameWindows   "/modules/scicos/bin/modelicac.exe"

Referenced by ExistModelicac().


Function Documentation

int ExistJavaSciUnix ( void   ) 

TODO : comment

Returns:

Definition at line 241 of file inisci-c.c.

References FREE, getSCIpath(), JavaSciName, MALLOC, and NULL.

Referenced by withjavasci().

00242 {
00243         int bOK=0;
00244 #ifndef _MSC_VER
00245         char *SCIPATH = (char*)getSCIpath();
00246         char *fullpathJavaSci=NULL;
00247 
00248         #define JavaSciName "libjavasci"
00249 
00250         struct utsname uname_pointer;
00251         FILE *fp;
00252 
00253         char OperatinSystem[256];
00254         char Release[256];
00255         char extension[5];
00256 
00257         uname(&uname_pointer);
00258         sprintf(OperatinSystem,"%s",uname_pointer.sysname);
00259         sprintf(Release,"%s",uname_pointer.release);
00260 
00261         if ( strcmp(OperatinSystem,"HP-UX") == 0 )
00262         {
00263                 strcpy(extension,".sl");
00264         }
00265         else
00266         {
00267                 strcpy(extension,".so");
00268         }
00269         fullpathJavaSci=(char*)MALLOC((strlen(SCIPATH)+strlen("/bin/")+strlen(JavaSciName)+strlen(extension)+1)*sizeof(char));
00270         sprintf(fullpathJavaSci,"%s/bin/%s%s",SCIPATH,JavaSciName,extension);
00271         fp=fopen(fullpathJavaSci,"r");
00272         if (fp)
00273         {
00274                 fclose(fp);
00275                 bOK=1;
00276         }
00277         else
00278         {
00279                 bOK=0;
00280         }
00281         if (fullpathJavaSci) FREE(fullpathJavaSci);
00282 #endif
00283         return bOK;
00284 }

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL ExistModelicac ( void   ) 

TODO : comment

Returns:

Definition at line 201 of file inisci-c.c.

References FALSE, FileExist(), FREE, getSCIpath(), MALLOC, ModelicacNameLinux, ModelicacNameWindows, NULL, and SCIPATH.

Referenced by withmodelicac().

00202 {
00203         #define ModelicacNameWindows "/modules/scicos/bin/modelicac.exe"
00204         #define ModelicacNameLinux "/modules/scicos/bin/modelicac"
00205 
00206         BOOL bOK=FALSE;
00207         char *SCIPATH = (char*)getSCIpath();
00208         char *fullpathModelicac=NULL;
00209         
00210         #ifdef _MSC_VER
00211                 fullpathModelicac=(char*)MALLOC((strlen(SCIPATH)+strlen(ModelicacNameWindows)+1)*sizeof(char));
00212                 sprintf(fullpathModelicac,"%s%s",SCIPATH,ModelicacNameWindows);
00213         #else
00214                 fullpathModelicac=(char*)MALLOC((strlen(SCIPATH)+strlen(ModelicacNameLinux)+1)*sizeof(char));
00215                 sprintf(fullpathModelicac,"%s%s",SCIPATH,ModelicacNameLinux);
00216         #endif
00217         bOK=FileExist(fullpathModelicac);
00218         if (fullpathModelicac) FREE(fullpathModelicac);
00219         if (SCIPATH) FREE(SCIPATH);
00220         return bOK;
00221 }

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL FileExist ( char *  filename  ) 

Definition at line 12 of file FileExist.c.

00013 {
00014         BOOL retour=FALSE;      
00015 
00016         #ifdef _MSC_VER
00017                 WIN32_FIND_DATA FindFileData;
00018                 HANDLE handle = FindFirstFile (filename, &FindFileData);
00019                 if (handle != INVALID_HANDLE_VALUE)
00020                 {
00021                         FindClose (handle);
00022                         retour=TRUE;
00023                 }
00024                 else retour=FALSE;
00025         #else
00026         FILE* tmpFile; 
00027         if( (tmpFile=fopen(filename,"r")) == FALSE ) 
00028         { 
00029                 retour=FALSE;
00030         } 
00031         else 
00032         { 
00033                 fclose(tmpFile); 
00034                 retour=TRUE;
00035         } 
00036         #endif
00037 
00038         return retour;
00039 }

int C2F() getcomp ( char *  buf,
int nbuf,
long int  lbuf 
)

TODO : comment

Parameters:
buf 
nbuf 
lbuf 
Returns:

Definition at line 95 of file inisci-c.c.

References buf, C2F, getenvc(), ierr, iflag, and lbuf.

Referenced by getversion_no_rhs().

00096 {
00097   int ierr,iflag=0,l1buf=lbuf;
00098   C2F(getenvc)(&ierr,"COMPILER",buf,&l1buf,&iflag);
00099   if ( ierr== 1) strncpy(buf,"NO",lbuf);
00100   *nbuf = strlen(buf);
00101   return 0;
00102 }

Here is the call graph for this function:

Here is the caller graph for this function:

int C2F() getsci ( char *  buf,
int nbuf,
long int  lbuf 
)

Get the SCI path and initialize the scilab environment path

Definition at line 140 of file inisci-c.c.

References buf, FREE, getSCIpath(), NULL, and SetSci().

00141 {
00142         char *pathtmp=NULL;
00143         SetSci();
00144         pathtmp=getSCIpath();
00145         strcpy(buf,pathtmp);
00146         *nbuf = strlen(buf);
00147         if (pathtmp) {FREE(pathtmp);pathtmp=NULL;}
00148         return 0;
00149 }

Here is the call graph for this function:

int C2F() getscihome ( char *  buf,
int nbuf,
long int  lbuf 
)

Get the SCIHOME path and initialize the scilab environment path

Definition at line 155 of file inisci-c.c.

References buf, FREE, getSCIHOME(), NULL, and setSCIHOME().

00156 {
00157         char *pathtmp=NULL;
00158         char *SCIHOME=getSCIHOME();
00159         if (strcmp(SCIHOME,"empty_SCIHOME")==0)
00160         {
00161                 if (!setSCIHOME())
00162                 {
00163                         #ifdef  _MSC_VER
00164                                 MessageBox(NULL,"SCIHOME not defined.","Warning",MB_ICONWARNING);
00165                         #else
00166                                 printf("SCIHOME not defined.\n");
00167                         #endif
00168                         exit(1);
00169                 }
00170                 else
00171                 {
00172                         if (SCIHOME) {FREE(SCIHOME);SCIHOME=NULL;}
00173                 }
00174         }
00175 
00176         pathtmp=getSCIHOME();
00177         strcpy(buf,pathtmp);
00178         *nbuf = strlen(buf);
00179         if (pathtmp) {FREE(pathtmp);pathtmp=NULL;}
00180 
00181         return 0;
00182 }

Here is the call graph for this function:

int C2F() gettmpdir ( char *  buf,
int nbuf,
long int  lbuf 
)

TODO : comment

Parameters:
buf 
nbuf 
lbuf 
Returns:

Definition at line 184 of file inisci-c.c.

References buf, C2F, getenvc(), ierr, iflag, lbuf, and NULL.

00185 {
00186         int ierr,iflag=0,l1buf=lbuf;
00187         C2F(getenvc)(&ierr,"TMPDIR",buf,&l1buf,&iflag);
00188         if ( ierr== 1) 
00189         {
00190 #ifdef  _MSC_VER
00191                 MessageBox(NULL,"TMPDIR not defined.","Warning",MB_ICONWARNING);
00192 #else
00193                 printf("TMPDIR not defined.\n");
00194 #endif
00195                 exit(1);
00196         }
00197         *nbuf = strlen(buf);
00198         return 0;
00199 }

Here is the call graph for this function:

BOOL GetWITH_GUI ( void   ) 

TODO : comment

Returns:

Definition at line 297 of file inisci-c.c.

References WITH_GUI.

00298 {
00299         return WITH_GUI;
00300 }

int SetSci ( void   ) 

Set the SCI path and initialize the scilab environement path

Definition at line 110 of file inisci-c.c.

References buf, C2F, FREE, getenvc(), ierr, iflag, lbuf, MALLOC, NULL, PATH_MAX, and setSCIpath().

00111 {
00112 #ifdef _MSC_VER
00113 #define PATH_MAX 1024
00114 #endif
00115 
00116         int ierr,iflag=0;
00117         int lbuf=PATH_MAX;
00118         char *buf=MALLOC(PATH_MAX*sizeof(char));
00119         C2F(getenvc)(&ierr,"SCI",buf,&lbuf,&iflag);
00120 
00121         if ( ierr== 1) 
00122         {
00123                 #ifdef  _MSC_VER
00124                 MessageBox(NULL,"SCI not defined.","Warning",MB_ICONWARNING);
00125                 #else
00126                 printf("SCI not defined.\n");
00127                 #endif
00128                 exit(1);
00129         }
00130         setSCIpath(buf);
00131         if (buf) {FREE(buf);buf=NULL;}
00132         return 0;
00133 }

Here is the call graph for this function:

void SetWITH_GUI ( BOOL  ON  ) 

Definition at line 292 of file inisci-c.c.

References FALSE, TRUE, and WITH_GUI.

00293 {
00294         if ( (ON == FALSE) || (ON == TRUE) ) WITH_GUI=ON;
00295 }

int C2F() withgtk ( int rep  ) 

TODO : comment

Parameters:
rep 
Returns:

Definition at line 36 of file inisci-c.c.

References rep.

00037 { 
00038   *rep =0; 
00039   return 0;
00040 }

int C2F() withgui ( int rep  ) 

TODO : comment

Parameters:
rep 
Returns:

Definition at line 286 of file inisci-c.c.

References rep, and WITH_GUI.

00287 { 
00288         *rep = WITH_GUI; 
00289         return 0;
00290 }

int C2F() withjavasci ( int rep  ) 

TODO : comment

Parameters:
rep 
Returns:

Definition at line 61 of file inisci-c.c.

References ExistJavaSciUnix(), ExistJavaSciWin(), and rep.

Referenced by getversion_no_rhs().

00062 {
00063 #ifdef _MSC_VER
00064         if (ExistJavaSciWin())
00065         {
00066                 *rep =1;
00067         }
00068         else
00069         {
00070                 *rep =0; 
00071         }
00072 #else
00073         if (ExistJavaSciUnix())
00074         {
00075                 *rep =1;
00076         }
00077         else
00078         {
00079                 *rep =0; 
00080         }
00081 #endif
00082   return 0;
00083 }

Here is the call graph for this function:

Here is the caller graph for this function:

int C2F() withmodelicac ( int rep  ) 

TODO : comment

Parameters:
rep 
Returns:

Definition at line 48 of file inisci-c.c.

References ExistModelicac(), and rep.

Referenced by getversion_no_rhs().

00049 {
00050         if (ExistModelicac())
00051         {
00052                 *rep =1;
00053         }
00054         else
00055         {
00056                 *rep =0; 
00057         }
00058   return 0;
00059 }

Here is the call graph for this function:

Here is the caller graph for this function:

int C2F() withmsdos ( int rep  ) 

TODO : comment

Parameters:
rep 
Returns:

Definition at line 85 of file inisci-c.c.

References rep.

00086 {
00087 #ifdef _MSC_VER
00088         *rep =1;
00089 #else
00090         *rep =0; 
00091 #endif
00092         return 0;
00093 }

int C2F() withpvm ( int rep  ) 

TODO : comment

Parameters:
rep 
Returns:

Definition at line 26 of file inisci-c.c.

References rep.

Referenced by getversion_no_rhs().

00027 { 
00028 #ifdef WITH_PVM
00029   *rep =1; 
00030 #else 
00031   *rep =0; 
00032 #endif 
00033   return 0;
00034 }

Here is the caller graph for this function:

int C2F() withscicos ( int rep  ) 

TODO : comment

Parameters:
rep 
Returns:

Definition at line 42 of file inisci-c.c.

References ExistScicos(), and rep.

00043 { 
00044         *rep = ExistScicos(); 
00045         return 0;
00046 }

Here is the call graph for this function:

int C2F() withtk ( int rep  ) 

Definition at line 8 of file with_tk.c.

00009 { 
00010   *rep =1; 
00011   return 0;
00012 }


Variable Documentation

BOOL WITH_GUI = TRUE [static]

Definition at line 21 of file inisci-c.c.

Referenced by GetWITH_GUI(), SetWITH_GUI(), and withgui().


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