本文整理汇总了C++中rb_warn函数的典型用法代码示例。如果您正苦于以下问题:C++ rb_warn函数的具体用法?C++ rb_warn怎么用?C++ rb_warn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rb_warn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: register_init_ext
static int
register_init_ext(st_data_t *key, st_data_t *value, st_data_t init, int existing)
{
const char *name = (char *)*key;
if (existing) {
/* already registered */
rb_warn("%s is already registered", name);
}
else {
*value = (st_data_t)MEMO_NEW(0, 0, init);
*key = (st_data_t)ruby_strdup(name);
}
return ST_CONTINUE;
}
示例2: rg_display_options
static VALUE
rg_display_options(int argc, VALUE *argv, VALUE self)
{
VALUE flags;
rb_scan_args(argc, argv, "01", &flags);
if NIL_P(flags){
#if GTK_CHECK_VERSION(2,4,0)
return GFLAGS2RVAL(gtk_calendar_get_display_options(_SELF(self)),
GTK_TYPE_CALENDAR_DISPLAY_OPTIONS);
#else
rb_warn("Gtk::Calendar#display_options has supported since GTK+-2.4.");
#endif
} else {
示例3: proc_new
static VALUE
proc_new(VALUE klass, int is_lambda)
{
VALUE procval = Qnil;
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *cfp = th->cfp;
rb_block_t *block;
if ((GC_GUARDED_PTR_REF(cfp->lfp[0])) != 0 &&
!RUBY_VM_CLASS_SPECIAL_P(cfp->lfp[0])) {
block = GC_GUARDED_PTR_REF(cfp->lfp[0]);
cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
}
else {
cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
if ((GC_GUARDED_PTR_REF(cfp->lfp[0])) != 0 &&
!RUBY_VM_CLASS_SPECIAL_P(cfp->lfp[0])) {
block = GC_GUARDED_PTR_REF(cfp->lfp[0]);
/* TODO: check more (cfp limit, called via cfunc, etc) */
while (cfp->dfp != block->dfp) {
cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
}
if (is_lambda) {
rb_warn("tried to create Proc object without a block");
}
}
else {
rb_raise(rb_eArgError,
"tried to create Proc object without a block");
}
}
if (block->proc) {
return block->proc;
}
procval = vm_make_proc(th, cfp, block);
if (is_lambda) {
rb_proc_t *proc;
GetProcPtr(procval, proc);
proc->is_lambda = Qtrue;
}
return procval;
}
示例4: rclosure_marshal_do
static VALUE
rclosure_marshal_do(VALUE arg_)
{
struct marshal_arg *arg;
GRClosure* rclosure;
GValue* return_value;
guint n_param_values;
const GValue* param_values;
/* gpointer invocation_hint;*/
/* gpointer marshal_data; */
VALUE ret = Qnil;
VALUE args;
GValToRValSignalFunc func;
arg = (struct marshal_arg*)arg_;
rclosure = (GRClosure *)(arg->closure);
return_value = arg->return_value;
n_param_values = arg->n_param_values;
param_values = arg->param_values;
/* invocation_hint = arg->invocation_hint; */
/* marshal_data = arg->marshal_data; */
if (rclosure->g2r_func){
func = (GValToRValSignalFunc)rclosure->g2r_func;
} else {
func = (GValToRValSignalFunc)rclosure_default_g2r_func;
}
args = (*func)(n_param_values, param_values);
if (rclosure_alive_p(rclosure)) {
VALUE callback, extra_args;
callback = rclosure->callback;
extra_args = rclosure->extra_args;
if (!NIL_P(extra_args)) {
args = rb_ary_concat(args, extra_args);
}
ret = rb_apply(callback, id_call, args);
} else {
rb_warn("GRClosure invoking callback: already destroyed: %s",
rclosure->tag[0] ? rclosure->tag : "(anonymous)");
}
if (return_value && G_VALUE_TYPE(return_value))
rbgobj_rvalue_to_gvalue(ret, return_value);
return Qnil;
}
示例5: ropenldap_check_link
/* Check to be sure the library that's dynamically-linked is the same
* one it was compiled against. */
static void
ropenldap_check_link()
{
LDAPAPIInfo api;
api.ldapai_info_version = LDAP_API_INFO_VERSION;
if ( ldap_get_option(NULL, LDAP_OPT_API_INFO, &api) != LDAP_OPT_SUCCESS ) {
rb_warn( "ldap_get_option(API_INFO) failed" );
return;
}
if ( api.ldapai_info_version != LDAP_API_INFO_VERSION ) {
rb_warn( "LDAP APIInfo version mismatch: library %d, header %d",
api.ldapai_info_version, LDAP_API_INFO_VERSION );
}
if ( api.ldapai_api_version != LDAP_API_VERSION ) {
rb_warn( "LDAP API version mismatch: library %d, header %d",
api.ldapai_api_version, LDAP_API_VERSION );
}
if ( strcmp(api.ldapai_vendor_name, LDAP_VENDOR_NAME ) != 0 ) {
rb_warn( "LDAP vendor name mismatch: library %s, header %s\n",
api.ldapai_vendor_name, LDAP_VENDOR_NAME );
}
if( api.ldapai_vendor_version != LDAP_VENDOR_VERSION ) {
rb_warn( "LDAP vendor version mismatch: library %d, header %d\n",
api.ldapai_vendor_version, LDAP_VENDOR_VERSION );
}
ropenldap_log( "info", "LDAP library: %s %d",
LDAP_VENDOR_NAME, LDAP_VENDOR_VERSION );
ldap_memfree( api.ldapai_vendor_name );
ber_memvfree( (void **)api.ldapai_extensions );
}
示例6: rb_undef
void
rb_undef(VALUE klass, ID id)
{
VALUE origin;
NODE *body;
if (rb_vm_cbase() == rb_cObject && klass == rb_cObject) {
rb_secure(4);
}
if (rb_safe_level() >= 4 && !OBJ_TAINTED(klass)) {
rb_raise(rb_eSecurityError, "Insecure: can't undef `%s'",
rb_id2name(id));
}
rb_frozen_class_p(klass);
if (id == object_id || id == __send__ || id == idInitialize) {
rb_warn("undefining `%s' may cause serious problem", rb_id2name(id));
}
body = search_method(klass, id, &origin);
if (!body || !body->nd_body) {
const char *s0 = " class";
VALUE c = klass;
if (FL_TEST(c, FL_SINGLETON)) {
VALUE obj = rb_iv_get(klass, "__attached__");
switch (TYPE(obj)) {
case T_MODULE:
case T_CLASS:
c = obj;
s0 = "";
}
}
else if (TYPE(c) == T_MODULE) {
s0 = " module";
}
rb_name_error(id, "undefined method `%s' for%s `%s'",
rb_id2name(id), s0, rb_class2name(c));
}
rb_add_method(klass, id, 0, NOEX_PUBLIC);
if (FL_TEST(klass, FL_SINGLETON)) {
rb_funcall(rb_iv_get(klass, "__attached__"),
singleton_undefined, 1, ID2SYM(id));
}
else {
rb_funcall(klass, undefined, 1, ID2SYM(id));
}
}
示例7: rb_set_ssl_mode_option
static VALUE rb_set_ssl_mode_option(VALUE self, VALUE setting) {
unsigned long version = mysql_get_client_version();
if (version < 50703) {
rb_warn( "Your mysql client library does not support setting ssl_mode; full support comes with 5.7.11." );
return Qnil;
}
#ifdef HAVE_CONST_MYSQL_OPT_SSL_ENFORCE
GET_CLIENT(self);
int val = NUM2INT( setting );
if (version >= 50703 && version < 50711) {
if (val == SSL_MODE_DISABLED || val == SSL_MODE_REQUIRED) {
bool b = ( val == SSL_MODE_REQUIRED );
int result = mysql_options( wrapper->client, MYSQL_OPT_SSL_ENFORCE, &b );
return INT2NUM(result);
} else {
rb_warn( "MySQL client libraries between 5.7.3 and 5.7.10 only support SSL_MODE_DISABLED and SSL_MODE_REQUIRED" );
return Qnil;
}
}
#endif
#ifdef FULL_SSL_MODE_SUPPORT
GET_CLIENT(self);
int val = NUM2INT( setting );
if (val != SSL_MODE_DISABLED && val != SSL_MODE_PREFERRED && val != SSL_MODE_REQUIRED && val != SSL_MODE_VERIFY_CA && val != SSL_MODE_VERIFY_IDENTITY) {
rb_raise(cMysql2Error, "ssl_mode= takes DISABLED, PREFERRED, REQUIRED, VERIFY_CA, VERIFY_IDENTITY, you passed: %d", val );
}
int result = mysql_options( wrapper->client, MYSQL_OPT_SSL_MODE, &val );
return INT2NUM(result);
#endif
#ifdef NO_SSL_MODE_SUPPORT
return Qnil;
#endif
}
示例8: set_reconnect
static VALUE set_reconnect(VALUE self, VALUE value) {
my_bool reconnect;
GET_CLIENT(self);
if(!NIL_P(value)) {
reconnect = value == Qfalse ? 0 : 1;
/* set default reconnect behavior */
if (mysql_options(wrapper->client, MYSQL_OPT_RECONNECT, &reconnect)) {
/* TODO: warning - unable to set reconnect behavior */
rb_warn("%s\n", mysql_error(wrapper->client));
}
}
return value;
}
示例9: Init_lzoruby
void Init_lzoruby() {
if (lzo_init() != LZO_E_OK) {
rb_warn("internal error - lzo_init() failed !!!");
return;
}
LZO = rb_define_module("LZO");
LZO_Error = rb_define_class_under(LZO, "Error", rb_eStandardError);
rb_define_const(LZO, "VERSION", rb_str_new2(VERSION));
rb_define_const(LZO, "LZO_VERSION", rb_str_new2(lzo_version_string()));
rb_define_module_function(LZO, "compress", lzoruby_compress, -1);
rb_define_module_function(LZO, "decompress", lzoruby_decompress, 1);
rb_define_module_function(LZO, "adler32", lzoruby_adler32, 2);
}
示例10: rxml_html_parser_initialize
/* call-seq:
* XML::HTMLParser.initialize -> parser
*
* Initializes a new parser instance with no pre-determined source.
*/
static VALUE rxml_html_parser_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE context = Qnil;
rb_scan_args(argc, argv, "01", &context);
if (context == Qnil)
{
rb_warn("Passing no parameters to XML::HTMLParser.new is deprecated. Pass an instance of XML::Parser::Context instead.");
context = rb_class_new_instance(0, NULL, cXMLParserContext);
}
rb_ivar_set(self, CONTEXT_ATTR, context);
return self;
}
示例11: rg_m_text_property_to_utf8_list
static VALUE
rg_m_text_property_to_utf8_list(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
{
gint num, i;
gchar** list;
VALUE ret = Qnil;
if (argc == 3) {
VALUE encoding, format, text;
rb_scan_args(argc, argv, "30", &encoding, &format, &text);
StringValue(text);
num = gdk_text_property_to_utf8_list(RVAL2ATOM(encoding),
NUM2INT(format),
(const guchar*)RVAL2CSTR(text),
RSTRING_LEN(text), &list);
} else {
#if GTK_CHECK_VERSION(2,2,0)
VALUE display, encoding, format, text;
rb_scan_args(argc, argv, "40", &display, &encoding, &format, &text);
StringValue(text);
num = gdk_text_property_to_utf8_list_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
RVAL2ATOM(encoding),
NUM2INT(format),
(const guchar*)RVAL2CSTR(text),
RSTRING_LEN(text),
&list);
#else
VALUE encoding, format, text;
rb_scan_args(argc, argv, "30", &encoding, &format, &text);
StringValue(text);
rb_warn("Gdk::Property.text_property_to_utf8_list: Not supported arguments in GTK+-2.0.x.");
num = gdk_text_property_to_utf8_list(RVAL2ATOM(encoding),
NUM2INT(format),
(const guchar*)RVAL2CSTR(text),
RSTRING_LEN(text), &list);
#endif
}
ret = rb_ary_new2(num);
for (i =0; i < num; i++) {
rb_ary_push(ret, CSTR2RVAL(list[i]));
}
g_strfreev(list);
return ret;
}
示例12: set_connect_timeout
static VALUE set_connect_timeout(VALUE self, VALUE value) {
unsigned int connect_timeout = 0;
GET_CLIENT(self);
if(!NIL_P(value)) {
connect_timeout = NUM2INT(value);
if(0 == connect_timeout) return value;
/* set default connection timeout behavior */
if (mysql_options(wrapper->client, MYSQL_OPT_CONNECT_TIMEOUT, &connect_timeout)) {
/* TODO: warning - unable to set connection timeout */
rb_warn("%s\n", mysql_error(wrapper->client));
}
}
return value;
}
示例13: rxml_node_line_num
/*
* call-seq:
* node.line_num -> num
*
* Obtain the line number (in the XML document) that this
* node was read from. If +default_line_numbers+ is set
* false (the default), this method returns zero.
*/
static VALUE rxml_node_line_num(VALUE self)
{
xmlNodePtr xnode;
long line_num;
xnode = rxml_get_xnode(self);
if (!xmlLineNumbersDefaultValue)
rb_warn(
"Line numbers were not retained: use XML::Parser::default_line_numbers=true");
line_num = xmlGetLineNo(xnode);
if (line_num == -1)
return (Qnil);
else
return (INT2NUM((long) line_num));
}
示例14: rxml_document_compression_q
/*
* call-seq:
* document.compression? -> (true|false)
*
* Determine whether this document is compressed.
*/
static VALUE rxml_document_compression_q(VALUE self)
{
#ifdef HAVE_ZLIB_H
xmlDocPtr xdoc;
Data_Get_Struct(self, xmlDoc, xdoc);
if (xdoc->compression != -1)
return(Qtrue);
else
return(Qfalse);
#else
rb_warn("libxml compiled without zlib support");
return (Qfalse);
#endif
}
示例15: Looksee_internal_undefined_instance_methods
/*
* Return the list of undefined instance methods (as Symbols) of the
* given internal class.
*/
VALUE Looksee_internal_undefined_instance_methods(VALUE self, VALUE klass) {
#if RUBY_VERSION >= 230
static int warned = 0;
if (!warned) {
rb_warn("Looksee cannot display undef'd methods on MRI 2.3");
warned = 1;
}
return rb_ary_new();
#else
VALUE names = rb_ary_new();
if (RCLASS_ORIGIN(klass) != klass)
klass = RCLASS_ORIGIN(klass);
Looksee_method_table_foreach(RCLASS_M_TBL(klass), add_method_if_undefined, (st_data_t)&names);
return names;
#endif
}