nanogui: Pending patches/bug/requests ... list available on the FTP


Previous by date: 28 May 2005 17:15:56 +0100 [PATCH] no mmap under ecos, Alexander Neundorf
Next by date: 28 May 2005 17:15:56 +0100 Re: usage of posix functions in src/engine/ and src/drivers/, Jachym Holecek
Previous in thread: 28 May 2005 17:15:56 +0100 Re: Pending patches/bug/requests ... list available on the FTP, Alain Volmat
Next in thread: 28 May 2005 17:15:56 +0100 Re: Pending patches/bug/requests ... list available on the FTP, Steven Scholz

Subject: Re: [nanogui] Pending patches/bug/requests ... list available on the FTP
From: Jachym Holecek ####@####.####
Date: 28 May 2005 17:15:56 +0100
Message-Id: <20050528161533.GA17914@merlot.ics.muni.cz>

Hello,

> I'd like to see this one go in, I was about to start writing the same kind of 
> patch. Another option would be to have all drivers register themselves.
> So in each driver file something like
> 
> static void register_me() __attribute__ ((constructor))
> {
>    global_driver_table_append(&my_driver_struct);
> }
> 
> Then the driver selection code in fb.c would turn from a big switch to an 
> iteration over the list of drivers and choose the matching one. This would 
> get rid of the ifdefs in this file.
> 
> Would you consider this a better option ?

In case portability is of concern, you can avoid the __attribute__ quite
easily:

  * Have each driver contain "DEFDRIVER(my_driver_struct)", where DEFDRIVER
    is a no-op macro.

  * At compile time, scan all the driver sources for DEFDRIVER() and have
    a tiny sed+awk/whatever script construct a .c file with the driver
    table.

That's what I do in a private project of mine, and it works reasonable
well. If people think this would be a good way, I'd volunteer to implement
it.

	Regards,
		-- Jachym Holecek

Previous by date: 28 May 2005 17:15:56 +0100 [PATCH] no mmap under ecos, Alexander Neundorf
Next by date: 28 May 2005 17:15:56 +0100 Re: usage of posix functions in src/engine/ and src/drivers/, Jachym Holecek
Previous in thread: 28 May 2005 17:15:56 +0100 Re: Pending patches/bug/requests ... list available on the FTP, Alain Volmat
Next in thread: 28 May 2005 17:15:56 +0100 Re: Pending patches/bug/requests ... list available on the FTP, Steven Scholz


Powered by ezmlm-browse 0.20.