mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-10-26 03:37:26 +01:00
First import of dmd-2.065-b1 (7088593).
The CPP mangling is not integrated yet.
This commit is contained in:
+6
-71
@@ -31,8 +31,8 @@ struct OutBuffer;
|
||||
|
||||
// Can't include arraytypes.h here, need to declare these directly.
|
||||
template <typename TYPE> struct Array;
|
||||
typedef Array<class File> Files;
|
||||
typedef Array<char> Strings;
|
||||
typedef Array<struct File> Files;
|
||||
typedef Array<const char> Strings;
|
||||
|
||||
|
||||
class RootObject
|
||||
@@ -43,11 +43,6 @@ public:
|
||||
|
||||
virtual bool equals(RootObject *o);
|
||||
|
||||
/**
|
||||
* Returns a hash code, useful for things like building hash tables of Objects.
|
||||
*/
|
||||
virtual hash_t hashCode();
|
||||
|
||||
/**
|
||||
* Return <0, ==0, or >0 if this is less than, equal to, or greater than obj.
|
||||
* Useful for sorting Objects.
|
||||
@@ -67,38 +62,13 @@ public:
|
||||
* defined by the library user. For Object, the return value is 0.
|
||||
*/
|
||||
virtual int dyncast();
|
||||
|
||||
/**
|
||||
* Marks pointers for garbage collector by calling mem.mark() for all pointers into heap.
|
||||
*/
|
||||
/*virtual*/ // not used, disable for now
|
||||
void mark();
|
||||
};
|
||||
|
||||
class String : public RootObject
|
||||
{
|
||||
public:
|
||||
const char *str; // the string itself
|
||||
|
||||
String(const char *str);
|
||||
~String();
|
||||
|
||||
static hash_t calcHash(const char *str, size_t len);
|
||||
static hash_t calcHash(const char *str);
|
||||
hash_t hashCode();
|
||||
size_t len();
|
||||
bool equals(RootObject *obj);
|
||||
int compare(RootObject *obj);
|
||||
char *toChars();
|
||||
void print();
|
||||
void mark();
|
||||
};
|
||||
|
||||
class FileName : public String
|
||||
struct FileName
|
||||
{
|
||||
public:
|
||||
const char *str;
|
||||
FileName(const char *str);
|
||||
hash_t hashCode();
|
||||
bool equals(RootObject *obj);
|
||||
static int equals(const char *name1, const char *name2);
|
||||
int compare(RootObject *obj);
|
||||
@@ -129,9 +99,10 @@ public:
|
||||
static const char *canonicalName(const char *name);
|
||||
|
||||
static void free(const char *str);
|
||||
char *toChars();
|
||||
};
|
||||
|
||||
class File : public RootObject
|
||||
struct File
|
||||
{
|
||||
public:
|
||||
int ref; // != 0 if this is a reference to someone else's buffer
|
||||
@@ -145,8 +116,6 @@ public:
|
||||
File(const FileName *);
|
||||
~File();
|
||||
|
||||
void mark();
|
||||
|
||||
char *toChars();
|
||||
|
||||
/* Read file, return !=0 if error
|
||||
@@ -250,7 +219,6 @@ struct OutBuffer
|
||||
OutBuffer();
|
||||
~OutBuffer();
|
||||
char *extractData();
|
||||
void mark();
|
||||
|
||||
void reserve(size_t nbytes);
|
||||
void setsize(size_t size);
|
||||
@@ -308,13 +276,6 @@ struct Array
|
||||
mem.free(data);
|
||||
}
|
||||
|
||||
void mark()
|
||||
{
|
||||
mem.mark(data);
|
||||
for (size_t u = 0; u < dim; u++)
|
||||
mem.mark(data[u]); // BUG: what if arrays of Object's?
|
||||
}
|
||||
|
||||
char *toChars()
|
||||
{
|
||||
char **buf = (char **)malloc(dim * sizeof(char *));
|
||||
@@ -522,30 +483,4 @@ struct Array
|
||||
}
|
||||
};
|
||||
|
||||
// TODO: Remove (only used by disabled GC)
|
||||
class Bits : public RootObject
|
||||
{
|
||||
public:
|
||||
unsigned bitdim;
|
||||
unsigned allocdim;
|
||||
unsigned *data;
|
||||
|
||||
Bits();
|
||||
~Bits();
|
||||
void mark();
|
||||
|
||||
void resize(unsigned bitdim);
|
||||
|
||||
void set(unsigned bitnum);
|
||||
void clear(unsigned bitnum);
|
||||
int test(unsigned bitnum);
|
||||
|
||||
void set();
|
||||
void clear();
|
||||
void copy(Bits *from);
|
||||
Bits *clone();
|
||||
|
||||
void sub(Bits *b);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user