diff -uNr dmd-0.132/dmd/html/d/changelog.html dmd-0.133/dmd/html/d/changelog.html --- dmd-0.132/dmd/html/d/changelog.html 2005-09-19 15:55:44.000000000 +0200 +++ dmd-0.133/dmd/html/d/changelog.html 2005-09-24 19:33:04.000000000 +0200 @@ -45,7 +45,7 @@ target="_top" title="Read/write comments and feedback">Comments
-Last update Mon Sep 19 2005 +Last update Sat Sep 24 2005
@@ -115,6 +115,7 @@
+

+ What's New for + D 0.133 +

+ +Sep 24, 2005 +

+ +

New/Changed Features

+ + +

Ddoc

+ + +

Bugs Fixed

+ + +

What's New for D 0.132 diff -uNr dmd-0.132/dmd/html/d/dcompiler.html dmd-0.133/dmd/html/d/dcompiler.html --- dmd-0.132/dmd/html/d/dcompiler.html 2005-09-18 11:39:24.000000000 +0200 +++ dmd-0.133/dmd/html/d/dcompiler.html 2005-09-24 12:56:42.000000000 +0200 @@ -45,7 +45,7 @@ target="_top" title="Read/write comments and feedback">Comments
-Last update Sun Sep 18 2005 +Last update Sat Sep 24 2005

@@ -267,6 +267,8 @@ /ma/li
-O
optimize +
-o-
+
suppress generation of object file
-odobjdir
write object files relative to directory objdir instead of to the current directory @@ -349,7 +351,7 @@ -

SC.INI Initialization File

+

SC.INI Initialization File

dmd will look for the initialization file sc.ini in the same directory dmd.exe resides in. If found, environment variable @@ -370,6 +372,7 @@ LIB="%@P%\..\lib";\dm\lib DFLAGS="-I%@P%\..\src\phobos" LINKCMD="%@P%\..\..\dm\bin" + DDOCFILE=mysettings.ddoc

Common Installation Problems

@@ -519,6 +522,8 @@ -M
-O
optimize +
-o-
+
suppress generation of object file
-odobjdir
write object files relative to directory objdir instead of to the current directory diff -uNr dmd-0.132/dmd/html/d/ddoc.html dmd-0.133/dmd/html/d/ddoc.html --- dmd-0.132/dmd/html/d/ddoc.html 2005-09-19 15:55:44.000000000 +0200 +++ dmd-0.133/dmd/html/d/ddoc.html 2005-09-24 19:33:26.000000000 +0200 @@ -45,7 +45,7 @@ target="_top" title="Read/write comments and feedback">Comments
-Last update Mon Sep 19 2005 +Last update Sat Sep 24 2005
@@ -227,10 +227,12 @@ part of the documentation comment. +/ +/**************** Closing *'s are not part *****************/ + -The extra *'s and +'s on the comment opening and left margin are ignored -and are not part +The extra *'s and +'s on the comment opening, closing and left margin are +ignored and are not part of the embedded documentation. Comments not following one of those forms are not documentation comments. @@ -309,15 +311,15 @@ While the summary can be any length, try to keep it to one line. The Summary section is optional. -

Synopsis

+

Description

-The next unnamed section is the Synopsis. +The next unnamed section is the Description. It consists of all the paragraphs following the Summary until a section name is encountered or the end of the comment.

-While the Synopsis section is optional, -there cannot be a Synopsis without a Summary section. +While the Description section is optional, +there cannot be a Description without a Summary section.

@@ -334,7 +336,7 @@
 void myfunc() { }
 
-Named sections follow the Summary and Synopsis unnamed sections. +Named sections follow the Summary and Description unnamed sections. @@ -345,19 +347,29 @@
-
Author: +
Authors:
Lists the author(s) of the declaration.
 /**
- * Author: Melvin D. Nerd
+ * Authors: Melvin D. Nerd, melvin@mailinator.com
  */
 
-
Version: -
Specifies the version of the declaration. +
Bugs: +
Lists any known bugs.
 /**
- * Version: 1.6a
+ * Bugs: Doesn't work for negative values.
+ */
+
+ +
Date: +
Specifies the date of the current revision. The date should be in a form + parseable by std.date. + +
+/**
+ * Date: March 14, 2003
  */
 
@@ -373,24 +385,36 @@ deprecated void foo() { ... } -
License: -
Any license information for copyrighted code. +
Examples: +
Any usage examples
 /**
- * License: use freely for any purpose
+ * Examples:
+ * --------------------
+ * writefln("3"); // writes '3' to stdout
+ * --------------------
  */
-
-void bar() { ... }
 
-
Date: -
Specifies the date of the last revision. The date should be in a form - parseable by std.date. +
History: +
Revision history. +
+/**
+ * History:
+ *	V1 is initial version
+ *
+ *	V2 added feature X
+ */
+
+
License: +
Any license information for copyrighted code.
 /**
- * Date: March 14, 2003
+ * License: use freely for any purpose
  */
+
+void bar() { ... }
 
Returns: @@ -405,6 +429,24 @@ void[] readFile(char[] filename) { ... } +
See_Also: +
List of other symbols and URL's to related items. +
+/**
+ * See_Also:
+ *    foo, bar, http://www.digitalmars.com/d/phobos/index.html
+ */
+
+ +
Standards: +
If this declaration is compliant with any particular standard, +the description of it goes here. +
+/**
+ * Standards: Conforms to DSPEC-1234
+ */
+
+
Throws:
Lists exceptions thrown and under what circumstances they are thrown.
@@ -416,12 +458,11 @@
 void writeFile(char[] filename) { ... }
 
-
References: -
List of other symbols and URL's to related items. +
Version: +
Specifies the current version of the declaration.
 /**
- * References:
- *    foo, bar, http://www.digitalmars.com/d/phobos/index.html
+ * Version: 1.6a
  */
 
@@ -435,6 +476,18 @@
+
Copyright: +
This contains the copyright notice. The macro COPYRIGHT is set to + the contents of the section when it documents the module declaration. + The copyright section only gets this special treatment when it + is for the module declaration. + +
+/** Copyright: Public Domain */
+
+module foo;
+
+
Params:
Function parameters can be documented by listing them in a params section. Each line that starts with an identifier followed by @@ -455,44 +508,6 @@ } -
Copyright: -
This contains the copyright notice. The macro COPYRIGHT is set to - the contents of the section. - The COPYRIGHT macro is often expanded in the boilerplate section. - The copyright section only gets this special treatment when it - is for the module declaration. - -
-/** Copyright: Public Domain */
-
-module foo;
-
- -
Boilerplate: -
The boilerplate section enables complete control over how the generated - documentation is inserted into a boilerplate document. - The documentation created is set as the replacement text for the - BODY macro. - Boilerplate sections only matter for the module declaration. - -
-/**
- * Boilerplate:
- *	<html>
- *	<title>$(TITLE)</title>
- *	<body>
- *	<h1>$(TITLE)</h1>
- *	$(BODY)
- *	<hr>
- *	Last update: $(DATETIME)
- *	$(COPYRIGHT)
- *	</body>
- *	</html>
- */
-
-module bar;
-
-
Macros:
The macros section follows the same syntax as the Params: section. It's a series of NAME=value pairs. @@ -504,57 +519,13 @@ * FOO = now is the time for * all good men * BAR = bar + * MAGENTA = <font color=magenta>$0</font> */
-

Macros

- - The documentation comment processor includes a simple macro - text preprocessor. There are predefined macros, and macros - defined by the Macros: section. - When a appears - in section text it is replaced with NAME's corresponding - replacment text. - The replacement text is then recursively scanned for more macros. - If a macro is recursively encountered, only one level of recursion - is performed. - Macro invocations that cut across replacement text boundaries are - not expanded. - If NAME is not a macro name, it is assumed to be a file name, - and the contents of the file with that name become the replacement - text. (By convention, non-filename macro names are in all upper case, - and filenames are not.) - If the file does not exist, the replacement text has no characters - in it. - If a is desired to exist in the output without being macro - expanded, add an extra $ as in: $(NAME). The extra $ will be elided. - -

Predefined Macros

- -
- - - - - -
BODY - The generated document text before it is inserted into the - boilerplate text. -
TITLE - Set to the module name. -
DATETIME - Set to the current date and time. -
YEAR - Set to the current year. -
COPYRIGHT - Set to the contents of any Copyright: section that is part - of the module comment. -
- -

Highlighting

comments, or tags. +

+ + Macro definitions come from the following sources, + in the specified order: + +

    +
  1. Predefined macros. +
  2. Definitions from file specified by sc.ini's DDOCFILE setting. +
  3. Definitions from *.ddoc files specified on the command line. +
  4. Runtime definitions generated by Ddoc. +
  5. Definitions from any Macros: sections. +
+ + Macro redefinitions replace previous definitions of the same name. + This means that the sequence of macro definitions from the various + sources forms a heirarchy. +

+ + Macro names beginning with "D_" and "DDOC_" are reserved. + +

Predefined Macros

+ + These are hardwired into Ddoc, and represent the + minimal definitions needed by Ddoc to format and highlight + the presentation. + The definitions are for simple HTML. + +
+B =	<b>$0</b>
+I =	<i>$0</i>
+U =	<u>$0</u>
+P =	<p>$0</p>
+DL =	<dl>$0</dl>
+DT =	<dt>$0</dt>
+DD =	<dd>$0</dd>
+TABLE =	<table>$0</table>
+TR =	<tr>$0</tr>
+TH =	<th>$0</th>
+TD =	<td>$0</td>
+OL =	<ol>$0</ol>
+UL =	<ul>$0</ul>
+LI =	<li>$0</li>
+BIG =	<big>$0</big>
+SMALL =	<small>$0</small>
+BR =	<br>
+
+RED =	<font color=red>$0</font>
+BLUE =	<font color=blue>$0</font>
+GREEN =	<font color=green>$0</font>
+YELLOW =<font color=yellow>$0</font>
+BLACK =	<font color=black>$0</font>
+WHITE =	<font color=white>$0</font>
+
+D_CODE = <pre class="d_code">$0</pre>
+
+DDOC =	<html><head>
+	<META http-equiv="content-type" content="text/html; charset=utf-8">
+	<title>$(TITLE)</title>
+	</head><body>
+	<h1>$(TITLE)</h1>
+	$(BODY)
+	</body></html>
+
+DDOC_DECL      = $(DT $(BIG $0))
+DDOC_DECL_DD   = $(DD $0)
+DDOC_SECTIONS  = $0
+DDOC_SUMMARY   = $0
+DDOC_DESCRIPTION = $0
+DDOC_SECTION_H = $(P $(B $0))
+DDOC_SECTION   = $0
+DDOC_MEMBERS   = $(DL $0)
+DDOC_PARAMS    = $(P $(TABLE $0))
+DDOC_PARAM_ROW = $(TR $0)
+DDOC_PARAM_ID  = $(TD $0)
+DDOC_PARAM_DESC  = $(TD $0)
+
+DDOC_PSYMBOL	= $(U $0)
+DDOC_KEYWORD	= $(B $0)
+DDOC_PARAM	= $(I $0)
+	
+ + Ddoc does not generate HTML code. It formats into the basic + formatting macros, which (in their predefined form) + are then expanded into HTML. + If output other than HTML is desired, then these macros + need to be redefined. +

+ + + +
Basic Formatting Macros
B boldface the argument +
I italicize the argument +
U underline the argument +
P argument is a paragraph +
DL argument is a definition list +
DT argument is a definition in a definition list +
DD argument is a description of a definition +
TABLE argument is a table +
TR argument is a row in a table +
TH argument is a header entry in a row +
TD argument is a data entry in a row +
OL argument is an ordered list +
UL argument is an unordered list +
LI argument is an item in a list +
BIG argument is one font size bigger +
SMALL argument is one font size smaller +
BR start new line +
RED argument is set to be red +
BLUE argument is set to be blue +
GREEN argument is set to be green +
YELLOW argument is set to be yellow +
BLACK argument is set to be black +
WHITE argument is set to be white +
D_CODE argument is D code +
DDOC overall template for output +
+

+ + DDOC is special in that it specifies the boilerplate into + which the entire generated text is inserted (represented by the + Ddoc generated macro BODY). For example, in order + to use a style sheet, DDOC would be redefined as: + +

