Giter VIP home page Giter VIP logo

fortran-index-args's Introduction

fortran-index-args.el

Motivation

Legacy scientific codes written in fortran tend to define subroutines with very long lists of arguments (in the order of several dozens). When reading and debugging such code, one often has to count all arguments to the subroutine to identify the correspondance between an argument in the subroutine definition and its counterpart in the call.

fortran-index-args helps doing this by numbering arguments and showing indexes before each argument in the list. Such indexes are just displayed on screen, but do not modify the underlying buffer.

Example (screencast):

C Subroutine definition
      SUBROUTINE MCGFLX(SUBFFI,SUBFFA,SUBSCH,CYCLIC,KPSYS,IPRINT,IPTRK,
     1           IFTRAK,IPMACR,NDIM,K,KPN,NLONG,NREG,NSOUT,NG,NGEFF,
     2           NGIND,NZON,MATALB,V,FIMEM,QFR,M,NANI,MAXI,IAAC,KRYL,
     3           ISCR,NMU,NANGL,NMAX,LC,EPSI,CAZ,CPO,ZMU,WZMU,LFORW,
     4           PACA,NFUNL,NMOD,ISGNR,KEYFLX,KEYCUR,SIGAL,LPS,REPS,EPS,
     5           ITST,NCONV,LNCONV,REBFLG,STIS,NPJJM,SOUR,FLUX,LPRISM,
     6           N2REG,N2SOU,NZP,DELU,FACSYM)
C ...
C ...
      END



C Somewhere else in the code: a call to the subroutine
C ...
         CALL MCGFLX(MCGFFI,MCGFFA,MCGDDF,CYCLIC,IBASE(KPSYS),IMPX,
     1           IPTRK,IFTRAK,IPMACR,NDIM,NFI,NUNKNO,NLONG,NBREG,NSOU,
     2           NGRP,NGEFF,IBASE(INGIND),IBASE(INZON),IBASE(MATALB),
     3           BASE(IV),FUNKNO,SUNKNO,NBMIX,NANI,MAXI,IAAC,KRYL,ISCR,
     4           NMU,NANGL,NMAX,LC,EPSI,BASE(ICAZ),BASE(ICPO),BASE(IZMU),
     5           BASE(IWZMU),LFORW,PACA,NFUNL,NMOD,IBASE(ISGNR),
     6           BASE(IKEY),IBASE(KEYCUR),BASE(ISIGAL),LPS,BASE(IREPS),
     7           BASE(IEPS),IBASE(ITST),LBASE(INCONV),LNCONV,REBFLG,
     8           STIS,NPJJM,BASE(IS),BASE(IPHI),LPRISM,N2REG,N2SOU,NZP,
     9           DELU,FACSYM)
C ...

Installation

Just drop fortran-index-args.el somewhere and load it.

(load "/path/to/fortran-index-args.el")

Usage

  1. place point in a subroutine arguments list
  2. call M-x fia/display to display arguments indices
  3. call M-x fia/cleanup to remove indices and return to the previous view of the buffer.

Alternatively, call M-x fia/toggle to toggle subroutine arguments indexing.

Customization

You might want to bind fia/toggle to a convenient key. For example:

(define-key fortran-mode-map (kbd "C-c i") 'fia/toggle)

License

Copyright (C) 2013 François Févotte.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

fortran-index-args's People

Contributors

ffevotte avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.