GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_numeric_prompt_create.c Lines: 10 10 100.0 %
Date: 2024-12-05 08:52:37 Branches: 14 14 100.0 %

Line Branch Exec Source
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
/**   Numeric 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_widget.h"
28
#include "gx_numeric_prompt.h"
29
#include "gx_system.h"
30
31
/* Bring in externs for caller checking code.  */
32
GX_CALLER_CHECKING_EXTERNS
33
34
/**************************************************************************/
35
/*                                                                        */
36
/*  FUNCTION                                               RELEASE        */
37
/*                                                                        */
38
/*    _gxe_numeric_prompt_create                          PORTABLE C      */
39
/*                                                           6.1          */
40
/*  AUTHOR                                                                */
41
/*                                                                        */
42
/*    Kenneth Maxwell, Microsoft Corporation                              */
43
/*                                                                        */
44
/*  DESCRIPTION                                                           */
45
/*                                                                        */
46
/*    This function checks errors in numeric prompt create function.      */
47
/*                                                                        */
48
/*  INPUT                                                                 */
49
/*                                                                        */
50
/*    prompt                                Numeric prompt control block  */
51
/*    name                                  Name of numeric prompt        */
52
/*    parent                                Parent widget control block   */
53
/*    text_id                               Resource string id            */
54
/*    style                                 Style of numeric prompt       */
55
/*    prompt_id                             Application-defined ID of     */
56
/*                                            Numeric prompt.             */
57
/*    size                                  Numeric prompt size           */
58
/*    control_block_size                    The size of the widget control*/
59
/*                                            structure in bytes          */
60
/*                                                                        */
61
/*  OUTPUT                                                                */
62
/*                                                                        */
63
/*    status                                Completion status             */
64
/*                                                                        */
65
/*  CALLS                                                                 */
66
/*                                                                        */
67
/*   _gx_numeric_prompt_create              Actual numeric prompt create  */
68
/*                                            call                        */
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
/**************************************************************************/
83
1697
UINT  _gxe_numeric_prompt_create(GX_NUMERIC_PROMPT *prompt, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
84
                                GX_RESOURCE_ID text_id, ULONG style, USHORT prompt_id, GX_CONST GX_RECTANGLE *size,
85
                                UINT control_block_size)
86
{
87
88
UINT status;
89
90
    /* Check for appropriate caller.  */
91

1697
    GX_INIT_AND_THREADS_CALLER_CHECKING
92
93
    /* Check error for valid pointer. */
94

1695
    if ((prompt == GX_NULL) || (size == GX_NULL))
95
    {
96
2
        return(GX_PTR_ERROR);
97
    }
98
99
    /* Check for widget already created.  */
100
1693
    if (prompt -> gx_widget_type != 0)
101
    {
102
1
        return(GX_ALREADY_CREATED);
103
    }
104
105
1692
    if (control_block_size != sizeof(GX_NUMERIC_PROMPT))
106
    {
107
1
        return(GX_INVALID_SIZE);
108
    }
109
110
    /* Call actual number prompt create. */
111
1691
    status = _gx_numeric_prompt_create(prompt, name, parent, text_id, style, prompt_id, size);
112
113
1691
    return(status);
114
}
115