Exemplo n.º 1
0
 void printAttris(const AttriMap& m)
 {
     if (m.empty()) return;
     printTab(m_so, m_d); m_so << "attris = {\n";
     ++m_d;
     for (AttriMap::const_iterator iter = m.begin(); iter != m.end(); ++iter) {
         printKV(iter->first, iter->second);
     }
     --m_d;
     printTab(m_so, m_d); m_so << "},\n";
 }
Exemplo n.º 2
0
int main(){

  int tab[10]={1,2,3,4,5,6,7,8,9,10};
  int *pointer;

  pointer=tab;
  printf("Przed zamianą\n");
  printTab(pointer);

  for (int i=0;i<10;i++){
      *(pointer+i)=0;
    }
  printf("Po zamianie\n");
  printTab(pointer);
}
Exemplo n.º 3
0
static void startPrint(FILE *stream, Print_Data_Ptr printer)
{
  printer->cursorPosGlobal = 0;
  printer->lineNumGlobal = 0;
  printer->truncatedGlobal = 0;
  printTab(stream, printer, GET_M_GLOBAL(indentGlobal));
}
Exemplo n.º 4
0
 void printNodes(NodePtrList& list)
 {
     m_so << "{\n";
     ++m_d;
     for (NodePtrList::iterator iter = list.begin();
             iter != list.end(); 
             ++iter) {
         printTab(m_so, m_d); m_so << "{\n";
         ++m_d;
         (*iter)->acceptVisitor(this);
         --m_d;
         printTab(m_so, m_d); m_so << "},\n";
     }
     --m_d;
     printTab(m_so, m_d); m_so << "}";
 }
Exemplo n.º 5
0
 virtual void visit(Node_Declare *v)
 {
     m_so << '\n'; printTab(m_so, m_d);
     m_so << "<?" << v->tag;
     printAttris(v->attris);
     m_so << "?>";
 }
Exemplo n.º 6
0
Arquivo: td3.c Projeto: anliec/TP-Algo
int main(void) 
{
  char lecture[100];
  int val;
  BinaryHeap * heap;
  heap = Init(10);

  fscanf(stdin,"%99s",lecture);
  while (strcmp(lecture,"bye")!=0) {
    if (strcmp(lecture,"insert")==0) {
      fscanf(stdin,"%99s",lecture);
      val = strtol(lecture,NULL,10);
      InsertValue(heap,val);
    } else if (strcmp(lecture,"extract")==0) {
      if(ExtractMax(heap,&val))
      {
        printf("%d\r\n",val);
      }
    } else if (strcmp(lecture,"print")==0) {
      printTab(heap);
    }
    fscanf(stdin,"%99s",lecture);
  }
  Destroy(heap);
  return 0;
}
Exemplo n.º 7
0
void printString(FILE *stream, Print_Data_Ptr printer,
		 const char *pString, int32 keepWithNext)
{ 
  int32 length;
  
  if (!printer->truncatedGlobal) {
    if (pString)
      length = strlen(pString);
    else
      length = 0;
    
    if ((printer->cursorPosGlobal + length + keepWithNext) > LINE_LENGTH) 
      {
	newLine(stream, printer);
	printTab(stream, printer, GET_M_GLOBAL(indentGlobal)+1);
      }
    if (printer->lineNumGlobal < PRINT_LENGTH) {
      if (pString) {
	(void)fprintf(stream, "%s", pString);
	printer->cursorPosGlobal += length;
      }
      else {
	(void)fprintf(stream, "NULL");
	printer->cursorPosGlobal += 4;
      }
    }
    else {
      printer->truncatedGlobal = 1;
      (void)fprintf(stream, "...");
    }
  }
}
Exemplo n.º 8
0
 virtual void visit(Node_Element *v)
 {
     m_so << '\n'; printTab(m_so, m_d);
     m_so << "<" << v->tag;
     printAttris(v->attris);
     if (v->children.empty()) {
         m_so << "/>";
     }
     else {
         m_so << ">";
         ++m_d;
         for (NodePtrList::iterator iter = v->children.begin(); iter != v->children.end(); ++iter) {
             (*iter)->acceptVisitor(this);
         }
         --m_d;
         m_so << '\n'; printTab(m_so, m_d);
         m_so << "</" << v->tag << ">";
     }
 }
