[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bison-1.28a Remove bug

From: Hans Aberg
Subject: Re: Bison-1.28a Remove bug
Date: Thu, 5 Oct 2000 12:15:11 +0200

At 11.14 +0200 0-10-05, Akim Demaille wrote:
>Thanks for the proposal, but in this area bison is way too damaged to
>keep on patching small chunks.  We need to completely redesign its
>handling of temp files.

I mentioned my stuff because I used the ISO C variation, and you seemed to
not use it.

>There are several steps to complete.  The first one is to equip bison
>with mkstemp and its portability machinery.  Then we must find a means
>to isolate the specificities of the various system bison was ported
>to.  For instance we should have a function get_tmpdir or something.
>Then use only unlink, and install portability machinery for
>unlink-less architectures.

Unlink is not ISO C, remove is. So it should be the other way around if ISO
C should be the point of departure, use remove() as a basis, and then
figure out which compilers do not have it. :-)

If you use a get_tmpdir, then you get into the stuff of what symbol is used
to separate directories "/", "\", or ":". Isn't people asking for this
directory only because Bison fails to cleanup the files? So perhaps it's
simpler to merely make sure those files are removed.

So why not register another function cleanup() with atexit(). Make sure to
remove the abort() from the code as it does call functions registered by
atexit(). For each file used also introduce a variable is_open telling if
it is open or not. Then simply
void cleanup(void) {
     if (file_p) {
         if (file_is_open)   fclose(file_p);
         remove(file_name);   -- or unlink.

Then done() could concentrate on writing the tab file and such.

-- This is essentially just a translation of the cleanup done by a C++
automatic class object; cleanup() is the destructor of the program.

  Hans Aberg

reply via email to

[Prev in Thread] Current Thread [Next in Thread]