managed_texture2d::managed_texture2d(const boost::shared_ptr<device_services> & device,
                     const platform::tstring & src_file)
     : device(device)
 {
     HRESULT r = D3DXCreateTextureFromFile(device->get(), src_file.c_str(), &texture);
     check_failure(r, platform::narrow(LOCI_TSTR("Failed to load texture from file: ") + src_file).c_str(), "D3DXCreateTextureFromFile");
 }
int
main (void)
{
  gint failures = 0;
  gint i;

  g_print ("\nTesting the GIMP color parser ...\n");

  for (i = 0; i < G_N_ELEMENTS (samples); i++)
    {
      GimpRGB   rgb = { 0.0, 0.0, 0.0, 0.0 };
      gboolean  success;

      if (samples[i].alpha)
        success = gimp_rgba_parse_css (&rgb, samples[i].str, -1);
      else
        success = gimp_rgb_parse_css (&rgb, samples[i].str, -1);

      failures += check_failure (samples + i, success, &rgb);
    }

  if (failures)
    {
      g_print ("%d out of %d samples failed!\n\n",
               failures, (int)G_N_ELEMENTS (samples));
      return EXIT_FAILURE;
    }
  else
    {
      g_print ("All %d samples passed.\n\n", (int)G_N_ELEMENTS (samples));
      return EXIT_SUCCESS;
    }
}
Beispiel #3
0
int main(int argc, char **argv) {
	srand(time(NULL));

	struct command_args args = get_args(argc, argv);
	atexit(close_queue);

	key_t key = ftok(args.path, args.id);
	check_failure((int) key, -1, "failed to execute ftok\n");

	ID = msgget(key, IPC_CREAT | 0700);
	check_failure(ID, -1, "failed to execute msgget\n");

	struct q_msg buf;

	while(1) {

		int status;

		status = msgrcv(ID, &buf, size, 1, IPC_NOWAIT);

		if (status > 0) {
			start_communication(buf.msg);
			continue;
		}

		int i;
		for (i = 0; i < client_no; i++) {

			status = msgrcv(clients[i], &buf, size, 2, IPC_NOWAIT);
			if (status > 0) {
				send_random(buf.msg);
			}

			status = msgrcv(clients[i], &buf, size, 3, IPC_NOWAIT);
			if (status > 0) {
				process_response(buf.msg);
			}
		}

	}

	return 0;
}
Beispiel #4
0
void start_communication(char *msg) {
	if (client_no == 19) return;

	clients[client_no] = atoi(msg);
	check_failure(clients[client_no], -1, "failed to create clients' queue\n");

	struct q_msg buf;
	buf.type = 6;
	sprintf(buf.msg, "%d", client_no);
	//printf("Starting communication with client no %d, his queue id: %d\n", client_no, clients[client_no]);

	msgsnd(clients[client_no], &buf, size, 0);

	client_no++;
}