Csound Csound-dev Csound-tekno Search About

[Cs-dev] Is there a way to have a string as an optional

Date2013-04-18 23:04
FromAndres Cabrera
Subject[Cs-dev] Is there a way to have a string as an optional
AttachmentsNone  None  
input argument to an opcode?

Cheers,
Andrés

Date2013-04-18 23:23
FromSteven Yi
SubjectRe: [Cs-dev] Is there a way to have a string as an optional
Hi Andres,

There are no optional types for Strings currently. There is a var-arg
type "N" that will match against a String, and the var arg types are
zero-to-many, but it's not quite the same.  Optional types are done by
using a new letter; it'd be nice to have the arg specifiers have
modifiers for things like k? to mean optional k, or k* to mean var-arg
k, but it's not currently possible.

steven

On Thu, Apr 18, 2013 at 11:04 PM, Andres Cabrera  wrote:
> input argument to an opcode?
>
> Cheers,
> Andrés
>
> ------------------------------------------------------------------------------
> Precog is a next-generation analytics platform capable of advanced
> analytics on semi-structured data. The platform includes APIs for building
> apps and a phenomenal toolset for data science. Developers can use
> our toolset for easy data analysis & visualization. Get a free account!
> http://www2.precog.com/precogplatform/slashdotnewsletter
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-04-19 00:30
FromAndres Cabrera
SubjectRe: [Cs-dev] Is there a way to have a string as an optional
AttachmentsNone  None  
Hi Steven,

Thanks. In this case, 'N' will do as the string argument is the last one.

Cheers,
Andrés


On Thu, Apr 18, 2013 at 3:23 PM, Steven Yi <stevenyi@gmail.com> wrote:
Hi Andres,

There are no optional types for Strings currently. There is a var-arg
type "N" that will match against a String, and the var arg types are
zero-to-many, but it's not quite the same.  Optional types are done by
using a new letter; it'd be nice to have the arg specifiers have
modifiers for things like k? to mean optional k, or k* to mean var-arg
k, but it's not currently possible.

steven

On Thu, Apr 18, 2013 at 11:04 PM, Andres Cabrera <mantaraya36@gmail.com> wrote:
> input argument to an opcode?
>
> Cheers,
> Andrés
>
> ------------------------------------------------------------------------------
> Precog is a next-generation analytics platform capable of advanced
> analytics on semi-structured data. The platform includes APIs for building
> apps and a phenomenal toolset for data science. Developers can use
> our toolset for easy data analysis & visualization. Get a free account!
> http://www2.precog.com/precogplatform/slashdotnewsletter
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


Date2013-04-19 00:39
FromSteven Yi
SubjectRe: [Cs-dev] Is there a way to have a string as an optional
Okay, but just to be aware, the semantic checker may then allow for a
user to set multiple strings at the end of your opcode, and if that
happens, it could possibly overwrite memory if there's not enough
space allocated in the dsblksize for your OENTRY.  If you go this
route, you should probably just pad your opcode struct as a just in
case, plus do some init-time checking to see only one string was set.

Another option is to add an optional type to csound_standard_types.c
for in types. I thought at first that doing something like that might
make things harder to change later. If the opcode is included with
Csound, then I guess it'd be easy enough to modify the arg string to
the opcode in conjunction with any future changes.  You'd just have to
pick a letter that's not in use right now for any of the in arg types.

