home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / OB3.2D2.DMS / in.adf / Module / Alerts.mod next >
Encoding:
Text File  |  1994-08-05  |  2.1 KB  |  76 lines

  1. (*-------------------------------------------------------------------------*)
  2. (*                                                                         *)
  3. (*  Amiga Oberon Library Module: Alerts               Date: 02-Nov-92      *)
  4. (*                                                                         *)
  5. (*   © 1992 by Fridtjof Siebert                                            *)
  6. (*                                                                         *)
  7. (*-------------------------------------------------------------------------*)
  8.  
  9. MODULE Alerts;
  10.  
  11. IMPORT Intuition, Exec, SYSTEM * ;
  12.  
  13. TYPE
  14.   String = ARRAY 256 OF CHAR;
  15.  
  16. PROCEDURE * RFProc;                     (* $EntryExitCode- *)
  17. BEGIN
  18.   SYSTEM.INLINE(016C0U,  (* MOVE.B D0,(A3)+ *)
  19.                 04E75U); (* RTS             *)
  20. END RFProc;
  21.  
  22.  
  23. PROCEDURE AlertDummy * (s{8}: Exec.STRPTR; d{9}: SYSTEM.ADDRESS): BOOLEAN;
  24. VAR
  25.   str,string: String;
  26.   i,j: INTEGER;
  27.   y: INTEGER;
  28. BEGIN
  29.   Exec.OldRawDoFmt(s^,d,RFProc,SYSTEM.ADR(str));
  30.   string[0] := 00X;
  31.   string[1] := 32X;
  32.   string[2] := 12X; y := ORD(12X);
  33.   j := 3; i := 0;
  34.   WHILE (j<255-8) & (str[i]#0X) DO
  35.     string[j] := str[i];
  36.     IF string[j]="\n" THEN
  37.       INC(y,12);
  38.       string[j] :=  00X; INC(j);
  39.       string[j] := 0FFX; INC(j);
  40.       string[j] :=  00X; INC(j);
  41.       string[j] :=  32X; INC(j);
  42.       string[j] := CHR(y);
  43.     END;
  44.     INC(i); INC(j);
  45.   END;
  46.   string[j] := 00X; INC(j);
  47.   string[j] := 00X;
  48.   RETURN Intuition.DisplayAlert(0,string,y+16)
  49. END AlertDummy;
  50.  
  51.  
  52. (*--------------------------------------------------------------------------*)
  53.  
  54.  
  55. PROCEDURE Alert * {"Alerts.AlertDummy"} (s   {8}  : ARRAY OF CHAR;
  56.                                          data{9}..: SYSTEM.ADDRESS): BOOLEAN;
  57. (*
  58.  * Display Alertmsg s with an arbritrary number of values to be inserted in
  59.  * s, as it would be done by printf.
  60.  *
  61.  * Example:
  62.  *   IF Alerts.Alert("My task (\"%s\") has trouble",
  63.  *                   Exec.exec.thisTask.node.name)
  64.  * THEN
  65.  * END;
  66.  *
  67.  * As you may have noted, this declaration is a bit tricky and is not
  68.  * recommended for usual use.
  69.  *
  70.  *)
  71.  
  72.  
  73. END Alerts.
  74.  
  75.  
  76.