Esempio n. 1
0
static int printObject(FILE *f, Imod *m, int ob)
{
  Iobj *obj = &m->obj[ob];
  Icont *cont;
  int co;
  int ec = 0; /* error code. */
     
  for(co = 0; co < obj->contsize; co++){
    cont = &obj->cont[co];
    if (!cont->psize) return -1;

    if (iobjClose(obj->flags)){
      fprintf(f, "Container (\n");
      if ((iobjFill(obj->flags)) && (!LinesOnly))
        printContourPoly(f, cont);
      else
        printContourLines(f, &obj->cont[co], 1);
      printAttributes(f, obj);
      fprintf(f, ")\n");
      continue;
    }

    if (iobjScat(obj->flags)){
      printContourScat(f , obj, cont, obj->pdrawsize*5);
      continue;
    }

    fprintf(f, "Container (\n");
    printContourLines(f, &obj->cont[co], 0);
    printAttributes(f, obj);
    fprintf(f, ")\n");
  }
  return(ec);
}
Esempio n. 2
0
void SQLWriter::writeAttributes(UMLClassifier *c, QTextStream &sql) {
    UMLAttributeList atpub, atprot, atpriv, atimp;
    atpub.setAutoDelete(false);
    atprot.setAutoDelete(false);
    atpriv.setAutoDelete(false);
    atimp.setAutoDelete(false);

    //sort attributes by scope and see if they have a default value
    UMLAttributeList atl = c->getAttributeList();
    for(UMLAttribute* at=atl.first(); at ; at=atl.next()) {
        switch(at->getVisibility()) {
          case Uml::Visibility::Public:
            atpub.append(at);
            break;
          case Uml::Visibility::Protected:
            atprot.append(at);
            break;
          case Uml::Visibility::Private:
            atpriv.append(at);
            break;
          case Uml::Visibility::Implementation:
            atimp.append(at);
            break;
        }
    }

    // now print the attributes; they are sorted by there scope
    // in front of the first attribute shouldn't be a , -> so we need to find
    // out, when the first attribute was added
    bool first = true;

    if (atpub.count() > 0)
    {
        printAttributes(sql, atpub, first);
        first = false;
    }

    if (atprot.count() > 0)
    {
        printAttributes(sql, atprot, first);
        first = false;
    }

    if (atpriv.count() > 0)
    {
        printAttributes(sql, atpriv, first);
        first = false;
    }

    if (atimp.count() > 0)
    {
        printAttributes(sql, atimp, first);
        first = false;
    }

    return;
}
Esempio n. 3
0
/**
 * Sample implementation of the method which handles arc entities.
 */
void DXFReader::addArc(const DL_ArcData& data)
{

    gp_Pnt p1(data.cx, data.cy, data.cz);
    gp_Ax2 a2(p1, gp_Dir(0, 0, 1));
    gp_Circ c(a2, data.radius);

    TopoDS_Shape arc = BRepBuilderAPI_MakeEdge(c, DEGTORAD(data.angle1), DEGTORAD(data.angle2)).Shape();
    m_mainClass->draw(arc);


    /*
    gp_Pnt p1(data.cx, data.cy, data.cz);
    gp_Ax2 a2(p1, gp_Dir(0, 0, 1));
    gp_Circ circle(a2, data.radius);
    GC_MakeArcOfCircle geoArc(circle, data.angle1, data.angle2, true);

    TopoDS_Shape arc = BRepBuilderAPI_MakeEdge(geoArc.Value()).Shape();
    m_mainClass->draw(arc);
    qDebug() << data.angle1;
    qDebug() << data.angle2;
    */

    /*printf("ARC      (%6.3f, %6.3f, %6.3f) %6.3f, %6.3f, %6.3f\n",
           data.cx, data.cy, data.cz,
           data.radius, data.angle1, data.angle2);*/
    printAttributes();
}
Esempio n. 4
0
int main(int argc, char *argv[]) {

	// Init SDL video subsystem
	if ( SDL_Init (SDL_INIT_VIDEO) < 0 ) {
		
        fprintf(stderr, "Couldn't initialize SDL: %s\n",
			SDL_GetError());
		exit(1);
	}
	atexit(SDL_Quit);

    // Set GL context attributes
    initAttributes ();
    
    // Create GL context
    createSurface(0);
    
    // Get GL context attributes
    printAttributes();
    
    // Init GL state
    initGL();
    
    // Draw, get events...
    mainLoop();
    
    // Cleanup
	SDL_Quit();
	
    return 0;
}
Esempio n. 5
0
/**
 * @brief printResourceData Prints the data of a resource
 *
 * @param resource      The resource's data to print
 */
