(tput) 1>/dev/null 2>&1
if [ $? = 1 ]; then
  CLEAR="clear"; export CLEAR
else
  CLEAR="tput clear"; export CLEAR
fi
$CLEAR
echo "
                    Object Access
            Programmer's Reusable Library
                        MAP
 

  Demo Program Build and Run Procedure
  ====================================
 
  This Procedure will compile and run the library
  demonstration programs.  The library object archive
  file 'libmap.a' must be created, and the
  library environment variable MAP must be
  defined, prior to performing this Procedure.
 "
echo "  <CR> to Continue"
read answer
if [ "$SYSID" = "" ]; then
$CLEAR
echo "
                    Object Access
            Programmer's Reusable Library
                        MAP
 

       Select System
      ===============
         1. APOLLO
         2. RISC6K
         3. CONVEX
         4. SGIRIX
         5. SUNOS
         6. UNICOS
         7. HP9000
         8. DECOSF
         9. LINUX
 "
read SYSID; export SYSID
fi
LINK="f77 "; export LINK
FORTRAN=FORTRAN;export FORTRAN
LIBX11="libX11.a";export LIBX11
if [ "$SYSID" = "1" ]; then
  LINK="f77 "
fi
if [ "$SYSID" = "2" ]; then
  LINK='xlf '
fi
if [ "$SYSID" = "3" ]; then
  LINK='fc '
fi
if [ "$SYSID" = "4" ]; then
  LINK='f77 '
fi
if [ "$SYSID" = "5" ]; then
  LINK='f77 '
fi
if [ "$SYSID" = "6" ]; then
  LINK='cf77 -Wl"-D DUPENTRY=IGNORE" '
fi
if [ "$SYSID" = "7" ]; then
  LINK='fort77 '
fi
if [ "$SYSID" = "8" ]; then
  LINK='f77 -taso '
  LIBX11='libX11.so'
  echo " "
fi
if [ "$SYSID" = "9" ]; then
  LINK='g77 -Wunused '
fi
$CLEAR
echo "
 
        Creating demo program source files.
 "
echo "  Generating =====> [ ./ORIGIN.INC ]"
cat <<"STOP_CAT"> ././ORIGIN.INC
C     ------------------Start ORIGIN.INC Include File---------------------
C
C                       ORIGIN Object Hidden Information
C
C
C
      INTEGER   KZOR
      REAL      UUXOR, UUYOR, ZZXOR, ZZYOR
C
      COMMON /ORIGINC/  KZOR, UUXOR, UUYOR, ZZXOR, ZZYOR
C
C     PRIVATE CONSTANTS
C       None
C
C     PRIVATE VARIABLES
C       KZOR   = origin location source indicator
C                111          Y: user has defined origin
C                222          N: use default origin
C       UUXOR  = origin X location from left page edge,cm
C                1.27:1.905   default (0.5 or 0.75 inches)
C       UUYOR  = origin X location from left page edge,cm
C                1.27:1.905   default (0.5 or 0.75 inches)
C       ZZXOR  = device-adjusted X origin location, cm
C       ZZYOR  = device-adjusted Y origin location, cm
C
C     ------------------End ORIGIN.INC Include File---------------------
STOP_CAT
echo "  Generating =====> [ ./PAGE.INC ]"
cat <<"STOP_CAT"> ././PAGE.INC
C     ------------------Start PAGE.INC Include File---------------------
C
C                       PAGE Object Hidden Information
C
C
C
      INTEGER   KZBEGN, KZAUTO, KZPAGE, KZSCAL, IVIS
      REAL      UUPAGX, UUPAGY, ZZPAGX, ZZPAGY, ZZPAGR, XCM0, XCM1, YCM0
     *        , YCM1, XCLIPD, YCLIPD, ZZUNIT
C
      COMMON /PAGEC/  KZBEGN, KZAUTO, KZPAGE, KZSCAL, UUPAGX, UUPAGY
     *        , ZZPAGX, ZZPAGY, ZZPAGR, XCM0, XCM1, YCM0, YCM1, IVIS
     *        , XCLIPD, YCLIPD, ZZUNIT
C
C     PRIVATE CONSTANTS
C       None
C
C     PRIVATE VARIABLES
C       KZBEGN = index for beginning of plot
C                111          Y: plot has begun on this page
C                222          N: starting new plot, clear page
C       KZAUTO = page rotation auto-selection switch
C                111          Y: sw auto-selects portrait,landscape
C                                (default)
C                222          N: user selects portrait or landscape
C       KZPAGE = page size source indicator
C                111          Y: user has defined page size
C                222          N: use default page size
C       KZSCAL = oversize plot behavior switch
C                12           clip out-of-bounds objects
C                13           scale down plot to fit device limits
C                14           scale plot to fit device limits
C                15           abort plot if exceeds device limits
C       UUPAGX = user-defined X page size, cm
C                27.94        default (11 inches)
C       UUPAGY = user-defined Y page size, cm
C                21.59        default (8.5 inches)
C       ZZPAGX = device-adjusted X page size, cm
C       ZZPAGY = device-adjusted Y page size, cm
C       ZZPAGR = page ratio multiplier; (device page size
C                             divided by user-def page size)*.95
C                1.0          default value, non-dimensional
C       XCM0   = min X location of clipping boundary from
C                [<ZZPAGX]    page left edge, cm
C       XCM1   = max X location of clipping boundary from
C                [<ZZPAGX]    page left edge, cm
C       YCM0   = min Y location of clipping boundary from
C                [<ZZPAGY]    page bottom edge, cm
C       YCM1   = max Y location of clipping boundary from
C                [<ZZPAGY]    page bottom edge, cm
C       IVIS   = clipped point visibility indicator
C                0            point visible (in clipping boundary)
C                >1           point not visible (clipped)
C       XCLIPD = max X extent of clipping boundary, cm
C       YCLIPD = max Y extent of clipping boundary, cm
C       ZZUNIT = factor for converting page units to cm
C                2.54         cm/in., page units in inches
C                0.1          cm/mm,  page units in mm
C                1.0          cm/cm,  page units in cm
C
C     ------------------End PAGE.INC Include File---------------------
STOP_CAT
echo "  Generating =====> [ ./_map.tk ]"
cat <<"STOP_CAT"> ././_map.tk
#!/tmp/tk/usr/X386/bin/wish -f
#
#       Programmer's Reusable Library, Version 0.7      (TM)
#
#            Copyright (C) 1995 Object Access (SM)
#
#     Permission is granted to any individual or institution
#     to use, copy, modify, and distribute this single program
#     unit, provided that this complete copyright and
#     permission notice is maintained, intact, in all copies.
#
#     Object Access Incorporated provides this software
#     "as is" without express or implied warranty.
#
#     PURPOSE: Demonstrate features of the PRL-MAP library
#
#     NOTES:
#
#     ******************************************************************
#
#                       Define window title
#
set auto_path "$tk_library/demos $auto_path"
wm title . "PRL-MAP Demonstration"
#
#     ******************************************************************
#
#                       Create the main window, consisting of a menu
#                       bar and a message explaining the basic operation
#                       of the program
#
frame .menu -relief raised -borderwidth 1
#
message .msg -font -Adobe-times-medium-r-normal--*-180* -relief raised \
-width 600 -borderwidth 1 -text \
"This window demonstrates the Programmer's Reuseable Library \
PRL-MAP, Version 0.7 \
using a graphical user interface provided by the Tk toolkit.
 
To invoke a demonstration, press the left mouse button over one of the \
menu buttons, drag the mouse to the desired menu file, then release the \
mouse button.
 
The Demo menu tells more about using this window.
The More menu has more information about PRL-MAP.
 
To exit, select the \"Quit\" option in the Demo menu.
 
----------------------------------------------------
 
Copyright (C) 1995 Object Access (SM)
 
Permission is granted to any individual or institution \
to use, copy, modify, and distribute this single program \
unit, provided that this complete copyright and \
permission notice is maintained, intact, in all copies.
 
Object Access Incorporated provides this software \
\"as is\" without express or implied warranty."
#
pack .menu -side top -fill x
pack .msg -side bottom -expand yes -fill both
#
#     ******************************************************************
#
#                       DEFINE MENUS FOR TOP MENU ROW
#
#     ******************************************************************
#
#                       "Demo" menu
#
menubutton .menu.demo -text "Demo  " -menu .menu.demo.m
#
#     ------------------------------------------------------------------
#
                        menu .menu.demo.m
#
#                       "Tear-off menus" button
.menu.demo.m add command -label "Tear-off menus" -command mkTear
#
#                       "Quit" button
.menu.demo.m add command -label "Quit" -command "destroy ."
#
#     ******************************************************************
#
#                       "PRL" menu
#
menubutton .menu.prl -text "PRL  " -menu .menu.prl.m
#
#     ------------------------------------------------------------------
#
                        menu .menu.prl.m
#
#                       "prl1" button
.menu.prl.m add command -label "prl1" -command { \
exec xterm -rw -cr black -ms black -fg black -bg CadetBlue1 \
-sb -e prl1.x }
#
#     ******************************************************************
#
#                       "DEVICE" menu
#
menubutton .menu.device -text "DEVICE  " -menu .menu.device.m
#
#     ------------------------------------------------------------------
#
                        menu .menu.device.m
#
#                       "device1" button
.menu.device.m add command -label "device1" -command { \
exec xterm -rw -cr black -ms black -fg black -bg CadetBlue1 \
-sb -e device1.x }
#
#     ******************************************************************
#
#                       "MAP" menu
#
menubutton .menu.mapp -text "MAP  " -menu .menu.mapp.m
#
#     ------------------------------------------------------------------
#
                        menu .menu.mapp.m
#
#                       "map1" button
.menu.mapp.m add command -label "map1" -command { \
exec xterm -rw -cr black -ms black -fg black -bg CadetBlue1 \
-sb -e map1.x }
#
#     ******************************************************************
#
#                       "Graph_Setup" menu
#
menubutton .menu.setup -text "Graph_Setup " -menu .menu.setup.m
#
#     ******************************************************************
#
                        menu .menu.setup.m
#
#                       "PAGE" menu
#
.menu.setup.m add cascade -label "PAGE" -menu .menu.setup.page
#
#     ------------------------------------------------------------------
#
                        menu .menu.setup.page
#
#                       "page1" button
.menu.setup.page add command -label "page1" -command { \
exec xterm -rw -cr black -ms black -fg black -bg CadetBlue1 \
-sb -e page1.x }
#
#                       "page2" button
.menu.setup.page add command -label "page2" -command { \
exec xterm -rw -cr black -ms black -fg black -bg CadetBlue1 \
-sb -e page2.x }
#
#     ******************************************************************
#
#                       "ORIGIN" menu
#
.menu.setup.m add cascade -label "ORIGIN" -menu .menu.setup.origin
#
#     ------------------------------------------------------------------
#
                        menu .menu.setup.origin
#
#                       "origin1" button
.menu.setup.origin add command -label "origin1" -command { \
exec xterm -rw -cr black -ms black -fg black -bg CadetBlue1 \
-sb -e origin1.x }
#
#     ******************************************************************
#
#                       "FRAME" menu
#
.menu.setup.m add cascade -label "FRAME" -menu .menu.setup.frame
#
#     ------------------------------------------------------------------
#
                        menu .menu.setup.frame
#
#                       "frame1" button
.menu.setup.frame add command -label "frame1" -command { \
exec xterm -rw -cr black -ms black -fg black -bg CadetBlue1 \
-sb -e frame1.x }
#
#     ******************************************************************
#
#                       "SUBPLOT" menu
#
.menu.setup.m add cascade -label "SUBPLOT" -menu .menu.setup.subplot
#
#     ------------------------------------------------------------------
#
                        menu .menu.setup.subplot
#
#                       "subplot1" button
.menu.setup.subplot add command -label "subplot1" -command { \
exec xterm -rw -cr black -ms black -fg black -bg CadetBlue1 \
-sb -e subplot1.x }
#
#     ******************************************************************
#
#                       "Axes_Setup" menu
#
menubutton .menu.axes -text "Axes_Setup " -menu .menu.axes.m
#
#     ******************************************************************
#
                        menu .menu.axes.m
#
#                       "GRID" menu
#
.menu.axes.m add cascade -label "GRID" -menu .menu.axes.grid
#
#     ------------------------------------------------------------------
#
                        menu .menu.axes.grid
#
#                       "grid1" button
.menu.axes.grid add command -label "grid1" -command { \
exec xterm -rw -cr black -ms black -fg black -bg CadetBlue1 \
-sb -e grid1.x }
#
#                       "grid2" button
.menu.axes.grid add command -label "grid2" -command { \
exec xterm -rw -cr black -ms black -fg black -bg CadetBlue1 \
-sb -e grid2.x }
#
#     ******************************************************************
#
#                       "PLOT2D" menu
#
.menu.axes.m add cascade -label "PLOT2D" -menu .menu.axes.plot2d
#
#     ------------------------------------------------------------------
#
                        menu .menu.axes.plot2d
#
#                       "plot2d1" button
.menu.axes.plot2d add command -label "plot2d1" -command { \
exec xterm -rw -cr black -ms black -fg black -bg CadetBlue1 \
-sb -e plot2d1.x }
#
#     ******************************************************************
#
#                       "VIEWPT" menu
#
.menu.axes.m add cascade -label "VIEWPT" -menu .menu.axes.viewpt
#
#     ------------------------------------------------------------------
#
                        menu .menu.axes.viewpt
#
#                       "viewpt1" button
.menu.axes.viewpt add command -label "viewpt1" -command { \
exec xterm -rw -cr black -ms black -fg black -bg CadetBlue1 \
-sb -e viewpt1.x }
#
#                       "viewpt2" button
.menu.axes.viewpt add command -label "viewpt2" -command { \
exec xterm -rw -cr black -ms black -fg black -bg CadetBlue1 \
-sb -e viewpt2.x }
#
#     ******************************************************************
#
#                       "Map_Drawing" menu
#
menubutton .menu.map -text "Map_Drawing" -menu .menu.map.m
#
#     ******************************************************************
#
                        menu .menu.map.m
#
#                       "CURVE2D" menu
#
.menu.map.m add cascade -label "CURVE2D" -menu .menu.map.curve2d
#
#     ------------------------------------------------------------------
#
                        menu .menu.map.curve2d
#
#                       "curve2d1" button
.menu.map.curve2d add command -label "curve2d1" -command { \
exec xterm -rw -cr black -ms black -fg black -bg CadetBlue1 \
-sb -e curve2d1.x }
#
#     ******************************************************************
#
#                       "MAPDATA" menu
#
.menu.map.m add cascade -label "MAPDATA" -menu .menu.map.mapdata
#
#     ------------------------------------------------------------------
#
                        menu .menu.map.mapdata
#
#                       "mapdata1" button
.menu.map.mapdata add command -label "mapdata1" -command { \
exec xterm -rw -cr black -ms black -fg black -bg CadetBlue1 \
-sb -e mapdata1.x }
#
#     ******************************************************************
#
#                       "PROJ" menu
#
.menu.map.m add cascade -label "PROJ" -menu .menu.map.proj
#
#     ------------------------------------------------------------------
#
                        menu .menu.map.proj
#
#                       "proj1" button
.menu.map.proj add command -label "proj1" -command { \
exec xterm -rw -cr black -ms black -fg black -bg CadetBlue1 \
-sb -e proj1.x }
#
#                       "proj2" button
.menu.map.proj add command -label "proj2" -command { \
exec xterm -rw -cr black -ms black -fg black -bg CadetBlue1 \
-sb -e proj2.x }
#
#     ******************************************************************
#
#                       "PROCESS" menu
#
menubutton .menu.process -text "PROCESS  " -menu .menu.process.m
#
#     ------------------------------------------------------------------
#
                        menu .menu.process.m
#
#                       "process1" button
.menu.process.m add command -label "process1" -command { \
exec xterm -rw -cr black -ms black -fg black -bg CadetBlue1 \
-sb -e process1.x }
#
#     ******************************************************************
#
#                       "More" menu
#
menubutton .menu.more -text "More" -menu .menu.more.m
#
#     ------------------------------------------------------------------
#
                        menu .menu.more.m
#
#                       "MENU Definitions" button
.menu.more.m add cascade -label "MENU Definitions" -menu .menu.more.defs
#
#     ------------------------------------------------------------------
#
                        menu .menu.more.defs
