Re: Add support for hex floats to *scanf

2021-05-13 Thread Michael Forney
On 2021-04-03, Michael Forney  wrote:
> On 2020-01-28, Michael Forney  wrote:
>> On 2019-05-28, Michael Forney  wrote:
>>> I noticed that OpenBSD's fscanf doesn't yet support hex float strings,
>>> which are standardized in C99. I am using them in my application (which
>>> I would like to support OpenBSD), since the "%a" format specifier is a
>>> convenient way to preserve the exact floating point value.
>>>
>>> strtod already supports parsing hex floats, so it is just the scanner
>>> in __svfscanf that needed changes.
>>>
>>> The implementation reuses the PFXOK and NZDIGITS flags from CT_INT
>>> scanning and follows similar logic to CT_INT. This required allocating
>>> new flag values for DPTOK and EXPOK.
>>>
>>> I did my best to follow style(9), but since the indentation level of
>>> this
>>> switch is so high, I found it difficult wrap lines nicely. I noticed
>>> that
>>> several existing lines broke the "space around binary operators" rule if
>>> the added space would require unnatural wrapping, so I did the same
>>> here.
>>>
>>> I wasn't sure which comments I should carry over from the CT_INT case
>>> (for example, above `case 'x':`), or if any of the other changes require
>>> additional comments. Please let me know if they do.
>>
>> Just bumping this so it doesn't get forgotten. I'd be happy to address
>> any feedback anyone might have.
>
> Ping.

Ping again.



Re: Add support for hex floats to *scanf

2021-04-03 Thread Michael Forney
On 2020-01-28, Michael Forney  wrote:
> On 2019-05-28, Michael Forney  wrote:
>> I noticed that OpenBSD's fscanf doesn't yet support hex float strings,
>> which are standardized in C99. I am using them in my application (which
>> I would like to support OpenBSD), since the "%a" format specifier is a
>> convenient way to preserve the exact floating point value.
>>
>> strtod already supports parsing hex floats, so it is just the scanner
>> in __svfscanf that needed changes.
>>
>> The implementation reuses the PFXOK and NZDIGITS flags from CT_INT
>> scanning and follows similar logic to CT_INT. This required allocating
>> new flag values for DPTOK and EXPOK.
>>
>> I did my best to follow style(9), but since the indentation level of this
>> switch is so high, I found it difficult wrap lines nicely. I noticed that
>> several existing lines broke the "space around binary operators" rule if
>> the added space would require unnatural wrapping, so I did the same here.
>>
>> I wasn't sure which comments I should carry over from the CT_INT case
>> (for example, above `case 'x':`), or if any of the other changes require
>> additional comments. Please let me know if they do.
>
> Just bumping this so it doesn't get forgotten. I'd be happy to address
> any feedback anyone might have.

Ping.



Re: Add support for hex floats to *scanf

2020-02-02 Thread ori
>> I wasn't sure which comments I should carry over from the CT_INT case
>> (for example, above `case 'x':`), or if any of the other changes require
>> additional comments. Please let me know if they do.
> 
> Just bumping this so it doesn't get forgotten. I'd be happy to address
> any feedback anyone might have.

The looks good to me.  I've managed to destroy my main computer, and
am waiting for replacement hardware to ship -- but if nobody has
objections, I'll commit as soon as I get things back up.

ok orib@



Re: Add support for hex floats to *scanf

2020-01-28 Thread Michael Forney
On 2019-05-28, Michael Forney  wrote:
> I noticed that OpenBSD's fscanf doesn't yet support hex float strings,
> which are standardized in C99. I am using them in my application (which
> I would like to support OpenBSD), since the "%a" format specifier is a
> convenient way to preserve the exact floating point value.
>
> strtod already supports parsing hex floats, so it is just the scanner
> in __svfscanf that needed changes.
>
> The implementation reuses the PFXOK and NZDIGITS flags from CT_INT
> scanning and follows similar logic to CT_INT. This required allocating
> new flag values for DPTOK and EXPOK.
>
> I did my best to follow style(9), but since the indentation level of this
> switch is so high, I found it difficult wrap lines nicely. I noticed that
> several existing lines broke the "space around binary operators" rule if
> the added space would require unnatural wrapping, so I did the same here.
>
> I wasn't sure which comments I should carry over from the CT_INT case
> (for example, above `case 'x':`), or if any of the other changes require
> additional comments. Please let me know if they do.

Just bumping this so it doesn't get forgotten. I'd be happy to address
any feedback anyone might have.