loadsavelanguage.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "loadsavelanguage.h"
#include "setgetlanguage.h"
#include "SCIHOME.h"
#include "MALLOC.h"
#include "iconv.h"

Include dependency graph for loadsavelanguage.c:

Go to the source code of this file.

Defines

#define LINELENGTHMAX   1024
#define TAGLANGUAGE   "LANGUAGE"
#define namelanguagepref   "/.language"

Functions

static BOOL loadlanguagepref_linux (void)
static BOOL savelanguagepref_linux (void)
static char * getfilenamelanguagepref (void)
BOOL loadlanguagepref (void)
BOOL savelanguagepref (void)


Define Documentation

#define LINELENGTHMAX   1024

Definition at line 18 of file loadsavelanguage.c.

Referenced by loadlanguagepref_linux(), and savelanguagepref_linux().

#define namelanguagepref   "/.language"

Referenced by getfilenamelanguagepref().

#define TAGLANGUAGE   "LANGUAGE"

Definition at line 19 of file loadsavelanguage.c.

Referenced by loadlanguagepref_linux(), and savelanguagepref_linux().


Function Documentation

static char * getfilenamelanguagepref ( void   )  [static]

Definition at line 113 of file loadsavelanguage.c.

References getSCIHOME(), MALLOC, namelanguagepref, and NULL.

Referenced by loadlanguagepref_linux(), and savelanguagepref_linux().

00114 {
00115 #if _MSC_VER
00116 #define namelanguagepref "\\language.ini"
00117 #else
00118 #define namelanguagepref "/.language"
00119 #endif
00120 
00121         char *retFilename=NULL;
00122         char *SCIHOME=NULL;
00123 
00124         SCIHOME=getSCIHOME();
00125 
00126         retFilename=(char*)MALLOC((strlen(namelanguagepref)+strlen(SCIHOME)+1)*sizeof(char));
00127         sprintf(retFilename,"%s%s",SCIHOME,namelanguagepref);
00128 
00129         return retFilename;
00130 }

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL loadlanguagepref ( void   ) 

Definition at line 31 of file loadsavelanguage.c.

References loadlanguagepref_linux().

Referenced by InitializeLocalization().

00032 {
00033 #ifdef _MSC_VER
00034         return loadlanguagepref_windows();
00035 #else
00036         return loadlanguagepref_linux();
00037 #endif
00038 }

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL loadlanguagepref_linux ( void   )  [static]

Definition at line 50 of file loadsavelanguage.c.

References FALSE, FREE, getfilenamelanguagepref(), LINE, LINELENGTHMAX, MALLOC, NULL, setlanguage(), TAGLANGUAGE, and TRUE.

Referenced by loadlanguagepref().

00051 {
00052         BOOL bOK=FALSE;
00053         char *filepref=NULL;
00054         FILE *fileR;
00055 
00056         filepref=getfilenamelanguagepref();
00057 
00058         if (filepref)
00059         {
00060                 fileR= fopen(filepref, "rt");
00061                 if (fileR)
00062                 {
00063                         char *LANGUAGE=NULL;
00064                         char LINE[LINELENGTHMAX];
00065 
00066                         LANGUAGE=(char*)MALLOC(sizeof(char)*LINELENGTHMAX);
00067                         fscanf(fileR, "%[^\n]", LINE); 
00068                         sscanf(&LINE[strlen(TAGLANGUAGE)+1],"%s",LANGUAGE);
00069                         setlanguage(LANGUAGE,FALSE,TRUE);
00070 
00071                         fclose(fileR);
00072 
00073                         if (LANGUAGE){FREE(LANGUAGE);LANGUAGE=NULL;}
00074                         bOK=TRUE;
00075                 }
00076         }
00077 
00078         return bOK;
00079 }

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL savelanguagepref ( void   ) 

Definition at line 40 of file loadsavelanguage.c.

References savelanguagepref_linux().

Referenced by setlanguage().

00041 {
00042 #ifdef _MSC_VER
00043         return savelanguagepref_windows();
00044 #else
00045         return savelanguagepref_linux();
00046 #endif
00047 }

Here is the call graph for this function:

Here is the caller graph for this function:

static BOOL savelanguagepref_linux ( void   )  [static]

Definition at line 83 of file loadsavelanguage.c.

References FALSE, FREE, getfilenamelanguagepref(), getlanguage(), LINE, LINELENGTHMAX, NULL, TAGLANGUAGE, and TRUE.

Referenced by savelanguagepref().

00084 {
00085         BOOL bOK=FALSE;
00086         char *filepref=NULL;
00087         FILE *fileW;
00088 
00089         filepref=getfilenamelanguagepref();
00090 
00091         if (filepref)
00092         {
00093                 fileW= fopen(filepref, "wt");
00094                 if (fileW)
00095                 {
00096                         char LINE[LINELENGTHMAX];
00097                         char *LANGUAGE=NULL;
00098                         LANGUAGE=getlanguage();
00099                         sprintf(LINE,"%s=%s",TAGLANGUAGE,LANGUAGE);
00100                         fputs(LINE,fileW);
00101                         fputs("\n",fileW);
00102                         fclose(fileW);
00103 
00104                         if (LANGUAGE){FREE(LANGUAGE);LANGUAGE=NULL;}
00105                         bOK=TRUE;
00106                 }
00107         }
00108         return bOK;
00109 }

Here is the call graph for this function:

Here is the caller graph for this function:


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