Quantcast

Polymorphic opcode problem

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Polymorphic opcode problem

Andres Cabrera-3
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. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Polymorphic opcode problem

Steven Yi
Hi Andres,

I think you need to use "_" instead of ".".  This was a change of
Istvan's so that opcodes could actually use "."'s in their names, if
I'm not mistaken.

steven


On 7/20/05, Andres Cabrera <[hidden email]> 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 },
>
> 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. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&opclick">http://ads.osdn.com/?ad_idt77&alloc_id492&opclick
> _______________________________________________
> Csound-devel mailing list
> [hidden email]
> 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. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Polymorphic opcode problem

Istvan Varga
In reply to this post by Andres Cabrera-3
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Polymorphic opcode problem

Steven Yi
In reply to this post by Steven Yi
Oh, sorry, I got that totally backwards.  It used to be "_" and now is
"." to allow "_" in opcodes names.  Sorry about that!

steven


On 7/20/05, Steven Yi <[hidden email]> wrote:

> Hi Andres,
>
> I think you need to use "_" instead of ".".  This was a change of
> Istvan's so that opcodes could actually use "."'s in their names, if
> I'm not mistaken.
>
> steven
>
>
> On 7/20/05, Andres Cabrera <[hidden email]> 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 },
> >
> > 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. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&opclick">http://ads.osdn.com/?ad_idt77&alloc_id492&opclick
> > _______________________________________________
> > Csound-devel mailing list
> > [hidden email]
> > 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. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Polymorphic opcode problem

Andres Cabrera-3
In reply to this post by Istvan Varga
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
> [hidden email]
> 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Loading...