本文整理汇总了C++中rb_warn函数的典型用法代码示例。如果您正苦于以下问题:C++ rb_warn函数的具体用法?C++ rb_warn怎么用?C++ rb_warn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rb_warn函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:tenderlove,项目名称:ruby,代码行数:14,代码来源:load.c
示例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 {
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:14,代码来源:rbgtkcalendar.c
示例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;
}
开发者ID:Sophrinix,项目名称:iphone-macruby,代码行数:50,代码来源:proc.c
示例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;
}
开发者ID:Mazwak,项目名称:ruby-gnome2,代码行数:50,代码来源:rbgobj_closure.c
示例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 );
}
开发者ID:Pupsoid,项目名称:ruby-openldap,代码行数:39,代码来源:openldap.c
示例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));
}
}
开发者ID:genki,项目名称:ruby,代码行数:49,代码来源:vm_method.c
示例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
}
开发者ID:reverbnation,项目名称:mysql2,代码行数:36,代码来源:client.c
示例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;
}
开发者ID:leadtune,项目名称:mysql2,代码行数:15,代码来源:client.c
示例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);
}
开发者ID:expectedbehavior,项目名称:lzo-ruby,代码行数:15,代码来源:lzoruby.c
示例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;
}
开发者ID:astro,项目名称:libxml-ruby,代码行数:20,代码来源:ruby_xml_html_parser.c
示例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;
}
开发者ID:tec,项目名称:ruby-gnome2,代码行数:48,代码来源:rbgdkproperty.c
示例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;
}
开发者ID:0xCCD,项目名称:mysql2,代码行数:16,代码来源:client.c
示例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));
}
开发者ID:nikitug,项目名称:libxml-ruby,代码行数:24,代码来源:ruby_xml_node.c
示例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
}
开发者ID:codymarcel,项目名称:grievebot,代码行数:22,代码来源:ruby_xml_document.c
示例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
}
开发者ID:mathieujobin,项目名称:looksee,代码行数:20,代码来源:mri.c
示例16: return_tsk_fs_type_list
VALUE return_tsk_fs_type_list(int argc, VALUE *args, VALUE self) {
VALUE io; uint fd;
rb_scan_args(argc, args, "01", &io);
if (! rb_obj_is_kind_of(io, rb_cIO) ) {
rb_warn("Method did not recieve IO object, using STDOUT");
fd = 1;
} else {
fd = FIX2LONG(rb_funcall(io, rb_intern("fileno"), 0));
}
FILE * hFile = fdopen((int)fd, "w");
tsk_fs_type_print(hFile);
fflush(hFile); // clear file buffer, completing write
return self;
}
开发者ID:Lorrie,项目名称:RubyTSK,代码行数:16,代码来源:file_system.c
示例17: make_struct
static VALUE
make_struct(VALUE name, VALUE members, VALUE klass)
{
VALUE nstr;
ID id;
long i;
OBJ_FREEZE(members);
if (NIL_P(name)) {
nstr = rb_class_new(klass);
rb_make_metaclass(nstr, RBASIC(klass)->klass);
rb_class_inherited(klass, nstr);
}
else {
char *cname = StringValuePtr(name);
id = rb_intern(cname);
if (!rb_is_const_id(id)) {
rb_name_error(id, "identifier %s needs to be constant", cname);
}
if (rb_const_defined_at(klass, id)) {
rb_warn("redefining constant Struct::%s", cname);
rb_mod_remove_const(klass, ID2SYM(id));
}
nstr = rb_define_class_under(klass, rb_id2name(id), klass);
}
rb_iv_set(nstr, "__size__", LONG2NUM(RARRAY(members)->len));
rb_iv_set(nstr, "__members__", members);
rb_define_alloc_func(nstr, struct_alloc);
rb_define_singleton_method(nstr, "new", rb_class_new_instance, -1);
rb_define_singleton_method(nstr, "[]", rb_class_new_instance, -1);
rb_define_singleton_method(nstr, "members", rb_struct_s_members_m, 0);
for (i=0; i< RARRAY(members)->len; i++) {
ID id = SYM2ID(RARRAY(members)->ptr[i]);
if (rb_is_local_id(id) || rb_is_const_id(id)) {
if (i<10) {
rb_define_method_id(nstr, id, ref_func[i], 0);
}
else {
rb_define_method_id(nstr, id, rb_struct_ref, 0);
}
rb_define_method_id(nstr, rb_id_attrset(id), rb_struct_set, 1);
}
}
return nstr;
}
开发者ID:asimoov,项目名称:emscripted-ruby,代码行数:47,代码来源:struct.c
示例18: rxml_debug_entities_set
/*
* call-seq:
* XML.debug_entities = true|false
*
* Enable or disable included-entity debugging.
* (Requires Libxml to be compiled with debugging support)
*/
static VALUE rxml_debug_entities_set(VALUE klass, VALUE value)
{
#ifdef LIBXML_DEBUG_ENABLED
if (value == Qfalse)
{
xmlParserDebugEntities = 0;
return(Qfalse);
}
else
{
xmlParserDebugEntities = 1;
return(Qtrue);
}
#else
rb_warn("libxml was compiled with debugging turned off");
#endif
}
开发者ID:xml4r,项目名称:libxml-ruby,代码行数:24,代码来源:ruby_xml.c
示例19: ropenldap_check_api_version
static void
ropenldap_check_api_version()
{
LDAPAPIInfo info;
info.ldapai_info_version = LDAP_API_INFO_VERSION;
if ( ldap_get_option(NULL, LDAP_OPT_API_INFO, &info) != LDAP_OPT_SUCCESS )
rb_raise( ropenldap_eOpenLDAPError, "ldap_get_option(API_INFO) failed." );
if ( info.ldapai_api_version != LDAP_API_VERSION ) {
rb_warn( "Extension was compiled for API version %d,\nbut your library is version %d.",
LDAP_API_VERSION, info.ldapai_api_version );
}
ldap_memfree( info.ldapai_vendor_name );
ber_memvfree( (void **)info.ldapai_extensions );
}
开发者ID:Pupsoid,项目名称:ruby-openldap,代码行数:17,代码来源:openldap.c
示例20: rb_undef
void
rb_undef(VALUE klass, ID id)
{
rb_method_entry_t *me;
if (NIL_P(klass)) {
rb_raise(rb_eTypeError, "no class to undef method");
}
if (rb_vm_cbase() == rb_cObject && klass == rb_cObject) {
rb_secure(4);
}
if (rb_safe_level() >= 4 && !OBJ_UNTRUSTED(klass)) {
rb_raise(rb_eSecurityError, "Insecure: can't undef `%s'", rb_id2name(id));
}
rb_frozen_class_p(klass);
if (id == object_id || id == id__send__ || id == idInitialize) {
rb_warn("undefining `%s' may cause serious problems", rb_id2name(id));
}
me = search_method(klass, id);
if (UNDEFINED_METHOD_ENTRY_P(me)) {
const char *s0 = " class";
VALUE c = klass;
if (FL_TEST(c, FL_SINGLETON)) {
VALUE obj = rb_ivar_get(klass, attached);
switch (TYPE(obj)) {
case T_MODULE:
case T_CLASS:
c = obj;
s0 = "";
}
}
else if (RB_TYPE_P(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, VM_METHOD_TYPE_UNDEF, 0, NOEX_PUBLIC);
CALL_METHOD_HOOK(klass, undefined, id);
}
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:46,代码来源:vm_method.c
注:本文中的rb_warn函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论