]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/m2/mc-boot/GmcStack.h
Update copyright years.
[thirdparty/gcc.git] / gcc / m2 / mc-boot / GmcStack.h
1 /* do not edit automatically generated by mc from mcStack. */
2 /* mcStack.def provides a stack data type and associated procedures.
3
4 Copyright (C) 2015-2023 Free Software Foundation, Inc.
5 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
6
7 This file is part of GNU Modula-2.
8
9 GNU Modula-2 is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
12 any later version.
13
14 GNU Modula-2 is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with GNU Modula-2; see the file COPYING3. If not see
21 <http://www.gnu.org/licenses/>. */
22
23
24 #if !defined (_mcStack_H)
25 # define _mcStack_H
26
27 #include "config.h"
28 #include "system.h"
29 # ifdef __cplusplus
30 extern "C" {
31 # endif
32 # if !defined (PROC_D)
33 # define PROC_D
34 typedef void (*PROC_t) (void);
35 typedef struct { PROC_t proc; } PROC;
36 # endif
37
38 # include "GSYSTEM.h"
39
40 # if defined (_mcStack_C)
41 # define EXTERN
42 # else
43 # define EXTERN extern
44 # endif
45
46 #if !defined (mcStack_stack_D)
47 # define mcStack_stack_D
48 typedef void *mcStack_stack;
49 #endif
50
51
52 /*
53 init - create and return a stack.
54 */
55
56 EXTERN mcStack_stack mcStack_init (void);
57
58 /*
59 kill - deletes stack, s.
60 */
61
62 EXTERN void mcStack_kill (mcStack_stack *s);
63
64 /*
65 push - an address, a, onto the stack, s.
66 It returns, a.
67 */
68
69 EXTERN void * mcStack_push (mcStack_stack s, void * a);
70
71 /*
72 pop - and return the top element from stack, s.
73 */
74
75 EXTERN void * mcStack_pop (mcStack_stack s);
76
77 /*
78 replace - performs a pop; push (a); return a.
79 */
80
81 EXTERN void * mcStack_replace (mcStack_stack s, void * a);
82
83 /*
84 depth - returns the depth of the stack.
85 */
86
87 EXTERN unsigned int mcStack_depth (mcStack_stack s);
88
89 /*
90 access - returns the, i, th stack element.
91 The top of stack is defined by:
92
93 access (s, depth (s)).
94 */
95
96 EXTERN void * mcStack_access (mcStack_stack s, unsigned int i);
97 # ifdef __cplusplus
98 }
99 # endif
100
101 # undef EXTERN
102 #endif