This repository has been archived by the owner on Mar 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathial.h
99 lines (84 loc) · 2.63 KB
/
ial.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
/*
* Project name:
* Implementace interpretu imperativního jazyka IFJ14
*
* Repository:
* https://github.com/Dasio/IFJ
*
* Team:
* Dávid Mikuš (xmikus15)
* Peter Hostačný (xhosta03)
* Tomáš Kello (xkello00)
* Adam Lučanský (xlucan01)
* Michaela Lukášová (xlukas09)
*/
#include "system.h"
#include "string.h"
#ifndef ial_H
#define ial_H
#include "symbol.h"
#include "stack.h"
/**
* Find substring in string (length of string have to be set in String struct)
* @param in Original String
* @param substring Substring
*
* @return SUCCESSFUL
* index where substring start
* FAILED
* Length of input String
* ERR_Allocation if unable to malloc
*/
int FindString(String *in, String *substring);
/**
* Make formula for KMP algorithm
* @param find String which must include it's length
* @return FORMULA, NULL if unable to malloc
*/
int *GetFormula(String *find);
// Use QuickSortRecursive (faster)
/**
* Get length of arr and call QuickSortRecursive
* @param arr array to sort
*/
void QuickSort(String *string);
void QuickSortRecursive(char *arr, int left, int right);
// Return hash depend on char* in range of (uint)length
/**
* Return hash index in range
* @param name Name of symbol
* @param range Range of HashTable
* @return index to Hash
*/
unsigned int GetHash(const char* name, unsigned range);
// Free LocTable, use SymbolListFree function
/**
* Erase LocTable in Context and recursive all Contents stored in Hash table
* @param Cont Pointer to Context
*/
void ContextLocTableFree(Context* Cont);
// Free SymbolList and included Strin
/**
* Free SymbolList TODO? String if included?
* @param symbol pointer to SymbolList
*/
void SymbolListFree(SymbolList* symbol);
/**
* Find Symbol with specific name
* @param Cont Content where to find
* @param name Name which we want
* @return Pointer to SymbolList, NULL if failed
*/
Symbol *SymbolFind(Context *Cont, char *name);
/**
* Add symbol to Context
* @param FunCont Context where symbol will be
* @param type Type of symbol
* @param name Name of symbol
* @param SymbolContext Pointer to symbol's Context if type is T_FunPointer
* @param foundSymbol If not null, function dont have to call again SymbolFind
* @param skipCheck If false, function will check if symbol name doesn't collide with function
* @return Pointer to Symbol, NULL if failed
*/
Symbol *SymbolAdd(Context *FunCont, SymbolType type, char *name, Context *SymbolContext, Symbol *foundSymbol, bool skipCheck);
#endif