1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** GUIX Component                                                        */
16 /**                                                                       */
17 /**   Prompt Management (Prompt)                                          */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 #define GX_SOURCE_CODE
22 
23 
24 /* Include necessary system files.  */
25 
26 #include "gx_api.h"
27 #include "gx_system.h"
28 #include "gx_prompt.h"
29 
30 /**************************************************************************/
31 /*                                                                        */
32 /*  FUNCTION                                               RELEASE        */
33 /*                                                                        */
34 /*    _gxe_prompt_text_get                                PORTABLE C      */
35 /*                                                           6.1          */
36 /*  AUTHOR                                                                */
37 /*                                                                        */
38 /*    Kenneth Maxwell, Microsoft Corporation                              */
39 /*                                                                        */
40 /*  DESCRIPTION                                                           */
41 /*                                                                        */
42 /*    This function checks errors in the prompt text get function.        */
43 /*                                                                        */
44 /*                                                                        */
45 /*  INPUT                                                                 */
46 /*                                                                        */
47 /*    prompt                          Pointer to prompt widget            */
48 /*                                      control block                     */
49 /*    return_text                     Pointer to destination for text     */
50 /*                                                                        */
51 /*  OUTPUT                                                                */
52 /*                                                                        */
53 /*    status                          Completion status                   */
54 /*                                                                        */
55 /*  CALLS                                                                 */
56 /*                                                                        */
57 /*    _gx_prompt_text_get             The actual function                 */
58 /*                                                                        */
59 /*  CALLED BY                                                             */
60 /*                                                                        */
61 /*    Application Code                                                    */
62 /*                                                                        */
63 /*  RELEASE HISTORY                                                       */
64 /*                                                                        */
65 /*    DATE              NAME                      DESCRIPTION             */
66 /*                                                                        */
67 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
68 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
69 /*                                            resulting in version 6.1    */
70 /*                                                                        */
71 /**************************************************************************/
72 #if defined(GX_ENABLE_DEPRECATED_STRING_API)
_gxe_prompt_text_get(GX_PROMPT * prompt,GX_CONST GX_CHAR ** return_text)73 UINT _gxe_prompt_text_get(GX_PROMPT *prompt, GX_CONST GX_CHAR **return_text)
74 {
75 UINT status;
76 
77     /* Check error for valid pointer. */
78     if (prompt == GX_NULL)
79     {
80         return(GX_PTR_ERROR);
81     }
82 
83     /* Check for invalid widget.  */
84     if (prompt -> gx_widget_type == 0)
85     {
86         return(GX_INVALID_WIDGET);
87     }
88 
89     /* Call the actual function.  */
90     status = _gx_prompt_text_get(prompt, return_text);
91 
92     /* Return completion status.  */
93     return(status);
94 }
95 #endif
96 
97 /**************************************************************************/
98 /*                                                                        */
99 /*  FUNCTION                                               RELEASE        */
100 /*                                                                        */
101 /*    _gxe_prompt_text_get_ext                            PORTABLE C      */
102 /*                                                           6.1          */
103 /*  AUTHOR                                                                */
104 /*                                                                        */
105 /*    Kenneth Maxwell, Microsoft Corporation                              */
106 /*                                                                        */
107 /*  DESCRIPTION                                                           */
108 /*                                                                        */
109 /*    This function checks errors in the prompt text get function.        */
110 /*                                                                        */
111 /*                                                                        */
112 /*  INPUT                                                                 */
113 /*                                                                        */
114 /*    prompt                          Pointer to prompt widget            */
115 /*                                      control block                     */
116 /*    return_text                     Pointer to destination for text     */
117 /*                                                                        */
118 /*  OUTPUT                                                                */
119 /*                                                                        */
120 /*    status                          Completion status                   */
121 /*                                                                        */
122 /*  CALLS                                                                 */
123 /*                                                                        */
124 /*    _gx_prompt_text_get_ext         The actual function                 */
125 /*                                                                        */
126 /*  CALLED BY                                                             */
127 /*                                                                        */
128 /*    Application Code                                                    */
129 /*                                                                        */
130 /*  RELEASE HISTORY                                                       */
131 /*                                                                        */
132 /*    DATE              NAME                      DESCRIPTION             */
133 /*                                                                        */
134 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
135 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
136 /*                                            resulting in version 6.1    */
137 /*                                                                        */
138 /**************************************************************************/
_gxe_prompt_text_get_ext(GX_PROMPT * prompt,GX_STRING * return_text)139 UINT _gxe_prompt_text_get_ext(GX_PROMPT *prompt, GX_STRING *return_text)
140 {
141 UINT status;
142 
143     /* Check error for valid pointer. */
144     if (prompt == GX_NULL)
145     {
146         return(GX_PTR_ERROR);
147     }
148 
149     /* Check for invalid widget.  */
150     if (prompt -> gx_widget_type == 0)
151     {
152         return(GX_INVALID_WIDGET);
153     }
154 
155     /* Call the actual function.  */
156     status = _gx_prompt_text_get_ext(prompt, return_text);
157 
158     /* Return completion status.  */
159     return(status);
160 }
161 
162