Merge dmd v2.055

This commit is contained in:
Alexey Prokhin
2011-09-12 15:38:38 +04:00
parent 8f4a15c868
commit 0e754b5acd
74 changed files with 3809 additions and 2240 deletions

View File

@@ -1,6 +1,6 @@
// Copyright (c) 1999-2010 by Digital Mars
// Copyright (c) 1999-2011 by Digital Mars
// All Rights Reserved
// written by Walter Bright
// http://www.digitalmars.com
@@ -13,6 +13,9 @@
#include <stdlib.h>
#include <stdarg.h>
#ifdef DEBUG
#include <assert.h>
#endif
#if __DMC__
#pragma once
@@ -60,7 +63,12 @@ longlong randomx();
*/
struct OutBuffer;
struct Array;
// Can't include arraytypes.h here, need to declare these directly.
template <typename TYPE> struct ArrayBase;
typedef ArrayBase<struct File> Files;
typedef ArrayBase<char> Strings;
struct Object
{
@@ -141,14 +149,14 @@ struct FileName : String
static const char *replaceName(const char *path, const char *name);
static char *combine(const char *path, const char *name);
static Array *splitPath(const char *path);
static Strings *splitPath(const char *path);
static FileName *defaultExt(const char *name, const char *ext);
static FileName *forceExt(const char *name, const char *ext);
int equalsExt(const char *ext);
void CopyTo(FileName *to);
static char *searchPath(Array *path, const char *name, int cwd);
static char *safeSearchPath(Array *path, const char *name);
static char *searchPath(Strings *path, const char *name, int cwd);
static char *safeSearchPath(Strings *path, const char *name);
static int exists(const char *name);
static void ensurePathExists(const char *path);
static char *canonicalName(const char *name);
@@ -233,8 +241,8 @@ struct File : Object
* matching File's.
*/
static Array *match(char *);
static Array *match(FileName *);
static Files *match(char *);
static Files *match(FileName *);
// Compare file times.
// Return <0 this < f
@@ -267,7 +275,7 @@ struct OutBuffer : Object
OutBuffer();
~OutBuffer();
void *extractData();
char *extractData();
void mark();
void reserve(unsigned nbytes);
@@ -340,6 +348,48 @@ struct Array : Object
Array *copy();
};
template <typename TYPE>
struct ArrayBase : Array
{
TYPE **tdata()
{
return (TYPE **)data;
}
TYPE*& operator[] (size_t index)
{
#ifdef DEBUG
assert(index < dim);
#endif
return ((TYPE **)data)[index];
}
void insert(size_t index, TYPE *v)
{
Array::insert(index, (void *)v);
}
void insert(size_t index, ArrayBase *a)
{
Array::insert(index, (Array *)a);
}
void append(ArrayBase *a)
{
Array::append((Array *)a);
}
void push(TYPE *a)
{
Array::push((void *)a);
}
ArrayBase *copy()
{
return (ArrayBase *)Array::copy();
}
};
struct Bits : Object
{
unsigned bitdim;