[Xr] small adjustments

Bill Spitzak spitzak at d2.com
Tue Jul 8 10:14:11 PDT 2003


On Tuesday 08 July 2003 06:55 am, Carl Worth wrote:
> On Jul 7, Bill Spitzak wrote:
>  > I have not been sucessful in getting Xr to compile without Xrender.
>
> The work has not yet been done to make this possible. That work is
> near the top of my list of tasks to do for Xr. Of course,
> contributions would be welcome.

Sorry about the complaints. I was trying to be constructive but eventually 
got frustrated. I was really hoping to get it to compile and link.

In any case the biggest impediment I see is that the Xr and Xc headers 
themselves depend on symbols defined by Xrender header files.

Some of this is a problem with Xrender itself:

Primarily the fact that it uses things like "XFixed" and "XDouble" rather 
than built-in types. This means it is impossible to write an efficient 
implementation, unless you assumme these are the same as int/double (thus 
defeating the purpose of the typedef), or include the Xrender header file 
(thus pushing the whole problem of conversion up to the program calling Xr 
and solving nothing, and also making Xr non-portable). I strongly recommend 
that such typedefs be removed from all new interfaces to X or other system 
services, they are actually counter-productive.

The other bad part about Xrender is that it uses the "typedef struct _Foo 
{...} Foo;" convention. This makes it impossible to declare functions that 
take pointers to these structures without including Xrender.h. All modern C 
compilers accept "struct Foo {...};" and thus another header file can just 
say "struct Foo;" and make functions that take pointers. However in almost 
all cases I would replace the use of such structures with either individual 
x,y arguments or with arrays of the correct size of built-in types. Although 
not "type safe" such interfaces are much more convienent for efficient glue 
to another drawing library.

Fortunately Xrender has learned not to typedef-hide pointers. I am grateful 
for that.

-- 
                   ,~,~,~,~ ~ ~ ~ ~
     /\_       _|_========___         Bill Spitzak
 ~~~/\/\\~~~~~~\____________/~~~~~~~~ spitzak at d2.com




More information about the cairo mailing list