[comp.os.vms] Some changes to SWING

perkins@arc.CDN (Ernie Perkins) (08/25/87)

I have found the latest swing.com to be a very useful utility, but have
made some changes.  I've included the 2 most useful of these below 
  - if using a terminal with a different screen length than a VT....
    takes advantage of the fact.
  - from a version posted to the net by Michael Bednarek, use the symbol
    SWING_SAVE to point to the directory where the save is stored
  - allow <ret> and a few other keys to exit out in the directory.

If you are customizing your version, I would suggest moving FILER into 
the top level menu, it is a lot more useful.

                    Ernie Perkins alias "der Schrumpfschluch"
 +----------------------------------------------------------------------------+
 | E.H. Perkins,                  CSNET             perkins%arc.cdn@ubc.csnet | 
 | Alberta Research Council,      MTSNET              perkins%arc.cdn@alberta | 
 | Oil Sands Research Dept.,      UUCP            ...!alberta!arc.cdn!perkins | 
 | PO Box 8330, Postal Station F, ARPA perkins%arc.cdn%ubc.csnet@relay.cs.net | 
 | Edmonton, Alberta, Canada                                                  |
 | T6H 5X2                                                                    |
 |                                                                            |
 | Voice:  (403) 464-9212          alternate bitnet: userehp@UBCMTSG          |
 | Telex:  037-2147                alternate bitnet: usertcak@UALTAMTS        |
 +----------------------------------------------------------------------------+
 |  The views expressed herein reflect my own interests, prejudices,          |
 |  misconceptions and ignorance.  When the truth is known, they are probably |
 |  incorrect. They do not necessarily reflect the views of my employers who  |
 |  have their own unique set of interests, prejudices and misconceptions.    |
 +----------------------------------------------------------------------------+

****************
****************in define_paste_board
****************
File USERS:[PERKINS.SWING.NEW_VERSION.NET_SOURCE_NEW]2.FOR;1
  486         record     /smgdef/ table
******
File USERS:[PERKINS.SWING.NEW_VERSION]2.FOR;8
  486   C
  487   C	Q and D fix to cope with strange terminal screen lengths
  488   C       Added by EH Perkins, Aug 16, 1987
  489   C
  490   	integer linest
  491   	common /length/ linest
  492   
  493         record     /smgdef/ table
************
************
File USERS:[PERKINS.SWING.NEW_VERSION.NET_SOURCE_NEW]2.FOR;1
  490         istat = smg$create_pasteboard( board_id )
  491   
******
File USERS:[PERKINS.SWING.NEW_VERSION]2.FOR;8
  497         istat = smg$create_pasteboard( board_id,,linest)  ! linest added
  498   C                                                          by EHP
  499   
************
************in delete_file
************
File USERS:[PERKINS.SWING.NEW_VERSION.NET_SOURCE_NEW]2.FOR;1
  709            call smg$read_string( keyboard, string,
  710        .                         'Enter YES to delete this file: ',
  711        .                         ,,,,len_string,, window3 )
  712            call str$upcase( string, string )
******
File USERS:[PERKINS.SWING.NEW_VERSION]2.FOR;8
  734   C
  735   C        Call to smg$read_string changed from
  736   C     .                         ,,,,len_string,, window3 )
  737   C        to
  738   C     .                        3,,,,len_string,, window3 )
  739   C        so it is the same as the delete node confirmation.
  740   C
  741   C        EH Perkins Aug 16, 1987
  742   C
  743            call smg$read_string( keyboard, string,
  744        .                         'Enter YES to delete this file: ',
  745        .                        3,,,,len_string,, window3 )
  746            call str$upcase( string, string )
************

DIFFERENCES /IGNORE=()/MERGED=1/OUTPUT=USERS:[PERKINS.SWING.NEW_VERSION.NET_SOURCE_NEW]2.DIF;1-
    USERS:[PERKINS.SWING.NEW_VERSION.NET_SOURCE_NEW]2.FOR;1-
    USERS:[PERKINS.SWING.NEW_VERSION]2.FOR;8

