-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpile.h
108 lines (87 loc) · 2.78 KB
/
pile.h
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/**
* @file pile.h
* @author meo ([email protected])
* @brief fichier de mise en oeuvre de la Pile
* @version 0.1
* @date 2022-10-04
*
* @copyright Copyright (c) 2022
*
*/
#ifndef PILE_H
#define PILE_H
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
typedef struct element_pile_int{
int val;
struct element_pile_int *precedent;
}t_element_pile_int;
typedef struct element_pile_char{
char val;
struct element_pile_char *precedent;
}t_element_pile_char;
typedef struct element_pile_float{
float val;
struct element_pile_float *precedent;
}t_element_pile_float;
typedef struct element_pile_double{
double val;
struct element_pile_double *precedent;
}t_element_pile_double;
typedef struct element_pile_long{
long val;
struct element_pile_long *precedent;
}t_element_pile_long;
typedef struct element_pile_bool{
bool val;
struct element_pile_bool *precedent;
}t_element_pile_bool;
typedef struct element_pile_string{
char *val;
struct element_pile_string *precedent;
}t_element_pile_string;
typedef enum type_pile{
PILE_INT,
PILE_CHAR,
PILE_FLOAT,
PILE_DOUBLE,
PILE_LONG,
PILE_BOOL,
PILE_STRING
}t_type_pile;
typedef struct pile{
void * haut_pile;
t_type_pile type;
int taille;
void (*empiler)(struct pile *, void *);
void (*depiler)(struct pile *, void *);
void (*peek)(struct pile *, void *);
}t_pile;
extern t_pile *creer_pile(t_type_pile type);
extern bool pile_vide(t_pile *pile);
extern void empiler(t_pile *pile, void *val);
extern void depiler(t_pile *pile, void *val);
extern void peek(t_pile *pile, void *val);
static void empiler_int(t_pile *pile, void *val);
static void empiler_char(t_pile *pile, void *val);
static void empiler_float(t_pile *pile, void *val);
static void empiler_double(t_pile *pile, void *val);
static void empiler_long(t_pile *pile, void *val);
static void empiler_bool(t_pile *pile, void *val);
static void empiler_string(t_pile *pile, void *val);
static void depiler_int(t_pile *pile, void *val);
static void depiler_char(t_pile *pile, void *val);
static void depiler_float(t_pile *pile, void *val);
static void depiler_double(t_pile *pile, void *val);
static void depiler_long(t_pile *pile, void *val);
static void depiler_bool(t_pile *pile, void *val);
static void depiler_string(t_pile *pile, void *val);
static void peek_int(t_pile *pile, void *val);
static void peek_char(t_pile *pile, void *val);
static void peek_float(t_pile *pile, void *val);
static void peek_double(t_pile *pile, void *val);
static void peek_long(t_pile *pile, void *val);
static void peek_bool(t_pile *pile, void *val);
static void peek_string(t_pile *pile, void *val);
#endif