Hello,
I am stuck with a String issue that I do not understand, maybe you can understand it. Basically, I have a small interface (package) to BrowserInformation and the String returned by the following function is apparently mangled. That does not happen for every operations. I attached the Spad file for testing purpose.
getOperationDocumentation(op) ==
ops := search_operations(string op)$BrowserInformation
docs := coerce(ops)@List(Record(name: Symbol,
sdl: List(Record(signature: SExpression,
condition: SExpression, origin: SExpression,
documentation: String))))
res_str : String := ""
for ops_rec in docs repeat
for item in elt(ops_rec, sdl) repeat
cleaned := clean_tex(elt(item, documentation))
sl := cons(convert('Mapping)$SExpression,
destruct(elt(item, signature)))
sig_str : String := concat [" Signature: ",
form2LispString(sl)$Lisp pretend String]
ori_str : String := concat [" From: ",
form2LispString(elt(item, origin))$Lisp pretend String]
-- Debug purpose
PRINT(concat [cleaned, coerce(newline()),
sig_str, coerce(newline()), ori_str, coerce(newline()), coerce(newline())])$Lisp
res_str := concat [res_str, cleaned, coerce(newline()),
sig_str, coerce(newline()), ori_str, coerce(newline()), coerce(newline())]
res_str
The PRINT$Lisp is here for debug. As an example, here is the output when I apply it to the debug function:
===========================================================================
(3) -> getOperationDocumentation(debug)
"debug(d) specifies whether we want additional output on the progress. This option is expressed in the form debug == d.
Signature: (Boolean)->%
From: GuessOption
"
"debug(true) turns debug mode on debug(false) turns debug mode off
Signature: (Boolean)->Boolean
From: Plot
"
"debug returns whether we want additional output on the progress, default being false
Signature: (List(GuessOption))->Boolean
From: GuessOptionFunctions0
"
(3)
"debug(d) specifies whether we want additional output on the progress. This o
ption is expressed in the form debug == d.
Signature: (Boolean)->%
From: Gu
essOption
debug(true) turns debug mode on debug(false) turns debug mode off
Signature: (Boolean)->Boolean
From: Plot
debug returns whether we want add
itional output on the progress, default being false
Signature: (List(GuessOp
tion))->Boolean
From: GuessOptionFunctions0
"
Type: String
==================================================================
The first part is the PRINT debug information, but after the (3), in the string returned I obtain some _apparently_ random space characters or carriage return.
For example, see the first "From:", the GuessOption is mangled. In the third part this is in the "Signature:". In fact, that can happen in the docstring also. Any idea why? And eventually a hack to circumvent this?
Hoping I am clear.
Greg