/* * call-seq: * xc.medialib_entry_property_set(id, key, value, *source) -> result * * Write info to the medialib at _id_. _source_ is an optional argument that * describes where to write the mediainfo. If _source_ is omitted, the * mediainfo is written to "client/<yourclient>" where <yourclient> is the * name you specified in _Xmms::Client.new(name)_. */ static VALUE c_medialib_entry_property_set (int argc, VALUE *argv, VALUE self) { VALUE tmp, key, value, src = Qnil; RbXmmsClient *xmms = NULL; xmmsc_result_t *res; const char *ckey; bool is_str = false; uint32_t id; int32_t ivalue; Data_Get_Struct (self, RbXmmsClient, xmms); CHECK_DELETED (xmms); rb_scan_args (argc, argv, "31", &tmp, &key, &value, &src); id = check_int32 (tmp); Check_Type (key, T_SYMBOL); if (!NIL_P (rb_check_string_type (value))) is_str = true; else ivalue = check_int32 (value); ckey = rb_id2name (SYM2ID (key)); if (NIL_P (src) && is_str) res = xmmsc_medialib_entry_property_set_str (xmms->real, id, ckey, StringValuePtr (value)); else if (NIL_P (src)) res = xmmsc_medialib_entry_property_set_int (xmms->real, id, ckey, ivalue); else if (is_str) res = xmmsc_medialib_entry_property_set_str_with_source ( xmms->real, id, StringValuePtr (src), ckey, StringValuePtr (value)); else res = xmmsc_medialib_entry_property_set_int_with_source ( xmms->real, id, StringValuePtr (src), ckey, ivalue); return TO_XMMS_CLIENT_RESULT (self, res); }
/* * call-seq: * xc.medialib_entry_property_remove(id, key, *source) -> result * * Remove a custom field in the medialib associated with the entry _id_. * _source_ is an optional argument that describes where to write the * mediainfo. If _source_ is omitted, "client/<yourclient>" is used, * where <yourclient> is the name you specified in * _Xmms::Client.new(name)_. */ static VALUE c_medialib_entry_property_remove (int argc, VALUE *argv, VALUE self) { VALUE tmp, key, src = Qnil; RbXmmsClient *xmms = NULL; xmmsc_result_t *res; const char *ckey; int32_t id; Data_Get_Struct (self, RbXmmsClient, xmms); CHECK_DELETED (xmms); rb_scan_args (argc, argv, "21", &tmp, &key, &src); id = check_int32 (tmp); Check_Type (key, T_SYMBOL); ckey = rb_id2name (SYM2ID (key)); if (NIL_P (src)) res = xmmsc_medialib_entry_property_remove (xmms->real, id, ckey); else res = xmmsc_medialib_entry_property_remove_with_source ( xmms->real, id, StringValuePtr (src), ckey); return TO_XMMS_CLIENT_RESULT (self, res); }
// Tests libgo.so to export the following functions. // int8_t DidInitRun() // returns true // int8_t DidMainRun() // returns true // int32_t FromPkg() // returns 1024 int main(int argc, char** argv) { void* handle = dlopen(argv[1], RTLD_LAZY | RTLD_GLOBAL); if (!handle) { fprintf(stderr, "ERROR: failed to open the shared library: %s\n", dlerror()); return 2; } int ret = 0; ret = check_int8(handle, "DidInitRun", 1); if (ret != 0) { return ret; } ret = check_int8(handle, "DidMainRun", 0); if (ret != 0) { return ret; } ret = check_int32(handle, "FromPkg", 1024); if (ret != 0) { return ret; } // test.bash looks for "PASS" to ensure this program has reached the end. printf("PASS\n"); return 0; }
/* call-seq: * c = Xmms::Collection.new(type) * * Returns a new Xmms::Collection object of type _type_. */ static VALUE c_coll_init (VALUE self, VALUE type) { COLL_METHOD_HANDLER_HEADER coll->real = xmmsv_new_coll (check_int32 (type)); return self; }
/* * call-seq: * xc.medialib_entry_move(id, url) -> result * * Moves the entry specified by _id_ to a new URL without changing mediainfo. */ static VALUE c_medialib_entry_move (VALUE self, VALUE id, VALUE url) { METHOD_HANDLER_HEADER res = xmmsc_medialib_move_entry (xmms->real, check_int32 (id), StringValuePtr (url)); METHOD_HANDLER_FOOTER }
/* * call-seq: * xc.coll_find(id, ns) -> result * * Find all collections in the given namespace _ns_ which contain _id_. */ static VALUE c_coll_find (VALUE self, VALUE id, VALUE ns) { METHOD_HANDLER_HEADER res = xmmsc_coll_find (xmms->real, check_int32 (id), StringValuePtr (ns)); METHOD_HANDLER_FOOTER }
/* * call-seq: * pl.insert_entry(pos, arg) -> result * * Inserts an entry to the current playlist at position _pos_ in the playlist. * _arg_ can be either a URL or an id. */ static VALUE c_insert_entry (VALUE self, VALUE pos, VALUE arg) { int32_t id; int32_t ipos; PLAYLIST_METHOD_HANDLER_HEADER ipos = check_int32 (pos); if (!NIL_P (rb_check_string_type (arg))) res = xmmsc_playlist_insert_url (xmms->real, pl->name, ipos, StringValuePtr (arg)); else { id = check_int32 (arg); res = xmmsc_playlist_insert_id (xmms->real, pl->name, ipos, id); } PLAYLIST_METHOD_HANDLER_FOOTER }
Object dap_arraydecl(DAPparsestate* state, Object name, Object size) { long value; OCnode* dim; if(!check_int32(size,&value)) { dap_parse_error(state,"Dimension not an integer"); state->error = OC_EDIMSIZE; /* signal semantic error */ } if(name != NULL) dim = newocnode((char*)name,OC_Dimension,state); else dim = newocnode(NULL,OC_Dimension,state); dim->dim.declsize = value; return dim; }