The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] ed: multiple addresses (with semicolons)
@ 2022-07-08 13:23 Douglas McIlroy
  2022-07-08 16:01 ` [TUHS] " Ken Thompson
  2022-07-10  9:25 ` Angelo Papenhoff
  0 siblings, 2 replies; 9+ messages in thread
From: Douglas McIlroy @ 2022-07-08 13:23 UTC (permalink / raw)
  To: TUHS main list

The interpretation of a string of addresses separated by commas and/or
semicolons was already defined in the v1 man page for ed.

Ed was essentially a stripped-down version of Multics qed. The latter
was originally
written by Ken. Unfortunately the "Multics Condensed Guide" online at
multicians.org describes how strings of addresses were interpreted
only by canonical examples for the various editing requests.

I  have no specific memory of semicolons in qed. I have a vague
recollection that semicolons originated in ed, however you should put
no trust in this. Maybe Ken remembers.

Doug

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [TUHS] Re: ed: multiple addresses (with semicolons)
  2022-07-08 13:23 [TUHS] ed: multiple addresses (with semicolons) Douglas McIlroy
@ 2022-07-08 16:01 ` Ken Thompson
  2022-07-08 19:13   ` markus schnalke
  2022-07-10  9:25 ` Angelo Papenhoff
  1 sibling, 1 reply; 9+ messages in thread
From: Ken Thompson @ 2022-07-08 16:01 UTC (permalink / raw)
  To: Douglas McIlroy; +Cc: TUHS main list

[-- Attachment #1: Type: text/plain, Size: 753 bytes --]

On Fri, Jul 8, 2022 at 6:24 AM Douglas McIlroy <
douglas.mcilroy@dartmouth.edu> wrote:

> The interpretation of a string of addresses separated by commas and/or
> semicolons was already defined in the v1 man page for ed.
>
> Ed was essentially a stripped-down version of Multics qed. The latter
> was originally
> written by Ken. Unfortunately the "Multics Condensed Guide" online at
> multicians.org describes how strings of addresses were interpreted
> only by canonical examples for the various editing requests.
>
> I  have no specific memory of semicolons in qed. I have a vague
> recollection that semicolons originated in ed, however you should put
> no trust in this. Maybe Ken remembers.
>
> Doug
>
String of addresses was same for qed and ed.

[-- Attachment #2: Type: text/html, Size: 1177 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [TUHS] Re: ed: multiple addresses (with semicolons)
  2022-07-08 16:01 ` [TUHS] " Ken Thompson
@ 2022-07-08 19:13   ` markus schnalke
  2022-07-09  8:10     ` steve jenkin
  0 siblings, 1 reply; 9+ messages in thread
From: markus schnalke @ 2022-07-08 19:13 UTC (permalink / raw)
  To: tuhs

Hoi,

thanks for your replies, Doug and Ken.

Unfortunately I wasn't able to find the ``Multics Condensed Guide''
on multicians.org. Can someone please provide a link?


