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 // @ TO DO remove this
179 // used in getversion (compatibility)
180 #define FORMAT_SCIBIN_PATH "%s/bin/%s"
182 char *SCIPATH = (char*)getSCIpath();
183 char *fullpathModelicac=NULL;
184 int length_path = strlen(SCIPATH) +
185 strlen(ModelicacName) +
186 strlen(FORMAT_SCIBIN_PATH) + 1 ;
188 fullpathModelicac=(char*)MALLOC((length_path)*sizeof(char));
189 sprintf(fullpathModelicac,FORMAT_SCIBIN_PATH,SCIPATH,ModelicacName);
191 bOK = FileExist(fullpathModelicac);
192 if (fullpathModelicac) FREE(fullpathModelicac);
193 if (SCIPATH) FREE(SCIPATH);
196 /*--------------------------------------------------------------------------*/
197 int C2F(withgui)(int *rep)
199 *rep = (getScilabMode() != SCILAB_NWNI);
202 /*--------------------------------------------------------------------------*/
203 int C2F(getdefaultgstacksize)(int *defaultsize)
205 #if defined(_MSC_VER) && defined(_WIN64)
206 *defaultsize = DEFAULTGSTACKSIZE;
208 *defaultsize = DEFAULTGSTACKSIZE;
213 /*--------------------------------------------------------------------------*/
214 int C2F(getdefaultstacksize)(int *defaultsize)
216 *defaultsize = DEFAULTSTACKSIZE;
219 /*--------------------------------------------------------------------------*/