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 /** String Scroll Wheel Management (Scroll Wheel) */
19 /** */
20 /**************************************************************************/
21
22 #define GX_SOURCE_CODE
23
24
25 /* Include necessary system files. */
26
27 #include "gx_api.h"
28 #include "gx_scroll_wheel.h"
29 #include "gx_utility.h"
30
31 GX_CALLER_CHECKING_EXTERNS
32
33 /**************************************************************************/
34 /* */
35 /* FUNCTION RELEASE */
36 /* */
37 /* _gxe_string_scroll_wheel_string_list_set PORTABLE C */
38 /* 6.1 */
39 /* AUTHOR */
40 /* */
41 /* Kenneth Maxwell, Microsoft Corporation */
42 /* */
43 /* DESCRIPTION */
44 /* */
45 /* This function checks for errors in string scroll wheel string list */
46 /* set call. */
47 /* */
48 /* INPUT */
49 /* */
50 /* wheel Scroll wheel control block */
51 /* string_list String list to be set */
52 /* string_count The number of assigned strings*/
53 /* */
54 /* OUTPUT */
55 /* */
56 /* status Completion status */
57 /* */
58 /* CALLS */
59 /* */
60 /* _gx_string_scroll_wheel_string_list_set */
61 /* Actual string scroll wheel */
62 /* string list set call */
63 /* */
64 /* CALLED BY */
65 /* */
66 /* Application Code */
67 /* */
68 /* RELEASE HISTORY */
69 /* */
70 /* DATE NAME DESCRIPTION */
71 /* */
72 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
73 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
74 /* resulting in version 6.1 */
75 /* */
76 /**************************************************************************/
77 #if defined(GX_ENABLE_DEPRECATED_STRING_API)
_gxe_string_scroll_wheel_string_list_set(GX_STRING_SCROLL_WHEEL * wheel,GX_CONST GX_CHAR ** string_list,INT string_count)78 UINT _gxe_string_scroll_wheel_string_list_set(GX_STRING_SCROLL_WHEEL *wheel,
79 GX_CONST GX_CHAR **string_list,
80 INT string_count)
81 {
82 UINT status;
83
84 /* Check for appropriate caller. */
85 GX_INIT_AND_THREADS_CALLER_CHECKING
86
87 /* Check for invalid pointer. */
88 if (wheel == GX_NULL)
89 {
90 return GX_PTR_ERROR;
91 }
92
93 /* Check for invalid widget. */
94 if (wheel -> gx_widget_type == 0)
95 {
96 return GX_INVALID_WIDGET;
97 }
98
99 /* Check for invalid list size. */
100 if (string_count < 0)
101 {
102 return GX_INVALID_VALUE;
103 }
104
105 status = _gx_string_scroll_wheel_string_list_set(wheel, string_list, string_count);
106
107 return status;
108 }
109 #endif
110
111 /**************************************************************************/
112 /* */
113 /* FUNCTION RELEASE */
114 /* */
115 /* _gxe_string_scroll_wheel_string_list_set_ext PORTABLE C */
116 /* 6.1 */
117 /* AUTHOR */
118 /* */
119 /* Kenneth Maxwell, Microsoft Corporation */
120 /* */
121 /* DESCRIPTION */
122 /* */
123 /* This function checks for errors in string scroll wheel string list */
124 /* set call. */
125 /* */
126 /* INPUT */
127 /* */
128 /* wheel Scroll wheel control block */
129 /* string_list String list to be set */
130 /* string_count The number of assigned strings*/
131 /* */
132 /* OUTPUT */
133 /* */
134 /* status Completion status */
135 /* */
136 /* CALLS */
137 /* */
138 /* _gx_string_scroll_wheel_string_list_set_ext */
139 /* Actual string scroll wheel */
140 /* string list set ext call */
141 /* */
142 /* CALLED BY */
143 /* */
144 /* Application Code */
145 /* */
146 /* RELEASE HISTORY */
147 /* */
148 /* DATE NAME DESCRIPTION */
149 /* */
150 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
151 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
152 /* resulting in version 6.1 */
153 /* */
154 /**************************************************************************/
_gxe_string_scroll_wheel_string_list_set_ext(GX_STRING_SCROLL_WHEEL * wheel,GX_CONST GX_STRING * string_list,INT string_count)155 UINT _gxe_string_scroll_wheel_string_list_set_ext(GX_STRING_SCROLL_WHEEL *wheel,
156 GX_CONST GX_STRING *string_list,
157 INT string_count)
158 {
159 UINT status;
160 INT string_id;
161 GX_CONST GX_STRING *string;
162 UINT string_length;
163
164 /* Check for appropriate caller. */
165 GX_INIT_AND_THREADS_CALLER_CHECKING
166
167 /* Check for invalid pointer. */
168 if (wheel == GX_NULL)
169 {
170 return GX_PTR_ERROR;
171 }
172
173 /* Check for invalid widget. */
174 if (wheel -> gx_widget_type == 0)
175 {
176 return GX_INVALID_WIDGET;
177 }
178
179 /* Check for invalid list size. */
180 if (string_count < 0)
181 {
182 return GX_INVALID_VALUE;
183 }
184
185 if (string_list)
186 {
187 /* Test string length. */
188 for (string_id = 0; string_id < string_count; string_id++)
189 {
190 string = &string_list[string_id];
191 if (string -> gx_string_ptr)
192 {
193 status = _gx_utility_string_length_check(string -> gx_string_ptr, &string_length, string -> gx_string_length);
194
195 if (status != GX_SUCCESS)
196 {
197 return status;
198 }
199 }
200 else
201 {
202 string_length = 0;
203 }
204
205 if (string_length != string -> gx_string_length)
206 {
207 return GX_INVALID_STRING_LENGTH;
208 }
209 }
210 }
211
212 status = _gx_string_scroll_wheel_string_list_set_ext(wheel, string_list, string_count);
213
214 return status;
215 }
216
217