[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

469.0. "ADA binding" by BREAKR::YUEN () Thu Mar 23 1989 12:09

    Does anynone know if the ADA language binding for DECwindows is
    included in the SDC release of VMS V5.1/VMS DECwindows???

T.RTitleUserPersonal
Name
DateLines
469.1It's in thereQUARK::LIONELThe dream is aliveThu Mar 23 1989 13:2636
Yes it is.  See the release notes for instructions on how to use it.  There
are also three examples in DECW$EXAMPLES:.

By the way, we've just discovered a rather nasty problem with the Ada
definition of EVENT_TYPE, in that it fails to account for the padding at the
end of the definition.  Unfortunately, Xlib writes the entire length, thus
you could end up with corrupted data.

I'm going to QAR this in hopes that it gets fixed for V5.2, but in the meantime,
edit SYS$LIBRARY:DECW$X_.ADA, replace the definition of ANY_EVENT_TYPE as
follows:

          when  OTHERS =>
            -- ANY_EVENT_TYPE
            ANYV_SERIAL : UNSIGNED_LONGWORD;
            ANYV_SEND_EVENT : INTEGER;              -- bool
            ANYV_DISPLAY : ADDRESS;
            ANYV_WINDOW : UNSIGNED_LONGWORD;        -- window
            ANYV_PAD  : UNSIGNED_BYTE_ARRAY (0 .. 75); -- pad to 96 bytes
          end case;
   
and then below in the representation clause, add the pad as follows:


            ANYV_SERIAL at 4 range 0 .. 31;
            ANYV_SEND_EVENT at 8 range 0 .. 31;
            ANYV_DISPLAY at 12 range 0 .. 31;
            ANYV_WINDOW at 16 range 0 .. 31;
            ANYV_PAD at 20 range 0 .. 607;

(The lines with ANYV_PAD are new - the others are shown for clarity.)

Then submit SYS$UPDATE:DECW$COMPILE_ADA_UNITS to reflect the change.

				Steve

469.2Does this apply to ULTRIX too?IVOGUS::ZIPKINTue Oct 03 1989 13:495
    Is the ADA binding Available for use under ULTRIX as well, or 
    does it only work with VAX ADA?
    
    --Mark

469.3QUARK::LIONELFree advice is worth every centTue Oct 03 1989 16:547
The Ada bindings we supply contain VAX Ada specific pragmas.  Though the
VAX bindings are available under VAX Ultrix, VAX Ada is not.  The bindings
can be used by other Ada compilers, but unless they support the same
IMPORT pragmas VAX Ada does, I doubt you'll be too successful.

				Steve

469.4Standard Ada Binding?PRIMES::UEBERSAXKris, Primes DWT Sales Supp., Md.Fri Feb 23 1990 06:0923
    
    I have a customer who is developing Ada DECwindows programs for both
    VAX/VMS and RISC/Ultrix.  They are using VAX Ada on VMS and Meridian
    ADA on Ultrix.  They want to write the code once.
    
    Since the VAX binding is not available on RISC/Ultrix (and if it was
    could not be used with Meridian (?) ) they are writing an Ada binding
    that uses the MIT C binding.  Writing code using this new binding
    should then make their programs portable.
    
    I have a couple of questions:
    
    	1. This seems like a very common need.  Are they reinventing the
    	wheel?  Is there a standard Ada binding?
    
    	2. How do the 2 bindings we offer on VMS work?  There seems to be
    	only one shareable library each for the toolkit and Xlib.  Are
    	there two entry points for each routine?  Does the VAX binding
    	always just set up and make a call to the C routine?
    
    Thanks,
    
    Kris
469.5QUARK::LIONELFree advice is worth every centFri Feb 23 1990 10:0212
I have seen references to an Ada binding for Xlib that has been circulated
around the "Ada community", though I have not seen the binding myself.  
Naturally, it does not define an interface to the DWT or DRM routines.

There are generally two entry points for each routine, the C binding and
the VAX binding.  The VAX binding routines do generally call the C
binding, after converting passing mechanisms as needed.  The VAX bindings
are a convenience for high-level languages that don't share C's unique
view of a calling interface.  It is certainly possible to call the C
binding routines from Ada, it's just more work and looks uglier.

				Steve
469.6There is another side to every storyDECWIN::KLEINFri Feb 23 1990 12:1016
>view of a calling interface.  It is certainly possible to call the C
>binding routines from Ada, it's just more work and looks uglier.

While this may be true, I have seen some situations where only the C binding
works the way it is supposed to.  Nothing wrong with the ADA definitions,
it is just that there are more bugs in the VAX bindings that in the C
bindings, and that is a fact.  Beauty is in the eye...

I wish we shipped ADA pragmas(?) for as many of the C bindings as possible.
Are we saying that we know what the customer wants better than they do?
If so, try standing in their shoes for a while and see how long before
your feet ache.

Trying to be :)