Exemplo n.º 9
0
void* maSuperfonction_3(void * t_data){
  
  tab[4]=25;
  printf("\nthread 3\n");
  printTab(tab);
  
  
  
  return NULL;
}
Exemplo n.º 10
0
 virtual void visit(Node_Element *v)
 {
     printKV("type", "element");
     printKV("tag", v->tag);
     printAttris(v->attris);
     if (!v->children.empty()) {
         printTab(m_so, m_d); m_so << "children = ";
         printNodes(v->children);
         m_so << ",\n";
     }
 }
Exemplo n.º 11
0
int main()
{
	float tabx[15];
	float taby[]={109.4,110.1,112.0,114.7,116.0,118.1,119.5,121.8,123.1,124.9,127.6,129.4,130.6,131.9,134.1};
	int x;

	for(x=1,tabx[0]=25;x<15;x++)
	{
		tabx[x]=tabx[x-1]+5;
	};
	printf("   i|");
	for(x=0;x<15;x++)
	{
		printf("%5d|",x);
	};
	printf("\n");
	printTab("x[i]",15,tabx,0);
	printTab("y[i]",15,taby,1);
	return 0;
};
Exemplo n.º 12
0
/* Prototype */
void incTab (tabint *T); /* Increment setiap elemen tabel */
void printTab (tabint T); /* Print tabel */
int main()
{
/* kamus */
tabint T;
int i;
/* program */
T.N = 3;
printf("Isi dan print tabel untuk indeks 1..5 \n");
/* isi dari pembacaan */
for (i = 0; i < T.N; i++) {
printf("Input tabel ke -[%d] = ", i);
scanf ("%d", &(T.tab[i]));
};
/* Print : perhatikan passing parameter by value */
printTab(T);
/* Increment : perhatikan passing parameter by reference */
incTab (&T);
printTab (T);
return 0;
}
Exemplo n.º 13
0
static void printSpace(FILE *stream, Print_Data_Ptr printer)
{
  if (!printer->truncatedGlobal) {
    if (printer->cursorPosGlobal == LINE_LENGTH) {
      newLine(stream, printer);
      printTab(stream, printer, GET_M_GLOBAL(indentGlobal));
    }
    
    (void)fprintf(stream, "%c", ' ');
    printer->cursorPosGlobal++;
  }
}
Exemplo n.º 14
0
	void		ObjectGroup::print()
	{
		printTab();
		std::cout <<
			"ObjectGroup\tid:" << m_id <<
			//" ptr:" << *m_ptr <<
			//" node:" << *m_ptrToHeadNode <<
			//" uk1:" << *m_unknown1 <<
			//" uk2:" << *m_unknown2 <<
			" count:" << m_count << std::endl;
		if (m_node != NULL)
			m_node->print();
	}
