Esempio n. 1
0
        private void GetPetButton_Click(object sender, System.EventArgs e)
        {
            LogicServer ls;
            long        term;

            term = 0;
            try
            {
                ls = new LogicServer();
                ls.Init("");
                ls.Load("pets.xpl");
                ls.AssertaStr("sound(" + SoundText.Text + ")");
                term = ls.ExecStr("pet(X)");
                if (term != 0)
                {
                    PetText.Text = ls.GetStrArg(term, 1);
                }
                else
                {
                    PetText.Text = "Unknown Pet";
                }
                ls.Close();
            }
            catch (LSException ex)
            {
                String message = ex.GetMessage();
                PetText.Text = message;
            }
        }
Esempio n. 2
0
        private void GoButton_Click(object sender, System.EventArgs e)
        {
            LogicServer     ls;
            PrologPredicate prompt_pred;
            int             term;
            string          pet;

            ls          = new LogicServer();
            prompt_pred = new PrologPredicate(prompt);
            try
            {
                ls.Init("");
                ls.AddPred("prompt", 2, prompt_pred);
                ls.Load("pets.xpl");
                term = ls.ExecStr("pet(X)");
                if (term == 0)
                {
                    MessageBox.Show("Sound not found", "ERROR",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    pet          = ls.GetStrArg(term, 1);
                    PetText.Text = pet;
                }
                ls.Close();
            }
            catch (LSException ex)
            {
                MessageBox.Show(ex.GetMessage(), "ERROR",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 3
0
    // Display errors from ARulesXL
    private string FormatARulesError()
    {
        int term;

        try
        {
            term = ls.ExecStr("query_error(?x)");
            if (term != 0)
            {
                return(ls.GetStrArg(term, 1));
            }
            else
            {
                return("Unknown ARulesXL error");
            }
        }
        catch (LSException ex)
        {
            return("Error getting ARulesXL error: " + ex.GetMsg());
        }
    }