-steve-
469.7QUARK::LIONELFree advice is worth every centFri Feb 23 1990 13:2123
The only way that we even got the Ada bindings (and Pascal and Basic and
PL/I and...) is because the VAX bindings were defined using SDL.  The
C bindings weren't.

That the VAX bindings were hardly tested and therefore didn't work in
many cases is not an indictment against the decision to provide them, just
in the implementation.

Ideally, the callable interface would have been designed from the start without
the "C is the only language" mindset, especially because C does things 
different from all other languages.  But if we're stuck with the inefficient
C interface (consider the operations needed to manipulate null-terminated
strings), it probably would have been better to bite the bullet and not
provide any other interface, though I say this more because of the headaches
caused by the differences than the concept itself.

If the DECwindows folks would like to come up with (correct!) SDL definitions
for the C bindings, it would be easy to make those available to other
languages.  More difficult to use, true, but we at least wouldn't be in
the position of having the VAX bindings not work while the C bindings do.

		Steve (who long ago became disillusioned about the
			DECwindows callable interface)
469.8they really are important!TOOLEY::B_WACKERMon Feb 26 1990 11:0515
>It probably would have been better to bite the bullet and not provide
>any other interface, though I say this more because of the headaches
>caused by the differences than the concept itself. 

While I sympathize with the feeling, over half our DW business is NOT
C!  If we didn't provide any other interface we also wouldn't be
selling much.  True, some customers have decided to go elsewhere
because of the bugs, but I think it would be worse without the other
bindings. 

Hopefully DW product management/engineering is doing something to make 
the "other" bindings more reliable before many more customers walk 
away.

Bruce
469.9QUARK::LIONELFree advice is worth every centMon Feb 26 1990 11:4711
What I meant was - provide Ada packages that defined interfaces to the
C bindings.  This would be not so much of a problem for Ada as it would
for languages that didn't have routine declarations such as FORTRAN.  The
Ada user would need to manipulate ASCIZ strings more than at present,
though even with the VAX bindings, you can't avoid them entirely.

Most of the differences are in passing mechanism - the C bindings use
immediate value where the VAX bindings use reference, and Ada could handle
that fine.  (So could Pascal - I'm not sure of other languages.)

				Steve
469.10PSW::WINALSKICareful with that VAX, EugeneMon Feb 26 1990 16:076
RE: .9

FORTRAN is about the only language that has problems with the C binding,
mainly because it lacks pointers.

--PSW
469.11QUARK::LIONELFree advice is worth every centMon Feb 26 1990 16:1717
Re: .10

Pointers have nothing to do with it - the VAX bindings return pointers as
well.  FORTRAN can deal with pointers, though clumsily.  The problem is
passing mechanisms that not only are not "standard" (across all other
VAX languages) but that vary depending on the use of the argument.  This
is very difficult to keep track of, and languages such as Ada which allow
you to specify the passing mechanism when declaring the routine relieve
the user of that burden.

The only benefits provided by the VAX bindings are:

	1.  Uniformity of passing mechanism (well, that was the intention).

	2.  Ability to use strings by descriptor instead of ASCIZ.

			Steve