[fpc-devel] Faster InitObject

2012-02-22 Thread Amir
<> @emptyintf then InitInterfacePointers(self,instance); InitInstance:=TObject(Instance); end; My question is do we need to call fillchar in InitInstance? Or Is there any way to avoid calling InitInstance? Amir P.S. I can send you the output of cal

Re: [fpc-devel] Faster InitObject

2012-02-23 Thread Amir
On 02/23/2012 02:59 AM, Hans-Peter Diettrich wrote: Amir schrieb: Hi, I have a code, developed in object pascal, with many classes. The project is working fine. Today, I used callgrind (valgrind --tool=calgrind) to see which function consumes the most execution time and I noticed that the most

Re: [fpc-devel] Faster InitObject

2012-02-23 Thread Amir
. So, I need them in my new NewInstance Implementation, don't I? ppointer(instance)^:=pointer(self); if PVmt(self)^.vIntfTable <> @emptyintf then InitInterfacePointers(self,instance); InitInstance:=TObject(Instance); Amir ___ fpc-devel maill

Re: [fpc-devel] Faster InitObject

2012-02-23 Thread Amir
On 02/23/2012 11:37 AM, Hans-Peter Diettrich wrote: Amir schrieb: Incl. Self. Called Function 29.78 29.72 26M SYSTEM_FILLCHAR$formal$INT64$BYTE 19.07 19.07 123M SYSTEM_MOVE$formal$formal$INT64 3.63 3.63 70M SYSTEM_SYSGETMEM_FIXED$QWORD$$POINTER I suspect that the procedure

Re: [fpc-devel] Faster InitObject

2012-02-23 Thread Amir
On 02/23/2012 02:20 PM, Hans-Peter Diettrich wrote: Amir schrieb: The performance of FillChar is not my problem, The main issue in my case is that my class has a big array defined inside it. I developed my code such that this array does not need to be initialized with zero initially (I have

[fpc-devel] Strange Problem!

2012-04-24 Thread Amir
executed correctly. I am using fpc-2.6.0-1.x86_64 Thanks, Amir ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel

Re: [fpc-devel] Strange Problem!

2012-04-25 Thread Amir
nd I believe it is a bug, isn't it? Amir On 04/25/2012 04:25 AM, Flávio Etrusco wrote: You program isn't valid. You're assigning a constant (a global variable) to Result, so you shouldn't change it's contents through a pointer (if you change it normally the compile

Re: [fpc-devel] Strange Problem!

2012-04-25 Thread Amir
uring the previous execution of your function rather than a series of spaces. Makes sense! Why does fpc consider the constant string ' ' as an ansistring, not a shortstring? What fpc did, in this case, is not what I expected. Amir __

[fpc-devel] What does fpc_ansistr_unique do?

2012-08-31 Thread Amir
Hi, I was profiling my code, that I noticed that there are about 2M calls to fpc_ansistr_unique function (5% of the CPU time). I could not find any reference to what this function does and/or who calls this function. I appreciate any help in this regard. Amir

[fpc-devel] Faster Implementation for IntToStr

2012-09-02 Thread Amir
function. I attached my function, and also a sample code which calls MyIntToStr and IntToStr 1000 times. I used valgrind to compare the performance of the two function. Amir P.S. I understand that my code is not easy to read/understand, but the question is, should the code for a library be

Re: [fpc-devel] Faster Implementation for IntToStr

2012-09-02 Thread Amir
Check the attachments on this email. Amir On 09/02/2012 12:07 PM, Amir wrote: Hi, In one of my project, I have to call IntToStr more than 10M times. I noticed that IntToStr calls Str function. I implemented my own version of IntToStr which is almost twice faster than the current

Re: [fpc-devel] Re: Faster Implementation for IntToStr

2012-09-02 Thread Amir
I could not follow what the code does, as it is in assembly, but it looks like it has the same idea as mine. In general, how can one propose some changes in a library? Should the suggestion goes through this mailing list? Amir On 09/02/2012 05:24 PM, Jonas Maebe wrote: On 02 Sep 2012

[fpc-devel] Creating Generic Object

2018-04-15 Thread Amir
if there is any shorter way to handle the objects' initialization, .e.g., something like   MyMap := auto.Create; Thanks, Amir ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

[fpc-devel] How to force the child's constructor to call its parent constructor

2007-10-21 Thread amir
Is there any way to force the child constructor to call its parent(direct parent) constructor. Consider the following case: TParent= class (TObject) private ID: Integer; public constructor Create (MyIdentifier: Integer); end; I want to force the all childs of TParent to cal

Re: [fpc-devel] How to force the child's constructor to call its parent constructor

2007-10-21 Thread amir
Joao Morais wrote: amir wrote: I want to force the all childs of TParent to call the Create constructor (with appropriate parameter). But one can implement a child class like this: constructor TChild.Create; begin // do any thing but not use inherited. end; No way. But you can

Re: [fpc-devel] How to force the child's constructor to call its parent constructor

2007-10-22 Thread amir
It is a run-time error but what I am looking for is an compile-time error. It is not sensible(for me) to raise an exception because of bad implementation. Thanks for you idea ;) Amir Michael Schnell wrote: Couldn't you check the ID in your after construction event and throw an excepti