************
************in draw_screen
************
File USERS:[PERKINS.SWING.NEW_VERSION.NET_SOURCE_NEW]3.FOR;1
   74   
   75         integer    ii, jj, kk, smg$change_pbd_characteristics
******
File USERS:[PERKINS.SWING.NEW_VERSION]3.FOR;7
   74   C
   75   C	To cope with strange terminal screen lengths
   76   C        19 --- > linest - 5
   77   C        20 --- > linest - 4 
   78   C        23 --- > linest - 1
   79   C
   80   C
   81   C       Added by EH Perkins, Aug 16, 1987
   82   C
   83   
   84   	integer linest
   85   	common /length/ linest
   86                    
   87         integer    ii, jj, kk, smg$change_pbd_characteristics
************
************
File USERS:[PERKINS.SWING.NEW_VERSION.NET_SOURCE_NEW]3.FOR;1
   82         call smg$paste_virtual_display( window3, board_id, 23, 1 )
   83   
******
File USERS:[PERKINS.SWING.NEW_VERSION]3.FOR;7
   94         call smg$paste_virtual_display( window3, board_id, 
   95        .                                (linest - 1), 1 )
   96   
************
************
File USERS:[PERKINS.SWING.NEW_VERSION.NET_SOURCE_NEW]3.FOR;1
   89         bottom_line = 20
   90   
******
File USERS:[PERKINS.SWING.NEW_VERSION]3.FOR;7
  102         bottom_line = (linest - 4)
  103   
