freepascal

Could Free Pascal benefit of something like Apache Maven?

心已入冬 提交于 2019-11-28 20:52:19
Apache Maven is a very popular build and dependency management tool in the Java open source ecosphere. I did some tests to find out if it can handle compiled Free Pascal / Delphi units and found it easy to implement. So it would be possible to release open source libraries precompiled for Free Pascal (or Delphi) in a public Maven repository include metadata in this repository which contains dependency information use Maven on the command line to download the open source library from the public repository, and automatically resolve all dependencies local repositories, working as proxies, could

Why would introducing useless MOV instructions speed up a tight loop in x86_64 assembly?

ⅰ亾dé卋堺 提交于 2019-11-28 14:56:19
Background: While optimizing some Pascal code with embedded assembly language, I noticed an unnecessary MOV instruction, and removed it. To my surprise, removing the un-necessary instruction caused my program to slow down . I found that adding arbitrary, useless MOV instructions increased performance even further. The effect is erratic, and changes based on execution order: the same junk instructions transposed up or down by a single line produce a slowdown . I understand that the CPU does all kinds of optimizations and streamlining, but, this seems more like black magic. The data: A version

Runtime Error 201 at fpc

删除回忆录丶 提交于 2019-11-28 14:44:28
i have been writing a game about guessing numbers and i have to seperate a 4 digit number into its digits and put digits into an array.However that section keeps giving me runtime error 201 using fpc.However when i use ideone.com it gives me what i want.I can't figure out.can it be a bug?Sorry for my English. program game; var number : array [1..4] of integer; z, i, j: integer; number_4digit: integer; begin readln(number_4digit); for i := 4 downto 1 do begin j := i; z := number_4digit; while z > 10 do begin z := z div 10; end; number[5-i] := z; repeat z := z * 10; j := j - 1; until j = 1;

How can I call a Delphi function that returns a string using JNA?

混江龙づ霸主 提交于 2019-11-28 07:44:29
问题 I'm working on calling functions from a Delphi compiled *.so file from a Java program. After some research it seems like JNA is he way to go. Before diving into some complex Delphi code, I'm trying to play with some "Hello World" code but am having trouble getting a string returned by a Delphi function. The Delphi code (helloworld.pp): library HelloWorldLib; function HelloWorld(const myString: string): string; stdcall; begin WriteLn(myString); Result := myString; end; exports HelloWorld;

How to build a Treeview design (a task group with tasks nesting hierarchy) using Inno Setup?

安稳与你 提交于 2019-11-28 02:20:27
问题 I'm trying to build a Treeview hierarchy of checkable elements and labels that must be more or less like this: Standalone Controls (label, root) |__Check/Uncheck all controls of all groups (checkbox) | | | |__Controls group 1 (group description label) | | |__Check/Uncheck all these controls (checkbox) | | |__Control name 1 (task) | | |__Control name 2 (task) | | |__Control name 3 (task) | | | |__Controls group 2 (group description label) | | |__Check/Uncheck all these controls (checkbox) | |

What is wrong with my if-statement?

做~自己de王妃 提交于 2019-11-27 16:09:19
I am now trying to explore pascal. And I ran into some compiler errors. I wrote a if else if statement like this: if ((input = 'y') or (input = 'Y')) then begin writeln ('blah blah'); end; else if ((input = 'n') or (input = 'N')) then begin writeln ('blah'); end; else begin writeln ('Input invalid!'); end; And it gives me an error at the first else : ";" expected but "ELSE" found I looked for a lot of tutorials about if statements and they just do it like me: if(boolean_expression 1)then S1 (* Executes when the boolean expression 1 is true *) else if( boolean_expression 2) then S2 (* Executes

Could Free Pascal benefit of something like Apache Maven?

百般思念 提交于 2019-11-27 13:29:42
问题 Apache Maven is a very popular build and dependency management tool in the Java open source ecosphere. I did some tests to find out if it can handle compiled Free Pascal / Delphi units and found it easy to implement. So it would be possible to release open source libraries precompiled for Free Pascal (or Delphi) in a public Maven repository include metadata in this repository which contains dependency information use Maven on the command line to download the open source library from the

Why would introducing useless MOV instructions speed up a tight loop in x86_64 assembly?

两盒软妹~` 提交于 2019-11-27 08:56:02
问题 Background: While optimizing some Pascal code with embedded assembly language, I noticed an unnecessary MOV instruction, and removed it. To my surprise, removing the un-necessary instruction caused my program to slow down . I found that adding arbitrary, useless MOV instructions increased performance even further. The effect is erratic, and changes based on execution order: the same junk instructions transposed up or down by a single line produce a slowdown . I understand that the CPU does

Runtime Error 201 at fpc

风流意气都作罢 提交于 2019-11-27 08:45:59
问题 i have been writing a game about guessing numbers and i have to seperate a 4 digit number into its digits and put digits into an array.However that section keeps giving me runtime error 201 using fpc.However when i use ideone.com it gives me what i want.I can't figure out.can it be a bug?Sorry for my English. program game; var number : array [1..4] of integer; z, i, j: integer; number_4digit: integer; begin readln(number_4digit); for i := 4 downto 1 do begin j := i; z := number_4digit; while

Delphi / Pascal Example for Calling OpenSSL EVP functions

时光毁灭记忆、已成空白 提交于 2019-11-27 02:51:52
问题 Does anyone have a Delphi / Pascal example for calling the below OpenSSL functions... http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/packages/openssl/src/openssl.pas?revision=17634&view=markup I am specifically interested in: procedure EVP_CIPHER_CTX_init(a: PEVP_CIPHER_CTX); function EVP_CIPHER_CTX_cleanup(a: PEVP_CIPHER_CTX): cint; function EVP_CIPHER_CTX_set_key_length(x: PEVP_CIPHER_CTX; keylen: cint): cint; function EVP_CIPHER_CTX_ctrl(ctx: PEVP_CIPHER_CTX; type_, arg: cint; ptr: