[Csnd] pinit opcode and string pfields
| Date | 2019-07-22 00:27 |
| From | Richard Knight |
| Subject | [Csnd] pinit opcode and string pfields |
| I've been using pinit recently and noticed it only handles numeric pfields, so I've added a string version of the opcode. Basically just wondering if this will be useful to others/whether to submit a pull request - the change can be seen here: https://github.com/csound/csound/compare/develop...1bpm:develop is there a difference or preference between csound->Strdup() and cs_strdup() ? |
| Date | 2019-07-22 01:03 |
| From | Richard Knight |
| Subject | Re: [Csnd] pinit opcode and string pfields |
|
sorry, I mean pindex , not pinit On Mon, 22 Jul 2019 00:27:37 +0100, Richard Knight wrote: I've been using pinit recently and noticed it only handles numeric pfields, so I've added a string version of the opcode. Basically just wondering if this will be useful to others/whether to submit a pull request - the change can be seen here: https://github.com/csound/csound/compare/develop...1bpm:develop is there a difference or preference between csound->Strdup() and cs_strdup() ? -- http://rk.1bpm.net/ |
| Date | 2019-07-22 08:46 |
| From | John ff |
| Subject | Re: [Csnd] pinit opcode and string pfields |
I did not deal with strings as I could not think of a syntax. What did you do?
Sent from TypeApp
On 22 Jul 2019, at 00:28, Richard Knight <richard@1bpm.net> wrote: I've been using pinit recently and noticed it only handles numeric pfields, so I've added a string version of the opcode. Basically just wondering if this will be useful to others/whether to submit a pull request - the change can be seen here: https://github.com/csound/csound/compare/develop...1bpm:develop is there a difference or preference between csound->Strdup() and cs_strdup() ? Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
| Date | 2019-07-22 12:40 |
| From | Richard Knight |
| Subject | Re: [Csnd] pinit opcode and string pfields |
|
Just to clarify if missed I made a mistake in my email and it's pindex not pinit that I mean. The addition is really very simple, it just uses most of the i value pindex code but then just cs_strdup(csound, get_arg_string(csound, csound->init_event->p[n])) and the length of that for the stringdat. On Mon, 22 Jul 2019 08:46:17 +0100, John ff wrote:
-- http://rk.1bpm.net/ |
| Date | 2019-07-22 13:06 |
| From | john |
| Subject | Re: [Csnd] pinit opcode and string pfields |
Previous resonse from me referred tot pinit function (visable as passign)
so I probably did not add anytin!
Are you suggestinf a pindex opcode taat delivers a string from an integer?
What do you doif the actual p field is a number?
==John ff
On Mon, 22 Jul 2019, Richard Knight wrote:
> I've been using pinit recently and noticed it only handles numeric pfields, so
> I've added a string version of the opcode. Basically just wondering if this
> will be useful to others/whether to submit a pull request - the change can be
> seen here: https://github.com/csound/csound/compare/develop...1bpm:develop is
> there a difference or preference between csound->Strdup() and cs_strdup() ?
> Csound mailing list Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features can
> be posted here
>
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here |
| Date | 2019-07-22 14:39 |
| From | Richard Knight |
| Subject | Re: [Csnd] pinit opcode and string pfields |
|
Yes that's right - pindex that delivers a string. Good question, at the moment if the requested index is a number, it just uses the default of get_arg_string which seems to be the last string argument if there was one, or the next string argument if there isn't a last. Perhaps it could return the number as a string, or an empty string, and in either case show a message indicating that - any persuasion on what might be most logical behaviour? On Mon, 22 Jul 2019 13:06:08 +0100, john wrote: Previous resonse from me referred tot pinit function (visable as passign) so I probably did not add anytin! Are you suggestinf a pindex opcode taat delivers a string from an integer? What do you doif the actual p field is a number? ==John ff On Mon, 22 Jul 2019, Richard Knight wrote:I've been using pinit recently and noticed it only handles numeric pfields, so I've added a string version of the opcode. Basically just wondering if this will be useful to others/whether to submit a pull request - the change can be seen here: https://github.com/csound/csound/compare/develop...1bpm:develop is there a difference or preference between csound->Strdup() and cs_strdup() ? Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted hereCsound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here -- http://rk.1bpm.net/ |
| Date | 2019-07-22 16:08 |
| From | john |
| Subject | Re: [Csnd] pinit opcode and string pfields |
I woul go for an empty string.
Do you want to submit a PR Or send me tjhe code? Or could try and write
it....
==John ff
On Mon, 22 Jul 2019, Richard Knight wrote:
>
> Yes that's right - pindex that delivers a string.
>
> Good question, at the moment if the requested index is a number, it just uses
> the default of get_arg_string which seems to be the last string argument if
> there was one, or the next string argument if there isn't a last.
> What I hadn't tested until now was if there were no string arguments at all,
> then in that case it segfaults..
>
> Perhaps it could return the number as a string, or an empty string, and in
> either case show a message indicating that - any persuasion on what might be
> most logical behaviour?
>
> On Mon, 22 Jul 2019 13:06:08 +0100, john wrote:
>
> Previous resonse from me referred tot pinit function (visable as passign)
> so I probably did not add anytin!
>
> Are you suggestinf a pindex opcode taat delivers a string from an integer?
> What do you doif the actual p field is a number?
>
> ==John ff
>
> On Mon, 22 Jul 2019, Richard Knight wrote:
>
> I've been using pinit recently and noticed it only handles numeric pfields, so
> I've added a string version of the opcode. Basically just wondering if this
> will be useful to others/whether to submit a pull request - the change can be
> seen here: https://github.com/csound/csound/compare/develop...1bpm:develop is
> there a difference or preference between csound->Strdup() and cs_strdup() ?
> Csound mailing list Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features can
> be posted here
>
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
> https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>
> --
>
>
> http://rk.1bpm.net/
> Csound mailing list Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features can
> be posted here
>
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here |
| Date | 2019-07-22 17:52 |
| From | Richard Knight |
| Subject | Re: [Csnd] pinit opcode and string pfields |
|
OK, sounds good, I'll change/test the code and amend the commit then submit a PR, later today hopefully. On Mon, 22 Jul 2019 16:08:30 +0100, john wrote: I woul go for an empty string. Do you want to submit a PR Or send me tjhe code? Or could try and write it.... ==John ff On Mon, 22 Jul 2019, Richard Knight wrote:Yes that's right - pindex that delivers a string. Good question, at the moment if the requested index is a number, it just uses the default of get_arg_string which seems to be the last string argument if there was one, or the next string argument if there isn't a last. What I hadn't tested until now was if there were no string arguments at all, then in that case it segfaults.. Perhaps it could return the number as a string, or an empty string, and in either case show a message indicating that - any persuasion on what might be most logical behaviour? On Mon, 22 Jul 2019 13:06:08 +0100, john wrote: Previous resonse from me referred tot pinit function (visable as passign) so I probably did not add anytin! Are you suggestinf a pindex opcode taat delivers a string from an integer? What do you doif the actual p field is a number? ==John ff On Mon, 22 Jul 2019, Richard Knight wrote: I've been using pinit recently and noticed it only handles numeric pfields, so I've added a string version of the opcode. Basically just wondering if this will be useful to others/whether to submit a pull request - the change can be seen here: https://github.com/csound/csound/compare/develop...1bpm:develop is there a difference or preference between csound->Strdup() and cs_strdup() ? Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here -- http://rk.1bpm.net/ Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted hereCsound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here -- http://rk.1bpm.net/ |
| Date | 2019-07-23 14:04 |
| From | Richard Knight |
| Subject | Re: [Csnd] pinit opcode and string pfields |
|
OK, submitted PR now. I also noticed that the original pindex code returns NOTOK but no error, so causes the instrument to fail silently. I changed this to return an InitError, same with what I've added. Also not sure if setting the value before returning NOTOK had any purpose, do let me know if I missed some reason for these and I will go back and have a look. On Mon, 22 Jul 2019 16:08:30 +0100, john wrote: I woul go for an empty string. Do you want to submit a PR Or send me tjhe code? Or could try and write it.... ==John ff On Mon, 22 Jul 2019, Richard Knight wrote:Yes that's right - pindex that delivers a string. Good question, at the moment if the requested index is a number, it just uses the default of get_arg_string which seems to be the last string argument if there was one, or the next string argument if there isn't a last. What I hadn't tested until now was if there were no string arguments at all, then in that case it segfaults.. Perhaps it could return the number as a string, or an empty string, and in either case show a message indicating that - any persuasion on what might be most logical behaviour? On Mon, 22 Jul 2019 13:06:08 +0100, john wrote: Previous resonse from me referred tot pinit function (visable as passign) so I probably did not add anytin! Are you suggestinf a pindex opcode taat delivers a string from an integer? What do you doif the actual p field is a number? ==John ff On Mon, 22 Jul 2019, Richard Knight wrote: I've been using pinit recently and noticed it only handles numeric pfields, so I've added a string version of the opcode. Basically just wondering if this will be useful to others/whether to submit a pull request - the change can be seen here: https://github.com/csound/csound/compare/develop...1bpm:develop is there a difference or preference between csound->Strdup() and cs_strdup() ? Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here -- http://rk.1bpm.net/ Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted hereCsound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here -- http://rk.1bpm.net/ |