summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/guile/weechat-guile-api.c101
-rw-r--r--src/plugins/javascript/weechat-js-api.cpp75
-rw-r--r--src/plugins/lua/weechat-lua-api.c59
-rw-r--r--src/plugins/lua/weechat-lua-api.h1
-rw-r--r--src/plugins/lua/weechat-lua.c40
-rw-r--r--src/plugins/lua/weechat-lua.h10
-rw-r--r--src/plugins/perl/weechat-perl-api.c59
-rw-r--r--src/plugins/php/weechat-php.c82
-rw-r--r--src/plugins/plugin-script.c45
-rw-r--r--src/plugins/plugin-script.h36
-rw-r--r--src/plugins/python/weechat-python.c64
-rw-r--r--src/plugins/ruby/weechat-ruby-api.c59
-rw-r--r--src/plugins/tcl/weechat-tcl-api.c65
13 files changed, 207 insertions, 489 deletions
diff --git a/src/plugins/guile/weechat-guile-api.c b/src/plugins/guile/weechat-guile-api.c
index a04e6d5a8..dc012ca9c 100644
--- a/src/plugins/guile/weechat-guile-api.c
+++ b/src/plugins/guile/weechat-guile-api.c
@@ -5395,6 +5395,8 @@ weechat_guile_api_upgrade_close (SCM upgrade_file)
void
weechat_guile_api_module_init (void *data)
{
+ char str_const[256];
+ int i;
#if SCM_MAJOR_VERSION >= 3 || (SCM_MAJOR_VERSION == 2 && SCM_MINOR_VERSION >= 2)
/* Guile >= 2.2 */
scm_t_port_type *port_type;
@@ -5642,92 +5644,15 @@ weechat_guile_api_module_init (void *data)
API_DEF_FUNC(upgrade_close, 1);
/* interface constants */
- scm_c_define ("weechat:WEECHAT_RC_OK", scm_from_int (WEECHAT_RC_OK));
- scm_c_define ("weechat:WEECHAT_RC_OK_EAT", scm_from_int (WEECHAT_RC_OK_EAT));
- scm_c_define ("weechat:WEECHAT_RC_ERROR", scm_from_int (WEECHAT_RC_ERROR));
-
- scm_c_define ("weechat:WEECHAT_CONFIG_READ_OK", scm_from_int (WEECHAT_CONFIG_READ_OK));
- scm_c_define ("weechat:WEECHAT_CONFIG_READ_MEMORY_ERROR", scm_from_int (WEECHAT_CONFIG_READ_MEMORY_ERROR));
- scm_c_define ("weechat:WEECHAT_CONFIG_READ_FILE_NOT_FOUND", scm_from_int (WEECHAT_CONFIG_READ_FILE_NOT_FOUND));
- scm_c_define ("weechat:WEECHAT_CONFIG_WRITE_OK", scm_from_int (WEECHAT_CONFIG_WRITE_OK));
- scm_c_define ("weechat:WEECHAT_CONFIG_WRITE_ERROR", scm_from_int (WEECHAT_CONFIG_WRITE_ERROR));
- scm_c_define ("weechat:WEECHAT_CONFIG_WRITE_MEMORY_ERROR", scm_from_int (WEECHAT_CONFIG_WRITE_MEMORY_ERROR));
- scm_c_define ("weechat:WEECHAT_CONFIG_OPTION_SET_OK_CHANGED", scm_from_int (WEECHAT_CONFIG_OPTION_SET_OK_CHANGED));
- scm_c_define ("weechat:WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE", scm_from_int (WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE));
- scm_c_define ("weechat:WEECHAT_CONFIG_OPTION_SET_ERROR", scm_from_int (WEECHAT_CONFIG_OPTION_SET_ERROR));
- scm_c_define ("weechat:WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND", scm_from_int (WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND));
- scm_c_define ("weechat:WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET", scm_from_int (WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET));
- scm_c_define ("weechat:WEECHAT_CONFIG_OPTION_UNSET_OK_RESET", scm_from_int (WEECHAT_CONFIG_OPTION_UNSET_OK_RESET));
- scm_c_define ("weechat:WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED", scm_from_int (WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED));
- scm_c_define ("weechat:WEECHAT_CONFIG_OPTION_UNSET_ERROR", scm_from_int (WEECHAT_CONFIG_OPTION_UNSET_ERROR));
-
- scm_c_define ("weechat:WEECHAT_LIST_POS_SORT", scm_from_locale_string (WEECHAT_LIST_POS_SORT));
- scm_c_define ("weechat:WEECHAT_LIST_POS_BEGINNING", scm_from_locale_string (WEECHAT_LIST_POS_BEGINNING));
- scm_c_define ("weechat:WEECHAT_LIST_POS_END", scm_from_locale_string (WEECHAT_LIST_POS_END));
-
- scm_c_define ("weechat:WEECHAT_HOTLIST_LOW", scm_from_locale_string (WEECHAT_HOTLIST_LOW));
- scm_c_define ("weechat:WEECHAT_HOTLIST_MESSAGE", scm_from_locale_string (WEECHAT_HOTLIST_MESSAGE));
- scm_c_define ("weechat:WEECHAT_HOTLIST_PRIVATE", scm_from_locale_string (WEECHAT_HOTLIST_PRIVATE));
- scm_c_define ("weechat:WEECHAT_HOTLIST_HIGHLIGHT", scm_from_locale_string (WEECHAT_HOTLIST_HIGHLIGHT));
-
- scm_c_define ("weechat:WEECHAT_HOOK_PROCESS_RUNNING", scm_from_int (WEECHAT_HOOK_PROCESS_RUNNING));
- scm_c_define ("weechat:WEECHAT_HOOK_PROCESS_ERROR", scm_from_int (WEECHAT_HOOK_PROCESS_ERROR));
-
- scm_c_define ("weechat:WEECHAT_HOOK_CONNECT_OK", scm_from_int (WEECHAT_HOOK_CONNECT_OK));
- scm_c_define ("weechat:WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND", scm_from_int (WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND));
- scm_c_define ("weechat:WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND", scm_from_int (WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND));
- scm_c_define ("weechat:WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED", scm_from_int (WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED));
- scm_c_define ("weechat:WEECHAT_HOOK_CONNECT_PROXY_ERROR", scm_from_int (WEECHAT_HOOK_CONNECT_PROXY_ERROR));
- scm_c_define ("weechat:WEECHAT_HOOK_CONNECT_LOCAL_HOSTNAME_ERROR", scm_from_int (WEECHAT_HOOK_CONNECT_LOCAL_HOSTNAME_ERROR));
- scm_c_define ("weechat:WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR", scm_from_int (WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR));
- scm_c_define ("weechat:WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR", scm_from_int (WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR));
- scm_c_define ("weechat:WEECHAT_HOOK_CONNECT_MEMORY_ERROR", scm_from_int (WEECHAT_HOOK_CONNECT_MEMORY_ERROR));
- scm_c_define ("weechat:WEECHAT_HOOK_CONNECT_TIMEOUT", scm_from_int (WEECHAT_HOOK_CONNECT_TIMEOUT));
- scm_c_define ("weechat:WEECHAT_HOOK_CONNECT_SOCKET_ERROR", scm_from_int (WEECHAT_HOOK_CONNECT_SOCKET_ERROR));
-
- scm_c_define ("weechat:WEECHAT_HOOK_SIGNAL_STRING", scm_from_locale_string (WEECHAT_HOOK_SIGNAL_STRING));
- scm_c_define ("weechat:WEECHAT_HOOK_SIGNAL_INT", scm_from_locale_string (WEECHAT_HOOK_SIGNAL_INT));
- scm_c_define ("weechat:WEECHAT_HOOK_SIGNAL_POINTER", scm_from_locale_string (WEECHAT_HOOK_SIGNAL_POINTER));
-
- scm_c_export ("weechat:WEECHAT_RC_OK",
- "weechat:WEECHAT_RC_OK_EAT",
- "weechat:WEECHAT_RC_ERROR",
- "weechat:WEECHAT_CONFIG_READ_OK",
- "weechat:WEECHAT_CONFIG_READ_MEMORY_ERROR",
- "weechat:WEECHAT_CONFIG_READ_FILE_NOT_FOUND",
- "weechat:WEECHAT_CONFIG_WRITE_OK",
- "weechat:WEECHAT_CONFIG_WRITE_ERROR",
- "weechat:WEECHAT_CONFIG_WRITE_MEMORY_ERROR",
- "weechat:WEECHAT_CONFIG_OPTION_SET_OK_CHANGED",
- "weechat:WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE",
- "weechat:WEECHAT_CONFIG_OPTION_SET_ERROR",
- "weechat:WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND",
- "weechat:WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET",
- "weechat:WEECHAT_CONFIG_OPTION_UNSET_OK_RESET",
- "weechat:WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED",
- "weechat:WEECHAT_CONFIG_OPTION_UNSET_ERROR",
- "weechat:WEECHAT_LIST_POS_SORT",
- "weechat:WEECHAT_LIST_POS_BEGINNING",
- "weechat:WEECHAT_LIST_POS_END",
- "weechat:WEECHAT_HOTLIST_LOW",
- "weechat:WEECHAT_HOTLIST_MESSAGE",
- "weechat:WEECHAT_HOTLIST_PRIVATE",
- "weechat:WEECHAT_HOTLIST_HIGHLIGHT",
- "weechat:WEECHAT_HOOK_PROCESS_RUNNING",
- "weechat:WEECHAT_HOOK_PROCESS_ERROR",
- "weechat:WEECHAT_HOOK_CONNECT_OK",
- "weechat:WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND",
- "weechat:WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND",
- "weechat:WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED",
- "weechat:WEECHAT_HOOK_CONNECT_PROXY_ERROR",
- "weechat:WEECHAT_HOOK_CONNECT_LOCAL_HOSTNAME_ERROR",
- "weechat:WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR",
- "weechat:WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR",
- "weechat:WEECHAT_HOOK_CONNECT_MEMORY_ERROR",
- "weechat:WEECHAT_HOOK_CONNECT_TIMEOUT",
- "weechat:WEECHAT_HOOK_CONNECT_SOCKET_ERROR",
- "weechat:WEECHAT_HOOK_SIGNAL_STRING",
- "weechat:WEECHAT_HOOK_SIGNAL_INT",
- "weechat:WEECHAT_HOOK_SIGNAL_POINTER",
- NULL);
+ for (i = 0; weechat_script_constants[i].name; i++)
+ {
+ snprintf (str_const, sizeof (str_const),
+ "weechat:%s", weechat_script_constants[i].name);
+ scm_c_define (
+ str_const,
+ (weechat_script_constants[i].value_string) ?
+ scm_from_locale_string (weechat_script_constants[i].value_string) :
+ scm_from_int (weechat_script_constants[i].value_integer));
+ scm_c_export (str_const, NULL);
+ }
}
diff --git a/src/plugins/javascript/weechat-js-api.cpp b/src/plugins/javascript/weechat-js-api.cpp
index 0e139fc70..d477c40e0 100644
--- a/src/plugins/javascript/weechat-js-api.cpp
+++ b/src/plugins/javascript/weechat-js-api.cpp
@@ -43,12 +43,6 @@ extern "C"
weechat_obj->Set( \
v8::String::New(#__name), \
v8::FunctionTemplate::New(weechat_js_api_##__name));
-#define API_DEF_CONST_INT(__name) \
- weechat_obj->Set(v8::String::New(#__name), \
- v8::Integer::New(__name));
-#define API_DEF_CONST_STR(__name) \
- weechat_obj->Set(v8::String::New(#__name), \
- v8::String::New(__name));
#define API_FUNC(__name) \
static v8::Handle<v8::Value> \
weechat_js_api_##__name(const v8::Arguments &args)
@@ -5320,57 +5314,28 @@ API_FUNC(upgrade_close)
void
WeechatJsV8::loadLibs()
{
+ int i;
+
v8::Local<v8::ObjectTemplate> weechat_obj = v8::ObjectTemplate::New();
- /* constants */
- API_DEF_CONST_INT(WEECHAT_RC_OK);
- API_DEF_CONST_INT(WEECHAT_RC_OK_EAT);
- API_DEF_CONST_INT(WEECHAT_RC_ERROR);
-
- API_DEF_CONST_INT(WEECHAT_CONFIG_READ_OK);
- API_DEF_CONST_INT(WEECHAT_CONFIG_READ_MEMORY_ERROR);
- API_DEF_CONST_INT(WEECHAT_CONFIG_READ_FILE_NOT_FOUND);
- API_DEF_CONST_INT(WEECHAT_CONFIG_WRITE_OK);
- API_DEF_CONST_INT(WEECHAT_CONFIG_WRITE_ERROR);
- API_DEF_CONST_INT(WEECHAT_CONFIG_WRITE_MEMORY_ERROR);
- API_DEF_CONST_INT(WEECHAT_CONFIG_OPTION_SET_OK_CHANGED);
- API_DEF_CONST_INT(WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE);
- API_DEF_CONST_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- API_DEF_CONST_INT(WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND);
- API_DEF_CONST_INT(WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET);
- API_DEF_CONST_INT(WEECHAT_CONFIG_OPTION_UNSET_OK_RESET);
- API_DEF_CONST_INT(WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED);
- API_DEF_CONST_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
-
- API_DEF_CONST_STR(WEECHAT_LIST_POS_SORT);
- API_DEF_CONST_STR(WEECHAT_LIST_POS_BEGINNING);
- API_DEF_CONST_STR(WEECHAT_LIST_POS_END);
-
- API_DEF_CONST_STR(WEECHAT_HOTLIST_LOW);
- API_DEF_CONST_STR(WEECHAT_HOTLIST_MESSAGE);
- API_DEF_CONST_STR(WEECHAT_HOTLIST_PRIVATE);
- API_DEF_CONST_STR(WEECHAT_HOTLIST_HIGHLIGHT);
-
- API_DEF_CONST_INT(WEECHAT_HOOK_PROCESS_RUNNING);
- API_DEF_CONST_INT(WEECHAT_HOOK_PROCESS_ERROR);
-
- API_DEF_CONST_INT(WEECHAT_HOOK_CONNECT_OK);
- API_DEF_CONST_INT(WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND);
- API_DEF_CONST_INT(WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND);
- API_DEF_CONST_INT(WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED);
- API_DEF_CONST_INT(WEECHAT_HOOK_CONNECT_PROXY_ERROR);
- API_DEF_CONST_INT(WEECHAT_HOOK_CONNECT_LOCAL_HOSTNAME_ERROR);
- API_DEF_CONST_INT(WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR);
- API_DEF_CONST_INT(WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR);
- API_DEF_CONST_INT(WEECHAT_HOOK_CONNECT_MEMORY_ERROR);
- API_DEF_CONST_INT(WEECHAT_HOOK_CONNECT_TIMEOUT);
- API_DEF_CONST_INT(WEECHAT_HOOK_CONNECT_SOCKET_ERROR);
-
- API_DEF_CONST_STR(WEECHAT_HOOK_SIGNAL_STRING);
- API_DEF_CONST_STR(WEECHAT_HOOK_SIGNAL_INT);
- API_DEF_CONST_STR(WEECHAT_HOOK_SIGNAL_POINTER);
-
- /* functions */
+ /* interface constants */
+ for (i = 0; weechat_script_constants[i].name; i++)
+ {
+ if (weechat_script_constants[i].value_string)
+ {
+ weechat_obj->Set(
+ v8::String::New(weechat_script_constants[i].name),
+ v8::String::New(weechat_script_constants[i].value_string));
+ }
+ else
+ {
+ weechat_obj->Set(
+ v8::String::New(weechat_script_constants[i].name),
+ v8::Integer::New(weechat_script_constants[i].value_integer));
+ }
+ }
+
+ /* interface functions */
API_DEF_FUNC(register);
API_DEF_FUNC(plugin_get_name);
API_DEF_FUNC(charset_set);
diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c
index 36a43adde..fcc0f09a3 100644
--- a/src/plugins/lua/weechat-lua-api.c
+++ b/src/plugins/lua/weechat-lua-api.c
@@ -36,10 +36,6 @@
#include "weechat-lua.h"
-#define API_DEF_CONST_INT(__name) \
- { #__name, __name, NULL }
-#define API_DEF_CONST_STR(__name) \
- { #__name, 0, __name }
#define API_DEF_FUNC(__name) \
{ #__name, &weechat_lua_api_##__name }
#define API_FUNC(__name) \
@@ -5966,58 +5962,5 @@ const struct luaL_Reg weechat_lua_api_funcs[] = {
API_DEF_FUNC(upgrade_write_object),
API_DEF_FUNC(upgrade_read),
API_DEF_FUNC(upgrade_close),
-
- { NULL, NULL }
-};
-
-const struct t_lua_const weechat_lua_api_consts[] =
-{
- API_DEF_CONST_INT(WEECHAT_RC_OK),
- API_DEF_CONST_INT(WEECHAT_RC_OK_EAT),
- API_DEF_CONST_INT(WEECHAT_RC_ERROR),
-
- API_DEF_CONST_INT(WEECHAT_CONFIG_READ_OK),
- API_DEF_CONST_INT(WEECHAT_CONFIG_READ_MEMORY_ERROR),
- API_DEF_CONST_INT(WEECHAT_CONFIG_READ_FILE_NOT_FOUND),
- API_DEF_CONST_INT(WEECHAT_CONFIG_WRITE_OK),
- API_DEF_CONST_INT(WEECHAT_CONFIG_WRITE_ERROR),
- API_DEF_CONST_INT(WEECHAT_CONFIG_WRITE_MEMORY_ERROR),
- API_DEF_CONST_INT(WEECHAT_CONFIG_OPTION_SET_OK_CHANGED),
- API_DEF_CONST_INT(WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE),
- API_DEF_CONST_INT(WEECHAT_CONFIG_OPTION_SET_ERROR),
- API_DEF_CONST_INT(WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND),
- API_DEF_CONST_INT(WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET),
- API_DEF_CONST_INT(WEECHAT_CONFIG_OPTION_UNSET_OK_RESET),
- API_DEF_CONST_INT(WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED),
- API_DEF_CONST_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR),
-
- API_DEF_CONST_STR(WEECHAT_LIST_POS_SORT),
- API_DEF_CONST_STR(WEECHAT_LIST_POS_BEGINNING),
- API_DEF_CONST_STR(WEECHAT_LIST_POS_END),
-
- API_DEF_CONST_STR(WEECHAT_HOTLIST_LOW),
- API_DEF_CONST_STR(WEECHAT_HOTLIST_MESSAGE),
- API_DEF_CONST_STR(WEECHAT_HOTLIST_PRIVATE),
- API_DEF_CONST_STR(WEECHAT_HOTLIST_HIGHLIGHT),
-
- API_DEF_CONST_INT(WEECHAT_HOOK_PROCESS_RUNNING),
- API_DEF_CONST_INT(WEECHAT_HOOK_PROCESS_ERROR),
-
- API_DEF_CONST_INT(WEECHAT_HOOK_CONNECT_OK),
- API_DEF_CONST_INT(WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND),
- API_DEF_CONST_INT(WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND),
- API_DEF_CONST_INT(WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED),
- API_DEF_CONST_INT(WEECHAT_HOOK_CONNECT_PROXY_ERROR),
- API_DEF_CONST_INT(WEECHAT_HOOK_CONNECT_LOCAL_HOSTNAME_ERROR),
- API_DEF_CONST_INT(WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR),
- API_DEF_CONST_INT(WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR),
- API_DEF_CONST_INT(WEECHAT_HOOK_CONNECT_MEMORY_ERROR),
- API_DEF_CONST_INT(WEECHAT_HOOK_CONNECT_TIMEOUT),
- API_DEF_CONST_INT(WEECHAT_HOOK_CONNECT_SOCKET_ERROR),
-
- API_DEF_CONST_STR(WEECHAT_HOOK_SIGNAL_STRING),
- API_DEF_CONST_STR(WEECHAT_HOOK_SIGNAL_INT),
- API_DEF_CONST_STR(WEECHAT_HOOK_SIGNAL_POINTER),
-
- { NULL, 0, NULL }
+ { NULL, NULL },
};
diff --git a/src/plugins/lua/weechat-lua-api.h b/src/plugins/lua/weechat-lua-api.h
index b9f02b130..a41138f29 100644
--- a/src/plugins/lua/weechat-lua-api.h
+++ b/src/plugins/lua/weechat-lua-api.h
@@ -22,7 +22,6 @@
#define WEECHAT_PLUGIN_LUA_API_H
extern struct luaL_Reg weechat_lua_api_funcs[];
-extern struct t_lua_const weechat_lua_api_consts[];
extern int weechat_lua_api_buffer_input_data_cb (const void *pointer,
void *data,
diff --git a/src/plugins/lua/weechat-lua.c b/src/plugins/lua/weechat-lua.c
index f2ae10808..c4d66cc98 100644
--- a/src/plugins/lua/weechat-lua.c
+++ b/src/plugins/lua/weechat-lua.c
@@ -423,25 +423,6 @@ weechat_lua_exec (struct t_plugin_script *script, int ret_type,
}
/*
- * Adds a constant.
- */
-
-void
-weechat_lua_add_constant (lua_State *L, struct t_lua_const *ptr_const)
-{
- lua_pushstring (L, ptr_const->name);
- if (ptr_const->str_value)
- lua_pushstring (L, ptr_const->str_value);
- else
-#if LUA_VERSION_NUM >= 503
- lua_pushinteger (L, ptr_const->int_value);
-#else
- lua_pushnumber (L, ptr_const->int_value);
-#endif /* LUA_VERSION_NUM >= 503 */
- lua_settable (L, -3);
-}
-
-/*
* Called when a constant is modified.
*/
@@ -459,8 +440,7 @@ weechat_lua_newindex (lua_State *L)
void
weechat_lua_register_lib (lua_State *L, const char *libname,
- const luaL_Reg *lua_api_funcs,
- struct t_lua_const lua_api_consts[])
+ const luaL_Reg *lua_api_funcs)
{
int i;
@@ -482,10 +462,21 @@ weechat_lua_register_lib (lua_State *L, const char *libname,
lua_pushliteral (L, "__index");
lua_newtable (L);
- for (i= 0; lua_api_consts[i].name; i++)
+ /* define constants */
+ for (i = 0; weechat_script_constants[i].name; i++)
{
- weechat_lua_add_constant (L, &lua_api_consts[i]);
+ lua_pushstring (L, weechat_script_constants[i].name);
+ if (weechat_script_constants[i].value_string)
+ lua_pushstring (L, weechat_script_constants[i].value_string);
+ else
+#if LUA_VERSION_NUM >= 503
+ lua_pushinteger (L, weechat_script_constants[i].value_integer);
+#else
+ lua_pushnumber (L, weechat_script_constants[i].value_integer);
+#endif /* LUA_VERSION_NUM >= 503 */
+ lua_settable (L, -3);
}
+
lua_settable (L, -3);
lua_pushliteral (L, "__newindex");
@@ -572,8 +563,7 @@ weechat_lua_load (const char *filename, const char *code)
#endif /* LUA_VERSION_NUM */
weechat_lua_register_lib (lua_current_interpreter, "weechat",
- weechat_lua_api_funcs,
- weechat_lua_api_consts);
+ weechat_lua_api_funcs);
#ifdef LUA_VERSION_NUM
if (luaL_dostring (lua_current_interpreter, lua_redirect_output) != 0)
diff --git a/src/plugins/lua/weechat-lua.h b/src/plugins/lua/weechat-lua.h
index 84c141bcd..7494bdb3d 100644
--- a/src/plugins/lua/weechat-lua.h
+++ b/src/plugins/lua/weechat-lua.h
@@ -27,13 +27,6 @@
#define LUA_CURRENT_SCRIPT_NAME ((lua_current_script) ? lua_current_script->name : "-")
-struct t_lua_const
-{
- char *name;
- int int_value;
- char *str_value;
-};
-
extern struct t_weechat_plugin *weechat_lua_plugin;
extern struct t_plugin_script_data lua_data;
@@ -59,7 +52,6 @@ extern void *weechat_lua_exec (struct t_plugin_script *script,
const char *function,
const char *format, void **argv);
extern void weechat_lua_register_lib (lua_State *L, const char *libname,
- const luaL_Reg *lua_api_funcs,
- struct t_lua_const lua_api_consts[]);
+ const luaL_Reg *lua_api_funcs);
#endif /* WEECHAT_PLUGIN_LUA_H */
diff --git a/src/plugins/perl/weechat-perl-api.c b/src/plugins/perl/weechat-perl-api.c
index 5617e29d1..89280fb8e 100644
--- a/src/plugins/perl/weechat-perl-api.c
+++ b/src/plugins/perl/weechat-perl-api.c
@@ -5674,6 +5674,8 @@ void
weechat_perl_api_init (pTHX)
{
HV *stash;
+ int i;
+ char str_const[256];
newXS ("DynaLoader::boot_DynaLoader", boot_DynaLoader, __FILE__);
newXS ("weechat::__output__", weechat_perl_output, "weechat");
@@ -5900,50 +5902,15 @@ weechat_perl_api_init (pTHX)
/* interface constants */
stash = gv_stashpv ("weechat", TRUE);
- newCONSTSUB (stash, "weechat::WEECHAT_RC_OK", newSViv (WEECHAT_RC_OK));
- newCONSTSUB (stash, "weechat::WEECHAT_RC_OK_EAT", newSViv (WEECHAT_RC_OK_EAT));
- newCONSTSUB (stash, "weechat::WEECHAT_RC_ERROR", newSViv (WEECHAT_RC_ERROR));
-
- newCONSTSUB (stash, "weechat::WEECHAT_CONFIG_READ_OK", newSViv (WEECHAT_CONFIG_READ_OK));
- newCONSTSUB (stash, "weechat::WEECHAT_CONFIG_READ_MEMORY_ERROR", newSViv (WEECHAT_CONFIG_READ_MEMORY_ERROR));
- newCONSTSUB (stash, "weechat::WEECHAT_CONFIG_READ_FILE_NOT_FOUND", newSViv (WEECHAT_CONFIG_READ_FILE_NOT_FOUND));
- newCONSTSUB (stash, "weechat::WEECHAT_CONFIG_WRITE_OK", newSViv (WEECHAT_CONFIG_WRITE_OK));
- newCONSTSUB (stash, "weechat::WEECHAT_CONFIG_WRITE_ERROR", newSViv (WEECHAT_CONFIG_WRITE_ERROR));
- newCONSTSUB (stash, "weechat::WEECHAT_CONFIG_WRITE_MEMORY_ERROR", newSViv (WEECHAT_CONFIG_WRITE_MEMORY_ERROR));
- newCONSTSUB (stash, "weechat::WEECHAT_CONFIG_OPTION_SET_OK_CHANGED", newSViv (WEECHAT_CONFIG_OPTION_SET_OK_CHANGED));
- newCONSTSUB (stash, "weechat::WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE", newSViv (WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE));
- newCONSTSUB (stash, "weechat::WEECHAT_CONFIG_OPTION_SET_ERROR", newSViv (WEECHAT_CONFIG_OPTION_SET_ERROR));
- newCONSTSUB (stash, "weechat::WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND", newSViv (WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND));
- newCONSTSUB (stash, "weechat::WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET", newSViv (WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET));
- newCONSTSUB (stash, "weechat::WEECHAT_CONFIG_OPTION_UNSET_OK_RESET", newSViv (WEECHAT_CONFIG_OPTION_UNSET_OK_RESET));
- newCONSTSUB (stash, "weechat::WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED", newSViv (WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED));
- newCONSTSUB (stash, "weechat::WEECHAT_CONFIG_OPTION_UNSET_ERROR", newSViv (WEECHAT_CONFIG_OPTION_UNSET_ERROR));
-
- newCONSTSUB (stash, "weechat::WEECHAT_LIST_POS_SORT", newSVpv (WEECHAT_LIST_POS_SORT, PL_na));
- newCONSTSUB (stash, "weechat::WEECHAT_LIST_POS_BEGINNING", newSVpv (WEECHAT_LIST_POS_BEGINNING, PL_na));
- newCONSTSUB (stash, "weechat::WEECHAT_LIST_POS_END", newSVpv (WEECHAT_LIST_POS_END, PL_na));
-
- newCONSTSUB (stash, "weechat::WEECHAT_HOTLIST_LOW", newSVpv (WEECHAT_HOTLIST_LOW, PL_na));
- newCONSTSUB (stash, "weechat::WEECHAT_HOTLIST_MESSAGE", newSVpv (WEECHAT_HOTLIST_MESSAGE, PL_na));
- newCONSTSUB (stash, "weechat::WEECHAT_HOTLIST_PRIVATE", newSVpv (WEECHAT_HOTLIST_PRIVATE, PL_na));
- newCONSTSUB (stash, "weechat::WEECHAT_HOTLIST_HIGHLIGHT", newSVpv (WEECHAT_HOTLIST_HIGHLIGHT, PL_na));
-
- newCONSTSUB (stash, "weechat::WEECHAT_HOOK_PROCESS_RUNNING", newSViv (WEECHAT_HOOK_PROCESS_RUNNING));
- newCONSTSUB (stash, "weechat::WEECHAT_HOOK_PROCESS_ERROR", newSViv (WEECHAT_HOOK_PROCESS_ERROR));
-
- newCONSTSUB (stash, "weechat::WEECHAT_HOOK_CONNECT_OK", newSViv (WEECHAT_HOOK_CONNECT_OK));
- newCONSTSUB (stash, "weechat::WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND", newSViv (WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND));
- newCONSTSUB (stash, "weechat::WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND", newSViv (WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND));
- newCONSTSUB (stash, "weechat::WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED", newSViv (WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED));
- newCONSTSUB (stash, "weechat::WEECHAT_HOOK_CONNECT_PROXY_ERROR", newSViv (WEECHAT_HOOK_CONNECT_PROXY_ERROR));
- newCONSTSUB (stash, "weechat::WEECHAT_HOOK_CONNECT_LOCAL_HOSTNAME_ERROR", newSViv (WEECHAT_HOOK_CONNECT_LOCAL_HOSTNAME_ERROR));
- newCONSTSUB (stash, "weechat::WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR", newSViv (WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR));
- newCONSTSUB (stash, "weechat::WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR", newSViv (WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR));
- newCONSTSUB (stash, "weechat::WEECHAT_HOOK_CONNECT_MEMORY_ERROR", newSViv (WEECHAT_HOOK_CONNECT_MEMORY_ERROR));
- newCONSTSUB (stash, "weechat::WEECHAT_HOOK_CONNECT_TIMEOUT", newSViv (WEECHAT_HOOK_CONNECT_TIMEOUT));
- newCONSTSUB (stash, "weechat::WEECHAT_HOOK_CONNECT_SOCKET_ERROR", newSViv (WEECHAT_HOOK_CONNECT_SOCKET_ERROR));
-
- newCONSTSUB (stash, "weechat::WEECHAT_HOOK_SIGNAL_STRING", newSVpv (WEECHAT_HOOK_SIGNAL_STRING, PL_na));
- newCONSTSUB (stash, "weechat::WEECHAT_HOOK_SIGNAL_INT", newSVpv (WEECHAT_HOOK_SIGNAL_INT, PL_na));
- newCONSTSUB (stash, "weechat::WEECHAT_HOOK_SIGNAL_POINTER", newSVpv (WEECHAT_HOOK_SIGNAL_POINTER, PL_na));
+ for (i = 0; weechat_script_constants[i].name; i++)
+ {
+ snprintf (str_const, sizeof (str_const),
+ "weechat::%s", weechat_script_constants[i].name);
+ newCONSTSUB (
+ stash,
+ str_const,
+ (weechat_script_constants[i].value_string) ?
+ newSVpv (weechat_script_constants[i].value_string, PL_na) :
+ newSViv (weechat_script_constants[i].value_integer));
+ }
}
diff --git a/src/plugins/php/weechat-php.c b/src/plugins/php/weechat-php.c
index d17aba86f..3ef3df50a 100644
--- a/src/plugins/php/weechat-php.c
+++ b/src/plugins/php/weechat-php.c
@@ -328,67 +328,33 @@ const zend_function_entry weechat_functions[] = {
PHP_MINIT_FUNCTION(weechat)
{
+ int i;
+
/* make C compiler happy */
(void) type;
- /* Register integer constants */
- #define PHP_WEECHAT_CONSTANT(NAME) \
- zend_register_long_constant(#NAME, sizeof(#NAME)-1, (NAME), CONST_CS | CONST_PERSISTENT, module_number)
- PHP_WEECHAT_CONSTANT(WEECHAT_RC_OK);
- PHP_WEECHAT_CONSTANT(WEECHAT_RC_OK_EAT);
- PHP_WEECHAT_CONSTANT(WEECHAT_RC_ERROR);
- PHP_WEECHAT_CONSTANT(WEECHAT_CONFIG_READ_OK);
- PHP_WEECHAT_CONSTANT(WEECHAT_CONFIG_READ_MEMORY_ERROR);
- PHP_WEECHAT_CONSTANT(WEECHAT_CONFIG_READ_FILE_NOT_FOUND);
- PHP_WEECHAT_CONSTANT(WEECHAT_CONFIG_WRITE_OK);
- PHP_WEECHAT_CONSTANT(WEECHAT_CONFIG_WRITE_ERROR);
- PHP_WEECHAT_CONSTANT(WEECHAT_CONFIG_WRITE_MEMORY_ERROR);
- PHP_WEECHAT_CONSTANT(WEECHAT_CONFIG_OPTION_SET_OK_CHANGED);
- PHP_WEECHAT_CONSTANT(WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE);
- PHP_WEECHAT_CONSTANT(WEECHAT_CONFIG_OPTION_SET_ERROR);
- PHP_WEECHAT_CONSTANT(WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND);
- PHP_WEECHAT_CONSTANT(WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET);
- PHP_WEECHAT_CONSTANT(WEECHAT_CONFIG_OPTION_UNSET_OK_RESET);
- PHP_WEECHAT_CONSTANT(WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED);
- PHP_WEECHAT_CONSTANT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
- PHP_WEECHAT_CONSTANT(WEECHAT_HOOK_PROCESS_RUNNING);
- PHP_WEECHAT_CONSTANT(WEECHAT_HOOK_PROCESS_ERROR);
- PHP_WEECHAT_CONSTANT(WEECHAT_HOOK_CONNECT_OK);
- PHP_WEECHAT_CONSTANT(WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND);
- PHP_WEECHAT_CONSTANT(WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND);
- PHP_WEECHAT_CONSTANT(WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED);
- PHP_WEECHAT_CONSTANT(WEECHAT_HOOK_CONNECT_PROXY_ERROR);
- PHP_WEECHAT_CONSTANT(WEECHAT_HOOK_CONNECT_LOCAL_HOSTNAME_ERROR);
- PHP_WEECHAT_CONSTANT(WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR);
- PHP_WEECHAT_CONSTANT(WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR);
- PHP_WEECHAT_CONSTANT(WEECHAT_HOOK_CONNECT_MEMORY_ERROR);
- PHP_WEECHAT_CONSTANT(WEECHAT_HOOK_CONNECT_TIMEOUT);
- PHP_WEECHAT_CONSTANT(WEECHAT_HOOK_CONNECT_SOCKET_ERROR);
- PHP_WEECHAT_CONSTANT(WEECHAT_HOOK_CONNECT_GNUTLS_CB_VERIFY_CERT);
- PHP_WEECHAT_CONSTANT(WEECHAT_HOOK_CONNECT_GNUTLS_CB_SET_CERT);
- #undef PHP_WEECHAT_CONSTANT
-
- /* Register string constants */
- #define PHP_WEECHAT_CONSTANT(NAME) \
- zend_register_string_constant(#NAME, sizeof(#NAME)-1, (NAME), CONST_CS | CONST_PERSISTENT, module_number)
- PHP_WEECHAT_CONSTANT(WEECHAT_PLUGIN_API_VERSION);
- PHP_WEECHAT_CONSTANT(WEECHAT_CONFIG_OPTION_NULL);
- PHP_WEECHAT_CONSTANT(WEECHAT_LIST_POS_SORT);
- PHP_WEECHAT_CONSTANT(WEECHAT_LIST_POS_BEGINNING);
- PHP_WEECHAT_CONSTANT(WEECHAT_LIST_POS_END);
- PHP_WEECHAT_CONSTANT(WEECHAT_HASHTABLE_INTEGER);
- PHP_WEECHAT_CONSTANT(WEECHAT_HASHTABLE_STRING);
- PHP_WEECHAT_CONSTANT(WEECHAT_HASHTABLE_POINTER);
- PHP_WEECHAT_CONSTANT(WEECHAT_HASHTABLE_BUFFER);
- PHP_WEECHAT_CONSTANT(WEECHAT_HASHTABLE_TIME);
- PHP_WEECHAT_CONSTANT(WEECHAT_HOTLIST_LOW);
- PHP_WEECHAT_CONSTANT(WEECHAT_HOTLIST_MESSAGE);
- PHP_WEECHAT_CONSTANT(WEECHAT_HOTLIST_PRIVATE);
- PHP_WEECHAT_CONSTANT(WEECHAT_HOTLIST_HIGHLIGHT);
- PHP_WEECHAT_CONSTANT(WEECHAT_HOOK_SIGNAL_STRING);
- PHP_WEECHAT_CONSTANT(WEECHAT_HOOK_SIGNAL_INT);
- PHP_WEECHAT_CONSTANT(WEECHAT_HOOK_SIGNAL_POINTER);
- #undef PHP_WEECHAT_CONSTANT
+ /* interface constants */
+ for (i = 0; weechat_script_constants[i].name; i++)
+ {
+ if (weechat_script_constants[i].value_string)
+ {
+ zend_register_string_constant(
+ weechat_script_constants[i].name,
+ strlen (weechat_script_constants[i].name),
+ weechat_script_constants[i].value_string,
+ CONST_CS | CONST_PERSISTENT,
+ module_number);
+ }
+ else
+ {
+ zend_register_long_constant(
+ weechat_script_constants[i].name,
+ strlen (weechat_script_constants[i].name),
+ weechat_script_constants[i].value_integer,
+ CONST_CS | CONST_PERSISTENT,
+ module_number);
+ }
+ }
return SUCCESS;
}
diff --git a/src/plugins/plugin-script.c b/src/plugins/plugin-script.c
index 70c60c3ad..40fe368ce 100644
--- a/src/plugins/plugin-script.c
+++ b/src/plugins/plugin-script.c
@@ -36,6 +36,51 @@
#include "plugin-script-config.h"
+struct t_weechat_script_constant weechat_script_constants[] = {
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_RC_OK),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_RC_OK_EAT),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_RC_ERROR),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_CONFIG_READ_OK),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_CONFIG_READ_MEMORY_ERROR),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_CONFIG_READ_FILE_NOT_FOUND),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_CONFIG_WRITE_OK),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_CONFIG_WRITE_ERROR),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_CONFIG_WRITE_MEMORY_ERROR),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_CONFIG_OPTION_SET_OK_CHANGED),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_CONFIG_OPTION_SET_ERROR),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_CONFIG_OPTION_UNSET_OK_RESET),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR),
+ WEECHAT_SCRIPT_CONST_STR(WEECHAT_LIST_POS_SORT),
+ WEECHAT_SCRIPT_CONST_STR(WEECHAT_LIST_POS_BEGINNING),
+ WEECHAT_SCRIPT_CONST_STR(WEECHAT_LIST_POS_END),
+ WEECHAT_SCRIPT_CONST_STR(WEECHAT_HOTLIST_LOW),
+ WEECHAT_SCRIPT_CONST_STR(WEECHAT_HOTLIST_MESSAGE),
+ WEECHAT_SCRIPT_CONST_STR(WEECHAT_HOTLIST_PRIVATE),
+ WEECHAT_SCRIPT_CONST_STR(WEECHAT_HOTLIST_HIGHLIGHT),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_HOOK_PROCESS_RUNNING),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_HOOK_PROCESS_ERROR),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_HOOK_CONNECT_OK),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_HOOK_CONNECT_PROXY_ERROR),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_HOOK_CONNECT_LOCAL_HOSTNAME_ERROR),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_HOOK_CONNECT_MEMORY_ERROR),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_HOOK_CONNECT_TIMEOUT),
+ WEECHAT_SCRIPT_CONST_INT(WEECHAT_HOOK_CONNECT_SOCKET_ERROR),
+ WEECHAT_SCRIPT_CONST_STR(WEECHAT_HOOK_SIGNAL_STRING),
+ WEECHAT_SCRIPT_CONST_STR(WEECHAT_HOOK_SIGNAL_INT),
+ WEECHAT_SCRIPT_CONST_STR(WEECHAT_HOOK_SIGNAL_POINTER),
+ { NULL, 0, NULL },
+};
+
+
/*
* Displays name and version of interpreter used.
*/
diff --git a/src/plugins/plugin-script.h b/src/plugins/plugin-script.h
index 9dda7def7..4ccac05b4 100644
--- a/src/plugins/plugin-script.h
+++ b/src/plugins/plugin-script.h
@@ -20,17 +20,6 @@
#ifndef WEECHAT_PLUGIN_PLUGIN_SCRIPT_H
#define WEECHAT_PLUGIN_PLUGIN_SCRIPT_H
-/* constants which defines return types for weechat_<lang>_exec functions */
-
-enum t_weechat_script_exec_type
-{
- WEECHAT_SCRIPT_EXEC_INT = 0,
- WEECHAT_SCRIPT_EXEC_STRING,
- WEECHAT_SCRIPT_EXEC_POINTER,
- WEECHAT_SCRIPT_EXEC_HASHTABLE,
- WEECHAT_SCRIPT_EXEC_IGNORE,
-};
-
#define WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE 16
#define WEECHAT_SCRIPT_EVAL_NAME "__eval__"
@@ -53,6 +42,29 @@ enum t_weechat_script_exec_type
__function, \
(__current_script) ? __current_script : "-");
+#define WEECHAT_SCRIPT_CONST_INT(__name) \
+ { #__name, __name, NULL }
+#define WEECHAT_SCRIPT_CONST_STR(__name) \
+ { #__name, 0, __name }
+ \
+/* constants which defines return types for weechat_<lang>_exec functions */
+
+enum t_weechat_script_exec_type
+{
+ WEECHAT_SCRIPT_EXEC_INT = 0,
+ WEECHAT_SCRIPT_EXEC_STRING,
+ WEECHAT_SCRIPT_EXEC_POINTER,
+ WEECHAT_SCRIPT_EXEC_HASHTABLE,
+ WEECHAT_SCRIPT_EXEC_IGNORE,
+};
+
+struct t_weechat_script_constant
+{
+ char *name; /* constant name */
+ int value_integer; /* value as integer */
+ char *value_string; /* value as string */
+};
+
struct t_plugin_script
{
/* script variables */
@@ -113,6 +125,8 @@ struct t_plugin_script_data
void (*unload_all) ();
};
+extern struct t_weechat_script_constant weechat_script_constants[];
+
extern void plugin_script_display_interpreter (struct t_weechat_plugin *plugin,
int indent);
extern void plugin_script_init (struct t_weechat_plugin *weechat_plugin,
diff --git a/src/plugins/python/weechat-python.c b/src/plugins/python/weechat-python.c
index 498e286f7..e51a99065 100644
--- a/src/plugins/python/weechat-python.c
+++ b/src/plugins/python/weechat-python.c
@@ -609,6 +609,7 @@ end:
static PyObject *weechat_python_init_module_weechat ()
{
PyObject *weechat_module, *weechat_dict;
+ int i;
weechat_module = PyModule_Create (&moduleDef);
@@ -623,52 +624,23 @@ static PyObject *weechat_python_init_module_weechat ()
/* define some constants */
weechat_dict = PyModule_GetDict (weechat_module);
- PyDict_SetItemString (weechat_dict, "WEECHAT_RC_OK", PyLong_FromLong ((long)WEECHAT_RC_OK));
- PyDict_SetItemString (weechat_dict, "WEECHAT_RC_OK_EAT", PyLong_FromLong ((long)WEECHAT_RC_OK_EAT));
- PyDict_SetItemString (weechat_dict, "WEECHAT_RC_ERROR", PyLong_FromLong ((long)WEECHAT_RC_ERROR));
-
- PyDict_SetItemString (weechat_dict, "WEECHAT_CONFIG_READ_OK", PyLong_FromLong ((long)WEECHAT_CONFIG_READ_OK));
- PyDict_SetItemString (weechat_dict, "WEECHAT_CONFIG_READ_MEMORY_ERROR", PyLong_FromLong ((long)WEECHAT_CONFIG_READ_MEMORY_ERROR));
- PyDict_SetItemString (weechat_dict, "WEECHAT_CONFIG_READ_FILE_NOT_FOUND", PyLong_FromLong ((long)WEECHAT_CONFIG_READ_FILE_NOT_FOUND));
- PyDict_SetItemString (weechat_dict, "WEECHAT_CONFIG_WRITE_OK", PyLong_FromLong ((long)WEECHAT_CONFIG_WRITE_OK));
- PyDict_SetItemString (weechat_dict, "WEECHAT_CONFIG_WRITE_ERROR", PyLong_FromLong ((long)WEECHAT_CONFIG_WRITE_ERROR));
- PyDict_SetItemString (weechat_dict, "WEECHAT_CONFIG_WRITE_MEMORY_ERROR", PyLong_FromLong ((long)WEECHAT_CONFIG_WRITE_MEMORY_ERROR));
- PyDict_SetItemString (weechat_dict, "WEECHAT_CONFIG_OPTION_SET_OK_CHANGED", PyLong_FromLong ((long)WEECHAT_CONFIG_OPTION_SET_OK_CHANGED));
- PyDict_SetItemString (weechat_dict, "WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE", PyLong_FromLong ((long)WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE));
- PyDict_SetItemString (weechat_dict, "WEECHAT_CONFIG_OPTION_SET_ERROR", PyLong_FromLong ((long)WEECHAT_CONFIG_OPTION_SET_ERROR));
- PyDict_SetItemString (weechat_dict, "WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND", PyLong_FromLong ((long)WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND));
- PyDict_SetItemString (weechat_dict, "WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET", PyLong_FromLong ((long)WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET));
- PyDict_SetItemString (weechat_dict, "WEECHAT_CONFIG_OPTION_UNSET_OK_RESET", PyLong_FromLong ((long)WEECHAT_CONFIG_OPTION_UNSET_OK_RESET));
- PyDict_SetItemString (weechat_dict, "WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED", PyLong_FromLong ((long)WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED));
- PyDict_SetItemString (weechat_dict, "WEECHAT_CONFIG_OPTION_UNSET_ERROR", PyLong_FromLong ((long)WEECHAT_CONFIG_OPTION_UNSET_ERROR));
-
- PyDict_SetItemString (weechat_dict, "WEECHAT_LIST_POS_SORT", PyUnicode_FromString (WEECHAT_LIST_POS_SORT));
- PyDict_SetItemString (weechat_dict, "WEECHAT_LIST_POS_BEGINNING", PyUnicode_FromString (WEECHAT_LIST_POS_BEGINNING));
- PyDict_SetItemString (weechat_dict, "WEECHAT_LIST_POS_END", PyUnicode_FromString (WEECHAT_LIST_POS_END));
-
- PyDict_SetItemString (weechat_dict, "WEECHAT_HOTLIST_LOW", PyUnicode_FromString (WEECHAT_HOTLIST_LOW));
- PyDict_SetItemString (weechat_dict, "WEECHAT_HOTLIST_MESSAGE", PyUnicode_FromString (WEECHAT_HOTLIST_MESSAGE));
- PyDict_SetItemString (weechat_dict, "WEECHAT_HOTLIST_PRIVATE", PyUnicode_FromString (WEECHAT_HOTLIST_PRIVATE));
- PyDict_SetItemString (weechat_dict, "WEECHAT_HOTLIST_HIGHLIGHT", PyUnicode_FromString (WEECHAT_HOTLIST_HIGHLIGHT));
-
- PyDict_SetItemString (weechat_dict, "WEECHAT_HOOK_PROCESS_RUNNING", PyLong_FromLong ((long)WEECHAT_HOOK_PROCESS_RUNNING));
- PyDict_SetItemString (weechat_dict, "WEECHAT_HOOK_PROCESS_ERROR", PyLong_FromLong ((long)WEECHAT_HOOK_PROCESS_ERROR));
-
- PyDict_SetItemString (weechat_dict, "WEECHAT_HOOK_CONNECT_OK", PyLong_FromLong ((long)WEECHAT_HOOK_CONNECT_OK));
- PyDict_SetItemString (weechat_dict, "WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND", PyLong_FromLong ((long)WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND));
- PyDict_SetItemString (weechat_dict, "WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND", PyLong_FromLong ((long)WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND));
- PyDict_SetItemString (weechat_dict, "WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED", PyLong_FromLong ((long)WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED));
- PyDict_SetItemString (weechat_dict, "WEECHAT_HOOK_CONNECT_PROXY_ERROR", PyLong_FromLong ((long)WEECHAT_HOOK_CONNECT_PROXY_ERROR));
- PyDict_SetItemString (weechat_dict, "WEECHAT_HOOK_CONNECT_LOCAL_HOSTNAME_ERROR", PyLong_FromLong ((long)WEECHAT_HOOK_CONNECT_LOCAL_HOSTNAME_ERROR));
- PyDict_SetItemString (weechat_dict, "WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR", PyLong_FromLong ((long)WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR));
- PyDict_SetItemString (weechat_dict, "WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR", PyLong_FromLong ((long)WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR));
- PyDict_SetItemString (weechat_dict, "WEECHAT_HOOK_CONNECT_MEMORY_ERROR", PyLong_FromLong ((long)WEECHAT_HOOK_CONNECT_MEMORY_ERROR));
- PyDict_SetItemString (weechat_dict, "WEECHAT_HOOK_CONNECT_TIMEOUT", PyLong_FromLong ((long)WEECHAT_HOOK_CONNECT_TIMEOUT));
- PyDict_SetItemString (weechat_dict, "WEECHAT_HOOK_CONNECT_SOCKET_ERROR", PyLong_FromLong ((long)WEECHAT_HOOK_CONNECT_SOCKET_ERROR));
-
- PyDict_SetItemString (weechat_dict, "WEECHAT_HOOK_SIGNAL_STRING", PyUnicode_FromString (WEECHAT_HOOK_SIGNAL_STRING));
- PyDict_SetItemString (weechat_dict, "WEECHAT_HOOK_SIGNAL_INT", PyUnicode_FromString (WEECHAT_HOOK_SIGNAL_INT));
- PyDict_SetItemString (weechat_dict, "WEECHAT_HOOK_SIGNAL_POINTER", PyUnicode_FromString (WEECHAT_HOOK_SIGNAL_POINTER));
+ for (i = 0; weechat_script_constants[i].name; i++)
+ {
+ if (weechat_script_constants[i].value_string)
+ {
+ PyDict_SetItemString (
+ weechat_dict,
+ weechat_script_constants[i].name,
+ PyUnicode_FromString (weechat_script_constants[i].value_string));
+ }
+ else
+ {
+ PyDict_SetItemString (
+ weechat_dict,
+ weechat_script_constants[i].name,
+ PyLong_FromLong ((long)weechat_script_constants[i].value_integer));
+ }
+ }
return weechat_module;
}
diff --git a/src/plugins/ruby/weechat-ruby-api.c b/src/plugins/ruby/weechat-ruby-api.c
index 8d840641d..46bdcf950 100644
--- a/src/plugins/ruby/weechat-ruby-api.c
+++ b/src/plugins/ruby/weechat-ruby-api.c
@@ -6926,53 +6926,20 @@ weechat_ruby_api_upgrade_close (VALUE class, VALUE upgrade_file)
void
weechat_ruby_api_init (VALUE ruby_mWeechat)
{
- rb_define_const (ruby_mWeechat, "WEECHAT_RC_OK", INT2NUM(WEECHAT_RC_OK));
- rb_define_const (ruby_mWeechat, "WEECHAT_RC_OK_EAT", INT2NUM(WEECHAT_RC_OK_EAT));
- rb_define_const (ruby_mWeechat, "WEECHAT_RC_ERROR", INT2NUM(WEECHAT_RC_ERROR));
-
- rb_define_const (ruby_mWeechat, "WEECHAT_CONFIG_READ_OK", INT2NUM(WEECHAT_CONFIG_READ_OK));
- rb_define_const (ruby_mWeechat, "WEECHAT_CONFIG_READ_MEMORY_ERROR", INT2NUM(WEECHAT_CONFIG_READ_MEMORY_ERROR));
- rb_define_const (ruby_mWeechat, "WEECHAT_CONFIG_READ_FILE_NOT_FOUND", INT2NUM(WEECHAT_CONFIG_READ_FILE_NOT_FOUND));
- rb_define_const (ruby_mWeechat, "WEECHAT_CONFIG_WRITE_OK", INT2NUM(WEECHAT_CONFIG_WRITE_OK));
- rb_define_const (ruby_mWeechat, "WEECHAT_CONFIG_WRITE_ERROR", INT2NUM(WEECHAT_CONFIG_WRITE_ERROR));
- rb_define_const (ruby_mWeechat, "WEECHAT_CONFIG_WRITE_MEMORY_ERROR", INT2NUM(WEECHAT_CONFIG_WRITE_MEMORY_ERROR));
- rb_define_const (ruby_mWeechat, "WEECHAT_CONFIG_OPTION_SET_OK_CHANGED", INT2NUM(WEECHAT_CONFIG_OPTION_SET_OK_CHANGED));
- rb_define_const (ruby_mWeechat, "WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE", INT2NUM(WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE));
- rb_define_const (ruby_mWeechat, "WEECHAT_CONFIG_OPTION_SET_ERROR", INT2NUM(WEECHAT_CONFIG_OPTION_SET_ERROR));
- rb_define_const (ruby_mWeechat, "WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND", INT2NUM(WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND));
- rb_define_const (ruby_mWeechat, "WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET", INT2NUM(WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET));
- rb_define_const (ruby_mWeechat, "WEECHAT_CONFIG_OPTION_UNSET_OK_RESET", INT2NUM(WEECHAT_CONFIG_OPTION_UNSET_OK_RESET));
- rb_define_const (ruby_mWeechat, "WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED", INT2NUM(WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED));
- rb_define_const (ruby_mWeechat, "WEECHAT_CONFIG_OPTION_UNSET_ERROR", INT2NUM(WEECHAT_CONFIG_OPTION_UNSET_ERROR));
-
- rb_define_const (ruby_mWeechat, "WEECHAT_LIST_POS_SORT", rb_str_new2 (WEECHAT_LIST_POS_SORT));
- rb_define_const (ruby_mWeechat, "WEECHAT_LIST_POS_BEGINNING", rb_str_new2 (WEECHAT_LIST_POS_BEGINNING));
- rb_define_const (ruby_mWeechat, "WEECHAT_LIST_POS_END", rb_str_new2 (WEECHAT_LIST_POS_END));
-
- rb_define_const (ruby_mWeechat, "WEECHAT_HOTLIST_LOW", rb_str_new2 (WEECHAT_HOTLIST_LOW));
- rb_define_const (ruby_mWeechat, "WEECHAT_HOTLIST_MESSAGE", rb_str_new2 (WEECHAT_HOTLIST_MESSAGE));
- rb_define_const (ruby_mWeechat, "WEECHAT_HOTLIST_PRIVATE", rb_str_new2 (WEECHAT_HOTLIST_PRIVATE));
- rb_define_const (ruby_mWeechat, "WEECHAT_HOTLIST_HIGHLIGHT", rb_str_new2 (WEECHAT_HOTLIST_HIGHLIGHT));
-
- rb_define_const (ruby_mWeechat, "WEECHAT_HOOK_PROCESS_RUNNING", INT2NUM(WEECHAT_HOOK_PROCESS_RUNNING));
- rb_define_const (ruby_mWeechat, "WEECHAT_HOOK_PROCESS_ERROR", INT2NUM(WEECHAT_HOOK_PROCESS_ERROR));
-
- rb_define_const (ruby_mWeechat, "WEECHAT_HOOK_CONNECT_OK", INT2NUM(WEECHAT_HOOK_CONNECT_OK));
- rb_define_const (ruby_mWeechat, "WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND", INT2NUM(WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND));
- rb_define_const (ruby_mWeechat, "WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND", INT2NUM(WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND));
- rb_define_const (ruby_mWeechat, "WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED", INT2NUM(WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED));
- rb_define_const (ruby_mWeechat, "WEECHAT_HOOK_CONNECT_PROXY_ERROR", INT2NUM(WEECHAT_HOOK_CONNECT_PROXY_ERROR));
- rb_define_const (ruby_mWeechat, "WEECHAT_HOOK_CONNECT_LOCAL_HOSTNAME_ERROR", INT2NUM(WEECHAT_HOOK_CONNECT_LOCAL_HOSTNAME_ERROR));
- rb_define_const (ruby_mWeechat, "WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR", INT2NUM(WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR));
- rb_define_const (ruby_mWeechat, "WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR", INT2NUM(WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR));
- rb_define_const (ruby_mWeechat, "WEECHAT_HOOK_CONNECT_MEMORY_ERROR", INT2NUM(WEECHAT_HOOK_CONNECT_MEMORY_ERROR));
- rb_define_const (ruby_mWeechat, "WEECHAT_HOOK_CONNECT_TIMEOUT", INT2NUM(WEECHAT_HOOK_CONNECT_TIMEOUT));
- rb_define_const (ruby_mWeechat, "WEECHAT_HOOK_CONNECT_SOCKET_ERROR", INT2NUM(WEECHAT_HOOK_CONNECT_SOCKET_ERROR));
-
- rb_define_const (ruby_mWeechat, "WEECHAT_HOOK_SIGNAL_STRING", rb_str_new2 (WEECHAT_HOOK_SIGNAL_STRING));
- rb_define_const (ruby_mWeechat, "WEECHAT_HOOK_SIGNAL_INT", rb_str_new2 (WEECHAT_HOOK_SIGNAL_INT));
- rb_define_const (ruby_mWeechat, "WEECHAT_HOOK_SIGNAL_POINTER", rb_str_new2 (WEECHAT_HOOK_SIGNAL_POINTER));
+ int i;
+ /* interface constants */
+ for (i = 0; weechat_script_constants[i].name; i++)
+ {
+ rb_define_const (
+ ruby_mWeechat,
+ weechat_script_constants[i].name,
+ (weechat_script_constants[i].value_string) ?
+ rb_str_new2 (weechat_script_constants[i].value_string) :
+ INT2NUM(weechat_script_constants[i].value_integer));
+ }
+
+ /* interface functions */
API_DEF_FUNC(register, 7);
API_DEF_FUNC(plugin_get_name, 1);
API_DEF_FUNC(charset_set, 1);
diff --git a/src/plugins/tcl/weechat-tcl-api.c b/src/plugins/tcl/weechat-tcl-api.c
index eadb740f3..5a040c3f6 100644
--- a/src/plugins/tcl/weechat-tcl-api.c
+++ b/src/plugins/tcl/weechat-tcl-api.c
@@ -5650,6 +5650,9 @@ API_FUNC(upgrade_close)
void weechat_tcl_api_init (Tcl_Interp *interp)
{
+ char str_const[256];
+ int i;
+
/* standard initializer */
Tcl_Init (interp);
@@ -5658,55 +5661,25 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
/* interface constants */
/* set variables, TODO: make them unmodifiable (thru Tcl_TraceVar) ? */
/* NOTE: it is not good for performance to convert "defines" to Tcl_Obj */
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_RC_OK", NULL, Tcl_NewIntObj (WEECHAT_RC_OK), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_RC_OK_EAT", NULL, Tcl_NewIntObj (WEECHAT_RC_OK_EAT), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_RC_ERROR", NULL, Tcl_NewIntObj (WEECHAT_RC_ERROR), 0);
+ for (i = 0; weechat_script_constants[i].name; i++)
+ {
+ snprintf (str_const, sizeof (str_const),
+ "::weechat::%s", weechat_script_constants[i].name);
+ if (weechat_script_constants[i].value_string)
+ {
+ Tcl_SetVar (interp, str_const,
+ weechat_script_constants[i].value_string, 0);
+ }
+ else
+ {
+ Tcl_SetVar2Ex (interp, str_const, NULL,
+ Tcl_NewIntObj (weechat_script_constants[i].value_integer), 0);
+ }
+ }
+ /* add specific constant for `NULL` in tcl */
Tcl_SetVar (interp, "::weechat::WEECHAT_NULL", WEECHAT_NULL_STRING, 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_CONFIG_READ_OK", NULL, Tcl_NewIntObj (WEECHAT_CONFIG_READ_OK), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_CONFIG_READ_MEMORY_ERROR", NULL, Tcl_NewIntObj (WEECHAT_CONFIG_READ_MEMORY_ERROR), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_CONFIG_READ_FILE_NOT_FOUND", NULL, Tcl_NewIntObj (WEECHAT_CONFIG_READ_FILE_NOT_FOUND), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_CONFIG_WRITE_OK", NULL, Tcl_NewIntObj (WEECHAT_CONFIG_WRITE_OK), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_CONFIG_WRITE_ERROR", NULL, Tcl_NewIntObj (WEECHAT_CONFIG_WRITE_ERROR), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_CONFIG_WRITE_MEMORY_ERROR", NULL, Tcl_NewIntObj (WEECHAT_CONFIG_WRITE_MEMORY_ERROR), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_CONFIG_OPTION_SET_OK_CHANGED", NULL, Tcl_NewIntObj (WEECHAT_CONFIG_OPTION_SET_OK_CHANGED), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE", NULL, Tcl_NewIntObj (WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_CONFIG_OPTION_SET_ERROR", NULL, Tcl_NewIntObj (WEECHAT_CONFIG_OPTION_SET_ERROR), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND", NULL, Tcl_NewIntObj (WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET", NULL, Tcl_NewIntObj (WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_CONFIG_OPTION_UNSET_OK_RESET", NULL, Tcl_NewIntObj (WEECHAT_CONFIG_OPTION_UNSET_OK_RESET), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED", NULL, Tcl_NewIntObj (WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_CONFIG_OPTION_UNSET_ERROR", NULL, Tcl_NewIntObj (WEECHAT_CONFIG_OPTION_UNSET_ERROR), 0);
-
- Tcl_SetVar (interp, "::weechat::WEECHAT_LIST_POS_SORT", WEECHAT_LIST_POS_SORT, 0);
- Tcl_SetVar (interp, "::weechat::WEECHAT_LIST_POS_BEGINNING", WEECHAT_LIST_POS_BEGINNING, 0);
- Tcl_SetVar (interp, "::weechat::WEECHAT_LIST_POS_END", WEECHAT_LIST_POS_END, 0);
-
- Tcl_SetVar (interp, "::weechat::WEECHAT_HOTLIST_LOW", WEECHAT_HOTLIST_LOW, 0);
- Tcl_SetVar (interp, "::weechat::WEECHAT_HOTLIST_MESSAGE", WEECHAT_HOTLIST_MESSAGE, 0);
- Tcl_SetVar (interp, "::weechat::WEECHAT_HOTLIST_PRIVATE", WEECHAT_HOTLIST_PRIVATE, 0);
- Tcl_SetVar (interp, "::weechat::WEECHAT_HOTLIST_HIGHLIGHT", WEECHAT_HOTLIST_HIGHLIGHT, 0);
-
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_HOOK_PROCESS_RUNNING", NULL, Tcl_NewIntObj (WEECHAT_HOOK_PROCESS_RUNNING), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_HOOK_PROCESS_ERROR", NULL, Tcl_NewIntObj (WEECHAT_HOOK_PROCESS_ERROR), 0);
-
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_HOOK_CONNECT_OK", NULL, Tcl_NewIntObj (WEECHAT_HOOK_CONNECT_OK), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND", NULL, Tcl_NewIntObj (WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND", NULL, Tcl_NewIntObj (WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED", NULL, Tcl_NewIntObj (WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_HOOK_CONNECT_PROXY_ERROR", NULL, Tcl_NewIntObj (WEECHAT_HOOK_CONNECT_PROXY_ERROR), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_HOOK_CONNECT_LOCAL_HOSTNAME_ERROR", NULL, Tcl_NewIntObj (WEECHAT_HOOK_CONNECT_LOCAL_HOSTNAME_ERROR), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR", NULL, Tcl_NewIntObj (WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR", NULL, Tcl_NewIntObj (WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_HOOK_CONNECT_MEMORY_ERROR", NULL, Tcl_NewIntObj (WEECHAT_HOOK_CONNECT_MEMORY_ERROR), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_HOOK_CONNECT_TIMEOUT", NULL, Tcl_NewIntObj (WEECHAT_HOOK_CONNECT_TIMEOUT), 0);
- Tcl_SetVar2Ex (interp, "::weechat::WEECHAT_HOOK_CONNECT_SOCKET_ERROR", NULL, Tcl_NewIntObj (WEECHAT_HOOK_CONNECT_SOCKET_ERROR), 0);
-
- Tcl_SetVar (interp, "::weechat::WEECHAT_HOOK_SIGNAL_STRING", WEECHAT_HOOK_SIGNAL_STRING, 0);
- Tcl_SetVar (interp, "::weechat::WEECHAT_HOOK_SIGNAL_INT", WEECHAT_HOOK_SIGNAL_INT, 0);
- Tcl_SetVar (interp, "::weechat::WEECHAT_HOOK_SIGNAL_POINTER", WEECHAT_HOOK_SIGNAL_POINTER, 0);
-
/* interface functions */
API_DEF_FUNC(register);
API_DEF_FUNC(plugin_get_name);