-
Notifications
You must be signed in to change notification settings - Fork 0
/
instruct_dllist.h
89 lines (61 loc) · 2.52 KB
/
instruct_dllist.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
/**
* Projekt: IFJ2021
*
* @brief Implementace DLListu pro instrukce.
*
* @author Vít Janeček [email protected]
*
* @property Kostra je založena na základě IAL DU1 a DU2
*/
#ifndef _INSTRUCT_DLLIST_H
#include <stdio.h>
#include <stdbool.h>
#include "Dynamic_string.h"
#include "error.h"
typedef struct DLLElement_Instruct {
/** Dynamicky string s instrukci */
Dynamic_string *instruction;
/** Ukazatel na předcházející prvek seznamu. */
struct DLLElement_Instruct *previousElement;
/** Ukazatel na následující prvek seznamu. */
struct DLLElement_Instruct *nextElement;
} *DLLElementPtr_Instruct;
/** Dvousměrně vázaný seznam. */
typedef struct {
/** Pocet prvku. */
int count;
/** Ukazatel na první prvek seznamu. */
DLLElementPtr_Instruct firstElement;
/** Ukazatel na aktuální prvek seznamu. */
DLLElementPtr_Instruct activeElement;
/** Ukazatel na source prvek seznamu. */
DLLElementPtr_Instruct sourceElement;
/** Ukazatel na destination prvek seznamu. */
DLLElementPtr_Instruct destinationElement;
/** Ukazatel na posledni prvek seznamu. */
DLLElementPtr_Instruct lastElement;
} DLList_Instruct;
void DLL_Instruct_Init( DLList_Instruct * );
void DLL_Instruct_Dispose( DLList_Instruct * );
int DLL_Instruct_InsertFirst( DLList_Instruct *, Dynamic_string *);
int DLL_Instruct_InsertLast( DLList_Instruct *, Dynamic_string *);
void DLL_Instruct_First( DLList_Instruct * );
void DLL_Instruct_Last( DLList_Instruct * );
void DLL_Instruct_GetFirst( DLList_Instruct *, Dynamic_string *);
void DLL_Instruct_GetLast( DLList_Instruct *, Dynamic_string *);
void DLL_Instruct_DeleteFirst( DLList_Instruct * );
void DLL_Instruct_DeleteLast( DLList_Instruct * );
void DLL_Instruct_DeleteAfter( DLList_Instruct * );
void DLL_Instruct_DeleteBefore( DLList_Instruct * );
int DLL_Instruct_InsertAfter( DLList_Instruct *, Dynamic_string *);
int DLL_Instruct_InsertBefore( DLList_Instruct *, Dynamic_string *);
void DLL_Instruct_GetValue( DLList_Instruct *, Dynamic_string * );
void DLL_Instruct_SetValue( DLList_Instruct *, Dynamic_string * );
void DLL_Instruct_Next( DLList_Instruct * );
void DLL_Instruct_Previous( DLList_Instruct * );
void DLL_Instruct_setSource(DLList_Instruct *, int position);
void DLL_Instruct_setDestination(DLList_Instruct *, int position);
int DLL_Instruct_Move(DLList_Instruct *, int countOfElem, int positionOFDestination, int positionOFSource);
#define _INSTRUCT_DLLIST_H
#endif //IFJ_PROJECT_INSTRUCT_DLLIST_H
/** @endcode */