Ejemplo n.º 1
0
void DeploymentDiagramView::read(char * st, char * k) {
  UmlCanvas * canvas = the_canvas();
  
  // reads first deploymentnode component icons text notes and image
  while (DeploymentNodeCanvas::read(st, canvas, k) ||
	 // reads artifact before component to manage component -> artifact
	 ArtifactCanvas::read(st, canvas, k) ||
	 ComponentCanvas::read(st, canvas, k) ||
	 HubCanvas::read(st, canvas, k) ||
	 NoteCanvas::read(st, canvas, k) ||
	 TextCanvas::read(st, canvas, k) ||
	 IconCanvas::read(st, canvas, k) ||
	 PackageCanvas::read(st, canvas, k) ||
	 FragmentCanvas::read(st, canvas, k) ||
	 ImageCanvas::read(st, canvas, k))
    k = read_keyword(st);
  
  // then reads relations and anchors
  while (ArrowCanvas::read(st, canvas, k) ||
	 AssocContainCanvas::read(st, canvas, k) ||
	 SimpleRelationCanvas::read(st, canvas, k))
    k = read_keyword(st);
  
  if (!strcmp(k, "preferred_whz") || !strcmp(k, "prefered_whz")) {
    preferred_size.setWidth(read_unsigned(st));
    preferred_size.setHeight(read_unsigned(st));
    preferred_zoom = read_double(st);
    k = read_keyword(st);
  }
  
  if (strcmp(k, "end"))
    wrong_keyword(k, "end");
}
Ejemplo n.º 2
0
void ObjectDiagramView::read(char * st, char * k) {
  UmlCanvas * canvas = the_canvas();
  
  // reads first the instances, package, fragment notes, icons text and image
  while (OdClassInstCanvas::read(st, canvas, k) ||
	 NoteCanvas::read(st, canvas, k) ||
	 TextCanvas::read(st, canvas, k) ||
	 IconCanvas::read(st, canvas, k) ||
	 PackageCanvas::read(st, canvas, k) ||
	 FragmentCanvas::read(st, canvas, k) ||
	 ImageCanvas::read(st, canvas, k))
    k = read_keyword(st);
  
  // then reads links 
  while (ObjectLinkCanvas::read(st, canvas, k))
    k = read_keyword(st);
  
  // then reads anchors
  while (ArrowCanvas::read(st, canvas, k))
    k = read_keyword(st);
  
  if (!strcmp(k, "preferred_whz") || !strcmp(k, "prefered_whz")) {
    preferred_size.setWidth(read_unsigned(st));
    preferred_size.setHeight(read_unsigned(st));
    preferred_zoom = read_double(st);
    k = read_keyword(st);
  }
  
  if (strcmp(k, "end"))
    wrong_keyword(k, "end");
}
Ejemplo n.º 3
0
void ClassDiagramView::read(char * st, char * k) {
  UmlCanvas * canvas = the_canvas();
  
  // reads first the classes package icons text notes and images
  while (CdClassCanvas::read(st, canvas, k) ||
	 NoteCanvas::read(st, canvas, k) ||
	 TextCanvas::read(st, canvas, k) ||
	 IconCanvas::read(st, canvas, k) ||
	 PackageCanvas::read(st, canvas, k) ||
	 FragmentCanvas::read(st, canvas, k) ||
	 ImageCanvas::read(st, canvas, k))
    k = read_keyword(st);
  
  // then reads relations and anchors
  while (ArrowCanvas::read(st, canvas, k) ||
	 RelationCanvas::read(st, canvas, k) ||
	 SimpleRelationCanvas::read(st, canvas, k))
    k = read_keyword(st);
  
  if (!strcmp(k, "preferred_whz") || !strcmp(k, "prefered_whz")) {
    preferred_size.setWidth(read_unsigned(st));
    preferred_size.setHeight(read_unsigned(st));
    preferred_zoom = read_double(st);
    k = read_keyword(st);
  }
  
  if (strcmp(k, "end"))
    wrong_keyword(k, "end");
}
Ejemplo n.º 4
0
void ComponentDiagramView::read(char * st, char * k) {
  UmlCanvas * canvas = the_canvas();
  
  // reads first component package icons notes junctions text and images
  while (ComponentCanvas::read(st, canvas, k) ||
	 NoteCanvas::read(st, canvas, k) ||
	 TextCanvas::read(st, canvas, k) ||
	 IconCanvas::read(st, canvas, k) ||
	 PackageCanvas::read(st, canvas, k) ||
	 FragmentCanvas::read(st, canvas, k) ||
	 ArrowJunctionCanvas::read(st, canvas, k) ||
	 ImageCanvas::read(st, canvas, k))
    k = read_keyword(st);
  
  // then reads relations and anchors
  ArrowCanvas * a;
  
  while (((a = ArrowCanvas::read(st, canvas, k)) != 0) ||
	 ((a = SimpleRelationCanvas::read(st, canvas, k)) != 0)) {
    a->get_start()->check_line(a);
    k = read_keyword(st);
  }
  
  if (!strcmp(k, "preferred_whz") || !strcmp(k, "prefered_whz")) {
    preferred_size.setWidth(read_unsigned(st));
    preferred_size.setHeight(read_unsigned(st));
    preferred_zoom = read_double(st);
    k = read_keyword(st);
  }
  
  if (strcmp(k, "end"))
    wrong_keyword(k, "end");
}
gcov_type gooda::gcov_file::read_counter(){
    int low = read_unsigned();
    int high = read_unsigned();
    gcov_type value = static_cast<gcov_type>(low) + (static_cast<gcov_type>(high) << 32);

    log::emit<log::Trace>() << "Read counter \"" << value << "\"" << log::endl;

    return value;
}
static enum RPC_ERR_CODE sip_fin_handler(brpc_t *brpc_req, AmSipReply &amRpl)
{
  const static size_t FMT_LEAD_LEN =
    /*`!'*/1 + 
    /*`.'*/1 + 
    /*AS'es + SER's opaque*/2;
  char fmt[FMT_LEAD_LEN + sizeof(FIN_FMTS)/sizeof(brpc_str_t *) + /*0-term*/1];
  string opaque, code_str, cseq_str;
  string *strRef[] = {
    &amRpl.serKey,
    &opaque,
    &code_str,
    &amRpl.reason,
    &amRpl.next_request_uri,
    &amRpl.route,
    &amRpl.local_tag,
    &amRpl.remote_tag,
    &cseq_str,
    &amRpl.content_type,
    &amRpl.hdrs,
    &amRpl.body
  };
  brpc_str_t *cstr_refs[sizeof(strRef)/sizeof(string *)];

