OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [expect/] [NEWS] - Blame information for rev 1780

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
This file is the NEWS file from the Expect distribution.
2
 
3
======================================================================
4
======================================================================
5
 
6
Date: 8/18/96
7
 
8
Expect now works with Tcl 8.0.
9
 
10
No changes were made to take advantage of 8.0 features such as
11
namespaces.  (If you want to put the Expect commands in a namespace,
12
declare a namespace before loading them in.)
13
 
14
Even thought Tcl allows embedded nulls in commands, Expect still does
15
not.  Tcl still doesn't support embedded in patterns and regexps.
16
I'll wait til Tcl supports that before rewriting Expect's null
17
support.
18
 
19
 
20
======================================================================
21
======================================================================
22
 
23
Date: 9/28/96
24
 
25
There is now an Expect FAQ and home page.  Feedback is encouraged.
26
You can get to the FAQ from the home page and vice versa, so you only
27
need to remember one of the links, but here are both for completeness:
28
 
29
home page: http://expect.nist.gov
30
FAQ:       http://expect.nist.gov/FAQ.html
31
 
32
 
33
 
34
======================================================================
35
======================================================================
36
This section describes the changes to Expect 5, many due to changes
37
from Tcl 7.4 to 7.5.
38
 
39
Improvements
40
==============================
41
 
