-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.h
69 lines (60 loc) · 1.88 KB
/
common.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
#ifndef _COMMON_H_
#define _COMMON_H_
/**
* Method used to dynamically allocate a string.
* @param d The string to allocate
* @return the new pointer for the string
**/
char* calloc_string(char* d);
/**
* Method used to destroy a dinamically allocated string previously archived
* @param p The string to delete
**/
void destroy_string(char* p);
/**
* Method used to clean the archive containing all strings dinamically allocated
**/
void recycle_garbage();
/**
* Method used to dinamically allocate a string and store it inside temporary archive
* @param d The string to allocate
* @return a char pointer to the beginning od the newly allocated string
**/
char* alloc_string(char* d);
/**
* Method used to concatenate two strings
* @param head The beginning sting
* @param tail The end string
* @return a char pointer to the beginning od the newly allocated string
**/
char* grow_string(char* head, char* tail);
/**
* Method used to extract the variable's name from the variable in string passed
* @param s The string containing the variable
* @return the variable's name extracted
**/
char* extract_variable(char* s);
/**
* Method used to extract a binary expression from components
* @param a The left size of the expression
* @param b The symbol
* @param c The right part of the expression
* @return The newly created exception
**/
char* extract_binary_expr(char* a, char* b, char* c);
/**
* Method used to extract a unary expression from components
* @param a The symbol
* @param b The right part of the expression
* @return The newly created exception
**/
char* extract_unary_expr(char* a, char* b);
/**
* Method used to extract a condition expression from components
* @param a The left size of the expression
* @param b The symbol
* @param c The right part of the expression
* @return The newly created exception
**/
char* extract_conditional_op(char* a, char* b, char* c);
#endif