+DDOC =	<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+	<html><head>
+	<META http-equiv="content-type" content="text/html; charset=utf-8">
+	<title>$(TITLE)</title>
+	<link rel="stylesheet" type="text/css" href="style.css">
+	</head><body>
+	<h1>$(TITLE)</h1>
+	$(BODY)
+	</body></html>
+	
+ + The highlighting macros start with DDOC_. + They control the formatting of individual parts of the presentation. +

+ + +
DDOC_DECL + Highlighting of the declaration. + +
DDOC_DECL_DD + Highlighting of the description of a declaration. + +
DDOC_SECTIONS + Highlighting of all the sections. + +
DDOC_SUMMARY + Highlighting of the summary section. + +
DDOC_DESCRIPTION + Highlighting of the description section. + +
DDOC_SECTION_H + Highlighting of the section name. + +
DDOC_SECTION + Highlighting of the contents of a section. + +
DDOC_MEMBERS + Highlighting of all the members of a class, struct, etc. + +
DDOC_PARAMS + Highlighting of a function parameter section. + +
DDOC_PARAM_ROW + Highlighting of a name=value function parameter. + +
DDOC_PARAM_ID + Highlighting of the parameter name. + +
DDOC_PARAM_DESC + Highlighting of the parameter value. + +
DDOC_PSYMBOL + Highlighting of declaration name to which a particular section is + referring. + +
DDOC_KEYWORD + Highlighting of D keywords. + +
DDOC_PARAM + Highlighting of function parameters. +
+

+ + For example, one could redefine DDOC_SUMMARY: + +

+DDOC_SECTIONS  = $(GREEN $0)
+	
+ + And all the description sections will now be green. + +

Macro Definitions from sc.ini's DDOCFILE

+ + A text file of macro definitions can be created, + and specified in sc.ini: + +
+DDOCFILE=myproject.ddoc
+	
+ +

Macro Definitions from .ddoc Files on the Command Line

+ + File names on the DMD command line with the extension + .ddoc are text files that are read and processed in order. + +

Macro Definitions Generated by Ddoc

+ + + + + + + +
BODY + Set to the generated document text. +
TITLE + Set to the module name. +
DATETIME + Set to the current date and time. +
YEAR + Set to the current year. +
COPYRIGHT + Set to the contents of any Copyright: section that is part + of the module comment. +
+ + +

Feedback and Comments

Binärfilerna dmd-0.132/dmd/html/d/phobos/erfc.gif och dmd-0.133/dmd/html/d/phobos/erfc.gif skiljer Binärfilerna dmd-0.132/dmd/html/d/phobos/erf.gif och dmd-0.133/dmd/html/d/phobos/erf.gif skiljer diff -uNr dmd-0.132/dmd/html/d/phobos/std_math.html dmd-0.133/dmd/html/d/phobos/std_math.html --- dmd-0.132/dmd/html/d/phobos/std_math.html 2005-09-19 17:53:32.000000000 +0200 +++ dmd-0.133/dmd/html/d/phobos/std_math.html 2005-09-24 15:33:42.000000000 +0200 @@ -12,6 +12,7 @@ Digital Mars - The D Programming Language - std.math + @@ -21,11 +22,10 @@ Home | Search | D -| Comments +| Comments
-Last update Mon Sep 19 17:53:31 2005 +Last update Sat Sep 24 15:33:41 2005
@@ -103,408 +103,1112 @@
-

-
-
const real E; + +

+ + +
+
const real E;
-
-

e +

+

e

+ +
-
const real LOG2T; +
const real LOG2T;
-
-

log210 +

+

log210

+ +
-
const real LOG2E; +
const real LOG2E;
-
-

log2e +

+

log2e

+ +
-
const real LOG2; +
const real LOG2;
-
-

log102 +

+

log102

+ +
-
const real LOG10E; +
const real LOG10E;
-
-

log10e +

+

log10e

+ +
-
const real LN2; +
const real LN2;
-
-

ln 2 +

+

ln 2

+ +
-
const real LN10; +
const real LN10;
-
-

ln 10 +

+

ln 10

+ +
-
const real PI; +
const real PI;
-
-

π +

+

π

+ +
-
const real PI_2; +
const real PI_2;
-
-

π / 2 +

+

π / 2

+ +
-
const real PI_4; +
const real PI_4;
-
-

π / 4 +

+

π / 4

+ +
-
const real M_1_PI; +
const real M_1_PI;
-
-

1 / π +

+

1 / π

+ +
-
const real M_2_PI; +
const real M_2_PI;
-
-

2 / π +

+

2 / π

+ +
-
const real M_2_SQRTPI; +
const real M_2_SQRTPI;
-
-

2 / √π +

+

2 / √π

+ +
-
const real SQRT2; +
const real SQRT2;
-
-

√2 +

+

√2

+ +
-
const real SQRT1_2; +
const real SQRT1_2;
-
-

√½ +

+

√½

+ +
-
real cos(real x); +
real cos(real x);
-
-

Returns cosine of x. x is in radians. +

+

Returns cosine of x. x is in radians.

-

- -
Special Values
x cos(x) invalid? -
NAN NAN yes -
±∞ NAN yes + +

+ + + + +
Special Values
x cos( x) invalid?
NAN NAN yes
±∞ NAN yes

+ + -
real sin(real x); +
real sin(real x);
-
-

Returns sine of x. x is in radians. +

+

Returns sine of x. x is in radians.

-

- -
Special Values
x sin(x) invalid? -
NAN NAN yes + +

+ + +
Special Values
x sin( x) invalid? +
NAN NAN yes
±0.0 ±0.0 no -
±∞ NAN yes +
±∞ NAN yes

+ + -
real tan(real x); +
real tan(real x);
-
-

Returns tangent of x. x is in radians. +

+

Returns tangent of x. x is in radians.

-

- -
Special Values
x tan(x) invalid? -
NAN NAN yes + +

+ + +
Special Values
x tan( x) invalid? +
NAN NAN yes
±0.0 ±0.0 no -
±∞ NAN yes +
±∞ NAN yes

+ + + +
real acos(real x); +
+
+

Calculates the arc cosine of x, + returning a value ranging from -π/2 to π/2. +

+ +

+ + +
Special Values
x acos( x) invalid? +
>1.0 NAN yes +
<-1.0 NAN yes +
NAN NAN yes +
+ +

+ + +
+
real asin(real x); +
+
+

Calculates the arc sine of x, + returning a value ranging from -π/2 to π/2. +

+ +

+ + +
Special Values
x asin( x) invalid? +
±0.0 ±0.0 no +
>1.0 NAN yes +
<-1.0 NAN yes +
+ +

+ + +
+
real atan(real x); +
+
+

Calculates the arc tangent of x, + returning a value ranging from -π/2 to π/2. +

+ +

+ + +
Special Values
x atan( x) invalid? +
±0.0 ±0.0 no +
±∞ NAN yes +
+ +

+ + +
+
real atan2(real x,real y); +
+
+

Calculates the arc tangent of y / x, + returning a value ranging from -π/2 to π/2. +

+ +

+ + +
Special Values
x y atan( x, y) +
NAN anything NAN +
anything NAN NAN +
±0.0 > 0.0 ±0.0 +
±0.0 ±0.0 ±0.0 +
±0.0 < 0.0 ±π +
±0.0 -0.0 ±π +
> 0.0 ±0.0 π/2 +
< 0.0 ±0.0 π/2 +
> 0.0 ±0.0 +
±∞ anything ±π/2 +
> 0.0 -∞ ±π +
±∞ ±π/4 +
±∞ -∞ ±3π/4 +
+ +

+ + +
+
real cosh(real x); +
+
+

Calculates the hyperbolic cosine of x. +

+ +

+ + +
Special Values
x cosh( x) invalid? +
±∞ ±0.0 no +
+ +

+ + +
+
real sinh(real x); +
+
+

Calculates the hyperbolic sine of x. +

+ +

+ + +
Special Values
x sinh( x) invalid? +
±0.0 ±0.0 no +
±∞ ±∞ no +
+ +

+ + +
+
real tanh(real x); +
+
+

Calculates the hyperbolic tangent of x. +

+ +

+ + +
Special Values
x tanh( x) invalid? +
±0.0 ±0.0 no +
±∞ ±1.0 no +
+ +

+ + +
+
long rndtol(real x); +
+
+

Returns x rounded to a long value using the current rounding mode. + If the integer value of x is + greater than long.max, the result is + indeterminate. + +

+ +
-
real ldexp(real n,int exp); +
realC rndtonl(real x);
-
-

Compute n * 2exp +

+

Returns x rounded to a long value using the FE_TONEAREST rounding mode. + If the integer value of x is + greater than long.max, the result is + indeterminate. +

-

References:

frexp + + +

+
float sqrt(float x); +
double sqrt(double x); +
real sqrt(real x); +
+
+

Compute square root of x. +

+ +

+ + +
Special Values
x sqrt( x) invalid? +
-0.0 -0.0 no +
<0.0 NAN yes +
+∞ +∞ no +

+ +
-
float sqrt(float x); -
double sqrt(double x); -
real sqrt(real x); +
real exp(real x);
-
-

Compute square root of x. +

+

Calculates e x.

-

- - - - - -
Special Values
x sqrt(x) invalid? -
-0.0 -0.0 no -
<0.0 NAN yes -
+∞ +∞ no + +

+ + +
Special Values
x exp( x) +
+∞ +∞ +
-∞ +0.0

+ + -
real cbrt(real x); +
real exp2(real x);
-
-

Cube root. +

+

Calculates 2 x. +

+ +

+ + +
Special Values
x exp2( x) +
+∞ +∞ +
-∞ +0.0 +

+ +
-
real expm1(real x); +
real expm1(real x);
-
-

Calculates the value of the natural logarithm base (e) - raised to the power of x, minus 1. +

+

Calculates the value of the natural logarithm base (e) + raised to the power of x, minus 1.

-

For very small x, expm1(x) is more accurate - than exp(x)-1. + +

For very small x, expm1( x) is more accurate + than exp( x)-1.

-

+

- - + +
Special Values
x ex-1 +
Special Values
x e x-1
±0.0 ±0.0
+∞ +∞
-∞ -1.0

+ +
-
real log(real x); +
real frexp(real value,out int exp);
-
-

Calculate the natural logarithm of x. +

+

Separate floating point value into significand and exponent. +

+ +

+ +

Returns:

Calculate and return x and exp such that + value =x*2 exp and + .5 <= |x| < 1.0
+ x has same sign as value.

-

- - - - - -
Special Values
x log(x) divide by 0? invalid? -
±0.0 -∞ yes no -
< 0.0 NAN no yes -
+∞ +∞ no no +

+ + + +
Special Values
value returns exp +
±0.0 ±0.0 0 +
+∞ +∞ int.max +
-∞ -∞ int.min +
±NAN ±NAN int.min

+ + -
real log10(real x); +
int ilogb(real x);
-
-

Calculate the base-10 logarithm of x. +

+

Extracts the exponent of x as a signed integral value.

-

- - - - - -
Special Values
x log10(x) divide by 0? invalid? -
±0.0 -∞ yes no -
< 0.0 NAN no yes -
+∞ +∞ no no + +

If x is not a special value, the result is the same as + cast(int)logb( x). +

+

+ + + +
Special Values
x ilogb( x) Range error? +
0 FP_ILOGB0 yes +
±∞ +∞ no +
NAN FP_ILOGBNAN no

+ + -
real log1p(real x); +
real ldexp(real n,int exp);
-
-

Calculates the natural logarithm of 1 + x. +

+

Compute n * 2 exp

-

For very small x, log1p(x) will be more accurate than - log(1 + x). + +

References:

frexp +

-

- - - - - - - -
Special Values
x log1p(x) divide by 0? invalid? -
±0.0 ±0.0 no no -
-1.0 -∞ yes no -
<-1.0 NAN no yes -
+∞ -∞ no no + + + +
real log(real x); +
+
+

Calculate the natural logarithm of x. +

+ +

+ + +
Special Values
x log( x) divide by 0? invalid? +
±0.0 -∞ yes no +
< 0.0 NAN no yes +
+∞ +∞ no no

+ +
-
int isnan(real e); +
real log10(real x);
-
-

Is number a nan? +

+

Calculate the base-10 logarithm of x. +

+ +

+ + +
Special Values
x log10( x) divide by 0? invalid? +
±0.0 -∞ yes no +
< 0.0 NAN no yes +
+∞ +∞ no no +

+ +
-
int isfinite(real e); +
real log1p(real x);
-
-

Is number finite? +

+

Calculates the natural logarithm of 1 + x. +

+ +

For very small x, log1p( x) will be more accurate than + log(1 + x). +

+

+ + + +
Special Values
x log1p( x) divide by 0? invalid? +
±0.0 ±0.0 no no +
-1.0 -∞ yes no +
<-1.0 NAN no yes +
+∞ -∞ no no +

+ +
-
int isnormal(float f); -
int isnormal(double d); -
int isnormal(real e); +
real log2(real x);
-
-

Is number normalized? +

+

Calculates the base-2 logarithm of x: + log2 x +

+ +

+ + +
Special Values
x log2( x) divide by 0? invalid? +
±0.0 -∞ yes no +
< 0.0 NAN no yes +
+∞ +∞ no no +

+ +
-
int issubnormal(float f); -
int issubnormal(double d); -
int issubnormal(real e); +
real logb(real x);
-
-

Is number subnormal? (Also called "denormal".) - Subnormals have a 0 exponent and a 0 most significant mantissa bit. +

+

Extracts the exponent of x as a signed integral value. +

+ +

If x is subnormal, it is treated as if it were normalized. + For a positive, finite x: +

+

+

+	1 <=   x * FLT_RADIX-  logb(  x) < FLT_RADIX
+	
+

+

+ + + +
Special Values
x logb( x) Divide by 0? +
±∞ +∞ no +
±0.0 -∞ yes +

+ +
-
int isinf(real e); +
real modf(real x,inout real y);
-
-

Is number infinity? +

+

Calculates the remainder from the calculation x/ y. +

+ +

Returns:

The value of x - i * y, where i is the number of times that y can + be completely subtracted from x. The result has the same sign as x. +

+

+ + + +
Special Values
x y modf( x, y) invalid? +
±0.0 not 0.0 ±0.0 no +
±∞ anything NAN yes +
anything ±0.0 NAN yes +
!=±∞ ±∞ x no +

+ +
-
int signbit(real e); +
real scalbn(real x,int n);
-
-

Get sign bit. +

+

Efficiently calculates x * 2 n. +

+ +

scalbn handles underflow and overflow in + the same fashion as the basic arithmetic operators. +

+

+ + + +
Special Values
x scalb( x) +
±∞ ±∞ +
±0.0 ±0.0 +

+ +
-
real copysign(real to,real from); +
real cbrt(real x);
-
-

Copy sign. +

+

Calculates the cube root x. +

+ +

+ + +
Special Values
x cbrt( x) invalid? +
±0.0 ±0.0 no +
NAN NAN yes +
±∞ ±∞ no +

+ +
-
real hypot(real x,real y); +
real fabs(real x);
-
-

Calculates the length of the - hypotenuse of a right-angled triangle with sides of length x and y. +

+

Returns | x| +

+ +

+ + +
Special Values
x fabs( x) +
±0.0 +0.0 +
±∞ +∞ +
+ +

+ + +
+
real hypot(real x,real y); +
+
+

Calculates the length of the + hypotenuse of a right-angled triangle with sides of length x and y. The hypotenuse is the value of the square root of - the sums of the squares of x and y: + the sums of the squares of x and y:

-

sqrt(x² + y²) + +

sqrt( x² + y²)

-

- Note that hypot(x, y), hypot(y, x) and - hypot(x, -y) are equivalent. +

+ Note that hypot( x, y), hypot( y, x) and + hypot( x, - y) are equivalent.

-

+

- - - - - - + +
Special Values
x y hypot(x, y) invalid? -
x ±0.0 |x| no -
±∞ y +∞ no -
±∞ NAN +∞ no +
Special Values
x y hypot( x, y) invalid? +
x ±0.0 | x| no +
±∞ y +∞ no +
±∞ NAN +∞ no

+ +
-
real frexp(real value,out int exp); +
real erf(real x);
-
-

Separate floating point value into significand and exponent. +

+

Returns the error function of x.

-

-

Returns:

Calculate and return x and exp such that - value =x*2exp and - .5 <= |x| < 1.0
- x has same sign as value. + +

error function + +

+ + +
+
real erfc(real x); +
+
+

Returns the complementary error function of x, which is 1 - erf( x). +

+ +

complementary error function + +

+ + +
+
real lgamma(real x); +
+
+

Calculates ln |Γ( x)| + +

+ + +
+
real tgamma(real x); +
+
+

Calculates the gamma function Γ( x) + +

+ + +
+
real ceil(real x); +
+
+

Returns the value of x rounded upward to the next integer + (toward positive infinity). + +

+ + +
+
real floor(real x); +
+
+

Returns the value of x rounded downward to the next integer + (toward negative infinity). + +

+ + +
+
real nearbyint(real x); +
+
+

Rounds x to the nearest integer value, using the current rounding + mode.

-

+ +

Unlike the rint functions, nearbyint does not raise the + FE_INEXACT exception. + +

+ + +
+
real rint(real x); +
+
+

Rounds x to the nearest integer value, using the current rounding + mode. + If the return value is not equal to x, the FE_INEXACT + exception is raised. + nearbyint performs + the same operation, but does not set the FE_INEXACT exception. + +

+ + +
+
long lrint(real x); +
+
+

Rounds x to the nearest integer value, using the current rounding + mode. + +

+ + +
+
real round(real x); +
+
+

Return the value of x rounded to the nearest integer. + If the fractional part of x is exactly 0.5, the return value is rounded to + the even integer. + +

+ + +
+
long lround(real x); +
+
+

Return the value of x rounded to the nearest integer. +

+ +

If the fractional part of x is exactly 0.5, the return value is rounded + away from zero. + +

+ + +
+
real trunc(real x); +
+
+

Returns the integer portion of x, dropping the fractional portion. +

+ +

This is also know as "chop" rounding. + +

+ + +
+
real remainder(real x,real y); +
real remquo(real x,real y,out int n); +
+
+

Calculate the remainder x REM y, following IEC 60559. +

+ +

REM is the value of x - y * n, where n is the integer nearest the exact + value of x / y. + If |n - x / y| == 0.5, n is even. + If the result is zero, it has the same sign as x. + Otherwise, the sign of the result is the sign of x / y. + Precision mode has no affect on the remainder functions. +

+

+ remquo returns n in the parameter n. +

+

- - - - - - - + +
Special values
value returns exp -
±0.0 ±0.0 0 -
+∞ +∞ int.max -
-∞ -∞ int.min -
±NAN ±NAN int.min +
Special Values
x y remainder( x, y) n invalid? +
±0.0 not 0.0 ±0.0 0.0 no +
±∞ anything NAN ? yes +
anything ±0.0 NAN ? yes +
!= ±∞ ±∞ x ? no

+ +
-
real pow(real x,uint n); -
real pow(real x,int n); +
int isnan(real e);
-
-

Fast integral powers. +

+

Returns !=0 if e is a NaN.

+ +
-
int feqrel(real x,real y); +
int isfinite(real e);
-
-

To what precision is x equal to y? +

+

Returns !=0 if e is finite. + +

+ + +
+
int isnormal(float x); +
int isnormal(double d); +
int isnormal(real e); +
+
+

Returns !=0 if x is normalized. +

-

-

Returns:

the number of mantissa bits which are equal in x and y. + + +

+
int issubnormal(float f); +
int issubnormal(double d); +
int issubnormal(real e); +
+
+

Is number subnormal? (Also called "denormal".) + Subnormals have a 0 exponent and a 0 most significant mantissa bit. + +

+ + +
+
int isinf(real e); +
+
+

Return !=0 if e is ±∞. + +

+ + +
+
int signbit(real e); +
+
+

Return 1 if sign bit of e is set, 0 if not. + +

+ + +
+
real copysign(real to,real from); +
+
+

Return a value composed of to with from's sign bit. + +

+ + +
+
real nan(char[] tagp); +
+
+

Creates a quiet NAN with the information from tagp[] embedded in it. + +

+ + +
+
real nextafter(real x,real y); +
+
+

Calculates the next representable value after x in the direction of y. +

+ +

If y > x, the result will be the next largest floating-point value; + if y < x, the result will be the next smallest value. + If x == y, the result is y. + The FE_INEXACT and FE_OVERFLOW exceptions will be raised if x is finite and + the function result is infinite. The FE_INEXACT and FE_UNDERFLOW + exceptions will be raised if the function value is subnormal, and x is + not equal to y. + +

+ + +
+
real fdim(real x,real y); +
+
+

Returns the positive difference between x and y. +

+ +

Returns:

+
x, y fdim( x, y) +
x > y x - y +
x <= y +0.0 +
+ +

+ + +
+
real fmax(real x,real y); +
+
+

Returns the larger of x and y. + +

+ + +
+
real fmin(real x,real y); +
+
+

Returns the smaller of x and y. + +

+ + +
+
real fma(real x,real y,real z); +
+
+

Returns ( x * y) + z, rounding only once according to the + current rounding mode. + +

+ + +
+
real pow(real x,uint n); +
real pow(real x,int n); +
+
+

Fast integral powers. + +

+ + +
+
real pow(real x,real y); +
+
+

Calculates x y. +

+ +

+ + + + + + + + + + + + + + + + + + + + +
Special Values
x y pow( x, y) div 0 invalid? +
anything ±0.0 1.0 no no +
| x| > 1 +∞ +∞ no no +
| x| < 1 +∞ +0.0 no no +
| x| > 1 -∞ +0.0 no no +
| x| < 1 -∞ +∞ no no +
+∞ > 0.0 +∞ no no +
+∞ < 0.0 +0.0 no no +
-∞ odd integer > 0.0 -∞ no no +
-∞ > 0.0, not odd integer +∞ no no +
-∞ odd integer < 0.0 -0.0 no no +
-∞ < 0.0, not odd integer +0.0 no no +
±1.0 ±∞ NAN no yes +
< 0.0 finite, nonintegral NAN no yes +
±0.0 odd integer < 0.0 ±∞ yes no +
±0.0 < 0.0, not odd integer +∞ yes no +
±0.0 odd integer > 0.0 ±0.0 no no +
±0.0 > 0.0, not odd integer +0.0 no no +
+ +

+ + +
+
int feqrel(real x,real y); +
+
+

To what precision is x equal to y? +

+ +

+ +

Returns:

the number of mantissa bits which are equal in x and y. eg, 0x1.F8p+60 and 0x1.F1p+60 are equal to 5 bits of precision.

-

+

- - - - - - - - + +
Special values
x y feqrel(x, y) -
x x real.mant_dig -
x >= 2*x 0 -
x <= x/2 0 -
NAN any 0 -
any NAN 0 +
Special Values
x y feqrel( x, y) +
x x real.mant_dig +
x >= 2* x 0 +
x <= x/2 0 +
NAN any 0 +
any NAN 0

+ +
@@ -514,9 +1218,7 @@

Feedback and Comments

- Add feedback and comments regarding this + Add feedback and comments regarding this page.
@@ -524,15 +1226,14 @@ - @@ -541,4 +1242,3 @@ - diff -uNr dmd-0.132/dmd/html/d/phobos/std_outbuffer.html dmd-0.133/dmd/html/d/phobos/std_outbuffer.html --- dmd-0.132/dmd/html/d/phobos/std_outbuffer.html 2005-09-19 15:01:30.000000000 +0200 +++ dmd-0.133/dmd/html/d/phobos/std_outbuffer.html 2005-09-24 15:02:24.000000000 +0200 @@ -12,6 +12,7 @@ Digital Mars - The D Programming Language - std.outbuffer + @@ -21,11 +22,10 @@ Home | Search | D -| Comments +| Comments
-Last update Mon Sep 19 15:01:28 2005 +Last update Sat Sep 24 15:02:22 2005
@@ -103,120 +103,150 @@
-

-
-
class OutBuffer; + +

+ +

Boilerplate:

+

+ + +
+
class OutBuffer;
-
-

OutBuffer provides a way to build up an array of bytes out +

+

OutBuffer provides a way to build up an array of bytes out of raw data. It is useful for things like preparing an array of bytes to write out to a file. - OutBuffer's byte order is the format native to the computer. + OutBuffer's byte order is the format native to the computer. To control the byte order (endianness), use a class derived - from OutBuffer. + from OutBuffer.

-
-
ubyte[] toBytes(); + + +
+
ubyte[] toBytes();
-
-

Convert to array of bytes. +

+

Convert to array of bytes.

+ +
-
void reserve(uint nbytes); +
void reserve(uint nbytes);
-
-

Preallocate nbytes more to the size of the internal buffer. +

+

Preallocate nbytes more to the size of the internal buffer.

-

This is a + +

This is a speed optimization, a good guess at the maximum size of the resulting buffer will improve performance by eliminating reallocations and copying.

+ +
-
void write(ubyte[]bytes); -
void write(ubyte b); -
void write(byte b); -
void write(char c); -
void write(ushort w); -
void write(short s); -
void write(wchar c); -
void write(uint w); -
void write(int i); -
void write(ulong l); -
void write(long l); -
void write(float f); -
void write(double f); -
void write(real f); -
void write(char[]s); -
void write(OutBuffer buf); +
void write(ubyte[] bytes); +
void write(ubyte b); +
void write(byte b); +
void write(char c); +
void write(ushort w); +
void write(short s); +
void write(wchar c); +
void write(uint w); +
void write(int i); +
void write(ulong l); +
void write(long l); +
void write(float f); +
void write(double f); +
void write(real f); +
void write(char[] s); +
void write(OutBuffer buf);
-
-

Append data to the internal buffer. +

+

Append data to the internal buffer.

+ +
-
void fill0(uint nbytes); +
void fill0(uint nbytes);
-
-

Append nbytes of 0 to the internal buffer. +

+

Append nbytes of 0 to the internal buffer.

+ +
-
void alignSize(uint alignsize); +
void alignSize(uint alignsize);
-
-

0-fill to align on power of 2 boundary. +

+

0-fill to align on power of 2 boundary.

+ +
-
void align2(); +
void align2();
-
-

Optimize common special case alignSize(2) +

+

Optimize common special case alignSize(2)

+ +
-
void align4(); +
void align4();
-
-

Optimize common special case alignSize(4) +

+

Optimize common special case alignSize(4)

+ +
-
char[] toString(); +
char[] toString();
-
-

Convert internal buffer to array of chars. +

+

Convert internal buffer to array of chars.

+ +
-
void vprintf(char[]format,void*args); +
void vprintf(char[] format,void* args);
-
-

Append output of C's vprintf() to internal buffer. +

+

Append output of C's vprintf() to internal buffer.

+ +
-
void printf(char[]format,...); +
void printf(char[] format,...);
-
-

Append output of C's printf() to internal buffer. +

+

Append output of C's printf() to internal buffer.

+ +
-
void spread(uint index,uint nbytes); +
void spread(uint index,uint nbytes);
-
-

At offset index into buffer, create nbytes of space by shifting upwards - all data past index. +

+

At offset index into buffer, create nbytes of space by shifting upwards + all data past index.

+ +
-
-

+
@@ -225,9 +255,7 @@

Feedback and Comments

- Add feedback and comments regarding this + Add feedback and comments regarding this page.
@@ -235,15 +263,14 @@ - @@ -252,4 +279,3 @@ - diff -uNr dmd-0.132/dmd/html/d/phobos/std_path.html dmd-0.133/dmd/html/d/phobos/std_path.html --- dmd-0.132/dmd/html/d/phobos/std_path.html 2005-09-19 17:53:48.000000000 +0200 +++ dmd-0.133/dmd/html/d/phobos/std_path.html 2005-09-24 15:34:40.000000000 +0200 @@ -12,6 +12,7 @@ Digital Mars - The D Programming Language - std.path + @@ -21,11 +22,10 @@ Home | Search | D -| Comments +| Comments
-Last update Mon Sep 19 17:53:47 2005 +Last update Sat Sep 24 15:34:38 2005
@@ -103,134 +103,171 @@
-

-
-
const char[1]sep; + +

+ + +
+
const char[1] sep;
-
-

String used to separate directory names in a path. +

+

String used to separate directory names in a path.

+ +
-
const char[1]altsep; +
const char[1] altsep;
-
-

Alternate version of sep[], used in Windows. +

+

Alternate version of sep[], used in Windows.

+ +
-
const char[1]pathsep; +
const char[1] pathsep;
-
-

Path separator string. +

+

Path separator string.

+ +
-
const char[2]linesep; +
const char[2] linesep;
-
-

String used to separate lines. +

+

String used to separate lines.

+ +
-
const char[1]curdir; +
const char[1] curdir;
-
-

String representing the current directory. +

+

String representing the current directory.

+ +
-
const char[2]pardir; +
const char[2] pardir;
-
-

String representing the parent directory. +

+

String representing the parent directory.

+ +
-
char[] getExt(char[]fullname); +
char[] getExt(char[] fullname);
-
-

Get extension. +

+

Get extension. For example, "d:\path\foo.bat" returns "bat".

+ +
-
char[] getBaseName(char[]fullname); +
char[] getBaseName(char[] fullname);
-
-

Get base name. +

+

Get base name. For example, "d:\path\foo.bat" returns "foo.bat".

+ +
-
char[] getDirName(char[]fullname); +
char[] getDirName(char[] fullname);
-
-

Get directory name. +

+

Get directory name. For example, "d:\path\foo.bat" returns "d:\path".

+ +
-
char[] getDrive(char[]fullname); +
char[] getDrive(char[] fullname);
-
-

Get drive. +

+

Get drive. For example, "d:\path\foo.bat" returns "d:".

+ +
-
char[] defaultExt(char[]filename,char[]ext); +
char[] defaultExt(char[] filename,char[] ext);
-
-

If filename doesn't already have an extension, - append the extension ext and return the result. +

+

If filename doesn't already have an extension, + append the extension ext and return the result.

+ +
-
char[] addExt(char[]filename,char[]ext); +
char[] addExt(char[] filename,char[] ext);
-
-

Strip any existing extension off of filename and add the new extension ext. +

+

Strip any existing extension off of filename and add the new extension ext. Return the result.

+ +
-
int isabs(char[]path); +
int isabs(char[] path);
-
-

Return !=0 if path is absolute (i.e. it starts from the root directory). +

+

Return !=0 if path is absolute (i.e. it starts from the root directory).

+ +
-
char[] join(char[]p1,char[]p2); +
char[] join(char[] p1,char[] p2);
-
-

Join two path components p1 and p2 and return the result. +

+

Join two path components p1 and p2 and return the result.

+ +
-
int fncharmatch(dchar c1,dchar c2); +
int fncharmatch(dchar c1,dchar c2);
-
-

Match file name characters c1 and c2. +

+

Match file name characters c1 and c2. Case sensitivity depends on the operating system.

+ +
-
int fnmatch(char[]filename,char[]pattern); +
int fnmatch(char[] filename,char[] pattern);
-
-

Match filename with pattern, using the following wildcards: +

+

Match filename with pattern, using the following wildcards:

-

+ +

* match 0 or more characters
? match any character
[chars] match any character that appears between the []
[!chars] match any character that does not appear between the [! ]

-

+

Matching is case sensitive on a file system that is case sensitive.

-

+

-

Returns:

!=0 for match + +

Returns:

!=0 for match

+ +
@@ -240,9 +277,7 @@

Feedback and Comments

- Add feedback and comments regarding this + Add feedback and comments regarding this page.
@@ -250,15 +285,14 @@ - @@ -267,4 +301,3 @@ - diff -uNr dmd-0.132/dmd/html/d/phobos/std_stream.html dmd-0.133/dmd/html/d/phobos/std_stream.html --- dmd-0.132/dmd/html/d/phobos/std_stream.html 2005-09-19 15:01:30.000000000 +0200 +++ dmd-0.133/dmd/html/d/phobos/std_stream.html 2005-09-24 15:34:40.000000000 +0200 @@ -12,6 +12,7 @@ Digital Mars - The D Programming Language - std.stream + @@ -21,11 +22,10 @@ Home | Search | D -| Comments +| Comments
-Last update Mon Sep 19 15:01:29 2005 +Last update Sat Sep 24 15:34:38 2005
@@ -103,156 +103,187 @@
-

-
-
class StreamException: object.Exception; + +

+ + +
+
class StreamException: object.Exception;
-
-

A base class for stream exceptions. +

+

A base class for stream exceptions.

-
-
this(char[]msg); + + +
+
this(char[] msg);
-
-

Construct a StreamException with given error message. +

+

Construct a StreamException with given error message.

+ +
-
-

-
class ReadException: std.stream.StreamException; + +
class ReadException: std.stream.StreamException;
-
-

Thrown when unable to read data from Stream. +

+

Thrown when unable to read data from Stream.

-
-
this(char[]msg); + + +
+
this(char[] msg);
-
-

Construct a ReadException with given error message. +

+

Construct a ReadException with given error message.

+ +
-
-
-
class WriteException: std.stream.StreamException; + +
class WriteException: std.stream.StreamException;
-
-

Thrown when unable to write data to Stream. +

+

Thrown when unable to write data to Stream.

-
-
this(char[]msg); + + +
+
this(char[] msg);
-
-

Construct a WriteException with given error message. +

+

Construct a WriteException with given error message.

+ +
-
-
-
class SeekException: std.stream.StreamException; + +
class SeekException: std.stream.StreamException;
-
-

Thrown when unable to move Stream pointer. +

+

Thrown when unable to move Stream pointer.

-
-
this(char[]msg); + + +
+
this(char[] msg);
-
-

Construct a SeekException with given error message. +

+

Construct a SeekException with given error message.

+ +
-
-
-
interface InputStream; + +
interface InputStream;
-
-

InputStream is the interface for readable streams. +

+

InputStream is the interface for readable streams.

-
-
void readExact(void*buffer,uint size); + + +
+
void readExact(void* buffer,uint size);
-
-

Read exactly size bytes into the buffer. +

+

Read exactly size bytes into the buffer.

-

Throws a ReadException if it is not correct. + +

Throws a ReadException if it is not correct.

+ +
-
uint read(ubyte[]buffer); +
uint read(ubyte[] buffer);
-
-

Read a block of data big enough to fill the given array buffer. +

+

Read a block of data big enough to fill the given array buffer.

-

-

Returns:

the actual number of bytes read. Unfilled bytes are not modified. + +

+ +

Returns:

the actual number of bytes read. Unfilled bytes are not modified.

+ +
-
void read(out byte x); -
void read(out ubyte x); -
void read(out short x); -
void read(out ushort x); -
void read(out int x); -
void read(out uint x); -
void read(out long x); -
void read(out ulong x); -
void read(out float x); -
void read(out double x); -
void read(out real x); -
void read(out ifloat x); -
void read(out idouble x); -
void read(out ireal x); -
void read(out cfloat x); -
void read(out cdouble x); -
void read(out creal x); -
void read(out char x); -
void read(out wchar x); -
void read(out dchar x); -
void read(out char[]s); -
void read(out wchar[]s); +
void read(out byte x); +
void read(out ubyte x); +
void read(out short x); +
void read(out ushort x); +
void read(out int x); +
void read(out uint x); +
void read(out long x); +
void read(out ulong x); +
void read(out float x); +
void read(out double x); +
void read(out real x); +
void read(out ifloat x); +
void read(out idouble x); +
void read(out ireal x); +
void read(out cfloat x); +
void read(out cdouble x); +
void read(out creal x); +
void read(out char x); +
void read(out wchar x); +
void read(out dchar x); +
void read(out char[] s); +
void read(out wchar[] s);
-
-

Read a basic type or counted string. +

+

Read a basic type or counted string.

-

Throw a ReadException if it could not be read. + +

Throw a ReadException if it could not be read. Outside of byte, ubyte, and char, the format is implementation-specific and should not be used except as opposite actions to write.

+ +
-
char[] readLine(); -
char[] readLine(char[]result); -
wchar[] readLineW(); -
wchar[] readLineW(wchar[]result); +
char[] readLine(); +
char[] readLine(char[] result); +
wchar[] readLineW(); +
wchar[] readLineW(wchar[] result);
-
-

Read a line that is terminated with some combination of carriage return and +

+

Read a line that is terminated with some combination of carriage return and line feed or end-of-file.

-

The terminators are not included. The wchar version + +

The terminators are not included. The wchar version is identical. The optional buffer parameter is filled (reallocating it if necessary) and a slice of the result is returned.

+ +
-
int opApply(int delegate(inout char[]line)dg); -
int opApply(int delegate(inout ulong n,inout char[]line)dg); -
int opApply(int delegate(inout wchar[]line)dg); -
int opApply(int delegate(inout ulong n,inout wchar[]line)dg); +
int opApply(int delegate(inout char[]line) dg); +
int opApply(int delegate(inout ulong n,inout char[]line) dg); +
int opApply(int delegate(inout wchar[]line) dg); +
int opApply(int delegate(inout ulong n,inout wchar[]line) dg);
-
-

Overload foreach statements to read the stream line by line and call the +

+

Overload foreach statements to read the stream line by line and call the supplied delegate with each line or with each line with line number.

-

The string passed in line may be reused between calls to the delegate. + +

The string passed in line may be reused between calls to the delegate. Line numbering starts at 1. Breaking out of the foreach will leave the stream position at the beginning of the next line to be read. For example, to echo a file line-by-line with line numbers run: -

+
 
  Stream file = new BufferedFile("sample.txt");
  foreach(ulong n, char[] line; file) {
    stdout.writefln("line %d: %s",n,line);
@@ -261,64 +292,79 @@
 

+ +
-
char[] readString(uint length); +
char[] readString(uint length);
-
-

Read a string of the given length, +

+

Read a string of the given length,

-

throwing ReadException if there was a problem. + +

throwing ReadException if there was a problem.

+ +
-
wchar[] readStringW(uint length); +
wchar[] readStringW(uint length);
-
-

Read a string of the given length, throwing ReadException if there was a +

+

Read a string of the given length, throwing ReadException if there was a problem.

-

The file format is implementation-specific and should not be used + +

The file format is implementation-specific and should not be used except as opposite actions to write.

+ +
-
char getc(); -
wchar getcw(); +
char getc(); +
wchar getcw();
-
-

Read and return the next character in the stream. +

+

Read and return the next character in the stream.

-

This is the only method that will handle ungetc properly. + +

This is the only method that will handle ungetc properly. getcw's format is implementation-specific. - If EOF is reached then getc returns char.init and getcw returns wchar.init. + If EOF is reached then getc returns char.init and getcw returns wchar.init.

+ +
-
char ungetc(char c); -
wchar ungetcw(wchar c); +
char ungetc(char c); +
wchar ungetcw(wchar c);
-
-

Push a character back onto the stream. +

+

Push a character back onto the stream.

-

They will be returned in first-in last-out order from getc/getcw. + +

They will be returned in first-in last-out order from getc/getcw. Only has effect on further calls to getc() and getcw().

+ +
-
int vreadf(TypeInfo []arguments,void*args); -
int readf(...); +
int vreadf(TypeInfo [] arguments,void* args); +
int readf(...);
-
-

Scan a string from the input using a similar form to C's scanf +

+

Scan a string from the input using a similar form to C's scanf and std.format.

-

An argument of type char[] is interpreted as a format string. - All other arguments must be pointer types. + +

An argument of type char[] is interpreted as a format string. + All other arguments must be pointer types. If a format string is not present a default will be supplied computed from the base type of the pointer type. An argument of type char[]* is filled (possibly with appending characters) and a slice of the result is assigned back into the argument. For example the following readf statements are equivalent: -

+
 
  int x;
  double y;
  char[] s;
@@ -328,756 +374,919 @@
 

+ +
-
uint available(); +
uint available();
-
-

Retrieve the number of bytes available for immediate reading. +

+

Retrieve the number of bytes available for immediate reading.

+ +
-
bit eof(); +
bit eof();
-
-

Return whether the current file position is the same as the end of the +

+

Return whether the current file position is the same as the end of the file.

-

This does not require actually reading past the end, as with stdio. For - non-seekable streams this might only return true after attempting to read + +

This does not require actually reading past the end, as with stdio. For + non-seekable streams this might only return true after attempting to read past the end.

+ +
-
bit isOpen(); +
bit isOpen();
-
-

Return true if the stream is currently open. +

+

Return true if the stream is currently open.

+ +
-
-
-
interface OutputStream; + +
interface OutputStream;
-
-

Interface for writable streams. +

+

Interface for writable streams.

-
-
void writeExact(void*buffer,uint size); + + +
+
void writeExact(void* buffer,uint size);
-
-

Write exactly size bytes from buffer, or throw a WriteException if that +

+

Write exactly size bytes from buffer, or throw a WriteException if that could not be done.

+ +
-
uint write(ubyte[]buffer); +
uint write(ubyte[] buffer);
-
-

Write as much of the buffer as possible, +

+

Write as much of the buffer as possible, returning the number of bytes written.

+ +
-
void write(byte x); -
void write(ubyte x); -
void write(short x); -
void write(ushort x); -
void write(int x); -
void write(uint x); -
void write(long x); -
void write(ulong x); -
void write(float x); -
void write(double x); -
void write(real x); -
void write(ifloat x); -
void write(idouble x); -
void write(ireal x); -
void write(cfloat x); -
void write(cdouble x); -
void write(creal x); -
void write(char x); -
void write(wchar x); -
void write(dchar x); +
void write(byte x); +
void write(ubyte x); +
void write(short x); +
void write(ushort x); +
void write(int x); +
void write(uint x); +
void write(long x); +
void write(ulong x); +
void write(float x); +
void write(double x); +
void write(real x); +
void write(ifloat x); +
void write(idouble x); +
void write(ireal x); +
void write(cfloat x); +
void write(cdouble x); +
void write(creal x); +
void write(char x); +
void write(wchar x); +
void write(dchar x);
-
-

Write a basic type. +

+

Write a basic type.

-

Outside of byte, ubyte, and char, the format is implementation-specific + +

Outside of byte, ubyte, and char, the format is implementation-specific and should only be used in conjunction with read. Throw WriteException on error.

+ +
-
void write(char[]s); -
void write(wchar[]s); +
void write(char[] s); +
void write(wchar[] s);
-
-

Writes a string, together with its length. +

+

Writes a string, together with its length.

-

The format is implementation-specific + +

The format is implementation-specific and should only be used in conjunction with read. Throw WriteException on error.

+ +
-
void writeLine(char[]s); +
void writeLine(char[] s);
-
-

Write a line of text, +

+

Write a line of text, appending the line with an operating-system-specific line ending.

-

Throws WriteException on error. + +

Throws WriteException on error.

+ +
-
void writeLineW(wchar[]s); +
void writeLineW(wchar[] s);
-
-

Write a line of text, +

+

Write a line of text, appending the line with an operating-system-specific line ending.

-

The format is implementation-specific. + +

The format is implementation-specific. Throws WriteException on error.

+ +
-
void writeString(char[]s); +
void writeString(char[] s);
-
-

Write a string of text. +

+

Write a string of text.

-

Throws WriteException if it could not be fully written. + +

Throws WriteException if it could not be fully written.

+ +
-
void writeStringW(wchar[]s); +
void writeStringW(wchar[] s);
-
-

Write a string of text. +

+

Write a string of text.

-

The format is implementation-specific. + +

The format is implementation-specific. Throws WriteException if it could not be fully written.

+ +
-
uint vprintf(char[]format,void*args); -
uint printf(char[]format,...); +
uint vprintf(char[] format,void* args); +
uint printf(char[] format,...);
-
-

Print a formatted string into the stream using printf-style syntax, +

+

Print a formatted string into the stream using printf-style syntax, returning the number of bytes written.

+ +
-
OutputStream writef(...); -
OutputStream writefln(...); -
OutputStream writefx(TypeInfo []arguments,void*argptr,int newline = cast(int)(0)); +
OutputStream writef(...); +
OutputStream writefln(...); +
OutputStream writefx(TypeInfo [] arguments,void* argptr,int newline = cast(int)(0));
-
-

Print a formatted string into the stream using writef-style syntax. +

+

Print a formatted string into the stream using writef-style syntax.

-

References:

std.format. + +

References:

std.format.

-

Returns:

self to chain with other stream commands like flush. + +

Returns:

self to chain with other stream commands like flush.

+ +
-
void flush(); +
void flush();
-
-

Flush pending output if appropriate. +

+

Flush pending output if appropriate.

+ +
-
void close(); +
void close();
-
-

Close the stream, flushing output if appropriate. +

+

Close the stream, flushing output if appropriate.

+ +
-
bit isOpen(); +
bit isOpen();
-
-

Return true if the stream is currently open. +

+

Return true if the stream is currently open.

+ +
-
-
-
class Stream: std.stream.InputStream, std.stream.OutputStream; + +
class Stream: std.stream.InputStream, std.stream.OutputStream;
-
-

Stream is the base abstract class from which the other stream classes derive. +

+

Stream is the base abstract class from which the other stream classes derive.

-

Stream's byte order is the format native to the computer. + +

Stream's byte order is the format native to the computer.

-

+

-

Reading:

These methods require that the readable flag be set. + +

Reading:

These methods require that the readable flag be set. Problems with reading result in a ReadException being thrown. - Stream implements the InputStream interface in addition to the + Stream implements the InputStream interface in addition to the readBlock method.

-

+

-

Writing:

These methods require that the writeable flag be set. Problems with writing - result in a WriteException being thrown. Stream implements the OutputStream + +

Writing:

These methods require that the writeable flag be set. Problems with writing + result in a WriteException being thrown. Stream implements the OutputStream interface in addition to the following methods: writeBlock copyFrom copyFrom

-

+

-

Seeking:

These methods require that the seekable flag be set. + +

Seeking:

These methods require that the seekable flag be set. Problems with seeking result in a SeekException being thrown. seek, seekSet, seekCur, seekEnd, position, size, toString, toHash

-
-
bit readable; + + +
+
bit readable;
-
-

Indicates whether this stream can be read from. +

+

Indicates whether this stream can be read from.

+ +
-
bit writeable; +
bit writeable;
-
-

Indicates whether this stream can be written to. +

+

Indicates whether this stream can be written to.

+ +
-
bit seekable; +
bit seekable;
-
-

Indicates whether this stream can be seeked within. +

+

Indicates whether this stream can be seeked within.

+ +
-
protected bit isopen; +
protected bit isopen;
-
-

Indicates whether this stream is open. +

+

Indicates whether this stream is open.

+ +
-
protected bit readEOF; +
protected bit readEOF;
-
-

Indicates whether this stream is at eof +

+

Indicates whether this stream is at eof

+ +
-
protected bit prevCr; +
protected bit prevCr;
-
-

For a non-seekable stream indicates that +

+

For a non-seekable stream indicates that

+ +

after the last read attempt. +

+

+ For a non-seekable stream indicates that +

+ +
-
this(); +
this();
-
-

the last readLine or readLineW ended on a +

+

the last readLine or readLineW ended on a

-

'\r' character. + +

'\r' character.

+ +
-
uint readBlock(void*buffer,uint size); +
uint readBlock(void* buffer,uint size);
-
-

Read up to size bytes into the buffer and return the number of bytes +

+

Read up to size bytes into the buffer and return the number of bytes actually read. A return value of 0 indicates end-of-file.

+ +
-
uint writeBlock(void*buffer,uint size); +
uint writeBlock(void* buffer,uint size);
-
-

Write up to size bytes from buffer in the stream, returning the actual +

+

Write up to size bytes from buffer in the stream, returning the actual number of bytes that were written.

+ +
-
void copyFrom(Stream s); +
void copyFrom(Stream s);
-
-

Copies all data from s into this stream. +

+

Copies all data from s into this stream. This may throw ReadException or WriteException on failure. - This restores the file position of s so that it is unchanged. + This restores the file position of s so that it is unchanged.

+ +
-
void copyFrom(Stream s,ulong count); +
void copyFrom(Stream s,ulong count);
-
-

Copy a specified number of bytes from the given stream into this one. +

+

Copy a specified number of bytes from the given stream into this one. This may throw ReadException or WriteException on failure. - Unlike the previous form, this doesn't restore the file position of s. + Unlike the previous form, this doesn't restore the file position of s.

+ +
-
ulong seek(long offset,SeekPos whence); +
ulong seek(long offset,SeekPos whence);
-
-

Change the current position of the stream. whence is either SeekPos.Set, in - which case the offset is an absolute index from the beginning of the stream, - SeekPos.Current, in which case the offset is a delta from the current - position, or SeekPos.End, in which case the offset is a delta from the end of +

+

Change the current position of the stream. whence is either SeekPos.Set, in + which case the offset is an absolute index from the beginning of the stream, + SeekPos.Current, in which case the offset is a delta from the current + position, or SeekPos.End, in which case the offset is a delta from the end of the stream (negative or zero offsets only make sense in that case). This returns the new file position.

+ +
-
ulong seekSet(long offset); -
ulong seekCur(long offset); -
ulong seekEnd(long offset); +
ulong seekSet(long offset); +
ulong seekCur(long offset); +
ulong seekEnd(long offset);
-
-

Aliases for their normal seek counterparts. +

+

Aliases for their normal seek counterparts.

+ +
-
void position(ulong pos); +
void position(ulong pos);
-
-

Sets file position. Equivalent to calling seek(pos, SeekPos.Set). +

+

Sets file position. Equivalent to calling seek( pos, SeekPos.Set).

+ +
-
ulong position(); +
ulong position();
-
-

Returns current file position. Equivalent to seek(0, SeekPos.Current). +

+

Returns current file position. Equivalent to seek(0, SeekPos.Current).

+ +
-
ulong size(); +
ulong size();
-
-

Retrieve the size of the stream in bytes. +

+

Retrieve the size of the stream in bytes. The stream must be seekable or a SeekException is thrown.

+ +
-
char[] toString(); +
char[] toString();
-
-

Read the entire stream and return it as a string. +

+

Read the entire stream and return it as a string. If the stream is not seekable the contents from the current position to eof is read and returned.

+ +
-
uint toHash(); +
uint toHash();
-
-

Get a hash of the stream by reading each byte and using it in a CRC-32 +

+

Get a hash of the stream by reading each byte and using it in a CRC-32 checksum.

+ +
-
-
-
class FilterStream: std.stream.Stream; + +
class FilterStream: std.stream.Stream;
-
-

A base class for streams that wrap a source stream with additional +

+

A base class for streams that wrap a source stream with additional functionality.

-

The method implementations forward read/write/seek calls to the - source stream. A FilterStream can change the position of the source stream + +

The method implementations forward read/write/seek calls to the + source stream. A FilterStream can change the position of the source stream arbitrarily and may not keep the source stream state in sync with the - FilterStream, even upon flushing and closing the FilterStream. It is + FilterStream, even upon flushing and closing the FilterStream. It is recommended to not make any assumptions about the state of the source position - and read/write state after a FilterStream has acted upon it. Specifc subclasses - of FilterStream should document how they modify the source stream and if any - invariants hold true between the source and filter. + and read/write state after a FilterStream has acted upon it. Specifc subclasses + of FilterStream should document how they modify the source stream and if any + invariants hold true between the source and filter.

-
-
bit nestClose; + + +
+
bit nestClose;
-
-

Property indicating when this stream closes to close the source stream as +

+

Property indicating when this stream closes to close the source stream as

-

well. + +

well.

-

- Defaults to true. +

+ Defaults to true.

+ +
-
this(Stream source); +
this(Stream source);
-
-

Construct a FilterStream for the given source. +

+

Construct a FilterStream for the given source.

+ +
-
final Stream source(); +
final Stream source();
-
-

Get the current source stream. +

+

Get the current source stream.

+ +
-
void source(Stream s); +
void source(Stream s);
-
-

Set the current source stream. +

+

Set the current source stream.

-

Setting the source stream closes this stream before attaching the new - source. Attaching an open stream reopens this stream and resets the stream + +

Setting the source stream closes this stream before attaching the new + source. Attaching an open stream reopens this stream and resets the stream state.

+ +
-
void resetSource(); +
void resetSource();
-
-

Indicates the source stream changed state and that this stream should reset +

+

Indicates the source stream changed state and that this stream should reset any readable, writeable, seekable, isopen and buffering flags.

+ +
-
-
-
class BufferedStream: std.stream.FilterStream; + +
class BufferedStream: std.stream.FilterStream;
-
-

This subclass is for buffering a source stream. +

+

This subclass is for buffering a source stream.

-

A buffered stream must be + +

A buffered stream must be closed explicitly to ensure the final buffer content is written to the source stream. The source stream position is changed according to the block size so - reading or writing to the BufferedStream may not change the source stream + reading or writing to the BufferedStream may not change the source stream position by the same amount.

-
-
this(Stream source,uint bufferSize = cast(uint)(8192)); + + +
+
this(Stream source,uint bufferSize = cast(uint)(8192));
-
-

Create a buffered stream for the stream source with the buffer size - bufferSize. +

+

Create a buffered stream for the stream source with the buffer size + bufferSize.

+ +
-
-
-
class StreamFileException: std.stream.StreamException; + +
class StreamFileException: std.stream.StreamException;
-
-

An exception for File errors. +

+

An exception for File errors.

-
-
this(char[]msg); + + +
+
this(char[] msg);
-
-

Construct a StreamFileException with given error message. +

+

Construct a StreamFileException with given error message.

+ +
-
-
-
class OpenException: std.stream.StreamFileException; + +
class OpenException: std.stream.StreamFileException;
-
-

An exception for errors during File.open. +

+

An exception for errors during File.open.

-
-
this(char[]msg); + + +
+
this(char[] msg);
-
-

Construct an OpenFileException with given error message. +

+

Construct an OpenFileException with given error message.

+ +
-
-
-
class File: std.stream.Stream; + +
class File: std.stream.Stream;
-
-

This subclass is for unbuffered file system streams. +

+

This subclass is for unbuffered file system streams.

-
-
this(char[]filename,FileMode mode = cast(FileMode)1); + + +
+
this(char[] filename,FileMode mode = cast(FileMode)1);
-
-

Create the stream with no open file, an open file in read mode, or an open - file with explicit file mode. - mode, if given, is a combination of FileMode.In +

+

Create the stream with no open file, an open file in read mode, or an open + file with explicit file mode. + mode, if given, is a combination of FileMode.In (indicating a file that can be read) and FileMode.Out (indicating a file that can be written). Opening a file for reading that doesn't exist will error. Opening a file for writing that doesn't exist will create the file. - The FileMode.OutNew mode will open the file for writing and reset the + The FileMode.OutNew mode will open the file for writing and reset the length to zero. - The FileMode.Append mode will open the file for writing and move the + The FileMode.Append mode will open the file for writing and move the file position to the end of the file.

+ +
-
void open(char[]filename,FileMode mode = cast(FileMode)1); +
void open(char[] filename,FileMode mode = cast(FileMode)1);
-
-

Open a file for the stream, in an identical manner to the constructors. +

+

Open a file for the stream, in an identical manner to the constructors. If an error occurs an OpenException is thrown.

+ +
-
void create(char[]filename); -
void create(char[]filename,FileMode mode); +
void create(char[] filename); +
void create(char[] filename,FileMode mode);
-
-

Create a file for writing. +

+

Create a file for writing.

+ +
-
void close(); +
void close();
-
-

Close the current file if it is open; otherwise it does nothing. +

+

Close the current file if it is open; otherwise it does nothing.

+ +
-
uint available(); +
uint available();
-
-

For a seekable file returns the difference of the size and position and +

+

For a seekable file returns the difference of the size and position and otherwise returns 0.

+ +
-
-
-
class BufferedFile: std.stream.BufferedStream; + +
class BufferedFile: std.stream.BufferedStream;
-
-

This subclass is for buffered file system streams. +

+

This subclass is for buffered file system streams.

-

It is a convenience class for wrapping a File in a BufferedStream. + +

It is a convenience class for wrapping a File in a BufferedStream. A buffered stream must be closed explicitly to ensure the final buffer content is written to the file.

-
-
+ + +
-
-
enum BOM; + +
enum BOM;
-
-

UTF byte-order-mark signatures +

+

UTF byte-order-mark signatures

-
-
UTF8
-
-

UTF-8 + + +

+
UTF8
+
+

UTF-8

+ +
-
UTF16LE
-
-

UTF-16 Little Endian +

UTF16LE
+
+

UTF-16 Little Endian

+ +
-
UTF16BE
-
-

UTF-16 Big Endian +

UTF16BE
+
+

UTF-16 Big Endian

+ +
-
UTF32LE
-
-

UTF-32 Little Endian +

UTF32LE
+
+

UTF-32 Little Endian

+ +
-
UTF32BE
-
-

UTF-32 Big Endian +

UTF32BE
+
+

UTF-32 Big Endian

+ +
-
-
class EndianStream: std.stream.FilterStream; + +
class EndianStream: std.stream.FilterStream;
-
-

This subclass wraps a stream with big-endian or little-endian byte order +

+

This subclass wraps a stream with big-endian or little-endian byte order swapping.

-

UTF Byte-Order-Mark (BOM) signatures can be read and deduced or + +

UTF Byte-Order-Mark (BOM) signatures can be read and deduced or written. - Note that an EndianStream should not be used as the source of another + Note that an EndianStream should not be used as the source of another FilterStream since a FilterStream call the source with byte-oriented - read/write requests and the EndianStream will not perform any byte swapping. - The EndianStream reads and writes binary data (non-getc functions) in a + read/write requests and the EndianStream will not perform any byte swapping. + The EndianStream reads and writes binary data (non-getc functions) in a one-to-one manner with the source stream so the source stream's position and state will be - kept in sync with the EndianStream if only non-getc functions are called. + kept in sync with the EndianStream if only non-getc functions are called.

-
-
Endian endian; + + +
+
Endian endian;
-
-

Endianness property of the source stream. +

+

Endianness property of the source stream.

+ +
-
this(Stream source,Endian end = endian); +
this(Stream source,Endian end = endian);
-
-

Create the endian stream for the source stream source with endianness end. +

+

Create the endian stream for the source stream source with endianness end. The default endianness is the native byte order. The Endian type is defined in the std.system module.

+ +
-
int readBOM(int ungetCharSize = 1); +
int readBOM(int ungetCharSize = 1);
-
-

Return -1 if no BOM and otherwise read the BOM and return it. +

+

Return -1 if no BOM and otherwise read the BOM and return it.

-

If there is no BOM or if bytes beyond the BOM are read then the bytes read + +

If there is no BOM or if bytes beyond the BOM are read then the bytes read are pushed back onto the ungetc buffer or ungetcw buffer. - Pass ungetCharSize == 2 to use + Pass ungetCharSize == 2 to use ungetcw instead of ungetc when no BOM is present.

+ +
-
final void fixBO(void*buffer,uint size); +
final void fixBO(void* buffer,uint size);
-
-

Correct the byte order of buffer to match native endianness. - size must be even. +

+

Correct the byte order of buffer to match native endianness. + size must be even.

+ +
-
final void fixBlockBO(void*buffer,uint size,uint repeat); +
final void fixBlockBO(void* buffer,uint size,uint repeat);
-
-

Correct the byte order of the given buffer in blocks of the given size and +

+

Correct the byte order of the given buffer in blocks of the given size and repeated the given number of times. - size must be even. + size must be even.

+ +
-
void writeBOM(BOM b); +
void writeBOM(BOM b);
-
-

Write the specified BOM b to the source stream. +

+

Write the specified BOM b to the source stream.

+ +
-
-
-
class TArrayStream(Buffer): Stream; + +
class TArrayStream(Buffer): Stream;
-
-

Parameterized subclass that wraps an array-like buffer with a stream +

+

Parameterized subclass that wraps an array-like buffer with a stream interface.

-

The type Buffer must support the length property, opIndex and opSlice. - Compile in release mode when directly instantiating a TArrayStream to avoid + +

The type Buffer must support the length property, opIndex and opSlice. + Compile in release mode when directly instantiating a TArrayStream to avoid link errors.

-
-
this(Buffer buf); -
-
-

Create the stream for the the buffer buf. Non-copying. -

-
-
ubyte[] data(); -
-
-

Get the current memory data in total. -

-
-
+ + +
-
-
class MemoryStream: std.stream.TArrayStream!(ubyte[]).TArrayStream; + +
class MemoryStream: std.stream.TArrayStream!(ubyte[]).TArrayStream;
-
-

This subclass reads and constructs an array of bytes in memory. +

+

This subclass reads and constructs an array of bytes in memory.

-
-
this(); + + +
+
this();
-
-

Create the output buffer and setup for reading, writing, and seeking. +

+

Create the output buffer and setup for reading, writing, and seeking.

+ +
-
this(ubyte[]buf); -
this(byte[]buf); -
this(char[]buf); +
this(ubyte[] buf); +
this(byte[] buf); +
this(char[] buf);
-
-

Create the output buffer and setup for reading, writing, and seeking. +

+

Create the output buffer and setup for reading, writing, and seeking. Load it with specific input data.

+ +
-
void reserve(uint count); +
void reserve(uint count);
-
-

Ensure the stream can hold count bytes. +

+

Ensure the stream can hold count bytes.

+ +
-
-
-
class MmFileStream: std.stream.TArrayStream!(MmFile ).TArrayStream; + +
class MmFileStream: std.stream.TArrayStream!(MmFile ).TArrayStream;
-
-

This subclass wraps a memory-mapped file with the stream API. +

+

This subclass wraps a memory-mapped file with the stream API. See std.mmfile module.

-
-
this(MmFile file); + + +
+
this(MmFile file);
-
-

Create stream wrapper for file. +

+

Create stream wrapper for file.

+ +
-
-
-
class SliceStream: std.stream.FilterStream; + +
class SliceStream: std.stream.FilterStream;
-
-

This subclass slices off a portion of another stream, making seeking relative +

+

This subclass slices off a portion of another stream, making seeking relative to the boundaries of the slice.

-

It could be used to section a large file into a + +

It could be used to section a large file into a set of smaller files, such as with tar archives. Reading and writing a - SliceStream does not modify the position of the source stream if it is + SliceStream does not modify the position of the source stream if it is seekable.

-
-
this(Stream s,ulong low); + + +
+
this(Stream s,ulong low);
-
-

Indicate both the source stream to use for reading from and the low part of +

+

Indicate both the source stream to use for reading from and the low part of the slice.

-

The high part of the slice is dependent upon the end of the source + +

The high part of the slice is dependent upon the end of the source stream, so that if you write beyond the end it resizes the stream normally.

+ +
-
this(Stream s,ulong low,ulong high); +
this(Stream s,ulong low,ulong high);
-
-

Indicate the high index as well. +

+

Indicate the high index as well.

-

Attempting to read or write past the high + +

Attempting to read or write past the high index results in the end being clipped off.

+ +
-
-
+
@@ -1086,9 +1295,7 @@

Feedback and Comments

- Add feedback and comments regarding this + Add feedback and comments regarding this page.
@@ -1096,15 +1303,14 @@ - @@ -1113,4 +1319,3 @@ - diff -uNr dmd-0.132/dmd/html/d/phobos/std_string.html dmd-0.133/dmd/html/d/phobos/std_string.html --- dmd-0.132/dmd/html/d/phobos/std_string.html 2005-08-22 22:42:58.000000000 +0200 +++ dmd-0.133/dmd/html/d/phobos/std_string.html 2005-09-24 15:34:56.000000000 +0200 @@ -1,524 +1,786 @@ + + + + + + + +Digital Mars - The D Programming Language - std.string + + + + + +www.digitalmars.com + +Home +| Search +| D +| Comments + +
+Last update Sat Sep 24 15:34:55 2005 + +
+ + + +
+
+
+ + + + + +
+
+
D
+
Language
+
Phobos
+
Comparisons


+ +object
+
+ +std
std.base64
std.boxer
std.compiler
std.conv
std.ctype
std.date
std.file
std.format
std.gc
std.intrinsic
std.math
std.md5
std.mmfile
std.openrj
std.outbuffer
std.path
std.process
std.random
std.recls
std.regexp
std.socket
std.socketstream
std.stdint
std.stdio
std.cstream
std.stream
std.string
std.system
std.thread
std.uri
std.utf
std.zip
std.zlib
+
+std.windows
+
+std.linux
+
+std.c
std.c.stdio
+
+std.c.windows
+
+std.c.linux
+
+
+
+ + +

std.string

+ +
+ + +

String handling functions. +

+

To copy or not to copy? + When a function takes a string as a parameter, and returns a string, + is that string the same as the input string, modified in place, or + is it a modified copy of the input string? The D array convention is + "copy-on-write". This means that if no modifications are done, the + original string (or slices of it) can be returned. If any modifications + are done, the returned string is a copy. +

+

+

+ + +
+
class StringException: object.Exception; +
+
+

Thrown on errors in string functions. +

+ + +
+
+
+
const char[16] hexdigits; +
+
+

0..9A..F +

+ + +
+
const char[10] digits; +
+
+

0..9 +

+ + +
+
const char[8] octdigits; +
+
+

0..7 +

+ + +
+
const char[26] lowercase; +
+
+

a..z +

+ + +
+
const char[26] uppercase; +
+
+

A..Z +

+ + +
+
const char[52] letters; +
+
+

A..Za..z +

+ + +
+
const char[6] whitespace; +
+
+

ASCII whitespace +

+ + +
+
int iswhite(dchar c); +
+
+

Returns !=0 if c is whitespace + +

+
+
long atoi(char[] s); +
+
+

Convert string to integer. + +

+
+
real atof(char[] s); +
+
+

Convert string to real. + +

+
+
int cmp(char[] s1,char[] s2); +
int icmp(char[] s1,char[] s2); +
+
+

Compare two strings. cmp is case sensitive, icmp is case insensitive. +

+ +

Returns:

+
< 0 s1 < s2 +
= 0 s1 == s2 +
> 0 s1 > s2 +
+ +

+
+
char* toStringz(char[] s); +
+
+

Convert array of chars s[] to a C-style 0 terminated string. + +

+
+
int find(char[] s,dchar c); +
int ifind(char[] s,dchar c); +
int rfind(char[] s,dchar c); +
int irfind(char[] s,dchar c); +
+
+

find, ifind find first occurrance of c in string s. + rfind, irfind find last occurrance of c in string s. +

+

find, rfind are case sensitive; ifind, irfind are case insensitive. +

+

Returns:

Index in s where c is found, -1 if not found. + +

+
+
int find(char[] s,char[] sub); +
int ifind(char[] s,char[] sub); +
int rfind(char[] s,char[] sub); +
int irfind(char[] s,char[] sub); +
+
+

find, ifind find first occurrance of sub[] in string s[]. + rfind, irfind find last occurrance of sub[] in string s[]. +

+

find, rfind are case sensitive; ifind, irfind are case insensitive. +

+

Returns:

Index in s where c is found, -1 if not found. + +

+
+
char[] tolower(char[] s); +
+
+

Convert string s[] to lower case. + +

- - - - - - - -Digital Mars - The D Programming Language - std.string - - - - -www.digitalmars.com - -Home -| Search -| D -| Comments - -
-Last update Mon Aug 22 2005 -
- - - -
-
-
- - - - - -
-
-
D
-
Language
-
Phobos
-
Comparisons


- -object
-
- -std
std.base64
std.boxer
std.compiler
std.conv
std.ctype
std.date
std.file
std.format
std.gc
std.intrinsic
std.math
std.md5
std.mmfile
std.openrj
std.outbuffer
std.path
std.process
std.random
std.recls
std.regexp
std.socket
std.socketstream
std.stdint
std.stdio
std.cstream
std.stream
std.string
std.system
std.thread
std.uri
std.utf
std.zip
std.zlib
-
-std.windows
-
-std.linux
-
-std.c
std.c.stdio
-
-std.c.windows
-
-std.c.linux
-
-
-
- - -

std.string

- - - -

To copy or not to copy?

- - When a function takes a string as a parameter, and returns a string, - is that string the same as the input string, modified in place, or - is it a modified copy of the input string? The D array convention is - "copy-on-write". This means that if no modifications are done, the - original string (or slices of it) can be returned. If any modifications - are done, the returned string is a copy. -

- -

- -
class StringException -
Thrown on errors in string functions. -

- -

const char[] hexdigits; -
"0123456789ABCDEF" -

- -

const char[] digits; -
"0123456789" -

- -

const char[] octdigits; -
"01234567" -

- -

const char[] lowercase; -
"abcdefghijklmnopqrstuvwxyz" -

- -

const char[] uppercase; -
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" -

- -

const char[] letters; -
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" -

- -

const char[] whitespace; -
" \t\v\r\n\f" -

- -

long atoi(char[] s) -
Convert string to integer. -

- -

real atof(char[] s) -
Convert string to real. -

- -

int cmp(char[] s1, char[] s2) -
Compare two strings. - Returns: -
-
<0 for (s1 < s2) -
=0 for (s1 == s2) -
>0 for (s1 > s2) -
-

- - -

int icmp(char[] s1, char[] s2) -
Same as cmp() but case insensitive. -

- -

char* toStringz(char[] s) -
Converts a D array of chars to a C-style 0 terminated string. -

- - -

int find(char[] s, dchar c) -
Find first occurrance of c in string s. - Return index in s where it is found. - Return -1 if not found. -

- -

int rfind(char[] s, dchar c) -
Find last occurrance of c in string s. - Return index in s where it is found. - Return -1 if not found. -

- -

int find(char[] s, char[] sub) -
Find first occurrance of sub in string s. - Return index in s[] where it is found. - Return -1 if not found. -

- -

int rfind(char[] s, char[] sub) -
Find last occurrance of sub in string s. - Return index in s where it is found. - Return -1 if not found. -

- -

int ifind(char[] s, dchar c) -
int irfind(char[] s, dchar c) -
int ifind(char[] s, char[] sub) -
int irfind(char[] s, char[] sub) -
Case insensitive versions. -

- -

char[] tolower(char[] s) -
Convert string to lower case. -

- -

char[] toupper(char[] s) -
Convert string to upper case. -

- -

char[] capitalize(char[] s) -
Capitalize first character of string. -

- -

char[] capwords(char[] s) -
Capitalize all words in string. - Remove leading and trailing whitespace. - Replace all sequences of whitespace with a single space. -

- -

char[] join(char[][] words, char[] sep) -
Concatenate all the strings together into one - string; use sep[] as the separator. -

- -

char[][] split(char[] s) -
Split s[] into an array of words, - using whitespace as the delimiter. -

- -

char[][] split(char[] s, char[] delim) -
Split s[] into an array of words, - using delim[] as the delimiter. -

- -

char[][] splitlines(char[] s) -
Split s[] into an array of lines, - using CR, LF, or CR-LF as the delimiter. -

- -

char[] stripl(char[] s) -
char[] stripr(char[] s) -
char[] strip(char[] s) -
Strips leading or trailing whitespace, or both. -

- -

char[] chomp(char[] s, char[] delimiter = null) -
Returns s sans trailing delimiter, if any. - If delimiter is null, any trailing CR, LF, or CRLF - is removed. -

- -

char[] chop(char[] s) -
Returns s sans trailing character, if there is one. - If last two characters are CR-LF, then both are removed. -

- -

char[] ljustify(char[] s, int width) -
char[] rjustify(char[] s, int width) -
char[] center(char[] s, int width) -
Left justify, right justify, or center string s - in field width chars wide. -

- -

char[] zfill(char[] s, int width) -
Same as rjustify(), but fill with '0's. -

- -

char[] replace(char[] s, char[] from, char[] to) -
Replace occurrences of from with to in s. -

- -

char[] replaceSlice(char[] s, char[] slice, char[] replacement) -
Given a string s with a slice into it, - replace slice[] with replacement. -

- -

char[] insert(char[] s, int index, char[] sub) -
Insert sub into s at location index. -

- -

int count(char[] s, char[] sub) -
Count up all instances of sub in s. -

- -

char[] expandtabs(char[] s, int tabsize) -
Replace tabs with the appropriate number of spaces. - tabsize is the distance between tab stops. -

- -

char[] maketrans(char[] from, char[] to) -
Construct translation table for translate(). -

- -

char[] translate(char[] s, char[] transtab, char[] delchars) -
Translate characters in s using table created by maketrans(). - Delete chars in delchars. - Note: This only works if s is ASCII. - Use tr for full UCS character support. -

- -

char[] toString(bit arg) -
char[] toString(char arg) -
char[] toString(byte arg) -
char[] toString(ubyte arg) -
char[] toString(short arg) -
char[] toString(ushort arg) -
char[] toString(int arg) -
char[] toString(uint arg) -
char[] toString(long arg) -
char[] toString(ulong arg) -
char[] toString(float arg) -
char[] toString(double arg) -
char[] toString(real arg) -
char[] toString(ifloat arg) -
char[] toString(idouble arg) -
char[] toString(ireal arg) -
char[] toString(cfloat arg) -
char[] toString(cdouble arg) -
char[] toString(creal arg) -
Convert arg to string. -

- -

char[] toString(long arg, uint radix) -
Convert arg to string in radix radix. - radix must be a value from 2 to 36. - arg is treated as a signed value only if radix is 10. - The characters A through Z are used to represent values 10 through - 36. -

- -

char[] toString(ulong arg, uint radix) -
Convert arg to string in radix radix. - radix must be a value from 2 to 36. - The characters A through Z are used to represent values 10 through - 36. -

- -

char[] toString(char* s) -
Convert C-style 0 terminated string s to char[] string. -

- -

char[] format(...) -
Format arguments into a string. -

- -

char[] sformat(char[] s, ...) -
Format arguments into string s which must be large - enough to hold the result. Throws ArrayBoundsError if it is not. - Returns s. -

- -

char[] succ(char[] s) -
Return string that is the 'successor' to s. - If the rightmost character is a-zA-Z0-9, it is incremented within - its case or digits. If it generates a carry, the process is - repeated with the one to its immediate left. -
-	succ(null);	// returns null	
-	succ("!@#$%");	// returns "!@#$%"
-	succ("1");	// returns "2"
-	succ("9");	// returns "10"
-	succ("999");	// returns "1000"
-	succ("zz99");	// returns "aaa00"
-

- - -

char[] tr(char[] str, char[] from, char[] to, char[] modifiers = null) -
Replaces characters in str that are in from - with corresponding characters in to and returns the resulting - string. -

- - modifiers is a string of modifier characters: -

- - - - - - - - -
Modifier - Description -
c - Complement the list of characters in from -
d - Removes matching characters with no corresponding - replacement in to -
s - Removes adjacent duplicates in the replaced characters -
-

+

+
char[] toupper(char[] s); +
+
+

Convert string s[] to upper case. + +

- If modifier d is present, then the number of characters - in to may be only 0 or 1. -

- If modifier d is not present and to is null, - then to is taken to be the same as from. -

- - If modifier d is not present and to is shorter - than from, then to is extended by replicating the - last character in to. -

+

+
char[] capitalize(char[] s); +
+
+

Capitalize first character of string s[], convert rest of string s[] + to lower case. + +

- Both from and to may contain ranges using the - - character, for example a-d is synonymous with abcd. - Neither accept a leading ^ as meaning the complement of - the string (use the c modifier for that). -

-

+ +
char[] capwords(char[] s); +
+
+

Capitalize all words in string s[]. + Remove leading and trailing whitespace. + Replace all sequences of whitespace with a single space. + +

+ + +
+
char[] repeat(char[] s,uint n); +
+
+

Return a string that consists of s[] repeated n times. + +

+ -

Patterns

+
+
char[] join(char[][] words,char[] sep); +
+
+

Concatenate all the strings in words[] together into one + string; use sep[] as the separator. + +

+ + +
+
char[][] split(char[] s); +
+
+

Split s[] into an array of words, + using whitespace as the delimiter. + +

+ + +
+
char[][] split(char[] s,char[] delim); +
+
+

Split s[] into an array of words, + using delim[] as the delimiter. + +

+ + +
+
char[][] splitlines(char[] s); +
+
+

Split s[] into an array of lines, + using CR, LF, or CR-LF as the delimiter. + The delimiter is not included in the line. + +

+ + +
+
char[] stripl(char[] s); +
+
+

Strips leading or trailing whitespace, or both. + +

+ + +
+
char[] chomp(char[] s,char[] delimiter = null); +
+
+

Returns s[] sans trailing delimiter[], if any. + If delimiter[] is null, removes trailing CR, LF, or CRLF, if any. + +

+ + +
+
char[] chop(char[] s); +
+
+

Returns s[] sans trailing character, if there is one. + If last two characters are CR-LF, then both are removed. + +

+ + +
+
char[] ljustify(char[] s,int width); +
char[] rjustify(char[] s,int width); +
char[] center(char[] s,int width); +
+
+

Left justify, right justify, or center string s[] + in field width chars wide. + +

+ + +
+
char[] zfill(char[] s,int width); +
+
+

Same as rjustify(), but fill with '0' s. + +

+ + +
+
char[] replace(char[] s,char[] from,char[] to); +
+
+

Replace occurrences of from[] with to[] in s[]. + +

+ + +
+
char[] replaceSlice(char[] string,char[] slice,char[] replacement); +
+
+

Return a string that is string[] with slice[] replaced by replacement[]. + +

+ + +
+
char[] insert(char[] s,uint index,char[] sub); +
+
+

Insert sub[] into s[] at location index. + +

- A pattern is an array of characters much like a character + +
+
uint count(char[] s,char[] sub); +
+
+

Count up all instances of sub[] in s[]. + +

+ + +
+
char[] expandtabs(char[] s,int tabsize); +
+
+

Replace tabs with the appropriate number of spaces. + tabsize is the distance between tab stops. + +

+ + +
+
char[] maketrans(char[] from,char[] to); +
+
+

Construct translation table for translate(). +

+ +

BUG:

only works with ASCII + +

+ + +
+
char[] translate(char[] s,char[] transtab,char[] delchars); +
+
+

Translate characters in s[] using table created by maketrans(). + Delete chars in delchars[]. +

+ +

BUG:

only works with ASCII + +

+ + +
+
char[] toString(bit b); +
char[] toString(char c); +
char[] toString(ubyte ub); +
char[] toString(ushort us); +
char[] toString(uint u); +
char[] toString(ulong u); +
char[] toString(byte b); +
char[] toString(short s); +
char[] toString(int i); +
char[] toString(long i); +
char[] toString(float f); +
char[] toString(double d); +
char[] toString(real r); +
char[] toString(ifloat f); +
char[] toString(idouble d); +
char[] toString(ireal r); +
char[] toString(cfloat f); +
char[] toString(cdouble d); +
char[] toString(creal r); +
+
+

Convert to char[]. + +

+ + +
+
char[] toString(long value,uint radix); +
char[] toString(ulong value,uint radix); +
+
+

Convert value to string in radix radix. +

+ +

radix must be a value from 2 to 36. + value is treated as a signed value only if radix is 10. + The characters A through Z are used to represent values 10 through 36. + +

+ + +
+
char[] toString(char* s); +
+
+

Convert C-style 0 terminated string s to char[] string. + +

+ + +
+
char[] format(...); +
+
+

Format arguments into a string. + +

+ + +
+
char[] sformat(char[] s,...); +
+
+

Format arguments into string s which must be large + enough to hold the result. Throws ArrayBoundsError if it is not. +

+ +

Returns:

s + +

+ + +
+
int inPattern(dchar c,char[] pattern); +
+
+

See if character c is in the pattern. +

+ +

Patterns:

A pattern is an array of characters much like a character class in regular expressions. A sequence of characters can be given, such as "abcde". The '-' can represent a range - of characters, as "a-e" represents the same pattern as "abcde". + of characters, as "a-e" represents the same pattern as "abcde". "a-fA-F0-9" represents all the hex characters. - If the first character of a pattern is '^', then the pattern + If the first character of a pattern is '^', then the pattern is negated, i.e. "^0-9" means any character except a digit. - The following functions use patterns. -

+ The functions inPattern, countchars, removeschars, + and squeeze + use patterns. +

+

+

- Note: In the future, the pattern syntax may be improved +

Note:

In the future, the pattern syntax may be improved to be more like regular expression character classes. + +

+ + +
+
int inPattern(dchar c,char[][] patterns); +
+
+

See if character c is in the intersection of the patterns. + +

-
-
int inPattern(dchar c, char[] pattern) -
Returns 1 if c is in pattern, 0 if not. -

- -

int inPatterns(dchar c, char[][] patterns) -
Returns 1 if c is in each of the patterns - in patterns, 0 if not. -

- -

size_t countchars(char[] s, char[] pattern) -
Returns number of characters in s that match - pattern. -

- -

char[] removechars(char[] s, char[] pattern) -
Return a string consisting of s with all the characters - that match pattern removed. -

- -

char[] squeeze(char[] s, char[] pattern = null) -
Return a string consisting of s with all the - multiple sequences of characters - that match pattern are removed. - If pattern is null, it defaults to all characters. -
-	squeeze("hello goodbye")	// returns "helo godbye"
-	squeeze("hello goodbye", "le")	// returns "helo goodbye"
-

- - -

- - -
-

Feedback and Comments

- - Add feedback and comments regarding this - page. - -
-Copyright © 1999-2005 by Digital Mars, All Rights Reserved

- - - - - - - - +

+
uint countchars(char[] s,char[] pattern); +
+
+

Count characters in s that match pattern. +

+
+
char[] removechars(char[] s,char[] pattern); +
+
+

Return string that is s with all characters removed that match pattern. + +

+ + +
+
char[] squeeze(char[] s,char[] pattern = null); +
+
+

Return string where sequences of a character in s[] from pattern[] + are replaced with a single instance of that character. + If pattern is null, it defaults to all characters. + +

+ + +
+
char[] succ(char[] s); +
+
+

Return string that is the 'successor' to s[]. + If the rightmost character is a-zA-Z0-9, it is incremented within + its case or digits. If it generates a carry, the process is + repeated with the one to its immediate left. + +

+ + +
+
char[] tr(char[] str,char[] from,char[] to,char[] modifiers = null); +
+
+

Replaces characters in str[] that are in from[] + with corresponding characters in to[] and returns the resulting + string. +

+ +

Params:

+ + +
char[] modifiers

a string of modifier characters

+

+ +

Modifiers:

+
Modifier Description +
c Complement the list of characters in from[] +
d Removes matching characters with no corresponding replacement in to[] +
s Removes adjacent duplicates in the replaced characters +
+

+

+ If modifier d is present, then the number of characters + in to[] may be only 0 or 1. +

+

+ If modifier d is not present and to[] is null, + then to[] is taken to be the same as from[]. +

+

+ If modifier d is not present and to[] is shorter + than from[], then to[] is extended by replicating the + last character in to[]. +

+

+ Both from[] and to[] may contain ranges using the - + character, for example a-d is synonymous with abcd. + Neither accept a leading ^ as meaning the complement of + the string (use the c modifier for that). + +

+ + +
+
final bit isNumeric(char[] s,bit bAllowSep = 0); +
+
+

[in] char[] s can be formatted in the following ways: +

+ +

Integer Whole Number: + (for byte, ubyte, short, ushort, int, uint, long, and ulong) + ['+'|'-']digit( s)[U|L|UL] +

+

+

+ +

examples:

123, 123UL, 123L, +123U, -123L +

+

+ Floating-Point Number: + (for float, double, real, ifloat, idouble, and ireal) + ['+'|'-']digit( s)[.][digit( s)][[e-|e+]digit( s)][i|f|L|Li|fi]] + or [nan|nani|inf|-inf] +

