void dump_objects(tmx_object *o, int depth) { char padding[11]; mk_padding(padding, depth); printf("\n%s" "object={", padding); if (!o) { printf(" (NULL) }"); } else { printf("\n%s\t" "name='%s'", padding, o->name); printf("\n%s\t" "shape=", padding); print_shape(o->shape); printf("\n%s\t" "x=%f", padding, o->x); printf("\n%s\t" "y=%f", padding, o->y); printf("\n%s\t" "number of points='%d'", padding, o->points_len); printf("\n%s\t" "rotation=%f", padding, o->rotation); printf("\n%s\t" "visible=%s", padding, str_bool(o->visible)); if (o->points_len) { printf("\n%s\t" "points=", padding); dump_points(o->points, o->points_len); } dump_prop(o->properties, depth+1); printf("\n%s}", padding); } if (o && o->next) { dump_objects(o->next, depth); } }
void dump_layer(tmx_layer *l, unsigned int tc) { unsigned int i; printf("\nlayer={"); if (!l) { printf(" (NULL) }"); } else { printf("\n\t" "name='%s'", l->name); printf("\n\t" "visible=%s", str_bool(l->visible)); printf("\n\t" "opacity='%f'", l->opacity); if (l->type == L_LAYER && l->content.gids) { printf("\n\t" "type=Layer" "\n\t" "tiles="); for (i=0; i<tc; i++) { printf("%d,", l->content.gids[i] & TMX_FLIP_BITS_REMOVAL); } } else if (l->type == L_OBJGR) { printf("\n\t" "color=#%.6X", l->content.objgr->color); printf("\n\t" "draworder="); print_draworder(l->content.objgr->draworder); printf("\n\t" "type=ObjectGroup"); dump_objects(l->content.objgr->head, 1); } else if (l->type == L_IMAGE) { printf("\n\t" "x_offset=%d", l->x_offset); printf("\n\t" "y_offset=%d", l->y_offset); printf("\n\t" "type=ImageLayer"); dump_image(l->content.image, 1); } dump_prop(l->properties, 1); printf("\n}"); } if (l) { if (l->next) dump_layer(l->next, tc); } }
void dump_tile(tmx_tile *t) { unsigned int i; printf("\n\t" "tile={"); if (t) { printf("\n\t\t" "id=%u", t->id); dump_image(t->image, 2); dump_prop(t->properties, 2); dump_objects(t->collision, 2); if (t->animation) { printf("\n\t\t" "animation={"); for (i=0; i<t->animation_len; i++) { printf("\n\t\t\t" "tile=%3d (%6dms)", t->animation[i].tile_id, t->animation[i].duration); } printf("\n\t\t}"); } printf("\n\t}"); } else { printf(" (NULL) }"); } if (t && t->next) { dump_tile(t->next); } }
void dump_layer(tmx_layer l, unsigned int tc) { unsigned int i; printf("layer={"); if (!l) { fputs("\n(NULL)", stdout); } else { printf("\n\tname='%s'", l->name); printf("\n\tvisible='%d'", l->visible); printf("\n\topacity='%f'", l->opacity); if (l->type == L_LAYER && l->content.gids) { printf("\n\ttype=Layer\n\ttiles="); for (i=0; i<tc; i++) printf("%d,", l->content.gids[i] & TMX_FLIP_BITS_REMOVAL); } else if (l->type == L_OBJGR) { printf("\n\ttype=ObjectGroup"); } } puts("\n}"); if (l) { if (l->type == L_OBJGR && l->content.head) dump_objects(l->content.head); if (l->properties) dump_prop(l->properties); if (l->next) dump_layer(l->next, tc); } }
static void test_one_flags(duk_context *ctx, duk_uint_t defprop_flags) { duk_eval_string(ctx, "({})"); duk_push_string(ctx, "prop"); duk_push_uint(ctx, 123); duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE | DUK_DEFPROP_FORCE | defprop_flags); dump_prop(ctx); duk_pop(ctx); duk_eval_string(ctx, "(function () { var o = {}; Object.defineProperty(o, 'prop', {value:-123,writable:true,enumerable:true,configurable:true}); return o; })()"); duk_push_string(ctx, "prop"); duk_push_uint(ctx, 123); duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE | DUK_DEFPROP_FORCE | defprop_flags); dump_prop(ctx); duk_pop(ctx); duk_eval_string(ctx, "(function () { var o = {}; Object.defineProperty(o, 'prop', {value:-123,writable:false,enumerable:false,configurable:false}); return o; })()"); duk_push_string(ctx, "prop"); duk_push_uint(ctx, 123); duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE | DUK_DEFPROP_FORCE | defprop_flags); dump_prop(ctx); duk_pop(ctx); }
static void listObjectProperties(uint32_t id, uint32_t type) { unsigned int i; drmModeObjectPropertiesPtr props; props = drmModeObjectGetProperties(fd, id, type); if (!props) { printf("\tNo properties: %s.\n", strerror(errno)); return; } for (i = 0; i < props->count_props; i++) dump_prop(props->props[i], props->prop_values[i]); drmModeFreeObjectProperties(props); }
void dump_map(tmx_map m) { fputs("map={", stdout); if (m) { printf("\n\torient=%d", m->orient); printf("\n\theight=%d", m->height); printf("\n\twidth=%d", m->width); printf("\n\ttheight=%d", m->tile_height); printf("\n\ttwidth=%d", m->tile_width); } else { fputs("\n(NULL)", stdout); } puts("\n}"); if (m) { dump_tileset(m->ts_head); dump_prop(m->properties); dump_layer(m->ly_head, m->height * m->width); } }
void dump_map(tmx_map *m) { fputs("map={", stdout); if (m) { printf("\n\t" "orient="); print_orient(m->orient); printf("\n\t" "renderorder=%d", m->renderorder); printf("\n\t" "height=%d", m->height); printf("\n\t" "width=%d", m->width); printf("\n\t" "theight=%d", m->tile_height); printf("\n\t" "twidth=%d", m->tile_width); printf("\n\t" "bgcol=#%.6X", m->backgroundcolor); } else { fputs("\n(NULL)", stdout); } puts("\n}"); if (m) { dump_tileset(m->ts_head); dump_layer(m->ly_head, m->height * m->width); dump_prop(m->properties, 0); } }
static int dump_props(int types, const char *object, int name_and_help) { int ret; int i; int j; const struct prop_handler *prop; for (i = 0; prop_handlers[i].name; i++) { prop = &prop_handlers[i]; for (j = 1; j < __prop_object_max; j <<= 1) { ret = dump_prop(prop, object, types, j, name_and_help); if (ret < 0) { ret = 50; goto out; } } } ret = 0; out: return ret; }
void dump_tileset(tmx_tileset *t) { printf("\ntileset={"); if (t) { printf("\n\t" "name=%s", t->name); printf("\n\t" "firstgid=%u", t->firstgid); printf("\n\t" "tile_height=%d", t->tile_height); printf("\n\t" "tile_width=%d", t->tile_width); printf("\n\t" "firstgid=%d", t->firstgid); printf("\n\t" "margin=%d", t->margin); printf("\n\t" "spacing=%d", t->spacing); printf("\n\t" "x_offset=%d", t->x_offset); printf("\n\t" "y_offset=%d", t->y_offset); dump_image(t->image, 1); dump_tile(t->tiles); dump_prop(t->properties, 1); printf("\n}"); } else { printf(" (NULL) }"); } if (t && t->next) { dump_tileset(t->next); } }
static duk_ret_t test_basic(duk_context *ctx, void *udata) { (void) udata; duk_push_object(ctx); duk_push_string(ctx, "prop"); duk_def_prop(ctx, -2, DUK_DEFPROP_SET_WRITABLE | DUK_DEFPROP_SET_ENUMERABLE | DUK_DEFPROP_SET_CONFIGURABLE); dump_prop(ctx); duk_push_string(ctx, "prop"); duk_def_prop(ctx, -2, DUK_DEFPROP_CLEAR_WRITABLE); dump_prop(ctx); duk_push_string(ctx, "prop"); duk_def_prop(ctx, -2, DUK_DEFPROP_CLEAR_ENUMERABLE); dump_prop(ctx); duk_push_string(ctx, "prop"); duk_def_prop(ctx, -2, DUK_DEFPROP_CLEAR_CONFIGURABLE); dump_prop(ctx); duk_push_string(ctx, "prop"); duk_def_prop(ctx, -2, DUK_DEFPROP_SET_CONFIGURABLE | DUK_DEFPROP_FORCE); dump_prop(ctx); duk_push_string(ctx, "prop"); duk_def_prop(ctx, -2, DUK_DEFPROP_SET_ENUMERABLE); dump_prop(ctx); duk_push_string(ctx, "prop"); duk_def_prop(ctx, -2, DUK_DEFPROP_SET_WRITABLE); dump_prop(ctx); printf("final top: %ld\n", (long) duk_get_top(ctx)); return 0; }