Forum > Windows

Pascal version of the UCI Filter program

(1/9) > >>

Roland57:
Hello everybody.

I translated to Pascal the program UCI Filter. It's a program designed to be used as a filter between a UCI chess engine and a chess GUI.

The Pascal version doesn't work correctly. Would someone help me to find the error?

Here is how to compile and test the original program:

(You need to have make and fpc available on the command line.)

D:\c\echecs\ucifilter-pascal-241011>make
gcc -Wall ucifilter.c -o ucifilter.exe

D:\c\echecs\ucifilter-pascal-241011>make test
ucifilter .\CT800_V1.34_x32.exe
CT800 V1.34 32 bit UCI version
2016-2019 by Rasmus Althoff
Free software under GPLv3+
quit

Here is how to compile and test the Pascal version:

D:\c\echecs\ucifilter-pascal-241011>make ucifilterpas
fpc -Mobjfpc -Sh -dDEBUG ucifilter.pas -oucifilterpas.exe
Compiling Debug Version
Free Pascal Compiler version 3.2.0 [2021/02/21] for i386
Copyright (c) 1993-2020 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling ucifilter.pas
Compiling log.pas
Linking ucifilterpas.exe
524 lines compiled, 0.3 sec, 170256 bytes code, 6724 bytes data

D:\c\echecs\ucifilter-pascal-241011>make testpas
ucifilterpas .\CT800_V1.34_x32.exe
| a♠CT800 V1.34 32☻  | a♠►' £ a♠2016-2019 by R☻  | a♠╣ a♠Free software ☻  | aquit

You can see that the output of the UCI engine is corrupted.

Which error did I make?

bobby100:
Are you sure about using ansichar and ansistring? To me, it looks like you are getting multibyte text, and the garbage comes from reading it as singlebyte (ansi) chars.

af0815:
Best way, write the original raw stringdata to a file and analyse this file. I have see this, if i read output from a Delphi programm (2 Byte Chars) and misinterpret this in my first try.

Roland57:

--- Quote from: bobby100 on October 11, 2024, 03:07:54 pm ---Are you sure about using ansichar and ansistring?

--- End quote ---

I think ansichar is the equivalent of the char type used in the C program. The ansistring type is used only for the executable path, and it seems to work (since the executable starts).


--- 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";}};} ---function EngineStarten(EnginePath: AnsiString): THandle; forward;

Fred vS:

--- Quote from: Roland57 on October 16, 2024, 03:18:52 pm ---I think ansichar is the equivalent of the char type used in the C program. ;

--- End quote ---

There is also cchar from ctypes.pp.

Navigation

[0] Message Index

[#] Next page

Go to full version