Programming Guidelines

  1. Decide on which language to program in. If you only know one language (and it is either Fortran or C) then this will be an easy decision. If you are bilingual, consider the subroutine libraries.

  2. Examine the BSU and some 3rd Party subroutine libraries

    Consult these libraries to see which pre-existing subroutines might serve your needs. Your choice of programming language may depend on what is available in each language. Of course, you can always add to the subroutine libraries, so this is not the only issue.

  3. Examine Other 3rd party libraries that you may need. PLPLOT can be called from both C and Fortran. For linear algebra, the LAPACK libraries are available in both Fortran and C. Further, the GSL library has some duplication of LAPACK in it (strictly C only). For other scientific functions, the GSL libraries are in C, and the CMLIB material is Fortran.
  4. Copy a master example to a new file name. The programs are:
        bsu-3.0.2/src/Fort/bsegy/bmst.f
        bsu-3.0.2/src/C/bsegy/cmst.c
    These programs are simple examples which you can copy to a new file, and then edit. What they do is read traces from a BSEGY data set. As each trace is read, it is rectified with an absolute value function. The rectified trace is output. What you will want to do is replace the absolute value part with your own calculations. The source code for main programs should be kept located in the appropriate bsegy directory.
  5. Edit the new program. You will need to change the process name character string (4 characters), the input parameter function/subroutine, and the output listing function/subroutine to meet your needs (see section 4.2 below). You will replace the computation section with your own code.
  6. Edit Makefile.am. You will want to add your program to the file.
       a). Add your process to the list of executables at the top (bin_PROGRAMS=).
       b). Add a filename_SOURCES=filename.c or filename_SOURCES=filename.f
       c). If you are adding to the one of the subroutine libraries, then all you need to do to the Makefile.am in the subroutine directory is to add the name of the new source file to the list at the top of Makefile.am.
    (ie. libsubF4_la_SOURCES= or libsubC4_la_SOURCES=).
  7. Re-configure the build tree Change back to the bsu-3.0.2 top directory and re-run configure.
  8. Compile your new program Type:

    make

  9. Install your new program. Type:

    make install

    (this will install everything, so you might only want to explicitly install the executable manually).

  10. Write a man page for your new program. Start with an existing man page, and modify it to meet your specific needs. Use man1 for main programs, man3 for subroutines. Install in the appropriate directory:
    bsu-3.0.2
    |-- man
    | |-- man1
    | |-- man3
    | |-- man5
    | `-- man7