nanogui: Microwindows for Hercules
Subject:
Re: Microwindows for Hercules
From:
Ben Pfaff ####@####.####
Date:
15 Jul 1999 21:37:22 -0000
Message-Id: <87oghdk39j.fsf@pfaffben.user.msu.edu>
Jakob Eriksson ####@####.#### writes:
On Thu, 15 Jul 1999, Perry Harrington wrote:
> Why not take the approach that Linux takes with the module:
>
> Create the driver structure, have the primitives referenced in the
> driver structure. If the driver doesn't implement a primitive, set
> the structure member to NULL, and the driver loader will take care
> to use the builtin function. EG:
>
> struct driver {
> ptr_t hline
> ptr_t vline
> ptr_t bline
> ...
> } DRIVER;
>
> struct driver herc_card[]={
> herc_hline,
> herc_vline,
> NULL
> };
>
> That way you can have driver optimized primitives or rely on the default,
> which just calls write_pixel.
sounds good.
how much would it take to change/add microwin?
If someone's really going to take that approach (I assumed something
like this was already being done), then I recommend modifying it a
little for speed. Instead of leaving NULL in the table and having to
test it each time the function is being called, replace the NULL with
a function pointer. This can either be done in the device driver
directly:
struct driver herc_card[]={
herc_hline,
herc_vline,
generic_line,
};
or it can be done in a function that examines the structure at load
time and patches up any NULLs with real function pointers. This is a
good way to reduce the special cases.
--
"...dans ce pays-ci il est bon de tuer de temps en temps un amiral
pour encourager les autres."
--Voltaire, _Candide_