Skip to content

Commit b7d16ed

Browse files
committed
Merge code to access property information from Python.
2 parents 0827169 + 12a8dd1 commit b7d16ed

File tree

18 files changed

+1216
-251
lines changed

18 files changed

+1216
-251
lines changed

core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ set(MODULE_SRC_FILES
179179
pythoncdb/py_progress.cc
180180
pythoncdb/py_properties.cc
181181
pythoncdb/py_stopwatch.cc
182+
pythoncdb/py_tableau.cc
182183
)
183184

184185
set(LOCAL_SRC_FILES

core/Parser.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ You should have received a copy of the GNU General Public License
2222
#include "PreProcessor.hh"
2323

2424
#include <sstream>
25-
#include <locale>
26-
#include <codecvt>
25+
#include <internal/uniconv.h>
2726
#include <iostream>
2827
#include <typeinfo>
2928

@@ -173,8 +172,8 @@ bool Parser::string2tree(const std::string& inp)
173172
ss2 << pp;
174173
std::string str8=" "+ss2.str()+" "; // for lookahead
175174

176-
std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> conv;
177-
str=conv.from_bytes(str8);
175+
utf_converter conv;
176+
str=conv.to_utf32(str8);
178177

179178
// std::cout << str << std::endl;
180179

core/PreProcessor.cc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ Remember: we want brackets around infix operators to be around every child,
3333
#include <ctype.h>
3434
#include <stdexcept>
3535
#include <sstream>
36-
#include <locale>
37-
#include <codecvt>
36+
#include <internal/uniconv.h>
3837
#include "PreProcessor.hh"
3938

4039
const char32_t preprocessor::orders[] = { '!', tok_pow, '/', '*', tok_wedge,
@@ -56,9 +55,10 @@ const char32_t preprocessor::close_brackets[] = { '}', ')', ']' };
5655
std::istream& operator>>(std::istream& s, preprocessor& p)
5756
{
5857
std::string inp;
59-
std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> conv;
58+
59+
utf_converter conv;
6060
while(std::getline(s,inp)) {
61-
std::u32string inp32=conv.from_bytes(inp);
61+
std::u32string inp32=conv.to_utf32(inp);
6262
p.parse_(inp32);
6363
}
6464
return s;
@@ -70,8 +70,8 @@ std::ostream& operator<<(std::ostream& s, const preprocessor& p)
7070
p.unwind_(sizeof(preprocessor::orders)/sizeof(char32_t));
7171
p.unwind_(sizeof(preprocessor::orders)/sizeof(char32_t));
7272
p.strip_outer_brackets();
73-
std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> conv;
74-
auto ac8 = conv.to_bytes(p.cur.accu);
73+
utf_converter conv;
74+
auto ac8 = conv.to_utf8(p.cur.accu);
7575
s << ac8;
7676
return s;
7777
}
@@ -203,7 +203,7 @@ char32_t preprocessor::get_token_(char32_t prev_token)
203203
// }
204204
}
205205
if(is_opening_bracket_(prev_token)) {
206-
while(isblank(cur_str[cur_pos])) {
206+
while (std::isblank(cur_str[cur_pos], std::locale{})) {
207207
++cur_pos;
208208
}
209209
}
@@ -260,7 +260,7 @@ char32_t preprocessor::get_token_(char32_t prev_token)
260260

261261
// HERE: how do we force get_token to return a '*' for the space separating .... and b ?
262262

263-
if(isblank(c)) {
263+
if (std::isblank(c, std::locale{})) {
264264
// std::cout << "blank " << (int)(c) << "\n";
265265
if(candidate==0) candidate=' ';
266266
++cur_pos;
@@ -526,8 +526,8 @@ void preprocessor::parse_(const std::u32string& str)
526526
void preprocessor::show_and_throw_(const std::string& str) const
527527
{
528528
std::stringstream ss;
529-
std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> conv;
530-
ss << std::endl << conv.to_bytes(cur_str) << std::endl;
529+
utf_converter conv;
530+
ss << std::endl << conv.to_utf8(cur_str) << std::endl;
531531
for(unsigned int i=0; i<cur_pos; ++i)
532532
ss << " ";
533533
ss << "^" << std::endl

core/Storage.cc

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ You should have received a copy of the GNU General Public License
2323
#include "Exceptions.hh"
2424
#include <iomanip>
2525
#include <sstream>
26-
#include <locale>
27-
#include <codecvt>
26+
#include <internal/uniconv.h>
2827
#include <pcrecpp.h>
2928

3029
//#define DEBUG 1
@@ -714,8 +713,8 @@ namespace cadabra {
714713

715714
str_node::str_node(const std::u32string& nm, bracket_t br, parent_rel_t pr)
716715
{
717-
std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> conv;
718-
std::string nm8=conv.to_bytes(nm);
716+
utf_converter conv;
717+
std::string nm8=conv.to_utf8(nm);
719718
#ifdef DEBUG
720719
std::cerr << "str_node: " << nm8 << std::endl;
721720
#endif
@@ -773,7 +772,7 @@ namespace cadabra {
773772
{
774773
if((*name).size()==0) return false;
775774
for(unsigned int i=0; i<(*name).size(); ++i) {
776-
if(!isdigit((*name)[i]) && (*name)[i]!='/' && (*name)[i]!='-')
775+
if (!std::isdigit((*name)[i], std::locale{}) && (*name)[i] != '/' && (*name)[i] != '-')
777776
return false;
778777
}
779778
return true;
@@ -783,7 +782,7 @@ namespace cadabra {
783782
{
784783
if((*name).size()==0) return false;
785784
for(unsigned int i=0; i<(*name).size(); ++i) {
786-
if(!isdigit((*name)[i]) && (*name)[i]!='-')
785+
if (!std::isdigit((*name)[i], std::locale{}) && (*name)[i] != '-')
787786
return false;
788787
}
789788
return true;
@@ -897,7 +896,7 @@ namespace cadabra {
897896
{
898897
int len=(*name).size();
899898
if(len>1)
900-
if(isdigit((*name)[len-1]))
899+
if (std::isdigit((*name)[len - 1], std::locale{}))
901900
return true;
902901
return false;
903902
}

0 commit comments

Comments
 (0)