ZT: Delphi programming specification 1.0.0.0 (YCKXZJJ)

xiaoxiao2021-03-06  55

Writing Objectives This specification is defined as program files and coding styles involved in the process of writing. This specification is based on Delphi language.

The organization of the project file in Delphi, organizes program files in accordance with the project. In a typical project, including: project file (.drp file) contains the PASCAL source code for the engineering main program; unit file (.PAS file) project, the PASCAL source file of each form, contains all the declarations of the form and Process (including time processing); Form file (.dfm file) contains binary files for design properties of a form, each form of .dfm files correspond to .pas files; resource files (.res files) compile The binary resource file is linked to the application's executable; the project option file (.dof file) stores the project options set by the Project | Options menu command; the desktop settings file (.dsk file) stores Tools | Options The menu command sets the desktop options set; the package file (.dpk / .bpl file) is used to share components, classes, data, and code files. The source file is a .dpk file, compiled. BPL file;

Constant definition content: definition of logical values; definition of constant value; definition of error code;

Format: One definition occupies a line. As follows: Const : Type = value; // Note Description: Use the const statement to declare the constant used to replace the text value.

Example: const c_sql: string = 'select ch_USERER_ID from T_CD_USER'; // Query User ID Const C_PI: Real = 3.1415926; // Performance Rate Structure Type Definition Content: Structure Type Definition Format: Type // Structure Description Note < Variable Name 1>: Variable Type; // Variable Description Note : Variable Type; // Variable Description Note ... END;

Description: is a string that starts with uppercase letters. The statement defined in the structural definition is starting from the second line of the fifth column.

Example: type TableList = Record // System Tree unit Type Definition InID: Integer; // Unit Number Name: String; // Unit Name PID: String; // Previous Unit Name Pt: PtableList; // Refers to the next unit Type pointer END;

Program style

The program style specifies the positioning rules and procedures in the program of each statement. Function / Procedure Style Name (Variable: Variable Type [, ...]); // Function / Procedure Description VAR Variable 1: Variable Type; // Variable Description Variable 2: Variable Type; // Variable Description ... begin statement; statement; ... End; Note: Variable declaration, statement is written from the third column, if there is indent, each indent two columns, and aligned with relative statements.

Statement Style Description: There is usually a paragraph function explanation in the program body; the specification uses various statements; the indentation in the statement is in two listed as a unit.

Variable definition statement var var_name:

Assignment Statement Var_Name: = ;

Conditional statement if condition Then // Note Begin statement; ... END ELSE IF Condition THEN / / Note Begin statement; ... endelse // comment statement; Note: If only one sentence is executed, it can omit the Begin, End statement. Cycle Schedule // Cycle Function For counter: = start to end dobegin [statement]; ... END; // cycle function comment

While [Condition] DOBEGIN [Statement]; ... END;

// Cycle Function Note Repeat [Statement]; ... Until [Condition]

Switch Statement // Switch Function Description Case Of : [Statement 1]; : [Statement 2]; ... : [Statement N] END;

Note Return must have this unit file "Module Description" and "Unit Description" comments at the top of the program code unit file. For constants, structural types, functions / processes, custom variables, code segment function blocks, key statements, etc.

The point must be detailed in detail. The note can be added to the "// xxxxxxxxx" manner after the part is required, or the part line is required

Add multiple lines to "{xxxxxxxx}" or "// xxxxxxxx" mode.

File and Form Name Meaning Class Name Name Format Project Document Program (.dpr) xxxxx Unit Unit (PAS) UXXXXX Form.Name (.dfm) XXXXXFRM Data Module DataModule XXXXDM

Element head definitions are added to the front of each unit. {********************************************************** **** unit name: description: author: software name: version: company name: Daojianrumeng software workshop ************************ ****************************}

Software version number format definition: The following version number format is used: X.x.x.x For example, the released program is complete, the version number is "1.0.0.0" first: version number. Note: The version formed after the software is significantly improved. Second: Maintenance number. Note: The existing version has modified the version of some errors formed. The third place: patch number. Note: When the program modifies some errors, use the patch number when the new maintenance is not formed. The fourth place: correction number. Note: When an emergency error occurs, the modified procedure is used as an identifier, and does not use the version number of the release program.

转载请注明原文地址:https://www.9cbs.com/read-82693.html

New Post(0)