mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-08-21 13:50:05 +02:00
Merge dmd v2.055
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user