fpt and WinFPT Reference Manual - Command-line Commands
| SimCon Home | Ref Manual Home |
INSERT FUNCTION TO TRANSLATE READ / WRITE ACCESS
Syntax:
INSERT [ <type> [ * <size> ]] FUNCTION [::] <identifier> TO TRANSLATE { READ | WRITE } ACCESS TO [SYMBOL] [::] <identifier>
Function:
When code is migrated from one environment to another there may be hardware interfaces or binary files which supply or require foreign data types. For example, a Gould-SEL flight simulator may have interfaces which supply Gould-SEL real numbers. If the code is migrated to a PC which uses IEEE real numbers, the Gould-SEL numbers must be translated when they are used in expressions. This command specifies the translation function. It does not command fpt to make the insertions. The insertions are made in response to the command INSERT TRANSLATIONS OF FOREIGN OBJECTS. When this command is made, the functions are inserted to encapsulate the foreign data types and appropriatre declarations are made.
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 translation sub-programs are defined by default (Note that defaults may be modified in the configuration file).
Examples
The code fragment shown below is part of a Gould-SEL program which was migrated to a PC. Air search radar data are supplied by external hardware and the number formats are those used on the original Gould-SEL host.
REAL*4 ASR_H0,ASR_X0,ARS_Y0 REAL*4 ASR_H,ASR_X,ASR_Y REAL*4 ASR_R,ASR_AZ,ASR_EL : * Get the air search radar data CALL GET_ASR(ASR_R,ASR_AZ,ASR_EL) * Convert to range Cartesians ASR_H = ASR_H0 + ASR_R * SIN(ASR_EL) ASR_X = ASR_X0 + ASR_R * COS(ASR_EL) * COS(ASR_AZ) ASR_Y = ASR_Y0 + ASR_R * COS(ASR_EL) * SIN(ASR_AZ)
The code is modified by the commands:
% insert real*4 function :: sel2pc to translate read access to asr_r % insert real*4 function :: sel2pc to translate read access to asr_az % insert real*4 function :: sel2pc to translate read access to asr_el % insert translations of foreign objects
The code is converted to:
REAL*4 sel2pc REAL*4 asr_h0,asr_x0,ars_y0 REAL*4 asr_h,asr_x,asr_y REAL*4 asr_r,asr_az,asr_el ! ! Get the air search radar data CALL get_asr(asr_r,asr_az,asr_el) ! Convert to range Cartesians !% TRANSLATION FUNCTION INSERTED FOR: asr_el asr_h = asr_h0+asr_r*SIN(sel2pc(asr_el)) !% TRANSLATION FUNCTION INSERTED FOR: asr_el !% TRANSLATION FUNCTION INSERTED FOR: asr_az asr_x = asr_x0+asr_r*COS(sel2pc(asr_el))*COS(sel2pc(asr_az)) !% TRANSLATION FUNCTION INSERTED FOR: asr_el !% TRANSLATION FUNCTION INSERTED FOR: asr_az asr_y = asr_y0+asr_r*COS(sel2pc(asr_el))*SIN(sel2pc(asr_az))
Note that the embedded command !% TRANSLATION FUNCTION INSERTED FOR: ... is inserted to mark the changes and to prevent fpt from repeating the insertion if the code is processed again.
Copyright ©1995 to 2024 Software Validation Ltd. All rights reserved.