Csound Csound-dev Csound-tekno Search About

[Csnd-dev] Improved getftargs opcode

Date2016-10-20 21:19
FromGuillermo Senna
Subject[Csnd-dev] Improved getftargs opcode
Attachmentsgetftargs.c  

Hi,

I've been trying to improve the way getftargs allocates the space for its string. I think it is working fine now, but it would be great if someone could check I haven't done anything stupid as I'm not used to C so much.

Also, I see in the Release_Notes/Version_6.08.md file that it says "getftargs -- copy arguments of a gen to an array", but the opcode actually copies the arguments of a gen to an S-variable. Is this last one equivalent to an array in Csound lingo?

Thanks!




Date2016-10-21 17:30
Fromjpff
SubjectRe: [Csnd-dev] Improved getftargs opcode
My error in the release notes -- will fix
I think your code was good; looked OK when I read it, but testing is 
always nice

On Thu, 20 Oct 2016, Guillermo Senna wrote:

> 
> Hi,
> 
> I've been trying to improve the way getftargs allocates the space for its
> string. I think it is working fine now, but it would be great if someone could
> check I haven't done anything stupid as I'm not used to C so much.
> 
> Also, I see in the Release_Notes/Version_6.08.md file that it says "getftargs
> -- copy arguments of a gen to an array", but the opcode actually copies the
> arguments of a gen to an S-variable. Is this last one equivalent to an array
> in Csound lingo?
> 
> Thanks!
> 
> 
> 
> 

Date2016-10-21 21:36
FromGuillermo Senna
SubjectRe: [Csnd-dev] Improved getftargs opcode
Thank you John! I tested it with a couple of f-tables with varying size
on its arguments and it reallocates the space fine. I didn't see any
undefined behavior. My only concern was regarding the second use of
snprinf, because it's supposed to remove the last space and insert '\0'
where that was. I imagined I could get away with that by just passing a
smaller size as an argument. Otherwise I should add 1 to the strlen
variable.

Let me know if you find something that needs to be corrected!

Cheers.


On 21/10/16 13:30, jpff wrote:
> My error in the release notes -- will fix
> I think your code was good; looked OK when I read it, but testing is
> always nice
>
> On Thu, 20 Oct 2016, Guillermo Senna wrote:
>
>>
>> Hi,
>>
>> I've been trying to improve the way getftargs allocates the space for
>> its
>> string. I think it is working fine now, but it would be great if
>> someone could
>> check I haven't done anything stupid as I'm not used to C so much.
>>
>> Also, I see in the Release_Notes/Version_6.08.md file that it says
>> "getftargs
>> -- copy arguments of a gen to an array", but the opcode actually
>> copies the
>> arguments of a gen to an S-variable. Is this last one equivalent to
>> an array
>> in Csound lingo?
>>
>> Thanks!
>>
>>
>>
>>