On Fri, Apr 19, 2013 at 12:30 AM, Andres Cabrera  wrote:
> Hi Steven,
>
> Thanks. In this case, 'N' will do as the string argument is the last one.
>
> Cheers,
> Andrés
>
>
> On Thu, Apr 18, 2013 at 3:23 PM, Steven Yi  wrote:
>>
>> Hi Andres,
>>
>> There are no optional types for Strings currently. There is a var-arg
>> type "N" that will match against a String, and the var arg types are
>> zero-to-many, but it's not quite the same.  Optional types are done by
>> using a new letter; it'd be nice to have the arg specifiers have
>> modifiers for things like k? to mean optional k, or k* to mean var-arg
>> k, but it's not currently possible.
>>
>> steven
>>
>> On Thu, Apr 18, 2013 at 11:04 PM, Andres Cabrera 
>> wrote:
>> > input argument to an opcode?
>> >
>> > Cheers,
>> > Andrés
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > Precog is a next-generation analytics platform capable of advanced
>> > analytics on semi-structured data. The platform includes APIs for
>> > building
>> > apps and a phenomenal toolset for data science. Developers can use
>> > our toolset for easy data analysis & visualization. Get a free account!
>> > http://www2.precog.com/precogplatform/slashdotnewsletter
>> > _______________________________________________
>> > Csound-devel mailing list
>> > Csound-devel@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/csound-devel
>> >
>>
>>
>> ------------------------------------------------------------------------------
>> Precog is a next-generation analytics platform capable of advanced
>> analytics on semi-structured data. The platform includes APIs for building
>> apps and a phenomenal toolset for data science. Developers can use
>> our toolset for easy data analysis & visualization. Get a free account!
>> http://www2.precog.com/precogplatform/slashdotnewsletter
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
>
> ------------------------------------------------------------------------------
> Precog is a next-generation analytics platform capable of advanced
> analytics on semi-structured data. The platform includes APIs for building
> apps and a phenomenal toolset for data science. Developers can use
> our toolset for easy data analysis & visualization. Get a free account!
> http://www2.precog.com/precogplatform/slashdotnewsletter
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-04-19 00:40
FromSteven Yi
SubjectRe: [Cs-dev] Is there a way to have a string as an optional
Oh, you might also have to modify another string somewhere... but I
can't recall at the moment.  Anyways, if you try it and it doesn't
work, it means there's another place to modify. :P

On Fri, Apr 19, 2013 at 12:39 AM, Steven Yi  wrote:
> Okay, but just to be aware, the semantic checker may then allow for a
> user to set multiple strings at the end of your opcode, and if that
> happens, it could possibly overwrite memory if there's not enough
> space allocated in the dsblksize for your OENTRY.  If you go this
> route, you should probably just pad your opcode struct as a just in
> case, plus do some init-time checking to see only one string was set.
>
> Another option is to add an optional type to csound_standard_types.c
> for in types. I thought at first that doing something like that might
> make things harder to change later. If the opcode is included with
> Csound, then I guess it'd be easy enough to modify the arg string to
> the opcode in conjunction with any future changes.  You'd just have to
> pick a letter that's not in use right now for any of the in arg types.
>
> On Fri, Apr 19, 2013 at 12:30 AM, Andres Cabrera  wrote:
>> Hi Steven,
>>
>> Thanks. In this case, 'N' will do as the string argument is the last one.
>>
>> Cheers,
>> Andrés
>>
>>
>> On Thu, Apr 18, 2013 at 3:23 PM, Steven Yi  wrote:
>>>
>>> Hi Andres,
>>>
>>> There are no optional types for Strings currently. There is a var-arg
>>> type "N" that will match against a String, and the var arg types are
>>> zero-to-many, but it's not quite the same.  Optional types are done by
>>> using a new letter; it'd be nice to have the arg specifiers have
>>> modifiers for things like k? to mean optional k, or k* to mean var-arg
>>> k, but it's not currently possible.
>>>
>>> steven
>>>
>>> On Thu, Apr 18, 2013 at 11:04 PM, Andres Cabrera 
>>> wrote:
>>> > input argument to an opcode?
>>> >
>>> > Cheers,
>>> > Andrés
>>> >
>>> >
>>> > ------------------------------------------------------------------------------
>>> > Precog is a next-generation analytics platform capable of advanced
>>> > analytics on semi-structured data. The platform includes APIs for
>>> > building
>>> > apps and a phenomenal toolset for data science. Developers can use
>>> > our toolset for easy data analysis & visualization. Get a free account!
>>> > http://www2.precog.com/precogplatform/slashdotnewsletter
>>> > _______________________________________________
>>> > Csound-devel mailing list
>>> > Csound-devel@lists.sourceforge.net
>>> > https://lists.sourceforge.net/lists/listinfo/csound-devel
>>> >
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Precog is a next-generation analytics platform capable of advanced
>>> analytics on semi-structured data. The platform includes APIs for building
>>> apps and a phenomenal toolset for data science. Developers can use
>>> our toolset for easy data analysis & visualization. Get a free account!
>>> http://www2.precog.com/precogplatform/slashdotnewsletter
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Precog is a next-generation analytics platform capable of advanced
>> analytics on semi-structured data. The platform includes APIs for building
>> apps and a phenomenal toolset for data science. Developers can use
>> our toolset for easy data analysis & visualization. Get a free account!
>> http://www2.precog.com/precogplatform/slashdotnewsletter
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-04-19 00:51
FromAndres Cabrera
SubjectRe: [Cs-dev] Is there a way to have a string as an optional
AttachmentsNone  None  
Thanks Steven. I've taken the easy route of using N and allowing 64 arguments, but just using the first one.