Interrestingly, I discovered that qed had double quotes (") as a
comment command, which simply ignores the rest of the line. As far
as I know, there's no way to comment ed scripts. Why was that
dropped?

In ex(1) the " comment command reappeared. I've always wondered
why it used this character for comments. Seems it comes from qed,
leaping over ed, but reappearing in ex.


meillo



[2022-07-08 09:01] Ken Thompson <kenbob@gmail.com>
> On Fri, Jul 8, 2022 at 6:24 AM Douglas McIlroy <douglas.mcilroy@dartmouth.edu>
> wrote:
> 
>     The interpretation of a string of addresses separated by commas and/or
>     semicolons was already defined in the v1 man page for ed.
> 
>     Ed was essentially a stripped-down version of Multics qed. The latter
>     was originally
>     written by Ken. Unfortunately the "Multics Condensed Guide" online at
>     multicians.org describes how strings of addresses were interpreted
>     only by canonical examples for the various editing requests.
> 
>     I  have no specific memory of semicolons in qed. I have a vague
>     recollection that semicolons originated in ed, however you should put
>     no trust in this. Maybe Ken remembers.
> 
>     Doug
> 
> String of addresses was same for qed and ed.
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [TUHS] Re: ed: multiple addresses (with semicolons)
  2022-07-08 19:13   ` markus schnalke
@ 2022-07-09  8:10     ` steve jenkin
  2022-07-09  8:22       ` Rob Pike
  0 siblings, 1 reply; 9+ messages in thread
From: steve jenkin @ 2022-07-09  8:10 UTC (permalink / raw)
  To: TUHS



> On 9 Jul 2022, at 05:13, markus schnalke <meillo@marmaro.de> wrote:
> 
> Unfortunately I wasn't able to find the ``Multics Condensed Guide''
> on multicians.org. Can someone please provide a link?

Couldn’t find the Condensed Guide on the Multicians site.

There was a thread on QED, October 2018
	<https://minnie.tuhs.org/pipermail/tuhs/2018-October/thread.html>

Starts here:
	<https://minnie.tuhs.org/pipermail/tuhs/2018-October/016595.html>

This message has the bitsavers link at end:
	<https://minnie.tuhs.org/pipermail/tuhs/2018-October/016613.html>

This from O.P.

	QED editor - thanks!
		<https://minnie.tuhs.org/pipermail/tuhs/2018-October/016619.html>

Tracking through the thread, there’s software & git repos.

HTH
steve

===========

On the Multician site, there was information about qedx - a reimplementation, if I read correctly.
Ken is noted as the author of QED, but no docs are linked.

Dev Docs Library
<https://multicians.org/devdoc.html>
	• AW17: Multics Commands and Active Functions pocket guide (101K, 04/01/80, posted 12/18/21)
	• AG91: Multics Programmers' Manual: Reference Guide Table of Contents (128K, 1984, posted 04/27/21)
	• Multics System Programmer's Manual Table of Contents (224K, posted 06/05/22, 838 sections, 821 online)


Early Multics Development and the MSPM
<https://multicians.org/mspmtoc.html>
	• BX.9.06 qed Text Editor, 11/15/68, K. L. Thompson


<https://multicians.org/mgq.html#qed>

QED
CTSS editor written by Ken Thompson. This  line-oriented editor was influenced by the character-oriented QED editor on the SDS-940; one of Ken's major additions was regular expression searching and substitution. Ported to Multics BCPL by Ken and Dennis Ritchie. Bob Daley then wrote Multics qedx as a less functional but faster version. Both qed and qedx are programmable: they support multiple buffers, and a user can execute the contents of a buffer containing editor commands. Doug McIlroy wrote a version of tic-tac-toe in qed. Qedx was the standard editor for most of the Multics development community throughout the 70s. Info segment for qedx command See ted.

[BSG] The qedx language was unambiguously optimized for interactive line-editing, not programming, thus writing non-trivial QEDX "macros" (programs) was a black art whose results where very ugly and non-maintainable and often bordered on black humor. Compare TECO. ted, adding many more commands, is one direction of solution. edm, having no programming language, is another. [perl, with no editing language, is another point on the scale -- THVV] Having entirely distinct command and extension languages is now almost universally considered to be the correct solution to problems of this sort (e.g., Emacs).

[THVV] A nice history of QED, its descendants, and the use of regular expressions is in  Russ Cox's article.


Russ Cox
	Regular Expression Matching Can Be Simple And Fast 
	<https://swtch.com/~rsc/regexp/regexp1.html>


qedx Info page
<https://web.mit.edu/multics-history/source/Multics/doc/info_segments/qedx.info>
	03/03/83  qedx, qx

	Syntax:  qx {-control_args} {macro_path} {macro_args}


	Function:  The qedx editor is used to create and edit ASCII segments.
	This description summarizes the editing requests and addressing
	features provided by qedx.  Complete tutorial information on qedx is
	available in the qedx Text Editor Users' Guide, Order No.  CG40.


[linked from Multician biblio page] - not QED, qedx
	<https://multicians.org/biblio.html>

MULTICS
qedx TEXT EDITOR USER'S GUIDE
	<http://www.bitsavers.org/pdf/honeywell/multics/CG40-01_qedx_Feb83.pdf>


===========

<http://www.bitsavers.org/pdf/honeywell/multics/swenson/6906.multics-condensed-guide.pdf>

Page: V1-2 Rev 2 06019

TEXT ADDRESSING

QED accepts commands and text as a stream of characters from the console.
Text within the current buffer is specified by (1) line addresses or (2) strings (regular-expressions) in the text 1 ine.

Lines in the current buffer may be addressed in the following ways:
	1. by current line number
	2. by absolute line number
	3. by the value of the current line (".")
	4. by the special character (“$”)
	5. by context
	6. by additive combinations of methods 1. to 5.

===========

--
Steve Jenkin, IT Systems and Design 
0412 786 915 (+61 412 786 915)
PO Box 38, Kippax ACT 2615, AUSTRALIA

mailto:sjenkin@canb.auug.org.au http://members.tip.net.au/~sjenkin


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [TUHS] Re: ed: multiple addresses (with semicolons)
  2022-07-09  8:10     ` steve jenkin
@ 2022-07-09  8:22       ` Rob Pike
  2022-07-10  3:50         ` Jon Forrest
  0 siblings, 1 reply; 9+ messages in thread
From: Rob Pike @ 2022-07-09  8:22 UTC (permalink / raw)
  To: steve jenkin; +Cc: TUHS

[-- Attachment #1: Type: text/plain, Size: 5196 bytes --]

Wasn't quick enough to grab a photo, but saw a car today with the license
plate reading

ED 8080

including the space.

-rob


On Sat, Jul 9, 2022 at 6:11 PM steve jenkin <sjenkin@canb.auug.org.au>
wrote:

>
>
> > On 9 Jul 2022, at 05:13, markus schnalke <meillo@marmaro.de> wrote:
> >
> > Unfortunately I wasn't able to find the ``Multics Condensed Guide''
> > on multicians.org. Can someone please provide a link?
>
> Couldn’t find the Condensed Guide on the Multicians site.
>
> There was a thread on QED, October 2018
>         <https://minnie.tuhs.org/pipermail/tuhs/2018-October/thread.html>
>
> Starts here:
>         <https://minnie.tuhs.org/pipermail/tuhs/2018-October/016595.html>
>
> This message has the bitsavers link at end:
>         <https://minnie.tuhs.org/pipermail/tuhs/2018-October/016613.html>
>
> This from O.P.
>
>         QED editor - thanks!
>                 <
> https://minnie.tuhs.org/pipermail/tuhs/2018-October/016619.html>
>
> Tracking through the thread, there’s software & git repos.
>
> HTH
> steve
>
> ===========
>
> On the Multician site, there was information about qedx - a
> reimplementation, if I read correctly.
> Ken is noted as the author of QED, but no docs are linked.
>
> Dev Docs Library
> <https://multicians.org/devdoc.html>
>         • AW17: Multics Commands and Active Functions pocket guide (101K,
> 04/01/80, posted 12/18/21)
>         • AG91: Multics Programmers' Manual: Reference Guide Table of
> Contents (128K, 1984, posted 04/27/21)
>         • Multics System Programmer's Manual Table of Contents (224K,
> posted 06/05/22, 838 sections, 821 online)
>
>
> Early Multics Development and the MSPM
> <https://multicians.org/mspmtoc.html>
>         • BX.9.06 qed Text Editor, 11/15/68, K. L. Thompson
>
>
> <https://multicians.org/mgq.html#qed>
>
> QED
> CTSS editor written by Ken Thompson. This  line-oriented editor was
> influenced by the character-oriented QED editor on the SDS-940; one of
> Ken's major additions was regular expression searching and substitution.
> Ported to Multics BCPL by Ken and Dennis Ritchie. Bob Daley then wrote
> Multics qedx as a less functional but faster version. Both qed and qedx are
> programmable: they support multiple buffers, and a user can execute the
> contents of a buffer containing editor commands. Doug McIlroy wrote a
> version of tic-tac-toe in qed. Qedx was the standard editor for most of the
> Multics development community throughout the 70s. Info segment for qedx
> command See ted.
>
> [BSG] The qedx language was unambiguously optimized for interactive
> line-editing, not programming, thus writing non-trivial QEDX "macros"
> (programs) was a black art whose results where very ugly and
> non-maintainable and often bordered on black humor. Compare TECO. ted,
> adding many more commands, is one direction of solution. edm, having no
> programming language, is another. [perl, with no editing language, is
> another point on the scale -- THVV] Having entirely distinct command and
> extension languages is now almost universally considered to be the correct
> solution to problems of this sort (e.g., Emacs).
>
> [THVV] A nice history of QED, its descendants, and the use of regular
> expressions is in  Russ Cox's article.
>
>
> Russ Cox
>         Regular Expression Matching Can Be Simple And Fast
>         <https://swtch.com/~rsc/regexp/regexp1.html>
>
>
> qedx Info page
> <
> https://web.mit.edu/multics-history/source/Multics/doc/info_segments/qedx.info
> >
>         03/03/83  qedx, qx
>
>         Syntax:  qx {-control_args} {macro_path} {macro_args}
>
>
>         Function:  The qedx editor is used to create and edit ASCII
> segments.
>         This description summarizes the editing requests and addressing
>         features provided by qedx.  Complete tutorial information on qedx
> is
>         available in the qedx Text Editor Users' Guide, Order No.  CG40.
>
>
> [linked from Multician biblio page] - not QED, qedx
>         <https://multicians.org/biblio.html>
>
> MULTICS
> qedx TEXT EDITOR USER'S GUIDE
>         <
> http://www.bitsavers.org/pdf/honeywell/multics/CG40-01_qedx_Feb83.pdf>
>
>
> ===========
>
> <
> http://www.bitsavers.org/pdf/honeywell/multics/swenson/6906.multics-condensed-guide.pdf
> >
>
> Page: V1-2 Rev 2 06019
>
> TEXT ADDRESSING
>
> QED accepts commands and text as a stream of characters from the console.
> Text within the current buffer is specified by (1) line addresses or (2)
> strings (regular-expressions) in the text 1 ine.
>
> Lines in the current buffer may be addressed in the following ways:
>         1. by current line number
>         2. by absolute line number
>         3. by the value of the current line (".")
>         4. by the special character (“$”)
>         5. by context
>         6. by additive combinations of methods 1. to 5.
>
> ===========
>
> --
> Steve Jenkin, IT Systems and Design
> 0412 786 915 (+61 412 786 915)
> PO Box 38, Kippax ACT 2615, AUSTRALIA
>
> mailto:sjenkin@canb.auug.org.au http://members.tip.net.au/~sjenkin
>
>

[-- Attachment #2: Type: text/html, Size: 7488 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [TUHS] Re: ed: multiple addresses (with semicolons)
  2022-07-09  8:22       ` Rob Pike
@ 2022-07-10  3:50         ` Jon Forrest
  0 siblings, 0 replies; 9+ messages in thread
From: Jon Forrest @ 2022-07-10  3:50 UTC (permalink / raw)
  To: tuhs



On 7/9/2022 1:22 AM, Rob Pike wrote:
> Wasn't quick enough to grab a photo, but saw a car today with the 
> license plate reading
> 
> ED 8080

This is slightly off topic but back in the 80s I saw
a license plate reading

	IEFBR14

This won't mean anything to you unless you've
used IBM software.

Jon


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [TUHS] Re: ed: multiple addresses (with semicolons)
  2022-07-08 13:23 [TUHS] ed: multiple addresses (with semicolons) Douglas McIlroy
  2022-07-08 16:01 ` [TUHS] " Ken Thompson
@ 2022-07-10  9:25 ` Angelo Papenhoff
  2022-07-10  9:59   ` Ralph Corderoy
  1 sibling, 1 reply; 9+ messages in thread
From: Angelo Papenhoff @ 2022-07-10  9:25 UTC (permalink / raw)
  To: TUHS main list

On 08/07/22, Douglas McIlroy wrote:
> Ed was essentially a stripped-down version of Multics qed. The latter
> was originally written by Ken.

Does anyone know if this version has survived? Current Multics has qedx,
but it seems to be a stripped down version of qed as well. In fact I
find Unix ed nicer to use than qedx.

And a question about pronunciation: I've heard qedx pronounced as
"queddix" and I know ed is "ee dee". What about qed?

aap

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [TUHS] Re: ed: multiple addresses (with semicolons)
  2022-07-10  9:25 ` Angelo Papenhoff
@ 2022-07-10  9:59   ` Ralph Corderoy
  0 siblings, 0 replies; 9+ messages in thread
From: Ralph Corderoy @ 2022-07-10  9:59 UTC (permalink / raw)
  To: tuhs

Hi Angelo,

> What about qed?

I've assumed it was deliberately named after ‘Q.E.D.’ and so read as
individual letters.  https://en.wiktionary.org/wiki/Q.E.D.#English

-- 
Cheers, Ralph.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [TUHS] ed: multiple addresses (with semicolons)
@ 2022-07-08  7:47 markus schnalke
  0 siblings, 0 replies; 9+ messages in thread
From: markus schnalke @ 2022-07-08  7:47 UTC (permalink / raw)
  To: tuhs

Hoi,

via a recent message from Chris Pinnock to the list I became aware
of the book ``Ed Mastery'' by Michael W. Lucas. At once I bought
and read it. Although it is not on the mastery level it claims and
I would have liked it to be, it still was fun to read.

This brought me back to my ed interest. I like ed a lot and despite
my young age, I've actually programmed with ed for fun and have
prepared the troff slides for a talk on early Unix tools (like ed)
with ed alone. I use the Heirloom version of ed.

Anyways, I wondered about the possibility to give multiple
addresses ... more than two for relative address searches.

For example, to print the context of the first occurance of `argv'
within the main function, you can use:

	/^main(/;/\<argv\>/-2;+4n 

For the last occurance it's even one level more:

	/^main(/;/^}/;?\<argv\>?-2;+4n

(The semicolons mean that the next search or relative addressing
starts at the result of the previous one. I.e. in this case: We go
to the `main' function, from there go to the function end, then
backwards to `argv' minus two lines and print (with line numbers)
this line and four lines more.)


The manpage of 6th Edition mentiones this possibility to give more
than two addresses:

	Commands may require zero, one, or two addresses.  Commands
	which require no addresses regard the presence of an address
	as an error.  Commands which accept one or two addresses
	assume default addresses when insufficient are given.  If
	more addresses are given than such a command requires, the
	last one or two (depending on what is accepted) are used.

	http://man.cat-v.org/unix-6th/1/ed

You can see it in the sources as well:
	https://www.tuhs.org/cgi-bin/utree.pl?file=V6/usr/source/s1/ed.c
(Search for  ';'  to find the line. There's a loop processing the
addresses.)

V5 ed(1) is in assembler, however, which I cannot read. Thus there
must have been a complete rewrite, maybe introducing this feature
at that point. (I don't know where to find v5 manpage to check
that as well.)


I wonder how using multiple addresses for setting starting points
for relative searches came to be. When was it implemented and what
use cases drove this features back in the days? Or was it more an
accident that was introduced by the implementation, which turned
out to be useful? Or maybe it existed already in earlier versions
of ed, althoug maybe undocumented.




For reference, POSIX writes:

	Commands accept zero, one, or two addresses. If more than the
	required number of addresses are provided to a command that
	requires zero addresses, it shall be an error. Otherwise, if more
	than the required number of addresses are provided to a command,
	the addresses specified first shall be evaluated and then discarded
	until the maximum number of valid addresses remain, for the
	specified command.

	https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ed.html

Here more explanation rom the rationale section:

	Any number of addresses can be provided to commands taking
	addresses; for example, "1,2,3,4,5p" prints lines 4 and 5, because
	two is the greatest valid number of addresses accepted by the print
	command. This, in combination with the <semicolon> delimiter,
	permits users to create commands based on ordered patterns in the
	file. For example, the command "3;/foo/;+2p" will display the first
	line after line 3 that contains the pattern foo, plus the next two
	lines. Note that the address "3;" must still be evaluated before
	being discarded, because the search origin for the "/foo/" command
	depends on this.

As far as I can see, multiple addresses make only sense with the
semicolon separator, because the comma separator does not change
the state, thus previous addresses can have no effect on later
addresses. The implementation just does not forbid them, for
simplicity reasons.



meillo

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-07-10 10:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-08 13:23 [TUHS] ed: multiple addresses (with semicolons) Douglas McIlroy
2022-07-08 16:01 ` [TUHS] " Ken Thompson
2022-07-08 19:13   ` markus schnalke
2022-07-09  8:10     ` steve jenkin
2022-07-09  8:22       ` Rob Pike
2022-07-10  3:50         ` Jon Forrest
2022-07-10  9:25 ` Angelo Papenhoff
2022-07-10  9:59   ` Ralph Corderoy
  -- strict thread matches above, loose matches on Subject: below --
2022-07-08  7:47 [TUHS] " markus schnalke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).