* Re: PATCH: pws-N: function line numbers
@ 1999-06-25 6:58 Sven Wischnowsky
0 siblings, 0 replies; 3+ messages in thread
From: Sven Wischnowsky @ 1999-06-25 6:58 UTC (permalink / raw)
To: zsh-workers
Bart Schaefer wrote:
> On Jun 24, 12:02pm, Peter Stephenson wrote:
> } Subject: PATCH: pws-N: function line numbers
> }
> } It would be sort of nice to fix this stuff in 3.0.6 too, but that means
> } adapting both Sven's and my previous fixes, which is a rather deathly task.
>
> Yawn. Been there, done that.
>
> 1999-06-19 05:11 Bart Schaefer <schaefer@zsh.org>
>
> * Doc/zsh.texi, Doc/zshbuiltins.man, Src/builtin.c, Src/exec.c,
> Src/init.c, Src/input.c, Src/parse.c, Src/zsh.h: Adapt Sven's and
> PWS's patches for correct LINENO computation from 6693, 6705.
>
> Is there something else that I missed?
There is something I missed: the %_ was wrong for else-branches.
Bye
Sven
--- os/loop.c Thu Jun 24 14:03:59 1999
+++ Src/loop.c Fri Jun 25 08:55:35 1999
@@ -378,7 +378,7 @@
noerrexit = olderrexit;
if (*t) {
- cmdpush(s ? CS_ELIFTHEN : CS_IFTHEN);
+ cmdpush(*i ? (s ? CS_ELIFTHEN : CS_IFTHEN) : CS_ELSE);
execlist(*t, 1, flags & CFLAG_EXEC);
cmdpop();
} else
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PATCH: pws-N: function line numbers
1999-06-24 10:02 Peter Stephenson
@ 1999-06-24 16:16 ` Bart Schaefer
0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 1999-06-24 16:16 UTC (permalink / raw)
To: Zsh hackers list
On Jun 24, 12:02pm, Peter Stephenson wrote:
} Subject: PATCH: pws-N: function line numbers
}
} It would be sort of nice to fix this stuff in 3.0.6 too, but that means
} adapting both Sven's and my previous fixes, which is a rather deathly task.
Yawn. Been there, done that.
1999-06-19 05:11 Bart Schaefer <schaefer@zsh.org>
* Doc/zsh.texi, Doc/zshbuiltins.man, Src/builtin.c, Src/exec.c,
Src/init.c, Src/input.c, Src/parse.c, Src/zsh.h: Adapt Sven's and
PWS's patches for correct LINENO computation from 6693, 6705.
Is there something else that I missed?
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* PATCH: pws-N: function line numbers
@ 1999-06-24 10:02 Peter Stephenson
1999-06-24 16:16 ` Bart Schaefer
0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 1999-06-24 10:02 UTC (permalink / raw)
To: Zsh hackers list
Now line numbers work properly in functions, we can use them for printing
error messages. To get the name of the function right, I hijacked
scriptname. That neatly solves the problem of deciding whether the nearest
enclosing object is a sourced script or a function.
It would be sort of nice to fix this stuff in 3.0.6 too, but that means
adapting both Sven's and my previous fixes, which is a rather deathly task.
--- Src/exec.c.fnln Thu Jun 24 10:46:29 1999
+++ Src/exec.c Thu Jun 24 11:40:38 1999
@@ -2879,7 +2879,7 @@
{
char **tab, **x, *oargv0 = NULL;
int oldzoptind, oldlastval;
- char saveopts[OPT_SIZE];
+ char saveopts[OPT_SIZE], *oldscriptname;
int obreaks = breaks;
HEAPALLOC {
@@ -2891,6 +2891,8 @@
starttrapscope();
tab = pparams;
+ oldscriptname = scriptname;
+ scriptname = name;
oldzoptind = zoptind;
zoptind = 1;
@@ -2933,6 +2935,7 @@
argzero = oargv0;
}
zoptind = oldzoptind;
+ scriptname = oldscriptname;
pparams = tab;
if (isset(LOCALOPTIONS)) {
--- Src/utils.c.fnln Wed Jun 23 17:35:29 1999
+++ Src/utils.c Thu Jun 24 11:42:42 1999
@@ -62,9 +62,10 @@
/*
* scriptname is set when sourcing scripts, so that we get the
* correct name instead of the generic name of whatever
- * program/script is running.
+ * program/script is running. It's also set in shell functions,
+ * so test locallevel, too.
*/
- nicezputs(isset(SHINSTDIN) ? "zsh" :
+ nicezputs((isset(SHINSTDIN) && !locallevel) ? "zsh" :
scriptname ? scriptname : argzero, stderr);
fputs(": ", stderr);
zerrnam(NULL, fmt, str, num);
@@ -79,7 +80,7 @@
return;
errflag = 1;
trashzle();
- if(unset(SHINSTDIN)) {
+ if (unset(SHINSTDIN) || locallevel) {
nicezputs(scriptname ? scriptname : argzero, stderr);
fputs(": ", stderr);
}
@@ -133,7 +134,7 @@
putc(*fmt == Meta ? *++fmt ^ 32 : *fmt, stderr);
fmt++;
}
- if (unset(SHINSTDIN) && lineno)
+ if ((unset(SHINSTDIN) || locallevel) && lineno)
fprintf(stderr, " [%ld]\n", (long)lineno);
else
putc('\n', stderr);
--
Peter Stephenson <pws@ibmth.df.unipi.it> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1999-06-25 6:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-25 6:58 PATCH: pws-N: function line numbers Sven Wischnowsky
-- strict thread matches above, loose matches on Subject: below --
1999-06-24 10:02 Peter Stephenson
1999-06-24 16:16 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
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).