// cairo_public const char * // cairo_ps_level_to_string (cairo_ps_level_t level); static int l_cairo_ps_level_to_string(lua_State* L) { cairo_ps_level_t level = (cairo_ps_level_t)luaL_checkinteger(L, 1); const char *v = cairo_ps_level_to_string (level); lua_pushstring(L, v); return 1; }
static int ps_get_levels (lua_State *L) { const cairo_ps_level_t *levels; int num_levels, i; cairo_ps_get_levels(&levels, &num_levels); lua_createtable(L, num_levels, 0); for (i = 0; i < num_levels; ++i) { lua_pushstring(L, cairo_ps_level_to_string(levels[i])); lua_rawseti(L, -2, i + 1); } return 1; }
static VALUE cr_ps_level_to_string (int argc, VALUE *argv, VALUE self) { if (argc == 0) { return rb_call_super (argc, argv); } else { VALUE level; rb_scan_args (argc, argv, "1", &level); return rb_str_new2 (cairo_ps_level_to_string (RVAL2CRPSLEVEL (level))); } }