コード例 #1
0
static pwr_tStatus trace_get_attr_m5( 	WGre		*gre, 
					vldh_t_node	node, 
					char		*debug_par,
					char		*object_str, 
					char		*attr_str,
					flow_eTraceType	*trace_type,
					int		*inverted)
{
  pwr_tAName	       	aname;
  pwr_tStatus		sts;
  int			size;
  pwr_sAttrRef		*objarp;
  pwr_sAttrRef		objar, disar;
  char			*np, *s;
  ldh_sAttrRefInfo	info;

  *inverted = 0;

  /* Get the attrref stored in the attribute Object */
  sts = ldh_GetObjectPar( node->hn.wind->hw.ldhses,  
		node->ln.oid, "DevBody", "Object",
		(char **)&objarp, &size); 
  if ( EVEN(sts)) return sts;

  objar = *objarp;
  free((char *) objarp);

  sts = ldh_GetAttrRefInfo( node->hn.wind->hw.ldhses,
	&objar, &info);
  if( EVEN(sts)) return sts;

  if ( !info.flags & PWR_MASK_DISABLEATTR)
    return TRA__NOPAR;

  disar = cdh_ArefToDisableAref( &objar);

  /* Get the name of the node */
  sts = ldh_AttrRefToName( node->hn.wind->hw.ldhses,  
			   &disar, cdh_mNName, &np,
			   &size);
  if( EVEN(sts)) return sts;
  strcpy( aname, np);

  s = strrchr( aname, '.');
  if ( !s) return TRA__NOPAR;

  strcpy( attr_str, s + 1);
  *s = 0;
  strcpy( object_str, aname);

  *trace_type = flow_eTraceType_Boolean;
  return TRA__SUCCESS;
}
コード例 #2
0
ファイル: wb_c_object.cpp プロジェクト: jordibrus/proview
static pwr_tStatus configure_object( ldh_sMenuCall *ip, pwr_sAttrRef *aref, 
				     unsigned int disable_mask)
{
  pwr_tStatus 	sts;
  pwr_tCid 	cid;
  ldh_sParDef 	*bodydef;
  int 		rows;
  int		i;
  pwr_sAttrRef  aaref, daref;
  pwr_tDisableAttr disable;
  int disableattr_cnt = 0;
  
  sts = ldh_GetAttrRefTid( ip->PointedSession, aref, &cid);
  if ( EVEN(sts)) return sts;

  sts = ldh_GetObjectBodyDef( ip->PointedSession, cid, "RtBody", 1,
				  &bodydef, &rows);
  if (EVEN(sts)) return sts;

  for ( i = 0; i < rows; i++) {
    if ( bodydef[i].Par->Param.Info.Flags & PWR_MASK_DISABLEATTR) {
      // Disable or enable dependent on mask
      sts = ldh_ArefANameToAref( ip->PointedSession, aref, bodydef[i].ParName, &aaref);
      if ( EVEN(sts)) return sts;

      daref = cdh_ArefToDisableAref( &aaref);

      if ( (1 << disableattr_cnt++) & disable_mask)
	disable = 1;
      else
	disable = 0;

      sts = ldh_WriteAttribute( ip->PointedSession, &daref, (void *)&disable, 
				sizeof(disable));
      if ( EVEN(sts)) return sts;
    }
#if 0
    if ( bodydef[i].Par->Param.Info.Flags & PWR_MASK_CLASS) {
      // Examine object attribute
      sts = ldh_ArefANameToAref( ip->PointedSession, aref, bodydef[i].ParName, &aaref);
      if ( EVEN(sts)) return sts;

      sts = configure_object( ip, &aaref, disable_mask, disableattr_cnt);
      if ( EVEN(sts)) return sts;
    }
#endif
  }
  free( (char *)bodydef);

  return LDH__SUCCESS;
}
コード例 #3
0
ファイル: wb_session.cpp プロジェクト: siamect/proview
bool wb_session::disableAttribute(pwr_sAttrRef* arp, pwr_tDisableAttr disable)
{
  wb_attribute a = attribute(arp);
  if (!a)
    return a.sts();

  if (!(a.flags() & PWR_MASK_DISABLEATTR)) {
    m_sts = 0;
    return false;
  }

  pwr_sAttrRef dis_aref = cdh_ArefToDisableAref(arp);
  wb_attribute dis_a = attribute(&dis_aref);
  if (!dis_a)
    return dis_a.sts();

  try {
    writeAttribute(dis_a, &disable);
  } catch (wb_error& e) {
    m_sts = e.sts();
    return false;
  }
  return true;
}
コード例 #4
0
ファイル: wb_c_object.cpp プロジェクト: jordibrus/proview
static pwr_tStatus configure_object_reset( ldh_sMenuCall *ip, pwr_sAttrRef *aref,
					   pwr_sMenuButton *mb)
{
  pwr_tStatus 	sts;
  pwr_tCid 	cid;
  ldh_sParDef 	*bodydef;
  int 		rows;
  int		i, j;
  pwr_sAttrRef  aaref, daref;
  pwr_tDisableAttr disable = 0;
  char 		vect[10][80];
  int 		vect_cnt;
  int 		skip;
  char		*s;
  
  // Attribute objects in argument 2 are not controlled by the configure method
  if ( mb) {
    vect_cnt = dcli_parse( mb->MethodArguments[2], ",", "", (char *)vect, 
			   sizeof( vect) / sizeof( vect[0]), 
			   sizeof( vect[0]), 0);
    for ( j = 0; j < vect_cnt; j++)
      dcli_trim( vect[j], vect[j]);
  }
  else
    vect_cnt = 0;

  sts = ldh_GetAttrRefTid( ip->PointedSession, aref, &cid);
  if ( EVEN(sts)) return sts;

  sts = ldh_GetObjectBodyDef( ip->PointedSession, cid, "RtBody", 1,
				  &bodydef, &rows);
  if (EVEN(sts)) return sts;

  for ( i = 0; i < rows; i++) {

    // Check if attribute is controlled by this method
    skip = 0;
    if ( mb) {
      // Remove leading Super.
      s = bodydef[i].ParName;
      while ( strncmp( s, "Super.", 6) == 0)
	s += 6;
      for ( j = 0; j < vect_cnt; j++) {
	if ( cdh_NoCaseStrcmp( vect[j], s) == 0) {
	  // This object should not be reset
	  skip = 1;
	  break;
	}
      }
      if ( skip)
	continue;
    }

    if ( bodydef[i].Par->Param.Info.Flags & PWR_MASK_DISABLEATTR) {
      // Enable all attributes
      sts = ldh_ArefANameToAref( ip->PointedSession, aref, bodydef[i].ParName, &aaref);
      if ( EVEN(sts)) return sts;

      daref = cdh_ArefToDisableAref( &aaref);

      sts = ldh_WriteAttribute( ip->PointedSession, &daref, (void *)&disable, 
				sizeof(disable));
      if ( EVEN(sts)) return sts;
    }

    if ( bodydef[i].Par->Param.Info.Flags & PWR_MASK_CLASS) {
      // Reset object attribute
      sts = ldh_ArefANameToAref( ip->PointedSession, aref, bodydef[i].ParName, &aaref);
      if ( EVEN(sts)) return sts;

      sts = configure_object_reset( ip, &aaref, 0);
      if ( EVEN(sts)) return sts;
    }
  }
  free( (char *)bodydef);

  return LDH__SUCCESS;
}