FORTRAN SPECS

FORTRAN is used to develop ROBACUS because its simplicity. In fact, only a subset of FORTRAN is allowed to be used to achieve maximum simplicity. Furthermore, a variable naming convention and strict grammar is followed to allow users to expect maximum consistency and structure in the program modules. All this is extensively planned out in preparation for the ultimate aim of finally pass all the programming to the computer.

The FORTRAN rules are described with the help of actual sample statements. The naming of variable and FORTRAN grammar are explained in the naming convention file, namspe.html.

1. Comments are precede by a "C" in column one:

C*** EXECUTION FLOW CONTROL ***

2. Subroutine statement with name, SUBNAM, starting in column 7, with arguements, ARGNA1 and ARGNA2, which are passed between the subroutine and its calling routine:


(6 spaces)SUBROUTINE SUBNAM(ARGNA1,ARGNA2)

3. Character strings are declared for argument and other variables with length=40.


(6 sp)CHARACTER*(*) ARGNA1(1)
(6 sp)CHARACTER*40 TITLES,QUESTI

where the character length for a string only need to be declared as '*(*)' and the size of an array as (1).

4. the RETURN/END statements are used to end a subroutine


(6 sp)RETURN
(6 sp)END

5. Calling statement of this subroutine:

(6 sp)CALL SUBNAM(ARGNA1,ARGNA2)

6. Dimension statement declare array
dimension:

(6 sp)DIMENSION REAARR(10)

7. Integer variables are prefixed by I, J, K, L, and M. All else are real variables.

8. Common block, AUTDAT, declares common use of variables in different subroutines. Any numbers enclosed in parentheses(see rule 7) are the number of elements in the arrays:

(6 sp)COMMON/AUTDAT/LOGAUT,NUMAUT,LOG

9. Continuation signal is a '+' in column 6:

(5sp)+COL(20),LOGBUG,LOGVER,IDEAUT(1050)

10. Charcter string operation where the resultant string is equal to 1st NUMCHA characters combined with the segment between 5th and 10th character and attached by the last LASCHA characters of, respectively, RESSTR, STRONE and STRTWO.


(6 sp)CHARACTER*40 RESSTR,STRONE,STRTWO
...
(6 sp)RESSTR=RESSTR(:NUMCHA)//STRONE(5:10)
(6 sp)+//STRTWO(LASCHA:)

11. Assign a string value to QUESTI


(6 sp)QUESTI='TIME INCREMENT?'

12. Initialization of variables is done with DATA statements:


(6 sp)CHARACTER*6 ANIFIL(2)
(6 sp)DATA ANIFIL/'table0','boubal'/

13. GOTO statement goes to a CONTINUE statement:


(6 sp)GOTO 155
...
155 CONTINUE

14. IF/THEN/ENDIF block enclose a contingent execution process:


(6 sp)IF(LOGFIR.EQ.1)THEN
...
(6 sp)ENDIF

15. DO loop indexes sequential execution involving elements of arrays:


(6 sp)DO 100 I=1,IM
(6 sp)SUMVAL=SUMVAL+EACVAL(I)
100 CONTINUE

16. Arithmatic operators are:


+,-,*,/,** for add, subtract, multiply, divide and raising to the power, with precedence start with: (**),(/,*),and (+,-) ,and parentheses can be used to force the operations enclosed to be executed as a group prior other executions.

* Relational operators are:


.EQ.,.NE.,.GT.,.GE.,.LT.,.LE.,.AND. and .OR. for equal, not equal, greater than, greater and equal, less than, less or equal, logical AND and logical OR.

* External files can be OPENed with:

(6 sp)OPEN(11,FILE='extfil')

where both '11' and 'extfil' can be replaced by an integer and a character variables, respectively.

17. READ and WRITE statements are used to read in data from keyboard(on unit 5), robots(50), and other files, and write out data to screen(6),robots(60), debugging file(70, except editor on 60), and other files:

(6 sp)WRITE(NUMINP,1111)REAVAR,INTVA1,
(5sp)+INTVA2,CHAVAR
1111 FORMAT('REAL VARIAB=',1PE12.4/
(5sp)+'INTEGE VARIABS=',2I5/
(5sp)+'CHARAC VARIAB=',A40)

18. Unformatted READ(N)/WRITE(N) can also done without specifying a format number.

19. Where the format statement 1111 FORMAT specifies the format of the variables to be outputted, with real number formats being the floating format, 1PE12.4, meaning 1 non-zero digit to the left of decimal, a total of 12 spaces and 4 spaces to the left of the decimal, and also the fixed-point format, F10.2, with similar meaning except the exponential part,...E0?, absent.

The 2I5 means 2 integer variable in 5 spaces and the A40, 40 spaces.

The single quotes are used to enclose string to be directly displayed on the output. Double quotes can also be used when single quotes are to be displayed.

20. A check for the end of file can be include in a READ statement:


(6 sp)READ(11,1111,END=185)STATEM
...
185 CONTINUE

21. Files can be released or deleted, respectively, by:


(6 sp)CLOSE(11)
(6 sp)CLOSE(12,STATUS='delete')

22. Main-program subroutine does not need a subroutine statement

C***** MAIN PROGRAM ********** C SUBROUTINE MAIN

23. The execution can be stopped by:

(6 sp)STOP

2.12 USE INTERFACE SPECS

2.13 EDITOR SPECS

2.14 DIAGNOSER SPECS

2.15 DATA FILE LINK SPECS

2.16 COMPUTER ENGLISH WORDS

2.17 UNIVERSAL LANGUAGE FOR COMPUTING

2.18 SPACE NUCLEAR DESIGN ANALYSIS
heapip.

back to homepage