home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / M2V11-1.LHA / modula / m2lib / M2Lib.def
Encoding:
Text File  |  1994-07-31  |  1.8 KB  |  49 lines

  1. DEFINITION FOR C MODULE M2Lib ;
  2.  
  3. FROM SYSTEM IMPORT ADDRESS, STRING ;
  4.  
  5. VAR (* The following variables are READ ONLY!! *)
  6.   wbStarted : BOOLEAN ;
  7.   _WBMsg    : ADDRESS ; (* Startup message sent to us by workbench,         *)
  8.               (* Do not reply to it, as the DICE exit code will    *)
  9.               (* do this at the correct time.                 *)
  10.               (* WBMsg is only valid if wbStarted = TRUE         *)
  11.               (* There is a copy of this variable in WorkBench.def *)
  12.               (* which is properly typed: VAR WBMsg : WBStartupPtr *)
  13.  
  14. (* following are only valid if wbStarted = FALSE (CLI startup) *)
  15.   argc : LONGINT ; (* # of cmd line arguments eg [m2c x.mod] = 2 arguments *)
  16.   argv : POINTER TO ARRAY (* 0..argc-1 *) OF STRING ;
  17.  
  18. PROCEDURE OpenLib( name : STRING ; version : LONGINT ) : ADDRESS ;
  19. (* Like the Exec version but the library is automatically closed at program   *)
  20. (* exit.                                      *)
  21.  
  22. PROCEDURE _ErrorReq( s1,s2 : STRING ) ;
  23. (* Displays an error requester with s1,s2 and then calls StdLib.exit(20)  *)
  24. (* dont pass NIL as either argument pass " " instead.              *)
  25.  
  26. PROCEDURE CheckStack( needBytes : LONGINT ) ;
  27. (* Checks that needBytes of space are avaiable on the stack.        *)
  28. (* calls _ErrorReq if there are not.                    *)
  29. (* Used for manual stack checking. Place calls to this procedure in    *)
  30. (* the recursive call paths of your program.                *)
  31. (* If the check fails then this function sets the stack to a safer    *)
  32. (* value before the _ErrorReq call.                    *)
  33. (* DO NOT use if youre program creates coroutines or Exec tasks        *)
  34.  
  35.  
  36. (* Duplicated from StdLib.def *)
  37.  
  38. TYPE
  39.   IntProc = PROCEDURE( ) : LONGINT ;
  40.  
  41. PROCEDURE onbreak( ip : IntProc ) : IntProc ;
  42. PROCEDURE atexit( p : PROC ) ;
  43. PROCEDURE exit( n : LONGINT ) ;
  44.  
  45. PROCEDURE malloc( size : LONGINT ) : ADDRESS ;
  46. PROCEDURE free( a : ADDRESS ) ;
  47.  
  48. END M2Lib.
  49.