-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlistaOperandos.h
92 lines (67 loc) · 2.19 KB
/
listaOperandos.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
/*
lista_operandos.h
Estrutura e * cabeçalho da implementação da pilha de operações
*/
#ifndef LISTA_OPERANDOS_H
#define LISTA_OPERANDOS_H
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
typedef uint8_t u1;
typedef uint16_t u2;
typedef uint32_t u4;
typedef uint64_t u8;
typedef int8_t i1;
typedef int16_t i2;
typedef int32_t i4;
typedef int64_t i8;
typedef struct lista_operandos{
i4 operando;
void *referencia;
u1 tipo_operando;
struct lista_operandos *prox;
struct lista_operandos *ant;
}lista_operandos;
/* *
* lista_operandos
*
* Estrutura de dados da lista de operações.
* consulte https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-2.html#jvms-2.6.2
*
*/
enum tipos_operandos{
BOOLEAN_OP = 1,
BYTE_OP,
CHAR_OP,
SHORT_OP,
INTEGER_OP,
FLOAT_OP,
LONG_OP,
DOUBLE_OP,
RETURN_ADDRESS_OP,
REFERENCE_OP,
REFERENCE_ARRAY_BOOLEAN_OP,
REFERENCE_ARRAY_CHAR_OP,
REFERENCE_ARRAY_FLOAT_OP,
REFERENCE_ARRAY_DOUBLE_OP,
REFERENCE_ARRAY_BYTE_OP,
REFERENCE_ARRAY_SHORT_OP,
REFERENCE_ARRAY_INT_OP,
REFERENCE_ARRAY_LONG_OP,
REFERENCE_STRING_OP,
};
lista_operandos* CriaListaOperandos();
lista_operandos* InsereInicioOperandos(lista_operandos *lista, i4 operando, void *referencia, u1 tipo_operando);
lista_operandos* InsereFimOperandos(lista_operandos *lista, i4 operando, void *referencia, u1 tipo_operando);
lista_operandos* RemoveInicioOperandos(lista_operandos *lista);
lista_operandos* RemoveFimOperandos(lista_operandos *lista);
void ImprimeListaOperandos(lista_operandos *lista);
void LiberaListaOperandos(lista_operandos *lista);
lista_operandos* RemoveElementoOperandos(lista_operandos *lista,i4 operando, u1 tipo_operando);
lista_operandos* BuscaElementoOperandos(lista_operandos *lista, i4 operando, u1 tipo_operando);
lista_operandos* BuscaPosicaoOperandos(lista_operandos *lista, int posicao);
lista_operandos* InserePosicaoOperandos(lista_operandos *lista, i4 operando, u1 tipo_operando, int posicao);
lista_operandos* RemovePosicaoOperandos(lista_operandos *lista, int posicao);
#endif