Csound Csound-dev Csound-tekno Search About

[Cs-dev] strsubk ignoring k-rate arguments?

Date2013-07-16 23:42
Fromjoachim heintz
Subject[Cs-dev] strsubk ignoring k-rate arguments?
i think something is wrong with strsubk. this is working:

instr 1
Sbla strcpyk "abc"
Spart strsubk Sbla, 0, 2
puts Spart, 1 ;returns "ab"
endin

but this returns an empty string:
instr 2
Sbla strcpyk "abc"
klen strlenk Sbla
Spart strsubk Sbla, 0, klen-1
puts Spart, klen
endin

i think this must be related to the k-argument, which seems to be set to 
zero.

	joachim





-n



instr 1 ;works
Sbla strcpyk "abc"
Spart strsubk Sbla, 0, 2
puts Spart, 1
endin

instr 2 ;does not work (returns an empty string)
Sbla strcpyk "abc"
klen strlenk Sbla
Spart strsubk Sbla, 0, klen-1
puts Spart, klen
endin



i 1 0 1
i 2 0 1



------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-07-17 00:29
FromVictor Lazzarini
SubjectRe: [Cs-dev] strsubk ignoring k-rate arguments?
I think what is happening here is this: klen - 1 is evaluated at i-time and then
because klen - 1 does not get computed at i-time (it's a k-rate expression),
the result is 0 at i-time. So there is no output at i-time, and puts prints the empty string.
Because klen does not change anymore, puts does not print anything else.

However, if we use klen - 1 trigger, we get a printout. Now, for the same reasons
at i-pass, klen - 1 is zero, then in the first kcycle it gets evaluated and then
puts prints, only once, because of course klen - 1 does not change anymore.

instr 2 
Sbla strcpyk "abc"
klen strlenk Sbla
Spart strsubk Sbla, 0, klen-1
puts Spart, klen-1
endin



On 16 Jul 2013, at 23:42, joachim heintz wrote:

> i think something is wrong with strsubk. this is working:
> 
> instr 1
> Sbla strcpyk "abc"
> Spart strsubk Sbla, 0, 2
> puts Spart, 1 ;returns "ab"
> endin
> 
> but this returns an empty string:
> instr 2
> Sbla strcpyk "abc"
> klen strlenk Sbla
> Spart strsubk Sbla, 0, klen-1
> puts Spart, klen
> endin
> 
> i think this must be related to the k-argument, which seems to be set to 
> zero.
> 
> 	joachim
> 
> 
> 
> 
> 
> -n
> 
> 
> 
> instr 1 ;works
> Sbla strcpyk "abc"
> Spart strsubk Sbla, 0, 2
> puts Spart, 1
> endin
> 
> instr 2 ;does not work (returns an empty string)
> Sbla strcpyk "abc"
> klen strlenk Sbla
> Spart strsubk Sbla, 0, klen-1
> puts Spart, klen
> endin
> 
> 
> 
> i 1 0 1
> i 2 0 1
> 
> 
> 
> ------------------------------------------------------------------------------
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-07-17 07:45
Fromjoachim heintz
SubjectRe: [Cs-dev] strsubk ignoring k-rate arguments?
i got it now -- the bug is in strlenk, not in strsubk.
strlenk simply returns 5 for the string "abc"; this for the reason for 
the error i got while transforming csound5 code.
the same is happening for strlen.
best -
	joachim





-n



instr 5
Sbla strcpyk "abc"
klen strlenk Sbla
printf "klen = %d\n", 1, klen
turnoff
endin



i 5 0 1





Am 17.07.2013 01:29, schrieb Victor Lazzarini:
> I think what is happening here is this: klen - 1 is evaluated at i-time and then
> because klen - 1 does not get computed at i-time (it's a k-rate expression),
> the result is 0 at i-time. So there is no output at i-time, and puts prints the empty string.
> Because klen does not change anymore, puts does not print anything else.
>
> However, if we use klen - 1 trigger, we get a printout. Now, for the same reasons
> at i-pass, klen - 1 is zero, then in the first kcycle it gets evaluated and then
> puts prints, only once, because of course klen - 1 does not change anymore.
>
> instr 2
> Sbla strcpyk "abc"
> klen strlenk Sbla
> Spart strsubk Sbla, 0, klen-1
> puts Spart, klen-1
> endin
>
>
>
> On 16 Jul 2013, at 23:42, joachim heintz wrote:
>
>> i think something is wrong with strsubk. this is working:
>>
>> instr 1
>> Sbla strcpyk "abc"
>> Spart strsubk Sbla, 0, 2
>> puts Spart, 1 ;returns "ab"
>> endin
>>
>> but this returns an empty string:
>> instr 2
>> Sbla strcpyk "abc"
>> klen strlenk Sbla
>> Spart strsubk Sbla, 0, klen-1
>> puts Spart, klen
>> endin
>>
>> i think this must be related to the k-argument, which seems to be set to
>> zero.
>>
>> 	joachim
>>
>>
>>
>> 
>> 
>> -n
>> 
>> 
>>
>> instr 1 ;works
>> Sbla strcpyk "abc"
>> Spart strsubk Sbla, 0, 2
>> puts Spart, 1
>> endin
>>
>> instr 2 ;does not work (returns an empty string)
>> Sbla strcpyk "abc"
>> klen strlenk Sbla
>> Spart strsubk Sbla, 0, klen-1
>> puts Spart, klen
>> endin
>>
>> 
>> 
>> i 1 0 1
>> i 2 0 1
>> 
>> 
>>
>> ------------------------------------------------------------------------------
>> See everything from the browser to the database with AppDynamics
>> Get end-to-end visibility with application monitoring from AppDynamics
>> Isolate bottlenecks and diagnose root cause in seconds.
>> Start your free trial of AppDynamics Pro today!
>> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
> Dr Victor Lazzarini
> Senior Lecturer
> Dept. of Music
> NUI Maynooth Ireland
> tel.: +353 1 708 3545
> Victor dot Lazzarini AT nuim dot ie
>
>
>
>
> ------------------------------------------------------------------------------
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-07-17 08:13
FromVictor Lazzarini
SubjectRe: [Cs-dev] strsubk ignoring k-rate arguments?
that is fixed.
On 17 Jul 2013, at 07:45, joachim heintz wrote:

> i got it now -- the bug is in strlenk, not in strsubk.
> strlenk simply returns 5 for the string "abc"; this for the reason for 
> the error i got while transforming csound5 code.
> the same is happening for strlen.
> best -
> 	joachim
> 
> 
> 
> 
> 
> -n
> 
> 
> 
> instr 5
> Sbla strcpyk "abc"
> klen strlenk Sbla
> printf "klen = %d\n", 1, klen
> turnoff
> endin
> 
> 
> 
> i 5 0 1
> 
> 
> 
> 
> 
> Am 17.07.2013 01:29, schrieb Victor Lazzarini:
>> I think what is happening here is this: klen - 1 is evaluated at i-time and then
>> because klen - 1 does not get computed at i-time (it's a k-rate expression),
>> the result is 0 at i-time. So there is no output at i-time, and puts prints the empty string.
>> Because klen does not change anymore, puts does not print anything else.
>> 
>> However, if we use klen - 1 trigger, we get a printout. Now, for the same reasons
>> at i-pass, klen - 1 is zero, then in the first kcycle it gets evaluated and then
>> puts prints, only once, because of course klen - 1 does not change anymore.
>> 
>> instr 2
>> Sbla strcpyk "abc"
>> klen strlenk Sbla
>> Spart strsubk Sbla, 0, klen-1
>> puts Spart, klen-1
>> endin
>> 
>> 
>> 
>> On 16 Jul 2013, at 23:42, joachim heintz wrote:
>> 
>>> i think something is wrong with strsubk. this is working:
>>> 
>>> instr 1
>>> Sbla strcpyk "abc"
>>> Spart strsubk Sbla, 0, 2
>>> puts Spart, 1 ;returns "ab"
>>> endin
>>> 
>>> but this returns an empty string:
>>> instr 2
>>> Sbla strcpyk "abc"
>>> klen strlenk Sbla
>>> Spart strsubk Sbla, 0, klen-1
>>> puts Spart, klen
>>> endin
>>> 
>>> i think this must be related to the k-argument, which seems to be set to
>>> zero.
>>> 
>>> 	joachim
>>> 
>>> 
>>> 
>>> 
>>> 
>>> -n
>>> 
>>> 
>>> 
>>> instr 1 ;works
>>> Sbla strcpyk "abc"
>>> Spart strsubk Sbla, 0, 2
>>> puts Spart, 1
>>> endin
>>> 
>>> instr 2 ;does not work (returns an empty string)
>>> Sbla strcpyk "abc"
>>> klen strlenk Sbla
>>> Spart strsubk Sbla, 0, klen-1
>>> puts Spart, klen
>>> endin
>>> 
>>> 
>>> 
>>> i 1 0 1
>>> i 2 0 1
>>> 
>>> 
>>> 
>>> ------------------------------------------------------------------------------
>>> See everything from the browser to the database with AppDynamics
>>> Get end-to-end visibility with application monitoring from AppDynamics
>>> Isolate bottlenecks and diagnose root cause in seconds.
>>> Start your free trial of AppDynamics Pro today!
>>> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>> 
>> Dr Victor Lazzarini
>> Senior Lecturer
>> Dept. of Music
>> NUI Maynooth Ireland
>> tel.: +353 1 708 3545
>> Victor dot Lazzarini AT nuim dot ie
>> 
>> 
>> 
>> 
>> ------------------------------------------------------------------------------
>> See everything from the browser to the database with AppDynamics
>> Get end-to-end visibility with application monitoring from AppDynamics
>> Isolate bottlenecks and diagnose root cause in seconds.
>> Start your free trial of AppDynamics Pro today!
>> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>> 
> 
> ------------------------------------------------------------------------------
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net