fix get_num
This commit is contained in:
parent
fab0075f9b
commit
2726fb279c
@ -1119,10 +1119,9 @@ Term Yap_scan_num(StreamDesc *inp) {
|
|||||||
LOCAL_Error_TYPE = RESOURCE_ERROR_TRAIL;
|
LOCAL_Error_TYPE = RESOURCE_ERROR_TRAIL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
while (iswblank( ch = getchr(inp) ));
|
||||||
TokEntry *tokptr = (TokEntry *)AllocScannerMemory(sizeof(TokEntry));
|
TokEntry *tokptr = (TokEntry *)AllocScannerMemory(sizeof(TokEntry));
|
||||||
tokptr->TokPos = GetCurInpPos(inp);
|
tokptr->TokPos = GetCurInpPos(inp);
|
||||||
while ((ch = getchr(inp)) == BS)
|
|
||||||
;
|
|
||||||
if (ch == '-') {
|
if (ch == '-') {
|
||||||
sign = -1;
|
sign = -1;
|
||||||
ch = getchr(inp);
|
ch = getchr(inp);
|
||||||
|
10
C/text.c
10
C/text.c
@ -41,7 +41,11 @@ void *buf__, *cur__;
|
|||||||
void *ov__ = TR, *ocur__ = LOCAL_ScannerStack; \
|
void *ov__ = TR, *ocur__ = LOCAL_ScannerStack; \
|
||||||
if (!LOCAL_ScannerStack) LOCAL_ScannerStack = (char *)TR
|
if (!LOCAL_ScannerStack) LOCAL_ScannerStack = (char *)TR
|
||||||
|
|
||||||
#define protect_stack(s)
|
#define mark_stack() \
|
||||||
|
void *otr__ = TR; void * ost__ = LOCAL_ScannerStack; TR =(tr_fr_ptr)LOCAL_ScannerStack
|
||||||
|
|
||||||
|
#define restore_stack() \
|
||||||
|
TR = otr__; LOCAL_ScannerStack = ost__
|
||||||
|
|
||||||
#define export_buf(s) {}
|
#define export_buf(s) {}
|
||||||
|
|
||||||
@ -672,15 +676,19 @@ static size_t write_length(const unsigned char *s0, seq_tv_t *out,
|
|||||||
static Term write_number( unsigned char *s, seq_tv_t *out, int size
|
static Term write_number( unsigned char *s, seq_tv_t *out, int size
|
||||||
USES_REGS) {
|
USES_REGS) {
|
||||||
Term t;
|
Term t;
|
||||||
|
mark_stack();
|
||||||
t = Yap_StringToNumberTerm((char *)s, &out->enc);
|
t = Yap_StringToNumberTerm((char *)s, &out->enc);
|
||||||
|
restore_stack();
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Term string_to_term(void *s, seq_tv_t *out, size_t leng USES_REGS) {
|
static Term string_to_term(void *s, seq_tv_t *out, size_t leng USES_REGS) {
|
||||||
Term o;
|
Term o;
|
||||||
|
mark_stack();
|
||||||
o = out->val.t =
|
o = out->val.t =
|
||||||
Yap_StringToTerm(s, strlen(s) + 1, &out->enc,
|
Yap_StringToTerm(s, strlen(s) + 1, &out->enc,
|
||||||
GLOBAL_MaxPriority, NULL);
|
GLOBAL_MaxPriority, NULL);
|
||||||
|
restore_stack();
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,9 +94,6 @@ Term Yap_StringToNumberTerm(const char *s, encoding_t *encp) {
|
|||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
while (*s && isblank(*s) && Yap_wide_chtype(*s) == BS)
|
while (*s && isblank(*s) && Yap_wide_chtype(*s) == BS)
|
||||||
s++;
|
s++;
|
||||||
#else
|
|
||||||
while (*s && iswblank(*s++))
|
|
||||||
;
|
|
||||||
#endif
|
#endif
|
||||||
t = Yap_scan_num(GLOBAL_Stream + sno);
|
t = Yap_scan_num(GLOBAL_Stream + sno);
|
||||||
if (LOCAL_Error_TYPE == SYNTAX_ERROR)
|
if (LOCAL_Error_TYPE == SYNTAX_ERROR)
|
||||||
|
Reference in New Issue
Block a user