Skip to content

Commit

Permalink
fixed \n in print
Browse files Browse the repository at this point in the history
  • Loading branch information
GianlucaBortoli committed Dec 22, 2014
1 parent 3fbfff1 commit 400ca59
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion REQUIREMENTS.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* Bortoli Gianluca 159993 */

I developed points b.I, b.II, b.III, b.IV (b.VII too)
I developed points b.I, b.II, b.III, b.IV (b.VII too)

I took inspiration from 5.2 example. I nearly rewrited it all to better understant
was really going on and in order to have only what is necessary.
6 changes: 3 additions & 3 deletions calcInterpreter.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ conNodeType * ex(nodeType *p) {
case nodeDic: {
//check if var already declared earlier
if (getsym(p->dic.name)) {
fprintf(stderr, "%s is already declared\n", p->dic.name);
fprintf(stdout, "%s is already declared\n", p->dic.name);
exit(1);
}
//if not decleared, put in symbol table its name and type
Expand Down Expand Up @@ -117,7 +117,7 @@ conNodeType * ex(nodeType *p) {
// 46 is the maximum length of float in C
// I didn't figured out a smart(er) way to do this
char * tmp = (char *)malloc(46 + 1);
sprintf(tmp, "%f", print->r);
sprintf(tmp, "%f\n", print->r);

// substitute comma with dot, again
for(int i = 0 ; ; i++){
Expand Down Expand Up @@ -177,7 +177,7 @@ conNodeType * ex(nodeType *p) {
case EQ: {
symrec * s = getsym(p->opr.op[0]->id.name);
if(s == NULL){
fprintf(stderr, "There is not '%s' varibale in the symbol table\n", p->opr.op[0]->id.name);
fprintf(stdout, "There is not '%s' varibale in the symbol table\n", p->opr.op[0]->id.name);
exit(1);
}

Expand Down

0 comments on commit 400ca59

Please sign in to comment.