EnvTclTk.c File Reference

#include "machine.h"
#include <stdio.h>
#include "Errors.h"
#include "tcl.h"
#include "tk.h"
#include "MALLOC.h"

Include dependency graph for EnvTclTk.c:

Go to the source code of this file.

Defines

#define MAX_PATH   512

Functions

BOOL ConvertPathUnixToWindowsFormat (char *pathunix, char *pathwindows)
BOOL Set_TCL_LIBRARY_PATH (char *DefaultPath)
BOOL Set_TK_LIBRARY_PATH (char *DefaultPath)


Define Documentation

#define MAX_PATH   512

Definition at line 8 of file EnvTclTk.c.


Function Documentation

BOOL ConvertPathUnixToWindowsFormat ( char *  pathunix,
char *  pathwindows 
)

Definition at line 129 of file SciEnv.c.

References FALSE, i, int, and TRUE.

Referenced by ConfigureScilabStar(), GetLanguageCodeInScilabDotStar(), Set_TCL_LIBRARY_PATH(), and Set_TK_LIBRARY_PATH().

00130 {
00131         BOOL bOK=TRUE;
00132         if ( (pathunix) && (pathwindows) )
00133         {
00134                 int i=0;
00135                 strcpy(pathwindows,pathunix);
00136                 for (i=0;i<(int)strlen(pathwindows);i++)
00137                 {
00138                         if (pathwindows[i]=='/') pathwindows[i]='\\';
00139                 }
00140         }
00141         else bOK=FALSE;
00142 
00143         return bOK;
00144 
00145 }

Here is the caller graph for this function:

BOOL Set_TCL_LIBRARY_PATH ( char *  DefaultPath  ) 

Definition at line 20 of file EnvTclTk.c.

References ConvertPathUnixToWindowsFormat(), env, FALSE, FREE, MALLOC, MAX_PATH, NULL, TCL_ERROR35, TCL_ERROR37, TRUE, and type.

00021 {
00022         BOOL bOK=FALSE;
00023         
00024         int major=8;
00025         int minor=4; // Par defaut
00026         int patchLevel=0;
00027         int type=0;
00028         
00029         char env[MAX_PATH + 1 + 10];
00030         
00031         char ShortPath[MAX_PATH+1];
00032         char *CopyOfDefaultPath=NULL;
00033 
00034         CopyOfDefaultPath=MALLOC(((int)strlen(DefaultPath)+1)*sizeof(char));
00035 
00036         
00037         Tcl_GetVersion(&major, &minor, &patchLevel, &type);
00038 
00039         /* to be sure that it's windows format */
00040         /* c:\progra~1\scilab-5.0\modules\tclsci\tcl\tcl8.4 */
00041         if (GetShortPathName(DefaultPath,ShortPath,MAX_PATH)==0)
00042         {
00043                 fprintf(stderr,"\n%s\n%s%s.\n",TCL_ERROR35,TCL_ERROR37,DefaultPath);
00044                 if (CopyOfDefaultPath) {FREE(CopyOfDefaultPath);CopyOfDefaultPath=NULL;}
00045 
00046                 ConvertPathUnixToWindowsFormat(ShortPath,CopyOfDefaultPath);
00047                 wsprintf (env, "TCL_LIBRARY=%s\\modules\\tclsci\\tcl\\tcl%d.%d",CopyOfDefaultPath,major,minor);
00048 
00049                 if (CopyOfDefaultPath) {FREE(CopyOfDefaultPath);CopyOfDefaultPath=NULL;}
00050         }
00051         else
00052         {
00053                 ConvertPathUnixToWindowsFormat(ShortPath,CopyOfDefaultPath);
00054                 wsprintf (env, "TCL_LIBRARY=%s\\modules\\tclsci\\tcl\\tcl%d.%d",CopyOfDefaultPath,major,minor);
00055                 
00056                 if (CopyOfDefaultPath) {FREE(CopyOfDefaultPath);CopyOfDefaultPath=NULL;}
00057         }
00058 
00059         if (_putenv (env))
00060         {
00061                 bOK=FALSE;
00062         }
00063         else
00064         {
00065                 bOK=TRUE;
00066         }
00067 
00068         return bOK;
00069 }

Here is the call graph for this function:

BOOL Set_TK_LIBRARY_PATH ( char *  DefaultPath  ) 

Definition at line 71 of file EnvTclTk.c.

References ConvertPathUnixToWindowsFormat(), env, FALSE, FREE, MALLOC, MAX_PATH, NULL, TCL_ERROR36, TCL_ERROR38, TRUE, and type.

00072 {
00073         BOOL bOK=FALSE;
00074         char env[MAX_PATH + 1 + 10];
00075         char ShortPath[MAX_PATH+1];
00076         char *CopyOfDefaultPath=NULL;
00077 
00078         int major=8;
00079         int minor=4; // Par defaut
00080         int patchLevel=0;
00081         int type=0;
00082 
00083         CopyOfDefaultPath=MALLOC(((int)strlen(DefaultPath)+1)*sizeof(char));
00084 
00085         Tcl_GetVersion(&major, &minor, &patchLevel, &type);
00086 
00087         /* to be sure that it's windows format */
00088         /* c:\progra~1\scilab-3.1\modules\tclsci\tcl\tk8.4 */
00089         if (GetShortPathName(DefaultPath,ShortPath,MAX_PATH)==0)
00090         {
00091                 fprintf(stderr,"\n%s\n%s%s.\n",TCL_ERROR36,TCL_ERROR38,DefaultPath);
00092                 if (CopyOfDefaultPath) {FREE(CopyOfDefaultPath);CopyOfDefaultPath=NULL;}
00093 
00094                 ConvertPathUnixToWindowsFormat(ShortPath,CopyOfDefaultPath);
00095                 wsprintf (env, "TK_LIBRARY=%s\\modules\\tclsci\\tcl\\tk%d.%d",CopyOfDefaultPath,major,minor);
00096 
00097                 if (CopyOfDefaultPath) {FREE(CopyOfDefaultPath);CopyOfDefaultPath=NULL;}
00098                 
00099         }
00100         else
00101         {
00102                 ConvertPathUnixToWindowsFormat(ShortPath,CopyOfDefaultPath);
00103                 wsprintf (env, "TK_LIBRARY=%s\\modules\\tclsci\\tcl\\tk%d.%d",CopyOfDefaultPath,major,minor);
00104 
00105                 if (CopyOfDefaultPath) {FREE(CopyOfDefaultPath);CopyOfDefaultPath=NULL;}
00106         }
00107 
00108         if (_putenv (env))
00109         {
00110                 bOK=FALSE;
00111         }
00112         else
00113         {
00114                 bOK=TRUE;
00115         }
00116 
00117         return bOK;
00118 }

Here is the call graph for this function:


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