From c03408a7a3dd1013bda3be88d1fa4b07120b19ff Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Tue, 10 Jul 2018 23:03:31 +0200 Subject: [PATCH] Modify the code from obsolete 'struct line' to 'struct card' --- src/frontend/translatepoly.c | 39 ++++++++++++++++++------------------ src/frontend/translatepoly.h | 2 +- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/frontend/translatepoly.c b/src/frontend/translatepoly.c index a3caa36b0..bedb374a1 100644 --- a/src/frontend/translatepoly.c +++ b/src/frontend/translatepoly.c @@ -106,13 +106,14 @@ permutation_t increment(permutation_t input, int ndimensions) return next; } -Poly_t interpretpoly(struct line * input, char controlType, char sourceType) +Poly_t interpretpoly(struct card *input, char controlType, char sourceType) { + NG_IGNORE(sourceType); Poly_t Poly; Poly.Dimensions = 0; Poly.Coefficients = 0; char * linestr; - linestr = input->li_line; + linestr = input->line; char * polystr; polystr = strstr(linestr, "poly("); if(polystr == NULL){ @@ -148,7 +149,7 @@ Poly_t interpretpoly(struct line * input, char controlType, char sourceType) for(int j = 0; j < 2; j++){ if(cutstr[0] == '\0'){ //Syntax Error - fprintf(stderr, "Error: Too few control node/source pairs for POLY command in line %i", input->li_linenum_orig); + fprintf(stderr, "Error: Too few control node/source pairs for POLY command in line %i", input->linenum_orig); } nodepair[j] = gettok_node(&cutstr); } @@ -300,10 +301,10 @@ char * expressionfrompoly(Poly_t input) return expression; } -struct line * translatepoly(struct line * input_line) +struct card * translatepoly(struct card * input_line) { char * linestr; - linestr = input_line->li_line; + linestr = input_line->line; // check if translation needed if(strstr(linestr, "poly") == NULL){ return input_line; @@ -318,13 +319,13 @@ struct line * translatepoly(struct line * input_line) //default: return input_line; } Poly_t Poly = interpretpoly(input_line, controlchar, sourcechar); - struct line * output_line; + struct card * output_line; if(TRANSLATEPOLY_REPLACE){ - output_line->li_actual = input_line->li_actual; - output_line->li_error = input_line->li_error; - output_line->li_linenum = input_line->li_linenum; - output_line->li_linenum_orig = input_line->li_linenum_orig; - output_line->li_next = input_line->li_next; + output_line->actualLine = input_line->actualLine; + output_line->error = input_line->error; + output_line->linenum = input_line->linenum; + output_line->linenum_orig = input_line->linenum_orig; + output_line->nextcard = input_line->nextcard; } char * sourcename; int newlinelen; @@ -335,23 +336,23 @@ struct line * translatepoly(struct line * input_line) break; } } - output_line->li_line = (char *) tmalloc( newlinelen * sizeof(char) ); - if(output_line->li_line == NULL){ + output_line->line = (char *) tmalloc( newlinelen * sizeof(char) ); + if(output_line->line == NULL){ fprintf(stderr, "ERROR: Out of memory"); controlled_exit(EXIT_BAD); } - strcpy(output_line->li_line, "b"); - strcat(output_line->li_line, sourcename); + strcpy(output_line->line, "b"); + strcat(output_line->line, sourcename); char * expressionLHS, * expressionRHS; expressionLHS = tprintf(" %c = ", sourcechar); - strcat(output_line->li_line, expressionLHS); + strcat(output_line->line, expressionLHS); expressionRHS = expressionfrompoly(Poly); newlinelen += strlen(expressionRHS); - output_line->li_line = (char *) trealloc(output_line->li_line, newlinelen); - if(output_line->li_line == NULL){ + output_line->line = (char *) trealloc(output_line->line, newlinelen); + if(output_line->line == NULL){ fprintf(stderr, "ERROR: Out of memory"); controlled_exit(EXIT_BAD); } - strcat(output_line->li_line, expressionRHS); + strcat(output_line->line, expressionRHS); return output_line; } \ No newline at end of file diff --git a/src/frontend/translatepoly.h b/src/frontend/translatepoly.h index 3a97d407d..23b901e05 100644 --- a/src/frontend/translatepoly.h +++ b/src/frontend/translatepoly.h @@ -7,6 +7,6 @@ arbitrary behavioural modelling source line. */ -struct line * translatepoly(struct line * input_line); +struct card * translatepoly(struct card * input_line); #endif \ No newline at end of file