-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjumpstack.h
More file actions
76 lines (61 loc) · 1.97 KB
/
jumpstack.h
File metadata and controls
76 lines (61 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* File: jumpstack.h
* Author: Sir Gee of Five
*
* Created on May 26, 2011, 10:06 AM
*/
#ifndef JUMPSTACK_H
#define JUMPSTACK_H
#include <stdio.h>
#include <pspkerneltypes.h>
/** Indicates success. */
#define JUMPSTACK_SUCCESS (0)
/** Indicates failure. */
#define JUMPSTACK_FAILURE (-1)
/** Indicates a NULL pointer. */
#define JUMPSTACK_NULLPTR (-2)
/** Indicates a memory error. */
#define JUMPSTACK_MEMORY (-3)
/** The number of elements in a Jump Stack. */
#define JUMPSTACK_SIZE (16)
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _JumpStack {
/** Array of SceUInt32 addresses. */
SceUInt32 element[JUMPSTACK_SIZE];
/** The number of active elements. */
int elements;
}
/** The JumpStack struct represents a Jump Stack. */
JumpStack;
/** Clear a Jump Stack.
*
* @param prStack Pointer to a JumpStack struct representing the Jump Stack.
* @return 0 indicates success, <0 indicates failure.
*/
int jumpstack_clear(JumpStack* prStack);
/** Initialize a Jump Stack.
*
* @param prStack Pointer to the JumpStack struct to initialize.
* @return 0 indicates success, <0 indicates failure.
*/
int jumpstack_init(JumpStack* prStack);
/** Return the last added address from a Jump Stack, removing the address.
*
* @param prStack Pointer to a JumpStack struct representing the Jump Stack.
* @return A SceUInt32 containing the last added address is returned.
*/
SceUInt32 jumpstack_pop(JumpStack* prStack);
/** Push an address onto the Jump Stack, rolling off the last element if
* necessary.
*
* @param prStack Pointer to a JumpStack struct representing the Jump Stack.
* @param address SceUInt32 containing the address to push.
* @return 0 indicates success, <0 indicates failure.
*/
int jumpstack_push(JumpStack* prStack, SceUInt32 address);
#ifdef __cplusplus
}
#endif
#endif /* JUMPSTACK_H */