Re: [fpc-pascal] A cross-architecture Integer type for 32-bit and 64-bit

2010-12-23 Thread Bihar Anwar
Thanks Felipe. - Original Message From: Felipe Monteiro de Carvalho To: FPC-Pascal users discussions Sent: Thu, December 23, 2010 5:00:04 AM Subject: Re: [fpc-pascal] A cross-architecture Integer type for 32-bit and 64-bit PtrUInt or something similar. -- Felipe Monteiro de Carval

[fpc-pascal] A cross-architecture Integer type for 32-bit and 64-bit

2010-12-22 Thread Bihar Anwar
Is there a data typein FPC which is compiled as Cardinal in 32-bit, but compiled as UInt64 in 64-bit? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] stdcall on win64?

2010-09-06 Thread Bihar Anwar
Thanks Florian. :-) - Original Message From: Florian Klämpfl To: FPC-Pascal users discussions Sent: Tue, September 7, 2010 2:01:31 AM Subject: Re: [fpc-pascal] stdcall on win64? Am 06.09.2010 18:27, schrieb Bihar Anwar: > stdcall calling convention is for Win32, right?

[fpc-pascal] stdcall on win64?

2010-09-06 Thread Bihar Anwar
stdcall calling convention is for Win32, right? E.g. function Test: HRESULT; {$IFDEF WIN32}stdcall;{$ENDIF} By using $IFDEF like that, will the code also work in Win64? Thanks in advance. ___ fpc-pascal maillist - fpc-pascal@lists.freep

Re: [fpc-pascal] Recursion optimization by compiler

2010-09-03 Thread Bihar Anwar
O Marco, I love you :-) - Original Message From: Marco van de Voort To: FPC-Pascal users discussions Sent: Fri, September 3, 2010 11:02:52 PM Subject: Re: [fpc-pascal] Recursion optimization by compiler > Second, does FPC understand "tail recursion"? Depends on version, do fpc -i

Re: [fpc-pascal] Recursion optimization by compiler

2010-09-03 Thread Bihar Anwar
September 3, 2010 7:17:57 PM, José Mejuto wrote: > That kind of "optimization" to me only seems interesting in > two possible situations, when calling functions is high > costly or when there is a very limited stack amount (really, > really small). From my point of view if you need more that > 1M

[fpc-pascal] Recursion optimization by compiler

2010-09-03 Thread Bihar Anwar
After my previous post, "TreeView and Nonrecursion", I'd tried to ask the same topics in stackoverflow.com (http://stackoverflow.com/questions/3630047/treeview-control-and-nonrecursion) and I got something new. It is possible to recurse without using up the stack space. Optimizing compilers

Re: [fpc-pascal] TreeView and Nonrecursion

2010-09-02 Thread Bihar Anwar
On September 2, 2010 5:14:50 PM, Juha Manninen wrote: > If your input data contains a string which always > identifies the parent node then you can map the > string -> "parent node" and find it later for adding > a child node. > > Pseudo code again: > ... > ... > If you don't have such ID then

Re: [fpc-pascal] TreeView and Nonrecursion

2010-09-01 Thread Bihar Anwar
On 2 September 2010 3:53:34 AM, Vannus wrote: > i probably shouldn't open my mouth, as i don't quite understand the >question... > > however FRED from the game Freespace let you design missions using a treeview. Just to make my question clear, for example, I can fill a TreeView control with

[fpc-pascal] TreeView and Nonrecursion

2010-09-01 Thread Bihar Anwar
A Newbie question :-) Is it possible to fill TreeView (tree is naturally recursive) with a nonrecursive/iterative thinking paradigm? Are there some good examples regarding this matter in the Internet? I post this question in FPC mailing list because my question actually about filling a "tree" i

Re: [fpc-pascal] methods of an object to create others objects

2010-07-06 Thread Bihar Anwar
Michael, what do you think about the following popular nested try-except-finally construct? try try ... except ... end; finally ... end; My understanding of your last statement is the above construct is superfluous. Did it what you mean? If yes, is it only true in objfpc mode?

Re: [fpc-pascal] [ANN] Beyond Compare 3.2 public beta is available

