Exemple #1
0
void
RenderQueryDithersReply (FD fd, const unsigned char *buf)
{
  PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* RenderRequest reply */ ;
  PrintField(RBf, 1, 1, RENDERREPLY, RENDERREPLYHEADER) /* RenderQueryVersion reply */;
  if (Verbose < 1)
    return;
  printfield(buf, 2, 2, CARD16, "sequence number");
  printfield(buf, 4, 4, DVALUE4(0), "reply length");
}
Exemple #2
0
void
MitshmGetImageReply (FD fd, const unsigned char *buf)
{
  PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* MitshmRequest reply */ ;
  if (Verbose < 1)
    return;
  PrintField(RBf, 1, 1, CARD8, "depth") /* shared Pixmaps */;
  printfield(buf, 2, 2, CARD16, "sequence number");
  printfield(buf, 4, 4, DVALUE4(0), "reply length");
  PrintField(buf, 8, 4, VISUALID, "visual");
}
Exemple #3
0
int main(int argc, char **argv)
{
    char *filename;
    FILE *fd;
    int left = (9*9)*9;
    int count=0;

    if (argc == 2) {
        filename = argv[1];
    } else {
        filename = "fields.sud";
    }

    bf_backups = malloc(sizeof(struct bf_backups));

    if (!(fd = fopen(filename, "r"))) {
        printf("error opening file\n");
        exit(1);
    }
    if(readfield(fd)) {
        printf("error reading field\n");
        exit(1);
    }

    if (initialize())
        exit(1);

    fill_all();
    check_filled();
    printfield(wfield, 1);
    bruteforced = 0;

    /* main loop */
    while (left > 0) {
        check_validity();
        solve_run(&count);
        check_validity();
        left = get_left();
        count++;
    }
    if (final_check()) {
        winprintf(wtext, "\n\rSolved successfully\n\r");
    } else {
        winprintf(wtext, "\n\rThere are still some errors\n\r");
    }
    printfield(wfield, 1);
    press_any_key();
    endwin();
    return(0);
}
Exemple #4
0
void
MitshmQueryVersionReply (FD fd, const unsigned char *buf)
{
  PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* MitshmRequest reply */ ;
  if (Verbose < 1)
    return;
  PrintField(RBf, 1, 1, BOOL, "shared-pixmaps") /* shared Pixmaps */;
  printfield(buf, 2, 2, CARD16, "sequence number");
  printfield(buf, 4, 4, DVALUE4(0), "reply length");
  PrintField(buf, 8, 2, CARD16, "major-version");
  PrintField(buf, 10, 2, CARD16, "minor-version");
  PrintField(buf, 12, 2, CARD16, "uid");
  PrintField(buf, 14, 2, CARD16, "gid");
  PrintField(buf, 16, 1, CARD8, "pixmap-format");
}
Exemple #5
0
static void
PrintGlyphList(const unsigned char *buf, int length, char *name, int size)
{
  short   n;

  fprintf(stdout, "%s%20s:\n", Leader, name);
  while (length >= 8)
  {
    n = IByte(&buf[0]);
    if (n != 255)
    {
      printfield(buf, 0, 1, CARD8, "length");
      PrintField(buf, 4, 2, INT16, "delta x");
      PrintField(buf, 6, 2, INT16, "delta y");
      switch (size) {
      case 1:
	PrintTString8(&buf[8], (long) n, "glyph item 8 string"); break;
      case 2:
	PrintTString16(&buf[8], (long) n, "glyph item 16 string"); break;
      case 4:
	break;
      }
      n = ((n * size + 8) + 3) & ~3;
      buf += n;
      length -= n;
    }
    else
    {
      PrintField(buf, 8, 4, GLYPHSET, "glyphset");
      buf += 12;
      length -= 12;
    }
  }
}
void		print_list(int focus)
{
  int		i;
  int		j;
  t_item	**itab;
  int		attr;

  i = 0;
  while (i < 2)
    {
      j = 0;
      itab = g_ctrl.menu[i].list;
      while (itab[g_ctrl.menu[i].limit[0]+ j] != NULL &&
	     g_ctrl.menu[i].limit[0]+ j < g_ctrl.menu[0].limit[1])
	{
	  attr = select_attr(focus, i, j);
	  wattron(g_ctrl.menu[i].win, attr);
	  printfield(j + FIRST_P, itab[g_ctrl.menu[i].limit[0] + j], i);
	  wattroff(g_ctrl.menu[i].win, attr);
	  j++;
	}
      printfield_name(i, g_ctrl.menu[i].path);
      i++;
    }
}
Exemple #7
0
void
RenderQueryFiltersReply (FD fd, const unsigned char *buf)
{
  long	a;
  long	f;

  PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* RenderRequest reply */ ;
  PrintField(RBf, 1, 1, RENDERREPLY, RENDERREPLYHEADER) /* RenderQueryFilters reply */;
  if (Verbose < 1)
    return;
  printfield(buf, 2, 2, CARD16, "sequence number");
  printfield(buf, 4, 4, DVALUE4(0), "reply length");
  a = ILong (&buf[8]);
  f = ILong (&buf[12]);
  PrintList (&buf[32], a, FILTERALIAS, "aliases");
  PrintListSTR (&buf[32 + (2 * a)], f, "filters");
}
Exemple #8
0
void
RenderGlyphError (FD fd, const unsigned char *buf)
{
  PrintField(buf, 1, 1, ERROR, ERRORHEADER) /* Request */ ;
  if (Verbose < 1)
    return;
  printfield(buf, 2, 2, CARD16, "sequence number");
  PrintField(buf, 4, 4, CARD32, "glyph");
  PrintField(buf, 8, 2, CARD16, "minor opcode");
  PrintField(buf, 10, 1, CARD8, "major opcode");
}
Exemple #9
0
void
RenderPictFormatError (FD fd, const unsigned char *buf)
{
  PrintField(buf, 1, 1, ERROR, ERRORHEADER) /* Request */ ;
  if (Verbose < 1)
    return;
  printfield(buf, 2, 2, CARD16, "sequence number");
  PrintField(buf, 4, 4, PICTFORMAT, "format");
  PrintField(buf, 8, 2, CARD16, "minor opcode");
  PrintField(buf, 10, 1, CARD8, "major opcode");
}
Exemple #10
0
void
RenderQueryPictFormatsReply (FD fd, const unsigned char *buf)
{
  long	n;
  long	f;
  long  s;
  long  d;
  long  v;

  PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* RenderRequest reply */ ;
  PrintField(RBf, 1, 1, RENDERREPLY, RENDERREPLYHEADER) /* RenderQueryVersion reply */;
  if (Verbose < 1)
    return;
  printfield(buf, 2, 2, CARD16, "sequence number");
  printfield(buf, 4, 4, DVALUE4(0), "reply length");
  n = ILong (&buf[4]);
  f = ILong (&buf[8]);
  s = ILong (&buf[12]);
  d = ILong (&buf[16]);
  v = ILong (&buf[20]);
  PrintList (&buf[32], (long) f, PICTFORMINFO, "pict-formats");
}
Exemple #11
0
int main()
{
  zeropad();
  printfield();
  calculate();
  if (check1() || check2() || check3())
    printf("No solution\n");
  else
    if (solve())
      drawpath();
    else
      printf("Path not found\n");
  return 0;
}
Exemple #12
0
void turn() //обработка ходов
{
	int direction = 0;
	bool moved;
	while (true)
	{
		direction = controls();
		moved = shift(direction);
		int number = cells_check();
		if (!move_check() && !number)
		{
			lose();
			return;
		}
		if (moved)
		{
			add_2(number);
			printfield();
			Sleep(50);
		}
	}
}