summaryrefslogtreecommitdiffstats
path: root/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp')
-rw-r--r--tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp b/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp
index a6d2ff6..9b2f9fc5 100644
--- a/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp
+++ b/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp
@@ -9,6 +9,8 @@ namespace llvmc {
extern char *ProgramName;
}
+
+
// Returns the platform specific directory separator via #ifdefs.
// FIXME: This currently work on linux and windows only. It does not
// work on other unices.
@@ -21,6 +23,43 @@ static std::string GetDirSeparator() {
}
namespace hooks {
+// Get preprocessor define for the part.
+// It is __partname format in lower case.
+std::string
+GetLowerCasePartDefine(void) {
+ std::string Partname;
+ if (AutoGeneratedParameter_p.empty()) {
+ Partname = "16f1xxx";
+ } else {
+ Partname = AutoGeneratedParameter_p;
+ }
+
+ std::string LowerCase;
+ for (unsigned i = 0; i <= Partname.size(); i++) {
+ LowerCase.push_back(std::tolower(Partname[i]));
+ }
+
+ return "__" + LowerCase;
+}
+
+std::string
+GetUpperCasePartDefine(void) {
+ std::string Partname;
+ if (AutoGeneratedParameter_p.empty()) {
+ Partname = "16f1xxx";
+ } else {
+ Partname = AutoGeneratedParameter_p;
+ }
+
+ std::string UpperCase;
+ for (unsigned i = 0; i <= Partname.size(); i++) {
+ UpperCase.push_back(std::toupper(Partname[i]));
+ }
+
+ return "__" + UpperCase;
+}
+
+
// Get the dir where c16 executables reside.
std::string GetBinDir() {
// Construct a Path object from the program name.
OpenPOWER on IntegriCloud