-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCalc2.h
90 lines (59 loc) · 1.69 KB
/
Calc2.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
#ifndef CALC2_H
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "General.h"
#include "DoubleLinkedListVoid.h"
typedef struct MathT_Struct{
int type;
void* data;
}* MathT;
#define MathT_Operation 0
#define MathT_int 1
#define MathT_float 2
#define MathT_double 3
#define MathT_Add 4
#define MathT_Subtract 5
#define MathT_Multiply 6
#define MathT_Divide 7
#define MathT_Modulus 8
#define MathT_Power 9
struct Operation_Struct;
typedef struct Operation_Struct* Operation;
MathT MathT_Create();
MathT MathT_FromOperation(Operation);
MathT MathT_Operator(int);
MathT MathT_FromInt(int);
MathT MathT_FromFloat(float);
MathT MathT_FromDouble(double);
bool MathT_TryConvertToInt(MathT, int*);
bool MathT_TryConvertToFloat(MathT, float*);
bool MathT_TryConvertToDouble(MathT, double*);
void MathT_Free(MathT);
typedef struct Operation_Struct{
List op; //list of MathT
}* Operation;
Operation Operation_Create();
Operation Operation_FromString(char*);
int Operation_GetReturnType(Operation o);
bool Operation_SolveInnerOperations(Operation o);
double Operation_Solve(Operation);
int String_SkipSpaces(char*);
bool MathT_TryReadInt(char*, int*);
bool MathT_TryReadFloat(char*, float*);
bool MathT_TryReadDouble(char*, double*);
bool MathT_TryReadNumber(char*, double*);
bool MathT_TryReadOperator(char*, int*);
bool MathT_TryReadBraces(char*, Operation*);
bool Char_IsNumber(char);
bool String_IsNullOrEmpty(char* s);
bool String_HasNumber(char*);
bool String_HasOperator(char*);
bool String_HasBraces(char*);
void Operation_Free(Operation);
int String_IndexOfChar(char*, char);
void Operation_Print(Operation o);
void MathT_Print(MathT);
#define CALC2_H
#endif