Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
43 views20 pages

Code::Blocks IDE for Fortran Development

Code::Blocks is an open-source IDE primarily designed for C++ and Fortran, first developed in 2004. It features a FortranProject plugin that enhances its functionality for Fortran users, including code completion, debugging, and code refactoring tools. The IDE supports multiple platforms and allows for custom builds, making it a versatile choice for developers working with Fortran.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views20 pages

Code::Blocks IDE for Fortran Development

Code::Blocks is an open-source IDE primarily designed for C++ and Fortran, first developed in 2004. It features a FortranProject plugin that enhances its functionality for Fortran users, including code completion, debugging, and code refactoring tools. The IDE supports multiple platforms and allows for custom builds, making it a versatile choice for developers working with Fortran.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Code::Blocks: Open Source IDE for Fortran

Darius Markauskas
Code::Blocks IDE

Open source project: http://codeblocks.org

First commits to SVN by “mandrav” in 2004

Development using: C++, wxWidgets, Scintilla

Code organized into a core and plugins

Runs on Linux, Windows, Mac (?)

Oriented towards C++ and Fortran

Scintilla

2
FortranProject plugin
Settings->Editor...

Makes C::B useful for Fortran

There are other parts in IDE too,
where Fortran specific code is
included: Fortran compilers,
SmartIndentFortran plugin…

Was started in 2010 by “darmar” (me)

About 29k of code lines (C::B >400k)

Custom build for Linux and Windows
and more useful information for
Fortran users on:

http://cbfortran.sourceforge.net

3
Code organization using the IDE

User files are grouped into workspaces, projects and targets

Workspace

Project 1 Project 2

Build target 1 Build target 2


File 2

File 4
File 1

File 3

4
Editor

Syntax highlighting (for free and
fixed source code forms)

Code folding

Occurrences highlighting: highlights
selected word in editor

Fortran construct highlighter

Keyboard shortcuts adjustment
(Settings→Editor→Keyboard shortcuts)Editor→Editor→Keyboard shortcuts)Keyboard shortcuts)

5
Code completion

Is shown when you type or on Settings→Editor→Keyboard shortcuts)Editor
“Ctrl+Space”

Code completion for:
– Keywords
– Defined variables, procedures
– Derived type components
– Type-bound procedures

Follows use-association

Uses logic to make CC list
shorter (smart code-
completion)

6
Call-tips, tool-tips


Call-tips: show information
about dummy arguments
(Shift+Ctrl+Space)

Tool-tips: are shown when
mouse is kept over item

7
Auto-complete, auto-insert


Auto-complete: Not code-completion!
– Replaces typed keyword with the
predefined code
– Invoked by typing one of the keywords and
pressing “Ctrl+J” (Edit→Editor→Keyboard shortcuts)Auto-complete)
– Change, add new:
Settings→Editor→Keyboard shortcuts)Editor→Editor→Keyboard shortcuts)Abbreviations


Auto-insert:
– Inserts “end...” after “do”, “if(…)then” etc.
– Options: Settings→Editor→Keyboard shortcuts)Editor→Editor→Keyboard shortcuts)FortranProject,
Auto insert tab

8
Symbols Browser

Displays defined items in a
workspace, an active project or a
current file:
– Global and module procedures
– Modules
– Submodules
– Local variables

Recognizes public/private items

Item, where the cursor is, is marked
in bold

Double-click to go to the declaration

9
Compilation
Settings→Editor→Keyboard shortcuts)Compiler

Code compilation from within IDE

IDE’s build-in build system is used

Takes care of dependencies between
Fortran files

If possible, several files are compiled
at the same time

Possibility to use external makefiles

Compiler support: Gfortran, Intel,
PGI, Oracle Fortran

Additional compilers can be added by
users

10
Debugging

Debugging with GDB debugger

Watches window

GDB command prompt

CBFortran custom build:
– Improvement through use of Python
pretty printer
– Possibility to visualize 1D and 2D
arrays with Gnuplot

More info:
http://cbfortran.sourceforge.net/debugging

11
Call/Called-by tree

Shows called/calling procedures in
a tree

Enables easy navigation in the
code

To show: right-click on a procedure
or module name and choose
“Show→Editor→Keyboard shortcuts)Call tree/Called-By tree”

If build takes too long, decrease
“Call tree depth limit” on
FortranProject setting dialog

12
Navigation in code

BrowseTracker plugin:
– Tracks mouse clicks
– Menu: View→Editor→Keyboard shortcuts)Jump→Editor→Keyboard shortcuts)Jump Back / Jump Fwrd
– BrowserTracker toolbar

Go to the previous files: “Alt+Left”

Right-click “Jump to ‘Name’”

Call/Called-By tree

13
Code refactoring


Change case:
– Change case for keywords and/or other names

Tab2space:
– replaces tabs with spaces
– useful for fixed form source code

Format indent:
– adjusts indentation of the code
– originally developed as a separate plugin by YWX
([email protected])

All refactoring tools are found in Fortran menu

14
Generation of makefile

Generates a makefile for current project

Access through Fortran menu

Generated makefile can be used only on
Linux (does anybody need it on Windows?)

15
BindTo tool

Generates a wrapper code for Fortran to be called from C and Python

More about BindTo: http://cbfortran.sourceforge.net/bindto/

Fortran wrapper code

Fortran code BindTo C headers

Cython code
(to be called from Python)

16
Demonstration in Code::Blocks

17
Ongoing work: a problem

The Fortran Template Library (FTL)


https://github.com/SCM-NV/ftl

Implements:
generic containers, algorithms,
string manipulation

typedef std::vector<int> ftlDynArrayInt

18
Ongoing work: a solution

Implementation of preprocessor directives

19
Milian Curcic: “Fortran should feel like play and not work”

Try ;)

Thank you for your attention!

20

You might also like