#include <stdio.h>#include <stdlib.h>#include <string.h>#include <stdarg.h>#include <windows.h>#include <Winuser.h>#include <shlwapi.h>#include "version.h"#include "wcommon.h"Include dependency graph for FilesAssociations.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Functions | |
| BOOL | IsAFile (char *chainefichier) |
| BOOL | IsABinOrSavFile (char *chainefichier) |
| BOOL | IsAGraphFile (char *chainefichier) |
| BOOL | IsAGraphFilegraph (char *chainefichier) |
| BOOL | IsAGraphFilegraphb (char *chainefichier) |
| BOOL | IsAScicosFile (char *chainefichier) |
| BOOL | IsAScicosFileCOS (char *chainefichier) |
| BOOL | IsAScicosFileCOSF (char *chainefichier) |
| int | CommandByFileExtension (char *fichier, int OpenCode, char *Cmd) |
| void | ExtensionFileIntoLowerCase (char *fichier) |
Definition at line 124 of file FilesAssociations.c.
References ChooseAnotherWindowScilab(), ExtensionFileIntoLowerCase(), FALSE, FREE, HaveAnotherWindowScilab(), i, int, IsABinOrSavFile(), IsAFile(), IsAGraphFile(), IsAScicosFile(), MAX_PATH, MSG_SCIMSG1, MSG_SCIMSG2, MSG_SCIMSG3, MSG_SCIMSG4, MSG_SCIMSG5, MSG_SCIMSG6, MSG_SCIMSG7, MSG_SCIMSG8, NULL, PrintFile(), ReplaceSlash(), SendCommandToAnotherScilab(), and TRUE.
Referenced by Windows_Main().
00125 { 00126 int Retour=FALSE; 00127 char FinalFileName[MAX_PATH]; 00128 char ShortPath[MAX_PATH]; 00129 char PathWScilex[MAX_PATH]; 00130 00131 if (fichier[0]=='\"') 00132 { 00133 char buffertemp[MAX_PATH]; 00134 int i=1; 00135 00136 while (fichier[i] != '"') 00137 { 00138 buffertemp[i-1]=fichier[i]; 00139 i++; 00140 if (i> (int)strlen(fichier)) 00141 { 00142 i=(int)strlen(fichier); 00143 break; 00144 } 00145 } 00146 buffertemp[i-1]='\0'; 00147 strcpy(fichier,buffertemp); 00148 } 00149 if (fichier[strlen(fichier)-1]=='\"') fichier[strlen(fichier)-1]='\0'; 00150 00151 if (IsAFile(fichier)) 00152 { 00153 GetShortPathName(fichier,ShortPath,MAX_PATH); /* Recuperation du nom du fichier au format 8.3 */ 00154 ReplaceSlash(FinalFileName,ShortPath); 00155 GetModuleFileName ((HINSTANCE)GetModuleHandle(NULL), PathWScilex, MAX_PATH); 00156 Retour=TRUE; 00157 00158 switch (OpenCode) 00159 { 00160 case 1: /* Execute -X*/ 00161 { 00162 if ( IsABinOrSavFile(FinalFileName)== TRUE ) 00163 { 00164 /* C'est un fichier .BIN ou .SAV d'ou load */ 00165 wsprintf(Cmd,MSG_SCIMSG1,PathWScilex,FinalFileName,FinalFileName); 00166 } 00167 else 00168 if ( IsAScicosFile(fichier)== TRUE ) 00169 { 00170 ExtensionFileIntoLowerCase(FinalFileName); 00171 wsprintf(Cmd,MSG_SCIMSG2,PathWScilex,FinalFileName); 00172 } 00173 else 00174 if ( IsAGraphFile(fichier)== TRUE ) 00175 { 00176 ExtensionFileIntoLowerCase(FinalFileName); 00177 wsprintf(Cmd,MSG_SCIMSG3,PathWScilex,FinalFileName); 00178 } 00179 else wsprintf(Cmd,MSG_SCIMSG4,PathWScilex,FinalFileName); 00180 } 00181 break; 00182 case 2: /* Print -P*/ 00183 { 00184 PrintFile(fichier); 00185 strcpy(Cmd," "); 00186 exit(0); 00187 } 00188 break; 00189 case 0:default: /* Open -O*/ 00190 { 00191 if (! HaveAnotherWindowScilab()) 00192 { 00193 wsprintf(Cmd,MSG_SCIMSG5,PathWScilex,FinalFileName); 00194 } 00195 else 00196 { 00197 char *ScilabDestination=NULL; 00198 wsprintf(Cmd,MSG_SCIMSG6,FinalFileName); 00199 00200 ScilabDestination=(char*)ChooseAnotherWindowScilab(); 00201 if (ScilabDestination) 00202 { 00203 SendCommandToAnotherScilab(MSG_SCIMSG7,ScilabDestination,Cmd); 00204 FREE(ScilabDestination); 00205 exit(0); 00206 } 00207 else 00208 { 00209 wsprintf(Cmd,MSG_SCIMSG8,PathWScilex,FinalFileName); 00210 } 00211 00212 } 00213 } 00214 break; 00215 00216 } 00217 00218 } 00219 00220 00221 return Retour; 00222 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void ExtensionFileIntoLowerCase | ( | char * | fichier | ) |
Definition at line 224 of file FilesAssociations.c.
References buffer, FREE, MALLOC, and NULL.
Referenced by CommandByFileExtension().
00225 { 00226 char *tmpfile=NULL; 00227 char *buffer=NULL; 00228 char *lastdot=NULL; 00229 char *ext=NULL; 00230 00231 tmpfile=(char*)MALLOC(strlen(fichier)*sizeof(char)); 00232 strcpy(tmpfile,fichier); 00233 00234 buffer=strtok(tmpfile,"."); 00235 while ( buffer = strtok(NULL,".")) 00236 { 00237 lastdot=buffer; 00238 } 00239 /* le dernier . permet d'avoir l'extension */ 00240 ext=_strlwr(lastdot); /* Fichier en Majuscule */ 00241 00242 strcpy(&fichier[strlen(fichier)-strlen(ext)],ext); 00243 00244 FREE(tmpfile); 00245 }
Here is the caller graph for this function:

| BOOL IsABinOrSavFile | ( | char * | chainefichier | ) |
Definition at line 35 of file FilesAssociations.c.
References FALSE, FREE, NULL, and TRUE.
Referenced by CommandByFileExtension().
00036 { 00037 BOOL retour=FALSE; 00038 char *ExtensionFilename=NULL; 00039 00040 ExtensionFilename=PathFindExtension(chainefichier); 00041 00042 /* Comparaison avec les extension BIN et SAV */ 00043 if ( (_stricmp(ExtensionFilename,".BIN")==0) || (_stricmp(ExtensionFilename,".SAV")==0) ) retour=TRUE; 00044 00045 if (ExtensionFilename) {FREE(ExtensionFilename);ExtensionFilename=NULL;} 00046 return retour; 00047 00048 }
Here is the caller graph for this function:

| BOOL IsAFile | ( | char * | chainefichier | ) |
Definition at line 17 of file FilesAssociations.c.
00018 { 00019 BOOL retour=FALSE; 00020 00021 WIN32_FIND_DATA FindFileData; 00022 HANDLE handle = FindFirstFile (chainefichier, &FindFileData); 00023 if (handle != INVALID_HANDLE_VALUE) 00024 { 00025 FindClose (handle); 00026 retour=TRUE; 00027 } 00028 else retour=FALSE; 00029 00030 return retour; 00031 }
| BOOL IsAGraphFile | ( | char * | chainefichier | ) |
Definition at line 50 of file FilesAssociations.c.
References FALSE, IsAGraphFilegraph(), IsAGraphFilegraphb(), and TRUE.
Referenced by CommandByFileExtension(), and Windows_Main().
00051 { 00052 BOOL retour=FALSE; 00053 00054 if ( IsAGraphFilegraphb(chainefichier) || IsAGraphFilegraph(chainefichier) ) retour=TRUE; 00055 00056 return retour; 00057 }
Here is the call graph for this function:

Here is the caller graph for this function:

| BOOL IsAGraphFilegraph | ( | char * | chainefichier | ) |
Definition at line 59 of file FilesAssociations.c.
References FALSE, FREE, NULL, and TRUE.
Referenced by IsAGraphFile().
00060 { 00061 BOOL retour=FALSE; 00062 char *ExtensionFilename=NULL; 00063 00064 ExtensionFilename=PathFindExtension(chainefichier); 00065 00066 /* Comparaison avec l'extension Graph */ 00067 if (_stricmp(ExtensionFilename,".GRAPH")==0) retour=TRUE; 00068 00069 if (ExtensionFilename) {FREE(ExtensionFilename);ExtensionFilename=NULL;} 00070 return retour; 00071 }
Here is the caller graph for this function:

| BOOL IsAGraphFilegraphb | ( | char * | chainefichier | ) |
Definition at line 73 of file FilesAssociations.c.
References FALSE, FREE, NULL, and TRUE.
Referenced by IsAGraphFile().
00074 { 00075 BOOL retour=FALSE; 00076 char *ExtensionFilename=NULL; 00077 00078 ExtensionFilename=PathFindExtension(chainefichier); 00079 00080 /* Comparaison avec l'extension Graphb */ 00081 if (_stricmp(ExtensionFilename,".GRAPHB")==0) retour=TRUE; 00082 00083 if (ExtensionFilename) {FREE(ExtensionFilename);ExtensionFilename=NULL;} 00084 return retour; 00085 }
Here is the caller graph for this function:

| BOOL IsAScicosFile | ( | char * | chainefichier | ) |
Definition at line 87 of file FilesAssociations.c.
References FALSE, IsAScicosFileCOS(), IsAScicosFileCOSF(), and TRUE.
Referenced by CommandByFileExtension(), and Windows_Main().
00088 { 00089 BOOL retour=FALSE; 00090 00091 if ( IsAScicosFileCOS(chainefichier) || IsAScicosFileCOSF(chainefichier) ) retour=TRUE; 00092 00093 return retour; 00094 }
Here is the call graph for this function:

Here is the caller graph for this function:

| BOOL IsAScicosFileCOS | ( | char * | chainefichier | ) |
Definition at line 96 of file FilesAssociations.c.
References FALSE, FREE, NULL, and TRUE.
Referenced by IsAScicosFile().
00097 { 00098 BOOL retour=FALSE; 00099 char *ExtensionFilename=NULL; 00100 00101 ExtensionFilename=PathFindExtension(chainefichier); 00102 00103 /* Comparaison avec l'extension cos */ 00104 if (_stricmp(ExtensionFilename,".COS")==0) retour=TRUE; 00105 00106 if (ExtensionFilename) {FREE(ExtensionFilename);ExtensionFilename=NULL;} 00107 return retour; 00108 }
Here is the caller graph for this function:

| BOOL IsAScicosFileCOSF | ( | char * | chainefichier | ) |
Definition at line 110 of file FilesAssociations.c.
References FALSE, FREE, NULL, and TRUE.
Referenced by IsAScicosFile().
00111 { 00112 BOOL retour=FALSE; 00113 char *ExtensionFilename=NULL; 00114 00115 ExtensionFilename=PathFindExtension(chainefichier); 00116 00117 /* Comparaison avec l'extension cosf */ 00118 if (_stricmp(ExtensionFilename,".COSF")==0) retour=TRUE; 00119 00120 if (ExtensionFilename) {FREE(ExtensionFilename);ExtensionFilename=NULL;} 00121 return retour; 00122 }
Here is the caller graph for this function:

1.5.1