2010-06-29 Thread Bihar Anwar
Thanks Graeme, please keep inform us about anything special to FPC/Lazarus users. :-) - Original Message From: Graeme Geldenhuys To: Other FPC related discussions. ; Lazarus mailing list ; FPC-Pascal users discussions Sent: Tue, June 29, 2010 2:42:46 PM Subject: [fpc-pascal] [ANN]

Re: [fpc-pascal] Negative RTL Error Codes in Some Platforms

2010-06-10 Thread Bihar Anwar
On June 10, 2010 6:12:42 PM, Tomas Hajny wrote: >OK, this is a slightly different story then. Win32 API function FindFirst >(and thus also the Delphi function FindFirst provided in SysUtils) returns >the "search handle" (positive value) in case of a success and -1 in case >of an error. The implem

Re: [fpc-pascal] Missing GetLastOSError() in DOS and MacOS

2010-06-10 Thread Bihar Anwar
June 10, 2010 3:03:45 PM, Jonas Maebe wrote: >"MacOS" in the RTL stands for "System 7.5 - Mac OS 9.2.x", i.e., the "classic >Mac OS" which preceded Mac OS X. I don't think the sysutils unit was ever completely ported for that platform. Thanks Jonas, your clarification strengthens my thought

Re: [fpc-pascal] Negative RTL Error Codes in Some Platforms

2010-06-10 Thread Bihar Anwar
On June 10, 2010 1:46:39 PM, Tomas Hajny wrote: >If I remember correctly, it's been done in order to differentiate standard >error codes (supposedly cross-platform and mostly inherited from TP/BP) >from all other error codes which may be triggered there and which are >completely platform specif

Re: [fpc-pascal] Missing GetLastOSError() in DOS and MacOS

2010-06-09 Thread Bihar Anwar
On June 10, 2010 1:00:27 PM, Tomas Hajny wrote: >... or whether it should return the last OS error for what OS function invoked recently (also directly without using RTL). Yes, I think this one is agreed with other similar RTL functions. __

[fpc-pascal] Missing GetLastOSError() in DOS and MacOS

2010-06-09 Thread Bihar Anwar
I don't see SysUtils.GetLastOSError() in DOS. Looking at a glance, I think it will be a trivial effort by just returning Dos.DosError variable content. Also, I notice that SysUtils.GetLastOSError() in MacOS is defined but it's implementation is empty. I've no knowledge on MacOS, so my question i

[fpc-pascal] Negative RTL Error Codes in Some Platforms

2010-06-09 Thread Bihar Anwar
I look at the FPC RTL source codes and notice that in some OSes (e.g. OS/2, DOS) every RTL functions which call OS API functions will return the OS error code as a negative number. What is the reason behind this? I don't find such a convention in the official documentation of thouse OSes.

Re: [fpc-pascal] regex vs synregexpr unit

2010-06-06 Thread Bihar Anwar
OK guys, after contemplating all your suggestions, I decide to follow the SynEdit way, that is, synregexpr unit. I suppose this unit tends to get more maintenance in the future. Concerning the C++ PCRE library, it is the most full-featured reg-expr implementation, but calling C++ functions from

Re: [fpc-pascal] regex vs synregexpr unit

2010-06-06 Thread Bihar Anwar
On June 6, 2010 3:06:06 PM, Graeme Geldenhuys wrote: > I have looked into this as well, about 2 months ago. From my initial > research it seems the regex unit included with FCL is not as > feature-complete as the one in SynEdit. On June 6, 2010 3:54:53 PM, Juha Manninen wrote: >I also chose SynEdi

Re: [fpc-pascal] regex vs synregexpr unit

2010-06-05 Thread Bihar Anwar
Schindler Karl-Michael wrote on June 6, 2010 1:09:02 AM: >The pcre library (written in C) has a good reputation. You can get pascal headers from the Project JEDI Code Library (JCL). Wow, that seems a more promising approach in the current time, I'll look on it. Thanks so much. BTW, which approa

[fpc-pascal] regex vs synregexpr unit

2010-06-05 Thread Bihar Anwar
I've search fpc mailing list about this matter, I found they were discussed a long time ago (2006), and I still didn't have a conclusion about which one should be used. I need an advice about which unit should be used in terms of features, speed, etc. Also, if someone here know a better approac

Re: [fpc-pascal] What is the lowest MS-DOS version supported by FPC?

