From 873fc7ef523b0114865ef9e076c626ec5c35abcc Mon Sep 17 00:00:00 2001 From: Nathan Glenn Date: Tue, 30 Apr 2024 22:59:14 -0500 Subject: [PATCH] fix minor typos --- Core/ClientSML/src/sml_ClientTraceXML.h | 42 +++++++-------- Core/ClientSML/src/sml_ClientXML.h | 52 +++++++++---------- .../debugger/modules/FoldingTextView.java | 28 ++++++---- 3 files changed, 64 insertions(+), 58 deletions(-) diff --git a/Core/ClientSML/src/sml_ClientTraceXML.h b/Core/ClientSML/src/sml_ClientTraceXML.h index 18cf6687f9..d013e9aa6c 100644 --- a/Core/ClientSML/src/sml_ClientTraceXML.h +++ b/Core/ClientSML/src/sml_ClientTraceXML.h @@ -5,7 +5,7 @@ // Date : March 2005 // // This class is used to represent XML messages -// that contain trace output from a Soar. +// that contain trace output from a Soar command. // ///////////////////////////////////////////////////////////////// @@ -23,15 +23,15 @@ namespace sml public: // These methods provide access to specific attributes and tags without // the client needing to pass in/know the strings. They're all very simple. - + // Trace tag contains everything else bool IsTagTrace() const ; - + // Write commands on right hand side of productions generate output // which are collected here. bool IsTagRhsWrite() const ; char const* GetString() const ; - + // State tag attributes bool IsTagState() const ; char const* GetDecisionCycleCount() const ; @@ -39,58 +39,58 @@ namespace sml char const* GetImpasseObject() const ; char const* GetImpasseType() const ; char const* GetStackLevel() const ; - + // Operator tag attributes bool IsTagOperator() const ; char const* GetOperatorID() const ; char const* GetOperatorName() const ; // Included in tag, same as state // char const* GetDecisionCycleCount() const ; - + // Phase tag attributes bool IsTagPhase() const ; char const* GetPhaseName() const ; char const* GetPhaseStatus() const ; char const* GetFiringType() const ; char const* GetLevelNum() const ; // SBW 8/4/08 - + // Subphase (firing productions/changing wm) tag bool IsTagSubphase() const ; bool IsSubphaseNameFiringProductions() const ; bool IsSubphaseNameChangingWorkingMemory() const ; - + // Firing-production tag, contains production bool IsTagFiringProduction() const ; bool IsTagRetractingProduction() const ; bool IsTagLearning() const ; - + // Production bool IsTagProduction() const ; char const* GetProductionName() const ; char const* GetProductionDoc() const ; char const* GetProductionType() const ; char const* GetProductionDeclaredSupport() const ; - + bool IsTagConditions() const ; bool IsTagCondition() const ; bool IsTagConjunctiveNegationCondition() const ; bool IsTagActions() const ; bool IsTagAction() const ; - + // Condition attributes: Note this form allows for multiple unparsed conditions within the "condition" attribute. char const* GetConditionTest() const ; char const* GetConditionId() const ; char const* GetCondition() const ; - + // Action attributes char const* GetActionId() const ; char const* GetAction() const ; char const* GetFunction() const ; - + // Add-wme contains wme bool IsTagAddWme() const ; bool IsTagRemoveWme() const ; - + // Wme tag attributes bool IsTagWme() const ; char const* GetWmeID() const ; @@ -98,7 +98,7 @@ namespace sml char const* GetWmeValue() const ; char const* GetWmeTimeTag() const ; char const* GetWmePreference() const ; - + // Preference tag bool IsTagPreference() const ; char const* GetPreferenceID() const ; @@ -108,10 +108,10 @@ namespace sml char const* GetPreferenceTimeTag() const ; char const* GetPreferenceOSupported() const ; char const* GetPreferenceReferent() const ; - + // Marker between LHS matches and RHS results in trace bool IsTagActionSideMarker() const ; - + // Backtracing bool IsTagLocal() const ; bool IsTagLocals() const ; @@ -121,25 +121,25 @@ namespace sml bool IsTagOSKPreference() const ; bool IsTagBacktraceResult() const ; bool IsTagLocalNegation() const ; - + char const* GetBacktraceAlreadyBacktraced() const ; char const* GetBacktraceSymbol1() const ; char const* GetBacktraceSymbol2() const ; - + // Numeric indifferent preferences bool IsTagCandidate() const ; char const* GetCandidateName() const ; char const* GetCandidateType() const ; char const* GetCandidateValue() const ; char const* GetCandidateExpValue() const ; - + // Warnings, errors, messages and other tags bool IsTagError() const ; bool IsTagWarning() const ; bool IsTagMessage() const ; bool IsTagVerbose() const ; } ; - + } //closes namespace #endif //SML_CLIENT_TRACE_XML_H diff --git a/Core/ClientSML/src/sml_ClientXML.h b/Core/ClientSML/src/sml_ClientXML.h index b09731c822..e593a53c3a 100644 --- a/Core/ClientSML/src/sml_ClientXML.h +++ b/Core/ClientSML/src/sml_ClientXML.h @@ -28,25 +28,25 @@ namespace sml class Agent ; class ClientTraceXML ; - + class EXPORT ClientXML { friend class Agent ; - + private: soarxml::ElementXML* m_pElementXML ; - + protected: // This constructor is protected so that client doesn't try to build these objects. // So far they're only built internally and then passed to the client. // NOTE: We take ownership of the ElementXML object we are passed and // delete it when this client object is deleted. ClientXML(soarxml::ElementXML* pXML) ; - + public: ClientXML() ; virtual ~ClientXML() ; - + /************************************************************* * @brief Creates a new reference to the underlying XML object. * @@ -54,7 +54,7 @@ namespace sml * passed. *************************************************************/ ClientXML(ClientXML* pXML) ; - + /************************************************************* * @brief Cast this object to a subclass. * @@ -64,7 +64,7 @@ namespace sml * to cast the underlying C++ object. These methods achieve that. * * NOTE: These methods always succeed because the subclasses contain no - * data. They just contain specific access method. So we can cast any + * data. They just contain specific access methods. So we can cast any * XML message over to any of these subclasses and if it's not a match * when we ask for IsTagX() etc they'll just return false. * If the subclasses contained data we'd want this to be a dynamic cast @@ -76,14 +76,14 @@ namespace sml { return (ClientTraceXML*) this ; } - + /************************************************************* * @brief Gets the tag name for this element. * * @returns The tag name. *************************************************************/ char const* GetTagName() const ; - + /************************************************************* * @brief Returns true if the tag name matches. * @@ -92,12 +92,12 @@ namespace sml * @returns true if equal (case sensitive) *************************************************************/ bool IsTag(char const* pTagName) const ; - + /************************************************************* * @brief Returns the number of children of this element. *************************************************************/ int GetNumberChildren() const ; - + /************************************************************* * @brief Returns the n-th child of this element by placing it in pChild. * @@ -111,12 +111,12 @@ namespace sml * @returns false if index is out of range. *************************************************************/ bool GetChild(ClientXML* pChild, int index) const ; - + /************************************************************* * @brief Get the number of attributes attached to this element. *************************************************************/ int GetNumberAttributes() const ; - + /************************************************************* * @brief Get the name of the n-th attribute of this element. * Attributes may not be returned in the order they were added. @@ -124,14 +124,14 @@ namespace sml * @param index The 0-based index of the attribute to return. *************************************************************/ const char* GetAttributeName(int index) const ; - + /************************************************************* * @brief Get the value of the n-th attribute of this element. * * @param index The 0-based index of the attribute to return. *************************************************************/ const char* GetAttributeValue(int index) const ; - + /************************************************************* * @brief Get the value of the named attribute of this element. * @@ -139,7 +139,7 @@ namespace sml * @returns The value of the named attribute (or null if this attribute doesn't exist). *************************************************************/ const char* GetAttribute(const char* attName) const ; - + /************************************************************* * @brief Get the character data for this element. * @@ -148,13 +148,13 @@ namespace sml * It will include the original special characters (e.g. "<"). *************************************************************/ char const* GetCharacterData() const ; - + /************************************************************* * @brief Returns true if the character data should be treated as a binary buffer * rather than a null-terminated character string. *************************************************************/ bool IsCharacterDataBinary() const ; - + /************************************************************* * @brief Converts a character data buffer into binary data. * @@ -173,7 +173,7 @@ namespace sml * @returns True if buffer is binary after conversion. *************************************************************/ bool ConvertCharacterDataToBinary() ; - + /************************************************************* * @brief Returns the length of the character data. * @@ -181,7 +181,7 @@ namespace sml * If the data is a null terminated string this is the length of the string + 1 (for the null). *************************************************************/ int GetCharacterDataLength() const ; - + /************************************************************* * @brief Converts the XML object to a string. * @@ -191,7 +191,7 @@ namespace sml * @returns The string form of the object. *************************************************************/ char* GenerateXMLString(bool includeChildren, bool insertNewLines = false) const ; - + /************************************************************* * @brief Returns the length of string needed to represent this object (does not include the trailing null, so add one for that) * @@ -199,7 +199,7 @@ namespace sml * @param insertNewlines Add newlines to space out the tags to be more human-readable *************************************************************/ int DetermineXMLStringLength(bool includeChildren, bool insertNewLines = false) const ; - + /************************************************************* * @brief Utility function to allocate memory that the client will pass to the other ElementXML functions. * @@ -207,21 +207,21 @@ namespace sml * (so that a trailing null is always included). Thus passing length 0 is valid and will allocate a single byte. *************************************************************/ static char* AllocateString(int length) ; - + /************************************************************* * @brief Utility function to release memory allocated by this element and returned to the caller. * * @param string The string to release. Passing NULL is valid and does nothing. *************************************************************/ static void DeleteString(char* pString) ; - + /************************************************************* * @brief Performs an allocation and then copies the contents of the passed in string to the newly allocated string. * * @param string The string to copy. Passing NULL is valid and returns NULL. *************************************************************/ static char* CopyString(char const* original) ; - + /************************************************************* * @brief Performs an allocation and then copies the contents of the passed in buffer to the newly allocated buffer. * You need to use this rather than copyString if copying binary data (because it can contained embedded nulls). @@ -231,7 +231,7 @@ namespace sml *************************************************************/ static char* CopyBuffer(char const* original, int length) ; } ; - + } //closes namespace #endif //SML_CLIENT_XML_H diff --git a/Java/Debugger/src/edu/umich/soar/debugger/modules/FoldingTextView.java b/Java/Debugger/src/edu/umich/soar/debugger/modules/FoldingTextView.java index f9b5d7ce98..8d103ad95a 100644 --- a/Java/Debugger/src/edu/umich/soar/debugger/modules/FoldingTextView.java +++ b/Java/Debugger/src/edu/umich/soar/debugger/modules/FoldingTextView.java @@ -627,7 +627,7 @@ public void copy() * @param wrap * If true after reaching the bottom, continue search from the * top - * @param searchHidden + * @param searchHiddenText * If true and this view has hidden text (e.g. unexpanded tree * nodes) search that text * @@ -1277,7 +1277,10 @@ else if (xmlTrace.IsTagError()) xmlParent.delete(); } - public static class RunWrapper implements Runnable + /** + * Solves a very specific problem; see call site comments for details + */ + public static class XMLDisplayRunner implements Runnable { final FoldingTextView m_View; @@ -1285,7 +1288,7 @@ public static class RunWrapper implements Runnable final ClientXML m_XML; - public RunWrapper(FoldingTextView view, Agent agent, ClientXML xml) + public XMLDisplayRunner(FoldingTextView view, Agent agent, ClientXML xml) { m_Agent = agent; m_XML = xml; @@ -1311,14 +1314,14 @@ public void xmlEventHandler(int eventID, Object data, Agent agent, // can send over many pieces of a trace in a single call. Just more // efficient that way. - ClientTraceXML xmlParent = xml.ConvertToTraceXML(); - if (!xmlParent.IsTagTrace() || xmlParent.GetNumberChildren() == 0) + ClientTraceXML clientTraceXML = xml.ConvertToTraceXML(); + if (!clientTraceXML.IsTagTrace() || clientTraceXML.GetNumberChildren() == 0) { xml.delete(); return; } // The conversion creates a new SWIG object which we have to delete. - xmlParent.delete(); + clientTraceXML.delete(); // If Soar is running in the UI thread we can make // the update directly. @@ -1350,12 +1353,12 @@ public void xmlEventHandler(int eventID, Object data, Agent agent, // specifically because // Linux needs these two to stay in step and some users might not want // the UI to get ahead. - ClientXML pKeep = new ClientXML(xml); + ClientXML xmlSafeCopy = new ClientXML(xml); if (m_LockToSoar) - Display.getDefault().syncExec(new RunWrapper(this, agent, pKeep)); + Display.getDefault().syncExec(new XMLDisplayRunner(this, agent, xmlSafeCopy)); else - Display.getDefault().asyncExec(new RunWrapper(this, agent, pKeep)); + Display.getDefault().asyncExec(new XMLDisplayRunner(this, agent, xmlSafeCopy)); } /******************************************************************************************** @@ -1366,6 +1369,7 @@ public void xmlEventHandler(int eventID, Object data, Agent agent, @Override protected void registerForViewAgentEvents(Agent agent) { + System.out.println("Registering for XML Events: " + agent.GetAgentName()); m_xmlCallback = agent.RegisterForXMLEvent( smlXMLEventId.smlEVENT_XML_TRACE_OUTPUT, this, null); } @@ -1373,6 +1377,7 @@ protected void registerForViewAgentEvents(Agent agent) @Override protected void clearViewAgentEvents() { + System.out.println("Clearing XML events"); m_xmlCallback = -1; } @@ -1381,9 +1386,10 @@ protected boolean unregisterForViewAgentEvents(Agent agent) { boolean ok = true; - if (m_xmlCallback != -1) + if (m_xmlCallback != -1) { ok = agent.UnregisterForXMLEvent(m_xmlCallback); - + System.out.println("Unregistered for XML events: " + agent.GetAgentName() + ", " + ok); + } m_xmlCallback = -1; return ok;