void printResourceData(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;
    }

    printAttributes(resource->attribute);
    OIC_LOG(DEBUG, TAG, "=============================");
}
Esempio n. 6
0
void printFieldInfo(cfrt_field_info *field, FILE *f) {
    fprintf(f, "        access_flags: 0x%X\n", field->access_flags);
    fprintf(f, "        name_index: %d\n", field->name_index);
    fprintf(f, "        descriptor_index: %d\n", field->descriptor_index);
    fprintf(f, "        attributes:\n");
    printAttributes(field->attributes, field->attributes_count, "        ");
}
Esempio n. 7
0
//=============================================================================
void sstDxf01ReadCls::add3dFace(const DL_3dFaceData& data) {
    printf("3DFACE\n");
    for (int i=0; i<4; i++) {
        printf("   corner %d: %6.3f %6.3f %6.3f\n",
            i, data.x[i], data.y[i], data.z[i]);
    }
    printAttributes();
}
void Test_CreationClass::add3dFace(const DL_3dFaceData& data) {
    printf("3DFACE\n");
    for (int i=0; i<4; i++) {
        printf("   corner %d: %6.3f %6.3f %6.3f\n", 
            i, data.x[i], data.y[i], data.z[i]);
    }
    printAttributes();
}
Esempio n. 9
0
int main()
{
    cout << "Enter lower left and upper right coordinates for the rectangle" <<
        " as four separated integers" << endl;
    int x1, y1, x2, y2;

    cin >> x1 >> y1 >> x2 >> y2;
    // Rectangle rect(Point(x1, y1), Point(x2, y2));
    Rectangle rect(x1, y1, x2, y2);
    printAttributes(&rect);

    cout << "Enter coordinates of a triangle as six integers" << endl;
    int x3, y3;

    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

    Triangle tri(Point(x1, y1), Point(x2, y2), Point(x3, y3));
    printAttributes(&tri);

    return 0;
}
Esempio n. 10
0
std::ostream& printNode(std::ostream & out, size_t level, const Node * n, std::vector<const Node*> * groups) {
  auto outputs = n->outputs();
  indent(out, level) << const_value_list_with_types(outputs);
  out << " = ";
  IR_IFM_CONST(n,PythonOp)
    out << "^" << value->name();
    out << "(";
    int i = 0;
    for (auto& scalar : value->scalar_args) {
      if (i++ > 0)
        out << ", ";
      printPyObject(out, scalar);
    }
    out << ")";
  IR_ELSEIFM_CONST(CppOp)
    out << "CppOp[" << value->name() << "]";
  IR_ELSE()
    if(n->hasAttribute(kSubgraph)) {
      if(groups) {
        out << n->kind().toString() << "_" << groups->size();
        groups->push_back(n);
      } else {
        out << n->kind().toString() << "[" << *n->g(kSubgraph) << "]";
      }
    } else {
      out << n->kind().toString();
      if(n->hasAttributes()) {
        printAttributes(out,n);
      }
    }
  IR_END()
  out << "(" << n->inputs() << ")";
  std::string scopeName = n->scopeName();
  if (scopeName.empty()) {
    out << "\n";
  }
  else {
    out << ", ";
    out << "scope: " << scopeName << "\n";
  }
  for(size_t i = 0; i < n->blocks().size(); ++i) {
    auto b = n->blocks()[i];
    indent(out, level + 1) << "block" << i << "(" << const_value_list_with_types(b->inputs(), false) << ") {\n";
    for(auto n : b->nodes()) {
      printNode(out, level + 2, n, groups);
    }
    indent(out, level + 2) << "-> (" << b->outputs() << ")\n";
    indent(out, level + 1) << "}\n";
  }
  return out;
}
Esempio n. 11
0
void printInterestPacket(Ext_TOS_MsgPtr extTosMsg)
{
  InterestMessage *intMsg;

  intMsg = (InterestMessage *)extTosMsg->data;
  printf("INTEREST: sink: %d dest: %d seq: %d prev: %d ttl: %d exp: %d\n", 
	  intMsg->sink, 
          extTosMsg->addr,
          intMsg->seqNum, 
          intMsg->prevHop, 
	  intMsg->ttl, 
          intMsg->expiration);
  printAttributes(intMsg->attributes, intMsg->numAttrs);
  
  printf("\n");
}
Esempio n. 12
0
static int printContourScat(FILE *f, Iobj *obj, Icont *c, int inPsize)
{
  int pt;
  float psize = (float)inPsize * 0.1f;

  for(pt = 0; pt < c->psize; pt++){
    fprintf(f, "Container (\n" 
            "\tEllipsoid ( 0 0 %g %g 0 0 0 %g 0 %g %g %g )\n",
            psize, psize, psize, 
            c->pts[pt].x,
            c->pts[pt].y,
            Zscale * c->pts[pt].z);
    printAttributes(f, obj);
    fprintf(f, ")\n");
  }
  return(0);
}
Esempio n. 13
0
static int printMesh(FILE *f, Iobj *obj, Imesh *mesh)
{
  int i;
  int nfaces = 0;
  int nverts = 0;


     

  fprintf(f, "Container (\n");
  fprintf(f, "\tMesh (\n");


     
     
  fprintf(f, "\t\t%d\n", mesh->vsize);
  for (i = 0; i < mesh->vsize; i++){
    fprintf(f, "\t\t%g %g %g\n",
            mesh->vert[i].x, mesh->vert[i].y,mesh->vert[i].z);
  }
  fprintf(f, "\t\t%d\n", nfaces);
  fprintf(f, "\t\t0\n");
  for(i = 0; i < nfaces; i++){
      
  }

  printAttributes(f, obj);

#ifdef USE_NORMALS
  fprintf(f, "\tContainer (\n");
  fprintf(f, "\tAttributeVertexSet ( )\n");
  fprintf(f, "\tNormal(\n");
  for (i = 0; i < nverts; i++){
      
  }
  fprintf(f, "\t)\n");
  fprintf(f, "\t)\n");
#endif

  fprintf(f, "\t)\n");
  fprintf(f, ")\n");
  return 0;
}
Esempio n. 14
0
/* .Internal( print.function(f, useSource, ...)) */
SEXP attribute_hidden do_printfunction(SEXP call, SEXP op, SEXP args, SEXP rho)
{
    checkArity(op,args);
    SEXP s = CAR(args);
    switch (TYPEOF(s)) {
    case CLOSXP:
	PrintLanguageEtc(s, asLogical(CADR(args)), /*is closure = */ TRUE);
	printAttributes(s, rho, FALSE);
	break;
    case BUILTINSXP:
    case SPECIALSXP:
	PrintSpecial(s);
	break;

    default: /* if(!isFunction(s)) */
	error(_("non-function argument to .Internal(print.function(.))"));
    }
    return s;
}
/**
 * Sample implementation of the method which handles layers.
 */
