Esempio n. 1
0
void printResource(OCBaseResourceT *resource)
{
    OIC_LOG(DEBUG, TAG, "=============================");
    OIC_LOG_V(DEBUG, TAG, "Resource URI: %s", resource->uri);
    OIC_LOG_V(DEBUG, TAG, "Handle of the resource: %p", (void*) resource->handle);

    OIC_LOG(DEBUG, TAG, "Resource Types: ");
    OCResourceType *currentType = resource->type;
    while(currentType != NULL)
    {
        OIC_LOG_V(DEBUG, TAG, "\t%s", currentType->resourcetypename);
        currentType = currentType->next;
    }

    OIC_LOG(DEBUG, TAG, "Resource Interfaces: ");
    OCResourceInterface *currentInterface = resource->interface;
    while(currentInterface != NULL)
    {
        OIC_LOG_V(DEBUG, TAG, "\t%s", currentInterface->name);
        currentInterface = currentInterface->next;
    }

    printAttribute(resource->attribute);
    OIC_LOG(DEBUG, TAG, "=============================");
}
Esempio n. 2
0
  void PrivateConsoleLogHandler::textColorFG(char fg) const
  {
    if (!_color)
      return;

    printAttribute(fg + 30);
  }
Esempio n. 3
0
  void PrivateConsoleLogHandler::textColorBG(char bg) const
  {
    if (!_color)
      return;

    printAttribute(bg + 40);
  }
Esempio n. 4
0
  void PrivateConsoleLogHandler::textColorAttr(char attr) const
  {
    if (!_color)
      return;

    printAttribute(attr);
  }
