IAP GITLAB

Skip to content
Snippets Groups Projects
Commit db887dfb authored by ralfulrich's avatar ralfulrich
Browse files

clang

parent 417c94a2
No related branches found
No related tags found
No related merge requests found
...@@ -26,11 +26,11 @@ namespace corsika_data { ...@@ -26,11 +26,11 @@ namespace corsika_data {
// the fortran interface functions // the fortran interface functions
extern "C" { extern "C" {
void cordataopenfile_(const char*); void cordataopenfile_(const char*);
void cordatafillarray_(double*, const int&); void cordatafillarray_(double*, const int&);
void cordataclosefile_(); void cordataclosefile_();
double cordatanextnumber_(); double cordatanextnumber_();
void cordatanexttext_(char*, int); void cordatanexttext_(char*, int);
void cordatacandecompress_(int&); void cordatacandecompress_(int&);
} }
} // namespace corsika_data } // namespace corsika_data
...@@ -72,17 +72,17 @@ namespace corsika_data { ...@@ -72,17 +72,17 @@ namespace corsika_data {
for (int i = 0; i < maxlength && i < (int)STR.size(); ++i) data[i] = STR[i]; for (int i = 0; i < maxlength && i < (int)STR.size(); ++i) data[i] = STR[i];
} }
bool CorDataCanDeCompress() { return true; } bool CorDataCanDeCompress() { return true; }
extern "C" { extern "C" {
void cordataopenfile_(const char* name) { CorDataOpenFile(name); } void cordataopenfile_(const char* name) { CorDataOpenFile(name); }
void cordatafillarray_(double* data, const int& length) { void cordatafillarray_(double* data, const int& length) {
global_DataFile.FillArray(data, length); global_DataFile.FillArray(data, length);
} }
double cordatanextnumber_() { return global_DataFile.ReadNextNumber(); } double cordatanextnumber_() { return global_DataFile.ReadNextNumber(); }
void cordatanexttext_(char* data, const int maxlength) { void cordatanexttext_(char* data, const int maxlength) {
return CorDataNextText(data, maxlength); return CorDataNextText(data, maxlength);
} }
void cordataclosefile_() { global_DataFile.Close(); } void cordataclosefile_() { global_DataFile.Close(); }
void cordatacandecompress_(int& v) { v=1; } void cordatacandecompress_(int& v) { v = 1; }
} }
} // namespace corsika_data } // namespace corsika_data
...@@ -14,37 +14,45 @@ ...@@ -14,37 +14,45 @@
namespace corsika_data { namespace corsika_data {
void CorDataOpenFile(const std::string&) { void CorDataOpenFile(const std::string&) {
throw std::runtime_error("CorDataOpenFile: Cannot read compressed data files with dummy library."); throw std::runtime_error(
"CorDataOpenFile: Cannot read compressed data files with dummy library.");
} }
void CorDataFillArray(double*, const int&) { void CorDataFillArray(double*, const int&) {
throw std::runtime_error("CorDataFillArray: Cannot read compressed data files with dummy library."); throw std::runtime_error(
"CorDataFillArray: Cannot read compressed data files with dummy library.");
} }
void CorDataCloseFile() { void CorDataCloseFile() {
throw std::runtime_error("CorDataCloseFile: Cannot read compressed data files with dummy library."); throw std::runtime_error(
"CorDataCloseFile: Cannot read compressed data files with dummy library.");
} }
double CorDataNextNumber() { double CorDataNextNumber() {
throw std::runtime_error("CorDataNextNumber: Cannot read compressed data files with dummy library."); throw std::runtime_error(
"CorDataNextNumber: Cannot read compressed data files with dummy library.");
return 0; return 0;
} }
void CorDataNextText(std::string&) { void CorDataNextText(std::string&) {
throw std::runtime_error("CorDataNextText(string&): Cannot read compressed data files with dummy library."); throw std::runtime_error(
"CorDataNextText(string&): Cannot read compressed data files with dummy "
"library.");
} }
void CorDataNextText(char*, int) { void CorDataNextText(char*, int) {
throw std::runtime_error("CorDataNextText(char*): Cannot read compressed data files with dummy library."); throw std::runtime_error(
"CorDataNextText(char*): Cannot read compressed data files with dummy library.");
} }
bool CorDataCanDeCompress() { return false; } bool CorDataCanDeCompress() { return false; }
// the fortran interface functions // the fortran interface functions
extern "C" { extern "C" {
void cordataopenfile_(const char* name) { CorDataOpenFile(name); } void cordataopenfile_(const char* name) { CorDataOpenFile(name); }
void cordatafillarray_(double* data, const int& length) { void cordatafillarray_(double* data, const int& length) {
CorDataFillArray(data, length); CorDataFillArray(data, length);
} }
void cordataclosefile_() { CorDataCloseFile(); } void cordataclosefile_() { CorDataCloseFile(); }
double cordatanextnumber_() { return CorDataNextNumber(); } double cordatanextnumber_() { return CorDataNextNumber(); }
void cordatanexttext_(char*, int) { void cordatanexttext_(char*, int) {
throw std::runtime_error("cordatanexttext_: Cannot read compressed data files with dummy library."); throw std::runtime_error(
} "cordatanexttext_: Cannot read compressed data files with dummy library.");
void cordatacandecompress_(int& v) { v=0; } }
void cordatacandecompress_(int& v) { v = 0; }
} }
} // namespace corsika_data } // namespace corsika_data
...@@ -60,7 +60,7 @@ TEST_CASE("Data", "[data]") { ...@@ -60,7 +60,7 @@ TEST_CASE("Data", "[data]") {
} }
SECTION(std::string("fortran, ") + file) { SECTION(std::string("fortran, ") + file) {
int i=0; int i = 0;
cordatacandecompress_(i); cordatacandecompress_(i);
CHECK(i == 1); CHECK(i == 1);
cout << "Reading: " << file << endl; cout << "Reading: " << file << endl;
...@@ -108,9 +108,9 @@ TEST_CASE("Data", "[data]") { ...@@ -108,9 +108,9 @@ TEST_CASE("Data", "[data]") {
CHECK_THROWS(d = cordatanextnumber_()); CHECK_THROWS(d = cordatanextnumber_());
char* buf = 0; char* buf = 0;
CHECK_THROWS(cordatanexttext_(buf, 0)); CHECK_THROWS(cordatanexttext_(buf, 0));
int i= 0; int i = 0;
cordatacandecompress_(i); cordatacandecompress_(i);
CHECK( i == 0); CHECK(i == 0);
} }
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment