Пример #1
0
init_vip(char *name)
{
if (name == NULL || name[0] == 0)
	return(0);
if ((vdh.alloced = load_exe(name, &vdh.eh)) != NULL)
	{
	zero_structure(&vdh.vh, sizeof(vdh.vh) );
	vdh.vh.vip_magic = DVIP_MAGIC;
	(*vdh.eh.entry_point)(&vdh.vh, continu_box);
	if (vdh.vh.vip_magic != VIP_MAGIC)
		{
		continu_line("Bad tablet driver protocol.");
		freemem(vdh.alloced);
		return(0);
		}
	if (!(*vdh.vh.init_vip_device)(&vdh.vh, continu_box))
		{
		char *bufs[3];

		bufs[0] = name;
		bufs[1] = "Tablet not attatched";
		bufs[2] = NULL;
		continu_box(bufs);
		freemem(vdh.alloced);
		return(0);
		}
	return(1);
	}
}
Пример #2
0
verify_exe_head(int file, Exe_head *exe)
{
if (!test_exe_head(file, exe))
	{
	continu_line("Not a good tablet driver.");
	return(0);
	}
return(1);
}
Пример #3
0
open_verify_vision()
{
int i;

if ((bopen(vision_name, &vision_bf)) == 0)
	{
	cant_find(vision_name);
	return(0);
	}
if (bread(&vision_bf, &vh, sizeof(vh)) <
	sizeof(vh))
	{
	vitrunc();
	return(0);
	}
linebytes = VWID;
switch (vh.imgdata.pixsiz)
	{
	case 16:
		bap = 2;
		break;
	case 24:
		bap = 3;
		break;
	case 32:
		bap = 4;
		break;
	default:
		continu_box(not_vision_lines);
		return(0);
	}
linebytes *= bap;
switch (vh.imgtype)
    {
	case 2:             /* uncompressed */
		is_compressed = 0;
		break;
	case 10:
		is_compressed = 1;
		break;
	default:
		continu_line(vision_103 /* "Unknown compression type" */);
		return(0);
	}
if ((vh.imgdata.imgdesc & INLEAVE) != 0)
	{
	continu_line(vision_104 /* "Sorry, can't deal with Interleave" */);
	return(0);
	}
if ((buf = lbegmem(linebytes + 130*bap)) == NULL)
	return(0);
over = buf + linebytes;	/* extra at end to make decompression easier */
for (i=0; i<3; i++)
	{
	if ((rgb_bufs[i] = begmem(VWID)) == NULL)
		return(0);
	}
is_flipped = !((vh.imgdata.imgdesc&SCRORG) == SCRORG);
if ((pic_cel = alloc_cel(VWID, vh.imgdata.height,
	vh.imgdata.xorg, vh.imgdata.yorg)) == NULL)
	return(0);
vstart = pic_cel->p;
vnext = pic_cel->bpr;
if (is_flipped)
	{
	vstart = long_to_pt(
		pt_to_long(vstart) + vnext * (vh.imgdata.height-1));
	vnext = -vnext;
	}
data_offset = vh.idlength + sizeof(vh);
if (vh.maptype != 0)
	data_offset += ((vh.cms.mapbits+7)/8)*vh.cms.maplen;
return(1);
}