diff --git a/ee.c b/ee.c index bd1e503..40cff2f 100644 --- a/ee.c +++ b/ee.c @@ -33,7 +33,7 @@ main (int argc, const char* argv[]){ return error; } -int // Dependency of main() +int isNum(const char* query){ /* @@ -46,7 +46,7 @@ isNum(const char* query){ } -int // Dependency of main() +int arrity(const char query){ /* * If query is a string corresponding to an operator in {+,x,-,/,^,!}, then @@ -63,12 +63,12 @@ arrity(const char query){ } -double // Dependency of main() -evaluate(STACK* target_stack, int operator){ +double +evaluate(STACK* target_stack, ch operator){ /* - * if target_stack is a pointer to a STACK and operator is - * an integer corresponding to the ascii value of a supported - * operator, evaluate(target_stack,operator) is the result of + * If target_stack is a pointer to a STACK and operator is + * a char corresponding to a supported operator, + * evaluate(target_stack,operator) is the result of * applying the given operator to the appropriate number of * operands from target_stack. */ @@ -114,12 +114,12 @@ evaluate(STACK* target_stack, int operator){ } return value; } -double* // Dependency of evaluate() +double* operands(STACK* target_stack, int size){ /* * if target_stack is a pointer to a STACK, and size is an integer * corresponding to the number of operands desired, - * getOperands(target_stack,size) returns an array of operands and + * operands(target_stack,size) returns an array of operands and * pops them off *target_stack. */ double * const _operands = (double*)malloc(size*sizeof(double)); @@ -139,7 +139,7 @@ operands(STACK* target_stack, int size){ return _operands; } -double // Dependency of evaluate() +double fact(int n){ /* * if n is an integer, fact(n) is 'n factorial'. @@ -147,13 +147,12 @@ fact(int n){ return (n==0)? 1 : n*fact(n-1); } -void // Dependency of main() +void report(STACK expr){ /* - * reportErrors() returns an integer corresponding to - * the number of discrete error types noted in global - * variables ERR_NS_OPERANDS, ERR_NS_OPERATORS, and - * ERR_INVALID_INPUT. + * reportErrors() prints error strings according to the value of global + * bitvector error if it is nonzero, or the result of evaluation if error + * is zero. */ if (error & ERR_INVALID_INPUT)