Re: [fpc-pascal] Floating point question

2024-02-06 Thread Bart via fpc-pascal
On Tue, Feb 6, 2024 at 6:13 PM Rafael Picanço via fpc-pascal wrote: > type > {$IFDEF CPU86}{$IFDEF CPU32} > TLargerFloat = Extended; > {$ENDIF}{$ENDIF} > > {$IFDEF CPUX86_64} > TLargerFloat = Double; > {$ENDIF} Why (re-invent the wheel)? Why not use Math.Float? IIRC then this

Re: [fpc-pascal] Floating point question

2024-01-28 Thread Bart via fpc-pascal
On Sun, Jan 28, 2024 at 10:21 AM Bernd Oppolzer via fpc-pascal wrote: > The problem now is: > > the printout of my value suggest an accuracy which in fact is not there, Which is because I was too lazy to cater for that. Notice the :20:20 in the writeln statement: I tell the compiler how many

Re: [fpc-pascal] Floating point question

2024-01-27 Thread Bart via fpc-pascal
On Sat, Jan 27, 2024 at 6:23 PM Thomas Kurz via fpc-pascal wrote: > Hmmm... I don't think I can understand that. If the precision of "double" > were that bad, it wouldn't be possible to store dates up to a precision of > milliseconds in a TDateTime. I have a discrepancy of 40 seconds here.

Re: [fpc-pascal] Floating point question

2024-01-27 Thread Bart via fpc-pascal
On Sat, Jan 27, 2024 at 1:40 PM Thomas Kurz via fpc-pascal wrote: > 2. According to both C, Sqlite and Excel, the value of "t" in line 41 should > be "8427.0229167". FPC gives me a difference of approximately 39/86400. Again: if I cast all flots involved to double both the result of

Re: [fpc-pascal] Floating point question

2024-01-27 Thread Bart via fpc-pascal
On Sat, Jan 27, 2024 at 1:40 PM Thomas Kurz via fpc-pascal wrote: > My problems are: > > 1. The "writeln" in line 32 correctly prints "0." when (cross-) compiling > to win64, but "39.375" when compiling to win32 (with ppc386). On Win64 all math is done with double precision, on win32 all

Re: [fpc-pascal] case statement

2023-12-14 Thread Bart via fpc-pascal
On Thu, Dec 14, 2023 at 5:01 PM Adriaan van Os via fpc-pascal wrote: > I always use "OTHERWISE instead of ELSE, but that's my personal > preference. +1 Seeing OTHERWISE in source code just makes me smile. -- Bart ___ fpc-pascal maillist -

