~louis/ubuntu/trusty/clamav/lp799623_fix_logrotate

« back to all changes in this revision

Viewing changes to libclamav/c++/llvm/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-03-12 11:30:04 UTC
  • mfrom: (0.41.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100312113004-b0fop4bkycszdd0z
Tags: 0.96~rc1+dfsg-0ubuntu1
* New upstream RC - FFE (LP: #537636):
  - Add OfficialDatabaseOnly option to clamav-base.postinst.in
  - Add LocalSocketGroup option to clamav-base.postinst.in
  - Add LocalSocketMode option to clamav-base.postinst.in
  - Add CrossFilesystems option to clamav-base.postinst.in
  - Add ClamukoScannerCount option to clamav-base.postinst.in
  - Add BytecodeSecurity opiton to clamav-base.postinst.in
  - Add DetectionStatsHostID option to clamav-freshclam.postinst.in
  - Add Bytecode option to clamav-freshclam.postinst.in
  - Add MilterSocketGroup option to clamav-milter.postinst.in
  - Add MilterSocketMode option to clamav-milter.postinst.in
  - Add ReportHostname option to clamav-milter.postinst.in
  - Bump libclamav SO version to 6.1.0 in libclamav6.install
  - Drop clamdmon from clamav.examples (no longer shipped by upstream)
  - Drop libclamav.a from libclamav-dev.install (not built by upstream)
  - Update SO version for lintian override for libclamav6
  - Add new Bytecode Testing Tool, usr/bin/clambc, to clamav.install
  - Add build-depends on python and python-setuptools for new test suite
  - Update debian/copyright for the embedded copy of llvm (using the system
    llvm is not currently feasible)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "AutoGenerated.inc"
 
2
 
 
3
#include "llvm/System/Path.h"
 
4
#include "llvm/Support/raw_ostream.h"
 
5
 
 
6
using namespace llvm;
 
7
 
 
8
namespace llvmc {
 
9
  extern char *ProgramName;
 
10
}
 
11
 
 
12
  
 
13
 
 
14
// Returns the platform specific directory separator via #ifdefs.
 
15
// FIXME: This currently work on linux and windows only. It does not 
 
16
// work on other unices. 
 
17
static std::string GetDirSeparator() {
 
18
#if __linux__ || __APPLE__
 
19
  return "/";
 
20
#else
 
21
  return "\\";
 
22
#endif
 
23
}
 
24
 
 
25
namespace hooks {
 
26
// Get preprocessor define for the part.
 
27
// It is __partname format in lower case.
 
28
std::string
 
29
GetLowerCasePartDefine(void) {
 
30
  std::string Partname;
 
31
  if (AutoGeneratedParameter_p.empty()) {
 
32
    Partname = "16f1xxx";
 
33
  } else {
 
34
    Partname = AutoGeneratedParameter_p;
 
35
  }
 
36
 
 
37
  std::string LowerCase;
 
38
  for (unsigned i = 0; i <= Partname.size(); i++) {
 
39
    LowerCase.push_back(std::tolower(Partname[i]));
 
40
  }
 
41
 
 
42
  return "__" + LowerCase;
 
43
}
 
44
 
 
45
std::string
 
46
GetUpperCasePartDefine(void) {
 
47
  std::string Partname;
 
48
  if (AutoGeneratedParameter_p.empty()) {
 
49
    Partname = "16f1xxx";
 
50
  } else {
 
51
    Partname = AutoGeneratedParameter_p;
 
52
  }
 
53
 
 
54
  std::string UpperCase;
 
55
  for (unsigned i = 0; i <= Partname.size(); i++) {
 
56
    UpperCase.push_back(std::toupper(Partname[i]));
 
57
  }
 
58
 
 
59
  return "__" +  UpperCase;
 
60
}
 
61
 
 
62
 
 
63
// Get the dir where c16 executables reside.
 
64
std::string GetBinDir() {
 
65
  // Construct a Path object from the program name.  
 
66
  void *P = (void*) (intptr_t) GetBinDir;
 
67
  sys::Path ProgramFullPath 
 
68
    = sys::Path::GetMainExecutable(llvmc::ProgramName, P);
 
69
 
 
70
  // Get the dir name for the program. It's last component should be 'bin'.
 
71
  std::string BinDir = ProgramFullPath.getDirname();
 
72
 
 
73
  // llvm::errs() << "BinDir: " << BinDir << '\n';
 
74
  return BinDir + GetDirSeparator();
 
75
}
 
76
 
 
77
// Get the Top-level Installation dir for c16.
 
78
std::string GetInstallDir() {
 
79
  sys::Path BinDirPath = sys::Path(GetBinDir());
 
80
 
 
81
  // Go one more level up to get the install dir.
 
82
  std::string InstallDir  = BinDirPath.getDirname();
 
83
  
 
84
  return InstallDir + GetDirSeparator();
 
85
}
 
86
 
 
87
// Get the dir where the c16 header files reside.
 
88
std::string GetStdHeadersDir() {
 
89
  return GetInstallDir() + "include";
 
90
}
 
91
 
 
92
// Get the dir where the assembler header files reside.
 
93
std::string GetStdAsmHeadersDir() {
 
94
  return GetInstallDir() + "inc";
 
95
}
 
96
 
 
97
// Get the dir where the linker scripts reside.
 
98
std::string GetStdLinkerScriptsDir() {
 
99
  return GetInstallDir() + "lkr";
 
100
}
 
101
 
 
102
// Get the dir where startup code, intrinsics and lib reside.
 
103
std::string GetStdLibsDir() {
 
104
  return GetInstallDir() + "lib";
 
105
}
 
106
}