fixed docstring for report and evaluate
This commit is contained in:
29
ee.c
29
ee.c
@@ -33,7 +33,7 @@ main (int argc, const char* argv[]){
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
int // Dependency of main()
|
int
|
||||||
isNum(const char* query){
|
isNum(const char* query){
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -46,7 +46,7 @@ isNum(const char* query){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int // Dependency of main()
|
int
|
||||||
arrity(const char query){
|
arrity(const char query){
|
||||||
/*
|
/*
|
||||||
* If query is a string corresponding to an operator in {+,x,-,/,^,!}, then
|
* If query is a string corresponding to an operator in {+,x,-,/,^,!}, then
|
||||||
@@ -63,12 +63,12 @@ arrity(const char query){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double // Dependency of main()
|
double
|
||||||
evaluate(STACK* target_stack, int operator){
|
evaluate(STACK* target_stack, ch operator){
|
||||||
/*
|
/*
|
||||||
* if target_stack is a pointer to a STACK and operator is
|
* If target_stack is a pointer to a STACK and operator is
|
||||||
* an integer corresponding to the ascii value of a supported
|
* a char corresponding to a supported operator,
|
||||||
* operator, evaluate(target_stack,operator) is the result of
|
* evaluate(target_stack,operator) is the result of
|
||||||
* applying the given operator to the appropriate number of
|
* applying the given operator to the appropriate number of
|
||||||
* operands from target_stack.
|
* operands from target_stack.
|
||||||
*/
|
*/
|
||||||
@@ -114,12 +114,12 @@ evaluate(STACK* target_stack, int operator){
|
|||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
double* // Dependency of evaluate()
|
double*
|
||||||
operands(STACK* target_stack, int size){
|
operands(STACK* target_stack, int size){
|
||||||
/*
|
/*
|
||||||
* if target_stack is a pointer to a STACK, and size is an integer
|
* if target_stack is a pointer to a STACK, and size is an integer
|
||||||
* corresponding to the number of operands desired,
|
* 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.
|
* pops them off *target_stack.
|
||||||
*/
|
*/
|
||||||
double * const _operands = (double*)malloc(size*sizeof(double));
|
double * const _operands = (double*)malloc(size*sizeof(double));
|
||||||
@@ -139,7 +139,7 @@ operands(STACK* target_stack, int size){
|
|||||||
return _operands;
|
return _operands;
|
||||||
}
|
}
|
||||||
|
|
||||||
double // Dependency of evaluate()
|
double
|
||||||
fact(int n){
|
fact(int n){
|
||||||
/*
|
/*
|
||||||
* if n is an integer, fact(n) is 'n factorial'.
|
* 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);
|
return (n==0)? 1 : n*fact(n-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void // Dependency of main()
|
void
|
||||||
report(STACK expr){
|
report(STACK expr){
|
||||||
/*
|
/*
|
||||||
* reportErrors() returns an integer corresponding to
|
* reportErrors() prints error strings according to the value of global
|
||||||
* the number of discrete error types noted in global
|
* bitvector error if it is nonzero, or the result of evaluation if error
|
||||||
* variables ERR_NS_OPERANDS, ERR_NS_OPERATORS, and
|
* is zero.
|
||||||
* ERR_INVALID_INPUT.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (error & ERR_INVALID_INPUT)
|
if (error & ERR_INVALID_INPUT)
|
||||||
|
|||||||
Reference in New Issue
Block a user