コード例 #1
0
ファイル: xgccache.c プロジェクト: hroptatyr/sxemacs
void describe_gc_cache(struct gc_cache *cache)
{
	int count = 0;
	struct gc_cache_cell *cell = cache->head;
	stderr_out("\nsize:    %d", cache->size);
	stderr_out("\ncreated: %d", cache->create_count);
	stderr_out("\ndeleted: %d", cache->delete_count);
	while (cell) {
		struct gc_cache_cell *cell2;
		int i = 0;
		stderr_out("\n%d:\t0x%lx  GC: 0x%08lx  hash: 0x%08lx\n",
			   count, (long)cell, (long)cell->gc,
			   gc_cache_hash(&cell->gcvm));
		for (cell2 = cache->head; cell2; cell2 = cell2->next, i++)
			if (count != i &&
			    gc_cache_hash(&cell->gcvm) ==
			    gc_cache_hash(&cell2->gcvm))
				stderr_out("\tHASH COLLISION with cell %d\n",
					   i);
		stderr_out("\tmask:       %8lx\n", cell->gcvm.mask);

#define FROB(field) do {						\
  if ((int)cell->gcvm.gcv.field != (~0))				\
    stderr_out ("\t%-12s%8x\n", #field ":", (int)cell->gcvm.gcv.field);	\
} while (0)
		FROB(function);
		FROB(plane_mask);
		FROB(foreground);
		FROB(background);
		FROB(line_width);
		FROB(line_style);
		FROB(cap_style);
		FROB(join_style);
		FROB(fill_style);
		FROB(fill_rule);
		FROB(arc_mode);
		FROB(tile);
		FROB(stipple);
		FROB(ts_x_origin);
		FROB(ts_y_origin);
		FROB(font);
		FROB(subwindow_mode);
		FROB(graphics_exposures);
		FROB(clip_x_origin);
		FROB(clip_y_origin);
		FROB(clip_mask);
		FROB(dash_offset);
#undef FROB

		count++;
		if (cell->next && cell == cache->tail)
			stderr_out("\nERROR!  tail is here!\n\n");
		else if (!cell->next && cell != cache->tail)
			stderr_out("\nERROR!  tail is not at the end\n\n");
		cell = cell->next;
	}
	if (count != cache->size)
		stderr_out("\nERROR!  count should be %d\n\n", cache->size);
}
コード例 #2
0
ファイル: xgccache.c プロジェクト: sbp/lemacs
void
describe_gc_cache (struct gc_cache *cache)
{
  int count = 0;
  struct gc_cache_cell *cell = cache->head;
  fprintf (stderr, "\nsize:    %d", cache->size);
  fprintf (stderr, "\ncreated: %d", cache->create_count);
  fprintf (stderr, "\ndeleted: %d", cache->delete_count);
  while (cell)
  {
    struct gc_cache_cell *cell2;
    int i = 0;
    fprintf (stderr,"\n%d:\t0x%x  GC: 0x%08x  hash: 0x%08lx\n",
	     count, (int) cell, (int) cell->gc, gc_cache_hash (&cell->gcvm));
    for (cell2 = cache->head; cell2; cell2 = cell2->next, i++)
      if (count != i &&
	  gc_cache_hash (&cell->gcvm) == gc_cache_hash (&cell2->gcvm))
	fprintf (stderr, "\tHASH COLLISION with cell %d\n", i);
    fprintf (stderr,"\tmask:       %8lx\n", cell->gcvm.mask);
#define F(x) (int)cell->gcvm.gcv.x
#define G(w,x) if (F(x) != (~0)) fprintf (stderr, "\t%-12s%8x\n", w, F(x))
    G("function:", function);
    G("plane_mask:", plane_mask);
    G("foreground:", foreground);
    G("background:", background);
    G("line_width:", line_width);
    G("line_style:", line_style);
    G("cap_style:", cap_style);
    G("join_style:", join_style);
    G("fill_style:", fill_style);
    G("fill_rule:", fill_rule);
    G("arc_mode:", arc_mode);
    G("tile:", tile);
    G("stipple:", stipple);
    G("tsx_origin:", ts_x_origin);
    G("tsy_origin:", ts_y_origin);
    G("font:", font);
    G("subwindow:", subwindow_mode);
    G("gexposures:", graphics_exposures);
    G("clip_x:", clip_x_origin);
    G("clip_y:", clip_y_origin);
    G("clip_mask:", clip_mask);
    G("dash_off:", dash_offset);
#undef F
#undef G
    count++;
    if (cell->next && cell == cache->tail)
      fprintf (stderr, "\nERROR!  tail is here!\n\n");
    else if (!cell->next && cell != cache->tail)
      fprintf (stderr, "\nERROR!  tail is not at the end\n\n");
    cell = cell->next;
  }
  if (count != cache->size)
    fprintf (stderr, "\nERROR!  count should be %d\n\n", cache->size);
}