Example #1
0
void skipblock(psd_file_t f, char *desc){
	extern void ir_dump(psd_file_t f, int level, int len, struct dictentry *parent);
	psd_bytes_t n = get4B(f);
	if(n){
		if(verbose > 1){
			VERBOSE("%s:\n", desc);
			ir_dump(f, 0, n, NULL);
		}
		else{
			fseeko(f, n, SEEK_CUR);
			VERBOSE("  ...skipped %s (" LL_L("%lld","%ld") " bytes)\n", desc, n);
		}
	}else
		VERBOSE("  (%s is empty)\n", desc);
}
Example #2
0
int main(int argc, char **argv)
{
        int res;
        struct genbind_node *genbind_root = NULL;
        struct webidl_node *webidl_root = NULL;
        struct ir *ir = NULL;
        enum bindingtype_e bindingtype;

        options = process_cmdline(argc, argv);
        if (options == NULL) {
                return 1; /* bad commandline */
        }

        /* parse binding */
        res = genbind_parsefile(options->infilename, &genbind_root);
        if (res != 0) {
                fprintf(stderr, "Error: parse failed with code %d\n", res);
                return res;
        }

        /* dump the binding AST */
        genbind_dump_ast(genbind_root);

        /* get type of binding */
        bindingtype = genbind_get_type(genbind_root);
        if (bindingtype == BINDINGTYPE_UNKNOWN) {
                return 3;
        }

        /* load the IDL files specified in the binding */
        res = genbind_load_idl(genbind_root, &webidl_root);
        if (res != 0) {
                return 4;
        }

	/* debug dump of web idl AST */
        webidl_dump_ast(webidl_root);

        /* generate intermediate representation */
        res = ir_new(genbind_root, webidl_root, &ir);
        if (res != 0) {
                return 5;
        }

        /* dump the intermediate representation */
        ir_dump(ir);
        ir_dumpdot(ir);

        /* generate binding */
        switch (bindingtype) {
        case BINDINGTYPE_DUK_LIBDOM:
                res = duk_libdom_output(ir);
                break;

        default:
                fprintf(stderr, "Unable to generate binding of this type\n");
                res = 7;
        }

        return res;
}