about summary refs log tree commit diff
path: root/Doc
diff options
context:
space:
mode:
Diffstat (limited to 'Doc')
-rw-r--r--Doc/Makefile.in19
-rw-r--r--Doc/Zsh/compsys.yo12
-rw-r--r--Doc/Zsh/mod_random.yo56
-rw-r--r--Doc/intro.ms40
4 files changed, 111 insertions, 16 deletions
diff --git a/Doc/Makefile.in b/Doc/Makefile.in
index d9be182e9..a986aa1c5 100644
--- a/Doc/Makefile.in
+++ b/Doc/Makefile.in
@@ -68,7 +68,7 @@ Zsh/mod_hlgroup.yo Zsh/mod_langinfo.yo \
 Zsh/mod_ksh93.yo Zsh/mod_mapfile.yo Zsh/mod_mathfunc.yo \
 Zsh/mod_nearcolor.yo Zsh/mod_newuser.yo \
 Zsh/mod_parameter.yo Zsh/mod_pcre.yo Zsh/mod_private.yo \
-Zsh/mod_regex.yo Zsh/mod_sched.yo Zsh/mod_socket.yo \
+Zsh/mod_regex.yo Zsh/mod_random.yo Zsh/mod_sched.yo Zsh/mod_socket.yo \
 Zsh/mod_stat.yo  Zsh/mod_system.yo Zsh/mod_tcp.yo \
 Zsh/mod_termcap.yo Zsh/mod_terminfo.yo \
 Zsh/mod_watch.yo \
@@ -118,15 +118,20 @@ zsh.pdf zsh_a4.pdf zsh_us.pdf: $(sdir)/zsh.texi
 	  $(TEXI2PDF) -o $@ -t @afourpaper $(sdir)/zsh.texi; \
 	fi
 
-# Use roff2ps / ps2pdf because pdfroff produces doubled output.
 intro.pdf intro.a4.pdf intro.us.pdf: $(sdir)/intro.ms
 	if test $@ = intro.us.pdf || \
 	  { test $@ = intro.pdf && test "$(PAPERSIZE)" = us; }; then \
-	  roff2ps -ms -P-pletter < $(sdir)/intro.ms > intro.ps; \
+	  pdfroff -mspdf --no-kill-null-pages -P-pletter --pdf-output=$@ $<; \
 	else \
-	  roff2ps -ms -P-pa4 < $(sdir)/intro.ms > intro.ps; \
-	fi; \
-	ps2pdf -sOutputFile=$@ intro.ps
+	  pdfroff -mspdf --no-kill-null-pages -P-pa4 --pdf-output=$@ $<; \
+	fi
+
+intro.html: $(sdir)/intro.ms
+	if groff -ms -Thtml -P-jintro $< > tmp.html; then \
+	  mv tmp.html $@; \
+	else \
+	  rm -f tmp.html; false; \
+	fi
 
 texi: $(sdir)/zsh.texi
 .PHONY: texi
@@ -172,7 +177,7 @@ a4_ps: zsh_a4.ps
 zsh_a4.ps: zsh_a4.dvi
 	$(DVIPS) -t a4 -o $@ zsh_a4.dvi
 
-html: zsh_toc.html
+html: zsh_toc.html intro.html
 .PHONY: html
 
 zsh_toc.html: $(sdir)/zsh.texi texi2html.conf
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index f75298a1b..9b7f91148 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -4290,6 +4290,14 @@ arguments.  The first describes the first argument as a
 be completed.  The last description gives all other arguments the
 description `var(page number)' but does not offer completions.
 )
+findex(_as_if)
+item(tt(_as_if) var(command) [var(arg) ... ])(
+This function is useful when one command should be completed as if it were
+another command with particular arguments. For example to complete tt(foo) as
+if it were tt(bar --baz), use
+
+example(compdef '_as_if bar --baz' foo)
+)
 findex(_cache_invalid)
 item(tt(_cache_invalid) var(cache_identifier))(
 This function returns status zero if the completions cache corresponding to
@@ -5448,10 +5456,6 @@ example(local expl
 _wanted tag expl 'description' \ 
     compadd -- var(match1) var(match2)...)
 
-See also the use of tt(_wanted) in the example function in
-ifzman(the subsection `Dynamic named directories' in zmanref(zshexpn))\
-ifnzman(noderef(Dynamic named directories)).
-
 Note that, as for tt(_requested), the var(command) must be able to
 accept options to be passed down to tt(compadd).
 
