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 /** Single Line Text Input Managment (Single 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_single_line_text_input.h"
29 #include "gx_utility.h"
30
31 GX_CALLER_CHECKING_EXTERNS
32 /**************************************************************************/
33 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _gxe_single_line_text_input_text_set PORTABLE C */
37 /* 6.1 */
38 /* AUTHOR */
39 /* */
40 /* Kenneth Maxwell, Microsoft Corporation */
41 /* */
42 /* DESCRIPTION */
43 /* */
44 /* This function checks for errors in the single line text input text */
45 /* set function call. */
46 /* */
47 /* */
48 /* INPUT */
49 /* */
50 /* input Pointer to single line text */
51 /* input control block */
52 /* text Null-terminated text string */
53 /* */
54 /* OUTPUT */
55 /* */
56 /* status Completion status */
57 /* */
58 /* CALLS */
59 /* */
60 /* _gx_single_line_text_input_text_set Actual multi line text input */
61 /* text set fucntion */
62 /* */
63 /* CALLED BY */
64 /* */
65 /* Application Code */
66 /* */
67 /* RELEASE HISTORY */
68 /* */
69 /* DATE NAME DESCRIPTION */
70 /* */
71 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
72 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
73 /* resulting in version 6.1 */
74 /* */
75 /**************************************************************************/
76 #if defined(GX_ENABLE_DEPRECATED_STRING_API)
_gxe_single_line_text_input_text_set(GX_SINGLE_LINE_TEXT_INPUT * input,GX_CONST GX_CHAR * text)77 UINT _gxe_single_line_text_input_text_set(GX_SINGLE_LINE_TEXT_INPUT *input, GX_CONST GX_CHAR *text)
78 {
79 UINT status;
80
81 /* Check for invalid caller. */
82 GX_INIT_AND_THREADS_CALLER_CHECKING
83
84 if (!input)
85 {
86 return(GX_PTR_ERROR);
87 }
88
89 /* Check for invalid widget. */
90 if (input -> gx_widget_type == 0)
91 {
92 return(GX_INVALID_WIDGET);
93 }
94
95 status = _gx_single_line_text_input_text_set(input, text);
96
97 return(status);
98 }
99 #endif
100
101 /**************************************************************************/
102 /* */
103 /* FUNCTION RELEASE */
104 /* */
105 /* _gxe_single_line_text_input_text_set_ext PORTABLE C */
106 /* 6.1 */
107 /* AUTHOR */
108 /* */
109 /* Kenneth Maxwell, Microsoft Corporation */
110 /* */
111 /* DESCRIPTION */
112 /* */
113 /* This function checks for errors in the single line text input text */
114 /* set ext function call. */
115 /* */
116 /* */
117 /* INPUT */
118 /* */
119 /* input Pointer to single line text */
120 /* input control block */
121 /* text GX_STRING type text string */
122 /* */
123 /* OUTPUT */
124 /* */
125 /* status Completion status */
126 /* */
127 /* CALLS */
128 /* */
129 /* _gx_single_line_text_input_text_set_ext */
130 /* Actual multi line text input */
131 /* text set ext fucntion */
132 /* */
133 /* CALLED BY */
134 /* */
135 /* Application Code */
136 /* */
137 /* RELEASE HISTORY */
138 /* */
139 /* DATE NAME DESCRIPTION */
140 /* */
141 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
142 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
143 /* resulting in version 6.1 */
144 /* */
145 /**************************************************************************/
_gxe_single_line_text_input_text_set_ext(GX_SINGLE_LINE_TEXT_INPUT * input,GX_CONST GX_STRING * text)146 UINT _gxe_single_line_text_input_text_set_ext(GX_SINGLE_LINE_TEXT_INPUT *input, GX_CONST GX_STRING *text)
147 {
148 UINT status = GX_SUCCESS;
149 UINT text_length = 0;
150
151 /* Check for invalid caller. */
152 GX_INIT_AND_THREADS_CALLER_CHECKING
153
154 if (!input)
155 {
156 return(GX_PTR_ERROR);
157 }
158
159 /* Check for invalid widget. */
160 if (input -> gx_widget_type == 0)
161 {
162 return(GX_INVALID_WIDGET);
163 }
164
165 if (text)
166 {
167 if (text -> gx_string_ptr)
168 {
169 status = _gx_utility_string_length_check(text -> gx_string_ptr, &text_length, text -> gx_string_length);
170
171 if (status != GX_SUCCESS)
172 {
173 return status;
174 }
175 }
176
177 if (text_length != text -> gx_string_length)
178 {
179 return GX_INVALID_STRING_LENGTH;
180 }
181 }
182
183 status = _gx_single_line_text_input_text_set_ext(input, text);
184
185 return(status);
186 }
187
188