ifx 2025.0 å°ã Fortran 2023 ã«å¯¾å¿
overview
www.intel.com
Compiler Release Notes
You can specify new pure intrinsic subroutines SPLIT and TOKENIZE.
www.intel.com
Fortran 2023 æ©è½ã¨ãã¦ã¯ãæååããåèªãåãåºãããã®ãµãã«ã¼ãã³ SPLIT 㨠TOKENIZE ã®äºã¤ãå®è£
ãããããã§ãã
John Reid ã® The new features of Fortran 2023 ãåèã«ãã¦ã以ä¸ã§è©¦ãã¦ã¿ã¾ãã
https://wg5-fortran.org/N2201-N2250/N2212.pdf
Fortran 2023 æ©è½ã試ã
split
æå®ããåºåãæåã®ä½ç½®ãé ã
ã«è¿ãã¦ããã¾ãã
ã½ã¼ã¹ã»ããã°ã©ã
program split_test
implicit none
character(len = :), allocatable :: text
integer :: ipos
text = 'The rain in Spain stays mainly in the plain.'
ipos = 0
do
call split(text, ' .', ipos)
print *, ipos
print *, text(:ipos-1)
if (ipos > len_trim(text)) exit
end do
end program split_test
å®è¡ä¾
4
The
9
The rain
12
The rain in
18
The rain in Spain
24
The rain in Spain stays
31
The rain in Spain stays mainly
34
The rain in Spain stays mainly in
38
The rain in Spain stays mainly in the
44
The rain in Spain stays mainly in the plain
45
The rain in Spain stays mainly in the plain.
tokenize
ã½ã¼ã¹ã»ããã°ã©ã
tokenize ã¯äºã¤ã®ãµãã«ã¼ãã³ã®ç·ç§°åã«ãªã£ã¦ãã¦ãå¼æ°ã®ä¸ãæ¹ã§æ¯ãèããç°ãªãã¾ãã
æåã® tokenize ã®å¼ã³åºãã§ã¯ãæå®ããåºåãæåã§åãåºããæååãé
åã«å
¥ã£ã¦è¿ããã¾ããæååã®é
åã¯é·ããåãã«ãªããªãã¨ãã¡ãªã®ã§ã空ç½ã padding ããã¦æé·ã®åèªæååã®é·ãã§è¿ããã¾ããã¾ããªãã·ã§ã³ã§ååºåãæåãè¿ãã¦ãããã¾ãã
äºçªç®ã® tokenize ã®å¼ã³åºãã§ã¯ãæå®ããåºåãæåã§åºåãããåèªã®æåã¨æå¾ã®æåã®ä½ç½®ãããããé
åã«è¿ãã¾ããæååå
ã®ä½ç½®ãè¿ãç¹ã§ã¯ split ã«å°ãè¿ãã¨ãããããã¾ãããåºåãæåã®ä½ç½®ãè¿ãã token ã®ä½ç½®ãè¿ããã®éããããã¾ãã
ãªã Fortran ã®ç¶ç¶è¡ã®è¨å· & ã¯ãæååã®éä¸ã§æ¹è¡ããã¨ãä½è¨ãªç©ºç½ãå
¥ããªãããã«ãæ«å°¾ã®ï¼ã¯æ¬¡ã®è¡ã® & ã®ã¨ããããé£ç¶ããããã«ãªã£ã¦ãã¾ãã
program token_test
implicit none
character(len = :), allocatable :: text, tokens(:), separator(:)
integer, allocatable :: first(:), last(:)
integer :: i
text = 'Old King Cole was a merry old soul,&
&And a merry old soul was he;'
call tokenize(text, ' ,;', tokens, separator)
do i = 1, size(tokens)
print *, i, ':', tokens(i), ':'
end do
do i = 1, size(separator)
print *, i, ':', separator(i), ':'
end do
print *
call tokenize(text, ' ,;', first, last)
do i = 1, size(first)
print *, i, first(i), last(i), ':', text(first(i):last(i)), ':'
end do
end program token_test
å®è¡çµæ
1 :Old :
2 :King :
3 :Cole :
4 :was :
5 :a :
6 :merry:
7 :old :
8 :soul :
9 :And :
10 :a :
11 :merry:
12 :old :
13 :soul :
14 :was :
15 :he :
16 : :
1 : :
2 : :
3 : :
4 : :
5 : :
6 : :
7 : :
8 :,:
9 : :
10 : :
11 : :
12 : :
13 : :
14 : :
15 :;:
1 1 3 :Old:
2 5 8 :King:
3 10 13 :Cole:
4 15 17 :was:
5 19 19 :a:
6 21 25 :merry:
7 27 29 :old:
8 31 34 :soul:
9 36 38 :And:
10 40 40 :a:
11 42 46 :merry:
12 48 50 :old:
13 52 55 :soul:
14 57 59 :was:
15 61 62 :he:
16 64 63 ::