FPT and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Reference Manual Home |


PAD STRUCTURES

Syntax:

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:

Yes


Interactive command files

Yes


Embedded in the Fortran code

Yes


Default:

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

Example:

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 2014 Software Validation Ltd. All rights reserved.