declare function TEST1_CBIT(V as long,B as long) as long
function TEST1_CBIT(V as long,B as long) as long
var I as long,J as long
TEST1_CBIT=V
if B=0 then error 5:exit function
if B<0 then error 11:exit function '未実装
I=B :J=1
do while (I mod 2 = 0)
J=J * 2 : I=I \ 2
loop
TEST1_CBIT=(V and B) \ J
if ((V and B) mod J) <> 0 then error 21
end function
declare sub TEST1_GetState()
sub TEST1_GETSTATE()
var RES as long
var hfile as long
var DCB as T_DCB
var F as long
HFILE=INVALID_HANDLE_VALUE
HFILE = CREATEFILE("COM1", (GENERIC_READ or GENERIC_WRITE), 0, NULL, OPEN_EXISTING, 0, NULL)
if HFILE= INVALID_HANDLE_VALUE then print "Error:open失敗":exit sub
RES=GetCommState(hfile, DCB)
if RES=0 then
print "Error:GetCommState"
RES=CLOSEHANDLE(HFILE)
else
RES=CLOSEHANDLE(HFILE)