msgbox.pas 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. {
  2. This file is part of the Free Pascal run time library.
  3. A file in Amiga system run time library.
  4. Copyright (c) 1998-2003 by Nils Sjoholm
  5. member of the Amiga RTL development team.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {
  13. History:
  14. Added the define use_amiga_smartlink.
  15. 13 Jan 2003.
  16. [email protected] Nils Sjoholm
  17. }
  18. {$I useamigasmartlink.inc}
  19. {$ifdef use_amiga_smartlink}
  20. {$smartlink on}
  21. {$endif use_amiga_smartlink}
  22. unit MsgBox;
  23. interface
  24. FUNCTION MessageBox(tit,txt,gad:string) : LONGint;
  25. function MessageBox(tit,txt,gad:pchar):longint;
  26. implementation
  27. uses pastoc;
  28. type
  29. pEasyStruct = ^tEasyStruct;
  30. tEasyStruct = record
  31. es_StructSize : longint; { should be sizeof (struct EasyStruct )}
  32. es_Flags : longint; { should be 0 for now }
  33. es_Title : pchar; { title of requester window }
  34. es_TextFormat : pchar; { 'printf' style formatting string }
  35. es_GadgetFormat : pchar; { 'printf' style formatting string }
  36. END;
  37. FUNCTION EasyRequestArgs(window : pointer; easyStruct : pEasyStruct; idcmpPtr : longint; args : POINTER) : LONGINT;
  38. BEGIN
  39. ASM
  40. MOVE.L A6,-(A7)
  41. MOVEA.L window,A0
  42. MOVEA.L easyStruct,A1
  43. MOVEA.L idcmpPtr,A2
  44. MOVEA.L args,A3
  45. MOVEA.L _IntuitionBase,A6
  46. JSR -588(A6)
  47. MOVEA.L (A7)+,A6
  48. MOVE.L D0,@RESULT
  49. END;
  50. END;
  51. FUNCTION MessageBox(tit,txt,gad:string) : LONGint;
  52. begin
  53. MessageBox := MessageBox(pas2c(tit),pas2c(txt),pas2c(gad));
  54. end;
  55. FUNCTION MessageBox(tit,txt,gad:pchar) : LONGint;
  56. VAR
  57. MyStruct : tEasyStruct;
  58. BEGIN
  59. MyStruct.es_StructSize:=SizeOf(tEasyStruct);
  60. MyStruct.es_Flags:=0;
  61. MyStruct.es_Title:=(tit);
  62. MyStruct.es_TextFormat:=(txt);
  63. MyStruct.es_GadgetFormat:=(gad);
  64. MessageBox := EasyRequestArgs(nil,@MyStruct,0,NIL);
  65. END;
  66. end.