Re: [PHP-DEV] Bug #20460 (Feature Request)

2002-11-30 Thread Derick Rethans
On Sat, 30 Nov 2002, Stig S. Bakken wrote:

> > 4) Make sure we can use fscanf on a dynamically sized buffer. This will 
> > definitely the hardest solution, but also the most beautiful one.
> 
> [4] is definitely the best option.  formatted_print.c already does 
> something similar.

Stig, it's already fixed :)

Derick

-- 

-
 Derick Rethans http://derickrethans.nl/ 
 PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/
-


-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Bug #20460 (Feature Request)

2002-11-30 Thread Stig S. Bakken
On Wed, 27 Nov 2002, Derick Rethans wrote:

> On Wed, 27 Nov 2002, Sara Pollita Golemon wrote:
> 
> > User complains that maximum length of a line used by fscanf is too short
> > (he has lines > 1600 chars).  Looking at file.h I agree (it's only 512).
> > 
> > The user requested two options:
> > 
> > 1) Add an optional length field.
> >   No way to do that without breaking parameter list. :(
> 
> We can't really do that, users will get pissed :)
> 
> > 
> > 2) Increase to a larger arbitrary number.
> >   This simply has the problem that it may prove too short eventually as well.
> 
> Yeah, IMO it doesn't solve anything.
> 
> > 
> > Plus I came up with a third option:
> > 
> > 3) Create an .ini entry to specify the maximum length used.
> >   I think this has the best overall return on it.
> 
> I don't like us adding a new ini entry for this, I think we should try 
> another option:
> 
> 4) Make sure we can use fscanf on a dynamically sized buffer. This will 
> definitely the hardest solution, but also the most beautiful one.

[4] is definitely the best option.  formatted_print.c already does 
something similar.

 - Stig


-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Bug #20460 (Feature Request)

2002-11-27 Thread Derick Rethans
On Wed, 27 Nov 2002, Sara Pollita Golemon wrote:

> >> Derick Rethans <[EMAIL PROTECTED]> wrote:
> >>
> >> > I don't like us adding a new ini entry for this, I think we should
> >> try  another option:
> >> >
> >> > 4) Make sure we can use fscanf on a dynamically sized buffer. This
> >> will  definitely the hardest solution, but also the most beautiful
> >> one.
> >>
> >
> I'll admit to not knowing what you mean by 'dynamically sized buffer's. 
> Is there an example of another function which works with such?

char *buf; buf = malloc(length of line);

vs.

char buf[MAX_BUF_SIZE];

and example of such a function is AFAIK not really available for a PHP 
function, but api wise there is php_stream_get_line which uses it. As 
you can see sterling just put that in to 'fix' this feature report (his 
commit to file.c).

regards,
Derick

-- 

-
 Derick Rethans http://derickrethans.nl/ 
 PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/
-


-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Bug #20460 (Feature Request)

2002-11-27 Thread Sterling Hughes
> >> Derick Rethans <[EMAIL PROTECTED]> wrote:
> >>
> >> > I don't like us adding a new ini entry for this, I think we should
> >> try  another option:
> >> >
> >> > 4) Make sure we can use fscanf on a dynamically sized buffer. This
> >> will  definitely the hardest solution, but also the most beautiful
> >> one.
> >>
> >
> I'll admit to not knowing what you mean by 'dynamically sized buffer's. 
> Is there an example of another function which works with such?
>

a php function, not sure, spprintf() is a perfect example though (in C).

Basically, a dynamically sized buffer is a buffer that grows or shrinks
when necessary (dynamically :)

Anyhow, I've got fscanf() doing what you wanted in CVS (as well as the 
release branch), give it a try, and see if it meets your needs.

-Sterling

-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Bug #20460 (Feature Request)

