From:	CSBVAX::CSBVAX::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 10-FEB-1989 07:18
To:	MRGATE::"ARISIA::EVERHART"
Subj:	VMS_SHARE (Version 6.10) 4/4


Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Thu,  9 FEB 89 11:21:13 PDT
Received: from CUNYVM.CUNY.EDU by KL.SRI.COM with TCP; Thu, 9 Feb 89 11:08:14 PST
Received: from UKACRL.BITNET by CUNYVM.CUNY.EDU (IBM VM SMTP R1.1) with BSMTP id 8548; Thu, 09 Feb 89 14:06:28 EST
Received: from RL.IB by UKACRL.BITNET (Mailer X1.25) with BSMTP id 5897; Wed,
 08 Feb 89 13:37:25 GMT
Received: from RL.IB by UK.AC.RL.IB (Mailer X1.25) with BSMTP id 5764; Wed, 08
          Feb 89 13:37:24 GM
Via:      UK.AC.KCL.CC.OAK;  8 FEB 89 13:37:13 GMT
Date:     8-FEB-1989 13:36:42 GMT
From:     UDAA055%OAK.CC.KCL.AC.UK@CUNYVM.CUNY.EDU
To:       info-vax@KL.SRI.COM
Subject:  VMS_SHARE (Version 6.10) 4/4
Sender:   JANET "UDAA055@UK.AC.KCL.CC.OAK" <UDAA055%OAK.CC.KCL.AC.UK@CUNYVM.CUNY.EDU>
Mailer:   Janet_Mailshr V3.3 (14-Dec-1988)

