If parser overflows in local stack, expand global with scanned terms.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@661 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
6a4f06cde6
commit
ea76f86890
@ -9,14 +9,14 @@
|
|||||||
**************************************************************************
|
**************************************************************************
|
||||||
* *
|
* *
|
||||||
* File: mpi.c *
|
* File: mpi.c *
|
||||||
* Last rev: $Date: 2002-10-03 17:32:40 $ *
|
* Last rev: $Date: 2002-10-29 13:58:21 $ *
|
||||||
* mods: *
|
* mods: *
|
||||||
* comments: Interface to an MPI library *
|
* comments: Interface to an MPI library *
|
||||||
* *
|
* *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char *rcsid = "$Header: /Users/vitor/Yap/yap-cvsbackup/library/mpi/mpi.c,v 1.9 2002-10-03 17:32:40 stasinos Exp $";
|
static char *rcsid = "$Header: /Users/vitor/Yap/yap-cvsbackup/library/mpi/mpi.c,v 1.10 2002-10-29 13:58:21 stasinos Exp $";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Yap.h"
|
#include "Yap.h"
|
||||||
@ -241,7 +241,7 @@ mpi_parse(void)
|
|||||||
|
|
||||||
old_TR = TR;
|
old_TR = TR;
|
||||||
while( TRUE ) {
|
while( TRUE ) {
|
||||||
CELL *old_H = H;
|
CELL *old_H;
|
||||||
|
|
||||||
/* Scans the term using stack space */
|
/* Scans the term using stack space */
|
||||||
eot_before_eof = FALSE;
|
eot_before_eof = FALSE;
|
||||||
@ -249,6 +249,10 @@ mpi_parse(void)
|
|||||||
/* the first arg is the getc_for_read, diff only if CharConv is on */
|
/* the first arg is the getc_for_read, diff only if CharConv is on */
|
||||||
tokstart = tokptr = toktide = tokenizer( mpi_getc, mpi_getc );
|
tokstart = tokptr = toktide = tokenizer( mpi_getc, mpi_getc );
|
||||||
|
|
||||||
|
/* preserve value of H after scanning: otherwise we may lose strings
|
||||||
|
and floats */
|
||||||
|
old_H = H;
|
||||||
|
|
||||||
if ( mpi_eob() && !eot_before_eof) {
|
if ( mpi_eob() && !eot_before_eof) {
|
||||||
if (tokstart != NIL && tokstart->Tok != Ord (eot_tok)) {
|
if (tokstart != NIL && tokstart->Tok != Ord (eot_tok)) {
|
||||||
/* we got the end of file from an abort */
|
/* we got the end of file from an abort */
|
||||||
@ -279,6 +283,7 @@ mpi_parse(void)
|
|||||||
/* ignore term we just built */
|
/* ignore term we just built */
|
||||||
H = old_H;
|
H = old_H;
|
||||||
if (growstack_in_parser(&old_TR, &tokstart, &VarTable)) {
|
if (growstack_in_parser(&old_TR, &tokstart, &VarTable)) {
|
||||||
|
old_H = H;
|
||||||
tokptr = toktide = tokstart;
|
tokptr = toktide = tokstart;
|
||||||
ErrorMessage = NULL;
|
ErrorMessage = NULL;
|
||||||
goto repeat_cycle;
|
goto repeat_cycle;
|
||||||
|
Reference in New Issue
Block a user