1 !***************************************************************& ! & ! & ! R E F O R M A T T I N G P R O G R A M & ! & ! & ! & ! Program: FORMAT.B2S & ! Edit Level: V1.6 & ! Edit Date: 18-OCT-79 & ! Author: Tom Benson & ! & ! Modified 23-Sep-80 by Phil Stephensen-Payne & ! to allow lines greater than 512 chars and to & ! output a new line when FF is detected. & !***************************************************************& & ON ERROR GOTO 19000 11 !***************************************************************& ! & ! & ! C O P Y R I G H T & ! & ! & ! & ! (C) Copyright 1977, 1978, 1979 & ! Digital Equipment Corporation, Maynard, Massachusetts & ! & ! This software is furnished under a license for use only & ! on a single computer system and may be copied only with & ! the inclusion of the above copyright notice. This & ! software, or any other copies thereof, may not be pro- & ! vided or otherwise made available to any other person & ! except for use on such system and to one who agrees to & ! these license terms. Title to and ownership of the & ! software shall at all times remain in DIGITAL. & ! & ! The information in this software is subject to change & ! without notice and should not be construed as a commit- & ! ment by Digital Equipment Corporation. & ! & ! DIGITAL assumes no responsibility for the use or relia- & ! bility of its software on equipment that is not sup- & ! plied by DIGITAL. & ! & !***************************************************************& 20 !***************************************************************& ! & ! & ! M O D I F I C A T I O N H I S T O R Y L O G & ! & ! & ! & ! VER/ED DATE INITIAL REASON & ! ------ ------- ------- --------------------------------& ! & ! & ! & !***************************************************************& 100 !***************************************************************& ! & ! & ! G E N E R A L D E S C R I P T I O N & ! & ! & ! This program reformats files so that the line & ! feed character denotes end of record as does & ! a carriage return/line feed combination. Files & ! already in this format are left unchanged. & ! & ! It can be used to reformat files brought from RSTS & ! to RSX, VAX, etc. on non-ANSI media so that they may & ! be used as input to the Translator. & ! & ! & ! & !***************************************************************& 300 !***************************************************************& ! & ! & ! C H A N N E L A S S I G N M E N T S & ! & ! & ! & ! Channel # Assignment & ! --------- ------------------------------- & ! 1 input file & ! 2 output file & ! & ! & !***************************************************************& 400 !***************************************************************& ! & ! & ! V A R I A B L E S A N D A R R A Y S U S E D & ! & ! & ! Name Description & ! & ! & !***************************************************************& 900 !***************************************************************& ! & ! & ! D I M E N S I O N D E C L A R A T I O N S & ! & ! & ! Lines 901-929 denote local dimension declarations & ! Lines 950-979 denote MAP statements & ! & ! & !***************************************************************& 950 MAP(OUTMAP) LNTMP$=256% 1000 !***************************************************************& ! & ! & ! M A I N P R O G R A M L O G I C & ! & ! & !***************************************************************& ! & ! & ! & 1010 LF$=CHR$(10%) \ FF$=CHR$(12%) 1050 PRINT & \ PRINT 'PDP-11 FORMAT V1.6 BL- 01.60' & \ PRINT \ PRINT 1100 INPUT 'INPUT FILE';FILE$ & \ FILE$ = EDIT$(FILE$,32%) & \ WHILE FILE$<>'' & \ EOF%=0% & \ FILE$=FILE$+'.BAS' UNLESS INSTR(1%,FILE$,'.') & \ OPEN FILE$ FOR INPUT AS FILE #1% & , ORGANIZATION SEQUENTIAL VARIABLE & , ACCESS READ, ALLOW NONE & , RECORDSIZE 1536 1110 INPUT 'OUTPUT FILE';OFILE$ & \ OFILE$ = EDIT$(OFILE$,32%) 1115 OFILE$=FILE$ IF OFILE$='' & \ OFILE$=OFILE$+'.BAS' UNLESS INSTR(1%,OFILE$,'.') & \ OPEN OFILE$ FOR OUTPUT AS FILE #2% & , ORGANIZATION SEQUENTIAL VARIABLE & , ACCESS WRITE, ALLOW NONE & , MAP OUTMAP 1120 WHILE EOF%=0% & \ INPUT LINE #1%, INLINE$ & \ BPOS%=INSTR(1%,INLINE$,LF$) & \ DPOS% = BPOS% & \ WHILE BPOS%<>0% & \ LNTMP$=LEFT$(INLINE$,BPOS%) & \ CPOS%=INSTR(1%,LNTMP$,FF$) & \ PUT #2%, COUNT CPOS% UNLESS CPOS%=0% & \ LNTMP$=RIGHT$(LNTMP$,CPOS%+1%) & \ BPOS%=BPOS%-CPOS% & \ PUT #2%, COUNT BPOS% UNLESS BPOS%=0% & \ INLINE$=RIGHT$(INLINE$,DPOS%+1%) & \ BPOS%=INSTR(1%,INLINE$,LF$) & \ DPOS% = BPOS% & \ NEXT & \ LNTMP$=INLINE$ & \ LNLEN%=LEN(INLINE$) & \ PUT #2%, COUNT LNLEN% UNLESS LNLEN%=0% & \ NEXT & \ CLOSE #2%,1% 1130 PRINT & \ INPUT 'INPUT FILE';FILE$ & \ FILE$ = EDIT$(FILE$,32%) & \ NEXT 1140 GOTO 32767 ! E N D 19000 !***************************************************************& ! & ! & ! S T A N D A R D E R R O R H A N D L I N G & ! & ! & !***************************************************************& 19100 IF ERR=11% THEN & IF ERL=1120% THEN EOF%=1% \ RESUME 1130 & ELSE IF ERL=1110% THEN OFILE$='' \ RESUME 1115 & ELSE RESUME 32767 19200 IF ERR=5% THEN & PRINT "%Can't find file or account" & \ IF ERL=1100% THEN RESUME 1130 & ELSE RESUME 1110 19300 IF ERR=2% THEN & PRINT '%Bad file specification - Please use form [#,#]NAME.EXT'& \ IF ERL=1100% THEN RESUME 1130 & ELSE RESUME 1110 19900 PRINT & \ ERR.MESSAGE$=ERT$(ERR) & \ PRINT "??Error ";ERR.MESSAGE$ & \ PRINT "in ";ERN$;" at line ";ERL & \ ERR.MESSAGE$='' & \ ERR.IND%=-1% & \ RESUME 32767 & \ & ! For all unaccounted for errors, print the line & ! and error number, as supplied by the BASIC-PLUS II & ! variables, ERR and ERL. Exit throught the END & ! statement. 32000 !***************************************************************& ! & ! & ! E N D O F P R O C E S S I N G & ! & ! & !***************************************************************& 32766 !***************************************************************& ! & ! & ! E N D O F P R O G R A M & ! & ! & !***************************************************************& 32767 END