void printHeap(int array[], int len){
	//un po di spazi
	printf("\n");
	//numero di elementi che vanno stampati nella riga
	int riga_heap = 1;
	//contatore che mi indica quando devo andare a capo
	int count = riga_heap;
	
	for(int i = 0;i < len; i++){
		//distribuzione delgi spazi prima e dopo(non è perfetta, 
		//ma l'approssimazione grafica mi sembra abbastanza buona)
		printSpace(len/(i+1));
		//stampo l'elemento
		printf("%d",array[i]);
		//ancora spazi
		printSpace(len/(i+1));
		//scalo contore per andare a capo
		count--;
		//se il contatore si esaurisce vado a capo
		if(count == 0){
			//vado a capo
			printf("\n\n");
			//incremento gli elementi da stampare per riga
			riga_heap*=2;
			//ricarico contatore
			count = riga_heap;
		}
	}
	//ancora spazi
	printf("\n\n\n");
}
Ejemplo n.º 2
0
void mapPrint(FILE *stream, const genericMatrix *map, CONST_FORMAT_PTR format,
	      int32 keepWithNext, const void *mapElements)
{ 
  FORMAT_ARRAY_TYPE mapFormatArray[4];
  
  mapFormatArray[0].i = 4;
  mapFormatArray[1].f = (FORMAT_PTR)format;
  mapFormatArray[2].i = map->ub1 - map->lb1 + 1;
  mapFormatArray[3].i = map->ub2 - map->lb2 + 1;
  
  /* Print header: "[Map (lb1, ub1)(lb2, ub2): " */
  printString(stream, printer, "[Map (", 5);
  printInt(stream, &(map->lb1), 1);
  printCommaSpace(stream);
  printInt(stream, &(map->ub1), 1);
  printString(stream, printer, ")", 0);
  printString(stream, printer, "(", 5);
  printInt(stream, &(map->lb2), 1);
  printCommaSpace(stream);
  printInt(stream, &(map->ub2), 2);
  printString(stream, printer, "):", 0);
  printSpace(stream);
  
  (void)printArrayData(stream, mapFormatArray[1].f, mapElements,
		       /* &(map->el[map->lb1][map->lb2]),*/
		       0, mapFormatArray, 2, keepWithNext+1, "[", "]");
}
Ejemplo n.º 3
0
void Negate::print(int level)
{
#ifdef DEBUG
    printSpace(level);
    printf("Negate: arg:\n");
    e->print(level + 1);
#endif /* DEBUG */
}
Ejemplo n.º 4
0
void
Const::print(int level)
{
#ifdef DEBUG
    printSpace(level);
    printf("Const: val = %g\n", val);
#endif /* DEBUG */
}
Ejemplo n.º 5
0
void
Expr::print(int level)
{
#ifdef DEBUG
    printSpace(level);
    printf("Expr: type %s\n", type == FLOAT ? "FLOAT" : "VEC3F");
#endif /* DEBUG */
}
Ejemplo n.º 6
0
Archivo: ascart.c Proyecto: NeTTa/espl
void printWord(int iline , int argc ,char **argv){
	int iarg;
	for(iarg = 1; iarg != argc; ++iarg) {
		char *c = argv[iarg];
		printChar(c,iline);
		printSpace(iarg , iline , argc);
	}
}
Ejemplo n.º 7
0
void BinaryOp::print(int level)
{
#ifdef DEBUG
    printSpace(level);
    printf("BinaryOp: args:\n");
    a->print(level + 1);
    b->print(level + 1);
#endif /* DEBUG */
}
Ejemplo n.º 8
0
void Ternary::print(int level)
{
#ifdef DEBUG
    printSpace(level);
    printf("Ternary: conditional + 2 args:\n");
    etest->print(level + 1);
    etrue->print(level + 1);
    efalse->print(level + 1);
#endif /* DEBUG */
}
Ejemplo n.º 9
0
void
Func::print(int level)
{
#ifdef DEBUG
    printSpace(level);
    printf("Func: name = %s, %d args:\n", name, args->getLength());
    for (int i = 0; i < args->getLength(); i++)
	(*args)[i]->print(level + 1);
#endif /* DEBUG */
}
Ejemplo n.º 10
0
void Var::print(int level)
{
#ifdef DEBUG
    printSpace(level);
    printf("Var: name = %s, value = ", name);
    if (type == FLOAT)
	printf("%g", *pfloat);
    else
	printf("(%g %g %g)", (*pvec3f)[0], (*pvec3f)[1], (*pvec3f)[2]);
    printf("\n");
#endif /* DEBUG */
}
Ejemplo n.º 11
0
int main(int argc, char *argv[]) {
  uint32_t nodeNum = atol(argv[1]);
  uint32_t sigma = atoi(argv[2]);
  char *file = argv[3];
  double loadFactor = atof(argv[4]);

  Bonsai b(nodeNum, sigma, loadFactor, file);
  b.build();
  std::cout << "node Count: " << b.nodeNumberCount << std::endl;
  b.searchBench(argv[5]);
  printSpace(b);

  return 0;
}
Ejemplo n.º 12
0
void traverse(treeNode* root,int i){	
	if(root != NULL){
		printSpace(i);
		display(root);
		root = root->firstChild;
		while(root != NULL){
			i = i+2;
			traverse(root,i);
			i = i-2;	
			root = root->sibling;
		}
	}
	
}
Ejemplo n.º 13
0
void drawGrid(CONTEXT context)
{
	flushDisplay();
	contextNewPass(context);
	
	//Draw the top of the display
	uint offset = LENGTH_BORDER + LENGTH_NODE / 2 - WIDTH_ROAD_EXTERNAL / 2, internalSpace = WIDTH_ROAD_EXTERNAL;
	
	for(byte i = 0; i < NB_SLOTS_BORDER - 1; ++i)
	{
		printSpace(offset);
		printWideVerticalRoad(context, "\u2551");
		contextJumpNewLine(context);
		putc('\n', stdout);
	}
	
	offset -= 2 * CAR_WIDTH + 1;
	
	//Add the line at the top of
	printSpace(offset);
	fputs(COLOR_BORDER "_____" , stdout);
	printWideVerticalRoad(context, "\u2569");
	contextJumpNewLine(context);
	puts(COLOR_BORDER "_____" );
	
	//Top horizontal line
	printSpace(--offset);
	fputs(COLOR_BORDER"/ ", stdout);
	printHorizontalRoad(context, 11, false);
	contextJumpNewLine(context);
	puts(COLOR_BORDER" \\");
	
	//Empty space between the two top lines
	printSpace(--offset);
	printf(COLOR_BORDER"/"COLOR_CAR" %c "COLOR_SEPARATOR, getCarReadableGlyph(context));
	printChar("\u2501\u2501\u2501", 6);
	printf(COLOR_CAR"  %c "COLOR_BORDER"\\""\n", getCarReadableGlyph(context));
	contextJumpNewLine(context);
	
	//Internal line
	printSpace(--offset);
	printf(COLOR_BORDER"/ "COLOR_CAR"%c "COLOR_SEPARATOR"/ ", getCarReadableGlyph(context));
	printHorizontalRoad(context, 9, false);
	printf(COLOR_SEPARATOR" \\"COLOR_CAR" %c "COLOR_BORDER"\\\n", getCarReadableGlyph(context));
	contextJumpNewLine(context);
	
	//First oblique portion
	printSpace(--offset);
	printOblique45Road(context);
	printChar(COLOR_BORDER"¯", --internalSpace);
	printOblique135Road(context);
	contextJumpNewLine(context);
	putc('\n', stdout);
	
	for(byte i = 0; i < 3; ++i)
	{
		printSpace(--offset);
		printOblique45Road(context);
		internalSpace += 2;
		printSpace(internalSpace);
		printOblique135Road(context);
		contextJumpNewLine(context);
		putc('\n', stdout);
	}
	
	printChar(COLOR_BORDER"_", --offset);
	printf(COLOR_BORDER"/"COLOR_CAR"  %c "COLOR_SEPARATOR"\u2502"COLOR_CAR" %c "COLOR_BORDER"\u2502", getCarReadableGlyph(context), getCarReadableGlyph(context));
	printSpace(internalSpace);
	printf(COLOR_BORDER"\u2502"COLOR_CAR" %c "COLOR_SEPARATOR"\u2502"COLOR_CAR" %c  "COLOR_BORDER"\\", getCarReadableGlyph(context), getCarReadableGlyph(context));
	printChar(COLOR_BORDER"_", offset);
	contextJumpNewLine(context);
	fputs("\n"COLOR_SEPARATOR, stdout);

	//Top two lines
	for(byte i = 0; i < 2; ++i)
	{
		printHorizontalRoad(context, NB_SLOTS_BORDER + 1, true);
		printf(COLOR_SEPARATOR" \u2502"COLOR_CAR" %c "COLOR_BORDER"\u2502", getCarReadableGlyph(context));
		printSpace(internalSpace);
		printf("\u2502"COLOR_CAR" %c "COLOR_SEPARATOR"\u2502 ", getCarReadableGlyph(context));
		printHorizontalRoad(context, NB_SLOTS_BORDER + 1, true);
		contextJumpNewLine(context);
		putc('\n', stdout);
	}
	
	//Separator
	fputs(COLOR_SEPARATOR, stdout);
	printChar("\u2550\u2550\u2550", offset / 3);
	printf("\u2563  "COLOR_CAR"%c "COLOR_SEPARATOR"\u2502"COLOR_CAR" %c "COLOR_BORDER"\u2502", getCarReadableGlyph(context), getCarReadableGlyph(context));
	printSpace(internalSpace);
	printf(COLOR_BORDER"\u2502"COLOR_CAR" %c "COLOR_SEPARATOR"\u2502"COLOR_CAR" %c  "COLOR_SEPARATOR"\u2560", getCarReadableGlyph(context), getCarReadableGlyph(context));
	printChar("\u2550\u2550\u2550", offset / 3);
	contextJumpNewLine(context);
	putc('\n', stdout);
	
	//Last two lines
	for(byte i = 0; i < 2; ++i)
	{
		printHorizontalRoad(context, NB_SLOTS_BORDER + 1, true);
		printf(COLOR_SEPARATOR" \u2502"COLOR_CAR" %c "COLOR_BORDER"\u2502", getCarReadableGlyph(context));
		printSpace(internalSpace);
		printf("\u2502"COLOR_CAR" %c "COLOR_SEPARATOR"\u2502 ", getCarReadableGlyph(context));
		printHorizontalRoad(context, NB_SLOTS_BORDER + 1, true);
		contextJumpNewLine(context);
		putc('\n', stdout);
	}

	//Starting to close the area
	printChar(COLOR_BORDER"¯", offset);
	printf(COLOR_BORDER"\\"COLOR_CAR"  %c "COLOR_SEPARATOR"\u2502"COLOR_CAR" %c "COLOR_BORDER"\u2502", getCarReadableGlyph(context), getCarReadableGlyph(context));
	printSpace(internalSpace);
	printf(COLOR_BORDER"\u2502"COLOR_CAR" %c "COLOR_SEPARATOR"\u2502"COLOR_CAR" %c  "COLOR_BORDER"/", getCarReadableGlyph(context), getCarReadableGlyph(context));
	printChar(COLOR_BORDER"¯", offset);
	contextJumpNewLine(context);
	putc('\n', stdout);
	
	for(byte i = 0; i < 3; ++i)
	{
		printSpace(++offset);
		printOblique135Road(context);
		printSpace(internalSpace);
		internalSpace -= 2;
		printOblique45Road(context);
		contextJumpNewLine(context);
		putc('\n', stdout);
	}
	
	//Last oblique portion
	printSpace(++offset);
	printOblique135Road(context);
	printChar(COLOR_BORDER "_" , internalSpace++);
	printOblique45Road(context);
	contextJumpNewLine(context);
	putc('\n', stdout);

	//Internal line
	printSpace(++offset);
	printf(COLOR_BORDER"\\ "COLOR_CAR"%c "COLOR_SEPARATOR"\\ ", getCarReadableGlyph(context));
	printHorizontalRoad(context, 9, false);
	printf(COLOR_SEPARATOR" /"COLOR_CAR" %c "COLOR_BORDER"/\n", getCarReadableGlyph(context));
	contextJumpNewLine(context);
	
	//Empty space between the two top lines
	printSpace(++offset);
	printf(COLOR_BORDER"\\"COLOR_CAR" %c "COLOR_SEPARATOR, getCarReadableGlyph(context));
	printChar("\u2501\u2501\u2501", 6);
	printf(COLOR_CAR"  %c "COLOR_BORDER"/""\n", getCarReadableGlyph(context));
	contextJumpNewLine(context);

	//Top horizontal line
	printSpace(++offset);
	fputs(COLOR_BORDER"\\ ", stdout);
	printHorizontalRoad(context, 11, false);
	contextJumpNewLine(context);
	puts(COLOR_BORDER" /");
	
	//Add the line at the top of
	printSpace(++offset);
	fputs(COLOR_BORDER"¯¯¯¯¯", stdout);
	printWideVerticalRoad(context, "\u2566");
	contextJumpNewLine(context);
	puts(COLOR_BORDER"¯¯¯¯¯");
	
	offset += 2 * CAR_WIDTH + 1;

	for(byte i = 0; i < NB_SLOTS_BORDER - 1; ++i)
	{
		printSpace(offset);
		printWideVerticalRoad(context, "\u2551");
		contextJumpNewLine(context);
		putc('\n', stdout);
	}
}
Ejemplo n.º 14
0
static void printCommaSpace(FILE *stream, Print_Data_Ptr printer)
{
  printString(stream, printer, ",", 0);
  printSpace(stream, printer);
}