intOEMconvert.c

Go to the documentation of this file.
00001 /*-----------------------------------------------------------------------------------*/
00002 /* INRIA 2005 */
00003 /* Allan CORNET */
00004 /*-----------------------------------------------------------------------------------*/
00005 #include "gw_wintools.h"
00006 #include "MALLOC.h" /* MALLOC */
00007 /*-----------------------------------------------------------------------------------*/
00008 #ifdef _MSC_VER
00009   extern BOOL IsWindowInterface(void);
00010 #endif
00011 /*-----------------------------------------------------------------------------------*/
00012 
00013 int C2F(sci_oemtochar) _PARAMS((char *fname,unsigned long l))
00014 {
00015         static int l1,n1,m1;
00016         char *Output=NULL;
00017 
00018         CheckRhs(1,1);
00019         CheckLhs(0,1);
00020 
00021         if (GetType(1) == sci_strings)  
00022         {
00023                 char *OEMstring=NULL;
00024 
00025                 GetRhsVar(1,"c",&m1,&n1,&l1);
00026                 OEMstring=cstk(l1);
00027                 
00028                 Output=(char*)MALLOC((strlen(OEMstring)+1)*sizeof(char));
00029         #ifdef _MSC_VER
00030                 if (IsWindowInterface())
00031                 {
00032                                 OemToChar(OEMstring,Output);
00033                 }
00034                 else
00035                 {
00036                         wsprintf(Output,"%s",OEMstring);
00037                 }
00038         #else
00039                 sprintf(Output,"%s",OEMstring);
00040         #endif
00041         }
00042         else
00043         {
00044                 Scierror(999,"parameter must be a string.");
00045                 return 0;
00046         }
00047         
00048         n1=1;
00049         CreateVarFromPtr( 1, "c",(m1=(int)strlen(Output), &m1),&n1,&Output);
00050         LhsVar(1) = 1;
00051         C2F(putlhsvar)();       
00052         if (Output) {FREE(Output);Output=NULL;}
00053         return 0;
00054 }
00055 /*-----------------------------------------------------------------------------------*/
00056 int C2F(sci_chartooem) _PARAMS((char *fname,unsigned long l))
00057 {
00058         static int l1,n1,m1;
00059         char *Output=NULL;
00060 
00061         CheckRhs(1,1);
00062         CheckLhs(0,1);
00063 
00064         if (GetType(1) == sci_strings)  
00065         {
00066                 char *Charstring=NULL;
00067 
00068                 GetRhsVar(1,"c",&m1,&n1,&l1);
00069                 Charstring=cstk(l1);
00070 
00071                 Output=(char*)MALLOC((strlen(Charstring)+1)*sizeof(char));
00072         #ifdef _MSC_VER
00073                 if (IsWindowInterface())
00074                 {
00075                         CharToOem(Charstring,Output);
00076                 }
00077                 else
00078                 {
00079                         wsprintf(Output,"%s",Charstring);
00080                 }
00081         #else
00082                         sprintf(Output,"%s",Charstring);
00083         #endif
00084         }
00085         else
00086         {
00087                 Scierror(999,"parameter must be a string.");
00088                 return 0;
00089         }
00090         
00091         n1=1;
00092         CreateVarFromPtr( 1, "c",(m1=(int)strlen(Output), &m1),&n1,&Output);
00093         LhsVar(1) = 1;
00094         C2F(putlhsvar)();       
00095         if (Output) {FREE(Output);Output=NULL;}
00096         return 0;
00097 }
00098 /*-----------------------------------------------------------------------------------*/

Generated on Sun Mar 4 15:04:01 2007 for Scilab [trunk] by  doxygen 1.5.1