https://github.com/interkosmos/fortran-ncurses
Fortran 2018 interface bindings to ncurses
https://github.com/interkosmos/fortran-ncurses
curses fortran fortran-2018 fpm ncurses
Last synced: 4 months ago
JSON representation
Fortran 2018 interface bindings to ncurses
- Host: GitHub
- URL: https://github.com/interkosmos/fortran-ncurses
- Owner: interkosmos
- License: isc
- Created: 2025-09-18T08:15:19.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2025-09-23T16:02:06.000Z (9 months ago)
- Last Synced: 2025-10-30T01:55:40.806Z (8 months ago)
- Topics: curses, fortran, fortran-2018, fpm, ncurses
- Language: Fortran
- Homepage:
- Size: 51.8 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fortran-ncurses
A work-in-progress collection of auto-generated ISO C binding interfaces to
ncurses for Fortran 2018, similar to
[M_ncurses](https://github.com/urbanjost/M_ncurses).
## Build Instructions
Execute the Makefile to build and install the library:
```
$ make
$ make install PREFIX=/opt
```
Depending on the ncurses library installed locally, you may have to generate the
constants module `ncurses_const.f90`, for instance:
```
$ make mkconst
$ ./mkconst src/ncurses_const.f90
```
To build all example programs:
```
$ make examples
```
## Example
Basic example program to initialise ncurses and output a string:
```fortran
! example.f90
program main
use :: ncurses
implicit none (type, external)
integer :: ch, rc
stdscr = initscr()
rc = noecho()
rc = curs_set(0)
rc = printw('Hello, World!' // c_null_char)
ch = getch()
rc = endwin()
end program main
```
Compile, link, and run the program:
```
$ gfortran -I/opt/include/libfortran-ncurses -o example example.f90 /opt/lib/libfortran-ncurses.a -lncurses
$ ./example
```
## Fortran Package Manager
You can add _fortran-ncurses_ as an FPM dependency to your `fpm.toml`:
```toml
[dependencies]
fortran-ncurses = { git = "https://github.com/interkosmos/fortran-ncurses.git" }
```
## Compatibility
* All character strings passed to the interfaces have to be null-terminated
with `c_null_char`.
* The ncurses macros `COLOR_PAIR`, `COLOR_PAIRS`, `COLORS`, `COLS`, `LINES` and
`PAIR_NUMBER` are bound through functions of the same name.
## References
* Pradeep Padala, Thomas E. Dickey: [NCURSES Programming HOWTO](https://invisible-island.net/ncurses/howto/NCURSES-Programming-HOWTO.html)
* Eric S. Raymond, Zeyd M. Ben-Halim, Thomas E. Dickey: [Writing Programs with NCURSES](https://invisible-island.net/ncurses/ncurses-intro.html)
* [ncurses manuals](https://alfonsosiciliano.gitlab.io/posts/2021-11-03-ncurses-manuals.html)
## Licence
ISC