Lazarus

Free Pascal => General => Topic started by: TJF on April 22, 2016, 11:35:29 am

Title: How to compile *.pas with text-graphic
Post by: TJF on April 22, 2016, 11:35:29 am
Hello,

I changed a very, very old *.pas and want to compile it with freepascal. There is a lot of text graphic inside, which doesn't compile the way I want (see attachments).

What can I do?

Regards
Thomas
Title: Re: How to compile *.pas with text-graphic
Post by: marcov on April 22, 2016, 11:44:19 am
It seems to be an encoding issue, and is probably related to the target platform and terminal that you use. Could you specify that?

Try to configure the terminal (encoding) in the same way as the source code.

Title: Re: How to compile *.pas with text-graphic
Post by: TJF on April 22, 2016, 11:57:19 am
How can I do this?

Sorry, I am not very familiar with freepascal. And it is about 30 years ago, I wrote this with TP5.0...

uses dos,crt

I am using Windows (DOS).
Title: Re: How to compile *.pas with text-graphic
Post by: marcov on April 22, 2016, 12:46:56 pm
This is not Free Pascal this is windows.  Create a shortcut to cmd.exe, and then browse the properties of that shortcut.

Or try "chcp 437" before executing.

The problem is that in dos all encodings were the same, source encoding, console encoding and system encoding. Now they are all different.

A FPC dos (go32v2 or msdos) program run under plain dos will still work.
Title: Re: How to compile *.pas with text-graphic
Post by: TJF on April 22, 2016, 02:48:59 pm
Using go32v2 shows the right graphik after compiling - but the program crashes ...
Title: Re: How to compile *.pas with text-graphic
Post by: marcov on April 22, 2016, 03:00:08 pm
Changing to 32-bit can bring out hidden flaws. Try compiling with -ghl and see if you get a traceback.
Title: Re: How to compile *.pas with text-graphic
Post by: TJF on April 22, 2016, 03:32:34 pm
crashes...
Title: Re: How to compile *.pas with text-graphic
Post by: Thaddy on April 22, 2016, 05:17:43 pm
crashes...
Well, then: it's weekend. Show
a) where it crashes It doesn't .
b) in the example sourcecode you are gonna write for us to demonstrate... and the codepage information from your system...
 ;D

As Marco says this is probably just a codepage issue and solved in minutes rather than months.
Title: Re: How to compile *.pas with text-graphic
Post by: TJF on April 22, 2016, 07:23:43 pm
My codepage is 850. Changing to 437 doesn't  change anything.

I don't want to waste your time. My hope was, that anybody knows how to compile files with text-graphic with freepascal AND that it is only a little step to do ...

Now I installed my old Borland Turbo Pascal 6.0 from the year (?) in WIN10 Pro and everything is compiling well. Freepascal cannot do the job or it is too complicated.

Best Regards
Thomas
Title: Re: How to compile *.pas with text-graphic
Post by: wp on April 22, 2016, 07:40:08 pm
Freepascal cannot do the job or it is too complicated.
Absolutely wrong! It's just that nobody exactly understands your issue. But without seeing what you are doing there can be many many possibilities. Why don't you just prepare a little demo and post the code here?
Title: Re: How to compile *.pas with text-graphic
Post by: marcov on April 22, 2016, 09:18:31 pm
Freepascal cannot do the job or it is too complicated.

Free Pascal is a compiler with compatibility, not an emulator nor a mind-reader.

As said switching development system can expose hidden flaws. Playing ostrich is a a way to avoid thinking about such things, but usually with a limited lifespan. As you soon will find out running Tp6 on a 64-bit windows.
Title: Re: How to compile *.pas with text-graphic
Post by: TJF on April 22, 2016, 09:41:41 pm
It's just that nobody exactly understands your issue.

The generated text-graphic code in the first picture is very clear (and very old  :) ) and has nothing to do with mind-reading.

Title: Re: How to compile *.pas with text-graphic
Post by: wp on April 22, 2016, 10:49:29 pm
It's just that nobody exactly understands your issue.
The generated text-graphic code in the first picture is very clear (and very old  :) ) and has nothing to do with mind-reading.
You are talking about crashes, and show a partial screenshot of some code hiding the rest. No, this is mind-reading. And how do you think that, nowadays, anybody can create such ancient DOS code for testing to give you a hint? Once again: Please prepare a little demo from your TF6 files and post it, and you will have a solution shortly.
Title: Re: How to compile *.pas with text-graphic
Post by: TJF on April 23, 2016, 11:04:37 am
Ok wp, I understand!

Thank you! See attachment: A simple extract

Best regards
Thomas
Title: Re: How to compile *.pas with text-graphic
Post by: TJF on April 23, 2016, 11:12:36 am
And a second case. S. attachment...

