summaryrefslogtreecommitdiffstats
path: root/source/core
diff options
context:
space:
mode:
Diffstat (limited to 'source/core')
-rw-r--r--source/core/slang-common.h19
-rw-r--r--source/core/slang-smart-pointer.h5
-rw-r--r--source/core/slang-string.h14
-rw-r--r--source/core/slang-token-reader.cpp3
-rw-r--r--source/core/slang-token-reader.h2
-rw-r--r--source/core/slang-type-convert-util.cpp1
-rw-r--r--source/core/slang-type-text-util.cpp7
7 files changed, 35 insertions, 16 deletions
diff --git a/source/core/slang-common.h b/source/core/slang-common.h
index f17660e0d..694162f1d 100644
--- a/source/core/slang-common.h
+++ b/source/core/slang-common.h
@@ -94,3 +94,22 @@ template<typename T> void slang_use_obj(T&) {}
#define SLANG_UNREFERENCED_PARAMETER(P) slang_use_obj(P)
#define SLANG_UNREFERENCED_VARIABLE(P) slang_use_obj(P)
#endif
+
+#if defined(SLANG_RT_DYNAMIC)
+#if defined(_MSC_VER)
+# ifdef SLANG_RT_DYNAMIC_EXPORT
+# define SLANG_RT_API SLANG_DLL_EXPORT
+# else
+# define SLANG_RT_API __declspec(dllimport)
+# endif
+#else
+// TODO: need to consider compiler capabilities
+//# ifdef SLANG_RT_DYNAMIC_EXPORT
+# define SLANG_RT_API SLANG_DLL_EXPORT
+//# endif
+#endif
+#endif
+
+#ifndef SLANG_RT_API
+#define SLANG_RT_API
+#endif
diff --git a/source/core/slang-smart-pointer.h b/source/core/slang-smart-pointer.h
index 2e5821ffd..a6aa35906 100644
--- a/source/core/slang-smart-pointer.h
+++ b/source/core/slang-smart-pointer.h
@@ -10,7 +10,7 @@
namespace Slang
{
// Base class for all reference-counted objects
- class RefObject
+ class SLANG_RT_API RefObject
{
private:
UInt referenceCount;
@@ -86,8 +86,7 @@ namespace Slang
SLANG_FORCE_INLINE const T* as(const RefObject* obj) { return dynamicCast<T>(obj); }
// "Smart" pointer to a reference-counted object
- template<typename T>
- struct RefPtr
+ template<typename T> struct SLANG_RT_API RefPtr
{
RefPtr()
: pointer(nullptr)
diff --git a/source/core/slang-string.h b/source/core/slang-string.h
index cb13ec415..6dc3275eb 100644
--- a/source/core/slang-string.h
+++ b/source/core/slang-string.h
@@ -62,7 +62,7 @@ namespace Slang
return (((unsigned char)ch) & 0xC0) == 0x80;
}
- struct UnownedStringSlice
+ struct SLANG_RT_API UnownedStringSlice
{
public:
typedef UnownedStringSlice ThisType;
@@ -190,7 +190,7 @@ namespace Slang
// A `StringRepresentation` provides the backing storage for
// all reference-counted string-related types.
- class StringRepresentation : public RefObject
+ class SLANG_RT_API StringRepresentation : public RefObject
{
public:
Index length;
@@ -286,7 +286,7 @@ namespace Slang
- struct UnownedTerminatedStringSlice : public UnownedStringSlice
+ struct SLANG_RT_API UnownedTerminatedStringSlice : public UnownedStringSlice
{
public:
UnownedTerminatedStringSlice(char const* b)
@@ -294,7 +294,7 @@ namespace Slang
{}
};
- struct StringSlice
+ struct SLANG_RT_API StringSlice
{
public:
StringSlice();
@@ -333,7 +333,7 @@ namespace Slang
};
/// String as expected by underlying platform APIs
- class OSString
+ class SLANG_RT_API OSString
{
public:
/// Default
@@ -394,7 +394,7 @@ namespace Slang
@brief Represents a UTF-8 encoded string.
*/
- class String
+ class SLANG_RT_API String
{
friend struct StringSlice;
friend class StringBuilder;
@@ -837,7 +837,7 @@ namespace Slang
}
};
- class StringBuilder : public String
+ class SLANG_RT_API StringBuilder : public String
{
private:
enum { InitialSize = 1024 };
diff --git a/source/core/slang-token-reader.cpp b/source/core/slang-token-reader.cpp
index 3be010751..7ffbc12fa 100644
--- a/source/core/slang-token-reader.cpp
+++ b/source/core/slang-token-reader.cpp
@@ -681,9 +681,6 @@ namespace Misc {
{
switch (data[i])
{
- case ' ':
- sb << "\\s";
- break;
case '\n':
sb << "\\n";
break;
diff --git a/source/core/slang-token-reader.h b/source/core/slang-token-reader.h
index 26539732c..bf5ca4cdc 100644
--- a/source/core/slang-token-reader.h
+++ b/source/core/slang-token-reader.h
@@ -295,6 +295,8 @@ namespace Misc {
return result;
}
+ String EscapeStringLiteral(String str);
+ String UnescapeStringLiteral(String str);
} // namespace Misc
} // namespace Slang
diff --git a/source/core/slang-type-convert-util.cpp b/source/core/slang-type-convert-util.cpp
index fbf385319..6e6598357 100644
--- a/source/core/slang-type-convert-util.cpp
+++ b/source/core/slang-type-convert-util.cpp
@@ -17,6 +17,7 @@ namespace Slang
case SLANG_HLSL: return SLANG_SOURCE_LANGUAGE_HLSL;
case SLANG_C_SOURCE: return SLANG_SOURCE_LANGUAGE_C;
case SLANG_CPP_SOURCE: return SLANG_SOURCE_LANGUAGE_CPP;
+ case SLANG_HOST_CPP_SOURCE: return SLANG_SOURCE_LANGUAGE_CPP;
case SLANG_CUDA_SOURCE: return SLANG_SOURCE_LANGUAGE_CUDA;
default: break;
}
diff --git a/source/core/slang-type-text-util.cpp b/source/core/slang-type-text-util.cpp
index 5be097d15..13bf439ce 100644
--- a/source/core/slang-type-text-util.cpp
+++ b/source/core/slang-type-text-util.cpp
@@ -68,11 +68,12 @@ static const CompileTargetInfo s_compileTargetInfos[] =
{ SLANG_SPIRV_ASM, "spv.asm", "spirv-asm,spirv-assembly" },
{ SLANG_C_SOURCE, "c", "c" },
{ SLANG_CPP_SOURCE, "cpp,c++,cxx", "cpp,c++,cxx" },
- { SLANG_EXECUTABLE, "exe", "exe,executable" },
- { SLANG_SHARED_LIBRARY, "dll,so", "sharedlib,sharedlibrary,dll" },
+ { SLANG_HOST_CPP_SOURCE, "cpp,c++,cxx", "cpp,c++,cxx"},
+ { SLANG_HOST_EXECUTABLE,"exe", "exe,executable" },
+ { SLANG_SHADER_SHARED_LIBRARY, "dll,so", "sharedlib,sharedlibrary,dll" },
{ SLANG_CUDA_SOURCE, "cu", "cuda,cu" },
{ SLANG_PTX, "ptx", "ptx" },
- { SLANG_HOST_CALLABLE, "", "host-callable,callable" },
+ { SLANG_SHADER_HOST_CALLABLE, "", "host-callable,callable" },
{ SLANG_OBJECT_CODE, "obj,o", "object-code" },
};