Esempio n. 1
0
void
PutPsFile(void)
{
    Prologue();
    Variables();

    CurvesInit();

    DoTitleAndBox();

    if (multipageflag) {
      Key(); // print multi-page key even if there are more than 20 bands 
      NextPage();
    }

    Axes();

    if (!multipageflag && (TWENTY != 0)) Key();

    Curves();

    if (!yflag) Marks();

    fprintf(psfp, "showpage\n");
}
Esempio n. 2
0
void SetToDefaultValues(RobotState* state)
{
    for (auto& v : Variables(state->model)) {
        auto position = GetDefaultPosition(state->model, &v);
        SetVariablePosition(state, &v, position);
    }
}
Esempio n. 3
0
void
PutPsFile()
{
    Prologue();
    Variables();
    BorderOutlineBox();

    if (bflag) {
	BigTitleOutlineBox();
        BigTitleText();
    } else {
	TitleOutlineBox();
	TitleText();
    }

    CurvesInit();

    Axes();

    if (TWENTY) Key();

    Curves();

    if (!yflag) Marks();

    fprintf(psfp, "showpage\n");
}
Esempio n. 4
0
File: utils.c Progetto: JMED106/2pop
t_data Arg(char *argv, t_data d) {
  int i = 0;
  char valor[50];
  t_data data;
  data = d;
  if(isdigit(argv[0]))
    return d;
  if(argv[0] == 'S');
  else {
    while(argv[i+2] != '\0') {
      valor[i] = argv[i+2];
      i++;
    }
    valor[i] = '\0';
  }

  if(argv[0] == '-' && argv[1] == 'd') { 
    debug = 1;
    d_level = atoi(valor);
    if(d_level == 0) d_level =1;
    return d;
  }  
  data= Variables(argv[0], valor,d); 
  return data;
}
Esempio n. 5
0
  /**
   * This is the the overriding virtual function that provides the expansion into
   * the parabolic equation.
   * See BasisFunction for more information.
   *
   * @param vars A vector of double values to use for the expansion.
   */
  void Parabola::Expand(const std::vector<double> &vars) {

    if((int) vars.size() != Variables()) {
      std::ostringstream msg;
      msg << "Number of variables given (" << vars.size()
          << ") does not match expected (" << Variables() << ")!"
          << std::ends;
//      std::cout << msg.str << std::endl;
//      throw Isis::iException::Message("Isis::iException::Programmer",msg.str,
//        _FILEINFO_);
    }
    p_terms.clear();
    p_terms.push_back(1.0);
    p_terms.push_back(vars[0]);
    p_terms.push_back(vars[0] * vars[0]);
    return;
  }
Esempio n. 6
0
double define_name(string var, double val)
//adds variable name var, value val to the table
{
    //if variable already on the table (if is_declared() returns true)
    if(is_declared(var)) error(var, " declared twice");

    variablesTable.push_back(Variables(var, val));
    return val;
}
 Testee(fun::FUN* fun) :
     MyFUInterface(Variables()),
     CommandTypeSpecifier<>(fun),
     HasReceptor<>(),
     HasConnector<>(),
     HasDeliverer<>(),
     Cloneable<Testee>()
 {
     changeState(createState<ReadyForTransmission>());
 }
