forked from zufuliu/notepad4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Fortran.f
493 lines (454 loc) · 10.1 KB
/
Fortran.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
! https://wg5-fortran.org/
! https://fortranwiki.org/fortran/show/HomePage
! https://gcc.gnu.org/onlinedocs/gfortran/
! https://wg5-fortran.org/documents.html
! 2018 N2146 https://wg5-fortran.org/N2101-N2150/N2146.pdf
! 2023 https://j3-fortran.org/doc/year/24/24-007.pdf
!! keywords ===========================================================
INCLUDE ! Including source text
! Types
CLASS TYPEOF CLASSOF ! Type specifier
FINAL ! FINAL statement
ENUMERATOR ! Enumerations and enumerators
! Attribute declarations and specifications
IMPLICIT NONE ! IMPLICIT statement
IMPORT ONLY NONE ALL ! IMPORT statement
NAMELIST ! NAMELIST statement
EQUIVALENCE
COMMON
! Use of data objects
ALLOCATE NULLIFY DEALLOCATE ! Dynamic association
! Expressions and assignment
ELSEWHERE ! Masked array assignment
! Execution control
CHANGE TEAM ! CHANGE TEAM construct
ENDTEAM
WHILE CONCURRENT CYCLE ! DO construct
ELSE ELSEIF THEN ! IF construct
SELECT CASE DEFAULT RANK ! SELECT CASE construct
ENDSELECT
SELECT TYPE IS
ENDSELECT
EXIT
GO TO GOTO ! GO TO statement
ERROR STOP
FAIL IMAGE ! FAIL IMAGE statement
NOTIFY WAIT ! NOTIFY WAIT statement
! Image control statements
SYNC ALL
SYNC IMAGES
SYNC MEMORY
SYNC TEAM
EVENT POST
EVENT WAIT
FORM TEAM
LOCK
UNLOCK
! Input/output statements
OPEN CLOSE READ WRITE PRINT
WAIT BACKSPACE END FILE ENDFILE REWIND
FLUSH
INQUIRE
! Input/output editing
FORMAT
! Program units
USE ONLY ! USE statement
BLOCK DATA
END
! Procedures
PROCEDURE
GENERIC
CALL
RESULT ! Function subprogram
ENTRY RETURN CONTAINS
! Deleted and obsolescent features
PAUSE ASSIGN
! gfortran
STRUCTURE RECORD UNION MAP
!! attribute ===========================================================
! Types
ABSTRACT BIND EXTENDS ! Derived-type definition
SEQUENCE ! Sequence type
KIND LEN ! Derived-type parameters
! Type declaration statement
PUBLIC PRIVATE ! Accessibility attribute
ALLOCATABLE ASYNCHRONOUS
BIND NAME ! BIND attribute
CODIMENSION CONTIGUOUS
DIMENSION
EXTERNAL
INTENT IN OUT INOUT ! INTENT attribute
INTRINSIC
OPTIONAL
PARAMETER POINTER PROTECTED
SAVE
TARGET
VALUE
VOLATILE
! Components
NOPASS PASS POINTER ! proc-component-attr-spec
DEFERRED NON_OVERRIDABLE ! binding-attr
! Use of data objects
NOTIFY STAT TEAM TEAM_NUMBER ! Image selectors
ERRMSG MOLD SOURCE STAT ! ALLOCATE statement
! Execution control
LOCAL LOCAL_INIT SHARED DEFAULT NONE ! DO construct
QUIET ! STOP and ERROR STOP statements
UNTIL_COUNT ! EVENT WAIT
NEW_INDEX ! FORM TEAM
ACQUIRED_LOCK ! LOCK and UNLOCK statements
! OPEN statement
ACCESS ACTION ASYNCHRONOUS BLANK DECIMAL DELIM ENCODING ERR FILE FORM IOMSG IOSTAT LEADING_ZERO NEWUNIT PAD POSITION RECL ROUND SIGN STATUS UNIT
! Control information list
ADVANCE ASYNCHRONOUS BLANK DECIMAL DELIM ERR EOR FMT ID IOMSG IOSTAT LEADING_ZERO NML PAD POS REC ROUND SIGN SIZE UNIT
! INQUIRE statement
ACCESS ACTION ASYNCHRONOUS BLANK DECIMAL DELIM DIRECT ENCODING ERR EXIST FILE FORM FORMATTED ID IOLENGTH IOMSG IOSTAT NAME NAMED NEXTREC NUMBER OPENED PAD PENDING POS POSITION READWRITE RECL ROUND SEQUENTIAL SIGN SIZE STREAM UNFORMATTED UNIT WRITE
! Program units
INTRINSIC NON_INTRINSIC OPERATOR ! USE statement
ABSTRACT OPERATOR ASSIGNMENT FORMATTED UNFORMATTED ! procedure interface
ELEMENTAL IMPURE NON_RECURSIVE PURE RECURSIVE ! Intrinsic procedure definition
! gfortran
CONVERT AUTOMATIC STATIC
!! type ===========================================================
! Intrinsic types
CHARACTER COMPLEX
DOUBLE PRECISION DOUBLEPRECISION
LOGICAL
INTEGER
REAL
! intrinsic modules
EVENT_TYPE LOCK_TYPE TEAM_TYPE
! IEEE arithmetic
! ISO_C_BINDING intrinsic module
! gfortran
TYPESPEC
!! code folding ===========================================================
! Types
TYPE ! Derived-type definition
ENDTYPE
ENUM ! Enumerations and enumerators
ENDENUM
ENUMERATION TYPE
END ENUMERATION TYPE
! Expressions and assignment
WHERE ! Masked array assignment
ENDWHERE
FORALL
ENDFORALL
! Execution control
ASSOCIATE
ENDASSOCIATE
BLOCK
ENDBLOCK
!CHANGE TEAM
!ENDTEAM
CRITICAL
ENDCRITICAL
DO
ENDDO
DO
CONTINUE
IF THEN
ENDIF
SELECT CASE
ENDSELECT
SELECTCASE
ENDSELECT
SELECT TYPE
ENDSELECT
SELECTTYPE
ENDSELECT
SELECT RANK
ENDSELECT
SELECTRANK
ENDSELECT
! Program units
PROGRAM
END PROGRAM
PROGRAM
ENDPROGRAM
MODULE
ENDMODULE
SUBMODULE
ENDSUBMODULE
BLOCK DATA
ENDBLOCK DATA
BLOCKDATA
ENDBLOCKDATA
! Procedures
INTERFACE
ENDINTERFACE
MODULE PROCEDURE
ENDPROCEDURE
FUNCTION
ENDFUNCTION
SUBROUTINE
ENDSUBROUTINE
MODULE FUNCTION
ENDFUNCTION
MODULE SUBROUTINE
ENDSUBROUTINE
!! function ===========================================================
TYPE()
CLASS()
CLASSOF()
TYPEOF()
DIMENSION()
INTENT()
OPEN()
CLOSE()
READ()
WRITE()
WAIT()
BACKSPACE()
ENDFILE()
REWIND()
FLUSH()
INQUIRE()
FORMAT()
! standard intrinsic procedures
! TODO: https://gcc.gnu.org/onlinedocs/gfortran/Intrinsic-Procedures.html
ABS(A)
ACHAR(I [, KIND])
ACOS(X)
ACOSD(X)
ACOSH(X)
ACOSPI(X)
ADJUSTL(STRING)
ADJUSTR(STRING)
AIMAG(Z)
AINT(A [, KIND])
ALL(MASK, DIM)
ALLOCATED(ARRAY)
ANINT(A [, KIND])
ANY(MASK, DIM)
ASIN(X)
ASIND(X)
ASINH(X)
ASINPI(X)
ASSOCIATED(POINTER [, TARGET])
ATAN(X)
ATAN2(Y, X)
ATAN2D(Y, X)
ATAN2PI(Y, X)
ATAND(X)
ATANH(X)
ATANHPI(X)
ATOMIC_ADD(ATOM, VALUE [, STAT])
ATOMIC_AND(ATOM, VALUE [, STAT])
ATOMIC_CAS(ATOM, OLD, COMPARE, NEW [, STAT])
ATOMIC_DEFINE(ATOM, VALUE [, STAT])
ATOMIC_FETCH_ADD(ATOM, VALUE, OLD [, STAT])
ATOMIC_FETCH_AND(ATOM, VALUE, OLD [, STAT])
ATOMIC_FETCH_OR(ATOM, VALUE, OLD [, STAT])
ATOMIC_FETCH_XOR(ATOM, VALUE, OLD [, STAT])
ATOMIC_OR(ATOM, VALUE [, STAT])
ATOMIC_REF(VALUE, ATOM [, STAT])
ATOMIC_XOR(ATOM, VALUE [, STAT])
BESSEL_J0(X)
BESSEL_J1(X)
BESSEL_JN(N, X)
BESSEL_Y0(X)
BESSEL_Y1(X)
BESSEL_YN(N, X)
BGE(I, J)
BGT(I, J)
BIT_SIZE(I)
BLE(I, J)
BLT(I, J)
BTEST(I, POS)
CEILING(A [, KIND])
CHAR(I [, KIND])
CMPLX(X [, Y, KIND])
CO_BROADCAST(A, SOURCE_IMAGE [, STAT, ERRMSG])
CO_MAX(A [, RESULT_IMAGE, STAT, ERRMSG])
CO_MIN(A [, RESULT_IMAGE, STAT, ERRMSG])
CO_REDUCE(A, OPERATION [, RESULT_IMAGE, STAT, ERRMSG])
CO_SUM(A [, RESULT_IMAGE, STAT, ERRMSG])
COMMAND_ARGUMENT_COUNT( )
CONJG(Z)
COS(X)
COSD(X)
COSH(X)
COSHAPE(COARRAY [, KIND])
COSPI(X)
COUNT(MASK [, DIM, KIND])
CPU_TIME(TIME)
CSHIFT(ARRAY, SHIFT [, DIM])
DATE_AND_TIME([DATE, TIME, ZONE, VALUES])
DBLE(A)
DIGITS(X)
DIM(X, Y)
DOT_PRODUCT(VECTOR_A, VECTOR_B)
DPROD(X, Y)
DSHIFTL(I, J, SHIFT)
DSHIFTR(I, J, SHIFT)
EOSHIFT(ARRAY, SHIFT [, BOUNDARY, DIM])
EPSILON(X)
ERF(X)
ERFC(X)
ERFC_SCALED(X)
EVENT_QUERY(EVENT, COUNT [, STAT])
EXECUTE_COMMAND_LINE(COMMAND [, WAIT, EXITSTAT, CMDSTAT, CMDMSG])
EXP(X)
EXPONENT(X)
EXTENDS_TYPE_OF(A, MOLD)
FAILED_IMAGES([TEAM, KIND])
FINDLOC(ARRAY, VALUE, DIM [, MASK, KIND, BACK])
FLOOR(A [, KIND])
FRACTION(X)
GAMMA(X)
GET_COMMAND([COMMAND, LENGTH, STATUS, ERRMSG])
GET_COMMAND_ARGUMENT(NUMBER [, VALUE, LENGTH, STATUS, ERRMSG])
GET_ENVIRONMENT_VARIABLE(NAME [, VALUE, LENGTH, STATUS, TRIM_NAME, ERRMSG])
GET_TEAM([LEVEL])
HUGE(X)
HYPOT(X, Y)
IACHAR(C [, KIND])
IALL(ARRAY, DIM [, MASK])
IAND(I, J)
IANY(ARRAY, DIM [, MASK])
IBCLR(I, POS)
IBITS(I, POS, LEN)
IBSET(I, POS)
ICHAR(C [, KIND])
IEOR(I, J)
IMAGE_INDEX(COARRAY, SUB, TEAM)
IMAGE_STATUS(IMAGE [, TEAM])
INDEX(STRING, SUBSTRING [, BACK, KIND])
INT(A [, KIND])
IOR(I, J)
IPARITY(ARRAY, DIM [, MASK])
ISHFT(I, SHIFT)
ISHFTC(I, SHIFT [, SIZE])
IS_CONTIGUOUS(ARRAY)
IS_IOSTAT_END(I)
IS_IOSTAT_EOR(I)
KIND(X)
LBOUND(ARRAY [, DIM, KIND])
LCOBOUND(COARRAY [, DIM, KIND])
LEADZ(I)
LEN(STRING [, KIND])
LEN_TRIM(STRING [, KIND])
LGE(STRING_A, STRING_B)
LGT(STRING_A, STRING_B)
LLE(STRING_A, STRING_B)
LLT(STRING_A, STRING_B)
LOG(X)
LOG_GAMMA(X)
LOG10(X)
LOGICAL(L [, KIND])
MASKL(I [, KIND])
MASKR(I [, KIND])
MATMUL(MATRIX_A, MATRIX_B)
MAX(A1, A2 [, A3, ...])
MAXEXPONENT(X)
MAXLOC(ARRAY, DIM [, MASK, KIND, BACK])
MAXVAL(ARRAY, DIM [, MASK])
MERGE(TSOURCE, FSOURCE, MASK)
MERGE_BITS(I, J, MASK)
MIN(A1, A2 [, A3, ...])
MINEXPONENT(X)
MINLOC(ARRAY, DIM [, MASK, KIND, BACK])
MINVAL(ARRAY, DIM [, MASK])
MOD(A, P)
MODULO(A, P)
MOVE_ALLOC(FROM, TO [, STAT, ERRMSG])
MVBITS(FROM, FROMPOS, LEN, TO, TOPOS)
NEAREST(X, S)
NEW_LINE(A)
NEXT(A [, STAT])
NINT(A [, KIND])
NORM2(X, DIM)
NOT(I)
NULL([MOLD])
NUM_IMAGES(TEAM)
OUT_OF_RANGE(X, MOLD [, ROUND])
PACK(ARRAY, MASK [, VECTOR])
PARITY(MASK, DIM)
POPCNT(I)
POPPAR(I)
PRECISION(X)
PRESENT(A)
PREVIOUS(A [, STAT])
PRODUCT(ARRAY, DIM [, MASK])
RADIX(X)
RANDOM_INIT(REPEATABLE, IMAGE_DISTINCT)
RANDOM_NUMBER(HARVEST)
RANDOM_SEED([SIZE, PUT, GET])
RANGE(X)
RANK(A)
REAL(A [, KIND])
REDUCE(ARRAY, OPERATION [, MASK, IDENTITY, ORDERED])
REPEAT(STRING, NCOPIES)
RESHAPE(SOURCE, SHAPE [, PAD, ORDER])
RRSPACING(X)
SAME_TYPE_AS(A, B)
SCALE(X, I)
SCAN(STRING, SET [, BACK, KIND])
SELECTED_CHAR_KIND(NAME)
SELECTED_INT_KIND(R)
SELECTED_LOGICAL_KIND(BITS)
SELECTED_REAL_KIND([P, R, RADIX])
SET_EXPONENT(X, I)
SHAPE(SOURCE [, KIND])
SHIFTA(I, SHIFT)
SHIFTL(I, SHIFT)
SHIFTR(I, SHIFT)
SIGN(A, B)
SIN(X)
SIND(X)
SINH(X)
SINPI(X)
SIZE(ARRAY [, DIM, KIND])
SPACING(X)
SPLIT(STRING, SET, POS [, BACK])
SPREAD(SOURCE, DIM, NCOPIES)
SQRT(X)
STOPPED_IMAGES([TEAM, KIND])
STORAGE_SIZE(A [, KIND])
SUM(ARRAY, DIM [, MASK])
SYSTEM_CLOCK([COUNT, COUNT_RATE, COUNT_MAX])
TAN(X)
TAND(X)
TANH(X)
TANPI(X)
TEAM_NUMBER([TEAM])
THIS_IMAGE(COARRAY, DIM [, TEAM])
TINY(X)
TOKENIZE(STRING, SET, TOKENS [, SEPARATOR])
TRAILZ(I)
TRANSFER(SOURCE, MOLD [, SIZE])
TRANSPOSE(MATRIX)
TRIM(STRING)
UBOUND(ARRAY [, DIM, KIND])
UCOBOUND(COARRAY [, DIM, KIND])
UNPACK(VECTOR, MASK, FIELD)
VERIFY(STRING, SET [, BACK, KIND])
COMPILER_OPTIONS()
COMPILER_VERSION()
! IEEE arithmetic
! ISO_C_BINDING intrinsic module
! misc ===========================================================
! Symbols
AND EQ EQV FALSE GE GT LE LT NE NEQV NOT OR TRUE
XOR LOC ! gfortran
! Standard intrinsic modules
ISO_FORTRAN_ENV
ATOMIC_INT_KIND ATOMIC_LOGICAL_KIND
CHARACTER_KINDS CHARACTER_STORAGE_SIZE
CURRENT_TEAM
ERROR_UNIT
FILE_STORAGE_SIZE
INITIAL_TEAM
INPUT_UNIT
INT8 INT16 INT32 INT64 INTEGER_KINDS
IOSTAT_END IOSTAT_EOR IOSTAT_INQUIRE_INTERNAL_UNIT
LOGICAL_KINDS
NUMERIC_STORAGE_SIZE
OUTPUT_UNIT
PARENT_TEAM
REAL_KINDS REAL32 REAL64 REAL128
STAT_FAILED_IMAGE STAT_LOCKED STAT_LOCKED_OTHER_IMAGE STAT_STOPPED_IMAGE STAT_UNLOCKED STAT_UNLOCKED_FAILED_IMAGE
! IEEE arithmetic
! ISO_C_BINDING intrinsic module