CallScilab.c File Reference

#include "CallScilab.h"
#include "MALLOC.h"
#include "../../../graphics/includes/WindowList.h"
#include "../../../graphics/includes/GetProperty.h"
#include "setgetSCIpath.h"
#include "fromc.h"
#include "sciquit.h"
#include "tmpdir.h"
#include "inisci-c.h"
#include "scirun.h"

Include dependency graph for CallScilab.c:

Go to the source code of this file.

Functions

int setenvc (char *string, char *value)
int C2F() inisci (int *, int *, int *)
int C2F() ismenu ()
int C2F() sxevents ()
void DisableInteractiveMode (void)
int StartScilab (char *SCIpath, char *ScilabStartup, int *Stacksize)
int TerminateScilab (char *ScilabQuit)
void ScilabDoOneEvent (void)
int ScilabHaveAGraph (void)

Variables

static char DefaultScilabStartup [] = "SCI/etc/scilab.start"
static char DefaultScilabQuit [] = "SCI/etc/scilab.quit"
static char DefaultSCIenv [] = "../.."
static int DefaultStacksize = 1000000
static int StartScilabIsOK = FALSE


Function Documentation

void DisableInteractiveMode ( void   ) 

Disable TCL/TK and graphic interfaces Scilab no GUI no TCL/TK "kernel mode"

Definition at line 60 of file CallScilab.c.

References FALSE, and SetWITH_GUI().

00061 {
00062         SetWITH_GUI(FALSE);
00063 }

Here is the call graph for this function:

int C2F() inisci ( int ,
int ,
int  
)

Referenced by Initialize(), realmain(), StartScilab(), and VTRun().

Here is the caller graph for this function:

int C2F() ismenu (  ) 

Definition at line 191 of file dynamic_menus.c.

Referenced by getmen(), IsToThePrompt(), msdos_getch(), parse(), readline_win(), run(), SciClick(), ScilabDoOneEvent(), SendInputText(), TCL_EvalScilabCmd(), WriteIntoScilab(), WriteTextThread(), xclick_any(), and Xorgetchar().

00192 {
00193   /* Do not manage comands while compiling scilab function */
00194   if ( (commandQueue == NULL) || (C2F(com).comp[0] != 0)) 
00195     return(0) ;
00196   else 
00197     return(1);
00198 }

Here is the caller graph for this function:

void ScilabDoOneEvent ( void   ) 

This procedure is the entry point to Scilab's event loop

Definition at line 166 of file CallScilab.c.

References C2F, GetWITH_GUI(), int, ismenu(), scirun(), sxevents(), and TextMessage1().

Referenced by deuxieme_exemple(), example2(), and Java_javasci_Scilab_Events().