Esempio n. 8
0
task usercontrol(){
	bLCDBacklight = true;
	clearLCDLine(0);
	clearLCDLine(1);
	while (true)
	{
		Variables();
		Control();
	}
}
Esempio n. 9
0
void Declarations() {

  while(strchr("lctvpf", Look)) {
    switch(Look) {
      case 'l': Labels();
      case 'c': Constants();
      case 't': Types();
      case 'v': Variables();
      case 'p': DoProcedure();
      case 'f': DoFunction();
    }
  }
}
Esempio n. 10
0
void Declarations(){
    int other = 0;
    while(!other){
        switch(Look){
            case 'l' : Labels(); break;
            case 'c' : Constants(); break;
            case 't' : Types(); break;
            case 'v' : Variables(); break;
            case 'p' : DoProcedure(); break;
            case 'f' : DoFunction(); break;
            default : other = 1;
        }
    }
}
Esempio n. 11
0
boost::optional<Document> DocumentSourceRedact::getNext() {
    while (boost::optional<Document> in = pSource->getNext()) {
        Variables vars = Variables(*in,
                                   Value(*in),
                                   DOC("DESCEND" << descendVal
                                       << "PRUNE" << pruneVal
                                       << "KEEP" << keepVal));

        if (boost::optional<Document> result = redactObject(vars)) {
            return result;
        }
    }

    return boost::none;
}
Esempio n. 12
0
boost::optional<Document> DocumentSourceProject::getNext() {
    pExpCtx->checkForInterrupt();

    boost::optional<Document> input = pSource->getNext();
    if (!input)
        return boost::none;

    /* create the result document */
    const size_t sizeHint = pEO->getSizeHint();
    MutableDocument out (sizeHint);

    /*
      Use the ExpressionObject to create the base result.

      If we're excluding fields at the top level, leave out the _id if
      it is found, because we took care of it above.
    */
    pEO->addToDocument(out, *input, Variables(*input));

#if defined(_DEBUG)
    if (!_simpleProjection.getSpec().isEmpty()) {
        // Make sure we return the same results as Projection class

        BSONObj inputBson = input->toBson();
        BSONObj outputBson = out.peek().toBson();

        BSONObj projected = _simpleProjection.transform(inputBson);

        if (projected != outputBson) {
            log() << "$project applied incorrectly: " << getRaw() << endl;
            log() << "input:  " << inputBson << endl;
            log() << "out: " << outputBson << endl;
            log() << "projected: " << projected << endl;
            verify(false); // exits in _DEBUG builds
        }
    }
#endif

    return out.freeze();
}
Esempio n. 13
0
Variables ScriptManager::callFunction(const Common::UString &name, const Variables &params) {
	assert(!name.empty());
	assert(_luaState && _regNestingLevel == 0);

	std::vector<Common::UString> parts;
	Common::UString::split(name, '.', parts);
	if (parts.empty()) {
		error("Lua call \"%s\" failed: bad name", name.c_str());
		return Variables();
	}

	const Common::UString funcName = parts.back();
	parts.pop_back();

	if (parts.empty()) {
		return getGlobalFunction(funcName).call(params);
	}

	TableRef table = getGlobalTable(parts[0]);
	for (uint32 i = 1; i < parts.size(); ++i) {
		table = table.getTableAt(parts[i]);
	}
	return table.getFunctionAt(funcName).call(params);
}
Esempio n. 14
0
Variables FunctionRef::call() const {
	return call(Variables());
}
Esempio n. 15
0
 Variables getVariables() const
 {
     return Variables(
         const_cast< System* >( this )->theVariableMap.begin(),
         const_cast< System* >( this )->theVariableMap.end() );
 }