Exemplo n.º 15
0
void main(){
	int tab1[MAX]={1,2,3,4,5,6};
	int tab2[MAX]={6,5,4,3,2,1};
	int tab3[MAX];

	int i; //index
	for (i=0; i<MAX; i++){
		tab3[i]=tab1[i]+tab2[MAX-(i+1)];
	}

	printTab(tab3);

}
Exemplo n.º 16
0
void* maSuperfonction_2(void * t_data){
  
  pthread_mutex_lock(&mutex_1);
  
  printf("\nthread 2\n");
  printTab(tab);
  pthread_cond_signal(&cond_test);
  printf("\nthread 2 après cond_signal\n");
  
  pthread_mutex_unlock(&mutex_1);
  
  
  return NULL;
}
Exemplo n.º 17
0
void* maSuperfonction(void * t_data){
  
  
  
  
  pthread_mutex_lock(&mutex_1);
  
  printf("\nthread 1\n");
  pthread_cond_wait(&cond_test,&mutex_1);
  printf("\nthread 1 avant modif\n");
  tab[0]=1;
  tab[1]=2;
  tab[2]=3;
  tab[3]=4;
  tab[4]=5;
  
  
  printf("\nthread 1 tab\n");
  printTab(tab);
  pthread_mutex_unlock(&mutex_1);
  return NULL;
}
Exemplo n.º 18
0
	void visit(const Structure* structure) {
		Assert(isTheoryOpen());

		printTab();
		output() << "Data: " << '\n';
		indent();

		auto voc = structure->vocabulary();
		for (auto it = voc->firstSort(); it != voc->lastSort(); ++it) {
			auto s = it->second;
			if (not s->builtin()) {
				printTab();
				auto name = s->name();
				name = capitalize(name);
				output() << name << " = ";
				auto st = structure->inter(s);
				visit(st);
				output() << '\n';
			}
		}
		for (auto it = voc->firstPred(); it != voc->lastPred(); ++it) {
			auto sp = it->second->nonbuiltins();
			for (auto jt = sp.cbegin(); jt != sp.cend(); ++jt) {
				auto p = *jt;
				if (p->arity() == 1 && p->sorts()[0]->pred() == p) { // If it is in fact a sort, ignore it
					continue;
				}
				auto pi = structure->inter(p);
				if (pi->ct()->size() == 0 && pi->cf()->size() == 0) {
					continue;
				}
				if (not pi->approxTwoValued()) {
					output() << "Partial: " << '\n'; //TEMPORARY GO TO PARTIAL BLOCK
				}
				printTab();
				auto name = p->nameNoArity();
				name = capitalize(name);
				output() << name << " = ";
				visit(pi->ct());
				if (not pi->approxTwoValued()) {
					visit(pi->cf());
					output() << '\n';
					output() << "Data: "; //RETURN TO DATA BLOCK
				}
				output() << '\n';
			}
		}
		for (auto it = voc->firstFunc(); it != voc->lastFunc(); ++it) {
			auto sf = it->second->nonbuiltins();
			for (auto jt = sf.cbegin(); jt != sf.cend(); ++jt) {
				auto f = *jt;
				auto fi = structure->inter(f);
				if (fi->approxTwoValued()) {
					printTab();
					auto name = f->nameNoArity();
					name = capitalize(name);
					output() << name << " = ";
					auto ft = fi->funcTable();
					visit(ft);
				} else {
					auto pi = fi->graphInter();
					auto ct = pi->ct();
					auto cf = pi->cf();
					if (ct->approxEmpty() && cf->approxEmpty()) {
						continue;
					}
					output() << "Partial: " << '\n'; //TEMPORARY GO TO PARTIAL BLOCK
					printTab();
					auto name = f->nameNoArity();
					name = capitalize(name);
					output() << name << " = ";
					printAsFunc(ct);
					printAsFunc(cf);
					output() << '\n';
					output() << "Data: "; //RETURN TO DATA BLOCK
				}
				output() << '\n';
			}
		}
		unindent();
		output() << '\n';
	}
Exemplo n.º 19
0
 virtual void visit(Node_Text *v)
 {
     m_so << '\n'; printTab(m_so, m_d);
     m_so << v->s;
 }
Exemplo n.º 20
0
 virtual void visit(Node_Comment *v)
 {
     m_so << '\n'; printTab(m_so, m_d);
     m_so << "<!--" << v->s << "-->";
 }
Exemplo n.º 21
0
 void printKV(const std::string& k, const std::string& v)
 {
     printTab(m_so, m_d); 
     m_so << "['" << k << "'] = '" << v << "',\n";
 }