Re: [fpc-pascal] USB serial interface

2006-12-27 Thread Klaus Hartnegg
transfers per second. USB1 can transfer a lot more than 1000 bytes per second, but not in 1000 transfers of only 1 byte each. I don't know the exact number for USB2. Also it depends on which other USB devides are connected because they all share the bus. Klaus -- Klaus Hartnegg, Brain Research

Re: [fpc-pascal]Modifying cpu registers while in turbo pascal interrupt routine ?

2004-03-18 Thread Klaus Hartnegg
it it doesn't use longint). The problem is that these parameters are probably passed 'by value'. So these are only copies. try trapint.pas from this page: http://www.brain.uni-freiburg.de/~klaus/pascal/sources/ hope this helps, Klaus -- Klaus Hartnegg, Brain Research Group, University Freiburg

[fpc-pascal] subtract longwords with rollover

2013-11-28 Thread Klaus Hartnegg
Hi, How can I subtract two longwords such that when the result becomes negative, it rolls over? A := A - B triggers runtime error 201 when the result is negative. dec (A,B) rolls over, but triggers runtime error 201 when A is higher than the highest possible value of longint. Is dec only

Re: [fpc-pascal] subtract longwords with rollover

2013-11-28 Thread Klaus Hartnegg
Sorry, I forgot to mention there is {$Q-} in the source. The trick was indeed to use dec(longint(a),b). However I had missed one place in the code, so I got another runtime error from there. But why does it only work with longint, and not with longword? This looks like a missing declaration

Re: [fpc-pascal] subtract longwords with rollover

2013-11-29 Thread Klaus Hartnegg
On 28.11.2013 18:32, Tomas Hajny wrote: On Thu, November 28, 2013 18:12, Klaus Hartnegg wrote: Sorry, I forgot to mention there is {$Q-} in the source. I believe that $Q- covers overflow checks, not range checks. Thanks, this showed me the right direction. Explanation: I'm trying to port

Re: [fpc-pascal] quality of FPC random

2015-08-20 Thread Klaus Hartnegg
Am 14.08.2015 um 15:38 schrieb Xiangrong Fang: I need to generate random numbers to be used as IV of block ciphers. My question is: is FPC built-in PRNG good enough as comparing to /dev/urandom? NO!!! For crypto always use /dev/urandom On the other hand, /dev/urandom in my impression is

[fpc-pascal] fprecvfrom for IPv6?

2015-08-02 Thread Klaus Hartnegg
Hello, How can fprecvfrom work with IPv6? It returns the address of the sender in a record sockaddr, which only has space for an IPv4 address. http://www.freepascal.org/docs-html/rtl/sockets/fprecvfrom.html Is there an undocumented variant in which psockaddr points to sockaddr_in6 instead

Re: [fpc-pascal] is scrypt available?

2015-10-29 Thread Klaus Hartnegg
Am 27.10.2015 um 18:55 schrieb David W Noon: Do not use a normal hash function to store passwords. If the password file is stolen, the attackers can quickly determine most passwords. There are

Re: [fpc-pascal] howto store passwords

2015-10-30 Thread Klaus Hartnegg
Am 29.10.2015 um 18:08 schrieb Frederic Da Vitoria: I'd even ask the question: do you really need to store the passwords? IOW, do you want to be able to send them back to the user? Or do you only need to check them? My latest access system does not use passwords at all. The server sends the

[fpc-pascal] howto find alternatives for deprecated fucntions?

2015-09-16 Thread Klaus Hartnegg
Hi, if the docs and the compiler say that a function is deprecated, how can I find out which other function should be used instead? Example: www.freepascal.org/docs-html/rtl/sockets/accept.html says that accept is deprecated. Whould I switch to fpaccept eventhough that can do a lot less? I

Re: [fpc-pascal] the accept sample from the manual drives me crazy

2015-09-30 Thread Klaus Hartnegg
Sorry, I meant accept, not access. Am 30.09.2015 um 11:10 schrieb Klaus Hartnegg: http://www.freepascal.org/docs-html/rtl/sockets/fpaccept.html if Accept(S,FromName,Sin,Sout) then (* WARNING: Accept is deprecated *) (* ERROR: fromname contains nonsense characters *) Sock2Text(S,Sin,Sout

Re: [fpc-pascal] howto find alternatives for deprecated fucntions?

2015-09-28 Thread Klaus Hartnegg
What can I use instead of Sock2Text? That's also deprecated. Am 16.09.2015 um 16:50 schrieb Klaus Hartnegg: www.freepascal.org/docs-html/rtl/sockets/accept.html says that accept is deprecated. Whould I switch to fpaccept eventhough that can do a lot less? I hope that Sock2Text works

Re: [fpc-pascal] Variable Initialization Questions

2016-02-22 Thread Klaus Hartnegg
Am 18.02.2016 um 21:38 schrieb Jonas Maebe: all global variables are always zeroed. but it is better to not rely on it because Local variables are never zeroed and it is not uncommon that a part from main gets moved to a procedure, and all of a sudden you must add commands to initialize

[fpc-pascal] fpSelect fails with UDP sockets?

2016-04-01 Thread Klaus Hartnegg
Hello, Does fpSelect not work with UDP sockets? It always returns 0, which means it did not see a packet. Is anything wrong with this code? Uses UnixType, BaseUnix, Sockets; procedure abort (reason:string); begin writeln (reason); halt; end; var sock: cint; adr : {TInet}SockAddr;

Re: [fpc-pascal] SOLVED fpSelect fails with UDP sockets?

2016-04-03 Thread Klaus Hartnegg
It works with rc := fpSelect (sock+1,@FDS,nil,nil,5000); I did not understand the description of the first argument in the docs, so I used the value from the sample, this was not a good idea. For reference here is the source that works: Uses UnixType, BaseUnix, Sockets; procedure abort

Re: [fpc-pascal] SOLVED fpSelect fails with UDP sockets?

2016-04-03 Thread Klaus Hartnegg
Am 03.04.2016 um 18:32 schrieb Klaus Hartnegg: dadr.sin_addr.s_bytes[1] := 127; dadr.sin_addr.s_bytes[2] := 0; dadr.sin_addr.s_bytes[2] := 0; dadr.sin_addr.s_bytes[2] := 1; The array index numbers are of course garbage (from incomplete copy editing), but somehow it worked

Re: [fpc-pascal] FreePascal Windows - Force files to write to disk

2017-02-23 Thread Klaus Hartnegg
Am 21.02.2017 um 22:12 schrieb James Richters: Assign(BitFile,'BitSave.pax'); {$I-} ReWrite(BitFile); if ioresult <> 0 then writeln ('error opening pax file'); WriteLn(BitFile,XADJ:1:8); WriteLn(BitFile,YADJ:1:8); WriteLn(BitFile,ZADJ:1:8); WriteLn(BitFile,WADJ:1:8);

Re: [fpc-pascal] FreePascal Windows - Force files to write to disk

2017-02-23 Thread Klaus Hartnegg
Am 22.02.2017 um 21:27 schrieb James Richters: Here is the procedure that reads the file. Also you could always try to immediately read the file each time it has been modified. Append a log entry to some other file, telling that the pax file was modified and whether it was still correct.

Re: [fpc-pascal] FreePascal Windows - Force files to write to disk

2017-03-22 Thread Klaus Hartnegg
Am 21.03.2017 um 19:58 schrieb James Richters: Does anyone know of a way to force critical data to be written to a SSD so it's not lost during a power failure? Here is a unix-like sync command for windows: https://technet.microsoft.com/sv-se/sysinternals/bb897438(en-us).aspx

[fpc-pascal] FP IDE browse-function (search symbol) errors

2018-06-08 Thread Klaus Hartnegg
Hi, I'm struggling with two issues with the Search,Symbol (Browse) function of the FreePascal IDE. Are these known issues, or is something wrong with how I installed or configured FreePascal? 1: With duplicate names it always shows the results for the one which was declared first.

[fpc-pascal] round(2.5)=2

2018-06-08 Thread Klaus Hartnegg
Hi, The round function behaves different than in TurboPascal, and its English Wiki page differs from the German page. When given an argument halfway between to integers, FreePascal rounds to the nearest even number, TurboPascal always rounds up (except when it is set to mode $N+, but

Re: [fpc-pascal] round(2.5)=2

2018-06-12 Thread Klaus Hartnegg
Am 12.06.2018 um 09:01 schrieb Mattias Gaertner: IMHO this is not really relevant, as relying on the exact value of a real number is erroneous, anyway. So a real number never can be considered to *exactly* *be* 1.5, but just somewhere nearby, and hence it's not legal to predict hat it is rounded

Re: [fpc-pascal] round(2.5)=2

2018-06-12 Thread Klaus Hartnegg
Am 12.06.2018 um 23:24 schrieb Jonas Maebe: On 12/06/18 23:12, Klaus Hartnegg wrote: This behaviour does have advantages in the special case of adding up many rounded numbers, but it ruins the graphics output of my software. It should at least be configurable. And in {$mode tp} it should

Re: [fpc-pascal] round(2.5)=2

2018-06-12 Thread Klaus Hartnegg
Am 11.06.2018 um 10:01 schrieb Michael Schnell:  - the way of rounding is defined by the CPU hardware, even old Turbo Pascal executables do banker's rouding on modern hardware. No, it does not depend on the hardware, but on the setting of $N. Turbo Pascal with $N+ rounds like FreePascal. But

[fpc-pascal] howto print hires-graphics in windows?

2018-05-03 Thread Klaus Hartnegg
Hi, I want to draw simple line graphics both on screen and printer (full page, with ~300dpi). What is the easiest way to achieve this in FreePascal (not Lazarus)? Maybe a graph-unit that outputs to GDI? thanks, Klaus ___ fpc-pascal maillist -

Re: [fpc-pascal] Prorammatically sending file using HTTP POST?

2018-05-03 Thread Klaus Hartnegg
Am 04.04.2018 um 13:50 schrieb Bo Berglund: By the way, I am using the Indy10 components via the indylaz package. Lazarus is 1.8.0 and FPC 3.0.4 on Windows7. If anybody wants to do this just with winsock: const dstport = 80; http_path = '/post.php'; type Int32 = Longint; function