[fpc-devel] How to use fpFlock?

2008-05-05 Thread amir
Hi, I have many process wanting to write in a file. Each process is going to open the file as a writeonly (using Assignfile and rewrite or fpOpen with o_WrOnly). But there is a risk that two processes simultaneously trying to write a message in the file. I want to use fpflock to avoid this. I

Re: [fpc-devel] How to use fpFlock?

2008-05-05 Thread amir
d you will access the procedure/function that try to write to the file, and the process that created the mutex is the only one that can write to that file. You of course remove it when you closed the file. Just an idea... Ido On Fri, May 2, 2008 at 5:35 AM, amir <[EMAIL PROTECTED]> wrote:

Re: [fpc-devel] How to use fpFlock?

2008-05-06 Thread amir
r a given file at a given time. LOCK_EX Place an exclusive lock. Only one process may hold an exclusive lock for a given file at a given time. LOCK_UN Remove an existing lock held by this process. Ido On Tue, May 6, 2008 at 9:38 AM, amir <[EMAIL PROTECTED]&

[fpc-devel] FpFlock with Text as argument

2008-05-07 Thread amir
t work and both processes can access the file. Both print "After Flock". Then I modify the code, and used fpopen instead of AssignFile and passed the cInt variable to fpflock . This worked. I attached the codes of both experiments. Amir program FLockTest; uses BaseUnix, U

[fpc-devel] Convert time to GMT

2008-08-13 Thread amir
kernel time which is in GMT). I also found two functions for reading the local timezone but they are located in Unix and OLDUnix units. Do they have an implementation on Windows? Amir ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http

[fpc-devel] Weird problem with Threads!

2009-01-19 Thread amir
Hi, I encountered a very mysterious problem within my code. I have an application which uses threads. There is a class TMyThread which perform some jobs. In the constructor of this class, I set FreeOnTerminate variable to False. My application creates a series for TMyThread, the i-th series i

[fpc-devel] Is the code in wiki correct?

2020-05-08 Thread Amir
'); MyStringList.add('2'); MyStringList.add('3'); result := StringReplace(MyStringList.Text,Lineending,'\n', [rfReplaceAll, rfIgnoreCase]); I believe this is not correct. What if there is a newline(LineEnding) in one of the strings? Best, Amir __

Re: [fpc-devel] Is the code in wiki correct?

2020-05-10 Thread Amir
 Are these functionalities implemented in rtl? On 5/8/20 11:53 PM, Michael Van Canneyt wrote: On Fri, 8 May 2020, Amir wrote: Hi there,   I was looking for a native implementation for JoinStrings and ended up in TStringList-TStrings_Tutorial <https://wiki.freepascal.org/TStringList-TStr

[fpc-devel] How to call (access) to an external procedure!

2006-01-30 Thread Amir Aavani
dear friends, I know that if want to use an external variable/procedure in fpc, i should use the following code: function GetEnvironment (const Name: PChar): PChar; cdecl; external 'c' name 'getenv'; but how could i add for example GetEnvironment function to a class (TEnvironment)! Is the

Re: [fpc-devel] How to call (access) to an external procedure!

2006-01-31 Thread Amir Aavani
e idea for methods is this. Just keep in mind that methods have a hidden parameter Self pointing to the object. When method is declared as cdecl it is the first parameter. Tia, Geno Roupsky В вт, 2006-01-31 в 10:05 +0330, Amir Aavani написа: dear friends, I know that if want to use

[fpc-devel] Calling Web Service from Freepascal

2006-02-03 Thread Amir Aavani
Any one call a webservice (WSDL) from Freepascal. I did it using Delphi, but now i want to do it by freepascal/Lazarus. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel

[fpc-devel] procedure Types

2006-03-04 Thread Amir Aavani
;Procedure (S: String); Object" to TProcedure. The problem is clear but I don't know (can't find) any solution to define TProcedure as a procedure of a class which accepts one argument. Yours Amir ___ fpc-devel maillist - fpc-devel@

Re: [fpc-devel] procedure Types

