2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
5 * This file must be used under the terms of the CeCILL.
6 * This source file is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at
9 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
16 #include <sys/utsname.h>
20 #include <stdlib.h> /* getenv ! */
21 #include "../../../io/includes/getenvc.h"
22 #include "../../../fileio/includes/FileExist.h"
23 #include "localization.h"
25 #include "Os_specific.h"
26 #include "core_math.h"
27 #include "setgetSCIpath.h"
31 #include "scilabmode.h"
32 #include "scilabDefaults.h"
33 /*--------------------------------------------------------------------------*/
34 int C2F(withmodelicac)(int *rep)
46 /*--------------------------------------------------------------------------*/
47 int C2F(withmsdos)(int *rep)
56 /*--------------------------------------------------------------------------*/
57 int C2F(getcomp)(char *buf,int *nbuf,long int lbuf)
59 int ierr,iflag=0,l1buf=lbuf;
60 C2F(getenvc)(&ierr,"COMPILER",buf,&l1buf,&iflag);
61 if ( ierr== 1) strncpy(buf,"NO",lbuf);
62 *nbuf = (int)strlen(buf);
65 /*--------------------------------------------------------------------------*/
67 * Set the SCI path and initialize the scilab environement path
74 char *buf = MALLOC(PATH_MAX*sizeof(char));
77 C2F(getenvc)(&ierr,"SCI",buf,&lbuf,&iflag);
82 MessageBox(NULL,_("SCI environment variable not defined.\n"),"Warning",MB_ICONWARNING);
84 fprintf(stderr, _("SCI environment variable not defined.\n"));
95 /*--------------------------------------------------------------------------*/
97 * Get the SCI path and initialize the scilab environment path
100 int C2F(getsci)(char *buf,int *nbuf,long int lbuf)
102 char *pathtmp = NULL;
106 pathtmp = getSCIpath();
110 *nbuf = (int)strlen(buf);
121 /*--------------------------------------------------------------------------*/
123 * Get the SCIHOME path and initialize the scilab environment path
126 int C2F(getscihome)(char *buf,int *nbuf,long int lbuf)
129 char *SCIHOME = getSCIHOME();
130 if (strcmp(SCIHOME,"empty_SCIHOME")==0)
135 MessageBox(NULL,_("SCIHOME not defined.\n"),_("Warning"),MB_ICONWARNING);
137 /* @TODO change that to the error output */
138 fprintf(stderr,_("SCIHOME not defined.\n"));
144 if (SCIHOME) {FREE(SCIHOME);SCIHOME=NULL;}
148 pathtmp = getSCIHOME();
152 *nbuf = (int)strlen(buf);
158 /*--------------------------------------------------------------------------*/
159 int C2F(gettmpdir)(char *buf,int *nbuf,long int lbuf)
161 int ierr,iflag=0,l1buf=lbuf;
162 C2F(getenvc)(&ierr,"TMPDIR",buf,&l1buf,&iflag);
166 MessageBox(NULL,_("TMPDIR not defined.\n"),_("Warning"),MB_ICONWARNING);
168 fprintf(stderr,_("TMPDIR not defined.\n"));
172 *nbuf = (int)strlen(buf);
175 /*--------------------------------------------------------------------------*/
176 BOOL ExistModelicac(void)
178 char *fullpathModelicac = searchEnv( ModelicacName,"PATH");
179 if (fullpathModelicac)
181 FREE(fullpathModelicac);
182 fullpathModelicac = NULL;
187 /*--------------------------------------------------------------------------*/
188 int C2F(withgui)(int *rep)
190 *rep = (getScilabMode() != SCILAB_NWNI);
193 /*--------------------------------------------------------------------------*/
194 int C2F(getdefaultgstacksize)(int *defaultsize)
196 #if defined(_MSC_VER) && defined(_WIN64)
197 *defaultsize = DEFAULTGSTACKSIZE;
199 *defaultsize = DEFAULTGSTACKSIZE;
204 /*--------------------------------------------------------------------------*/
205 int C2F(getdefaultstacksize)(int *defaultsize)
207 *defaultsize = DEFAULTSTACKSIZE;
210 /*--------------------------------------------------------------------------*/