[BASE] Removed dead code (#10330)

This commit is contained in:
mosfet80
2023-08-28 17:41:20 +02:00
committed by GitHub
parent 4adbc90c99
commit cb607ffe1e
14 changed files with 9 additions and 175 deletions

View File

@@ -104,26 +104,6 @@ void CoordinateSystem::setZDirection(const Vector3d& dir)
Placement CoordinateSystem::displacement(const CoordinateSystem& cs) const
{
#if 0
// align the Z axes
Base::Rotation rotZ(getZDirection(), cs.getZDirection());
// align the X axes
Base::Vector3d xd = xdir;
rotZ.multVec(xd,xd);
Base::Rotation rotX(xd, cs.getXDirection());
// the transformed base point
Vector3d mov = axis.getBase();
rotZ.multVec(mov,mov);
rotX.multVec(mov,mov);
mov = cs.getPosition() - mov;
Base::Rotation rot;
rot = rotX * rotZ;
return Placement(mov, rot);
#else
const Base::Vector3d& a = axis.getBase();
const Base::Vector3d& zdir = axis.getDirection();
Base::Matrix4D At;
@@ -140,15 +120,10 @@ Placement CoordinateSystem::displacement(const CoordinateSystem& cs) const
B[1][0] = cs.xdir.y; B[1][1] = cs.ydir.y; B[1][2] = cszdir.y; B[1][3] = b.y;
B[2][0] = cs.xdir.z; B[2][1] = cs.ydir.z; B[2][2] = cszdir.z; B[2][3] = b.z;
//Base::Matrix4D C;
//C = B * At;
//Placement p(C);
//return p;
Placement PAt(At);
Placement PB(B);
Placement C = PB * PAt;
return C;
#endif
}
void CoordinateSystem::transformTo(Vector3d& p)

View File

@@ -61,17 +61,8 @@ PyException::PyException()
setPyObject(PP_PyDict_Object);
std::string prefix = PP_last_error_type; /* exception name text */
// prefix += ": ";
std::string error = PP_last_error_info; /* exception data text */
#if 0
// The Python exceptions might be thrown from nested functions, so take
// into account not to add the same prefix several times
std::string::size_type pos = error.find(prefix);
if (pos == std::string::npos)
_sErrMsg = prefix + error;
else
_sErrMsg = error;
#endif
_sErrMsg = error;
_errorType = prefix;
@@ -248,7 +239,6 @@ std::string InterpreterSingleton::runString(const char *sCmd)
else {
PyException::ThrowException();
return {}; // just to quieten code analyzers
//throw PyException();
}
}
@@ -417,9 +407,6 @@ void InterpreterSingleton::runFile(const char*pxFileName, bool local)
#endif
if (fp) {
PyGILStateLocker locker;
//std::string encoding = PyUnicode_GetDefaultEncoding();
//PyUnicode_SetDefaultEncoding("utf-8");
//PyUnicode_SetDefaultEncoding(encoding.c_str());
PyObject *module{}, *dict{};
module = PyImport_AddModule("__main__");
dict = PyModule_GetDict(module);

View File

@@ -54,9 +54,6 @@
FC_LOG_LEVEL_INIT("Parameter", true, true)
//#ifdef XERCES_HAS_CPP_NAMESPACE
// using namespace xercesc;
//#endif
XERCES_CPP_NAMESPACE_USE
using namespace Base;
@@ -916,17 +913,6 @@ std::vector<std::pair<std::string,double> > ParameterGrp::GetFloatMap(const char
return vrValues;
}
void ParameterGrp::SetBlob(const char* /*Name*/, void* /*pValue*/, long /*lLength*/)
{
// not implemented so far
assert(0);
}
void ParameterGrp::GetBlob(const char* /*Name*/, void* /*pBuf*/, long /*lMaxLength*/, void* /*pPreset*/) const
{
// not implemented so far
assert(0);
}
void ParameterGrp::SetASCII(const char* Name, const char *sValue)
{
@@ -1081,18 +1067,6 @@ void ParameterGrp::RemoveBool(const char* Name)
Notify(Name);
}
void ParameterGrp::RemoveBlob(const char* /*Name*/)
{
/* not implemented yet
// check if Element in group
DOMElement *pcElem = FindElement(_pGroupNode,"FCGrp",Name);
// if not return
if(!pcElem)
return;
else
_pGroupNode->removeChild(pcElem);
*/
}
void ParameterGrp::RemoveFloat(const char* Name)
{

View File

@@ -220,16 +220,6 @@ public:
//@}
/** @name methods for Blob handling (not implemented yet) */
//@{
/// set a blob value
void SetBlob(const char* Name, void *pValue, long lLength);
/// read blob values or give default
void GetBlob(const char* Name, void * pBuf, long lMaxLength, void* pPreset=nullptr) const;
/// remove a blob value from this group
void RemoveBlob(const char* Name);
//@}
/** @name methods for String handling */

View File

@@ -417,7 +417,6 @@ PyObject * PlacementPy::number_power_handler (PyObject* self, PyObject* other, P
double pw_v{};
if (!PyArg_ParseTuple(tup.ptr(), "d", &pw_v)){
//PyErr_SetString(PyExc_NotImplementedError, "Wrong exponent type (expect float).");
return nullptr;
}
if (!PyObject_TypeCheck(self, &(PlacementPy::Type))

View File

@@ -42,10 +42,7 @@ PP_Run_Method(PyObject *pobject, const char *method,
va_end(argslist);
return -1; /* bound method? has self */
}
/* handle zero args different */
// if(resfmt == 0 || strcmp(resfmt,"") == 0)
// pargs = Py_BuildValue("()");
// else
pargs = Py_VaBuildValue(argfmt, argslist); /* args: c->python */
va_end(argslist);
@@ -64,10 +61,8 @@ PP_Run_Method(PyObject *pobject, const char *method,
Py_DECREF(pmeth);
Py_DECREF(pargs);
// if(cresult != 0 && resfmt != 0)
return PP_Convert_Result(presult, resfmt, cresult); /* to C format */
// else
// return 0;
return PP_Convert_Result(presult, resfmt, cresult); /* to C format */
}
@@ -231,8 +226,6 @@ PyObject *PP_last_exception_type = NULL; /* saved exception python type */
void PP_Fetch_Error_Text()
{
// called without exception happened!
//assert(PyErr_Occurred());
char *tempstr = NULL;
PyObject *errobj = NULL, *errdata = NULL, *errtraceback = NULL, *pystring = NULL, *pydict = NULL;
@@ -256,13 +249,11 @@ void PP_Fetch_Error_Text()
}
else
{
/* strcpy(PP_last_error_type, "<unknown exception type>"); */
PP_last_error_type[0] = '\0';
}
Py_XDECREF(pystring);
pystring = NULL;
pydict = NULL;
if (errdata != NULL &&
@@ -324,7 +315,6 @@ void PP_Fetch_Error_Text()
#else
const char *_f = strstr(file, "/src/");
#endif
/* strcpy(PP_last_error_trace, "<unknown exception traceback>"); */
snprintf(PP_last_error_trace,sizeof(PP_last_error_trace),"%s(%d)",(_f?_f+5:file),line);
}
Py_XDECREF(pystring);
@@ -439,17 +429,10 @@ int PP_DEBUG = 0; /* debug embedded code with pdb? */
const char *PP_Init(const char *modname) {
Py_Initialize(); /* init python if needed */
//#ifdef FC_OS_LINUX /* cannot convert `const char *' to `char *' in assignment */
if (modname!=NULL) return modname;
{ /* we assume here that the caller frees allocated memory */
// #0000716: strange assignment and a memory leak
return "__main__";
//char* __main__=(char *)malloc(sizeof("__main__"));
//return __main__="__main__";
return "__main__";
}
//#else
// return modname == NULL ? "__main__" : modname; /* default to '__main__' */
//#endif
}
@@ -681,3 +664,4 @@ PP_Debug_Bytecode(PyObject *codeobject, PyObject *moddict)
return (res != 0) ? NULL : presult; /* null if error in run_function */
}
// NOLINTEND

View File

@@ -546,7 +546,5 @@ Quantity Quantity::parse(const QString &string)
// free the scan buffer
QuantityParser::yy_delete_buffer (my_string_buffer);
//if (QuantResult == Quantity(DOUBLE_MIN))
// throw Base::ParserError("Unknown error in Quantity expression");
return QuantResult;
}

View File

@@ -34,12 +34,7 @@ using namespace Base;
std::string QuantityPy::representation() const
{
std::stringstream ret;
#if 0
//ret.precision(getQuantityPtr()->getFormat().precision);
//ret.setf(std::ios::fixed, std::ios::floatfield);
ret << getQuantityPtr()->getValue() << " ";
ret << getQuantityPtr()->getUnit().getString().toUtf8().constData();
#else
double val= getQuantityPtr()->getValue();
Unit unit = getQuantityPtr()->getUnit();
@@ -48,7 +43,6 @@ std::string QuantityPy::representation() const
ret << static_cast<std::string>(flt.repr());
if (!unit.isEmpty())
ret << " " << unit.getString().toUtf8().constData();
#endif
return ret.str();
}

View File

@@ -66,13 +66,6 @@ Base::XMLReader::XMLReader(const char* FileName, std::istream& str)
// create the parser
parser = XMLReaderFactory::createXMLReader();
//parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, false);
//parser->setFeature(XMLUni::fgXercesSchema, false);
//parser->setFeature(XMLUni::fgXercesSchemaFullChecking, false);
//parser->setFeature(XMLUni::fgXercesIdentityConstraintChecking, false);
//parser->setFeature(XMLUni::fgSAX2CoreNameSpacePrefixes, false);
//parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
//parser->setFeature(XMLUni::fgXercesDynamic, true);
parser->setContentHandler(this);
parser->setLexicalHandler(this);
@@ -190,42 +183,22 @@ bool Base::XMLReader::read()
parser->parseNext(token);
}
catch (const XMLException& toCatch) {
#if 0
char* message = XMLString::transcode(toCatch.getMessage());
cerr << "Exception message is: \n"
<< message << "\n";
XMLString::release(&message);
return false;
#else
char* message = XMLString::transcode(toCatch.getMessage());
std::string what = message;
XMLString::release(&message);
throw Base::XMLBaseException(what);
#endif
}
catch (const SAXParseException& toCatch) {
#if 0
char* message = XMLString::transcode(toCatch.getMessage());
cerr << "Exception message is: \n"
<< message << "\n";
XMLString::release(&message);
return false;
#else
char* message = XMLString::transcode(toCatch.getMessage());
std::string what = message;
XMLString::release(&message);
throw Base::XMLParseException(what);
#endif
}
catch (...) {
#if 0
cerr << "Unexpected Exception \n" ;
return false;
#else
throw Base::XMLBaseException("Unexpected XML exception");
#endif
}
return true;
}

