- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
int pop_2(StackNodePtr_2 *topPtr) {
StackNodePtr_2 tempPtr;
int popValue;
tempPtr = *topPtr;
popValue = (*topPtr)->data;
*topPtr = (*topPtr)->nextPtr;
free(tempPtr);
return popValue;
}
/* Return the value at the top of the stack */
char stackTop_1(StackNodePtr_2 topPtr) {
char topValue;
topValue = topPtr->data;
return topValue;
}
int isEmpty_2(StackNodePtr_2 topPtr) { return topPtr == NULL; }
/* Test if the list is empty */
int my_isalpha(char alpha) {
return ((alpha >= 65 && alpha <= 90) || (alpha >= 97 && alpha <= 122));
}
int my_isdigit(char alpha) { return (alpha >= 48) && (alpha <= 57); }
int isOperator_2(char c) {
return c == '/' || c == '*' || c == '-' || c == '+' || c == '^' || c == '%';
}
int goto_search(data *table, char *token) {
int x = 0;
for (x = 0; x != 100; x++) {
if (memcmp((table + x)->symbol, token, 2) == 0) {
return (table + x)->location;
}
}
return 0;
}
int helper_search_1(data *base, char *token, int run) {
return ((base + run)->symbol[0] == *token ||
my_strcmp((base + run)->symbol, "0") == 0);
}
int helper_search_2(data *base, char *token, int run) {
return (my_strcmp((base + run)->symbol, token) == 0 ||
my_strcmp((base + run)->symbol, "0") == 0);
}
int search_in_base(data *intro_search, char *str_tok_search) {
int runner = 0, ch = !my_isalpha(*str_tok_search);
for (; !helper_search_base(intro_search, str_tok_search, runner); ++runner)
;
return runner;
}
int helper_search_base(data *base, char *token, int run) {
return my_strcmp((base + run)->symbol, "0") == 0;
}
int search_in_table(data *intro_search, char *str_tok_search) {
int runner = 0, ch = !my_isalpha(*str_tok_search);
for (; !(*helper_search[ch])(intro_search, str_tok_search, runner); ++runner)
;
return runner;
}
int rem_break(char *token) {
if (memcmp(token, "rem", 3) == 0) {
return 1;
}
return 0;
}
Комментарии (0) RSS
Добавить комментарий