From:	CSBVAX::MRGATE!vtcf@ncsc.ARPA@SMTP 13-APR-1988 03:59
To:	ARISIA::EVERHART
Subj:	SWING 4 OF 13


Received: from ncsc.ARPA by KL.SRI.COM with TCP; Mon 11 Apr 88 08:36:41-PDT
Received: by ncsc.ARPA id AA02833; Mon, 11 Apr 88 10:27:37 CST
Date: Mon, 11 Apr 88 10:27:37 CST
From: vtcf@ncsc.ARPA (Williams)
Message-Id: <8804111627.AA02833@ncsc.ARPA>
To: info-vax@kl.sri.com
Subject: SWING 4 OF 13

$Part04:
$ File_is="SWING_1.FOR"
$ Check_Sum_is=1560876271
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X*=======================================================================
X*     
X*  Title:        SWING
X*                
X*  Version:      1-001
X
X*  Abstract:     SWING is a VMS utility for displaying and manipulating
X*                VMS directory trees.
X*                
X*  Environment:  VMS
X*                
X*  Author:       Eric Andresen of General Research Corporation
X*                
X*  Date:         24-SEP-1986 
X*                
X*-----------------------------------------------------------------------
X*
X*  Modified and
X*  Expanded by:  Craig Young of Hughes Aircraft Company
X*                
X*  Additions:    The main addition was the FILER and all the subroutines
X*                which support it.  The DCL Command option was added to
X*                the SWING command menu.  Changes were made to subroutine
X*                Load_Nodes to support '<' and '>' as directory indica-
X*                tors, to allow the Master file directory as the root
X*                directory and to allow the START qualifier.
X*
X*  Date:         3-AUG-1987
X*                
X*  Modified and
X*  Expanded by:  E.H. Perkins of Alberta Research Council 
X*
X*                -Put Filer in top level command
X*                -included SWING_TABLES to make swing into a 
X*                 symbol command .... swing:== $disc:[?]swing.exe
X*                -modified delete responce so no return is needed
X*                -allowed <return> as exit from swing
X*                -put SWING_SAVE in as logical where save file is
X*                 saved (code from Michael Bednarek) 
X*                -made modification to file length in print file
X*                 as suggested by F. Bonzanigo of ETH, ZURICH
X*                -removed directories from FILER screen
X*                
X*  Date:         August/Sept-1987
X*                
XC The following changes were sent over INFO-VAX by URS at ETH Zuerich, 
XC                                         CS Department, Switzerland
XC                                  UUCP: ...!seismo!mcvax!cernvax!ethz!zu 
XC and included by EHP, ARC
XC                                                              
XC`009- in a pulldown menu (e.g. the option menu) you can use the first
XC`009  letter of a command to invoke it
XC`009- in the FILER you can use the following keys:
XC`009`009t - go to first file (top)
XC`009`009b - go to last file (bottom)
XC`009`009prev.screen - scroll backward one screen of files
XC`009`009forw.screen - scroll forward one screen of files
XC
XC`009`009For VT100s which don't have prev.screen and forw.screen,
XC`009`009respectively, you can use <ctrl>B and <ctrl>F instead.
XC
XC`009- the file SWING.LIS now gets printed directly with the same command
XC`009  as to print a file and is deleted afterwards.
XC`009- in pulldown mode, if you work with the cursor keys, you now have
XC`009  wrap-around (go from last to first entry and vice versa).
XC
XC I also corrected a error which occured when you chose the Option command
XC and then hit the cursor right or cursor left key while not being in pull-
XC down mode (activated by <ctrl>P).
XC
XC The following was sent over the net 
XC
X
X*  Modified by:  Lin A Winterowd of Fermilab
X*
X*  Changes:      Modified  DRAW_SCREEN  to correct initial screen layout
X*                positioning error; and FIND_NODE to  limit  search  for 
X*                directory  created  outside  of  SWING  and  not  SAVED 
X*                (causing arithmetic trap on DELETE operation).
X*
X*                Included a new subroutine to update the stack if 
X*                the Dale Coys version of SD is used.
X
XC   Frank J. Nagy <nagy%warner.hepnet@lbl.gov> set modifications to
XC                subroutine HARDCOPY and RENAME_DIRECTORY
X                      
X*                
XC Federico Bonzanigo, ETH Zuerich, bonzanigo@nimbus.ethz.ch (earn)
XC                send over the net changes to LOAD_NODES to avoid
XC                puting "." in save file names when using /START
XC                and also suggested main*50 in SWING.CMN be changed
XC                to main*100 
XC                Done, 17/Feb/88.  EHP
X*-----------------------------------------------------------------------
X
X      program swing
X
X      include 'swing.cmn'
X      include '($smgdef)'
X
X      integer    ii, jj, istat
X      integer    ikey, old_level, old_line, isave, code, code_type
X      integer    smg$create_virtual_display
X      logical    crt, finished
X      character  key, choice*(PD_MAX_CHOICE_LEN)
XC
XC     Integer ehpcod added by EH Perkins, Aug 16, 1987
XC
X      integer    ehpcod
X
X      if ( .not. crt() ) 
X     .   call print_message( 'You must use a DEC CRT terminal', 1 )
X
X      call define_paste_board
X         
Xc     CREATE THE WINDOWS
X
X      istat = smg$create_virtual_display(  1, 132, window1 )
X      istat = smg$create_virtual_display(  MAX_LINES, 132, window2 )
X      istat = smg$create_virtual_display(  2, 132, window3 )
X      istat = smg$create_virtual_display(  12, 25, file_window )
X      call smg$set_display_scroll_region(  file_window )
X      istat = smg$create_virtual_display(  15, 70, DCL_window )
X      call smg$set_display_scroll_region(  DCL_window )
X
X      call load_nodes
X      call define_smg_layout
X      call load_display
X      call draw_screen
X
X      proc_created = 0
X            
X      do while ( .not. finished ) 
X
X         call smg$read_keystroke( keyboard, ikey )
X
X         call print_message( ' ', 0 )
X
X         old_line = cur_line
X         old_level = cur_level
X         old_rend = node(node_num).rend 
X
X         code_type = 0
X         code = 0
X
X         if ( ikey .eq. smg$k_trm_do .or.
X     .        ikey .eq. smg$k_trm_ctrlp ) then
X            if ( avo ) then
X               call pd_get_choice( board_id, keyboard, width, 
X     .                             pull_choices, choice, code )
X               code_type = code / 10
X               else
X               call print_message( 'Advanced video option required', 0 )
X               end if
X            end if
X
XC
XC        ikey = q / ikey = Q / ikey = return      added by
XC                                                 EH Perkins Aug 16, 87
XC
X         if ( ikey .eq. smg$k_trm_ctrlz .or.         
X     .        ikey .eq. smg$k_trm_lowercase_x .or.
X     .        ikey .eq. smg$k_trm_uppercase_x .or.
X     .        ikey .eq. smg$k_trm_lowercase_e .or.
X     .        ikey .eq. smg$k_trm_uppercase_e .or.
X     .        ikey .eq. smg$k_trm_lowercase_q .or.
X     .        ikey .eq. smg$k_trm_uppercase_q .or.
X     .        ikey .eq. smg$k_trm_enter       .or.
X     .        ikey .eq. smg$k_trm_cr          .or.
X     .        code .eq. 91 ) then             
X            finished = .true.
X
X            else if ( ikey .eq. smg$k_trm_up ) then
X            ii = cur_level
X            jj = cur_line - 1
X            do while( jj .ge. 1 .and. node_pointer(ii,jj) .eq. 0 ) 
X               jj = jj - 1
X            end do
X            if ( jj .ge. 1 ) cur_line = jj
X            call update_screen( old_line, old_level )
X
X            else if ( ikey .eq. smg$k_trm_down ) then
X            ii = cur_level
X            jj = cur_line + 1
X            do while( node_pointer(ii,jj) .eq. 0 .and.jj .le. num_lines) 
X               jj = jj + 1
X            end do
X            if ( jj .le. num_lines ) cur_line = jj
X            call update_screen( old_line, old_level )
X
X            else if ( ikey .eq. smg$k_trm_right ) then
X            ii = cur_level + 1
X            jj = cur_line 
X            do while( node_pointer(ii,jj) .eq. 0 .and.ii.le. MAX_LEVELS) 
X               ii = ii + 1
X            end do
X            if ( ii .le. MAX_LEVELS ) cur_level = ii
X            call update_screen( old_line, old_level )
X
X            else if ( ikey .eq. smg$k_trm_left .and. 
X     .                cur_level .ge. 1 ) then
X            ii = cur_level - 1
X            jj = cur_line
X            do while( node_pointer(ii,jj) .eq. 0 .and. jj .ge. 1 ) 
X               jj = jj - 1
X            end do
X            if ( jj .ge. 1 ) then
X               cur_level = ii
X               cur_line = jj
X               end if
X            call update_screen( old_line, old_level )
X
X            else if ( ikey .eq. smg$k_trm_lowercase_b .or.
X     .                ikey .eq. smg$k_trm_uppercase_b ) then
X            ii = MAX_LEVELS
X            cur_line = num_lines
X            do while( node_pointer(ii,cur_line) .eq. 0 .and. ii .ge. 1 )
X               ii = ii - 1
X            end do
X            cur_level = ii
X            call update_screen( old_line, old_level )
X
X            else if ( ikey .eq. smg$k_trm_lowercase_t .or.
X     .                ikey .eq. smg$k_trm_uppercase_t ) then
X            cur_line = 1
X            cur_level = 0
X            call update_screen( old_line, old_level )
X
X            else if ( code_type .eq. 1 .or. 
X     .                ikey .eq. smg$k_trm_lowercase_c .or.
X     .                ikey .eq. smg$k_trm_uppercase_c ) then
X            call create_directory( code )
X
X            else if ( code_type .eq. 2 .or. 
X     .                ikey .eq. smg$k_trm_lowercase_r .or.
X     .                ikey .eq. smg$k_trm_uppercase_r ) then
X            call rename_directory( 20 ) 
X
X            else if ( code_type .eq. 3 .or. 
X     .                ikey .eq. smg$k_trm_lowercase_m .or.
X     .                ikey .eq. smg$k_trm_uppercase_m ) then
X            call rename_directory( 30 ) 
X                 
X            else if ( code_type .eq. 4 .or. 
X     .                ikey .eq. smg$k_trm_lowercase_d .or.
X     .                ikey .eq. smg$k_trm_uppercase_d ) then
X            call delete_directory( code )
X
X            else if ( code_type .eq. 5 .or. 
X     .                ikey .eq. smg$k_trm_lowercase_p .or.
X     .                ikey .eq. smg$k_trm_uppercase_p ) then
X            call hardcopy( code )
X
X            else if ( code_type .eq. 6 .or. 
X     .                ikey .eq. smg$k_trm_lowercase_s .or.
X     .                ikey .eq. smg$k_trm_uppercase_s ) then
X            call record_structure( .true. )
X
X            else if ( code_type .eq. 7 .or. 
X     .                ikey .eq. smg$k_trm_lowercase_o .or.
X     .                ikey .eq. smg$k_trm_uppercase_o ) then
X            call change_options( code )
X
X            else if ( code_type .eq. 8 .or. 
X     .                ikey .eq. smg$k_trm_pf2 .or.
X     .                ikey .eq. smg$k_trm_help .or.
X     .                ikey .eq. smg$k_trm_lowercase_h .or.
X     .                ikey .eq. smg$k_trm_uppercase_h ) then
X            call help( code )
X
XC
XC          Filer option added at the main level by EH Perkins Aug 16, 1987
XC
X            else if ( code_type .eq. 10 .or.
X     .                ikey .eq. smg$k_trm_lowercase_f .or.
X     .                ikey .eq. smg$k_trm_uppercase_f ) then
X            ehpcod = 73
X            call change_options( ehpcod )
X
X            end if
X
X         call smg$set_cursor_abs( window2, cur_line, cur_level*17+1 )
X                                       
X      end do
X
X      call exit_swing
X      end
$ GoSub Convert_File
$ Goto Part05
