Skip to content

Commit

Permalink
Поправил работу формул
Browse files Browse the repository at this point in the history
  • Loading branch information
kuvbur committed Aug 20, 2024
1 parent ab9e54c commit 9b632b5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 48 deletions.
13 changes: 12 additions & 1 deletion Sources/AddOn/Helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3423,15 +3423,26 @@ bool ParamHelpers::ReadFormula (ParamDictValue& paramByType, ParamDictValue& par
for (GS::HashTable<GS::UniString, ParamValue>::PairIterator cIt = paramByType.EnumeratePairs (); cIt != NULL; ++cIt) {
#if defined(AC_28)
ParamValue& param = cIt->value;
GS::UniString key = cIt->key;
#else
ParamValue& param = *cIt->value;
GS::UniString key = *cIt->key;
#endif
GS::UniString expression = param.val.uniStringValue;
if (!param.val.formatstring.isEmpty) expression = expression + '.' + param.val.formatstring.stringformat;
if (ParamHelpers::ReplaceParamInExpression (params, expression)) {
if (EvalExpression (expression)) {
flag_find = true;
param.val.uniStringValue = expression;
ParamValue pvalue;
ParamHelpers::ConvertStringToParamValue (pvalue, key, expression);
paramByType.Get (key).val = pvalue.val;
GS::UniString expression_ = "<" + expression + ">";
if (EvalExpression (expression_)) {
ParamHelpers::ConvertStringToParamValue (pvalue, key, expression_);
paramByType.Get (key).val = pvalue.val;
paramByType.Get (key).val.uniStringValue = expression;
}
paramByType.Get (key).isValid = true;
}
}
}
Expand Down
39 changes: 0 additions & 39 deletions Sources/AddOn/SomeStuff_Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,42 +26,6 @@
#include "Summ.hpp"
#include "Dimensions.hpp"

bool debugtestfunc ()
{
#if defined(DEBUG)
// Тест функции вычисления
//GS::UniString unistring_expression = ""; bool res = false;
//unistring_expression = "<3+1+1>";
//res = EvalExpression (unistring_expression);
//if (unistring_expression != "5") DBPrintf ("== SMSTF == ERR debugtestfunc\n");

//unistring_expression = "<3+1+1>.3mm";
//res = EvalExpression (unistring_expression);
//if (unistring_expression != "5000") DBPrintf ("== SMSTF == ERR debugtestfunc\n");

//unistring_expression = "<3+1+1>.3m";
//res = EvalExpression (unistring_expression);
//if (unistring_expression != "5") DBPrintf ("== SMSTF == ERR debugtestfunc\n");

//unistring_expression = "<3+1>.3mm+<3+1>.3mm";
//res = EvalExpression (unistring_expression);
//if (unistring_expression != "4000+4000") DBPrintf ("== SMSTF == ERR debugtestfunc\n");

//unistring_expression = "<3+1>.3m+<3+1>.3mm";
//res = EvalExpression (unistring_expression);

//unistring_expression = "<3+1>+<3+1>.3mm";
//res = EvalExpression (unistring_expression);

//unistring_expression = "<3+1>.3mm +<3+1>.3mm";
//res = EvalExpression (unistring_expression);
return true;
#else
return true;
#endif
}


//-----------------------------------------------------------------------------
// Срабатывает при событиях в тимворк
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -404,9 +368,6 @@ API_AddonType __ACDLL_CALL CheckEnvironment (API_EnvirParams * envir)
RSGetIndString (&envir->addOnInfo.name, ID_ADDON_INFO + isEng (), AddOnNameID, ACAPI_GetOwnResModule ());
RSGetIndString (&envir->addOnInfo.description, ID_ADDON_INFO + isEng (), AddOnDescriptionID, ACAPI_GetOwnResModule ());
ACAPI_KeepInMemory (true);
if (!debugtestfunc ()) {
msg_rep ("debugtestfunc", "Error in test", APIERR_GENERAL, APINULLGuid);
}
return APIAddon_Preload;
}
#if defined(AC_28)
Expand Down
8 changes: 0 additions & 8 deletions Sources/AddOn/SomeStuff_Main.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ static const Int32 AutoList_CommandID = 11;
static const Int32 Auto3D_CommandID = 12;
static const Int32 AutoLay_CommandID = 13;

// -----------------------------------------------------------------------------
// Функция для тестирования поведения некоторых функций
// Срабатывает при загрузке аддона
// При обычном режиме всегда возвращает истину
// При дебаге возвращает истину если все тесты сработали
// -----------------------------------------------------------------------------
bool debugtestfunc ();

#if defined(AC_28)
GSErrCode ElementEventHandlerProc (const API_NotifyElementType* elemType);

Expand Down

0 comments on commit 9b632b5

Please sign in to comment.