int main (int argc, char **argv) { char *mname = ""; rb.buf = (char *) malloc ((unsigned) (rb.size = 0)); if (argc > 1) mname = argv[1]; if ((js = js_open (mname, 0)) == NULL) err (); if ((env = js_connect (js, "kana")) == NULL) err (); if ((fzk_file = js_file_read (env, FZK_FILE)) == -1) err (); if ((kihon_file = js_file_read (env, KIHON_DIC)) == -1) err (); if ((setto_file = js_file_read (env, SETTO_DIC)) == -1) err (); if (js_fuzokugo_set (env, fzk_file) == -1) err (); if ((kihon_dic_no = js_dic_add (env, kihon_file, -1, WNN_DIC_ADD_NOR, 1, WNN_DIC_RDONLY, WNN_DIC_RDONLY, NULL, NULL)) == -1) err (); if ((setto_dic_no = js_dic_add (env, setto_file, -1, WNN_DIC_ADD_NOR, 1, WNN_DIC_RDONLY, WNN_DIC_RDONLY, NULL, NULL)) == -1) err (); p_set (env); if ((rev_env = js_connect (js, "kanji")) == NULL) err (); if ((fzk_file = js_file_read (rev_env, FZK_FILE)) == -1) err (); if ((rev_file = js_file_read (rev_env, KIHON_DIC)) == -1) err (); if ((rev_setto_file = js_file_read (rev_env, SETTO_DIC)) == -1) err (); if (js_fuzokugo_set (rev_env, fzk_file) == -1) err (); if ((rev_dic_no = js_dic_add (rev_env, kihon_file, -1, WNN_DIC_ADD_REV, 1, WNN_DIC_RDONLY, WNN_DIC_RDONLY, NULL, NULL)) == -1) err (); if ((rev_setto_dic_no = js_dic_add (rev_env, setto_file, -1, WNN_DIC_ADD_REV, 1, WNN_DIC_RDONLY, WNN_DIC_RDONLY, NULL, NULL)) == -1) err (); p_set (rev_env); #ifdef DEBUG printf ("Now discard file push any key\n"); getchar (); js_file_discard (rev_env, rev_file); printf ("Now discard file\n"); #endif henkan (); js_close (js); }
void js_init(void) { BYTE i; for (i = PORT1; i < PORT_MAX; i++) { memset(&js[i], 0x00, sizeof(_js)); if (port[i].joy_id == name_to_jsn(uL("NULL"))) { continue; } usnprintf(js[i].dev, usizeof(js[i].dev), uL("" JS_DEV_PATH "%d"), port[i].joy_id); js[i].input_decode_event = input_decode_event[i]; js_open(&js[i]); } }
int main ( int argc, char** argv ) { if( argc < 2 ) { fprintf( stderr, "Please specify a joystick device file\n" ); return 1; } Joystick* joy = js_open( argv[1] ); if( joy == NULL ) { fprintf( stderr, "Opening of %s failed\n", argv[1] ); return 1; } printf( "Joystick Name: %s\n", joy->name ); printf( "Axes count: %d\n", joy->axis_count ); printf( "Button count: %d\n", joy->button_count ); js_close( joy ); return 0; }