Re: [fpc-pascal] TPath enhancements (Issue #40513): can somebody test with Delphi 12?y

2023-11-19 Thread Bart via fpc-pascal
Put a new implementation in the bugreport. Did not test the "wah is an illegal chatacter", IMO that should be a seperate issue. Currently based upon these rules: { Concatenates the paths. If one or more of the paths is absolute, it will use the right most absolute path as base path and

Re: [fpc-pascal] TPath enhancements (Issue #40513): can somebody test with Delphi 12?y

2023-11-19 Thread Bart via fpc-pascal
On Sun, Nov 19, 2023 at 3:50 PM Bart wrote: > Thanks again for testing. What about ['c:','a','b'] Does it return c:a\b, or c:\a\b (on Windows), or IOW: does it take into account driveletters? The first one IMO would be correct. -- Bart ___ fpc-pascal

Re: [fpc-pascal] TPath enhancements (Issue #40513): can somebody test with Delphi 12?y

2023-11-19 Thread Bart via fpc-pascal
On Sun, Nov 19, 2023 at 2:31 PM Michael Van Canneyt via fpc-pascal wrote: > > This raises the question what the result of > > TPath.Combine(['a','\b',c'','\d','e']) would be (I would then expect > > either \b\c or \d\e)? > > \d\e > > > > > If ValidateParams is True, will it raise an error on

Re: [fpc-pascal] TPath enhancements (Issue #40513): can somebody test with Delphi 12?

2023-11-19 Thread Bart via fpc-pascal
On Sun, Nov 19, 2023 at 12:59 PM Michael Van Canneyt via fpc-pascal wrote: > The output is in linux.txt and windows.txt Thanks for testing. It seems that it'll pick the last absolute path it finds, not the first one in the argument list. It seems that DoTest('regular 1','a','\b','c'); will

Re: [fpc-pascal] TPath enhancements (Issue #40513): can somebody test with Delphi 12?

2023-11-19 Thread Bart via fpc-pascal
On Sun, Nov 19, 2023 at 11:04 AM Sven Barth via fpc-pascal wrote: > Also: does this depend on the operating system and/or file system? Cause > Linux file systems have different invalid characters (usually only slash and > NUL) than NTFS or FAT. Determining FileSystem at runtime, is that even

[fpc-pascal] TPath enhancements (Issue #40513): can somebody test with Delphi 12?

2023-11-18 Thread Bart via fpc-pascal
Hi, I'm trying to implement the new features that were added in Delphi 12 to TPath. I've made a naive implementation based upon available documentation. Some questions about how it is supposed to behave are missing though: 1. The docs state that an exception is raised if the given paths contain

Re: [fpc-pascal] overriden or not ?

2023-08-18 Thread Bart via fpc-pascal
On Fri, Aug 18, 2023 at 10:21 AM Adriaan van Os via fpc-pascal wrote: > > Is there a way to see if a specific class/object method has been overridden > or not ? There's an example of this in Lazarus Controls unit: // Check if SetTextBuf is overridden, otherwise // we can call RealSetText

Re: [fpc-pascal] Choice of exceptions to use?

2023-06-04 Thread Bart via fpc-pascal
On Sun, Jun 4, 2023 at 11:58 AM Graeme Geldenhuys via fpc-pascal wrote: > Initially I was leaning towards the Range exception, but now I'm > thinking that maybe the Argument exception is more appropriate > (based on the descriptions seen in the linked docs). I would go for range exception,

Re: [fpc-pascal] Size of set.

2023-05-23 Thread Bart via fpc-pascal
On Tue, May 23, 2023 at 2:14 AM Mikael Backman via fpc-pascal wrote: > Is there any way to decide the number of elements in a set? > there any way to traverse the elements in a set? Couldn't you use PopCnt for that? You would need to know the SizeOf() the type of the set in question. --

Re: [fpc-pascal] StrIComp

2023-04-29 Thread Bart via fpc-pascal
On Sat, Apr 29, 2023 at 10:30 PM Thomas Kurz via fpc-pascal wrote: > Is it intentional that StrIComp (from the strings unit) gives an access > violation if one of its arguments is NIL? Yes. Delphi does so too. -- Bart ___ fpc-pascal maillist -

Re: [fpc-pascal] Converting old pascal written for Pascal/MT+ compiler

2023-04-04 Thread Bart via fpc-pascal
On Tue, Apr 4, 2023 at 6:00 PM Tomas Hajny via fpc-pascal wrote: > Well, managed types are not very likely in code imported from a Pascal > compiler not knowing units... Well, his fpc.cfg might define string to be ansistring... -- Bart ___

Re: [fpc-pascal] Converting old pascal written for Pascal/MT+ compiler

2023-04-04 Thread Bart via fpc-pascal
On Tue, Apr 4, 2023 at 9:43 AM Jacob Kroon via fpc-pascal wrote: > What is the technical downside to using "const", or is it just cosmetic ? If your local "writeable constant" is of type string, and strings are longstrings, and the writeable const is assigned a value that is the result of a

Re: [fpc-pascal] possible bug in blockwrite

2023-03-05 Thread Bart via fpc-pascal
On Sun, Mar 5, 2023 at 7:02 PM Travis Siegel via fpc-pascal wrote: > On tp, I could open a file with a blocksize of 1, > > reset(file1,1); > ... > For example. > > Let's say I have a 5 byte string: > > st1 := '12345'; > > Now, if I blockwrite this to the file under tp: > > blockwrite(f1,st1);

Re: [fpc-pascal] For Loop with QWord

2023-01-03 Thread Bart via fpc-pascal
On Tue, Jan 3, 2023 at 3:49 PM James Richters via fpc-pascal wrote: > Var > > I: QWord; > > Begin > > For I := 1 To N Do > It generates an error: > Error: Ordinal expression expected > If I change it to LongInt, then it works, but the question is, why can’t I > use a Qword here if I know I

Re: [fpc-pascal] CodeTools complete code

2022-10-05 Thread Bart via fpc-pascal
On Wed, Oct 5, 2022 at 2:17 PM Hairy Pixels via fpc-pascal wrote: > > CodeTools is part of Lazarus. ... > > Ok thanks. I’m not a Lazarus user so I don’t really follow those forums. > Ok, that makes me kinf of curious wether you and I mean the same when we refer to CodeTools. I mean the part of

Re: [fpc-pascal] CodeTools complete code

2022-10-05 Thread Bart via fpc-pascal
On Wed, Oct 5, 2022 at 8:33 AM Hairy Pixels via fpc-pascal wrote: > Does CodeTools not understand generic class function calls? Here is the class > in question: CodeTools is part of Lazarus. So, better ask on the Lazarus ML. (And yes, CodeTools has problems with generics.) -- Bart

Re: [fpc-pascal] Get highest element of a StringList

2022-09-10 Thread Bart via fpc-pascal
On Sat, Sep 10, 2022 at 6:01 PM James Richters via fpc-pascal wrote: > Is there a way to get the highest element of a stringlist other than: > > For Loop := 0 to MyStringList.Count-1 do You can use the for .. in loop. > It would be nice to not have the -1 > Could High() be made to work if the

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-30 Thread Bart via fpc-pascal
On Mon, May 30, 2022 at 7:25 AM Sven Barth via fpc-pascal wrote: > === code begin === > > Sort(lamba (left, right) as > if left < right then -1 > else if left > right then 1 > else 0); > This doesn't look like Pascal at all. I definitively hope this is not the future of our beautiful

Re: [fpc-pascal] Issue with CSVDocument

2022-02-07 Thread Bart via fpc-pascal
On Mon, Feb 7, 2022 at 9:54 PM James Richters via fpc-pascal wrote: > The part of my program that checks for the BOM is bigger than the actual CSV > read and write. Please let me know if the crash issue with no BOM gets fixed > so I can delete all this stuff that checks for it. That part can

Re: [fpc-pascal] Interface section overload procedures are all public

2022-01-23 Thread Bart via fpc-pascal
On Sun, Jan 23, 2022 at 6:12 PM Rainer Stratmann via fpc-pascal wrote: > // making only one procedure bugtest public in the interface section > // makes all other bugtest procedures public as well! > // Lazarus 2.0.0+dfsg-2 > // FPC-Version: 3.0.4 > // OS: Linux Debian 32 Bit Not so in fpc

Re: [fpc-pascal] StrToInt is using ShortString buffer?

2022-01-13 Thread Bart via fpc-pascal
On Wed, Jan 12, 2022 at 11:33 PM Sven Barth via fpc-pascal wrote: > You can see it in Florian's commit to the branch about range checking where > he added the DestSize parameter. Yes, I discovered that. Will study a bit how this is done, just for the fun of it. -- Bart

Re: [fpc-pascal] StrToInt is using ShortString buffer?

2022-01-12 Thread Bart via fpc-pascal
On Wed, Jan 12, 2022 at 10:28 PM Bart wrote: > Could you naybe point me to where in the compiler this "magic" happens? > (fpc_Val_UInt_Shortstr() signature needs to be changed IMO) Never mind, I just notice a new branch val_range_check was created that just does this. I'll get on trying to fix

Re: [fpc-pascal] StrToInt is using ShortString buffer?

2022-01-12 Thread Bart via fpc-pascal
On Wed, Jan 12, 2022 at 3:13 PM Michael Van Canneyt via fpc-pascal wrote: > From the definition you can see it is a compilerproc function, meaning that > the > compiler writes direct calls to this. > To change the signature of the function means the compiler itself also must > be changed.

Re: [fpc-pascal] Not available duties

2021-12-24 Thread Bart via fpc-pascal
On Fri, Dec 24, 2021 at 12:02 PM Adriaan van Os via fpc-pascal wrote: > I got a message from UPS this morning stating > > "! Duties, taxes, and fees totaling NaN are due for this delivery." > > Oops, I don't hope I will ever get a message from UPS > > "! Duties, taxes, and fees

Re: [fpc-pascal] ExtractStrings by line in Windows

2021-11-04 Thread Bart via fpc-pascal
On Thu, Nov 4, 2021 at 2:52 PM Ryan Joseph via fpc-pascal wrote: > > Maybe use SomeString.Split([LineEnding'], ...)? > > Split has an overload that takes an array of string as first paramter. > > Thanks, I guess I need to use a different way to work on all platforms. If you cast LineEnding to a

Re: [fpc-pascal] ExtractStrings by line in Windows

2021-11-03 Thread Bart via fpc-pascal
On Wed, Nov 3, 2021 at 1:57 PM Hairy Pixels via fpc-pascal wrote: Maybe use SomeString.Split([LineEnding'], ...)? Split has an overload that takes an array of string as first paramter. -- Bart ___ fpc-pascal maillist -

[fpc-pascal] String.Split(const Separators: array of Char; Options: TStringSplitOptions)

2021-09-16 Thread Bart via fpc-pascal
Hi, I must be missing something obvious. But given the following definition of the Split() helper function for strings: Function Split(const Separators: array of Char; Options: TStringSplitOptions): TStringArray; overload; (fpc 3.2.2) Why does this not compile: var SA: TStringArray; ...

Re: [fpc-pascal] How to create AnsiString with specific code page?

2021-09-15 Thread Bart via fpc-pascal
On Wed, Sep 15, 2021 at 12:32 PM Bart wrote: > This should work > > type > StringCP1251 = AnsiString(1251) That should be type StringCP1251 = type AnsiString(1251); -- Bart ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] How to create AnsiString with specific code page?

2021-09-15 Thread Bart via fpc-pascal
On Wed, Sep 15, 2021 at 12:14 PM Abuy via fpc-pascal wrote: > I need string with Windows-1251. Tried var msg: AnsiString(1251) but > this does not work. What I am doing now is This should work type StringCP1251 = AnsiString(1251) var S: StringCP1251; -- Bart

Re: [fpc-pascal] Hello, new Pascal programmer. had a question!

2021-08-31 Thread Bart via fpc-pascal
On Tue, Aug 31, 2021 at 12:23 PM Liam Proven via fpc-pascal wrote: > I've got Lazarus running here and it's more of the same. But I > discovered that I have `fpc` in the terminal and I had a "Hello world" > program running in 30 seconds there... something that took hours in > Delphi.

Re: [fpc-pascal] Hello, new Pascal programmer. had a question!

2021-08-29 Thread Bart via fpc-pascal
On Sat, Aug 28, 2021 at 3:21 PM joseph turco via fpc-pascal wrote: > I am a new programmer, and I thought I'd learn Pascal. You're very welcome. > I saw that with FreePascal, most users are using Lazarus. I don't want to use > this and would rather work in the console, > and use the free

Re: [fpc-pascal] How to get fpc and lazarus sources when svn has shut down?

2021-08-12 Thread Bart via fpc-pascal
On Thu, Aug 12, 2021 at 6:27 AM Michael Van Canneyt via fpc-pascal wrote: > >> As a programmer, switching version systems should be a no-brainer. > > > > My brain begs to differ... > > Well, sorry to say, but I don't understand this. > > What's so hard about it ? > > It's like switching car

Re: [fpc-pascal] How to get fpc and lazarus sources when svn has shut down?

2021-08-11 Thread Bart via fpc-pascal
On Wed, Aug 11, 2021 at 11:37 PM Michael Van Canneyt via fpc-pascal wrote: > As a programmer, switching version systems should be a no-brainer. My brain begs to differ... -- Bart ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

[fpc-pascal] Fwd: Linker error on simple program (windows)

2021-06-24 Thread Bart via fpc-pascal
On Thu, Jun 24, 2021 at 11:10 AM Sven Barth wrote: > Thus for 3.2.0 and 3.2.2 you indeed need to use the workarounds you mentioned. Not a problem. It just surprised me. Will this be fixed in 3.2.4? (The linker error is a bug IMO, compilation should have failed with a sensible message) --

[fpc-pascal] Linker error on simple program (windows)

2021-06-23 Thread Bart via fpc-pascal
Given this unit: unit ExtMath; {$mode objfpc} interface function LeadingZeroBits(n: Byte): Integer; inline; implementation function LeadingZeroBits(n: QWORD; BitSize: Integer): Integer; begin Result := 0; end; function LeadingZeroBits(n: Byte): Integer; begin Result :=

Re: [fpc-pascal] Will the size of an executable depend on the uses clause

2021-06-16 Thread Bart via fpc-pascal
On Wed, Jun 16, 2021 at 5:14 PM Bo Berglund via fpc-pascal wrote: > My use case here is that I created a Windows version of Linux "uptime" by > starting in Lazarus with a new Project and selecting Program. Choose Simple Program from that dialog. No uses clause at all, so everything you need,

Re: [fpc-pascal] TRegistry documentation

2021-06-16 Thread Bart via fpc-pascal
On Wed, Jun 16, 2021 at 2:26 PM Jean SUZINEAU via fpc-pascal wrote: > I think there is a way to do this with a single program. Using Lazarus IDE I tried to set Execution level to "requireAdministrator", but then the program simply would not run (it would not ask for the admin password), so in

Re: [fpc-pascal] TRegistry documentation

2021-06-16 Thread Bart via fpc-pascal
On Wed, Jun 16, 2021 at 2:21 PM Jean SUZINEAU via fpc-pascal wrote: > I guess that what was meaning Bart by hardcat is that you need to > transtype the result this way: > var dw: DWord; > begin > dw:= DWord( Registry.ReadInteger(...)) ; Indeed. This is a lossless operation. -- Bart

Re: [fpc-pascal] TRegistry documentation

2021-06-16 Thread Bart via fpc-pascal
On Wed, Jun 16, 2021 at 9:08 AM James Richters via fpc-pascal wrote: > > >You can have a look too at TRegDataType type, it seems there is nothing > >special for DWord. > > > > I got the list of functions you mentioned in Lazarus.. Here are all the ones > that can read: As I said before, it is

Re: [fpc-pascal] TRegistry documentation

2021-06-15 Thread Bart via fpc-pascal
On Tue, Jun 15, 2021 at 2:44 PM Jean SUZINEAU via fpc-pascal wrote: > I'm not sure which one will best match the DWord type. You'll have to use the Integer / Int64 variant and hardcats it to DWord/QWord. IIRC this is Delphi compatible. Of course it is peanuts to implement Read/WriteD/QWord()

Re: [fpc-pascal] Abstract classes ignored

2021-04-18 Thread Bart via fpc-pascal
On Sun, Apr 18, 2021 at 7:56 PM Travis Siegel via fpc-pascal wrote: >... but the last time I asked them > about pricing, they told me it'd cost $1000 for just delphi 7, and that > only costed $995 when it first came out, nearly 20 years ago. Wow! Long time ago, I bought Delphi2 (it was bundled

Re: [fpc-pascal] Directory Tree

2021-04-06 Thread Bart via fpc-pascal
On Tue, Apr 6, 2021 at 12:29 PM James Richters via fpc-pascal wrote: > Or Am I going to be better off going graphical with Lazarus for something > like this? TShellTreeView in Lazarus should do exactly what you want. It's not console though. -- Bart

Re: [fpc-pascal] Hide warning number

2021-03-25 Thread Bart via fpc-pascal
On Thu, Mar 25, 2021 at 8:08 PM Ryan Joseph via fpc-pascal wrote: > Is there a way to hide a warning for all files from the command line? The > "not inlined" warnings (6058) are too numerous to even be useful anymore so > I'd like to disable it. From my fpc.cfg: #Don't show the "function X;

Re: [fpc-pascal] fpreport: can not use two ObjectLists as datasource in one report

2021-03-19 Thread Bart via fpc-pascal
On Fri, Mar 19, 2021 at 7:14 PM Michael Van Canneyt via fpc-pascal wrote: > > Done: 0038639 , but i am not able to set the severity to 'feature' > > Hm. Strange. I did it for you. This has been disabled for "normal" reporters, since too many reporters marked their reports as major or even

Re: [fpc-pascal] JSONStringToString question

2021-03-14 Thread Bart via fpc-pascal
On Sun, Mar 14, 2021 at 4:15 PM Michael Van Canneyt via fpc-pascal wrote: > Fixed. Thanks for the patch. > There was a second issue, which is now also fixed. You set target to fpc 4.0 The simple patch I made can be backported/merged to 3.2 fixes branch? -- Bart

Re: [fpc-pascal] JSONStringToString question

2021-03-14 Thread Bart via fpc-pascal
On Sun, Mar 14, 2021 at 2:55 PM Bart wrote: > I think I have a fix, will report it. Reported as https://bugs.freepascal.org/view.php?id=38622 Possible patch attached in the bugreport. -- Bart ___ fpc-pascal maillist -

Re: [fpc-pascal] JSONStringToString question

2021-03-14 Thread Bart via fpc-pascal
On Sun, Mar 14, 2021 at 1:49 PM Bart wrote: > Do you know if we have a test suite for this function, so I can test > if there ar regressions when I try to fix it? Found it already. I think I have a fix, will report it. -- Bart ___ fpc-pascal

Re: [fpc-pascal] JSONStringToString question

2021-03-14 Thread Bart via fpc-pascal
On Sun, Mar 14, 2021 at 12:43 AM Michael Van Canneyt via fpc-pascal wrote: > > Do I misunderstand the purpose of this function or is this a bug? > > Seems like a bug. I'll report it then. Do you know if we have a test suite for this function, so I can test if there ar regressions when I try to

[fpc-pascal] JSONStringToString question

2021-03-13 Thread Bart via fpc-pascal
From : https://www.freepascal.org/docs-html/current/fcl/fpjson/jsonstringtostring.html Function result Pascal string with escaped characters replaced {$mode objfpc} {$h+} uses fpjson; var S1, S2: TJSONStringType; begin repeat write('S: ');readln(S2); S1 :=

Re: [fpc-pascal] Unicode chars losing information

2021-03-07 Thread Bart via fpc-pascal
On Sun, Mar 7, 2021 at 5:31 PM Marco van de Voort via fpc-pascal wrote: > Probably it is not in the BMP and thus needs more position than one. Length(Char) is 5 according to fpc, I see 5 "graphemes", which suggest that all of them fit into 1 WideChar? -- Bart

Re: [fpc-pascal] Windows Defender considers fp.exe a malicious program

2021-02-12 Thread Bart via fpc-pascal
On Fri, Feb 12, 2021 at 9:10 AM Alexander Bunakov via fpc-pascal wrote: > As of trunk r48648, Windows Defender deletes fp.exe after compilation > because it considers it an infected file. It claims that fp.exe is > infected with Trojan:Win32/Fuerboos.E!cl and quarantines the file. I exclude the

Re: [fpc-pascal] Question about System.Move()

2021-01-13 Thread Bart via fpc-pascal
On Sun, Jan 10, 2021 at 12:09 PM Sven Barth via fpc-pascal wrote: > If after the Move only one of the two references is reachable anymore > (because e.g. some internal count variable "ends" the array before that > element) then you don't need to care about increasing the reference > count, cause

Re: [fpc-pascal] Question about System.Move()

2021-01-11 Thread Bart via fpc-pascal
On Sun, Jan 10, 2021 at 12:09 PM Sven Barth via fpc-pascal wrote: > If after the Move only one of the two references is reachable anymore > (because e.g. some internal count variable "ends" the array before that > element) then you don't need to care about increasing the reference > count, cause

Re: [fpc-pascal] Question about System.Move()

2021-01-09 Thread Bart via fpc-pascal
On Sat, Jan 9, 2021 at 8:14 PM Yuriy Sydorov via fpc-pascal wrote: > > So, I'll use a for loop to copy the data. > > > > I assume that doing Arr[Index] := Default(T) will also finalize the > > element if that element ismanaged? > > For class object instances call Arr[Index].Free, for other

Re: [fpc-pascal] Question about System.Move()

2021-01-09 Thread Bart via fpc-pascal
On Sat, Jan 9, 2021 at 5:12 PM Yuriy Sydorov via fpc-pascal wrote: > > 2. Is it OK if the elements of the array are (or contain) managed types? > > You need to manually finalize/free elements which are overwritten before > calling Move. So, if I move Arr[3] to Arr[1], I first have to

[fpc-pascal] Question about System.Move()

2021-01-09 Thread Bart via fpc-pascal
Hi, This may be a silly question. I use System.Move() to move items in a dynamic array, like Move(FData[0], FData[OldEnd], FStart*SizeOf(T)); Where T is the type of the elements in the array. This seems to work as expected. I have some questions though: 1. Does this depend on the alignment of

Re: [fpc-pascal] Avoiding File conflicts

2021-01-05 Thread Bart via fpc-pascal
On Tue, Jan 5, 2021 at 3:30 PM wkitty42--- via fpc-pascal wrote: > provided the other program opens the file for creation properly (eg: > blahDenyAll), right? Maybe use fmShareExclusive when opening the file. That name suggest you can only open if you are the only one? -- Bart

Re: [fpc-pascal] Avoiding File conflicts

2021-01-04 Thread Bart via fpc-pascal
On Mon, Jan 4, 2021 at 3:19 AM James Richters via fpc-pascal wrote: > I suspect that I happen to see the file is there and try to read it before > the program that created the file is done writing it. > What is the proper way to detect the file is in use so I don't bother trying > to open it

Re: [fpc-pascal] I'm working on automated Help Output for console apps

2020-11-20 Thread Bart via fpc-pascal
On Fri, Nov 20, 2020 at 7:21 PM Sven Barth via fpc-pascal wrote: >> You know that fpc trunk now supports coloured output of the compiler >> (messages)? > > > Only on *nix and those versions of Windows 10 that support VT100 codes. > I know, and there he can see how this capability is detected,

Re: [fpc-pascal] I'm working on automated Help Output for console apps

2020-11-20 Thread Bart via fpc-pascal
On Fri, Nov 20, 2020 at 4:38 PM Graeme Geldenhuys via fpc-pascal wrote: > We often have color output and > full Unicode support - so we can output color and emojis to highlight certain > success > or error states in the output. It would be nice to incorporate that into > command > line help

Re: [fpc-pascal] Adding file to string to the RTL

2020-10-06 Thread Bart via fpc-pascal
On Tue, Oct 6, 2020 at 10:12 AM Michael Van Canneyt via fpc-pascal wrote: > // Assume TEncoding.SystemEncoding > Function GetFileAsString(Const aFileName : RawByteString) : RawByteString; > // Specify encoding > Function GetFileAsString(Const aFileName : RawByteString; aEncoding : > TEncoding)

Re: [fpc-pascal] basic question on begin, end;

2020-09-23 Thread Bart via fpc-pascal
On Wed, Sep 23, 2020 at 4:25 PM dano none via fpc-pascal wrote: for i := start to stop do for j := start2 to stop 2 do CompoundStatement if functionally the same as for i := start to stop do begin for j := start2 to stop 2 do CompoundStatement end; A Compound Statement is a statement that

Re: [fpc-pascal] String literals and code page of .pas source file

2020-09-09 Thread Bart via fpc-pascal
On Wed, Sep 9, 2020 at 5:25 PM Tomas Hajny via fpc-pascal wrote: > A simple question - is TLabel.Caption declared as Utf8String No. -- Bart ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] String literals and code page of .pas source file

2020-09-09 Thread Bart via fpc-pascal
On Wed, Sep 9, 2020 at 8:37 AM LacaK via fpc-pascal wrote: > I am still confused how this CodePage aware stuff is expected to work and > when implicit conversios are included (as far as I understand here ONLY > declared/static codepage plays role) and when dynamic codepage is taken into >

Re: [fpc-pascal] How reliable are Hashlists in Contnrs

2020-08-24 Thread Bart via fpc-pascal
On Mon, Aug 24, 2020 at 9:25 PM Lars via fpc-pascal wrote: > Is there a such thing as a perfect hashlist which never has a collision, No, there are infinite possible items you can add to a haslist, but only a finite number of available hashes. It's the pigeon hole principle:

Re: [fpc-pascal] Is there a FindAllDirs command like FindAllFiles?

2020-07-25 Thread Bart via fpc-pascal
On Sat, Jul 25, 2020 at 12:24 AM Bo Berglund via fpc-pascal wrote: > But I would like to enumerate the subdirectories themselves (without > the content). Take a look at how FindAllFiles is implemented. It should be relatively easy to modify it so that it discards files and only adds folders to

Re: [fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

2020-05-13 Thread Bart via fpc-pascal
On Wed, May 13, 2020 at 10:40 AM Noel Duffy via fpc-pascal wrote: > > And maybe change the var into an out I agree, it gives unnecessary warning about uninitialized variables. > As I've already learned the hard way, the sockets unit is compiled in > "fpc" mode, so there's no "out" parameters.

Re: [fpc-pascal] Compiler mode for code in rtl and rtl-extra

2020-05-11 Thread Bart via fpc-pascal
On Mon, May 11, 2020 at 9:30 AM Michael Van Canneyt wrote: > You are correct. The unit is compiled in fpc mode, which means no "result" > variable, no out param (replace with var). > > We can envision changing this mode, but then the whole unit needs to be > verified and checked for correct

Re: [fpc-pascal] FPCMake and Makefile.fpc question

2020-05-06 Thread Bart via fpc-pascal
On Wed, May 6, 2020 at 8:03 AM Sven Barth via fpc-pascal wrote: > Not in the makefile.fpc, That is unfortunate. > but fpcmake allows you to pass a list of supported targets (usually -Tall is > used to allow all targets), but you'd need to pick each one. This does mean > however that everyone

Re: [fpc-pascal] Different behaviour between FPC 2.6.4 and FPC 3.0.4

2020-05-05 Thread Bart via fpc-pascal
On Tue, May 5, 2020 at 10:05 PM Rainer Stratmann wrote: > Did I overlooked something? Your function returns a functiontype? Is that intended? -- Bart ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

[fpc-pascal] FPCMake and Makefile.fpc question

2020-05-05 Thread Bart via fpc-pascal
Hi, Here's the first line of the Lazarus Makefile: - # # Don't edit, this file is generated by FPCMake Version 2.0.0 # default: all MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris

Re: [fpc-pascal] PLEASE I NEED AN URGENT HELP, cant run Bundle.sh Succefully.

2020-04-06 Thread Bart via fpc-pascal
On Mon, Apr 6, 2020 at 2:28 PM mr.jenuine mr.jenuine via fpc-pascal wrote: > ... but when i run the bundle.sh i get error warning as shown below; You run a linux shell script in Windows? -- Bart ___ fpc-pascal maillist -

Re: [fpc-pascal] Why external execution so slow? (fixed)

2020-04-01 Thread Bart via fpc-pascal
On Wed, Apr 1, 2020 at 5:22 PM Marco van de Voort wrote: > I think I'll put this under a special porunidle option in trunk and fpc > 3.2.0 , so to only trigger this when needed. Hmm.. porunidle -> poRunIdle (to be consistent in namegiving)? Bart -- Bart

Re: [fpc-pascal] Range check error warning.

2020-03-25 Thread Bart via fpc-pascal
On Wed, Mar 25, 2020 at 10:30 PM wrote: > what? you don't like laughing bearded guys? LUL means penis (and I'm putting it nicely here) in Dutch. Google translate translates it as either asshole (anatomically rahter incorrect), cock, or prick. -- Bart

Re: [fpc-pascal] Range check error warning.

2020-03-25 Thread Bart via fpc-pascal
On Wed, Mar 25, 2020 at 7:48 PM wrote: > [wargames] seems like the winning move is to not play the game. [/wargames] > LUL LUL ?? What does that stand for? Better not say that to someone who speaks Dutch (like me) ;-)) -- Bart ___ fpc-pascal

Re: [fpc-pascal] Range check error warning.

2020-03-24 Thread Bart via fpc-pascal
On Tue, Mar 24, 2020 at 6:00 PM fredvs via fpc-pascal wrote: > OK, I stop. This works? {$mode objfpc} {$apptype console} const foldhiddenbit = byte(7); foldhiddenmask = byte(1 shl foldhiddenbit); currentfoldhiddenbit = byte(6); currentfoldhiddenmask = byte(1 shl currentfoldhiddenbit);

Re: [fpc-pascal] Operator precendence of ^

2020-03-16 Thread Bart via fpc-pascal
On Mon, Mar 16, 2020 at 8:31 AM Maël Hörz wrote: > But I could not find any mention of the derefence operator ^. As was explained to you in https://forum.lazarus.freepascal.org/index.php/topic,48911.0.html, the dereferencing a pointer (by using ^) isn't an operator. -- Bart

Re: [fpc-pascal] fpc trunk = Operator is not overloaded: "Class Of TBlobField" and "Boolean"

2020-03-08 Thread Bart via fpc-pascal
On Sun, Mar 8, 2020 at 3:59 PM fredvs via fpc-pascal wrote: > To resume, the problem comes from "if fld1 is tblobfield". No, you miss the point: > if fld1 is tblobfield and (self.fblobintf <> nil) then begin This will not compile anymore since the operator precedence of IS has been altered

Re: [fpc-pascal] ptop and comma.

2020-02-24 Thread Bart via fpc-pascal
On Mon, Feb 24, 2020 at 10:11 AM Sven Barth via fpc-pascal wrote: > You are wrong. Halt() sets the error code provided as parameter. Terminate by > itself does not. > Terminate leads to the destructor being called while Halt exists the program > in a hard way. But as Tomas wrote, when a

Re: [fpc-pascal] TProcess and zombie processes in *nix systems

2020-01-21 Thread Bart via fpc-pascal
On Tue, Jan 21, 2020 at 9:41 PM Graeme Geldenhuys wrote: > 2. Anybody else experience this zombie processes hanging > around in *nix systems? Is there any option in TProcess > to prevent that? https://bugs.freepascal.org/view.php?id=11797 -- Bart

Re: [fpc-pascal] TIniFile.WriteString gives file with BOM, bad

2020-01-10 Thread Bart via fpc-pascal
On Fri, Jan 10, 2020 at 11:30 PM AlexeyT via fpc-pascal wrote: > Can you add TIniFile.WriteBom property? it's not quite enough, I need to > disable it globally in entire app (I have ~10 ini objects), so > additional global default is needed (like Lazarus has global variables). Open a ticket in

Re: [fpc-pascal] TIniFile.WriteString gives file with BOM, bad

2020-01-10 Thread Bart via fpc-pascal
On Fri, Jan 10, 2020 at 5:57 PM AlexeyT via fpc-pascal wrote: > 1) don't write BOM via WriteString It doesn't AFAICS. The BOM is written in UpdateFile. > 2) if BOM is there, allow ReadString to find section at the file begin: > BOMCHARS[ref] I can read/write IniFiles with BOM with fpc

Re: [fpc-pascal] TIniFile.WriteString gives file with BOM, bad

2020-01-10 Thread Bart via fpc-pascal
TIniFile manually adds the BOM to the first Line. Then SaveToFile is called, which (if FEncoding = Utf8) will add the BOM again? Bart ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

[fpc-pascal] StringList encoding question

2019-12-22 Thread Bart via fpc-pascal
Hi, Consider this code: {$codepage utf8} {$mode objfpc} {$H+} uses SysUtils, Classes; var SL: TSTringList; S: String; begin writeln('DefaultSystemCodePage = ',DefaultSystemCodePage); SL := TStringList.Create; {$if fpc_fullversion > 30200} SL.WriteBom := False; {$endif}

Re: [fpc-pascal] Strange experience with TJsonConfig.Clear

2019-11-23 Thread Bart via fpc-pascal
On Sat, Nov 23, 2019 at 7:47 PM Bart wrote: As I was afraid: User error! Cfg.JSONOptions := Cfg.JSONOptions + [joIgnoreTrailingComma]; This forces a reload of the file (since Filename isn't empty at this point). (B.t.w. fpc trunk raise an error : An unhandled exception occurred at $00438A84:

[fpc-pascal] Strange experience with TJsonConfig.Clear

2019-11-23 Thread Bart via fpc-pascal
Hi, I experienced some strange behaviour with TJSONConfig.Clear. I'm using fpc 3.0.4 32-bit on Win10-64. (While I do have fpc trunk as well, the program is a Lazaurs GUI program and I don't like using Lazarus (trunk) in combination with fpc trunk.) I have a TJSONConfig that I use to store