fpt and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Ref Manual Home |

PAD STRUCTURES

Syntax:

[DO NOT] PAD STRUCTURES

Function:

fpt inserts %FILL directives into structure declarations so as to force objects to their aligned addresses.

The command ALIGN OBJECTS IN STRUCTURES instructs fpt to compute addresses in structures with the requirement that they are aligned, but does not change the code. Both ALIGN OBJECTS IN STRUCTURES and PAD STRUCTURES must be specified if padding is to be inserted

The command STRUCTURE ALIGNMENT GRANULARITY specifies the unit of alignment for structures. Logical, integer and real objects are aligned to the alignment granularity or to their data size, whichever is the smaller. Complex objects are aligned with the alignment rules for the real data specification with he same precision. Character objects are not aligned.

Where to Use this Command

Operating system command line Yes
Configuration file, config.fsp Yes
Specification (fsp) files, *.fsp Yes
Interactively, to FPT> prompt No
Interactive command files No
Embedded in the Fortran code No

Default

No change is made by default. (Note that defaults may be changed in the configuration file).

Examples

The original code contains the structure declaration:

STRUCTURE /SAMPLE_STR/ CHARACTER*8 TIME CHARACTER*9 DATE INTEGER*4 SEQU_NO REAL*4 GRID_REF(2) REAL*4 DEPTH CHARACTER*256 DESCRIPTION CHARACTER*16 STAFF END STRUCTURE

The command show symbol sample_str shows the default address allocation:

Name Sub-prog/Struct Use/COMMON Address Type Size Bounds ---- --------------- ---------- ------- ---- ---- ------ SAMPLE_STR SAMPLE_FRM Structure UNTYPED Field(s): TIME 0 CHARACTER *8 DATE 8 CHARACTER *9 SEQU_NO 17 INTEGER *4 GRID_REF 21 REAL *4 (1:2) DEPTH 29 REAL *4 DESCRIPTION 33 CHARACTER *256 STAFF 289 CHARACTER *16

The commands:

% STRUCTURE ALIGNMENT GRANULARITY: 4 % ALIGN OBJECTS IN STRUCTURES

change the address allocation to:

Name Sub-prog/Struct Use/COMMON Address Type Size Bounds ---- --------------- ---------- ------- ---- ---- ------ SAMPLE_STR SAMPLE_FRM Structure UNTYPED Field(s): TIME 0 CHARACTER *8 DATE 8 CHARACTER *9 SEQU_NO 20 INTEGER *4 GRID_REF 24 REAL *4 (1:2) DEPTH 32 REAL *4 DESCRIPTION 36 CHARACTER *256 STAFF 292 CHARACTER *16

The command

% PAD STRUCTURES

then inserts the %FILL directive as shown below:

STRUCTURE /SAMPLE_STR/ CHARACTER*8 TIME CHARACTER*9 DATE BYTE %FILL(3) INTEGER*4 SEQU_NO !---------------------------^------------------------------------------------- !!! fpt - 2817 Space left in original STRUCTURE by forced alignment of object !----------------------------------------------------------------------------- REAL*4 GRID_REF(2) REAL*4 DEPTH CHARACTER*256 DESCRIPTION CHARACTER*16 STAFF END STRUCTURE

See Also

ALIGN OBJECTS IN STRUCTURES

STRUCTURE ALIGNMENT GRANULARITY

Copyright ©1995 to 2025 Software Validation Ltd. All rights reserved.