private AIMLTagHandler proccessTemplate(SubQuery query, Request request, Result result,
                                                XmlNode templateNode, Unifiable sGuard,
                                                out bool createdOutput, out bool templateSucceeded,
                                                AIMLTagHandler parentHandlerU, TemplateInfo templateInfo,
                                                bool copyChild, bool copyParent)
        {
            ChatLabel label      = request.PushScope;
            var       prevTraced = request.IsTraced;
            var       untraced   = request.Graph.UnTraced;
            var       superTrace = templateInfo != null && templateInfo.IsTraced;

            try
            {
                if (superTrace)
                {
                    request.IsTraced       = true;
                    request.Graph.UnTraced = false;
                }

                var th = proccessResponse000(query, request, result, templateNode, sGuard,
                                             out createdOutput, out templateSucceeded,
                                             parentHandlerU, templateInfo, copyChild, copyParent);

                if (superTrace)
                {
                    StaticAIMLUtils.writeDebugLine("SuperTrace=" + templateSucceeded + ": " + templateInfo);
                }
                return(th);
            }
            catch (ChatSignalOverBudget ex)
            {
                throw;
            }
            catch (ChatSignal ex)
            {
                if (label.IsSignal(ex))
                {
                    // if (ex.SubQuery != query) throw;
                    if (ex.NeedsAdding)
                    {
                        request.AddOutputSentences(templateInfo, ex.TemplateOutput, result, request.TopLevelScore);
                    }
                    templateSucceeded = ex.TemplateSucceeded;
                    createdOutput     = ex.CreatedOutput;
                    return(ex.TagHandlerU);
                }
                throw;
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                request.IsTraced       = prevTraced;
                request.Graph.UnTraced = untraced;
                label.PopScope();
            }
        }
Example #2
0
 public static bool IsFirst(ChatLabel label)
 {
     lock (Labels) return(Labels[Labels.Count - 1].id == label.id);
 }