Example #1
0
bool instruccionAlu::ejecutar(RAM* r) {
  switch (opcode) {
    case ADD:
      r->setAc(r->getAc() + valor(r));
      break;
    case SUB:
      r->setAc(r->getAc() - valor(r));
      break;
    case MUL:
      r->setAc(r->getAc() * valor(r));
      break;
    case DIV:
      r->setAc(r->getAc() / valor(r));
      break;
  }
}
Example #2
0
DataMessage AlanTuring::decodeMessage (NetworkMessage netMsg)
{
	DataMessage dataMsg;
	memcpy(&dataMsg, netMsg.msg_Data, sizeof(DataMessage));

	std::string msgID(dataMsg.msg_ID);

	int pos = msgID.find("$");
	string id(msgID.substr(0, pos));

	msgID.erase(0, pos + 1);

	string valor(msgID);

	memcpy(dataMsg.msg_ID, id.c_str(), MESSAGE_ID_BYTES_LIMIT);
	memcpy(dataMsg.msg_value, valor.c_str(), MESSAGE_VALUE_SIZE);

	return dataMsg;
}
Example #3
0
void GNC::GUI::AnonymizePanel::GetTagsAnonymized(GIL::DICOM::DicomDataset & base)
{
        base.tags.clear();
        GNC::GCS::IConfigurationController::TListGroups configGroups;
        for (wxPropertyGridIterator it = m_pTagsList->GetIterator(); ! it.AtEnd(); ++it) {
                wxPGProperty* prop = it.GetProperty();
                if(prop->GetFlags() & wxPG_PROP_MODIFIED) {
                        std::string clave(prop->GetHelpString().ToUTF8());
                        std::string valor(prop->GetValueAsString().ToUTF8());
                        base.tags[clave] = valor;

                        GNC::GCS::IConfigurationController::TMapValues group;
                        group["tag"] = clave;
                        group["value"] = valor;
                        configGroups.push_back(group);
                }
        }
        GNC::GCS::IConfigurationController::Instance()->writeGroupUser("/Core/AnonymizationSelection", configGroups);
}
char* iniciar(int argc, const char **argv){ 
    if(argc < 12){
        return "faltan parámetros";
    }
    filtro = filtro_gestos_crear();   

    filtro_gestos_set_color(filtro,
            valor("orden_superior_rojo", argc, argv),
            valor("orden_inferior_rojo", argc, argv),
            valor("orden_superior_verde", argc, argv),
            valor("orden_inferior_verde", argc, argv),
            valor("orden_superior_azul", argc, argv),
            valor("orden_inferior_azul", argc, argv),
            valor("param_superior_rojo", argc, argv),
            valor("param_inferior_rojo", argc, argv),
            valor("param_superior_verde", argc, argv),
            valor("param_inferior_verde", argc, argv),
            valor("param_superior_azul", argc, argv),
            valor("param_inferior_azul", argc, argv));
  return "iniciado";
}
Example #5
0
int main()
  {
    char acao;
    num_matriz k, k1, k2, k3;
    int m, n, i, j;
    float x;
    matriz a[num_nomes];

    while (true)
      { 
        scanf("%c", &acao);
        printf("ação: %c", acao);
        switch (acao)
          { 
            case 'r': 
              le_nome(&k); prox_linha();
              printf(" %c\n", min_nome+k);
              le_matriz(&a[k]);
              break;
            case 'z': 
              le_nome(&k); scanf("%d %d", &m, &n); prox_linha();
              printf(" %c %d %d\n", min_nome+k, m, n);
              inicializa(&a[k], m, n);
              break;
            case 'v': 
              le_nome(&k); scanf("%d %d", &i, &j); prox_linha();
              printf(" %c %d %d\n", min_nome+k, i, j);
              printf("  %c[%d,%d] = %8.2f\n", min_nome+k, i, j, valor(&(a[k]), i, j));
              break;
            case 'a':
              le_nome(&k); scanf("%d %d %f", &i, &j, &x); prox_linha();
              printf(" %c %2d %2d %8.2f\n", min_nome+k, i, j, x);
              atribui(&a[k], i, j, x);
              break;
            case 's':
              le_nome(&k1); le_nome(&k2); le_nome(&k3); prox_linha();
              printf(" %c %c %c\n", min_nome+k1, min_nome+k2, min_nome+k3);
              soma(&a[k1], &a[k2], &a[k3]);
              break;
            case 'm':
              le_nome(&k1); le_nome(&k2); le_nome(&k3); prox_linha();
              printf(" %c %c %c\n", min_nome+k1, min_nome+k2, min_nome+k3);
              multiplica(&a[k1], &a[k2], &a[k3]);
              break;
            case 't':
              le_nome(&k1); le_nome(&k2); prox_linha();
              printf(" %c %c\n", min_nome+k1, min_nome+k2);
              transpoe(&a[k1], &a[k2]);
              break;
            case 'w':
              le_nome(&k); prox_linha();
              printf(" %c\n", min_nome+k);
              imprime_matriz(&a[k]);
              break;
            case 'x':
              printf("\n");
	      bapply(bprint);
              printf("fim da execução.\n");
              exit(0);
              break;
            case '#':
              { int c;
                do 
                  { c = getchar(); putchar(c); } 
                while ((c != '\n') && (c != EOF));
              }
              break;
  	   case 'l':
	     le_nome(&k); prox_linha();
             printf(" %c\n", min_nome+k);
             libera(&a[k]);
             break;
            default:
              { erro("ação inválida"); }
          } /* switch */
      } /* while */

   bapply(bprint);

   return 0;
  } /* main */