[Cs-dev] Polymorphic opcode problem
Date | 2005-07-20 00:47 |
From | Andres Cabrera |
Subject | [Cs-dev] Polymorphic opcode problem |
Hi, I'm trying to make the following polymorphic opcodes, but it's not working: {"dssictls.kk", sizeof(DSSICTLS), 3, "", "iikk", (SUBR)dssictls_init, (SUBR)dssictlsk, 0 }, {"dssictls.ak", sizeof(DSSICTLS), 5, "", "iiak", (SUBR)dssictls_init, 0 , (SUBR)dssictlsa }, if I use the following line: dssictls gihandle, p4, (kval*1), ktrig I get: error: no legal opcode, line 57: dssictls gihandle, p4, (kval*1), ktrig 1 syntax errors in orchestra. compilation invalid What am I missing to make the opcode polymorphic? Thanks, Andrés ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2005-07-20 07:45 |
From | Steven Yi |
Subject | Re: [Cs-dev] Polymorphic opcode problem |
Attachments | None |
Date | 2005-07-20 10:51 |
From | Istvan Varga |
Subject | Re: [Cs-dev] Polymorphic opcode problem |
Andres Cabrera wrote: > Hi, > I'm trying to make the following polymorphic opcodes, but it's not > working: > {"dssictls.kk", sizeof(DSSICTLS), 3, "", "iikk", (SUBR)dssictls_init, > (SUBR)dssictlsk, 0 }, > {"dssictls.ak", sizeof(DSSICTLS), 5, "", "iiak", (SUBR)dssictls_init, > 0 , (SUBR)dssictlsa }, You need to add a third entry that looks something like this: { "dssictls", 0xfffe }, Also, the two arguments on which the selection of the actual opcode is based must be the first two, so you may want to change the syntax of the opcode to: {"dssictls.kk", sizeof(DSSICTLS), 3, "", "kkii", (SUBR)dssictls_init, (SUBR)dssictlsk, 0 }, {"dssictls.ak", sizeof(DSSICTLS), 5, "", "akii", (SUBR)dssictls_init, 0 , (SUBR)dssictlsa }, Alternatively, if you do want to have the original syntax, then set the input types to "iixx": {"dssictls", sizeof(DSSICTLS), 7, "", "iixx", (SUBR)dssictls_init, (SUBR)dssictls_dummy, (SUBR)dssictls_dummy }, and then you can find out the actual type passed at init time with the following: int dssictls_dummy(ENVIRON *csound, DSSICTLS *p) { csound->PerfError(csound, Str("dssictls: not initialised")); } int dssictls_kk(ENVIRON *csound, DSSICTLS *p); int dssictls_ak(ENVIRON *csound, DSSICTLS *p); int dssictls_ka(ENVIRON *csound, DSSICTLS *p); int dssictls_aa(ENVIRON *csound, DSSICTLS *p); int dssictls_init(ENVIRON *csound, DSSICTLS *p) { switch ((int) csound->GetInputArgAMask(p) & 12) { case 0: p->h.opadr = (SUBR) dssictls_kk; /* "iikk" */ case 4: p->h.opadr = (SUBR) dssictls_ak; /* "iiak" */ case 8: p->h.opadr = (SUBR) dssictls_ka; /* "iika" */ case 12: p->h.opadr = (SUBR) dssictls_aa; /* "iiaa" */ } /* ... */ } ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2005-07-20 11:22 |
From | Steven Yi |
Subject | Re: [Cs-dev] Polymorphic opcode problem |
Attachments | None |
Date | 2005-07-20 14:24 |
From | Andres Cabrera |
Subject | Re: [Cs-dev] Polymorphic opcode problem |
Excellent! Very clear, thanks very much. Andres On Wed, 2005-07-20 at 04:51, Istvan Varga wrote: > Andres Cabrera wrote: > > > Hi, > > I'm trying to make the following polymorphic opcodes, but it's not > > working: > > {"dssictls.kk", sizeof(DSSICTLS), 3, "", "iikk", (SUBR)dssictls_init, > > (SUBR)dssictlsk, 0 }, > > {"dssictls.ak", sizeof(DSSICTLS), 5, "", "iiak", (SUBR)dssictls_init, > > 0 , (SUBR)dssictlsa }, > > You need to add a third entry that looks something like this: > > { "dssictls", 0xfffe }, > > Also, the two arguments on which the selection of the actual opcode is based > must be the first two, so you may want to change the syntax of the opcode to: > > {"dssictls.kk", sizeof(DSSICTLS), 3, "", "kkii", (SUBR)dssictls_init, > (SUBR)dssictlsk, 0 }, > {"dssictls.ak", sizeof(DSSICTLS), 5, "", "akii", (SUBR)dssictls_init, > 0 , (SUBR)dssictlsa }, > > Alternatively, if you do want to have the original syntax, then set the > input types to "iixx": > > {"dssictls", sizeof(DSSICTLS), 7, "", "iixx", (SUBR)dssictls_init, > (SUBR)dssictls_dummy, (SUBR)dssictls_dummy }, > > and then you can find out the actual type passed at init time > with the following: > > int dssictls_dummy(ENVIRON *csound, DSSICTLS *p) > { > csound->PerfError(csound, Str("dssictls: not initialised")); > } > > int dssictls_kk(ENVIRON *csound, DSSICTLS *p); > int dssictls_ak(ENVIRON *csound, DSSICTLS *p); > int dssictls_ka(ENVIRON *csound, DSSICTLS *p); > int dssictls_aa(ENVIRON *csound, DSSICTLS *p); > > int dssictls_init(ENVIRON *csound, DSSICTLS *p) > { > switch ((int) csound->GetInputArgAMask(p) & 12) { > case 0: p->h.opadr = (SUBR) dssictls_kk; /* "iikk" */ > case 4: p->h.opadr = (SUBR) dssictls_ak; /* "iiak" */ > case 8: p->h.opadr = (SUBR) dssictls_ka; /* "iika" */ > case 12: p->h.opadr = (SUBR) dssictls_aa; /* "iiaa" */ > } > /* ... */ > } > > > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click > _______________________________________________ > Csound-devel mailing list > Csound-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/csound-devel > > ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |