Re: [fpc-pascal] Open vs dynamic arrays

2012-04-22 Thread cobines
: procedure ClrDebug(const panels: array of integer); -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Open vs dynamic arrays

2012-04-22 Thread cobines
ClrDebug(panels[i]) calls itself again and not procedure ClrDebug(panel: integer)... So stack overflow happens. If you need it only for integers then declare it as: procedure ClrDebug(const panels: array of integer) -- cobines ___ fpc-pascal

Re: [fpc-pascal] Passing a string to open array of string

2012-03-31 Thread cobines
2012/3/31 Jonas Maebe : > > On 31 Mar 2012, at 12:07, cobines wrote: > >> The following program compiles and correctly prints 'something'. Is it >> something supported or a bug? > > It is supported. Even Turbo Pascal already supported passing a single element

[fpc-pascal] Passing a string to open array of string

2012-03-31 Thread cobines
WriteLn(s[0]); end; var s: string = 'something'; begin Proc(s); end. -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Pointer to temporary string

2012-03-11 Thread cobines
OK. Thanks, Jonas. I'll save a link to this message this time. -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Pointer to temporary string

2012-03-11 Thread cobines
+Ord('a'))); end; var p1,p2,p3: PChar; begin Randomize; p1 := PChar(GetNew); p2 := PChar(GetNew); p3 := PChar(GetNew); WriteLn(string(p1)); WriteLn(string(p2)); WriteLn(string(p3)); end. -- cobines ___ fpc-pascal

Re: [fpc-pascal] How to get path to current theme icons on linux?

2012-01-19 Thread cobines
src/platform/upixmapmanager.pas Once you have MIME name look here how to find the icon location in the icon theme: http://doublecmd.svn.sourceforge.net/viewvc/doublecmd/trunk/src/platform/uicontheme.pas -- cobines ___ fpc-pascal maillist - fpc-pascal@

Re: [fpc-pascal] How to get path to current theme icons on linux?

2012-01-11 Thread cobines
Take a look at the unit here: http://doublecmd.svn.sourceforge.net/viewvc/doublecmd/trunk/src/platform/unix/uunixicontheme.pas -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] parent class as a parameter type

2011-11-14 Thread cobines
Works for me: program a; {$mode objfpc}{$H+} uses Classes; procedure foo(AClass: TStrings); begin end; var sl: TStringList; begin foo(sl); end. -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http

Re: [fpc-pascal] [Semi-OT] Git format patches don't seem to work

2011-10-04 Thread cobines
I'm sure it is because patch contains non CRLF linefeeds, as I had such errors previously, not even using Git. It seems the "patch" binary only supports Windows EOLs. -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.free

Re: [fpc-pascal] Linux - ExecuteProcess versus fpSystem

2011-09-17 Thread cobines
ot;eter3 3: parameter'4 There is a good guide here which I used for similar purpose: http://www.grymoire.com/Unix/Quote.html -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] File monitoring Linux

2011-09-13 Thread cobines
ousands of directories. -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Converting String to array of Char generates duplicate local var

2011-09-02 Thread cobines
data twice and as you see array is quite big. Is it not possible to write directly to 4(%ebx)? FPC 2.7.1 i386-Linux -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Linking generics with long names with STABS gives Undefined Symbol

2011-08-10 Thread cobines
inking is successful. Is this some limitation of STABS or a bug? My platform is Windows XP SP3 i386. FPC 2.7.1 r18142. -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Problem with virtual constructors

2011-06-01 Thread cobines
e as param : Constructor Create(Const aOwner : TTreeNodeWithProperties); Overload; then if you're passing TTreeNode objects to TTreeNodeWithProperties constructor it will only call the base constructor. -- cobines ___ fpc-pascal maillist - fpc-pa

Re: [fpc-pascal] Re: Register variables slowing down floating point operations

2011-05-13 Thread cobines
at least for variable "i" (Integer). Int64 "max" is stored in two registers so it is still handled the same way. -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Re: Register variables slowing down floating point operations

2011-05-13 Thread cobines
2011/5/13 Ben : > On 12/05/2011 20:54, cobines wrote: >> >> I'm running it on Windows XP i386, compiled with FPC 2.5.1 17430. >> > > > I tried this on my system which runs 64-bit Linux with FPC 2.4.3 (64-bit). > > Using -O, -O2 or -O3 command line

[fpc-pascal] Register variables slowing down floating point operations

2011-05-12 Thread cobines
t can be rectified in the optimizer, or is it one of those things that you just have to be aware of? I have only found that disabling optimizations {$OPTIMIZATION OFF} ... {$OPTIMIZATION DEFAULT} helps, but you have to do it for the entire function. -- cobines __

Re: [fpc-pascal] generic, specialize keywords in mode delphi in FPC trunk

2011-04-11 Thread cobines
2011/4/12 Paul Ishenin : > 12.04.2011 4:22, cobines wrote: >> >> Hello. >> >> Following program: >> >> program a; >> {$mode delphi} >> type >>   generic TGen  = class end; >>   TSpc = specialize TGen; >> begin >> end. >

[fpc-pascal] generic, specialize keywords in mode delphi in FPC trunk

2011-04-11 Thread cobines
Is this a conscious change? There is no mention of this on Wiki User Changes 2.4.4 or User Changes Trunk pages. -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Associate initializer value with array item type

2011-03-24 Thread cobines
cket:clRed, ctPants:clBlue, ctShirt:clGreen); Is something like this possible? I know I can assign it at runtime: Colors[ctJacket] := clRed; Colors[ctPants] := clBlue; Colors[ctShirt] := clGreen; But I'm looking for compile time method. -- cobines ___

Re: [fpc-pascal] Merging r.16418 to FPC 2.4.4

2011-03-04 Thread cobines
2011/3/4 Jonas Maebe : > > On 04 Mar 2011, at 10:24, cobines wrote: > >> Is it possible to merge rev. 16418 from trunk to FPC 2.4.4? > > No, see http://bugs.freepascal.org/view.php?id=18831 I see, OK. -- cobines ___ fpc-pascal ma

[fpc-pascal] Merging r.16418 to FPC 2.4.4

2011-03-04 Thread cobines
Hello, Is it possible to merge rev. 16418 from trunk to FPC 2.4.4? http://svn.freepascal.org/cgi-bin/viewvc.cgi?view=rev&revision=16418 -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/list

Re: [fpc-pascal] Casting descendant interface variables to base

2011-01-30 Thread cobines
OK, I understand now. Thank you for explanation. -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Casting descendant interface variables to base

2011-01-30 Thread cobines
n compare interface variables but first I have to bring them to the same interface using "as", for example to IUnknown. -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Casting descendant interface variables to base

2011-01-30 Thread cobines
lly, I'm trying to determine in CopyToInterface function if the parameter points to the same object as Self. -- cobines project1.lpr Description: Binary data ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/

Re: [fpc-pascal] Issue 0012528: TFPList exception with no excpetion stack printed

2011-01-28 Thread cobines
2011/1/28 : > > > On Fri, 28 Jan 2011, cobines wrote: > >> Hello, >> >> Can someone comment on this issue? It still exists in current FPC >> trunk. It seems the patch posted there fixes the issue. Is the patch >> not good? > > The patch is go

[fpc-pascal] Issue 0012528: TFPList exception with no excpetion stack printed

2011-01-27 Thread cobines
Hello, Can someone comment on this issue? It still exists in current FPC trunk. It seems the patch posted there fixes the issue. Is the patch not good? Why is "raise ... at" needed instead of just "raise" ? -- cobines ___ fpc-pas

Re: [fpc-pascal] about dynamic array

2010-05-07 Thread cobines
quot;. Use it like this: uses fgl; type TPIntegerList = specialize TFPGList; var l : TPIntegerList; i : Integer; p : ^Integer; begin l := TPIntegerList.Create; i := 1 ; new(p) ; p^ := i; l.Add(p); p := l[0] ; writeln(p^);

Re: [fpc-pascal] about dynamic array

2010-05-06 Thread cobines
: Integer; begin l := TFPList.Create; index := l.Add(p); p := l[index]; end; You can use it like an array too: var l: TFPList; begin l := TFPList.Create; l.Count := 20; // now you have l[0]..l[19] elements for read/write end; -- cobines __

Re: [fpc-pascal] about dynamic array

2010-05-06 Thread cobines
ly on an array. So access is fast; insertion, deletion not. -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] var parameter

2010-04-30 Thread cobines
gt; changePtrDirect. > > Is this interpretation more or less correct? > How are var parameters actually implemented? > Yes, var parameters are passed by reference (pointer). See here Variable Parameters: http://www.freepascal.org/docs-html/ref/refse59.html. -- cobines ___

Re: [fpc-pascal] pointer magic

2010-04-27 Thread cobines
while traversing the list when you encounter that pointer to next node is nil then you are at the end of the list. -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

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

2010-04-24 Thread cobines
2010/4/24 David Emerson : > move (src.f_data, self.f_data, length(self.f_data) * sizeof(byte)); > I think it should be: SetLength(self.f_data, length(src.f_data)); move (src.f_data[0], self.f_data[0], length(self.f_data) * sizeof(byte)); -- c

Re: [fpc-pascal] ICS

2010-04-10 Thread cobines
b then you can get sources, say from http://www.zlib.net/ and rebuild using MinGW into a library, then link with this library. -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Reference Counting

2010-04-04 Thread cobines
isting object and you can use assigned to check it, Pest would be a dangling pointer and should not be accessed. I attached sample code with interfaces for you. -- cobines project1.lpr Description: Binary data ___ fpc-pascal maillist - fpc-pas

Re: [fpc-pascal] -Twin32 linker woes

2010-03-11 Thread cobines
Shouldn't the import library for "XXX.dll" be named "libXXX.a"? I remember that linking to ".lib" didn't work for me, but to ".a" did. -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepasca

Re: [fpc-pascal] Linking statically C code with stdcall functions

2010-03-05 Thread cobines
this decoration because on Win64 it is not applied (I don't know if only by GCC or other compilers too) and thought maybe FPC would do this for me. But I guess I can use {$IFDEF}'s and just put different names on Win32 and Win64. -- cobines __

Re: [fpc-pascal] Linking statically C code with stdcall functions

2010-03-05 Thread cobines
2010/3/5 Jonas Maebe : > > On 05 Mar 2010, at 06:36, cobines wrote: > >> Is there a way I can declare the external function to use "C" style >> mangling? > > That's currently only possible if the function also uses the C calling > convention. Ah,

[fpc-pascal] Linking statically C code with stdcall functions

2010-03-04 Thread cobines
an declare the external function to use "C" style mangling? -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Sets & FPC

2010-02-20 Thread cobines
odSelected in state then begin // My Code end; Maybe you meant to declare 'state' as a set. -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Exec(), Linux, and /dev/null redirection

2010-02-16 Thread cobines
test output 's' pclose(f); end else error := fpgeterrno; // failed end; This puts stdout and stderr into one pipe however. There must be some way to read from stdout and stderr separately, maybe using TProcess, but I've never needed it so I don't know how. -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] ReadXMLFile() fails reading a xml file

2010-02-02 Thread cobines
2010/2/2 Lee Jenkins : > Isn't it supposed to assume utf-8 if no encoding processing instruction is > present in the XML doc?  I thought I read that somewhere... It is supposed to look at "encoding" value, then BOM and if both are not present assu

Re: [fpc-pascal] Assigning class method to procedure of object via class name in delphi mode

2010-01-26 Thread cobines
not a bug, since I never used Delphi. Thanks for explanation. -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Assigning class method to procedure of object via class name in delphi mode

2010-01-25 Thread cobines
This works fine CM.Callback := CM.ContextMenuSelect; CM.Callback(CM); // This causes crash // Should this be allowed to assign? CM.Callback := TContextMenu.ContextMenuSelect; CM.Callback(CM); CM.free; end. -- cobines ___ fpc-pascal maillist - f

Re: [fpc-pascal] RTTI Bug or something else i did wrong...

2010-01-15 Thread cobines
did wrong ? Maybe there was an exception raised in the constructor in which case destructor is called automatically. And in destructor you may be accessing fTypeData without it being initialized. Try adding: if Assigned(fTypeData) and Assigned(fPropList) in destructor. -- cobines _

Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-19 Thread cobines
afe to use with interfaces, ansistrings, dynamic arrays? Should I stop using it this way? -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

2009-11-17 Thread cobines
Can the Fill... functions be changed to have the first parameter "out" instead of "var" ? Surely they don't use it as an input parameter. -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepa

Re: [fpc-pascal] Re: Stack checking in dynamic libraries

2009-11-08 Thread cobines
2009/11/8 Jonas Maebe : > Your problem is that every FPC-compiled library contains its own copy of the > RTL. I hadn't thought of that... It all makes sense now of course. Thanks. -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.fre

[fpc-pascal] Re: Stack checking in dynamic libraries

2009-11-08 Thread cobines
A followup from the previous mail. I have expanded the program to query pthreads library directly for thread's stack info. Here are the results (the lines containing "Pthr" string have values reported by the pthreads library): MainThreadId : 3076675264 < main thread, main program > CurrentThr

[fpc-pascal] Stack checking in dynamic libraries

2009-11-07 Thread cobines
library > shows the same value as in < main thread, main program > and in < main thread, library >. I'd be grateful for any explanations, or any pointers if I'm doing anything wrong. -- cobines checkthreadinfo.lpr Description: Binary data checkthreadinfoV2.lpr De