LUALIB_API int luaopen_chasen (lua_State *L) { luaL_register(L, "chasen", chasenlib); char *opt[4] = {"chasen", "-i", "w", NULL}; chasen_getopt_argv(opt, NULL); return 1; }
static int chasenlib_init (lua_State *L) { const char *format = luaL_checkstring(L, 1); int result; char *opt[6] = {"chasen", "-i", "w", "-F", NULL, NULL}; opt[4] = (char *)format; result = chasen_getopt_argv(opt, NULL); lua_pushboolean(L, result == 0); return 1; }
struct chasen_t * chasen_init() { int i; char *option[] = {"chasen", "-i", "w", NULL}; static struct chasen_t c; chasen_getopt_argv(option, stderr); for (i = 0; i < nelems(z); i++) { z[i].len = strlen(z[i].nam); } mt.len = strlen(mt.nam); return &c; }
int make_chasen_process( CHASEN_FD *fd_in, CHASEN_FD *fd_out ) { char *opt[] = { NULL, chasen_rc_option, chasen_rc, NULL }; #if defined(USE_CHASENLIB) { chasen_getopt_argv(opt, stdout); chasen_sparse_func = chasen_sparse_tostr; *fd_in = init_chasen_fd(); *fd_out = init_chasen_fd(); return 0; } #elif defined(USE_SPLIB) { void *hlib; chasen_getopt_argv_type chasen_getopt_func = NULL; /* libchasen load */ if( ( hlib = spOpenLibrary( chasen_dll ) ) != 0 ) { if( ( chasen_getopt_func = ( chasen_getopt_argv_type )spGetSymbolAddress( hlib, "chasen_getopt_argv" ) ) != 0 ) { ( *chasen_getopt_func )( opt, stdout ); } if( ( chasen_sparse_func = ( chasen_sparse_tostr_type )spGetSymbolAddress( hlib, "chasen_sparse_tostr" ) ) != 0 ) { *fd_in = init_chasen_fd(); *fd_out = init_chasen_fd(); /* no error */ return 0; } } ErrMsg( "DLL open error in make_chasen_process\n" ); } #else ErrMsg( "make_chasen_process is not supported\n" ); #endif return -1; }