A program contains
a program heading,
a uses clause (optional), and
a block of declarations and statements.
The program heading specifies a name for the program. The uses clause lists units used by the program. The block contains declarations and statements that are executed when the program runs. The IDE expects to find these three elements in a single project (.dpr) file.
The following example shows the project file for a program called Editor.
1 Program Project1;
2
3 uses
4 QForms, {cross-platform Form}
5 FrmAbout in ‘UAbout.pas’ {AboutBox},
6 FrmMain in ‘UMain.pas’ {MainForm};
7
8 {$R *.res}
9
10 begin
11 Application.Title := ‘First Project’;
12 Application.CreateForm(TMainForm, MainForm);
13 Application.Run;
14 end.
Line 1 contains the program heading. The uses clause is on lines 3 through 6. Line 8 is a compiler directive that links the project’s resource file into the program. Lines 10 through 14 contain the block of statements that are executed when the program runs. Finally, the project file, like all source files, ends with a period.
This is, in fact, a fairly typical project file. Project files are usually short, since most of a program’s logic resides in its unit files. Project files are generated and maintained automatically, and it is seldom necessary to edit them manually.