#
#                       "CURVE2D" button
.menu.more.defs add command -label "CURVE2D" -command \
{ mkDialog .modal {-text \
{The CURVE2D menu invokes demonstrations of the PRL-MAP \
CURVE2D object subprograms.  The CURVE2D object is \
a locus through two or more 2D points defined by an interpolation method. \
} -aspect 450 -justify left} {OK {}}
}
#                       "DEVICE" button
.menu.more.defs add command -label "DEVICE" -command \
{ mkDialog .modal {-text \
{The DEVICE menu invokes demonstrations of the PRL-MAP \
DEVICE object subprograms.  The DEVICE object is \
the parent object for all PRL-DEVICE objects. \
} -aspect 450 -justify left} {OK {}}
}
#                       "FRAME" button
.menu.more.defs add command -label "FRAME" -command \
{ mkDialog .modal {-text \
{The FRAME menu invokes demonstrations of the PRL-MAP \
FRAME object subprograms.  The FRAME object is \
a rectangle drawn at the edge of the subplot area. \
} -aspect 450 -justify left} {OK {}}
}
#                       "GRID" button
.menu.more.defs add command -label "GRID" -command \
{ mkDialog .modal {-text \
{The GRID menu invokes demonstrations of the PRL-MAP \
GRID object subprograms.  The GRID object is \
a set of lines perpendicular to the axes keyed to the axis tick marks. \
} -aspect 450 -justify left} {OK {}}
}
#                       "MAP" button
.menu.more.defs add command -label "MAP" -command \
{ mkDialog .modal {-text \
{The MAP menu invokes demonstrations of the PRL-MAP \
MAP object subprograms.  The MAP object is \
the parent object for all other PRL-MAP objects. \
} -aspect 450 -justify left} {OK {}}
}
#                       "MAPDATA" button
.menu.more.defs add command -label "MAPDATA" -command \
{ mkDialog .modal {-text \
{The MAPDATA menu invokes demonstrations of the PRL-MAP \
MAPDATA object subprograms.  The MAPDATA object is \
information comprising a world cartographic database. \
} -aspect 450 -justify left} {OK {}}
}
#                       "ORIGIN" button
.menu.more.defs add command -label "ORIGIN" -command \
{ mkDialog .modal {-text \
{The ORIGIN menu invokes demonstrations of the PRL-MAP \
ORIGIN object subprograms.  The ORIGIN object is \
the lower left-hand corner of a subplot. \
} -aspect 450 -justify left} {OK {}}
}
#                       "PAGE" button
.menu.more.defs add command -label "PAGE" -command \
{ mkDialog .modal {-text \
{The PAGE menu invokes demonstrations of the PRL-MAP \
PAGE object subprograms.  The PAGE object is \
a drawing surface of fixed size. \
} -aspect 450 -justify left} {OK {}}
}
#                       "PLOT2D" button
.menu.more.defs add command -label "PLOT2D" -command \
{ mkDialog .modal {-text \
{The PLOT2D menu invokes demonstrations of the PRL-MAP \
PLOT2D object subprograms.  The PLOT2D object is \
a plot referenced to 2D axes scaled for linear world coordinates. \
} -aspect 450 -justify left} {OK {}}
}
#                       "PRL" button
.menu.more.defs add command -label "PRL" -command \
{ mkDialog .modal {-text \
{The PRL menu invokes demonstrations of the PRL-MAP \
PRL object subprograms.  The PRL object is \
the grandparent object of all Programmer's Reusable Library objects. \
} -aspect 450 -justify left} {OK {}}
}
#                       "PROCESS" button
.menu.more.defs add command -label "PROCESS" -command \
{ mkDialog .modal {-text \
{The PROCESS menu invokes demonstrations of the PRL-MAP \
PROCESS object subprograms.  The PROCESS object is \
a single thread of control that executes within an address space. \
} -aspect 450 -justify left} {OK {}}
}
#                       "PROJ" button
.menu.more.defs add command -label "PROJ" -command \
{ mkDialog .modal {-text \
{The PROJ menu invokes demonstrations of the PRL-MAP \
PROJ object subprograms.  The PROJ object is \
a coordinate mapping used to image spherical data on a planar surface. \
} -aspect 450 -justify left} {OK {}}
}
#                       "SUBPLOT" button
.menu.more.defs add command -label "SUBPLOT" -command \
{ mkDialog .modal {-text \
{The SUBPLOT menu invokes demonstrations of the PRL-MAP \
SUBPLOT object subprograms.  The SUBPLOT object is \
a collection of graphical objects associated with a given reference system. \
} -aspect 450 -justify left} {OK {}}
}
#                       "VIEWPT" button
.menu.more.defs add command -label "VIEWPT" -command \
{ mkDialog .modal {-text \
{The VIEWPT menu invokes demonstrations of the PRL-MAP \
VIEWPT object subprograms.  The VIEWPT object is \
a location in 3-D space used to generate a projection of 3D graphical objects. \
} -aspect 450 -justify left} {OK {}}
}
#     ******************************************************************
#
#                       Pack menus
#
pack .menu.demo \
     .menu.prl \
     .menu.device \
     .menu.mapp \
     .menu.setup \
     .menu.axes \
     .menu.map \
     .menu.process \
     .menu.more -side left
#
#     ******************************************************************
#
#                       Set up for keyboard-based menu traversal
#
bind . <Any-FocusIn> {
    if {("%d" == "NotifyVirtual") && ("%m" == "NotifyNormal")} {
	focus .menu
    }
}
tk_menuBar .menu .menu.demo \
           .menu.prl \
           .menu.device \
           .menu.mapp \
           .menu.setup \
           .menu.axes \
           .menu.map \
           .menu.process \
           .menu.more
#
#     ******************************************************************
#
#                       Position a dialog box on the screen
#
proc dpos w {
    wm geometry $w +300+300
}
#
STOP_CAT
echo "  Generating =====> [ ./curve2d1.f ]"
cat <<"STOP_CAT"> ././curve2d1.f
C     PROGRAM CURVE2D1
C
C       Programmer's Reusable Library, Version 0.7      (TM)
C
C            Copyright (C) 1995 Object Access (SM)
C
C     Permission is granted to any individual or institution
C     to use, copy, modify, and distribute this single program
C     unit, provided that this complete copyright and
C     permission notice is maintained, intact, in all copies.
C
C     Object Access Incorporated provides this software
C     "as is" without express or implied warranty.
C
C     PURPOSE: Demonstrate and test access program CURVE2D_DRAW
C
C     LOCAL VARIABLES:
C
C
C     NOTES:  None
C
C     ******************************************************************
C
      REAL Y1(5),X1(5)
C
C                       Library version numbers (actual & required)
      CHARACTER*8  VERAQ,VERRQ
C
C                       Program required PRL version
      DATA VERRQ /'0.7     '/
C
      DATA X1 /-70.0,5.0,20.0,70.0,80.0/
      DATA Y1 /-10.0,25.0,50.0,60.0,70.0/
C
C     ******************************************************************
C
C                       INITIALIZE LIBRARIES
C
C                       Initialize the map package
      CALL MAP_INIT (0)
C
C     ******************************************************************
C
C                       Check PRL version
C
C                       Get actual PRL version being used
      CALL PRL_LIBVER (VERAQ,VERRQ)
C
C     ******************************************************************
C
C                       INITIALIZE OUTPUT DEVICE
C
C                       Allow user to choose a device interactively
      KTYPE = 0
      CALL DEVICE_PROMPT (KTYPE,XPAGE,YPAGE)
C
C     ******************************************************************
C
C                       DEFINE PAGE SIZE
C
      DO 100 ICRV=0,1
C
C                       Define page size in inches
      CALL PAGE_SIZE (XPAGE,YPAGE)
C
C     ******************************************************************
C
C                       DEFINE SUBPLOT AREA FOR LABELS
C
C                       Compute location of physical origin in inches
      XRL = 0.10*XPAGE
      YRL = 0.25*YPAGE
C
C                       Compute length of X and Y axis in inches
      XPG = XPAGE - 2.0*XRL
      YPG = YPAGE - 2.0*YRL
C                       Define location of physical origin relative
C                       to lower left corner of page
      CALL ORIGIN_SET (XRL,YRL)
C                       Specify 'lambert equal area' map projection
      CALL PROJ_SETMAP ('LAMBERT')
C                       Define subplot area in terms of length
C                       of X and Y axis in inches and draw border
C                       around outer edge of plot
      CALL SUBPLOT_DEFINE (XPG,YPG)
C
C     ******************************************************************
C
C                       DRAW HEADING OVER SUBPLOT AREA
C
C                       Compute text height based on page height
      SIZE = 0.25*YPAGE/11.0
C                       Set current text height in inches
      CALL TEXT2D_SETHT (SIZE)
C                       Set character style to 'triplx'
      CALL FONT_TRIPLX
C                       Draw heading over plot
      CALL HEADING_DRAW ('Lambert Equal Area Projection$',100,1.2,1)
C
C     ------------------------------------------------------------------
C
C                       DRAW TITLE UNDER SUBPLOT AREA
C
C                       Set character style to cartog
      CALL FONT_CARTOG
C                       Determine length of text string in inches
      XX = TEXT2D_GETLEN
     *     ('CURVE2D1 Demo: World Map with Curve$',100)
C                       Compute X coord of start of string in inches
      XX = 0.50*(XPG-XX)
C                       Plot text string
      CALL TEXT2D_PDRAW
     *     ('CURVE2D1 Demo: World Map with Curve$',100,XX,-YPG*0.25)
C
C     ******************************************************************
C
C                       END THE SUBPLOT
C
      CALL SUBPLOT_END (0)
C
C     ******************************************************************
C
C                       DEFINE SUBPLOT AREA FOR MAP
C
C                       Set current text height in inches
      CALL TEXT2D_SETHT (SIZE*0.75)
C
C                       Define world map subplot area in terms of
C                       length of X and Y axis in inches and draw
C                       border around outer edge of plot
      CALL SUBPLOT_DEFMAP (XPG,YPG)
C                        Define the map pole
      CALL VIEWPT_SETMPOLE (0.0,45.0)
C
C     ******************************************************************
C
C                       DRAW THE PLOT
C
C                       Define 2D coordinate system with
C                       longitude (X) = 90 west to 90 east and
C                       latitude  (Y) = 45 south to 135 north
      CALL PLOT2D_DEFMAP (-90.0, 30.0, 90., -45.0, 30.0, 135.0)
C
C                       Set frame thickness in inches
      CALL FRAME_THICK (0.01)
C                       Draw frame around subplot area
      CALL FRAME_DRAW
C                       Draw world coastlines, islands, lakes
C                       in low resolution
      CALL MAPDATA_DRAW ('LOWCOAST')
C                       Set curve highlight color
      CALL COLOR_SETNAM ('GREE')
C                       Set spline interpolation
      CALL CURVE2D_CUBIC
C                       Draw line using cubic spline interpolation
C                       with default symbol at each point
      CALL CURVE2D_DRAW (X1,Y1,5,ICRV)
C
C     ******************************************************************
C
C                       END THE SUBPLOT
C
      CALL  SUBPLOT_ENDMAP
C
C     ******************************************************************
C
C                       END THE PLOT
C
C                       End current plot and advance paper
      CALL PAGE_END (0)
C
  100 CONTINUE
C
C     ******************************************************************
C
C                       CLOSE THE OUTPUT DEVICE
C
C                       Finish plotting and release device
      CALL DEVICE_END
C                       Exit
      CALL PROCESS_EXIT
      END
STOP_CAT
echo "  Generating =====> [ ./device1.f ]"
cat <<"STOP_CAT"> ././device1.f
C     PROGRAM DEVICE3
C
C       Programmer's Reusable Library, Version 0.7      (TM)
C
C            Copyright (C) 1995 Object Access (SM)
C
C     Permission is granted to any individual or institution
C     to use, copy, modify, and distribute this single program
C     unit, provided that this complete copyright and
C     permission notice is maintained, intact, in all copies.
C
C     Object Access Incorporated provides this software
C     "as is" without express or implied warranty.
C
C     PURPOSE: Demonstrate and test access programs DEVICE_SELECT and
C              DEVICE_RELEASE
C
C     LOCAL VARIABLES:
C
C
C     NOTES:  None
C
C     ******************************************************************
C
C                       External subprogram declarations
C
C     INTRINSIC
C
C                       DEVICE object access program
      EXTERNAL DEVICE_SELECT, DEVICE_RELEASE
C
C                       DEVICE object access programs
      EXTERNAL DEVICE_INIT
C
C                       PRL object access programs
      EXTERNAL PRL_LIBVER
C
C                       REAL object access programs
      EXTERNAL REAL_IDIF0, REAL_SETTOL
      LOGICAL  REAL_IDIF0
C
C                       DBL object access programs
      EXTERNAL DBL_IDIF0, DBL_SETTOL
      LOGICAL  DBL_IDIF0
C
C                       CMPLX object access programs
      EXTERNAL CMPLX_IDIF0
      LOGICAL  CMPLX_IDIF0
C
C                       TERM object access programs
      EXTERNAL TERM_GETIN, TERM_GETOUT, TERM_GETERR, TERM_SETSIO
      INTEGER  TERM_GETIN, TERM_GETOUT, TERM_GETERR
C
C                       PROCESS object access programs
      EXTERNAL PROCESS_EXIT
C
C                       FILE object access programs
      EXTERNAL PXFCLS, PXFOPN
C
C                       PCONS object access programs
      EXTERNAL IPXCON
      INTEGER  IPXCON
C
C     ------------------------------------------------------------------
C
C                       Test program parameter values
C
C                       Standard input logical unit for the system
      PARAMETER (LUNSI=5)
C                       Standard output logical unit for the system
      PARAMETER (LUNSO=6)
C                       Standard error logical unit for the system
      PARAMETER (LUNSE=6)
C
C                       REAL subtraction tolerance
      PARAMETER (TOLER=0.00001)
C                       DBL subtraction tolerance
      DOUBLE PRECISION DTOLER
      PARAMETER (DTOLER=1.0D-13)
C
C                       Number of input variable test values
      PARAMETER (NVV101 = 26)
C
C                       Argument maximum array sizes
C
C     ------------------------------------------------------------------
C
C                       Access program variables
C
C                       Integer variables and arrays
      INTEGER KTYPQ, TMP101
C
C                       Real variables and arrays
      REAL    XPAGE, TMP102, YPAGE, TMP103
C
C                       Double precision variables and arrays
C
C                       Complex variables and arrays
C
C                       Logical variables and arrays
C
C                       Character variables and arrays
C
C     ------------------------------------------------------------------
C
C                       Test program variables
C
      CHARACTER*1 PAUS
C                       Program logical unit numbers
      INTEGER     IN, IOUT, IER, IFILE, IO
C
C                       Name of results file for the access program
      CHARACTER*(40) FILNAM
C
C                       Library version numbers (actual & required)
      CHARACTER*8  VERAQ,VERRQ
C
C                       Input variable test value arrays
      INTEGER VV101(NVV101)
C
C                       Program required PRL version
      DATA VERRQ /'0.7     '/
C
C                       Input variable test values
      DATA VV101 / 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15,
     *            -2,-3,-4,-5,-6,-7,-8,-10,-11,-12,-13,-14,-15/
C
C     ******************************************************************
C
C                       Initialize library
C
      CALL DEVICE_INIT (0)
C
C     ******************************************************************
C
C                       Check PRL version
C
C                       Get actual PRL version being used
      CALL PRL_LIBVER (VERAQ,VERRQ)
C
C     ******************************************************************
C
C                       Set machine-specific constants
C
      CALL TERM_SETSIO (LUNSI,LUNSO,LUNSE)
C
C                       Logical unit number (LUN) of standard in
      IN = TERM_GETIN ()
C                       LUN of standard out
      IOUT = TERM_GETOUT ()
C                       LUN of standard error
      IER = TERM_GETERR ()
C
C                       REAL subtraction tolerance
      CALL REAL_SETTOL (TOLER)
C
C                       DBL subtraction tolerance
      CALL DBL_SETTOL (DTOLER)
C
C     ******************************************************************
C
C                       Print introduction message
C
C                       Set file pathname
      FILNAM = 'device_select.dat'
C
      WRITE (IOUT,301) FILNAM
  301 FORMAT (
     * '              DEVICE Object Demo Program #3'/
     * ' This program tests the DEVICE object access programs'/
     * ' DEVICE_SELECT and DEVICE_RELEASE.'/
     * ' The input variables are varied through a wide range of valid'/
     * ' combinations.  The results for each combination are compared'/
     * ' to previously-computed results stored on file, and any '/
     * ' differences are displayed.  If no results file is found, the'/
     * ' computed results are saved in a file named'/
     * ' ',A//
     * ' This program will generate several files with names such as'/
     * ' POSTSC_LIS.  These are empty graphics output files that are'/
     * ' produced when testing the initialization of the various'/
     * ' graphics output devices.  These files may be deleted after'/
     * ' demo program has finished.'//
     * '                      Press <CR> to continue')
      READ (IN,811) PAUS
C
C                       Initialize program completion status
      IOK = 0
C
C     ******************************************************************
C
C                       Open test results file
C
C                       Open read-only
      IOPFLG = IPXCON ('O_RDONLY')
C
C                       Assume file exists and open read-only
      CALL PXFOPN (FILNAM,0,IOPFLG,0,IFILE,IRESLT)
C
C                       If file does not exist,
C                       create and open read/write
      IF (IRESLT .NE. 0) THEN
        IF (IRESLT .EQ. IPXCON('ENOENT')) THEN
C                       Open read-only
          IOPFLG = IPXCON ('O_RDWR')
C                       Allow file creation
     *            +IPXCON ('O_CREAT')
C                       Create file and open read/write
          CALL PXFOPN (FILNAM,0,IOPFLG,0,IFILE,IERROR)
C
C                       If error creating and opening file,
C                       print error message and exit
          IF (IERROR .NE. 0) THEN
            WRITE (IER,409) FILNAM
  409       FORMAT (' Error opening results file ',A)
            GOTO 900
          ENDIF
C                       Print message that file is being created
          WRITE (IOUT,411) FILNAM
  411     FORMAT (' Creating file ',A)
          IOK = 1
C
C                       If error opening existing file,
C                       print error message and exit
        ELSE
          WRITE (IER,409) FILNAM
          GOTO 900
        ENDIF
      ENDIF
C
C     ******************************************************************
C
C                       Test DEVICE_SELECT object access program
C
C                       Loop for each input variable of access program
      DO 589 IVV101 = 1,NVV101
        KTYPQ = VV101(IVV101)
C
C                       Non-interactively select a graphics output
C                       device
      CALL DEVICE_SELECT (KTYPQ,XPAGE,YPAGE)
C
C                       Read input and output variable values from file
      IF (IRESLT .EQ. 0) THEN
        READ (IFILE,502,ERR=610) TMP101,TMP102,TMP103
C
C                       Compare output with previously-computed values
C                       and write to error device if they do not match
        IF (.NOT. REAL_IDIF0(XPAGE ,TMP102 )) THEN
          IO = IER
          IOK = 1
          GOTO 501
        ELSE IF (.NOT. REAL_IDIF0(YPAGE ,TMP103 )) THEN
          IO = IER
          IOK = 1
          GOTO 501
        ENDIF
C                       Test combination matches previous results
        GOTO 503
C
C                       Write input and output variable values to file
      ELSE
        IO = IFILE
        GOTO 501
      ENDIF
C                       Write input and output variable values
C                       to file or error device
  501 CONTINUE
      WRITE (IO,502,ERR=612) KTYPQ,XPAGE,YPAGE
  502 FORMAT (I21,E15.7,E15.7)
  503 CONTINUE
C
C                       Repeat for next variable value
      CALL DEVICE_RELEASE ()
  589 CONTINUE
C
C     ******************************************************************
C
C                       Print program status message
C
      IF (IOK .EQ. 0) THEN
        WRITE (IOUT,601)
  601   FORMAT (' Program results identical to file values')
      ENDIF
      GOTO 700
C
  610 WRITE (IER,611) FILNAM
  611 FORMAT (' Error reading file ',A)
      GOTO 700
C
  612 WRITE (IER,613) FILNAM
  613 FORMAT (' Error writing file ',A)
C
C     ******************************************************************
C
C                       Close test results file
C
C                       Close file
  700 CALL PXFCLS (IFILDS,IERROR)
C
C     ******************************************************************
C
C                       Print demo termination message
C
C                       Wait until user presses a key before exiting
      WRITE (IOUT,810)
  810 FORMAT (/
     * ' Note:'/
     * ' In the above output, occasional strings of "garbage"'/
     * ' characters are normal,  They are the result of printing'/
     * ' Tektronix control code sequences to a non-Tektronix'/
     * ' terminal while exercising the Tektronix drivers.'//
     * '              DEVICE Demo Program #3 Execution Completed'/
     * '                      Press <CR> to exit demo')
      READ (IN,811) PAUS
  811 FORMAT (A)
C
C     ******************************************************************
C
C                       Terminate program execution
C
  900 CALL PROCESS_EXIT
      END
STOP_CAT
echo "  Generating =====> [ ./device_select.dat ]"
cat <<"STOP_CAT"> ././device_select.uuu
begin 660 ./device_select.dat
M("`@("`@("`@("`@("`@("`@("`R("`@+C$T,C@P,#!%*S`R("`@+C$P.#<P
M,#!%*S`R"B`@("`@("`@("`@("`@("`@("`@,R`@("XQ,3`P,#`P12LP,B`@
M("XX-3`P,#`P12LP,0H@("`@("`@("`@("`@("`@("`@(#0@("`N,3$P,#`P
M,$4K,#(@("`N.#4P,#`P,$4K,#$*("`@("`@("`@("`@("`@("`@("`U("`@
M+C$T,#`P,#!%*S`R("`@+C$P-3`P,#!%*S`R"B`@("`@("`@("`@("`@("`@
M("`@-B`@("XQ,3`P,#`P12LP,B`@("XX-3`P,#`P12LP,0H@("`@("`@("`@
M("`@("`@("`@(#<@("`N,30R.#`P,$4K,#(@("`N,3`X-S`P,$4K,#(*("`@
M("`@("`@("`@("`@("`@("`X("`@+C$T,C@P,#!%*S`R("`@+C$P.#<P,#!%
M*S`R"B`@("`@("`@("`@("`@("`@("`Q,"`@("XQ,S8Y,#`P12LP,B`@("XQ
M,#DU,#`P12LP,@H@("`@("`@("`@("`@("`@("`@,3$@("`N,3`P,#`P,$4K
M,#(@("`N-S4Y,#`P,$4K,#$*("`@("`@("`@("`@("`@("`@(#$R("`@+C$P
M,C4P,#!%*S`R("`@+C<W-3`P,#!%*S`Q"B`@("`@("`@("`@("`@("`@("`Q
M,R`@("XQ,S8Y,#`P12LP,B`@("XQ,#DU,#`P12LP,@H@("`@("`@("`@("`@
M("`@("`@,30@("`N,3`R-3`P,$4K,#(@("`N-S<U,#`P,$4K,#$*("`@("`@
M("`@("`@("`@("`@(#$U("`@+C$Q,#`P,#!%*S`R("`@+C@U,#`P,#!%*S`Q
M"B`@("`@("`@("`@("`@("`@("`M,B`@("XQ-#(X,#`P12LP,B`@("XQ,#@W
M,#`P12LP,@H@("`@("`@("`@("`@("`@("`@+3,@("`N,3$P,#`P,$4K,#(@
M("`N.#4P,#`P,$4K,#$*("`@("`@("`@("`@("`@("`@("TT("`@+C$Q,#`P
M,#!%*S`R("`@+C@U,#`P,#!%*S`Q"B`@("`@("`@("`@("`@("`@("`M-2`@
M("XQ-#`P,#`P12LP,B`@("XQ,#4P,#`P12LP,@H@("`@("`@("`@("`@("`@
M("`@+38@("`N,3$P,#`P,$4K,#(@("`N.#4P,#`P,$4K,#$*("`@("`@("`@
M("`@("`@("`@("TW("`@+C$T,C@P,#!%*S`R("`@+C$P.#<P,#!%*S`R"B`@
M("`@("`@("`@("`@("`@("`M."`@("XQ-#(X,#`P12LP,B`@("XQ,#@W,#`P
M12LP,@H@("`@("`@("`@("`@("`@("`M,3`@("`N,3,V.3`P,$4K,#(@("`N
M,3`Y-3`P,$4K,#(*("`@("`@("`@("`@("`@("`@+3$Q("`@+C$P,#`P,#!%
M*S`R("`@+C<U.3`P,#!%*S`Q"B`@("`@("`@("`@("`@("`@("TQ,B`@("XQ
M,#(U,#`P12LP,B`@("XW-S4P,#`P12LP,0H@("`@("`@("`@("`@("`@("`M
M,3,@("`N,3,V.3`P,$4K,#(@("`N,3`Y-3`P,$4K,#(*("`@("`@("`@("`@
M("`@("`@+3$T("`@+C$P,C4P,#!%*S`R("`@+C<W-3`P,#!%*S`Q"B`@("`@
M("`@("`@("`@("`@("TQ-2`@("XQ,3`P,#`P12LP,B`@("XX-3`P,#`P12LP
",0H@
`
end
STOP_CAT
echo "  Generating =====> [ ./frame1.f ]"
cat <<"STOP_CAT"> ././frame1.f
C     PROGRAM FRAME1
C
C       Programmer's Reusable Library, Version 0.7      (TM)
C
C            Copyright (C) 1995 Object Access (SM)
C
C     Permission is granted to any individual or institution
C     to use, copy, modify, and distribute this single program
C     unit, provided that this complete copyright and
C     permission notice is maintained, intact, in all copies.
C
C     Object Access Incorporated provides this software
C     "as is" without express or implied warranty.
C
C     PURPOSE: Demonstrate and test access program FRAME_DRAW
C
C     LOCAL VARIABLES:
C
C
C     NOTES:  None
C
C     ******************************************************************
C
C                       Library version numbers (actual & required)
      CHARACTER*8  VERAQ,VERRQ
C
C                       Program required PRL version
      DATA VERRQ /'0.7     '/
C
C     ******************************************************************
C
C                       INITIALIZE LIBRARIES
C
C                       Initialize the map package
      CALL MAP_INIT (0)
C
C     ******************************************************************
C
C                       Check PRL version
C
C                       Get actual PRL version being used
      CALL PRL_LIBVER (VERAQ,VERRQ)
C
C     ******************************************************************
C
C                       INITIALIZE OUTPUT DEVICE
C
C                       Allow user to choose a device interactively
      KTYPE = 0
      CALL DEVICE_PROMPT (KTYPE,XPAGE,YPAGE)
C
C     ******************************************************************
C
C                       DEFINE PAGE SIZE
C
C                       Define page size in inches
      CALL PAGE_SIZE (XPAGE,YPAGE)
C
C     ******************************************************************
C
C                       DEFINE SUBPLOT AREA FOR LABELS
C
C                       Compute location of physical origin in inches
      XRL = 0.10*XPAGE
      YRL = 0.25*YPAGE
C
C                       Compute length of X and Y axis in inches
      XPG = XPAGE - 2.0*XRL
      YPG = YPAGE - 2.0*YRL
C                       Define location of physical origin relative
C                       to lower left corner of page
      CALL ORIGIN_SET (XRL,YRL)
C                       Specify 'cylindrical equidistant' map projection
      CALL PROJ_SETMAP ('CYLINDRICAL')
C                       Define subplot area in terms of length
C                       of X and Y axis in inches and draw border
C                       around outer edge of plot
      CALL SUBPLOT_DEFINE (XPG,YPG)
C
C     ******************************************************************
C
C                       DRAW HEADING OVER SUBPLOT AREA
C
C                       Compute text height based on page height
      SIZE = 0.25*YPAGE/11.0
C                       Set current text height in inches
      CALL TEXT2D_SETHT (SIZE)
C                       Set character style to 'triplx'
      CALL FONT_TRIPLX
C                       Draw heading over plot
      CALL HEADING_DRAW
     *     ('Cylindrical Equidistant Projection$',100,1.2,1)
C
C     ------------------------------------------------------------------
C
C                       DRAW TITLE UNDER SUBPLOT AREA
C
C                       Set character style to cartog
      CALL FONT_CARTOG
C                       Determine length of text string in inches
      XX = TEXT2D_GETLEN
     *     ('FRAME1 Demo: World Map with Frame$',100)
C                       Compute X coord of start of string in inches
      XX = 0.50*(XPG-XX)
C                       Plot text string
      CALL TEXT2D_PDRAW
     *     ('FRAME1 Demo: World Map with Frame$',
     *     100,XX,-YPG*0.25)
C
C     ******************************************************************
C
C                       END THE SUBPLOT
C
      CALL SUBPLOT_END (0)
C
C     ******************************************************************
C
C                       DEFINE SUBPLOT AREA FOR MAP
C
C                       Set current text height in inches
      CALL TEXT2D_SETHT (SIZE*0.75)
C
C                       Define world map subplot area in terms of
C                       length of X and Y axis in inches and draw
C                       border around outer edge of plot
      CALL SUBPLOT_DEFMAP (XPG,YPG)
C
C     ******************************************************************
C
C                       DEFINE PLOT HEADING AND LABELS
C
C                       Set character style to 'duplex'
      CALL FONT_DUPLEX
C                       Set X axis label
      CALL AXISLBL_DEFX2 ('LONGITUDE$',100)
C                       Set Y axis label
      CALL AXISLBL_DEFY2 ('LATITUDE$',100)
C
C     ******************************************************************
C
C                       DRAW THE PLOT
C
C                       Define 2D coordinate system with
C                       longitude (X) = 82 to 80 deg west and
C                       latitude  (Y) = 28 to 30 deg north and
C                       draw axes, axes labels
      CALL PLOT2D_DEFMAP (-82.0, 0.50,-80. 0,28.0, 0.50, 30.0)
C
C                       Draw grid lines in, and frame around, subplot
      CALL GRID_DRAW (1,1)
C                       Set frame thickness in inches
      CALL FRAME_THICK (0.03)
C                       Draw frame around subplot area
      CALL FRAME_DRAW
C                       Draw world coastlines, islands, lakes
C                       in high resolution
      CALL MAPDATA_DRAW ('HICOAST')
C
C     ******************************************************************
C
C                       END THE SUBPLOT
C
      CALL  SUBPLOT_ENDMAP
C
C     ******************************************************************
C
C                       END THE PLOT
C
C                       End current plot and advance paper
      CALL PAGE_END (0)
C
C     ******************************************************************
C
C                       CLOSE THE OUTPUT DEVICE
C
C                       Finish plotting and release device
      CALL DEVICE_END
C                       Exit
      CALL PROCESS_EXIT
      END
STOP_CAT
echo "  Generating =====> [ ./grid1.f ]"
cat <<"STOP_CAT"> ././grid1.f
C     PROGRAM GRID1
C
C       Programmer's Reusable Library, Version 0.7      (TM)
C
C            Copyright (C) 1995 Object Access (SM)
C
C     Permission is granted to any individual or institution
C     to use, copy, modify, and distribute this single program
C     unit, provided that this complete copyright and
C     permission notice is maintained, intact, in all copies.
C
C     Object Access Incorporated provides this software
C     "as is" without express or implied warranty.
C
C     PURPOSE: Demonstrate and test access program GRID_DRAW
C
C     LOCAL VARIABLES:
C
C
C     NOTES:  None
C
C     ******************************************************************
C
C                       Library version numbers (actual & required)
      CHARACTER*8  VERAQ,VERRQ
C
C                       Program required PRL version
      DATA VERRQ /'0.7     '/
C
C     ******************************************************************
C
C                       INITIALIZE LIBRARIES
C
C                       Initialize the map package
      CALL MAP_INIT (0)
C
C     ******************************************************************
C
C                       Check PRL version
C
C                       Get actual PRL version being used
      CALL PRL_LIBVER (VERAQ,VERRQ)
C
C     ******************************************************************
C
C                       INITIALIZE OUTPUT DEVICE
C
C                       Allow user to choose a device interactively
      KTYPE = 0
      CALL DEVICE_PROMPT (KTYPE,XPAGE,YPAGE)
C
C     ******************************************************************
C
C                       DEFINE PAGE SIZE
C
C                       Define page size in inches
      CALL PAGE_SIZE (XPAGE,YPAGE)
C
C     ******************************************************************
C
C                       DEFINE SUBPLOT AREA FOR LABELS
C
C                       Compute location of physical origin in inches
      XRL = 0.10*XPAGE
      YRL = 0.25*YPAGE
C
C                       Compute length of X and Y axis in inches
      XPG = XPAGE - 2.0*XRL
      YPG = YPAGE - 2.0*YRL
C                       Define location of physical origin relative
C                       to lower left corner of page
      CALL ORIGIN_SET (XRL,YRL)
C                       Specify 'cylindrical equidistant' map projection
      CALL PROJ_SETMAP ('CYLINDRICAL')
C                       Define subplot area in terms of length
C                       of X and Y axis in inches and draw border
C                       around outer edge of plot
      CALL SUBPLOT_DEFINE (XPG,YPG)
C
C     ******************************************************************
C
C                       DRAW HEADING OVER SUBPLOT AREA
C
C                       Compute text height based on page height
      SIZE = 0.25*YPAGE/11.0
C                       Set current text height in inches
      CALL TEXT2D_SETHT (SIZE)
C                       Set character style to 'triplx'
      CALL FONT_TRIPLX
C                       Draw heading over plot
      CALL HEADING_DRAW
     *     ('Cylindrical Equidistant Projection$',100,1.2,1)
C
C     ------------------------------------------------------------------
C
C                       DRAW TITLE UNDER SUBPLOT AREA
C
C                       Set character style to cartog
      CALL FONT_CARTOG
C                       Determine length of text string in inches
      XX = TEXT2D_GETLEN
     *     ('GRID1 Demo: World Map with Grid$',100)
C                       Compute X coord of start of string in inches
      XX = 0.50*(XPG-XX)
C                       Plot text string
      CALL TEXT2D_PDRAW
     *     ('GRID1 Demo: World Map with Grid$',100,XX,-YPG*0.25)
C
C     ******************************************************************
C
C                       END THE SUBPLOT
C
      CALL SUBPLOT_END (0)
C
C     ******************************************************************
C
C                       DEFINE SUBPLOT AREA FOR MAP
C
C                       Set current text height in inches
      CALL TEXT2D_SETHT (SIZE*0.75)
C
C                       Define world map subplot area in terms of
C                       length of X and Y axis in inches and draw
C                       border around outer edge of plot
      CALL SUBPLOT_DEFMAP (XPG,YPG)
C
C     ******************************************************************
C
C                       DEFINE PLOT HEADING AND LABELS
C
C                       Set character style to 'duplex'
      CALL FONT_DUPLEX
C                       Set X axis label
      CALL AXISLBL_DEFX2 ('LONGITUDE$',100)
C                       Set Y axis label
      CALL AXISLBL_DEFY2 ('LATITUDE$',100)
C
C     ******************************************************************
C
C                       DRAW THE PLOT
C
C                       Define 2D coordinate system with
C                       longitude (X) = 82 to 80 deg west and
C                       latitude  (Y) = 28 to 30 deg north and
C                       draw axes, axes labels
      CALL PLOT2D_DEFMAP (-82.0, 0.50,-80. 0,28.0, 0.50, 30.0)
C
C                       Draw grid lines in, and frame around, subplot
      CALL GRID_DRAW (1,1)
C                       Draw world coastlines, islands, lakes
C                       in high resolution
      CALL MAPDATA_DRAW ('HICOAST')
C
C     ******************************************************************
C
C                       END THE SUBPLOT
C
      CALL  SUBPLOT_ENDMAP
C
C     ******************************************************************
C
C                       END THE PLOT
C
C                       End current plot and advance paper
      CALL PAGE_END (0)
C
C     ******************************************************************
C
C                       CLOSE THE OUTPUT DEVICE
C
C                       Finish plotting and release device
      CALL DEVICE_END
C                       Exit
      CALL PROCESS_EXIT
      END
STOP_CAT
echo "  Generating =====> [ ./grid2.f ]"
cat <<"STOP_CAT"> ././grid2.f
C     PROGRAM GRID2
C
C       Programmer's Reusable Library, Version 0.7      (TM)
C
C            Copyright (C) 1995 Object Access (SM)
C
C     Permission is granted to any individual or institution
C     to use, copy, modify, and distribute this single program
C     unit, provided that this complete copyright and
C     permission notice is maintained, intact, in all copies.
C
C     Object Access Incorporated provides this software
C     "as is" without express or implied warranty.
C
C     PURPOSE: Demonstrate and test access program GRID_DRAW
C
C     LOCAL VARIABLES:
C
C
C     NOTES:  None
C
C     ******************************************************************
C
C                       Library version numbers (actual & required)
      CHARACTER*8  VERAQ,VERRQ
C
C                       Program required PRL version
      DATA VERRQ /'0.7     '/
C
C     ******************************************************************
C
C                       INITIALIZE LIBRARIES
C
C                       Initialize the map package
      CALL MAP_INIT (0)
C
C     ******************************************************************
C
C                       Check PRL version
C
C                       Get actual PRL version being used
      CALL PRL_LIBVER (VERAQ,VERRQ)
C
C     ******************************************************************
C
C                       INITIALIZE OUTPUT DEVICE
C
C                       Allow user to choose a device interactively
      KTYPE = 0
      CALL DEVICE_PROMPT (KTYPE,XPAGE,YPAGE)
C
C     ******************************************************************
C
C                       DEFINE PAGE SIZE
C
C                       Define page size in inches
      CALL PAGE_SIZE (XPAGE,YPAGE)
C
C     ******************************************************************
C
C                       DEFINE SUBPLOT AREA FOR LABELS
C
C                       Compute location of physical origin in inches
      XRL = 0.10*XPAGE
      YRL = 0.25*YPAGE
C
C                       Compute length of X and Y axis in inches
      XPG = XPAGE - 2.0*XRL
      YPG = YPAGE - 2.0*YRL
C                       Define location of physical origin relative
C                       to lower left corner of page
      CALL ORIGIN_SET (XRL,YRL)
C                       Specify 'lambert equal area' map projection
      CALL PROJ_SETMAP ('LAMBERT')
C                       Define subplot area in terms of length
C                       of X and Y axis in inches and draw border
C                       around outer edge of plot
      CALL SUBPLOT_DEFINE (XPG,YPG)
C
C     ******************************************************************
C
C                       DRAW HEADING OVER SUBPLOT AREA
C
C                       Compute text height based on page height
      SIZE = 0.25*YPAGE/11.0
C                       Set current text height in inches
      CALL TEXT2D_SETHT (SIZE)
C                       Set character style to 'triplx'
      CALL FONT_TRIPLX
C                       Draw heading over plot
      CALL HEADING_DRAW ('Lambert Equal Area Projection$',100,1.2,1)
C
C     ------------------------------------------------------------------
C
C                       DRAW TITLE UNDER SUBPLOT AREA
C
C                       Set character style to cartog
      CALL FONT_CARTOG
C                       Determine length of text string in inches
      XX = TEXT2D_GETLEN
     *     ('GRID2 Demo: World Map with Grid$',100)
C                       Compute X coord of start of string in inches
      XX = 0.50*(XPG-XX)
C                       Plot text string
      CALL TEXT2D_PDRAW
     *     ('GRID2 Demo: World Map with Grid$',100,XX,-YPG*0.25)
C
C     ******************************************************************
C
C                       END THE SUBPLOT
C
      CALL SUBPLOT_END (0)
C
C     ******************************************************************
C
C                       DEFINE SUBPLOT AREA FOR MAP
C
C                       Set current text height in inches
      CALL TEXT2D_SETHT (SIZE*0.75)
C
C                       Define world map subplot area in terms of
C                       length of X and Y axis in inches and draw
C                       border around outer edge of plot
      CALL SUBPLOT_DEFMAP (XPG,YPG)
C                        Define the map pole
      CALL VIEWPT_SETMPOLE (0.0,45.0)
C
C     ******************************************************************
C
C                       DRAW THE PLOT
C
C                       Define 2D coordinate system with
C                       longitude (X) = 90 west to 90 east and
C                       latitude  (Y) = 45 south to 135 north
      CALL PLOT2D_DEFMAP (-90.0, 30.0, 90., -45.0, 30.0, 135.0)
C
C                       Draw grid lines in subplot area
      CALL GRID_DRAW (1,1)
C                       Set frame thickness in inches
      CALL FRAME_THICK (0.01)
C                       Draw frame around subplot area
      CALL FRAME_DRAW
C                       Draw world coastlines, islands, lakes
C                       in low resolution
      CALL MAPDATA_DRAW ('LOWCOAST')
C
C     ******************************************************************
C
C                       END THE SUBPLOT
C
      CALL  SUBPLOT_ENDMAP
C
C     ******************************************************************
C
C                       END THE PLOT
C
C                       End current plot and advance paper
      CALL PAGE_END (0)
C
C     ******************************************************************
C
C                       CLOSE THE OUTPUT DEVICE
C
C                       Finish plotting and release device
      CALL DEVICE_END
C                       Exit
      CALL PROCESS_EXIT
      END
STOP_CAT
echo "  Generating =====> [ ./map1.f ]"
cat <<"STOP_CAT"> ././map1.f
C     PROGRAM MAP1
C
C       Programmer's Reusable Library, Version 0.7      (TM)
C
C            Copyright (C) 1995 Object Access (SM)
C
C     Permission is granted to any individual or institution
C     to use, copy, modify, and distribute this single program
C     unit, provided that this complete copyright and
C     permission notice is maintained, intact, in all copies.
C
C     Object Access Incorporated provides this software
C     "as is" without express or implied warranty.
C
C     PURPOSE: Demonstrate and test access program MAP_INIT
C
C     LOCAL VARIABLES:
C
C
C     NOTES:  None
C
C     ******************************************************************
C
C                       MAP object access programs
      EXTERNAL MAP_INIT
C
C                       PROCESS object access programs
      EXTERNAL PROCESS_EXIT
C
C     ------------------------------------------------------------------
C
      CHARACTER*80 STRING
C
C     ******************************************************************
C
C                       Initialize library
C
      CALL MAP_INIT (0)
C
C     ******************************************************************
C
C                       Write demo program introduction message
C
C                       Write intro message
C                       (use * for logical unit since TERM_SETSIO will
C                       not be called in this demo)
      WRITE (*,401)
  401 FORMAT (
     * '                   MAP Object Demo Program #1'//
     * ' MAP_INIT must be used to initialize the PRL-MAP'/
     * ' library prior to invoking any other PRL-MAP subprograms.'/
     * ' Failure to initialize the library will cause erroneous'/
     * ' program operation.'/
     * ' '/
     * ' MAP_INIT was called before printing this message.'/)
C
C     ******************************************************************
C
C                       Terminate program execution
C                       Wait until user presses a key before exiting
C
      WRITE (*,810)
  810 FORMAT (/
     * '              MAP Demo Program #1 Execution Completed'/
     * '                      Press <CR> to exit demo')
      READ (*,811) STRING
  811 FORMAT (A)
C                       Exit demo
      CALL PROCESS_EXIT
      END
STOP_CAT
echo "  Generating =====> [ ./mapdata1.f ]"
cat <<"STOP_CAT"> ././mapdata1.f
C     PROGRAM MAPDATA1
C
C       Programmer's Reusable Library, Version 0.7      (TM)
C
C            Copyright (C) 1995 Object Access (SM)
C
C     Permission is granted to any individual or institution
C     to use, copy, modify, and distribute this single program
C     unit, provided that this complete copyright and
C     permission notice is maintained, intact, in all copies.
C
C     Object Access Incorporated provides this software
C     "as is" without express or implied warranty.
C
C     PURPOSE: Demonstrate and test access program PLOT2D_DEFMAP
C
C     LOCAL VARIABLES:
C
C
C     NOTES:  None
C
C     ******************************************************************
C
      EXTERNAL  REAL_CVSTRING, TERM_GETOUT
      REAL      REAL_CVSTRING
      INTEGER   TERM_GETOUT
C
      PARAMETER (NBUFF = 40)
      PARAMETER (NDAT  = 16)
C
      CHARACTER*40  BUFF
      CHARACTER*4   DNAM(NDAT)
      INTEGER       KDAT(NDAT)
C
C                       Library version numbers (actual & required)
      CHARACTER*8  VERAQ,VERRQ
C
C                       Program required PRL version
      DATA VERRQ /'0.7     '/
      DATA DNAM  /'HICO','ASIA','EUAF','NORT','SOUT','RASI','REUA',
     *            'RNOR','RSOU','POLI','PASI','PEUA','PNS ','IASI',
     *            'IEUA','INS '/
C
C     ******************************************************************
C
C                       INITIALIZE LIBRARIES
C
C                       Initialize the map package
      CALL MAP_INIT (0)
C
C     ******************************************************************
C
C                       Check PRL version
C
C                       Get actual PRL version being used
      CALL PRL_LIBVER (VERAQ,VERRQ)
C
C     ******************************************************************
C
C                       INITIALIZE OUTPUT DEVICE
C
C                       Allow user to choose a device interactively
      KTYPE = 0
      CALL DEVICE_PROMPT (KTYPE,XPAGE,YPAGE)
C
C     ******************************************************************
C
C                       READ THE MAP COORDINATE RANGE
C
C                       Write prompt
  100 CALL TERM_WRITE
     *     (' Enter min , max longitude in degrees; q to quit:',0)
C
C                       Read response
      CALL TERM_READ (BUFF,NBUFF)
C                       Convert to real
      XMIN  = REAL_CVSTRING (BUFF,1,ISTAT)
      XMAX  = REAL_CVSTRING (BUFF,2,JSTAT)
C
C                       Check for exit
      IF (ISTAT .LT. 0 .OR. JSTAT .LT. 0) THEN
        GOTO 800
      ENDIF
C
C                       Write prompt
      CALL TERM_WRITE (' Enter min , max latitude in degrees:',0)
C
C                       Read response
      CALL TERM_READ (BUFF,NBUFF)
C                       Convert to real
      YMIN  = REAL_CVSTRING (BUFF,1,ISTAT)
      YMAX  = REAL_CVSTRING (BUFF,2,JSTAT)
C
C                       Check for exit
      IF (ISTAT .LT. 0 .OR. JSTAT .LT. 0) THEN
        GOTO 800
      ENDIF
C
C     ------------------------------------------------------------------
C
C                       READ THE HI-RES DATA CHOICES
C
C                       Clear the choice array
      DO 201 IDAT=1,NDAT
        KDAT(IDAT) = 0
  201 CONTINUE
C
      IOUT = TERM_GETOUT ()
C                       Write prompt
      WRITE (IOUT,205)
  205 FORMAT (' Select one or more:'/
     *        ' Hi-res coastlines, islands, and lakes of'/
     *        '    1 World   2 Asia   3 Europe and Africa'/
     *        '    4 North America    5 South America'//
     *        ' Rivers of'/
     *        '    6 Asia             7 Europe and Africa'/
     *        '    8 North America    9 South America'//
     *        ' Political boundaries of'/
     *        '   10 World  11 Asia  12 Europe and Africa'/
     *        '   13 North and South America'//
     *        ' Internal boundaries of'/
     *        '   14 Asia            15 Europe and Africa'/
     *        '   16 North and South America')
C
C                       Read response
      CALL TERM_READ (BUFF,NBUFF)
C
C                       Convert to integer
      DO 211 IDAT=1,NDAT
        IVAL = INT_CVSTRING (BUFF,IDAT,ISTAT)
        IF (IVAL .GT. 0 .AND. IVAL .LE. NDAT) THEN
          KDAT(IVAL) = 1
        ENDIF
  211 CONTINUE
C
C     ******************************************************************
C
C                       DEFINE PAGE SIZE
C
C                       Define page size in inches
      CALL PAGE_SIZE (XPAGE,YPAGE)
C
C     ******************************************************************
C
C                       DEFINE SUBPLOT AREA FOR LABELS
C
C                       Compute location of physical origin in inches
      XRL = 0.10*XPAGE
      YRL = 0.25*YPAGE
C
C                       Compute length of X and Y axis in inches
      XPG = XPAGE - 2.0*XRL
      YPG = YPAGE - 2.0*YRL
C                       Define location of physical origin relative
C                       to lower left corner of page
      CALL ORIGIN_SET (XRL,YRL)
C                       Specify 'cylindrical equidistant' map projection
      CALL PROJ_SETMAP ('CYLINDRICAL')
C                       Define subplot area in terms of length
C                       of X and Y axis in inches and draw border
C                       around outer edge of plot
      CALL SUBPLOT_DEFINE (XPG,YPG)
C
C     ******************************************************************
C
C                       DRAW HEADING OVER SUBPLOT AREA
C
C                       Compute text height based on page height
      SIZE = 0.25*YPAGE/11.0
C                       Set current text height in inches
      CALL TEXT2D_SETHT (SIZE)
C                       Set character style to 'triplx'
      CALL FONT_TRIPLX
C                       Draw heading over plot
      CALL HEADING_DRAW
     *     ('Cylindrical Equidistant Projection$',100,1.2,1)
C
C     ------------------------------------------------------------------
C
C                       DRAW TITLE UNDER SUBPLOT AREA
C
C                       Set character style to cartog
      CALL FONT_CARTOG
C                       Determine length of text string in inches
      XX = TEXT2D_GETLEN
     *     ('MAPDATA1 Demo: World Map Hi-Res Data$',100)
C                       Compute X coord of start of string in inches
      XX = 0.50*(XPG-XX)
C                       Plot text string
      CALL TEXT2D_PDRAW
     *     ('MAPDATA1 Demo: World Map Hi-Res Data$',
     *     100,XX,-YPG*0.25)
C
C     ******************************************************************
C
C                       END THE SUBPLOT
C
      CALL SUBPLOT_END (0)
C
C     ******************************************************************
C
C                       DEFINE SUBPLOT AREA FOR MAP
C
C                       Set current text height in inches
      CALL TEXT2D_SETHT (SIZE*0.75)
C
C                       Define world map subplot area in terms of
C                       length of X and Y axis in inches and draw
C                       border around outer edge of plot
      CALL SUBPLOT_DEFMAP (XPG,YPG)
C
C     ******************************************************************
C
C                       DEFINE PLOT HEADING AND LABELS
C
C                       Set character style to 'duplex'
      CALL FONT_DUPLEX
C                       Set X axis label
      CALL AXISLBL_DEFX2 ('LONGITUDE$',100)
C                       Set Y axis label
      CALL AXISLBL_DEFY2 ('LATITUDE$',100)
C
C     ******************************************************************
C
C                       DRAW THE PLOT
C
C                       Define 2D coordinate system
      XSTEP = (XMAX-XMIN)*0.2
      YSTEP = (YMAX-YMIN)*0.2
      CALL PLOT2D_DEFMAP (XMIN, XSTEP, XMAX, YMIN, YSTEP, YMAX)
C
C                       Set frame thickness in inches
      CALL FRAME_THICK (0.01)
C                       Draw frame around subplot area
      CALL FRAME_DRAW
C                       Draw chosen high resolution map data
      DO 251 IDAT=1,NDAT
C                       Internal boundaries in magenta
        IF (IDAT .GE. 14) THEN
          CALL COLOR_SETNAM ('MAGE')
C                       Political boundaries boundaries in red
        ELSE IF (IDAT .GE. 10) THEN
          CALL COLOR_SETNAM ('RED')
C                       Rivers boundaries in blue
        ELSE IF (IDAT .GE. 6) THEN
          CALL COLOR_SETNAM ('BLUE')
C                       Coastlines in green
        ELSE
          CALL COLOR_SETNAM ('GREE')
        ENDIF
        IF (KDAT(IDAT) .EQ. 1) THEN
          CALL MAPDATA_DRAW (DNAM(IDAT))
        ENDIF
  251 CONTINUE
C
C     ******************************************************************
C
C                       END THE SUBPLOT
C
      CALL  SUBPLOT_ENDMAP
C
C     ******************************************************************
C
C                       END THE PLOT
C
C                       End current plot and advance paper
      CALL PAGE_END (0)
C
      GOTO 100
C
C     ******************************************************************
C
C                       CLOSE THE OUTPUT DEVICE
C
C                       Finish plotting and release device
  800 CALL DEVICE_END
C                       Exit
      CALL PROCESS_EXIT
      END
STOP_CAT
echo "  Generating =====> [ ./origin1.f ]"
cat <<"STOP_CAT"> ././origin1.f
C     PROGRAM ORIGIN2
C
C       Programmer's Reusable Library, Version 0.7      (TM)
C
C            Copyright (C) 1995 Object Access (SM)
C
C     Permission is granted to any individual or institution
C     to use, copy, modify, and distribute this single program
C     unit, provided that this complete copyright and
C     permission notice is maintained, intact, in all copies.
C
C     Object Access Incorporated provides this software
C     "as is" without express or implied warranty.
C
C     PURPOSE: Demonstrate and test access program ORIGIN_SET
C
C     LOCAL VARIABLES:
C
C
C     NOTES:  None
C
C     ******************************************************************
C
C                       External subprogram declarations
C
C     INTRINSIC
C
C                       ORIGIN object access program
      EXTERNAL ORIGIN_SET
C
C                       DEVICE object access programs
      EXTERNAL DEVICE_SELECT, DEVICE_RELEASE
C
C                       GRAPHICS object access programs
      EXTERNAL GRAPHICS_INIT
C
C                       PRL object access programs
      EXTERNAL PRL_LIBVER
C
C                       REAL object access programs
      EXTERNAL REAL_IDIF0, REAL_SETTOL
      LOGICAL  REAL_IDIF0
C
C                       DBL object access programs
      EXTERNAL DBL_IDIF0, DBL_SETTOL
      LOGICAL  DBL_IDIF0
C
C                       CMPLX object access programs
      EXTERNAL CMPLX_IDIF0
      LOGICAL  CMPLX_IDIF0
C
C                       TERM object access programs
      EXTERNAL TERM_GETIN, TERM_GETOUT, TERM_GETERR, TERM_SETSIO
      INTEGER  TERM_GETIN, TERM_GETOUT, TERM_GETERR
C
C                       PROCESS object access programs
      EXTERNAL PROCESS_EXIT
C
C                       FILE object access programs
      EXTERNAL PXFCLS, PXFOPN
C
C                       PCONS object access programs
      EXTERNAL IPXCON
      INTEGER  IPXCON
C
C     ------------------------------------------------------------------
C
C                       Test program parameter values
C
C                       Standard input logical unit for the system
      PARAMETER (LUNSI=5)
C                       Standard output logical unit for the system
      PARAMETER (LUNSO=6)
C                       Standard error logical unit for the system
      PARAMETER (LUNSE=6)
C
C                       REAL subtraction tolerance
      PARAMETER (TOLER=0.00001)
C                       DBL subtraction tolerance
      DOUBLE PRECISION DTOLER
      PARAMETER (DTOLER=1.0D-13)
C
C                       Number of input variable test values
      PARAMETER (NVV104 =  2)
      PARAMETER (NVV105 =  2)
C
C                       Argument maximum array sizes
C
C     ------------------------------------------------------------------
C
C                       Access program variables
C
C                       Private variables and arrays
      INCLUDE 'ORIGIN.INC'
C
C                       Integer variables and arrays
      INTEGER TMP101
C
C                       Real variables and arrays
      REAL    TMP102, TMP103, XOABS, TMP104, YOABS, TMP105
C
C                       Double precision variables and arrays
C
C                       Complex variables and arrays
C
C                       Logical variables and arrays
C
C                       Character variables and arrays
C
C     ------------------------------------------------------------------
C
C                       Test program variables
C
      CHARACTER*1 PAUS
C                       Program logical unit numbers
      INTEGER     IN, IOUT, IER, IFILE, IO
C
C                       Name of results file for the access program
      CHARACTER*(40) FILNAM
C
C                       Library version numbers (actual & required)
      CHARACTER*8  VERAQ,VERRQ
C
C                       Input variable test value arrays
      REAL    VV104(NVV104)
      REAL    VV105(NVV105)
C
C                       Program required PRL version
      DATA VERRQ /'0.7     '/
C
C                       Input variable test values
      DATA VV104 /-3333.33, 9999.99/
C
      DATA VV105 /-3333.33, 9999.99/
C
C     ******************************************************************
C
C                       Initialize library
C
      CALL GRAPHICS_INIT (0)
C
C     ******************************************************************
C
C                       Check PRL version
C
C                       Get actual PRL version being used
      CALL PRL_LIBVER (VERAQ,VERRQ)
C
C     ******************************************************************
C
C                       Set machine-specific constants
C
      CALL TERM_SETSIO (LUNSI,LUNSO,LUNSE)
C
C                       Logical unit number (LUN) of standard in
      IN = TERM_GETIN ()
C                       LUN of standard out
      IOUT = TERM_GETOUT ()
C                       LUN of standard error
      IER = TERM_GETERR ()
C
C                       REAL subtraction tolerance
      CALL REAL_SETTOL (TOLER)
C
C                       DBL subtraction tolerance
      CALL DBL_SETTOL (DTOLER)
C
C     ******************************************************************
C
C                       Print introduction message
C
C                       Set file pathname
      FILNAM = 'origin_set.dat'
C
      WRITE (IOUT,301) FILNAM
  301 FORMAT (
     * '              ORIGIN Object Demo Program #2'/
     * ' This program tests the ORIGIN object access program'/
     * ' ORIGIN_SET.'/
     * ' The input variables are varied through a wide range of valid'/
     * ' combinations.  The results for each combination are compared'/
     * ' to previously-computed results stored on file, and any '/
     * ' differences are displayed.  If no results file is found, the'/
     * ' computed results are saved in a file named'/
     * ' ',A/)
C
C                       Initialize program completion status
      IOK = 0
C
C     ******************************************************************
C
C                       Open test results file
C
C                       Open read-only
      IOPFLG = IPXCON ('O_RDONLY')
C
C                       Assume file exists and open read-only
      CALL PXFOPN (FILNAM,0,IOPFLG,0,IFILE,IRESLT)
C
C                       If file does not exist,
C                       create and open read/write
      IF (IRESLT .NE. 0) THEN
        IF (IRESLT .EQ. IPXCON('ENOENT')) THEN
C                       Open read-write
          IOPFLG = IPXCON ('O_RDWR')
C                       Allow file creation
     *            +IPXCON ('O_CREAT')
C                       Create file and open read/write
          CALL PXFOPN (FILNAM,0,IOPFLG,0,IFILE,IERROR)
C
C                       If error creating and opening file,
C                       print error message and exit
          IF (IERROR .NE. 0) THEN
            WRITE (IER,409) FILNAM
  409       FORMAT (' Error opening results file ',A)
            GOTO 900
          ENDIF
C                       Print message that file is being created
          WRITE (IOUT,411) FILNAM
  411     FORMAT (' Creating file ',A)
          IOK = 1
C
C                       If error opening existing file,
C                       print error message and exit
        ELSE
          WRITE (IER,409) FILNAM
          GOTO 900
        ENDIF
      ENDIF
C
C     ******************************************************************
C
C                       Set up proper environment for access program
C                       under test
C
C                       Select device and advance package to level 1
      KTYPE = 2
      CALL DEVICE_SELECT (KTYPE,XPAGE,YPAGE)
C
C     ******************************************************************
C
C                       Test ORIGIN_SET object access program
C
C                       Loop for each input variable of access program
      DO 589 IVV104 = 1,NVV104
        XOABS = VV104(IVV104)
C
      DO 588 IVV105 = 1,NVV105
        YOABS = VV105(IVV105)
C
C                       Set location of origin relative to lower left
C                       corner of page
      CALL ORIGIN_SET (XOABS,YOABS)
C
C                       Read input and output variable values from file
      IF (IRESLT .EQ. 0) THEN
        READ (IFILE,502,ERR=610) TMP101,TMP102,TMP103,TMP104,TMP105
C
C                       Compare output with previously-computed values
C                       and write to error device if they do not match
        IF (KZOR .NE. TMP101 ) THEN
          IO = IER
          IOK = 1
          GOTO 501
        ELSE IF (.NOT. REAL_IDIF0(UUXOR ,TMP102 )) THEN
          IO = IER
          IOK = 1
          GOTO 501
        ELSE IF (.NOT. REAL_IDIF0(UUYOR ,TMP103 )) THEN
          IO = IER
          IOK = 1
          GOTO 501
        ENDIF
C                       Test combination matches previous results
        GOTO 503
C
C                       Write input and output variable values to file
      ELSE
        IO = IFILE
        GOTO 501
      ENDIF
C                       Write input and output variable values
C                       to file or error device
  501 CONTINUE
      WRITE (IO,502,ERR=612) KZOR,UUXOR,UUYOR,XOABS,YOABS
  502 FORMAT (I21,E15.7,E15.7,E15.7,E15.7)
  503 CONTINUE
C
C                       Repeat for next variable value
  588 CONTINUE
  589 CONTINUE
C
C     ******************************************************************
C
C                       Clean up environment
C
C                       Release device
      CALL DEVICE_RELEASE ()
C
C     ******************************************************************
C
C                       Print program status message
C
      IF (IOK .EQ. 0) THEN
        WRITE (IOUT,601)
  601   FORMAT (' Program results identical to file values')
      ENDIF
      GOTO 700
C
  610 WRITE (IER,611) FILNAM
  611 FORMAT (' Error reading file ',A)
      GOTO 700
C
  612 WRITE (IER,613) FILNAM
  613 FORMAT (' Error writing file ',A)
C
C     ******************************************************************
C
C                       Close test results file
C
C                       Close file
  700 CALL PXFCLS (IFILDS,IERROR)
C
C     ******************************************************************
C
C                       Print demo termination message
C
C                       Wait until user presses a key before exiting
      WRITE (IOUT,810)
  810 FORMAT (/
     * '              ORIGIN Demo Program #2 Execution Completed'/
     * '                      Press <CR> to exit demo')
      READ (IN,811) PAUS
  811 FORMAT (A)
C
C     ******************************************************************
C
C                       Terminate program execution
C
  900 CALL PROCESS_EXIT
      END
STOP_CAT
echo "  Generating =====> [ ./origin_set.dat ]"
cat <<"STOP_CAT"> ././origin_set.uuu
begin 660 ./origin_set.dat
M("`@("`@("`@("`@("`@("`@,3$Q("`M+C@T-C8V-3A%*S`T("`M+C@T-C8V
M-3A%*S`T("`M+C,S,S,S,S!%*S`T("`M+C,S,S,S,S!%*S`T"B`@("`@("`@
M("`@("`@("`@(#$Q,2`@+2XX-#8V-C4X12LP-"`@("XR-3,Y.3DW12LP-2`@
M+2XS,S,S,S,P12LP-"`@("XY.3DY.3DP12LP-`H@("`@("`@("`@("`@("`@
M("`Q,3$@("`N,C4S.3DY-T4K,#4@("TN.#0V-C8U.$4K,#0@("`N.3DY.3DY
M,$4K,#0@("TN,S,S,S,S,$4K,#0*("`@("`@("`@("`@("`@("`@,3$Q("`@
M+C(U,SDY.3=%*S`U("`@+C(U,SDY.3=%*S`U("`@+CDY.3DY.3!%*S`T("`@
-+CDY.3DY.3!%*S`T"B`@
`
end
STOP_CAT
echo "  Generating =====> [ ./page1.f ]"
cat <<"STOP_CAT"> ././page1.f
C     PROGRAM PAGE1
C
C       Programmer's Reusable Library, Version 0.7      (TM)
C
C            Copyright (C) 1995 Object Access (SM)
C
C     Permission is granted to any individual or institution
C     to use, copy, modify, and distribute this single program
C     unit, provided that this complete copyright and
C     permission notice is maintained, intact, in all copies.
C
C     Object Access Incorporated provides this software
C     "as is" without express or implied warranty.
C
C     PURPOSE: Demonstrate and test access program PAGE_END
C
C     LOCAL VARIABLES:
C
C
C     NOTES:  None
C
C     ******************************************************************
C
C                       External subprogram declarations
C
C     INTRINSIC
C
C                       PAGE object access program
      EXTERNAL PAGE_END
C
C                       GRAPHICS object access programs
      EXTERNAL GRAPHICS_INIT
C
C                       Environment object access programs
      EXTERNAL DEVICE_PROMPT, DEVICE_RELEASE
      EXTERNAL PAGE_SIZE, ORIGIN_SET, SUBPLOT_DEFINE, SUBPLOT_END
C
C                       PRL object access programs
      EXTERNAL PRL_LIBVER
C
C                       TERM object access programs
      EXTERNAL TERM_GETIN, TERM_GETOUT, TERM_GETERR, TERM_SETSIO
      INTEGER  TERM_GETIN, TERM_GETOUT, TERM_GETERR
C
C                       PROCESS object access programs
      EXTERNAL PROCESS_EXIT
C
C     ------------------------------------------------------------------
C
C                       Test program parameter values
C
C                       Standard input logical unit for the system
      PARAMETER (LUNSI=5)
C                       Standard output logical unit for the system
      PARAMETER (LUNSO=6)
C                       Standard error logical unit for the system
      PARAMETER (LUNSE=6)
C
C                       Number of input variable test values
      PARAMETER (NVV101 =  1)
C
C     ------------------------------------------------------------------
C
C                       Access program variables
C
C                       Integer variables and arrays
      INTEGER ISPARE
C
C     ------------------------------------------------------------------
C
C                       Test program variables
C
      CHARACTER*1 PAUS
C                       Program logical unit numbers
      INTEGER     IN, IOUT, IER
C
      DOUBLE PRECISION  DTOLER
C
C                       Library version numbers (actual & required)
      CHARACTER*8  VERAQ,VERRQ
C
      DATA TOLER /1.0E-5/
      DATA DTOLER /1.0D-13/
C                       Program required PRL version
      DATA VERRQ /'0.7     '/
C
C     ******************************************************************
C
C                       Initialize library
C
      CALL GRAPHICS_INIT (0)
C
C     ******************************************************************
C
C                       Check PRL version
C
C                       Get actual PRL version being used
      CALL PRL_LIBVER (VERAQ,VERRQ)
C
C     ******************************************************************
C
C                       Set machine-specific constants
C
      CALL TERM_SETSIO (LUNSI,LUNSO,LUNSE)
C
C                       Logical unit number (LUN) of standard in
      IN = TERM_GETIN ()
C                       LUN of standard out
      IOUT = TERM_GETOUT ()
C                       LUN of standard error
      IER = TERM_GETERR ()
C
C                       REAL subtraction tolerance
      CALL REAL_SETTOL (TOLER)
C
C                       DBL subtraction tolerance
      CALL DBL_SETTOL (DTOLER)
C
C     ******************************************************************
C
C                       Print introduction message
C
      WRITE (IOUT,301)
  301 FORMAT (
     * '              PAGE Object Demo Program #1'/
     * ' This program tests the PAGE object access program'/
     * ' PAGE_END.'/
     * ' This demo first queries for a graphics device to initialize.'/
     * ' It then uses PAGE_END to clear the screen or otherwise'/
     * ' obtain a new drawing surface.  There is no input to'/
     * ' PAGE_END.'//
     * ' Note: selecting a Tektronix terminal driver may result in'/
     * ' "garbage" characters being written to the screen if you have'/
     * ' a non-Tektronix terminal.'//
     * '                      Press <CR> to continue')
      READ (IN,811) PAUS
C
C                       Initialize program completion status
      IOK = 0
C
C     ******************************************************************
C
C                       Test PAGE_END object access program
C
C                       Loop for each input variable of access program
      DO 589 IVV101 = 1,NVV101
        ISPARE = 0
C
C     ------------------------------------------------------------------
C
C                       Set up proper environment for access program
C                       under test
C
C                       Select device and advance package to level 1
      KTYPE = 0
      CALL DEVICE_PROMPT (KTYPE,XPAGE,YPAGE)
      CALL PAGE_SIZE (XPAGE,YPAGE)
      CALL ORIGIN_SET (0.0,0.0)
      CALL SUBPLOT_DEFINE (XPAGE,YPAGE)
      CALL SUBPLOT_END(0)
C
C     ------------------------------------------------------------------
C
C                       End plotting on current page
      CALL PAGE_END (ISPARE)
C
C                       Release device
      CALL DEVICE_RELEASE ()
C
C                       Repeat for next variable value
  589 CONTINUE
C
C     ******************************************************************
C
C                       Print demo termination message
C
C                       Wait until user presses a key before exiting
      WRITE (IOUT,810)
  810 FORMAT (/
     * '              PAGE Demo Program #1 Execution Completed'/
     * '                      Press <CR> to exit demo')
      READ (IN,811) PAUS
  811 FORMAT (A)
C
C     ******************************************************************
C
C                       Terminate program execution
C
      CALL PROCESS_EXIT
      END
STOP_CAT
echo "  Generating =====> [ ./page2.f ]"
cat <<"STOP_CAT"> ././page2.f
C     PROGRAM PAGE4
C
C       Programmer's Reusable Library, Version 0.7      (TM)
C
C            Copyright (C) 1995 Object Access (SM)
C
C     Permission is granted to any individual or institution
C     to use, copy, modify, and distribute this single program
C     unit, provided that this complete copyright and
C     permission notice is maintained, intact, in all copies.
C
C     Object Access Incorporated provides this software
C     "as is" without express or implied warranty.
C
C     PURPOSE: Demonstrate and test access program PAGE_SIZE
C
C     LOCAL VARIABLES:
C
C
C     NOTES:  None
C
C     ******************************************************************
C
C                       External subprogram declarations
C
C     INTRINSIC
C
C                       PAGE object access program
      EXTERNAL PAGE_SIZE
C
C                       GRAPHICS object access programs
      EXTERNAL GRAPHICS_INIT
C
C                       Environment object access programs
      EXTERNAL DEVICE_PROMPT, DEVICE_RELEASE
      EXTERNAL PAGE_END, ORIGIN_SET
      EXTERNAL SUBPLOT_DEFINE, SUBPLOT_END
C
C                       PRL object access programs
      EXTERNAL PRL_LIBVER
C
C                       REAL object access programs
      EXTERNAL REAL_IDIF0, REAL_SETTOL
      LOGICAL  REAL_IDIF0
C
C                       DBL object access programs
      EXTERNAL DBL_IDIF0, DBL_SETTOL
      LOGICAL  DBL_IDIF0
C
C                       CMPLX object access programs
      EXTERNAL CMPLX_IDIF0
      LOGICAL  CMPLX_IDIF0
C
C                       TERM object access programs
      EXTERNAL TERM_GETIN, TERM_GETOUT, TERM_GETERR, TERM_SETSIO
      INTEGER  TERM_GETIN, TERM_GETOUT, TERM_GETERR
C
C                       PROCESS object access programs
      EXTERNAL PROCESS_EXIT
C
C                       FILE object access programs
      EXTERNAL PXFCLS, PXFOPN
C
C                       PCONS object access programs
      EXTERNAL IPXCON
      INTEGER  IPXCON
C
C     ------------------------------------------------------------------
C
C                       Test program parameter values
C
C                       Standard input logical unit for the system
      PARAMETER (LUNSI=5)
C                       Standard output logical unit for the system
      PARAMETER (LUNSO=6)
C                       Standard error logical unit for the system
      PARAMETER (LUNSE=6)
C
C                       REAL subtraction tolerance
      PARAMETER (TOLER=0.00001)
C                       DBL subtraction tolerance
      DOUBLE PRECISION DTOLER
      PARAMETER (DTOLER=1.0D-13)
C
C                       Number of input variable test values
      PARAMETER (NVV101 =  3)
      PARAMETER (NVV105 =  3)
      PARAMETER (NVV106 =  3)
C
C                       Argument maximum array sizes
C
C     ------------------------------------------------------------------
C
C                       Access program variables
C
C                       Private variables and arrays
      INCLUDE 'PAGE.INC'
C
C                       Integer variables and arrays
      INTEGER TMP102
C
C                       Real variables and arrays
      REAL    TMP101, TMP103, TMP104, PAGEX, TMP105, PAGEY, TMP106
C
C                       Double precision variables and arrays
C
C                       Complex variables and arrays
C
C                       Logical variables and arrays
C
C                       Character variables and arrays
C
C     ------------------------------------------------------------------
C
C                       Test program variables
C
      CHARACTER*1 PAUS
C                       Program logical unit numbers
      INTEGER     IN, IOUT, IER, IFILE, IO
C
C                       Name of results file for the access program
      CHARACTER*(40) FILNAM
C
C                       Library version numbers (actual & required)
      CHARACTER*8  VERAQ,VERRQ
C
C                       Input variable test value arrays
      REAL    VV101(NVV101)
      REAL    VV105(NVV105)
      REAL    VV106(NVV106)
C
C                       Program required PRL version
      DATA VERRQ /'0.7     '/
C
C                       Input variable test values
      DATA VV101 /2.54, 0.1, 1.0/
C
      DATA VV105 /.000001, 9999.99, 8.5/
C
      DATA VV106 /.000001, 9999.99, 11.0/
C
C     ******************************************************************
C
C                       Initialize library
C
      CALL GRAPHICS_INIT (0)
C
C     ******************************************************************
C
C                       Check PRL version
C
C                       Get actual PRL version being used
      CALL PRL_LIBVER (VERAQ,VERRQ)
C
C     ******************************************************************
C
C                       Set machine-specific constants
C
      CALL TERM_SETSIO (LUNSI,LUNSO,LUNSE)
C
C                       Logical unit number (LUN) of standard in
      IN = TERM_GETIN ()
C                       LUN of standard out
      IOUT = TERM_GETOUT ()
C                       LUN of standard error
      IER = TERM_GETERR ()
C
C                       REAL subtraction tolerance
      CALL REAL_SETTOL (TOLER)
C
C                       DBL subtraction tolerance
      CALL DBL_SETTOL (DTOLER)
C
C     ******************************************************************
C
C                       Print introduction message
C
C                       Set file pathname
      FILNAM = 'page_size.dat'
C
      WRITE (IOUT,301) FILNAM
  301 FORMAT (
     * '              PAGE Object Demo Program #4'/
     * ' This program tests the PAGE object access program'/
     * ' PAGE_SIZE.'/
     * ' The input variables are varied through a wide range of valid'/
     * ' combinations.  The results for each combination are compared'/
     * ' to previously-computed results stored on file, and any '/
     * ' differences are displayed.  If no results file is found, the'/
     * ' computed results are saved in a file named'/
     * ' ',A/)
C
C                       Initialize program completion status
      IOK = 0
C
C     ******************************************************************
C
C                       Open test results file
C
C                       Open read-only
      IOPFLG = IPXCON ('O_RDONLY')
C
C                       Assume file exists and open read-only
      CALL PXFOPN (FILNAM,0,IOPFLG,0,IFILE,IRESLT)
C
C                       If file does not exist,
C                       create and open read/write
      IF (IRESLT .NE. 0) THEN
        IF (IRESLT .EQ. IPXCON('ENOENT')) THEN
C                       Open read-write
          IOPFLG = IPXCON ('O_RDWR')
C                       Allow file creation
     *            +IPXCON ('O_CREAT')
C                       Create file and open read/write
          CALL PXFOPN (FILNAM,0,IOPFLG,0,IFILE,IERROR)
C
C                       If error creating and opening file,
C                       print error message and exit
          IF (IERROR .NE. 0) THEN
            WRITE (IER,409) FILNAM
  409       FORMAT (' Error opening results file ',A)
            GOTO 900
          ENDIF
C                       Print message that file is being created
          WRITE (IOUT,411) FILNAM
  411     FORMAT (' Creating file ',A)
          IOK = 1
C
C                       If error opening existing file,
C                       print error message and exit
        ELSE
          WRITE (IER,409) FILNAM
          GOTO 900
        ENDIF
      ENDIF
C
C     ******************************************************************
C
C                       Set up proper environment for access program
C                       under test
C
C                       Select device and advance package to level 1
      KTYPE = 0
      CALL DEVICE_PROMPT (KTYPE,XPAGE,YPAGE)
C
C     ******************************************************************
C
C                       Test PAGE_SIZE object access program
C
C                       Loop for each input variable of access program
      DO 589 IVV101 = 1,NVV101
        ZZUNIT = VV101(IVV101)
C
      DO 588 IVV105 = 1,NVV105
        PAGEX = VV105(IVV105)
C
      DO 587 IVV106 = 1,NVV106
        PAGEY = VV106(IVV106)
C
C                       Set page size for plot
      CALL PAGE_SIZE (PAGEX,PAGEY)
C
      CALL ORIGIN_SET (0.0,0.0)
      CALL SUBPLOT_DEFINE (PAGEX,PAGEY)
C
C                       Read input and output variable values from file
      IF (IRESLT .EQ. 0) THEN
        READ (IFILE,502,ERR=610) TMP101,TMP102,TMP103,TMP104,TMP105,
     *       TMP106
C
C                       Compare output with previously-computed values
C                       and write to error device if they do not match
        IF (KZPAGE .NE. TMP102 ) THEN
          IO = IER
          IOK = 1
          GOTO 501
        ELSE IF (.NOT. REAL_IDIF0(UUPAGX ,TMP103 )) THEN
          IO = IER
          IOK = 1
          GOTO 501
        ELSE IF (.NOT. REAL_IDIF0(UUPAGY ,TMP104 )) THEN
          IO = IER
          IOK = 1
          GOTO 501
        ENDIF
C                       Test combination matches previous results
        GOTO 503
C
C                       Write input and output variable values to file
      ELSE
        IO = IFILE
        GOTO 501
      ENDIF
C                       Write input and output variable values
C                       to file or error device
  501 CONTINUE
      WRITE (IO,502,ERR=612) ZZUNIT,KZPAGE,UUPAGX,UUPAGY,PAGEX,PAGEY
  502 FORMAT (E15.7,I21,E15.7,E15.7,E15.7,E15.7)
  503 CONTINUE
C
      CALL SUBPLOT_END(0)
      CALL PAGE_END (ISPARE)
C
C                       Repeat for next variable value
  587 CONTINUE
  588 CONTINUE
  589 CONTINUE
C
C     ******************************************************************
C
C                       Clean up environment
C
C                       Release device
      CALL DEVICE_RELEASE ()
C
C     ******************************************************************
C
C                       Print program status message
C
      IF (IOK .EQ. 0) THEN
        WRITE (IOUT,601)
  601   FORMAT (' Program results identical to file values')
      ENDIF
      GOTO 700
C
  610 WRITE (IER,611) FILNAM
  611 FORMAT (' Error reading file ',A)
      GOTO 700
C
  612 WRITE (IER,613) FILNAM
  613 FORMAT (' Error writing file ',A)
C
C     ******************************************************************
C
C                       Close test results file
C
C                       Close file
  700 CALL PXFCLS (IFILDS,IERROR)
C
C     ******************************************************************
C
C                       Print demo termination message
C
C                       Wait until user presses a key before exiting
      WRITE (IOUT,810)
  810 FORMAT (/
     * '              PAGE Demo Program #4 Execution Completed'/
     * '                      Press <CR> to exit demo')
      READ (IN,811) PAUS
  811 FORMAT (A)
C
C     ******************************************************************
C
C                       Terminate program execution
C
  900 CALL PROCESS_EXIT
      END
STOP_CAT
echo "  Generating =====> [ ./page_size.dat ]"
cat <<"STOP_CAT"> ././page_size.uuu
begin 660 ./page_size.dat
M("`@+C(U-#`P,#!%*S`Q("`@("`@("`@("`@("`@("`@,3$Q("`@+C(U-#`P
M,#!%+3`U("`@+C(U-#`P,#!%+3`U("`@+C$P,#`P,#!%+3`U("`@+C$P,#`P
M,#!%+3`U"B`@("XR-30P,#`P12LP,2`@("`@("`@("`@("`@("`@(#$Q,2`@
M("XR-30P,#`P12TP-2`@("XR-3,Y.3DW12LP-2`@("XQ,#`P,#`P12TP-2`@
M("XY.3DY.3DP12LP-`H@("`N,C4T,#`P,$4K,#$@("`@("`@("`@("`@("`@
M("`Q,3$@("`N,C4T,#`P,$4M,#4@("`N,C<Y-#`P,$4K,#(@("`N,3`P,#`P
M,$4M,#4@("`N,3$P,#`P,$4K,#(*("`@+C(U-#`P,#!%*S`Q("`@("`@("`@
M("`@("`@("`@,3$Q("`@+C(U,SDY.3=%*S`U("`@+C(U-#`P,#!%+3`U("`@
M+CDY.3DY.3!%*S`T("`@+C$P,#`P,#!%+3`U"B`@("XR-30P,#`P12LP,2`@
M("`@("`@("`@("`@("`@(#$Q,2`@("XR-3,Y.3DW12LP-2`@("XR-3,Y.3DW
M12LP-2`@("XY.3DY.3DP12LP-"`@("XY.3DY.3DP12LP-`H@("`N,C4T,#`P
M,$4K,#$@("`@("`@("`@("`@("`@("`Q,3$@("`N,C4S.3DY-T4K,#4@("`N
M,C<Y-#`P,$4K,#(@("`N.3DY.3DY,$4K,#0@("`N,3$P,#`P,$4K,#(*("`@
M+C(U-#`P,#!%*S`Q("`@("`@("`@("`@("`@("`@,3$Q("`@+C(Q-3DP,#!%
M*S`R("`@+C(U-#`P,#!%+3`U("`@+C@U,#`P,#!%*S`Q("`@+C$P,#`P,#!%
M+3`U"B`@("XR-30P,#`P12LP,2`@("`@("`@("`@("`@("`@(#$Q,2`@("XR
M,34Y,#`P12LP,B`@("XR-3,Y.3DW12LP-2`@("XX-3`P,#`P12LP,2`@("XY
M.3DY.3DP12LP-`H@("`N,C4T,#`P,$4K,#$@("`@("`@("`@("`@("`@("`Q
M,3$@("`N,C$U.3`P,$4K,#(@("`N,C<Y-#`P,$4K,#(@("`N.#4P,#`P,$4K
M,#$@("`N,3$P,#`P,$4K,#(*("`@+C$P,#`P,#!%*S`P("`@("`@("`@("`@
M("`@("`@,3$Q("`@+C$P,#`P,#!%+3`V("`@+C$P,#`P,#!%+3`V("`@+C$P
M,#`P,#!%+3`U("`@+C$P,#`P,#!%+3`U"B`@("XR-30P,#`P12LP,2`@("`@
M("`@("`@("`@("`@(#$Q,2`@("XR-30P,#`P12TP-2`@("XR-3,Y.3DW12LP
M-2`@("XQ,#`P,#`P12TP-2`@("XY.3DY.3DP12LP-`H@("`N,C4T,#`P,$4K
M,#$@("`@("`@("`@("`@("`@("`Q,3$@("`N,C4T,#`P,$4M,#4@("`N,C<Y
M-#`P,$4K,#(@("`N,3`P,#`P,$4M,#4@("`N,3$P,#`P,$4K,#(*("`@+C(U
M-#`P,#!%*S`Q("`@("`@("`@("`@("`@("`@,3$Q("`@+C(U,SDY.3=%*S`U
M("`@+C(U-#`P,#!%+3`U("`@+CDY.3DY.3!%*S`T("`@+C$P,#`P,#!%+3`U
M"B`@("XR-30P,#`P12LP,2`@("`@("`@("`@("`@("`@(#$Q,2`@("XR-3,Y
M.3DW12LP-2`@("XR-3,Y.3DW12LP-2`@("XY.3DY.3DP12LP-"`@("XY.3DY
M.3DP12LP-`H@("`N,C4T,#`P,$4K,#$@("`@("`@("`@("`@("`@("`Q,3$@
M("`N,C4S.3DY-T4K,#4@("`N,C<Y-#`P,$4K,#(@("`N.3DY.3DY,$4K,#0@
M("`N,3$P,#`P,$4K,#(*("`@+C(U-#`P,#!%*S`Q("`@("`@("`@("`@("`@
M("`@,3$Q("`@+C(Q-3DP,#!%*S`R("`@+C(U-#`P,#!%+3`U("`@+C@U,#`P
M,#!%*S`Q("`@+C$P,#`P,#!%+3`U"B`@("XR-30P,#`P12LP,2`@("`@("`@
M("`@("`@("`@(#$Q,2`@("XR,34Y,#`P12LP,B`@("XR-3,Y.3DW12LP-2`@
M("XX-3`P,#`P12LP,2`@("XY.3DY.3DP12LP-`H@("`N,C4T,#`P,$4K,#$@
M("`@("`@("`@("`@("`@("`Q,3$@("`N,C$U.3`P,$4K,#(@("`N,C<Y-#`P
M,$4K,#(@("`N.#4P,#`P,$4K,#$@("`N,3$P,#`P,$4K,#(*("`@+C$P,#`P
M,#!%*S`Q("`@("`@("`@("`@("`@("`@,3$Q("`@+C$P,#`P,#!%+3`U("`@
M+C$P,#`P,#!%+3`U("`@+C$P,#`P,#!%+3`U("`@+C$P,#`P,#!%+3`U"B`@
M("XR-30P,#`P12LP,2`@("`@("`@("`@("`@("`@(#$Q,2`@("XR-30P,#`P
M12TP-2`@("XR-3,Y.3DW12LP-2`@("XQ,#`P,#`P12TP-2`@("XY.3DY.3DP
M12LP-`H@("`N,C4T,#`P,$4K,#$@("`@("`@("`@("`@("`@("`Q,3$@("`N
M,C4T,#`P,$4M,#4@("`N,C<Y-#`P,$4K,#(@("`N,3`P,#`P,$4M,#4@("`N
M,3$P,#`P,$4K,#(*("`@+C(U-#`P,#!%*S`Q("`@("`@("`@("`@("`@("`@
M,3$Q("`@+C(U,SDY.3=%*S`U("`@+C(U-#`P,#!%+3`U("`@+CDY.3DY.3!%
M*S`T("`@+C$P,#`P,#!%+3`U"B`@("XR-30P,#`P12LP,2`@("`@("`@("`@
M("`@("`@(#$Q,2`@("XR-3,Y.3DW12LP-2`@("XR-3,Y.3DW12LP-2`@("XY
M.3DY.3DP12LP-"`@("XY.3DY.3DP12LP-`H@("`N,C4T,#`P,$4K,#$@("`@
M("`@("`@("`@("`@("`Q,3$@("`N,C4S.3DY-T4K,#4@("`N,C<Y-#`P,$4K
M,#(@("`N.3DY.3DY,$4K,#0@("`N,3$P,#`P,$4K,#(*("`@+C(U-#`P,#!%
M*S`Q("`@("`@("`@("`@("`@("`@,3$Q("`@+C(Q-3DP,#!%*S`R("`@+C(U
M-#`P,#!%+3`U("`@+C@U,#`P,#!%*S`Q("`@+C$P,#`P,#!%+3`U"B`@("XR
M-30P,#`P12LP,2`@("`@("`@("`@("`@("`@(#$Q,2`@("XR,34Y,#`P12LP
M,B`@("XR-3,Y.3DW12LP-2`@("XX-3`P,#`P12LP,2`@("XY.3DY.3DP12LP
M-`H@("`N,C4T,#`P,$4K,#$@("`@("`@("`@("`@("`@("`Q,3$@("`N,C$U
M.3`P,$4K,#(@("`N,C<Y-#`P,$4K,#(@("`N.#4P,#`P,$4K,#$@("`N,3$P
),#`P,$4K,#(*
`
end
STOP_CAT
echo "  Generating =====> [ ./plot2d1.f ]"
cat <<"STOP_CAT"> ././plot2d1.f
C     PROGRAM PLOT2D1
C
C       Programmer's Reusable Library, Version 0.7      (TM)
C
C            Copyright (C) 1995 Object Access (SM)
C
C     Permission is granted to any individual or institution
C     to use, copy, modify, and distribute this single program
C     unit, provided that this complete copyright and
C     permission notice is maintained, intact, in all copies.
C
C     Object Access Incorporated provides this software
C     "as is" without express or implied warranty.
C
C     PURPOSE: Demonstrate and test access program PLOT2D_DEFMAP
C
C     LOCAL VARIABLES:
C
C
C     NOTES:  None
C
C     ******************************************************************
C
      EXTERNAL  REAL_CVSTRING
      REAL      REAL_CVSTRING
C
      PARAMETER (NBUFF = 40)
C
      CHARACTER*40  BUFF
C
C                       Library version numbers (actual & required)
      CHARACTER*8  VERAQ,VERRQ
C
C                       Program required PRL version
      DATA VERRQ /'0.7     '/
C
C     ******************************************************************
C
C                       INITIALIZE LIBRARIES
C
C                       Initialize the map package
      CALL MAP_INIT (0)
C
C     ******************************************************************
C
C                       Check PRL version
C
C                       Get actual PRL version being used
      CALL PRL_LIBVER (VERAQ,VERRQ)
C
C     ******************************************************************
C
C                       INITIALIZE OUTPUT DEVICE
C
C                       Allow user to choose a device interactively
      KTYPE = 0
      CALL DEVICE_PROMPT (KTYPE,XPAGE,YPAGE)
C
C     ******************************************************************
C
C                       READ THE MAP COORDINATE RANGE
C
C                       Write prompt
  100 CALL TERM_WRITE
     *     (' Enter min , max longitude in degrees; q to quit:',0)
C
C                       Read response
      CALL TERM_READ (BUFF,NBUFF)
C                       Convert to real
      XMIN  = REAL_CVSTRING (BUFF,1,ISTAT)
      XMAX  = REAL_CVSTRING (BUFF,2,JSTAT)
C
C                       Check for exit
      IF (ISTAT .LT. 0 .OR. JSTAT .LT. 0) THEN
        GOTO 800
      ENDIF
C
C                       Write prompt
      CALL TERM_WRITE (' Enter min , max latitude in degrees:',0)
C
C                       Read response
      CALL TERM_READ (BUFF,NBUFF)
C                       Convert to real
      YMIN  = REAL_CVSTRING (BUFF,1,ISTAT)
      YMAX  = REAL_CVSTRING (BUFF,2,JSTAT)
C
C                       Check for exit
      IF (ISTAT .LT. 0 .OR. JSTAT .LT. 0) THEN
        GOTO 800
      ENDIF
C
C     ******************************************************************
C
C                       DEFINE PAGE SIZE
C
C                       Define page size in inches
      CALL PAGE_SIZE (XPAGE,YPAGE)
C
C     ******************************************************************
C
C                       DEFINE SUBPLOT AREA FOR LABELS
C
C                       Compute location of physical origin in inches
      XRL = 0.10*XPAGE
      YRL = 0.25*YPAGE
C
C                       Compute length of X and Y axis in inches
      XPG = XPAGE - 2.0*XRL
      YPG = YPAGE - 2.0*YRL
C                       Define location of physical origin relative
C                       to lower left corner of page
      CALL ORIGIN_SET (XRL,YRL)
C                       Specify 'cylindrical equidistant' map projection
      CALL PROJ_SETMAP ('CYLINDRICAL')
C                       Define subplot area in terms of length
C                       of X and Y axis in inches and draw border
C                       around outer edge of plot
      CALL SUBPLOT_DEFINE (XPG,YPG)
C
C     ******************************************************************
C
C                       DRAW HEADING OVER SUBPLOT AREA
C
C                       Compute text height based on page height
      SIZE = 0.25*YPAGE/11.0
C                       Set current text height in inches
      CALL TEXT2D_SETHT (SIZE)
C                       Set character style to 'triplx'
      CALL FONT_TRIPLX
C                       Draw heading over plot
      CALL HEADING_DRAW
     *     ('Cylindrical Equidistant Projection$',100,1.2,1)
C
C     ------------------------------------------------------------------
C
C                       DRAW TITLE UNDER SUBPLOT AREA
C
C                       Set character style to cartog
      CALL FONT_CARTOG
C                       Determine length of text string in inches
      XX = TEXT2D_GETLEN
     *     ('PLOT2D1 Demo: World Map Coordinate Axes$',100)
C                       Compute X coord of start of string in inches
      XX = 0.50*(XPG-XX)
C                       Plot text string
      CALL TEXT2D_PDRAW
     *     ('PLOT2D1 Demo: World Map Coordinate Axes$',
     *     100,XX,-YPG*0.25)
C
C     ******************************************************************
C
C                       END THE SUBPLOT
C
      CALL SUBPLOT_END (0)
C
C     ******************************************************************
C
C                       DEFINE SUBPLOT AREA FOR MAP
C
C                       Set current text height in inches
      CALL TEXT2D_SETHT (SIZE*0.75)
C
C                       Define world map subplot area in terms of
C                       length of X and Y axis in inches and draw
C                       border around outer edge of plot
      CALL SUBPLOT_DEFMAP (XPG,YPG)
C
C     ******************************************************************
C
C                       DEFINE PLOT HEADING AND LABELS
C
C                       Set character style to 'duplex'
      CALL FONT_DUPLEX
C                       Set X axis label
      CALL AXISLBL_DEFX2 ('LONGITUDE$',100)
C                       Set Y axis label
      CALL AXISLBL_DEFY2 ('LATITUDE$',100)
C
C     ******************************************************************
C
C                       DRAW THE PLOT
C
C                       Define 2D coordinate system
      XSTEP = (XMAX-XMIN)*0.2
      YSTEP = (YMAX-YMIN)*0.2
      CALL PLOT2D_DEFMAP (XMIN, XSTEP, XMAX, YMIN, YSTEP, YMAX)
C
C                       Set frame thickness in inches
      CALL FRAME_THICK (0.01)
C                       Draw frame around subplot area
      CALL FRAME_DRAW
C                       Draw world coastlines, islands, lakes
C                       in high resolution
      CALL MAPDATA_DRAW ('HICOAST')
C
C     ******************************************************************
C
C                       END THE SUBPLOT
C
      CALL  SUBPLOT_ENDMAP
C
C     ******************************************************************
C
C                       END THE PLOT
C
C                       End current plot and advance paper
      CALL PAGE_END (0)
C
      GOTO 100
C
C     ******************************************************************
C
C                       CLOSE THE OUTPUT DEVICE
C
C                       Finish plotting and release device
  800 CALL DEVICE_END
C                       Exit
      CALL PROCESS_EXIT
      END
STOP_CAT
echo "  Generating =====> [ ./prl1.f ]"
cat <<"STOP_CAT"> ././prl1.f
C     PROGRAM PRL1
C
C       Programmer's Reusable Library, Version 0.7      (TM)
C
C            Copyright (C) 1995 Object Access (SM)
C
C     Permission is granted to any individual or institution
C     to use, copy, modify, and distribute this single program
C     unit, provided that this complete copyright and
C     permission notice is maintained, intact, in all copies.
C
C     Object Access Incorporated provides this software
C     "as is" without express or implied warranty.
C
C     PURPOSE: Demonstrate and test access program PRL_LIBVER
C
C     LOCAL VARIABLES:
C
C
C     NOTES:  None
C
C     ******************************************************************
C
      INTRINSIC INDEX,LEN
C
C                       PRL object access programs
      EXTERNAL PRL_LIBVER
C
C                       POSIX object access programs
      EXTERNAL POSIX_INIT
C
C                       PROCESS object access programs
      EXTERNAL PROCESS_EXIT
C
C     ------------------------------------------------------------------
C
      PARAMETER (MAXVER=9)
C
C                       Library version numbers (actual & required)
      CHARACTER*8  VERAQ,VERSQ(MAXVER)
      CHARACTER*80 STRING
C
C                       Required PRL version number (update DATA value
C                       when program updated to new version of library)
      DATA VERSQ /'0.7     ',
     2            '0.6     ',
     3            '0.6.10  ',
     4            '0.7.1   ',
     5            '0.8     ',
     6            '0.8.1   ',
     9            '1.6     ',
     7            '1.7     ',
     8            '1.8     '/
C
C     ******************************************************************
C
C                       STEP 1 - Initialize library
C
      CALL POSIX_INIT (0)
C
C     ******************************************************************
C
C                       Write demo program introduction message
C
C                       Write intro message
C                       (use * for logical unit since TERM_SETSIO will
C                       not be called in this demo)
      WRITE (*,401)
  401 FORMAT (
     * '                   PRL "PRL1" Object Demo Program'//
     * ' PRL_LIBVER should be used to check the version of the'/
     * ' Programmer''s Reusable Library being used and print the'/
     * ' following types of WARNING or ERROR messages if the'/
     * ' version is not correct.')
C
C     ******************************************************************
C
C                       STEP 2 - Check PRL version
C
C                       Loop for each test case
      DO 200 IVER=1,MAXVER
C
C                       Get actual PRL version being used
C                       but do not perform check
      CALL PRL_LIBVER (VERAQ,' ')
C
C                       Compare actual & required major release numbers
      LOCAQ = INDEX (VERAQ,'.')
      LOCRQ = INDEX (VERSQ(IVER),'.')
      LENAQ = LEN (VERAQ)
      LENRQ = LEN (VERSQ(IVER))
      IF (VERAQ(1:LOCAQ) .NE. VERSQ(IVER)(1:LOCRQ)) THEN
        WRITE (*,213) VERAQ,VERSQ(IVER)
  213   FORMAT (/
     *  ' SAMPLE MESSAGE FOR INCORRECT LIBRARY VERSION:'/
     *  ' ERROR: Incompatible version of Programmer''s Reusable Library'
     *  /' Program is using version ',A,'but requires version ',A)
        GOTO 200
C
C                       Compare actual & reqd secondary release numbers
      ELSE IF (VERAQ(LOCAQ+1:LENAQ) .LT.
     *         VERSQ(IVER)(LOCRQ+1:LENRQ)) THEN
        WRITE (*,223) VERAQ,VERSQ(IVER)
  223   FORMAT (/
     *   ' SAMPLE MESSAGE FOR OUT-OF-DATE LIBRARY VERSION:'/
     *   ' WARNING: Old version of Programmer''s Reusable Library'/
     *   ' Program is using version ',A,'but requires version ',A)
C                       Print message for acceptable version
      ELSE
        WRITE (*,233) VERAQ,VERSQ(IVER)
  233   FORMAT (/
     *   ' NO MESSAGE PRINTED WHEN LIBRARY VERSION IS ACCEPTABLE:'/
     *   ' (Program is using version ',A,'and requires version ',A,' )')
      ENDIF
  200 CONTINUE
C
C     ******************************************************************
C
C                       STEP 5 - Terminate program execution
C                       Wait until user presses a key before exiting
C
      WRITE (*,810)
  810 FORMAT (/
     * '                 Demo Program PRL1 Execution Completed'/
     * '                         Press <CR> to exit demo')
      READ (*,811) STRING
  811 FORMAT (A)
C                       Exit demo
      CALL PROCESS_EXIT
      END
STOP_CAT
echo "  Generating =====> [ ./process1.f ]"
cat <<"STOP_CAT"> ././process1.f
C     PROGRAM PROCESS1
C
C       Programmer's Reusable Library, Version 0.7      (TM)
C
C            Copyright (C) 1995 Object Access (SM)
C
C     Permission is granted to any individual or institution
C     to use, copy, modify, and distribute this single program
C     unit, provided that this complete copyright and
C     permission notice is maintained, intact, in all copies.
C
C     Object Access Incorporated provides this software
C     "as is" without express or implied warranty.
C
C     PURPOSE: Demonstrate and test access program PROCESS_EXIT
C
C     LOCAL VARIABLES:
C
C
C     NOTES:  None
C
C     ******************************************************************
C
C                       POSIX object access programs
      EXTERNAL POSIX_INIT
C
C                       PROCESS object access programs
      EXTERNAL PROCESS_EXIT
C
C     ------------------------------------------------------------------
C
      CHARACTER*80 STRING
C
C     ******************************************************************
C
C                       STEP 1 - Initialize library
C
      CALL POSIX_INIT (0)
C
C     ******************************************************************
C
C                       Write demo program introduction message
C
C                       Write intro message
C                       (use * for logical unit since TERM_SETSIO will
C                       not be called in this demo)
      WRITE (*,401)
  401 FORMAT (
     * '                PRL-POSIX "PROCESS" Object Demo Program #1'//
     * ' PROCESS_EXIT may be used to terminate execution of programs'/
     * ' that use the PRL-POSIX library.  PROCESS_EXIT will be used'/
     * ' to exit from this demo after you press the Carriage Return'/
     * ' or Enter key <CR>.')
C
C     ******************************************************************
C
C                       STEP 5 - Terminate program execution
C                       Wait until user presses a key before exiting
C
      WRITE (*,810)
  810 FORMAT (/
     * '                 Demo Program PROCESS1 Execution Completed'/
     * '                         Press <CR> to exit demo')
      READ (*,811) STRING
  811 FORMAT (A)
C                       Exit demo
      CALL PROCESS_EXIT
      END
STOP_CAT
echo "  Generating =====> [ ./proj1.f ]"
cat <<"STOP_CAT"> ././proj1.f
C     PROGRAM PROJ1
C
C       Programmer's Reusable Library, Version 0.7      (TM)
C
C            Copyright (C) 1995 Object Access (SM)
C
C     Permission is granted to any individual or institution
C     to use, copy, modify, and distribute this single program
C     unit, provided that this complete copyright and
C     permission notice is maintained, intact, in all copies.
C
C     Object Access Incorporated provides this software
C     "as is" without express or implied warranty.
C
C     PURPOSE: Demonstrate and test access program SUBPLOT_DEFMAP,
C              SUBPLOT_ENDMAP, and PROJ_SETMAP for Cylindrical
C              Equidistant projection
C
C     LOCAL VARIABLES:
C
C
C     NOTES:  None
C
C     ******************************************************************
C
C                       Library version numbers (actual & required)
      CHARACTER*8  VERAQ,VERRQ
C
C                       Program required PRL version
      DATA VERRQ /'0.7     '/
C
C     ******************************************************************
C
C                       INITIALIZE LIBRARIES
C
C                       Initialize the map package
      CALL MAP_INIT (0)
C
C     ******************************************************************
C
C                       Check PRL version
C
C                       Get actual PRL version being used
      CALL PRL_LIBVER (VERAQ,VERRQ)
C
C     ******************************************************************
C
C                       INITIALIZE OUTPUT DEVICE
C
C                       Allow user to choose a device interactively
      KTYPE = 0
      CALL DEVICE_PROMPT (KTYPE,XPAGE,YPAGE)
C
C     ******************************************************************
C
C                       DEFINE PAGE SIZE
C
C                       Define page size in inches
      CALL PAGE_SIZE (XPAGE,YPAGE)
C
C     ******************************************************************
C
C                       DEFINE SUBPLOT AREA FOR LABELS
C
C                       Compute location of physical origin in inches
      XRL = 0.10*XPAGE
      YRL = 0.25*YPAGE
C
C                       Compute length of X and Y axis in inches
      XPG = XPAGE - 2.0*XRL
      YPG = YPAGE - 2.0*YRL
C                       Define location of physical origin relative
C                       to lower left corner of page
      CALL ORIGIN_SET (XRL,YRL)
C                       Specify 'cylindrical equidistant' map projection
      CALL PROJ_SETMAP ('CYLINDRICAL')
C                       Define subplot area in terms of length
C                       of X and Y axis in inches and draw border
C                       around outer edge of plot
      CALL SUBPLOT_DEFINE (XPG,YPG)
C
C     ******************************************************************
C
C                       DRAW HEADING OVER SUBPLOT AREA
C
C                       Compute text height based on page height
      SIZE = 0.25*YPAGE/11.0
C                       Set current text height in inches
      CALL TEXT2D_SETHT (SIZE)
C                       Set character style to 'triplx'
      CALL FONT_TRIPLX
C                       Draw heading over plot
      CALL HEADING_DRAW
     *     ('Cylindrical Equidistant Projection$',100,1.2,1)
C
C     ------------------------------------------------------------------
C
C                       DRAW TITLE UNDER SUBPLOT AREA
C
C                       Set character style to cartog
      CALL FONT_CARTOG
C                       Determine length of text string in inches
      XX = TEXT2D_GETLEN
     *     ('PROJ1 Demo: World Map - Cylindrical Equidistant$',100)
C                       Compute X coord of start of string in inches
      XX = 0.50*(XPG-XX)
C                       Plot text string
      CALL TEXT2D_PDRAW
     *     ('PROJ1 Demo: World Map - Cylindrical Equidistant$',
     *     100,XX,-YPG*0.25)
C
C     ******************************************************************
C
C                       END THE SUBPLOT
C
      CALL SUBPLOT_END (0)
C
C     ******************************************************************
C
C                       DEFINE SUBPLOT AREA FOR MAP
C
C                       Set current text height in inches
      CALL TEXT2D_SETHT (SIZE*0.75)
C
C                       Define world map subplot area in terms of
C                       length of X and Y axis in inches and draw
C                       border around outer edge of plot
      CALL SUBPLOT_DEFMAP (XPG,YPG)
C
C     ******************************************************************
C
C                       DEFINE PLOT HEADING AND LABELS
C
C                       Set character style to 'duplex'
      CALL FONT_DUPLEX
C                       Set X axis label
      CALL AXISLBL_DEFX2 ('LONGITUDE$',100)
C                       Set Y axis label
      CALL AXISLBL_DEFY2 ('LATITUDE$',100)
C
C     ******************************************************************
C
C                       DRAW THE PLOT
C
C                       Define 2D coordinate system with
C                       longitude (X) = 82 to 80 deg west and
C                       latitude  (Y) = 28 to 30 deg north and
C                       draw axes, axes labels
      CALL PLOT2D_DEFMAP (-82.0, 0.50,-80. 0,28.0, 0.50, 30.0)
C
C                       Set frame thickness in inches
      CALL FRAME_THICK (0.01)
C                       Draw frame around subplot area
      CALL FRAME_DRAW
C                       Draw world coastlines, islands, lakes
C                       in high resolution
      CALL MAPDATA_DRAW ('HICOAST')
C
C     ******************************************************************
C
C                       END THE SUBPLOT
C
      CALL  SUBPLOT_ENDMAP
C
C     ******************************************************************
C
C                       END THE PLOT
C
C                       End current plot and advance paper
      CALL PAGE_END (0)
C
C     ******************************************************************
C
C                       CLOSE THE OUTPUT DEVICE
C
C                       Finish plotting and release device
      CALL DEVICE_END
C                       Exit
      CALL PROCESS_EXIT
      END
STOP_CAT
echo "  Generating =====> [ ./proj2.f ]"
cat <<"STOP_CAT"> ././proj2.f
C     PROGRAM PROJ2
C
C       Programmer's Reusable Library, Version 0.7      (TM)
C
C            Copyright (C) 1995 Object Access (SM)
C
C     Permission is granted to any individual or institution
C     to use, copy, modify, and distribute this single program
C     unit, provided that this complete copyright and
C     permission notice is maintained, intact, in all copies.
C
C     Object Access Incorporated provides this software
C     "as is" without express or implied warranty.
C
C     PURPOSE: Demonstrate and test access program SUBPLOT_DEFMAP,
C              SUBPLOT_ENDMAP, and PROJ_SETMAP for Lambert Equal Area
C              projection
C
C     LOCAL VARIABLES:
C
C
C     NOTES:  None
C
C     ******************************************************************
C
C                       Library version numbers (actual & required)
      CHARACTER*8  VERAQ,VERRQ
C
C                       Program required PRL version
      DATA VERRQ /'0.7     '/
C
C     ******************************************************************
C
C                       INITIALIZE LIBRARIES
C
C                       Initialize the map package
      CALL MAP_INIT (0)
C
C     ******************************************************************
C
C                       Check PRL version
C
C                       Get actual PRL version being used
      CALL PRL_LIBVER (VERAQ,VERRQ)
C
C     ******************************************************************
C
C                       INITIALIZE OUTPUT DEVICE
C
C                       Allow user to choose a device interactively
      KTYPE = 0
      CALL DEVICE_PROMPT (KTYPE,XPAGE,YPAGE)
C
C     ******************************************************************
C
C                       DEFINE PAGE SIZE
C
C                       Define page size in inches
      CALL PAGE_SIZE (XPAGE,YPAGE)
C
C     ******************************************************************
C
C                       DEFINE SUBPLOT AREA FOR LABELS
C
C                       Compute location of physical origin in inches
      XRL = 0.10*XPAGE
      YRL = 0.25*YPAGE
C
C                       Compute length of X and Y axis in inches
      XPG = XPAGE - 2.0*XRL
      YPG = YPAGE - 2.0*YRL
C                       Define location of physical origin relative
C                       to lower left corner of page
      CALL ORIGIN_SET (XRL,YRL)
C                       Specify 'lambert equal area' map projection
      CALL PROJ_SETMAP ('LAMBERT')
C                       Define subplot area in terms of length
C                       of X and Y axis in inches and draw border
C                       around outer edge of plot
      CALL SUBPLOT_DEFINE (XPG,YPG)
C
C     ******************************************************************
C
C                       DRAW HEADING OVER SUBPLOT AREA
C
C                       Compute text height based on page height
      SIZE = 0.25*YPAGE/11.0
C                       Set current text height in inches
      CALL TEXT2D_SETHT (SIZE)
C                       Set character style to 'triplx'
      CALL FONT_TRIPLX
C                       Draw heading over plot
      CALL HEADING_DRAW ('Lambert Equal Area Projection$',100,1.2,1)
C
C     ------------------------------------------------------------------
C
C                       DRAW TITLE UNDER SUBPLOT AREA
C
C                       Set character style to cartog
      CALL FONT_CARTOG
C                       Determine length of text string in inches
      XX = TEXT2D_GETLEN
     *     ('PROJ2 Demo: World Map - Lambert$',100)
C                       Compute X coord of start of string in inches
      XX = 0.50*(XPG-XX)
C                       Plot text string
      CALL TEXT2D_PDRAW
     *     ('PROJ2 Demo: World Map - Lambert$',100,XX,-YPG*0.25)
C
C     ******************************************************************
C
C                       END THE SUBPLOT
C
      CALL SUBPLOT_END (0)
C
C     ******************************************************************
C
C                       DEFINE SUBPLOT AREA FOR MAP
C
C                       Set current text height in inches
      CALL TEXT2D_SETHT (SIZE*0.75)
C
C                       Define world map subplot area in terms of
C                       length of X and Y axis in inches and draw
C                       border around outer edge of plot
      CALL SUBPLOT_DEFMAP (XPG,YPG)
C                        Define the map pole
      CALL VIEWPT_SETMPOLE (0.0,45.0)
C
C     ******************************************************************
C
C                       DRAW THE PLOT
C
C                       Define 2D coordinate system with
C                       longitude (X) = 90 west to 90 east and
C                       latitude  (Y) = 45 south to 135 north
      CALL PLOT2D_DEFMAP (-90.0, 30.0, 90., -45.0, 30.0, 135.0)
C
C                       Set frame thickness in inches
      CALL FRAME_THICK (0.01)
C                       Draw frame around subplot area
      CALL FRAME_DRAW
C                       Draw world coastlines, islands, lakes
C                       in low resolution
      CALL MAPDATA_DRAW ('LOWCOAST')
C
C     ******************************************************************
C
C                       END THE SUBPLOT
C
      CALL  SUBPLOT_ENDMAP
C
C     ******************************************************************
C
C                       END THE PLOT
C
C                       End current plot and advance paper
      CALL PAGE_END (0)
C
C     ******************************************************************
C
C                       CLOSE THE OUTPUT DEVICE
C
C                       Finish plotting and release device
      CALL DEVICE_END
C                       Exit
      CALL PROCESS_EXIT
      END
STOP_CAT
echo "  Generating =====> [ ./skeleton.f ]"
cat <<"STOP_CAT"> ././skeleton.f
C     PROGRAM SKELETON
C
C       Programmer's Reusable Library, Version 0.7      (TM)
C
C            Copyright (C) 1995 Object Access (SM)
C
C     Permission is granted to any individual or institution
C     to use, copy, modify, and distribute this single program
C     unit, provided that this complete copyright and
C     permission notice is maintained, intact, in all copies.
C
C     Object Access Incorporated provides this software
C     "as is" without express or implied warranty.
C
C     PURPOSE: Demonstrate use of PRL-MAP library
C
C     LOCAL VARIABLES:
C
C
C     NOTES:
C       1. This is a program skeleton that may be used for development
C          of any program that uses the PRL-MAP library.  Customize
C          to your needs by retaining desired lines.
C
C       2. Steps 1 through 2 must be performed first in sequence, and
C          step 13 must be performed last.  Other steps may be mixed
C          as necessary.
C
C     ******************************************************************
C
C     INTRINSIC
C
C                       CURVE2D object access programs
      EXTERNAL CURVE2D_DRAW
C
C                       DEVICE object access programs
      EXTERNAL DEVICE_END, DEVICE_SELECT
C
C                       FRAME object access programs
      EXTERNAL FRAME_DRAW
C
C                       GRID object access programs
      EXTERNAL GRID_DRAW
C
C                       MAP object access programs
      EXTERNAL MAP_INIT
C
C                       MAPDATA object access programs
      EXTERNAL MAPDATA_DRAW
C
C                       ORIGIN object access programs
      EXTERNAL ORIGIN_SET
C
C                       PAGE object access programs
      EXTERNAL PAGE_END, PAGE_SIZE
C
C                       PLOT2D object access programs
      EXTERNAL PLOT2D_DEFMAP
C
C                       PRL object access programs
      EXTERNAL PRL_LIBVER
C
C                       PROCESS object access programs
      EXTERNAL PROCESS_EXIT
C
C                       PROJ object access programs
      EXTERNAL PROJ_SETMAP
C
C                       SUBPLOT object access programs
      EXTERNAL SUBPLOT_DEFMAP, SUBPLOT_ENDMAP
C
C                       VIEWPT object access programs
      EXTERNAL VIEWPT_SETMPOLE, VIEWPT_SETMRAD
C
C     ------------------------------------------------------------------
C
C                       Maximum array sizes
      PARAMETER (MX101 = 1)
      PARAMETER (MX102 = 1)
C
C                       Integer variables and arrays
      INTEGER NPTS, IMARK, KTYPQ, IXGRID, IYGRID, ISCOPE, ISPARE
C
C                       Real variables and arrays
      REAL XC2(MX101), YC2(MX102), XPAGE, YPAGE, XOABS, YOABS, PAGEX
     *        , PAGEY, XMN, XSTP, XMX, YMN, YSTP, YMX, AX, AY, XPOLE
     *        , YPOLE, RAD
C
C                       Double precision variables and arrays
C     DOUBLE PRECISION
C
C                       Complex variables and arrays
C     COMPLEX
C
C                       Logical variables and arrays
C     LOGICAL
C
C                       Character variables and arrays
      CHARACTER VERAQ*8, MFILE*4, VERRQ*8, PRONAM*4
C
C                       Program required PRL version (update DATA value
C                       when program updated to new version of library)
      DATA VERRQ /'0.7     '/
C
C     ******************************************************************
C
C                       STEP 1  - Initialize the library
C
C     ------------------------------------------------------------------
C
C                       Use MAP_INIT object access program
C
C                       Initialize the PRL-MAP library
C     ISCOPE =
      CALL MAP_INIT (ISCOPE)
C
C     ******************************************************************
C
C                       STEP 2  - Check the Programmer's Reusable
C                       Library version
C
C     ------------------------------------------------------------------
C
C                       Use PRL_LIBVER object access program
C
C                       Return the version of the Programmer's Reusable
C                       Library
C     VERRQ =
      CALL PRL_LIBVER (VERAQ,VERRQ)
C
C     ******************************************************************
C
C                       STEP 3  - Use PRL-DEVICE to initialize a
C                       graphics device
C
C     ------------------------------------------------------------------
C
C                       Use DEVICE_SELECT object access program
C
C                       Non-interactively select a graphics output
C                       device
C     KTYPQ =
      CALL DEVICE_SELECT (KTYPQ,XPAGE,YPAGE)
C
C     ******************************************************************
C
C                       STEP 4  - Use PRL-GRAPHICS to define plotting
C                       page
C
C     ------------------------------------------------------------------
C
C                       Use PAGE_SIZE object access program
C
C                       Set page size for plot
C     PAGEX =
C     PAGEY =
      CALL PAGE_SIZE (PAGEX,PAGEY)
C
C     ******************************************************************
C
C                       STEP 5  - Use PRL-GRAPHICS to help set origin
C                       location and and subplot properties
C
C     ------------------------------------------------------------------
C
C                       Use ORIGIN_SET object access program
C
C                       Set location of origin relative to lower left
C                       corner of page
C     XOABS =
C     YOABS =
      CALL ORIGIN_SET (XOABS,YOABS)
C
C     ------------------------------------------------------------------
C
C                       Use PROJ_SETMAP object access program
C
C                       Specify a map projection
C     PRONAM =
      CALL PROJ_SETMAP (PRONAM)
C
C     ******************************************************************
C
C                       STEP 6  - Define subplot area
C
C     ------------------------------------------------------------------
C
C                       Use SUBPLOT_DEFMAP object access program
C
C                       Define world map subplot area
C     AX =
C     AY =
      CALL SUBPLOT_DEFMAP (AX,AY)
C
C     ******************************************************************
C
C                       STEP 7  - Set world map coordinate reference
C                       system properties
C
C     ------------------------------------------------------------------
C
C                       Use VIEWPT object access programs
C
C                       Define location of map pole for world map
C                       viewpoint
C     XPOLE =
C     YPOLE =
      CALL VIEWPT_SETMPOLE (XPOLE,YPOLE)
C
C                       Specify radius of projection of world map
C                       viewpoint
C     RAD =
      CALL VIEWPT_SETMRAD (RAD)
C
C     ******************************************************************
C
C                       STEP 8  - Define world map coordinate reference
C                       system for subplot and draw axes
C
C     ------------------------------------------------------------------
C
C                       Use PLOT2D_DEFMAP object access program
C
C                       Define map coordinate system and draw axes for
C                       2D plot
C     XMN =
C     XSTP =
C     XMX =
C     YMN =
C     YSTP =
C     YMX =
      CALL PLOT2D_DEFMAP (XMN,XSTP,XMX,YMN,YSTP,YMX)
C
C     ******************************************************************
C
C                       STEP 9  - Invoke other library objects as needed
C
C     ------------------------------------------------------------------
C
C                       Use GRID object access programs
C
C                       Draw grid lines within, and frame around,
C                       subplot area
C     IXGRID =
C     IYGRID =
      CALL GRID_DRAW (IXGRID,IYGRID)
C
C     ------------------------------------------------------------------
C
C                       Use FRAME object access programs
C
C                       Draw frame around subplot area
      CALL FRAME_DRAW ()
C
C     ------------------------------------------------------------------
C
C                       Use MAPDATA object access programs
C
C                       Draw world map features
C     MFILE =
      CALL MAPDATA_DRAW (MFILE)
C
C     ------------------------------------------------------------------
C
C                       Use CURVE2D object access programs
C
C                       Draw 2D curve using current interpolation method
C     XC2(1) =
C     YC2(1) =
C     NPTS =
C     IMARK =
      CALL CURVE2D_DRAW (XC2,YC2,NPTS,IMARK)
C
C     ******************************************************************
C
C                       STEP 10 - End the world map subplot
C
C     ------------------------------------------------------------------
C
C                       Use SUBPLOT_ENDMAP object access program
C
C                       End world map subplot
      CALL SUBPLOT_ENDMAP ()
C
C     ******************************************************************
C
C                       STEP 11 - Use PRL-GRAPHICS to end plotting on
C                       the page
C
C     ------------------------------------------------------------------
C
C                       Use PAGE_END object access program
C
C                       End plotting on current page
C     ISPARE =
      CALL PAGE_END (ISPARE)
C
C     ******************************************************************
C
C                       STEP 12 - Use PRL-DEVICE to release graphics
C                       device
C
C     ------------------------------------------------------------------
C
C                       Use DEVICE_END object access program
C
C                       End plotting and release the current graphics
C                       device
      CALL DEVICE_END ()
C
C     ******************************************************************
C
C                       STEP 13 - Use PRL-POSIX to terminate program
C                       execution
C
C     ------------------------------------------------------------------
C
C                       Use PROCESS_EXIT object access program
C
C                       Silently terminate process execution
      CALL PROCESS_EXIT ()
      END
STOP_CAT
echo "  Generating =====> [ ./subplot1.f ]"
cat <<"STOP_CAT"> ././subplot1.f
C     PROGRAM SUBPLOT1
C
C       Programmer's Reusable Library, Version 0.7      (TM)
C
C            Copyright (C) 1995 Object Access (SM)
C
C     Permission is granted to any individual or institution
C     to use, copy, modify, and distribute this single program
C     unit, provided that this complete copyright and
C     permission notice is maintained, intact, in all copies.
C
C     Object Access Incorporated provides this software
C     "as is" without express or implied warranty.
C
C     PURPOSE: Demonstrate and test access program SUBPLOT_DEFMAP and
C              SUBPLOT_ENDMAP
C
C     LOCAL VARIABLES:
C
C
C     NOTES:  None
C
C     ******************************************************************
C
C                       External subprogram declarations
C
C     INTRINSIC
C
C                       SUBPLOT object access program
      EXTERNAL SUBPLOT_DEFMAP
C
C                       MAP object access programs
      EXTERNAL MAP_INIT
C
C                       Environment object access programs
      EXTERNAL DEVICE_PROMPT, DEVICE_RELEASE
      EXTERNAL PAGE_SIZE, PAGE_END, ORIGIN_SET
C
C                       PRL object access programs
      EXTERNAL PRL_LIBVER
C
C                       REAL object access programs
      EXTERNAL REAL_IDIF0, REAL_SETTOL
      LOGICAL  REAL_IDIF0
C
C                       DBL object access programs
      EXTERNAL DBL_IDIF0, DBL_SETTOL
      LOGICAL  DBL_IDIF0
C
C                       CMPLX object access programs
      EXTERNAL CMPLX_IDIF0
      LOGICAL  CMPLX_IDIF0
C
C                       TERM object access programs
      EXTERNAL TERM_GETIN, TERM_GETOUT, TERM_GETERR, TERM_SETSIO
      INTEGER  TERM_GETIN, TERM_GETOUT, TERM_GETERR
C
C                       PROCESS object access programs
      EXTERNAL PROCESS_EXIT
C
C                       FILE object access programs
      EXTERNAL PXFCLS, PXFOPN
C
C                       PCONS object access programs
      EXTERNAL IPXCON
      INTEGER  IPXCON
C
C     ------------------------------------------------------------------
C
C                       Test program parameter values
C
C                       Standard input logical unit for the system
      PARAMETER (LUNSI=5)
C                       Standard output logical unit for the system
      PARAMETER (LUNSO=6)
C                       Standard error logical unit for the system
      PARAMETER (LUNSE=6)
C
C                       REAL subtraction tolerance
      PARAMETER (TOLER=0.00001)
C                       DBL subtraction tolerance
      DOUBLE PRECISION DTOLER
      PARAMETER (DTOLER=1.0D-13)
C
C                       Number of input variable test values
      PARAMETER (NVV101 =  2)
      PARAMETER (NVV102 =  2)
C
C                       Argument maximum array sizes
C
C     ------------------------------------------------------------------
C
C                       Access program variables
C
C                       Integer variables and arrays
C
C                       Real variables and arrays
      REAL    AX, TMP101, AY, TMP102
C
C                       Double precision variables and arrays
C
C                       Complex variables and arrays
C
C                       Logical variables and arrays
C
C                       Character variables and arrays
C
C     ------------------------------------------------------------------
C
C                       Test program variables
C
      CHARACTER*1 PAUS
C                       Program logical unit numbers
      INTEGER     IN, IOUT, IER, IFILE, IO
C
C                       Name of results file for the access program
      CHARACTER*(40) FILNAM
C
C                       Library version numbers (actual & required)
      CHARACTER*8  VERAQ,VERRQ
C
C                       Input variable test value arrays
      REAL    VV101(NVV101)
      REAL    VV102(NVV102)
C
C                       Program required PRL version
      DATA VERRQ /'0.7     '/
C
C                       Input variable test values
      DATA VV101 /.000001, 90.0/
C
      DATA VV102 /.000001, 180.0/
C
C     ******************************************************************
C
C                       Initialize library
C
      CALL MAP_INIT (0)
C
C     ******************************************************************
C
C                       Check PRL version
C
C                       Get actual PRL version being used
      CALL PRL_LIBVER (VERAQ,VERRQ)
C
C     ******************************************************************
C
C                       Set machine-specific constants
C
      CALL TERM_SETSIO (LUNSI,LUNSO,LUNSE)
C
C                       Logical unit number (LUN) of standard in
      IN = TERM_GETIN ()
C                       LUN of standard out
      IOUT = TERM_GETOUT ()
C                       LUN of standard error
      IER = TERM_GETERR ()
C
C                       REAL subtraction tolerance
      CALL REAL_SETTOL (TOLER)
C
C                       DBL subtraction tolerance
      CALL DBL_SETTOL (DTOLER)
C
C     ******************************************************************
C
C                       Print introduction message
C
C                       Set file pathname
      FILNAM = 'subplot_defmap.dat'
C
      WRITE (IOUT,301) FILNAM
  301 FORMAT (
     * '              SUBPLOT Object Demo Program #1'/
     * ' This program tests the SUBPLOT object access program'/
     * ' SUBPLOT_DEFMAP.'/
     * ' The input variables are varied through a wide range of valid'/
     * ' combinations.  The results for each combination are compared'/
     * ' to previously-computed results stored on file, and any '/
     * ' differences are displayed.  If no results file is found, the'/
     * ' computed results are saved in a file named'/
     * ' ',A/)
C
C                       Initialize program completion status
      IOK = 0
C
C     ******************************************************************
C
C                       Open test results file
C
C                       Open read-only
      IOPFLG = IPXCON ('O_RDONLY')
C
C                       Assume file exists and open read-only
      CALL PXFOPN (FILNAM,0,IOPFLG,0,IFILE,IRESLT)
C
C                       If file does not exist,
C                       create and open read/write
      IF (IRESLT .NE. 0) THEN
        IF (IRESLT .EQ. IPXCON('ENOENT')) THEN
C                       Open read-write
          IOPFLG = IPXCON ('O_RDWR')
C                       Allow file creation
     *            +IPXCON ('O_CREAT')
C                       Create file and open read/write
          CALL PXFOPN (FILNAM,0,IOPFLG,0,IFILE,IERROR)
C
C                       If error creating and opening file,
C                       print error message and exit
          IF (IERROR .NE. 0) THEN
            WRITE (IER,409) FILNAM
  409       FORMAT (' Error opening results file ',A)
            GOTO 900
          ENDIF
C                       Print message that file is being created
          WRITE (IOUT,411) FILNAM
  411     FORMAT (' Creating file ',A)
          IOK = 1
C
C                       If error opening existing file,
C                       print error message and exit
        ELSE
          WRITE (IER,409) FILNAM
          GOTO 900
        ENDIF
      ENDIF
C
C     ******************************************************************
C
C                       Set up proper environment for access program
C                       under test
C
C                       Select device and advance package to level 1
      KTYPE = 0
      CALL DEVICE_PROMPT (KTYPE,XPAGE,YPAGE)
C
C     ------------------------------------------------------------------
C
C                       Test SUBPLOT_DEFMAP object access program
C
C                       Loop for each input variable of access program
      DO 589 IVV101 = 1,NVV101
        AX = VV101(IVV101)
C
      DO 588 IVV102 = 1,NVV102
        AY = VV102(IVV102)
C
      CALL PAGE_SIZE (XPAGE,YPAGE)
      CALL ORIGIN_SET (0.0,0.0)
C
C                       Define world map subplot area
      CALL SUBPLOT_DEFMAP (AX,AY)
C
C                       Read input and output variable values from file
      IF (IRESLT .EQ. 0) THEN
        READ (IFILE,502,ERR=610) TMP101,TMP102
C                       Test combination matches previous results
        GOTO 503
C
C                       Write input and output variable values to file
      ELSE
        IO = IFILE
        GOTO 501
      ENDIF
C                       Write input and output variable values
C                       to file or error device
  501 CONTINUE
      WRITE (IO,502,ERR=612) AX,AY
  502 FORMAT (E15.7,E15.7)
  503 CONTINUE
C                       Finish subplot
      CALL SUBPLOT_ENDMAP(0)
C                       End plotting on current page
      CALL PAGE_END (0)
C
C                       Repeat for next variable value
  588 CONTINUE
  589 CONTINUE
C                       Release device
      CALL DEVICE_RELEASE ()
C
C     ******************************************************************
C
C                       Print program status message
C
      IF (IOK .EQ. 0) THEN
        WRITE (IOUT,601)
  601   FORMAT (' Program results identical to file values')
      ENDIF
      GOTO 700
C
  610 WRITE (IER,611) FILNAM
  611 FORMAT (' Error reading file ',A)
      GOTO 700
C
  612 WRITE (IER,613) FILNAM
  613 FORMAT (' Error writing file ',A)
C
C     ******************************************************************
C
C                       Close test results file
C
C                       Close file
  700 CALL PXFCLS (IFILDS,IERROR)
C
C     ******************************************************************
C
C                       Print demo termination message
C
C                       Wait until user presses a key before exiting
      WRITE (IOUT,810)
  810 FORMAT (/
     * '              SUBPLOT Demo Program #1 Execution Completed'/
     * '                      Press <CR> to exit demo')
      READ (IN,811) PAUS
  811 FORMAT (A)
C
C     ******************************************************************
C
C                       Terminate program execution
C
  900 CALL PROCESS_EXIT
      END
STOP_CAT
echo "  Generating =====> [ ./subplot_defmap.dat ]"
cat <<"STOP_CAT"> ././subplot_defmap.uuu
begin 660 ./subplot_defmap.dat
M("`@+C$P,#`P,#!%+3`U("`@+C$P,#`P,#!%+3`U"B`@("XQ,#`P,#`P12TP
M-2`@("XQ.#`P,#`P12LP,PH@("`N.3`P,#`P,$4K,#(@("`N,3`P,#`P,$4M
B,#4*("`@+CDP,#`P,#!%*S`R("`@+C$X,#`P,#!%*S`S"B`N
`
end
STOP_CAT
echo "  Generating =====> [ ./viewpt1.f ]"
cat <<"STOP_CAT"> ././viewpt1.f
C     PROGRAM VIEWPT1
C
C       Programmer's Reusable Library, Version 0.7      (TM)
C
C            Copyright (C) 1995 Object Access (SM)
C
C     Permission is granted to any individual or institution
C     to use, copy, modify, and distribute this single program
C     unit, provided that this complete copyright and
C     permission notice is maintained, intact, in all copies.
C
C     Object Access Incorporated provides this software
C     "as is" without express or implied warranty.
C
C     PURPOSE: Demonstrate and test access program VIEWPT_SETMPOLE
C
C     LOCAL VARIABLES:
C
C
C     NOTES:  None
C
C     ******************************************************************
C
      EXTERNAL  REAL_CVSTRING
      REAL      REAL_CVSTRING
C
      PARAMETER (NBUFF = 40)
C
      CHARACTER*40  BUFF
C                       Library version numbers (actual & required)
      CHARACTER*8  VERAQ,VERRQ
C
C                       Program required PRL version
      DATA VERRQ /'0.7     '/
C
C     ******************************************************************
C
C                       INITIALIZE LIBRARIES
C
C                       Initialize the map package
      CALL MAP_INIT (0)
C
C     ******************************************************************
C
C                       Check PRL version
C
C                       Get actual PRL version being used
      CALL PRL_LIBVER (VERAQ,VERRQ)
C
C     ******************************************************************
C
C                       INITIALIZE OUTPUT DEVICE
C
C                       Allow user to choose a device interactively
      KTYPE = 0
      CALL DEVICE_PROMPT (KTYPE,XPAGE,YPAGE)
C
C     ******************************************************************
C
C                       READ THE MAP POLE ANGLE
C
C                       Write prompt
  100 CALL TERM_WRITE
     *     (' Enter longitude , latitude in degrees; q to quit:',0)
C
C                       Read response
      CALL TERM_READ (BUFF,NBUFF)
C                       Convert to real
      XPOLE = REAL_CVSTRING (BUFF,1,ISTAT)
      YPOLE = REAL_CVSTRING (BUFF,2,JSTAT)
C
C                       Check for exit
      IF (ISTAT .LT. 0 .OR. JSTAT .LT. 0) THEN
        GOTO 800
      ENDIF
C
C     ******************************************************************
C
C                       DEFINE PAGE SIZE
C
C                       Define page size in inches
      CALL PAGE_SIZE (XPAGE,YPAGE)
C
C     ******************************************************************
C
C                       DEFINE SUBPLOT AREA FOR LABELS
C
C                       Compute location of physical origin in inches
      XRL = 0.10*XPAGE
      YRL = 0.25*YPAGE
C
C                       Compute length of X and Y axis in inches
      XPG = XPAGE - 2.0*XRL
      YPG = YPAGE - 2.0*YRL
C                       Define location of physical origin relative
C                       to lower left corner of page
      CALL ORIGIN_SET (XRL,YRL)
C                       Specify 'lambert equal area' map projection
      CALL PROJ_SETMAP ('LAMBERT')
C                       Define subplot area in terms of length
C                       of X and Y axis in inches and draw border
C                       around outer edge of plot
      CALL SUBPLOT_DEFINE (XPG,YPG)
C
C     ******************************************************************
C
C                       DRAW HEADING OVER SUBPLOT AREA
C
C                       Compute text height based on page height
      SIZE = 0.25*YPAGE/11.0
C                       Set current text height in inches
      CALL TEXT2D_SETHT (SIZE)
C                       Set character style to 'triplx'
      CALL FONT_TRIPLX
C                       Draw heading over plot
      CALL HEADING_DRAW ('Lambert Equal Area Projection$',100,1.2,1)
C
C     ------------------------------------------------------------------
C
C                       DRAW TITLE UNDER SUBPLOT AREA
C
C                       Set character style to cartog
      CALL FONT_CARTOG
C                       Determine length of text string in inches
      XX = TEXT2D_GETLEN
     *     ('VIEWPT1 Demo: World Map View Angle$',100)
C                       Compute X coord of start of string in inches
      XX = 0.50*(XPG-XX)
C                       Plot text string
      CALL TEXT2D_PDRAW
     *     ('VIEWPT1 Demo: World Map View Angle$',100,XX,-YPG*0.25)
C
C     ******************************************************************
C
C                       END THE SUBPLOT
C
      CALL SUBPLOT_END (0)
C
C     ******************************************************************
C
C                       DEFINE SUBPLOT AREA FOR MAP
C
C                       Set current text height in inches
      CALL TEXT2D_SETHT (SIZE*0.75)
C
C                       Define world map subplot area in terms of
C                       length of X and Y axis in inches and draw
C                       border around outer edge of plot
      CALL SUBPLOT_DEFMAP (XPG,YPG)
C                        Define the map pole
      CALL VIEWPT_SETMPOLE (XPOLE,YPOLE)
C
C     ******************************************************************
C
C                       DRAW THE PLOT
C
C                       Define 2D coordinate system
      CALL PLOT2D_DEFMAP (XPOLE-90.0, 30.0, XPOLE+90.,
     *                    YPOLE-90.0, 30.0, YPOLE+90.)
C
C                       Set frame thickness in inches
      CALL FRAME_THICK (0.01)
C                       Draw frame around subplot area
      CALL FRAME_DRAW
C                       Draw world coastlines, islands, lakes
C                       in low resolution
      CALL MAPDATA_DRAW ('LOWCOAST')
C
C     ******************************************************************
C
C                       END THE SUBPLOT
C
      CALL  SUBPLOT_ENDMAP
C
C     ******************************************************************
C
C                       END THE PLOT
C
C                       End current plot and advance paper
      CALL PAGE_END (0)
C
      GOTO 100
C
C     ******************************************************************
C
C                       CLOSE THE OUTPUT DEVICE
C
C                       Finish plotting and release device
  800 CALL DEVICE_END
C                       Exit
      CALL PROCESS_EXIT
      END
STOP_CAT
echo "  Generating =====> [ ./viewpt2.f ]"
cat <<"STOP_CAT"> ././viewpt2.f
C     PROGRAM VIEWPT2
C
C       Programmer's Reusable Library, Version 0.7      (TM)
C
C            Copyright (C) 1995 Object Access (SM)
C
C     Permission is granted to any individual or institution
C     to use, copy, modify, and distribute this single program
C     unit, provided that this complete copyright and
C     permission notice is maintained, intact, in all copies.
C
C     Object Access Incorporated provides this software
C     "as is" without express or implied warranty.
C
C     PURPOSE: Demonstrate and test access program VIEWPT_SETMRAD
C
C     LOCAL VARIABLES:
C
C
C     NOTES:  None
C
C     ******************************************************************
C
      EXTERNAL  REAL_CVSTRING
      REAL      REAL_CVSTRING
C
      PARAMETER (NBUFF = 40)
      PARAMETER (MAXALT=  3)
C
      REAL  ALT(MAXALT)
      CHARACTER*40  BUFF
C                       Library version numbers (actual & required)
      CHARACTER*8  VERAQ,VERRQ
C
C                       Program required PRL version
      DATA VERRQ /'0.7     '/
C
      DATA ALT /5400.,  2000., 500./
C
C     ******************************************************************
C
C                       INITIALIZE LIBRARIES
C
C                       Initialize the map package
      CALL MAP_INIT (0)
C
C     ******************************************************************
C
C                       Check PRL version
C
C                       Get actual PRL version being used
      CALL PRL_LIBVER (VERAQ,VERRQ)
C
C     ******************************************************************
C
C                       INITIALIZE OUTPUT DEVICE
C
C                       Allow user to choose a device interactively
      KTYPE = 0
      CALL DEVICE_PROMPT (KTYPE,XPAGE,YPAGE)
C
C     ******************************************************************
C
C                       READ THE MAP POLE ANGLE
C
C                       Write prompt
  100 CALL TERM_WRITE
     *     (' Enter longitude , latitude in degrees; q to quit:',0)
C
C                       Read response
      CALL TERM_READ (BUFF,NBUFF)
C                       Convert to real
      XPOLE = REAL_CVSTRING (BUFF,1,ISTAT)
      YPOLE = REAL_CVSTRING (BUFF,2,JSTAT)
C
C                       Check for exit
      IF (ISTAT .LT. 0 .OR. JSTAT .LT. 0) THEN
        GOTO 800
      ENDIF
C
C     ******************************************************************
C
C                       DEFINE PAGE SIZE
C
      DO 300 IALT=1,MAXALT
C
C                       Define page size in inches
      CALL PAGE_SIZE (XPAGE,YPAGE)
C
C     ******************************************************************
C
C                       DEFINE SUBPLOT AREA FOR LABELS
C
C                       Compute location of physical origin in inches
      XRL = 0.10*XPAGE
      YRL = 0.25*YPAGE
C
C                       Compute length of X and Y axis in inches
      XPG = XPAGE - 2.0*XRL
      YPG = YPAGE - 2.0*YRL
C                       Define location of physical origin relative
C                       to lower left corner of page
      CALL ORIGIN_SET (XRL,YRL)
C                       Specify 'lambert equal area' map projection
      CALL PROJ_SETMAP ('LAMBERT')
C                       Define subplot area in terms of length
C                       of X and Y axis in inches and draw border
C                       around outer edge of plot
      CALL SUBPLOT_DEFINE (XPG,YPG)
C
C     ******************************************************************
C
C                       DRAW HEADING OVER SUBPLOT AREA
C
C                       Compute text height based on page height
      SIZE = 0.25*YPAGE/11.0
C                       Set current text height in inches
      CALL TEXT2D_SETHT (SIZE)
C                       Set character style to 'triplx'
      CALL FONT_TRIPLX
C                       Draw heading over plot
      CALL HEADING_DRAW ('Lambert Equal Area Projection$',100,1.2,1)
C
C     ------------------------------------------------------------------
C
C                       DRAW TITLE UNDER SUBPLOT AREA
C
C                       Set character style to cartog
      CALL FONT_CARTOG
C                       Determine length of text string in inches
      XX = TEXT2D_GETLEN
     *     ('VIEWPT2 Demo: World Map View Altitude$',100)
C                       Compute X coord of start of string in inches
      XX = 0.50*(XPG-XX)
C                       Plot text string
      CALL TEXT2D_PDRAW
     *     ('VIEWPT2 Demo: World Map View Altitude$',100,XX,-YPG*0.25)
C
C     ******************************************************************
C
C                       END THE SUBPLOT
C
      CALL SUBPLOT_END (0)
C
C     ******************************************************************
C
C                       DEFINE SUBPLOT AREA FOR MAP
C
C                       Set current text height in inches
      CALL TEXT2D_SETHT (SIZE*0.75)
C
C                       Define world map subplot area in terms of
C                       length of X and Y axis in inches and draw
C                       border around outer edge of plot
      CALL SUBPLOT_DEFMAP (XPG,YPG)
C                        Define the map pole
      CALL VIEWPT_SETMPOLE (XPOLE,YPOLE)
C                        Define radius of projection
      CALL VIEWPT_SETMRAD (ALT(IALT))
C
C     ******************************************************************
C
C                       DRAW THE PLOT
C
C                       Define 2D coordinate system
      CALL PLOT2D_DEFMAP (XPOLE-90.0, 30.0, XPOLE+90.,
     *                    YPOLE-90.0, 30.0, YPOLE+90.)
C
C                       Set frame thickness in inches
      CALL FRAME_THICK (0.01)
C                       Draw frame around subplot area
      CALL FRAME_DRAW
C                       Draw world coastlines, islands, lakes
C                       in low resolution
      CALL MAPDATA_DRAW ('LOWCOAST')
C
C     ******************************************************************
C
C                       END THE SUBPLOT
C
      CALL SUBPLOT_ENDMAP
C
C     ******************************************************************
C
C                       END THE PLOT
C
C                       End current plot and advance paper
      CALL PAGE_END (0)
C
  300 CONTINUE
      GOTO 100
C
C     ******************************************************************
C
C                       CLOSE THE OUTPUT DEVICE
C
C                       Finish plotting and release device
  800 CALL DEVICE_END
C                       Exit
      CALL PROCESS_EXIT
      END
STOP_CAT
echo "  <CR> to Continue"
read answer
cat <<STOP_CAT> ./compile
echo "
 
  Compiling and linking demo programs.
 "
echo "  Compiling ======> [ ./curve2d1.f ]"
$LINK ./curve2d1.f -o ./curve2d1.x $MAP
chmod 0770 ./curve2d1.x
echo "  Compiling ======> [ ./device1.f ]"
$LINK ./device1.f -o ./device1.x $MAP
chmod 0770 ./device1.x
echo "  Converting ======> [ ./device_select.uuu ]"
uudecode ./device_select.uuu
chmod 0660 ./device_select.dat
echo "  Compiling ======> [ ./frame1.f ]"
$LINK ./frame1.f -o ./frame1.x $MAP
chmod 0770 ./frame1.x
echo "  Compiling ======> [ ./grid1.f ]"
$LINK ./grid1.f -o ./grid1.x $MAP
chmod 0770 ./grid1.x
echo "  Compiling ======> [ ./grid2.f ]"
$LINK ./grid2.f -o ./grid2.x $MAP
chmod 0770 ./grid2.x
echo "  Compiling ======> [ ./map1.f ]"
$LINK ./map1.f -o ./map1.x $MAP
chmod 0770 ./map1.x
echo "  Compiling ======> [ ./mapdata1.f ]"
$LINK ./mapdata1.f -o ./mapdata1.x $MAP
chmod 0770 ./mapdata1.x
echo "  Compiling ======> [ ./origin1.f ]"
$LINK ./origin1.f -o ./origin1.x $MAP
chmod 0770 ./origin1.x
echo "  Converting ======> [ ./origin_set.uuu ]"
uudecode ./origin_set.uuu
chmod 0660 ./origin_set.dat
echo "  Compiling ======> [ ./page1.f ]"
$LINK ./page1.f -o ./page1.x $MAP
chmod 0770 ./page1.x
echo "  Compiling ======> [ ./page2.f ]"
$LINK ./page2.f -o ./page2.x $MAP
chmod 0770 ./page2.x
echo "  Converting ======> [ ./page_size.uuu ]"
uudecode ./page_size.uuu
chmod 0660 ./page_size.dat
echo "  Compiling ======> [ ./plot2d1.f ]"
$LINK ./plot2d1.f -o ./plot2d1.x $MAP
chmod 0770 ./plot2d1.x
echo "  Compiling ======> [ ./prl1.f ]"
$LINK ./prl1.f -o ./prl1.x $MAP
chmod 0770 ./prl1.x
echo "  Compiling ======> [ ./process1.f ]"
$LINK ./process1.f -o ./process1.x $MAP
chmod 0770 ./process1.x
echo "  Compiling ======> [ ./proj1.f ]"
$LINK ./proj1.f -o ./proj1.x $MAP
chmod 0770 ./proj1.x
echo "  Compiling ======> [ ./proj2.f ]"
$LINK ./proj2.f -o ./proj2.x $MAP
chmod 0770 ./proj2.x
echo "  Compiling ======> [ ./subplot1.f ]"
$LINK ./subplot1.f -o ./subplot1.x $MAP
chmod 0770 ./subplot1.x
echo "  Converting ======> [ ./subplot_defmap.uuu ]"
uudecode ./subplot_defmap.uuu
chmod 0660 ./subplot_defmap.dat
echo "  Compiling ======> [ ./viewpt1.f ]"
$LINK ./viewpt1.f -o ./viewpt1.x $MAP
chmod 0770 ./viewpt1.x
echo "  Compiling ======> [ ./viewpt2.f ]"
$LINK ./viewpt2.f -o ./viewpt2.x $MAP
chmod 0770 ./viewpt2.x
echo "
 
  All demo programs have been compiled.
 "
Proceed="No"
while [ "\$Proceed" = "No" ]
do
echo "
 
  Delete demo program source?
  ( Y or N )
 "
read answer
if [ "\$answer" = "y" ]; then
  Proceed="Yes"
  echo "
  All demo programs are being deleted"
  rm ./*.f
  rm ./*.uuu 2>/dev/null
  rm ./*.INC 2>/dev/null
else
  if [ "\$answer" = "Y" ]; then
    Proceed="Yes"
    echo "
  All demo programs are being deleted"
    rm ./*.f
    rm ./*.uuu 2>/dev/null
    rm ./*.INC 2>/dev/null
  fi
fi
if [ "\$answer" = "n" ]; then
  Proceed="Yes"
else
  if [ "\$answer" = "N" ]; then
    Proceed="Yes"
  fi
fi
echo "  <CR> to Continue"
read answer
done
STOP_CAT
chmod 770 ./compile
cat <<"STOP_CAT"> ./run_demo
(tput) 1>/dev/null 2>&1
if [ $? = 1 ]; then
  CLEAR="clear"; export CLEAR
else
  CLEAR="tput clear"; export CLEAR
fi
$CLEAR
echo "
                    Object Access
            Programmer's Reusable Library
                        MAP
 

 
  PRL-MAP demonstration programs. These programs
  test and demonstrate the capabilities of the
  PRL-MAP library.
 
  <CR> to Continue"
read answer
while [ 1 -eq 1 ]; do
$CLEAR
echo "
 Select Demo Program
 ===================
   1 ./_map.tk       2 ./curve2d1      3 ./device1       4 ./frame1             
   5 ./grid1         6 ./grid2         7 ./map1          8 ./mapdata1           
   9 ./origin1      10 ./page1        11 ./page2        12 ./plot2d1            
  13 ./prl1         14 ./process1     15 ./proj1        16 ./proj2              
  17 ./subplot1     18 ./viewpt1      19 ./viewpt2                              
 
   x. Exit, delete demo executables
   s. Exit, save demo executables"
read answer
$CLEAR
case "$answer" in
  "x") rm ./*.o ./*.x ./*.tk ./*.dat ./*.inp 2>/dev/null; break;;
  "s") rm ./*.o 2>/dev/null; break;;
  1) wish -f ./_map.tk;;
  2) ./curve2d1.x;;
  3) ./device1.x;;
  4) ./frame1.x;;
  5) ./grid1.x;;
  6) ./grid2.x;;
  7) ./map1.x;;
  8) ./mapdata1.x;;
  9) ./origin1.x;;
 10) ./page1.x;;
 11) ./page2.x;;
 12) ./plot2d1.x;;
 13) ./prl1.x;;
 14) ./process1.x;;
 15) ./proj1.x;;
 16) ./proj2.x;;
 17) ./subplot1.x;;
 18) ./viewpt1.x;;
 19) ./viewpt2.x;;
  *) echo "Invalid Choice
 
  <CR> to Continue"
read answer;;
esac
done
$CLEAR
echo "
                    Object Access
            Programmer's Reusable Library
                        MAP
 

 
       For more information contact:
 
         Object Access
         2023 Leisure Lane
         League City, TX  77573
 
         e-mail:   oa@iah.com
         homepage: http://www.iah.com/oa
         phone:    713-332-7281, 713-554-7617
 
 "
STOP_CAT
chmod 770 ./run_demo
if [ "$SYSID" = "" ]; then
$CLEAR
echo "
                    Object Access
            Programmer's Reusable Library
                        MAP
 

  If you had selected a supported system, the demos
  would be installed automatically now.  Since you
  did not, you must perform the following procedures
  to complete the demo installation:
 
  1. Compile the demo programs using the FORTRAN command
     for your system, or by executing the 'compile' 
     script by typing its name.
 
  2. Execute the demo programs by typing 'run_demo'
 
  "
else
$CLEAR
echo "
                    Object Access
            Programmer's Reusable Library
                        MAP
 

  All files required to run the demo programs are
  prepared.  If you wish to continue, press ENTER.
  To stop and continue manually, type any character
  and press ENTER.
 
  <CR> to Continue"
read answer
$CLEAR
if [ "$answer" = "" ]; then
  ./compile
  rm ./compile
  ./run_demo
else
$CLEAR
echo "
                    Object Access
            Programmer's Reusable Library
                        MAP
 

  If you had elected to proceed, the demos
  would be installed automatically now.  Since you
  did not, you must perform the following procedures
  to complete the demo installation:
 
  1. Compile the demo programs using the FORTRAN command
     for your system, or by executing the 'compile' 
     script by typing its name.
 
  2. Execute the demo programs by typing 'run_demo'
 
  "
fi
fi