void Test_CreationClass::addLayer(const DL_LayerData& data) {
    printf("LAYER: %s flags: %d\n", data.name.c_str(), data.flags);
    printAttributes();
}
Esempio n. 16
0
/**
 * Sample implementation of the method which handles layers.
 */
void DXFReader::addLayer(const DL_LayerData& data) {
    printf("LAYER: %s flags: %d\n", data.name.c_str(), data.flags);
    printAttributes();
}
/**
 * Sample implementation of the method which handles vertices.
 */
void Test_CreationClass::addVertex(const DL_VertexData& data) {
    printf("VERTEX   (%6.3f, %6.3f, %6.3f) %6.3f\n",
           data.x, data.y, data.z,
           data.bulge);
    printAttributes();
}
/**
 * Sample implementation of the method which handles polyline entities.
 */
void Test_CreationClass::addPolyline(const DL_PolylineData& data) {
    printf("POLYLINE \n");
    printf("flags: %d\n", (int)data.flags);
    printAttributes();
}
Esempio n. 19
0
void printDataPacket(Ext_TOS_MsgPtr extTosMsg)
{
  DataMessage *dataMsg;
  int numAttrs;
  int i;
  bool mine = FALSE;


  dataMsg = (DataMessage *)extTosMsg->data;

  if (extTosMsg->addr == myId)
  {
    mine = TRUE;
  }
  else if (TOS_BCAST_ADDR == extTosMsg->addr)
  // this shouldn't really happen since all data in OPP is unicast towards
  // the sink
  {
    printf("Recieved broadcast data message! shouldn't happen!!\n");

    // print out only if it's for me if the printMineOnly flag is set...
    numAttrs = dataMsg->numAttrs;
    if (numAttrs < 0 || numAttrs > MAX_ATT)
    {
      numAttrs = MAX_ATT;
    }
    for (i = 0; i < dataMsg->numAttrs; i++)
    {
      if (ESS_CLUSTERHEAD_KEY == dataMsg->attributes[i].key &&
          IS == dataMsg->attributes[i].op)
      {
        if (dataMsg->attributes[i].value == myId)
        {
          mine = TRUE;
        }
        else
        {
          mine = FALSE;
        }
      }
    }
  }

  if (TRUE == printMineOnly && 
      FALSE == mine)
  {
    return;
  }
  printf("DATA: src: %d dest: %d seq: %d prev: %d hops2src: %d len: %d\n",
	  dataMsg->source, 
          extTosMsg->addr,
          dataMsg->seqNum, 
          dataMsg->prevHop, 
	  dataMsg->hopsToSrc,
          extTosMsg->length);

  printAttributes(dataMsg->attributes, 
                  dataMsg->numAttrs);
  
  printf("\n");
}
Esempio n. 20
0
/**
 * Sample implementation of the method which handles point entities.
 */
