Language Overview
Delphi is a high-level, compiled, strongly typed language that supports structured and object-oriented design.
Based on Object Pascal, its benefits include easy-to-read code, quick compilation, and the use of multiple unit files formodular programming.
Delphi has special features that support Borland's component framework and RADenvironment. For the most part, descriptions and examples in this language guide assume that you are using Borlanddevelopment tools.
Most developers using Borland software development tools write and compile their code in the integrateddevelopment environment (IDE). Borland development tools handle many details of setting up projects and sourcefiles, such as maintenance of dependency information among units. The product also places constraints on programorganization that are not, strictly speaking, part of the Object Pascal language specification. For example, Borlanddevelopment tools enforce certain file- and program-naming conventions that you can avoid if you write yourprograms outside of the IDE and compile them from the command prompt.
This language guide generally assumes that you are working in the IDE and that you are building applications thatuse the Borland Visual Component Library (VCL). Occasionally, however, Delphi-specific rules are distinguishedfrom rules that apply to all Object Pascal programming. This text covers both the Win32 Delphi language compiler,and the Delphi for .NET language compiler. Platform-specific language differences and features are noted wherenecessary.This section covers the following topics:Program Organization. Covers the basic language features that allow you to partition your application into unitsand namespaces.Example Programs. Small examples of both console and GUI applications are shown, with basic instructionson running the compiler from the command-line.Program OrganizationDelphi programs are usually divided into source-code modules called units.
Most programs begin with a programheading, which specifies a name for the program. The program heading is followed by an optional uses clause, thena block of declarations and statements. The uses clause lists units that are linked into the program; these units,which can be shared by different programs, often have uses clauses of their own.The uses clause provides the compiler with information about dependencies among modules. Because thisinformation is stored in the modules themselves, most Delphi language programs do not require makefiles, headerfiles, or preprocessor "include" directives.Delphi Source FilesThe compiler expects to find
Delphi source code in files of three kinds:Unit source files (which end with the .pas extension)Project files (which end with the .dpr extension)Package source files (which end with the .dpk extension)Unit source files typically contain most of the code in an application. Each application has a single project file andseveral unit files; the project file, which corresponds to the program file in traditional Pascal, organizes the unit filesinto an application. Borland development tools automatically maintain a project file for each application.If you are compiling a program from the command line, you can put all your source code into unit (.pas) files. If youuse the IDE to build your application, it will produce a project (.dpr) file.Package source files are similar to project files, but they are used to construct special dynamically linkable librariescalled packages.
November 19, 2007
Delphi
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment