Fortran intrinsics reference on fortran-lang.org

The Fortran-lang website now has a thorough intrinsics reference:

Many thanks to @urbanjost and reviewers for this big contribution!

20 Likes

Could you by any chance point me at the part of the repo that holds what I assume are the HTML files?
I would like to see if I can have fortls download the intrinsics html/JSON/any file instead of having to keep a separate JSON updated.

It’s a real pain having to keep up to date with the standards

I replied in a previous post about the exp() function for complex argument with non default kind that the description was incorrect. That discussion, and the correction, did not make it into the final document.

@gnikit, the sources are Markdown, one file per intrinsic. See Fortran Intrinsics by urbanjost · Pull Request #347 · fortran-lang/fortran-lang.org · GitHub for all the files that were introduced.

@RonShepard can you point me to that thread? Let’s fix it.

This is terrific! Very clean and modern looking.

1 Like

It was Intrinsic descriptions - #25 by RonShepard and there are a few others like RANDOM_INIT seems to be missing and some changes to RANDOM_SEED and CPU_TIME seem out of sync with what I thought was the last push; and this might just be a bug in my browser, but I cannot get to end of list of names unless I change my browser scale from 100% to 90%; but nice to see otherwise. Odd, but all the others I have looked at look OK.

1 Like

The change was for this sentence:

if cx=(re,im) then exp(cx)=exp(re)*cmplx(cos(im),sin(im))

It should read something like:

if cx=(re,im) then exp(cx)=exp(re)*cmplx(cos(im),sin(im),kind(cx))

Maybe a link to the cmplx() intrinsic could be added in order to explain why the kind argument is necessary for non default kind result.

1 Like

I personally will urge a lot of caution and a lot of review by different pairs of eyes and editing and settling on a common theme and style and brevity with the examples via a workflow that might borrow from ISO IEC standardization process before hosting this at fortran-lang.

I didn’t manage to look beyond the first description for ABS intrinsic where the first link I noticed “Standard” which is not strictly accurate: ANSI X3.9 1966 (FORTRAN 66) did support ABS as an intrinsic, albeit with a REAL argument only.

Separately it will be nice if instead of the *UX man page reference and style section numbering, a direct naming is applied:
image

image

Also, it is unclear to me how any licensing applies to description of intrinsics in an ISO IEC standard document, it might be better if the author(s) were to “donate” the effort to fortran-lang and for fortran-lang to seek approval from ISO on the nature of the content prior to hosting this:
image

1 Like

Wonderful! Thanks for that work! :champagne:

I have just installed the man pages in Ubuntu, following the instructions in https://fortran-lang.org/learn/intrinsics. But the mand -c command did not work, it was instead mandb -c.

I have also noticed that the code frame # as a user, placing the files in ~/man: seems to be misplaced. I think it should be placed before the sentence “then anyone on that plaform can enter commands like (see man(1))”, not after.

On my machine, amongst these commands:

man sinh.3fortran     # specifically show Fortran sinh(3) documentation
man -k . -s 3fortran  # list all fortran pages
man -s 3fortran --regex '.*' |col -b # show all Fortran intrinsics

the first and last ones work, but the second one returns nothing.

Awesome, Markdown should work too. I will have a look to see if I can make this work.

Thanks to @urbanjost and the reviewers.

Looking at the allocated entry I wonder what the (3) means.

Name

allocated(3) - [ARRAY INQUIRY] Status of an allocatable entity

I think the line of code in the example

   if (allocated(x) .eqv. .false.) allocate(x(i))

should be written more concisely as

   if (.not. allocated(x)) allocate(x(i))
1 Like

I guess the (3) is the man section. Although a total Linux fan, I am not sure these (3) should be present. Fortran is not linked to any operating system and it may be very confusing for people using only Windows. At least for the web version. It has sense of course in the man version.

1 Like

+1.

See this comment upthread where I suggest not to use the *UX based manpages style and numbering on what is hosted at fortran-lang.org website.

2 Likes

The current format supports automatic conversion of the documents to man-pages. The filters currently used require the (3) to be present for that to work. There was discussion in the original threads about whether generation of real man-pages for Unix-like systems should continue, or whether an on-line format allowing for non-ASCII text features like math expressions, graphics, and links was preferred. Included in this release under the experimental suggestion is a tarball with actual *roff manpages, and a conversion to a slidy(1) HTML file, etc. I personally prefer having man-pages available (as well as a system-independent CLI viewer – see fman(1) in the experimental section) but there was strong support for going completely to the more expressive document format(s). The Unix convention allows for distinguishing between when a word is just representing a word, or a procedure, or a command even when just simple plain ASCII is available; whereas other conventions like a key at the beginning of a single document indicating italics or bold or a certain color means function, etc… is generally used in a single published work. If no other format other than the on-line one is going to be supported going forward, a simpe sed(1) program or other simple filter can probably change them all without undo effort s. Anyone can make a push request to change them. Is there consensus that going forward just the on-line format will be supported? The original hope was this would become a community-supported effort with a lot of individuals refining the documentation; so anyone can volunteer to make the change if there is consensus that is the way to go. I definitely hope the pages will continue to be improved by the community. So support for fman(1) and man-pages should end and the Unix-like section designations should go?

1 Like

I have successfully installed it on a second Ubuntu machine and all commands are now working.
Maybe on the first machine I forgot to use sudo on the tar command? I remember the mandb process was much shorter than on the second machine. I will retry on the first machine on Monday.
Thanks.

Just an update on the
M_intrinsics project
for providing Fortran intrinsics descriptions (and ultimately a refresh
of the fortran-lang intrinsics pages).

About 1/2 way through a phase-II rewrite of the descriptions of the
Fortran intrinsics, reviewing each page against the 2018 standard,
trying a newer format that uses pseudo-Fortran in the SYNOPSIS section
to describe the procedure characteristic, and continuing development of
the example programs.

The goal is to provide an update to the fortran-lang pages as well as
generating new man-pages and an improved fman/fpm-man program (same
program, when you rename it to “fpm-man” it becomes an fpm(1) plugin).

  • slides are the easiest view mode.
    With the caveat that these are a WIP (Work In Progress) please feel free to leave comments and feedback
    in the “Issues” section of the M_intrinsics project site.

  • manpages.zip for anyone who wants to try the man-pages

  • standalone file fman.f90
    is a single-file build of the terminal-based viewer, which can also easily extract the example programs

    • builds with gfortran fman.f90
    • builds with ifort -O1 fman.f90
    • feedback on other processors would be appreciated
1 Like