2010-05-17 Thread Bihar Anwar
Tomas Hajny on May 17, 2010 5:43:07 PM wrote: >However, I don't think that anyone tried it with anything older than >MS-DOS 5.0 recently. So, the safe assumption is fpc-compiled programs should run smoothly in at least MS-DOS 5.0. Thanks for the info. >If you really need to use an even older

Re: [fpc-pascal] What is the lowest MS-DOS version supported by FPC?

2010-05-15 Thread Bihar Anwar
Vinzent Höfler on May 16, 2010 3:48:25 AM wrote: >> I've tried googling and searching FPC mailing list for information about >> this one, but I found nothing. >> I just found in http://www.delorie.com/djgpp/v2faq/faq3_1.html that >> DJGPP requires MS-DOS version 3.1 or later. >> >> Would som

[fpc-pascal] What is the lowest MS-DOS version supported by FPC?

2010-05-15 Thread Bihar Anwar
I've tried googling and searching FPC mailing list for information about this one, but I found nothing. I just found in http://www.delorie.com/djgpp/v2faq/faq3_1.html that DJGPP requires MS-DOS version 3.1 or later. Would someone here tell me exactly about lowest MS-DOS version supported by

Re: [fpc-pascal] Does FPC has consts of portable OS error codes?

2010-05-12 Thread Bihar Anwar
leledumbo onMay 12, 2010 3:58:09 PM > Any reason for that? or it is not implemented yet? > For the first one, usually errors in FPCgenerate exception, you can handle > that instead. Yes, as you said "usually", it is not "always". For example, FindFirst() and FindNext return OS dependent error

Re: [fpc-pascal] Does FPC has consts of portable OS error codes?

2010-05-12 Thread Bihar Anwar
Jonas Maebe on May 12, 2010 2:32:18 PM On 12 May 2010, at 05:53, Bihar Anwar wrote: >> As the title says. :-) > No, it doesn't. Any reason for that? or it is not implemented yet? ___ fpc-pascal maillist - fpc-pascal@lists.

Re: [fpc-pascal] Does FPC has consts of portable OS error codes?

2010-05-11 Thread Bihar Anwar
Something like this one: https://libxpl.arsoft.homeip.net/browser/trunk/errormap/xplErrorMap.cpp?rev=70 ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Does FPC has consts of portable OS error codes?

2010-05-11 Thread Bihar Anwar
I mean, for example, are there something like: - fpcError_ERROR_PATH_NOT_FOUND = ESysENOENT in UNIX fpcError_ERROR_PATH_NOT_FOUND = ERROR_PATH_NOT_FOUND in Windows - fpcERROR_FILENAME_EXCED_RANGE = ESysENAMETOOLONG in UNIX fpcERROR_FILENAME_EXCED_RANGE = ERROR_FILENAME_EXCED_RANGE

[fpc-pascal] Does FPC has consts of portable OS error codes?

2010-05-11 Thread Bihar Anwar
As the title says. :-) I mean ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Where is the best place to declare an array?

2010-05-06 Thread Bihar Anwar
Thanks Jose, Werner, and Jonas for the fantastic discussion and explanation. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Where is the best place to declare an array?

2010-05-06 Thread Bihar Anwar
If I remember this correctly, I've formerly ever read somewhere (in my Delphi days) that array should be declared globally (not inside a function or procedure) so that access to the array will be faster. Is this correct? If yes, does this also true in FPC? Thanks in advance. _

Re: [fpc-pascal] dynamic array contents and system.move

2010-05-05 Thread Bihar Anwar
From: Aleksa Todorovic on May 5, 2010 3:13:12 PM >As of copying/moving array elements, why don't you use simple for loop for that? Because of performance optimization. TStringlist.Delete() and TStringlist.InsertItem() itself uses Move() instead of such loop. _

Re: [fpc-pascal] Is this a reference counting bug?

2010-05-02 Thread Bihar Anwar
From: Jonas Maebe, May 2, 2010 7:05:46 PM >And the last one explicitly states "No assumptions should be made about the >number of temporary variables or the time when they are finalized". I see, thanks Jonas for noting that statements. >I know, we've had bug reports about that in the past. "Su

Re: [fpc-pascal] Is this a reference counting bug?

