static VALUE rg_matches(int argc, VALUE *argv, VALUE self) { VALUE range_list; rb_scan_args(argc, argv, "01", &range_list); return CBOOL2RVAL(pango_language_matches(_SELF(self), RVAL2CSTR_ACCEPT_NIL(range_list))); }
/* The fact that this comparison function works is dependent * on a property of the pango_script_lang_table which accidental rather * than inherent. * * The property is if we take any element in the table and suffix it * <elem>-<suffix> then that must strcmp() between any elements * preceding the element in the table and any element following in the * table. So, if we had something like: * * 'zh' *' zh-cn' * * in the table we would have a problem since 'zh-tw' follows 'zh-cn'. * On the other hand: * * 'zh' * 'zha' * * Works because 'zh-tw' precedes 'zha'. */ static int script_for_lang_compare (gconstpointer key, gconstpointer member) { PangoLanguage *lang = (PangoLanguage *)key; const PangoScriptForLang *script_for_lang = member; if (pango_language_matches (lang, script_for_lang->lang)) return 0; else return strcmp (pango_language_to_string (lang), script_for_lang->lang); }