13 void print_stack(void);
30 while((type
= getop(s
)) != EOF
)
39 printf("Print Top of Stack\n");
44 printf("Reverse Stack\n");
62 printf("error: zero divisor\n");
68 push((int)(pop()) % (int)(op2
));
70 printf("error: zero divisor\n");
74 printf("\t%.8g\n", pop());
77 printf("error: unknown command %s\n", s
);
84 /* push f onto value stack */
90 printf("error: stack full\n");
93 /* pop and return top value from stack */
100 printf("error: stack empty\n");
105 /* reverse two vales at top of stack */
115 /* print top two values on stack */
118 printf("%f\t%f\n", val
[sp
], val
[sp
-1]);
121 /* get next operator or numberic operand */
126 while ((s
[0] = c
= getch()) == ' ' || c
== '\t')
129 if(!isdigit(c
) && c
!= '.')
133 while(isdigit(s
[++i
] = c
= getch()))
136 while(isdigit(s
[++i
] = c
= getch()))
146 return (bufp
> 0) ? buf
[--bufp
] : getchar();
152 printf("ungetch: too many characters\n");