summaryrefslogtreecommitdiffstats
path: root/source/core/slang-char-util.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-10-22 08:46:12 -0400
committerGitHub <noreply@github.com>2020-10-22 08:46:12 -0400
commit10e1bae34733f1cdb5abc001666b1aafa1c1f406 (patch)
treead9571c071b7b7c2384cdd42426851d257fc5f7b /source/core/slang-char-util.cpp
parentc0943661e5441bfb996430c4f67fb4dddea9dfcf (diff)
Single pass C++ extraction (#1583)
* #include an absolute path didn't work - because paths were taken to always be relative. * Added CharUtil. Added TypeSet to extractor. First pass at being able to specify all headers for multiple output headers. * Fix includes for new C++ extractor convension. Update premake5 to use new extractor mechanisms. * Small improvements around StringUtil. * Split out NameConventionUtil. * Use a 'convert' to convert between convention types. * Fix output of build message for C++ extractor. Improve NameConventionUtil interface. * Improve comments. * Fix warning on gcc. * Fix clang warning. * Fix some typos in NameConventionUtil. * Small fix to premake5.lua * Fix generated includes. * Remove m_reflectType as no longer applicable with TypeSet. * Fix .gitignore for slang-generated-* files. Added getConvention to determine convention from slice. Add versions of split and convert that infer the from convention * Fix typo in spliting camel. * LineWhitespace -> HorizontalWhitespace * Improve CharUtil comments.
Diffstat (limited to 'source/core/slang-char-util.cpp')
-rw-r--r--source/core/slang-char-util.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/source/core/slang-char-util.cpp b/source/core/slang-char-util.cpp
new file mode 100644
index 000000000..53dd98541
--- /dev/null
+++ b/source/core/slang-char-util.cpp
@@ -0,0 +1,48 @@
+#include "slang-char-util.h"
+
+namespace Slang {
+
+static const CharUtil::CharFlagMap _calcCharFlagsMap()
+{
+ typedef CharUtil::Flag Flag;
+
+ CharUtil::CharFlagMap map;
+ memset(&map, 0, sizeof(map));
+
+ {
+ for (Index i = 'a'; i <= 'z'; ++i)
+ {
+ map.flags[i] |= Flag::Lower;
+ }
+ }
+ {
+ for (Index i = 'A'; i <= 'Z'; ++i)
+ {
+ map.flags[i] |= Flag::Upper;
+ }
+ }
+ {
+ for (Index i = '0'; i <= '9'; ++i)
+ {
+ map.flags[i] |= Flag::Digit | Flag::HexDigit;
+ }
+ }
+ {
+ for (Index i = 'a'; i <= 'f'; ++i)
+ {
+ map.flags[i] |= Flag::HexDigit;
+ map.flags[size_t(CharUtil::toUpper(char(i)))] |= Flag::HexDigit;
+ }
+ }
+
+ {
+ map.flags[size_t(' ')] |= Flag::HorizontalWhitespace;
+ map.flags[size_t('\t')] |= Flag::HorizontalWhitespace;
+ }
+
+ return map;
+}
+
+/* static */const CharUtil::CharFlagMap CharUtil::g_charFlagMap = _calcCharFlagsMap();
+
+} // namespace Slang