home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Pascal / HISOFTPASCAL2,0-2.DMS / in.adf / Demos / Hello.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-05-20  |  2.2 KB  |  106 lines

  1. { The good old 'Hello World' program made in HighSpeed Pascal }
  2. { This is a translation of the RKM example and does it the hard
  3.   way of calling the operating system directly }
  4.   
  5. Program HelloWorld;
  6. Uses Exec, Graphics, Intuition;
  7.  
  8.  
  9. var
  10.   MyNewWindow: tNewWindow;
  11.   MyNewScreen: tNewScreen;
  12.  
  13.   FontName: String;
  14.   Title:    String;
  15.   WTitle:   String;
  16.   Message:    String;
  17.   MyFont:   tTextAttr;
  18.  
  19.   MyScreen: pScreen;
  20.   MyWindow: pWindow;
  21.   L: Longint;
  22.  
  23.   {$ifdef WORKBENCH_2}
  24.   junk:        boolean;
  25.   {$endif}
  26.  
  27.  
  28. begin
  29.   GfxBase:=pGfxBase(OpenLibrary('graphics.library',0));
  30.   IntuitionBase:=pIntuitionBase(OpenLibrary('intuition.library',0));
  31.  
  32.   FontName := 'topaz.font'#0;
  33.   with MyFont do begin
  34.     ta_Name        := @FontName[1];
  35.     ta_YSize    := TOPAZ_SIXTY;
  36.     ta_Style    := FS_NORMAL;
  37.     ta_Flags    := FPF_ROMFONT;
  38.   end;
  39.  
  40.   Title := 'HighSpeed Pascal Screen'#0;
  41.   with MyNewScreen do begin
  42.     LeftEdge:=0;
  43.     TopEdge:=0;
  44.     Width:=320;
  45.     Height:=200;
  46.     Depth:=2;
  47.     DetailPen:=0;
  48.     BlockPen:=1;
  49.     ViewModes:=0;
  50.     Type_:=CUSTOMSCREEN;
  51.     Font:=@MyFont;
  52.     DefaultTitle:=@Title[1];
  53.     Gadgets:=NIL;
  54.     CustomBitMap:=NIL;
  55.   end;
  56.   MyScreen:=OpenScreen(@MyNewScreen);
  57.   if MyScreen=NIL then Halt(1);
  58.  
  59.   WTitle := 'A Simple Window'#0;
  60.   with MyNewWindow do begin
  61.     LeftEdge:=20;
  62.     TopEdge:=20;
  63.     Width:=300;
  64.     Height:=100;
  65.     DetailPen:=0;
  66.     BlockPen:=1;
  67.     Title:=@WTitle[1];
  68.     Flags:=WINDOWCLOSE or SMART_REFRESH or
  69.            ACTIVATE or WINDOWSIZING or
  70.            WINDOWDRAG or WINDOWDEPTH;
  71.     IDCMPFlags:=CLOSEWINDOW_;
  72.     Type_:=CUSTOMSCREEN;
  73.     FirstGadget:=NIL;
  74.     CheckMark:=NIL;
  75.     Screen:=MyScreen;
  76.     BitMap:=NIL;
  77.     MinWidth:=100;
  78.     MinHeight:=25;
  79.     MaxWidth:=640;
  80.     MaxHeight:=200;
  81.   end;
  82.   MyWindow:=OpenWindow(@MyNewWindow);
  83.   if MyWindow=NIL then begin
  84.     {$ifdef WORKBENCH_2}
  85.     junk := {ignore return code}
  86.     {$endif}
  87.     CloseScreen(MyScreen);          {Remove the screen opened before}
  88.     halt(2);
  89.   end;
  90.  
  91.   Message := 'Hello World';
  92.   with MyWindow^ do begin
  93.     Move_(RPort,20,20);
  94.     Text_(RPort,@Message[1],Length(Message));
  95.     L:=Wait(BitMask(UserPort^.MP_SIGBIT));
  96.   end;
  97.  
  98.   CloseWindow(MyWindow);
  99.   {$ifdef WORKBENCH_2}
  100.   junk :=
  101.   {$endif}
  102.   CloseScreen(MyScreen);
  103.   CloseLibrary(Pointer(IntuitionBase));
  104.   CloseLibrary(Pointer(GfxBase));
  105. end.
  106.