42
You can now use expect_background from Tcl along with all the
43
Tcl-based event stuff such as "after".  You can also do fun things
44
such as have "after" actions run while expect is waiting for input.
45
It's worth comparing the difference between commands such as expect
46
(which waits in the event loop) and gets (which doesn't).
47
 
48
Incompatibilities
49
==============================
50
 
51
libexpectk is gone.  Because of the event loop was moved into Tcl,
52
this is no longer necessary.  Just use the regular Expect library.
53
This only affects you if are hand-linking.
54
 
55
The name of the static C library now has the extension on the end -
56
just like Tcl.  This only affects you if are hand-linking.
57
 
58
 
59
==============================
60
Some obvious questions and answers
61
 
62
Nothing in the user interface has changed.  All your old scripts
63
should run.  Tcl now has commands that replace Expect functionality in
64
the area of version control and date handling.  I encourage you to use
65
Tcl's support rather than Expect's for any new scripts that you write.
66
However, I won't be removing Expect's commands, so don't worry about
67
having to convert old scripts.
68
 
69
It is my understand that shared/dl libs work.  (I say "it is my
70
understanding", because my own environment doesn't handle it, sigh.
71
My system admins tell me that they're working on it.)  So I've had to
72
guess on some things - in fact, I've talked to a number of people and
73
I get the feeling that a lot of people are guessing on shared/dl libs.
74
I have yet to talk to anyone that REALLY understands this stuff (by
75
"understand", I mean "can write the configure/Makefile portably and
76
correctly".  So much for my griping.  In theory, the shared/dl support
77
is pretty much a freebie because Tcl itself provides all the support
78
for this.  (There is some reorganization that could be done to improve
79
shared library memory use - I'll get to it eventually - it shouldn't
80
affect most people.)  Don't send me complaints about shared/dl libs
81
unless you are *positive* it is something that I am responsible for.
82
Even if Tcl works and Expect fails, it is likely to be a Tcl error (or
83
more precisely, a configuration problem that is more appropriately
84
fixed from the Tcl distribution).
85
 
86
For Tcl-package purposes, Expect is called "Expect".  (Duh...)
87
 
88
Expect's multiple interpreter support is minimal.  It should work for
89
most things, serendipitously.  I haven't spent any time making this
90
perfect.
91
 
92
No, this release isn't portable to Windows or Mac.  Let me know if
93
you're seriously interested in a lot of work.  I'm not saying it's not
94
possible.  It's definitely possible and the porting working at Sun has
95
made it easier than before.  But it's still not a weekend hack.
96
 
97
Industrial support for the NT port, would be very helpful.  If you are
98
interested, either as a student or an industrial sponsor, let me know.
99
 
100
==============================
101
Building the code
102
==============================
103
 
104
Expect builds as usual.  (See the INSTALL file for details.)
105
 
106
The only significant change is that Expect now has to find the
107
tclConfig.sh file (and tkConfig.sh if you want).  So if you like to
108
store Tcl where Expect can't find it, you'll need to use even more
109
configure flags than you used to.
110
 
111
Shared/dl Expect libraries are built if you configured Tcl for
112
shared/dl libraries.
113
 
114
All support for earlier versions of Tcl and Tk have been removed from
115
Expect.  For example, if you're still using Tcl 7.4 (or earlier),
116
don't bother to install this release.
117
 
118
======================================================================
119
======================================================================
120
This section describes the changes from Expect 4 to Expect 5.
121
 
122
The changes that people will find most interesting or annoying are as
123
follows.  Some of them may seem rather arbitrary but fix inconsistencies
124
leading to much cleaner coding both internally and externally.
125
 
126
 
127
-- Expect version 5.20 and above is designed to work with Tcl 7.5 and
128
Tk 4.1.  Expect 5.20 and above will not work with earlier versions.
129
 
130
-- Glob-style patterns do longest-possible matches (from the earliest
131
possible position) just like regexps.  Previously, they matched the
132
shortest-possible strings.  However, the documentation didn't actually
133
say this (it didn't say anything)
134
 
135
-- Exact patterns are now supported from expect.  Use the "-ex" flag.
136
Exact patterns work just like those in interact.  No special handling
137
is made of *, ^, etc.
138
 
139
-- The new command "expect_background" registers patterns that are to
140
be tested against spawned process output whenever it appears (i.e.,
141
asynchronously).  This only works in the Tk environment.  The
142
arguments are the same as the expect command.
143
 
144
-- expect_before and expect_after now handle their arguments like
145
expect_background.  Previously, a command such as "expect_before"
146
with no arguments deleted patterns for all spawn ids.  Now, it only
147
deletes patterns for the current spawn id.  Similarly with the "-i"
148
form.
149
 
150
-- expect_background/before/after support an -info flag to query what
151
the current patterns are.  The results are returned in such a way that
152
they can be re-used by a new expect command.
153
 
154
The -info flag must be the first flag in the command.  With no other
155
arguments, it returns the setting for the current spawn id.  With a -i
156
descriptor, information is returned for that spawn id.  The argument
157
-noindirect may be used to suppress indirects which also match a
158
direct spawn id.  Only a single -i specification may be given with
159
-info.  With the argument "-all", all spawn id specifications are
160
reported.
161
 
162
-- There is now a sleep command.  It understands decimal values such as
163
 
164
        sleep .5
165
 
166
Interrupts and other asynchronous events are processed while Expect sleeps.
167
 
168
-- Traps now use Tcl's "Async" support.  This has advantages and
169
disadvantages.  One advantage is that traps have no chance of screwing
170
up the Tcl internals.  One disadvantage is that trap handlers are
171
delayed at certain specific times and places.  For example, a handler
172
cannot occur inside another handler.  While one handler is running,
173
all other handlers are blocked.  This is probably the most noticable
174
place where handlers are blocked.  Others are generally small windows,
175
so you shouldn't notice the delay in executing the handlers.
176
 
177
Several traps are initially defined:
178
 
179
        trap exit {SIGINT SIGTERM}
180
 
181
If you use the -D flag to start the debugger, the following trap is
182
defined:
183
 
184
        trap {exp_debug 1} SIGINT
185
 
186
You can, of course, override these.  In particular, if you have your
187
own "trap exit SIGINT", this will override the debugger trap.  Because
188
SIGINT is tied to exit (see above) by default anyway, you should
189
remove your own "trap exit SIGINT" unless you specifically do not want
190
to be able to get to the debugger by ^C.
191
 
192
If you want to define your own trap on SIGINT but still trap to the
193
debugger when it is running, use:
194
 
195
        if ![exp_debug] {trap mystuff SIGINT}
196
 
197
Alternatively, you can trap to the debugger using some other signal.
198
 
199
The ONEXIT trap is no longer available.  Instead, say "exit -onexit ..."
200
 
201
Traps are now deleted by using the empty ({}) handler.  The current
202
handler is returned if no action is supplied.  With no arguments, trap
203
returns the signal number of the trap command currently being executed.
204
 
205
-- The wait command now returns a four element list if a valid child
206
was waited on.
207
Element 1: pid
208
Element 2: spawn id
209
Element 3: 0 (or -1 if there was an OS error)
210
Element 4: status (or errno if element 3 == -1)
211
 
212
-- expect and interact notes:
213
 
214
The timeout and eof patterns were initially named "-timeout" and
215
"-eof" but have been renamed "timeout" and "eof" to match those of
216
expect.  The ability to define default timeout/eof actions has been
217
removed.  (You can do this more easily by grouping spawn ids.)
218
 
219
expect and interact now support a "null" keyword to match an ASCII 0.
220
send supports -null and -break keywords.
221
 
222
Since a large number of special keywords have been added to interact,
223
a new keyword "-ex" for "exact" was added descriptive of its default
224
treatment of patterns.  This protects the next token from being
225
misinterpreted as a keyword.  The expect command provides "-gl" for
226
"glob" for analogous reasons.
227
 
228
Any string starting with "-" should be protected by the "-ex" or "-gl"
229
flag, even those that are not keywords currently.  (All strings
230
starting with "-" are reserved for future options.)
231
 
232
String start/end indices are no longer written to expect_out and
233
interact_out unless the -indices flag is given.
234
 
235
expect_out(spawn_id) is set to the spawn id associated with the spawn
236
id that produced the last output in an expect command.  For example,
237
you can use this to delete files that have closed, by removing this
238
element from an indirect spawn ids spec.  The same effect is
239
reproducable with interact (and interact_out(spawn_id)) but for
240
efficiency reasons, it requires the -iwrite flag before each pattern.
241
 
242
Expect's -i and interact's -i, -u, -input, and -output flags can now
243
describe a list of spawn ids.  So you can say things like:
244
 
245
        interact -input "$id1 $id2 $id3" .... -output "$id1 $id2" ...
246
 
247
In this case, id1, 2, 3 would be sent to id1, and 2.
248
 
249
The spawn id may be given as a global variable name (called an
250
"indirect spawn id specification"), in which case, the variable
251
contains the list of spawn ids.  Whenever the variable is changed, the
252
new list of spawn ids is automatically used.  This is particularly
253
useful with any long running expect command such as expect_before,
254
expect_after, expect_background, and interact.
255
 
256
The -update flag was removed.  Use indirect spawn ids (see previous
257
paragraph).
258
 
259
-- interact notes:
260
 
261
Interact now support -input and -output flags that provide very
262
flexible means of moving data from/to multiple spawn ids in complex
263
ways (but very quickly).  It is possible to write most expect loops
264
using a simple interact statement.  For instance, the three way
265
interaction inside kibitz (between two users and a process) is written
266
this way:
267
 
268
        interact {
269
                -output $shell
270
                -input $userin eof { . . . } -output $shell
271
                -input $shell -output "$user_spawn_id $userout"
272
        }
273
 
274
-- send command notes:
275
 
276
It is possible to send a break by using the "-break" flag.
277
 
278
Any string starting with "-" should be protected by preceding it with
279
the "--" flag, even those that are not keywords currently.  (All
280
strings starting "-" are reserved for future options.)
281
 
282
-- The spawn command now takes an "-open" flag which in turns takes a
283
Tcl file as an argument.  This lets you treat raw devices, files, and
284
pipelines as spawned processes without using a pty.
285
 
286
This was actually in Expect 4, but I forgot to document it.  Oops!
287
 
288
-- The old "debug" command (which describes what Expect is doing
289
internally) was renamed "exp_internal".  "debug" (and "exp_debug") now
290
invoke the interactive debugger.
291
 
292
-- The new command "stty" now takes over the job of "system stty".  It
293
works much better, allowing POSIX-style redirection to affect other
294
ttys.  It otherwise takes arguments as "system stty" did.
295
 
296
-- The "-tcl" option to "return" has gone away.  (This was dangerous
297
to anyone that actually happened to return the value "-tcl".)
298
Instead, use inter_return.
299
 
300
-- Added exp_timestamp command to produce very fast timestamps.
301
 
302
-- Added exp_pid command to return pid of given spawn id.
303
 
304
-- The close command now takes an argument of "-onexec" with a following
305
 
306
current spawn id from being closed when another process is exec'd or
307
spawn'd.
308
 
309
        close -onexec 0
310
 
311
While "-onexec 1" returns it to the default condition where it will be
312
closed upon exec or spawn.
313
 
314
-- log_user now returns previous value.  It is acceptable to call now,
315
without arguments just to get the value.
316
 
317
-- The following forms are deprecated.  They will be allowed
318
indefinitely but not advertised or supported if they break.
319
 
320
        -eof, -timeout in interact (reason: didn't match expect.
321
                Instead, use eof or timeout.)
322
 
323
        -- in expect or interact (reason: no easier to read.
324
                Instead, use -gl in expect or -ex in interact.)
325
 
326
        continue -expect (reason: when mixing in extensions, you have
327
                to use exp_continue, so -expect becomes irrelevant.
328
                Instead, use exp_continue.)
329
 
330
        getpid (reason: Tcl now supplies same functionality as "pid".
331
                Instead, use pid.)
332
 
333
        expect_version and expect_library (reason: the name implies
334
                they have something to do with the expect command,
335
                which they doesn't.
336
                Instead, use exp_version and exp_library.)
337
 
338
        -timestamp for obtaining tm and ctime in expect and interact
339
                (reason: separate command now exists for this purpose.
340
                Instead, use exp_timestamp.)
341
 
342
        system stty (reason: bad interaction with redirection.
343
                Instead, use stty.)
344
 
345
-- New examples have been added:
346
 
347
"dislocate" lets you disconnect and reconnect to processes.
348
 
349
"tkpasswd" illustrates passwd embedded in a GUI.
350
 
351
They may not be overwhelmingly useful, but run them once to see what
352
they do.  If you ever need to do anything similar, you can look back
353
at them.
354
 
355
"tknewsbiff" pops up a window or plays a audio clip when you have
356
unread news.
357
 
358
-- Changes to the Expect libraries:
359
 
360
The expect-tcl library (libexpectcl.a) has been integrated with the
361
expect library (libexpect.a).  So references to libexpectcl.a should
362
be removed.
363
 
364
The Expect C library now supports buffering, multiplexing, null
365
matching, full buffer matching.  Basically, all of the features in
366
Expect are now in the library.
367
 
368
Buffering and multiplexing has caused the biggest change to the
369
library.  Previously, exp_match contained the entire buffer that
370
matched.  Now exp_match just points to where in the buffer the match
371
started.  exp_buffer points to the beginning of the buffer.
372
Previously, the previous buffer was thrown away at the beginning of
373
each expect function call.  Now, previously unmatched characters are
374
eligible for matching.
375
 
376
To match on different file descriptors, exp_match, exp_match_end,
377
exp_buffer_end must be restored to their previous values.  Initially,
378
they should be zero.
379
 
380
The meaning of timeout == 0 in the Expect library has been changed.
381
See the man page for more info.
382
 
383
======================================================================
384
======================================================================
385
This file describes the changes from Expect 3 to Expect 4.
386
 
387
The improvements that people will find most interesting are:
388
 
389
1) Expect version 4 is designed to work with Tcl 6.7 and Tk 3.2.
390
   (Earlier versions of Expect will not work with Tcl 6.7)
391
   Expect can now be layered in with any Tcl program.
392
   Note that in Tk, Expect's send command is called "exp_send".
393
   (It used to be called "send_spawn" but this bit the dust.)
394
2) A debugger is provided.
395
3) The interact command has been totally rewritten and supports regular
396
   expressions, timeout/eof patterns, and a number of other new things.
397
4) The default behavior of ^C (SIGINT) is exit whether or not you are in
398
   a read.