2010-05-02 Thread Bihar Anwar
On May 2, 2010 4:24:37 PM, Jonas Maebe wrote: > The reference counting logic is considered to be an opaque implementation > detail (whose implementation can change at any time). It is undocumented by > design. In fact, it was already documented in detail in FPC Language Reference Guide: 3.2.4

Re: [fpc-pascal] dynamic array contents and system.move

2010-05-02 Thread Bihar Anwar
>>Jürgen Hestermann wrote: >> Although I would have expected that special procedures exist to insert >> and remove array elements so that there is no need to do such things >> manually ... >David Emerson wrote: >These must be written on a case-by-case basis, for each type of array element. >Perhap

Re: [fpc-pascal] Is this a reference counting bug?

2010-05-02 Thread Bihar Anwar
Florian Klaempfl: > FPC and Delphi handle code generation for ref. counted types slightly > different, so there might be cases where the ref. counter differs. As > long as there is no memory leak when the vars are properly used, we > don't consider it as a bug. I see, well, there should be exp

[fpc-pascal] Is this a reference counting bug?

2010-05-01 Thread Bihar Anwar
I found that the last element of a dynamic array starts with reference count = 2 in FPC, but in Delphi is 1. Is this an FPC bug, or FPC implements reference counting differ from Delphi? type PAnsiRec = ^TAnsiRec; TAnsiRec = packed Record Ref, Len : SizeInt; First : Char; end;

Re: [fpc-pascal] Is there a StringRefCount() equivalence?

2010-04-30 Thread Bihar Anwar
boyarintsev To: FPC-Pascal users discussions Sent: Fri, April 30, 2010 3:22:22 PM Subject: Re: [fpc-pascal] Is there a StringRefCount() equivalence? On Fri, Apr 30, 2010 at 7:42 AM, Bihar Anwar wrote: > I hope FPC developers will include StringRefCount() to the RTL. Why would you need that? tha

Re: [fpc-pascal] Is there a StringRefCount() equivalence?

2010-04-30 Thread Bihar Anwar
Thanks Jonas for your advice. - Original Message From: Jonas Maebe To: FPC-Pascal users discussions Sent: Fri, April 30, 2010 2:37:23 PM Subject: Re: [fpc-pascal] Is there a StringRefCount() equivalence? On 30 Apr 2010, at 05:42, Bihar Anwar wrote: > By the way, how do I c

Re: [fpc-pascal] Is there a StringRefCount() equivalence?

2010-04-29 Thread Bihar Anwar
10-04-29 at 10:30 -0700, Bihar Anwar wrote: > Delphi has StringRefCount() function (I'm not aware since what version it was > introduced). I just curious, is there a function equivalent to it in FPC? > Currently, I just steal a portion of code from System unit: > > type

[fpc-pascal] Is there a StringRefCount() equivalence?

2010-04-29 Thread Bihar Anwar
Delphi has StringRefCount() function (I'm not aware since what version it was introduced). I just curious, is there a function equivalent to it in FPC? Currently, I just steal a portion of code from System unit: type PAnsiRec = ^TAnsiRec; TAnsiRec = packed record Ref, Len : SizeInt

Re: [fpc-pascal] Question about Deleting elements in Dynamic Array

2010-04-28 Thread Bihar Anwar
Thank you very much Henry, David, and Vincent. I think, I must go back to the basic of reference counting. Special thanks to David for the detail explanation. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.o

Re: [fpc-pascal] Question about Deleting elements in Dynamic Array

2010-04-27 Thread Bihar Anwar
) );// instead of a := Copy(a, 3, 2); SetLength(a, 2); - Original Message From: dmitry boyarintsev To: FPC-Pascal users discussions Sent: Wed, April 28, 2010 10:31:09 AM Subject: Re: [fpc-pascal] Question about Deleting elements in Dynamic Array On Wed, Apr 28, 2010 at 7:2

Re: [fpc-pascal] Question about Deleting elements in Dynamic Array

2010-04-27 Thread Bihar Anwar
users discussions Sent: Wed, April 28, 2010 4:12:26 AM Subject: Re: [fpc-pascal] Question about Deleting elements in Dynamic Array On 27 April 2010 18:34, Bihar Anwar wrote: > > Would Move() be faster, instead of Copy()? I guess so, have you tried to benchmark? If you really need speed, wh

