Ejemplo n.º 1
0
void CompilerPass::visit(ArrayComprehension *ast)
{
    expr(ast->body);
    fodder(ast->commaFodder);
    specs(ast->specs);
    fodder(ast->closeFodder);
}
Ejemplo n.º 2
0
void TypeRuleEngine::checkRules(int from)
{
    operationStarted();
    _rulesChecked = 0;

    // Full or partial check?
    if (from <= 0) {
        from = 0;
        _hits.fill(0, _rules.size());
        _rulesPerType.clear();
        for (int i = 0; i < _activeRules.size(); ++i)
            delete _activeRules[i];
        _activeRules.clear();
        _rulesToCheck = _rules.size();
    }
    else {
        _hits.resize(_rules.size());
        _rulesToCheck = _rules.size() - from;
    }

    if (!_symbols->factory().symbolsAvailable() || _rules.isEmpty())
        return;

    forceOperationProgress();
    OsSpecs specs(&_symbols->memSpecs());

    // Checking the rules from last to first assures that rules in the
    // _activeRules hash are processes first to last. That way, if multiple
    // rules match the same instance, the first rule takes precedence.
    for (int i = _rules.size() - 1; !interrupted() && i >= from; --i) {
        ++_rulesChecked;
        checkOperationProgress();

        checkRule(_rules[i], i, &specs);
    }

    operationStopped();
    operationProgress();
    shellEndl();
}
Ejemplo n.º 3
0
 virtual void specinit() {
     dx=0.0; dy=0.0; angle= -3.14159/2.0;
     specs();
 }
/* ---------------------------------------------------------------- space --- */
static int
space(float dim[],          /* first 4 args: arrays of 2 elements */
      float source[],
      float warp1[],
      float warp2[],
      float dec,
      float rndval)
{
   int    i;
   double pow1, pow2, pow3, pow4, rval, xval, x;
   float  rndseed, bounce[NTAPS][2];
   float  xxx, xlist[2];

   rndseed = (rndval == 0.0) ? 0.3 : rndval;

   pow1 = log((double)warp1[0]) / log(0.5);
   pow2 = log((double)warp1[1]) / log(0.5);
   pow3 = log((double)warp2[0]) / log(0.5);
   pow4 = log((double)warp2[1]) / log(0.5);

   for (i = 0; i < 2; i++) {
      source[i] *= dim[i];
      x = (double)i / 2.0;

      rval = ((double)rind(0.5, &rndseed) + 0.5) / 2.0 + x;
      xval = exp(log(rval) / pow1);
      bounce[i][0] = (float)rval;
      bounce[i][1] = (float)pow(xval, pow2);

      rval = ((double)rind(0.5, &rndseed) + 0.5) / 2.0 + x;
      xval = exp(log(rval) / pow3);
      bounce[i + 4][0] = (float)rval;
      bounce[i + 4][1] = (float)pow(xval, pow4);

      rval = ((double)rind(0.5, &rndseed) + 0.5) / 2.0 + x;
      xval = exp(log(rval) / pow2);
      bounce[i + 2][1] = (float)rval;
      bounce[i + 2][0] = (float)pow(xval, pow1);

      rval = ((double)rind(0.5, &rndseed) + 0.5) / 2.0 + x;
      xval = exp(log(rval) / pow4);
      bounce[i + 6][1] = (float)rval;
      bounce[i + 6][0] = (float)pow(xval, pow3);

      bounce[i + 8][0] = (rind(0.5, &rndseed) + 0.5) / 2.0 + x;
      bounce[i + 10][0] = (rind(0.5, &rndseed) + 0.5) / 2.0 + x;
      bounce[i + 8][1] = bounce[i + 10][1] = 0.0;

      bounce[NTAPS - 1][i] = source[i];
   }

   for (i = 0; i < 4; i++) {
      bounce[i][0] *= (0.5 * dim[0]);
      bounce[i][1] *= dim[1];
      bounce[i + 4][0] = (1.0 - bounce[i + 4][0] * 0.5) * dim[0];
      bounce[i + 4][1] *= dim[1];
   }
   for (i = 8; i < 10; i++) {
      bounce[i][0] *= 0.5 * dim[0];
      bounce[i + 2][0] = (1.0 - bounce[i + 2][0] * 0.5) * dim[0];
   }

   xlist[0] = 0.5 * dim[0];
   xlist[1] = 0.0;
   bounce[NTAPS - 1][0] = source[0];
   bounce[NTAPS - 1][1] = source[1];

   xxx = 0;
   for (i = 0; i < NTAPS; i++) {
      float d, s, a;
      specs(source, &bounce[i][0], xlist, dec, &d, &s, &a);
      delay[i] = d;
      sloc[i] = s;
      amp[i] = a * boost(s);
      xxx += amp[i];
   }
   printf(" x-loc   y-loc   delay    sloc     amp\n");
   for (i = 0; i < NTAPS; i++) {
      amp[i] /= xxx;
      delay[i] -= delay[NTAPS - 1];
      printf("%7.2f %7.2f  %6.5f  %6.5f  %6.5f\n",
             bounce[i][0], bounce[i][1], delay[i], sloc[i], amp[i]);
   }

   return 0;
}
Ejemplo n.º 5
0
void CompilerPass::visit(ObjectComprehension *ast)
{
    fields(ast->fields);
    specs(ast->specs);
    fodder(ast->closeFodder);
}