void DXFReader::addPoint(const DL_PointData& data) {
    printf("POINT    (%6.3f, %6.3f, %6.3f)\n",
           data.x, data.y, data.z);
    printAttributes();
}
Esempio n. 21
0
//=============================================================================
void sstDxf01ReadCls::addPolyline(const DL_PolylineData& data) {
    printf("POLYLINE \n");
    printf("flags: %d\n", (int)data.flags);
    printAttributes();
}
Esempio n. 22
0
//=============================================================================
void sstDxf01ReadCls::addLine(const DL_LineData& data) {
    printf("LINE     (%6.3f, %6.3f, %6.3f) (%6.3f, %6.3f, %6.3f)\n",
           data.x1, data.y1, data.z1, data.x2, data.y2, data.z2);
    printAttributes();
}
Esempio n. 23
0
//=============================================================================
void sstDxf01ReadCls::addPoint(const DL_PointData& data) {
    printf("POINT    (%6.3f, %6.3f, %6.3f)\n",
           data.x, data.y, data.z);
    printAttributes();
}
/**
 * Sample implementation of the method which handles point entities.
 */
void Test_CreationClass::addPoint(const DL_PointData& data) {
    printf("POINT    (%6.3f, %6.3f, %6.3f)\n",
           data.x, data.y, data.z);
    printAttributes();
}
Esempio n. 25
0
//=============================================================================
void sstDxf01ReadCls::addCircle(const DL_CircleData& data) {
    printf("CIRCLE   (%6.3f, %6.3f, %6.3f) %6.3f\n",
           data.cx, data.cy, data.cz,
           data.radius);
    printAttributes();
}
/**
 * Sample implementation of the method which handles line entities.
 */