This is for the chn_k opcode to allow it to take a string as its last argument.

Cheers,
Andrés


On Thu, Apr 18, 2013 at 4:39 PM, Steven Yi <stevenyi@gmail.com> wrote:
Okay, but just to be aware, the semantic checker may then allow for a
user to set multiple strings at the end of your opcode, and if that
happens, it could possibly overwrite memory if there's not enough
space allocated in the dsblksize for your OENTRY.  If you go this
route, you should probably just pad your opcode struct as a just in
case, plus do some init-time checking to see only one string was set.

Another option is to add an optional type to csound_standard_types.c
for in types. I thought at first that doing something like that might
make things harder to change later. If the opcode is included with
Csound, then I guess it'd be easy enough to modify the arg string to
the opcode in conjunction with any future changes.  You'd just have to
pick a letter that's not in use right now for any of the in arg types.

On Fri, Apr 19, 2013 at 12:30 AM, Andres Cabrera <mantaraya36@gmail.com> wrote:
> Hi Steven,
>
> Thanks. In this case, 'N' will do as the string argument is the last one.
>
> Cheers,
> Andrés
>
>
> On Thu, Apr 18, 2013 at 3:23 PM, Steven Yi <stevenyi@gmail.com> wrote:
>>
>> Hi Andres,
>>
>> There are no optional types for Strings currently. There is a var-arg
>> type "N" that will match against a String, and the var arg types are
>> zero-to-many, but it's not quite the same.  Optional types are done by
>> using a new letter; it'd be nice to have the arg specifiers have
>> modifiers for things like k? to mean optional k, or k* to mean var-arg
>> k, but it's not currently possible.
>>
>> steven
>>
>> On Thu, Apr 18, 2013 at 11:04 PM, Andres Cabrera <mantaraya36@gmail.com>
>> wrote:
>> > input argument to an opcode?
>> >
>> > Cheers,
>> > Andrés
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > Precog is a next-generation analytics platform capable of advanced
>> > analytics on semi-structured data. The platform includes APIs for
>> > building
>> > apps and a phenomenal toolset for data science. Developers can use
>> > our toolset for easy data analysis & visualization. Get a free account!
>> > http://www2.precog.com/precogplatform/slashdotnewsletter
>> > _______________________________________________
>> > Csound-devel mailing list
>> > Csound-devel@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/csound-devel
>> >
>>
>>
>> ------------------------------------------------------------------------------
>> Precog is a next-generation analytics platform capable of advanced
>> analytics on semi-structured data. The platform includes APIs for building
>> apps and a phenomenal toolset for data science. Developers can use
>> our toolset for easy data analysis & visualization. Get a free account!
>> http://www2.precog.com/precogplatform/slashdotnewsletter
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
>
> ------------------------------------------------------------------------------
> Precog is a next-generation analytics platform capable of advanced
> analytics on semi-structured data. The platform includes APIs for building
> apps and a phenomenal toolset for data science. Developers can use
> our toolset for easy data analysis & visualization. Get a free account!
> http://www2.precog.com/precogplatform/slashdotnewsletter
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel