zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: Re: Curiosity: zstyle -a vs. zstyle -h
Date: Mon, 22 May 2000 11:29:18 +0200 (MET DST)	[thread overview]
Message-ID: <200005220929.LAA17966@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Bart Schaefer"'s message of Wed, 17 May 2000 08:37:35 +0000


Bart Schaefer wrote:

> I just did a little experiment.  It appears that `zstyle -h pat style name'
> is exactly equivalent to `typeset -A name; zstyle -a pat style name'.
> 
> This seems just a tad inconsistent; if `zstyle -h' is going to force the
> name to be an associative array, shouldn't `zstyle -a' force the name to
> be an ordinary array?  (And shouldn't it be -A rather than -h?  I thought
> we only used -h when -A was already taken, as with `stat' (and there it's
> -H).)
> 
> An equally good (perhaps even better) alternative would be to drop the -h
> option entirely and require the array to be declared if one wants it to be
> an assoc.

This patch does that.

Bye
 Sven

Index: Doc/Zsh/mod_zutil.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/mod_zutil.yo,v
retrieving revision 1.5
diff -u -r1.5 mod_zutil.yo
--- Doc/Zsh/mod_zutil.yo	2000/05/21 18:27:36	1.5
+++ Doc/Zsh/mod_zutil.yo	2000/05/22 09:29:31
@@ -11,7 +11,7 @@
 xitem(tt(zstyle) [ tt(-) | tt(-)tt(-) ] var(pattern) var(style) var(strings) ...)
 xitem(tt(zstyle -d) [ var(pattern) [ var(styles) ... ] ])
 xitem(tt(zstyle -g) var(name) [ var(pattern) [ var(style) ] ])
-xitem(tt(zstyle -abhs) var(context) var(style) var(name) [ var(sep) ])
+xitem(tt(zstyle -abs) var(context) var(style) var(name) [ var(sep) ])
 xitem(tt(zstyle -Tt) var(context) var(style) [ var(strings) ...])
 item(tt(zstyle -m) var(context) var(style) var(pattern))(
 This builtin command is used to define and lookup styles.  Styles are
@@ -67,11 +67,10 @@
 of `tt(yes)', `tt(true)', `tt(on)', or `tt(1)'. If the value is any other
 string or has more than one string, the parameter is set to `tt(no)'.
 )
-xitem(tt(zstyle -a) var(context) var(style) var(name))
-item(tt(zstyle -h) var(context) var(style) var(name))(
-With the tt(-a) option the value is stored in var(name) as an array and
-with tt(-h) as an associative array (with the first, third, etc. string
-being used as the keys and the other strings being used as the values).
+item(tt(zstyle -a) var(context) var(style) var(name))(
+The value is stored in var(name) as an array. If var(name) is declared 
+as an associative array,  the first, third, etc. stringare used as the
+keys and the other strings are used as the values.
 )
 xitem(tt(zstyle -t) var(context) var(style) [ var(strings) ...])
 item(tt(zstyle -T) var(context) var(style) [ var(strings) ...])(
Index: Src/Modules/zutil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/zutil.c,v
retrieving revision 1.3
diff -u -r1.3 zutil.c
--- Src/Modules/zutil.c	2000/05/15 08:04:10	1.3
+++ Src/Modules/zutil.c	2000/05/22 09:29:31
@@ -279,7 +279,6 @@
     case 's': min = 3; max =  4; break;
     case 'b': min = 3; max =  3; break;
     case 'a': min = 3; max =  3; break;
-    case 'h': min = 3; max =  3; break;
     case 't': min = 2; max = -1; break;
     case 'T': min = 2; max = -1; break;
     case 'm': min = 3; max =  3; break;
@@ -384,7 +383,6 @@
 	}
 	break;
     case 'a':
-    case 'h':
 	{
 	    Stypat s;
 	    char **ret;
@@ -399,10 +397,7 @@
 		ret = zarrdup(&dummy);
 		val = 1;
 	    }
-	    if (args[0][1] == 'a')
-		setaparam(args[3], ret);
-	    else
-		sethparam(args[3], ret);
+	    setaparam(args[3], ret);
 
 	    return val;
 	}

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


                 reply	other threads:[~2000-05-22  9:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200005220929.LAA17966@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --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).