Re: [fpc-pascal] Question about Deleting elements in Dynamic Array

2010-04-27 Thread Bihar Anwar
- Original Message From: Henry Vermaak To: FPC-Pascal users discussions Sent: Tue, April 27, 2010 10:19:45 PM >I think the right way to do this is: >a := copy(a, 3, length(a) - 3); >Presumably copy optimizes this adequately. Henry ___ Would

[fpc-pascal] Question about Deleting elements in Dynamic Array

2010-04-27 Thread Bihar Anwar
Just say, I have a dynamic array with size=5, and I want to delete elements from the index 0 to 2. Is there a trick (the fastest way) to delete those elements (0 to 2) without moving activities? I've tried to make the dynamic array just pointing to 3rd element and set a new length for it, but f

[fpc-pascal] FindFirst()

2010-04-22 Thread Bihar Anwar
In Windows XP and upper, traversing directories starting from root directory (e.g. D:\) using FindFirst() and FindNext() will fail (ERROR_ACCESS_DENIED) when iteration encounters "System Volume Information" directory. I solved this by ignoring this error code and keep looping. However, I don't k

Re: Re[2]: [fpc-pascal] Initializing a record-type variable to get rid of the false-positive compiler hint

2010-04-15 Thread Bihar Anwar
Thank you very much Jose, that's a detail explanation. Forget my wrong observation before. - Original Message From: José Mejuto To: FPC-Pascal users discussions Sent: Thu, April 15, 2010 10:11:03 PM Subject: Re[2]: [fpc-pascal] Initializing a record-type variable to get rid of the f

Re: [fpc-pascal] Initializing a record-type variable to get rid of the false-positive compiler hint

2010-04-15 Thread Bihar Anwar
Thanks Bart, forget my silly comments before, you did it cleverly. - Original Message From: Bart To: FPC-Pascal users discussions Sent: Thu, April 15, 2010 10:02:33 PM Subject: Re: [fpc-pascal] Initializing a record-type variable to get rid of the false-positive compiler hint > Fil

Re: [fpc-pascal] Initializing a record-type variable to get rid of the false-positive compiler hint

2010-04-14 Thread Bihar Anwar
Thanks for your reply José, but what is the philosophy behind the solution? and What are the reasons for $PUSH and $POP? Also, I tried to remove the $HINTS directive, and it worked fine without it. Could you explain this? - Original Message From: José Mejuto Subject: Re: [fpc-pascal

[fpc-pascal] Initializing a record-type variable to get rid of the false-positive compiler hint

2010-04-14 Thread Bihar Anwar
I still need compiler hint generated by FPC at compiling (I don't want to turn it off), but the hint sometime disturbs me because it's a false-postive detection. Supposing I have a record-type variable, could someone here tell me how to initialize it properly so that FPC could notice the initia

Re: [fpc-pascal] (no subject)

2010-04-12 Thread Bihar Anwar
Thanks very much Bart, Thomas, and Graeme, they're precious information. I even didn't notice about the built-in feature within FPC and Lazarus IDE. Thanks again. - Original Message From: Graeme Geldenhuys To: FPC-Pascal users discussions Sent: Mon, April 12, 2010 8:09:42 PM Subject

Re: [fpc-pascal] (no subject)

2010-04-11 Thread Bihar Anwar
Yes it works, but the {$DEFINE NOFORMSPLEASE} clause must be put in the unit itself. If I put the clause in the first line of my console project, the unit won't catch it. How can I define a compiler directive that can be understood by all units in my project? Anyway, thanks. - Original

Re: [fpc-pascal] (no subject)

2010-04-11 Thread Bihar Anwar
Thanks Bart, I will try it. - Original Message From: Bart To: FPC-Pascal users discussions Sent: Sun, April 11, 2010 4:51:54 PM Subject: Re: [fpc-pascal] (no subject) Simply define the compiler directive NOFORMSPLEASE when compiling your console app. The ProcessMessages is there (I g

[fpc-pascal] (no subject)

2010-04-11 Thread Bihar Anwar
I have the following part of a unit code which can be compiled successfully under a normal GUI application. {$IFNDEF NOFORMSPLEASE} if soProcessMessages in oSearchOptions then Application.ProcessMessages; {$ENDIF} My question is, how can I use this unit from my console application? I k