2006-03-04 Thread Amir Aavani
Thanks to Michael and Christian. It works correctly. I think it could be usefull to put an example for this case in fpc docs. Michael Van Canneyt wrote: On Sat, 4 Mar 2006, Amir Aavani wrote: I have problem with procedure Types. Look at the following code: TProcedure= procedure (S

Re: [fpc-devel] procedure Types

2006-03-13 Thread Amir Aavani
Any idea to call: BeginThread (@MyObject.F1, Pointer (S)) Michael Van Canneyt wrote: On Sat, 4 Mar 2006, Amir Aavani wrote: I have problem with procedure Types. Look at the following code: TProcedure= procedure (S: String); TTest= class MyF: TProcedure; procedure F1 (S: String

[fpc-devel] Lazarus

2006-03-18 Thread Amir Aavani
Is there any example(way) to develop a plugin for lazarus,? for example, adding a new type of application to lazarus with its own properites and ... ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinf

[fpc-devel] Which of them are right (Delphi or FPC)

2006-04-17 Thread Amir Aavani
I developed a project in lazarus (FPC) and now when I try to run it in Delphi, it acts incorrect! I have a class TObjectCollection which is a collection of TObject: TObjectCollection= class (TObject) FMembers: array of TObject; ... ... public property Member [Index: Int

[fpc-devel] Fast Bitmap access

2006-06-21 Thread Amir Aavani
itmap implementation. Amir ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel

Re: [fpc-devel] Fast Bitmap access

2006-06-21 Thread Amir Aavani
EMAIL PROTECTED] Behalf Of Amir Aavani Sent: 21 June 2006 08:51 To: FPC developers' list Subject: [fpc-devel] Fast Bitmap access Hi there, In Delphi, accessing to pixels of a Bitmap image via the property of Pixels is very time-consuming. For fast Bitmap editing, reading usually deve

[fpc-devel] Mutex!

2006-11-04 Thread Amir Aavani
://lists.freepascal.org/lists/fpc-pascal/2006-July/011295.html). Is there any article about it? Yours, Amir ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel

Re: [fpc-devel] Mutex!

2006-11-04 Thread Amir Aavani
Let me explain the problem with more details, consider the following code: while true do begin ReadLn (S); /// Lock Mutex AThread:= TMyThread.Create (True);//Suspended AThread.Prepare (S); AThread.Resume; ///UnLock Mutex end; ... To understand the EnterCriticalsection, I write the followin

Re: [fpc-devel] Mutex!

2006-11-05 Thread Amir Avani
Thanks Michael, you are right! I want to know how should I use Criticalsections to make my program to print only one "here". Michael Müller wrote: > > Am 05.11.2006 um 12:14 schrieb Colin Western: > >> Amir Aavani wrote: >>> InitCriticalSection (

Re: [fpc-devel] Mutex!

2006-11-06 Thread Amir Aavani
; And I told to check if Criticalsession could work in my situation i write that sample code. Any idea for my problem? Vinzent Höfler wrote: Amir Avani wrote: Thanks Michael, you are right! I want to know how should I use Criticalsections to make my program to print only one "here"

[fpc-devel] Com Port

2007-01-16 Thread Amir Aavani
Hi, How can I read/write through Com port by Lazarus/FPC?! Yours, Amir ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel

[fpc-devel] Do we need a TFPGMap.IsSorted method?

2020-09-01 Thread Amir via fpc-devel
getter is implemented as:   if FSorted then Exit(True);   FSorted := IsSortedFunc;   Result := FSorted; Thanks, Amir ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

[fpc-devel] PB2PAS: Proto Compiler for FPC

2021-02-25 Thread Amir via fpc-devel
class destructor?   In the current implementation, the destructor frees the Maps/Lists and all their members. The issue is uncommenting  line 178 of Main.pp (attached) would cause a segfault. I had a couple of ideas about how to handle this, but none of them is perfect. Wondering what you thin

[fpc-devel] Cannot create Merge Request

2024-01-02 Thread Amir--- via fpc-devel
Hi there, I never used gitlab before, so my question might be very stupid! I am trying to follow the instruction here to create a patch. I have created a Feature Request

Re: [fpc-devel] Cannot create Merge Request

2024-01-03 Thread Amir--- via fpc-devel
I do not see the option to upload attach the patch file? On 1/3/24 02:39, Michael Van Canneyt wrote: On Tue, 2 Jan 2024, Amir--- via fpc-devel wrote: Hi there, I never used gitlab before, so my question might be very stupid! I am trying to follow the instruction here <ht

Re: [fpc-devel] Cannot create Merge Request

2024-01-03 Thread Amir--- via fpc-devel
+1 On 1/3/24 21:53, Christo Crause wrote: On Thu, Jan 4, 2024 at 6:18 AM Amir--- via fpc-devel wrote: I do not see the option to upload attach the patch file? In GitLab, scroll down to the bottom of the page showing your issue. There should be an edit box where you can type a new comment