Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
getop.cpp
- Committer:
- okano
- Date:
- 2015-06-26
- Revision:
- 2:0e96f4495b43
- Child:
- 3:4ef74510cc5b
File content as of revision 2:0e96f4495b43:
#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;
}