/**
   Processing commands for dbname combobox (hwndCtl).
*/
void processDbCombobox(HWND hwnd, HWND hwndCtl, UINT codeNotify)
{
  switch(codeNotify)
  {
    /* Loading list and adjust its height if button clicked and on user input */
    case(CBN_DROPDOWN):
    {
      FillParameters(hwnd, pParams);
      LIST *dbs= mygetdatabases(hwnd, pParams);
      LIST *dbtmp= dbs;

      ComboBox_ResetContent(hwndCtl);

      adjustDropdownHeight(hwndCtl,list_length(dbs));

      for (; dbtmp; dbtmp= list_rest(dbtmp))
        ComboBox_AddString(hwndCtl, (SQLWCHAR *)dbtmp->data);

      list_free(dbs, 1);

      ComboBox_SetText(hwndCtl,pParams->database);

      break;
    }
  }
}
void btnTest_Click (HWND hwnd)
{
  FillParameters(hwnd, pParams);
  wchar_t *testResultMsg= mytest(hwnd, pParams);
  MessageBoxW(hwnd, testResultMsg, L"Test Result", MB_OK);
  x_free(testResultMsg);
}
void tScriptState::ParseCommand(CString& s, tCommand& cmd, ULONG step, bool& bSilent)
{
    size_t len = 0;
    int i, selected = -1;
    const char *token;
    tCommandId cmdId = cmdInvalid;
    cmd.step =  step;
    cmd.line = currentLine;
    cmd.lineDot = ++currentDot;
    s.MakeLower();
    for (i = 0; i < ELEMENTS_IN(commands); ++i)
    {
        if (s.Find(commands[i].token) == 0 && len < strlen(commands[i].token))
        {
            cmdId = commands[i].cmd;
            len = strlen(commands[i].token);
            token = commands[i].token;
            selected = i;
        }
    }
    cmd.cmdId = cmdId;
    if (cmdId != cmdInvalid)
    {
        s.Delete(0, len);
        // get parameters
        if (FillParameters(s, cmd, commands[selected]))
        {
            if (!bSilent)
            {
                s.Format("%04d.%d(%04d) Command %s", cmd.line, cmd.lineDot, cmd.step, (LPCSTR)cmd.Description());
                LogTestFlow("%s\n", (LPCSTR)s);
            }
        }
    }
}
void btnOk_Click (HWND hwnd)
{
  FillParameters(hwnd, pParams);

  /* if DS params are valid, close dialog */
  if (mytestaccept(hwnd, pParams))
  {
    OkPressed= 1;
    PostMessage(hwnd, WM_CLOSE, NULL, NULL);
  }
}
示例#5
0
bool GLCgShader::CreateCgProgram()
{
	DestroyCgProgram();
	m_cgProgam = cgCreateProgram(
		m_cgContext,
		CG_SOURCE,
		m_shaderCode.c_str(),
		m_cgProfile,
		m_entry.empty() ? NULL : m_entry.c_str(),
		NULL);

	if (CheckForError("Shader::LoadShader creating program from file", m_shaderName))
		return false;

	// compile shader
	cgGLLoadProgram(m_cgProgam);
	if (CheckForError("GS_SHADER::CompileShader loading the program", m_shaderName))
		return false;

	FillParameters(CG_GLOBAL);
	FillParameters(CG_PROGRAM);
	return true;
}
bool tScriptState::EvaluateCondition(CString s)
{
    bool b = FALSE;
    CString sPrintable;
    CString sTemp;
    sPrintable.Format("Evaluating %s", (LPCSTR)s );
    if (!s.CompareNoCase("true"))
    {
        b = TRUE;
    }
    else if (!s.CompareNoCase("false"))
    {

    }
    else
    {
        bool bOK;
        tCommand cmd;
        cmd.cmdId = cmdEval;
        _tCommandDecs desc = { NULL, cmdEval, "eval", {ptString, ptString, ptInteger } };
        if (FillParameters(s, cmd, desc))
        {
            ULONG val, operand;
            CString op = cmd.params[1]->String();
            operand = cmd.params[2]->Value();
            bOK = GetVariable(cmd.params[0]->String(), val);
            if (bOK)
            {
                sTemp.Format("(%s = %d)", (LPCSTR)cmd.params[0]->String(), val);
                sPrintable += sTemp;
                if (!op.CompareNoCase("lt"))
                {
                    b = val < operand;
                }
                else if (!op.CompareNoCase("gt"))
                {
                    b = val > operand;
                }
                else if (!op.CompareNoCase("le"))
                {
                    b = val <= operand;
                }
                else if (!op.CompareNoCase("ge"))
                {
                    b = val >= operand;
                }
                else if (!op.CompareNoCase("eq"))
                {
                    b = val == operand;
                }
                else if (!op.CompareNoCase("ne"))
                {
                    b = val != operand;
                }
            }
            else
            {
                FailCase("Variable %s does not exist", cmd.params[0]->String());
            }
        }
    }
    sTemp.Format("=%d", b);
    sPrintable += sTemp;
    LogTestFlow("%s\n", (LPCSTR)sPrintable);
    return b;
}