fixmsg.pp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. type
  2. trtabrec=record
  3. name : string[12];
  4. idx : longint;
  5. end;
  6. const
  7. trtab : array[0..10] of trtabrec=(
  8. (name:'general';idx:1000),
  9. (name:'scan';idx:2000),
  10. (name:'parser';idx:3000),
  11. (name:'type';idx:4000),
  12. (name:'sym';idx:5000),
  13. (name:'cg';idx:6000),
  14. (name:'asmr';idx:7000),
  15. (name:'asmw';idx:8000),
  16. (name:'exec';idx:9000),
  17. (name:'unit';idx:10000),
  18. (name:'option';idx:11000)
  19. );
  20. var
  21. t,f : text;
  22. s,hs : string;
  23. i,j,k : longint;
  24. begin
  25. assign(t,paramstr(1));
  26. reset(t);
  27. assign(f,'errorm.msg');
  28. rewrite(f);
  29. while not eof(t) do
  30. begin
  31. readln(t,s);
  32. if (s<>'') and not(s[1] in ['#','%']) then
  33. begin
  34. if copy(s,1,11)='option_info' then
  35. delete(s,1,13)
  36. else
  37. if copy(s,1,2)='ol' then
  38. delete(s,1,6)
  39. else
  40. for i:=0 to 10 do
  41. if Copy(s,1,length(trtab[i].name))=trtab[i].name then
  42. begin
  43. j:=pos('=',s);
  44. if j>0 then
  45. begin
  46. inc(j);
  47. if s[j] in ['0'..'9'] then
  48. begin
  49. k:=j;
  50. while (s[k] in ['0'..'9']) do
  51. inc(k);
  52. if s[k]='_' then
  53. inc(k);
  54. delete(s,j,k-j);
  55. end;
  56. str(trtab[i].idx,hs);
  57. while length(hs)<5 do
  58. hs:='0'+hs;
  59. hs:=hs+'_';
  60. inc(trtab[i].idx);
  61. insert(hs,s,j);
  62. end;
  63. break;
  64. end;
  65. end;
  66. writeln(f,s);
  67. end;
  68. close(f);
  69. close(t);
  70. erase(t);
  71. rename(f,paramstr(1));
  72. end.
  73. $Log$
  74. Revision 1.2 2000-07-13 11:32:55 michael
  75. + removed logs
  76. }