Пример #1
0
static int gen_union_verifier(output_t *out, fb_compound_type_t *ct)
{
    fb_symbol_t *sym;
    fb_member_t *member;
    fb_scoped_name_t snt, snref;

    fb_clear(snt);
    fb_clear(snref);
    fb_compound_name(ct, &snt);

    fprintf(out->fp,
            "int __%s_union_verifier(flatcc_table_verifier_descriptor_t *td, flatbuffers_voffset_t id, uint8_t type)\n{\n    switch(type) {\n",
            snt.text);
    for (sym = ct->members; sym; sym = sym->link) {
        member = (fb_member_t *)sym;
        if (member->type.type == vt_missing) {
            /* NONE is of type vt_missing and already handled. */
            continue;
        }
        assert(member->type.type == vt_compound_type_ref);
        fb_compound_name(member->type.ct, &snref);
        fprintf(out->fp,
                "    case %u: return flatcc_verify_table_field(td, id, 0, __%s_table_verifier);\n",
                (unsigned)member->value.u, snref.text);
    }
    fprintf(out->fp,
            "    default: return flatcc_verify_ok;\n    }\n}\n\n");
    return 0;
}
Пример #2
0
int fb_init() {
	if(gFbHasInit) return 0;
	gFbInfo = find_fbinfo();
	if (gFbInfo == NULL) {
		printf("Unable to find framebuffer info\n");
		return -1;
	}
	printf("Found framebuffer info at 0x%x\n", gFbInfo);
	printf("Framebuffer dimentions: %dx%d\n", gFbInfo->width, gFbInfo->height);

	fb_setup();
	fb_clear();
    fb_set_loc(0,0);
	fb_display_text(TRUE);

	fb_print_line('=');
	fb_print_center("greenpois0n\n");
	fb_print_center("http://www.greenpois0n.com\n");
	fb_print_line('=');

	cmd_add("fbecho", &fb_cmd, "write characters back to framebuffer");
	cmd_add("fbimg", &fbimg_cmd, "display image on framebuffer");
	gFbHasInit = TRUE;
	return 0;
}
Пример #3
0
int
main(int argc, char **argv)
{
    struct vfont *vfp;

    bu_setprogname(argv[0]);

    if (!get_args(argc, argv)) {
        fputs(usage, stderr);
        bu_exit(1, NULL);
    }

    if ((fbp = fb_open(framebuffer, scr_width, scr_height)) == NULL) {
        fprintf(stderr, "fblabel:  Unable to open framebuffer %s\n", framebuffer);
        bu_exit(12, NULL);
    }

    if (clear) {
        fb_clear(fbp, PIXEL_NULL);
    }

    if ((vfp = vfont_get(font1)) == VFONT_NULL) {
        fprintf(stderr, "fblabel:  Can't get font \"%s\"\n",
                font1 == NULL ? "(null)" : font1);
        bu_exit(1, NULL);
    }

    do_line(vfp, textstring);

    fb_close(fbp);
    vfont_free(vfp);

    return 0;
}
Пример #4
0
int fb_init() {
	if(gFbHasInit) return 0;
	fb_setup();
	fb_clear();
    fb_set_loc(0,0);
	fb_display_text(TRUE);

	fb_print("=====================================================");
#ifdef S5L8930X
	fb_print("=====================================================");
	fb_print("                          ");
#endif

	fb_print("                 Haifisch - AESPayload               ");

#ifdef S5L8930X
	fb_print("                                                     ");
#endif

	fb_print("                  http://haifisch.me                 ");

#ifdef S5L8930X
	fb_print("                           ");
	fb_print("=====================================================");
#endif
	fb_print("=====================================================");
	cmd_add("fbecho", &fb_cmd, "write characters back to framebuffer");
	gFbHasInit = TRUE;
	return 0;
}
Пример #5
0
/* Same for structs and tables. */
static int gen_root_type_printer(output_t *out, fb_compound_type_t *ct)
{
    fb_scoped_name_t snt;

    fb_clear(snt);
    fb_compound_name(ct, &snt);

    fprintf(out->fp,
            "static int %s_print_json(flatcc_json_printer_t *ctx, const char *buf, size_t bufsiz)\n",
            out->S->basename);
    fprintf(out->fp,
            "{\n"
            "    flatcc_json_printer_t printer;\n"
            "\n"
            "    if (ctx == 0) {\n"
            "        ctx = &printer;\n"
            "        flatcc_json_printer_init(ctx, 0);\n"
            "    }\n"
            "    return %s_print_json_as_root(ctx, buf, bufsiz, ",
            snt.text);
    if (out->S->file_identifier.type == vt_string) {
        fprintf(out->fp,
                "\"%.*s\");\n",
                out->S->file_identifier.s.len, out->S->file_identifier.s.s);
    } else {
        fprintf(out->fp,
                "0);");
    }
    fprintf(out->fp,
        "}\n\n");
    return 0;
}
Пример #6
0
/*
 * Clear the framebuffer with the specified color.
 * Otherwise, clear the framebuffer with black.
 *
 * Usage:
 * procname clear [rgb]
 */
HIDDEN int
fbo_clear_tcl(void *clientData, int argc, const char **argv)
{
    struct fb_obj *fbop = (struct fb_obj *)clientData;
    int status;
    RGBpixel pixel;
    unsigned char *ms;


    if (argc < 2 || 3 < argc) {
	bu_log("ERROR: expecting only two or three arguments\n");
	return BRLCAD_ERROR;
    }

    if (argc == 3) {
	/*
	 * Decompose the color list into its constituents.
	 * For now must be in the form of rrr ggg bbb.
	 */
	if (fbo_tcllist2color(argv[6], pixel) == BRLCAD_ERROR) {
	    bu_log("fb_cell: invalid color spec: %s.", argv[6]);
	    return BRLCAD_ERROR;
	}

	ms = pixel;
    } else
	ms = RGBPIXEL_NULL;

    status = fb_clear(fbop->fbo_fbs.fbs_fbp, ms);

    if (status < 0)
	return BRLCAD_ERROR;

    return BRLCAD_OK;
}
Пример #7
0
/*
 * Basic frame (normal mode)
 */
