Hello
As many of you know I'm porting libusb to os4.
The source code uses serverl functions like snprintf() and strerror(). I wantede to use clib2 but thats ad no-no from library code, then I turn to newlib but dident have the inclide files :(
So here I'm what to do ? The only thing I can think of is to rip the source code from clib2 an include it in my lib but that not the best sulution IMHO.
Any ideas?
Kind regards Rene W. Olsen
----- Original Message ----- From: "Rene W. Olsen" ac@rebels.com To: openoffice-os4@samfundet.no Sent: Friday, January 28, 2005 6:04 AM Subject: [OO.org-OS4] Porting Question
Hello
As many of you know I'm porting libusb to os4.
The source code uses serverl functions like snprintf() and strerror(). I wantede to use clib2 but thats ad no-no from library code, then I turn to newlib but dident have the inclide files :(
So here I'm what to do ? The only thing I can think of is to rip the source code from clib2 an include it in my lib but that not the best sulution IMHO.
Well I'm not sure why it's no no...but I would assume that if you can extract the functionality you need from clib2 without trailing any clib2 dependant code (hence if the functionality you need happens to be isolated and non dependant on the rest of the library) then it could be worth it :-).
On 2005/01/28, stephane richard wrote:
Well I'm not sure why it's no no...but I would assume that if you can extract the functionality you need from clib2 without trailing any clib2 dependant code (hence if the functionality you need happens to be isolated and non dependant on the rest of the library) then it could be worth it :-).
clib2 need to be initalized before use, some function migth work but there is no garenti :-/
anyway if no one has a smart trick I have to rip the source code from clib2.
Regards Rene W. Olsen
On 2005-01-28, Rene W. Olsen wrote:
On 2005/01/28, stephane richard wrote:
<SNIP>
anyway if no one has a smart trick I have to rip the source code from clib2.
Check RawDoFmt() in exec.library as I wrote. Just wrap it a bit and you have can have a snprintf-like function all of your own. :-)
-Peter aka. Archprogrammer
Reality is for people who cannot face ScienceFiction. Only lefthanded people are in their right minds.
Hi,
Peter Bengtsson wrote:
Check RawDoFmt() in exec.library as I wrote. Just wrap it a bit and you have can have a snprintf-like function all of your own. :-)
I would rather use utiltiy.library/ASPrintf or utility.library/SNPrintf for this :)
Regards,
On 2005-01-28, Thomas Frieden wrote:
Hi,
Peter Bengtsson wrote:
Check RawDoFmt() in exec.library as I wrote. Just wrap it a bit and you have can have a snprintf-like function all of your own. :-)
I would rather use utiltiy.library/ASPrintf or utility.library/SNPrintf for this :)
These must be new for 4.0, but they certainly sound like a good idea. :-)
I should probably take the time to read the new autodocs, but I have barely had time to set up the A1 yet. (Works great by the way!)
-Peter aka. Archprogrammer
Reality is for people who cannot face ScienceFiction. Only lefthanded people are in their right minds.
On 2005-01-28, Rene W. Olsen wrote:
Hello
As many of you know I'm porting libusb to os4.
The source code uses serverl functions like snprintf() and strerror(). I wantede to use clib2 but thats ad no-no from library code, then I turn to newlib but dident have the inclide files :(
Neither snprintf() nor strerror() should be problematic to call from library code I think. (?)
So here I'm what to do ? The only thing I can think of is to rip the source code from clib2 an include it in my lib but that not the best sulution IMHO.
Unless you need the full printf-style formatting with all bells and whistles, it should be relatively easy to reimplement snprintf but there is also the possibility of using exec.library/RawDoFmt() to do printf style formatting.
As for strerror(), you can always use a static array of char * for an initial non-localised version until a better alternative comes up if this is what is bugging you. It might well be that this is how clib2 implements strerror (I have not checked). Otherwise I don't think I can add very much on the localisation issuse since I have not examined the locale API to speak of.
-Peter aka. Archprogrammer
Reality is for people who cannot face ScienceFiction. Only lefthanded people are in their right minds.
On 2005/01/28, Peter Bengtsson wrote:
Unless you need the full printf-style formatting with all bells and whistles, it should be relatively easy to reimplement snprintf but there is also the possibility of using exec.library/RawDoFmt() to do printf style formatting.
I dident se any printf() but I did find sprintf()
As for strerror(), you can always use a static array of char * for an initial non-localised version until a better alternative comes up if this is what is bugging you. It might well be that this is how clib2 implements strerror (I have not checked). Otherwise I don't think I can add very much on the localisation issuse since I have not examined the locale API to speak of.
strerror() is not that big of a problem (easy to rip) it was only used an example
Regards Rene W. Olsen
Hi,
Peter Bengtsson wrote:
Neither snprintf() nor strerror() should be problematic to call from library code I think. (?)
snprintf can't be called without the startup code.
Regards,
Hi,
Rene W. Olsen wrote:
The source code uses serverl functions like snprintf() and strerror(). I wantede to use clib2 but thats ad no-no from library code, then I turn to newlib but dident have the inclide files :(
These are in the sdk...
Regards,