home *** CD-ROM | disk | FTP | other *** search
- program test;
- {* main program, this will register with Adhesive, setup an
- atexit handler and then call mymain which is the real program
- *}
-
- #include "os.h"
- #include "clib.h"
-
- #include "Adhesive.h"
- #include "mymain.h"
-
-
- (* external Adhesive request table created using CAHG *)
- var cahg_need_ObjectsNeeded : Adhesive_RequestStr; extern;
-
-
- (* global variable we use to keep our Adhesive handle in *)
- var userHandle : Adhesive_User;
-
-
- (* procedure to check an error *)
- procedure checkErr(e:error);
- begin
- if e<>nil then begin
- writeln('*** ',e^.errmess,' ***');
- exit(EXIT_FAILURE);
- end;
- end;
-
-
- (* exit handler to deregister with Adhesive *)
- procedure exit_handler;
- begin
- adhesive_Deregister(userHandle);
- end;
-
-
-
- (* main *)
- var info : Adhesive_UserInfo;
- begin
- (* initialise handle to 0 so exit_handler doesn't do anything if
- an error occurs before we register with Adhesive
- *)
- new(userHandle);
- userHandle^ := 0;
-
- (* use atexit handler so we always deregister with Adhesive *)
- atexit(exit_handler);
-
- (* register and request objects *)
- new(info);
- info^.flags := 0;
- info^.name := 'Pascal User';
- checkErr(adhesive_Register(userHandle,info));
- checkErr(adhesive_Request(userHandle,
- address(cahg_need_ObjectsNeeded))
- );
-
- (* call real program *)
- mymain;
- end.
-