Tedd OKANO / Mbed 2 deprecated RPN_calc__based_on_K_and_R

Dependencies:   mbed

Revision:
2:0e96f4495b43
Child:
3:4ef74510cc5b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/getop.cpp	Fri Jun 26 10:16:24 2015 +0000
@@ -0,0 +1,35 @@
+#include    "mbed.h"
+#include    "calc.h"
+
+#include    <ctype.h>
+
+int getop( char s[] )
+{
+    int     i, c;
+
+    while ( (s[ 0 ] = c = getch()) == ' ' || c == '\t' )
+        ;
+
+    s[ 1 ]  = '\0';
+
+    if ( !isdigit( c ) && c != '.' )
+        return c;
+
+    i   = 0;
+
+    if ( isdigit( c ) )
+        while ( isdigit( s[ ++i ] = c = getch() ) )
+            ;
+
+    if ( c == '.' )
+        while ( isdigit( s[ ++i ] = c = getch() ) )
+            ;
+
+    s[ i ]  = '\0';
+
+
+    if ( c != EOF )
+        ungetch( c );
+
+    return NUMBER;
+}