Exemplo n.º 1
0
std::ostream& operator<<(std::ostream& o, const amqp_uuid& u) {
    std::ios_base::fmtflags ff = o.flags();
    o.flags(std::ios_base::hex);
    print_segment(o, u, 0, 4, "-");
    print_segment(o, u, 4, 6, "-");
    print_segment(o, u, 6, 8, "-");
    print_segment(o, u, 8, 10, "-");
    print_segment(o, u, 10, 16);
    o.flags(ff);
    return o;
}
void print_row(int s1, int s2, int s3)
{
  int i, which_digit, digit_count;

  for (i = 0, digit_count = 0; input[i] != '\n' && digit_count < MAX_DIGITS; i++) {
    if (isdigit(input[i])) {
      which_digit = (int) input[i] - '0';
      print_segment(s1, which_digit);
      print_segment(s2, which_digit);
      print_segment(s3, which_digit);
      printf(" ");

      digit_count++;
    }
  }
  printf("\n");
}
void	*ft_print_memory(void *addr, unsigned int size)
{
    int	i;

    i = 0;
    while (i < size)
    {
        print_address(i, 10);
        ft_putchar(':');
        ft_putchar(' ');
        print_ascii(addr, i, size);
        print_segment(addr, i, size);
        i += 16;
    }
    return (addr);
}
Exemplo n.º 4
0
/* prints the 'closed list' in a human readable form */
void print_closed_list()
{
    struct _ListNode *prev_ptr;

    prev_ptr = closed_list_head;

    printf("Closed List: (\n");
    while (prev_ptr != NULL)
    {
        printf("  %d%c: ", prev_ptr->node->belongs_to, prev_ptr->node->SoE);
        print_segment(prev_ptr->node->belongs_to);
        printf("  g=%.2f,h=%.2f,f=%.2f\n", prev_ptr->node->g_value, 
            prev_ptr->node->h_value, prev_ptr->node->f_value);
        //printf(" %.2f", prev_ptr->node->f_value);
        prev_ptr = prev_ptr->next;
    }
    printf(" )\n");
}
Exemplo n.º 5
0
void Filler::print_node(Node* node,std::ofstream& file){
  double x,y,z;
  double x1,y1,z1;
  double x2,y2,z2;
  double x3,y3,z3;
  double x4,y4,z4;
  double x5,y5,z5;
  double x6,y6,z6;
  double h;
  Metric m;
  SPoint3 point;

  point = node->get_point();
  x = point.x();
  y = point.y();
  z = point.z();
  h = node->get_size();
  m = node->get_metric();

  x1 = x + k1*h*m.get_m11();
  y1 = y + k1*h*m.get_m21();
  z1 = z + k1*h*m.get_m31();

  x2 = x - k1*h*m.get_m11();
  y2 = y - k1*h*m.get_m21();
  z2 = z - k1*h*m.get_m31();

  x3 = x + k1*h*m.get_m12();
  y3 = y + k1*h*m.get_m22();
  z3 = z + k1*h*m.get_m32();

  x4 = x - k1*h*m.get_m12();
  y4 = y - k1*h*m.get_m22();
  z4 = z - k1*h*m.get_m32();

  x5 = x + k1*h*m.get_m13();
  y5 = y + k1*h*m.get_m23();
  z5 = z + k1*h*m.get_m33();

  x6 = x - k1*h*m.get_m13();
  y6 = y - k1*h*m.get_m23();
  z6 = z - k1*h*m.get_m33();

  print_segment(SPoint3(x,y,z),SPoint3(x1,y1,z1),file);
  print_segment(SPoint3(x,y,z),SPoint3(x2,y2,z2),file);
  print_segment(SPoint3(x,y,z),SPoint3(x3,y3,z3),file);
  print_segment(SPoint3(x,y,z),SPoint3(x4,y4,z4),file);
  print_segment(SPoint3(x,y,z),SPoint3(x5,y5,z5),file);
  print_segment(SPoint3(x,y,z),SPoint3(x6,y6,z6),file);
}
Exemplo n.º 6
0
CA_BOOL segment_command_impl(char* args)
{
	struct ca_segment* segment;

	if (args)
	{
		address_t addr = ca_eval_address (args);
		segment = get_segment(addr, 0);
		if (segment)
		{
			CA_PRINT("Address %s belongs to segment:\n", args);
			print_segment(segment);
		}
		else
			CA_PRINT("Address %s doesn't belong to any segment\n", args);
	}
	else
	{
		unsigned int i;
		CA_PRINT("vaddr                         size      perm     name\n");
		CA_PRINT("=====================================================\n");
		for (i=0; i<g_segment_count; i++)
		{
			struct ca_segment* segment = &g_segments[i];
			CA_PRINT("[%4d] ", i);
			print_segment(segment);
		}
		// Find out why SIZE is much bigger than RSS, it might be modules, thread stack or heap, or all
		/*if (!g_debug_core)
		{
			size_t heap_gap = 0, stack_gap = 0, module_gap = 0;	// account for gap between RSS and SIZE
			int pid = ptid_get_pid (inferior_ptid);
			char fname[128];
			FILE* fp;

			snprintf(fname, 128, "/proc/%d/smaps", pid);
			if ((fp = fopen (fname, "r")) != NULL)
			{
				int ret;
				// Now iterate until end-of-file.
				do
				{
					int k;
					address_t addr, endaddr, offset, inode;
					char permissions[8], device[8], filename[128];
					size_t vsize, rss, dumb;

					ret = fscanf (fp, "%lx-%lx %s %lx %s %lx",
							    &addr, &endaddr, permissions, &offset, device, &inode);
					if (ret <= 0 || ret == EOF)
						break;
					filename[0] = '\0';
					if (ret > 0 && ret != EOF)
						ret += fscanf (fp, "%[^\n]\n", filename);
					ret = fscanf (fp, "Size: %ld kB\n", &vsize);
					ret = fscanf (fp, "Rss: %ld kB\n", &rss);
					for (k = 0; k < 11; k++)
						fgets(filename, 128, fp);	// Pss, etc.
					//CA_PRINT("Segment: 0x%lx SIZE=%ld RSS=%ld\n", addr, vsize, rss);
					if (vsize > rss)
					{
						struct ca_segment* segment = get_segment(addr, 1);
						size_t gap = (vsize - rss) * 1024;
						if (segment)
						{
							if (segment->m_type == ENUM_STACK)
								stack_gap += gap;
							else if (segment->m_type == ENUM_MODULE_TEXT || segment->m_type == ENUM_MODULE_DATA)
								module_gap += gap;
							else if (segment->m_type == ENUM_HEAP)
								heap_gap += gap;
						}
					}
				} while(1);
				fclose(fp);

				CA_PRINT("Gap between SIZE and RSS:\n");
				CA_PRINT("\tmodules: ");
				print_size(module_gap);
				CA_PRINT("\n");
				CA_PRINT("\tthreads: ");
				print_size(stack_gap);
				CA_PRINT("\n");
				CA_PRINT("\theap: ");
				print_size(heap_gap);
				CA_PRINT("\n");
			}
		}*/
	}
	return CA_TRUE;
}
Exemplo n.º 7
0
main()
{
	point p1,p2,q1,q2,i;
	line l1,l2;
	segment s1,s2,s3,s4;

	while ( scanf("%lf %lf",&p1[X],&p1[Y]) != EOF ) {
        	scanf("%lf %lf",&p2[X],&p2[Y]);
		scanf("%lf %lf",&q1[X],&q1[Y]);
		scanf("%lf %lf",&q2[X],&q2[Y]);

/*
	        print_point(p1);
		print_point(p2);
		print_point(q1);
		print_point(q2);
*/

		points_to_segment(p1,p2,&s1);
		points_to_segment(q1,q2,&s2);

                points_to_line(p1,p2,&l1);
                points_to_line(q1,q2,&l2);

		print_segment(s1);
		print_segment(s2);
		
/*
		printf("slope and line tests\n");
		point_and_slope_to_line(p1,-l1.a,&l3);
		print_line(l3);
                point_and_slope_to_line(p2,-l1.a,&l3);
                print_line(l3);
                point_and_slope_to_line(q1,-l2.a,&l3);
                print_line(l3);
                point_and_slope_to_line(q2,-l2.a,&l3);
                print_line(l3);
*/

		printf("segments_intersect test\n");
		printf("%d\n", segments_intersect(s1,s2));

		printf("intersection point\n");
		intersection_point(l1,l2,i);
		print_point(i);

/*
		printf("closest point\n");
		closest_point(p1,l1,i);
		print_point(i);
                closest_point(p2,l1,i);
                print_point(i);
                closest_point(q1,l1,i);
                print_point(i);
                closest_point(q2,l1,i);
                print_point(i);
                closest_point(p1,l2,i);
                print_point(i);
                closest_point(p2,l2,i);
                print_point(i);
                closest_point(q1,l2,i);
                print_point(i);
                closest_point(q2,l2,i);
                print_point(i);
*/


		printf("--------------------------------\n");
	}


}
Exemplo n.º 8
0
static inline void print_segment0(Mem_T memory){
        print_segment(Mem_arr_get(memory->segment_seq, 0));
}