home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / HEAPSW.ZIP / HEAPDEMO.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1989-01-27  |  1.5 KB  |  55 lines

  1. {$A-,B-,E-,F+,I+,L+,N-,O+,R-,S+,V-}
  2. {$M 16384,0,655360}       { !!Maximum Stack Allocation!!     }
  3.                           { If your disk cannot hold a       }
  4.                           { swap file of this size reduce    }
  5.                           { the stack allocation accordingly }
  6.  
  7. program HeapSwapDemo;
  8.  
  9. uses crt,dos,
  10.      _Heapswp,
  11.      _DEMO;
  12.  
  13. var S : string;
  14.     R : real;
  15.  
  16. begin
  17.   clrscr;
  18.   Show('^First make a background',3);
  19.   background;
  20.   delay(1000);
  21.   Show('^Then put a box on it saving the|^background behind it to the Heap',5);
  22.   MakeABox;
  23.   delay(2000);
  24.   Show('^Then show a Menu saving the|^background behind it to the Heap',5);
  25.   if DoAMenu=1 then
  26.     begin
  27.       delay(1000);
  28.       Show('^Now Push the whole screen|^to the Heap and Clear the Screen',5);
  29.       PushAScreen;
  30.       clrscr;
  31.       Show('^OK off to DOS we go|^Type EXIT at the DOS prompt to get back here',3);
  32.       R:=HeapSize;
  33.       R:=R*16;
  34.       str(R:8:0,S);
  35.       Show('^Saving '+S+' bytes of Heap space',3);
  36.       if PutHeap('.',0) then
  37.         begin
  38.           SwapVectors;
  39.           exec(GetEnv('COMSPEC'),'');
  40.           SwapVectors;
  41.           GetHeap;
  42.         end;
  43.       Show('^We''re Back|^so Pop the Screen from the Heap',5);
  44.       PopAScreen;
  45.       delay(1000);
  46.       Show('^Got our Screen Back so put away the Menu',4);
  47.       closeBox;
  48.       delay(1000);
  49.       Show('^Get Rid of the Box',4);
  50.       CloseBox;
  51.       delay(1000);
  52.     end;
  53.   Show('^'^A' Have a nice day '^A,5);
  54.   textmode(Lastmode);
  55. end.