Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] call to strtod() in Csound engine

Date2007-10-06 13:36
FromVictor Lazzarini
SubjectRe: [Cs-dev] call to strtod() in Csound engine
I think we can borrow a code snippet from there
without any problems. If that was a problem then
Csound might have bits of code that look like
other code licensed under other licenses etc..

Victor

>
> There shouldn't be any thread issues at the moment for
> those functions.  There will be issues if we go with that
> fix though whenever we go multicore with csound. Hmm... We
> can't set it globally as that's a bad assumption if csound
> gets used in the same process as another library that
> maybe should have it's locale not set to C.
>
> Taking a look dietlibc is GPL so I don't think we can take
> code from there.
>
> Not sure what is the best solution now.  The thread issue
> could affect other code say if strtod or sprintf is used
> in GTK app and is called there while Csound is doing that
> temporary locale change. We could perhaps take the source
> to the standard strtod (which is LGPL) and just modify
> that and use that as our csound_strtod.
>
> steven
>
> On 10/5/07, Mike Coleman  wrote:
> > Are there any issues with thread safety?  (I can't
> > recall if csound uses threads.)
> >
> > Mike
> >
> >
> >
> > On 10/5/07, Victor Lazzarini 
> > > wrote: That is more or less how I thought this should
> > > be handled. We can test it after the release and
> > > if it works, add it to 5.08.
> > >
> > > Victor
> > >
> > > >
> > > > I googled around and found this code:
> > > >
> > > >
> > >
>
https://lists.linux-foundation.org/pipermail/printing-driver/2005/000997.html
> > > >
> > > > in that file it forces locale but restores after
> > > > needing it in the locale required, wrapping with:
> > > >
> > > > setlocale(LC_ALL, "C");
> > > > [... some code that requires locale C...]
> > > > setlocale(LC_ALL, "");
> > > >
> > > > Maybe we can just do that?  Could even make a
> > > > wrapper function for strod, something like:
> > > >
> > > > double csound_strtod(const char *nptr, char
> > > >   **endptr) { double returnValue;
> > > >
> > > >   setlocale(LC_ALL, "C");
> > > >   returnValue = strtod(nptr, endptr);
> > > >   setlocale(LC_ALL, "");
> > > >
> > > >   return returnValue;
> > > > }
> > > >
> > > > and use that.
> > > >
> > > > Thoughts?
> > > >
> > > > steven
> > > >
> > > >
> > > > On 10/5/07, Victor Lazzarini
> > > > >  wrote: it looks like
> > > > > the way otran.c calls strtod() to check numeric
> > > > > values is buggy, because it assumes a certain
> > > > > locale and if the default encoding is changed from
> > > > ascii, say to UTF-8, then the parsing fails, >
> > > > > Some solutions were offered, one is to reimplement
> > > > > it using the dietlibc code. What do you think?
> > > > >
> > > > > Victor
> > > > > Victor Lazzarini
> > > > > Music Technology Laboratory
> > > > > Music Department
> > > > > National University of Ireland, Maynooth
> > > > >
> > > > >
> > > > >
> > > >
> > > > >
> ----------------------------------------------------------
> > > > > --------------- This SF.net email is sponsored by:
> > > > > Splunk Inc. Still grepping through log files to
> find problems?  Stop. Now Search log events and
> > > > > configuration files using AJAX and a browser.
> > > > > Download your FREE copy of Splunk now >>
> > > > > http://get.splunk.com/
> > > > > _______________________________________________
> > > > > Csound-devel mailing list
> > > > Csound-devel@lists.sourceforge.net
> > > >
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> > > > >
> > > >
> > > >
> ----------------------------------------------------------
> > > > --------------- This SF.net email is sponsored by:
> Splunk Inc. Still grepping through log files to find
> > > > problems? Stop. Now Search log events and
> > > > configuration files using AJAX and a browser.
> > > > Download your FREE copy of Splunk now >>
> > > > http://get.splunk.com/
> > > > _______________________________________________
> > > > Csound-devel mailing list
> > > > Csound-devel@lists.sourceforge.net
> >
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> > > >
> ----------------------------------------------------------
> > > --------------- This SF.net email is sponsored by:
> > > Splunk Inc. Still grepping through log files to find
> > > problems?  Stop. Now Search log events and
> > > configuration files using AJAX and a browser. Download
> > > your FREE copy of Splunk now >> http://get.splunk.com/
> > > _______________________________________________
> > > Csound-devel mailing list
> > > Csound-devel@lists.sourceforge.net
> >
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> > >
> >
> ----------------------------------------------------------
> > --------------- This SF.net email is sponsored by:
> > Splunk Inc. Still grepping through log files to find
> > problems?  Stop. Now Search log events and configuration
> > files using AJAX and a browser. Download your FREE copy
> > of Splunk now >> http://get.splunk.com/
> > _______________________________________________
> > Csound-devel mailing list
> > Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> >
>
> ----------------------------------------------------------
> --------------- This SF.net email is sponsored by: Splunk
> Inc. Still grepping through log files to find problems?
> Stop. Now Search log events and configuration files using
> AJAX and a browser. Download your FREE copy of Splunk now
> >> http://get.splunk.com/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net