#include <stdio.h>#include <string.h>#include "localization.h"#include "MALLOC.h"Include dependency graph for localization.c:

Go to the source code of this file.
Functions | |
| static char * | ReplaceChars (char *s1, char *s2, char *s3) |
| static char * | QueryString (struct hashtable *Table, char *Tag) |
| BOOL | AppendHashTableLocalization (struct hashtable *Table, char *Tag, char *MsgStr) |
| hashtable * | GetHashTableScilabErrors (void) |
| hashtable * | GetHashTableScilabMessages (void) |
| hashtable * | GetHashTableScilabMenus (void) |
| BOOL | InitializeHashTableScilabErrors (void) |
| BOOL | InitializeHashTableScilabMessages (void) |
| BOOL | InitializeHashTableScilabMenus (void) |
| int | DisposeHashTableScilabErrors (void) |
| int | DisposeHashTableScilabMessages (void) |
| int | DisposeHashTableScilabMenus (void) |
| IMPORT_EXPORT_LOCALIZATION_DLL char * | QueryStringError (char *Tag) |
| IMPORT_EXPORT_LOCALIZATION_DLL char * | QueryStringMessage (char *Tag) |
| IMPORT_EXPORT_LOCALIZATION_DLL char * | QueryStringMenu (char *Tag) |
Variables | |
| static int | count = 0 |
| static char * | Key_String = NULL |
| static char * | Key_Value = NULL |
| static struct hashtable * | Table_Scilab_Errors = NULL |
| static struct hashtable * | Table_Scilab_Messages = NULL |
| static struct hashtable * | Table_Scilab_Menus = NULL |
| BOOL AppendHashTableLocalization | ( | struct hashtable * | Table, | |
| char * | Tag, | |||
| char * | MsgStr | |||
| ) |
Definition at line 22 of file localization.c.
References FALSE, InsertHashtable_string(), key_string::Key_String, Key_Value, MALLOC, NULL, TRUE, and v.
Referenced by C2F(), and LoadHashTableLocalization().
00023 { 00024 BOOL bOK=FALSE; 00025 struct key_string *k=NULL; 00026 struct value_string *v=NULL; 00027 char *Key_Tag=NULL; 00028 char *Key_Value=NULL; 00029 00030 k=(struct key_string*)MALLOC(sizeof(struct key_string)); 00031 v=(struct value_string*)MALLOC(sizeof(struct value_string)); 00032 00033 Key_Tag=(char*)MALLOC(sizeof(char)*(strlen(Tag)+1)); 00034 Key_Value=(char*)MALLOC(sizeof(char)*(strlen(MsgStr)+1)); 00035 00036 if (k && v && Key_Tag && Key_Value) 00037 { 00038 strcpy(Key_Tag,Tag); 00039 strcpy(Key_Value,MsgStr); 00040 00041 k->Key_String=Key_Tag; 00042 v->Value_String=Key_Value; 00043 00044 if (InsertHashtable_string(Table,k, v)) bOK=TRUE; 00045 00046 } 00047 return bOK; 00048 00049 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int DisposeHashTableScilabErrors | ( | void | ) |
Definition at line 99 of file localization.c.
References hashtable_destroy(), NULL, and Table_Scilab_Errors.
Referenced by TerminateLocalization().
00100 { 00101 if (Table_Scilab_Errors) 00102 { 00103 hashtable_destroy( Table_Scilab_Errors, 0 ) ; 00104 Table_Scilab_Errors=NULL; 00105 } 00106 return 0; 00107 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int DisposeHashTableScilabMenus | ( | void | ) |
Definition at line 119 of file localization.c.
References hashtable_destroy(), NULL, and Table_Scilab_Menus.
Referenced by TerminateLocalization().
00120 { 00121 if (Table_Scilab_Menus) 00122 { 00123 hashtable_destroy(Table_Scilab_Menus, 0 ) ; 00124 Table_Scilab_Menus=NULL; 00125 } 00126 return 0; 00127 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int DisposeHashTableScilabMessages | ( | void | ) |
Definition at line 109 of file localization.c.
References hashtable_destroy(), NULL, and Table_Scilab_Messages.
Referenced by TerminateLocalization().
00110 { 00111 if (Table_Scilab_Messages) 00112 { 00113 hashtable_destroy( Table_Scilab_Messages, 0 ) ; 00114 Table_Scilab_Messages=NULL; 00115 } 00116 return 0; 00117 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct hashtable* GetHashTableScilabErrors | ( | void | ) |
Definition at line 51 of file localization.c.
References Table_Scilab_Errors.
Referenced by C2F(), GetLocalizationHashTable(), LoadHashTablesLocalization(), and OneRhs_gettext().
00052 { 00053 return Table_Scilab_Errors; 00054 }
Here is the caller graph for this function:

| struct hashtable* GetHashTableScilabMenus | ( | void | ) |
Definition at line 61 of file localization.c.
References Table_Scilab_Menus.
Referenced by C2F(), GetLocalizationHashTable(), LoadHashTablesLocalization(), and OneRhs_gettext().
00062 { 00063 return Table_Scilab_Menus; 00064 }
Here is the caller graph for this function:

| struct hashtable* GetHashTableScilabMessages | ( | void | ) |
Definition at line 56 of file localization.c.
References Table_Scilab_Messages.
Referenced by C2F(), GetLocalizationHashTable(), LoadHashTablesLocalization(), and OneRhs_gettext().
00057 { 00058 return Table_Scilab_Messages; 00059 }
Here is the caller graph for this function:

| BOOL InitializeHashTableScilabErrors | ( | void | ) |
Definition at line 66 of file localization.c.
References CreateHashtable_string(), FALSE, Table_Scilab_Errors, and TRUE.
Referenced by InitializeLocalization().
00067 { 00068 BOOL bOK=FALSE; 00069 00070 Table_Scilab_Errors=CreateHashtable_string(); 00071 if (Table_Scilab_Errors) bOK=TRUE; 00072 else bOK=FALSE; 00073 00074 return bOK; 00075 }
Here is the call graph for this function:

Here is the caller graph for this function:

| BOOL InitializeHashTableScilabMenus | ( | void | ) |
Definition at line 88 of file localization.c.
References CreateHashtable_string(), FALSE, Table_Scilab_Menus, and TRUE.
Referenced by InitializeLocalization().
00089 { 00090 BOOL bOK=FALSE; 00091 00092 Table_Scilab_Menus=CreateHashtable_string(); 00093 if (Table_Scilab_Menus) bOK=TRUE; 00094 else bOK=FALSE; 00095 00096 return bOK; 00097 }
Here is the call graph for this function:

Here is the caller graph for this function:

| BOOL InitializeHashTableScilabMessages | ( | void | ) |
Definition at line 77 of file localization.c.
References CreateHashtable_string(), FALSE, Table_Scilab_Messages, and TRUE.
Referenced by InitializeLocalization().
00078 { 00079 BOOL bOK=FALSE; 00080 00081 Table_Scilab_Messages=CreateHashtable_string(); 00082 if (Table_Scilab_Messages) bOK=TRUE; 00083 else bOK=FALSE; 00084 00085 return bOK; 00086 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static char * QueryString | ( | struct hashtable * | Table, | |
| char * | Tag | |||
| ) | [static] |
Definition at line 166 of file localization.c.
References FREE, NULL, ReplaceChars(), and SearchHashtable_string().
Referenced by QueryStringError(), QueryStringMenu(), and QueryStringMessage().
00167 { 00168 char oldpiece[8]; 00169 char newpiece[8]; 00170 char *RetString=NULL; 00171 char *StringWithoutSomeChars=NULL; 00172 00173 if (strcmp(Tag,"\r\n")) 00174 { 00175 /* Replace \r\n by \\r\\n */ 00176 strcpy(oldpiece,"\r\n"); 00177 strcpy(newpiece,"\\r\\n"); 00178 StringWithoutSomeChars=ReplaceChars( Tag,oldpiece,newpiece); 00179 00180 if (StringWithoutSomeChars) 00181 { 00182 RetString=SearchHashtable_string(Table,StringWithoutSomeChars); 00183 if (StringWithoutSomeChars) FREE(StringWithoutSomeChars); 00184 00185 if (RetString) 00186 { 00187 /* Replace \\r\\n by \r\n */ 00188 strcpy(oldpiece,"\\r\\n"); 00189 strcpy(newpiece,"\r\n"); 00190 StringWithoutSomeChars=ReplaceChars(RetString,oldpiece,newpiece); 00191 if (RetString) FREE(RetString); 00192 RetString = StringWithoutSomeChars; 00193 } 00194 } 00195 } 00196 return RetString; 00197 }
Here is the call graph for this function:

Here is the caller graph for this function:

| IMPORT_EXPORT_LOCALIZATION_DLL char* QueryStringError | ( | char * | Tag | ) |
Definition at line 129 of file localization.c.
References QueryString(), and Table_Scilab_Errors.
Referenced by C2F(), sciprint(), and TwoRhs_gettext().
00130 { 00131 return QueryString(Table_Scilab_Errors,Tag); 00132 }
Here is the call graph for this function:

Here is the caller graph for this function:

| IMPORT_EXPORT_LOCALIZATION_DLL char* QueryStringMenu | ( | char * | Tag | ) |
Definition at line 139 of file localization.c.
References QueryString(), and Table_Scilab_Menus.
Referenced by TwoRhs_gettext().
00140 { 00141 return QueryString(Table_Scilab_Menus,Tag); 00142 }
Here is the call graph for this function:

Here is the caller graph for this function:

| IMPORT_EXPORT_LOCALIZATION_DLL char* QueryStringMessage | ( | char * | Tag | ) |
Definition at line 134 of file localization.c.
References QueryString(), and Table_Scilab_Messages.
Referenced by TwoRhs_gettext().
00135 { 00136 return QueryString(Table_Scilab_Messages,Tag); 00137 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static char * ReplaceChars | ( | char * | s1, | |
| char * | s2, | |||
| char * | s3 | |||
| ) | [static] |
Definition at line 144 of file localization.c.
References buffer, MALLOC, NULL, and p.
Referenced by QueryString().
00145 { 00146 char *buffer=NULL; 00147 00148 if ( (S1) && (strlen(S1)>0) ) 00149 { 00150 char *p=NULL; 00151 buffer = (char*)MALLOC((strlen(S1)*2)*sizeof(char)); 00152 if(!(p = strstr(S1, S2))) 00153 { 00154 sprintf(buffer,"%s",S1); 00155 return buffer; 00156 } 00157 00158 strncpy(buffer, S1, p-S1); 00159 buffer[p-S1] = '\0'; 00160 00161 sprintf(buffer+(p-S1), "%s%s", S3, p+strlen(S2)); 00162 } 00163 return buffer; 00164 }
Here is the caller graph for this function:

Definition at line 11 of file localization.c.
char* Key_String = NULL [static] |
Definition at line 12 of file localization.c.
char* Key_Value = NULL [static] |
struct hashtable* Table_Scilab_Errors = NULL [static] |
Definition at line 15 of file localization.c.
Referenced by DisposeHashTableScilabErrors(), GetHashTableScilabErrors(), InitializeHashTableScilabErrors(), and QueryStringError().
struct hashtable* Table_Scilab_Menus = NULL [static] |
Definition at line 17 of file localization.c.
Referenced by DisposeHashTableScilabMenus(), GetHashTableScilabMenus(), InitializeHashTableScilabMenus(), and QueryStringMenu().
struct hashtable* Table_Scilab_Messages = NULL [static] |
Definition at line 16 of file localization.c.
Referenced by DisposeHashTableScilabMessages(), GetHashTableScilabMessages(), InitializeHashTableScilabMessages(), and QueryStringMessage().
1.5.1