Xref: utzoo comp.editors:2006 comp.sources.wanted:13830 comp.sys.misc:3058 comp.text:7481 Path: utzoo!attcan!uunet!wuarchive!usc!rutgers!galaxy.rutgers.edu!sugra!ken From: ken@sugra.UUCP (Kenneth Ng) Newsgroups: comp.editors,comp.sources.wanted,comp.sys.misc,comp.text Subject: Re: wanted: a reformat EXEC for XEDIT files Keywords: xedit Message-ID: <16@sugra.UUCP> Date: 27 Oct 90 19:30:46 GMT References: <1662@wjvax.UUCP> Organization: Bloomfield NJ, USA Lines: 113 In article <1662@wjvax.UUCP>, mario@wjvax.UUCP (Mario Dona) writes: : Editing on an IBM mainframe is such a pain, but sometimes that's all you : got. One of the most obvious things missing is a way to easily reformat : paragraphs written with the XEDIT editor. Has anyone figured out how to : reformat (re-align) the lines in a paragraph : so that they don't look this ugly? Check out the following, first the starting text: /* top marker */ Received: from MERCURY.CCCC.NJIT.EDU by ORION.CCCC.NJIT.EDU (Mailer R2.04) with BSMTP id 9179; Mon, 15 Oct 90 23:19:54 EDT Received: from MERCURY.CCCC.NJIT.EDU by MERCURY.CCCC.NJIT.EDU (Mailer R2.04) with BSMTP id 7944; Mon, 15 Oct 90 23:21:18 EDT Date: Mon, 15 Oct 90 23:21:18 EDT From: Network Mailer To: KEN@ORION Subject: mail delivery error /* end marker */ Batch SMTP transaction log follows: 220 MERCURY.CCCC.NJIT.EDU Columbia MAILER R2.04 BSMTP service ready. 050 HELO UWAVM.U.WASHINGTON.EDU 250 MERCURY.CCCC.NJIT.EDU Hello UWAVM.U.WASHINGTON.EDU 050 TICK 4995 250 4995 ... that's the ticket. 050 MAIL FROM: 250 ... sender OK. 050 RCPT TO: 250 ... recipient OK. 050 DATA 354 Start mail input. End with . 554-Mail not delivered to some or all recipients: 554 No such local user: BDBDB 050 QUIT 221 MERCURY.CCCC.NJIT.EDU Columbia MAILER BSMTP service done. -------------------------------------------------------------------------- Ok, now the output, the first paragraph was done without justtification, the second was done with justification: -------------------------------------------------------------------------- /* top marker */ Received: from MERCURY.CCCC.NJIT.EDU by ORION.CCCC.NJIT.EDU (Mailer R2.04) with BSMTP id 9179; Mon, 15 Oct 90 23:19:54 EDT Received: from MERCURY.CCCC.NJIT.EDU by MERCURY.CCCC.NJIT.EDU (Mailer R2.04) with BSMTP id 7944; Mon, 15 Oct 90 23:21:18 EDT Date: Mon, 15 Oct 90 23:21:18 EDT From: Network Mailer To: KEN@ORION Subject: mail delivery error /* end marker */ Batch SMTP transaction log follows: 220 MERCURY.CCCC.NJIT.EDU Columbia MAILER R2.04 BSMTP service ready. 050 HELO UWAVM.U.WASHINGTON.EDU 250 MERCURY.CCCC.NJIT.EDU Hello UWAVM.U.WASHINGTON.EDU 050 TICK 4995 250 4995 ... that's the ticket. 050 MAIL FROM: 250 ... sender OK. 050 RCPT TO: 250 ... recipient OK. 050 DATA 354 Start mail input. End with . 554-Mail not delivered to some or all recipients: 554 No such local user: BDBDB 050 QUIT 221 MERCURY.CCCC.NJIT.EDU Columbia MAILER BSMTP service done. -------------------------------------------------------------------------- Ok, this is the routine itself, please note that it is not well tested, its just something I threw together. There are probably better ways of doing it, but what do you expect to be done in an hour? Try learning more about what the REXX/XEDIT interface can do, it is *VERY* powerful, I'd say it almost approaches the capabilities of emacs. /* take from the current line till a line that has a blank in the beginning and try to format it nicely. */ signal on novalue /* get and store the starting line number */ 'EXTRACT/LINE' start_line = line.1 paragraph2format = '' /* get the stuff to format into a paragraph into a long line */ do forever 'EXTRACT/CURLINE' if curline.3 ^= '' & pos(' ', curline.3) ^= 1 then paragraph2format = paragraph2format strip(curline.3) else leave 'DOWN 1' if rc ^= 0 then leave end /* goto previous line and delete to the beginning line number */ 'UP 1' 'DEL :'start_line - 1 /* while we are not done, grab 72 characters, strip off the trucated part of the last word, and input it into editor */ do until new_line = '' parse value reverse(substr(paragraph2format,1,72)) with ' ' new_line new_line = reverse(new_line) paragraph2format = strip(substr(paragraph2format, length(new_line)+1)) /* for justified outout uncomment the following line */ new_line = justify(new_line, 72) if new_line ^= '' then 'INPUT' strip(new_line) end