************
************
File USERS:[PERKINS.SWING.NEW_VERSION.NET_SOURCE_NEW]3.FOR;1
   98            top_line = cur_line - 19
   99            bottom_line = cur_line
  100            call smg$move_virtual_display( window2, board_id, 
  101        .                                  23 - cur_line, 1 )
  102            else if ( cur_line .lt. top_line ) then
  103            top_line = cur_line
  104            bottom_line = cur_line + 19
  105            call smg$move_virtual_display( window2, board_id, 
******
File USERS:[PERKINS.SWING.NEW_VERSION]3.FOR;7
  111            top_line = cur_line - (linest - 5)
  112            bottom_line = cur_line
  113            call smg$move_virtual_display( window2, board_id, 
  114        .                                  (linest - 1) - cur_line, 1 )
  115            else if ( cur_line .lt. top_line ) then
  116            top_line = cur_line
  117            bottom_line = cur_line + (linest - 5)
  118            call smg$move_virtual_display( window2, board_id, 

************
************in load_nodes
************
File USERS:[PERKINS.SWING.NEW_VERSION.NET_SOURCE_NEW]3.FOR;1
  670         do ii = 1, MAX_LINES
******
File USERS:[PERKINS.SWING.NEW_VERSION]3.FOR;7
  683         integer*4 lib$sys_trnlog, lTR 			! added to allow
  684         character TR*255					! swing_save to
  685                                                           ! be used
  686   
  687         do ii = 1, MAX_LINES
************
************
File USERS:[PERKINS.SWING.NEW_VERSION.NET_SOURCE_NEW]3.FOR;1
  734         ii = 0
  735         if ( .not. update .and. lib$find_file( main(1:len_main)//
******
File USERS:[PERKINS.SWING.NEW_VERSION]3.FOR;7
  750   C Stolen from a version posted by Michael Bednarek ....
  751   ! Create a file name for the save file 
  752   ! The rationale behind this is that I don't want to write the 
  753   ! SWING.SAV file into other users' directories.
  754   ! If the logical name SWING_SAVE exists,
  755   
  756   	If (LIB$SYS_TRNLOG('SWING_SAVE',lTR,TR,,,%VAL(0)).eq.1) then
  757   	  main(1:len_main+10)='SWING_SAVE:'//main(2:len_main-1)//'_'
  758   	  len_main=len_main+10
  759   	End If
  760   
  761         ii = 0     
  762         if ( .not. update .and. lib$find_file( main(1:len_main)//
************

DIFFERENCES /IGNORE=()/MERGED=1/OUTPUT=USERS:[PERKINS.SWING.NEW_VERSION.NET_SOURCE_NEW]3.DIF;1-
    USERS:[PERKINS.SWING.NEW_VERSION.NET_SOURCE_NEW]3.FOR;1-
    USERS:[PERKINS.SWING.NEW_VERSION]3.FOR;7


************
************in show_files
************
File USERS:[PERKINS.SWING.NEW_VERSION.NET_SOURCE_NEW]5.FOR;1
  611        .        code .eq. 181 ) then
******
File USERS:[PERKINS.SWING.NEW_VERSION]5.FOR;13
  614        .        ikey .eq. smg$k_trm_lowercase_x .or.
  615        .        ikey .eq. smg$k_trm_uppercase_x .or.
  616        .        ikey .eq. smg$k_trm_ctrlz       .or.         
  617        .        code .eq. 181 ) then
************
************
File USERS:[PERKINS.SWING.NEW_VERSION.NET_SOURCE_NEW]5.FOR;1
  785        .        ikey .eq. smg$k_trm_enter .or.
  786        .        code .eq. 91 ) then
  787               finished = .true.
******
File USERS:[PERKINS.SWING.NEW_VERSION]5.FOR;13
  799        .        ikey .eq. smg$k_trm_lowercase_q .or.
  800        .        ikey .eq. smg$k_trm_uppercase_q .or.
  801        .        ikey .eq. smg$k_trm_enter       .or.
  802        .        ikey .eq. smg$k_trm_cr          .or.
  803        .        code .eq. 91 ) then             
  804               finished = .true.
************
************
************in program swing
************
File USERS:[PERKINS.SWING.NEW_VERSION.NET_SOURCE_NEW]5.FOR;1
  984   
******
File USERS:[PERKINS.SWING.NEW_VERSION]5.FOR;13
 1011   C
 1012   C	To cope with strange terminal screen lengths
 1013   C        19 --- > lenest - 5
 1014   C        23 --- > lenest - 1
 1015   C
 1016   C       Added by EH Perkins, Aug 16, 1987
 1017   C
 1018   
 1019   	integer linest
 1020   	common /length/ linest
 1021   
************
************
File USERS:[PERKINS.SWING.NEW_VERSION.NET_SOURCE_NEW]5.FOR;1
 1004               call smg$move_virtual_display( window2, board_id,23-ii,1)
 1005            end do
 1006            top_line = cur_line - 19
 1007            bottom_line = cur_line
******
File USERS:[PERKINS.SWING.NEW_VERSION]5.FOR;13
 1041               call smg$move_virtual_display( window2, board_id,
 1042        .                                    (linest - 1)-ii,1)
 1043            end do                
 1044            top_line = cur_line - (linest - 5)
 1045            bottom_line = cur_line
************
************
File USERS:[PERKINS.SWING.NEW_VERSION.NET_SOURCE_NEW]5.FOR;1
 1014            bottom_line = cur_line + 19
 1015            end if
******
File USERS:[PERKINS.SWING.NEW_VERSION]5.FOR;13
 1052            bottom_line = cur_line + (linest - 5)
 1053            end if
************

DIFFERENCES /IGNORE=()/MERGED=1/OUTPUT=USERS:[PERKINS.SWING.NEW_VERSION.NET_SOURCE_NEW]5.DIF;1-
    USERS:[PERKINS.SWING.NEW_VERSION.NET_SOURCE_NEW]5.FOR;1-
    USERS:[PERKINS.SWING.NEW_VERSION]5.FOR;13

fede@ethz.UUCP (F. Bonzanigo) (02/08/88)

Dear Swingers,

One of the changes to SWING posted by Ernie Perkins last August fails if the 
root directory is not on the top level, but is itself a subdirectory. In that 
case one or more spurious points appear in the name of the SWING.SAV file 
(this name is formed by appending "SWING.SAV" to the root directory name. In 
this way one can have various such files for different values of the /START 
qualifier). The name is therefore not a valid file name anymore and one 
obtains the ominous message "Unable to record directory structure". One 
possible correction is to add some code which changes points into underscores.
Following is a portion of the code: the lines I changed are marked with a
"!FBo". These changes have to be introduced in the subroutine LOAD_NODES
which is in the file 3.FOR.
I cannot give an output from DIFFERENCES because I have some other 
corrections and therefore the line numbers will probably not match with yours.

...............................................................................
C Stolen from a version posted by Michael Bednarek ....
! Create a file name for the save file 
! The rationale behind this is that I don't want to write the 
! SWING.SAV file into other users' directories.
! If the logical name SWING_SAVE exists,

      If (LIB$SYS_TRNLOG('SWING_SAVE',lTR,TR,,,%VAL(0)).eq.1) then
main(1:len_main+10)='SWING_SAVE:'//main(2:len_main-1)//'_'
len_main = len_main+10
do ii = 1, len_main!FBo
  if (main(ii:ii) .eq. '.')   main(ii:ii) = '_'!FBo
end do!FBo
      End If

      ii = 0
      if ( .not. update .and. lib$find_file( main(1:len_main)//
     .     'swing.sav', input, ii ) ) then

         open( unit=1, 
     .         readonly,
     .         name=main(1:len_main)//'swing.sav', 
     .         status='old',
...............................................................................

I would also recommend to make the character variable "main*50" in SWING.CMN
a little longer, e.g. to "main*100".


Federico Bonzanigo
  Institut fuer Elektronik
  Swiss Federal Institute of Technology (ETH)
  CH-8092 Zurich, Switzerland
EAN:         bonzanigo@nimbus.ethz.ch
EARN/BITNET: BONZANIGO@CZHETH5A
EUNET/UUCP:  ...!mcvax!cernvax!ethz!fede
Phone:   +41 (1) 256-5134      (+ = whatever you have to dial
Telefax: +41 (1) 251-2172       to call outside your country)
Telex:   817 379 ehhg ch

fede@ethz.UUCP (F. Bonzanigo) (02/10/88)

Dear Swingers,

something screwed the correction to SWING I posted a couple of days ago.
Following is a hopefully better version of it. The lines marked "!FBo"
have been added to the ones given by Ernie Perkins.

C Stolen from a version posted by Michael Bednarek ....
! Create a file name for the save file 
! The rationale behind this is that I don't want to write the 
! SWING.SAV file into other users' directories.
! If the logical name SWING_SAVE exists,

      If (LIB$SYS_TRNLOG('SWING_SAVE',lTR,TR,,,%VAL(0)).eq.1) then
        main(1:len_main+10)='SWING_SAVE:'//main(2:len_main-1)//'_'
        len_main = len_main+10
        do ii = 1, len_main                                       !FBo
          if (main(ii:ii) .eq. '.')   main(ii:ii) = '_'           !FBo
        end do                                                    !FBo
      End If

      ii = 0
      if ( .not. update .and. lib$find_file( main(1:len_main)//
     .     'swing.sav', input, ii ) ) then

         open( unit=1, 
     .         readonly,
     .         name=main(1:len_main)//'swing.sav', 
     .         status='old',
...............................................................................


Federico Bonzanigo
  Institut fuer Elektronik
  Swiss Federal Institute of Technology (ETH)
  CH-8092 Zurich, Switzerland
EAN:         bonzanigo@nimbus.ethz.ch
EARN/BITNET: BONZANIGO@CZHETH5A
EUNET/UUCP:  ...!mcvax!cernvax!ethz!fede
Phone:   +41 (1) 256-5134      (+ = whatever you have to dial
Telefax: +41 (1) 251-2172       to call outside your country)
Telex:   817 379 ehhg ch