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 /** Multi Line Text Input Management (Multi Line Text Input) */
19 /** */
20 /**************************************************************************/
21
22 #define GX_SOURCE_CODE
23
24
25 /* Include necessary system files. */
26
27 #include "gx_api.h"
28 #include "gx_multi_line_text_input.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_multi_line_text_input_char_insert PORTABLE C */
39 /* 6.1 */
40 /* AUTHOR */
41 /* */
42 /* Kenneth Maxwell, Microsoft Corporation */
43 /* */
44 /* DESCRIPTION */
45 /* */
46 /* This function checks for errors in the multi line text input */
47 /* char insert call. */
48 /* */
49 /* INPUT */
50 /* */
51 /* text_input Multi line text input widget */
52 /* control block */
53 /* str Utf8 string to be inserted */
54 /* str_size Inserted string size in bytes */
55 /* */
56 /* OUTPUT */
57 /* */
58 /* status Completion status */
59 /* */
60 /* CALLS */
61 /* */
62 /* _gx_multi_line_text_input_char_insert */
63 /* Actual multi line text input */
64 /* char insert 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_multi_line_text_input_char_insert(GX_MULTI_LINE_TEXT_INPUT * text_input,GX_UBYTE * str,UINT str_size)80 UINT _gxe_multi_line_text_input_char_insert(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_UBYTE *str, UINT str_size)
81 {
82 UINT status;
83
84 /* Check for invalid caller. */
85 GX_INIT_AND_THREADS_CALLER_CHECKING
86
87 /* Check for invalid input pointers. */
88 if ((text_input == GX_NULL) || (str == GX_NULL))
89 {
90 return(GX_PTR_ERROR);
91 }
92
93 /* Check for invalid value. */
94 if (str_size == 0)
95 {
96 return(GX_INVALID_VALUE);
97 }
98
99 /* Check for invalid widget check. */
100 if (text_input -> gx_widget_type == 0)
101 {
102 return(GX_INVALID_WIDGET);
103 }
104
105 /* Call actual multi line text input char insert function. */
106 status = _gx_multi_line_text_input_char_insert(text_input, str, str_size);
107
108 return status;
109 }
110 #endif
111
112 /**************************************************************************/
113 /* */
114 /* FUNCTION RELEASE */
115 /* */
116 /* _gxe_multi_line_text_input_char_insert_ext PORTABLE C */
117 /* 6.1 */
118 /* AUTHOR */
119 /* */
120 /* Kenneth Maxwell, Microsoft Corporation */
121 /* */
122 /* DESCRIPTION */
123 /* */
124 /* This function checks for errors in the multi line text input */
125 /* char insert call. */
126 /* */
127 /* INPUT */
128 /* */
129 /* text_input Multi line text input widget */
130 /* control block */
131 /* str Utf8 string to be inserted */
132 /* */
133 /* OUTPUT */
134 /* */
135 /* status Completion status */
136 /* */
137 /* CALLS */
138 /* */
139 /* _gx_multi_line_text_input_char_insert_ext */
140 /* Actual multi line text input */
141 /* char insert ext call */
142 /* */
143 /* CALLED BY */
144 /* */
145 /* Application Code */
146 /* */
147 /* RELEASE HISTORY */
148 /* */
149 /* DATE NAME DESCRIPTION */
150 /* */
151 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
152 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
153 /* resulting in version 6.1 */
154 /* */
155 /**************************************************************************/
_gxe_multi_line_text_input_char_insert_ext(GX_MULTI_LINE_TEXT_INPUT * text_input,GX_CONST GX_STRING * str)156 UINT _gxe_multi_line_text_input_char_insert_ext(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_CONST GX_STRING *str)
157 {
158 UINT status;
159 UINT string_length = 0;
160
161 /* Check for invalid caller. */
162 GX_INIT_AND_THREADS_CALLER_CHECKING
163
164 /* Check for invalid input pointers. */
165 if ((text_input == GX_NULL) || (str == GX_NULL) || (str -> gx_string_ptr == GX_NULL))
166 {
167 return(GX_PTR_ERROR);
168 }
169
170 status = _gx_utility_string_length_check(str -> gx_string_ptr, &string_length, str -> gx_string_length);
171
172 if (status != GX_SUCCESS)
173 {
174 return status;
175 }
176
177 /* Check for invalid string length. */
178 if (string_length != str -> gx_string_length)
179 {
180 return GX_INVALID_STRING_LENGTH;
181 }
182
183 /* Check for invalid widget check. */
184 if (text_input -> gx_widget_type == 0)
185 {
186 return(GX_INVALID_WIDGET);
187 }
188
189 /* Call actual multi line text input char insert function. */
190 status = _gx_multi_line_text_input_char_insert_ext(text_input, str);
191
192 return status;
193 }
194
195