1 /**************************************************************************/
2 /* */
3 /* Copyright (c) Microsoft Corporation. All rights reserved. */
4 /* */
5 /* This software is licensed under the Microsoft Software License */
6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */
7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
8 /* and in the root directory of this software. */
9 /* */
10 /**************************************************************************/
11
12
13 /**************************************************************************/
14 /**************************************************************************/
15 /** */
16 /** GUIX Component */
17 /** */
18 /** Display Management (Display) */
19 /** */
20 /**************************************************************************/
21
22 #define GX_SOURCE_CODE
23
24
25 /* Include necessary system files. */
26
27 #include "gx_api.h"
28 #include "gx_display.h"
29 #include "gx_utility.h"
30
31 /* Bring in externs for caller checking code. */
32 GX_CALLER_CHECKING_EXTERNS
33
34 /**************************************************************************/
35 /* */
36 /* FUNCTION RELEASE */
37 /* */
38 /* _gxe_display_language_table_set PORTABLE C */
39 /* 6.1 */
40 /* AUTHOR */
41 /* */
42 /* Kenneth Maxwell, Microsoft Corporation */
43 /* */
44 /* DESCRIPTION */
45 /* */
46 /* This function checks for errors in display language table set call. */
47 /* */
48 /* INPUT */
49 /* */
50 /* display Pointer to display instance. */
51 /* language_table The language table to be set */
52 /* num_languages Number of languages in the */
53 /* table */
54 /* number_of_strings Number of strings in each */
55 /* language */
56 /* */
57 /* OUTPUT */
58 /* */
59 /* status Completion status */
60 /* */
61 /* CALLS */
62 /* */
63 /* _gx_display_language_table_set Actual display language table */
64 /* set call */
65 /* */
66 /* CALLED BY */
67 /* */
68 /* Application Code */
69 /* */
70 /* RELEASE HISTORY */
71 /* */
72 /* DATE NAME DESCRIPTION */
73 /* */
74 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
75 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
76 /* resulting in version 6.1 */
77 /* */
78 /**************************************************************************/
79 #if defined(GX_ENABLE_DEPRECATED_STRING_API)
_gxe_display_language_table_set(GX_DISPLAY * display,GX_CHAR *** language_table,GX_UBYTE number_of_languages,UINT number_of_strings)80 UINT _gxe_display_language_table_set(GX_DISPLAY *display, GX_CHAR ***language_table,
81 GX_UBYTE number_of_languages, UINT number_of_strings)
82 {
83 UINT status;
84
85 /* Check for invalid caller. */
86 GX_INIT_AND_THREADS_CALLER_CHECKING
87
88 if (display == GX_NULL)
89 {
90 /* Check for null pointer*/
91 return(GX_PTR_ERROR);
92 }
93
94 /* Allow string table to be NULL if number_of_strings is zero. */
95 if (number_of_strings && language_table == GX_NULL)
96 {
97 /* Return error. */
98 return(GX_PTR_ERROR);
99 }
100
101 /* Call actual system string table set. */
102 status = _gx_display_language_table_set(display, language_table, number_of_languages, number_of_strings);
103
104 /* Return status. */
105 return(status);
106 }
107 #endif
108
109 /**************************************************************************/
110 /* */
111 /* FUNCTION RELEASE */
112 /* */
113 /* _gxe_display_language_table_set_ext PORTABLE C */
114 /* 6.1 */
115 /* AUTHOR */
116 /* */
117 /* Kenneth Maxwell, Microsoft Corporation */
118 /* */
119 /* DESCRIPTION */
120 /* */
121 /* This function checks for errors in display language table set call. */
122 /* */
123 /* INPUT */
124 /* */
125 /* display Pointer to display instance. */
126 /* table The language table to be set */
127 /* num_languages Number of languages in the */
128 /* table */
129 /* number_of_strings Number of strings in each */
130 /* language */
131 /* */
132 /* OUTPUT */
133 /* */
134 /* status Completion status */
135 /* */
136 /* CALLS */
137 /* */
138 /* _gx_display_language_table_set_ext Actual display language table */
139 /* set ext call */
140 /* */
141 /* CALLED BY */
142 /* */
143 /* Application Code */
144 /* */
145 /* RELEASE HISTORY */
146 /* */
147 /* DATE NAME DESCRIPTION */
148 /* */
149 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
150 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
151 /* resulting in version 6.1 */
152 /* */
153 /**************************************************************************/
_gxe_display_language_table_set_ext(GX_DISPLAY * display,GX_CONST GX_STRING ** table,GX_UBYTE num_languages,UINT number_of_strings)154 UINT _gxe_display_language_table_set_ext(GX_DISPLAY *display, GX_CONST GX_STRING **table, GX_UBYTE num_languages, UINT number_of_strings)
155 {
156 UINT status;
157 UINT language;
158 UINT string_id;
159 GX_CONST GX_STRING *string_table;
160 GX_CONST GX_STRING *string;
161 UINT string_length;
162
163 /* Check for invalid caller. */
164 GX_INIT_AND_THREADS_CALLER_CHECKING
165
166 if (display == GX_NULL)
167 {
168 /* Check for null pointer*/
169 return(GX_PTR_ERROR);
170 }
171
172 /* Allow string table to be NULL if number_of_strings is zero. */
173 if (number_of_strings)
174 {
175 if (table == GX_NULL)
176 {
177 /* Return error. */
178 return(GX_PTR_ERROR);
179 }
180
181 for (language = 0; language < num_languages; language++)
182 {
183 string_table = table[language];
184 for (string_id = 0; string_id < number_of_strings; string_id++)
185 {
186 string = &string_table[string_id];
187
188 if (string -> gx_string_ptr)
189 {
190 status = _gx_utility_string_length_check(string -> gx_string_ptr, &string_length, string -> gx_string_length);
191
192 if (status != GX_SUCCESS)
193 {
194 return status;
195 }
196 }
197 else
198 {
199 string_length = 0;
200 }
201
202 if (string_length != string -> gx_string_length)
203 {
204 return GX_INVALID_STRING_LENGTH;
205 }
206 }
207 }
208 }
209
210 /* Call actual system string table set. */
211 status = _gx_display_language_table_set_ext(display, table, num_languages, number_of_strings);
212
213 /* Return status. */
214 return(status);
215 }
216
217 /**************************************************************************/
218 /* */
219 /* FUNCTION RELEASE */
220 /* */
221 /* _gxe_display_language_direction_table_set PORTABLE C */
222 /* 6.1.10 */
223 /* AUTHOR */
224 /* */
225 /* Ting Zhu, Microsoft Corporation */
226 /* */
227 /* DESCRIPTION */
228 /* */
229 /* This function checks for errors in display language direction table */
230 /* set call. */
231 /* */
232 /* INPUT */
233 /* */
234 /* display Pointer to display instance. */
235 /* language_direction_table The language direction table */
236 /* to be set */
237 /* num_languages Number of languages in the */
238 /* table */
239 /* */
240 /* OUTPUT */
241 /* */
242 /* status Completion status */
243 /* */
244 /* CALLS */
245 /* */
246 /* _gx_display_language_direciton_table_set */
247 /* Actual display language table */
248 /* set ext call */
249 /* */
250 /* CALLED BY */
251 /* */
252 /* Application Code */
253 /* */
254 /* RELEASE HISTORY */
255 /* */
256 /* DATE NAME DESCRIPTION */
257 /* */
258 /* 01-31-2022 Ting Zhu Initial Version 6.1.10 */
259 /* */
260 /**************************************************************************/
261 #if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT)
_gxe_display_language_direction_table_set(GX_DISPLAY * display,GX_CONST GX_UBYTE * language_direction_table,GX_UBYTE num_languages)262 UINT _gxe_display_language_direction_table_set(GX_DISPLAY *display, GX_CONST GX_UBYTE *language_direction_table, GX_UBYTE num_languages)
263 {
264 UINT status;
265
266 /* Check for invalid caller. */
267 GX_INIT_AND_THREADS_CALLER_CHECKING
268
269 if (display == GX_NULL)
270 {
271 /* Check for null pointer*/
272 return(GX_PTR_ERROR);
273 }
274
275 /* Call actual system string table set. */
276 status = _gx_display_language_direction_table_set(display, language_direction_table, num_languages);
277
278 /* Return status. */
279 return(status);
280 }
281 #endif
282