コード例 #1
0
ファイル: im.c プロジェクト: Daksh/tuxpaint-0.9.21
void im_fullreset(IM_DATA* im)
{
  im->s[0] = L'\0';
  im->buf[0] = L'\0';

  im_request(im, IM_REQ_RESET_FULL);
}
コード例 #2
0
ファイル: im.c プロジェクト: Daksh/tuxpaint-0.9.21
/**
* Initialize the IM_DATA structure.
*
* @param im    IM_DATA structure to initialize.
* @param lang  LANG_* defined constant to initialize the structure with.
*/
void im_init(IM_DATA* im, int lang)
{
  /* Free already allocated resources if initialized before */
  if(im_initialized) {
    im_free(im);
  }

  /* Initialize */
  memset(im, 0, sizeof(IM_DATA));
  im->lang = lang;

  /* Setup static globals */
  if(!im_initialized) {
    /* ADD NEW LANGUAGE SUPPORT HERE */
    im_event_fns[LANG_JA] = &im_event_ja;
    im_event_fns[LANG_KO] = &im_event_ko;
    im_event_fns[LANG_TH] = &im_event_th;
    im_event_fns[LANG_ZH_TW] = &im_event_zh_tw;

    im_initialized = 1;
  }

  #ifdef DEBUG
  assert(0 <= im->lang && im->lang < NUM_LANGS);
  if(im_event_fp) printf("Initializing IM for %s...\n", lang_prefixes[im->lang]);
  #endif

  /* Initialize the individual IM */
  im_request(im, IM_REQ_INIT);
}
コード例 #3
0
ファイル: im.c プロジェクト: Daksh/tuxpaint-0.9.21
void im_softreset(IM_DATA* im)
{
  im->s[0] = L'\0';
  im->buf[0] = L'\0';

  im_request(im, IM_REQ_RESET_SOFT);
}
コード例 #4
0
ファイル: im.c プロジェクト: Daksh/tuxpaint-0.9.21
/**
* Free any allocated resources.
*/
void im_free(IM_DATA* im)
{
  im_request(im, IM_REQ_FREE);
}
コード例 #5
0
ファイル: test_uut.c プロジェクト: ansonl/torque
END_TEST

