Exemplo n.º 1
0
static void write_image_or_node(lua_State * L, wrtype_e writetype)
{
    image *a, **aa;
    image_dict *ad;
    halfword n;
    if (lua_gettop(L) != 1)
        luaL_error(L, "%s needs exactly 1 argument", wrtype_s[writetype]);
    if (lua_istable(L, 1))
        (void) l_new_image(L);  /* image --- if everything worked well */
    aa = (image **) luaL_checkudata(L, 1, TYPE_IMG);    /* image */
    a = *aa;
    ad = img_dict(a);
    setup_image(static_pdf, a, writetype);
    switch (writetype) {
    case WR_WRITE:
        n = img_to_node(a);
        tail_append(n);
        break;                  /* image */
    case WR_IMMEDIATEWRITE:
        write_img(static_pdf, ad);
        break;                  /* image */
    case WR_NODE:              /* image */
        lua_pop(L, 1);          /* - */
        n = img_to_node(a);
        lua_nodelib_push_fast(L, n);
        break;                  /* node */
    default:
        assert(0);
    }
    if (img_state(ad) < DICT_REFERED)
        img_state(ad) = DICT_REFERED;
}
Exemplo n.º 2
0
static void write_image_or_node(lua_State * L, wrtype_e writetype)
{
    image *a, **aa;
    image_dict *ad;
    halfword n;
    if (lua_gettop(L) != 1)
        luaL_error(L, "%s expects an argument", wrtype_s[writetype]);
    if (lua_istable(L, 1))
        (void) l_new_image(L);
    aa = (image **) luaL_checkudata(L, 1, TYPE_IMG);
    a = *aa;
    ad = img_dict(a);
    setup_image(static_pdf, a, writetype);
    switch (writetype) {
        case WR_WRITE:
            n = img_to_node(L, a);
            tail_append(n);
            break;
        case WR_IMMEDIATEWRITE:
            write_img(static_pdf, ad);
            break;
        case WR_NODE:
            lua_pop(L, 1); /* - */
            n = img_to_node(L, a);
            lua_nodelib_push_fast(L, n);
            break;
        default:
            luaL_error(L, "%s expects an valid image", wrtype_s[writetype]);
    }
    if (img_state(ad) < DICT_REFERED)
        img_state(ad) = DICT_REFERED;
}
Exemplo n.º 3
0
static void add_image(SimplyRes *self, SimplyImage *image) {
  list1_prepend(&self->images, &image->node);

  setup_image(image);

  window_stack_schedule_top_window_render();
}
Exemplo n.º 4
0
void vf_out_image(PDF pdf, unsigned i)
{
    image *a, **aa;
    image_dict *ad;
    lua_State *L = Luas;        /* ... */
    lua_rawgeti(L, LUA_GLOBALSINDEX, (int) i);  /* image ... */
    aa = (image **) luaL_checkudata(L, -1, TYPE_IMG);
    a = *aa;
    ad = img_dict(a);
    assert(ad != NULL);
    setup_image(pdf, a, WR_VF_IMG);     /* image ... */
    place_img(pdf, ad, img_dimen(a), img_transform(a));
    lua_pop(L, 1);              /* ... */
}
Exemplo n.º 5
0
void vf_out_image(PDF pdf, unsigned i)
{
    image *a, **aa;
    image_dict *ad;
    lua_rawgeti(Luas, LUA_REGISTRYINDEX, (int) i);
    aa = (image **) luaL_checkudata(Luas, -1, TYPE_IMG);
    a = *aa;
    ad = img_dict(a);
    if (ad == NULL) {
        luaL_error(Luas, "invalid image dictionary");
    }
    setup_image(pdf, a, WR_VF_IMG);
    place_img(pdf, ad, img_dimen(a), img_transform(a));
    lua_pop(Luas, 1);
}
Exemplo n.º 6
0
Arquivo: main.c Projeto: AndrewD/prex
/*
 * C entry point
 */
void
loader_main(void)
{
	paddr_t kernel_entry;

	/*
	 * Initialize data.
	 */
	memset(bootinfo, 0, BOOTINFO_SIZE);

	load_base = 0;
	load_start = 0;
	nr_img = 0;

	/*
	 * Setup minimum hardware for boot (may include machine_putc()).
	 */
	machine_setup();

	DPRINTF(("Prex Boot Loader V1.00\n"));

	/*
	 * Load program image.
	 */
	setup_image();
#if defined(DEBUG) && defined(DEBUG_BOOTINFO)
	dump_bootinfo();
#endif
	/*
	 * Jump to the kernel entry point
	 * via machine-dependent code.
	 */
	kernel_entry = (paddr_t)phys_to_virt(bootinfo->kernel.entry);

	DPRINTF(("kernel_entry=%x\n", kernel_entry));
	DPRINTF(("Entering kernel...\n\n"));

	start_kernel(kernel_entry);

	/* NOTREACHED */
}