  memset(fmt, 's', sizeof(fmt)/sizeof(char));
  fmt[0] = '!';
  fmt[1] = '.'; // discriminator had already been fetched by now
  fmt[sizeof(fmt)/sizeof(char) - 1] = 0;

  if (! brpc_dsm(brpc_req, fmt, cstr_refs)) {
    ERROR("failed to disassemble RPC message: %s [%d].\n", brpc_strerror(),
        brpc_errno);
    return CODE_RPC_INVALID;
  }

  for (unsigned i = 0; i < sizeof(strRef)/sizeof(string *); i ++) {
    if (cstr_refs[i])
      strRef[i]->assign(cstr_refs[i]->val, cstr_refs[i]->len - /*no 0-term*/1);
    DBG("#%u: `%.*s'\n", i, (int)strRef[i]->length(), strRef[i]->c_str());
  }

  enum RPC_ERR_CODE errcode;
  if ((errcode = read_unsigned(cseq_str, amRpl.cseq)) != CODE_RPC_SUCCESS) {
    ERROR("failed to read CSeq digest value.\n");
    return errcode;
  }
  if ((errcode = read_unsigned(code_str, amRpl.code)) != CODE_RPC_SUCCESS) {
    ERROR("failed to read code digest value.\n");
    return errcode;
  }

  return CODE_RPC_SUCCESS;
}
Ejemplo n.º 7
0
void DiagramWindow::read_session(char * & st) {






  unsigned w = read_unsigned(st);
	
  resize(w, read_unsigned(st));

  new_scale(read_unsigned(st));
  get_view()->read_session(st);
}
/**
 * All SER invoked RPCs have three leading values (besides requested by the
 * digest specifiers), as follows:
 * #1: discriminator (request, final, provisional reply);
 * #2: SER's opaque; must be read from SIP requests and returned in SIP
 * replies;
 * #3: AS's opaque; own opaque only makes sense for SIP replies;
 */