399
5) Expect uses "sane" terminal parameters by default, allowing scripts
400
   to work the same whether inside emacs shell mode or not.  (See man
401
   page on "spawn" for more info.)
402
6) All the hard parts of the installation process are automated.  This
403
   was done primarily by Rob Savoye at Cygnus.  Thank you, Rob!
404
7) It is now possible to buy a support contract for Expect from Cygnus.
405
 
406
The changes that people will find most annoying are:
407
 
408
1) send now only sends a single string.  (It used to send any number of
409
   strings with spaces jammed in between.)
410
2) getpid was renamed pid.
411
3) interact's -flush was renamed -nobuffer (much more descriptive).
412
4) interact now runs all actions in raw mode unless the flag -reset
413
   is used.  -f and -F are ignored.  send automatically understands
414
   how to do the right thing.  The most likely thing to watch out for
415
   are actions like "exec kill -STOP 0" which almost certainly need
416
   the -reset flag.
417
5) argv0 is initialized to script name.  argv no longer contains it.
418
   argc is initialized [llength $argv].  This follows new Tcl style.
419
 
420
All differences are described in the man page.  Some of the less
421
significant differences are described in the HISTORY file.  The
422
debugger is described in a separate document (see the README).
423
 
424
This version also introduces one incompatibility that may require
425
changes to scripts.  While this may initially annoy you, the final
426
result will simplify the process of writing scripts.  Namely:
427
 
