GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_prompt_text_get.c Lines: 13 13 100.0 %
Date: 2026-03-06 19:21:09 Branches: 4 4 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_system.h"
29
#include "gx_display.h"
30
#include "gx_widget.h"
31
#include "gx_prompt.h"
32
#include "gx_utility.h"
33
34
/**************************************************************************/
35
/*                                                                        */
36
/*  FUNCTION                                               RELEASE        */
37
/*                                                                        */
38
/*    _gx_prompt_text_get                                 PORTABLE C      */
39
/*                                                           6.1          */
40
/*  AUTHOR                                                                */
41
/*                                                                        */
42
/*    Kenneth Maxwell, Microsoft Corporation                              */
43
/*                                                                        */
44
/*  DESCRIPTION (deprecated)                                              */
45
/*                                                                        */
46
/*    This service gets the text of a prompt widget.                      */
47
/*                                                                        */
48
/*                                                                        */
49
/*  INPUT                                                                 */
50
/*                                                                        */
51
/*    prompt                                Pointer to prompt widget      */
52
/*                                            control block               */
53
/*    return_text                           Pointer to destination for    */
54
/*                                            the text                    */
55
/*                                                                        */
56
/*  OUTPUT                                                                */
57
/*                                                                        */
58
/*    status                                Completion status             */
59
/*                                                                        */
60
/*  CALLS                                                                 */
61
/*                                                                        */
62
/*    _gx_system_string_get                 Obtain the string             */
63
/*                                                                        */
64
/*  CALLED BY                                                             */
65
/*                                                                        */
66
/*    Application Code                                                    */
67
/*                                                                        */
68
/**************************************************************************/
69
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
70
2
UINT _gx_prompt_text_get(GX_PROMPT *prompt, GX_CONST GX_CHAR **return_text)
71
{
72
UINT      status;
73
GX_STRING string;
74
75
2
    string.gx_string_ptr = GX_NULL;
76
2
    string.gx_string_length = 0;
77
78
2
    status = _gx_prompt_text_get_ext(prompt, &string);
79
80
2
    if (status == GX_SUCCESS)
81
    {
82
1
        *return_text = string.gx_string_ptr;
83
    }
84
85
2
    return(status);
86
}
87
#endif
88
89
/**************************************************************************/
90
/*                                                                        */
91
/*  FUNCTION                                               RELEASE        */
92
/*                                                                        */
93
/*    _gx_prompt_text_get_ext                             PORTABLE C      */
94
/*                                                           6.1.10       */
95
/*  AUTHOR                                                                */
96
/*                                                                        */
97
/*    Kenneth Maxwell, Microsoft Corporation                              */
98
/*                                                                        */
99
/*  DESCRIPTION                                                           */
100
/*                                                                        */
101
/*    This service gets the text of a prompt widget.                      */
102
/*                                                                        */
103
/*                                                                        */
104
/*  INPUT                                                                 */
105
/*                                                                        */
106
/*    prompt                                Pointer to prompt widget      */
107
/*                                            control block               */
108
/*    return_text                           Pointer to destination for    */
109
/*                                            the text                    */
110
/*                                                                        */
111
/*  OUTPUT                                                                */
112
/*                                                                        */
113
/*    status                                Completion status             */
114
/*                                                                        */
115
/*  CALLS                                                                 */
116
/*                                                                        */
117
/*    _gx_system_string_get_ext             Obtain the string             */
118
/*                                                                        */
119
/*  CALLED BY                                                             */
120
/*                                                                        */
121
/*    Application Code                                                    */
122
/*                                                                        */
123
/**************************************************************************/
124
462169
UINT _gx_prompt_text_get_ext(GX_PROMPT *prompt, GX_STRING *return_string)
125
{
126
462169
UINT status = GX_SUCCESS;
127
128
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT)
129
GX_BIDI_TEXT_INFO           text_info;
130
GX_BIDI_RESOLVED_TEXT_INFO *resolved_info;
131
GX_CANVAS                  *canvas;
132
GX_DISPLAY                 *display;
133
#endif
134
135
462169
    if (prompt -> gx_prompt_text_id)
136
    {
137
420674
        status = _gx_widget_string_get_ext((GX_WIDGET *)prompt, prompt -> gx_prompt_text_id, return_string);
138
    }
139
    else
140
    {
141
41495
        _gx_system_private_string_get(&prompt -> gx_prompt_string, return_string, prompt -> gx_widget_style);
142
    }
143
144
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT)
145
    if (_gx_system_bidi_text_enabled)
146
    {
147
        if (prompt -> gx_prompt_bidi_resolved_text_info)
148
        {
149
            *return_string = *prompt -> gx_prompt_bidi_resolved_text_info -> gx_bidi_resolved_text_info_text;
150
        }
151
        else
152
        {
153
            text_info.gx_bidi_text_info_text = *return_string;
154
            text_info.gx_bidi_text_info_font = GX_NULL;
155
            text_info.gx_bidi_text_info_display_width = -1;
156
            GX_UTILITY_TEXT_DIRECTION_GET(text_info.gx_bidi_text_info_direction, prompt, canvas, display);
157
158
            if (_gx_utility_bidi_paragraph_reorder_ext(&text_info, &resolved_info) == GX_SUCCESS)
159
            {
160
                prompt -> gx_prompt_bidi_resolved_text_info = resolved_info;
161
                *return_string = *resolved_info -> gx_bidi_resolved_text_info_text;
162
            }
163
        }
164
    }
165
#endif
166
167
462169
    return(status);
168
}
169