[COFF] Editor Scripts

Steve Johnson scj at yaccman.com
Sat Jul 7 04:27:06 AEST 2018


What I used editor scripts for before utilities like sed came along
was primarily in what would now be called refactoring.
A common pattern for me was fo have a function foo that  took two
arguments and I wanted to add another argument.
Recall in those days that the arguments to a function had no type
information   foo( x, y ) would be followed by int x in the body of
the function.
Also, htere were no function prototypes.   So a very common error
(and a major motivation for writing Lint) was finding functions that
were
called inconsistently across the program.  

If I wanted to add an argument to foo, the first thing I would do is
run an editor script, something like

    1,$s/foo/old_foo/g
     w
     q

and apply it to all my source and header files.   Then I'd verify
that the resulting files compiled and ran.

Then I would take the definition of foo (now called old_foo), and
change it to its new form, with the
extra arguments, and rename it to foo.   Then I would grep my source
files for old_foo and change the
calls as needed.   Compiling would find any that I missed, so I
could fix them.

Sounds like a lot of work, but if you did it nearly every day it went
smoothly.

ed lent itself to scripts.  It was all ascii and line oriented.  
With glass teletypes came editors like vi.  Suddenly, a major
fraction of the letters typed were involved in moving a cursor
alone.  Also, vi wasn't as good at doing regular expressions as ed,
especially when lines were being joined   (this was later fixed). 
So editor scripts went from daily  usage to something that felt
increasingly alien.   The fact that you ccould see the code being
changed was good, but find the lines to change across a couple of
dozen files was much more time consuming...

Steve

PS:  There are IDEs that make quickly finding the definitions of a
function from its uses, or vice versa, much easier now.  But I think
it falls short of being an abstraction mechanism the way editor
scripts were...  In particular, you can't put such mouse clicks into
a file and run them on a bunch of tiles...

----- Original Message -----
From: "Grant Taylor" <gtaylor at tnetconsulting.net>
To:<coff at minnie.tuhs.org>
Cc:
Sent:Fri, 6 Jul 2018 10:10:24 -0600
Subject:Re: [COFF] Other OSes?

 On 07/05/2018 10:04 PM, Greg 'groggy' Lehey wrote:
 > It's really difficult to compare with Unix. I've tried several
times 
 > over the years, and I still haven't come to any conclusion.

 The impression that I got while reading your description made me
think 
 of distributed systems that use message bus(es) to communicate
between 
 applications on different distributed systems. Or at least the same 
 distributed IPC idea, just between parts of a single system, no (what
is 
 typically TCP/IP over Ethernet) network between them.

 Does that even come close? Or have I completely missed the boat?

 -- 
 Grant. . . .
 unix || die


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/coff/attachments/20180706/36f8fdf7/attachment.html>


More information about the COFF mailing list