GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_system_screen_stack_get.c Lines: 16 16 100.0 %
Date: 2026-03-06 19:21:09 Branches: 6 6 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
/**   System Management (System)                                          */
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
30
/**************************************************************************/
31
/*                                                                        */
32
/*  FUNCTION                                               RELEASE        */
33
/*                                                                        */
34
/*    _gx_system_screen_stack_get                         PORTABLE C      */
35
/*                                                           6.1          */
36
/*  AUTHOR                                                                */
37
/*                                                                        */
38
/*    Kenneth Maxwell, Microsoft Corporation                              */
39
/*                                                                        */
40
/*  DESCRIPTION                                                           */
41
/*                                                                        */
42
/*    This function removes the topmost entry from the system screen      */
43
/*    stack, and returns popped parent and screen pointers to the caller. */
44
/*                                                                        */
45
/*  INPUT                                                                 */
46
/*                                                                        */
47
/*    popped_parent                         Retrieved stack top parent    */
48
/*    popped_screen                         Retrieved stack top screen    */
49
/*                                                                        */
50
/*  OUTPUT                                                                */
51
/*                                                                        */
52
/*    status                                Completion status             */
53
/*                                                                        */
54
/*  CALLS                                                                 */
55
/*                                                                        */
56
/*    None                                                                */
57
/*                                                                        */
58
/*  CALLED BY                                                             */
59
/*                                                                        */
60
/*    Application Code                                                    */
61
/*                                                                        */
62
/**************************************************************************/
63
15
UINT  _gx_system_screen_stack_get(GX_WIDGET **popped_parent, GX_WIDGET **popped_screen)
64
{
65
UINT       status;
66
INT        top;
67
15
GX_WIDGET *screen = GX_NULL;
68
15
GX_WIDGET *parent = GX_NULL;
69
70
15
    top = _gx_system_screen_stack.gx_screen_stack_control_top;
71
72
15
    if (top >= 0)
73
    {
74
13
        top <<= 1;
75
13
        screen = _gx_system_screen_stack.gx_screen_stack_control_memory[top];
76
13
        parent = _gx_system_screen_stack.gx_screen_stack_control_memory[top + 1];
77
78
13
        _gx_system_screen_stack.gx_screen_stack_control_top--;
79
80
13
        status = GX_SUCCESS;
81
    }
82
    else
83
    {
84
2
        status = GX_FAILURE;
85
    }
86
87
15
    if (popped_parent)
88
    {
89
12
        (*popped_parent) = parent;
90
    }
91
92
15
    if (popped_screen)
93
    {
94
14
        (*popped_screen) = screen;
95
    }
96
97
15
    return status;
98
}
99