Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!bloom-beacon!mit-eddie!apollo!beierl_c From: beierl_c@apollo.COM (Christopher Beierl) Newsgroups: comp.sys.apollo Subject: Re: Discrepancy in sio.h file? Message-ID: <4425aca6.19050@apollo.COM> Date: 30 Jun 89 22:01:00 GMT References: <12447@netnews.upenn.edu> Reply-To: beierl_c@apollo.COM (Christopher Beierl) Distribution: na Organization: Apollo Computer, Chelmsford, MA Lines: 57 In article <12447@netnews.upenn.edu> lau@kings.wharton.upenn.edu (Yan K. Lau) writes: >This is a technical question about the C compiler and the Apollo sio >include file. There seems to be a discrepancy between parameter lists. > >In /usr/apollo/include/sio.h, the sio_$control call is defined as follows: > extern void sio_$control( > stream_$id_t &stream_id, > sio_$opt_t &option, > void &value, > status_$t *status > ); This is a bug (APR #dcb69) and is fixed in SR10.2. The correct prototype matches the documentation and is shown below. extern void sio_$control( stream_$id_t &stream_id, sio_$opt_t &option, sio_$value_t &value, status_$t *status ); Note that an actual object of type sio_$value_t must be used in the call, rather than just a cast because you can't cast a constant to a union. An example follows: #include stream_$id_t stream_id; sio_$value_t sio_value; status_$t status; sio_value.i = sio_$9600; sio_$control(stream_id, sio_$speed, sio_value, &status); sio_value.b = true; sio_$control(stream_id, sio_$raw, sio_value, &status); >BTW, In /sys/ins/sio.ins.c, the call is defined simply as: > std_$call void sio_$control(); For a C programmer it is much preferable to use the .h header files. If the ins.c header files are used instead then the std_$call mechanism is used for interlanguage calls rather than prototypes. An example follows: #include "/sys/ins/sio.ins.c" stream_$id_t stream_id; status_$t status; sio_$control(stream_id, sio_$speed, (pinteger)sio_$9600, status); sio_$control(stream_id, sio_$raw, true, status); -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Christopher T. Beierl Internet: beierl_c@apollo.com Apollo Computer, Inc. UUCP: {mit-eddie,yale,uw-beaver}!apollo!beierl_c A Subsidiary of Hewlett-Packard Phone: (508) 256-6600