void bootmenu_basic_frame(void)
{
	/* clear screen */
	fb_clear();
	
	/* clear status */
	fb_set_status("");
}
Пример #8
0
void kmain() {
	fb_clear(BLACK);
	char version[64] = "rhinocer/os 0.1";
	fb_write_string(0, version, BLACK, WHITE);
	fb_move_cursor(0);
	while (1) {

	}
}
Пример #9
0
void
fb_scroll(void)
{

	if (!fb.active)
		return;
#if 0	/* 1-line scroll */
	cons.y--;
	fb_copy(0, ROM_FONT_HEIGHT, 0, 0,
	    FB_WIDTH, FB_HEIGHT * (CONS_HEIGHT - 1));
	fb_clear(0, cons.y * ROM_FONT_HEIGHT, FB_WIDTH, ROM_FONT_HEIGHT,
	    CONS_BG);
#else	/* jump scroll */
	cons.y /= 2;
	fb_copy(0, cons.y * ROM_FONT_HEIGHT, 0, 0, FB_WIDTH, FB_HEIGHT / 2);
	fb_clear(0, cons.y *ROM_FONT_HEIGHT, FB_WIDTH, FB_HEIGHT / 2, CONS_BG);
#endif
}
Пример #10
0
void
fb_init(void)
{

	cons.x = X_INIT;
	cons.y = Y_INIT;
	fb.active = true;
	fb_clear(0, 0, FB_WIDTH, FB_HEIGHT, CONS_BG);
}
Пример #11
0
int kmain()
{
  fb_clear();

  fb_write_str("   ___           _            _            \n");
  fb_write_str("  / _ \\_ __ ___ | |_ ___  ___| |_ ___  ___ \n");
  fb_write_str(" / /_)/ '__/ _ \\| __/ _ \\/ __| __/ _ \\/ __|\n");
  fb_write_str("/ ___/| | | (_) | ||  __/ (__| || (_) \\__ \\\n");
  fb_write_str("\\/    |_|  \\___/ \\__\\___|\\___|\\__\\___/|___/\n");
}
Пример #12
0
static int gen_json_printer_union(output_t *out, fb_compound_type_t *ct)
{
    fb_symbol_t *sym;
    fb_member_t *member;
    fb_scoped_name_t snt, snref;

    fb_clear(snt);
    fb_clear(snref);
    fb_compound_name(ct, &snt);

    fprintf(out->fp,
            "void __%s_print_json_union(flatcc_json_printer_t *ctx, flatcc_json_printer_table_descriptor_t *td, int id, const char *name, int len)\n"
            "{\n    switch (flatcc_json_printer_read_union_type(td, id)) {\n",
            snt.text);
    for (sym = ct->members; sym; sym = sym->link) {
        member = (fb_member_t *)sym;
        if (member->type.type == vt_missing) {
            /* NONE is of type vt_missing and already handled. */
            continue;
        }
        assert(member->type.type == vt_compound_type_ref);
        fb_compound_name(member->type.ct, &snref);
#if FLATCC_JSON_PRINT_MAP_ENUMS
        fprintf(out->fp,
                "    case %u:\n"
                "        flatcc_json_printer_union_type(ctx, td, name, len, %u, \"%.*s\", %ld);\n",
                (unsigned)member->value.u, (unsigned)member->value.u, (int)sym->ident->len, sym->ident->text, sym->ident->len);
#else
        fprintf(out->fp,
                "    case %u:\n"
                "        flatcc_json_printer_union_type(ctx, td, name, len, %u, 0, 0);\n",
                (unsigned)member->value.u, (unsigned)member->value.u);
#endif
        fprintf(out->fp,
                "        flatcc_json_printer_table_field(ctx, td, id, name, len, __%s_print_json_table);\n"
                "        break;\n",
                snref.text);
    }
    fprintf(out->fp,
            "    }\n}\n\n");
    return 0;
}
Пример #13
0
static int gen_struct_verifier(output_t *out, fb_compound_type_t *ct)
{
    fb_scoped_name_t snt;

    fb_clear(snt);
    fb_compound_name(ct, &snt);

    fprintf(out->fp,
            "static inline int %s_verify_as_root(const void *buf, size_t bufsiz, const char *fid)\n"
            "{\n    return flatcc_verify_struct_as_root(buf, bufsiz, fid, %"PRIu16", %"PRIu64");\n}\n\n",
            snt.text, ct->align, ct->size);
    return 0;
}
Пример #14
0
void fb_init(void)
{
    Debug("fb_init()\n");
    fb_open();
    fb_get_var();
    memcpy(&saved_var, &fb_var, sizeof(struct fb_var_screeninfo));
    //saved_var = fb_var;
    if (fb_var.xoffset || fb_var.yoffset || fb_var.accel_flags) {
	fb_var.xoffset = 0;
	fb_var.yoffset = 0;
	fb_var.accel_flags = 0;
	fb_set_var();
    }
    fb_get_fix();
    var_fix_validate();
    memcpy(&saved_fix, &fb_fix, sizeof(struct fb_var_screeninfo));
    //saved_fix = fb_fix;
    switch (fb_fix.visual) {
	case FB_VISUAL_MONO01:
	case FB_VISUAL_MONO10:
	case FB_VISUAL_TRUECOLOR:
	    /* no colormap */
	    break;

	case FB_VISUAL_PSEUDOCOLOR:
	case FB_VISUAL_STATIC_PSEUDOCOLOR:
	    cmap_init(1<<fb_var.bits_per_pixel);
	    break;

	case FB_VISUAL_DIRECTCOLOR:
	    cmap_init(1<<(max(max(fb_var.red.length, fb_var.green.length),
			      max(fb_var.blue.length, fb_var.transp.length))));
	    break;
    }
    if (fb_cmap.len) {
	fb_get_cmap();
	saved_cmap = fb_cmap;
	ALLOC_AND_SAVE_COMPONENT(red);
	ALLOC_AND_SAVE_COMPONENT(green);
	ALLOC_AND_SAVE_COMPONENT(blue);
	if (fb_cmap.transp)
	    ALLOC_AND_SAVE_COMPONENT(transp);
    }
    fb_map();
    fb_save();
    fb_clear();
}
Пример #15
0
Файл: fb.c Проект: rhtyd/tantra
void init_fb()
{
    fb_clear();
    for (int idx = 0; banner[idx] != '\0'; idx++)
    {
        char c = banner[idx];
        if (c == '\0') return;
        uint8_t bg = FB_DGRAY;
        uint8_t fg = FB_LGRAY;

        if (c == 'w')
        {
            bg = FB_LMAGENTA;
            fg = FB_BROWN;
        }
        fb_putcolor(c, bg, fg);
    }
}
Пример #16
0
static int gen_verifier_prototypes(output_t *out)
{
    fb_symbol_t *sym;
    fb_scoped_name_t snt;

    fb_clear(snt);

    for (sym = out->S->symbols; sym; sym = sym->link) {
        switch (sym->kind) {
        case fb_is_table:
            fb_compound_name((fb_compound_type_t *)sym, &snt);
            fprintf(out->fp,
                    "static int __%s_table_verifier(flatcc_table_verifier_descriptor_t *td);\n",
                    snt.text);
        }
    }
    fprintf(out->fp, "\n");
    return 0;
}
Пример #17
0
Файл: fb.c Проект: pra85/tantra
void fb_init()
{
    fb_clear();
    for (int idx = 0; banner[idx] != '\0'; idx++)
    {
        char c = banner[idx];
        if (c == '\0') return;
        uint8_t bg = FB_DGRAY;
        uint8_t fg = FB_LGRAY;

        if (c == 'w')
        {
            bg = FB_LMAGENTA;
            fg = FB_BROWN;
        }
        fb_putcolor(c, bg, fg);
    }
    fb_printcolor("Welcome to Tantra. Type h or ? to get started...\n", FB_LCYAN, FB_BLACK);
}
Пример #18
0
void
paintGridFb()
{
    int fx, fy;
    int fxbeg, fybeg;
    int fxfin, fyfin;
    int fxorg, fyorg;
    int fgridwid;
    if (fb_clear(fbiop, pixbkgr) == -1)
	return;
    gridxmargin = (devwid - (gridwidth*zoom)) / 2.0;
    gridymargin = (devhgt - (gridheight*zoom)) / 2.0;
    gridToFb(gridxorg, gridyorg, &fxbeg, &fybeg);
    gridToFb(gridxfin+1, gridyfin+1, &fxfin, &fyfin);
    gridToFb(0, 0, &fxorg, &fyorg);
    CenterCell(fxorg); /* center of cell */
    CenterCell(fyorg);
    if (zoom == 1) {
	fgridwid = gridwidth + 2;
	fxfin++;
    } else
	fgridwid = gridwidth * zoom + 1;

    /* draw vertical lines */
    for (fx = 1; fx < fgridwid; fx++)
	COPYRGB(&pixbuf[fx][0], pixbkgr);
    for (fx = fxbeg; fx <= fxfin; fx += zoom)
	COPYRGB(&pixbuf[fx-fxbeg][0], &pixgrid[0]);
    for (fy = fybeg; fy <= fyfin; fy++)
	(void) fb_write(fbiop, fxbeg, fy, (unsigned char *)pixbuf, fgridwid);
    for (fy = 0; fy < devwid; fy++)
	(void) fb_write(fbiop, fxorg, fy, pixaxis, 1);

    /* draw horizontal lines */
    if (zoom > 1)
	for (fy = fybeg; fy <= fyfin; fy += zoom)
	    (void) fb_write(fbiop,
			    fxbeg, fy, pixgrid, fgridwid);
    for (fx = 0; fx < devwid; fx++)
	COPYRGB(&pixbuf[fx][0], pixaxis);
    (void) fb_write(fbiop, 0, fyorg, (unsigned char *)pixbuf, devwid);
    return;
}
Пример #19
0
/*
  Must be called after gridInit() so that gridsz is setup.
*/
int
openFbDevice(char *fbdev)
{
    int ret = 1;
    notify("Opening frame buffer", NOTIFY_APPEND);
    if (zoom < 1) {
	prntScr("Device is too small to display image.");
	ret = 0;
	goto safe_exit;
    }
    if (((fbiop != FBIO_NULL && fb_getwidth(fbiop) != devwid)
	 ||	pixgrid == NULL)
	&&	(pixgrid = (unsigned char *) calloc(devwid*3, sizeof(unsigned char)))
	== (unsigned char *) NULL) {
	prntScr("Memory allocation of %d bytes failed.",
		sizeof(unsigned char)*devwid);
	ret = 0;
	goto safe_exit;
    }
    (void) memset((char *) pixgrid, NUL, sizeof(unsigned char)*devwid*3);
    if (fbiop != FBIO_NULL) {
	if (! closFbDevice()) {
	    ret = 0;
	    goto safe_exit;
	}
    }
    fbiop = fb_open(fbdev, devwid, devhgt);
    if (fbiop == NULL) {
	ret = 0;
	goto safe_exit;
    } else if (fb_clear(fbiop, pixblack) == -1
	       ||	(notify("Zooming", NOTIFY_APPEND),
			 fb_zoom(fbiop, 1, 1) == -1)
	       ||	(notify("Windowing", NOTIFY_DELETE),
			 fb_window(fbiop, devwid/2, devhgt/2) == -1)
	) {
	ret = 0;
	goto safe_exit;
    }
    safe_exit : notify(NULL, NOTIFY_DELETE);
    return ret;
}
Пример #20
0
/*
 * Clear the framebuffer with the specified color.
 * Otherwise, clear the framebuffer with black.
 *
 * Usage:
 *	  procname clear [rgb]
 */