static enum RPC_ERR_CODE sip_req_handler(brpc_t *brpc_req, AmSipRequest &amReq)
{
  const static size_t FMT_LEAD_LEN = 
    /*`!'*/1 + 
    /* `.' x2 */2 + 
    /*SER's TID*/1;
  char fmt[FMT_LEAD_LEN + sizeof(REQ_FMTS)/sizeof(brpc_str_t *) + /*0-term*/1];
  string cseq_str;
  string *strRef[] = {
    &amReq.serKey,
    &amReq.method,
    &amReq.user,
    &amReq.domain,
    &amReq.dstip,
    &amReq.port,
    &amReq.r_uri,
    &amReq.from_uri,
    &amReq.from,
    &amReq.to,
    &amReq.callid,
    &amReq.from_tag,
    &amReq.to_tag,
    &cseq_str,
    &amReq.route,
    &amReq.content_type,
    &amReq.body,
    &amReq.cmd,
    &amReq.hdrs
  };
  brpc_str_t *cstr_refs[sizeof(strRef)/sizeof(string *)];

  assert(sizeof(strRef)/sizeof(string *) - /*implicit TID*/1 == 
    sizeof(REQ_FMTS)/sizeof(brpc_str_t *));

  memset(fmt, 's', sizeof(fmt)/sizeof(char) - 1);
  fmt[0] = '!'; /* lay the refs in array */
  fmt[1] = '.'; /* ignore discriminator (had been already read by now) */
  /* 2nd pos: SER's opaque (TID); makes sense only for non-ACK methods*/
  fmt[3] = '.'; /* ignore AS opaque for requests */
  fmt[sizeof(fmt)/sizeof(char) - 1] = 0;

  if (! brpc_dsm(brpc_req, fmt, cstr_refs)) {
    ERROR("failed to disassemble RPC message: %s [%d].\n", brpc_strerror(),
        brpc_errno);
    return CODE_RPC_INVALID;
  }

  for (unsigned i = 0; i < sizeof(strRef)/sizeof(string *); i ++) {
    if (cstr_refs[i])
      strRef[i]->assign(cstr_refs[i]->val, cstr_refs[i]->len - /*no 0-term*/1);
    DBG("#%u: `%s'\n", i, strRef[i]->c_str());
  }

