28 Dec 15:51
Re: parsing compressed files with flex & bison
From: Hans Aberg <haberg <at> math.su.se>
Subject: Re: parsing compressed files with flex & bison
Newsgroups: gmane.comp.lex.flex.general, gmane.comp.parsers.bison.general
Date: 2006-12-28 14:51:12 GMT
Subject: Re: parsing compressed files with flex & bison
Newsgroups: gmane.comp.lex.flex.general, gmane.comp.parsers.bison.general
Date: 2006-12-28 14:51:12 GMT
Flex was not built to generate lexers for essentially binary files, though you may try it. And one can easily pipe streams under UNIX- like OS's. Hans Aberg On 28 Dec 2006, at 14:27, Aïmen Troudi wrote: > I want to parse files in one pass for 2 reasons : > > 1- size of (5) files is important (>200MO). > 2- it is more sophistical (execution time and I/O). > > The problem is that flex needs FILE* stream, and Zlib needs gzFile > stream. > > I find these 2 solutions : > > 1) - find the type of compressed file (gzip or bunzip2 or Z). > - switch the type i execute FILE* yyin = popen(cmd,"r"), cmd : > "/usr/bin/bunzip2 -dfc file.bz2" or ... > > -> - this solution don't use zlib library, it use shell. > - easy to implement than 2). > > 2) - find the type of compressed file (gzip or bunzip2 or Z). > - open a pipe, fork. > - the father process use zlib library to read compressed files > and put them in pipe, > gzFile stream = gzopen(); ... gzread(buffer); ... gzwrite(pipe(Continue reading)
RSS Feed