+-+-+-+ Beginning of part 4 +-+-+-+
X  ! Determine if a GOTO/label pair is needed for Part 1/Part 2 boundary.
X  !-
X  MOVE_VERTICAL( -1 );
X  s_x := CURRENT_CHARACTER;
X  MOVE_VERTICAL( 1 );
X  IF s_x = "$"
X  THEN
X    i_label_needed := 1;
X  ELSE
X    i_label_needed := 0;
X  ENDIF;
X
X
X  !+
X  ! Initialize the number of parts and the starting part number.
X  !-
X  i_part_num := 2;
X  i_parts := 1;
X
X
X  !+
X  ! Loop through the rest of the parts moving the text to part buffers.
X  !-
X  LOOP
X
X    !+
X    ! Move the next part into the part buffer.
X    !-
X    POSITION( b_packed );
X    EXITIF MARK( NONE ) = END_OF( b_packed );
X
X    MOVE_HORIZONTAL( -(CURRENT_OFFSET) );
X    m_part_begin := MARK( NONE );
X    __find_part_end;
X    MOVE_HORIZONTAL( -(CURRENT_OFFSET + 1) );
X    r_part := CREATE_RANGE( m_part_begin, MARK( NONE ), NONE );
X    b_part := CREATE_BUFFER( FAO( "`123Part !UL`125", i_part_num ) );
X    POSITION( b_part );
X    COPY_TEXT( FAO( s_part_begin, i_part_num ) );
X    IF i_label_needed <> 0
X    THEN
X      SPLIT_LINE;
X      COPY_TEXT( FAO( s_part_label, i_part_num ) );
X    ENDIF;
X    POSITION( END_OF( b_part ) );
X    MOVE_TEXT( r_part );
X    POSITION( END_OF( b_part ) );
X
X
X    !+
X    ! Determine if a GOTO/label pair is needed for Part n/Part n+1 boundary.
X    !-
X    MOVE_VERTICAL( -1 );
X    s_x := CURRENT_CHARACTER;
X    MOVE_VERTICAL( 1 );
X    IF ( s_x = "$" ) AND ( END_OF( r_part ) <> END_OF( b_packed ) )
X    THEN
X      __copy_text( FAO( s_part_goto, i_part_num + 1 ) );
X      i_label_needed := 1;
X    ELSE
X      i_label_needed := 0;
X    ENDIF;
X    COPY_TEXT( FAO( s_part_end, i_part_num ) );
X
X
X    i_part_num := i_part_num + 1;`009! next part
X    i_parts := i_parts + 1;
X
X  ENDLOOP;
X
X
X  !+
V  ! Now that the number of parts is known, update the number of parts in part
X 1 and move it to it's part buffer.
X  !-
X  POSITION( m_attention_text );
X  r_parts := SEARCH( "999", FORWARD );
X  ERASE( r_parts );
X  POSITION( END_OF( r_parts ) );
X  COPY_TEXT( STR( i_parts ) );
X
X  b_part := CREATE_BUFFER( "`123Part 1`125" );
X  POSITION( b_part );
X  MOVE_TEXT( b_packed );
X  POSITION( END_OF( b_part ) );
X  MOVE_VERTICAL( -1 );
X  s_x := CURRENT_CHARACTER;
X  MOVE_VERTICAL( 1 );
X
X  !+
X  ! Only insert a "$GOTO PART2"  if this part ends in some DCL code
X  !-
X  IF s_x = "$" THEN  __copy_text( FAO( s_part_goto, 2 ) );  ENDIF;
X  COPY_TEXT( FAO( s_part_end, 1 ) );
X  DELETE( b_packed );
X
X
X  !+
V  ! Loop through all of the parts setting the file name to be associated with
X that part.
X  !-
X
V  i_digits := LENGTH( STR( i_parts) );`009! Determine part size for neat form
Xat
X  i_part_num := 1;`009`009`009! Initialize part number
X
X  LOOP
X
X    EXITIF i_part_num > i_parts;`009! exit if done all parts
X
X    !+
X    !  Find next buffer and set it's output filename.
X    !-
X    b_part := __find_buffer( FAO( "`123Part !UL`125", i_part_num ) );
V    SET( OUTPUT_FILE, b_part, FAO( "!AS!#ZL_OF_!UL", s_output_file, i_digits,
X i_part_num, i_parts ) );
X
X    i_part_num := i_part_num + 1;`009! Next part
X
X  ENDLOOP;
X
XENDIF;
X
X!+
X! Create final output message buffer and fill it.
X!-
Xb_message := CREATE_BUFFER( "`123Message`125" );
XPOSITION( b_message );
V__copy_text( FAO( "SHARE-file !AS was written in !UL part!%S as follows:", s_
Xshare_file, i_parts ) );
XSET( NO_WRITE, b_message, OFF );
XSET( OUTPUT_FILE, b_message, "SYS$COMMAND" );
X
XEXIT;
X$ DELETE/NOLOG/NOCONFIRM VMS_SHARE_DUMMY.DUMMY;*
V$ DIRECTORY/DATE=CREATED/NOHEADER/SIZE=USED/VERSIONS=1/WIDTH=(FILENAME=47,SIZ
XE=4) 'SHARE_FILE'*_OF_*
X$ VERIFY = F$VERIFY( VERIFY )
$ GOSUB UNPACK_FILE

$ FILE_IS = "VMS_SHARE.HLP"
$ CHECKSUM_IS = 52493434
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X1 VMS_SHARE
XPackages a series of files into a format suitable for
Xtransmission over electronic mail networks which may mangle the
Xtext.`032
X
XFormat:
X
X     $ VMS_SHARE [filelist] [sharfile]
X2 Examples
X
X     $ VMS_SHARE *.* FRED
X          Package all files in the current directory and create a
X          series of archive files of the form FRED.nn_OF_mm
X
X     $ VMS_SHARE TWEE.* TWEE.SHAR
X          Package all files with a filename of TWEE and create a
X          series of archive files of the form TWEE.SHARnn_OF_mm
X2 Filelist
XA list of files which make up the overall package. The list`032
Xshould be comma separated and may contain wildcards.
X
XThere is no default. A prompt is issued if no files are
Xspecified.`032
X2 Logical_Names
XSome logical names may be defined to control the operation of`032
XVMS_SHARE.
X3 SHARE_DISPLAY
XIf defined as 1 or TRUE, causes all TPU messages to be sent to`032
XSYS$OUTPUT.  Primarily intended for debugging.
X
XIt is a subset of the function of the SHARE_VERIFY logical name.
X3 SHARE_MAX_PART_SIZE
XThe translation of this logical name should be an integer value`032
Xgreater than 8 and defines the maximum size, in blocks, of one`032
Xpart of the generated share file(s).  This is to allow the sizes`032
Xto be tailored for mailers that refuse to pass files larger than`032
Xa certain number of blocks.
X
XExample:
X     $ DEFINE SHARE_MAX_PART_SIZE 60
X
XIf no logical name is defined or it is not an integer greater`032
Xthan 8, then a default size of 31 blocks is selected.
X3 SHARE_REAL_NAME
XThe translation of this logical name is included in brackets at`032
Xthe head of the generated share file to indicate the real name of`032
Xthe user.
X
XExample:
X     $ DEFINE SHARE_REAL_NAME "Fred Bloggs, Petunia Institute"
X
XIf no,logical name is defined, then no 'real name' is included in`032
Xthe share file header.
X
X3 SHARE_VERIFY
XThe translation of this logical name is used as an argument to`032
Xthe lexical function   f$verify   and allows a user with READ`032
Xaccess to the procedure to turn on tracing. This is primarily`032
Xused for debugging.
X
XExample:
X     $ DEFINE SHARE_VERIFY 1
X
XIf no logical name is defined then verification is OFF,`032
Xregardless of any current setting of the verify flag in DCL.`032
X2 Notes
XThe output is one or more text files containing the original code
Xin a self-unpacking text archive.  If more than one part is
Xproduced then to unpack, all parts must be concatenated in order
Xand executed as a command procedure.`032
X
XCertain aspects of the text are encoded to ensure that the
Xcontents is not mangled along the route. In particular,
Xcharacters outside the ascii range are escaped as are certain
Xprintable ascii characters, like tilde. This is automatically
Xdecoded whn the file is unpacked.  A checksum is used to ensure
Xthat the receiving contents are right. At least, you are warned
Xif they are NOT right!`032
X2 Sharfile
XThe name of the package file to be created.  In general, a series
Xof files are produced suffixed by 'nn_OF_mm'.  The specified name
Xwill be used with this suffix added to the file type.`032
$ GOSUB UNPACK_FILE