  enum RPC_ERR_CODE errcode;
  if ((errcode = read_unsigned(cseq_str, amReq.cseq)) != CODE_RPC_SUCCESS) {
    ERROR("failed to read CSeq value.\n");
    return errcode;
  }
  return CODE_RPC_SUCCESS;
}
Ejemplo n.º 9
0
void Tool::read(char * & st, char * & k)
{
  if (!strcmp(k, "tools_number")) {
    // old format
    set_ntools(read_unsigned(st));
    read(st, k, FALSE);
  }
  else
    set_ntools(0);
}
Ejemplo n.º 10
0
void ActivityDiagramView::read(char * st, char * k)
{
    // reads first state package icons notes text and image
    UmlCanvas * canvas = the_canvas();

    while (ActivityCanvas::read(st, canvas, k) ||
           InterruptibleActivityRegionCanvas::read(st, canvas, k) ||
           ExpansionRegionCanvas::read(st, canvas, k) ||
           ActivityPartitionCanvas::read(st, canvas, k) ||
           ActivityActionCanvas::read(st, canvas, k) ||
           ActivityObjectCanvas::read(st, canvas, k) ||
           ActivityNodeCanvas::read(st, canvas, k) ||
           NoteCanvas::read(st, canvas, k) ||
           TextCanvas::read(st, canvas, k) ||
           IconCanvas::read(st, canvas, k) ||
           PackageCanvas::read(st, canvas, k) ||
           FragmentCanvas::read(st, canvas, k) ||
           ImageCanvas::read(st, canvas, k))
        k = read_keyword(st);

    // then reads relations and anchors
    ArrowCanvas * a;

    while (((a = ArrowCanvas::read(st, canvas, k)) != 0) ||
           ((a = FlowCanvas::read(st, canvas, k)) != 0) ||
           ((a = SimpleRelationCanvas::read(st, canvas, k)) != 0)) {
        a->get_start()->check_line(a);
        k = read_keyword(st);
    }

    if (!strcmp(k, "preferred_whz") || !strcmp(k, "prefered_whz")) {
        preferred_size.setWidth(read_unsigned(st));
        preferred_size.setHeight(read_unsigned(st));
        preferred_zoom = read_double(st);
        k = read_keyword(st);
    }

    if (strcmp(k, "end"))
        wrong_keyword(k, "end");
}
Ejemplo n.º 11
0
void SeqDiagramView::read(char * st, char * k)
{
    UmlCanvas * canvas = the_canvas();
    // reads first the actors, classes instances, notes, icons text and images
    while (NoteCanvas::read(st, canvas, k) ||
           TextCanvas::read(st, canvas, k) ||
           IconCanvas::read(st, canvas, k) ||
           FragmentCanvas::read(st, canvas, k) ||
           SdClassInstCanvas::read(st, canvas, k) ||
           SdContinuationCanvas::read(st, canvas, k) ||
           ImageCanvas::read(st, canvas, k))
        k = read_keyword(st);

    // then reads durations
    while (SdDurationCanvas::read(st, canvas, k))
        k = read_keyword(st);

    // then reads lost/found start/end
    while (SdLostFoundMsgSupportCanvas::read(st, canvas, k))
        k = read_keyword(st);

    // then reads msgs
    while (SdMsgCanvas::read(st, canvas, k) ||
           SdSelfMsgCanvas::read(st, canvas, k))
        k = read_keyword(st);
    // then reads anchors
    while (ArrowCanvas::read(st, canvas, k))
        k = read_keyword(st);

    if (!strcmp(k, "preferred_whz") || !strcmp(k, "prefered_whz")) {
        preferred_size.setWidth(read_unsigned(st));
        preferred_size.setHeight(read_unsigned(st));
        preferred_zoom = read_double(st);
        k = read_keyword(st);
    }

    if (strcmp(k, "end"))
        wrong_keyword(k, "end");
}
Ejemplo n.º 12
0
void UmlCom::read_item_list(QVector<UmlItem> & v)
{
  unsigned n = read_unsigned();
  
  v.resize(n);
  
#ifdef TRACE
  //cout << "UmlCom::read_item_list " << n << " items\n";
#endif
  
  for (unsigned index = 0; index != n; index += 1)
    v.insert(index, UmlBaseItem::read_());
}
Ejemplo n.º 13
0
void ColMsg::read(char * & st, ColMsgList & l, UmlCanvas * canvas) {
  char * k = read_keyword(st);
    
  do {
    const OperationData * method = 0;
    QString expl;
    
    if (!strcmp(k, "msg")) {
      if ((method = OperationData::read_ref(st)) == 0)
	expl = "<deleted operation>";
    }
    else if (!strcmp(k, "explicitmsg"))
      expl = read_string(st);
    else
      return;
    
    bool forward = FALSE;
    
    k = read_keyword(st);
    
    if (!strcmp(k, "forward"))
      forward = TRUE;
    else if (!strcmp(k, "backward"))
      forward = FALSE;
    else
      wrong_keyword(k, "forward/backward");
    
    read_keyword(st, "ranks");
    unsigned abs = read_unsigned(st);
    QString hi = read_string(st);
    CodMsgSupport * in;
    
    k = read_keyword(st);
    if ((in = CodSelfLinkCanvas::read(st, canvas, k)) == 0)
      in = CodDirsCanvas::read(st, canvas, k);
    
    ColMsg * cm = new ColMsg(forward, method, expl, hi, in);		 
    
    cm->absolute_rank = abs;
    l.append(cm);
    in->get_msgs().append(cm);
    
    k = read_keyword(st);
    if (!strcmp(k, "msgs"))
      read(st, cm->msgs, canvas);
    else if (strcmp(k, "no_msg"))
      wrong_keyword(k, "msgs/no_msg");
    
    k = read_keyword(st);
  } while (strcmp(k, "msgsend"));
}
std::string gooda::gcov_file::read_string(){
    auto alloc = read_unsigned();

    char* buffer = new char[alloc * 4];

    gcov_file_r.read(buffer, alloc * 4);

    std::string value(buffer);

    delete[] buffer;

    log::emit<log::Trace>() << "Read string \"" << value << "\"" << log::endl;

    return value;
}
Ejemplo n.º 15
0
void HaveKeyValueData::read(char * & st, char * & k) {
  if (!strcmp(k, "ncouples")) {
    set_n_keys(read_unsigned(st));
    
    for (unsigned i = 0; i != nkeyvalues; i += 1) {
      read_keyword(st, "key");
      keyvalues[i].set_key(read_string(st));
      read_keyword(st, "value");
      keyvalues[i].set_value(read_string(st));
    }
    
    k = read_keyword(st);
  }
  else
    set_n_keys(0);
}
Ejemplo n.º 16
0
static int wf1_read_history (FILE *fp, unsigned pos, 
			     DATASET *dset, int i)
{
    char *htxt;
    unsigned hpos;
    int len, err = 0;

#if EVDEBUG
    fseek(fp, pos, SEEK_SET);
    fprintf(stderr, "first short: %d\n", read_short(fp, &err));
#endif

    fseek(fp, pos + 2, SEEK_SET);
    len = read_int(fp, &err);
    if (err) {
	return 1;
    }

#if EVDEBUG
    fprintf(stderr, "history length: %d\n", len);
    fprintf(stderr, "next int: %d\n", read_int(fp, &err));
#endif

    fseek(fp, pos + 10, SEEK_SET);
    hpos = read_unsigned(fp, &err);
    if (err) {
	return 1;
    }  

    htxt = calloc(len + 1, 1);
    if (htxt != NULL) {
	fseek(fp, hpos, SEEK_SET);
	if (fread(htxt, 1, len, fp) == len) {
	    series_set_label(dset, i, htxt);
	}
	free(htxt);
    }

    return 0;
}
Ejemplo n.º 17
0
static int parse_wf1_header (FILE *fp, int ftype, DATASET *dset, 
			     unsigned *offset)
{
    int nvars = 0, nobs = 0, startyr = 0;
    short pd = 0, startper = 0;
    unsigned off;
    int err = 0;

    fseek(fp, 80, SEEK_SET);
    off = read_unsigned(fp, &err);
    *offset = off + 26;

    fseek(fp, 114, SEEK_SET);
    nvars = read_int(fp, &err);

    fseek(fp, 124, SEEK_SET);
    pd = read_short(fp, &err);

    fseek(fp, 128, SEEK_SET);
    startyr = read_int(fp, &err);

    fseek(fp, 132, SEEK_SET);
    startper = read_short(fp, &err);

    fseek(fp, 140, SEEK_SET);
    nobs = read_int(fp, &err);

#if EVDEBUG > 1
    analyse_mystery_vals(fp);
#endif

    if (pd == 1) {
	startper = 0;
    }

    if (nvars <= 2 || nobs <= 0 || startyr < 0 ||
	pd <= 0 || startper < 0) {
	err = E_DATA;
	fprintf(stderr, "header info:\n"
		" nvars = %d\n"
		" nobs = %d\n"
		" pd = %d\n"
		" starting year or major = %d\n"
		" starting sub-period or minor = %d\n",
		nvars, nobs, (int) pd,
		startyr, (int) startper);
    } else {
	dset->v = nvars - 2; /* skip C and RESID */
	dset->n = nobs;
	dset->pd = pd;

	fprintf(stderr, "header info:\n"
		" number of variables = %d\n"
		" number of observations = %d\n"
		" data frequency = %d\n"
		" starting year or major = %d\n"
		" starting sub-period or minor = %d\n",
		dset->v, dset->n, dset->pd,
		startyr, (int) startper);
    }

    if (!err) {
	if (startper > 0) {
	    int p10 = log(pd) / log(10.0);

	    if (p10 > 0) {
		char fmt[16];

		sprintf(fmt, "%%d:%%0%dd", p10 + 1);
		sprintf(dset->stobs, fmt, startyr, startper);
	    } else {
		sprintf(dset->stobs, "%d:%d", startyr, startper);
	    }
	} else {
	    sprintf(dset->stobs, "%d", startyr);
	}

	if (dset->pd > 1 || startyr > 10) {
	    dset->structure = TIME_SERIES;
	}

	dset->sd0 = get_date_x(dset->pd, dset->stobs);
	ntodate(dset->endobs, dset->n - 1, dset);
    }

    return err;
}
Ejemplo n.º 18
0
void ClassData::read(char * & st, char * & k) {
  if (!strcmp(k, "abstract")) {
    is_abstract = TRUE;
    k = read_keyword(st);
  }
  else
    is_abstract = FALSE;
  
  if (!strcmp(k, "active")) {
    is_active = TRUE;
    k = read_keyword(st);
  }
  else
    is_active = FALSE;
  
  if (!strcmp(k, "visibility")) {
    uml_visibility = ::visibility(read_keyword(st));  
    k = read_keyword(st);
  }
  else {
    // old non nested class
    uml_visibility = UmlPackageVisibility;
  }
  
  if (!strcmp(k, "stereotype")) {
    set_stereotype(read_string(st));
    
    if (!strcmp(stereotype, "typedef")) {
      AType t;
      
      t.read(st, "base_type", "explicit_base_type");
      set_base_type(t);
    }
    
    k = read_keyword(st);
  }
  
  unsigned n, i;
  
  if (!strcmp(k, "nformals")) {
    n = read_unsigned(st);
    set_n_formalparams(n);
    
    for (i = 0; i != n; i += 1)
      formals[i].read(st);
    
    k = read_keyword(st);
  }
  else
    set_n_formalparams(0);

  if (!strcmp(k, "nactuals")) {
    n = read_unsigned(st);
    
    BrowserClass * cl = 0;

    for (i = 0; i != n; i += 1) {
      ActualParamData * actual = ActualParamData::read(st);

      actuals.append(actual);
      
      if (actual->get_class() != cl) {
	cl = actual->get_class();
	connect(cl->get_data(), SIGNAL(deleted()),
		this, SLOT(update_actuals()));
	connect(cl->get_data(), SIGNAL(changed()),
		this, SLOT(update_actuals()));
      }
    }

    k = read_keyword(st);
  }
  else {
    n = 0;
    actuals.clear();
  }
  
  if (!strcmp(k, "constraint")) {
    constraint = read_string(st);
    k = read_keyword(st);
  }
  else
    constraint = QString::null;
  
  if (!strcmp(k, "cpp_external")) {
    cpp_external = TRUE;
    k = read_keyword(st);
  }
  else
    cpp_external = FALSE;
  
  if (!strcmp(k, "cpp_visibility")) {
    cpp_visibility = ::visibility(read_keyword(st));
    k = read_keyword(st);
  }
  else
    cpp_visibility = UmlDefaultVisibility;

  if (!strcmp(k, "cpp_decl")) {
    cpp_decl = read_string(st);
    k = read_keyword(st);
  }
  else
    wrong_keyword(k, "cpp_decl");
  
  if (!strcmp(k, "java_external")) {
    java_external = TRUE;
    k = read_keyword(st);
  }
  else
    java_external = FALSE;
  
  if (read_file_format() <= 33) {
    // old file
    if ((cpp_visibility == UmlDefaultVisibility) &&
	(uml_visibility != UmlPublic) && 
	(uml_visibility != UmlPackageVisibility))
      cpp_visibility = uml_visibility;
    
    if (!strcmp(k, "public")) {
      uml_visibility = UmlPublic;
      k = read_keyword(st);
    }
    else
      uml_visibility = UmlPackageVisibility;
  }
  
  if (!strcmp(k, "final")) {
    java_final = TRUE;
    k = read_keyword(st);
  }
  else
    java_final = FALSE;
  
  if (!strcmp(k, "java_decl")) {
    java_decl = read_string(st);
    k = read_keyword(st);
  }
  else
    wrong_keyword(k, "java_decl");
  
  if (!strcmp(k, "java_annotation")) {
    java_annotation = read_string(st);
    k = read_keyword(st);
  }
  else
    java_annotation = QString::null;
  
  if (!strcmp(k, "php_external")) {
    php_external = TRUE;
    k = read_keyword(st);
  }
  else
    php_external = FALSE;
  
  if (!strcmp(k, "php_final")) {
    php_final = TRUE;
    k = read_keyword(st);
  }
  else
    php_final = FALSE;
  
  if (!strcmp(k, "php_decl")) {
    php_decl = read_string(st);
    k = read_keyword(st);
  }
  else if (read_file_format() >= 44)
    wrong_keyword(k, "php_decl");
  else
    php_decl = "";
  
  if (!strcmp(k, "python_external")) {
    python_external = TRUE;
    k = read_keyword(st);
  }
  else
    python_external = FALSE;
  
  if (!strcmp(k, "python_2_2")) {
    python_2_2 = TRUE;
    k = read_keyword(st);
  }
  else
    python_2_2 = (read_file_format() < 51);
  
  if (!strcmp(k, "python_decl")) {
    python_decl = read_string(st);
    k = read_keyword(st);
  }
  else if (read_file_format() >= 51)
    wrong_keyword(k, "python_decl");
  else
    python_decl = "";
  
  if (!strcmp(k, "idl_external")) {
    idl_external = TRUE;
    k = read_keyword(st);
  }
  else
    idl_external = FALSE;
  
  if (!strcmp(k, "local")) {
    idl_local = TRUE;
    k = read_keyword(st);
  }
  else
    idl_local = FALSE;
  
  if (!strcmp(k, "custom")) {
    idl_custom = TRUE;
    k = read_keyword(st);
  }
  else
    idl_custom = FALSE;
  
  if (!strcmp(k, "idl_decl")) {
    idl_decl = read_string(st);
    k = read_keyword(st);
  }
  else
    wrong_keyword(k, "idl_decl");
  
  AType t;
  
  t.read(st, "switch_type", "explicit_switch_type", k);
  set_switch_type(t);
  
  k = read_keyword(st);
}
Ejemplo n.º 19
0
static int read_wf1_variables (FILE *fp, int ftype, unsigned pos, 
			       DATASET *dset, int *nvread, 
			       PRN *prn)
{
    int nv = dset->v + 1; /* allow for "RESID" */
    char vname[32];
    short code = 0;
    unsigned u, sz;
    int i, k, j = 0;
    int obj = 1;
    int err = 0;

    fseek(fp, pos + 62, SEEK_SET);
    code = read_short(fp, &err);
    if (code == 0) {
	fprintf(stderr, "Did not get sensible code: skipping 32 bytes\n");
	pos += 32;
    }

    for (i=0; i<nv && !err; i++, pos += 70) {
	int discard = 0;

	/* read the 'code' for the 'object' (should be 44 for a regular
	   variable?) */
	fseek(fp, pos + 62, SEEK_SET);
	code = read_short(fp, &err);
	if (code != 44) {
	    discard = 1;
	}

	/* grab the object name */
	fseek(fp, pos + 22, SEEK_SET);
	*vname = '\0';
	if (fscanf(fp, "%31s", vname) != 1) {
	    err = E_DATA;
	    break;
	}
	    
	if (!strcmp(vname, "C") || !strcmp(vname, "RESID")) {
	    discard = 1;
	}

	fprintf(stderr, "\n*** object %d (type %d), '%s', at 0x%x (%d)\n", obj++, 
		(int) code, vname, pos, (int) pos);

	if (discard) {
	    fprintf(stderr, "Discarding '%s'\n", vname);
	    continue;
	}

	/* storage type code? */
	fseek(fp, pos + 4, SEEK_SET);
	k = read_short(fp, &err);
	if (k != 11) {
#if EVDEBUG
	    fprintf(stderr, "unknown data storage method %d\n", (int) k);
#else
	    pputs(prn, "unknown data storage method, skipping\n");
	    continue;
#endif
	}

	dset->varname[++j][0] = 0;
	strncat(dset->varname[j], vname, VNAMELEN - 1);

	fseek(fp, pos + 6, SEEK_SET);
	sz = read_unsigned(fp, &err);
	fprintf(stderr, "data record size: %d\n", (int) sz);
	fseek(fp, pos + 10, SEEK_SET);
	sz = read_unsigned(fp, &err);
	fprintf(stderr, "data block size: %d\n", (int) sz);

#if EVDEBUG
	fprintf(stderr, "first 6 bytes as shorts:");
	fseek(fp, pos, SEEK_SET);
	for (k=0; k<3; k++) {
	    fprintf(stderr, " %d", read_short(fp, &err));
	}
	fputc('\n', stderr);
	fprintf(stderr, "last 6 bytes as shorts:");
	fseek(fp, pos + 64, SEEK_SET);
	for (k=0; k<3; k++) {
	    fprintf(stderr, " %d", read_short(fp, &err));
	}
	fputc('\n', stderr);
#endif

	/* get stream position for the data */
	fseek(fp, pos + 14, SEEK_SET);
	u = read_unsigned(fp, &err);
	if (u > 0) {
	    /* follow up at the pos given above, if non-zero */
	    fprintf(stderr, "data record at 0x%x (%d)\n", u, (int) u);
	    err = wf1_read_values(fp, ftype, u, sz, dset, j, k);
	} else {
	    fputs("Couldn't find the data: skipping this variable\n", stderr);
	    continue;
	}

	if (!err) {
	    /* stream position for history */
	    fseek(fp, pos + 54, SEEK_SET);
	    u = read_unsigned(fp, &err);
	    if (u > 0) {
		fprintf(stderr, "Reading history block at 0x%x\n", (unsigned) u);
		wf1_read_history(fp, u, dset, j);
	    }
	}
    }

    *nvread = j;

    fprintf(stderr, "actual number of variables read = %d\n", *nvread);

    if (*nvread == 0) {
	pputs(prn, _("No variables were read\n"));
	err = E_DATA;
    } 

    return err;
}
Ejemplo n.º 20
0
void ColDiagramView::read(char * st, char * k)
{
    UmlCanvas * canvas = the_canvas();

    // reads first the instances, package, fragment notes, icons text and images
    while (CodClassInstCanvas::read(st, canvas, k) ||
           NoteCanvas::read(st, canvas, k) ||
           TextCanvas::read(st, canvas, k) ||
           IconCanvas::read(st, canvas, k) ||
           PackageCanvas::read(st, canvas, k) ||
           FragmentCanvas::read(st, canvas, k) ||
           ImageCanvas::read(st, canvas, k))
        k = read_keyword(st);

    // then reads links selflink and dirs (without messages)
    while (CodLinkCanvas::read(st, canvas, k) ||	// updates k
           CodSelfLinkCanvas::read(st, canvas, k) ||	// updates k
           CodDirsCanvas::read(st, canvas, k))		// updates k
        ;

    // then read messages
    if (!strcmp(k, "msgs"))
        ColMsg::read(st, msgs, canvas);
    else if (strcmp(k, "no_msg"))
        wrong_keyword(k, "msgs/no_msg");

    k = read_keyword(st);

    // then show/update msgs
    Q3CanvasItemList items = canvas->allItems();
    Q3CanvasItemList::Iterator it;

    for (it = items.begin(); it != items.end(); ++it) {
        DiagramItem * di = QCanvasItemToDiagramItem(*it);

        if (di != 0) {
            switch (di->type()) {
            case UmlSelfLink:
                ((CodSelfLinkCanvas *) di)->update_msgs();
                break;

            case UmlLinkDirs:
                ((CodDirsCanvas *) di)->update_msgs();
                break;

            default:	// to avoid warning
                break;
            }
        }
    }

    // then reads anchors
    while (ArrowCanvas::read(st, canvas, k))
        k = read_keyword(st);

    if (!strcmp(k, "preferred_whz") || !strcmp(k, "prefered_whz")) {
        preferred_size.setWidth(read_unsigned(st));
        preferred_size.setHeight(read_unsigned(st));
        preferred_zoom = read_double(st);
        k = read_keyword(st);
    }

    if (strcmp(k, "end"))
        wrong_keyword(k, "end");
}