2002-11-27 Thread Sara
>> Derick Rethans <[EMAIL PROTECTED]> wrote:
>>
>> > I don't like us adding a new ini entry for this, I think we should
>> try  another option:
>> >
>> > 4) Make sure we can use fscanf on a dynamically sized buffer. This
>> will  definitely the hardest solution, but also the most beautiful
>> one.
>>
>
I'll admit to not knowing what you mean by 'dynamically sized buffer's. 
Is there an example of another function which works with such?

-Pollita



-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Bug #20460 (Feature Request)

2002-11-27 Thread Moriyoshi Koizumi
Sterling Hughes <[EMAIL PROTECTED]> wrote:

> > > err. it didn't need a reimplementation, i fixed it, it works fine in cvs.
> > 
> > Then,
> > 
> >  >   $buf = "123 456 \0 567"
> >   sscanf($buf, "%d%d%s%d", $a, $b, $c, $d);
> >   var_dump($a, $b, $c, $d);
> > ?>
> > 
> > How about this?
> > 
> > The result was the same as for fscanf.
> >
> 
> Yes, but it didn't need a reimplementation as far as using arbitrary buffer 
> sizes.

Right, I just missed a big point about the scanf behaviour :)

Moriyoshi

> -Sterling


-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Bug #20460 (Feature Request)

2002-11-27 Thread Sterling Hughes
> > err. it didn't need a reimplementation, i fixed it, it works fine in cvs.
> 
> Then,
> 
>$buf = "123 456 \0 567"
>   sscanf($buf, "%d%d%s%d", $a, $b, $c, $d);
>   var_dump($a, $b, $c, $d);
> ?>
> 
> How about this?
> 
> The result was the same as for fscanf.
>

Yes, but it didn't need a reimplementation as far as using arbitrary buffer 
sizes.

-Sterling

-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Bug #20460 (Feature Request)

2002-11-27 Thread Moriyoshi Koizumi
> err. it didn't need a reimplementation, i fixed it, it works fine in cvs.

Then,



How about this?

The result was the same as for fscanf.

Moriyoshi

> 
> -Sterling
> 
> 
> > Moriyoshi
> > 
> > > Derick
> > > 
> > > -- 
> > > 
> > > -
> > >  Derick Rethans http://derickrethans.nl/ 
> > >  PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/
> > > -
> > > 
> > > 
> > > -- 
> > > PHP Development Mailing List 
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > 
> > 
> > 
> > -- 
> > PHP Development Mailing List 
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 


-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Bug #20460 (Feature Request)

2002-11-27 Thread Derick Rethans
On Thu, 28 Nov 2002, Moriyoshi Koizumi wrote:

> Derick Rethans <[EMAIL PROTECTED]> wrote:
> 
> > I don't like us adding a new ini entry for this, I think we should try 
> > another option:
> > 
> > 4) Make sure we can use fscanf on a dynamically sized buffer. This will 
> > definitely the hardest solution, but also the most beautiful one.
> 
> I like this fourth option, because the internal scanf function will anyway 
> need reimplementation since it's not binary safe.

Sterling just implemented that.

Derick

-- 

-
 Derick Rethans http://derickrethans.nl/ 
 PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/
-


-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Bug #20460 (Feature Request)

2002-11-27 Thread Sterling Hughes
> > 
> > I don't like us adding a new ini entry for this, I think we should try 
> > another option:
> > 
> > 4) Make sure we can use fscanf on a dynamically sized buffer. This will 
> > definitely the hardest solution, but also the most beautiful one.
> 
> I like this fourth option, because the internal scanf function will anyway 
> need reimplementation since it's not binary safe.
>
err. it didn't need a reimplementation, i fixed it, it works fine in cvs.

-Sterling


> Moriyoshi
> 
> > Derick
> > 
> > -- 
> > 
> > -
> >  Derick Rethans http://derickrethans.nl/ 
> >  PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/
> > -
> > 
> > 
> > -- 
> > PHP Development Mailing List 
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> 
> 
> -- 
> PHP Development Mailing List 
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Bug #20460 (Feature Request)

