install_t install_regexp() { PL_register_foreign("re_search", 2, re_search, 0); PL_register_foreign("re_name", 2, re_name, 0); printf("regexp is instelled\n"); }
install_t install_random() { FUNCTOR_rand3 = PL_new_functor(PL_new_atom("rand"), 3); PL_register_foreign("random", 1, p_random, 0); PL_register_foreign("setrand", 1, p_setrand, 0); PL_register_foreign("getrand", 1, p_getrand, 0); }
install_t install_fcgi() { fcgi_init(); PL_register_foreign("fcgi_accept", 0, fcgi_accept, PL_FA_NONDETERMINISTIC); PL_register_foreign("fcgi_finish", 0, fcgi_finish, 0); PL_register_foreign("fcgi_is_cgi", 0, fcgi_is_cgi, 0); PL_register_foreign("fcgi_param", 2, fcgi_param, PL_FA_NONDETERMINISTIC); }
install_t install_uid() { PL_register_foreign("getuid", 1, pl_getuid, 0); PL_register_foreign("geteuid", 1, pl_geteuid, 0); PL_register_foreign("getgid", 1, pl_getgid, 0); PL_register_foreign("getegid", 1, pl_getegid, 0); PL_register_foreign("user_info", 2, pl_user_info, 0); PL_register_foreign("group_info", 2, pl_group_info, 0); PL_register_foreign("setuid", 1, pl_setuid, 0); PL_register_foreign("setgid", 1, pl_setgid, 0); PL_register_foreign("seteuid", 1, pl_seteuid, 0); PL_register_foreign("setegid", 1, pl_setegid, 0); }
install_t install_plaincase() { init_constants(); setlocale(LC_COLLATE, "en_GB.UTF-8"); PL_register_foreign("is_plaincase", 1, is_plaincase1, 0); PL_register_foreign("is_diacritics", 1, is_diacritics1, 0); PL_register_foreign("plaincase_atom", 2, plaincase_atom2, 0); PL_register_foreign("no_diacritics_atom", 2, pl_no_diacritics_atom, 0); }
install_t install_sha4pl() { MKATOM(sha1); /* =160 */ MKATOM(sha224); MKATOM(sha256); MKATOM(sha384); MKATOM(sha512); MKATOM(algorithm); PL_register_foreign("sha_hash", 3, pl_sha_hash, 0); PL_register_foreign("sha_new_ctx", 2, pl_sha_new_ctx, 0); PL_register_foreign("sha_hash_ctx", 4, pl_sha_hash_ctx, 0); PL_register_foreign("hmac_sha", 4, pl_hmac_sha, 0); }
install_t install_snowball() { assert(sizeof(sb_symbol) == sizeof(char)); FUNCTOR_error2 = MKFUNCTOR("error", 2); FUNCTOR_type_error2 = MKFUNCTOR("type_error", 2); FUNCTOR_domain_error2 = MKFUNCTOR("domain_error", 2); PL_register_foreign("snowball", 3, snowball, 0); PL_register_foreign("snowball_algorithms", 1, snowball_algorithms, 0); #ifdef __WINDOWS__ stem_key_alloc(); #endif }
install_t install_pcecall(void) { context.pce_thread = PL_thread_self(); #ifdef __WINDOWS__ setup(); #else context.pipe[0] = context.pipe[1] = -1; #endif PL_register_foreign("in_pce_thread", 1, in_pce_thread, PL_FA_META, "0"); PL_register_foreign("in_pce_thread_sync2", 2, in_pce_thread_sync2, 0); PL_register_foreign("set_pce_thread", 0, set_pce_thread, 0); PL_register_foreign("pce_dispatch", 0, pl_pce_dispatch, 0); }
install_t install_md54pl(void) { MKATOM(utf8); MKATOM(octet); MKATOM(encoding); PL_register_foreign("md5_hash", 3, md5_hash, 0); }
install_t install_clingo(void) { ATOM_sup = PL_new_atom("sup"); ATOM_inf = PL_new_atom("inf"); ATOM_minus = PL_new_atom("-"); ATOM_hash = PL_new_atom("#"); ATOM_atoms = PL_new_atom("atoms"); ATOM_terms = PL_new_atom("terms"); ATOM_shown = PL_new_atom("shown"); ATOM_csp = PL_new_atom("csp"); ATOM_comp = PL_new_atom("comp"); FUNCTOR_hash1 = PL_new_functor(ATOM_hash, 1); FUNCTOR_tilde1 = PL_new_functor(PL_new_atom("~"), 1); FUNCTOR_clingo_error1 = PL_new_functor(PL_new_atom("clingo_error"), 1); FUNCTOR_error2 = PL_new_functor(PL_new_atom("error"), 2); PL_register_foreign("clingo_new", 2, pl_clingo_new, 0); PL_register_foreign("clingo_close", 1, pl_clingo_close, 0); PL_register_foreign("clingo_add", 3, pl_clingo_add, 0); PL_register_foreign("clingo_ground", 2, pl_clingo_ground, 0); PL_register_foreign("clingo_solve", 4, pl_clingo_solve, PL_FA_NONDETERMINISTIC); PL_register_foreign("clingo_assign_external", 3, pl_clingo_assign_external, 0); PL_register_foreign("clingo_release_external", 2, pl_clingo_release_external, 0); }
int pceMTinit() { InitializeCriticalSection(&mutex); XPCE_mt = TRUE; PL_register_foreign("pce_lock_owner", 2, pce_lock_owner, 0); succeed; }
//pinMode install_t install() { // pi specifics install() PL_register_foreign("digitalWriteByte",2,pl_digitalWriteByte,0); PL_register_foreign("pwmSetMode",1,pl_pwmSetMode,0); PL_register_foreign("pwmSetRange",1,pl_pwmSetRange,0); PL_register_foreign("pwmSetClock",1,pl_pwmSetClock,0); PL_register_foreign("piBoardRev",1,pl_piBoardRev,0); PL_register_foreign("wpiPinToGpio",2,pl_wpiPinToGpio,0); PL_register_foreign("physPinToGpio",2,pl_physPinToGpio,0); PL_register_foreign("setPadDrive",2,pl_setPadDrive,0); }
static void init_errors() { FUNCTOR_error2 = MKFUNCTOR("error", 2); FUNCTOR_type_error2 = MKFUNCTOR("type_error", 2); FUNCTOR_domain_error2 = MKFUNCTOR("domain_error", 2); FUNCTOR_existence_error2 = MKFUNCTOR("existence_error", 2); FUNCTOR_permission_error3 = MKFUNCTOR("permission_error", 3); #ifdef O_DEBUG PL_register_foreign("http_stream_debug", 1, http_stream_debug, 0); #endif }
install_t install_uuid(void) { ATOM_version = PL_new_atom("version"); ATOM_format = PL_new_atom("format"); ATOM_atom = PL_new_atom("atom"); ATOM_integer = PL_new_atom("integer"); ATOM_dns = PL_new_atom("dns"); ATOM_url = PL_new_atom("url"); ATOM_oid = PL_new_atom("oid"); ATOM_x500 = PL_new_atom("x500"); PL_register_foreign("uuid", 2, pl_uuid, 0); }
install_t install_process() { #ifdef __WINDOWS__ win_init(); #endif MKATOM(stdin); MKATOM(stdout); MKATOM(stderr); MKATOM(std); MKATOM(null); MKATOM(process); MKATOM(detached); MKATOM(cwd); MKATOM(env); MKATOM(window); MKATOM(timeout); MKATOM(release); MKATOM(infinite); MKFUNCTOR(pipe, 1); MKFUNCTOR(error, 2); MKFUNCTOR(type_error, 2); MKFUNCTOR(domain_error, 2); MKFUNCTOR(process_error, 2); MKFUNCTOR(system_error, 2); MKFUNCTOR(resource_error, 1); MKFUNCTOR(exit, 1); MKFUNCTOR(killed, 1); FUNCTOR_eq2 = PL_new_functor(PL_new_atom("="), 2); PL_register_foreign("process_create", 2, process_create, 0); PL_register_foreign("process_wait", 3, process_wait, 0); PL_register_foreign("process_kill", 2, process_kill, 0); }
install_t install_archive4pl(void) { MKATOM(close_parent); MKATOM(compression); MKATOM(filter); MKATOM(format); MKATOM(all); MKATOM(bzip2); MKATOM(compress); MKATOM(gzip); MKATOM(grzip); MKATOM(lrzip); MKATOM(lzip); MKATOM(lzma); MKATOM(lzop); MKATOM(none); MKATOM(rpm); MKATOM(uu); MKATOM(xz); ATOM_7zip = PL_new_atom("7zip"); MKATOM(ar); MKATOM(cab); MKATOM(cpio); MKATOM(empty); MKATOM(gnutar); MKATOM(iso9960); MKATOM(lha); MKATOM(mtree); MKATOM(rar); MKATOM(raw); MKATOM(tar); MKATOM(xar); MKATOM(zip); MKATOM(file); MKATOM(link); MKATOM(socket); MKATOM(character_device); MKATOM(block_device); MKATOM(directory); MKATOM(fifo); MKFUNCTOR(error, 2); MKFUNCTOR(archive_error, 2); MKFUNCTOR(filetype, 1); MKFUNCTOR(mtime, 1); MKFUNCTOR(size, 1); MKFUNCTOR(link_target, 1); MKFUNCTOR(format, 1); PL_register_foreign("archive_open_stream", 3, archive_open_stream, 0); PL_register_foreign("archive_property", 3, archive_property, 0); PL_register_foreign("archive_close", 1, archive_close, 0); PL_register_foreign("archive_next_header", 2, archive_next_header, 0); PL_register_foreign("archive_header_prop_", 2, archive_header_prop, 0); PL_register_foreign("archive_open_entry", 2, archive_open_entry, 0); }
install_t install_order() { init_constants(); PL_register_foreign("new_order_table", 2, pl_new_order_table, 0); PL_register_foreign("order_table_mapping", 3, pl_order_table_mapping, PL_FA_NONDETERMINISTIC); PL_register_foreign("compare_strings", 4, pl_compare_strings, 0); PL_register_foreign("prefix_string", 3, pl_prefix_string, 0); PL_register_foreign("prefix_string", 4, pl_prefix_string4, 0); PL_register_foreign("sub_string", 3, pl_sub_string, 0); }
install_t install_turtle() { MKFUNCTOR(error, 2); MKFUNCTOR(type_error, 2); MKFUNCTOR(syntax_error, 1); MKFUNCTOR(stream, 4); MKFUNCTOR(representation_error, 1); ATOM_ = PL_new_atom(""); PL_register_foreign("turtle_name_start_char", 1, turtle_name_start_char, 0); PL_register_foreign("turtle_name", 1, turtle_name, 0); PL_register_foreign("turtle_read_name", 4, turtle_read_name, 0); PL_register_foreign("turtle_read_string", 4, turtle_read_string, 0); PL_register_foreign("turtle_read_relative_uri", 4, turtle_read_relative_uri, 0); PL_register_foreign("turtle_write_quoted_string", 2, turtle_write_quoted_string, 0); PL_register_foreign("turtle_write_uri", 2, turtle_write_uri, 0); }
install_t install_time() { MODULE_user = PL_new_module(PL_new_atom("user")); FUNCTOR_alarm1 = PL_new_functor(PL_new_atom("$alarm"), 1); FUNCTOR_alarm4 = PL_new_functor(PL_new_atom("alarm"), 4); FUNCTOR_module2 = PL_new_functor(PL_new_atom(":"), 2); ATOM_remove = PL_new_atom("remove"); ATOM_install = PL_new_atom("install"); ATOM_done = PL_new_atom("done"); ATOM_next = PL_new_atom("next"); ATOM_scheduled = PL_new_atom("scheduled"); PREDICATE_call1 = PL_predicate("call", 1, "user"); PL_register_foreign("alarm_at", 4, alarm4_abs, PL_FA_TRANSPARENT); PL_register_foreign("alarm", 4, alarm4_rel, PL_FA_TRANSPARENT); PL_register_foreign("alarm_at", 3, alarm3_abs, PL_FA_TRANSPARENT); PL_register_foreign("alarm", 3, alarm3_rel, PL_FA_TRANSPARENT); PL_register_foreign("remove_alarm", 1, remove_alarm, 0); PL_register_foreign("uninstall_alarm",1, uninstall_alarm,0); PL_register_foreign("install_alarm", 1, install_alarm, 0); PL_register_foreign("install_alarm", 2, install_alarm2, 0); PL_register_foreign("remove_alarm_notrace",1, remove_alarm, PL_FA_NOTRACE); PL_register_foreign("current_alarms", 5, current_alarms, 0); #ifdef O_DEBUG PL_register_foreign("time_debug", 1, pl_time_debug, 0); #endif installHandler(); PL_on_halt(cleanup, NULL); }
install_t install(){ PL_register_foreign("wiringPiSetup",0,pl_wiringPiSetup,0); }
install_t install_crypt() { PL_register_foreign("crypt", 2, pl_crypt, 0); }
install_t install_socket() { nbio_init("socket"); ATOM_reuseaddr = PL_new_atom("reuseaddr"); ATOM_broadcast = PL_new_atom("broadcast"); ATOM_nodelay = PL_new_atom("nodelay"); ATOM_dispatch = PL_new_atom("dispatch"); ATOM_nonblock = PL_new_atom("nonblock"); ATOM_infinite = PL_new_atom("infinite"); ATOM_as = PL_new_atom("as"); ATOM_atom = PL_new_atom("atom"); ATOM_string = PL_new_atom("string"); ATOM_codes = PL_new_atom("codes"); FUNCTOR_socket1 = PL_new_functor(PL_new_atom("$socket"), 1); #ifdef O_DEBUG PL_register_foreign_in_module("user", "tcp_debug", 1, pl_debug, 0); #endif PL_register_foreign("tcp_accept", 3, pl_accept, 0); PL_register_foreign("tcp_bind", 2, pl_bind, 0); PL_register_foreign("tcp_connect", 2, pl_connect, 0); PL_register_foreign("tcp_listen", 2, pl_listen, 0); PL_register_foreign("tcp_open_socket", 3, pl_open_socket, 0); PL_register_foreign("tcp_socket", 1, tcp_socket, 0); PL_register_foreign("tcp_close_socket", 1, pl_close_socket, 0); PL_register_foreign("tcp_setopt", 2, pl_setopt, 0); PL_register_foreign("tcp_host_to_address", 2, pl_host_to_address, 0); PL_register_foreign("gethostname", 1, pl_gethostname, 0); PL_register_foreign("tcp_select", 3, tcp_select, 0); PL_register_foreign("udp_socket", 1, udp_socket, 0); PL_register_foreign("udp_receive", 4, udp_receive, 0); PL_register_foreign("udp_send", 4, udp_send, 0); }
install_t install() { PL_register_foreign("hello", 1, hello, 0); }
install_t install() { PL_register_foreign("gsl_sf_bessel_J0", 2, pl_gsl_sf_bessel_J0, 0); }
install_t install() { PL_register_foreign("lowercase", 2, pl_lowercase, 0); }
install_t install_tipc() { FILE *fp = fopen("/sys/module/tipc/version", "r"); if(fp) { char buf[32]; size_t n = fread(buf, sizeof(char), sizeof(buf), fp); if(n > 0) tipc_version = buf[0] - '0'; fclose(fp); } nbio_init("tipc"); ATOM_scope = PL_new_atom("scope"); ATOM_no_scope = PL_new_atom("no_scope"); ATOM_node = PL_new_atom("node"); ATOM_cluster = PL_new_atom("cluster"); ATOM_zone = PL_new_atom("zone"); ATOM_all = PL_new_atom("all"); ATOM_importance = PL_new_atom("importance"); ATOM_low = PL_new_atom("low"); ATOM_medium = PL_new_atom("medium"); ATOM_high = PL_new_atom("high"); ATOM_critical = PL_new_atom("critical"); ATOM_src_droppable = PL_new_atom("src_droppable"); ATOM_dest_droppable = PL_new_atom("dest_droppable"); ATOM_conn_timeout = PL_new_atom("conn_timeout"); ATOM_socket_type = PL_new_atom("socket_type"); ATOM_dgram = PL_new_atom("dgram"); ATOM_rdm = PL_new_atom("rdm"); ATOM_seqpacket = PL_new_atom("seqpacket"); ATOM_stream = PL_new_atom("stream"); ATOM_dispatch = PL_new_atom("dispatch"); ATOM_nodelay = PL_new_atom("nodelay"); ATOM_nonblock = PL_new_atom("nonblock"); ATOM_as = PL_new_atom("as"); ATOM_atom = PL_new_atom("atom"); ATOM_string = PL_new_atom("string"); ATOM_codes = PL_new_atom("codes"); FUNCTOR_tipc_socket1 = PL_new_functor(PL_new_atom("$tipc_socket"), 1); FUNCTOR_port_id = PL_new_functor(PL_new_atom("port_id"), 2); FUNCTOR_name3 = PL_new_functor(PL_new_atom("name"), 3); FUNCTOR_name_seq3 = PL_new_functor(PL_new_atom("name_seq"), 3); FUNCTOR_mcast3 = PL_new_functor(PL_new_atom("mcast"), 3); PL_register_foreign("tipc_socket", 2, tipc_socket, 0); PL_register_foreign("tipc_close_socket", 1, tipc_close_socket, 0); PL_register_foreign("tipc_setopt", 2, pl_tipc_setopt, 0); PL_register_foreign("tipc_bind", 3, pl_tipc_bind, 0); PL_register_foreign("tipc_listen", 2, tipc_listen, 0); PL_register_foreign("tipc_open_socket", 3, tipc_open_socket, 0); PL_register_foreign("tipc_accept", 3, pl_tipc_accept, 0); PL_register_foreign("tipc_connect", 2, pl_tipc_connect, 0); PL_register_foreign("tipc_get_name", 2, pl_tipc_get_name, 0); PL_register_foreign("tipc_get_peer_name", 2, pl_tipc_get_peer_name, 0); PL_register_foreign("tipc_receive", 4, pl_tipc_receive, 0); PL_register_foreign("tipc_send", 4, pl_tipc_send, 0); PL_register_foreign("tipc_subscribe", 5, pl_tipc_subscribe, 0); PL_register_foreign("tipc_receive_subscr_event", 2, pl_tipc_receive_subscr_event, 0); }
install_t install_cgi() { PL_register_foreign("cgi_get_form", 1, pl_cgi_get_form, 0); }
install_t install() { PL_register_foreign("read_word_list",1,(void*)(pl_read_word_list),0); PL_register_foreign("unify_list",1,(void*)(pl_unify_list),0); }
install_t install() { PL_register_foreign("gdImageCreate", 3, pl_gdImageCreate, 0); PL_register_foreign("gdImagePng", 2, pl_gdImagePng, 0); }
void install_ps() { PL_register_foreign("get_ps_parameters", 3, pl_get_ps_parameters, 0); }