MCGUIComponent::MCGUIComponent(const QString &mcNamespace, const QString &name, Type type, bool parseDataBindings, const MCGUIComponent *base, const QJsonObject &object) :
    mcNamespace(mcNamespace), name(name), type(type) {
    if (base != nullptr) {
        this->base = base;
        ignored = base->ignored;
        bindings = base->bindings;
        variables = base->variables;
        controls = base->controls;
    }
    {
        Variables vars;
        for (auto i = object.begin(); i != object.end(); i++) {
            if (i.key()[0] == '$')
                vars.vars[i.key()] = *i;
        }
        variables.push_back(vars);
    }
    if (object["variables"].isObject()) {
        variables.push_back(Variables(object["variables"].toObject()));
    } else if (object["variables"].isArray()) {
        QJsonArray vars = object["variables"].toArray();
        for (QJsonValue const& v : vars) {
            if (v.isObject())
                variables.push_back(Variables(v.toObject()));
        }
    }
    if (parseDataBindings) {
        for (QJsonValue v : object["bindings"].toArray()) {
            if (!v.isObject())
                continue;

            QJsonObject o = v.toObject();
            MCGUIDataBinding binding;
            binding.name.setJSON(o["binding_name"], "");
            binding.nameOverride.setJSON(o["binding_name_override"], "");
            binding.type.setJSON(o["binding_type"], MCGUIDataBinding::Type::GLOBAL);
            bindings.push_back(binding);
        }
    }
    ignored.setJSON(object, "ignored", bindings);
    if (object["controls"].isArray()) {
        for (QJsonValue v : object["controls"].toArray()) {
            if (!v.isObject())
                continue;

            QJsonObject o = v.toObject();
            for (auto i = o.begin(); i != o.end(); i++) {
                QJsonObject io = i->toObject();
                MCGUIVariableExtendComponent el;
                QString cName = i.key();
                if (!cName.contains("@") && !cName.startsWith("$")) {
                    MCGUIComponent::Type type = MCGUIComponent::getTypeFromString(io["type"].toString(""));
                    el.name = cName;
                    el.component = MCGUIComponent::createComponentOfType(type, mcNamespace, cName, nullptr, io);
                    if (el.component != nullptr)
                        controls.push_back(el);
                    continue;
                }
                el.object = io;
                el.mcNamespace = mcNamespace;
                el.name = cName;
                el.name.variableName = cName;
                controls.push_back(el);
            }
        }
    }
}
Esempio n. 17
0
File: utils.c Progetto: JMED106/2pop
t_data Scan_Data(char *file, t_data d) {
  char c, mesg[100],arg[10], valor[10],aux[100];
  FILE *fin;
  int lines = 0, *linea_vacia,  i = 0, j = 0, error = 0;
  t_data data;  
  data = d;
  linea_vacia = (int*) calloc (1, sizeof(int));
  
  printf("\nOpening data file %s ...............",file);
  if ((fin = fopen (file, "r")) == NULL) {			/* Abrimos el archivo de datos */
    printf(" FAILED\n");
    fprintf (stderr, "\nERROR: File ’%s’ does not exist or it can't be read......... TERMINATED\n\n", file);
    exit(1);
  }
  else
    printf(" OK\n");

  printf("Reading data file %s ...............",file);
  fflush(stdin);
  fflush(stdout);

  while((c = getc(fin)) != EOF) { /* Leemos el archivo de datos */
    if(c == '#'){ /* Si se detecta una # como primer carácter de línea... */
      linea_vacia[lines] = 1;
      DEBUG3("Comentario Encontrado");
    }
    if(c == '\n') {
      DEBUG3("Línea encontrada");
      lines++;
      linea_vacia = (int*) realloc (linea_vacia,(lines+1)*sizeof(int));
      linea_vacia[lines] = 0;
    }
  }
  rewind(fin);
  for(j = 0; j < lines; j++) {
    sprintf(mesg,"línea %d: vacía: %d ",j,linea_vacia[j] );
    DEBUG3(mesg);
    if(linea_vacia[j] == 0)  {
      DEBUG("Escaneando línea");
      fscanf(fin,"%s\n",arg);
      if(isdigit(arg[0])) {
	printf("\nERROR de lectura: la línea %d tiene formato incorrecto\n",lines);
	error = 1;
      }
      else {
	i = 0;
	while(arg[i+2] != '\0') {
	  valor[i] = arg[i+2];
	  i++;
	}
	valor[i] = '\0';
	sprintf(mesg,"Valor de %c = %s",arg[0],valor);
	DEBUG(mesg);
	sprintf(mesg,"Valor de %c = %lf (convertido)\n",arg[0],atof(valor));
	DEBUG(mesg);
      }
      data = Variables(arg[0],valor, d);
      sprintf(mesg,"data.init_dist = %d\t data.vr = %lf ",data.init_dist,data.vr );
  DEBUG(mesg);
      d = data;
sprintf(mesg,"data.init_dist = %d\t data.vr = %lf ",data.init_dist,data.vr );
 DEBUG(mesg);
    } else {
       fscanf(fin," %[^\n]s",aux);
    }
  }
  
  fclose(fin);
  if(error == 0) printf(" OK\n");
  else		 printf(" ERROR\n");

  sprintf(mesg,"data.vr = %lf ",data.vr );
  DEBUG(mesg);

  return data;
}
Esempio n. 18
0
Variables ScriptManager::callFunction(const Common::UString &name) {
	return callFunction(name, Variables());
}