frame  (4,3,75,3,2);
Title: Re: How to compile *.pas with text-graphic
Post by: molly on April 23, 2016, 11:17:25 am
First code-example worked for me (if the attached picture is the result what you had in mind)

As already suggested, it is probably a code-page related issue.
Title: Re: How to compile *.pas with text-graphic
Post by: TJF on April 23, 2016, 11:21:33 am
if the attached picture is the result what you had in mind


Yes!
Title: Re: How to compile *.pas with text-graphic
Post by: wp on April 23, 2016, 11:24:18 am
Tested with Laz-trunk/fpc3.0. Had to remove the unit ls1000 and replace the call to "charinput" by "readln". Then the program compiles fine and displays the screenshot of yout attachment - no other changes required, no crash!

In the Lazarus IDE, however, the line characters are not displayed correctly. To show them right-click in the editor window containing "test2.pas", select "FileSettings" / "Encoding" / "CP437", then "Reopen with another encoding", and here we are - see screenshot.
Title: Re: How to compile *.pas with text-graphic
Post by: molly on April 23, 2016, 11:34:54 am
Same here wp :-)

@TJF:
In case you have a unicode console, read the manual on how to do/setup proper encoding to match your example (some terminal programs simply refuses because they lack proper encoding(-settings)).

If using a 'normal' console, make sure the code-page matches 437 _and_ that your console is using a font that has such characters to display (my console is using courier new)
Title: Re: How to compile *.pas with text-graphic
Post by: TJF on April 23, 2016, 11:56:23 am
Thank you very much!

Could you please tell me, what your (Compile->)Target is (go32v2)? And where I can change the console? I am not shure, if I am on the wrong way here ...

Or do you recommend to use Lazarus?
Title: Re: How to compile *.pas with text-graphic
Post by: molly on April 23, 2016, 12:02:02 pm
I am using my favourite text-editor (just take a pick, any will do), and compile with the FPC command-line compiler with target being win32.

If you are on windows, then you can change the font of the console by going to the system menu of the console (that icon on the top-left), and press properties. There are some tabs, and in one of them you can change the font. I'm not into betting games, but i guess yours is set to lucida console ;-)

You can also use lazarus, and should be no problem. Just use whatever works best for you.
Title: Re: How to compile *.pas with text-graphic
Post by: marcov on April 23, 2016, 12:10:32 pm
I ran your .pas directly in the release (fpc 3.0) Win32 textmode IDE on win10/64 and when ran it showed up fine. Both when run from the IDE as from the console

I used the win32 compiler, since it is a 64-bit windows system so DOS .exe's won't run. I did not change codepage with chcp, and the codepage already was 850. I probably didn't change many textmode properties except copy and paste and size related.

The image is the same as Molly's above, though with different fonts.

As for textmode IDE vs Lazarus, the compiler is the same. It is only editor and GUI preferences that set them apart.   I generally use Lazarus now, having gotten used to Delphi at work,  but have mostly used FP till 2008-2010. I still do sometimes, including remote putty sessions (e.g. to RPI)
Title: Re: How to compile *.pas with text-graphic
Post by: wp on April 23, 2016, 12:29:58 pm
Could you please tell me, what your (Compile->)Target is (go32v2)?
I was using Lazarus in my test, at first Laz trunk, later Laz 1.2.6. Compile target was "default" in each case.
Title: Re: How to compile *.pas with text-graphic
Post by: TJF on April 23, 2016, 12:33:42 pm
Ok. Thank you very much!

My favorite Editor would be Notepad++ in this case. I could find the way to show the right signs: OEM-US (s. attachment).

If I do (Notepad++):
C:\FPC\3.0.0\bin\i386-win32\fpc.exe "$(FULL_CURRENT_PATH)"
... and get my old problem. But with your infos I will find the way ...

My console has "Consolas" and it shows Codepage 850 ...
Title: Re: How to compile *.pas with text-graphic
Post by: molly on April 23, 2016, 12:48:34 pm
Just to make sure (as it isn't that trivial on windows), here (http://www.howtogeek.com/howto/windows-vista/stupid-geek-tricks-enable-more-fonts-for-the-windows-command-prompt/) you can see how to add/change console fonts.

Here (http://superuser.com/questions/55318/how-to-change-the-cmd-exe-font) is a related question on superuser, with also a link to console2 (that you saw in my picture) as it saves your from dumbwitted registry peeking n' poking. m$ couldn't make it any more user-friendly  >:D
Title: Re: How to compile *.pas with text-graphic
Post by: TJF on April 23, 2016, 01:09:34 pm
I will try ...  :)
TinyPortal © 2005-2018