Kbase P120448: The Outline View in the OpenEdge Architect does not display if the procedure has multiple line quote
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  25/02/2008 |
|
Status: Verified
FACT(s) (Environment):
OpenEdge 10.1B
All Supported Operating Systems
SYMPTOM(s):
The Outline View in the OpenEdge Architect does not display if the procedure has multiple line quoted strings
Include file reference contains quoted strings as arguments
Quoted string arguments span multiple lines
Outline view node for include file reference has code appended after closing curly bracket "}"
Outline view does not show code after include file reference as nodes
Code compiles without errors
CAUSE:
Bug# OE00135083
CAUSE:
Any preprocessor directive spanning multiple lines should include tildes ("~") to indicate line continuation. The Outline view is very strict on this and will fail to parse the directive correctly if a tilde is omitted. However, the compiler is (and has always been) less restrictive in this regard. Because of this difference in behavior, existing code that has always worked as expected may not be handled correctly by the 10.1B OpenEdge Architect.
FIX:
Upgrade to 10.1C
If the upgrade is not possible, the following can be used as a workaround:
Ensure that all quoted strings fall on the same line or that the multiple lines of the quoted strings are joined together by the tilde "~" character.
The following code sample demonstrate how to programmatically add the continuation character, "~", at the end of quoted strings spanning multiple lines in a given procedure. This code is only a sample provided as is without any guarantees whatsoever. Developers who choose to use it may need to modify it to meet their specific code requirement:
DEFINE VARIABLE cSourceFileName AS CHARACTER NO-UNDO.
DEFINE VARIABLE cTargetFileName AS CHARACTER NO-UNDO.
DEFINE VARIABLE cTilde AS CHARACTER NO-UNDO.
DEFINE VARIABLE cDoubleQuote AS CHARACTER NO-UNDO.
DEFINE VARIABLE cClosingBrace AS CHARACTER NO-UNDO.
DEFINE VARIABLE cPeriod AS CHARACTER NO-UNDO.
DEFINE VARIABLE cTrimmedLine AS CHARACTER NO-UNDO.
DEFINE VARIABLE WeAreInABlock AS LOGICAL NO-UNDO.
DEFINE VARIABLE cLine AS CHARACTER NO-UNDO.
DEFINE VARIABLE cSpace AS CHARACTER NO-UNDO.
FUNCTION getCharacterCount RETURNS INTEGER(INPUT ipcLine AS CHARACTER, ipcCharacter AS CHARACTER) FORWARD.
FUNCTION getLastTwoCharacters RETURNS CHARACTER(INPUT ipcLine AS CHARACTER) FORWARD.
ASSIGN
cSourceFileName = "ProcedureWithQuotedStringsSpanningMultipleLines.p"
cTargetFileName = "ProcedureWithQuotedStringsSpanningMultipleLinesJoinedWithComtinuationCharacter.p"
cTilde = CHR(126)
cDoubleQuote = CHR(34)
cClosingBrace = CHR(125)
cPeriod = CHR(46)
cSpace = CHR(32).
INPUT FROM VALUE ( cSourceFileName ).
OUTPUT TO VALUE ( cTargetFileName ).
REPEAT:
IMPORT UNFORMATTED cLine.
cTrimmedLine = TRIM(cLine).
IF cTrimmedLine = "" THEN DO:
PUT UNFORMATTED cLine + CHR(32) SKIP.
NEXT.
END.
IF getCharacterCount(cTrimmedLine, cDoubleQuote) MODULO 2 = 0 THEN DO:
PUT UNFORMATTED cLine + CHR(32) SKIP.
NEXT.
END.
IF getCharacterCount(cTrimmedLine, cDoubleQuote) MODULO 2 = 1 THEN DO:
WeAreInABlock = TRUE.
InnerLoop:
REPEAT WHILE WeAreInABlock:
PUT UNFORMATTED cLine + CHR(32) + cTilde SKIP.
IMPORT UNFORMATTED cLine.
cTrimmedLine = TRIM(cLine).
IF cTrimmedLine = "" THEN DO:
PUT UNFORMATTED cLine + CHR(32) SKIP.
NEXT InnerLoop.
&.nbsp; END.
WeAreInABlock = getLastTwoCharacters(cTrimmedLine) <> cDoubleQuote + cClosingBrace AND getLastTwoCharacters(cTrimmedLine) <> cDoubleQuote + cPeriod.
IF WeAreInABlock = FALSE THEN DO:
PUT UNFORMATTED cLine SKIP.
LEAVE.
END.
END.
END.
END.
INPUT CLOSE.
OUTPUT CLOSE.
FUNCTION getCharacterCount RETURNS INTEGER(INPUT ipcLine AS CHARACTER, ipcCharacter AS CHARACTER):
DEFINE VARIABLE iStarting AS INTEGER NO-UNDO INITIAL 1.
DEFINE VARIABLE iCharacterCount AS INTEGER NO-UNDO.
REPEAT:
IF INDEX (ipcLine , ipcCharacter , iStarting) = 0 THEN LEAVE.
iCharacterCount = iCharacterCount + 1.
iStarting = INDEX (ipcLine , ipcCharacter , iStarting) + 1.
END.
RETURN iCharacterCount.
END FUNCTION.
FUNCTION getLastTwoCharacters RETURNS CHARACTER(INPUT ipcLine AS CHARACTER):
RETURN SUBSTRING(ipcLine, LENGTH(ipcLine) - 1).
END FUNCTION.
.