[PATCH]: Implement fwide (was Re: swprintf() and friends?)

Jeff Johnston jjohnstn@redhat.com
Tue Nov 18 21:59:00 GMT 2008


Corinna Vinschen wrote:
> On Nov  7 15:11, Corinna Vinschen wrote:
>   
>> As a starting point I removed the __SMOD flag and created two new flags
>> __SORD and __SWID, the latter for _flags2 and using the same bit mask
>> as __SORD.  I also created two functions fwide and _fwide_r.  Other than
>> that the new orientation bits are not used so far.  We can build the other
>> missing functionality slowly around this.
>>     
>
> Scratch that patch.  I guess it's better to restart and use the 
> OpenBSD implementation as basis for this.  The _flags2 would be
> replaced by a pointer _wcio to a structure wchar_io_data
>
>   struct wchar_io_data {
>     mbstate_t wcio_mbstate_in;
>     mbstate_t wcio_mbstate_out;
>
>     wchar_t wcio_ungetwc_buf[WCIO_UNGETWC_BUFSIZE];
>     size_t wcio_ungetwc_inbuf;
>
>     int wcio_mode; /* orientation */
>   };
>
> Would that be ok for newlib, Jeff?
>
>
> Corinna
>
>   
It is fine except that all field and type names need to be 
underscored.   Obviously some checks have to be put in place to ensure 
that the allocated structure gets freed as needed.

The old unused flag in _flags should still be removed and the field 
_flags2 itself should be added to the regular file structure, but it is 
not officially part of this effort.

Obviously some checking has to be added for allocating/freeing this 
structure properly.  I'm sure there is stuff in the _REENT_SMALL that 
you could use as a basis.

-- Jeff J.



More information about the Newlib mailing list