void Test_CreationClass::addLine(const DL_LineData& data) {
    printf("LINE     (%6.3f, %6.3f, %6.3f) (%6.3f, %6.3f, %6.3f)\n",
           data.x1, data.y1, data.z1, data.x2, data.y2, data.z2);
    printAttributes();
}
Esempio n. 27
0
//=============================================================================
void sstDxf01ReadCls::addVertex(const DL_VertexData& data) {
    printf("VERTEX   (%6.3f, %6.3f, %6.3f) %6.3f\n",
           data.x, data.y, data.z,
           data.bulge);
    printAttributes();
}
/**
 * Sample implementation of the method which handles arc entities.
 */
void Test_CreationClass::addArc(const DL_ArcData& data) {
    printf("ARC      (%6.3f, %6.3f, %6.3f) %6.3f, %6.3f, %6.3f\n",
           data.cx, data.cy, data.cz,
           data.radius, data.angle1, data.angle2);
    printAttributes();
}
Esempio n. 29
0
void PropertyMap::put(const Identifier &name, JSValue *value, int attributes, bool roCheck)
{
    assert(!name.isNull());
    assert(value != 0);
    
    checkConsistency();

    UString::Rep *rep = name._ustring.rep();
    
#if DEBUG_PROPERTIES
    printf("adding property %s, attributes = 0x%08x (", name.ascii(), attributes);
    printAttributes(attributes);
    printf(")\n");
#endif
    
#if USE_SINGLE_ENTRY
    if (!_table) {
        UString::Rep *key = _singleEntry.key;
        if (key) {
            if (rep == key && !(roCheck && (_singleEntry.attributes & ReadOnly))) {
                _singleEntry.value = value;
                return;
            }
        } else {
            rep->ref();
            _singleEntry.key = rep;
            _singleEntry.value = value;
            _singleEntry.attributes = static_cast<short>(attributes);
            checkConsistency();
            return;
        }
    }
#endif

    if (!_table || _table->keyCount * 2 >= _table->size)
        expand();
    
    unsigned h = rep->hash();
    int sizeMask = _table->sizeMask;
    Entry *entries = _table->entries;
    int i = h & sizeMask;
    int k = 0;
    bool foundDeletedElement = false;
    int deletedElementIndex = 0;    /* initialize to make the compiler happy */
#if DUMP_STATISTICS
    ++numProbes;
    numCollisions += entries[i].key && entries[i].key != rep;
#endif
    while (UString::Rep *key = entries[i].key) {
        if (rep == key) {
            if (roCheck && (_table->entries[i].attributes & ReadOnly)) 
                return;
            // Put a new value in an existing hash table entry.
            entries[i].value = value;
            // Attributes are intentionally not updated.
            return;
        }
        // If we find the deleted-element sentinel, remember it for use later.
        if (key == deletedSentinel() && !foundDeletedElement) {
            foundDeletedElement = true;
            deletedElementIndex = i;
        }
        if (k == 0)
            k = 1 | (h % sizeMask);
        i = (i + k) & sizeMask;
#if DUMP_STATISTICS
        ++numRehashes;
#endif
    }

    // Use either the deleted element or the 0 at the end of the chain.
    if (foundDeletedElement) {
        i = deletedElementIndex;
        --_table->sentinelCount;
    }

    // Create a new hash table entry.
    rep->ref();
    entries[i].key = rep;
    entries[i].value = value;
    entries[i].attributes = static_cast<short>(attributes);
    entries[i].index = ++_table->lastIndexUsed;
    ++_table->keyCount;

    checkConsistency();
}
/**
 * Sample implementation of the method which handles circle entities.
 */
void Test_CreationClass::addCircle(const DL_CircleData& data) {
    printf("CIRCLE   (%6.3f, %6.3f, %6.3f) %6.3f\n",
           data.cx, data.cy, data.cz,
           data.radius);
    printAttributes();
}