HIDDEN int
fbo_clear_tcl(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
{
    struct fb_obj *fbop = (struct fb_obj *)clientData;
    int status;
    RGBpixel pixel;
    unsigned char *ms;


    if (argc < 2 || 3 < argc) {
	struct bu_vls vls;

	bu_vls_init(&vls);
	bu_vls_printf(&vls, "helplib fb_clear");
	Tcl_Eval(interp, bu_vls_addr(&vls));
	bu_vls_free(&vls);
	return TCL_ERROR;
    }

    if (argc == 3) {
	/*
	 * Decompose the color list into its constituents.
	 * For now must be in the form of rrr ggg bbb.
	 */
	if (fbo_tcllist2color(interp, argv[6], pixel) == TCL_ERROR) {
	    Tcl_AppendResult(interp, "fb_cell: invalid color spec: ", argv[6], ".",
			     (char *)NULL);
	    return TCL_ERROR;
	}

	ms = pixel;
    } else
	ms = RGBPIXEL_NULL;

    status = fb_clear(fbop->fbo_fbs.fbs_fbp, ms);

    if (status < 0)
	return TCL_ERROR;

    return TCL_OK;
}
Пример #21
0
/*
 * Only tables are mutually recursive. Structs are sorted and unions are
 * defined earlier, depending on the table prototypes.
 */
static int gen_json_printer_prototypes(output_t *out)
{
    fb_symbol_t *sym;
    fb_scoped_name_t snt;
    fb_symbol_t *root_type = out->S->root_type.type;

    fb_clear(snt);

    if (root_type)
    switch (root_type->kind) {
    case fb_is_table:
    case fb_is_struct:
        fprintf(out->fp,
                "/*\n"
                " * Prints the default root table or struct from a buffer which must have\n"
                " * the schema declared file identifier, if any. It is also possible to\n"
                " * call the type specific `print_json_as_root` function wich accepts an\n"
                " * optional identifier (or 0) as argument. The printer `ctx` object must\n"
                " * be initialized with the appropriate output type, or it can be 0 which\n"
                " * defaults to stdout. NOTE: `ctx` is not generally allowed to be null, only\n"
                " * here for a simplified interface.\n"
                " */\n");
    fprintf(out->fp,
            "static int %s_print_json(flatcc_json_printer_t *ctx, const char *buf, size_t bufsiz);\n\n",
            out->S->basename);
    default:
        break;
    }

    for (sym = out->S->symbols; sym; sym = sym->link) {
        switch (sym->kind) {
        case fb_is_table:
            fb_compound_name((fb_compound_type_t *)sym, &snt);
            fprintf(out->fp,
                    "static void __%s_print_json_table(flatcc_json_printer_t *ctx, flatcc_json_printer_table_descriptor_t *td);\n",
                    snt.text);
        }
    }
    fprintf(out->fp, "\n");
    return 0;
}
Пример #22
0
int main(void)
{
	board_init();

	puts("\n\nOSMOCOM Compal DSP Dumper (revision " GIT_REVISION ")\n");
	puts(hr);

	/* Dump device identification */
	dump_dev_id();
	puts(hr);

	fb_clear();

	fb_setfg(FB_COLOR_BLACK);
	fb_setbg(FB_COLOR_WHITE);
	fb_setfont(FB_FONT_HELVB14);

	fb_gotoxy(2,20);
	fb_putstr("DSP Dump",framebuffer->width-4);

	fb_setfg(FB_COLOR_RED);
	fb_setbg(FB_COLOR_BLUE);

	fb_gotoxy(2,25);
	fb_boxto(framebuffer->width-3,38);

	fb_setfg(FB_COLOR_WHITE);
	fb_setfont(FB_FONT_HELVR08);
	fb_gotoxy(8,33);
	fb_putstr("osmocom-bb",framebuffer->width-4);

	fb_flush();

	/* Dump DSP content */
	dsp_dump();

	while (1) {
		osmo_timers_update();
	}
}
Пример #23
0
/*
 * Bootmenu frame
 */
void bootmenu_frame(void)
{
	/* Centered */
	char buffer[TEXT_LINE_CHARS+1];
	const char* hint = "Use volume keys to highlight, power to select.";
	int i;
	int l = strlen(hint);
	
	/* clear screen */
	fb_clear();
	
	/* set status */
	fb_set_status("Bootmenu Mode");
	
	/* Draw hint */
	for (i = 0; i < (TEXT_LINE_CHARS - l) / 2; i++)
		buffer[i] = ' ';

	strncpy(&(buffer[(TEXT_LINE_CHARS - l) / 2]), hint, l);
	fb_printf(buffer);
	fb_printf("\n\n\n");
}
Пример #24
0
HIDDEN int
mem_clear(FBIO *ifp, unsigned char *pp)
{
    RGBpixel v;
    register int n;
    register unsigned char *cp;

    if (pp == RGBPIXEL_NULL) {
	v[RED] = v[GRN] = v[BLU] = 0;
    } else {
	v[RED] = (pp)[RED];
	v[GRN] = (pp)[GRN];
	v[BLU] = (pp)[BLU];
    }

    cp = MI(ifp)->mem;
    if (v[RED] == v[GRN] && v[RED] == v[BLU]) {
	int bytes = ifp->if_width*ifp->if_height*3;
	if (v[RED] == 0)
	    memset((char *)cp, 0, bytes);	/* all black */
	else
	    memset(cp, v[RED], bytes);	/* all grey */
    } else {
	for (n = ifp->if_width*ifp->if_height; n; n--) {
	    *cp++ = v[RED];
	    *cp++ = v[GRN];
	    *cp++ = v[BLU];
	}
    }
    if (MI(ifp)->write_thru) {
	return fb_clear(MI(ifp)->fbp, pp);
    } else {
	MI(ifp)->mem_dirty = 1;
    }
    return 0;
}
Пример #25
0
/*
 * Removal of duplicate inclusions is only for a cleaner output - it is
 * not stricly necessary because the preprocessor handles include
 * guards. The guards are required to deal with concatenated files
 * regardless unless we generate special code for concatenation.
 */
void fb_gen_c_includes(output_t *out, const char *ext, const char *extup)
{
    fb_include_t *inc = out->S->includes;
    char *basename, *basenameup, *s;
    str_set_t set;

    fb_clear(set);

    /* Don't include our own file. */
    str_set_insert_item(&set, fb_copy_path(out->S->basenameup, -1), ht_keep);
    while (inc) {
        checkmem((basename = fb_create_basename(
                    inc->name.s.s, inc->name.s.len, out->opts->default_schema_ext)));
        inc = inc->link;
        checkmem((basenameup = fb_copy_path(basename, -1)));
        s = basenameup;
        while (*s) {
            *s = toupper(*s);
            ++s;
        }
        if (str_set_insert_item(&set, basenameup, ht_keep)) {
            free(basenameup);
            free(basename);
            continue;
        }
        /* The include guard is needed when concatening output. */
        fprintf(out->fp,
            "#ifndef %s%s\n"
            "#include \"%s%s\"\n"
            "#endif\n",
            basenameup, extup, basename, ext);
        free(basename);
        /* `basenameup` stored in str_set. */
    }
    str_set_destroy(&set, _str_set_destructor, 0);
}
Пример #26
0
static void refresh_display(void)
{
	char text[16];

	fb_clear();

	/* header */
	fb_setbg(FB_COLOR_WHITE);
	if (mode != MODE_SPECTRUM && !(mode == MODE_SYNC && cursor < 0)) {
		fb_setfg(FB_COLOR_BLUE);
		fb_setfont(FB_FONT_HELVR08);
		fb_gotoxy(0, 7);
		fb_putstr("Osmocom Monitor Tool", -1);
		fb_gotoxy(0, 10);
		fb_setfg(FB_COLOR_GREEN);
		fb_boxto(framebuffer->width - 1, 10);
	}
	fb_setfg(FB_COLOR_BLACK);
	fb_setfont(FB_FONT_C64);

	/* RACH */
	if (mode == MODE_RACH) {
		unsigned long elapsed = jiffies - rach_when;

		fb_gotoxy(0,28);
		switch (assign) {
		case ASSIGN_NONE:
			fb_putstr("Rach sent...", -1);
			break;
		case ASSIGN_RESULT:
			sprintf(text, "TA = %d", ta);
			fb_putstr(text, -1);
			fb_gotoxy(0,36);
			sprintf(text, "(%dm)", ta * 554);
			fb_putstr(text, -1);
			break;
		case ASSIGN_REJECT:
			fb_putstr("Rejected!", -1);
			break;
		case ASSIGN_NO_TX:
			fb_putstr("TX disabled", -1);
			break;
		case ASSIGN_TIMEOUT:
			fb_putstr("Timeout", -1);
			break;
		}
		switch (assign) {
		case ASSIGN_RESULT:
		case ASSIGN_REJECT:
			fb_gotoxy(0,44);
			sprintf(text, "Delay:%ldms", elapsed * 1000 / HZ);
			fb_putstr(text, -1);
			break;
		default:
			break;
		}
	}

	/* SYNC / UL levels */
	if (mode == MODE_SYNC && cursor < 0) {
		int i, tn, l;
		int offset = (framebuffer->width - 96) >> 1;
		int height = framebuffer->height - 25;

		fb_setfont(FB_FONT_HELVR08);
		for (i = 0; i < 8; i++) {
			if (uplink)
				tn = (i + 3) & 7; /* UL is shifted by 3 */
			else
				tn = i;
			fb_setbg(FB_COLOR_WHITE);
			fb_gotoxy(offset + 12 * i, 7);
			l = (max) ? ul_max[tn] : ul_levels[tn];
			l = 110 - l;
			if (l >= 100)
				l -= 100;
			sprintf(text, "%02d", l);
			fb_putstr(text, framebuffer->width);
			fb_setbg(FB_COLOR_BLACK);
			fb_gotoxy(offset + 3 + 12 * i, height + 10);
			fb_boxto(offset + 3 + 12 * i + 5, height + 10 - ul_levels[tn] * height / 64);
			if (max) {
				fb_gotoxy(offset + 3 + 12 * i, height + 10 - ul_max[tn] * height / 64);
				fb_boxto(offset + 3 + 12 * i + 5, height + 10 - ul_max[tn] * height / 64);
			}
		}
		fb_setbg(FB_COLOR_TRANSP);
		if (max) {
			fb_setfg(FB_COLOR_RED);
			fb_gotoxy(framebuffer->width - 16, 15);
			fb_putstr("max", framebuffer->width);
		}
		fb_setfont(FB_FONT_C64);
		fb_setfg(FB_COLOR_BLUE);
		fb_gotoxy(0, 16);
		if (pcs && ul_arfcn >= PCS_MIN && ul_arfcn <= PCS_MAX)
			sprintf(text, "%4dP", ul_arfcn);
		else if (ul_arfcn >= DCS_MIN && ul_arfcn <= DCS_MAX)
			sprintf(text, "%4dD", ul_arfcn);
		else
			sprintf(text, "%4d ", ul_arfcn);
		fb_putstr(text, framebuffer->width);
		fb_setbg(FB_COLOR_WHITE);
		fb_setfg(FB_COLOR_BLACK);
	}
static bool_t
display_Cells(long int ncells)
{
    Cell *gp, *ep = &grid[ncells];
    static int zoom;
    unsigned char *buf;
    static RGBpixel pixel;
    double lasty = -INFINITY;
    double dx, dy;
    int y_0 = 0, y_1;

    if (compute_fb_height) {
	dy = ((ymax - ymin) / cell_size + 1.0) * (hgt + grid_flag);
	if (compute_fb_height == SNUG_FIT)
	    fb_height = dy + (key_flag * 2 * hgt) + yorigin;
	else if (dy > LORES)	/* LOOSE_FIT */
	    fb_height = HIRES;
	else
	    fb_height = LORES;
    }
    if (compute_fb_width) {
	dx = ((xmax - xmin) / cell_size + 1.0) * (wid + grid_flag);
	if (compute_fb_width == SNUG_FIT)
	    fb_width = dx + xorigin;
	else if (dx > LORES)	/* LOOSE_FIT */
	    fb_width = HIRES;
	else
	    fb_width = LORES;
    }

    zoom = 1;
    fbiop = fb_open((fbfile[0] != '\0') ? fbfile : NULL, fb_width, fb_height);
    if (fbiop == FB_NULL)
	return 0;
    if (compute_fb_height || compute_fb_width) {
	bu_log("fb_size requested: %d %d\n", fb_width, fb_height);
	fb_width = fb_getwidth(fbiop);
	fb_height = fb_getheight(fbiop);
	bu_log("fb_size obtained: %d %d\n", fb_width, fb_height);
    }
    if (fb_wmap(fbiop, COLORMAP_NULL) == -1)
	bu_log("Cannot initialize color map\n");
    if (fb_zoom(fbiop, zoom, zoom) == -1)
	bu_log("Cannot set zoom <%d, %d>\n", zoom, zoom);
    if (erase_flag && fb_clear(fbiop, BACKGROUND) == -1)
	bu_log("Cannot clear frame buffer\n");

    buf = (unsigned char *) bu_malloc(sizeof(RGBpixel) * fb_width,
				      "line of frame buffer");
    if (debug_flag & CFB_DBG_MEM)
	bu_log("buf = %p... %d pixels @ %lu bytes/pixel\n",
	       (void *)buf, fb_width, sizeof(RGBpixel));

    for (gp = grid; gp < ep; gp++) {
	int x0, x1;

	/* Whenever Y changes, write out row of cells. */
	if (!ZERO(lasty - gp->c_y)) {
	    /* If first time, nothing to write out. */
	    if (!ZERO(lasty - INFINITY)) {
		if (debug_flag & CFB_DBG_GRID)
		    bu_log("%g = V2SCRY(%g)\n", V2SCRY(lasty), lasty);
		y_0 = V2SCRY(lasty);
		if (y_0 >= 0 && y_0 < fb_height) {
		    for (y_1 = y_0 + hgt; y_0 < y_1; y_0++)
			if (fb_write(fbiop, 0, y_0, buf, fb_width) == -1) {
			    bu_log("Couldn't write to <%d, %d>\n", 0, y_0);
			    (void) fb_close(fbiop);
			    return 0;
			}
		}
	    }
	    /* Clear buffer. */
	    for (x0 = 0; x0 < fb_width; x0++) {
		COPYRGB(&buf[3*x0], BACKGROUND);
	    }

	    /* Draw grid line between rows of cells. */
	    if (grid_flag && !ZERO(lasty - INFINITY)) {
		if (fb_write(fbiop, 0, y_0, buf, fb_width) == -1) {
		    bu_log("Couldn't write to <%d, %d>\n", 0, y_0);
		    (void) fb_close(fbiop);
		    return 0;
		}
		if (debug_flag & CFB_DBG_GRID)
		    bu_log("Writing grid row at %d\n", y_0);
	    }
	    lasty = gp->c_y;
	}
	val_To_RGB(gp->c_val, pixel);
	/* Be careful only to write color within bounds of the screen */
	x0 = H2SCRX(gp->c_x);
	if (x0 >= 0 && x0 <= fb_width - wid) {
	    for (x1 = x0 + wid; x0 < x1;  x0++) {
		COPYRGB(&buf[3*x0], pixel);
	    }
	}
    }

    /* Write out last row of cells. */
    if (debug_flag & CFB_DBG_GRID)
	bu_log("%g = V2SCRY(%g)\n", V2SCRY(lasty), lasty);
    for (y_0 = V2SCRY(lasty), y_1 = y_0 + hgt; y_0 < y_1;  y_0++)
	if (fb_write(fbiop, 0, y_0, buf, fb_width) == -1) {
	    bu_log("Couldn't write to <%d, %d>\n", 0, y_0);
	    (void) fb_close(fbiop);
	    return 0;
	}
    /* Draw color key. */
    if (key_flag && (fb_width < (10 + 1) * wid))
	bu_log("Width of key (%d) would exceed frame-buffer width (%d)\n",
	       (10 + 1) * wid, fb_width);
    else if (key_flag) {
	int i, j;
	double base;
	int scr_min, scr_max;
	int scr_center;	/* screen coord of center of view */
	int center_cell;	/* cell # of center of view */

	/* Clear buffer. */
	for (i = 0; i < fb_width; i++) {
	    COPYRGB(&buf[3*i], BACKGROUND);
	}
	/* Center the color key from side-to-side in the viewport.
	 * Find screen coords of min and max vals, clip to (0, fb_width).
	 * If there are fewer than 11 cells, the run the key
	 * from the left edge to beyond the right edge.
	 */
	scr_min = H2SCRX(xmin);
	scr_max = H2SCRX(xmax);
	CLAMP(scr_min, 0, fb_width);
	CLAMP(scr_max, 0, fb_width);

	scr_center = (scr_max + scr_min)/2;
	if ((center_cell = VPX2CX(SCRX2VPX(scr_center))) < 5)
	    center_cell = 5;

	/* Draw 10 cells for the color key */
	dom_cvt = 10.0;
	for (i = 0; i <= 10; i++) {
	    cell_val cv;

	    /*
	     * Determine where to start the key,
	     * being careful not to back up beyond the beginning of buf.
	     */
	    base = VPX2SCRX(CX2VPX(center_cell - 10/2 + i));

	    cv.v_scalar = i / 10.0;

	    val_To_RGB(cv, pixel);
	    for (j = 0; j < wid; j++) {
		int idx = base + j;
		COPYRGB(&buf[3*idx], pixel);
	    }
	}
	dom_cvt = 10.0 / (dom_max - dom_min);

	for (i = yorigin; i < yorigin+hgt; i++)
	    if (fb_write(fbiop, 0, i, buf, fb_width) == -1) {
		bu_log("Couldn't write to <%d, %d>\n", 0, i);
		(void) fb_close(fbiop);
		return 0;
	    }
    }
    (void) fb_close(fbiop);

    bu_free((char *) buf, "line of frame buffer");
    if (debug_flag & CFB_DBG_MEM)
	bu_log("freed buf, which is now %p\n", (void *)buf);
    return 1;
}
Пример #28
0
/*
  DoFile - process UNIX plot file

  This routine reads UNIX plot records from the specified file
  and controls the entry of the strokes into the descriptor lists.
  Strokes are limited (not clipped) to fit the frame.

  Upon end of file, erase, or flush, plot data is copied to the device.
  Returns status code:
  < 0	=> catastrophe
  = 0	=> complete success
  > 0	=> line limit hit
*/
static int
DoFile(void)	/* returns vpl status code */
{
    register bool	plotted;	/* false => empty frame image */
    register int	c;		/* input character */
    static coords	newpos; 	/* current input coordinates */
    static coords	virpos; 	/* virtual pen position */
    static unsigned char buf3[6*2];
    static unsigned char buf2[4*2];
    static	bool	firsterase = true;

    /* process each frame into a raster image file */

    for (;;)			/* for each frame */
    {
	InitDesc();		/* empty descriptor lists */

	virpos.x = virpos.y = 0;
	plotted = false;

	for (;;)		/* read until EOF*/
	{
	    c = getc( pfin );
	    if ( debug > 1 )  fprintf(stderr, "%c\n", c);
	    switch ( c )
	    {
		/* record type */
		case EOF:
		    if ( debug ) fprintf( stderr, "EOF\n");

		    if ( plotted )  {
			/* flush strokes */
			if ( debug ) fprintf( stderr, "flushing\n");
			if ( !OutBuild() )
			    return Foo( -6 );
		    }
		    return Foo( 0 );/* success */

		case 'e':	/* erase */
		    if ( debug )  fprintf( stderr, "Erase\n");

		    if ( plotted )  {
			/* flush strokes */
			if ( debug ) fprintf( stderr, "flushing\n");
			if ( !OutBuild() )
			    return Foo( -6 );
		    }
		    if ( !firsterase ) {
			if ( immediate )
			    fb_clear( fbp, RGBPIXEL_NULL );
			over = 0;
		    }
		    firsterase = false;
		    break;	/* next frame */

		case 'F':	/* flush */
		    if ( debug )  fprintf( stderr, "Flush\n");

		    if ( plotted )  {
			/* flush strokes */
			if ( debug ) fprintf( stderr, "flushing\n");
			if ( !OutBuild() )
			    return Foo( -6 );
			if ( !immediate )
			    over = 1;
		    }
		    firsterase = false;
		    break;	/* next frame */

		case 'f':	/* linemod */
		    if (debug)
			fprintf( stderr, "linemod\n");
		    /* ignore for time being */
		    while ( (c = getc( pfin )) != EOF
			    && c != '\n'
			)
			;	/* eat string */
		    continue;

		case 'L':
		case 'M':
		    if ( !Get3Coords( &newpos ) )
			return Foo( -8 );
		    virpos = newpos;
		    if ( c == 'M'  )  {
			if ( debug )
			    fprintf( stderr, "Move3\n");
			continue;
		    }
		    if ( debug )
			fprintf( stderr, "Line3\n");

		case 'N':	/* continue3 */
		case 'P':	/* point3 */
		    if ( !Get3Coords( &newpos ) )
			return Foo( -9 );
		    if ( c == 'P' )  {
			if ( debug )
			    fprintf( stderr, "point3\n");
			virpos = newpos;
		    } else
			if ( debug )
			    fprintf( stderr, "cont3\n");

		    if ( !BuildStr( &virpos, &newpos ) )
			return Foo( -10 );
		    plotted = true;
		    virpos = newpos;
		    continue;

		case 'l':	/* line */
		case 'm':	/* move */
		    if ( !GetCoords( &newpos ) )
			return Foo( -8 );
		    virpos = newpos;
		    if ( c == 'm' )  {
			if ( debug )
			    fprintf( stderr, "move\n");
			continue;
		    }
		    /* line: fall through */
		    if ( debug )
			fprintf( stderr, "line\n");

		case 'n':	/* cont */
		case 'p':	/* point */
		    if ( !GetCoords( &newpos ) )
			return Foo( -9 );
		    if ( c == 'p' )  {
			if ( debug )
			    fprintf( stderr, "point\n");
			virpos = newpos;
		    } else
			if ( debug )
			    fprintf( stderr, "cont\n");

		    if ( !BuildStr( &virpos, &newpos ) )
			return Foo( -10 );
		    plotted = true;
		    virpos = newpos;
		    continue;

		    /* IEEE */
		case 'V':
		case 'O':
		    if ( !Get3DCoords( &newpos ) )
			return Foo( -8 );
		    virpos = newpos;
		    if ( c == 'O'  )  {
			if ( debug )
			    fprintf( stderr, "dMove3\n");
			continue;
		    }
		    if ( debug )
			fprintf( stderr, "dLine3\n");

		case 'Q':	/* continue3 */
		case 'X':	/* point3 */
		    if ( !Get3DCoords( &newpos ) )
			return Foo( -9 );
		    if ( c == 'X' )  {
			if ( debug )
			    fprintf( stderr, "dpoint3\n");
			virpos = newpos;
		    } else
			if ( debug )
			    fprintf( stderr, "dcont3\n");

		    if ( !BuildStr( &virpos, &newpos ) )
			return Foo( -10 );
		    plotted = true;
		    virpos = newpos;
		    continue;

		case 'v':	/* line */
		case 'o':	/* move */
		    if ( !GetDCoords( &newpos ) )
			return Foo( -8 );
		    virpos = newpos;
		    if ( c == 'o' )  {
			if ( debug )
			    fprintf( stderr, "dmove\n");
			continue;
		    }
		    /* line: fall through */
		    if ( debug )
			fprintf( stderr, "dline\n");

		case 'q':	/* cont */
		case 'x':	/* point */
		    if ( !GetDCoords( &newpos ) )
			return Foo( -9 );
		    if ( c == 'x' )  {
			if ( debug )
			    fprintf( stderr, "dpoint\n");
			virpos = newpos;
		    } else
			if ( debug )
			    fprintf( stderr, "dcont\n");

		    if ( !BuildStr( &virpos, &newpos ) )
			return Foo( -10 );
		    plotted = true;
		    virpos = newpos;
		    continue;

		case 'W':
		{
		    unsigned char	in[6*8];
		    double	out[6];
		    if ( debug )
			fprintf( stderr, "dspace3\n");
		    if ( fread( in, sizeof(in), 1, pfin) != 1 )
			return Foo( -11 );
		    ntohd( (unsigned char *)out, in, 5 );
		    /* Only need X and Y, ignore Z */
		    space.left  = out[0]; /* x1 */
		    space.bottom= out[1]; /* y1 */
		    /* z1 */
		    space.right = out[3]; /* x2 */
		    space.top   = out[4]; /* y2 */
		    /* z2 */
		    goto spacend;
		}

		case 'w':	/* space */
		{
		    unsigned char	in[4*8];
		    double	out[4];
		    if ( debug )
			fprintf( stderr, "dspace\n");
		    if ( fread( in, sizeof(in), 1, pfin) != 1 )
			return Foo( -11 );
		    ntohd( (unsigned char *)out, in, 4 );
		    space.left  = out[0]; /* x1 */
		    space.bottom= out[1]; /* y1 */
		    space.right = out[2]; /* x2 */
		    space.top   = out[3]; /* y2 */
		    goto spacend;
		}

		case 'S':
		{
		    if ( debug )
			fprintf( stderr, "space3\n");
		    if ( fread( (char *)buf3,
				(int)sizeof buf3, 1, pfin)
			 != 1
			)
			return Foo( -11 );
		    /* Only need X and Y, ignore Z */
		    space.left  = sxt16((long)(buf3[1]<<8) | buf3[0]); /* x1 */
		    space.bottom= sxt16((long)(buf3[3]<<8) | buf3[2]); /* y1 */
		    /* z1 */
		    space.right = sxt16((long)(buf3[7]<<8) | buf3[6]); /* x2 */
		    space.top   = sxt16((long)(buf3[9]<<8) | buf3[8]); /* y2 */
		    /* z2 */
		    goto spacend;
		}

		case 's':	/* space */
		    if ( debug )
			fprintf( stderr, "space\n");
		    {
			if ( fread( (char *)buf2,
				    (int)sizeof buf2, 1, pfin
				 ) != 1
			    )
			    return Foo( -11 );
			space.left  = sxt16((long)(buf2[1]<<8) | buf2[0]); /* x1 */
			space.bottom= sxt16((long)(buf2[3]<<8) | buf2[2]); /* y1 */
			space.right = sxt16((long)(buf2[5]<<8) | buf2[4]); /* x2 */
			space.top   = sxt16((long)(buf2[7]<<8) | buf2[6]); /* y2 */
		    }

	    spacend:
		    delta = space.right - space.left;
		    deltao2 = space.top - space.bottom;
		    if ( deltao2 > delta )
			delta = deltao2;
		    if ( delta <= 0 )  {
			fprintf( stderr, "pl-fb: delta = %g, bad space()\n", delta );
			return Foo( -42 );
		    }
		    deltao2 = delta / 2.0;
		    if ( debug )
			fprintf( stderr, "Space: X=(%g,%g) Y=(%g,%g) delta=%g\n",
				 space.left, space.right,
				 space.bottom, space.top,
				 delta );
		    continue;

		case 'C':	/* color */
		    if ( fread( cur_color, 1, 3, pfin) != 3 )
			return Foo( -11 );
		    if ( debug )
			fprintf( stderr, "Color is R%d G%d B%d\n",
				 cur_color[RED],
				 cur_color[GRN],
				 cur_color[BLU]);
		    continue;

		case 't':	/* label */
		    if ( debug )
			fprintf( stderr, "label: ");

		    newpos = virpos;
		    while ( (c = getc( pfin )) != EOF && c != '\n'
			)  {
			/* vectorize the characters */
			put_vector_char( c, &newpos);

			if ( debug )
			    putc( c, stderr );
		    }

		    plotted = true;
		    virpos = newpos;
		    continue;

		    /* discard the deadwood */
		case 'c':
		{
		    char buf[3*2];
		    if ( fread(buf, sizeof(buf), 1, pfin) != 1 )
			return Foo( -11 );
		    if ( debug )
			fprintf( stderr, "circle ignored\n" );
		    continue;
		}
		case 'i':
		{
		    char buf[3*8];
		    if ( fread(buf, sizeof(buf), 1, pfin) != 1 )
			return Foo( -11 );
		    if ( debug )
			fprintf( stderr, "d_circle ignored\n" );
		    continue;
		}
		case 'a':
		{
		    char buf[6*2];
		    if ( fread(buf, sizeof(buf), 1, pfin) != 1 )
			return Foo( -11 );
		    if ( debug )
			fprintf( stderr, "arc ignored\n" );
		    continue;
		}
		case 'r':
		{
		    char buf[6*8];
		    if ( fread(buf, sizeof(buf), 1, pfin) != 1 )
			return Foo( -11 );
		    if ( debug )
			fprintf( stderr, "d_arc ignored\n" );
		    continue;
		}

		default:
		    fprintf( stderr, "bad command '%c' (0x%02x)\n", c, c );

		    return Foo( -12 );	/* bad input */
	    }
	    break;
	}		/* next input record */
    }			/* next frame */
}
Пример #29
0
/*
 *  M A I N
 *
 *	Parse arguments, valid ones are:
 *		name of file to plot (instead of STDIN)
 *		-d for debugging statements
 *
 *	Default (no arguments) action is to plot STDIN on current FB.
 */
int
main(int argc, char **argv)
{
    Nscanlines = Npixels = 512;

    if ( !get_args( argc, argv ) )  {
	(void)fputs(usage, stderr);
	bu_exit( 1, NULL );
    }

    /* Open frame buffer, adapt to slightly smaller ones */
    if ( (fbp = fb_open(framebuffer, Npixels, Nscanlines)) == FBIO_NULL ) {
	fprintf(stderr, "pl-fb: fb_open failed\n");
	bu_exit(1, NULL);
    }
    Npixels = fb_getwidth(fbp);
    Nscanlines = fb_getheight(fbp);
    if ( immediate )  {
	lines_per_band = Nscanlines;
	if ( !over )
	    fb_clear( fbp, RGBPIXEL_NULL );
    } else if ( Nscanlines <= 512 ) {
	/* make one full size band */
	lines_per_band = Nscanlines;
	single_banded = 1;
    }

    /*
     * Handle image-size specific initializations
     */
    if ( (Nscanlines % lines_per_band) != 0 )  {
	/* round it down - only necessary if buffered? */
	Nscanlines = (Nscanlines / lines_per_band) * lines_per_band;
    }
    space.left = space.right = 0;
    space.right = Npixels;
    space.top = Nscanlines;
    delta = Nscanlines;
    deltao2 = Nscanlines/2;

    buffersize = lines_per_band*Npixels*sizeof(RGBpixel);
    if ( (buffer = (unsigned char *)malloc(buffersize)) == RGBPIXEL_NULL)  {
	fprintf(stderr, "pl-fb:  malloc error\n");
	bu_exit(1, NULL);
    }
    /* Extra band protects against requeueing off the top */
    band = (struct band *)malloc((BANDSLOP)*sizeof(struct band));
    if ( band == (struct band *)0 )  {
	fprintf(stderr, "pl-fb: malloc error2\n");
	bu_exit(1, NULL);
    }
    memset((char *)band, 0, (BANDSLOP)*sizeof(struct band));
    bandEnd = &band[BANDS];
    if ( single_banded && over ) {
	/* Read in initial screen */
	if ( fb_read( fbp, 0, 0, buffer, buffersize/sizeof(RGBpixel) ) <= 0 )
	    fprintf(stderr, "pl-fb: band read error\n");
    }
    if ( debug )
	fprintf(stderr, "pl-fb output of %s\n", filename);

    SetSigs();			/* set signal catchers */

    (void)DoFile( );	/* plot it */
    bu_exit(0, NULL);
}
Пример #30
0
static void
fb_docmd(WINDISPLAY *mod, struct TVRequest *req)
{
	switch (req->tvr_Req.io_Command)
	{
		case TVCMD_OPENWINDOW:
			fb_openwindow(mod, req);
			break;
		case TVCMD_CLOSEWINDOW:
			fb_closewindow(mod, req);
			break;
		case TVCMD_OPENFONT:
			fb_openfont(mod, req);
			break;
		case TVCMD_CLOSEFONT:
			fb_closefont(mod, req);
			break;
		case TVCMD_GETFONTATTRS:
			fb_getfontattrs(mod, req);
			break;
		case TVCMD_TEXTSIZE:
			fb_textsize(mod, req);
			break;
		case TVCMD_QUERYFONTS:
			fb_queryfonts(mod, req);
			break;
		case TVCMD_GETNEXTFONT:
			fb_getnextfont(mod, req);
			break;
		case TVCMD_SETINPUT:
			fb_setinput(mod, req);
			break;
		case TVCMD_GETATTRS:
			fb_getattrs(mod, req);
			break;
		case TVCMD_SETATTRS:
			fb_setattrs(mod, req);
			break;
		case TVCMD_ALLOCPEN:
			fb_allocpen(mod, req);
			break;
		case TVCMD_FREEPEN:
			fb_freepen(mod, req);
			break;
		case TVCMD_SETFONT:
			fb_setfont(mod, req);
			break;
		case TVCMD_CLEAR:
			fb_clear(mod, req);
			break;
		case TVCMD_RECT:
			fb_rect(mod, req);
			break;
		case TVCMD_FRECT:
			fb_frect(mod, req);
			break;
		case TVCMD_LINE:
			fb_line(mod, req);
			break;
		case TVCMD_PLOT:
			fb_plot(mod, req);
			break;
		case TVCMD_TEXT:
			fb_drawtext(mod, req);
			break;
		case TVCMD_DRAWSTRIP:
			fb_drawstrip(mod, req);
			break;
		case TVCMD_DRAWTAGS:
			fb_drawtags(mod, req);
			break;
		case TVCMD_DRAWFAN:
			fb_drawfan(mod, req);
			break;
		case TVCMD_COPYAREA:
			fb_copyarea(mod, req);
			break;
		case TVCMD_SETCLIPRECT:
			fb_setcliprect(mod, req);
			break;
		case TVCMD_UNSETCLIPRECT:
			fb_unsetcliprect(mod, req);
			break;
		case TVCMD_DRAWBUFFER:
			fb_drawbuffer(mod, req);
			break;
		default:
			TDBPRINTF(TDB_INFO,("Unknown command code: %08x\n",
			req->tvr_Req.io_Command));
	}
}