zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: zsh-workers@sunsite.auc.dk (Zsh hackers list)
Subject: PATCH: 3.1.5-pws-5++: typeset -T fixlet
Date: Sat, 30 Jan 1999 14:16:11 +0100	[thread overview]
Message-ID: <9901301316.AA64877@ibmth.df.unipi.it> (raw)
In-Reply-To: "Peter Stephenson"'s message of "Fri, 29 Jan 1999 18:00:53 NFT." <9901291700.AA41949@ibmth.df.unipi.it>

Ho scritto io:
> By the way, it seems to me
> 
> % typeset -T FOO foo
> % foo="scalar"
> % print $FOO
> 
> %
> 
> is probably a bug, so I'll try to remember to have a look at it.

Seems quite easy to fix along the same lines that PATH/path were
supposed to work, and I've documented the behaviour.  There is a also
a fix to an existing bug here:

% PATH=(array)
% print $PATH
<nasty eight bit characters>

This was supposed to be handled, but a slight misunderstanding of the
parameter type flags (a scalar has a zero value) caused it to be
missed.

--- Doc/Zsh/builtins.yo.tied2	Thu Jan 28 18:04:21 1999
+++ Doc/Zsh/builtins.yo	Sat Jan 30 14:07:46 1999
@@ -910,7 +910,10 @@
 the former.  Only the scalar may have an initial value.  Both the
 scalar and the array may otherwise be manipulated as normal.  If one
 is unset, the other will automatically be unset too.  There is no way
-of untying the variables without unsetting them; tt(+T) does not work.
+of untying the variables without unsetting them, or converting the
+type of one them with another tt(typeset) command; tt(+T) does not work,
+assigning an array to var(SCALAR) is an error, and assigning a scalar
+to var(array) sets it to be a single-element array.
 
 If no var(name) is present, the names and values of all parameters are
 printed.  In this case the attribute flags restrict the the display to
--- Src/params.c.tied2	Fri Jan 29 17:36:10 1999
+++ Src/params.c	Sat Jan 30 14:02:11 1999
@@ -1371,7 +1371,7 @@
 	freearray(val);
 	return;
     }
-    if (PM_TYPE(v->pm->flags) & ~(PM_ARRAY|PM_HASHED)) {
+    if (!(PM_TYPE(v->pm->flags) & (PM_ARRAY|PM_HASHED))) {
 	freearray(val);
 	zerr("attempt to assign array value to non-array", NULL, 0);
 	return;
@@ -1501,7 +1501,7 @@
 	if (!(v = getvalue(&s, 1)))
 	    createparam(t, PM_SCALAR);
 	else if (PM_TYPE(v->pm->flags) == PM_ARRAY &&
-		 !(v->pm->flags & PM_SPECIAL) && unset(KSHARRAYS)) {
+		 !(v->pm->flags & (PM_SPECIAL|PM_TIED)) && unset(KSHARRAYS)) {
 	    unsetparam(t);
 	    createparam(t, PM_SCALAR);
 	    v = NULL;
@@ -1545,7 +1545,7 @@
 	if (!(v = getvalue(&s, 1)))
 	    createparam(t, PM_ARRAY);
 	else if (!(PM_TYPE(v->pm->flags) & (PM_ARRAY|PM_HASHED)) &&
-		 !(v->pm->flags & PM_SPECIAL)) {
+		 !(v->pm->flags & (PM_SPECIAL|PM_TIED))) {
 	    int uniq = v->pm->flags & PM_UNIQUE;
 	    unsetparam(t);
 	    createparam(t, PM_ARRAY | uniq);

-- 
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


  reply	other threads:[~1999-01-30 13:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-29 17:00 PATCH: 3.1.5-pws-5++: tidying up zle parameters Peter Stephenson
1999-01-30 13:16 ` Peter Stephenson [this message]
1999-01-30 18:19   ` PATCH: 3.1.5-pws-5++: typeset -T fixlet Bart Schaefer
1999-02-01  8:33     ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9901301316.AA64877@ibmth.df.unipi.it \
    --to=pws@ibmth.df.unipi.it \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).