diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2017-09-27 11:17:39 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-09-27 11:17:39 -0700 |
| commit | 74f2f47cb63b02638270beecd20acea1a0f5665e (patch) | |
| tree | af50d0355c7fccb4fb93fc1a0d45c66b5d07f1c9 /source/core/slang-string.h | |
| parent | b6cf0f4ae0f3f9d1f377d3f134dcf994676e68b4 (diff) | |
First attempt at a Linux build (#193)
* First attempt at a Linux build
- Fix up places where C++ idioms were written assuming lenient behavior of Microsoft's compiler
- Add a few more alternatives for platform-specific behavior where Windows was the only platform accounted for.
- Add a basic Makefile that can at least invoke our build, even if it isn't going good dependency tracking, etc.
- Build `libslang.so` and `slangc` that depends on it, using a relative `RPATH` to make the binary portable (I hope)
- Add an initial `.travis.yml` to see if we can trigger their build process.
* Fixup: const bug in `List::Sort`
I'm not clear why this gets picked up by the gcc *and* clang that Travis uses, but not the (newer) gcc I'm using on Ubuntu here, but I'm hoping it is just some missing `const` qualifiers.
* Fixup: reorder specialization of "class info"
Clang complains about things being specialized after being instantiated (implicilty), and I hope it is just the fact that I generate the class info for the roots of the hierarchy after the other cases. We'll see.
* Fixup: add `platform.cpp` to unified/lumped build
* Fixup: Windows uses `FreeLibrary`
and not `UnloadLibrary`
* Fixup: fix Windows project file to include new source file
This obviously points to the fact that we are going to need to be generating these files sooner or later.
Diffstat (limited to 'source/core/slang-string.h')
| -rw-r--r-- | source/core/slang-string.h | 61 |
1 files changed, 26 insertions, 35 deletions
diff --git a/source/core/slang-string.h b/source/core/slang-string.h index ed333f8e8..23ab54c23 100644 --- a/source/core/slang-string.h +++ b/source/core/slang-string.h @@ -222,7 +222,7 @@ namespace Slang char* getData() const { - return buffer ? buffer->getData() : ""; + return buffer ? buffer->getData() : (char*)""; } UInt getLength() const @@ -270,50 +270,29 @@ namespace Slang void append(String const& str); void append(StringSlice const& slice); - String(int val, int radix = 10) + String(int32_t val, int radix = 10) { append(val, radix); -#if 0 - buffer = StringRepresentation::createWithLength(33); - buffer->length = IntToAscii(getData(), val, radix); - ReverseInternalAscii(getData(), getLength()); -#endif } - String(unsigned int val, int radix = 10) + String(uint32_t val, int radix = 10) { append(val, radix); -#if 0 - buffer = StringRepresentation::createWithLength(33); - buffer->length = IntToAscii(getData(), val, radix); - ReverseInternalAscii(getData(), getLength()); -#endif } - String(long long val, int radix = 10) + String(int64_t val, int radix = 10) + { + append(val, radix); + } + String(uint64_t val, int radix = 10) { append(val, radix); -#if 0 - buffer = StringRepresentation::createWithLength(65); - buffer->length = IntToAscii(getData(), val, radix); - ReverseInternalAscii(getData(), getLength()); -#endif } String(float val, const char * format = "%g") { append(val, format); -#if 0 - buffer = StringRepresentation::createWithLength(128); - sprintf_s(getData(), 128, format, val); - buffer->length = (int)strnlen_s(begin(), 128); -#endif } String(double val, const char * format = "%g") { append(val, format); -#if 0 - buffer = StringRepresentation::createWithLength(128); - sprintf_s(getData(), 128, format, val); - buffer->length = (int)strnlen_s(begin(), 128); -#endif } String(const char * str) { @@ -656,17 +635,22 @@ namespace Slang Append(&ch, 1); return *this; } - StringBuilder & operator << (int val) + StringBuilder & operator << (Int32 val) + { + Append(val); + return *this; + } + StringBuilder & operator << (UInt32 val) { Append(val); return *this; } - StringBuilder & operator << (unsigned int val) + StringBuilder & operator << (Int64 val) { Append(val); return *this; } - StringBuilder & operator << (long long val) + StringBuilder & operator << (UInt64 val) { Append(val); return *this; @@ -714,21 +698,28 @@ namespace Slang int len = (int)strnlen_s(buf, 128); Append(buf, len); } - void Append(unsigned int value, int radix = 10) + void Append(Int32 value, int radix = 10) { char vBuffer[33]; int len = IntToAscii(vBuffer, value, radix); ReverseInternalAscii(vBuffer, len); Append(vBuffer); } - void Append(int value, int radix = 10) + void Append(UInt32 value, int radix = 10) { char vBuffer[33]; int len = IntToAscii(vBuffer, value, radix); ReverseInternalAscii(vBuffer, len); Append(vBuffer); } - void Append(long long value, int radix = 10) + void Append(Int64 value, int radix = 10) + { + char vBuffer[65]; + int len = IntToAscii(vBuffer, value, radix); + ReverseInternalAscii(vBuffer, len); + Append(vBuffer); + } + void Append(UInt64 value, int radix = 10) { char vBuffer[65]; int len = IntToAscii(vBuffer, value, radix); |
