Returns the first warning string associated with the specified grammar (if any) in the specified string, up to a maximum length specified.
Function
- int LV_SRE_ReturnGrammarFirstWarningString(HPORT hport, const char* GrammarLabel, char * OutputString, int MaxOutputStringLength)
Parameters
hport
The port's handle.
GrammarLabel
The label of the grammar whose first warning string needs to be returned.
OutputString
The string buffer that will be populated with the warning string associated with the specified grammar (if any). Users should ensure this buffer is large enough to contain the first warning string being requested (see LV_SRE_ReturnGrammarFirstWarningStringLength to determine the size of this buffer)
MaximumOutputStringLength
The maximum length of a string that can be stored in the specified OutputString buffer, which will contain the result. Users should ensure that OutputString is of at least this size. If the first warning string exceeds this length, it will be truncated at this specified length.
Return Values
LV_SUCCESS
No errors; the first warning string for the specified grammar (if any) was returned. If there is no first warning string for the specified grammar, an empty string is returned in OutputString.
LV_INVALID_HPORT
The input hport is not a valid one.
LV_FAILURE
The operation failed because the port was shutting down.
LV_EXCEPTION
An exception occurred while processing the request.
Remarks
Values returned by LV_SRE_ReturnGrammarFirstWarningString are particularly useful when debugging grammar load warnings.
Typically, when loading a grammar, some not-fatal warnings may not be severe enough to cause a grammar load to fail, so these warnings may often be overlooked. This function, and the corresponding functions listed below can uncover previously unknown issues within grammars.