Boost logo

Boost-Build :

From: Rene Rivera (grafik.list_at_[hidden])
Date: 2005-09-04 09:22:25

Joao Abecasis wrote:
> Rene Rivera wrote:
>>How about something like:
>>rule READ ( file : first-and-last-line * : regexp ? )
>> # file, path to file
>> # first-and-last-line, range of lines to read, default ( 0 1 )
>> # regexp, optional regex to apply to each line before it is returned
>> #
>> # returns: ( first-line-read last-line-read strings * )
> Some issues regarding the implementation of a READ command.
> * How are multiple reads on the same file to be handled? Is the file
> repeatedly opened? Does it remain open for the duration of a bjam run?
> FWIW, map_file_* could still be used as a back-end to cache file data in
> memory. A possible issue with my implementation is that it naively
> assumes files don't change, if they are changing they must be explicitly
> unmapped or remapped.
> * Are (file, line) pairs tracked? Or do we fopen/fseek on repeated
> reads? What about when sequentially calling READ a line at a time?

I always go for the simplest and most portable solution first. So reopen
and rereading would be the first thing to try. If it becomes a
performance issue then one can do buffering, for example (file, FILE*,
offset, line) in an MRU list.

> Hmm... Then again, perhaps I'm letting implementation details cloud my
> vision of the big picture ;-)

I'd say your are :-) It's the user interface that's important, the READ
rule in this case.

-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. -
-- rrivera/ - grafik/
-- 102708583/icq - grafikrobot/aim - Grafik/

Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at