START_TEST(im_request_test)
  {
  struct tcp_chan test_chan;
  struct sockaddr_in sockaddr;

  memset(&test_chan, 0, sizeof(test_chan));
  memset(&sockaddr,0,sizeof(sockaddr));

  im_request(&test_chan, 0,&sockaddr);

  memset(&test_chan, 0, sizeof(test_chan));
  disrsi_return_index = 0;
  disrst_return_index = 0;
  disrst_array[0] = strdup("other");
  disrst_array[1] = strdup("other");
  disrsi_array[0] = IM_KILL_JOB;
  disrsi_array[0] = 0;
  disrsi_array[1] = 0;
  im_request(&test_chan, IM_PROTOCOL_VER,&sockaddr);

  memset(&test_chan, 0, sizeof(test_chan));
  disrsi_return_index = 0;
  disrst_return_index = 0;
  disrst_array[0] = strdup("jobid");
  disrst_array[1] = strdup("cookie");
  disrsi_array[0] = IM_ALL_OKAY;
  disrsi_array[0] = 0;
  disrsi_array[1] = 0;
  im_request(&test_chan, IM_PROTOCOL_VER,&sockaddr);

  memset(&test_chan, 0, sizeof(test_chan));
  disrsi_return_index = 0;
  disrst_return_index = 0;
  disrst_array[0] = strdup("jobid");
  disrst_array[1] = strdup("cookie");
  disrsi_array[0] = IM_JOIN_JOB;
  im_request(&test_chan, IM_PROTOCOL_VER,&sockaddr);

  memset(&test_chan, 0, sizeof(test_chan));
  disrsi_return_index = 0;
  disrst_return_index = 0;
  disrst_array[0] = strdup("jobid");
  disrst_array[1] = strdup("cookie");
  disrsi_array[0] = IM_KILL_JOB;
  im_request(&test_chan, IM_PROTOCOL_VER,&sockaddr);

  memset(&test_chan, 0, sizeof(test_chan));
  disrsi_return_index = 0;
  disrst_return_index = 0;
  disrst_array[0] = strdup("jobid");
  disrst_array[1] = strdup("cookie");
  disrsi_array[0] = IM_SPAWN_TASK;
  im_request(&test_chan, IM_PROTOCOL_VER,&sockaddr);

  memset(&test_chan, 0, sizeof(test_chan));
  disrsi_return_index = 0;
  disrst_return_index = 0;
  disrst_array[0] = strdup("jobid");
  disrst_array[1] = strdup("cookie");
  disrsi_array[0] = IM_GET_TASKS;
  im_request(&test_chan, IM_PROTOCOL_VER,&sockaddr);

  memset(&test_chan, 0, sizeof(test_chan));
  disrsi_return_index = 0;
  disrst_return_index = 0;
  disrst_array[0] = strdup("jobid");
  disrst_array[1] = strdup("cookie");
  disrsi_array[0] = IM_SIGNAL_TASK;
  im_request(&test_chan, IM_PROTOCOL_VER,&sockaddr);

  memset(&test_chan, 0, sizeof(test_chan));
  disrsi_return_index = 0;
  disrst_return_index = 0;
  disrst_array[0] = strdup("jobid");
  disrst_array[1] = strdup("cookie");
  disrsi_array[0] = IM_OBIT_TASK;
  im_request(&test_chan, IM_PROTOCOL_VER,&sockaddr);

  memset(&test_chan, 0, sizeof(test_chan));
  disrsi_return_index = 0;
  disrst_return_index = 0;
  disrst_array[0] = strdup("jobid");
  disrst_array[1] = strdup("cookie");
  disrsi_array[0] = IM_POLL_JOB;
  im_request(&test_chan, IM_PROTOCOL_VER,&sockaddr);

  memset(&test_chan, 0, sizeof(test_chan));
  disrsi_return_index = 0;
  disrst_return_index = 0;
  disrst_array[0] = strdup("jobid");
  disrst_array[1] = strdup("cookie");
  disrsi_array[0] = IM_GET_INFO;
  im_request(&test_chan, IM_PROTOCOL_VER,&sockaddr);

  memset(&test_chan, 0, sizeof(test_chan));
  disrsi_return_index = 0;
  disrst_return_index = 0;
  disrst_array[0] = strdup("jobid");
  disrst_array[1] = strdup("cookie");
  disrsi_array[0] = IM_GET_RESC;
  im_request(&test_chan, IM_PROTOCOL_VER,&sockaddr);

  memset(&test_chan, 0, sizeof(test_chan));
  disrsi_return_index = 0;
  disrst_return_index = 0;
  disrst_array[0] = strdup("jobid");
  disrst_array[1] = strdup("cookie");
  disrsi_array[0] = IM_ABORT_JOB;
  im_request(&test_chan, IM_PROTOCOL_VER,&sockaddr);

  memset(&test_chan, 0, sizeof(test_chan));
  disrsi_return_index = 0;
  disrst_return_index = 0;
  disrst_array[0] = strdup("jobid");
  disrst_array[1] = strdup("cookie");
  disrsi_array[0] = IM_GET_TID;
  im_request(&test_chan, IM_PROTOCOL_VER,&sockaddr);

  memset(&test_chan, 0, sizeof(test_chan));
  disrsi_return_index = 0;
  disrst_return_index = 0;
  disrst_array[0] = strdup("jobid");
  disrst_array[1] = strdup("cookie");
  disrsi_array[0] = IM_RADIX_ALL_OK;
  im_request(&test_chan, IM_PROTOCOL_VER,&sockaddr);

  memset(&test_chan, 0, sizeof(test_chan));
  disrsi_return_index = 0;
  disrst_return_index = 0;
  disrst_array[0] = strdup("jobid");
  disrst_array[1] = strdup("cookie");
  disrsi_array[0] = IM_JOIN_JOB_RADIX;
  im_request(&test_chan, IM_PROTOCOL_VER,&sockaddr);

  memset(&test_chan, 0, sizeof(test_chan));
  disrsi_return_index = 0;
  disrst_return_index = 0;
  disrst_array[0] = strdup("jobid");
  disrst_array[1] = strdup("cookie");
  disrsi_array[0] = IM_KILL_JOB_RADIX;
  im_request(&test_chan, IM_PROTOCOL_VER,&sockaddr);

  memset(&test_chan, 0, sizeof(test_chan));
  disrsi_return_index = 0;
  disrst_return_index = 0;
  disrst_array[0] = strdup("jobid");
  disrst_array[1] = strdup("cookie");
  disrsi_array[0] = IM_MAX;
  im_request(&test_chan, IM_PROTOCOL_VER,&sockaddr);

  memset(&test_chan, 0, sizeof(test_chan));
  disrsi_return_index = 0;
  disrst_return_index = 0;
  disrst_array[0] = strdup("jobid");
  disrst_array[1] = strdup("cookie");
  disrsi_array[0] = IM_ERROR;
  im_request(&test_chan, IM_PROTOCOL_VER,&sockaddr);
  }