+

+

+ +

examples:

+123., -123.01, 123.3e-10f, 123.3e-10fi, 123.3e-10L +

+

+ (for cfloat, cdouble, and creal) + ['+'|'-']digit( s)[.][digit( s)][[e-|e+]digit( s)][+] + [digit( s)[.][digit( s)][[e-|e+]digit( s)][i|f|L|Li|fi]] + or [nan|nani|nan+nani|inf|-inf] +

+

+

+ +

examples:

nan, -123e-1+456.9e-10Li, +123e+10+456i, 123+456 +

+

+ [in] bool bAllowSep + False by default, but when set to true it will accept the + separator characters "," and "" within the string, but these + characters should be stripped from the string before using any + of the conversion functions like toInt(), toFloat(), and etc + else an error will occur. +

+

+ Also please note, that no spaces are allowed within the string + anywhere whether it' s a leading, trailing, or embedded space( s), + thus they too must be stripped from the string before using this + function, or any of the conversion functions. + +

+
+
bit isNumeric(...); +
+
+

Allow any object as a parameter +

+ + +
+
bit isNumeric(TypeInfo [] _arguments,void* _argptr); +
+
+

Check only the first parameter, all others will be ignored. +

+ + +
+
+ +
+ + +
+

Feedback and Comments

+ + Add feedback and comments regarding this + page. + +
+Copyright © 1999-2005 by Digital Mars, All Rights Reserved

+ + + + + + + + + + +