![]() |
![]() HP OpenVMS Systemsask the wizard |
![]() |
The Question is: 1000 !0123456789012345678901234567890123456789012345678901234567890123456 ! ! Dear Compaq. You have a declaration error in OpenVMS 7.2 library ! "sys$library:basic$starlet.tlb" which affects both VAX-BASIC and ! DEC-BASIC (on Alpha). I've checked your library and you have not ! declared two LIB$ routines properly when compared with OpenVMS ! document "OpenVMS RTL Library (LIB$) Manual". The routines are ! lib$bbcci and lib$bbssi and are in module "LIB$ROUTINES" of ! starlet. ! ! Neil Rieck ! Programmer/Analyst ! Bell Canada ! F3, 20 Water St. N. ! Kitchener, Ontario, ! Canada. N2H-5A5 ! tel: (519)-571-6303 ! biz: email:neil.rieck@bell.ca ! rez: email:n.rieck@sympatico.ca !------------------------------------------------------------------- option type=explicit ! %let %method=2 %if%method=1 %then ! this option "crashes at run time" because incorrect passing ! mechanisms are used in the library. %include "lib$routines" %from %library "sys$library:basic$starlet" %else ! this option "runs properly" and agrees with the lib$ manual external long function lib$bbcci(long by ref, long by ref) external long function lib$bbssi(long by ref, long by ref) %end %if ! common(abc)long junk(4) ! print "doing set" if( lib$bbssi (42, junk(0))) then print 'State bit 42 was set' else print 'State bit 42 was clear' end if print "doing clear" if( lib$bbcci (42, junk(0))) then print 'State bit 42 was set' else print 'State bit 42 was clear' end if end The Answer is : The OpenVMS documentation of this argument is admittedly rather odd, as this argument is a longword passed "by value" -- a mechanism that would more commonly be refered to as "by reference". The documentation for the argument lists: bit-zero-address OpenVMS usage:unspecified type: address access: modify mechanism: by reference A more expected (and equivilent) declaration might be: bit-vector OpenVMS usage: unspecified type: longword (unsigned) access: modify mechanism: by reference Though discussions of a change are underway at this writing, any changes to the SDL declaration will have to be carefully evaluated against the implications for existing source code modules. (At a minimum, a better description of this argument will be included in the documentation for this call in a future OpenVMS release, and potentially several additional programming examples will also be included...) Attached are functioning BASIC and C programs... $ basic x $ link x $ run x doing set State bit 42 was clear doing clear State bit 42 was set $ type x.bas 1000 !------------------------------------------------------------------- option type=explicit ! %include "lib$routines" %from %library "sys$library:basic$starlet" ! common(abc)long junk(4) ! print "doing set" if( lib$bbssi (42, LOC(junk(0)))) then print 'State bit 42 was set' else print 'State bit 42 was clear' end if print "doing clear" if( lib$bbcci (42, LOC(junk(0)))) then print 'State bit 42 was set' else print 'State bit 42 was clear' end if end -- $ cc x $ link x $ run x doing set State bit 42 was clear doing clear State bit 42 was set $ type x.c #include <lib$routines.h> #include <ssdef.h> #include <stdio.h> #include <stdlib.h> main() { unsigned long bitvector[4] = { 0, 0, 0, 0 }; unsigned long bitnumber = 42; printf("doing set\n"); if ( lib$bbssi( &bitnumber, bitvector)) printf("State bit %d was set\n", bitnumber ); else printf("State bit %d was clear\n", bitnumber ); printf("doing clear\n"); if ( lib$bbcci( &bitnumber, bitvector )) printf("State bit %d was set\n", bitnumber ); else printf("State bit %d was clear\n", bitnumber ); return SS$_NORMAL; }
|