#include <Windows.h>#include <stdlib.h>#include <stdio.h>Include dependency graph for lpr.c:

Go to the source code of this file.
Defines | |
| #define | MAXSTR 256 |
Typedefs | |
| typedef int(*) | MYPROC (HINSTANCE, HWND, char *, char *) |
| typedef BOOL(*) | MYPROC2 (void) |
Functions | |
| char * | GetScilabDirectory (BOOL UnixStyle) |
| char * | GetScilabDllDirectory (BOOL UnixStyle) |
| void | AddToScilabDllPathEnv () |
| int | main (int argc, char *argv[]) |
| void AddToScilabDllPathEnv | ( | ) |
Definition at line 130 of file lpr.c.
References env, FALSE, free(), GetScilabDllDirectory(), malloc(), and NULL.
Referenced by main().
00131 { 00132 char *LibScilabDirectory=NULL; 00133 char *env=NULL; 00134 00135 LibScilabDirectory=GetScilabDllDirectory(FALSE); 00136 env=(char*)malloc(sizeof(char)*(strlen(LibScilabDirectory)+strlen("PATH=%s;%PATH%")+1)); 00137 sprintf(env,"PATH=%s;%PATH%",LibScilabDirectory); 00138 if (LibScilabDirectory) {free(LibScilabDirectory);LibScilabDirectory=NULL;} 00139 _putenv(env); 00140 if (env) {free(env);env=NULL;} 00141 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* GetScilabDirectory | ( | BOOL | UnixStyle | ) |
Definition at line 64 of file SciEnv.c.
References dir, fname, FREE, i, int, MALLOC, MAXSTR, MSG_SCIMSG9, NULL, and setSCIpath().
00065 { 00066 LPSTR ScilabModuleName=NULL; 00067 char drive[_MAX_DRIVE]; 00068 char dir[_MAX_DIR]; 00069 char fname[_MAX_FNAME]; 00070 char ext[_MAX_EXT]; 00071 00072 char *SciPathName=NULL; 00073 char *DirTmp=NULL; 00074 00075 ScilabModuleName = (LPSTR) MALLOC (MAXSTR + 1); 00076 00077 if (!GetModuleFileName ((HINSTANCE)GetModuleHandle(MSG_SCIMSG9), (LPSTR) ScilabModuleName, MAXSTR)) 00078 { 00079 if (ScilabModuleName) {FREE(ScilabModuleName);ScilabModuleName=NULL;} 00080 return NULL; 00081 } 00082 00083 _splitpath(ScilabModuleName,drive,dir,fname,ext); 00084 if (ScilabModuleName) {FREE(ScilabModuleName);ScilabModuleName=NULL;} 00085 if (dir[strlen(dir)-1] == '\\') dir[strlen(dir)-1] = '\0'; 00086 00087 DirTmp=strrchr (dir, '\\'); 00088 if (strlen(dir)-strlen(DirTmp)>0) 00089 { 00090 dir[strlen(dir)-strlen(DirTmp)] = '\0'; 00091 } 00092 else return NULL; 00093 00094 SciPathName=(char*)MALLOC((int)(strlen(drive)+strlen(dir)+5)*sizeof(char)); 00095 00096 _makepath(SciPathName,drive,dir,NULL,NULL); 00097 00098 if ( UnixStyle ) 00099 { 00100 int i=0; 00101 for (i=0;i<(int)strlen(SciPathName);i++) 00102 { 00103 if (SciPathName[i]=='\\') SciPathName[i]='/'; 00104 } 00105 } 00106 SciPathName[strlen(SciPathName)-1]='\0'; 00107 setSCIpath(SciPathName); 00108 return SciPathName; 00109 }
Here is the call graph for this function:

| char * GetScilabDllDirectory | ( | BOOL | UnixStyle | ) |
Definition at line 118 of file lpr.c.
References free(), GetScilabDirectory(), malloc(), and NULL.
Referenced by AddToScilabDllPathEnv().
00119 { 00120 char *LibScilabPath=NULL; 00121 char *PathTmp=NULL; 00122 PathTmp=GetScilabDirectory(UnixStyle); 00123 00124 LibScilabPath=(char*)malloc(sizeof(char)*(strlen(PathTmp)+strlen("%s\\bin")+1)); 00125 wsprintf(LibScilabPath,"%s\\bin",PathTmp); 00126 if (PathTmp) {free(PathTmp);PathTmp=NULL;} 00127 return LibScilabPath; 00128 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 16 of file lpr.c.
References AddToScilabDllPathEnv(), ConfigurePrinterDialogBox(), FALSE, gp_printfile(), hinstLib, NULL, TRUE, and x.
00017 { 00018 HINSTANCE hinstLib; 00019 00020 MYPROC gp_printfile; 00021 MYPROC2 ConfigurePrinterDialogBox; 00022 BOOL fFreeResult, fRunTimeLinkSuccess = FALSE; 00023 00024 AddToScilabDllPathEnv(); 00025 00026 hinstLib = LoadLibrary(TEXT("LibScilab")); 00027 00028 if (hinstLib != NULL) 00029 { 00030 gp_printfile = (MYPROC) GetProcAddress(hinstLib, TEXT("gp_printfile")); 00031 ConfigurePrinterDialogBox = (MYPROC2) GetProcAddress(hinstLib, TEXT("ConfigurePrinterDialogBox")); 00032 00033 if ( (NULL != gp_printfile) && (NULL != ConfigurePrinterDialogBox) ) 00034 { 00035 HWND parent; 00036 HANDLE x = GetModuleHandleA (0); 00037 00038 fRunTimeLinkSuccess = TRUE; 00039 parent = GetActiveWindow (); 00040 00041 ConfigurePrinterDialogBox(); 00042 00043 if (argc == 2) 00044 (gp_printfile) (x, parent, argv[1], (char *) 0); 00045 else 00046 (gp_printfile) (x, parent, (char *) 0, (char *) 0); 00047 00048 } 00049 else 00050 { 00051 MessageBox(NULL,"Lpr : Libscilab.dll Incorret Version !","Warning",MB_ICONERROR); 00052 } 00053 00054 fFreeResult = FreeLibrary(hinstLib); 00055 } 00056 00057 if (! fRunTimeLinkSuccess) MessageBox(NULL,"Lpr : Libscilab.dll not found !","Warning",MB_ICONERROR); 00058 00059 return (0); 00060 }
Here is the call graph for this function:

1.5.1