428
In version 3, the expect command accepted lists of glob-style patterns
429
such as:
430
 
431
        expect "a\ b c" action
432
 
433
where "a b" or "c" would cause action to be executed.  The problem
434
with this is that the pattern list is hard to write and hard to read.
435
Patterns with control-characters, backslashes and dollar signs were
436
very difficult to deal with.
437
 
438
Regular-expression patterns provide a much simpler solution.  Via the
439
alternation feature (using a "|") the above pattern can be written as:
440
 
441
        expect -re "a b|c" action
442
 
443
I was concerned about people having a significant investment in code
444
that depended on the old syntax but responders to a comp.lang.tcl poll
445
about such a change in pattern handling were 100% in favor of it.  (I
446
even proposed hooks for backward compatibility, but there was no
447
interest in it.)
448
 
449
Fortunately, most simple things will work as before including:
450
 
451
        expect foobar
452
        expect {foobar}
453
        expect "foobar"
454
        expect "foo\ bar"
455
 
456
However, some things won't work as before.  For example, the following
457
will behave differently - now the braces will be considered as part of
458
the pattern.
459
 
460
        expect "{foo bar}"
461
 
462
Here are examples of patterns in my own code that I had to change:
463
 
464
        was                             changed to
465
        Version 3 pattern list          Version 4 pattern
