Merge branch 'master' of https://git.shs.tools/SHS/pip
This commit is contained in:
@@ -3,8 +3,8 @@ cmake_policy(SET CMP0017 NEW) # need include() with .cmake
|
||||
project(pip)
|
||||
set(pip_MAJOR 2)
|
||||
set(pip_MINOR 14)
|
||||
set(pip_REVISION 0)
|
||||
set(pip_SUFFIX beta)
|
||||
set(pip_REVISION 1)
|
||||
set(pip_SUFFIX )
|
||||
set(pip_COMPANY SHS)
|
||||
set(pip_DOMAIN org.SHS)
|
||||
|
||||
|
||||
@@ -330,8 +330,10 @@ void PIEvaluator::makeOutput(PIString & string) {
|
||||
void PIEvaluator::findUnknownVariables() {
|
||||
PIString cvar;
|
||||
unknownVars.clear();
|
||||
usedVars.clear();
|
||||
for (int i = 0; i < currentString.length(); i++) {
|
||||
if (elements[i].var_num == -666) cvar += currentString[i];
|
||||
if (elements[i].var_num >= 0) usedVars << content.variable(elements[i].var_num).name;
|
||||
else if (elements[i].var_num == -666) cvar += currentString[i];
|
||||
else {
|
||||
if (cvar.length() == 0) continue;
|
||||
unknownVars << cvar;
|
||||
@@ -340,6 +342,10 @@ void PIEvaluator::findUnknownVariables() {
|
||||
}
|
||||
if (cvar.length() > 0) unknownVars << cvar;
|
||||
unknownVars.removeDuplicates();
|
||||
usedVars.removeDuplicates();
|
||||
usedVars.removeOne("i");
|
||||
usedVars.removeOne("pi");
|
||||
usedVars.removeOne("e");
|
||||
}
|
||||
|
||||
|
||||
@@ -1196,7 +1202,7 @@ complexd PIEvaluator::evaluate() {
|
||||
|
||||
PIByteArray PIEvaluator::save() const {
|
||||
PIByteArray ret;
|
||||
ret << content << currentVariables << unknownVars << instructions << currentString << lastError << out << correct;
|
||||
ret << content << currentVariables << unknownVars << instructions << currentString << lastError << out << correct << usedVars;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1204,5 +1210,6 @@ PIByteArray PIEvaluator::save() const {
|
||||
void PIEvaluator::load(PIByteArray ba) {
|
||||
if (ba.size() <= 4) return;
|
||||
ba >> content >> currentVariables >> unknownVars >> instructions >> currentString >> lastError >> out >> correct;
|
||||
if (ba.size() >= 4) ba >> usedVars;
|
||||
variables = currentVariables;
|
||||
}
|
||||
|
||||
@@ -176,6 +176,9 @@ public:
|
||||
//! Returns all unknown variables founded in last expression passed to \a check() function
|
||||
const PIStringList & unknownVariables() const {return unknownVars;}
|
||||
|
||||
//! Returns all used variables founded in last expression passed to \a check() function
|
||||
const PIStringList & usedVariables() const {return usedVars;}
|
||||
|
||||
//! Returns processed last expression passed to \a check() function
|
||||
const PIString & expression() const {return currentString;}
|
||||
|
||||
@@ -220,7 +223,7 @@ private:
|
||||
PIDeque<PIEvaluatorTypes::Element> elements;
|
||||
PIVector<PIEvaluatorTypes::Variable> currentVariables, variables, tmpvars, * kvars;
|
||||
PIVector<PIEvaluatorTypes::Instruction> instructions;
|
||||
PIStringList unknownVars;
|
||||
PIStringList unknownVars, usedVars;
|
||||
PIString currentString, lastError;
|
||||
complexd out;
|
||||
bool correct;
|
||||
|
||||
@@ -30,12 +30,7 @@ protected:
|
||||
}
|
||||
|
||||
void resize_reduce_is_data_stay_consistent(int newRowsCount, int newColsCount) {
|
||||
piCout << "Before:";
|
||||
piCout << vec;
|
||||
piCout << "";
|
||||
vec.resize(newRowsCount, newColsCount, 0);
|
||||
piCout << "After:";
|
||||
piCout << vec;
|
||||
assert_fill_with(vec, newRowsCount, newColsCount);
|
||||
}
|
||||
|
||||
@@ -43,8 +38,9 @@ protected:
|
||||
vec.resize(newRowsCount, newColsCount, 0);
|
||||
assert_fill_with(vec, ROWS_COUNT_INIT, COLS_COUNT_INIT);
|
||||
|
||||
for (int r = ROWS_COUNT_INIT; r < newRowsCount; ++r) {
|
||||
for (int c = COLS_COUNT_INIT; c < newColsCount; ++c) {
|
||||
for (int r = 0; r < newRowsCount; ++r) {
|
||||
for (int c = 0; c < newColsCount; ++c) {
|
||||
if (r < ROWS_COUNT_INIT || c < COLS_COUNT_INIT) continue;
|
||||
ASSERT_EQ(vec.element(r, c), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ void usage() {
|
||||
"[-p <qt_plugins>] [-s <search_path>] [--ignore <libs>] [-S <styles>] "
|
||||
"[-l <ldd>] [-D <dpkg>] [--dpkg-workdir <d>] [-L <readelf> | -W <objdump> | -M <otool>] "
|
||||
"[--name-tool <pathS>] [-d <depth>] [-q <qtdir>] [-a <add_libs>] [-S <styles>] "
|
||||
"[-P <platforms>] [--qt-plugins <d>] -o <out_path> <file> [<file2> ...]\"" << NewLine;
|
||||
"[-P <platforms>] [--qt-plugins <d>] [--qt-modules <l>] -o <out_path> <file> [<file2> ...]\"" << NewLine;
|
||||
piCout << Green << Bold << "Details:";
|
||||
piCout << Bold << "Debug control";
|
||||
piCout << "-h, --help " << Green << "- display this message and exit";
|
||||
@@ -92,10 +92,11 @@ void usage() {
|
||||
piCout << "-S <styles> " << Green << "- set Qt styles (e.g. \"oxygen,breeze\"), default \"*\"";
|
||||
piCout << "-P <platforms> " << Green << "- set Qt platforms (e.g. \"win,mini\"), default by host system";
|
||||
piCout << "--qt-plugins <d> " << Green << "- set Qt plugins description";
|
||||
piCout << "--qt-modules <list>" << Green << "- additional Qt modules, may be separated by \"" DELIM "\" (e.g. \"Sql" DELIM "Xml\")";
|
||||
piCout << "";
|
||||
piCout << Bold << "Output control";
|
||||
piCout << "-o <out_path> " << Green << "- path for libraries copy to";
|
||||
piCout << "-p <qt_plugins> " << Green << "- path for Qt plugins, default \"<out_path>/plugins\"";
|
||||
piCout << "-p <qt_plugins> " << Green << "- path for Qt plugins, default \"<out_path>\"";
|
||||
piCout << "--dependencies " << Green << "- search dependencies by <dpkg>, print them and copy missing libraries";
|
||||
piCout << "--prefix <text> " << Green << "- print <text> before dependencies";
|
||||
piCout << "";
|
||||
@@ -127,9 +128,10 @@ QtDep qt_deps[] = {
|
||||
|
||||
|
||||
int depth = 8;
|
||||
bool fake = false, is_ldd = true, is_deps = false, need_qt = false;
|
||||
bool fake = false, is_ldd = true, is_deps = false, need_qt = false, make_qt_format = true;
|
||||
PIString ldd, readelf, objdump, otool, dpkg, nametool, strip, out_dir, qt_dir, out_plugins_dir, dpkg_workdir;
|
||||
PIStringList styles, lib_dirs, add_libs, platforms, sqldrivers, input_files, plugin_libs;
|
||||
PIString qt_pref, qt_suff;
|
||||
PIStringList styles, lib_dirs, add_libs, platforms, sqldrivers, input_files, plugin_libs, qt_add_libs;
|
||||
PISet<PIString> all_libs, miss_libs, all_deps, frameworks, framework_libs, miss_frameworks, qt_plugins, ignore_libs;
|
||||
PIMap<PIString, PIStringList> qt_filters;
|
||||
|
||||
@@ -181,17 +183,22 @@ PIString execute(const PIString & cmd) {
|
||||
|
||||
|
||||
void checkQtLib(PIString lib) {
|
||||
if (lib.startsWith("lib")) lib.cutLeft(3);
|
||||
if (lib.startsWith("qt5")) lib.cutLeft(3);
|
||||
if (lib.startsWith("qt")) lib.cutLeft(2);
|
||||
if (lib.find(".")) lib = lib.left(lib.find("."));
|
||||
//piCout << "checkQt" << lib;
|
||||
PIString pref, suff;
|
||||
if (lib.startsWith("lib")) {pref += "lib"; lib.cutLeft(3);}
|
||||
if (lib.startsWith("qt5")) {pref += "Qt5"; lib.cutLeft(3);}
|
||||
if (lib.startsWith("qt" )) {pref += "Qt" ; lib.cutLeft(2);}
|
||||
if (lib.find('.') >= 0) {suff = lib.right(lib.size_s() - lib.find('.')); lib = lib.left(lib.find('.'));}
|
||||
for (int i = 0; ; ++i) {
|
||||
if (qt_deps[i].lib.isEmpty()) break;
|
||||
if (qt_deps[i].lib == lib) {
|
||||
qt_plugins << qt_deps[i].plugins;
|
||||
//piCout << "add qt plugins" << qt_deps[i].plugins << "now" << qt_plugins;
|
||||
need_qt = true;
|
||||
if (make_qt_format) {
|
||||
make_qt_format = false;
|
||||
qt_pref = pref;
|
||||
qt_suff = suff;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -484,6 +491,7 @@ int main(int argc, char * argv[]) {
|
||||
cli.addArgument("Styles", true);
|
||||
cli.addArgument("Platforms", true);
|
||||
cli.addArgument("qt-plugins", PIChar('\0'), true);
|
||||
cli.addArgument("qt-modules", PIChar('\0'), true);
|
||||
cli.addArgument("ldd", true);
|
||||
cli.addArgument("Lreadelf", true);
|
||||
cli.addArgument("Wobjdump", true);
|
||||
@@ -590,6 +598,9 @@ int main(int argc, char * argv[]) {
|
||||
qt_filters["platforms"] = platforms;
|
||||
qt_filters["styles" ] = styles ;
|
||||
|
||||
qt_add_libs = cli.argumentValue("qt-modules").split(DELIM);
|
||||
need_qt = !qt_add_libs.isEmpty();
|
||||
|
||||
auto it = qt_filters.makeIterator();
|
||||
while (it.next())
|
||||
it.valueRef().forEachInplace([](PIString i)->PIString{
|
||||
@@ -616,8 +627,15 @@ int main(int argc, char * argv[]) {
|
||||
}
|
||||
});
|
||||
//piCout << files;
|
||||
if (depth > 0)
|
||||
if (depth > 0) {
|
||||
input_files.forEach([&](const PIString & f){procLdd(f);});
|
||||
qt_add_libs.forEach([&](const PIString & f){
|
||||
PIString l = findLib(qt_pref + f + qt_suff);
|
||||
if (l.isEmpty()) return;
|
||||
procLdd(l, true);
|
||||
checkQtLib(f.toLowerCase());
|
||||
});
|
||||
}
|
||||
piForeach (PIString & s, add_libs) {
|
||||
if (s.isEmpty()) continue;
|
||||
PIString alib = findLib(s);
|
||||
|
||||
Reference in New Issue
Block a user