comp.lang.ada
 help / color / mirror / Atom feed
* porting DEC Ada Motif Binding on Sun with RATIONAL compiler
@ 1994-12-14 17:46 besnard
  1994-12-16 19:43 ` Garlington KE
  0 siblings, 1 reply; 2+ messages in thread
From: besnard @ 1994-12-14 17:46 UTC (permalink / raw)



This is a report of my trying to port DEC Ada Motif on Sun:


host     : SunOS 5.3 (Solaris) sun4m sparc (SPARCclassic)
Compiler : Rational Apex 1.4.3
Motif    : 1.2


Here are the difficulties that I encountered. They are quite similar
as thoses described by  Ph. Kipfer and Robb Nebbe, for the porting
on Sun with ALSYS and SunAda compilers.



- the pragmas INPROVE and INLINE_GENERIC are not recognized.

- the pragma export_procedure has no mechanism parameter in rational
 (it's not important, because all parameter are passed explicitly
  by value in the DEC binding, and they are implicitly
  passed by value in Rational)

- the "PAD : at 0..-1" fields in many representation clause for record
  type definition are rejected by the rational compiler.
  I removed them ...

- there is a type mismatch (just one in all the sources) trying to
  convert an array'address to the system.address type. this occured
  in the function x_lib.get_error_text:

    function Get_Error_Text (Display : in Display_Type; 
	...
	Buffer_Out : Null_Terminated.String (1 .. 65_535);
    begin
	Get_Error_Text (Display, Code, Buffer_Out'Address, Buffer_Out'Length);
	return Null_Terminated.To_String 
		  (C_Types.Char_Pointer (Buffer_Out'Address));  --error
    end Get_Error_Text;

 Rational admited it as a bug, and it will be corrected in the next release.
 Anyway, this problem is easyly bypassed, using an auxiliary variable:

	...
	Buffer_Out : Null_Terminated.String (1 .. 65_535);
	Buffer_Address : System.Address := Buffer_Out'Address;

    begin
	Get_Error_Text (Display, Code, Buffer_Address, Buffer_Out'Length);

	return Null_Terminated.To_String 
		  (C_Types.Char_Pointer (Buffer_Address));
	...



- there is also a  problem of cyclic dependency between a specification
  package (x_lib_support) and its body:

    generic
	type T is private;
	Value : in T;
    function Constant_Function return T;
    pragma Inline (Constant_Function);
    ...
    generic
    package Derived_Quark_Pkg is

	type Quark_Type is new Base_Quark_Type;
	-- function Nul is new Constant_Function 
	--                     (Quark_Type, Quark_Type (Base_Quark_0));

	function Nul return Quark_Type;  -- my correction

    ---> the instanciation of Constant_Function in Nul function seemed
    not to be allowed until the former is truly known. So I replaced
    the instanciation by a declaration of the wanted instance function,
    and put the instanciation in the body:

package body X_Lib_Support is

    function Constant_Function return T is
    begin
	return Value;
    end Constant_Function;

    package body Derived_Quark_Pkg is

	function Nul return Quark_Type is
	    function Nul is new Constant_Function 
				   (Quark_Type, Quark_Type (Base_Quark_0));
	begin
	    return Nul;
	end Nul;



- finally, I got some frightning warnings, like

 --- [MID] Element Span for BITMAP_DATA_TYPE is 8
or
 !!! [MID] Program will raise CONSTRAINT_ERROR (Subtype_Match_Error)
	 at "return TO_TARGET (TO_BITS (S));"
	 (XM_MESSAGE_BOX.TO_POINTER_TYPE.LOCAL_TO_POINTER_TYPE'BODY.2S)
or
 !!! [MID] Unsafe unchecked conversion at "return TO_TARGET (TO_BITS (S));"




I have great difficulties with it, because some programs work well
(like xm_message_box), and some others don't (like xlib_hello).

when running xlib_hello, the program exits, with the report:

---- execute of xlib_hello  ----
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  2 (X_ChangeWindowAttributes)
  Value in failed request:  0xa0814000
  Serial number of failed request:  6
  Current serial number in output stream:  12

When debugging, the error seems to raise in the function NEXT_EVENT.
I'm still trying to find out why.


Help would be welcome ...



-------------------------------------------------------------------------
 Frederic BESNARD		|	tel : (19) 49.49.80.70
   ENSMA / LISI			|	fax : (19) 49.49.80.64
     BP 109			|	e-mail : fb@rabelais.univ-poitiers.fr
86960 FUTUROSCOPE cedex		|
	FRANCE			|
-------------------------------------------------------------------------



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: porting DEC Ada Motif Binding on Sun with RATIONAL compiler
  1994-12-14 17:46 porting DEC Ada Motif Binding on Sun with RATIONAL compiler besnard
@ 1994-12-16 19:43 ` Garlington KE
  0 siblings, 0 replies; 2+ messages in thread
From: Garlington KE @ 1994-12-16 19:43 UTC (permalink / raw)


besnard@zeus.univ-poitiers.fr wrote:
: This is a report of my trying to port DEC Ada Motif on Sun:

: - the pragmas INPROVE and INLINE_GENERIC are not recognized.

I wouldn't think INLINE_GENERIC would be a big deal, since the program
should still operate if it is ignored. What am I missing here?

: - the pragma export_procedure has no mechanism parameter in rational
:  (it's not important, because all parameter are passed explicitly
:   by value in the DEC binding, and they are implicitly
:   passed by value in Rational)

However, the call data parameter of a callback from a widget that
returns a structure (like a file dialog) should be a reference, not a
value. I would assume that this is the case with Rational implicitly
as well, but this would need to be checked.

--------------------------------------------------------------------
Ken Garlington                  GarlingtonKE@lfwc.lockheed.com
F-22 Computer Resources         Lockheed Fort Worth Co.

If LFWC or the F-22 program has any opinions, they aren't telling me.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1994-12-16 19:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-12-14 17:46 porting DEC Ada Motif Binding on Sun with RATIONAL compiler besnard
1994-12-16 19:43 ` Garlington KE

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox