665
Other Docs Known Problems ProMAX Developer’s Programming Guide Contents Introduction 1 Quick Start 3 Overview of a ProMAX Process 4 Creating your own Directory Hierarchy 5 Writing a Menu 6 Installing the Menu 7 Overriding the Default ProMAX Files 8 Writing a ProMAX Program 10 Viewing Online Documentation 11 Writing Helpfiles 12 Self-guided Tutorial 13 Support Documentation 15 System Overview 17 Your Development Directory 18 Tool Anatomy 19 Programming Exercises: Simple Tools (amp_ratio) 20 amp_ratio Exercise 1: Adding Trace Headers 21 Menus 22 Global Parameters 22 amp_ratio Exercise 2: ordered parameter files 22 amp_ratio Exercise 3: time gates and tables 23 Debugging 24 C Programming Environment 25 Tool Types 26 Programming Exercise: Ensemble Tools (AVO) 27 Programming Exercise: Panel Tools 29 Programming Exercise: Input Tools 30 Programming Exercise: IPC Tools 31 System Overview 33 ProMAX Organization: Areas, Lines, and Flows 34 The User Interface: The Flow Builder 36 Menu Files 37 Flow Execution 38 Super Executive 38 Executive 39 Executive 51

Prog Man.book

Embed Size (px)

DESCRIPTION

promax manual 5

Citation preview

  • ProMAX DevelopersProgramming Guide Contents

    Introduction 1

    Quick Start 3 Overview of a ProMAX Process 4 Creating your own Directory Hierarchy 5 Writing a Menu 6 Installing the Menu 7 Overriding the Default ProMAX Files 8 Writing a ProMAX Program 10 Viewing Online Documentation 11 Writing Helpfiles 12

    Self-guided Tutorial 13 Support Documentation 15 System Overview 17 Your Development Directory 18 Tool Anatomy 19 Programming Exercises: Simple Tools (amp_ratio) 20 amp_ratio Exercise 1: Adding Trace Headers 21 Menus 22 Global Parameters 22 amp_ratio Exercise 2: ordered parameter files 22 amp_ratio Exercise 3: time gates and tables 23

    Debugging 24 C Programming Environment 25 Tool Types 26 Programming Exercise: Ensemble Tools (AVO) 27 Programming Exercise: Panel Tools 29 Programming Exercise: Input Tools 30 Programming Exercise: IPC Tools 31

    System Overview 33 ProMAX Organization: Areas, Lines, and Flows 34 The User Interface: The Flow Builder 36 Menu Files 37 Flow Execution 38 Super Executive 38 Executive 39

    Executive 51Other Docs Known Problems

  • Contents2 Devlopers Programming Guide System Architecture 52 Headers and Global Variables 53 Input Tools 54 Re-entrancy 55 Common Blocks and Parms Structures 56 Executive Functions 57 Communication between Tools 58 OPF Database 59

    Make System 61 Working with ProMAX Systems 62 Getting Started 63 System Administrator Setup 63 User Setup 65

    Converting to the New System 69 Understanding the Directory Structure 70 $PROMAX_HOME/port/include/make/ 70 $PROMAX_HOME/port/bin/ 73 $PROMAX_HOME/sys/bin/ 74 $PROMAX_HOME/port/src/exe/exec/ 76

    Customizing the System 77 Toggling Products: .promax 78 Adding a New Tool 81 Making Your New Executable 84 Incorporating New Functionality 87 Creating Menus 88 Adding a ProMAX Menu 89 Changing Files 91 Understanding the Makefile System 94 C++ Template Instantiation 94 Terms and Variable Descriptions 95 Makefile Techniques 117

    Directory Structure 121 Directory Hierarchy 122 Machine-dependent Directories 125 Directory Naming Conventions 126 Product-dependent Subdirectories 127 Third-party Software 128 Recompilation - GNU Make 129 Makefile Rules 130 Makefile Options 131 User and Master Versions 132 Master Versions for Landmark Clients 134

    C Environment 135Other Docs Known Problems

  • Contents3 Devlopers Programming Guide C Process Components 136 C and FORTRAN Links 137 Calling a FORTRAN Routine from a C Routine 137 Calling a C Routine from a FORTRAN Routine 137

    Global Parameters 139 Trace Header Index Values 139 Re-Entrancy 140

    Tool Types 141 Executive Tools 142 Simple Tools 145 Ensemble Tools 147 Panel Tools 148 Single Buffer Tools 153 Double Buffer Tools 156 Complex Tools 157

    Stand-alone Tools 161 IPC Tools 163 IPC Tool Details 164 IPC Tool Debugging 165

    Global Parameters 167 Overview of Global Parameters 168 Common Blocks and C Structure Descriptions 169

    Ordered Parameter Files 171 Overview of the ProMAX Database 172 Standard Orders 176

    Trace Headers 179 Overview of Trace Headers 180 Definition and Usage of Standard Header Entries 184 Alphabetical Reference of Trace Header Entries 184 Sequential Reference of Trace Header Entries 185

    Parameter Tables 197 Overview of Parameter Tables 198 Structure of ProMAX Tables 198 Table Rules 200 Table Interpolation 200 X Values in Tables 204 Table Extrapolation 205 Table Subroutine Categories 206

    Examples of Table Routines 208 FORTRAN Code Examples 208 C Code Examples 213Other Docs Known Problems

  • Contents4 Devlopers Programming Guide Memory Management 219 Overview of Memory Management 220 C Memory Management 221 Multi-dimensional Arrays 221 Multi-dimensional Routine Names 223 References 225

    FORTRAN Memory Management 226 mem.inc 226 RSPACEz and ISPACEz 227

    Big Vector Routines 228

    Debugging with dbx 229 Overview of dbx 230 System Review 231 Debugging 233 Writing to the packet.job File 233 Creating an Executable for dbx 233 Running dbx 234

    Menus 237 Overview of ProMAX Menus and Landmark Lisp 238 Parts of a ProMAX menu 239 Menu Heading 240 Parameter Specifications 240 exec_data 242 Rules 243

    Tips on Writing Menus 246 Use Examples 246 Keep it Simple 246

    Usable Lisp Functions 247 Lisp Primitives 247 Access & Assignment Functions 250 ProMAX Lisp Extentions 252

    Parameter Menu System 254 Parameter Keywords 255 Parameter Types and Attributes 255 Including Other Menus 266 Rules and Context Sensitivity 266

    pwin 276 Example Macro: Display Shots with AGC 278

    Helpfiles 283 FrameMaker-formatted Helpfiles 284 Starting FrameMaker 284 Creating a New Helpfile 284 Editing a Helpfile 284Other Docs Known Problems

  • Contents5 Devlopers Programming Guide Working with FrameMaker Files 285 Helpfile Organization 288 Example Helpfile 289 Theory 289 Usage 290 References 290 Parameters 291 Interactive Display 292 Common Error Messages 292 Customizing the User Interface 293

    Hypertext 294

    Code Standards 295 C Coding Standards 296 ProMAX C Routine Documentation 297

    FORTRAN Coding Standards 299 General Text File Format 300 Variable Naming and Declarations 301 C preprocessor 302 Comments 303 White Space 304 Code Structure 304 Miscellaneous 305 Purify 305 ProMAX Fortran Routine Documentation 305

    Portable Code 307

    Man Page Reference 309 Using the Man Pages 310 Finding what you want 311

    Appendix: Expanded Directory Structure 313 Expanded Directory Structure 314

    Appendix: C Programming Examples 325 Example Include Files 326 cglobal.h 327 cpromax.h 336 Example Simple Processes 345 simple.menu 346 simple.c 347 ampRatio.c 349

    Appendix: Simple Tool Examples 357 amp_ratio.menu 358 amp_ratio.inc 359Other Docs Known Problems

  • Contents6 Devlopers Programming Guide amp_ratio.f 360 ampRatio.c 367

    Appendix: Ensemble Tool Examples 375 AVO Ensemble Tools 376 avo.menu 377 avo.inc 378 avo.f 379 avoC.c 383 Trace Interpolation Tools 388 prestk_interp.menu 389 prestk_interp.inc 390 prestk_interp.f 391 prestk_interp.c 393

    Appendix: Panel Tool Examples 397 panel_test.menu 398 panel_test.inc 399 panel_test.f 400 panelTest.c 402

    Appendix: Single Buffer Tool Examples 405 ens_define.menu 406 ens_define.inc 407 ens_define.f 408 interp_sb.menu 412 interp_sb.c 413

    Appendix: Double Buffer Tool Examples 417 semblance.menu 418 semblance.inc 420 semblance.f 421 interp_db.menu 427 interp_db.c 428

    Appendix: Complex Tool Examples 433 transform.menu 434 transform.inc 435 transform.f 436 transform.c 439

    Appendix: Input Tool Examples 445 sine_wave.menu 446 sine_wave.inc 448 sine_wave.f 449 sineWave.c 455Other Docs Known Problems

  • Contents7 Devlopers Programming Guide Appendix: Disk Iteration Examples 463 sc_amp.menu 464 sc_amp.inc 465 sc_amp.f 466 disk_iter.menu 469 disk_iter.c 470

    Appendix: Stand-alone Tool Examples 473 prestack.menu 474 prestack.f 475 Makefile_prestack 480 poststack.f 481 Makefile_poststack 484 poststack.c 485 vel_io.f 488

    Appendix: IPC Tool Examples 495 IPC Menu Code 496 IPC C Code 497 IPC FORTRAN Code 499 amp_ratio Menu Code 503 ampRatio C Code 505 amp_ratio FORTRAN Code 511

    Appendix: Global Include File Examples 519 global.inc 520 cglobal.h 526

    Appendix: Ordered Parameter File Examples 537 db_disp.f 538 comp_opf.menu 545 comp_opf.c 548

    Appendix: Lisp Menu Example 551 EXAMPLE.menu 552

    Appendix: C Library Summary 557 Error Routines 559 Control Functions 560 Parameter Input 561 Configuration 562 Database 563 Memory Allocation/Management 567 Trace Headers 569 Trace Muting 570 Velocity (Geophysical Routines) 571Other Docs Known Problems

  • Contents8 Devlopers Programming Guide Vector Routines 572 Parameter Lists 573 Packet Files 574 Parameter Interpolation 575 Unix Interface 576 IPC Tools 577 Parameter Tables 580 PVM 585 Matrix Functions 588 Interpolation Routines 590 Math Functions 594 Signal Processing 596 Plotting 598 Data Structures 599 Sorting and Searching 602

    Appendix: FORTRAN Library Summary 603 Area/Line(Survey)/Flow 605 Configuration 608 Database Orders 609 Domain Mapping 611 Miscellaneous 1 612 Trace I/O 613 Trace Executive 614 Trace Headers 615 Memory Management 616 Mute/Kill 617 Statics 618 Summing 619 Error Routines 620 Parameter Tables 622 Tables Obsolete 624 Parameter Interpolation 625 Parameter Lists 626 String Decoding 628 Miscellaneous 2 629 Parameter Input 631 Packet Files 632 Character Routines 633 Seg-Y Disk 634 Geophysical Routines 635 Signal Processing 637 Disk I/O 640 SEG Vector Routines 641 Resource Reporting 647 UNIX Interface 648Other Docs Known Problems

  • Contents9 Devlopers Programming Guide Index 651Other Docs Known Problems

  • 1 Developers Programming GuideIntroduction

    This Programmers Guide is written and designed to help youcreate ProMAX software modules. It assumes that you arefamiliar with large software system architecture, such as settingup a make system and accessing parameter tables. It providesinstructional text for newer ProMAX programmers and servesas a reference book for experienced ProMAX developers.

    OrganizationWe divided this manual into chapters and sections that discussthe key processes of the ProMAX system. In general, thisconsists of:

    environment setup and testing

    tools and tool building

    We added extensive Appendices to include:

    an expanded directory structure

    source code examples

    C and FORTRAN library summaries

    Documentation ConventionsWe use the following documentation conventions in thismanual:

    Boldface represents menu commands, push-buttonoptions, and keystrokes.

    Courier refers to text that you should type into acommand line and represents program code listings. Whena line of text or code is longer than we can print on one linein this manual, we use the UNIX standard of a backslash (\)at the end of the line to indicate that it continues on thenext line.Other Docs Known Problems

  • 2 Developers Programming Guide Hypertext represents hyperlink-active text; click on this redtext to go to related information.

    Italics emphasizes key terms and concepts and refers youto other documents, chapters, or sections.

    [Italics inside brackets] represent dummy parameters;replace the brackets and their contents with youruser-specific information.

    Text enclosed in a box signifies a warning, caution, or note.A warning or caution warns you when you could lose dataor crash your system. A note emphasizes an importantissue.

    We suggest that you read:

    the Quick Start chapter first for a brief overview ofProMAX IPC processes if you want to implement newcode without investing time in learning the other parts ofthe ProMAX processing system

    the Self-Guided Tutorial chapter first if you are interestedin a step-by-step course in writing ProMAX softwareprocesses

    the System Overview chapter first if you want an overallunderstanding of the ProMAX system. You should then beable to determine how this manual can further help you.

    Example

    This is an example of the box we use for warnings, cautions, andnotes.Other Docs Known Problems

  • 3 Developers Programming GuideQuick Start

    This chapter is designed to give a programmer a quick overviewof a particular type of ProMAX processing process, the IPC(Inter-Process Communication) tool. It should allow you toimplement some new code without investing much time inlearning other parts of the ProMAX programming system. Ifyou have previous experience with ProMAX programming, thischapter may be all that you need to get a program running onthe ProMAX system. If this is not enough to get you going, theSelf-Guided Tutorial chapter takes you step-by-step through aProMAX programming course.

    Topics Covered in this Chapter: Overview of a ProMAX Process Creating your own Directory Hierarchy Writing a Menu Installing the Menu Overriding the Default ProMAX Files Writing a ProMAX Program Viewing Online Documentation Writing HelpfilesOther Docs Known Problems

  • Overview of a ProMAX Process4 Developers Programming GuideOverview of a ProMAX Process

    There are three parts to writing a ProMAX process:

    the menu

    the program

    the helpfile

    The menu is the window that the User Interface pops up to let auser enter parameters for your program. The program is thecode that actually runs. The helpfile hopefully tells people howto use your process without them having to call you too much.

    There are two classes of ProMAX programs: inline flow toolsand stand-alones. Inline flow tools process data as it streams byin a flow; examples are AGC, FK filter, and migrations. Inlineflow tools do not contain an asterisk in the Processes list. Stand-alone tools either read their own data, as occurs with randomdata access, or do not need data, as occurs with velocitymanipulation. Stand-alone tools include such processes as theinteractive velocity editor, interactive velocity analysis, andsome of the statics programs. These tools do contain an asteriskin the Processes list.

    There are two types of inline flow tools: IPC tools and executivetools. IPC tools used to be called socket tools. This Quick Startchapter will only show you how to write an IPC tool. This is arelatively new approach which we recommend for manyapplications, especially if you are just getting started.Developing IPC tools is significantly quicker and simpler thandeveloping non-IPC tools, at little performance cost. If you arean expertfor example, if you have taken a ProMAXprogramming courseyou may decide to write inline flow toolsusing executive tools.Other Docs Known Problems

  • Creating your own Directory Hierarchy5 Developers Programming GuideCreating your own Directory Hierarchy

    To help give you some order to your ProMAX programming,we have a recommended directory hierarchy for you to create inyour home directory. Use the Makeadvance program, which isactually a shell script that is in $PROMAX_HOME/port/bin tocreate this directory hierarchy in your home directory. Theenvironmental variable $PROMAX_HOME is the path towhere your ProMAX software is installed. The default settingduring installation for $PROMAX_HOME is /advance. TheMakeadvance command produces a mirror of the$PROMAX_HOME directory hierarchy, but without any of thefiles. This will let you work on ProMAX modules under yourhome directory.Other Docs Known Problems

  • Writing a Menu6 Developers Programming GuideWriting a Menu

    The menu file is an ASCII file that is interpreted on the fly bythe User Interface. Writing a menu is simple enough that youshould be able to do this using the ProMAX menu filesdelivered with your system as examples. The menus are in$PROMAX_HOME/port/menu/promax. A good example tostart with is vdatum.menu; see also EXAMPLE.menu.

    vdatum.menu is an example of a menu for a an IPC tool. Mostmenus in the system, such as agc.menu, are for inline flow toolsthat are non-IPC tools. The only difference between these twomenus occurs at the beginning of the exec_data section of themenu. You should be able to tell the minor differences betweena IPC tool and a non-IPC tool, so you can still use all the menusas examples.

    An example of a menu of for a stand alone module isautostat.menu. Again, the only difference between this type ofmenu and others occurs at the beginning of the exec_dataportion of the menu.

    We recommend that you write your menu in your mirror of$PROMAX_HOME/port/menu/promax under your homedirectory; that is, under~/$PROMAX_HOME/port/menu/promax.

    Menus are actually written in Lisp. If you write menus often,you will notice that you are starting to learn Lisp. For moreinformation on writing menus, refer to the Menus chapter. Totest the menus you write, use the pwin program which is in$PROMAX_HOME/sys/bin. If you are an emacs user, typepwin my.menu and you should be in familiar surroundings. Ifyou are not an emacs user, type pwin my.menu t and bring upyour favorite editor in another window; you can create, debug,and edit the menu using your editor. After you write your editsto disk, click with the mouse in the pwin window and you willsee the sample menu updated to reflect your changes. If youhave syntax errors in your menu, pwin will generally print theline number containing the syntax error.Other Docs Known Problems

  • Installing the Menu7 Developers Programming GuideInstalling the Menu

    Once you have written a menu that you are happy with, youhave to install it in the ProMAX list of menus that appears in theUser Interface. We recommend that you copy the file$PROMAX_HOME/port/menu/promax/Processes to~/$PROMAX_HOME/port/menu/promax/Processes, which isthe 2D list of menus. The 3D list lives in$PROMAX_HOME/port/menu/promax3d. Now add your menuto the appropriate category. It should be straight forward how todo this by looking at the file. Be sure you do not use the .menusuffix.Other Docs Known Problems

  • Overriding the Default ProMAX Files8 Developers Programming GuideOverriding the Default ProMAX Files

    You need to tell the User Interface where to find your personalProMAX files: your new Processes file, menu, executable, andhelpfile. Edit or create a .promax file in your home directory tolook like this (replace your home directory for /mnt/stof):

    (quote ((:product; This is a comment ("P" "ProMAX" ".:/mnt/stof/promax/1998.6/rs6000/exe"\; executables "/mnt/stof/promax/1998.6/port/menu/promax:\promax" ; menus "/mnt/stof/promax/1998.6/port/menu/promax/Processes" ; Processes file "promax:/mnt/stof/promax/1998.6/port/help\/promax" ; helpfiles "" ; miscellaneous files (use default) "" ; data area (use default) t) ("p" "Prospector" ""

    "prospector" "prospector/Processes" "prospector" ""

    ""

    t) ("3" "3D Promax" ".:/mnt/stof/promax/1998.6/rs6000/exe"

    "/mnt/stof/promax/1998.6/port/menu/promax3d:\promax3d" "/mnt/stof/promax/1998.6/port/menu/promax3d\/Processes" "promax3d" ""

    ""

    t) )))

    Remember that a backslash (\) at the end of a line indicates thatthe line of code is longer than we can print on one line of thismanual and, therefore, continues on the next line; you shouldtype it all as one line without the backslash. Also, you can use a~ rather than typing out your home directory.Other Docs Known Problems

  • Overriding the Default ProMAX Files9 Developers Programming GuideNote that specifying /mnt/stof/promax/1998.6/menu:promaxcreates a search path, separated by a :, for menus. Also notethat just specifying promax or . refers to the default masterdirectory tree such as /advance/port/menu/promax. You can usea . only for the executables master directory; for the others,you must use promax. Thus, this search path above looks first inyour home directory, and then in the master location.

    When you now start the user interface by typing promax or$PROMAX_HOME/sys/bin/promax, the User Interface shouldread your personal Processes file, and you should see your newtool in the list of Processes. You should be able to bring yourmenu into a flow and parameterize it.

    You can supply any number of product stanzas in your personal.promax file, just so long as the initial single character strings,e.g. P and 3, are unique. The User Interface will thendisplay your list under the Products menu item in the Flowwindow and you can select any of them with the mouse prior tobuilding or editing a flow. This avoids having to exit the UserInterface in order to switch between development and/orproduction environments.

    Finally, it is important to remember that the User Interfacelooks at the setting of the environment variable new_menu todetermine the menu init behavior. If new_menu=t, then the UserInterface will re-initialize the menu every time it is displayed. Ifnew_menu=f, then the flow builder will only read files once.This means if you modify the processes file or a menu file afterstarting the flow builder, it will not see your changes.Furthermore, if you add a tool to a flow, the correspondingmenu file will be saved with the flow, and the menu file will notbe read again when the flow is accessed again. Settingnew_menu=t is a big help in testing menus and should be partof the ProMAX programmers environment. This setting slowsdown the User Interface because the menu files are reread;therefore, it is not recommended for the typical productionprocessing environment.Other Docs Known Problems

  • Writing a ProMAX Program10 Developers Programming GuideWriting a ProMAX Program

    To examine a sample IPC tool, written in C, look in$PROMAX_HOME/port/src/exe/c_socket and$PROMAX_HOME/port/src/exe/ampRatio. A sampleFORTRAN IPC tool is in$PROMAX_HOME/port/src/exe/f_socket and$PROMAX_HOME/port/src/exe/amp_ratio. Each of thesedirectories contain sample menus, although you should copy themenus to a more proper location, such as your own menudirectory. Sample FORTRAN standalone programs are in$PROMAX_HOME/port/src/exe/stand_alone.

    A good portion of this manual deals with creating in-line toolsthat are executive tools, not IPC tools. To compile and link theseprograms, go to ~/$PROMAX_HOME/port/src/c_socket. Thentype

    /$PROMAX_HOME/sys/bin/gmake

    which should compile and link the sample code. The executableproduced by this make will reside in~/$PROMAX_HOME/rs6000/exe. For more information on theMake System, refer Make System chapter. For more descriptionon IPC tools or stand-alone programs, see the Tool Typeschapter.

    If you copy this directory and start making modifications to thecode, you will need to change the name in the Makefile tomatch the name of your directory.

    You can change your product file to include your homedirectory in the search path for ProMAX executables. See thedescription in the product file.

    If you install your working source code under the$PROMAX_HOME tree, you can do a gmake there and yourexecutable will be placed under the standard ProMAXexecutable path, $PROMAX_HOME/sys/exe. You could doyour development under the $PROMAX_HOME directory treerather than in your home directory, but we discourage this. Itwill become a maintenance hassle when many developers workin that area.Other Docs Known Problems

  • Viewing Online Documentation11 Developers Programming GuideViewing Online Documentation

    All ProMAX subroutines are accessible from either FORTRANor C. We have online manual pages for these subroutines, whichyou can access by typing

    $PROMAX_HOME/port/bin/aman tblToMatrix

    The aman command supports the -k option; to find all Csubroutines for dealing with tables, type

    aman -k table | fgrep C routine

    For a quick summary of the ProMAX subroutines, type

    aman c_promax

    or

    aman f_promaxOther Docs Known Problems

  • Writing Helpfiles12 Developers Programming GuideWriting Helpfiles

    Documentation is an important part of the ProMAX system.You should write a helpfile for your new process if it is going tobe used in a production processing environment. At Landmark,we use Adobe FrameMaker to generate and edit most of ouronline and printed software documentation. For moreinformation, see the Helpfiles chapter, or contact any memberof the Documentation Department for assistance.Other Docs Known Problems

  • 13 Developers Programming GuideSelf-guided Tutorial

    This chapter is designed to be used as a guide for programmerswho want to learn to write ProMAX software modules. Thetutorial directs you through a sequence of chapters to read andspecific exercises to work on in order to learn the parts of thesystem.

    Topics Covered in this Chapter: Support Documentation System Overview Your Development Directory Tool Anatomy Programming Exercises: Simple Tools (amp_ratio) Debugging C Programming Environment Tool Types Programming Exercise: Ensemble Tools (AVO_exer) Programming Exercise: Panel Tools Programming Exercise: Input Tools Programming Exercise: IPC Tools

    Materials Needed for this Tutorial: This Programmers Reference Manual

    The ProMAX 2D Reference Manual

    The FORTRAN Programmers Reference Manual or the CProgrammers Reference Manual, depending on yourprogramming language preference. These manuals aresummarized in the C Library Summary and FORTRANLibrary Summary appendices.Other Docs Known Problems

  • 14 Developers Programming Guide Access to a computer on which ProMAX and the ProMAXDevelopment Environment have been installed. In addition,the computer must have an editor program, such as vi oremacs, to allow you to create new files, as well as a C orFORTRAN compiler.

    To use this tutorial, simply read through each section and followthe reading and programming exercise assignments. Thespecific reading and exercise assignments are highlighted asfollows:

    Now do this.Before you get started, please note that this chapter refers to theenvironmental variable $PROMAX_HOME, which is the pathname of the directory under which ProMAX is installed. Askyour system administrator for help in setting up your ProMAXenvironment if he or she has not already done so.Other Docs Known Problems

  • Support Documentation15 Developers Programming GuideSupport Documentation

    The online C or FORTRAN Programmers Reference Manualcontains documentation on hundreds of subroutines that areavailable in the ProMAX system. We have summarized thesesubroutines in the C Library Summary and FORTRAN LibrarySummary appendices..

    Take a few minutes now to skim through the C or FORTRAN librarysummaries to become familiar with the subroutine categories, suchas Trace Headers and Parameter Input. To get a even better over-view of the manual, read through the individual subroutine namesand descriptions.

    We discuss only a small percentage of the available subroutinesin this tutorial, so it is up to you to study the library to get themaximum use from it.

    You will also want to refer to the ProMAX Reference Manual.This manual provides basic information about the ProMAXsystem from the users point of view, along with additionalinformation about Parameter tables and other parts of thedatabase. We will give you specific reading assignments inthese chapters at the appropriate times.

    Finally, the ProMAX routines are also documented in the onlinemanual pages. You can access these manual pages by using theaman command. For example, to view the documentation forthe ProMAX routine tblCopy, type:

    aman tblCopy

    from the command line of the computer. Your path must include$PROMAX_HOME/port/bin.

    To see a name and short description of all table routines, type

    aman -k tbl

    Try typing aman tblCopy to see if your environment is set up properlyfor using the aman online documentation.

    If a message is returned saying that there is no manual entry fortblCopy, contact your system administrator for help in settingenvironment variables.Other Docs Known Problems

  • Support Documentation16 Developers Programming GuideAnother aman command allows you to see all ProMAXsubroutine names by category. Type

    aman c_promax

    to see all ProMAX C routines by category, or

    aman fortran_promax

    to see all ProMAX FORTRAN routines by category.Other Docs Known Problems

  • System Overview17 Developers Programming GuideSystem Overview

    The primary function of ProMAX is to create, modify, andexecute processing flows. A flow is a sequence of processeswhich are used to manipulate seismic data. Flows are built byselecting processes from a Processes List. A typical flowcontains an input process, one or more data manipulationprocesses, and a display and/or output process.

    Some of the chapters in this manual provide basic informationon how the system components work together and introduceideas that are present throughout the rest of this tutorial. Othersdescribe the specific processes of the ProMAX system. Becauseyou will be writing new menus which appear as part of the UserInterface, you should have a basic familiarity with the selectionof menu parameters at the User Interface level.

    Turn to the chapter entitled Working with ProMAX in the ProMAX 2DReference Manual. Read the sections entitled Getting Started andBuilding a Flow. These sections provide a brief overview of Areas,Lines, and Flows.

    Read the System Overview, Executive, and Directory Structure inthis manual.

    If you are already familiar with the User Interface, the ProMAXdata directory structure, tables, and datasets, you may skip thesechapters.Other Docs Known Problems

  • Your Development Directory18 Developers Programming GuideYour Development Directory

    In order to develop ProMAX software, a particular directorystructure must exist under the programmers home directory.The following exercises will help you create this directorystructure.

    Read the Make System chapter. Complete the Makeadvance exer-cise in the User Setup section; be sure you can complete the Make-exec exercise. Contact your system administrator if the computerrefuses to allow you to complete everything discussed in the chap-ter.

    Be sure to read the Adding A New Tool section of the Tool Typeschapter. This section provides a recap of the critical components ofa new processing tool and shows how they work together.Other Docs Known Problems

  • Tool Anatomy19 Developers Programming GuideTool Anatomy

    Before you actually get started on the programming exercises,you first need to understand the structure of the ProMAX tools.

    Read the Executive Tools section of the Tool Types chapter. You donot need to read beyond this section, since the remainder of thechapter will be assigned later in the tutorial.

    This assigned reading section provides an overview of thestructure of most ProMAX processes, including the processes inthe programming exercises in this tutorial.Other Docs Known Problems

  • Programming Exercises: Simple Tools (amp_ratio)20 Developers Programming GuideProgramming Exercises: Simple Tools (amp_ratio)The exercises in this tutorial consist primarily of exampleprograms to which you add code as a way of learning theimportant parts of ProMAX programming. The first suchprogram is called amp_ratio.f for FORTRAN programmers, andampRatio.c for C programmers. The functionality of the C andFORTRAN versions is the same, so the program will in generalbe referred to as amp_ratio.

    amp_ratio is an example of a simple tool. A simple tooloperates on a single trace at a time. amp_ratio operates on asingle trace by sliding two windows down the trace, taking theratio of powers in the windows, and outputting the ratio as asample at the beginning of the upper window. This is a crudefirst break picker, since the peak value of the output trace isnormally at approximately the first break time. While thisroutine is not high tech by any means, the programmingexercises involving amp_ratio demonstrate four importantfeatures of ProMAX Programming:

    the general mechanics of adding a tool

    adding and manipulating trace headers

    the use of the ordered parameter files

    the use of tables to store time gates

    The FORTRAN programming exercises that demonstrate theselast three features are amp_ratio1.f, amp_ratio2.f, andamp_ratio3.f, respectively. Working code which containssolutions to all three of these programming exercises can befound in amp_ratio.f. The corresponding C programmingexercises and code is ampRatio1.c, ampRatio2.c, ampRatio3.cand ampRatio.c.

    To begin, move to your own maxtool/amp_ratio directory by typingthe following command on the command line:

    cd ~/$PROMAX_HOME/port/src/lib/maxtool/amp_ratio

    If you are programming in C, copy the .c files from the systemamp_ratio directory to your own directory by typing:

    cp $PROMAX_HOME/port/src/lib/maxtool/amp_ratio/*.c .Other Docs Known Problems

  • Programming Exercises: Simple Tools (amp_ratio)21 Developers Programming GuideIf you are programming in FORTRAN, copy the .f and .inc filesfrom the system amp_ratio directory to your own directory bytyping a command similar to the one above.

    Set the access permissions to the files by typing:chmod 644 *.*

    Next you will need to copy the menu files into your personal menudirectory. To do this, go to your own menu directory by typing:

    cd ~/$PROMAX_HOME/port/menu/promax

    then type the following command:

    cp $PROMAX_HOME/port/src/lib/maxtool/amp_ratio/*.menu .

    Set the permissions so that you can edit the files by typing:chmod 644 *.menu

    amp_ratio Exercise 1: Adding Trace HeadersThe first amp_ratio exercise involves getting a first break picktime from the amp_ratio program, getting a quality estimate ofthe first break pick time, and placing those values into a traceheader.

    Read the Trace Headers chapter.Next, edit amp_ratio1.f (or ampRatio1.c) so that the first break time

    and first break quality information can be read into the trace headerfor each trace. You can find solutions in the file amp_ratio.f orampRatio.c.

    If you do not know how to compile and link the code into a newexec.exe, review the Make System chapter.

    Try your new program!

    Remember to add the path to amp_ratio1.menu to yourProcesses list. Review the Make System chapter if necessary.Also remember that you need to have a .promax file set up inyour directory in order to tell ProMAX where to look for yourProcesses file and where to find the executable code that youhave created. The .promax file is also discussed in the MakeSystem chapter.Other Docs Known Problems

  • Programming Exercises: Simple Tools (amp_ratio)22 Developers Programming GuideMenusA ProMAX menu is a file which controls how menu parametersappear to the user.

    Read the Menus chapter.Copy the EXAMPLE.menu file to your own menu directory by typing

    the following on the command line:cd ~/$PROMAX_HOME/port/menu/promax

    cp $PROMAX_HOME/port/menu/EXAMPLE.menu .

    Use the pwin program described in the Menus chapter to experi-ment with menu parameters in EXAMPLE.menu.

    Global ParametersThere are many numerical variables that are related to a dataset,such as the number of samples per trace and the number of traceheaders that exist for each trace. ProMAX has a global includefile that you can access to easily get this information.

    Read the Global Parameters chapter. C programmers can then lookat:

    $PROMAX_HOME/port/include/cglobal.h

    and/or read the C Environment chapter for more information.

    amp_ratio Exercise 2: ordered parameter filesThe next amp_ratio exercise involves putting the first breakinformation from the previous exercise into the orderedparameter files in the database.

    Read the Ordered Parameter Files chapter.Edit amp_ratio2.f or ampRatio2.c to add parameters to the TRC

    (trace) ordered parameter file; fill those database locations with theappropriate information. Add the necessary code to the menu file toallow the option of writing to the database.

    You might notice that there is already code in amp_ratio2.f andampRatio2.c to take care of the trace headers.Other Docs Known Problems

  • Programming Exercises: Simple Tools (amp_ratio)23 Developers Programming GuideRemember to change the Processes list to point to the rightmenu since there is a different menu for amp_ratio1 andamp_ratio2.

    Run Makeexec on your new program and try it out.Run the database display program and see the first break pick

    times.

    amp_ratio Exercise 3: time gates and tablesThe final amp_ratio exercise is to limit the time window forwhich the first break is searched. In the previous example, theentire trace was searched for the first break. The start and endtimes of the analysis window can be controlled through use ofProMAX parameter tables which are stored in the database.

    Read the Parameter Tables chapter. You can find additional informa-tion can be found in a chapter with the same name in the ProMAXReference Manual.

    Edit amp_ratio3.f or ampRatio3.c; use ProMAX parameter tables tolimit the time window for which the first break is searched. Edit themenu to allow the option to use the time gates and to get the timegates from the database.Other Docs Known Problems

  • Debugging24 Developers Programming GuideDebugging

    Most full-time programmers find that use of a debugger speedsup their code development. Use of the program dbx withProMAX requires a few special considerations, primarilyrelated to the packet.job file.

    Read the Debugging with dbx chapter. Practice using the debuggeron one of the amp_ratio or ampRatio routines.Other Docs Known Problems

  • C Programming Environment25 Developers Programming GuideC Programming Environment

    The system level code of ProMAX is largely written inFORTRAN, although most new ProMAX module developmentis now in C and C++. The C programming environment actuallylies on top of the FORTRAN environment; therefore, there are afew things that the C programmer should know about, includingsome conveniences that have been developed for programmingin C.

    Read the C Environment chapter.Other Docs Known Problems

  • Tool Types26 Developers Programming GuideTool Types

    Before you continue on with other programming examples, youneed to know about other kinds of processing tools. As youlearned earlier in this chapter, the program amp_ratio is anexample of a simple tool, which is a processing tool that onlyprocesses one data trace at a time. There are several other typesof tools that make handling multiple traces very convenient.

    Read the Tool Types chapter. Pay particular attention to the respon-sibilities that each tool has in both the init and exec subroutines,such as setting global variables and trace header values that thetrace executive uses.Other Docs Known Problems

  • Programming Exercise: Ensemble Tools (AVO)27 Developers Programming GuideProgramming Exercise: Ensemble Tools (AVO)This section involves programming with ensemble tools.Ensemble tools operate on bundles of traces.

    Go to your personal maxtool directory:cd ~/$PROMAX_HOME/port/src/lib/maxtool

    Copy the avo_exer directory from the $PROMAX_HOME directorytree by typing the following on the command line:

    cp -r $PROMAX_HOME/port/src/lib/maxtool/avo_exer .

    This routine is an AVO (Amplitude Variation with Offset)module. The intent of this routine is that a CDP ensemble,sorted by the absolute value of offset, is input into the execsubroutine as a 2D array. The routine fits a least squares straightline to the amplitude versus offset graph for each time sample inthe input array (see the following figure).

    A single data trace is output for each CDP gather that is input tothe routine. The sample value at time T on an output trace iseither the slope or the zero-offset intercept of the least squarescurve shown in the figure above. A menu parameter allows theuser to select either slope or intercept as the output.

    Amplitude

    Offset

    Least Squares Fit Line

    Intercept ofLSF Line

    Sample amplitudeat an offset

    Least Squares fit line through Amplitude versus Offset DataOther Docs Known Problems

  • Programming Exercise: Ensemble Tools (AVO)28 Developers Programming GuideEdit amp_ratio1.f or ampRatio1.c; input code where the commentlines direct you to do so. A working solution to the exercise is inamp_ratio.f and ampRatio.c.

    Remember to change your tools_to_add file and Makefilebefore running Makeexec. The entry in tools_to_add will looklike this:

    AVO_EXER same panel

    Note that the tool type is panel. This is because ensemble toolshave the same calling arguments as panel tools and are insertedin the same part of the toolcall.f file.

    A further example of an ensemble tool is in$PROMAX_HOME/port/src/lib/maxtool/prestk_interp, whichoutputs more traces in an ensemble than are input.Other Docs Known Problems

  • Programming Exercise: Panel Tools29 Developers Programming GuideProgramming Exercise: Panel Tools

    Recall from the Tool Types chapter that panel tools are used toprocess 2D arrays of traces that are too large to fit into memoryat one time. The 2D array is processed in pieces and thenblended back together by the trace executive. The nextprogramming example is a panel tool in which a 2D panel oftraces is given to the exec subroutine. The exec subroutine setsthe value of each sample in the input array to a constant value;for example, all sample values are set to 2.0. The sample valuesof the next panel input are set to a value that is 1.0 more than theprevious panel. The input from the menu controls how large apanel will be and how many edge traces will be blended withadjacent panels. This lets you experiment with panel parametersand see the result on the screen. When using Screen Display orTrace Display to see the data, use the Entire Screen option forscaling the data traces so that the differences in trace amplitudescan be seen.

    Go to your maxtool directory and copy the panel directory from themain system maxtool directory via the following commands:

    cd ~/$PROMAX_HOME/port/src/lib/maxtool

    cp -r $PROMAX_HOME/port/src/lib/maxtool/panel .

    Edit the file panel_test.f or panelTest.c where the comments directyou to do so. A working solution to this exercise is in panel_test.f orpanelTest.c.

    Remember to change your tools_to_add file and Makefile beforerunning Makeexec. The entry in tools_to_add will look like this:

    PANEL_TEST same ensemble

    Also remember to change your Processes file before starting Pro-MAX so that the new menu will be read.Other Docs Known Problems

  • Programming Exercise: Input Tools30 Developers Programming GuideProgramming Exercise: Input Tools

    An input tool is, by default, the first processing tool in a flow. Itis the tool that feeds trace data to the rest of the flow. Theexercise for an input tool can be found in

    $PROMAX_HOME/port/src/lib/maxtool/sine_wave

    The sine_wave.f and sineWave.c programs generate traces andgive them to the trace executive to be passed along to othermodules. The traces output from sine_wave consist of a set ofsummed sine waves of user-specified frequency.

    Copy the sine_wave directory to your own maxtool directory (see theprevious examples on how to copy a directory). Edit sine_wave1.f orsineWave1.c and fill in the missing code where the comments indi-cate code needs to be added.

    The entry in the tools_to_add file looks like this:

    SINE_WAVE same complex

    A working solution to this problem is in sine_wave.f andsineWave.c. If you have problems with this module, review theTool Types chapter in this manual, paying special attention tothe responsibilities of an input tool, such as global variables andheaders. Then review the section on complex tools in that samechapter, paying attention to the modes, in particularEX_FLUSHMODE and EX_QUITMODE.Other Docs Known Problems

  • Programming Exercise: IPC Tools31 Developers Programming GuideProgramming Exercise: IPC Tools

    An IPC Inter-Process Communication) Tool is a special type oftool that allows the trace executive to pass data to and from aseparate unix process or separate piece of executable code. IPCtools used to be called socket tools.

    Read the IPC Tools section of the Tool Types chapter.Copy the directory $PROMAX_HOME/port/src/exe/f_socket or

    $PROMAX_HOME/port/src/exe/c_socket to your own directory tree;that is, $~/$PROMAX_HOME/port/src/exe/f_socket or c_socket.

    Notice that you are not in the maxtool directory where all workhas been done until now. The src/exe directory is for programsthat are not linked to the Trace Executive, or said another way,tools that are not called from toolcall.f.

    This exercise is just a demonstration of how to Make an IPCtool executable. There is a file in the c_socket and f_socketdirectories called Makefile. The Makefile contains, among otherthings, the name of the output executable. The name is specifiedwhere the Makefile states:

    name = c_socket

    The name of the executable must match the name of thedirectory in which the Makefile resides. The Makefile alsocontains a list of the object files that need to be used.

    Make the IPC tool by simply typing gmake in the directory whereMakefile resides. Run the program by putting an entry in the Pro-cesses file for the path to the menu.

    You can see another example of an IPC tool in$PROMAX_HOME/port/src/exe/ampRatio for C programmers,or in $PROMAX_HOME/port/src/exe/amp_ratio forFORTRAN programmers. These examples show the amp_ratioprogram in the form of IPC tools. The Makefiles and menus areincluded and can be compiled and used in a processing flow.Other Docs Known Problems

  • Programming Exercise: IPC Tools32 Developers Programming GuideOther Docs Known Problems

  • 33 Developers Programming GuideSystem Overview

    This chapter provides an overview of ProMAX. It describes thedirectory structure of the system and the User Interface.

    Topics covered in this chapter: ProMAX Organization: Areas, Lines, and Flows The User Interface: The Flow Builder Menu Files Flow Execution Super Executive ExecutiveOther Docs Known Problems

  • ProMAX Organization: Areas, Lines, and Flows34 Developers Programming GuideProMAX Organization: Areas, Lines, and Flows

    The primary function of ProMAX is to create, modify, andexecute processing flows. The program is built upon three levelsof organization: areas, lines, and flows. An area can representany grouping of seismic lines, but it is usually used as aprospect level collection of seismic lines. A line (in 2D) orsurvey (in 3D) usually represents a single seismic line or surveyin the tradition sense. A flow is a sequence of processes whichare used to manipulate seismic data. Flows are built by selectingprocesses from a Processes list. A typical flow contains an inputprocess, one or more data manipulation processes, and a displayand/or output process.

    Before we describe the system software any further, it is usefulif we first describe the directory structure of the system,particularly the data files (see the ProMAX Directory Structureillustration at the end of this chapter). The ProMAX homedirectory defaults to /promax/1998.6, but you can re-specifythis via the environmental variable PROMAX_HOME. Beneaththe ProMAX home directory is a subdirectory named data/,which you can also be re-specify with the environmentalvariable PROMAX_DATA_HOME (see the ProMAX DataDirectory Structure illustration at the end of this chapter).

    Any directory or symbolic link within the data/ subdirectory is,by definition, an area. Any subdirectory or symbolic linkbeneath an area subdirectory is, by definition, a line or a survey.ProMAX expects a line to be a collection of data that can bedescribed by a single geometry. Most of the actual data filesreside at the line or survey directory level (see the DatasetComponents, Ordered Database Files, and Parameter Tablesillustrations at the end of this chapter). Traces, trace headers,Ordered Parameter Files, and Parameter Tables, such asvelocities, first break picks, mutes, gates, trace kills, also resideat this level.

    Any subdirectory beneath a line or survey subdirectoryrepresents a further subgrouping, namely a flow. The flowsubdirectory contains all of the files related to a particularprocessing flow, such as the saved binary job flow and theruntime job output (see the Flow Components illustration at theend of this chapter).Other Docs Known Problems

  • ProMAX Organization: Areas, Lines, and Flows35 Developers Programming GuideThere is an exception to the rules that govern the existence ofareas, lines, and flows in the database: any subdirectory with aperiod in the name is ignored to facilitate the customization ofthe database to contain non-ProMAX files.Other Docs Known Problems

  • The User Interface: The Flow Builder36 Developers Programming GuideThe User Interface: The Flow Builder

    What people have come to know as ProMAX is sometimescalled the User Interface, but is more correctly called the flowbuilder. This is the very top level of the system (see the SystemOverview illustration at the end of this chapter). If you arefamiliar with the previous generations of the processing system,the flow builder is analogous to the editor that was used to buildjobs in those previous generations. In fact, the flow builder isjust a very specialized editor; it actually has no notion ofgeophysics built into it. Its primary purpose is to present menusand accumulate a collection of parameters, write thoseparameters to disk, and then launch programs that will use theparameters. The ProMAX Flow Builder Window Mapillustration (at the end of this chapter) sketches the various flowbuilder menus, and the Flow Builder illustration (at the end ofthis chapter) shows an screen image of the Flow Menu wherejobs are actually built and executed.Other Docs Known Problems

  • Menu Files37 Developers Programming GuideMenu Files

    In order for the flow builder to know how to present parametersto the user, it must read menu specification files, which are alsocalled menu files. Menu files are closely integrated with theunderlying processing tools; both are usually written by thesame author. Within the menu files, programmers specify whatparameters should exist, what their properties aresuch asparameter type, default value, and descriptionand how theyinterrelate. Experience has shown that good menu parameterspecification evolves to the point of approaching a language; atLandmark, we use Lisp, a language with suitable features. Theresulting menu specification is extremely well-suited tohandling traditional problems, such as context-sensitive hidingof unused parameters, and is clearly one of the cornerstones ofProMAXs success. Please refer to the Menus chapter forfurther discussion of ProMAX menu specifications.Other Docs Known Problems

  • Flow Execution38 Developers Programming GuideFlow Execution

    When a user clicks on the Execute button on the Flow Menu,the first step that the flow builder performs is to write all of theparameters to disk in the form of a packet file. A packet file isanalogous to the ASCII job deck that existed in older systems,except that it is binary in form and cannot be modified by anyeditor except the flow builder. This protects the integrity of thecontents. The flow builder writes the packet file into the flowdirectory that was created when the user constructed a new flowor copied an existing flow. After the flow builder writes thepacket file, it executes the following shell command:

    super_exec.exe packet_file host_name

    Super ExecutiveThe preceeding shell command launches the Super Executive,or super exec for short. The flow builder executes this SuperExecutive shell immediately, unless the job was submitted to aqueue. The Super Executive supplies the command line with thepath to the packet file and the name of the host on which theflow builder is running. The Super Executive is, in a sense,similar to the flow builderit is restricted in purpose and has nonotion of geophysics built into it. It is responsible for seeingthat the intended processing actually happens so the flowbuilder can go off and do something else, like build anotherflow.

    The Super Executive first checks for the presence of multipletasks within the packet file. For example, if there are multipleserial input steps in a flow, the Super Executive subdivides thepacket file and executes the separate jobs sequentially. Inaddition, the Super Executive checks to see if a job should berun on another host. It also performs other tasks, such asexpanding certain macrosfor example, the Parameter Testin what we could loosely describe as filtering the packet file.The Super Executive knows how to do most of these thingsbecause it receives instructions from programmers via specialparameters that are included in the menu files, and are thereforeincluded in the packet file.

    Some of the functionality within the Super Executive could beincluded in the flow builder without changing the behavior ofOther Docs Known Problems

  • Flow Execution39 Developers Programming Guidethe system. The exception is that the Super Executive waits onthe completion of the tasks that it spawns, rather than spawningthem in the background. This enables it to spawn processessequentially if required, and makes the spawning of onesubprocess contingent on completion of the previous one. Italso allows the Super Executive to report the completion statusof any process back to the flow buildereven processes that arenot strictly part of the ProMAX product.

    After the Super Executive modifies the packet file, it writes anew packet file in a scratch directory and launches the processthat does the actual work. In a normal processing flow, the formof this command is:

    exec.exe packet_file host_name PID

    ExecutiveThe preceeding command launches the Executive, or exec forshort. The Executive supplies the command line with the path tothe packet file, the name of the host on which the flow builder isrunning, and the process ID of the Super Executive. If theprocessing flow contains stand-alone or other special tools, thecorrect path to the process which was specified in the menu fileis substituted for exec.exe. The full path to the process can varywith release and may also be controlled by the user via theAlternate Executive directive.

    The Executive includes the actual processing tools, such asgain, decon, filter, etc. Ordinary processing tools are notseparate programs, but are rather a set of routines that are linkedtogether in the Executive. Tools can be single trace input andoutput types or one of a number of multi-trace types (see theProcessing Pipeline illustration at the end of this chapter). Theprimary function of this document is to provide you withinformation on how to add functionality to the Executive.

    You will see the terms exec and Executive used frequently inthis document. They are often used interchangeably, but we willrestrict the term exec to refer literally to the program namedexec.exe, and the term Executive to refer to the body ofsoftware that surrounds the actual processing tools and handlesthe flow of data within the pipeline.Other Docs Known Problems

  • Flow Execution40 Developers Programming GuideEach processing tool that is linked into the Executive must havetwo parts: an initialization routine and an execution routine. Theinitialization routine checks the input parameters for validity,sets global parameters (if appropriate), creates header entries,allocates memory, and other miscellaneous tasks that must beperformed before traces can be processed. The executionroutine is ideally a narrow-minded routine that simply processesthe traces and headers. Both routines are surrounded by theExecutive, which does everything it can to make life easy forthe initialization and execution routines.Other Docs Known Problems

  • Flow Execution41 Developers Programming GuideProMAX Directory Structure

    $PROMAX_HOME /syspromaxpromax3dpromaxvsp

    /bin

    /menupromaxpromax3dpromaxvsp

    /exeexec.exesuper_exec.exe*.exe

    /frame/sdi/(3rd party softwar

    /plot

    /liblib*.a

    /port /helppromax2d.pspromax3d.pspromaxvsp.ps(Manuals)

    /promax*.lok (Frame helps*.help (ASCII help/promax3d/promaxvsp

    /misc*.rgb (colormaps)ProMAX defaults

    /etcconfig_fileproductpvmhostsqconfig

    /scratch

    /queues

    /data /area1 /line1(or $PROMAX_DATA_HOME)Other Docs Known Problems

  • Flow Execution42 Developers Programming GuideProMAX Data Directory Structure

    Flow

    PROMAX_DATA_HOME

    LineArea Trace Headers

    Ordered Parameter

    Parameter Tables

    /data /area1 /line1 /12345678DescName12345678CIND12345678CMAP

    HDR1HDR2TRC1TRC2

    DescNameProject

    17968042TVEL317490267TGAT22783694TFBP36247238TMUT

    /flow1DescName (ASCII)TypeName (ASCII)job.output (ASCII)packet.job (Binary)job.output (Binary)

    /flow2/OPF.CDP (CDP)

    #s0_OPF_CDP.GEOMETRY.C_S#s0_OPF_CDP.GEOMETRY.ELE

    /OPF.CHN (Channel)OPF60_CHNOPF60_CHN.GEOMETRY.FOLDOPF60_CHN.GEOMETRY.SLOOKUP

    /OPF.ILN (Inline-3D)/OPF.LIN (Line)/OPF.OFB/OPF.PAT (Pattern)/OPF.SIN (Source)/OPF.SRF (Surface Station)/OPF.TRC (Trace)/OPF.XLN (Crossline)/OPF.XLN (Crossline-3D)

    Files databaseOther Docs Known Problems

  • Flow Execution43 Developers Programming GuideDataset Components

    Traces TraceHeaders

    MapMisc.

    Line

    Source

    CDP

    Trace

    Surface Location

    Channel

    Offset

    FB PickOffsetStaticetc.

    UnitsX RefY RefLo CutHi CutTotal # of CDPsetc.

    X CoordY CoordChansUpholeStaticElevationetc.

    FoldX CoordY CoordStaticDatum Veletc.

    FoldX CoordY CoordElevNearest SRFElev Staticetc.

    StaticAmplitude Cometc.

    Bin CenterMean Offsetetc.Other Docs Known Problems

  • Flow Execution44 Developers Programming GuideOrdered Database Files

    Parameter Tables

    Flow Components

    Mutes Gates Surg Mutes

    Kills Reversals Horizons

    Velocities Etc....

    FlowDirectory

    Packet File(packet.job)

    Job Output(job.output) DescName TypeNameOther Docs Known Problems

  • Flow Execution45 Developers Programming GuideSystem Overview

    Job Builder(promax.exe)

    BatchQueue

    Super Executive(super_exec.exe)

    Stand-alonePrograms

    Executive(exec.exe)

    Tool Caller

    Line DatabaseInformation

    (datasets, parameter tables,ordered database files, etc.)

    Packet File

    Diskread AGC Mute

    NMO FilterOther Docs Known Problems

  • Flow Execution46 Developers Programming GuideProMAX Flow Builder Window MapOther Docs Known Problems

  • Flow Execution47 Developers Programming GuideWindowsOverlap

    WindowOverlay

    Area: XXXXXX

    Line: YYYYYY

    Flow: ZZZZZZ

    Edit Flow Processes

    Seismic Datasets Parameter TablesOther Docs Known Problems

  • Flow Execution48 Developers Programming GuideFlow Builder

    Global OptionsProcessing FlowOther Docs Known Problems

  • Flow Execution49 Developers Programming Guide Processing Pipeline

    Gain

    FK Filter

    Mute

    Running Mix

    NMO

    Stack

    Single Trace Processes Multi-Trace Processes

    OutputData

    InputDataOther Docs Known Problems

  • Flow Execution50 Developers Programming GuideOther Docs Known Problems

  • 51 Developers Programming GuideExecutive

    This chapter describes the architecture and functions of theExecutive system.

    Topics covered in this chapter: System Architecture Headers and Global Variables Input Tools Re-entrancy Common Blocks and Parms Structures Executive Functions Communication between Tools OPF DatabaseOther Docs Known Problems

  • System Architecture52 Developers Programming GuideSystem Architecture

    The ProMAX Executive is a pipeline system. In this system,traces are dropped into the flow one at a time by the input tool(see the Processing Pipeline illustration at the end of the SystemOverview chapter). Individual traces continue to drop throughthe flow until they encounter a multi-trace processing tool. Thetrace executive collects all of the necessary traces for themulti-trace processing tool and returns the traces back to theflow when the tool is finished.

    There are a variety of tool types; each type is designed tominimize the coding required to implement the necessary tracehandling. These tool types range from simple, single-traceinput/output tools, to multi-trace input/output tools of a varietyof natural trace groupings, and finally to complex tools thatfacilitate the ultimate user control of trace buffering. Please seethe Tool Types chapter for a description of each tool.

    The Executive creates an essentially isolated environment foreach tool. It manages most of the tedious duties of trace andtrace header I/O, data buffering, initialization of globalvariables, and other miscellaneous tasks. The following sectionsdescribe these duties.Other Docs Known Problems

  • Headers and Global Variables53 Developers Programming GuideHeaders and Global Variables

    At run time, each tool is presented with a list of active headersand a set of initialized global variables. The header list containsthe description, format, and size of all headers that are valid atthat step in the flow. The global parameters can be categorizedas static or volatile. The static type of global parameters aretypically geometry-related: the number of CDPs, minimum andmaximum station number, maximum offset in data, etc. Thevolatile type of globals, named global run time or run timevariables, refer to variables that can change from step to stepwithin the flow: sample rate, trace length, sort order, maximumensemble size, etc.

    Headers can be added or deleted and run time variables changedat any step in the flow; for example, resampling changes thesample rate and trace length. Because of this, the Executiveactually keeps a separate copy of headers and run time globalsfor every step in the flow. In a sense, then, the environmentchanges dynamically as traces pass from tool to tool. Please seethe Global Parameters and Trace Headers chapters for detailson these subjects.

    It is important to note, however, that the global run timeattributes cannot change within a process or tool. In otherwords, while the sample rate, sort, trace length, and maximumensemble size can all change from tool to tool, they can notchange from trace to trace, such as by shot position within atool. Please review the list of run times in the GlobalParameters chapter.Other Docs Known Problems

  • Input Tools54 Developers Programming GuideInput Tools

    The primary responsibility for setting the globals andestablishing the current header list is assigned to the first tool inthe flow, which by definition is an input tool. All input toolsmust retrieve the current state of headers and run time variablesfrom the input ProMAX dataset and must make these availableto subsequent tools. The input tool must also retrieve theremaining static global variables from the Ordered ParameterFiles (geometry). If your input tool is reading a non-ProMAX(foreign) dataset or creating data, you are responsible forretrieving the necessary data from whatever source and creatingall possible header and global values. See the Input ToolExamples in the Appendix for code examples.Other Docs Known Problems

  • Re-entrancy55 Developers Programming GuideRe-entrancy

    Another related issue that the Executive manages is the issue ofre-entrancy. As mentioned above, the Executive attempts toisolate each tool in such a way that the programmer codes histool as if it is the only one in the flow. There is no need to worryabout a ProMAX user putting your tool in the flow multipletimes, which could create confusion over which set ofparameters goes with which instance of the tool. Nor is thereneed to worry about two tools coincidentally sharing identicalmenu parameters or internal local variables. The Executiveassures that each tool can only access menu parameters from itscorresponding menu in the flow; it offers protection forduplicate variables.Other Docs Known Problems

  • Common Blocks and Parms Structures56 Developers Programming GuideCommon Blocks and Parms Structures

    The Executive manages a SAVED_PARMS COMMON blockfor each tool for FORTRAN code, or a parms structure for Ccode. The n FORTRAN COMMON block or C parms structurestores variables that need to be passed from the initializationroutine to the execution routine, or local variables that mustretain their values between each call of the Executive routine.Clearly this must be accomplished by swapping a separateCOMMON block in and out of memory for each step in theflow. Again, the application programmer can develop a routineas if it is the only tool and with a single COMMON block. TheFORTRAN SAVED_PARMS COMMON block must be fixedin size to accommodate memory swapping. Currently the size islimited to 1000 4-byte words. If your application requires morethan a small fraction of this, you are probably misusing thespace by passing arrays instead of pointers or indexes to theFORTRAN RSPACE memory array.

    As described in the Executive section of the System Overviewchapter, each tool consists of two FORTRAN or C routines: theinitialization (or init) routine, and the execution (or exec)routine. The Executive runs each of the init routines in the flowonce. The exec routines are cycled through many times until allof the traces are processed through the pipe. The init routine isresponsible for reading menu parameters, making any one-timecalculations, resetting run time parameters (for example,changing the maximum ensemble size to one if stacking), andcreating/deleting headers entries. Remember, changing thestatus of the headers or global run time parameters must bedone in the init routine in order for other init routines to beaware of the change. This is one of the few situations where youmust consider what happens before or after your application.Other Docs Known Problems

  • Executive Functions57 Developers Programming GuideExecutive Functions

    The exec routine does the actual trace processing. TheExecutive passes traces and headers to the exec routine inbuffers and expects the processed traces to be in the samebuffers when exiting the routine. If the tool is a multi-trace type,the Executive will allocate the memory necessary to accumulatethe proper trace grouping, then free the memory after that groupof traces is processed and passed to the next tool. This memorymanagement is done automatically without any coding at thetool level. Often you will need to dynamically allocateadditional memory within the tool to hold temporary results.This is supported both in FORTRAN and C, but it is assumedthat such memory will be de-allocated upon exiting the execroutine. Remember that many tools could comprise a flow: yourtool could be repeated many times. After exiting yourmulti-trace exec routine, it might be some time before theremaining flow is executed and traces are again accumulatedand passed to your exec routine. This is another situation whereyou must consider the entire flow instead of simply yourapplication. It is assumed system-wide that two ensembles willfit comfortably in memory. However, tools that require manyensembles, multiple copies of ensembles, or large collections ofstacked traces should buffer traces on disk or process panels oftraces.Other Docs Known Problems

  • Communication between Tools58 Developers Programming GuideCommunication between Tools

    As previously discussed, tool-to-tool isolation makes theprogramming environment simple, and the Executive does thistask well. However, inter-tool or inter-process communicationis necessary. Tools that change the sample rate, trace length, killa trace, statically shift a trace, etc., need to communicate thischange to processes later in the flow or in a subsequent flow.Trace headers move with the data, and are an excellent way totag traces with information that may be required for a futureprocess. Headers move through the flow and are stored on diskor tape upon output. Run time global parameters are also anexcellent vehicle for communicating global changes in the data.As with headers, they move through the flow and are storedwith the traces upon output. However, these global parameterscannot change from one trace to the next within a tool.Other Docs Known Problems

  • OPF Database59 Developers Programming GuideOPF Database

    The Ordered Parameter Files database is another form ofinter-tool communication. Refer to the Ordered Parameter Fileschapter for a definition of this database. It is typically used tocommunicate information that is global to all datasets withinthe line; field geometry data is a good example. Convenience isa governing factor in choosing the form of communication thatis used. For example, geometry information that is placed in theOrdered Parameter Files database can be conveniently accessedby stand-alone programs that do not wish to read trace data.Other Docs Known Problems

  • OPF Database60 Developers Programming GuideOther Docs Known Problems

  • 61 Developers Programming GuideMake System

    This chapter provides an overview of the ProMAX makesystem.

    Topics covered in this chapter: Working with ProMAX Systems Getting Started System Administrator Setup User Setup: Aliases, Makeadvance, Makeexec Converting to the New System Understanding the Directory Structure Customizing the System Toggling Products: .promax Adding a New Tool Making Your New Executable Incorporating New Functionality Creating Menus Adding a ProMAX menu Changing Files Understanding the Makefile SystemOther Docs Known Problems

  • Working with ProMAX Systems62 Developers Programming GuideWorking with ProMAX Systems

    The ProMAX file and recompilation systems allow large groupsof programmers to develop and maintain software for multiplemachine types from a single master copy of source code. Someimportant features of these systems are:

    All Landmark software lies beneath a single directory, e.g./promax/1998.6/, in subdirectories with standard UNIXnames like bin/, include/, lib/, and src/. We will henceforthrefer to this directory as the environment variable$PROMAX_HOME.

    To support concurrent development, each programmer hasa subset of $PROMAX_HOME (containing the files they areworking on) in their home directory.

    Machine-dependent subdirectories of $PROMAX_HOMEenable a single file server or programmers home directoryto contain executable programs and libraries for allmachine types supported by Landmark.

    Software is organized to facilitate the evolution ofLandmark products, such as ProMAX, ProMAX VSP, andProMAX 3D.

    Third-party software is organized to facilitate distribution(if permitted) to Landmark clients and to avoid conflicts infile names among different third-party vendors.

    GNU make (gmake) is used to build executable programsand libraries and is provided with the ProMAX developerkit.

    Programmers write Makefiles, one for each program orlibrary, with compilation, link and installation commandsthat may be customized without affecting other programs.

    Makefiles used at Landmark are designed to be used byLandmark clients.

    Source code can be compiled and linked from one locationfor all machine types supported by Landmark.Other Docs Known Problems

  • Getting Started63 Developers Programming GuideGetting Started

    The following sections describe the System Administrator andUser setup.

    System Administrator SetupThe following steps must be performed after installing theProMAX release to configure the Development Environment.These steps help ensure that you will have little trouble whenattempting that first compile and link.

    Modify the $PROMAX_HOME/port/include/make/master.make file1. Change the line atopdir := /promax/1998.6 to be the

    absolute path to your $PROMAX_HOME directory. Anexample might be:

    atopdir =: /Landmark/ProMAX/1998.6

    2. Change the line utopdir := $(HOME)/promax/1998.6 tobe the path where each developer will build and use hisown copy of the ProMAX development tree. An examplemight be:

    utopdir=: $(HOME)/Landmark/ProMAX/1998.6

    Generally, Landmark recommends the above convention ofmaking each users development path parallel the masterinstallation path.

    3. Verify the line ctopdir := is blank. Typically you will leavethis field blank. This is used when clients have in-housesoftware which they want to be able to link with Landmarklibraries, or if they have their own special versions of theLandmark libraries which should take precedence over thestandard Landmark libraries.

    Additional Setup StepFor each platform on which your company develops, review thecorresponding [machine type].make file located inOther Docs Known Problems

  • Getting Started64 Developers Programming Guide$PROMAX_HOME/port/include/make/. Such files are suppliedfor the following machine types:

    crayymp rs6000 sgimips sgimips4 solaris

    The [machine type].make file should point to the defaultlocations of such things as compilers, include files, andlibraries; however, if your system has these located innonstandard places, you will have to edit the appropriate[machine type].make file to reflect this.

    Solaris UsersIf your target development machine type is solaris, eachdevelopment machine should have a symbolic link from /bin/ccto the location of your companys C compiler. This is used bythe gmake system to figure out what platform you are on; itdetermines this via the extra DEFINES that each platforms Ccompiler sends in by default.

    To get the C compiler to be recognized on Solaris, you need tocreate the following symbolic link:

    ln -s /opt/SUNWspro/bin/cc /bin/cc

    Automounter Users: If your development directories tend tobe automounted, the makefile system sometimes has difficultyin determining what atopdir really is. It figures this out via thelines:

    atopdir := /promax/1998.6

    atopdir := $(shell cd $(atopdir); /bin/pwd)

    If you suspect that you have a discrepancy here, cd toatopdirin this case /promax/1998.6and type /bin/pwd. If itis an automounted directory, it should return the actual path,something like /tmp_mnt/promax/1998.6. If it returns/promax/1998.6, you may have a problem which might besolved a number of ways:

    Hard mount the ProMAX master directory.Other Docs Known Problems

  • Getting Started65 Developers Programming Guide Change /bin/pwd to a pwd program which returns theproper path.

    Change the definition of atopdir to reflect the automountedversion.

    User SetupThe following sections describe the User setup.

    Creating Aliases, Makeadvance, MakeexecTo use the make system, complete the following four steps ifyou have not already done so (this assumes that you havealready installed the release distribution). Substitute/promax/1998.6 with whatever directory your systemadministrator used to install the release. Because most ProMAXdevelopment and testing is done using the Unix ksh commandinterpreter, including all Makefile and shell script commands,Landmark recommends you employ ksh for developing yourown ProMAX modules as well. It is normally straightforward todevelop under other command interpreters and the followinginstructions include settings for several popular alternatives tothe ksh.

    1. Place the release toplevel directory into environmentvariable PROMAX_HOME.

    For csh/tcsh users this line might look like:

    setenv PROMAX_HOME /promax/1998.6

    For ksh/zsh/sh users this line might look like:

    export PROMAX_HOME=/promax/1998.6

    2. Add $PROMAX_HOME/sys/bin and$PROMAX_HOME/port/bin to your path (or PATH) in your~/.cshrc (or ~.profile, depending on your shell and whatfiles it looks for upon login). csh looks for a .cshrc; tcshlooks for a .tcshrc (if it cannot find one of these, it uses a.cshrc); zsh looks for a .zshrc; sh and ksh use .profile. Ifyou are unsure of which shell you are using, the commandenv | grep SHELL should tell you.Other Docs Known Problems

  • Getting Started66 Developers Programming GuideFor csh/tcsh users this line might look like:

    set path = ($path /promax/1998.6/sys/bin \/promax/1998.6/port/bin)

    For ksh/zsh/sh users this line might look like:

    export PATH=$PATH:/promax/1998.6/sys/bin:\/promax/1998.6/port/bin)

    3. Add the following lines to your ~/.cshrc, ~/.tcshrc,~/.zshrc, or ~/.profile file.

    Csh/tcsh users:

    alias gmake '$PROMAX_HOME/sys/bin/gmake \-I$PROMAX_HOME/port/include/make'

    alias Makeexec '$PROMAX_HOME/port/bin/Makeexec \-I$PROMAX_HOME/port/include/make'

    Ksh/sh/zsh users:

    alias gmake='$PROMAX_HOME/sys/bin/gmake \-I$PROMAX_HOME/port/include/make'

    alias Makeexec='$PROMAX_HOME/port/bin/Makeexec \-I$PROMAX_HOME/port/include/make'

    This tells gmake and Makeexec where to look for includedfiles.

    4. Csh users should type source .cshrc (or .profile) to resetyour aliases and paths. Ksh users should type the command. .kshrc to reset their aliases and paths.

    5. Type Makeadvance. This will make a User developmenttree under your home directory. In addition to making lotsof directories, Makeadvance will also put a Makefile intoyour ~/advance/port/src/exe/exec/ as well as your~/advance/port/src/lib/maxtool/ directory. You shouldstudy the two Makefilesthey are short because theyinclude other files that do most of the work. (The other filesare in $PROMAX_HOME/port/include/make/.)

    6. From somewhere in your ~/$PROMAX_HOME/port/src/directory, type Makeexec. This will take a while.Other Docs Known Problems

  • Getting Started67 Developers Programming GuideMakeexec invokes a script that makes any or all variants ofthe ProMAX exec.exe files. It simply cds to~/$PROMAX_HOME/port/src/exe/exec, where theMakefile for exec.exe resides, and does a gmake with thearguments that you provide to Makeexec.

    FORTRAN or C toolcall: By default, Makeexec buildsand compiles a FORTRAN version of toolcall, toolcall.f.By setting the option language=C for the Makeexeccommand, that is Makeexec language=C ..., Makeexecbuilds and compiles a C version of toolcall, toolcall.c. Thisallows the building of exec.exe without a FORTRANcompiler.

    Understanding What HappensBecause exec.exe depends on libraries, such as libmaxtool*.a,in addition to files like toolcall.f or toolcall.c, the first thingMakefile does is check the libraries to see if it should try toupdate them. To help Makefile make this decision:

    if a Makefile exists in the src directory for the library, thenit ensures that the library is up-to-date by changing to thatdirectory and running gmake; or,

    it uses the master version of the library and assumes that itis up-to-date.

    When you run Makeexec the first time, the Makefile in your~/$PROMAX_HOME/port/src/exe/exec/ directory finds theMakefile in your ~/$PROMAX_HOME/port/src/lib/maxtool/,cds to that directory, and does a gmake. Because you do nothave any of the libmaxtool*.a or libmaxtool*.so libraries inyour User version of ~/$PROMAX_HOME/, the Makefile in~/$PROMAX_HOME/port/src/lib/maxtool/ will create theselibraries for you. This is the time-consuming part of runningMakeexec the first time: the libmaxtool* libraries are big andyou do not have them yet.

    First-time compilationUnlike the Master version of$PROMAX_HOME/port/src/lib/maxtool/, your User versiondoes not (yet) contain any source code. Therefore, the Makefilesimply copies the librariesOther Docs Known Problems

  • Getting Started68 Developers Programming Guide$PROMAX_HOME/[machtype]/lib/libmaxtool* over into your~/$PROMAX_HOME/[machtype]/lib/ directory. Note thatmachtype varies, depending on which platform you aremaking on. It is rs6000 on the IBM, sgimips or sgimips4 on theSilicon Graphics, crayymp on the Cray, and solaris on systemsrunning Solaris 2.x. After your own libmaxtool* libraries havebeen built, your toolcall.f or toolcall.c will be created andcompiled and your exec.exe will be linked. The toolcall iscreated by the script $PROMAX_HOME/port/bin/buildtoolcall.This script looks at the file$PROMAX_HOME/port/src/exe/exec/tools.db, then deletesany entries found in~/$PROMAX_HOME/port/src/exe/exec/tools_to_delete, thenadds any tools found in~/$PROMAX_HOME/port/src/exe/exec/tools_to_add.

    Based on the arguments to Makeexec or gmake, the buildtoolcallscript will then build a~/$PROMAX_HOME/port/src/exe/exec/toolcall.f FORTRANfile (default), or a~/$PROMAX_HOME/port/src/exe/exec/toolcall.c C file ifbuildtoolcall is invoked from gmake or Makeexec withlanguage=C. The new toolcall source file will then be compiledand linked into a working~/$PROMAX_HOME/[machtype]/exe/exec.exe executable.

    Nth-time compilationYou can run Makeexec from anywhere within your~/$PROMAX_HOME/port/src/ hierarchy. In particular, youcan run it inside your~/$PROMAX_HOME/port/src/lib/maxtool/xxx/ directory,where you have just finished modifying the source code foryour latest and greatest new tool.

    For new exec tools, you must specify the source files for eachnew tool in the newsrcs variable in your~/$PROMAX_HOME/port/src/maxtool/Makefile.Other Docs Known Problems

  • Converting to the New System69 Developers Programming GuideConverting to the New System

    Normally, it is sufficient to copy source files and Makefiles fromyour previous user development tree into your new user tree tobuild them under the new system. You will probably want torexamine your Makefile(s), if any, for local dependencies.Landmark has created several Makefile examples in$PROMAX_HOME/port/include/make to assist in creatingMakefiles for new tools or reworking older Makefiles forimproved compatibility.Other Docs Known Problems

  • Understanding the Directory Structure70 Developers Programming GuideUnderstanding the Directory Structure

    Before dealing with the details of the development system, it isessential to have a basic understanding of the directory structurein which it functions. A few of the files and directories ofinterest in the development system include:

    $PROMAX_HOME/port/include/make/ $PROMAX_HOME/port/bin/ $PROMAX_HOME/sys/bin/ $PROMAX_HOME/port/src/exe/exec

    $PROMAX_HOME/port/include/make/This directory contains the makefile header files which are usedto set up for various possible configurations. It also containssample makefiles for a library or stand-alone executables. Thefollowing table summarizes these files.

    $PROMAX_HOME/port/include/make/ FilesFile Description

    master.make This is the file which is responsible for setting up the basic variable structuresrepresenting the clients directory structure. This file can be included insteadof advance.make if all you need from your makefile include are variablescontaining paths to advance things. In this respect, it serves as a lightweightheader include.

    advance.make This header file includes master.make and sets up anything which is constantamong all platforms such as Canned Command Sequences. It also includes$machtype.make to import its platform dependent information.

    $machtype.make This represents the header file containing the platform dependent informationsuch as preprocessing, compiling, and link commands. As this variesdramatically from system to system, Landmark provides some reasonabledefaults. Even so, clients installing ProMAX will probably need to modifythis file to reflect their particular system setup.

    simple.make A simple makefile used to compile one or more executables into the currentdirectory.

    compile.test A simple makefile used in conjunction with$PROMAX_HOME/port/bin/ctest which allows you to compile source filesinto executables.

    libmaxtool.example An example user makefile for the maxtool[1-3] libraries. This file is used byMakeadvance to create a user environment.Other Docs Known Problems

  • Understanding the Directory Structure71 Developers Programming GuideThe following examples use files from this directory.

    Example: simple.makeThis makefile example uses simple.make to compile into thecurrent directory.

    1. cd $HOME

    2. mkdir simpletest

    3. cd simpletest

    4. Edit Makefile to look like:srcs1 := a.c b.csrcs2 := c.c d.fexec1 := abtestexec2 := cdtestinclude simple.make

    5. Edit a.c to look like:#include a() {printf(a()\n);}

    exec.example An example makefile for the executive. This file is used by Makeadvance tocreate a user environment.

    stand_alone1.example An example makefile for a stand-alone module. This file is used byMakeadvance to create a user environment.

    stand_alone2.example An example makefile for a stand-alone module utilizing the maxprog.maketemplate.

    maxprog.make A template or recipe for building an ordinary stand-alone executable.maxprog.make is merely a series of includes of other smaller granularityactions. Thus, if maxprog.make does not work well a large number ofapplications, it is possible to create a new template without having to rewriteeach part.

    maxprog++.make A template, similar to maxprog.make, which links via the C++ compiler.

    Makefile_example_* Sample makefiles for creating new modules under the bin, exe, and lib userport/src development subdirectories.

    $PROMAX_HOME/port/include/make/ Files (Continued)File DescriptionOther Docs Known Problems

  • Understanding the Directory Structure72 Developers Programming Guide6. Edit b.c to look like:#include b() {a(); printf(b()\n);}main() {b();}

    7. Edit c.c to look like:#include c_() {printf(c()\n);}

    8. Edit d.f to look like:SUBROUTINE DCALL CWRITE(*,*)D()RETURNEND

    PROGRAM D CALL D END

    9. Type gmake. The executables abtest and cdtest should becompiled in the current directory.

    Example: compile.testThis makefile example uses compile.test.

    1. cd $HOME

    2. mkdir compiletest

    3. cd compiletest

    4. Edit a.c to contain:#include main() {printf(Hello World From a.\n);}

    5. Edit b.f to contain:PROGRAM MAINWRITE(*,*) HELLO WORLD FROM MAIN()END

    6. ctest a b should compile executables a and b correspondingto your source code a.c and b.f.Other Docs Known Problems

  • Understanding the Directory Structure73 Developers Programming GuideExample: maxprog.makeFor this makefile example, maxprog.make might look like:include advance.makeinclude exe_setup.makeinclude exe_top.makeinclude depend.makeinclude exe_link.makeinclude exe_f77_compile.makeinclude exe_ansic_compile.makeinclude exe_cxx_compile.makeinclude exe_clean.makeinclude phony.make

    You might decide that you need a version of maxprog.make,such as maxprog++.make; this operates just as maxprog.make,except that the C source code is compiled via the K&R Ccompiler by default. In this case, all you have to do is copymaxprog.make to krc_maxprog.make and substitute"include exe_ansic_compile.make" for"include exe_krc_compile.make".

    $PROMAX_HOME/port/bin/This directory contains portable scripts which can be run fromthe command line. The following table summarizes thesescripts.

    $PROMAX_HOME/port/bin/ FilesScript Description

    Auto_test A script which automates quality control testing on various platforms.

    Makeadvance A script which sets up a user development environment.

    Makeexec A script which creates a user version of the executive.

    Setqueues A script which allows users to toggle between NQS and LPD queues.adoc A script which allows users to read documentation.

    aman A script which allows users to get online man pages.

    Promax A script which is used to bring up the user interface.

    makewhatis A script which is used to make the whatis/windex for man pages. Must beexecuted from the man directory.

    checkin2 A script which is used to check in a previously checked out Landmark sccs file.

    checkout2 A script which is used to check out an Landmark sccs file.Other Docs Known Problems

  • Understanding the Directory Structure74 Developers Programming Guide$PROMAX_HOME/sys/bin/This directory contains non-portable scripts which can be runfrom the command line. The following table describes thesescripts.

    testFlows Another script which is used for automated testing.

    buildtoolcall A script which is used to build toolcall source in FORTRAN or C. It is normallycalled from the Makefile but may also be invoked from the command line.buildtoolcall accepts as an optional first command line argument -C; this switchinstructs buildtoolcall to build C code instead of the default FORTRAN.

    app A small script which preprocesses, adding $PROMAX_HOME/port/include and$PROMAX_HOME/port/include/private to your include paths.

    pvmcleanup A script which kills and cleans up after stray pvm daemons.

    pvmdbx.sh A script which is invoked by an xterm by the generic debugger script. It startsthe debugger and waits when it exits to prevent the window from closing.

    Makelink A script which is used to create a link from a file in a users directory to thecorresponding file in the $PROMAX_HOME directory.

    Nmgrep A utility used for extracting information from object files.Fid A simple utility used to print out include dependencies in a file.

    $PROMAX_HOME/sys/bin/ FilesScript Description

    amakedepend Landmarks version of makedepend. Gene