DumpSections.dpr 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. {
  2. TIGCC Documentation Tools
  3. Copyright (C) 2002-2004 Sebastian Reichelt
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software Foundation,
  14. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  15. }
  16. program DumpSections;
  17. uses
  18. UtilsDos,
  19. SysUtils,
  20. Classes;
  21. var
  22. I,
  23. J: Integer;
  24. Contents: TStringList;
  25. Title: string;
  26. begin
  27. Contents := TStringList.Create;
  28. try
  29. with TFileReferences.Create do try
  30. SearchForFiles (ParamStr (1) + '*.hss', atStd);
  31. for I := 0 to Count - 1 do
  32. with TStringList.Create do try
  33. LoadFromFile (Items[I].FullName);
  34. for J := 0 to Count - 1 do
  35. if Copy (Strings [J], 1, Length ('Title=')) = 'Title=' then begin
  36. Title := Copy (Strings [J], Length ('Title=') + 1, Length (Strings [J]));
  37. if Length (Title) > 0 then begin
  38. if Title [1] = '.' then
  39. Contents.Add (#9'else if Pos (''' + Title + ''', Ref) > 0 then'#13#10#9#9'Result := ''' + ExtractFileName (WithoutBackslash (ParamStr (1))) + '/' + WithoutExt (Items[I].FileName) + '''')
  40. else if Pos ('cpp', ParamStr (1)) > 0 then
  41. Contents.Add (#9'else if Ref = ''' + Title + ''' then'#13#10#9#9'Result := ''' + ExtractFileName (WithoutBackslash (ParamStr (1))) + '/' + WithoutExt (Items[I].FileName) + '''')
  42. else
  43. Contents.Add (#9'else if Ref = ''' + Title + ',,' + Title + ''' then'#13#10#9#9'Result := ''' + ExtractFileName (WithoutBackslash (ParamStr (1))) + '/' + WithoutExt (Items[I].FileName) + '''');
  44. end;
  45. end;
  46. finally
  47. Free;
  48. end;
  49. finally
  50. Free;
  51. end;
  52. Contents.SaveToFile ('DumpSections.out');
  53. finally
  54. Contents.Free;
  55. end;
  56. end.