Browse Source

refactoring: function names improved

remotes/origin/Input_Handling
Sophia Weber 11 months ago
parent
commit
7fd32e4b04
  1. 12
      src/inputHandling.c
  2. 2
      src/inputHandling.h

12
src/inputHandling.c

@ -7,8 +7,8 @@
char data[1000]; char data[1000];
void deleteWhitespace(char* a, int length); void deleteWhitespace(char* a, int length);
op readFunction(char* data, int length); op readFunction(char* data, int length);
char* getnumbers(char* data, int length, calc_op* structure_ref);
void printstruct(calc_op* formula);
char* getNumbers(char* data, int length, calc_op* structure_ref);
void showStruct(calc_op* formula);
void input(char* a, int length) { void input(char* a, int length) {
@ -17,8 +17,8 @@ void input(char* a, int length) {
memcpy(data,a,length); memcpy(data,a,length);
temp.formel = a; temp.formel = a;
temp.funktionstyp = readFunction(data, 10); temp.funktionstyp = readFunction(data, 10);
if (getnumbers(data,length, &temp) == NULL){
printstruct(&temp);
if (getNumbers(data, length, &temp) == NULL){
showStruct(&temp);
} else { } else {
printf("Formular %s not supported", temp.formel); printf("Formular %s not supported", temp.formel);
} }
@ -51,7 +51,7 @@ op readFunction(char* data, int length){
} }
//Zahlen auslesen (+) //Zahlen auslesen (+)
char* getnumbers(char* data, int length, calc_op* structure_ref){ //input sind: string, länge vom String, berechnungsstruct
char* getNumbers(char* data, int length, calc_op* structure_ref){ //input sind: string, länge vom String, berechnungsstruct
// char tmp[length]; // char tmp[length];
char* splitPnt; char* splitPnt;
int i = 0; int i = 0;
@ -88,7 +88,7 @@ char* getnumbers(char* data, int length, calc_op* structure_ref){ //input sind:
} }
} }
void printstruct(calc_op* formula){
void showStruct(calc_op* formula){
printf("Berechnung: %s\n", formula->formel); printf("Berechnung: %s\n", formula->formel);
switch (formula->funktionstyp) { switch (formula->funktionstyp) {
case opAdd: case opAdd:

2
src/inputHandling.h

@ -16,6 +16,6 @@ double result;
}calc_op; }calc_op;
extern void input(char* a, int length); extern void input(char* a, int length);
extern void printstruct(calc_op* formula);
extern void showStruct(calc_op* formula);
#endif // INPUTHANDLING_H #endif // INPUTHANDLING_H
Loading…
Cancel
Save