A couple of years ago, I termed the reengineering concept of entombing. This basically takes legacy subprograms and encapsulates the code within a modern framework. The interface block can be very useful in this process, so we will term this *interface entombing*. Consider the following example of a F77 subroutine. It calculates the average thrust of a rocket engine, given the weight of the rocket, the thrust (F) of the engines, and the velocity (V) of the exhaust gases. Below is the pseudocode for the F77 function **SUBACL**.

- Compute the mass lost after
*t* seconds: m_{loss} = t (F/−V) - Compute the net mass remaining after
*t* seconds: m_{t (remaining}) = (W/gravity) − m_{loss} - Compute the weight at W
_{t}: W_{t} = m_{t (remaining}) gravity - Compute the unbalanced force that causes acceleration: F
_{t}=F−W_{t} - Compute the acceleration: a = F
_{t} / m_{t}

Here is Fortran 77 function (**subacl.for**).

```
REAL FUNCTION SUBACL(RCKTWT,THRUST,VELGAS,TIME)
REAL RCKTWT,THRUST,VELGAS,TIME,FTUNB,MT,UBWT
REAL FUNFOR, FUNACL
REAL GRAVTY
PARAMETER(GRAVTY=32.0)
FUNFOR(THRUST,VELGAS) = THRUST / (-VELGAS)
FUNACL(FTUNB,MT) = FTUNB/MT
MT = RCKTWT / GRAVTY - FUNFOR(THRUST,VELGAS) * TIME
UBWT = MT * GRAVTY
FTUNB = THRUST - UBWT
SUBACL = FUNACL(FTUNB,MT)
RETURN
END
```

Now we may not want to change anything here, for whatever reason. Note that the variables are all explicitly declared, and the function retains a number of legacy structures. Its functionality could be accessed by a Fortran 95 program which specifies it using an interface block. This basically adds a modern layer of interface between the new program, and the legacy function.

```
program entomb1
implicit none
```**interface**
real function subacl(rcktwt,thrust,velgas,time)
real, intent(in) :: rcktwt, thrust, velgas, time
end function subacl
end **interface**
real :: weight, thrust, velgas, time
write(*,*) 'Input data: '
write(*,*) 'Weight of rocket (lbs): '
read(*,*) weight
write(*,*) 'Thrust of the engine (lbs): '
read(*,*) thrust
write(*,*) 'Velocity of exhaust gas (ft/sec): '
read(*,*) velgas
write(*,*) 'Duration thrust (sec): '
read(*,*) time
write(*,10) weight, thrust, velgas
10 format(/' ',4x,'Output:' &
/' ',8x,'Weight of rocket:',t42,f10.2,' lbs' &
/' ',8x,'Thrust of engines:',t42,f10.2,' lbs' &
/' ',8x,'Velocity of exhaust:',t42,f10.2,' ft/sec')
write(*,12) subacl(weight,thrust,velgas,time)
12 format(/' ',8x,'Acceleration of the vehicle:',t42,f10.2,' ft/sec*sec')
end program entomb1

Now we can test the program:

```
Input data:
Weight of rocket (lbs):
```**10000**
Thrust of the engine (lbs):
**80000**
Velocity of exhaust gas (ft/sec):
**50000**
Duration thrust (sec):
**15**
Output:
Weight of rocket: 10000.00 lbs
Thrust of engines: 80000.00 lbs
Velocity of exhaust: 50000.00 ft/sec
Acceleration of the vehicle: 205.74 ft/sec*sec

Also note how **format** is used here to format the output (the output of the input is somewhat redundant, but I left it here to show the formatting side of things. Especially make note of the **/** to imply a line break, and **t** to tab (to column 42).