$ FILE_IS = "VMS_SHARE.RELEASE_NOTES"
$ CHECKSUM_IS = 1399279468
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
XVMS_SHARE  6.10`009`009`009`009`0097-FEB-1989
X
X
X6.10 - UPDATES SINCE 6.08
X-------------------------
X
XNew Features:
X   - Allow a new logical name to be defined: SHARE_DISPLAY. This is a subset
X     of the function of SHARE_VERIFY in that it turns on tracing but only
X     for messages generated by TPU. messages are sent to SYS$OUTPUT. It
X     does NOT echo lines of DCL code or TPU code used within VMS_SHARE.
X     Its primary function is debugging VMS_SHARE itself.
X
X
XBug Fixes:
X   - VMS_SHARE now works with VMS5. Due to changes in the way TPU dealt
X     with pattern searching, VMS_SHARE looped indefinately trying to
X     find a split point in a long line.
X
X   - A spurious blank line was inserted into the DCL control commands of
X     VMS_SHARE. Under VMS4 this was ignored. Under VMS5, lines not starting
X     with $ are rejected.  This blank line no longer appears.
X
X
XModifications:
X   - Made use of an error handler in the QUOTE_BUFFER procedure to
X     avoid an unwanted error message when SEARCH does not match at
X     the end of the buffer. When VMS 5 is more widespread, this will
X     be altered to use the SEARCH_QUIETLY procedure.
X
X   - Modifed the names of several local variables to avoid conflicts
X     with global variables pointed out by the VMS 5 TPU compiler. They
X     were not wrong originally but they've been fixed to 'clean' up the
X     code.
X
X   - VMS_SHARE now used a combination of STR and LENGTH functions to
V     determine the number of digits in a number. Previously this was a long`0
X32
X     chain of nested IFs.
X
X
X
X6.08 - UPDATES SINCE 6.06A
X--------------------------
X
XNew features:
X   - PAKMAIL enhanced to accept an extra parameter (P4) to allow inclusion
X     of a comment in the MAIL /subject header.
X
XModifications:
X   - PAKMAIL now returns the correct exit status code to allow for error
X     checking following return from the procedure.
X
X
X
X6.07 - UPDATES SINCE 6.06A
X--------------------------
X
XModifications:
X   - Code to deal with file input rewrittem so that
X        o One file at a time read and processed
X        o Less buffer space used overall
X        o Commoned up two similar sets of code
X
X
X
X6.06A - UPDATES SINCE 6.06
X-------------------------
X
XModifications:
X   - Changed max line length to 77 as some mailers object to longer lines
X
X
X6.06 - UPDATES SINCE 6.03
X-------------------------
X
XNew features:
X   - Allows definition of logical names to define some options:
X       o max part size
X       o verification (for code debugging only)
X       o real name definition (previously a symbol was used)
X   - Includes a new procedure (PAKMAIL) which allows easy distribution
X     of the various parts of a VMS_SHARE'd package to the network via
X     E-Mail.
X   - Help file for both VMS_SHARE and PAKMAIL
X
X
XBug Fixes:
X   - Added missing parameter to FAO to get correct date in file header.
X   - Loop constructing ASCII codes was off-by-1.  '255' now escaped properly.
X   - Shortened a DCL LINE in the preamble which was longer than 80 chars.
X   - Fixed some stuff relating to infinite loops when dealing with blanks.
X
XMiscellaneous Mods:
X   - Improved packing algorithm to get the initial TPU code in.
X   - Simplified code via procedures
X   - Various minor speedups of the packing stuff.
X   - More comments added!
X
X
VI'll be happy to try to incorporate further mods if details are sent to me.`0
X32
Vparticularly in the area of speeding up the various pack/unpack algorithms`03
X2
Xused - I find these horrendously slow when processing large'ish packages!
X
XAndy Harper
XKings College London UK
$ GOSUB UNPACK_FILE
$ EXIT
-+-+-+-+-+ End of part 4 +-+-+-+-+-

