[comp.windows.x] X11R3 on Pyramid

S.Davey@CS.UCL.AC.UK (05/05/89)

I'm currently trying to compile X11R3 for our Pyramid
(running OSx4.2) but am having problems with the
Athena Widget Library (Xaw) so I sent the following 
message to mark@nz.ac.vuw.comp but the message was
undelivered, if anyone has a solution to compiling Xaw
I'd be gratetful for any response.

Steve Davey
systems group
Dept Comp Science
UCL
-------------------------
To: mark@nz.ac.vuw.comp
cc: sjd@uk.ac.ucl.cs
Subject: X11R3 on Pyramid
Date: Thu, 04 May 89 18:36:10 +0100
From: S.Davey@uk.ac.ucl.cs

I received a forwarded message which you sent out in December 
concerning installation of X11R3 on Pyramids.
I followed the instructions given in your message 
(i.e I altered Login.h for Xdm and also created
pyr.macros ) but I can't get the Athena widget set
Xawlib.a to compile. The compiler fails on 
AsciiSink.c and complains that line 58 of TextSrcP.h has
a missing semi-colon but on investigation there is no
missing semi-colon.
I wondered whether you came across this problem, if so
I'd be very grateful if you let me know the solution.
Were running OSx4.2 on the pyramid and I've applied 
patches 1 to 8  as currently available from expo.lcs.mit.edu.

Steve Davey  
Systems Group
Dept Computer Science
University College London
tel +44-1-380-7280
email S.Davey@cs.ucl.ac.uk

mcfong@unisoft.UUCP (Martin C. Fong) (05/07/89)

In article <8905051503.AA07259@expo.lcs.mit.edu> S.Davey@CS.UCL.AC.UK writes:
>
> [ ... stuff deleted ... ]
>
>The compiler fails on 
>AsciiSink.c and complains that line 58 of TextSrcP.h has
>a missing semi-colon but on investigation there is no
>missing semi-colon.
>
> [ ... stuff deleted ... ]
>
>Steve Davey  
>Systems Group
>Dept Computer Science
>University College London
>tel +44-1-380-7280
>email S.Davey@cs.ucl.ac.uk

The Pyramid C compiler has some trouble with a traditional pointer to
function declaration (ie. " int (*foo)(); ") within a structure
declaration.  The problem appears to be a variable/type name space
scoping problem.  For example, the following will not work:

	typedef	int	foo;
	typedef struct	bar
	{
	      int	(*foo)();
	};

The new type "foo" for some reasons collides with the structure
variable "foo".  However, this code will work if re-written as:

	typedef	int	foo;
+	typedef	(*IntFuPtr)();
	typedef struct	bar
	{
!	      IntFuPtr	foo;
	};

Below is my patch to "TextSrcP.h" which will work around this problem.
I don't seem to have any trouble with "AsciiSink.c".  Care to elaborate
on what the compiler burped on?

*** TextSrcP.h.old	Sat May  6 12:23:30 1989
--- TextSrcP.h.new	Sat May  6 12:21:47 1989
***************
*** 52,61 ****
--- 52,69 ----
      caddr_t		data;	    
      };
  
