RE: [HACKERS] [OT] flex, yacc, and bison

Поиск
Список
Период
Сортировка
От Jackson, DeJuan
Тема RE: [HACKERS] [OT] flex, yacc, and bison
Дата
Msg-id D05EF808F2DFD211AE4A00105AA1B5D248565A@cpsmail
обсуждение исходный текст
Список pgsql-hackers
Thanks guys, for all the help.  
The reason that I was thinking 'grammar parser'  was that the spec of this
format may change.  I was looking for something that would be quick, but
easily extended as the grammar changed/evolved.  Also my next project will
need the same functionality if not an extension of the same grammar.Again thanks,    -DEJ

> -----Original Message-----
> 
> On 18-Aug-99 Vince Vielhaber wrote:
> > 
> > On 18-Aug-99 Jackson, DeJuan wrote:
> >> I'm trying to write a ncftp_auth deamon that will utilize PostgreSQL.
> The
> >> base SDK is in C.  I'm adapting it to C++ because I feel like it, but
> Perl
> >> would be a slightly steeper learning curve (sockets and all that).  I'm
> >> trying to get a conf file parser such that the login's can be in
> multiple
> >> database and/or on different machines.
> > 
> > If you're into C/C++ (like I am), it's almost trivial to parse that into
> > individual strings.  I was under the impression from your first note
> that
> > C/C++ wasn't an option.   At the minimum, think strtok().   There's also
> > strsep() but it's not been one of my favorites.  If you still need
> actual
> > code let me know and I can send you something.
> 
> It's my bestst:
> 
> int split(char delem, char *str, ... )
> {
>   char *tmp, *_src, *t, **s;
>   int fields = 0;
> 
>  _src = str;
> 
>  va_list ap;
>  va_start(ap, str);
> 
>  if (! (tmp=new char[2048]) )
>                          return -1;
> 
>  while(_src)
>   { t = _src;
>     while (*t && ((*t) != delem) ) ++t;
>     s = va_arg(ap, char **);
>     if (!s || !*t)
>                 break;
>      *s = ( t-_src-1 > 0) ? strndup(_src,t-_src-1) : 0 ;
>     _src = t+1;
>    ++ fields;
>   }
> 
>   return fields;
> }
> 
> 
> ---
> Dmitry Samersoff, dms@wplus.net, ICQ:3161705
> http://devnull.wplus.net
> * There will come soft rains ...


В списке pgsql-hackers по дате отправления:

Предыдущее
От: The Hermit Hacker
Дата:
Сообщение: Re: [HACKERS] Tangent ... you know what's scary?
Следующее
От: The Hermit Hacker
Дата:
Сообщение: RE: [HACKERS] Tangent ... you know what's scary?