diff --git a/Doc/Zsh/mod_random.yo b/Doc/Zsh/mod_random.yo
new file mode 100644
index 000000000..4f5622e61
--- /dev/null
+++ b/Doc/Zsh/mod_random.yo
@@ -0,0 +1,56 @@
+COMMENT(!MOD!zsh/random
+Some High-quality randomness parameters and functions.
+!MOD!)
+The tt(zsh/random) module gets random data from the kernel random pool. If no
+kernel random pool can be found, the module will not load.
+
+subsect(Parameters)
+
+startitem()
+vindex(SRANDOM)
+item(tt(SRANDOM)) (
+A random positive 32-bit integer between 0 and 4,294,967,295.  This parameter
+is read-only. The name was chosen for compatibility with Bash and to
+distinguish it from tt(RANDOM) which has a documented repeatable behavior.
+)
+enditem()
+
+subsect(Math Functions)
+
+startitem()
+item(tt(zrand_float+LPAR()RPAR())) (
+Returns a random floating point number between 0 and 1 inclusive.
+)
+enditem()
+
+startitem()
+item(tt(zrand_int)+LPAR()tt(upper), tt(lower), tt(inclusive)RPAR()) (
+Returns a random integer between tt(lower) and tt(upper). All parameters are
+optional.  If none are specified it is equivalent to
+tt(SRANDOM).
+
+tt(upper) is the upper bound on the resultant number and defaults to
+4,294,967,295.
+
+tt(lower) is the lower bound and defaults to 0.
+
+The defaults of these two arguments are also the maximum and minimum to which
+either can be set.
+
+tt(inclusive) is a flag that controls whether the result is ever equal to
+tt(upper).  By default it is not. If this argument is set to a non-zero value
+then it may be.
+
+This is to facilitate a construct like tt($a[zrand_int+LPAR()$#a+RPAR()+1]) rather
+than tt($a[zrand_int+LPAR()$#a-1+RPAR()+1]).
+For example, if $#a is 16, you would use tt(zrand_int+LPAR()16RPAR()) which has
+16 possible return values 0-15.  Because the function can return zero, in order
+to use it as an array index from 1-16 you need to add one.  It would
+be an array index range error for it to also potentially return 16 ($#a). You
+could, however, use the construct tt(zrand_int+LPAR()16,1,1+RPAR()) instead of
+adding 1 to achieve the same result, but it is more verbose.
+
+Most statistics algorithms seem to also expect 0 to tt(upper)-1, so this was
+deemed the most commonly desired case and chosen as the default.
+)
+enditem()
diff --git a/Doc/intro.ms b/Doc/intro.ms
index 4dd08f601..49f6cc07f 100644
--- a/Doc/intro.ms
+++ b/Doc/intro.ms
@@ -3,8 +3,32 @@
 .if \n(.g \{\
 .if "\*(.T"ascii" .ftr C R
 .if "\*(.T"latin1" .ftr C R
+.if "\*(.T"html" .nr HTML 1
 .nr De \n[.ss]
 .\}
+.\" ----- macro defintions -----
+.\" Ds/De: start/end of example
+.\" Sh: section header
+.\" XXX: It seems we can't use the same definition for both pdf and html
+.\"      (at least with groff-12.3.0).
+.\"
+.\" for HTML output
+.ie \n[HTML] \{\
+.de Ds
+.DS I .5i
+.ft C
+..
+.de De
+.DE
+.ft R
+..
+.de Sh
+.NH
+\\$1
+..
+.\}
+.\" for other output (such as PDF)
+.el \{\
 .de Ds
 .DS I .5i
 .ft C
@@ -21,12 +45,13 @@
 .el .ss
 ..
 .de Sh
-.SH
-\\$1
-.XS
-\\$1
-.XE
+.NH
+.XN \\$1
 ..
+.\}
+.\"
+.\" ----- Cover page -----
+.if !\n[HTML] \{\
 .nr HM 4i
 .ce 99
 .ps 18
@@ -50,6 +75,9 @@ bas@phys.uva.nl\fP
 .sv |1i
 .pn 1
 .bp
+.\}
+.\"
+.\" ----- main text -----
 .TL
 An Introduction to the Z Shell
 .AU
@@ -2712,6 +2740,7 @@ I (Bas de Bakker) would be happy to receive mail if anyone has any
 tricks or ideas to add to this document, or if there are some points
 that could be made clearer or covered more thoroughly.  Please notify
 me of any errors in this document.
+.if !\n[HTML] \{\
 .if o \{\
 .bp
 .sv 1i
@@ -2719,3 +2748,4 @@ me of any errors in this document.
 .pn 1
 .bp
 .PX
+.\}