[FFmpeg-cvslog] r15366 - trunk/ffmpeg.c
Michael Niedermayer
michaelni
Sat Sep 20 15:43:14 CEST 2008
On Sat, Sep 20, 2008 at 12:07:38PM +0200, Stefano Sabatini wrote:
> On date Friday 2008-09-19 01:30:38 +0200, Michael Niedermayer wrote:
> > On Thu, Sep 18, 2008 at 03:00:37PM -0700, Mike Melanson wrote:
> > > michael wrote:
> > > > + if(line[0] == '#' && !e)
> > > > + continue;
> > >
> > > So the comment marker can only occur at the start of a line? Still not
> > > very good behavior. Expected behavior would be for everything between
> > > '#' and the next newline to be disregarded.
> >
> > - e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2;
> > + e|= sscanf(line, "%999[^=]=%999[^#\n]", tmp, tmp2) - 2;
>
> Please can you apply it?
It would make it impossible to have # as part of a value. Maybe this does
not matter but iam not really happy with it.
Iam thinking of values for title/comment or such ...
>
> > > Face it-- text parsers in C are ugly. Good luck trying to make this
> > > user-friendly feature pretty enough for the FFmpeg codebase.
> >
> > Text parsers in C are only ugly when they are written by an idiot.
> > One can always write whatever primitive building blocks are needed
> > for a clean parser.
>
> Nonetheless parsers written using some higher-level generator (bison,
> or possibly another one which generates reentrant code) are easier to
> write, read and debug, so they tend to be more robust. Not that I'm
> saying that it would be needed for the preset file, but there are
> other parts in ffmpeg where it could be useful (ffserver.conf parser
> and the graphparser of libavfilter).
If you want clean parsers, first write functions to
search, replace and split based on some kind of regular expressions,
then use these functions and your parsers in C will be cleaner.
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/attachments/20080920/331a4af4/attachment.pgp>
More information about the ffmpeg-cvslog
mailing list