home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / demos / 57 / pascal / megacnv.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1986-09-18  |  1.8 KB  |  62 lines

  1. { This program will take a *.H file created using the Megamax resource
  2.   construction  program  and convert  it to an *.I format for use with
  3.   OSS Personal Pascal. I have used it with great success in developing
  4.   packages now. I hope you will  enjoy using it. It is free as long as
  5.   you do not remove any acknowledgements in the code.....              }
  6.  
  7. program change;
  8. CONST
  9.         {$I GEMCONST}
  10. TYPE
  11.         {$I GEMTYPE}
  12. var
  13.         def_path,full_name    :Path_Name;
  14.         dumm   :char;
  15.         tmpstr1,
  16.         tmpstr2,
  17.         file1,
  18.         file2,
  19.         alert   :string[255];
  20.         nwpc    :string[4];
  21.         f1,f2   :TEXT;
  22.         i       :integer;
  23.         {$I GEMSUBS}
  24.         {$I terminal.pas}
  25.  
  26. BEGIN
  27. alert := '[0][|  *.H to *.I|Conversion Utility|Written By David Bryan|][ OK ]';
  28.         if Init_Gem >= 0 then
  29.         i := Do_Alert(alert,0);
  30.         BEGIN
  31.         def_path := 'A:\*.H';
  32.         nwpc := ' = ';
  33.         color(3,2);
  34.         cls;
  35.         if Get_In_file(def_path,full_name) then
  36.         BEGIN
  37.         cls;
  38.         file1 := full_name;
  39.         i := Pos('.',file1);
  40.         file2 := Copy(file1,1,i) ;
  41.         file2 := Concat(file2,'I');
  42.         writeln('converting ',file1,' to ',file2);
  43.         reset(f1,file1);
  44.         rewrite(f2,file2);
  45.         while not Eof(f1) do
  46.         begin
  47.                 readln(f1,tmpstr1);
  48.                 tmpstr2 := copy(tmpstr1,9,(Length (tmpstr1) - 8));
  49.                 i := Pos (' ',tmpstr2);
  50.                 Insert (nwpc,tmpstr2,i);
  51.                 writeln(f2,tmpstr2,' ;');
  52.         end;
  53.         close(f1);
  54.         close(f2);
  55.         cls;
  56.         alert := Concat('[1][',file1,'| |converted to| |',file2,'][OK]');
  57.         i := Do_Alert(alert,0);
  58.         END;
  59.         END;
  60. Exit_Gem;
  61. END.
  62.