GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_multi_line_text_input_create.c Lines: 12 12 100.0 %
Date: 2024-12-05 08:52:37 Branches: 18 18 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
/**   Multi Line Text Input Management (Multi Line Text)                  */
18
/**                                                                       */
19
/**************************************************************************/
20
21
#define GX_SOURCE_CODE
22
23
24
/* Include necessary system files.  */
25
26
#include "gx_api.h"
27
#include "gx_multi_line_text_input.h"
28
#include "gx_multi_line_text_view.h"
29
30
/* Bring in externs for caller checking code.  */
31
GX_CALLER_CHECKING_EXTERNS
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gxe_multi_line_text_input_create                   PORTABLE C      */
38
/*                                                           6.1.3        */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    This function checks for errors in the multi line text input        */
46
/*  create.                                                               */
47
/*                                                                        */
48
/*  INPUT                                                                 */
49
/*                                                                        */
50
/*    text_input_ptr                        Multi Line input control block*/
51
/*    nampe_ptr                             Wigdget name                  */
52
/*    parent                                Parent widget control block   */
53
/*    size                                  Parent widget control block   */
54
/*    input_buffer                          User-supplied input buffer    */
55
/*    buffer_size                           Size of the user-supplied     */
56
/*                                            input buffer                */
57
/*    style                                 The style of the widget border*/
58
/*    Id                                    The ID number of the widget   */
59
/*    text_input_control_block_size         Size of the multi line text   */
60
/*                                            input control block         */
61
/*                                                                        */
62
/*  OUTPUT                                                                */
63
/*                                                                        */
64
/*    status                                Completion status             */
65
/*                                                                        */
66
/*  CALLS                                                                 */
67
/*                                                                        */
68
/*    _gx_multi_line_text_input_create                                    */
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
/*  12-31-2020     Kenneth Maxwell          Modified comment(s),          */
82
/*                                            removed input buffer check, */
83
/*                                            resulting in version 6.1.3  */
84
/*                                                                        */
85
/**************************************************************************/
86
580
UINT  _gxe_multi_line_text_input_create(GX_MULTI_LINE_TEXT_INPUT *text_input_ptr,
87
                                        GX_CONST GX_CHAR *name_ptr,
88
                                        GX_WIDGET *parent,
89
                                        GX_CHAR *input_buffer,
90
                                        UINT buffer_size,
91
                                        ULONG style,
92
                                        USHORT Id,
93
                                        GX_CONST GX_RECTANGLE *size,
94
                                        UINT text_input_control_block_size)
95
{
96
UINT status;
97
98
    /* Check for invalid caller of this function.  */
99

580
    GX_INIT_AND_THREADS_CALLER_CHECKING
100
101
    /* Check for invalid pointer.  */
102

578
    if ((text_input_ptr == GX_NULL) || (size == GX_NULL))
103
    {
104
2
        return(GX_PTR_ERROR);
105
    }
106
107
    /* Check for invalid control block size. */
108
576
    if (text_input_control_block_size != sizeof(GX_MULTI_LINE_TEXT_INPUT))
109
    {
110
1
        return(GX_INVALID_SIZE);
111
    }
112
113
    /* Check for widget already created.  */
114
575
    if (text_input_ptr -> gx_widget_type != 0)
115
    {
116
1
        return(GX_ALREADY_CREATED);
117
    }
118
119
    /* Check for invalid parent widget.  */
120

574
    if (parent && (parent -> gx_widget_type == 0))
121
    {
122
1
        return(GX_INVALID_WIDGET);
123
    }
124
125
    /* Call actual multi line text input create function.  */
126
573
    status = _gx_multi_line_text_input_create(text_input_ptr, name_ptr, parent, input_buffer, buffer_size, style, Id, size);
127
128
    /* Return completion status.  */
129
573
    return(status);
130
}
131