Пример #1
0
/*	f b _ S e t u p ( )						*/
int
fb_Setup(char *file, int size)
{
    if ( BU_STR_EQUAL( file, "/dev/remote" ) )
	file = "/dev/debug";
    prnt_Event( "Opening device..." );

    if (((fbiop = fb_open(file[0] == '\0' ? NULL : file, size, size)) == FBIO_NULL) ||
	(fb_ioinit( fbiop ) == -1) ||
	(fb_wmap( fbiop, COLORMAP_NULL ) == -1))
	return	0;

    (void) fb_setcursor( fbiop, arrowcursor, 16, 16, 0, 0 );
    (void) fb_cursor( fbiop, 1, size/2, size/2 );

    prnt_Event( (char *) NULL );
    return	1;
}
Пример #2
0
/*
 * Open/create a framebuffer object.
 *
 * Usage:
 *	  fb_open [name device [args]]
 */
HIDDEN int
fbo_open_tcl(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
{
    struct fb_obj *fbop;
    FBIO *ifp;
    int width = 512;
    int height = 512;
    register int c;
    struct bu_vls vls;

    if (argc == 1) {
	/* get list of framebuffer objects */
	for (BU_LIST_FOR(fbop, fb_obj, &HeadFBObj.l))
	    Tcl_AppendResult(interp, bu_vls_addr(&fbop->fbo_name), " ", (char *)NULL);

	return TCL_OK;
    }

    if (argc < 3) {
	bu_vls_init(&vls);
	bu_vls_printf(&vls, "helplib fb_open");
	Tcl_Eval(interp, bu_vls_addr(&vls));
	bu_vls_free(&vls);
	return TCL_ERROR;
    }

    /* process args */
    bu_optind = 3;
    bu_opterr = 0;
    while ((c = bu_getopt(argc, argv, "w:W:s:S:n:N:")) != EOF)  {
	switch (c) {
	    case 'W':
	    case 'w':
		width = atoi(bu_optarg);
		break;
	    case 'N':
	    case 'n':
		height = atoi(bu_optarg);
		break;
	    case 'S':
	    case 's':
		width = atoi(bu_optarg);
		height = width;
		break;
	    case '?':
	    default:
		Tcl_AppendResult(interp, "fb_open: bad option - ",
				 bu_optarg, (char *)NULL);
		return TCL_ERROR;
	}
    }

    if ((ifp = fb_open(argv[2], width, height)) == FBIO_NULL) {
	Tcl_AppendResult(interp, "fb_open: bad device - ",
			 argv[2], (char *)NULL);
    }

    if (fb_ioinit(ifp) != 0) {
	Tcl_AppendResult(interp, "fb_open: fb_ioinit() failed.", (char *) NULL);
	return TCL_ERROR;
    }

    BU_GETSTRUCT(fbop, fb_obj);
    bu_vls_init(&fbop->fbo_name);
    bu_vls_strcpy(&fbop->fbo_name, argv[1]);
    fbop->fbo_fbs.fbs_fbp = ifp;
    fbop->fbo_fbs.fbs_listener.fbsl_fbsp = &fbop->fbo_fbs;
    fbop->fbo_fbs.fbs_listener.fbsl_fd = -1;
    fbop->fbo_fbs.fbs_listener.fbsl_port = -1;

    /* append to list of fb_obj's */
    BU_LIST_APPEND(&HeadFBObj.l, &fbop->l);

    (void)Tcl_CreateCommand(interp,
			    bu_vls_addr(&fbop->fbo_name),
			    (Tcl_CmdProc *)fbo_cmd,
			    (ClientData)fbop,
			    fbo_deleteProc);

    /* Return new function name as result */
    Tcl_ResetResult(interp);
    Tcl_AppendResult(interp, bu_vls_addr(&fbop->fbo_name), (char *)NULL);
    return TCL_OK;
}