help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Debug Fortran 90 code in Emacs with arguments.


From: Hongyi Zhao
Subject: Debug Fortran 90 code in Emacs with arguments.
Date: Tue, 5 Apr 2022 10:27:41 +0800

I've the following Fortran 90 code snippet adapted from here [1]:

```
program echo_command_line
  integer i, cnt, len, status
  character c*100, b*100

  call get_command (b, len, status)
  if (status .ne. 0) then
     write (*,*) 'get_command failed with status = ', status
     stop
  end if
  write (*,*) 'command line = ', b (1:len)

  call get_command_argument (0, c, len, status)
  if (status .ne. 0) then
     write (*,*) 'Getting command name failed with status = ', status
     stop
  end if
  write (*,*) 'command name = ', c (1:len)

  cnt = command_argument_count ()
  write (*,*) 'number of command arguments = ', cnt

  do i = 1, cnt
     call get_command_argument (i, c, len, status)
     if (status .ne. 0) then
       write (*,*) 'get_command_argument failed: status = ', status, '
arg = ', i
       stop
     end if
     write (*,*) 'command arg ', i, ' = ', c (1:len)
  end do

  write (*,*) 'command line processed'
  end
```

The above code snippet must be run and debug with some arguments, say,
as follows:

-o 42 -a hello b

So, I want to know how to debug Fortran 90 code in Emacs with arguments.

[1] 
https://www.intel.com/content/www/us/en/develop/documentation/fortran-compiler-oneapi-dev-guide-and-reference/top/language-reference/a-to-z-reference/c-to-d/command-argument-count.html#command-argument-count

Regards
-- 
Assoc. Prof. Hongsheng Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province



reply via email to

[Prev in Thread] Current Thread [Next in Thread]