Esempio n. 5
0
static int
printMetaData(D4printer* out, NCD4node* node, int depth)
{
    int ret = NC_NOERR;
    int i;

    if(nclistlength(node->dims) > 0) {
	for(i=0;i<nclistlength(node->dims);i++) {
	    NCD4node* dim = (NCD4node*)nclistget(node->dims,i);
	    printDimref(out,dim,depth);
	    CAT("\n");
	}
    }
    if(nclistlength(node->maps) > 0) {
	for(i=0;i<nclistlength(node->maps);i++) {
	    NCD4node* mapref = (NCD4node*)nclistget(node->maps,i);
	    printMap(out,mapref,depth);
	    CAT("\n");
	}
     }
    if(nclistlength(node->attributes) > 0) {
	for(i=0;i<nclistlength(node->attributes);i++) {
	    NCD4node* attr = (NCD4node*)nclistget(node->attributes,i);
	    printAttribute(out,attr,depth);
	    CAT("\n");
	}
    }
    return THROW(ret);
}
Esempio n. 6
0
//
// printClass
//
void wb_print_wbl::printClass(wb_volume& v,
                              wb_attribute& attr,
                              wb_attribute& tattr,
                              wb_adef& adef) 
{
  pwr_tCid subClass = attr.subClass();
  wb_object templ;
  wb_object sysbo;
  wb_attribute tattr2;
  wb_attribute attr2;
  wb_adef adef2;

  //  if ( strcmp( attr.name(), "Template") == 0 && v.cid() == pwr_eClass_ClassVolume)
    // The parser can't handle subclasses in template objects yet...
  //  return;

  wb_cdef cdef = v.cdef(attr.cid());
  if (!cdef) {
    m_os << "! %WBDUMP-E-Error Unknown sub class: " << subClass << endl;
    m_errCnt++;
    return;
  }

  wb_bdef bdef = cdef.bdef(pwr_eBix_sys);
  if (!bdef) {
    m_os << "! %WBDUMP-E-Error sub class: " << subClass 
         << " not defined" << endl;
    m_errCnt++;
    return;
  }    

  for (int i = 0; i < adef.nElement(); i++) {
    attr2 = attr.first(i);
    tattr2 = tattr.first(i);
  
    while ( attr2.oddSts()) {

      adef2 = bdef.adef( attr2.attrName()); 
      
      printAttribute(v, attr2, tattr2, adef2, 0);
    
      attr2 = attr2.after();
      if ( tattr2.oddSts())
	tattr2 = tattr2.after();
    }
  }

#if 0
  wb_object co = v.object(cdh_ClassIdToObjid(subClass));
  if (!co) {
    m_os << "! %WBDUMP-E-Error Unknown sub class: " << subClass << endl;
    m_errCnt++;
    return;
  }

  wb_cdef cdef = v.cdef(subClass);
  if (!cdef) {
    m_os << "! %WBDUMP-E-Error Unknown sub class: " << subClass << endl;
    m_errCnt++;
    return;
  }

  wb_name t("Template");
  
  templ = co.child(t);
  if (!templ) {
    m_errCnt++;
    m_os << "! %WBDUMP-E-Error Template not found for class " << cdef.longName() << endl;
    return;
  }

  wb_bdef bdef = cdef.bdef(pwr_eBix_sys);
  if (!bdef) {
    m_os << "! %WBDUMP-E-Error sub class: " << subClass 
         << " not defined" << endl;
    m_errCnt++;
    return;
  }    
  bname = bdef.name();

  for (int i = 0; i < adef.nElement(); i++) {

    if (adef.flags() & PWR_MASK_ARRAY)
      indent(1) << "Buffer " << adef.name() << "[" << i << "]" << endl;
    else
      indent(1) << "Buffer " << adef.name() << endl;


    adef2 = bdef.adef(); 
    attr2 = attr.first(i);
    
    while (1) {
      tattr2 = templ.attribute(bname, adef2.name());
      printAttribute(v, attr2, tattr2, adef2, 0);

      if (!(adef2 = adef2.next()))
        break;
      
      if (!(attr2 = attr2.after()))
        break;
    }                   

    indent(-1) << "EndBuffer" << endl;

    if (adef.flags() & PWR_MASK_ARRAY)
      indent(1) << "Buffer " << adef.name() << "[" << i << "]" << endl;
    else
      indent(1) << "Buffer " << adef.name() << endl;


    adef2 = bdef.adef(); 
    attr2 = attr.first(i);
    
    while (1) {
      strcpy( aname, adef.subName());
      strcat( aname, ".");
      strcat( aname, attr2.name());

      attr2
      tattr2 = templ.attribute(bname, adef2.name());
      printAttribute(v, attr2, tattr2, adef2, 0);

      if (!(adef2 = adef2.next()))
        break;
      
      if (!(attr2 = attr2.after()))
        break;
    }                   

  }
#endif
}
Esempio n. 7
0
//
// printBody
//
void wb_print_wbl::printBody(wb_volume& v, 
                             wb_object& o, 
                             wb_object& templ,
                             wb_cdef& cdef,
                             pwr_eBix bix)
{
  wb_adef adef;
  wb_attribute attr;
  wb_attribute tattr;
  const char* bname;
  char timestr[40] = " ";
  int force = 0;
    
  wb_bdef bdef = cdef.bdef(bix);
    

  if (!bdef)
    return;

  bname = bdef.name();

  wb_bdef tbdef = templ.bdef(bix);
  if (!tbdef) {
    m_errCnt++;
    m_os << "Couldn't find template body def for object " << o.name() << endl;
    return;
  }
    
  if ( m_timeFlag) {
    // Get body time
    pwr_tTime btime;
    switch ( bix) {
    case pwr_eBix_rt:
      btime = o.rbTime();

      // Bugcheck in 4.2 btime can be corrupt
      if ( btime.tv_nsec < 0 || btime.tv_nsec >= 1000000000)
	break;

      strcpy( timestr, " ");
      time_AtoAscii( &btime, time_eFormat_DateAndTime, &timestr[1], sizeof(timestr)-1);
      break;
    case pwr_eBix_dev:
      btime = o.dbTime();
      strcpy( timestr, " ");
      time_AtoAscii( &btime, time_eFormat_DateAndTime, &timestr[1], sizeof(timestr)-1);
      break;
    default: ;
    }
  }

  indent(1) << "Body " << bdef.name() << timestr << endl;
  for (adef = bdef.adef(); adef; adef = adef.next()) {
    if ( cdef.cid() == pwr_eClass_Param && strcmp( adef.name(), "Size") == 0) {
      // Print Size for Pointers that is not private
      wb_attribute flags_attr = o.attribute(bname, "Flags");
      pwr_tMask *flagsp = (pwr_tMask *)flags_attr.value();
      if (*flagsp & PWR_MASK_POINTER && !(*flagsp & PWR_MASK_PRIVATE))
	force = 1;
    }

    attr = o.attribute(bname, adef.name());
    tattr = templ.attribute(bname, adef.name());
    //    if (tattr == attr)
    //  continue;
    printAttribute(v, attr, tattr, adef, force);
  }

  indent(-1) << "EndBody" << endl;
    
  return;
}
Esempio n. 8
0
static int
printGroupBody(D4printer* out, NCD4node* node, int depth)
{
    int ret = NC_NOERR;
    int i,ngroups,nvars,ntypes,ndims,nattrs;

    ngroups = nclistlength(node->groups);
    nvars = nclistlength(node->vars);
    ntypes = nclistlength(node->types);
    ndims = nclistlength(node->dims);
    nattrs = nclistlength(node->attributes);

    if(ndims > 0) {
	INDENT(depth);
	CAT("<Dimensions>\n");
	depth++;
	for(i=0;i<nclistlength(node->dims);i++) {
	    NCD4node* dim = (NCD4node*)nclistget(node->dims,i);
	    printNode(out,dim,depth);
	    CAT("\n");
	}
	depth--;
	INDENT(depth);
	CAT("</Dimensions>\n");
    }
    if(ntypes > 0) {
	INDENT(depth);
	CAT("<Types>\n");
	depth++;
	for(i=0;i<nclistlength(node->types);i++) {
	    NCD4node* type = (NCD4node*)nclistget(node->types,i);
	    if(type->subsort <= NC_MAX_ATOMIC_TYPE) continue;
	    printNode(out,type,depth);
	    CAT("\n");
	}
	depth--;
	INDENT(depth);
	CAT("</Types>\n");
    }
    if(nvars > 0) {
	INDENT(depth);
	CAT("<Variables>\n");
	depth++;
	for(i=0;i<nclistlength(node->vars);i++) {
	    NCD4node* var = (NCD4node*)nclistget(node->vars,i);
	    printNode(out,var,depth);
	}
	depth--;
	INDENT(depth);
	CAT("</Variables>\n");
    }
    if(nattrs > 0) {
	for(i=0;i<nclistlength(node->attributes);i++) {
	    NCD4node* attr = (NCD4node*)nclistget(node->attributes,i);
	    printAttribute(out,attr,depth);
	    CAT("\n");
	}
    }
    if(ngroups > 0) {
	INDENT(depth);
	CAT("<Groups>\n");
	depth++;
	for(i=0;i<nclistlength(node->groups);i++) {
	    NCD4node* g = (NCD4node*)nclistget(node->groups,i);
	    printNode(out,g,depth);
	    CAT("\n");
	}
	depth--;
	INDENT(depth);
	CAT("</Groups>\n");
    }
    return THROW(ret);
}