[comp.os.vms] Fix for SWING Print option failures

nagy%warner.hepnet@LBL.GOV (Frank J. Nagy, VAX Wizard & Guru) (01/31/88)

> Just had a crash out of Swing...tried the Print option, it wrote some line
> that was about copying to disk file or something, then I got an arithematic
> trap in procedure hardcopy.
     
The following VMS_SHAR file contains a new copy of HARDCOPY.FOR which
fixes the above problem.


= Frank J. Nagy   "VAX Guru & Wizard"
= Fermilab Research Division EED/Controls
= HEPNET: WARNER::NAGY (43198::NAGY) or FNAL::NAGY (43009::NAGY)
= BitNet: NAGY@FNAL
= USnail: Fermilab POB 500 MS/220 Batavia, IL 60510


...................... Cut between dotted lines and save ......................
$!..............................................................................
$! VAX/VMS archive file created by VMS_SHAR V-5.01 01-Oct-1987
$! which was written by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au)
$! To unpack, simply save and execute (@) this file.
$!
$! This archive was created by NAGY
$! on Saturday 30-JAN-1988 13:10:55.36
$!
$! It contains the following 1 file:
$! HARDCOPY.FOR
$!==============================================================================
$ Set Symbol/Scope=(NoLocal,NoGlobal)
$ Version=F$GetSYI("VERSION") ! See what VMS version we have here:
$ If Version.ges."V4.4" then goto Version_OK
$ Write SYS$Output "Sorry, you are running VMS ",Version, -
                ", but this procedure requires V4.4 or higher."
$ Exit 44
$Version_OK: CR[0,8]=13
$ Pass_or_Failed="failed!,passed."
$ Goto Start
$Convert_File:
$ Read/Time_Out=0/Error=No_Error1/Prompt="creating ''File_is'" SYS$Command ddd
$No_Error1: Define/User_Mode SYS$Output NL:
$ Edit/TPU/NoSection/NoDisplay/Command=SYS$Input/Output='File_is' -
        VMS_SHAR_DUMMY.DUMMY
f:=Get_Info(Command_Line,"File_Name");b:=Create_Buffer("",f);
o:=Get_Info(Command_Line,"Output_File");Set(Output_File,b,o);
Position(Beginning_of(b));Loop x:=Erase_Character(1);Loop ExitIf x<>"V";
Move_Vertical(1);x:=Erase_Character(1);Append_Line;
Move_Horizontal(-Current_Offset);EndLoop;Move_Vertical(1);
ExitIf Mark(None)=End_of(b) EndLoop;Position(Beginning_of(b));Loop
x:=Search("`",Forward,Exact);ExitIf x=0;Position(x);Erase_Character(1);
If Current_Character='`' then Move_Horizontal(1);else
Copy_Text(ASCII(INT(Erase_Character(3))));EndIf;EndLoop;Exit;
$ Delete VMS_SHAR_DUMMY.DUMMY;*
$ Checksum 'File_is
$ Success=F$Element(Check_Sum_is.eq.CHECKSUM$CHECKSUM,",",Pass_or_Failed)+CR
$ Read/Time_Out=0/Error=No_Error2/Prompt=" CHECKSUM ''Success'" SYS$Command ddd
$No_Error2: Return
$Start:
$ File_is="HARDCOPY.FOR"
$ Check_Sum_is=322589694
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X      subroutine hardcopy( code )
X
X      include    'swing.cmn'
X      include    '($smgdef)'
X
X      integer    column, num, ii, jj, level, ikey, start, end, len
X      integer    code, ll, kk
X      character  hard_node*12, dashes*12, out_line(MAX_LINES)*132
X      character  one_line*200
X
X      data dashes / '------------' /
X
X      open( unit=1,
X     .      name='swing.lis',
X     .      carriagecontrol='list',
X     .      status='new',
X     .      err=99 )
X
X      call print_message( 'Creating hardcopy listing in SWING.LIS', 0 )
X
X      last_level = 1
X      line = 0
X      do ii = 0, MAX_LEVELS
X         last_line(ii) = 1
X      end do
X      do ii = 1, num_lines
X         out_line(ii) = ' '
X      end do
X
X      do jj = 1, num_lines
X         do level = 0, MAX_LEVELS
X            if ( node_pointer(level,jj) .ne. 0 ) then
X               num = node_pointer(level,jj)
X
X               column = level * 17 + 1
X               line = node(num).line
X
X               call str$trim( hard_node, node(num).name, len )
X               if ( level .lt. 7 ) then
X                  if (( node_pointer(level+1,jj) .ne. 0 ) .and. (len .lt. 12))
X     .               hard_node = hard_node(1:len)//dashes(len+1:12)
X                  end if
X
X               out_line(line)(column:column+11) = hard_node
X               if ( level .gt. 0 ) then
X                  out_line(line)(column-3:column-1) = '---'
X
X                  if ( level .le. last_level ) then
X                     out_line(line)(column-3:column-3) = '+'
X                     if ( out_line(line-1)(column-3:column-3) .eq. '+' )
X     .                  out_line(line-1)(column-3:column-3) = '|'
X
X                     else if ( level .eq. last_level + 1 ) then
X                     out_line(line)(column-5:column-2) = '----'
X                     end if
X
X                  if ( level .lt. last_level ) then
X                     if ( out_line(last_line(level))(column-3:column-3)
X     .                    .eq. '+' ) then
X                        ll = last_line(level)
X                        else
X                        ll = last_line(level) + 1
X                        end if
X                     do kk = ll, line-1
X                        out_line(kk)(column-3:column-3) = '|'
X                     end do
X                     end if
X                  end if
X
X               last_level = level
X               last_line(level) = line
X               end if
X         end do
X      end do
X
X      do ii = 1, num_lines
X         call str$trim( out_line(ii), out_line(ii), len )
X         write( 1, 100 ) out_line(ii)(1:len)
X100      format( a )
X      end do
X
X      call print_message( 'Finished creating SWING.LIS',
X     .                    0 )
X
X      close( unit=1 )
X
X      return
X
X99    call print_message( 'Unable to open file for hardcopy', 0 )
X      return
X      end
$ GoSub Convert_File
$ Exit

-------