IoObject *IoCairoSVGSurface_getVersions(IoCairoSVGSurface *self, IoObject *locals, IoMessage *m) { IoList *versionList = IoList_new(IOSTATE); const cairo_svg_version_t *versions = 0; int versionCount = 0; int i = 0; cairo_svg_get_versions(&versions, &versionCount); for (i = 0; i < versionCount; i++) IoList_rawAppend_(versionList, IONUMBER(versions[i])); return versionList; }
static int svg_get_versions (lua_State *L) { const cairo_svg_version_t *versions; int num_versions, i; cairo_svg_get_versions(&versions, &num_versions); lua_createtable(L, num_versions, 0); for (i = 0; i < num_versions; ++i) { lua_pushstring(L, cairo_svg_version_to_string(versions[i])); lua_rawseti(L, -2, i + 1); } return 1; }
static VALUE cr_svg_get_versions (VALUE self) { VALUE rb_versions; int i, num_versions; cairo_svg_version_t const *versions; cairo_svg_get_versions (&versions, &num_versions); rb_versions = rb_ary_new2 (num_versions); for (i = 0; i < num_versions; i++) { rb_ary_push (rb_versions, INT2NUM (versions[i])); } return rb_versions; }