+ #ifdef pyr
+     typedef int (*IntFuPtr) ();
+ #endif pyr
+ 
  typedef struct _XtTextSink {
      XFontStruct	*font;
      int foreground;
+ #ifdef pyr
+     IntFuPtr Display;
+ #else pyr
      int (*Display)();
+ #endif pyr
      int (*InsertCursor)();
      int (*ClearToBackground)();
      int (*FindPosition)();

jim@eda.com (Jim Budler) (05/07/89)

In article <8905051503.AA07259@expo.lcs.mit.edu> S.Davey@CS.UCL.AC.UK writes:
# I'm currently trying to compile X11R3 for our Pyramid
# (running OSx4.2) but am having problems with the
# Athena Widget Library (Xaw) so I sent the following 
# message to mark@nz.ac.vuw.comp but the message was
# undelivered, if anyone has a solution to compiling Xaw
# I'd be gratetful for any response.
# 
# Steve Davey
[...]
# Xawlib.a to compile. The compiler fails on 
# AsciiSink.c and complains that line 58 of TextSrcP.h has
# a missing semi-colon but on investigation there is no
# missing semi-colon.
[...]
# Steve Davey  
# Systems Group
# Dept Computer Science
# University College London

There is a conflict between the global Display and the struct member
_XtTextSink->Display. The problem is actually due to the compiler. I
solved it (hacked it) by renaming the member to xDisplay in
lib/Xaw/{AsciiSink.c,Text.c,TextSrcP.h} as follows:

*** AsciiSink.c.orig	Sat May  6 14:44:37 1989
--- AsciiSink.c	Sat May  6 14:43:59 1989
***************
*** 411,417
      if (!buf) buf = XtMalloc(bufferSize);
  
      sink = XtNew(XtTextSinkRec);
!     sink->Display = AsciiDisplayText;
      sink->InsertCursor = AsciiInsertCursor;
      sink->ClearToBackground = AsciiClearToBackground;
      sink->FindPosition = AsciiFindPosition;

--- 411,417 -----
      if (!buf) buf = XtMalloc(bufferSize);
  
      sink = XtNew(XtTextSinkRec);
!     sink->xDisplay = AsciiDisplayText;
      sink->InsertCursor = AsciiInsertCursor;
      sink->ClearToBackground = AsciiClearToBackground;
      sink->FindPosition = AsciiFindPosition;
*** Text.c.orig	Sat May  6 15:16:16 1989
--- Text.c	Sat May  6 14:44:00 1989
***************
*** 1091,1097
                  (*ctx->text.sink->ClearToBackground)
  		    (w, 0, y, ctx->text.leftmargin, height);
  	    if (startPos >= ctx->text.s.right || endPos <= ctx->text.s.left) {
! 		(*ctx->text.sink->Display) (w, x, y, startPos, endPos, FALSE);
  	    } else if (startPos >= ctx->text.s.left && endPos <= ctx->text.s.right) {
  		(*ctx->text.sink->Display) (w, x, y, startPos, endPos, TRUE);
  	    } else {

--- 1091,1097 -----
                  (*ctx->text.sink->ClearToBackground)
  		    (w, 0, y, ctx->text.leftmargin, height);
  	    if (startPos >= ctx->text.s.right || endPos <= ctx->text.s.left) {
! 		(*ctx->text.sink->xDisplay) (w, x, y, startPos, endPos, FALSE);
  	    } else if (startPos >= ctx->text.s.left && endPos <= ctx->text.s.right) {
  		(*ctx->text.sink->xDisplay) (w, x, y, startPos, endPos, TRUE);
  	    } else {
***************
*** 1093,1099
  	    if (startPos >= ctx->text.s.right || endPos <= ctx->text.s.left) {
  		(*ctx->text.sink->Display) (w, x, y, startPos, endPos, FALSE);
  	    } else if (startPos >= ctx->text.s.left && endPos <= ctx->text.s.right) {
! 		(*ctx->text.sink->Display) (w, x, y, startPos, endPos, TRUE);
  	    } else {
  		DisplayText(w, startPos, ctx->text.s.left);
  		DisplayText(w, max(startPos, ctx->text.s.left), 

--- 1093,1099 -----
  	    if (startPos >= ctx->text.s.right || endPos <= ctx->text.s.left) {
  		(*ctx->text.sink->xDisplay) (w, x, y, startPos, endPos, FALSE);
  	    } else if (startPos >= ctx->text.s.left && endPos <= ctx->text.s.right) {
! 		(*ctx->text.sink->xDisplay) (w, x, y, startPos, endPos, TRUE);
  	    } else {
  		DisplayText(w, startPos, ctx->text.s.left);
  		DisplayText(w, max(startPos, ctx->text.s.left), 
*** TextSrcP.h.orig	Sat May  6 15:16:25 1989
--- TextSrcP.h	Sat May  6 14:44:00 1989
***************
*** 55,61
  typedef struct _XtTextSink {
      XFontStruct	*font;
      int	foreground;
!     int	(*Display)();
      int	(*InsertCursor)();
      int	(*ClearToBackground)();
      int	(*FindPosition)();

--- 55,61 -----
  typedef struct _XtTextSink {
      XFontStruct	*font;
      int	foreground;
!     int	(*xDisplay)();
      int	(*InsertCursor)();
      int	(*ClearToBackground)();
      int	(*FindPosition)();

-- 
Jim Budler   address = uucp: ...!{decwrl,uunet}!eda!jim
					 domain: jim@eda.com
			 voice	 = +1 408 986-9585
			 fax	 = +1 408 748-1032

mark@comp.vuw.ac.nz (Mark Davies) (05/09/89)

In article <8905051503.AA07259@expo.lcs.mit.edu> S.Davey@CS.UCL.AC.UK writes:
>I'm currently trying to compile X11R3 for our Pyramid
>(running OSx4.2) but am having problems with the
>Athena Widget Library (Xaw) 
  [...]
>To: mark@nz.ac.vuw.comp
>Subject: X11R3 on Pyramid

>I received a forwarded message which you sent out in December 
>concerning installation of X11R3 on Pyramids.
>I followed the instructions given in your message 
>(i.e I altered Login.h for Xdm and also created
>pyr.macros ) but I can't get the Athena widget set
>Xawlib.a to compile. The compiler fails on 
>AsciiSink.c and complains that line 58 of TextSrcP.h has
>a missing semi-colon but on investigation there is no
>missing semi-colon.

Whoops, sorry I forgot about this problem when I posted my instructions.
As other people have pointed out the Pyramid compiler has a name clash
problem between the global Display and the pointer to function Display that
is a member of struct _XtTextSink.

To fix this I renamed the struct member to DisplayX everywhere it occurs
(TextSrcP.h, Text.c and AsciiSink.c).
Martin Fong's fix (Ref: <8905051503.AA07259@expo.lcs.mit.edu>) of defining
a typedef and then using that in the struct looks a better fix, as it
requires only a minimal change to one file.

cheers
mark-- 
Domainised:  mark@comp.vuw.ac.nz	Bang form: ...!uunet!vuwcomp!mark