fix ast, elementary_functions, string tests memory leaks.
to use it :
- install Visual Leak Detector ( https://vld.codeplex.com/releases )
- add path in Visual Studio Configuration ( https://vld.codeplex.com/wikipage?title=Using%20Visual%20Leak%20Detector&referringTitle=Documentation )
- add preprocessor flag DEBUG_VLD in Property Manager Configuration of Visual Studio.
- Rebuild and play !
Change-Id: Icc6d7449a3e8f4f11dcb752f75805e5ba5fa5f3f
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
#include <stdio.h>
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib, "../../bin/libintl.lib")
#pragma comment(lib, "../../bin/blasplus.lib")
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../bin/libintl.lib")
#pragma comment(lib,"../../bin/arpack.lib")
#pragma comment(lib,"../../bin/blasplus.lib")
*
*/
-//for Visual Leak Detector
-//#define DEBUG_VLD
-#if defined(DEBUG_VLD)
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
#include <vld.h>
#endif
sub->append(getList());
ope->append(sub);
- types::String* s = new types::String(1, 1);
switch (e.getOper())
{
// Arithmetics.
delete *i;
}
+ _pAssignValue->killMe();
throw error;
}
}
err = execstr("a.b(1,3).num = 5;", "errcatch");
assert_checktrue(err <> 0);
+
a(3).b.num = 12;
assert_checkequal(a(3).b.num, 12);
st=initst();
err=execstr("st(1:2).f(1:4).e = 5;", "errcatch");
assert_checktrue(err <> 0);
-
if (in.size() == 1)
{
- if (api_scilab::isBool(in[0]) == false || api_scilab::getAsBool(in[0])->isScalar() == false)
+ api_scilab::Bool* pIn = api_scilab::getAsBool(in[0]);
+ if (pIn == NULL || pIn->isScalar() == false)
{
Scierror(999, _("%s: Wrong type for input argument #%d: A scalar boolean expected.\n"), "cppfoo", 1);
return api_scilab::Error;
}
- api_scilab::Bool* pIn = api_scilab::getAsBool(in[0]);
out.push_back(new NewType(pIn->get(0)));
+ delete pIn;
}
else
{
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
#include <windows.h>
#include "machine.h"
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
#pragma comment(lib,"../../../../bin/blasplus.lib")
#pragma comment(lib,"../../../../bin/lapack.lib")
#include <stdio.h>
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
#include <windows.h>
#include "dynlib_commons.h"
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
COMMONS_IMPEXP int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
int WINAPI DllMain(HINSTANCE hInstance, DWORD reason, PVOID pvReserved);
}
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain(HINSTANCE hInstance, DWORD reason, PVOID pvReserved)
return 1;
}
#else
-void __attribute__ ((constructor)) load(void);
-void __attribute__ ((destructor)) unload(void);
+__attribute__ ((constructor)) static void load(void);
+__attribute__ ((destructor)) static void unload(void);
void load(void)
{
#include <windows.h>
#include "../../src/c/windows/TermLine.h"
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
//nb lines
l->append(new types::Double(body->getLocation().last_line - body->getLocation().first_line + 1));
out.push_back(l);
+ statement->killMe();
return types::Function::OK;
}
\ No newline at end of file
* http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
*
*/
-/*-----------------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#include <windows.h>
#include "machine.h"
#include "stack-def.h"
sprintf(pstCommand, "exec(\"%s\",-1)", _pSEI->pstFile);
StoreConsoleCommand(pstCommand);
-
+ FREE(pstCommand);
iMainRet = ConfigVariable::getExitStatus();
_pSEI->pstExec = NULL;
_pSEI->pstFile = NULL;
break;
}
+ pList->killMe();
Scierror(999, _("List element number %d is Undefined.\n"), iIndex);
return types::Function::Error;
}
out.push_back(pList->get(i));
}
+ pList->killMe();
+
return types::Function::OK;
}
/*-----------------------------------------------------------------------------------*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
public :
- DifferentialEquationFunctions(std::wstring callerName);
+ DifferentialEquationFunctions(const std::wstring& callerName);
~DifferentialEquationFunctions();
void setOdeYRows(int);
iPos++;
// functions: fsub,dfsub,gsub,dgsub,guess
- DifferentialEquationFunctions* deFunctionsManager = new DifferentialEquationFunctions(L"bvode");
- DifferentialEquation::addDifferentialEquationFunctions(deFunctionsManager);
- deFunctionsManager->setBvodeM(sumM);
- deFunctionsManager->setBvodeN(ncomp);
+ DifferentialEquationFunctions deFunctionsManager(L"bvode");
+ DifferentialEquation::addDifferentialEquationFunctions(&deFunctionsManager);
+ deFunctionsManager.setBvodeM(sumM);
+ deFunctionsManager.setBvodeN(ncomp);
for (int i = iPos; i < 15; i++)
{
types::Callable* pCall = in[i]->getAs<types::Callable>();
if (i == 10) // fsub
{
- deFunctionsManager->setFsubFunction(pCall);
+ deFunctionsManager.setFsubFunction(pCall);
}
else if (i == 11) // dfsub
{
- deFunctionsManager->setDfsubFunction(pCall);
+ deFunctionsManager.setDfsubFunction(pCall);
}
else if (i == 12) // gsub
{
- deFunctionsManager->setGsubFunction(pCall);
+ deFunctionsManager.setGsubFunction(pCall);
}
else if (i == 13) // dgsub
{
- deFunctionsManager->setDgsubFunction(pCall);
+ deFunctionsManager.setDgsubFunction(pCall);
}
else if (i == 14 && ipar[8] == 1) // guess is needed only if ipar(9) == 1
{
- deFunctionsManager->setGuessFunction(pCall);
+ deFunctionsManager.setGuessFunction(pCall);
}
}
else if (in[i]->isString())
types::String* pStr = in[i]->getAs<types::String>();
if (i == 10) // fsub
{
- bOK = deFunctionsManager->setFsubFunction(pStr);
+ bOK = deFunctionsManager.setFsubFunction(pStr);
}
else if (i == 11) // dfsub
{
- bOK = deFunctionsManager->setDfsubFunction(pStr);
+ bOK = deFunctionsManager.setDfsubFunction(pStr);
}
else if (i == 12) // gsub
{
- bOK = deFunctionsManager->setGsubFunction(pStr);
+ bOK = deFunctionsManager.setGsubFunction(pStr);
}
else if (i == 13) // dgsub
{
- bOK = deFunctionsManager->setDgsubFunction(pStr);
+ bOK = deFunctionsManager.setDgsubFunction(pStr);
}
else if (i == 14 && ipar[8] == 1) // guess is needed only if ipar(9) == 1
{
- bOK = deFunctionsManager->setGuessFunction(pStr);
+ bOK = deFunctionsManager.setGuessFunction(pStr);
}
if (bOK == false)
{
if (i == 10) // fsub
{
- deFunctionsManager->setFsubFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setFsubFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setFsubArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setFsubArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
else if (i == 11) // dfsub
{
- deFunctionsManager->setDfsubFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setDfsubFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setDfsubArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setDfsubArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
else if (i == 12) // gsub
{
- deFunctionsManager->setGsubFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setGsubFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setGsubArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setGsubArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
else if (i == 13) // dgsub
{
- deFunctionsManager->setDgsubFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setDgsubFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setDgsubArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setDgsubArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
else if (i == 14 && ipar[8] == 1) // guess is needed only if ipar(9) == 1
{
- deFunctionsManager->setGuessFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setGuessFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setGuessArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setGuessArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
}
}
// get next inputs
- DifferentialEquationFunctions* deFunctionsManager = new DifferentialEquationFunctions(L"daskr");
- DifferentialEquation::addDifferentialEquationFunctions(deFunctionsManager);
+ DifferentialEquationFunctions deFunctionsManager(L"daskr");
+ DifferentialEquation::addDifferentialEquationFunctions(&deFunctionsManager);
- deFunctionsManager->setOdeYRows(pDblX0->getRows());
+ deFunctionsManager.setOdeYRows(pDblX0->getRows());
for (iPos++; iPos < in.size(); iPos++)
{
types::Callable* pCall = in[iPos]->getAs<types::Callable>();
if (bFuncF == false)
{
- deFunctionsManager->setFFunction(pCall);
+ deFunctionsManager.setFFunction(pCall);
bFuncF = true;
}
else if (bFuncJac == false && pDblNg == NULL)
{
- deFunctionsManager->setJacFunction(pCall);
+ deFunctionsManager.setJacFunction(pCall);
bFuncJac = true;
}
else if (bFuncG == false && pDblNg)
{
- deFunctionsManager->setGFunction(pCall);
+ deFunctionsManager.setGFunction(pCall);
bFuncG = true;
}
else if (bFuncG && bFuncPsol == false)
{
- deFunctionsManager->setPsolFunction(pCall);
+ deFunctionsManager.setPsolFunction(pCall);
bFuncPsol = true;
}
else if (bFuncPsol && bFuncPjac == false)
{
- deFunctionsManager->setPjacFunction(pCall);
+ deFunctionsManager.setPjacFunction(pCall);
bFuncPjac = true;
}
else
if (bFuncF == false)
{
- bOK = deFunctionsManager->setFFunction(pStr);
+ bOK = deFunctionsManager.setFFunction(pStr);
bFuncF = true;
}
else if (bFuncJac == false && pDblNg == NULL)
{
- bOK = deFunctionsManager->setJacFunction(pStr);
+ bOK = deFunctionsManager.setJacFunction(pStr);
bFuncJac = true;
}
else if (bFuncG == false && pDblNg)
{
- bOK = deFunctionsManager->setGFunction(pStr);
+ bOK = deFunctionsManager.setGFunction(pStr);
bFuncG = true;
}
else if (bFuncG && bFuncPsol == false)
{
- bOK = deFunctionsManager->setPsolFunction(pStr);
+ bOK = deFunctionsManager.setPsolFunction(pStr);
bFuncPsol = true;
}
else if (bFuncPsol && bFuncPjac == false)
{
- bOK = deFunctionsManager->setPjacFunction(pStr);
+ bOK = deFunctionsManager.setPjacFunction(pStr);
bFuncPjac = true;
}
else
if (bFuncF == false)
{
bFuncF = true;
- bOK = deFunctionsManager->setFFunction(pStr);
+ bOK = deFunctionsManager.setFFunction(pStr);
}
else if (bFuncJac == false && pDblNg == NULL)
{
bFuncJac = true;
- bOK = deFunctionsManager->setJacFunction(pStr);
+ bOK = deFunctionsManager.setJacFunction(pStr);
}
else if (bFuncG == false && pDblNg)
{
bFuncG = true;
- bOK = deFunctionsManager->setGFunction(pStr);
+ bOK = deFunctionsManager.setGFunction(pStr);
}
else if (bFuncG && bFuncPsol == false)
{
- bOK = deFunctionsManager->setPsolFunction(pStr);
+ bOK = deFunctionsManager.setPsolFunction(pStr);
bFuncPsol = true;
}
else if (bFuncPsol && bFuncPjac == false)
{
- bOK = deFunctionsManager->setPjacFunction(pStr);
+ bOK = deFunctionsManager.setPjacFunction(pStr);
bFuncPjac = true;
}
if (bFuncF == false)
{
bFuncF = true;
- deFunctionsManager->setFFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setFFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setFArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setFArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
else if (bFuncJac == false && pDblNg == NULL)
{
bFuncJac = true;
- deFunctionsManager->setJacFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setJacFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setJacArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setJacArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
else if (bFuncG == false && pDblNg)
{
bFuncG = true;
- deFunctionsManager->setGFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setGFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setGArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setGArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
else if (bFuncG && bFuncPsol == false)
{
bFuncPsol = true;
- deFunctionsManager->setPsolFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setPsolFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setPsolArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setPsolArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
else if (bFuncPsol && bFuncPjac == false)
{
bFuncPjac = true;
- deFunctionsManager->setPjacFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setPjacFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setPjacArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setPjacArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
}
info[5] = 1;
ml = (int)pDblTemp->get(0);
mu = (int)pDblTemp->get(1);
- deFunctionsManager->setMl(ml);
- deFunctionsManager->setMu(mu);
+ deFunctionsManager.setMl(ml);
+ deFunctionsManager.setMu(mu);
}
else if (pDblTemp->getSize() != 0)
{
{
for (int i = 0; i < pDblX0->getRows(); i++)
{
- iwork[LID + i] = pDblE7->get(i);
+ iwork[LID + i] = static_cast<int>(pDblE7->get(i));
}
}
{
for (int i = 0; i < pDblX0->getRows(); i++)
{
- iwork[LID + i] = pDblE12->get(i);
+ iwork[LID + i] = static_cast<int>(pDblE12->get(i));
}
}
}
// get next inputs
- DifferentialEquationFunctions* deFunctionsManager = new DifferentialEquationFunctions(L"dasrt");
- DifferentialEquation::addDifferentialEquationFunctions(deFunctionsManager);
+ DifferentialEquationFunctions deFunctionsManager(L"dasrt");
+ DifferentialEquation::addDifferentialEquationFunctions(&deFunctionsManager);
YSize = (int*)MALLOC(sizeOfYSize * sizeof(int));
*YSize = pDblX0->getRows();
memset(pdYdotData, 0x00, *YSize);
}
- deFunctionsManager->setOdeYRows(pDblX0->getRows());
+ deFunctionsManager.setOdeYRows(pDblX0->getRows());
for (iPos++; iPos < in.size(); iPos++)
{
types::Callable* pCall = in[iPos]->getAs<types::Callable>();
if (bFuncF == false)
{
- deFunctionsManager->setFFunction(pCall);
+ deFunctionsManager.setFFunction(pCall);
bFuncF = true;
}
else if (bFuncJac == false && pDblNg == NULL)
{
- deFunctionsManager->setJacFunction(pCall);
+ deFunctionsManager.setJacFunction(pCall);
bFuncJac = true;
}
else if (bFuncG == false && pDblNg)
{
- deFunctionsManager->setGFunction(pCall);
+ deFunctionsManager.setGFunction(pCall);
bFuncG = true;
}
else
if (bFuncF == false)
{
- bOK = deFunctionsManager->setFFunction(pStr);
+ bOK = deFunctionsManager.setFFunction(pStr);
bFuncF = true;
}
else if (bFuncJac == false && pDblNg == NULL)
{
- bOK = deFunctionsManager->setJacFunction(pStr);
+ bOK = deFunctionsManager.setJacFunction(pStr);
bFuncJac = true;
}
else if (bFuncG == false && pDblNg)
{
- bOK = deFunctionsManager->setGFunction(pStr);
+ bOK = deFunctionsManager.setGFunction(pStr);
bFuncG = true;
}
else
if (bFuncF == false)
{
bFuncF = true;
- bOK = deFunctionsManager->setFFunction(pStr);
+ bOK = deFunctionsManager.setFFunction(pStr);
sizeOfpdYData = *YSize;
}
else if (bFuncJac == false && pDblNg == NULL)
{
bFuncJac = true;
- bOK = deFunctionsManager->setJacFunction(pStr);
+ bOK = deFunctionsManager.setJacFunction(pStr);
if (sizeOfpdYData == 0)
{
sizeOfpdYData = *YSize;
else if (bFuncG == false && pDblNg)
{
bFuncG = true;
- bOK = deFunctionsManager->setGFunction(pStr);
+ bOK = deFunctionsManager.setGFunction(pStr);
if (sizeOfpdYData == 0)
{
sizeOfpdYData = *YSize;
if (bFuncF == false)
{
bFuncF = true;
- deFunctionsManager->setFFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setFFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setFArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setFArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
else if (bFuncJac == false && pDblNg == NULL)
{
bFuncJac = true;
- deFunctionsManager->setJacFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setJacFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setJacArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setJacArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
else if (bFuncG == false && pDblNg)
{
bFuncG = true;
- deFunctionsManager->setGFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setGFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setGArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setGArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
}
info[5] = 1;
ml = (int)pDblTemp->get(0);
mu = (int)pDblTemp->get(1);
- deFunctionsManager->setMl(ml);
- deFunctionsManager->setMu(mu);
+ deFunctionsManager.setMl(ml);
+ deFunctionsManager.setMu(mu);
}
else if (pDblTemp->getSize() != 0)
{
}
// get next inputs
- DifferentialEquationFunctions* deFunctionsManager = new DifferentialEquationFunctions(L"dassl");
- DifferentialEquation::addDifferentialEquationFunctions(deFunctionsManager);
+ DifferentialEquationFunctions deFunctionsManager(L"dassl");
+ DifferentialEquation::addDifferentialEquationFunctions(&deFunctionsManager);
YSize = (int*)MALLOC(sizeOfYSize * sizeof(int));
*YSize = pDblX0->getRows();
memset(pdYdotData, 0x00, *YSize);
}
- deFunctionsManager->setOdeYRows(pDblX0->getRows());
+ deFunctionsManager.setOdeYRows(pDblX0->getRows());
for (iPos++; iPos < in.size(); iPos++)
{
types::Callable* pCall = in[iPos]->getAs<types::Callable>();
if (bFuncF == false)
{
- deFunctionsManager->setFFunction(pCall);
+ deFunctionsManager.setFFunction(pCall);
bFuncF = true;
}
else if (bFuncJac == false)
{
- deFunctionsManager->setJacFunction(pCall);
+ deFunctionsManager.setJacFunction(pCall);
bFuncJac = true;
}
else
if (bFuncF == false)
{
- bOK = deFunctionsManager->setFFunction(pStr);
+ bOK = deFunctionsManager.setFFunction(pStr);
bFuncF = true;
}
else if (bFuncJac == false)
{
- bOK = deFunctionsManager->setJacFunction(pStr);
+ bOK = deFunctionsManager.setJacFunction(pStr);
bFuncJac = true;
}
else
if (bFuncF == false)
{
bFuncF = true;
- bOK = deFunctionsManager->setFFunction(pStr);
+ bOK = deFunctionsManager.setFFunction(pStr);
sizeOfpdYData = *YSize;
}
else if (bFuncJac == false)
{
bFuncJac = true;
- bOK = deFunctionsManager->setJacFunction(pStr);
+ bOK = deFunctionsManager.setJacFunction(pStr);
if (sizeOfpdYData == 0)
{
sizeOfpdYData = *YSize;
if (bFuncF == false)
{
bFuncF = true;
- deFunctionsManager->setFFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setFFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setFArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setFArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
else if (bFuncJac == false)
{
bFuncJac = true;
- deFunctionsManager->setJacFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setJacFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setJacArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setJacArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
}
info[5] = 1;
ml = (int)pDblTemp->get(0);
mu = (int)pDblTemp->get(1);
- deFunctionsManager->setMl(ml);
- deFunctionsManager->setMu(mu);
+ deFunctionsManager.setMl(ml);
+ deFunctionsManager.setMu(mu);
}
else if (pDblTemp->getSize() != 0)
{
}
// function
- DifferentialEquationFunctions* deFunctionsManager = new DifferentialEquationFunctions(L"feval");
- DifferentialEquation::addDifferentialEquationFunctions(deFunctionsManager);
+ DifferentialEquationFunctions deFunctionsManager(L"feval");
+ DifferentialEquation::addDifferentialEquationFunctions(&deFunctionsManager);
if (in[iPos]->isCallable())
{
types::Callable* pCall = in[iPos]->getAs<types::Callable>();
- deFunctionsManager->setFFunction(pCall);
+ deFunctionsManager.setFFunction(pCall);
}
else if (in[iPos]->isString())
{
bool bOK = false;
types::String* pStr = in[iPos]->getAs<types::String>();
- bOK = deFunctionsManager->setFFunction(pStr);
+ bOK = deFunctionsManager.setFFunction(pStr);
if (bOK == false)
{
if (pList->get(0)->isCallable())
{
- deFunctionsManager->setFFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setFFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setFArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setFArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
else
try
{
- deFunctionsManager->execFevalF(&nn, &valX, &valY, res, &itype);
+ deFunctionsManager.execFevalF(&nn, &valX, &valY, res, &itype);
}
catch (ast::ScilabMessage &sm)
{
pDblT = in[iPos]->getAs<types::Double>();
// get next inputs
- DifferentialEquationFunctions* deFunctionsManager = new DifferentialEquationFunctions(L"impl");
- DifferentialEquation::addDifferentialEquationFunctions(deFunctionsManager);
+ DifferentialEquationFunctions deFunctionsManager(L"impl");
+ DifferentialEquation::addDifferentialEquationFunctions(&deFunctionsManager);
YSize = (int*)malloc(sizeOfYSize * sizeof(int));
*YSize = pDblY0->getSize();
types::Callable* pCall = in[iPos]->getAs<types::Callable>();
if (bFuncF == false)
{
- deFunctionsManager->setFFunction(pCall);
+ deFunctionsManager.setFFunction(pCall);
bFuncF = true;
}
else if (bFuncG == false)
{
- deFunctionsManager->setGFunction(pCall);
+ deFunctionsManager.setGFunction(pCall);
bFuncG = true;
}
else if (bFuncJac == false)
{
- deFunctionsManager->setJacFunction(pCall);
+ deFunctionsManager.setJacFunction(pCall);
bFuncJac = true;
}
else
if (bFuncF == false)
{
- bOK = deFunctionsManager->setFFunction(pStr);
+ bOK = deFunctionsManager.setFFunction(pStr);
bFuncF = true;
}
else if (bFuncG == false)
{
- bOK = deFunctionsManager->setGFunction(pStr);
+ bOK = deFunctionsManager.setGFunction(pStr);
bFuncG = true;
}
else if (bFuncJac == false)
{
- bOK = deFunctionsManager->setJacFunction(pStr);
+ bOK = deFunctionsManager.setJacFunction(pStr);
bFuncJac = true;
}
else
if (bFuncF == false)
{
bFuncF = true;
- bOK = deFunctionsManager->setFFunction(pStr);
+ bOK = deFunctionsManager.setFFunction(pStr);
sizeOfpdYData = *YSize;
}
else if (bFuncG == false)
{
bFuncG = true;
- bOK = deFunctionsManager->setGFunction(pStr);
+ bOK = deFunctionsManager.setGFunction(pStr);
if (sizeOfpdYData == 0)
{
sizeOfpdYData = *YSize;
else if (bFuncJac == false)
{
bFuncJac = true;
- bOK = deFunctionsManager->setJacFunction(pStr);
+ bOK = deFunctionsManager.setJacFunction(pStr);
if (sizeOfpdYData == 0)
{
sizeOfpdYData = *YSize;
if (bFuncF == false)
{
bFuncF = true;
- deFunctionsManager->setFFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setFFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setFArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setFArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
else if (bFuncG == false)
{
bFuncG = true;
- deFunctionsManager->setGFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setGFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setGArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setGArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
else if (bFuncJac == false)
{
bFuncJac = true;
- deFunctionsManager->setJacFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setJacFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setJacArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setJacArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
}
// function
- DifferentialEquationFunctions* deFunctionsManager = new DifferentialEquationFunctions(L"int2d");
- DifferentialEquation::addDifferentialEquationFunctions(deFunctionsManager);
+ DifferentialEquationFunctions deFunctionsManager(L"int2d");
+ DifferentialEquation::addDifferentialEquationFunctions(&deFunctionsManager);
if (in[2]->isCallable())
{
types::Callable* pCall = in[2]->getAs<types::Callable>();
- deFunctionsManager->setFFunction(pCall);
+ deFunctionsManager.setFFunction(pCall);
// check function
double x = 1;
{
bool bOK = false;
types::String* pStr = in[2]->getAs<types::String>();
- bOK = deFunctionsManager->setFFunction(pStr);
+ bOK = deFunctionsManager.setFFunction(pStr);
if (bOK == false)
{
if (pList->get(0)->isCallable())
{
- deFunctionsManager->setFFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setFFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setFArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setFArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
else
}
// function
- DifferentialEquationFunctions* deFunctionsManager = new DifferentialEquationFunctions(L"int3d");
- DifferentialEquation::addDifferentialEquationFunctions(deFunctionsManager);
+ DifferentialEquationFunctions deFunctionsManager(L"int3d");
+ DifferentialEquation::addDifferentialEquationFunctions(&deFunctionsManager);
if (in[3]->isCallable())
{
types::Callable* pCall = in[3]->getAs<types::Callable>();
- deFunctionsManager->setFFunction(pCall);
+ deFunctionsManager.setFFunction(pCall);
}
else if (in[3]->isString())
{
bool bOK = false;
types::String* pStr = in[3]->getAs<types::String>();
- bOK = deFunctionsManager->setFFunction(pStr);
+ bOK = deFunctionsManager.setFFunction(pStr);
if (bOK == false)
{
if (pList->get(0)->isCallable())
{
- deFunctionsManager->setFFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setFFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setFArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setFArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
else
}
// function
- DifferentialEquationFunctions* deFunctionsManager = new DifferentialEquationFunctions(L"intg");
- DifferentialEquation::addDifferentialEquationFunctions(deFunctionsManager);
+ DifferentialEquationFunctions deFunctionsManager(L"intg");
+ DifferentialEquation::addDifferentialEquationFunctions(&deFunctionsManager);
if (in[2]->isCallable())
{
types::Callable* pCall = in[2]->getAs<types::Callable>();
- deFunctionsManager->setFFunction(pCall);
+ deFunctionsManager.setFFunction(pCall);
// check function
double t = 1;
{
bool bOK = false;
types::String* pStr = in[2]->getAs<types::String>();
- bOK = deFunctionsManager->setFFunction(pStr);
+ bOK = deFunctionsManager.setFFunction(pStr);
if (bOK == false)
{
if (pList->get(0)->isCallable())
{
- deFunctionsManager->setFFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setFFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setFArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setFArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
else
pDblT = in[iPos]->getAs<types::Double>();
// get next inputs
- DifferentialEquationFunctions* deFunctionsManager = new DifferentialEquationFunctions(L"ode");
- DifferentialEquation::addDifferentialEquationFunctions(deFunctionsManager);
- deFunctionsManager->setOdeYRows(pDblY0->getRows());
- deFunctionsManager->setOdeYCols(pDblY0->getCols());
+ DifferentialEquationFunctions deFunctionsManager(L"ode");
+ DifferentialEquation::addDifferentialEquationFunctions(&deFunctionsManager);
+ deFunctionsManager.setOdeYRows(pDblY0->getRows());
+ deFunctionsManager.setOdeYCols(pDblY0->getCols());
YSize = (int*)MALLOC(sizeOfYSize * sizeof(int));
*YSize = pDblY0->getSize();
types::Callable* pCall = in[iPos]->getAs<types::Callable>();
if (bFuncF == false)
{
- deFunctionsManager->setFFunction(pCall);
+ deFunctionsManager.setFFunction(pCall);
bFuncF = true;
}
else if (bFuncJac == false && (pDblNg == NULL || meth != 3))
{
- deFunctionsManager->setJacFunction(pCall);
+ deFunctionsManager.setJacFunction(pCall);
bFuncJac = true;
}
else if (bFuncG == false && meth == 3)
{
- deFunctionsManager->setGFunction(pCall);
+ deFunctionsManager.setGFunction(pCall);
bFuncG = true;
}
else
if (bFuncF == false)
{
- bOK = deFunctionsManager->setFFunction(pStr);
+ bOK = deFunctionsManager.setFFunction(pStr);
bFuncF = true;
}
else if (bFuncJac == false && (pDblNg == NULL || meth != 3))
{
- bOK = deFunctionsManager->setJacFunction(pStr);
+ bOK = deFunctionsManager.setJacFunction(pStr);
bFuncJac = true;
}
else if (bFuncG == false && meth == 3)
{
- bOK = deFunctionsManager->setGFunction(pStr);
+ bOK = deFunctionsManager.setGFunction(pStr);
bFuncG = true;
}
else
if (bFuncF == false)
{
bFuncF = true;
- bOK = deFunctionsManager->setFFunction(pStr);
+ bOK = deFunctionsManager.setFFunction(pStr);
sizeOfpdYData = *YSize;
}
else if (bFuncJac == false && (pDblNg == NULL || meth != 3))
{
bFuncJac = true;
- bOK = deFunctionsManager->setJacFunction(pStr);
+ bOK = deFunctionsManager.setJacFunction(pStr);
if (sizeOfpdYData == 0)
{
sizeOfpdYData = *YSize;
else if (bFuncG == false && meth == 3)
{
bFuncG = true;
- bOK = deFunctionsManager->setGFunction(pStr);
+ bOK = deFunctionsManager.setGFunction(pStr);
if (sizeOfpdYData == 0)
{
sizeOfpdYData = *YSize;
if (bFuncF == false)
{
bFuncF = true;
- deFunctionsManager->setFFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setFFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setFArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setFArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
else if (bFuncJac == false && (pDblNg == NULL || meth != 3))
{
bFuncJac = true;
- deFunctionsManager->setJacFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setJacFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setJacArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setJacArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
else if (bFuncG == false && meth == 3)
{
bFuncG = true;
- deFunctionsManager->setGFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setGFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setGArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setGArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
}
}
// get next inputs
- DifferentialEquationFunctions* deFunctionsManager = new DifferentialEquationFunctions(L"odedc");
- DifferentialEquation::addDifferentialEquationFunctions(deFunctionsManager);
- deFunctionsManager->setOdedcYDSize((int)pDblNd->get(0));
- deFunctionsManager->setOdeYRows(pDblY0->getRows());
- deFunctionsManager->setOdeYCols(pDblY0->getCols());
+ DifferentialEquationFunctions deFunctionsManager(L"odedc");
+ DifferentialEquation::addDifferentialEquationFunctions(&deFunctionsManager);
+ deFunctionsManager.setOdedcYDSize((int)pDblNd->get(0));
+ deFunctionsManager.setOdeYRows(pDblY0->getRows());
+ deFunctionsManager.setOdeYCols(pDblY0->getCols());
YSize = (int*)MALLOC(sizeOfYSize * sizeof(int));
*YSize = pDblY0->getSize();
types::Callable* pCall = in[iPos]->getAs<types::Callable>();
if (bFuncF == false)
{
- deFunctionsManager->setFFunction(pCall);
+ deFunctionsManager.setFFunction(pCall);
bFuncF = true;
}
else if (bFuncJac == false && (pDblNg == NULL || meth != 3))
{
- deFunctionsManager->setJacFunction(pCall);
+ deFunctionsManager.setJacFunction(pCall);
bFuncJac = true;
}
else if (bFuncG == false && meth == 3)
{
- deFunctionsManager->setGFunction(pCall);
+ deFunctionsManager.setGFunction(pCall);
bFuncG = true;
}
else
if (bFuncF == false)
{
- bOK = deFunctionsManager->setFFunction(pStr);
+ bOK = deFunctionsManager.setFFunction(pStr);
bFuncF = true;
}
else if (bFuncJac == false && (pDblNg == NULL || meth != 3))
{
- bOK = deFunctionsManager->setJacFunction(pStr);
+ bOK = deFunctionsManager.setJacFunction(pStr);
bFuncJac = true;
}
else if (bFuncG == false && meth == 3)
{
- bOK = deFunctionsManager->setGFunction(pStr);
+ bOK = deFunctionsManager.setGFunction(pStr);
bFuncG = true;
}
else
if (bFuncF == false)
{
bFuncF = true;
- bOK = deFunctionsManager->setFFunction(pStr);
+ bOK = deFunctionsManager.setFFunction(pStr);
sizeOfpdYData = *YSize;
}
else if (bFuncJac == false && (pDblNg == NULL || meth != 3))
{
bFuncJac = true;
- bOK = deFunctionsManager->setJacFunction(pStr);
+ bOK = deFunctionsManager.setJacFunction(pStr);
if (sizeOfpdYData == 0)
{
sizeOfpdYData = *YSize;
else if (bFuncG == false && meth == 3)
{
bFuncG = true;
- bOK = deFunctionsManager->setGFunction(pStr);
+ bOK = deFunctionsManager.setGFunction(pStr);
if (sizeOfpdYData == 0)
{
sizeOfpdYData = *YSize;
if (bFuncF == false)
{
bFuncF = true;
- deFunctionsManager->setFFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setFFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setFArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setFArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
else if (bFuncJac == false && (pDblNg == NULL || meth != 3))
{
bFuncJac = true;
- deFunctionsManager->setJacFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setJacFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setJacArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setJacArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
else if (bFuncG == false && meth == 3)
{
bFuncG = true;
- deFunctionsManager->setGFunction(pList->get(0)->getAs<types::Callable>());
+ deFunctionsManager.setGFunction(pList->get(0)->getAs<types::Callable>());
for (int iter = 1; iter < pList->getSize(); iter++)
{
- deFunctionsManager->setGArgs(pList->get(iter)->getAs<types::InternalType>());
+ deFunctionsManager.setGArgs(pList->get(iter)->getAs<types::InternalType>());
}
}
}
if (fabs(tleft - hf) < 1.0e-12) // update discrete part
{
bIntegrateContPart = false;
- deFunctionsManager->setOdedcFlag();
+ deFunctionsManager.setOdedcFlag();
if (pDblOdeOptions && pDblOdeOptions->get(9) == 1)
{
throw ast::ScilabMessage(os.str());
}
- deFunctionsManager->resetOdedcFlag();
+ deFunctionsManager.resetOdedcFlag();
nhpass++;
double* copy = (double*)MALLOC(*YSize * sizeof(double));
if (bUpdate)
{
- deFunctionsManager->setOdedcFlag();
+ deFunctionsManager.setOdedcFlag();
if (pDblOdeOptions && pDblOdeOptions->get(9) == 1)
{
throw ast::ScilabMessage(os.str());
}
- deFunctionsManager->resetOdedcFlag();
+ deFunctionsManager.resetOdedcFlag();
nhpass++;
}
#include "common_structure.h"
#include "dynlib_differential_equations.h"
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
-DifferentialEquationFunctions::DifferentialEquationFunctions(std::wstring callerName)
+DifferentialEquationFunctions::DifferentialEquationFunctions(const std::wstring& callerName)
{
m_odeYRows = 0;
m_odeYCols = 0;
/*--------------------------------------------------------------------------*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
{
SciErr sciErr;
int i;
- int iRet = 0;
+ int iRet = 0;
- int iRows = 0;
- int iCols = 0;
- char **pstData = NULL;
- int* piAddr = NULL;
+ int iRows = 0;
+ int iCols = 0;
+ char **pstData = NULL;
+ int* piAddr = NULL;
- double dblRet = 0;
- int bRet = 0;
+ double dblRet = 0;
+ int bRet = 0;
- int bBoolFlag = 0;
+ int bBoolFlag = 0;
CheckRhs(1, 1);
CheckLhs(1, 1);
}
else
{
+ freeAllocatedMatrixOfString(iRows, iCols, pstData);
sciprint(_("%s: unknown property kind.\n"), fname);
SciError(999);
return 0;
}
+ freeAllocatedMatrixOfString(iRows, iCols, pstData);
+
if (bBoolFlag)
{
iRet = createScalarBoolean(pvApiCtx, Rhs + 1, bRet);
* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
*
*/
-//for Visual Leak Detector
-#ifdef DEBUG_VLD
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
#include <vld.h>
#endif
#include <windows.h>
-//for Visual Leak Detector
-#ifdef DEBUG_VLD
+/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
#include <vld.h>
#endif
-
/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
#include <windows.h>
+/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
-int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
+int WINAPI DllMain(HINSTANCE hInstance, DWORD reason, PVOID pvReserved)
{
switch (reason)
{
*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
FREE(wcsAbsFile);
pStrOut->set(i, wcsResult);
+ FREE(wcsResult);
}
out.push_back(pStrOut);
Scierror(999, _("%s: Wrong type for input argument #%d: A string expected.\n"), "mget", 2);
return Function::Error;
}
+
+ FREE(pstType);
pstType = wide_string_to_UTF8(in[1]->getAs<types::String>()->get(0));
}
{
case 0: // stderr
case 6: // stdout
+ FREE(pstType);
Scierror(999, _("%s: Wrong file descriptor: %d.\n"), "mget", iFile);
return types::Function::Error;
}
// file opened with fortran open function
if (pFile == NULL || pFile->getFileType() == 1)
{
+ FREE(pstType);
Scierror(999, _("%s: Wrong file descriptor: %d.\n"), "mget", iFile);
return types::Function::Error;
}
C2F(mget)(&iFile, pData, &iSize, pstType, &iErr);
-
+ FREE(pstType);
if (iErr > 0)
{
return Function::Error;
/*--------------------------------------------------------------------------*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../bin/libintl.lib")
#pragma comment(lib,"../../bin/libxml2.lib")
#pragma comment(lib,"../../bin/libcurl.lib")
/*--------------------------------------------------------------------------*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
src/cpp/createObjectData.cpp \
src/cpp/pickSurface.cpp \
src/cpp/Texture.cpp \
- src/cpp/NormalGenerator.cpp
+ src/cpp/NormalGenerator.cpp \
+ src/cpp/DllmainGraphic_objects.cpp
GIWS_WRAPPERS = \
src/jni/graphic_objects.giws.xml \
src/cpp/libscigraphic_objects_la-createObjectData.lo \
src/cpp/libscigraphic_objects_la-pickSurface.lo \
src/cpp/libscigraphic_objects_la-Texture.lo \
- src/cpp/libscigraphic_objects_la-NormalGenerator.lo
+ src/cpp/libscigraphic_objects_la-NormalGenerator.lo \
+ src/cpp/libscigraphic_objects_la-DllmainGraphic_objects.lo
am_libscigraphic_objects_la_OBJECTS = $(am__objects_2) \
$(am__objects_3) $(am__objects_4)
libscigraphic_objects_la_OBJECTS = \
src/cpp/createObjectData.cpp \
src/cpp/pickSurface.cpp \
src/cpp/Texture.cpp \
- src/cpp/NormalGenerator.cpp
+ src/cpp/NormalGenerator.cpp \
+ src/cpp/DllmainGraphic_objects.cpp
GIWS_WRAPPERS = \
src/jni/graphic_objects.giws.xml \
src/cpp/$(DEPDIR)/$(am__dirstamp)
src/cpp/libscigraphic_objects_la-NormalGenerator.lo: \
src/cpp/$(am__dirstamp) src/cpp/$(DEPDIR)/$(am__dirstamp)
+src/cpp/libscigraphic_objects_la-DllmainGraphic_objects.lo: \
+ src/cpp/$(am__dirstamp) src/cpp/$(DEPDIR)/$(am__dirstamp)
libscigraphic_objects.la: $(libscigraphic_objects_la_OBJECTS) $(libscigraphic_objects_la_DEPENDENCIES) $(EXTRA_libscigraphic_objects_la_DEPENDENCIES)
$(AM_V_CXXLD)$(libscigraphic_objects_la_LINK) $(am_libscigraphic_objects_la_rpath) $(libscigraphic_objects_la_OBJECTS) $(libscigraphic_objects_la_LIBADD) $(LIBS)
@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscigraphic_objects_la-Data3D.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscigraphic_objects_la-DataLoader.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscigraphic_objects_la-DecompositionUtils.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscigraphic_objects_la-DllmainGraphic_objects.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscigraphic_objects_la-Fac3DColorComputer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscigraphic_objects_la-Fac3DDecomposer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscigraphic_objects_la-FigureList.Plo@am__quote@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphic_objects_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libscigraphic_objects_la-NormalGenerator.lo `test -f 'src/cpp/NormalGenerator.cpp' || echo '$(srcdir)/'`src/cpp/NormalGenerator.cpp
+src/cpp/libscigraphic_objects_la-DllmainGraphic_objects.lo: src/cpp/DllmainGraphic_objects.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphic_objects_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libscigraphic_objects_la-DllmainGraphic_objects.lo -MD -MP -MF src/cpp/$(DEPDIR)/libscigraphic_objects_la-DllmainGraphic_objects.Tpo -c -o src/cpp/libscigraphic_objects_la-DllmainGraphic_objects.lo `test -f 'src/cpp/DllmainGraphic_objects.cpp' || echo '$(srcdir)/'`src/cpp/DllmainGraphic_objects.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libscigraphic_objects_la-DllmainGraphic_objects.Tpo src/cpp/$(DEPDIR)/libscigraphic_objects_la-DllmainGraphic_objects.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/cpp/DllmainGraphic_objects.cpp' object='src/cpp/libscigraphic_objects_la-DllmainGraphic_objects.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphic_objects_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libscigraphic_objects_la-DllmainGraphic_objects.lo `test -f 'src/cpp/DllmainGraphic_objects.cpp' || echo '$(srcdir)/'`src/cpp/DllmainGraphic_objects.cpp
+
mostlyclean-libtool:
-rm -f *.lo
class DataModel
{
private :
- DataModel()
- {
- m_dataMap = new std::map<int, Data3D*>();
- }
+ DataModel() {}
public :
static DataModel *get()
return m_me;
}
+ static void destroy()
+ {
+ if (m_me)
+ {
+ delete m_me;
+ m_me = NULL;
+ }
+ }
public :
/**
* Sets a graphic object property
private :
static DataModel *m_me;
- std::map<int, Data3D*> *m_dataMap;
+ std::map<int, Data3D*> m_dataMap;
};
#endif
<ClCompile Include="..\cpp\CurrentFigure.cpp" />
<ClCompile Include="..\cpp\CurrentObject.cpp" />
<ClCompile Include="..\cpp\CurrentSubwin.cpp" />
+ <ClCompile Include="..\cpp\DllmainGraphic_objects.cpp" />
<ClCompile Include="..\cpp\Fac3DColorComputer.cpp" />
<ClCompile Include="..\cpp\FigureList.cpp" />
<ClCompile Include="..\cpp\FigureModel.cpp" />
<ClCompile Include="..\jni\ObjectData_wrap.c" />
<ClCompile Include="..\jni\PolylineData_wrap.c" />
<ClCompile Include="..\jni\ScilabNativeView_wrap.c" />
- <ClCompile Include="DllmainGraphic_objects.c" />
<ClCompile Include="..\cpp\Fac3DDecomposer.cpp" />
<ClCompile Include="..\cpp\getGraphicObjectProperty.cpp" />
<ClCompile Include="..\cpp\NgonData.cpp" />
<ClCompile Include="..\cpp\deleteGraphicObject.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="DllmainGraphic_objects.c">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="..\cpp\Fac3DDecomposer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\cpp\MeshFecDataDecomposer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\cpp\DllmainGraphic_objects.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\jni\CallGraphicController.hxx">
--- /dev/null
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2010 - DIGITEO - Allan CORNET
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ *
+ */
+
+#include "DataModel.hxx"
+#ifdef _MSC_VER
+#include <windows.h>
+/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+
+extern "C"
+{
+ int WINAPI DllMain(HINSTANCE hInstance, DWORD reason, PVOID pvReserved);
+}
+/*--------------------------------------------------------------------------*/
+#pragma comment(lib,"../../../../bin/libintl.lib")
+/*--------------------------------------------------------------------------*/
+int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
+{
+ switch (reason)
+ {
+ case DLL_PROCESS_ATTACH:
+ break;
+ case DLL_PROCESS_DETACH:
+ DataModel::destroy();
+ break;
+ case DLL_THREAD_ATTACH:
+ break;
+ case DLL_THREAD_DETACH:
+ break;
+ }
+ return 1;
+}
+#else
+__attribute__((constructor)) static void load(void);
+__attribute__((destructor)) static void unload(void);
+
+void load(void)
+{
+}
+
+void unload(void)
+{
+ DataModel::destroy();
+}
+#endif
+/*--------------------------------------------------------------------------*/
+
deleteDataObject(iUID);
- m_pathList.erase(iUID);
+ /*clear userdata object*/
m_userdata.erase(iUID);
+
+ //clear path object
+ __pathList_iterator itPath = m_pathList.find(iUID);
+ if (itPath != m_pathList.end())
+ {
+ delete itPath->second; //destroy PathItem object
+ m_pathList.erase(itPath); //remove entry
+ }
}
void ScilabView::updateObject(int iUID, int iProperty)
int* children = NULL;
getGraphicObjectProperty(iUID, __GO_CHILDREN__, jni_int_vector, (void**)&children);
item->children.assign(children, children + childrenCount);
+ releaseGraphicObjectProperty(__GO_CHILDREN__, children, jni_int_vector, childrenCount);
}
}
break;
void ScilabView::registerToController(void)
{
org_scilab_modules_graphic_objects::CallGraphicController::registerScilabView(getScilabJavaVM());
- m_figureList.get_allocator().allocate(4096);
- m_handleList.get_allocator().allocate(4096);
- m_uidList.get_allocator().allocate(4096);
}
/*
/*
** Allocate static class variable.
*/
-ScilabView::__figureList ScilabView::m_figureList = *new __figureList();
-ScilabView::__handleList ScilabView::m_handleList = *new __handleList();
-ScilabView::__uidList ScilabView::m_uidList = *new __uidList();
+ScilabView::__figureList ScilabView::m_figureList;
+ScilabView::__handleList ScilabView::m_handleList;
+ScilabView::__uidList ScilabView::m_uidList;
long ScilabView::m_topHandleValue = 0;
int ScilabView::m_currentFigure;
int ScilabView::m_currentObject;
int ScilabView::m_currentSubWin;
int ScilabView::m_figureModel;
int ScilabView::m_axesModel;
-ScilabView::__pathList ScilabView::m_pathList = *new __pathList();
-ScilabView::__pathFigList ScilabView::m_pathFigList = *new __pathFigList();
-ScilabView::__userdata ScilabView::m_userdata = *new __userdata();
+ScilabView::__pathList ScilabView::m_pathList;
+ScilabView::__pathFigList ScilabView::m_pathFigList;
+ScilabView::__userdata ScilabView::m_userdata;
int property = 0;
int returnValue = 0;
- dataObject = (*m_dataMap)[iUID];
+ dataObject = m_dataMap[iUID];
if (dataObject == NULL)
{
return FALSE;
Data3D* dataObject = NULL;
int property = 0;
- dataObject = (*m_dataMap)[iUID];
+ dataObject = m_dataMap[iUID];
if (dataObject == NULL)
{
return 0;
}
- (*m_dataMap)[iUID] = newObject;
+ m_dataMap[iUID] = newObject;
return iUID;
}
void DataModel::deleteDataObject(int iUID)
{
- std::map<int, Data3D*>::iterator it = m_dataMap->find(iUID);
- if (it != m_dataMap->end() && it->second != NULL)
+ std::map<int, Data3D*>::iterator it = m_dataMap.find(iUID);
+ if (it != m_dataMap.end() && it->second != NULL)
{
delete it->second;
- m_dataMap->erase(it);
+ m_dataMap.erase(it);
}
- /*Data3D* newObject = (*m_dataMap)[std::string(_pstID)];
+ /*Data3D* newObject = m_dataMap[std::string(_pstID)];
if (newObject != NULL)
{
delete newObject;
}
- m_dataMap->erase(std::string(_pstID));*/
+ m_dataMap.erase(std::string(_pstID));*/
}
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
</ProjectReference>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="..\c\DllmainGraphic_objects.c" />
+ <ClCompile Include="Dllmainnographic_objects.c" />
<ClCompile Include="nographic_objects.c" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="nographic_objects.c">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="..\c\DllmainGraphic_objects.c">
+ <ClCompile Include="Dllmainnographic_objects.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
src/c/getHandleProperty/set_auto_margins_property.c \
src/c/getHandleProperty/get_auto_margins_property.c \
src/c/name2rgb.c \
- src/c/addColor.c
+ src/c/addColor.c \
+ src/c/DllmainGraphics.c
GRAPHICS_CXX_SOURCES = \
src/cpp/configgraphicvariable.cpp \
src/c/getHandleProperty/libscigraphics_algo_la-set_auto_margins_property.lo \
src/c/getHandleProperty/libscigraphics_algo_la-get_auto_margins_property.lo \
src/c/libscigraphics_algo_la-name2rgb.lo \
- src/c/libscigraphics_algo_la-addColor.lo
+ src/c/libscigraphics_algo_la-addColor.lo \
+ src/c/libscigraphics_algo_la-DllmainGraphics.lo
am__objects_2 = \
src/cpp/libscigraphics_algo_la-configgraphicvariable.lo \
src/cpp/libscigraphics_algo_la-set_data_property.lo \
src/c/getHandleProperty/set_auto_margins_property.c \
src/c/getHandleProperty/get_auto_margins_property.c \
src/c/name2rgb.c \
- src/c/addColor.c
+ src/c/addColor.c \
+ src/c/DllmainGraphics.c
GRAPHICS_CXX_SOURCES = \
src/cpp/configgraphicvariable.cpp \
src/c/$(DEPDIR)/$(am__dirstamp)
src/c/libscigraphics_algo_la-addColor.lo: src/c/$(am__dirstamp) \
src/c/$(DEPDIR)/$(am__dirstamp)
+src/c/libscigraphics_algo_la-DllmainGraphics.lo: \
+ src/c/$(am__dirstamp) src/c/$(DEPDIR)/$(am__dirstamp)
src/cpp/$(am__dirstamp):
@$(MKDIR_P) src/cpp
@: > src/cpp/$(am__dirstamp)
@AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscigraphics_algo_la-Contour.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscigraphics_algo_la-DefaultCommandArg.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscigraphics_algo_la-DestroyObjects.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscigraphics_algo_la-DllmainGraphics.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscigraphics_algo_la-DrawObjects.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscigraphics_algo_la-FeC.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscigraphics_algo_la-Format.Plo@am__quote@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/c/libscigraphics_algo_la-addColor.lo `test -f 'src/c/addColor.c' || echo '$(srcdir)/'`src/c/addColor.c
+src/c/libscigraphics_algo_la-DllmainGraphics.lo: src/c/DllmainGraphics.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/c/libscigraphics_algo_la-DllmainGraphics.lo -MD -MP -MF src/c/$(DEPDIR)/libscigraphics_algo_la-DllmainGraphics.Tpo -c -o src/c/libscigraphics_algo_la-DllmainGraphics.lo `test -f 'src/c/DllmainGraphics.c' || echo '$(srcdir)/'`src/c/DllmainGraphics.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/c/$(DEPDIR)/libscigraphics_algo_la-DllmainGraphics.Tpo src/c/$(DEPDIR)/libscigraphics_algo_la-DllmainGraphics.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/c/DllmainGraphics.c' object='src/c/libscigraphics_algo_la-DllmainGraphics.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/c/libscigraphics_algo_la-DllmainGraphics.lo `test -f 'src/c/DllmainGraphics.c' || echo '$(srcdir)/'`src/c/DllmainGraphics.c
+
src/nographics/libscigraphics_disable_la-nographics.lo: src/nographics/nographics.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphics_disable_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/nographics/libscigraphics_disable_la-nographics.lo -MD -MP -MF src/nographics/$(DEPDIR)/libscigraphics_disable_la-nographics.Tpo -c -o src/nographics/libscigraphics_disable_la-nographics.lo `test -f 'src/nographics/nographics.c' || echo '$(srcdir)/'`src/nographics/nographics.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/nographics/$(DEPDIR)/libscigraphics_disable_la-nographics.Tpo src/nographics/$(DEPDIR)/libscigraphics_disable_la-nographics.Plo
int isMatrixOfString = 0;
- char* pstProperty = NULL;
char* pstNewProperty = NULL;
unsigned long hdl;
int iRows2 = 0;
int iCols2 = 0;
void* pvData = NULL;
+ char* pstProperty = NULL;
if (isStringType(pvApiCtx, piAddr1) == 0)
{
sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2);
if (sciErr.iErr)
{
+ freeAllocatedSingleString(pstProperty);
Scierror(999, _("%s: Can not read input argument #%d.\n"), fname, 2);
return 1;
}
sciErr = getVarType(pvApiCtx, piAddr2, &iType2);
if (sciErr.iErr)
{
+ freeAllocatedSingleString(pstProperty);
Scierror(999, _("%s: Can not read input argument #%d.\n"), fname, 2);
return 1;
}
sciErr = getMatrixOfDouble(pvApiCtx, piAddr2, &iRows2, &iCols2, (double**)&pvData);
if (sciErr.iErr)
{
+ freeAllocatedSingleString(pstProperty);
printError(&sciErr, 0);
Scierror(999, _("%s: Wrong type for input argument #%d: Matrix expected.\n"), fname, 2);
return sciErr.iErr;
sciErr = getMatrixOfHandle(pvApiCtx, piAddr2, &iRows2, &iCols2, (long long**)&pvData);
if (sciErr.iErr)
{
+ freeAllocatedSingleString(pstProperty);
printError(&sciErr, 0);
Scierror(999, _("%s: Wrong type for input argument #%d: Matrix of handle expected.\n"), fname, 3);
return 1;
isMatrixOfString = 1;
if (getAllocatedMatrixOfString(pvApiCtx, piAddr2, &iRows2, &iCols2, (char***)&pvData))
{
+ freeAllocatedSingleString(pstProperty);
Scierror(999, _("%s: Wrong size for input argument #%d: A matrix of string expected.\n"), fname, 2);
return 1;
}
{
if (getAllocatedSingleString(pvApiCtx, piAddr2, (char**)&pvData))
{
+ freeAllocatedSingleString(pstProperty);
Scierror(999, _("%s: Wrong size for input argument #%d: A single string expected.\n"), fname, 2);
return 1;
}
}
else
{
+ freeAllocatedSingleString(pstProperty);
Scierror(999, _("%s: Wrong value for input argument #%d: a valid property expected.\n"), fname, 1);
if (iType2 == sci_strings)
{
return 0;
}
+ freeAllocatedSingleString(pstProperty);
AssignOutputVariable(pvApiCtx, 1) = 0;
ReturnArguments(pvApiCtx);
return 0;
int iCols3 = 0;
int iType3 = 0;
void* pvData = NULL;
+ char* pstProperty = NULL;
sciErr = getVarAddressFromPosition(pvApiCtx, iPos, &piAddr2);
if (sciErr.iErr)
sciErr = getVarType(pvApiCtx, piAddr3, &iType3);
if (sciErr.iErr)
{
+ freeAllocatedSingleString(pstProperty);
Scierror(999, _("%s: Can not read input argument #%d.\n"), fname, iPos + 1);
return 1;
}
{
if (isScalar(pvApiCtx, piAddr3) == 0)
{
+ freeAllocatedSingleString(pstProperty);
Scierror(999, _("%s: Wrong size for input argument #%d: A single string expected.\n"), fname, iPos + 1);
return 1;
}
if (getAllocatedSingleString(pvApiCtx, piAddr3, (char**)&pvData))
{
+ freeAllocatedSingleString(pstProperty);
Scierror(999, _("%s: Can not read input argument #%d.\n"), fname, iPos + 1);
return 1;
}
if (sciErr.iErr)
{
+ freeAllocatedSingleString(pstProperty);
Scierror(999, _("%s: Can not read input argument #%d.\n"), fname, iPos + 1);
return 1;
}
freeAllocatedSingleString((char*)pvData);
}
}
- }
- freeAllocatedSingleString(pstProperty);
+ freeAllocatedSingleString(pstProperty);
+ }
AssignOutputVariable(pvApiCtx, 1) = 0;
ReturnArguments(pvApiCtx);
*
*/
+#include "SetHashTable.h"
+#include "GetHashTable.h"
+
+#ifdef _MSC_VER
+/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
/*--------------------------------------------------------------------------*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
case DLL_PROCESS_ATTACH:
break;
case DLL_PROCESS_DETACH:
+ destroyScilabSetHashTable();
+ destroyScilabGetHashTable();
break;
case DLL_THREAD_ATTACH:
break;
}
return 1;
}
+#else
+__attribute__((constructor)) static void load(void);
+__attribute__((destructor)) static void unload(void);
+
+void unload(void)
+{
+ destroyScilabSetHashTable();
+ destroyScilabGetHashTable();
+}
+#endif
/*--------------------------------------------------------------------------*/
}
// ColorMap
setGraphicObjectProperty(iFiguremdlUID, __GO_COLORMAP__, pdblColorMap, jni_double_vector, 3 * m);
+ FREE(pdblColorMap);
// Parent
{
rect[4] = dataBounds[4];
rect[5] = dataBounds[5];
+
+ releaseGraphicObjectProperty(__GO_DATA_BOUNDS__, dataBounds, jni_double_vector, 6);
}
setGraphicObjectProperty(iSubwinUID, __GO_DATA_BOUNDS__, rect, jni_double_vector, 6);
pdblNewColorMap[i * (iColorMapSize + 1) + iColorMapSize] = _pdblNewColor[i];
}
+ releaseGraphicObjectProperty(__GO_COLORMAP__, pdblColorMap, jni_double_vector, iColorMapSize * COLOR_COMPONENT);
setGraphicObjectProperty(_iFig, __GO_COLORMAP__, pdblNewColorMap, jni_double_vector, iNewColorMapSize);
-
+ FREE(pdblNewColorMap);
iColorIndex = iColorMapSize + 1;
}
return iColorIndex;
int iType = -1;
int* piType = &iType;
double* position = NULL;
+ void* ret = NULL;
getGraphicObjectProperty(iObjUID, __GO_TYPE__, jni_int, (void **) &piType);
if (piType == NULL)
return NULL;
}
- return sciReturnRowVector(position, 4);
+ ret = sciReturnRowVector(position, 4);
+ releaseGraphicObjectProperty(__GO_POSITION__, position, jni_double_vector, 4);
+ return ret;
}
/*------------------------------------------------------------------------*/
{
// Already set creating new figure
// but let the set_ function fail if figure already exists
+ freeAllocatedSingleString(pstProName);
continue;
}
sciErr = getVarAddressFromPosition(pvApiCtx, i + 1, &piAddrData);
if (sciErr.iErr)
{
+ freeAllocatedSingleString(pstProName);
Scierror(999, _("%s: Can not read input argument #%d.\n"), fname, i + 1);
return 1;
}
{
if (getAllocatedSingleString(pvApiCtx, piAddrData, (char**)&_pvData))
{
+ freeAllocatedSingleString(pstProName);
Scierror(999, _("%s: Wrong size for input argument #%d: A single string expected.\n"), fname, 3);
return 1;
}
setGraphicObjectProperty(iAxes, __GO_BACKGROUND__, piBackground, jni_int, 1);
}
+ freeAllocatedSingleString(pstProName);
if (iType == sci_strings)
{
//free allacted data
int* piAxesSize = NULL;
getGraphicObjectProperty(getFigureModel(), __GO_AXES_SIZE__, jni_int_vector, (void **)&piAxesSize);
setGraphicObjectProperty(iFig, __GO_AXES_SIZE__, piAxesSize, jni_int_vector, 2);
+ releaseGraphicObjectProperty(__GO_AXES_SIZE__, piAxesSize, jni_int_vector, 2);
}
initBar(iFig, bMenuBar, bToolBar, bInfoBar);
}
}
+ freeAllocatedSingleString(propertyName);
+
if (found == 0)
{
Scierror(999, _("%s: Unknown property: %s for '%s' handles.\n"), fname, propertyName, "Uicontrol");
if (iScroll)
{
freeAllocatedSingleString(styleProperty);
- styleProperty = strdup("framescrollable");
+ styleProperty = os_strdup("framescrollable");
}
propertiesValuesIndices[scrollable_property] = NOT_FOUND;
getGraphicObjectProperty(iUicontrol, __GO_POSITION__, jni_double_vector, (void**) &pdblPosition);
setGraphicObjectProperty(iUicontrol, __GO_POSITION__, pdblPosition, jni_double_vector, 4);
+ releaseGraphicObjectProperty(__GO_POSITION__, pdblPosition, jni_double_vector, 4);
}
if ((nbInputArgument(pvApiCtx) < 2) || (propertiesValuesIndices[visible_property] == NOT_FOUND)) /* Visible property not set */
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
int iNbStrings = 0;
int *piNbStrings = &iNbStrings;
char **pstString = NULL;
+ void* ret = NULL;
getGraphicObjectProperty(iObjUID, __GO_UI_STRING_SIZE__, jni_int, (void **) &piNbStrings);
getGraphicObjectProperty(iObjUID, __GO_UI_STRING_COLNB__, jni_int, (void **) &piNbColStrings);
{
if (iNbStrings == 0 || iNbColStrings == 0)
{
- return sciReturnEmptyMatrix();
+ ret = sciReturnEmptyMatrix();
}
else if (iNbColStrings == 1)
{
- return sciReturnStringMatrix(pstString, 1, iNbStrings);
+ ret = sciReturnStringMatrix(pstString, 1, iNbStrings);
}
else
{
- return sciReturnStringMatrix(pstString, iNbStrings / iNbColStrings, iNbColStrings);
+ ret = sciReturnStringMatrix(pstString, iNbStrings / iNbColStrings, iNbColStrings);
}
+
+ releaseGraphicObjectProperty(__GO_UI_STRING__, pstString, jni_string_vector, iNbStrings);
+ return ret;
}
else
{
int iNbStrings = 0;
int *piNbStrings = &iNbStrings;
char **pstString = NULL;
+ void* ret = NULL;
getGraphicObjectProperty(iObjUID, __GO_UI_TOOLTIPSTRING_SIZE__, jni_int, (void **) &piNbStrings);
getGraphicObjectProperty(iObjUID, __GO_UI_TOOLTIPSTRING__, jni_string_vector, (void **) &pstString);
if (pstString != NULL)
{
- return sciReturnStringMatrix(pstString, 1, iNbStrings);
+ ret = sciReturnStringMatrix(pstString, 1, iNbStrings);
+ releaseGraphicObjectProperty(__GO_UI_TOOLTIPSTRING__, pstString, jni_string_vector, iNbStrings);
+ return ret;
}
else
{
char* units = NULL;
int type = -1;
int *piType = &type;
+ void* ret = NULL;
/* Handle must be a uicontrol */
getGraphicObjectProperty(iObjUID, __GO_TYPE__, jni_int, (void**) &piType);
}
getGraphicObjectProperty(iObjUID, __GO_UI_UNITS__, jni_string, (void**) &units);
- return sciReturnString(units);
+ ret = sciReturnString(units);
+ releaseGraphicObjectProperty(__GO_UI_UNITS__, units, jni_string, 1);
+ return ret;
}
#ifdef _MSC_VER
#include <windows.h>
-
+/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
#pragma comment(lib,"../../../../bin/hdf5dll.lib")
/*--------------------------------------------------------------------------*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
/*--------------------------------------------------------------------------*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
#include "getenvc.h"
#include "PATH_MAX.h"
#include "api_scilab.h"
-#include "getenvc.h"
/*--------------------------------------------------------------------------*/
int sci_getenv(char *fname, void* pvApiCtx)
{
int iflag = 0;
- Rhs = Max(Rhs, 0);
+ int iRhs = nbInputArgument(pvApiCtx);
CheckRhs(1, 2);
CheckLhs(1, 1);
- if (Rhs == 2)
+ if (iRhs == 2)
{
sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddressVarTwo);
if (sciErr.iErr)
{
if (pStVarTwo)
{
- if (createSingleString(pvApiCtx, Rhs + 1, pStVarTwo))
+ if (createSingleString(pvApiCtx, iRhs + 1, pStVarTwo))
{
freeAllocatedSingleString(pStVarOne);
freeAllocatedSingleString(pStVarTwo);
{
freeAllocatedSingleString(pStVarOne);
freeAllocatedSingleString(pStVarTwo);
- LhsVar(1) = Rhs + 1;
- PutLhsVar();
+ LhsVar(1) = iRhs + 1;
+ ReturnArguments(pvApiCtx);
return 0;
}
}
freeAllocatedSingleString(pStVarOne);
//create variable on stack and return it.
- if (createSingleString(pvApiCtx, Rhs + 1, env_value))
+ if (createSingleString(pvApiCtx, iRhs + 1, env_value))
{
FREE(env_value);
printError(&sciErr, 0);
}
FREE(env_value);
- LhsVar(1) = Rhs + 1;
- PutLhsVar();
+ AssignOutputVariable(pvApiCtx, 1) = iRhs + 1;
+ ReturnArguments(pvApiCtx);
return 0;
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
sciprint(_("Undefined environment variable %s.\n"), var);
}
+ FREE(wbuf);
FREE(wvar);
*ierr = 1;
return;
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
/*--------------------------------------------------------------------------*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../bin/libxml2.lib")
#pragma comment(lib,"../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
}
}
nOptions = 0;
+ FREE(jvm_options);
+ jvm_options = NULL;
}
}
{
fprintf(stderr, "%d: %s\n", j, vm_args.options[j].optionString);
}
+
+ freeJavaVMOption();
}
return FALSE;
}
freeJavaVMOption();
return FALSE;
}
- else
- {
- return TRUE;
- }
+
+ freeJavaVMOption();
+ return TRUE;
}
/*--------------------------------------------------------------------------*/
BOOL finishJVM(void)
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
#pragma comment(lib,"../../../../bin/blasplus.lib")
#pragma comment(lib,"../../../../bin/lapack.lib")
pWork = allocWorkspace(ws, 0, &worksize);
pRightVectors = (lhs == 2 ? (double*)MALLOC(iCols * iCols * sizeof(double)) : NULL );
iEigen1R(pData, iCols, pEigenValuesReal, pEigenValuesImg, pRightVectors, pWork, worksize);
+ FREE(pWork);
if (lhs == 2)
{
assembleEigenvectorsSourceToTarget(iCols, pEigenValuesImg,
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
/*--------------------------------------------------------------------------*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../bin/libintl.lib")
#pragma comment(lib,"../../bin/libmatio.lib")
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../bin/libintl.lib")
#pragma comment(lib,"../../bin/blasplus.lib")
//MS MPI
#pragma comment(lib,"../../libs/mpi/lib/msmpi.lib")
-
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
{
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
#pragma comment(lib,"../../../../bin/blasplus.lib")
#pragma comment(lib,"../../../../bin/lapack.lib")
*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
#ifdef __INTEL_COMPILER
#pragma comment(lib,"libiomp5md.lib")
/*--------------------------------------------------------------------------*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
memset(pdblOutReal, 0x00, pDblOut->getSize() * sizeof(double));
C2F(dset)(&iSizeM1, &dblOne, &pdblOutReal[iSize], &iSizeP1);
C2F(dcopy)(&iSize, pdblTempReal, &iOne, pdblOutReal, &iOne);
+ delete[] pdblTempReal;
if (bComplex)
{
#include <windows.h>
#include "machine.h"
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
/* COMMON used by fortran */
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
#pragma comment(lib, "../../../../bin/libxml2.lib")
/*--------------------------------------------------------------------------*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
/*--------------------------------------------------------------------------*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
{
switch (reason)
/*--------------------------------------------------------------------------*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
{
switch (reason)
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
#include <windows.h>
#include "machine.h" /* C2F */
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
/* defines & exports fortran COMMON in C */
/*--------------------------------------------------------------------------*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
*/
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
if (iTotalLen == 0)
{
+ for (int i = 0; i < iSize; ++i)
+ {
+ if (pst[i])
+ {
+ FREE(pst[i]);
+ }
+ }
+
delete[] pst;
delete[] pstLen;
return Double::Empty();
//transform character value as double.
pdbl[index] = (unsigned char)pst[i][j];
}
+ FREE(pst[i]);
}
delete[] pstLen;
code_error_grep = GREP_OLD(&grepresults, pStr1, pS1->getSize(), pStr2, pS2->getSize());
}
+ for (int i = 0; i < pS1->getSize(); i++)
+ {
+ FREE(pStr1[i]);
+ }
+ FREE(pStr1);
+
+ for (int i = 0; i < pS2->getSize(); i++)
+ {
+ FREE(pStr2[i]);
+ }
+ FREE(pStr2);
+
switch (code_error_grep)
{
case GREP_OK :
case MEMORY_ALLOC_ERROR :
Scierror(999, _("%s: No more memory.\n"), "grep");
- //no break, to free reserved memory.
+ //no break, to free reserved memory.
case GREP_ERROR :
{
if (grepresults.values)
break;
}
- for (int i = 0 ; i < pS1->getSize() ; i++)
- {
- FREE(pStr1[i]);
- }
- FREE(pStr1);
-
- for (int i = 0 ; i < pS2->getSize() ; i++)
- {
- FREE(pStr2[i]);
- }
- FREE(pStr2);
-
return Function::OK;
}
//Function::ReturnValue sci_grep(typed_list &in, int _iRetCount, typed_list &out)
pBOut = new types::Bool(1, iResultSize);
pBOut->set(pbResult);
+ FREE(pbResult);
out.push_back(pBOut);
return types::Function::OK;
pBOut = new types::Bool(1, iResultSize);
pBOut->set(pbResult);
+ FREE(pbResult);
out.push_back(pBOut);
}
else if (in[0]->isDouble())
pBOut = new types::Bool(1, pIn->getSize());
pBOut->set(pbResult);
+ FREE(pbResult);
out.push_back(pBOut);
}
else
pBOut = new types::Bool(1, iResultSize);
pBOut->set(pbResult);
+ FREE(pbResult);
out.push_back(pBOut);
return types::Function::OK;
out.push_back(types::Double::Empty());
}
+ if (values)
+ {
+ FREE(values);
+ }
return types::Function::OK;
}
pcre_error("regexp", iPcreStatus);
delete[] piStart;
delete[] piEnd;
+ for (int i = 0; i < iOccurs; i++)
+ {
+ freeArrayOfWideString(pwstCapturedString[i], piCapturedStringCount[i]);
+ }
+
+ FREE(pwstCapturedString);
+ FREE(piCapturedStringCount);
return Function::Error;
}
}
out.push_back(new String(L""));
}
+ FREE(pwstCapturedString);
+ FREE(piCapturedStringCount);
delete[] piStart;
delete[] piEnd;
return Function::OK;
}
out.push_back(pS);
- for (int i = 0 ; i < iOccurs ; i++)
- {
- freeArrayOfWideString(pwstCapturedString[i], piCapturedStringCount[i]);
- }
+ }
- FREE(pwstCapturedString);
- FREE(piCapturedStringCount);
+ for (int i = 0; i < iOccurs; i++)
+ {
+ freeArrayOfWideString(pwstCapturedString[i], piCapturedStringCount[i]);
}
+ FREE(pwstCapturedString);
+ FREE(piCapturedStringCount);
delete[] piStart;
delete[] piEnd;
return Function::OK;
wcscat(pwstOut + iOffset, pS->get(j, i));
}
pOut->set(0, i, pwstOut);
+ FREE(pwstOut);
}
break;
}
wcscat(pwstOut + iOffset, pS->get(i, j));
}
pOut->set(i, 0, pwstOut);
+ FREE(pwstOut);
}
break;
}
}
-
out.push_back(pOut);
return Function::OK;
- // CheckRhs(1,3);
- // CheckLhs(1,1);
- //
- // switch (Rhs)
- // {
- // case 3:
- // {
- // sci_strcat_three_rhs(fname);
- // }
- // break;
- // case 2:
- // {
- // sci_strcat_two_rhs(fname);
- // }
- // break;
- // case 1:
- // {
- // sci_strcat_one_rhs(fname);
- // }
- // break;
- // default:
- // /* nothing */
- // break;
- // }
- // return 0;
- //}
- ///*-------------------------------------------------------------------------------------*/
- //static int sci_strcat_three_rhs(char *fname)
- //{
- // int Row_One = 0,Col_One = 0;
- // char **Input_String_One = NULL;
- // int mn = 0;
- // static char def_sep[] = "";
- // char *Input_String_Two = def_sep;
- // char typ = 0;
- // int i = 0;
- //
- // if (VarType(1) != sci_strings)
- // {
- // Scierror(999,_("%s: Wrong type for input argument #%d: a string vector expected.\n"),fname,1);
- // return 0;
- // }
- //
- // if (VarType(2) != sci_strings)
- // {
- // Scierror(999,"%s : Wrong size for input argument #%d: Single string expected.\n",fname,2);
- // return 0;
- // }
- //
- // if (VarType(3) != sci_strings)
- // {
- // Scierror(999,"%s : Wrong size for input argument #%d: Single string expected.\n",fname,3);
- // return 0;
- // }
- //
- // GetRhsVar(1,MATRIX_OF_STRING_DATATYPE,&Row_One,&Col_One,&Input_String_One);
- // mn = Row_One * Col_One;
- //
- // if (Rhs >= 2)
- // {
- // /* second argument always a string and not a matrix of string */
- // int l2 = 0;
- // int Row_Two = 0,Col_Two = 0;
- // GetRhsVar(2, STRING_DATATYPE, &Row_Two, &Col_Two, &l2);
- // Input_String_Two = cstk(l2);
- // }
- //
- // if (Rhs >= 3)
- // {
- // int Row_Three = 0, Col_Three = 0;
- // int l3 = 0;
- // GetRhsVar(3, STRING_DATATYPE, &Row_Three, &Col_Three, &l3);
- // if (Row_Three * Col_Three != 0) typ = cstk(l3)[0];
- // if (typ != COL && typ != ROW )
- // {
- // freeArrayOfString(Input_String_One,mn);
- // Scierror(999,_("%s: Wrong type for input argument #%d: ''%s'' or ''%s'' expected.\n"),fname,3,"c","r");
- // return 0;
- // }
- // }
- //
- // switch ( typ )
- // {
- // case STAR :
- // {
- // int nchars = 0;
- // int one = 1;
- // int l3 = 0;
- // int k = 0;
- //
- // /* just return one string */
- // for ( i = 0 ; i < mn ; i++ ) nchars += (int)strlen(Input_String_One[i]);
- // nchars += (mn-1)*(int)strlen(Input_String_Two);
- //
- // CreateVar(Rhs+1,STRING_DATATYPE,&one,&nchars,&l3);
- //
- // for ( i = 0 ; i < mn ; i++ )
- // {
- // int j = 0;
- // for ( j =0 ; j < (int)strlen(Input_String_One[i]) ; j++ ) *cstk(l3+ k++) = Input_String_One[i][j];
- // if ( i != mn-1) for ( j =0 ; j < (int)strlen(Input_String_Two) ; j++ ) *cstk(l3+ k++) = Input_String_Two[j];
- // }
- // freeArrayOfString(Input_String_One,mn);
- // LhsVar(1) = Rhs+1 ;
- // }
- // break;
- // case COL:
- // {
- // char **Output_String = NULL;
- // int nchars = 0;
- // int one = 1;
- // /* return a column matrix */
- // if ( (Output_String = (char**)MALLOC((Row_One+1)*sizeof(char *)))==NULL)
- // {
- // freeArrayOfString(Input_String_One,mn);
- // Scierror(999,_("%s: No more memory.\n"),fname);
- // return 0;
- // }
- // Output_String[Row_One]=NULL;
- // for (i= 0 ; i < Row_One ; i++)
- // {
- // int j = 0;
- // /* length of row i */
- // nchars = 0;
- // for ( j = 0 ; j < Col_One ; j++ ) nchars += (int)strlen(Input_String_One[i+ Row_One*j]);
- // nchars += (Col_One-1)*(int)strlen(Input_String_Two);
- //
- // Output_String[i]=(char*)MALLOC((nchars+1)*sizeof(char));
- // if ( Output_String[i] == NULL)
- // {
- // freeArrayOfString(Output_String,i);
- // freeArrayOfString(Input_String_One,mn);
- // Scierror(999,_("%s: No more memory.\n"),fname);
- // return 0;
- // }
- // /* fill the string */
- // strcpy(Output_String[i],Input_String_One[i]);
- //
- // for ( j = 1 ; j < Col_One ; j++ )
- // {
- // strcat(Output_String[i],Input_String_Two);
- // strcat(Output_String[i],Input_String_One[i+ Row_One*j]);
- // }
- // }
- //
- // CreateVarFromPtr(Rhs+1,MATRIX_OF_STRING_DATATYPE, &Row_One, &one, Output_String);
- // freeArrayOfString(Input_String_One,mn);
- // freeArrayOfString(Output_String,Row_One+1);
- // LhsVar(1) = Rhs+1 ;
- // }
- // break;
- //
- // case ROW:
- // {
- // int nchars = 0;
- // int j = 0;
- // int one = 1;
- // char **Output_String = (char **)CALLOC(Col_One, sizeof(char*));
- //
- // /* return a row matrix */
- // if (Output_String == NULL)
- // {
- // freeArrayOfString(Input_String_One, mn);
- // Scierror(999,_("%s: No more memory.\n"), fname);
- // return 0;
- // }
- //
- // for (j = 0 ; j < Col_One ; j++)
- // {
- // Output_String[j] = os_strdup(Input_String_One[j*Row_One]);
- //
- // if ( Output_String[j] == NULL)
- // {
- // freeArrayOfString(Output_String,j);
- // freeArrayOfString(Input_String_One, mn);
- // Scierror(999,_("%s: No more memory.\n"), fname);
- // return 0;
- // }
- //
- // for ( i = 1 ; i < Row_One ; i++ )
- // {
- // int lenOutput = 0;
- // int lenInput = 0;
- // int lenNew = 0;
- //
- // if (Input_String_Two)
- // {
- // lenOutput = (int)strlen(Output_String[j]);
- // lenInput = (int)strlen(Input_String_Two);
- // lenNew = lenOutput + lenInput + 1;
- //
- // Output_String[j] = (char*)REALLOC(Output_String[j], sizeof(char*) * lenNew);
- // if (Output_String[j] == NULL)
- // {
- // freeArrayOfString(Output_String,j);
- // freeArrayOfString(Input_String_One, mn);
- // Scierror(999,_("%s: No more memory.\n"), fname);
- // return 0;
- // }
- // strcat(Output_String[j], Input_String_Two);
- // }
- //
- // if (Input_String_One[i+ Row_One*j])
- // {
- // lenOutput = (int)strlen(Output_String[j]);
- // lenInput = (int)strlen(Input_String_One[i+ Row_One*j]);
- // lenNew = lenOutput + lenInput + 1;
- //
- // Output_String[j] = (char*)REALLOC(Output_String[j], sizeof(char*) * lenNew);
- // if (Output_String[j] == NULL)
- // {
- // freeArrayOfString(Output_String,j);
- // freeArrayOfString(Input_String_One, mn);
- // Scierror(999,_("%s: No more memory.\n"), fname);
- // return 0;
- // }
- // strcat(Output_String[j], Input_String_One[i+ Row_One*j]);
- // }
- // }
- // }
- //
- // CreateVarFromPtr(Rhs+1,MATRIX_OF_STRING_DATATYPE, &one, &Col_One, Output_String);
- // freeArrayOfString(Input_String_One, mn);
- // if (Col_One == 1)
- // {
- // FREE(Output_String);
- // Output_String = NULL;
- // }
- // else
- // {
- // freeArrayOfString(Output_String, Col_One);
- // }
- // LhsVar(1) = Rhs+1 ;
- // }
- // break;
- //
- // default:
- // {
- // freeArrayOfString(Input_String_One,mn);
- // Scierror(999,_("%s: Wrong value for input argument #%d: ''%s'' or ''%s'' expected.\n"),fname,3,"c","r");
- // return 0;
- // }
- // break;
- //
- // }
- // C2F(putlhsvar)();
- // return 0;
- //}
- ///*-------------------------------------------------------------------------------------*/
- //static int sci_strcat_two_rhs(char *fname)
- //{
- // int Type_One = VarType(1);
- // int Type_Two = VarType(2);
- //
- // int Number_Inputs_Two = 0;
- // char **Input_String_Two = NULL;
- //
- // if (Type_Two != sci_strings)
- // {
- // Scierror(246,_("%s: Wrong type for input argument #%d: Single string expected.\n"),fname,2);
- // return 0;
- // }
- // else /* sci_strings */
- // {
- // int Row_Two = 0,Col_Two = 0;
- //
- // GetRhsVar(2,MATRIX_OF_STRING_DATATYPE,&Row_Two,&Col_Two,&Input_String_Two);
- // Number_Inputs_Two = Row_Two * Col_Two;
- // /* check we have only a string as second parameter */
- // if (Number_Inputs_Two != 1)
- // {
- // freeArrayOfString(Input_String_Two,Number_Inputs_Two);
- // Scierror(36,"%s : Wrong size for input argument #%d: Single string expected.\n",fname,2);
- // return 0;
- // }
- // }
- //
- // if ( (Type_One != sci_strings) && (Type_One != sci_matrix) )
- // {
- // freeArrayOfString(Input_String_Two,Number_Inputs_Two);
- // Scierror(246,"%s: Wrong type for input argument #%d: Matrix of strings expected.\n",fname,1);
- // return 0;
- // }
- // else
- // {
- // if (Type_One == sci_matrix)
- // {
- // freeArrayOfString(Input_String_Two,Number_Inputs_Two);
- // sci_strcat_rhs_one_is_a_matrix(fname);
- // }
- // else /* sci_strings */
- // {
- // char **Input_String_One = NULL;
- // int Row_One = 0,Col_One = 0;
- // int Number_Inputs_One = 0;
- // int length_output = 0;
- //
- // GetRhsVar(1,MATRIX_OF_STRING_DATATYPE,&Row_One,&Col_One,&Input_String_One);
- // Number_Inputs_One = Row_One * Col_One;
- //
- // if (Input_String_One)
- // {
- // if ( (Number_Inputs_One == 1) && (strcmp(Input_String_One[0],"")==0) )
- // {
- // /* With no input argument returns a zero length character string */
- // int m1 = 0, n1 = 0, l1 = 0;
- //
- // CreateVar(Rhs+1,STRING_DATATYPE, &m1, &n1, &l1);
- // LhsVar(1)=Rhs+1;
- // C2F(putlhsvar)();
- //
- // freeArrayOfString(Input_String_Two,Number_Inputs_Two);
- // freeArrayOfString(Input_String_One,Number_Inputs_One);
- // return 0;
- // }
- // else
- // {
- // if (Number_Inputs_One == 1)
- // {
- // length_output = (int)strlen(Input_String_One[0]);
- // }
- // else
- // {
- // int lengthInput_String_Two = (int)strlen(Input_String_Two[0]);
- // length_output = sumlengthstring(1) + (int)(Number_Inputs_One)*lengthInput_String_Two - lengthInput_String_Two;
- // }
- // }
- // }
- //
- // if (length_output > 0)
- // {
- // static int n1 = 0, m1 = 0;
- // int outIndex = 0 ;
- // char *Output_String = NULL;
- // int i = 0;
- // int Number_Inputs_OneLessOne = Number_Inputs_One - 1;
- //
- // m1 = length_output;
- // n1 = 1;
- //
- // CreateVar( Rhs+1,STRING_DATATYPE,&m1,&n1,&outIndex);
- // Output_String = cstk(outIndex);
- //
- // /* strcpy + strcat faster than sprintf */
- // strcpy(Output_String,Input_String_One[0]);
- // ( 0 < Number_Inputs_OneLessOne )? strcat(Output_String,Input_String_Two[0]):0;
- //
- // for (i = 1; i < Number_Inputs_One; i++)
- // {
- // strcat(Output_String,Input_String_One[i]);
- // ( i < Number_Inputs_OneLessOne )? strcat(Output_String,Input_String_Two[0]):0;
- // }
- //
- // LhsVar(1) = Rhs+1;
- // C2F(putlhsvar)();
- // freeArrayOfString(Input_String_One,Row_One*Col_One);
- // freeArrayOfString(Input_String_Two,Number_Inputs_Two);
- // }
- // else
- // {
- // if (length_output == 0)
- // {
- // int one = 1 ;
- // int len = (int)strlen(EMPTY_CHAR);
- // int outIndex = 0 ;
- //
- // CreateVar(Rhs+1,STRING_DATATYPE,&len,&one,&outIndex);
- // strcpy(cstk(outIndex),EMPTY_CHAR);
- // LhsVar(1) = Rhs+1 ;
- // C2F(putlhsvar)();
- //
- // freeArrayOfString(Input_String_Two,Number_Inputs_Two);
- // freeArrayOfString(Input_String_One,Number_Inputs_One);
- // }
- // else
- // {
- // freeArrayOfString(Input_String_Two,Number_Inputs_Two);
- // freeArrayOfString(Input_String_One,Number_Inputs_One);
- // Scierror(999,_("%s : Wrong size for input argument(s).\n"),fname);
- // }
- // }
- // }
- // }
- // return 0;
- //}
- ///*-------------------------------------------------------------------------------------*/
- //static int sci_strcat_one_rhs(char *fname)
- //{
- // int Type_One = VarType(1);
- // if ( (Type_One != sci_strings) && (Type_One != sci_matrix) )
- // {
- // Scierror(246,"%s: Wrong type for input argument #%d: Matrix of strings expected.\n",fname,1);
- // return 0;
- // }
- // else
- // {
- // if (Type_One == sci_strings)
- // {
- // int lenstrcat = sumlengthstring(1);
- //
- // if (lenstrcat >= 0)
- // {
- // char **Input_String_One = NULL;
- // int m = 0, n = 0; /* matrix size */
- // int mn = 0; /* m*n */
- // int n1 = 1, m1 = lenstrcat;
- // int outIndex = 0 ;
- //
- // char *Output_String = NULL;
- // int i = 0;
- //
- // int sizeLengths = 0;
- // int *lengths = lengthEachString(1, &sizeLengths);
- //
- // int l = 0;
- //
- // if (lengths == NULL)
- // {
- // Scierror(999,_("%s: error.\n"),fname);
- // return 0;
- // }
- //
- // GetRhsVar(1,MATRIX_OF_STRING_DATATYPE,&m,&n,&Input_String_One);
- // mn = m * n;
- //
- // CreateVar( Rhs+1,STRING_DATATYPE,&m1,&n1,&outIndex);
- // Output_String = cstk(outIndex);
- //
- // l = 0;
- // for (i = 0; i < mn; i++)
- // {
- // /* bug 4728 Compatibility with Scilab 4.1.2 */
- // /* replaces strcpy & strcat by memcpy */
- // /* copy of char array and not string */
- // if ( i == 0)
- // {
- // memcpy(Output_String,Input_String_One[i], lengths[i]);
- // }
- // else
- // {
- // memcpy(Output_String + l, Input_String_One[i], lengths[i]);
- // }
- // l = l + lengths[i];
- // }
- //
- // FREE(lengths); lengths = NULL;
- //
- // LhsVar(1) = Rhs+1;
- // C2F(putlhsvar)();
- // if (Input_String_One) freeArrayOfString(Input_String_One,mn);
- // }
- // else
- // {
- // Scierror(999,_("%s: Wrong size for input argument(s).\n"),fname);
- // }
- // }
- // else /* sci_matrix*/
- // {
- // sci_strcat_rhs_one_is_a_matrix(fname);
- // }
- // }
- // return 0;
- //}
- ///*-------------------------------------------------------------------------------------*/
- //static int sci_strcat_rhs_one_is_a_matrix(char *fname)
- //{
- // /* strcat([],'A') returns a empty string matrix */
- // double *Input_String_One = NULL;
- // int Row_One = 0,Col_One = 0;
- //
- // GetRhsVar(1,MATRIX_OF_DOUBLE_DATATYPE,&Row_One,&Col_One,&Input_String_One);
- //
- // /* check that we have [] */
- // if ((Row_One == 0) && (Col_One == 0))
- // {
- // int one = 1 ;
- // int len = (int)strlen(EMPTY_CHAR);
- // int outIndex = 0 ;
- //
- // CreateVar(Rhs+1,STRING_DATATYPE,&len,&one,&outIndex);
- // strcpy(cstk(outIndex),EMPTY_CHAR);
- // LhsVar(1) = Rhs+1 ;
- // C2F(putlhsvar)();
- // }
- // else
- // {
- // Scierror(999,_("%s: Wrong type for input argument #%d: Matrix of strings or empty real matrix expected.\n"),fname,1);
- // }
- // return 0;
- //}
- ///*-------------------------------------------------------------------------------------*/
- //static int sumlengthstring(int rhspos)
- //{
- // int sizelengths = 0;
- // int sumlength = -1; /* error */
- // int *lengths = lengthEachString(rhspos, &sizelengths);
- // int i = 0;
- // if (lengths)
- // {
- // sumlength = 0;
- // for(i = 0;i < sizelengths; i++)
- // {
- // sumlength = sumlength + lengths[i];
- // }
- // FREE(lengths); lengths = NULL;
- // }
- //
- // return sumlength;
- //}
- ///*-------------------------------------------------------------------------------------*/
- //static int *lengthEachString(int rhspos, int *sizeArrayReturned)
- //{
- // int *StringsLength = NULL;
- //
- // if (VarType(rhspos) == sci_strings)
- // {
- // int m = 0, n = 0; /* matrix size */
- // int mn = 0; /* m*n */
- //
- // int il = 0; int ilrd = 0;
- // int l1 = 0;
- //
- // int x = 0;
- //
- // int lw = rhspos + Top - Rhs;
- // int lenstrcat = 0;
- //
- // l1 = *Lstk(lw);
- // il = iadr(l1);
- //
- // if (*istk(il ) < 0) il = iadr(*istk(il + 1));
- //
- // /* get dimensions */
- // m = getNumberOfLines(il); /* row */
- // n = getNumberOfColumns(il); /* col */
- // mn = m * n ;
- // ilrd = il + 4;
- //
- // StringsLength = (int*)MALLOC(sizeof(int) * mn);
- // if (StringsLength == NULL) return NULL;
- //
- // *sizeArrayReturned = mn;
- //
- // for ( x = 0; x < mn; x++ )
- // {
- // StringsLength[x]= (int) (*istk(ilrd + x + 1) - *istk(ilrd + x));
- // }
- // }
- // return StringsLength;
}
/*-------------------------------------------------------------------------------------*/
{
pOutDouble = new types::Double(pString1->getDims(), pString1->getDimsArray());
pOutDouble->setInt(values);
+ FREE(values);
}
else
{
#include "Scierror.h"
#include "localization.h"
#include "strsplit.h"
+#include "freeArrayOfString.h"
}
types::Function::ReturnValue sci_strsplit(types::typed_list &in, int _iRetCount, types::typed_list &out)
types::String* pStrOut = new types::String(pDbl->getSize() + 1, 1);
pStrOut->set(results);
- for (int i = 0; i < pStrIn->getSize(); i++)
- {
- FREE(results[i]);
- results[i] = NULL;
- }
- FREE(results);
- results = NULL;
-
+ freeArrayOfWideString(results, pDbl->getSize() + 1);
out.push_back(pStrOut);
return types::Function::OK;
}
break;
case STRSPLIT_INCORRECT_VALUE_ERROR:
{
+ freeArrayOfWideString(results, pDbl->getSize() + 1);
Scierror(999, _("%s: Wrong value for input argument #%d.\n"), "strsplit", 2);
return types::Function::Error;
}
break;
case STRSPLIT_INCORRECT_ORDER_ERROR:
{
+ freeArrayOfWideString(results, pDbl->getSize() + 1);
Scierror(999, _("%s: Elements of %dth argument must be in increasing order.\n"), "strsplit", 2);
return types::Function::Error;
}
break;
case STRSPLIT_MEMORY_ALLOCATION_ERROR:
{
+ freeArrayOfWideString(results, pDbl->getSize() + 1);
Scierror(999, _("%s: Memory allocation error.\n"), "strsplit");
return types::Function::Error;
}
break;
default:
{
+ freeArrayOfWideString(results, pDbl->getSize() + 1);
Scierror(999, _("%s: error.\n"), "strsplit");
return types::Function::Error;
}
*
*/
-//for Visual Leak Detector
-#ifdef DEBUG_VLD
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
#include <vld.h>
#endif
*
*/
-//for Visual Leak Detector
-#ifdef DEBUG_VLD
-#include <vld.h>
-#endif
-
-
/*--------------------------------------------------------------------------*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/pcre.lib")
#pragma comment(lib,"../../../../bin/pcreposix.lib")
#pragma comment(lib,"../../../../bin/libintl.lib")
freeArrayOfString(pstCaptured, *_piCapturedStringCount);
}
}
+
+ FREE(pstInput);
+ FREE(pstPattern);
return iPcreStatus;
}
/*-------------------------------------------------------------------------------*/
*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
#include <windows.h>
#include "tcl.h"
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
#if defined(TCL_MAJOR_VERSION) && defined(TCL_MAJOR_VERSION)
/*--------------------------------------------------------------------------*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
/*--------------------------------------------------------------------------*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libumfpack.lib")
#pragma comment(lib,"../../../../bin/blasplus.lib")
#pragma comment(lib,"../../../../bin/lapack.lib")
/*--------------------------------------------------------------------------*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
/*--------------------------------------------------------------------------*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/
int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved)
/*--------------------------------------------------------------------------*/
#include <windows.h>
/*--------------------------------------------------------------------------*/
+//for Visual Leak Detector in debug compilation mode
+#if defined(DEBUG_VLD) && defined(_DEBUG)
+#include <vld.h>
+#endif
+/*--------------------------------------------------------------------------*/
#pragma comment(lib,"../../bin/libxml2.lib")
#pragma comment(lib,"../../bin/libintl.lib")
/*--------------------------------------------------------------------------*/