home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / ECO30603.ZIP / ECO30603.LZH / ECOLIBII / DEMOS / demo_env.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-04-05  |  1.1 KB  |  55 lines

  1. {$R-,S-}
  2. uses
  3.   eco_env
  4.  
  5.   ;
  6.  
  7.  
  8.  
  9. var
  10.   e      :  envrec;
  11.   ss     :  string;
  12.   vs     :  string;
  13.   status : integer;
  14.  
  15.  
  16. begin
  17.   ss := programstr;
  18.   if length(ss) <> 0 then writeln('Program name: ', ss, ^m^j);
  19.  
  20.   {dump the current environment}
  21.   currentenv(e);
  22.   if e.envseg = 0 then begin
  23.     writeln('Current environment not found');
  24.     halt;
  25.   end;
  26.   write('Current environment (', e.envlen, ' bytes)');
  27.   dumpenv(e);
  28.   writeln;
  29.  
  30.   {dump the master environment}
  31.   masterenv(e);
  32.   if e.envseg = 0 then begin
  33.     writeln('Master environment not found');
  34.     halt;
  35.   end;
  36.   write('Master environment (', e.envlen, ' bytes)');
  37.   dumpenv(e);
  38.   writeln;
  39.  
  40.   {demonstrate changes to the master environment}
  41.   writeln('Change the master environment. Enter empty string to quit');
  42.   repeat
  43.     writeln;
  44.     write('String to set: ');
  45.     readln(ss);
  46.     if length(ss) <> 0 then begin
  47.       write('Value: ');
  48.       readln(vs);
  49.       if not setenvstr(e, ss, vs) then writeln(
  50.         'Insufficient environment space'
  51.       ) else dumpenv(e);
  52.     end;
  53.   until length(ss) = 0;
  54. end.
  55.