mirror of
https://gitlab.com/80486DX2-66/gists
synced 2025-01-25 14:51:45 +05:30
floatscan-experiment.c: implement shunget
to normalize operation of the original code
This commit is contained in:
parent
f411dfc6dc
commit
c040b0bd44
@ -47,11 +47,12 @@
|
|||||||
const char* fgetc_ptr = NULL;
|
const char* fgetc_ptr = NULL;
|
||||||
|
|
||||||
int __shgetc(void);
|
int __shgetc(void);
|
||||||
|
int __shunget(void);
|
||||||
long double floatscan(const char* s, int prec);
|
long double floatscan(const char* s, int prec);
|
||||||
|
|
||||||
#define shgetc(f) __shgetc()
|
#define shgetc(f) __shgetc()
|
||||||
#define shlim(...)
|
#define shlim(...)
|
||||||
#define shunget(...)
|
#define shunget(f) __shunget()
|
||||||
|
|
||||||
#define FLOAT_TYPE 0
|
#define FLOAT_TYPE 0
|
||||||
#define DOUBLE_TYPE 1
|
#define DOUBLE_TYPE 1
|
||||||
@ -567,6 +568,11 @@ int __shgetc(void) {
|
|||||||
return *fgetc_ptr++;
|
return *fgetc_ptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int __shunget(void) {
|
||||||
|
fgetc_ptr--;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
long double floatscan(const char* s, int prec) {
|
long double floatscan(const char* s, int prec) {
|
||||||
fgetc_ptr = s;
|
fgetc_ptr = s;
|
||||||
return __floatscan(NULL, prec, 1);
|
return __floatscan(NULL, prec, 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user