2002-11-27 Thread Moriyoshi Koizumi
Derick Rethans <[EMAIL PROTECTED]> wrote:

> On Wed, 27 Nov 2002, Sara Pollita Golemon wrote:
> 
> > User complains that maximum length of a line used by fscanf is too short
> > (he has lines > 1600 chars).  Looking at file.h I agree (it's only 512).
> > 
> > The user requested two options:
> > 
> > 1) Add an optional length field.
> >   No way to do that without breaking parameter list. :(
> 
> We can't really do that, users will get pissed :)
> 
> > 
> > 2) Increase to a larger arbitrary number.
> >   This simply has the problem that it may prove too short eventually as well.
> 
> Yeah, IMO it doesn't solve anything.
> 
> > 
> > Plus I came up with a third option:
> > 
> > 3) Create an .ini entry to specify the maximum length used.
> >   I think this has the best overall return on it.
> 
> I don't like us adding a new ini entry for this, I think we should try 
> another option:
> 
> 4) Make sure we can use fscanf on a dynamically sized buffer. This will 
> definitely the hardest solution, but also the most beautiful one.

I like this fourth option, because the internal scanf function will anyway 
need reimplementation since it's not binary safe.

Moriyoshi

> Derick
> 
> -- 
> 
> -
>  Derick Rethans http://derickrethans.nl/ 
>  PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/
> -
> 
> 
> -- 
> PHP Development Mailing List 
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Bug #20460 (Feature Request)

2002-11-27 Thread Sterling Hughes
> User complains that maximum length of a line used by fscanf is too short
> (he has lines > 1600 chars).  Looking at file.h I agree (it's only 512).
> 
> The user requested two options:
> 
> 1) Add an optional length field.
>   No way to do that without breaking parameter list. :(
> 
> 2) Increase to a larger arbitrary number.
>   This simply has the problem that it may prove too short eventually as well.
> 
> Plus I came up with a third option:
> 
> 3) Create an .ini entry to specify the maximum length used.
>   I think this has the best overall return on it.
> 

The thing is that just feels kinda dirty (an ini option controlling how long a
line should be assumed for fscanf, but I agree there is no really good solution), 
unless of course it means changing the parameter order to fscanf().

-Sterling

-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Bug #20460 (Feature Request)

2002-11-27 Thread Derick Rethans
On Wed, 27 Nov 2002, Sara Pollita Golemon wrote:

> User complains that maximum length of a line used by fscanf is too short
> (he has lines > 1600 chars).  Looking at file.h I agree (it's only 512).
> 
> The user requested two options:
> 
> 1) Add an optional length field.
>   No way to do that without breaking parameter list. :(

We can't really do that, users will get pissed :)

> 
> 2) Increase to a larger arbitrary number.
>   This simply has the problem that it may prove too short eventually as well.

Yeah, IMO it doesn't solve anything.

> 
> Plus I came up with a third option:
> 
> 3) Create an .ini entry to specify the maximum length used.
>   I think this has the best overall return on it.

I don't like us adding a new ini entry for this, I think we should try 
another option:

4) Make sure we can use fscanf on a dynamically sized buffer. This will 
definitely the hardest solution, but also the most beautiful one.

Derick

-- 

-
 Derick Rethans http://derickrethans.nl/ 
 PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/
-


-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Bug #20460 (Feature Request)

2002-11-27 Thread Sara
User complains that maximum length of a line used by fscanf is too short
(he has lines > 1600 chars).  Looking at file.h I agree (it's only 512).

The user requested two options:

1) Add an optional length field.
  No way to do that without breaking parameter list. :(

2) Increase to a larger arbitrary number.
  This simply has the problem that it may prove too short eventually as well.

Plus I came up with a third option:

3) Create an .ini entry to specify the maximum length used.
  I think this has the best overall return on it.


If #3 sounds okay I'll get to work on it.  I await your comments.

-Pollita



-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php