| yes, I think you're on the right track there; if we are going to make
changes to
the API, modernising it should be one of the goals.
Victor
At 16:54 27/04/2007, you wrote:
>True...
>
>I still think a variant type is the way to go. I do suggest a more
>object-oriented style of C coding to implement it. Pfields would be not
>pointers (as they are now), but they would point to an array of
>discriminated unions any of which could be char, boolean, int, real, or
>string. It is easiest if the string is a fixed length buffer, then it does
>not need to be a pointer to a separate block of memory that requires
>additional code to manage. It is enough to simply create the pfield
>struct. This in turn could be a contiguous array in the instrument
>instance. There could be separate arrays of pointers that would alias to
>the current pfields; that would mean most Csound code would not need to be
>changed, only code that actually does use more than one string. The API
>would be backwardly incompatible in that it would require recompiling
>everything, but it would not require rewriting existing code.
>
>To illustrate (names are not as used in Csound):
>
>typedef struct pfield_ {
> int type;
> union {
> char c;
> int i;
> MYFLT r;
> char s[0xff];
> };
>} pfield;
>
>typedef struct instrument_ {
> pfield pfields[N];
> MYFLT *p[N];
>} instrument;
>
>int instrument_init(instrument *instrument)
>{
> for (size_t i = 0; i < N; i++) {
> p[i] = &pfields[i].r;
> }
> // et cetera...
>}
>
>Regards,
>Mike
>
>-----Original Message-----
> >From: Victor Lazzarini
> >Sent: Apr 27, 2007 11:22 AM
> >To: Michael Gogins , Developer discussions
>
> >Subject: Re: [Cs-dev] more than one string in an i-statement
> >
> >The only dependence for the core Csound5 is libsndfile.
> >
> >At 16:17 27/04/2007, you wrote:
> >>Why? We have tons of dependencies already, and boost is pretty standard
> >>for C++ development now.
> >>
> >>Regards,
> >>Mike
> >>
> >>-----Original Message-----
> >> >From: Victor Lazzarini
> >> >Sent: Apr 27, 2007 11:13 AM
> >> >To: Developer discussions
> >> >Subject: Re: [Cs-dev] more than one string in an i-statement
> >> >
> >> >I would be against introducing a dependency on Boost to the
> >> >csound core.
> >> >
> >> >Victor
> >> >
> >> >At 16:07 27/04/2007, you wrote:
> >> >>Better yet, the pfields should be variants; each pfield should be
> allowed
> >> >>to be any one of a predefined set of types that would at least include
> >> >>int, real, boolean, string. I would not want to get too fancy with this!
> >> >>
> >> >>boost::any provides an efficient, easy to use encapsulation of this kind
> >> >>of facility in C++, which is another argument for moving the Csound
> >> >>internals from C to C++. I don't want to wait around for weeks or months
> >> >>while people hammer out some implementation in C of what already works
> >> >>perfectly in C++.
> >> >>
> >> >>Regards,
> >> >>Mike
> >> >>
> >> >>-----Original Message-----
> >> >> >From: Victor Lazzarini
> >> >> >Sent: Apr 27, 2007 4:40 AM
> >> >> >To: Developer discussions
> >> >> >Subject: Re: [Cs-dev] more than one string in an i-statement
> >> >> >
> >> >> >I think we should have a plan for a change in the API. Perhaps we
> >> >> >should wait for other changes before doing, so they are all done
> >> >> >in one go. So, for now, we don't do anything, but add this to a list
> >> >> >of future API changes. When that list is big enough or there is a
> >> >> >good reason for modifying the API, then we will do it.
> >> >> >
> >> >> >
> >> >> >At 02:42 27/04/2007, you wrote:
> >> >> >>Please keep in mind that if you change the EVTBLK structure to
> allow for
> >> >> >>more than one string, then you will also need to change the EVENT
> >> structure
> >> >> >>in cscore.h which is part of the Cscore API. This will be an
> >> incompatible
> >> >> >>change to the API (our first) and will require the API version
> >> number to be
> >> >> >>increased to 2.0. Increasing the API major version will require all
> >> host
> >> >> >>applications that dynamically link to Csound to be recompiled even
> >> though
> >> >> >>this change will likely not affect them. Existing user cscore
> programs
> >> >> will
> >> >> >>all need to be recompiled and will likely crash if they are loaded
> >> with the
> >> >> >>new library.
> >> >> >>
> >> >> >>None of this means that we should not make this improvement. But
> >> these are
> >> >> >>the consequences of this particular change unless you can think of a
> >> way to
> >> >> >>avoid changing EVTBLK.
> >> >> >>
> >> >> >>If you do change EVTBLK, I would suggest that we do away with the
> "magic
> >> >> >>number" (*) for indicating a string p-field and instead have an
> array of
> >> >> >>bools. I have not yet been able to cause anything really bad to
> happen
> >> >> as a
> >> >> >>result of this hack but the CSD below certainly could be
> considered to
> >> >> >>behave a little "strangely".
> >> >> >>
> >> >> >>Also, I don't know if we can save space by using a union { char * ;
> >> MYFLT }
> >> >> >>for each p-field but that may not be a good idea either if it
> >> changes how
> >> >> >>Cscore users access p-fields from their code.
> >> >> >>
> >> >> >>Anthony
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>sr = 10
> >> >> >>kr = 10
> >> >> >>
> >> >> >>instr 1
> >> >> >> print p4
> >> >> >> ifile fiopen p4, 1
> >> >> >>endin
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>i1 0 1 "test string"
> >> >> >>i1 1 1 3945467
> >> >> >>e
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>* By the way, did the magic number (SSTRCOD) change between Csound 4
> >> & 5 or
> >> >> >>has it changed since Csound 5.00 was released? I thought that it
> used
> >> >> to be
> >> >> >>1048576 and it is now 3945467. Am I confused?
> >> >> >>
> >> >> >>Victor Lazzarini wrote on 4/26/07 11:35 AM:
> >> >> >>
> >> >> >> > Yes, more than one string in an i-statement should be enabled,
> >> >> >> > that should be one of the items in the to-do list. At the
> moment the
> >> >> data
> >> >> >> > structure that holds i-statements has only one slot for
> strings, so
> >> >> >> > I suppose that's where we should start.
> >> >> >>
> >> >> >>
> >> >> >>------------------------------------------------------------------
> ---
> >> ----
> >> >> >>This SF.net email is sponsored by DB2 Express
> >> >> >>Download DB2 Express C - the FREE version of DB2 express and take
> >> >> >>control of your XML. No limits. Just data. Click to get it now.
> >> >> >>http://sourceforge.net/powerbar/db2/
> >> >> >>_______________________________________________
> >> >> >>Csound-devel mailing list
> >> >> >>Csound-devel@lists.sourceforge.net
> >> >> >>https://lists.sourceforge.net/lists/listinfo/csound-devel
> >> >> >
> >> >> >Victor Lazzarini
> >> >> >Music Technology Laboratory
> >> >> >Music Department
> >> >> >National University of Ireland, Maynooth
> >> >> >
> >> >> >
> >> >> >-------------------------------------------------------------------
> ------
> >> >> >This SF.net email is sponsored by DB2 Express
> >> >> >Download DB2 Express C - the FREE version of DB2 express and take
> >> >> >control of your XML. No limits. Just data. Click to get it now.
> >> >> >http://sourceforge.net/powerbar/db2/
> >> >> >_______________________________________________
> >> >> >Csound-devel mailing list
> >> >> >Csound-devel@lists.sourceforge.net
> >> >> >https://lists.sourceforge.net/lists/listinfo/csound-devel
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>---------------------------------------------------------------------
> ----
> >> >>This SF.net email is sponsored by DB2 Express
> >> >>Download DB2 Express C - the FREE version of DB2 express and take
> >> >>control of your XML. No limits. Just data. Click to get it now.
> >> >>http://sourceforge.net/powerbar/db2/
> >> >>_______________________________________________
> >> >>Csound-devel mailing list
> >> >>Csound-devel@lists.sourceforge.net
> >> >>https://lists.sourceforge.net/lists/listinfo/csound-devel
> >> >
> >> >Victor Lazzarini
> >> >Music Technology Laboratory
> >> >Music Department
> >> >National University of Ireland, Maynooth
> >> >
> >> >
> >> >-------------------------------------------------------------------------
> >> >This SF.net email is sponsored by DB2 Express
> >> >Download DB2 Express C - the FREE version of DB2 express and take
> >> >control of your XML. No limits. Just data. Click to get it now.
> >> >http://sourceforge.net/powerbar/db2/
> >> >_______________________________________________
> >> >Csound-devel mailing list
> >> >Csound-devel@lists.sourceforge.net
> >> >https://lists.sourceforge.net/lists/listinfo/csound-devel
> >>
> >>
> >>
> >>
> >>-------------------------------------------------------------------------
> >>This SF.net email is sponsored by DB2 Express
> >>Download DB2 Express C - the FREE version of DB2 express and take
> >>control of your XML. No limits. Just data. Click to get it now.
> >>http://sourceforge.net/powerbar/db2/
> >>_______________________________________________
> >>Csound-devel mailing list
> >>Csound-devel@lists.sourceforge.net
> >>https://lists.sourceforge.net/lists/listinfo/csound-devel
> >
> >Victor Lazzarini
> >Music Technology Laboratory
> >Music Department
> >National University of Ireland, Maynooth
> >
> >
> >-------------------------------------------------------------------------
> >This SF.net email is sponsored by DB2 Express
> >Download DB2 Express C - the FREE version of DB2 express and take
> >control of your XML. No limits. Just data. Click to get it now.
> >http://sourceforge.net/powerbar/db2/
> >_______________________________________________
> >Csound-devel mailing list
> >Csound-devel@lists.sourceforge.net
> >https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
>
>
>-------------------------------------------------------------------------
>This SF.net email is sponsored by DB2 Express
>Download DB2 Express C - the FREE version of DB2 express and take
>control of your XML. No limits. Just data. Click to get it now.
>http://sourceforge.net/powerbar/db2/
>_______________________________________________
>Csound-devel mailing list
>Csound-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/csound-devel
Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net |