GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_prompt_create.c Lines: 10 10 100.0 %
Date: 2026-03-06 19:21:09 Branches: 14 14 100.0 %

Line Branch Exec Source
1
/***************************************************************************
2
 * Copyright (c) 2024 Microsoft Corporation
3
 * Copyright (c) 2026-present Eclipse ThreadX contributors
4
 *
5
 * This program and the accompanying materials are made available under the
6
 * terms of the MIT License which is available at
7
 * https://opensource.org/licenses/MIT.
8
 *
9
 * SPDX-License-Identifier: MIT
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
/**************************************************************************/
75
57220
UINT  _gxe_prompt_create(GX_PROMPT *prompt, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
76
                         GX_RESOURCE_ID text_id, ULONG style, USHORT prompt_id,
77
                         GX_CONST GX_RECTANGLE *size, UINT prompt_control_block_size)
78
{
79
80
UINT status;
81
82
    /* Check for appropriate caller.  */
83

57220
    GX_INIT_AND_THREADS_CALLER_CHECKING
84
85
    /* Check error for valid pointer. */
86

57218
    if ((prompt == GX_NULL) || (size == GX_NULL))
87
    {
88
2
        return(GX_PTR_ERROR);
89
    }
90
91
    /* Check for widget already created.  */
92
57216
    if (prompt -> gx_widget_type != 0)
93
    {
94
1
        return(GX_ALREADY_CREATED);
95
    }
96
97
    /* Check for invalid control block size. */
98
57215
    if (prompt_control_block_size != sizeof(GX_PROMPT))
99
    {
100
1
        return(GX_INVALID_SIZE);
101
    }
102
103
57214
    status = _gx_prompt_create(prompt, name, parent, text_id, style, prompt_id, size);
104
57214
    return(status);
105
}
106