466
 
467
        {Whois:\ }                      "Whois: "
468
        {No\ match}                     "No match"
469
        {250*ftp>* 200*ftp>*}           -re "2(5|0)0.*ftp>.*"
470
        {{Press Return to continue*}}   "Press Return to continue*"
471
        {*\r\n*\\\\\r\n}                "\r\n*\\\r\n"
472
 
473
 
474
 
475
Future Change Alert
476
 
477
John Ousterhout has pre-announced a future change in Tcl that may
478
affect you.  In particular, backslash sequences other than those
479
explicitly listed in the Tcl documentation will be handled as if the
480
backslash was not present.
481
 
482
The likely place this arises is when quoting characters that are
483
special to the pattern matcher but not to Tcl.
484
 
485
For example in Tcl 6.7, the following command matches a period.
486
 
487
        expect -re "\."
488
 
489
In Tcl 7.0, it will match any character, because Tcl will throw away
490
the backslash.  If you want to match a period, you will have to say:
491
 
492
        expect -re "\\."
493
or
494
        expect -re {\.}
495
 
496
The following command will find occurrences of this.  (It may find
497
other things, but it will at least find the problem cases.)
498
 
499
        egrep '(\\$)|(\\[^][bfnrtv\0-9{}$ ;"])' *.exp
500
 
501
======================================================================
502
======================================================================
503
This section describes the changes from Expect 2 to Expect 3.
504
 
505
If you used to use Expect version 2 (any version written before
506
September '91) you will find that the current version of Expect (3)
507
introduced minor but significant incompatibilities.
508
 
509
The HISTORY file describes these briefly.  They are described at
510
length in the man page.
511
 
512
I'm sorry if you feel annoyed at the incompatibilities, but Expect has
513
been out for a year and a half, Tcl even longer.  Both Tcl and Expect
514
are using this as a last chance to make significant changes, so that
515
we will not disturb even more users in the future.
516
 
517
There is no automated conversion procedure (although see note below)
518
for Expect or even raw Tcl.  For now, I suggest that you not bother
519
fixing things that already work - just keep the old Expect around.
520
The binary isn't very big after all.  If you do write a translation
521
script, let me know.  Thanks.
522
 
523
Of course, I felt obligated to convert the examples distributed with
524
expect.  I did this by hand while writing the new version itself,
525
partly as an aid but mostly to test lots of variations.  In 90% of the
526
scripts, all I had to do was change:
527
 
528
(changes due to Tcl)
529
        'index' to 'lindex'
530
        'range' to 'lrange'
531
        'length' to 'llength'
532
        'print' to 'send_user' or 'puts' depending on how you use it
533
        'function .... c' with '[join [function [split string ""]] ""]'
534
(changes due to Expect)
535
        'expect_match' to 'expect_out(buffer)'
536
        'set match_max' to 'match_max' (perhaps with -d flag)
537
        '*' to '-re .+'
538
 
539
If anyone wants to write a script to do this, note the pitfalls:
540
 
541
1) functions and variables do not share the same namespace, so it is a
542
inappropriate to just globally rename things.
543
 
544
A number of optimizations can be made:
545
 
546
1) If you are doing multiple split/joins, you should probably cache the
547
split string.
548
 
549
2) Virtually all uses of scan are unnecessary now, due to exec's automatic
550
stripping of terminating newlines, and expect's support of regexps.
551
 
552
3) String manipulation can be reduced or avoided entirely if you use
553
expect -re.
554
 
555
4) exec is no longer necessary to retrieve environment variables, since
556
they can now be retrieved from $env.
557
 
558
5) If you have been really anal about testing for timeout and eof, you
559
can dramatically reduce the size of your scripts by using expect_before
560
and expect_after.  This is more efficient, as well, since those actions
561
are only parsed once.
562
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.