Tracking down rate mismatch problem...

From: Michael J McGonagle (fndsnd@earthlink.net)
Date: Mon Jul 03 2000 - 22:14:28 EDT


Hello all,

After returning to work on a project that I started a couple of months
ago, I decided to rewrite some of the support code. In doing this, I
changed to using an oparray instead of separate opcode calls. Well, now
it seems that sfront gives me an error message saying that there was a
rate mismatch (btw, is it possible for sfront to give a little more info
here as to exactly which parameter is mismatched). I used saolc to
compile this and it pointed to the second parameter of a tableread call.
Looking at the spec, it would appear that this parameter can be of any
rate. So why am I getting an error.

I included the opcode code that I wrote, I indicated where the error is
in the code. This does not make any sense to me, it worked fine when it
was using distinct opcode calls instead of the oparray.

kopcode eg_table(ksig release, ksig ratescale, table rates, table
levels) {
  ksig pstage, stage, localtime, expire,
    kinit, triggered, eg, finallevel;
  oparray kline[6];

  if (!kinit) {
    kinit = 1;
    pstage = 3 ;
    expire = tableread(rates, stage) * ratescale;
  }
  if (!release && !triggered) {
    if (stage > 3 ) {

      // the following line is where the error is

      eg = ((kline[stage](1,
        tableread(rates, stage) * ratescale , 0) * (
        tableread(levels, pstage) -
        tableread(levels, stage))) + tableread(levels, stage));

      if (localtime >= expire) {
        pstage = stage;
        stage = stage + 1;
        if (stage == 3 ) {
          eg = tableread(levels, pstage);
        } else {
          expire = expire + (tableread(rates, stage) * ratescale);
        }
      }
    }
  } else {
    if (!triggered) {
      triggered = 1;
      expire = expire + (tableread(rates, 3) + ratescale);
      finallevel = eg;
    }
    eg = ((kline[ stage ](1,
      tableread(rates, 3 ) * ratescale , 0) * (
      finallevel -
      tableread(levels, 3))) + tableread(levels, 3));
    if (localtime >= expire) {
      eg = tableread(levels, 3);
    }
  }
  localtime = localtime + (1 / k_rate);
  return(eg);
}

Regards,
Mike



This archive was generated by hypermail 2b29 : Mon Jan 28 2002 - 12:03:57 EST