00167 {
00168         if ( GetWITH_GUI() )
00169         {
00170                 #ifdef _MSC_VER
00171                         TextMessage1 (1);
00172                 #else 
00173                         C2F(sxevents)();
00174                 #endif
00175 
00176                 while(C2F(ismenu)()==1 ) 
00177                 {
00178                         C2F(scirun)("quit;",(int)strlen("quit;"));
00179                 }
00180         }
00181 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ScilabHaveAGraph ( void   ) 

Get the information is a graphic windows is opened or not

Returns:
Returns TRUE if a graphic windows is opened

Definition at line 183 of file CallScilab.c.

References GetWITH_GUI(), ids, iflag, num, and sciGetIdFigure().

Referenced by deuxieme_exemple(), and example2().

00184 {
00185         integer iflag =0,ids,num;
00186         int vInt=0;
00187 
00188         if ( GetWITH_GUI() )
00189         {
00190                         
00191           sciGetIdFigure (&ids,&num,&iflag);
00192           if (num > 0) { vInt = 1 ; }
00193         }
00194         else
00195         {
00196                 vInt=0;
00197         }
00198 
00199         return vInt;
00200 }

Here is the call graph for this function:

Here is the caller graph for this function:

int setenvc ( char *  string,
char *  value 
)

Definition at line 20 of file setenvc.c.

Referenced by C2F().

00021 {
00022   int ret=0;
00023   char* env;
00024 
00025 #ifdef LINUX
00026   if ( setenv(string,value,1) ) ret=FALSE;
00027   else 
00028     {
00029       ret=TRUE;
00030       UpdateEnvVar=1;
00031     }
00032 #else /* others HP Solaris WIN32*/
00033   env=(char*)MALLOC((strlen(string)+strlen(value)+2)*sizeof(char));
00034   sprintf(env,"%s=%s",string,value);
00035   if ( putenv(env) ) ret=FALSE;
00036   else 
00037     {
00038       setenvtcl(string,value);
00039       ret=TRUE;
00040       UpdateEnvVar=1;
00041     }
00042 #ifdef _MSC_VER
00043   if (env)
00044     {
00045       FREE(env);
00046       env=NULL;
00047     }
00048 #endif
00049 #endif
00050 
00051   return ret;
00052 }

Here is the caller graph for this function:

int StartScilab ( char *  SCIpath,
char *  ScilabStartup,
int Stacksize 
)

Initialize Scilab

Parameters:
SCIpath define SCI environment variable : Default --> NULL
ScilabStartup path & filename of scilab.start : Default --> NULL
Stacksize : Default --> NULL
Returns:
TRUE if it is OK else FALSE

Definition at line 65 of file CallScilab.c.

References C2F, DefaultScilabStartup, DefaultStacksize, env, FALSE, FREE, ierr, iflag, inisci(), InitWindowGraphDll(), int, MALLOC, NULL, putenv, scirun(), SetFromCToON(), setSCIpath(), settmpdir(), StartScilabIsOK, and TRUE.

00066 {
00067         int bOK=FALSE;
00068 
00069         char *ScilabStartupUsed=NULL;
00070         char *InitStringToScilab=NULL;
00071         int StacksizeUsed=0;
00072         int lengthStringToScilab=0;
00073 
00074         static int iflag=-1,ierr=0;
00075 
00076         if (StartScilabIsOK) return bOK;
00077 
00078         SetFromCToON();
00079 
00080         if (SCIpath==NULL)
00081         {
00082                 #ifdef _MSC_VER
00083                         SetSciEnv();
00084                 #else
00085                 {
00086                         char env[2048];
00087                         setSCIpath(SCIpath);
00088                         sprintf(env,"SCI=%s",SCIpath);
00089                         putenv(env);
00090                 }
00091                 #endif
00092         }
00093         else
00094         {
00095                 char env[2048];
00096                 setSCIpath(SCIpath);
00097                 sprintf(env,"SCI=%s",SCIpath);
00098                 putenv(env);
00099         }
00100 
00101         if (ScilabStartup==NULL)
00102         {
00103                 ScilabStartupUsed=(char*)MALLOC((strlen(DefaultScilabStartup)+1)*sizeof(char));
00104                 sprintf(ScilabStartupUsed,"%s",DefaultScilabStartup);
00105         }
00106         else
00107         {
00108                 ScilabStartupUsed=(char*)MALLOC((strlen(DefaultScilabStartup)+1)*sizeof(char));
00109                 sprintf(ScilabStartupUsed,"%s",ScilabStartup);
00110         }
00111         
00112         if (Stacksize==NULL)
00113         {
00114                 StacksizeUsed=DefaultStacksize;
00115         }
00116         else
00117         {
00118                 StacksizeUsed=*Stacksize;
00119         }
00120 
00121         /* running the startup */ 
00122         C2F(settmpdir)();
00123 
00124         /* Scilab Initialization */ 
00125         C2F(inisci)(&iflag,&StacksizeUsed,&ierr);
00126 
00127         if ( ierr > 0 ) 
00128     {
00129           bOK=FALSE;
00130       return bOK;
00131     }
00132 
00133 #ifdef _MSC_VER
00134         InitWindowGraphDll();
00135 #endif
00136 
00137         lengthStringToScilab=(int)(strlen("exec(\"SCI/etc/scilab.start\",-1);quit;")+strlen(ScilabStartupUsed));
00138         InitStringToScilab=(char*)MALLOC(lengthStringToScilab*sizeof(char));
00139         sprintf(InitStringToScilab,"exec(\"%s\",-1);quit;",ScilabStartupUsed);
00140         
00141         C2F(scirun)(InitStringToScilab,strlen(InitStringToScilab));
00142 
00143         if (ScilabStartupUsed) {FREE(ScilabStartupUsed);ScilabStartupUsed=NULL;}
00144         if (InitStringToScilab) {FREE(InitStringToScilab);InitStringToScilab=NULL;}
00145 
00146         bOK=TRUE;
00147         StartScilabIsOK=TRUE;
00148 
00149         return bOK;
00150 }

Here is the call graph for this function:

int C2F() sxevents (  ) 

Definition at line 72 of file ScilabXloop.c.

Referenced by bouncexy(), cossim(), cossimdaskr(), msdos_getch(), parse(), run(), SciClick(), ScilabDoOneEvent(), test_loop(), xclick_any(), Xorgetchar(), and zzledt().

00073 {
00074   if ( GetWITH_GUI() )
00075   {
00076 #ifdef WITH_TK
00077           if (getINXscilab() == 1 || BasicScilab == 0 )
00078 #else
00079           if (getINXscilab() == 1 )
00080 #endif
00081           {
00082                   TextMessage1 (1);
00083           }
00084   }
00085   return (0);
00086 }

Here is the caller graph for this function:

int TerminateScilab ( char *  ScilabQuit  ) 

Terminate Scilab

Parameters:
ScilabQuit path & filename of scilab.quit : Default --> NULL
Returns:
TRUE if it is OK else FALSE

Definition at line 152 of file CallScilab.c.

References ExitScilab(), FALSE, StartScilabIsOK, and TRUE.

00153 {
00154         int bOK=FALSE;
00155 
00156         if (StartScilabIsOK)
00157         {
00158                 ExitScilab();
00159                 StartScilabIsOK=FALSE;
00160                 bOK=TRUE;
00161         }
00162 
00163         return bOK;
00164 }

Here is the call graph for this function:


Variable Documentation

char DefaultSCIenv[] = "../.." [static]

Definition at line 24 of file CallScilab.c.

char DefaultScilabQuit[] = "SCI/etc/scilab.quit" [static]

Definition at line 23 of file CallScilab.c.

char DefaultScilabStartup[] = "SCI/etc/scilab.start" [static]

Definition at line 22 of file CallScilab.c.

Referenced by StartScilab().

int DefaultStacksize = 1000000 [static]

Definition at line 25 of file CallScilab.c.

Referenced by StartScilab().

int StartScilabIsOK = FALSE [static]

Definition at line 26 of file CallScilab.c.

Referenced by StartScilab(), and TerminateScilab().


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