Esempio n. 1
0
double GetSymbolFromDll(const int chair, const char* name, bool& iserr)
{
	int			e = SUCCESS, stopchar = 0;
	double		res = 0.;
	CString		str = "";
	tpi_type	tpi;
	bool		result = false;
	CGrammar	gram;

	str.Format("%s", name);

	result = gram.ParseString(&str, (const SFormula *) p_formula, &tpi, &stopchar);

	if (result)
	{
		e = SUCCESS;
		res = gram.EvaluateTree(p_formula, tpi, NULL, &e);
	}
	else
	{
		res = 0;
		e = ERR_INVALID_FUNC_SYM;
	}

	if (e == SUCCESS)
		iserr = false;

	else
		iserr = true;

	return res;
}
Esempio n. 2
0
extern "C" __declspec(dllexport) double __stdcall GetSymbolFromDll(const int chair, const char* name, bool& iserr)
{
    int			e = SUCCESS, stopchar = 0;
    double		res = 0.;
    CString		str = "";
    tpi_type	tpi;
    bool		result = false;
    CGrammar	gram;

    str.Format("%s", name);

    if (strcmp (str, "cmd$recalc") == 0)
    {
        // restart iterator thread
        if (p_symbol_engine_prwin->nopponents_for_prwin() == 0)
        {
            iter_vars.set_iterator_thread_complete(true);
        }
        else
        {
            p_iterator_thread->RestartIteratorThread();
        }

        // Recompute versus tables
        p_versus->GetCounts ();
        iserr = false;
        return 0;
    }

    result = gram.ParseString(&str, (const SFormula *) p_formula, &tpi, &stopchar);

    if (result)
    {
        e = SUCCESS;
        res = gram.EvaluateTree(p_formula, tpi, NULL, &e);
    }
    else
    {
        res = 0;
        e = ERR_INVALID_FUNC_SYM;
    }

    if (e == SUCCESS)
        iserr = false;

    else
        iserr = true;

    return res;
}