[svn r136] MAJOR UNSTABLE UPDATE!!!

Initial commit after moving to Tango instead of Phobos.

Lots of bugfixes...

This build is not suitable for most things.
This commit is contained in:
Tomas Lindquist Olsen
2008-01-11 17:57:40 +01:00
parent bc08c6fcb1
commit b15b3484c8
524 changed files with 270705 additions and 175 deletions

View File

@@ -0,0 +1,20 @@
/**
Example showing how the alignment component in a format string argument works.
Put into public domain by Lars Ivar Igesund
*/
import tango.io.Stdout;
void main(){
char[] myFName = "Johnny";
Stdout.formatln("First Name = |{0,15}|", myFName);
Stdout.formatln("Last Name = |{0,15}|", "Foo de Bar");
Stdout.formatln("First Name = |{0,-15}|", myFName);
Stdout.formatln("Last Name = |{0,-15}|", "Foo de Bar");
Stdout.formatln("First name = |{0,5}|", myFName);
}

View File

@@ -0,0 +1,15 @@
/**
Example that shows how the format specifiers can be used to index into
the argument list.
Put into public domain by Lars Ivar Igesund.
*/
import tango.io.Stdout;
void main(){
Stdout.formatln("Many {1} can now be {0} around to make {2} easier,\n and {1} can also be repeated.",
"switched", "arguments", "localization");
}

View File

@@ -0,0 +1,17 @@
/**
Example showing how to use format specifier components in a format string's
argument.
Put into public domain by Lars Ivar Igesund
*/
import tango.io.Stdout;
void main(){
double avogadros = 6.0221415e23;
Stdout.formatln("I have {0:C} in cash.", 100);
Stdout.formatln("Avogadro's number is {0:E}.", avogadros);
Stdout.formatln("Avogadro's number (with alignment) is {0,4:E}.", avogadros);
}

View File

@@ -0,0 +1,21 @@
/******************************************************************************
Example to format a locale-based time. For a default locale of
en-gb, this examples formats in the following manner:
"Thu, 27 April 2006 18:20:47 +1"
******************************************************************************/
private import tango.io.Console;
private import tango.time.Clock;
private import tango.text.locale.Locale;
void main ()
{
auto layout = new Locale;
Cout (layout ("{:ddd, dd MMMM yyyy HH:mm:ss z}", Clock.now)).newline;
}

View File

@@ -0,0 +1,32 @@
private import tango.io.Buffer,
tango.io.Console;
private import tango.text.Properties;
/*******************************************************************************
Illustrates simple usage of tango.text.Properties
*******************************************************************************/
void main()
{
char[][char[]] aa;
aa ["foo"] = "something";
aa ["bar"] = "something else";
aa ["wumpus"] = "";
// write associative-array to a buffer; could use a file
auto props = new Properties!(char);
auto buffer = new Buffer (256);
props.save (buffer, aa);
// reset and repopulate AA from the buffer
aa = null;
props.load (buffer, (char[] name, char[] value){aa[name] = value;});
// display result
foreach (name, value; aa)
Cout (name) (" = ") (value).newline;
}

View File

@@ -0,0 +1,25 @@
/*******************************************************************************
Tokenize input from the console. There are a variety of handy
tokenizers in the tango.text package ~ this illustrates usage
of an iterator that recognizes quoted-strings within an input
array, and splits elements on a provided set of delimiters
*******************************************************************************/
import tango.io.Console;
import Text = tango.text.Util;
void main()
{
// flush the console output, since we have no newline present
Cout ("Please enter some space-separated tokens: ") ();
// create quote-aware iterator for handling space-delimited
// tokens from the console input
foreach (element; Text.quotes (Text.trim(Cin.get), " \t"))
Cout ("<") (element) ("> ");
Cout.newline;
}