Forum > Debugger

Unable To Step Into Writeln Using F7

(1/6) > >>

Aruna:
Hello Everyone, I tried:


--- 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";}};} --- WriteLn(Format('%m', [1234.56])); // Output: $1,234.56 (locale-dependent)
And it works but the '$' sign is not at the beginning as expected it is at the end of the displayed output. The attached screenshot shows this. I tried to debug and step through the Writeln function to see how it does things but have so far been unable to do so. I think I need to have the debug info compiled in?

How does one go about doing this, please? And is this the expected behaviour for a format string of '%m' ?

440bx:
The documentation for %M states that the currency sign is _appended_.  It doesn't say anything  about its position being locale dependent.

see it at https://www.freepascal.org/docs-html/rtl/sysutils/format.html

HTH.

Thaddy:
To step into things like writeln you need to build a debug version of the compiler. Writeln is not in any library but a compiler intrinsic.
Once you have done that, you can step into writeln.

TRon:

--- Quote from: Aruna on January 09, 2025, 12:47:17 am ---And it works but the '$' sign is not at the beginning as expected it is at the end of the displayed output.

--- End quote ---
Although it is being described in the help that %m appends the currency symbol, on linux it is actually locale dependent.

Did you add the clocale unit to your test example ? If you did and the currency symbol is still displayed after the numbers then you would need to change that in the system locale settings or use a custom formatstring with FormatCurr().

As an alternative you could also fiddle with FormatSettings.CurrencyFormat. For details see https://www.freepascal.org/docs-html/rtl/sysutils/negcurrformat.html (yes, I know it says negcurrformat and that it is deprecated but please don't mind that as this is the only place where it seems listed in the help).


on my system without clocale:

--- Code: Bash  [+][-]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";}};} ---1,234.56$
on my system with clocale

--- Code: Bash  [+][-]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";}};} ---€ 1.234,56

Aruna:

--- Quote from: 440bx on January 09, 2025, 01:19:05 am ---The documentation for %M states that the currency sign is _appended_.  It doesn't say anything  about its position being locale dependent.
see it at https://www.freepascal.org/docs-html/rtl/sysutils/format.html
HTH.
--- End quote ---
I am on Linux that could be why. Thank you for  the doc link.

Navigation

[0] Message Index

[#] Next page

Go to full version