PackageFTPParsers.pas 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. {
  2. $Project$
  3. $Workfile$
  4. $Revision$
  5. $DateUTC$
  6. $Id$
  7. This file is part of the Indy (Internet Direct) project, and is offered
  8. under the dual-licensing agreement described on the Indy website.
  9. (http://www.indyproject.org/)
  10. Copyright:
  11. (c) 1993-2005, Chad Z. Hower and the Indy Pit Crew. All rights reserved.
  12. }
  13. {
  14. $Log$
  15. }
  16. {
  17. { Rev 1.4 04/09/2004 12:45:16 ANeillans
  18. { Moved the databasename and output paths into a globally accessible variable
  19. { -- makes it a lot easier to override if you need to (as I did for my local
  20. { file structure).
  21. }
  22. {
  23. { Rev 1.3 2004.06.13 8:42:42 PM czhower
  24. { Added name.
  25. }
  26. {
  27. { Rev 1.2 2004.06.13 8:06:14 PM czhower
  28. { Update for D8
  29. }
  30. {
  31. { Rev 1.1 6/8/2004 3:52:52 PM JPMugaas
  32. { FTP List generation should work.
  33. }
  34. {
  35. { Rev 1.0 6/8/2004 2:15:50 PM JPMugaas
  36. { FTP Listing unit generation.
  37. }
  38. unit PackageFTPParsers;
  39. interface
  40. uses
  41. Package;
  42. type
  43. TFTPParsers = class(TPackage)
  44. public
  45. constructor Create; override;
  46. procedure Generate(ACompiler: TCompiler; const AFlags: TGenerateFlags); override;
  47. end;
  48. implementation
  49. uses
  50. SysUtils, DModule;
  51. { TFTPParsers }
  52. constructor TFTPParsers.Create;
  53. begin
  54. inherited;
  55. FOutputSubDir := 'Lib\Protocols';
  56. end;
  57. procedure TFTPParsers.Generate(ACompiler: TCompiler; const AFlags: TGenerateFlags);
  58. var
  59. i: Integer;
  60. begin
  61. //We don't call many of the inherited Protected methods because
  62. //those are for Packages while I'm making a unit.
  63. //inherited;
  64. FName := 'IdAllFTPListParsers';
  65. FExt := '.pas';
  66. FCompiler := ACompiler;
  67. FCode.Clear;
  68. FDesignTime := False;
  69. Code('unit IdAllFTPListParsers;');
  70. Code('');
  71. Code('interface');
  72. Code('');
  73. Code('{$I IdCompilerDefines.inc}');
  74. Code('');
  75. Code('{');
  76. Code('Note that is unit is simply for listing ALL FTP List parsers in Indy.');
  77. Code('The user could then add this unit to a uses clause in their program and');
  78. Code('have all FTP list parsers linked into their program.');
  79. Code('');
  80. Code('ABSOLELY NO CODE is permitted in this unit.');
  81. Code('');
  82. Code('}');
  83. Code('');
  84. Code('// RLebeau 4/17/10: this forces C++Builder to link to this unit so');
  85. Code('// the units can register themselves correctly at program startup...');
  86. Code('');
  87. Code('{$IFDEF HAS_DIRECTIVE_HPPEMIT_LINKUNIT}');
  88. Code(' {$HPPEMIT LINKUNIT}');
  89. Code('{$ELSE}');
  90. Code(' {$HPPEMIT ''#pragma link "IdAllFTPListParsers"''}');
  91. Code('{$ENDIF}');
  92. //Now add our units
  93. Code('');
  94. Code('implementation');
  95. Code('');
  96. Code('uses');
  97. for i := 0 to FUnits.Count - 1 do begin
  98. Code(' ' + ChangeFileExt(FUnits[i], '') + iif(i < FUnits.Count - 1, ',', ';'));
  99. end;
  100. //
  101. Code('');
  102. Code('{dee-duh-de-duh, that''s all folks.}');
  103. Code('');
  104. Code('end.');
  105. WriteFile;
  106. end;
  107. end.