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 /**   Prompt Management (Prompt)                                          */
19 /**                                                                       */
20 /**************************************************************************/
21 
22 #define GX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "gx_api.h"
28 #include "gx_widget.h"
29 #include "gx_prompt.h"
30 #include "gx_system.h"
31 
32 /* Bring in externs for caller checking code.  */
33 GX_CALLER_CHECKING_EXTERNS
34 
35 /**************************************************************************/
36 /*                                                                        */
37 /*  FUNCTION                                               RELEASE        */
38 /*                                                                        */
39 /*    _gxe_prompt_create                                  PORTABLE C      */
40 /*                                                           6.1          */
41 /*  AUTHOR                                                                */
42 /*                                                                        */
43 /*    Kenneth Maxwell, Microsoft Corporation                              */
44 /*                                                                        */
45 /*  DESCRIPTION                                                           */
46 /*                                                                        */
47 /*    This function checks errors in the prompt create function.          */
48 /*                                                                        */
49 /*  INPUT                                                                 */
50 /*                                                                        */
51 /*    prompt                                Prompt control block          */
52 /*    name                                  Name of prompt                */
53 /*    parent                                Parent widget control block   */
54 /*    text_id                               Resource string id            */
55 /*    style                                 Style of prompt               */
56 /*    prompt_id                             Application-defined ID of     */
57 /*                                            prompt.                     */
58 /*    size                                  Prompt size                   */
59 /*    prompt_control_block_size             Size of the prompt control    */
60 /*                                            block                       */
61 /*                                                                        */
62 /*  OUTPUT                                                                */
63 /*                                                                        */
64 /*    status                                Completion status             */
65 /*                                                                        */
66 /*  CALLS                                                                 */
67 /*                                                                        */
68 /*   _gx_prompt_create                     the actual function            */
69 /*                                                                        */
70 /*  CALLED BY                                                             */
71 /*                                                                        */
72 /*    Application Code                                                    */
73 /*                                                                        */
74 /*  RELEASE HISTORY                                                       */
75 /*                                                                        */
76 /*    DATE              NAME                      DESCRIPTION             */
77 /*                                                                        */
78 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
79 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
80 /*                                            resulting in version 6.1    */
81 /*                                                                        */
82 /**************************************************************************/
_gxe_prompt_create(GX_PROMPT * prompt,GX_CONST GX_CHAR * name,GX_WIDGET * parent,GX_RESOURCE_ID text_id,ULONG style,USHORT prompt_id,GX_CONST GX_RECTANGLE * size,UINT prompt_control_block_size)83 UINT  _gxe_prompt_create(GX_PROMPT *prompt, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
84                          GX_RESOURCE_ID text_id, ULONG style, USHORT prompt_id,
85                          GX_CONST GX_RECTANGLE *size, UINT prompt_control_block_size)
86 {
87 
88 UINT status;
89 
90     /* Check for appropriate caller.  */
91     GX_INIT_AND_THREADS_CALLER_CHECKING
92 
93     /* Check error for valid pointer. */
94     if ((prompt == GX_NULL) || (size == GX_NULL))
95     {
96         return(GX_PTR_ERROR);
97     }
98 
99     /* Check for widget already created.  */
100     if (prompt -> gx_widget_type != 0)
101     {
102         return(GX_ALREADY_CREATED);
103     }
104 
105     /* Check for invalid control block size. */
106     if (prompt_control_block_size != sizeof(GX_PROMPT))
107     {
108         return(GX_INVALID_SIZE);
109     }
110 
111     status = _gx_prompt_create(prompt, name, parent, text_id, style, prompt_id, size);
112     return(status);
113 }
114 
115