hoa: make the scanner interactive when reading from a pipe
Otherwise autfilt will not start processing input automata before its input buffer is full. * src/hoaparse/hoascan.ll: Here.
This commit is contained in:
parent
46d967945b
commit
2fc816c8a7
1 changed files with 15 additions and 1 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
/* -*- coding: utf-8 -*-
|
/* -*- coding: utf-8 -*-
|
||||||
** Copyright (C) 2014 Laboratoire de Recherche et Développement
|
** Copyright (C) 2014, 2015 Laboratoire de Recherche et Développement
|
||||||
** de l'Epita (LRDE).
|
** de l'Epita (LRDE).
|
||||||
**
|
**
|
||||||
** This file is part of Spot, a model checking library.
|
** This file is part of Spot, a model checking library.
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include "hoaparse/parsedecl.hh"
|
#include "hoaparse/parsedecl.hh"
|
||||||
#include "misc/escape.hh"
|
#include "misc/escape.hh"
|
||||||
|
|
||||||
|
|
@ -356,10 +357,21 @@ namespace spot
|
||||||
int
|
int
|
||||||
hoayyopen(const std::string &name)
|
hoayyopen(const std::string &name)
|
||||||
{
|
{
|
||||||
|
bool want_interactive = false;
|
||||||
|
|
||||||
// yy_flex_debug = 1;
|
// yy_flex_debug = 1;
|
||||||
if (name == "-")
|
if (name == "-")
|
||||||
{
|
{
|
||||||
yyin = stdin;
|
yyin = stdin;
|
||||||
|
|
||||||
|
// If the input is a pipe, make the scanner
|
||||||
|
// interactive so that it does not wait for the input
|
||||||
|
// buffer to be full to process automata.
|
||||||
|
struct stat s;
|
||||||
|
if (fstat(fileno(stdin), &s) < 0)
|
||||||
|
throw std::runtime_error("fstat failed");
|
||||||
|
if (S_ISFIFO(s.st_mode))
|
||||||
|
want_interactive = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -371,6 +383,8 @@ namespace spot
|
||||||
// ended badly.
|
// ended badly.
|
||||||
YY_NEW_FILE;
|
YY_NEW_FILE;
|
||||||
hoayyreset();
|
hoayyreset();
|
||||||
|
if (want_interactive)
|
||||||
|
yy_set_interactive(true);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue