-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterprete.h
More file actions
70 lines (58 loc) · 1.34 KB
/
interprete.h
File metadata and controls
70 lines (58 loc) · 1.34 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
#ifndef P1_COMPGO_INTERPRETE_H
#define P1_COMPGO_INTERPRETE_H
#include <math.h>
#include "bison.tab.h"
#include "pila.h"
#include <stdbool.h>
/* Colores */
#define ROJO "\x1b[31m"
#define VERDE "\x1b[32m"
#define CYAN "\x1b[36m"
#define AMARILLO "\x1b[33m"
#define RESET "\x1b[0m"
// Tolerancia
#define TOLERANCIA 1e-6
// Contenedor
typedef struct {
int comp_lexico;
char *lexema;
union {
// Valor para números
double var;
// Puntero a función
double (*funcptr)();
// Puntero a la librería asignada dinámicamente
void *libhandle;
} valor;
} contenedor;
/**
* Lanza el programa del intérprete
* @param arg script de entrada opcional
*/
void interprete(char* arg);
/**
* Wrapper del push de la pila de ficheros
* @param E puntero a FILE
*/
void push_wrapper(tipoelemPila E);
/**
* Wrapper de pop de la pila de ficheros
*/
void pop_wrapper();
/**
* Wrapper de esVaciaPila de la pila de ficheros
* @return 0 si no está vacía
* @return 1 si está vacía
*/
unsigned esVaciaPila_wrapper();
/**
* Wrapper de tope de la pila de ficheros
* @return puntero a FILE con el fichero más arriba
*/
tipoelemPila tope_wrapper();
/**
* Consulta el tamaño de la pila de ficheros
* @return entero con la profundidad de la pila
*/
int consultar_profundidad();
#endif //P1_COMPGO_INTERPRETE_H