00001
00002
00003
00004 #include <Windows.h>
00005 #include "stdio.h"
00006
00007 #include "../../../../../../libs/DetectFramework2/DetectFramework.h"
00008 #include "../../../../../../libs/GetWindowsVersion/GetWindowsVersion.h"
00009
00010 #include "../../../../../../libs/MALLOC/includes/win_mem_alloc.h"
00011
00012 typedef int (*MYPROC) (int , char **);
00013
00014 int main (int argc, char **argv)
00015 {
00016 #define MAXCMDTOKENS 128
00017
00018 HINSTANCE hinstLib;
00019 MYPROC Console_Main;
00020
00021 BOOL fFreeResult, fRunTimeLinkSuccess = FALSE;
00022
00023 int argcbis=-1;
00024 LPSTR argvbis[MAXCMDTOKENS];
00025 int i=0;
00026 int FindNW=0;
00027
00028 if (GetWindowsVersion()<OS_WIN32_WINDOWS_2000)
00029 {
00030 MessageBox(NULL,"Scilab requires Windows 2000 or more.","Warning",MB_ICONWARNING);
00031 return -1;
00032 }
00033
00034 if (!DetectFrameWorkNET2())
00035 {
00036 MessageBox(NULL,"The .NET Framework 2.0 is not installed","Warning",MB_ICONWARNING);
00037 return -1;
00038 }
00039
00040 for (i=0;i<argc;i++)
00041 {
00042 if ( (strcmp(argv[i],"-nw")==0) || (strcmp(argv[i],"-NW")==0) ) FindNW=1;
00043 if ( (strcmp(argv[i],"-nwni")==0) || (strcmp(argv[i],"-NWNI")==0) ) FindNW=1;
00044 if ( (strcmp(argv[i],"-nogui")==0) || (strcmp(argv[i],"-NOGUI")==0) ) FindNW=1;
00045 }
00046
00047 if (FindNW==0)
00048 {
00049 char *nwparam=NULL;
00050 nwparam=(char*)MALLOC((strlen("-nw")+1)*sizeof(char));
00051 strcpy(nwparam,"-nw");
00052 for (i=0;i<argc;i++)
00053 {
00054 argvbis[i]=argv[i];
00055 }
00056 argvbis[argc]=nwparam;
00057 argcbis=argc+1;
00058 }
00059 else
00060 {
00061 for (i=0;i<argc;i++)
00062 {
00063 argvbis[i]=argv[i];
00064 }
00065 argcbis=argc;
00066 }
00067
00068 hinstLib = LoadLibrary(TEXT("Libscilab"));
00069
00070 if (hinstLib != NULL)
00071 {
00072 Console_Main = (MYPROC) GetProcAddress(hinstLib, TEXT("Console_Main"));
00073
00074 if (NULL != Console_Main)
00075 {
00076 fRunTimeLinkSuccess = TRUE;
00077 (Console_Main)(argcbis,argvbis);
00078 }
00079 fFreeResult = FreeLibrary(hinstLib);
00080 }
00081
00082 if (! fRunTimeLinkSuccess)
00083 {
00084 MessageBox(NULL,"scilex.exe : Libscilab.dll not found !","Warning",MB_ICONERROR);
00085 exit(1);
00086 }
00087 else exit(0);
00088
00089 return 0;
00090
00091 }
00092