void pike_module_init() { ADD_FUNCTION("crypt_md5", f_crypt_md5, tOr(tFunc(tStr,tStr), tFunc(tStr tStr,tStr)), 0); }
void init_image__xpm( ) { ADD_FUNCTION( "_xpm_write_rows", f__xpm_write_rows, tFunc(tObj tObj tInt tArr(tStr) tArr(tStr), tInt), 0); ADD_FUNCTION( "_xpm_trim_rows", f__xpm_trim_rows, tFunc(tArr(tStr),tArr(tStr)), 0); }
void cairo_mod_init_path(void) { /*! @decl constant CAIRO_PATH_MOVE_TO *! @decl constant CAIRO_PATH_LINE_TO *! @decl constant CAIRO_PATH_CURVE_TO *! @decl constant CAIRO_PATH_CLOSE_PATH *! *! The various types of path elements in an Cairo path */ ADD_INT_CONSTANT("CAIRO_PATH_MOVE_TO", CAIRO_PATH_MOVE_TO, 0); ADD_INT_CONSTANT("CAIRO_PATH_LINE_TO", CAIRO_PATH_LINE_TO, 0); ADD_INT_CONSTANT("CAIRO_PATH_CURVE_TO", CAIRO_PATH_CURVE_TO, 0); ADD_INT_CONSTANT("CAIRO_PATH_CLOSE_PATH", CAIRO_PATH_CLOSE_PATH, 0); /* Cairo.Path */ start_new_program(); { ADD_STORAGE(struct cairo_mod_path); ADD_FUNCTION("_get_iterator", f_path_get_iterator, tFunc(tVoid,tObj), ID_PUBLIC); set_init_callback(init_cairo_mod_path); set_exit_callback(exit_cairo_mod_path); } add_program_constant("Path", cairo_mod_path_program = end_program(), 0); /* Cairo.PathElement */ start_new_program(); { ADD_STORAGE(struct cairo_mod_path_element); ADD_FUNCTION("get_type", f_path_element_get_type, tFunc(tNone,tInt), ID_PUBLIC); ADD_FUNCTION("get_point", f_path_element_get_point, tFunc(tInt, tMapping), ID_PUBLIC); ADD_FUNCTION("_sprintf", f_path_element_sprintf, tFunc(tInt tMapping, tStr), ID_STATIC); set_init_callback(init_cairo_mod_path_element); set_exit_callback(exit_cairo_mod_path_element); } add_program_constant("PathElement", cairo_mod_path_element_program = end_program(), 0); /* Cairo.PathIterator */ start_new_program(); { ADD_STORAGE(struct cairo_mod_path_iterator); ADD_FUNCTION("`!", f_path_iterator_not_operator, tFunc(tVoid,tInt), ID_PUBLIC); ADD_FUNCTION("`+=", f_path_iterator_add_self, tFunc(tInt,tObj), ID_PUBLIC); ADD_FUNCTION("index", f_path_iterator_index, tFunc(tNone,tObj), ID_PUBLIC); ADD_FUNCTION("value", f_path_iterator_value, tFunc(tNone,tObj), ID_PUBLIC); ADD_FUNCTION("first", f_path_iterator_first, tFunc(tNone,tInt), ID_PUBLIC); ADD_FUNCTION("next", f_path_iterator_next, tFunc(tNone,tObj), ID_PUBLIC); set_init_callback(init_cairo_mod_path_iterator); set_exit_callback(exit_cairo_mod_path_iterator); } add_program_constant("PathIterator", cairo_mod_path_iterator_program = end_program(), 0); }
void init_image_xbm(void) { ADD_FUNCTION( "_decode", image_xbm__decode, tFunc(tStr tOr(tVoid,tMapping),tMap(tStr,tObj)), 0); ADD_FUNCTION( "decode", image_xbm_decode, tFunc(tStr,tObj), 0); ADD_FUNCTION( "encode", image_xbm_encode, tFunc(tObj tOr(tVoid,tMapping),tStr), 0); param_name=make_shared_string("name"); param_fg=make_shared_string("fg"); param_bg=make_shared_string("bg"); param_invert=make_shared_string("invert"); }
void init_context() { set_init_callback(ctx_init); set_exit_callback(ctx_exit); ADD_STORAGE(js_context); ADD_FUNCTION("create", ctx_create, tFunc(tOr(tVoid, tInt) tOr(tVoid, tInt), tVoid), 0); ADD_FUNCTION("evaluate", ctx_evaluate, tFunc(tString tOr(tVoid, tInt), tOr(tMapping, tInt)), 0); ADD_FUNCTION("set_id", ctx_set_id, tFunc(tObj, tVoid), 0); }
int _init_xml_sax(void) { start_new_program(); ADD_STORAGE(sax_storage); set_init_callback(init_sax); set_exit_callback(exit_sax); ADD_FUNCTION("create", f_create, tFunc(tOr(tString, tObj) tObj tOr(tMapping, tVoid) tOr(tMixed, tVoid) tOr(tInt, tVoid), tVoid), 0); ADD_FUNCTION("parse", f_parse_xml, tFunc(tVoid, tInt), 0); ADD_FUNCTION("getLineNumber", f_getLineNumber, tFunc(tVoid, tInt), 0); ADD_FUNCTION("getColumnNumber", f_getColumnNumber, tFunc(tVoid, tInt), 0); xml_program = end_program(); add_program_constant("SAX", xml_program, 0); start_new_program(); ADD_STORAGE(sax_storage); set_init_callback(init_sax); set_exit_callback(exit_sax); ADD_FUNCTION("create", f_create, tFunc(tOr(tString, tObj) tObj tOr(tMapping, tVoid) tOr(tMixed, tVoid) tOr(tInt, tVoid), tVoid), 0); ADD_FUNCTION("parse", f_parse_html, tFunc(tOr(tString,tVoid), tInt), 0); ADD_FUNCTION("getLineNumber", f_getLineNumber, tFunc(tVoid, tInt), 0); ADD_FUNCTION("getColumnNumber", f_getColumnNumber, tFunc(tVoid, tInt), 0); html_program = end_program(); add_program_constant("HTML", html_program, 0); return 1; }
void pike_module_init(void) { #ifdef PEXTS_VERSION pexts_init(); #endif struct svalue sv; /* Starting a new class */ start_new_program(); /* Agrega espacio para los datos internos */ low_add_storage(sizeof(struct mcast_storage) - sizeof(struct udp_storage), ALIGNOF(struct mcast_storage),0); /* Hereda Stdio.UDP */ /* NOTA IMPORTANTE * Aparentemente no se puede heredar un objeto * escrito en Pike desde aquí... luego, heredo * el objeto básico (nativo) */ /* Resuelve el objeto (encuentra el archivo) */ push_text("files.UDP"); SAFE_APPLY_MASTER("resolv",1); if(Pike_sp[-1].type != T_FUNCTION) Pike_error("Error in resolving of Stdio.UDP!\n"); /* Obtiene el programa */ stdio_udp = program_from_function(&Pike_sp[-1]); pop_n_elems(1); /* Hereda */ sv.type = T_PROGRAM; sv.subtype = 0; sv.u.program = stdio_udp; do_inherit( &sv, 0, 0); /* Agrega los métodos */ ADD_FUNCTION("join",mcast_join,tFunc(tStr,tVoid),0); ADD_FUNCTION("leave",mcast_leave,tFunc(tStr,tVoid),0); ADD_FUNCTION("setLoopback",mcast_loopback,tFunc(tInt,tVoid),0); ADD_FUNCTION("setTTL",mcast_setTTL,tFunc(tInt,tVoid),0); ADD_FUNCTION("setInterface",mcast_setif,tFunc(tStr,tVoid),0); /* Llama a "init_mcast" antes de crear los objetos */ set_init_callback(init_mcast); end_class("MultiCastUDP",0); }
void source_pikestream_init( ) { start_new_program(); ADD_STORAGE( struct callback_prog ); ADD_FUNCTION("`()", f_got_data, tFunc(tInt tStr,tVoid),0); callback_program = end_program(); }
void PDESolver<T,lFunc,rFunc,bFunc,tFunc,force>::generateB() { m_B = Vector<T>((m_size - 1) * (m_size - 1)); ulong index = 0; T hVal = (m_rightBound - m_leftBound) / ((T)m_size); T x,y; for(ulong i = 1; i < m_size; i++) { for(ulong j = 1; j < m_size; j++) { m_B.at(index) = 0; x = ((T)j * (m_rightBound - m_leftBound))/m_size + m_leftBound; y = ((T)i * (m_upperBound - m_lowerBound))/m_size + m_lowerBound; if(i - 1 == 0) m_B.at(index) += bFunc(x); if(i + 1 == m_size) m_B.at(index) += tFunc(x); if(j - 1 == 0) m_B.at(index) += lFunc(y); if(j + 1 == m_size) m_B.at(index) += rFunc(y); m_B.at(index) -= hVal*hVal*force(x,y); m_B.at(index) /= 4; index++; } } }
/* Init the module */ void pike_module_init(void) { #ifdef PEXTS_VERSION pexts_init(); #endif start_new_program(); ADD_STORAGE( PCRE_Regexp ); ADD_FUNCTION( "create", f_pcre_create, tFunc(tOr(tStr,tVoid) tOr(tStr,tVoid), tVoid), 0); ADD_FUNCTION("match", f_pcre_match, tFunc(tStr tOr(tStr,tVoid), tInt), 0); ADD_FUNCTION("split", f_pcre_split, tFunc(tStr tOr(tStr,tVoid), tArr(tStr)), 0); set_init_callback(init_regexp); set_exit_callback(free_regexp); end_class("Regexp", 0); add_integer_constant("version", 2, 0); }
void init_dynamic_load(void) { #ifdef USE_DYNAMIC_MODULES if (dlinit()) { /* function(string:program) */ ADD_EFUN("load_module", f_load_module, tFunc(tStr,tPrg(tObj)), OPT_EXTERNAL_DEPEND); } #endif }
void pike_module_init(void) { #ifdef PEXTS_VERSION pexts_init(); #endif /* Compression program */ start_new_program(); ADD_STORAGE(bz_stream); set_init_callback(init_deflate); set_exit_callback(exit_deflate); ADD_FUNCTION("create", f_deflate_create, tFunc( tOr(tVoid, tInt), tVoid), 0); ADD_FUNCTION("deflate", f_deflate_deflate, tFunc(tString tOr(tInt, tVoid), tString), 0); ADD_FUNCTION("compress_file", f_deflate_file, tFunc(tString tOr(tString, tVoid), tVoid), 0); deflate_program = end_program(); add_program_constant("deflate", deflate_program, 0); /* Decompression program */ start_new_program(); ADD_STORAGE(bz_stream); ADD_FUNCTION("create", f_inflate_create, tFunc(tOr(tInt, tVoid), tVoid), 0); ADD_FUNCTION("inflate", f_inflate_inflate, tFunc(tString, tString), 0); set_init_callback(init_inflate); set_exit_callback(exit_inflate); inflate_program = end_program(); add_program_constant("inflate", inflate_program, 0); }
void mhash_init_mhash_program(void) { start_new_program(); ADD_STORAGE( mhash_storage ); ADD_FUNCTION("create", f_hash_create, tFunc(tOr(tInt,tVoid),tVoid), 0); ADD_FUNCTION("update", f_hash_feed, tFunc(tStr,tObj), 0 ); ADD_FUNCTION("feed", f_hash_feed, tFunc(tStr,tObj), 0 ); ADD_FUNCTION("digest", f_hash_digest, tFunc(tVoid,tStr), 0); ADD_FUNCTION("query_name", f_hash_query_name, tFunc(tVoid,tStr), 0 ); ADD_FUNCTION("reset", f_hash_reset, tFunc(tVoid,tVoid), 0 ); ADD_FUNCTION("set_type", f_hash_set_type, tFunc(tInt,tVoid), 0 ); set_init_callback(init_hash_storage); set_exit_callback(free_hash_storage); end_class("Hash", 0); }
void PDESolver<T,lFunc,rFunc,bFunc,tFunc,force>::gnuPlotify( const Vector<T>& sol, const string &method) const { string size; stringstream strStream; strStream<<m_size; strStream>>size; ofstream pnts,up,down,left,right; pnts.open(("points"+method+size+".dat").c_str()); up.open(("up"+method+size+".dat").c_str()); down.open(("down"+method+size+".dat").c_str()); left.open(("left"+method+size+".dat").c_str()); right.open(("right"+method+size+".dat").c_str()); T val = (m_upperBound-m_lowerBound)/m_size; for(unsigned long i = 0;i<m_size;i++) { up<<m_upperBound<<","<<val<<","<<tFunc(val)<<endl; down<<m_lowerBound<<","<<val<<","<<bFunc(val)<<endl; left<<val<<","<<m_leftBound<<","<<lFunc(val)<<endl; right<<val<<","<<m_rightBound<<","<<rFunc(val)<<endl; } for(unsigned long i = 0;i<(m_size-1)*(m_size-1);i++) { T y = i/(m_size-1); T x = i%(m_size-1); pnts<<x*val<<", "<<y*val<<", "<<sol[i]<<endl; } pnts.close(); up.close(); down.close(); left.close(); right.close(); }
void init_parser_rcs(void) { ADD_FUNCTION("tokenize",f_tokenize,tFunc(tStr,tArray),0); }
void init_stdio_port(void) { ptrdiff_t offset; START_NEW_PROGRAM_ID (STDIO_PORT); offset = ADD_STORAGE(struct port); PIKE_MAP_VARIABLE("_accept_callback", offset + OFFSETOF(port, accept_callback), tMix, PIKE_T_MIXED, 0); PIKE_MAP_VARIABLE("_id", offset + OFFSETOF(port, id), tMix, PIKE_T_MIXED, 0); /* function(int|string,void|mixed,void|string:int) */ ADD_FUNCTION("bind", port_bind, tFunc(tOr(tInt,tStr) tOr(tVoid,tMix) tOr(tVoid,tStr) tOr(tVoid,tInt),tInt), 0); #ifdef HAVE_SYS_UN_H /* function(int|string,void|mixed,void|string:int) */ ADD_FUNCTION("bind_unix", bind_unix, tFunc(tStr tOr(tVoid,tMix),tInt), ID_OPTIONAL); #endif /* HAVE_SYS_UN_H */ ADD_FUNCTION("close",port_close,tFunc(tNone,tVoid),0); /* function(int,void|mixed:int) */ ADD_FUNCTION("listen_fd",port_listen_fd,tFunc(tInt tOr(tVoid,tMix),tInt),0); /* function(mixed:mixed) */ ADD_FUNCTION("set_id",port_set_id,tFunc(tMix,tMix),0); /* function(:mixed) */ ADD_FUNCTION("query_id",port_query_id,tFunc(tNone,tMix),0); /* function(:string) */ ADD_FUNCTION("query_address",socket_query_address,tFunc(tNone,tStr),0); /* function(:int) */ ADD_FUNCTION("errno",port_errno,tFunc(tNone,tInt),0); /* function(:object) */ port_fd_factory_fun_num = ADD_FUNCTION("fd_factory", port_fd_factory, tFunc(tNone,tObjIs_STDIO_FD), ID_PROTECTED); ADD_FUNCTION("accept",port_accept,tFunc(tNone,tObjIs_STDIO_FD),0); /* function(void|string|int,void|mixed,void|string:void) */ ADD_FUNCTION("create", port_create, tFunc(tOr3(tVoid,tStr,tInt) tOr(tVoid,tMix) tOr(tVoid,tStr), tVoid), 0); ADD_FUNCTION ("set_backend", port_set_backend, tFunc(tObj,tVoid), 0); ADD_FUNCTION ("query_backend", port_query_backend, tFunc(tVoid,tObj), 0); ADD_FUNCTION ("query_fd", port_query_fd, tFunc(tVoid,tInt), 0); #ifdef SO_REUSEPORT ADD_INT_CONSTANT( "SO_REUSEPORT_SUPPORT", SO_REUSEPORT, ID_OPTIONAL ); #endif #ifdef TCP_FASTOPEN ADD_INT_CONSTANT( "TCP_FASTOPEN_SUPPORT", TCP_FASTOPEN, ID_OPTIONAL ); #endif set_init_callback(init_port_struct); set_exit_callback(exit_port_struct); port_program = end_program(); add_program_constant( "_port", port_program, 0 ); }
void init_parser_pike() { ADD_FUNCTION2("tokenize", f_tokenize, tFunc(tStr,tArr(tOr(tArr(tStr),tStr))), 0, 0); }
/* Initialized the sender */ void init_nbio(void) { start_new_program(); ADD_STORAGE( nbio_storage ); set_init_callback(alloc_nb_struct); set_exit_callback(free_nb_struct); ADD_FUNCTION("start", f_nbio_start, tFunc(tVoid, tVoid), 0); ADD_FUNCTION("nbio_status", f_nbio_status, tFunc(tVoid, tArray), 0); ADD_FUNCTION("input", f_input, tFunc(tObj tOr(tInt, tVoid), tVoid), 0); ADD_FUNCTION("write", f_write, tFunc(tStr, tVoid), 0); ADD_FUNCTION("output", f_output, tFunc(tObj, tVoid), 0); ADD_FUNCTION("_output_write_cb", f__output_write_cb, tFunc(tInt, tVoid), 0); ADD_FUNCTION("_input_read_cb", f__input_read_cb, tFunc(tInt tStr, tVoid), 0); ADD_FUNCTION("_input_close_cb", f__input_close_cb, tFunc(tInt, tVoid), 0); ADD_FUNCTION("set_done_callback", f_set_done_callback, tFunc(tOr(tVoid,tFunc(tMix, tMix)) tOr(tVoid,tMix),tVoid),0); ADD_FUNCTION("bytes_sent", f_bytes_sent, tFunc(tNone,tInt), 0); nbio_program = end_program(); add_program_constant("nbio", nbio_program, 0); output_write_cb_off = find_identifier("_output_write_cb", nbio_program); input_read_cb_off = find_identifier("_input_read_cb", nbio_program); input_close_cb_off = find_identifier("_input_close_cb", nbio_program); }
void pike_module_init() { struct utsname utsname; char *p; uname(&utsname); if ((p = strchr (utsname.nodename, '.'))) *p = 0; Hostname=strdup(utsname.nodename); Tempdir=(char *) LIBMUTT_TEMPDIR; ADD_INT_CONSTANT("M_READ",M_READ,0); ADD_INT_CONSTANT("M_REPLIED",M_REPLIED,0); ADD_INT_CONSTANT("M_OLD",M_OLD,0); ADD_INT_CONSTANT("M_FLAG",M_FLAG,0); ADD_INT_CONSTANT("M_DELETE",M_DELETE,0); ADD_INT_CONSTANT("M_TAG",M_TAG,0); ADD_INT_CONSTANT("M_NEW",M_NEW,0); /* constants for mx_check_mailbox() */ ADD_INT_CONSTANT("M_NEW_MAIL",M_NEW_MAIL,0); ADD_INT_CONSTANT("M_REOPENED",M_REOPENED,0); ADD_INT_CONSTANT("M_FLAGS",M_FLAGS,0); start_new_program(); ADD_STORAGE(MAILSTORE_STORAGE); set_init_callback(init_mailstore); set_exit_callback(exit_mailstore); // public pike methods ADD_FUNCTION("create", f_create, tFunc(tString, tVoid), 0); ADD_FUNCTION("_sizeof", f__sizeof, tFunc(tVoid, tInt), 0); ADD_FUNCTION("stat", f_stat, tFunc(tVoid, tMapping), 0); ADD_FUNCTION("get_header", f_get_header, tFunc(tInt, tMapping), 0); ADD_FUNCTION("debug", f_debug, tFunc(tInt, tInt), 0); ADD_FUNCTION("set_flag", f_set_flag, tFunc(tInt tInt, tVoid), 0); ADD_FUNCTION("reset_flag", f_reset_flag, tFunc(tInt tInt, tVoid), 0); ADD_FUNCTION("check_mailbox", f_check_mailbox, tFunc(tVoid, tInt), 0); /* Mailbox.Message */ start_new_program(); set_init_callback(init_message_storage); set_exit_callback(exit_message_storage); ADD_STORAGE( MESSAGE_STORAGE ); ADD_FUNCTION("create", f_msg_create, tFunc(tInt, tVoid), 0); ADD_FUNCTION("getFD", f_msg_getfd, tFunc(tVoid, tInt), 0); ADD_FUNCTION("get_header",f_msg_get_header, tFunc(tVoid, tMapping), 0); end_class("Message",0); end_class("Mailbox",0); mutt_error=libmutt_error; /* reference it so that it's not optimized out */ __dummy_variable[0] = (void*)NULL; }
void _ol_ldap_program_init(void) { start_new_program(); ADD_STORAGE(OLSTORAGE); set_init_callback(init_ldap); set_exit_callback(exit_ldap); ADD_FUNCTION("create", f_create, tFunc(tString, tVoid), 0); ADD_FUNCTION("bind", f_ldap_bind, tFunc(tOr(tString, tVoid) tOr(tString, tVoid) tOr(tInt, tVoid), tInt), 0); ADD_FUNCTION("unbind", f_ldap_unbind, tFunc(tVoid, tInt), 0); ADD_FUNCTION("enable_cache", f_ldap_enable_cache, tFunc(tOr(tInt, tVoid) tOr(tInt, tVoid), tInt), 0); ADD_FUNCTION("disable_cache", f_ldap_disable_cache, tFunc(tVoid, tVoid), 0); ADD_FUNCTION("destroy_cache", f_ldap_destroy_cache, tFunc(tVoid, tVoid), 0); ADD_FUNCTION("flush_cache", f_ldap_flush_cache, tFunc(tVoid, tVoid), 0); ADD_FUNCTION("uncache_entry", f_ldap_uncache_entry, tFunc(tString, tVoid), 0); ADD_FUNCTION("set_cache_options", f_ldap_set_cache_options, tFunc(tInt, tVoid), 0); ADD_FUNCTION("err2string", f_ldap_err2string, tFunc(tInt, tVoid), 0); ADD_FUNCTION("set_base_dn", f_set_base_dn, tFunc(tString, tString), 0); ADD_FUNCTION("set_basedn", f_set_base_dn, tFunc(tString, tString), 0); ADD_FUNCTION("set_scope", f_set_scope, tFunc(tInt, tVoid), 0); ADD_FUNCTION("dn2ufn", f_ldap_dn2ufn, tFunc(tString, tString), 0); ADD_FUNCTION("explode_dn", f_ldap_explode_dn, tFunc(tString tOr(tInt, tVoid), tArr(tString)), 0); ADD_FUNCTION("search", f_ldap_search, tFunc(tOr(tMapping, tString tOr(tArray, tVoid) tOr(tInt, tVoid) tOr(tInt, tVoid)), tOr(tObj, tInt)), 0); ADD_FUNCTION("modify", f_ldap_modify, tFunc(tString tArr(tMap(tString, tMixed)), tVoid), 0); ADD_FUNCTION("add", f_ldap_add, tFunc(tString tArr(tMap(tString, tMixed)), tVoid), 0); ADD_FUNCTION("delete", f_ldap_delete, tFunc(tString, tVoid), 0); _ol_result_program_init(); ldap_program = end_program(); add_program_constant("Client", ldap_program, 0); add_program_constant("client", ldap_program, 0); }