2 These SAS/C autoopen/autoclose functions was supplied by Mattias
6 #define USE_AHI_VERSION 4
8 #include <devices/ahi.h>
10 #include <proto/exec.h>
13 extern void __regargs
__autoopenfail(char *);
15 extern long __oslibversion
;
17 struct Library
*AHIBase
;
18 struct MsgPort
*AHImp
=NULL
;
19 struct AHIRequest
*AHIio
=NULL
;
22 // Autoopen rutin för ahi.
23 int __stdargs
_STI_openahi(void)
26 if(AHImp
=CreateMsgPort())
28 if(AHIio
=(struct AHIRequest
*)CreateIORequest(AHImp
,sizeof(struct AHIRequest
)))
30 AHIio
->ahir_Version
=USE_AHI_VERSION
;
32 if(!(AHIDevice
=OpenDevice(AHINAME
,AHI_NO_UNIT
,(struct IORequest
*)AHIio
,NULL
)))
34 AHIBase
=(struct Library
*)AHIio
->ahir_Std
.io_Device
;
40 // Så vi får rätt version angivelse
41 __oslibversion
=USE_AHI_VERSION
;
42 __autoopenfail("ahi.device");
46 // autoclose rutin finns det oxo :)
47 void __stdargs
_STD_closeahi(void)
52 CloseDevice((struct IORequest
*)AHIio
);
57 DeleteIORequest((struct IORequest
*)AHIio
);