View File

@@ -504,10 +504,8 @@ void Rotation::scaleAngle(const double scaleFactor)
Rotation Rotation::slerp(const Rotation & q0, const Rotation & q1, double t)
{
// Taken from <http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/>
// q = [q0*sin((1-t)*theta)+q1*sin(t*theta)]/sin(theta), 0<=t<=1
if (t<0.0) t=0.0;
else if (t>1.0) t=1.0;
//return q0;
double scale0 = 1.0 - t;
double scale1 = t;
@@ -702,11 +700,6 @@ void Rotation::setYawPitchRoll(double y, double p, double r)
double c3 = cos(r/2.0);
double s3 = sin(r/2.0);
// quat[0] = c1*c2*s3 - s1*s2*c3;
// quat[1] = c1*s2*c3 + s1*c2*s3;
// quat[2] = s1*c2*c3 - c1*s2*s3;
// quat[3] = c1*c2*c3 + s1*s2*s3;
this->setValue (
c1*c2*s3 - s1*s2*c3,
c1*s2*c3 + s1*c2*s3,

View File

@@ -106,18 +106,6 @@ bool BoundBox2d::Intersect(const Line2d &rclLine) const
bool BoundBox2d::Intersect(const BoundBox2d &rclBB) const
{
//// compare bb2-points to this
//if (Contains (Vector2d (rclBB.fMinX, rclBB.fMinY))) return true;
//if (Contains (Vector2d (rclBB.fMaxX, rclBB.fMinY))) return true;
//if (Contains (Vector2d (rclBB.fMaxX, rclBB.fMaxY))) return true;
//if (Contains (Vector2d (rclBB.fMinX, rclBB.fMaxY))) return true;
//
//// compare this-points to bb2
//if (rclBB.Contains (Vector2d (fMinX, fMinY))) return true;
//if (rclBB.Contains (Vector2d (fMaxX, fMinY))) return true;
//if (rclBB.Contains (Vector2d (fMaxX, fMaxY))) return true;
//if (rclBB.Contains (Vector2d (fMinX, fMaxY))) return true;
if (MinX < rclBB.MaxX &&
rclBB.MinX < MaxX &&
MinY < rclBB.MaxY &&

View File

@@ -36,7 +36,6 @@ using namespace Base;
QString UnitsSchema::toLocale(const Base::Quantity& quant, double factor, const QString& unitString) const
{
//return QString::fromUtf8("%L1 %2").arg(quant.getValue() / factor).arg(unitString);
QLocale Lc;
const QuantityFormat& format = quant.getFormat();
if (format.option != QuantityFormat::None) {

View File

@@ -37,23 +37,6 @@
using namespace Base;
//void UnitsSchemaImperial1::setSchemaUnits(void){
// // here you could change the constances used by the parser (defined in Quantity.cpp)
// Quantity::Inch = Quantity (25.4 ,Unit(1));
// Quantity::Foot = Quantity (304.8 ,Unit(1));
// Quantity::Thou = Quantity (0.0254 ,Unit(1));
// Quantity::Yard = Quantity (914.4 ,Unit(1));
// Quantity::Mile = Quantity (1609344.0 ,Unit(1));
//}
//
//void UnitsSchemaImperial1::resetSchemaUnits(void){
// // set units to US customary / Imperial units
// Quantity::Inch = Quantity (25.4 ,Unit(1));
// Quantity::Foot = Quantity (304.8 ,Unit(1));
// Quantity::Thou = Quantity (0.0254 ,Unit(1));
// Quantity::Yard = Quantity (914.4 ,Unit(1));
// Quantity::Mile = Quantity (1609344.0 ,Unit(1));
//}
QString UnitsSchemaImperial1::schemaTranslate(const Quantity &quant, double &factor, QString &unitString)
{
@@ -381,8 +364,6 @@ QString UnitsSchemaImperialCivil::schemaTranslate(const Base::Quantity& quant, d
double wholeMinutes = std::floor(rawMinutes);
double sumSeconds = totalDegrees * 3600.0; //quant as seconds
double rawSeconds = sumSeconds - (wholeDegrees * 3600.0) - (wholeMinutes * 60);
// double wholeSeconds = std::floor(rawSeconds);
// double remainSeconds = rawSeconds - wholeSeconds;
int outDeg = static_cast<int>(wholeDegrees);
int outMin = static_cast<int>(wholeMinutes);

View File

@@ -43,7 +43,6 @@ QString UnitsSchemaMmMin::schemaTranslate(const Quantity &quant, double &factor,
}
else if (unit == Unit::Angle) {
unitString = QString::fromUtf8("\xC2\xB0");
//unitString = QString::fromUtf8(u8"\u00B0"); //C++11 - Not supported by VS2013
factor = 1.0;
}
else if (unit == Unit::Velocity) {