Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works

Random project

pasunitmerge

View on GitHub

Anyone may press Interesting, signed in or not. It helps others find this project.

Member rating

No ratings yet.

Sign in to rate this project.

README

pasunitmerge

Purpose

pasunitmerge is a utility for Lazarus to merge multiple units to one unit. Why would one merge multiple units to one? The reason is to achieve the opposite! You can have a lot of very small units separated from each other that however depend on each other using forward declarations accross units.

This utility is functional while it certainly has a lot of bugs. It's merely an experiment because I want to find a way to deal with unseparable units. I use includes for it a lot but I am not totally happy with it.

Example

Sorry, the example is not very good for now because you could do it without forward declaration.

pascal
unit MyUnit.TestClass;
pascal
interface
pascal
uses SysUtils, Classes;
pascal
type
  TTestBaseClass = class; //forward
  TTestClass = class ( TTestBaseClass )
pascal
end;
pascal
...
pascal
unit MyUnit.TestBaseClass;
pascal
interface
pascal
uses Classes, fgl;
pascal
type
  TTestBaseClass = class
pascal
end;
pascal
...
pascal
unit MyUnit.TestClass;
pascal
interface
pascal
uses SysUtils, Classes, fgl;
pascal
type
  TTestBaseClass = class; //forward
  TTestClass = class ( TTestBaseClass )
pascal
end;
pascal
TTestBaseClass = class
pascal
end;
pascal
...

Usage:

call

pascal
pasunitmerge MyUnit.Testclass.pas MyUnit.TestBaseClass.pas -o MyUnit.pas [More Units -o Outfile]