Forum > Debugger

FpDebug watch array[0..n] of char

(1/4) > >>

440bx:
Hello,

when watching an array of char, e.g:
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var  test_name : packed array[0..511] of char;the watch window shows every character delimited by a single quote and separated by a comma.  This results in a lot of space used by quotes and commas.

Is there a way to have the (null terminated) character array be displayed showing only the characters ? that is, without any single quotes and commas.

Thank you for your help.

PS: attached is an example showing all the quotes and commas.

Martin_fr:
Not really, but kind of....

Btw, good idea for https://forum.lazarus.freepascal.org/index.php/topic,66143.0.html

The following work for me in 3.1 (fixes) / probably release too.

--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---@test_name[0]
--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---^char(@test_name)
--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---^char(@test_name[0])
--- EDIT


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- that is, without any single quotes and commas.Well there will be a quote at the very start and end.

And if there are unprintable chars #1..#31 then there will be more. Same as in a Pascal source file.

440bx:
Those work great :)  Thank you!

Question: do you want me to post this question/request as a suggestion in the thread you linked to ?  I'll be glad to, if you'd like the idea to be mentioned in that thread.

Martin_fr:
Might be a good idea to post it there. Not sure how soon I get to it.  (I am in the middle of some display format work, but this came to late... / and the align isn't yet in there neither)

Currently I can only think of one (or two) applications.

- "array of char" => Display as string
- "string" => display as array. (e.g. decimal, hex values)

Technically an array of byte could be casted... Even an array of "number" could be a list of unicode codepoints... Not sure though.

440bx:

--- Quote from: Martin_fr on February 27, 2024, 12:45:22 pm ---Might be a good idea to post it there. Not sure how soon I get to it. 

--- End quote ---
Will do and no rush.  The suggestions you made work quite well.  I just think it would be nice if that way of displaying the null terminated arrays was the default, i.e, no user action/typecast required to obtain that format.

Navigation

[0] Message Index

[#] Next page

Go to full version