Compare commits
13 Commits
v2.0.14
...
25e114dbea
Author | SHA1 | Date | |
---|---|---|---|
25e114dbea | |||
740116c7ba | |||
5899bd646b | |||
1d33a81ad2 | |||
b58efae107 | |||
cc0dd9978f | |||
4834f63a67 | |||
1be78a2c5e | |||
f5581557bc | |||
8cde88848b | |||
0799513ea2 | |||
effeee105c | |||
ed5b366341 |
10
.github/workflows/pypi-deploy.yml
vendored
10
.github/workflows/pypi-deploy.yml
vendored
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
name: Build Python Wheels
|
name: CI Build Wheel
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
#branches: [master]
|
# branches: [master]
|
||||||
tags: ["v[0-9]+.[0-9]+.[0-9]+"]
|
tags: ["v[0-9]+.[0-9]+.[0-9]+"]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -40,12 +40,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: wheel-config
|
name: wheel-config
|
||||||
path: python/
|
path: python/
|
||||||
- name: Install libiconv for windows
|
|
||||||
if: matrix.os == 'windows-2019'
|
|
||||||
run: |
|
|
||||||
git clone https://github.com/Microsoft/vcpkg.git
|
|
||||||
.\vcpkg\bootstrap-vcpkg.bat
|
|
||||||
vcpkg install libiconv
|
|
||||||
- name: Build wheels
|
- name: Build wheels
|
||||||
run: python -m cibuildwheel --output-dir wheelhouse
|
run: python -m cibuildwheel --output-dir wheelhouse
|
||||||
working-directory: python/
|
working-directory: python/
|
||||||
|
@@ -1,10 +1,8 @@
|
|||||||
|
|
||||||
[](https://lgtm.com/projects/g/RecordEvolution/IMCtermite/alerts/)
|
|
||||||
[](https://lgtm.com/projects/g/RecordEvolution/IMCtermite/context:cpp)
|
|
||||||
[](https://lgtm.com/projects/g/RecordEvolution/IMCtermite/context:python)
|
|
||||||
[](https://img.shields.io/github/license/RecordEvolution/IMCtermite)
|
[](https://img.shields.io/github/license/RecordEvolution/IMCtermite)
|
||||||
[](https://img.shields.io/github/stars/RecordEvolution/IMCtermite)
|
[](https://img.shields.io/github/stars/RecordEvolution/IMCtermite)
|
||||||

|

|
||||||
|
[](https://pypi.org/project/IMCtermite/)
|
||||||
|
|
||||||
# IMCtermite
|
# IMCtermite
|
||||||
|
|
||||||
|
@@ -12,6 +12,8 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#if defined(__linux__) || defined(__APPLE__)
|
#if defined(__linux__) || defined(__APPLE__)
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
|
#elif defined(__WIN32__) || defined(_WIN32)
|
||||||
|
#define timegm _mkgmtime
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//---------------------------------------------------------------------------//
|
//---------------------------------------------------------------------------//
|
||||||
@@ -146,13 +148,12 @@ namespace imc
|
|||||||
return sumstr;
|
return sumstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__linux__) || defined(__APPLE__)
|
||||||
// convert encoding of any descriptions, channel-names, units etc.
|
// convert encoding of any descriptions, channel-names, units etc.
|
||||||
class iconverter
|
class iconverter
|
||||||
{
|
{
|
||||||
#if defined(__linux__) || defined(__APPLE__)
|
|
||||||
iconv_t cd_;
|
|
||||||
#endif
|
|
||||||
std::string in_enc_, out_enc_;
|
std::string in_enc_, out_enc_;
|
||||||
|
iconv_t cd_;
|
||||||
size_t out_buffer_size_;
|
size_t out_buffer_size_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -160,7 +161,6 @@ namespace imc
|
|||||||
iconverter(std::string in_enc, std::string out_enc, size_t out_buffer_size = 1024) :
|
iconverter(std::string in_enc, std::string out_enc, size_t out_buffer_size = 1024) :
|
||||||
in_enc_(in_enc), out_enc_(out_enc), out_buffer_size_(out_buffer_size)
|
in_enc_(in_enc), out_enc_(out_enc), out_buffer_size_(out_buffer_size)
|
||||||
{
|
{
|
||||||
#if defined(__linux__) || defined(__APPLE__)
|
|
||||||
// allocate descriptor for character set conversion
|
// allocate descriptor for character set conversion
|
||||||
// (https://man7.org/linux/man-pages/man3/iconv_open.3.html)
|
// (https://man7.org/linux/man-pages/man3/iconv_open.3.html)
|
||||||
cd_ = iconv_open(out_enc.c_str(), in_enc.c_str());
|
cd_ = iconv_open(out_enc.c_str(), in_enc.c_str());
|
||||||
@@ -174,12 +174,10 @@ namespace imc
|
|||||||
throw std::runtime_error(errmsg);
|
throw std::runtime_error(errmsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void convert(std::string &astring)
|
void convert(std::string &astring)
|
||||||
{
|
{
|
||||||
#if defined(__linux__) || defined(__APPLE__)
|
|
||||||
if ( astring.empty() ) return;
|
if ( astring.empty() ) return;
|
||||||
|
|
||||||
std::vector<char> in_buffer(astring.begin(),astring.end());
|
std::vector<char> in_buffer(astring.begin(),astring.end());
|
||||||
@@ -221,8 +219,15 @@ namespace imc
|
|||||||
std::string outstring(out_buffer.begin(),out_buffer.end()-outbytes);
|
std::string outstring(out_buffer.begin(),out_buffer.end()-outbytes);
|
||||||
astring = outstring;
|
astring = outstring;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
#elif defined(__WIN32__) || defined(_WIN32)
|
||||||
|
class iconverter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
iconverter(std::string in_enc, std::string out_enc, size_t out_buffer_size = 1024) {}
|
||||||
|
void convert(std::string &astring) {}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
// channel
|
// channel
|
||||||
struct channel
|
struct channel
|
||||||
@@ -491,10 +496,18 @@ namespace imc
|
|||||||
// convert any description, units etc. to UTF-8 (by default)
|
// convert any description, units etc. to UTF-8 (by default)
|
||||||
void convert_encoding()
|
void convert_encoding()
|
||||||
{
|
{
|
||||||
|
// actual input codepage
|
||||||
|
std::string cpn;
|
||||||
|
|
||||||
if ( !codepage_.empty() )
|
if ( !codepage_.empty() )
|
||||||
{
|
{
|
||||||
// construct iconv-compatible name for respective codepage
|
// construct iconv-compatible name for respective codepage
|
||||||
std::string cpn = std::string("CP") + codepage_;
|
cpn = std::string("CP") + codepage_;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// assume codepage 1252 by default
|
||||||
|
cpn = std::string("CP1252");
|
||||||
|
}
|
||||||
|
|
||||||
// set up converter
|
// set up converter
|
||||||
std::string utf = std::string("UTF-8");
|
std::string utf = std::string("UTF-8");
|
||||||
@@ -513,7 +526,6 @@ namespace imc
|
|||||||
conv.convert(group_name_);
|
conv.convert(group_name_);
|
||||||
conv.convert(group_comment_);
|
conv.convert(group_comment_);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// get info string
|
// get info string
|
||||||
std::string get_info(int width = 20)
|
std::string get_info(int width = 20)
|
||||||
|
@@ -1 +1 @@
|
|||||||
2.0.14
|
2.0.20
|
||||||
|
Reference in New Issue
Block a user