[Lazarus] Possible bug passing a TStringList to a function.

2009-01-19 Thread Dave Coventry
Hi,

If I pass a TStringList to a function:

function TSLFunctn(myTSL: TSltringList):integer;
var i: integer;
begin
Result:=0;
for i:=0 to myTSL.Count-1 do //<---fails here
begin
Result+=strtoint(myTSL.Strings[i]);
end;
end;

The function fails when I try to assign quantify myTSL.Count.

However, this works:

function TSLFunctn(myTSL: TSltringList):integer;
var i: integer;
internalTSL: TStringList;
begin
internalTSL:= TStringList.Create;
internalTSL:=myTSL;
Result:=0;
for i:=0 to internalTSL.Count-1 do //<---works
begin
Result+=strtoint(internalTSL.Strings[i]);
end;
internalTSL.Free;
end;

Is this a bug? Or is that the way it's supposed to behave?
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Passing an array to a function

2009-01-19 Thread Dave Coventry
2009/1/20 Darmawan Sugiarto :
> Can you give more information about your function.

Sure:


function FieldValueAsString(var fsbuffer: TByteBuffer;
fitype,marker,fisize: integer): string;
begin
  case fitype of
43,52,108:Result:=inttostr(LEtoN(PLongint(@fsbuffer[marker])^));
 50:Result:=inttostr(LEtoN(PSmallInt(@fsbuffer[marker])^));
end;
end;

It was failing before it got there, so I don't think the problem was
with the function.

In any case, Martin's suggestion regarding calling the ReadBuffer
function with the first element of the array rather than the pointer
has worked...
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Passing an array to a function

2009-01-19 Thread Darmawan Sugiarto
Can you give more information about your function.

=INTOSOFT

   ALEXIO CHAOS

   darmawan_sugia...@yahoo.com   

  Yahoo Messager

=

--- On Mon, 1/19/09, Dave Coventry  wrote:

From: Dave Coventry 
Subject: [Lazarus] Passing an array to a function
To: laza...@miraclec.com
Date: Monday, January 19, 2009, 6:20 AM

I have a function that I'm trying to pass an array to.

function FieldValueAsString(fsbuffer: array of Byte; fitype,fisize:
integer): string;

Calling the function:

setlength(fsbuffer,recordsize);
FS:=TFileStream.Create(fname, fmshareDenyWrite);
FS.Seek(seekpos,soFromBeginning);
FS.ReadBuffer(fsbuffer,recordsize);
dfstring:= FieldValueAsString(fsbuffer,fitype,fisize);

Generates the error "Project raised exception class SIGSEGV"
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus



  ___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Few features for Lazarus editor

2009-01-19 Thread Hans-Peter Diettrich
ik schrieb:

>>> 1. Multiple spliting (and close the split) the editor to horizontal
>>> and vertical views
>> Better: multiple edit windows, as Delphi has.
> 
> That can work, the thing is, that I really hate jamping using
> bookmarks, and I like to see things in front of me to work better.

I work better when I can place independent windows across the entire 
desktop, including multiple monitors. Splitting a window is not a solution.

DoDi

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Error when create a main window

2009-01-19 Thread Carlos German Tejero
Hi, i'm using lazarus v0.9.27 r18334 i386-win32-win32/win64 and fpc 2.2.3 on
a WindowsXP64.
I try to port a delphi program to lazarus/fpc, but when create then main
window, the program raise an exception.
The exception raise in Win32WSControls unit:


  {$ifdef WindowsUnicodeSupport}
  if UnicodeEnabledOS then
Window := CreateWindowExW(FlagsEx,
PWideChar(WideString(pClassName)),  //<<<--- Return 0
  PWideChar(Utf8Decode(WindowTitle)), Flags,
  Left, Top, Width, Height, Parent, MenuHandle, HInstance, nil)
  else
Window := CreateWindowEx(FlagsEx, pClassName,
  PChar(Utf8ToAnsi(WindowTitle)), Flags,
  Left, Top, Width, Height, Parent, MenuHandle, HInstance, nil);
  {$else}
Window := CreateWindowEx(FlagsEx, pClassName,
  PChar(WindowTitle), Flags,
  Left, Top, Width, Height, Parent, MenuHandle, HInstance, nil);
  {$endif}

  if Window = 0 then
  begin
raise exception.create('failed to create win32 control, error:
'+IntToStr(GetLastError()));  //<<<-- Raise then exception
  end;
...

The attached file "error.txt" is a backtrace.

Any help or suggestion are welcome
Sorry my null english.

-- 
Carlos Germán Tejero
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-mingw32"...
(gdb) break fpc_raiseexception
Breakpoint 1 at 0x40a686
(gdb) run
Starting program: E:\projects\VisualDaVinci2/davinci.exe 
[New thread 3580.0xd58]

Breakpoint 1, 0x0040a686 in fpc_raiseexception ()
(gdb) backtrace
#0  0x0040a686 in fpc_raiseexception ()
#1  0x0052ed25 in FINISHCREATEWINDOW (AWINCONTROL=0x1a4ad8, PARAMS=
  {BUDDY = 0, PARENT = 0, WINDOW = 0, LEFT = -4, TOP = -30, HEIGHT = 120, 
WIDTH = 810, WINDOWINFO = 0x221fcbc, BUDDYWINDOWINFO = 0x1a4bdc, MENUHANDLE = 
0, FLAGS = 114032640, FLAGSEX = 0, SUBCLASSWNDPROC = 0x0, STRCAPTION = 0x0, 
WINDOWTITLE = 0x0, PCLASSNAME = 0x5eaa30 "Window"}, ALTERNATECREATEWINDOW=false)
at win32wscontrols.pp:222
#2  0x00534495 in TWIN32WSCUSTOMFORM__CREATEHANDLE (AWINCONTROL=0x1a4ad8, 
APARAMS=
  {CAPTION = 0x601d08 "", STYLE = 67108864, EXSTYLE = 0, X = 0, Y = 0, 
WIDTH = 802, HEIGHT = 86, WNDPARENT = 0, PARAM = 0x0, WINDOWCLASS = {STYLE = 0, 
LPFNWNDPROC = 0x0, CBCLSEXTRA = 0, CBWNDEXTRA = 0, HINSTANCE = 0, HICON = 0, 
HCURSOR = 0, HBRBACKGROUND = 0, LPSZMENUNAME = 0x0, LPSZCLASSNAME = 0x0}, 
WINCLASSNAME = '\0' }, pvmt=0x152bf0) at win32wsforms.pp:319
#3  0x004a4a1a in TWINCONTROL__CREATEWND (this=0x1a4ad8)
at wincontrol.inc:6589
#4  0x004135c1 in TSCROLLINGWINCONTROL__CREATEWND (this=0x1a4ad8)
at scrollingwincontrol.inc:41
#5  0x00417dcc in TCUSTOMFORM__CREATEWND (this=0x1a4ad8)
at customform.inc:1857
#6  0x00418a79 in TFORM__CREATEWND (this=0x1a4ad8) at customform.inc:2192
#7  0x004a4675 in TWINCONTROL__CREATEHANDLE (this=0x1a4ad8)
at wincontrol.inc:6517
#8  0x004a564a in TWINCONTROL__HANDLENEEDED (this=0x1a4ad8)
at wincontrol.inc:6908
#9  0x0041d43e in TAPPLICATION__CREATEFORM (INSTANCECLASS=, 
REFERENCE=void, this=0x167b48) at application.inc:1851
#10 0x0040295c in main () at davinci.lpr:36___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Few features for Lazarus editor

2009-01-19 Thread Martin Friebe

> On 0.9.27, if you activate a new feature, and you stand on a string,
> it marks all of the matching strings in the same file. It can be very
> helpful if I could fixate such string when I'm looking at the code and
> moving to see where the string in my context appears without the need
> to use search.
>   
It also works with the block selection.

And they key to toggle it is Alt-M (configurable in the options)

more options under "Automatic Features" in the option dialog


___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Few features for Lazarus editor

2009-01-19 Thread ik
On Mon, Jan 19, 2009 at 11:14 PM, Hans-Peter Diettrich
 wrote:
> ik schrieb:
>
>> There are few features that I would like to see in the Lazarus editor:
>>
>> 1. Multiple spliting (and close the split) the editor to horizontal
>> and vertical views
>
> Better: multiple edit windows, as Delphi has.

That can work, the thing is, that I really hate jamping using
bookmarks, and I like to see things in front of me to work better.
Duplicate tabs like with Delphi does not solve it, however it can be
done, if you are capable in doing what the split does (update all fo
the editors with the same content of the file). I tried to do it a
while back, but I wasn't able to achive what I wanted to do.

>
>> 2. VIM keyboard support
>> 3. Ability to have a way to fold code by using comments with special
>> chars (like (* {{{ *) (* }}} ) that VIM allows)
>
> When shall such comments be evaluated?

On the wiki page, I've placed a better way (chars) to do it.

>
>> 4. Multi linguistal spell checkers for strings and comments
>
> Only on demand.

You can install/activate it on demand if you wish, but such a feature
can be helpful imho.

>
>> 5. Color code with errors with special underline or some color that
>> the user can select that will help to locate where the problem is.
>
> Only if it doesn't slow down the editor.

CodeTools already does this, I mean, evaluate the code, but it
requires to communicate with the editor to paint such data properly.

>
>> 6. Ability to keep the string mark (that added to 0.9.27) as permanent
>> with a toggle of a menu item/key/toolbar
>> 7. Inline help for a command/reserve word that the mouse
>> cursor/keyboard caret are under that word (not instead of the
>> tooltip).
>
> What?

On 0.9.27, if you activate a new feature, and you stand on a string,
it marks all of the matching strings in the same file. It can be very
helpful if I could fixate such string when I'm looking at the code and
moving to see where the string in my context appears without the need
to use search.

>
>> 8. When pressing on CTRL above a file/variable/type etc.. that we are
>> trying to load, it will place a tooltip telling what is going to be
>> opened (the file + the line number)
>>
>> What do you think on this features ? Should I add them to mantis as a 
>> wishlist ?
>
> Currently I only have three wishes:
>
> - Multiple edit windows.
> - Make the editor faster.
> - More help texts.
>
> DoDi
>
> ___
> Lazarus mailing list
> Lazarus@lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>

Ido
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] is it me or a bug that i ve been fighting?

2009-01-19 Thread waldo kitty
Martin Friebe wrote:
> Anyway, unless you are willing to spent time on debugging the issue your 
> self, and go into the depth of the Connector code, this will probably be 
> of little help.

i've finally been able to work out the following...

MySQLConnection: TMySQL50Connection;
   TMySQL50Connection = Class(TConnectionName);
 TConnectionName = class (TSQLConnection)
   TSQLConnection = class (TDatabase)
 TDatabase = class(TCustomConnection)
   TCustomConnection = class(TComponent)
 TComponent = 
class(TPersistent,IUnknown,IInterfaceComponentReference)
   TPersistent = class(TObject)


it works out that MySQLConnection.Close is TCustomConnection.Close but if i 
hover the mouse over "Close" in "Procedure Close;" in the public section of the 
TCustomConnection definition stuffs, the editor wants to point to the textfile 
close routine Close(var t:Text); which definitely isn't the same thing :(

and with all of the searching i've done, i still don't see anything that 
indicates where i can actually lay eyes on the code for TCustomConnection.Close 
nor do i see anything indicating that it is assigned to another routine going 
by 
another name :?

now i know why i much prefer the old-style procedural coding methods :P

> If you get the stack backtrace you can mail it and hope some one knows 
> about...

i still don't know what this involves :(

-- 
NOTE: NEW EMAIL ADDRESS!!

_\/
   (@@)  Waldo Kitty, Waldo's Place USA
__ooO_( )_Ooo_ telnet://bbs.wpusa.dynip.com
_|_|_|_|_|_|_ http://www.wpusa.dynip.com
|_|_|_|_|_| ftp://ftp.wpusa.dynip.com
_|_Eat_SPAM_to_email_me!_YUM!__|_ wkitty42 -at- windstream.net


---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 090119-0, 01/19/2009
Tested on: 1/19/09 18:29:11
avast! - copyright (c) 1988-2009 ALWIL Software.
http://www.avast.com



___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] (no subject)

2009-01-19 Thread Mayte Carapeto

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Few features for Lazarus editor

2009-01-19 Thread Hans-Peter Diettrich
ik schrieb:

> There are few features that I would like to see in the Lazarus editor:
> 
> 1. Multiple spliting (and close the split) the editor to horizontal
> and vertical views

Better: multiple edit windows, as Delphi has.

> 2. VIM keyboard support
> 3. Ability to have a way to fold code by using comments with special
> chars (like (* {{{ *) (* }}} ) that VIM allows)

When shall such comments be evaluated?

> 4. Multi linguistal spell checkers for strings and comments

Only on demand.

> 5. Color code with errors with special underline or some color that
> the user can select that will help to locate where the problem is.

Only if it doesn't slow down the editor.

> 6. Ability to keep the string mark (that added to 0.9.27) as permanent
> with a toggle of a menu item/key/toolbar
> 7. Inline help for a command/reserve word that the mouse
> cursor/keyboard caret are under that word (not instead of the
> tooltip).

What?

> 8. When pressing on CTRL above a file/variable/type etc.. that we are
> trying to load, it will place a tooltip telling what is going to be
> opened (the file + the line number)
> 
> What do you think on this features ? Should I add them to mantis as a 
> wishlist ?

Currently I only have three wishes:

- Multiple edit windows.
- Make the editor faster.
- More help texts.

DoDi

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Few features for Lazarus editor

2009-01-19 Thread Vincent Snijders
Paul Ishenin schreef:
>> Should I add them to mantis as a wishlist ?
>>   
> Add them to the wiki page with ideas and explain them there more 
> detailed: http://wiki.lazarus.freepascal.org/Feature_Ideas
> 

When you have written a patch to implement the features, you can add 
them to Mantis.

Vincent
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] ?Linker Option Bug?

2009-01-19 Thread Andrew Brunner
I recently had an issue with building and needed to pass the linker a
-fPIC parameter. I went to Project/Compiler Options/Linking  and added
-fPIC parameter and put a check mark near the option to enable the
linking options and still had the error.

I reported the issue as an FPC bug (
http://bugs.freepascal.org/view.php?id=12940 ) because I thought I had
done all that I could to provide Linker  with my option.  The bug was
reviewed (thanks Jonas :-) and it was suggested that I place the
option in the "Other" tab under Custom Options... Which FIXED my Build
Problem (thanks again Jonas ;-)

I recognize this is not a bug in FPC but I do think it is worth
putting out here for consumption that even a newbie would have
expected that best place to put a linking option would be on the
Linking Tab, and that the phrase "Pass Options to the Linker" with a
check box would be dead right.

I must confess that when I got the message during the build process I
had "guessed" at first and expected to have fed the linker the
suggested parameter.

Should I submit this issue as a bug to Lazarus so it gets worked in?
Is this even a bug?

My thoughts are it should have passed that I should not have to enter
the parameter in Other/options section but that the Linker tab would
suffice.  I don't know the inner workings and logic of progression
form code to dynamic library on Linux completely so I will certainly
defer here.  But I am very curious on how all of these things work.
Any feedback at all would be helpful and more than welcome.
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Passing an array to a function

2009-01-19 Thread Andrew Brunner
Ok,

But when reading or writing to the buffer you do need to reference the
element in which you want to start writing/reading... In the case that
entire buffer is to be written use [0].

You can't write the buffer itself as it's just a pointer...



On Mon, Jan 19, 2009 at 9:35 AM, Dave Coventry  wrote:
> Hi Andy, thanks for the response.
>
> The array was declared as
> var fsbuffer: array of Byte;
>
> I tried your suggestion and typed the array as
> Type TByteBuffer=Array of Byte;
>
> then declared the buffer
> var fsbuffer: TByteBuffer;
>
> I also declared the function using 'var' as you suggested
>
> function FieldValueAsString(var fsbuffer: TByteBuffer; fitype,fisize:
> integer): string;
>
> But my app is still falling over at the same point.
>
> 2009/1/19 Andrew Brunner :
>> Hi Dave,
>>
>>
>> My first comment would be you must declare the input as a variable.
>> Next, I probably would type the Array out as well before using it.
>>
>> Type TByteBuffer=Array of Byte;
>>
>> function FieldValueAsString(var fsbuffer:TByteBuffer; fitype,fisize:
>> integer): string;
>>
>> Byte arrays should not generate an error.  There may be a memory leak
>> for instances where you pass them in as constant values.  Because the
>> Memory manager would need to free that memory as it is a dynamic
>> array.
>>
>> -Andy
>>
>>
>> On Mon, Jan 19, 2009 at 8:20 AM, Dave Coventry  wrote:
>>> I have a function that I'm trying to pass an array to.
>>>
>>> function FieldValueAsString(fsbuffer: array of Byte; fitype,fisize:
>>> integer): string;
>>>
>>> Calling the function:
>>>
>>> setlength(fsbuffer,recordsize);
>>> FS:=TFileStream.Create(fname, fmshareDenyWrite);
>>> FS.Seek(seekpos,soFromBeginning);
>>> FS.ReadBuffer(fsbuffer,recordsize);
>>> dfstring:= FieldValueAsString(fsbuffer,fitype,fisize);
>>>
>>> Generates the error "Project raised exception class SIGSEGV"
>>> ___
>>> Lazarus mailing list
>>> Lazarus@lazarus.freepascal.org
>>> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>>>
>> ___
>> Lazarus mailing list
>> Lazarus@lazarus.freepascal.org
>> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>>
> ___
> Lazarus mailing list
> Lazarus@lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Passing an array to a function

2009-01-19 Thread Dave Coventry
Thanks Martin, that works.

2009/1/19 Dave Coventry :
> Hi Andy, thanks for the response.
>
> The array was declared as
> var fsbuffer: array of Byte;
>
> I tried your suggestion and typed the array as
> Type TByteBuffer=Array of Byte;
>
> then declared the buffer
> var fsbuffer: TByteBuffer;
>
> I also declared the function using 'var' as you suggested
>
> function FieldValueAsString(var fsbuffer: TByteBuffer; fitype,fisize:
> integer): string;
>
> But my app is still falling over at the same point.
>
> 2009/1/19 Andrew Brunner :
>> Hi Dave,
>>
>>
>> My first comment would be you must declare the input as a variable.
>> Next, I probably would type the Array out as well before using it.
>>
>> Type TByteBuffer=Array of Byte;
>>
>> function FieldValueAsString(var fsbuffer:TByteBuffer; fitype,fisize:
>> integer): string;
>>
>> Byte arrays should not generate an error.  There may be a memory leak
>> for instances where you pass them in as constant values.  Because the
>> Memory manager would need to free that memory as it is a dynamic
>> array.
>>
>> -Andy
>>
>>
>> On Mon, Jan 19, 2009 at 8:20 AM, Dave Coventry  wrote:
>>> I have a function that I'm trying to pass an array to.
>>>
>>> function FieldValueAsString(fsbuffer: array of Byte; fitype,fisize:
>>> integer): string;
>>>
>>> Calling the function:
>>>
>>> setlength(fsbuffer,recordsize);
>>> FS:=TFileStream.Create(fname, fmshareDenyWrite);
>>> FS.Seek(seekpos,soFromBeginning);
>>> FS.ReadBuffer(fsbuffer,recordsize);
>>> dfstring:= FieldValueAsString(fsbuffer,fitype,fisize);
>>>
>>> Generates the error "Project raised exception class SIGSEGV"
>>> ___
>>> Lazarus mailing list
>>> Lazarus@lazarus.freepascal.org
>>> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>>>
>> ___
>> Lazarus mailing list
>> Lazarus@lazarus.freepascal.org
>> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>>
>
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] is it me or a bug that i ve been fighting?

2009-01-19 Thread waldo kitty
Martin Friebe wrote:
> Open view->debug->stack window (alt-ctrl-s)
> That will show you where in the Lazarus code the exception happened.  
> Problem: Likely it is in the fpc part, which will be useless numbers. Or 
> even in the mysql library.

ahhh... that's more than i've seen before...

i opened the stack window after my app started and it was just sitting there... 
then i clicked on the [connect] button which does the database connection, data 
retrieval and connection.close... here's what i got...

#0 KERNEL32!GetComputerNameW at :0
#1 KERNEL32!GetPrivateProfileStructA at :0
#2 ?? at :0
#3 ?? at :0

isn't that nice... no filenames listed :?

i get the same if i build it as a win32 GUI app (-WG)...

i'm not sure what debugging options i should turn on on the compiler options -> 
linking tab... the default was only display line numbers in RT error 
backtraces... since our previous discussion, i've also turned on generate debug 
into for gdb (-g) but nothing else...

> Anyway, unless you are willing to spent time on debugging the issue your 
> self, and go into the depth of the Connector code, this will probably be 
> of little help.

yeah, it does seem that way but someone's gotta do it... i mean, damn... the 
code is used in the wiki as workable demo apps and it doesn't work as posted... 
that's not saying that the demo code posted is broken but that the components 
used in the demo code have some sort of problem somewhere... so, its gotta be 
fixed...

> If you get the stack backtrace you can mail it and hope some one knows 
> about...

hummm... dunno anything about how to do that... this is all so very very 
different than the TP6/BP6 and TP7/BP7 IDE style... not only am i stuck trying 
to learn the new environment but also the new coding techniques and now the new 
debugging stuffs... i ain't as young as i used to be... i definitely can't sit 
and beat my head on this stuff for 48+ hours at a stretch like i used to do 
back 
in my 20's and earlier :?

-- 
NOTE: NEW EMAIL ADDRESS!!

_\/
   (@@)  Waldo Kitty, Waldo's Place USA
__ooO_( )_Ooo_ telnet://bbs.wpusa.dynip.com
_|_|_|_|_|_|_ http://www.wpusa.dynip.com
|_|_|_|_|_| ftp://ftp.wpusa.dynip.com
_|_Eat_SPAM_to_email_me!_YUM!__|_ wkitty42 -at- windstream.net


---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 090118-0, 01/18/2009
Tested on: 1/19/09 10:41:01
avast! - copyright (c) 1988-2009 ALWIL Software.
http://www.avast.com



___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Passing an array to a function

2009-01-19 Thread Dave Coventry
Hi Andy, thanks for the response.

The array was declared as
var fsbuffer: array of Byte;

I tried your suggestion and typed the array as
Type TByteBuffer=Array of Byte;

then declared the buffer
var fsbuffer: TByteBuffer;

I also declared the function using 'var' as you suggested

function FieldValueAsString(var fsbuffer: TByteBuffer; fitype,fisize:
integer): string;

But my app is still falling over at the same point.

2009/1/19 Andrew Brunner :
> Hi Dave,
>
>
> My first comment would be you must declare the input as a variable.
> Next, I probably would type the Array out as well before using it.
>
> Type TByteBuffer=Array of Byte;
>
> function FieldValueAsString(var fsbuffer:TByteBuffer; fitype,fisize:
> integer): string;
>
> Byte arrays should not generate an error.  There may be a memory leak
> for instances where you pass them in as constant values.  Because the
> Memory manager would need to free that memory as it is a dynamic
> array.
>
> -Andy
>
>
> On Mon, Jan 19, 2009 at 8:20 AM, Dave Coventry  wrote:
>> I have a function that I'm trying to pass an array to.
>>
>> function FieldValueAsString(fsbuffer: array of Byte; fitype,fisize:
>> integer): string;
>>
>> Calling the function:
>>
>> setlength(fsbuffer,recordsize);
>> FS:=TFileStream.Create(fname, fmshareDenyWrite);
>> FS.Seek(seekpos,soFromBeginning);
>> FS.ReadBuffer(fsbuffer,recordsize);
>> dfstring:= FieldValueAsString(fsbuffer,fitype,fisize);
>>
>> Generates the error "Project raised exception class SIGSEGV"
>> ___
>> Lazarus mailing list
>> Lazarus@lazarus.freepascal.org
>> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>>
> ___
> Lazarus mailing list
> Lazarus@lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Few features for Lazarus editor

2009-01-19 Thread Paul Ishenin
ik wrote:
> Hello,
>
> There are few features that I would like to see in the Lazarus editor:
>
> 1. Multiple spliting (and close the split) the editor to horizontal
> and vertical views
> 2. VIM keyboard support
> 3. Ability to have a way to fold code by using comments with special
> chars (like (* {{{ *) (* }}} ) that VIM allows)
>   
when Martin implement this it will look as {$REGION 'region 
name'}{$ENDREGION} or similar
> 4. Multi linguistal spell checkers for strings and comments
> 5. Color code with errors with special underline or some color that
> the user can select that will help to locate where the problem is.
> 6. Ability to keep the string mark (that added to 0.9.27) as permanent
> with a toggle of a menu item/key/toolbar
> 7. Inline help for a command/reserve word that the mouse
> cursor/keyboard caret are under that word (not instead of the
> tooltip).
> 8. When pressing on CTRL above a file/variable/type etc.. that we are
> trying to load, it will place a tooltip telling what is going to be
> opened (the file + the line number)
>
> What do you think on this features ? Should I add them to mantis as a 
> wishlist ?
>   
Add them to the wiki page with ideas and explain them there more 
detailed: http://wiki.lazarus.freepascal.org/Feature_Ideas

Best regards,
Paul Ishenin.
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Passing an array to a function

2009-01-19 Thread Martin Friebe
Not sure, but I would try something like

FS.ReadBuffer(fsbuffer[0],recordsize);

The function is declared as 
  ReadBuffer(var Buffer; 


So in reality a pointer to the variable is passed to the function. Your 
dyn-array is already a pointer. You are passing in a pointer to the internal 
pointer, and not to the bytes you allocated.

Martin



Dave Coventry wrote:
> I have a function that I'm trying to pass an array to.
>
> function FieldValueAsString(fsbuffer: array of Byte; fitype,fisize:
> integer): string;
>
> Calling the function:
>
> setlength(fsbuffer,recordsize);
> FS:=TFileStream.Create(fname, fmshareDenyWrite);
> FS.Seek(seekpos,soFromBeginning);
> FS.ReadBuffer(fsbuffer,recordsize);
> dfstring:= FieldValueAsString(fsbuffer,fitype,fisize);
>
> Generates the error "Project raised exception class SIGSEGV"
> ___
> Lazarus mailing list
> Lazarus@lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>   
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Passing an array to a function

2009-01-19 Thread Andrew Brunner
Hi Dave,


My first comment would be you must declare the input as a variable.
Next, I probably would type the Array out as well before using it.

Type TByteBuffer=Array of Byte;

function FieldValueAsString(var fsbuffer:TByteBuffer; fitype,fisize:
integer): string;

Byte arrays should not generate an error.  There may be a memory leak
for instances where you pass them in as constant values.  Because the
Memory manager would need to free that memory as it is a dynamic
array.

-Andy


On Mon, Jan 19, 2009 at 8:20 AM, Dave Coventry  wrote:
> I have a function that I'm trying to pass an array to.
>
> function FieldValueAsString(fsbuffer: array of Byte; fitype,fisize:
> integer): string;
>
> Calling the function:
>
> setlength(fsbuffer,recordsize);
> FS:=TFileStream.Create(fname, fmshareDenyWrite);
> FS.Seek(seekpos,soFromBeginning);
> FS.ReadBuffer(fsbuffer,recordsize);
> dfstring:= FieldValueAsString(fsbuffer,fitype,fisize);
>
> Generates the error "Project raised exception class SIGSEGV"
> ___
> Lazarus mailing list
> Lazarus@lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Few features for Lazarus editor

2009-01-19 Thread Martin Friebe
ik wrote:
> Hello,
>
> There are few features that I would like to see in the Lazarus editor:
>
> 1. Multiple spliting (and close the split) the editor to horizontal
> and vertical views
> 2. VIM keyboard support
> 3. Ability to have a way to fold code by using comments with special
> chars (like (* {{{ *) (* }}} ) that VIM allows)
> 4. Multi linguistal spell checkers for strings and comments
> 5. Color code with errors with special underline or some color that
> the user can select that will help to locate where the problem is.
> 6. Ability to keep the string mark (that added to 0.9.27) as permanent
> with a toggle of a menu item/key/toolbar
>   
If you talk about the highlight of the current-word-under-caret: try ALT-M
or configure your keyboard, it's in the section with the selection-commands

> 7. Inline help for a command/reserve word that the mouse
> cursor/keyboard caret are under that word (not instead of the
> tooltip).
> 8. When pressing on CTRL above a file/variable/type etc.. that we are
> trying to load, it will place a tooltip telling what is going to be
> opened (the file + the line number)
>
> What do you think on this features ? Should I add them to mantis as a 
> wishlist ?
>
> Thanks,
>
> Ido
> ___
> Lazarus mailing list
> Lazarus@lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>   
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Passing an array to a function

2009-01-19 Thread Dave Coventry
I have a function that I'm trying to pass an array to.

function FieldValueAsString(fsbuffer: array of Byte; fitype,fisize:
integer): string;

Calling the function:

setlength(fsbuffer,recordsize);
FS:=TFileStream.Create(fname, fmshareDenyWrite);
FS.Seek(seekpos,soFromBeginning);
FS.ReadBuffer(fsbuffer,recordsize);
dfstring:= FieldValueAsString(fsbuffer,fitype,fisize);

Generates the error "Project raised exception class SIGSEGV"
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Few features for Lazarus editor

2009-01-19 Thread ik
Hello,

There are few features that I would like to see in the Lazarus editor:

1. Multiple spliting (and close the split) the editor to horizontal
and vertical views
2. VIM keyboard support
3. Ability to have a way to fold code by using comments with special
chars (like (* {{{ *) (* }}} ) that VIM allows)
4. Multi linguistal spell checkers for strings and comments
5. Color code with errors with special underline or some color that
the user can select that will help to locate where the problem is.
6. Ability to keep the string mark (that added to 0.9.27) as permanent
with a toggle of a menu item/key/toolbar
7. Inline help for a command/reserve word that the mouse
cursor/keyboard caret are under that word (not instead of the
tooltip).
8. When pressing on CTRL above a file/variable/type etc.. that we are
trying to load, it will place a tooltip telling what is going to be
opened (the file + the line number)

What do you think on this features ? Should I add them to mantis as a wishlist ?

Thanks,

Ido
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] is it me or a bug that i ve been fighting?

2009-01-19 Thread Bart
On 1/19/09, waldo kitty  wrote:

>  and that might be another "bug" or something where one can't install laz 
> 0.9.26
>  to one directory and 0.9.27 to another and have each come out of the box 
> without
>  sharing any config settings or something...

It can be done. Just start lazarus with --pcp="path where you want
lazarus to save settings"
I have 0.9.26 and an SVN version up and running on Windows with that
--pcp thing.

AFAIK before 0.9.27 settings were saved in Lazarus directory, after
that in users config directory, which I guess is supplied by OS (on
Windows with GetSpecialFolder (?)).


Bart
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] is it me or a bug that i ve been fighting?

2009-01-19 Thread Martin Friebe
waldo kitty wrote:
> Martin Friebe wrote:
>   
>> 2) You say you do not know the exact error: " because the popup box 
>> doesn't state it" => Try running the exe in the debugger, make sure you 
>> compile with debug symbols for gdb (-g, maybe also -gl).
>> 
>
> just following up on this (as my other reply hasn't srrived back from the 
> list 
> yet) but i have just attempted to, with laz 0.9.27 fpc 2.2.3, run my app from 
> the laz gui via F9... i got a box stating
>
> Project raised exception class 'External SIGSEGV'
>
> at which point i could only click on the [OK] button in that box... then it 
> appeared that my box was locked up but it took a minute or so and another box 
> appeared titled "Assembly" with what appeared to be a list of addresses but i 
> farkled things up by attempting to scroll the box to see what may have been 
> listed and i lost the starting point that it gave me...
>   

Yes the assembly window, ignore that (and yes if you close it to early, 
it does mind that sometimes)

Open view->debug->stack window (alt-ctrl-s)
That will show you where in the Lazarus code the exception happened.  
Problem: Likely it is in the fpc part, which will be useless numbers. Or 
even in the mysql library.

Anyway, unless you are willing to spent time on debugging the issue your 
self, and go into the depth of the Connector code, this will probably be 
of little help.
If you get the stack backtrace you can mail it and hope some one knows 
about...
.


___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] is it me or a bug that i ve been fighting?

2009-01-19 Thread Martin Friebe
waldo kitty wrote:
> Martin Friebe wrote:
>   
>> but a couple of thinks that come to mind:
>> 1) What version of FPC are you using (you only said you updated 
>> Lazarus); you refer to FPC 2.2.2, have you tried the fixes branch 
>> (2.2.3)? or trunc(2.3.1)?
>> 
>
> i'm using whatever comes with lazarus... i started with laz 0.9.26 and then 
> completely removed it to install 0.9.27 because i found that some config 
> settings are evidently hardcoded or shared in a/the registry when a dual 
> install 
> of 0.9.27 still had some things pointing to the old 0.9.26 stuffs :? :(
>   
On the daily snapshot page, you get a windows build with fpc 2.2.2 and 
another one with 2.2.3 (eq fixes branch of fpc)

lookup -pcp (--primar-config-path)
Lazarus does what a windows  app should do, it stores setting in you 
users home director (depends on windows version)

Then if you installed Lazarus (incl fpc) in one directory => do not 
rename the directory; otherwise you must update you fpc.cfg file 
(windows search to locate)

If you have multiply installations, you may have to go to 
environment->options, and adapt the path to fpc
(once you use -pcp)

> and that might be another "bug" or something where one can't install laz 
> 0.9.26 
> to one directory and 0.9.27 to another and have each come out of the box 
> without 
> sharing any config settings or something... i dunno, as i'm still trying to 
> come 
> to grips with the whole GUI interface and drop this here and that there to 
> create a "hello world!" GUI app that's 10Meg (tongue in cheek!) in size 
> compared 
> to a textmode version that's only 2K ;) :lol:
>   

use strip to get rid of the symbols (or compiler options dialog, unclick 
all the debug info)

But leave it in while looking for a bug

>   
>> 2) You say you do not know the exact error: " because the popup box 
>> doesn't state it" => Try running the exe in the debugger, make sure you 
>> compile with debug symbols for gdb (-g, maybe also -gl).
>> 
>
> i've not changed any settings from the defaults on install... i have, a few 
> times, run some stuff directly from the GUI in the debugger but even with 
> 256Meg 
> of RAM in this box, it gets a bit on the tight side at times which is why i 
> switched over to simply building the apps and then shutting down laz and 
> running 
> the built code outside on its own... maybe that wasn't/isn't such a good idea?
>   
why not, but it doesn't help debugging (unless you do gdb by hand)

___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] lazdaemon

2009-01-19 Thread M.Ali VARDAR
Hi,

I tried to use so many times lazdaemon for my daemon application. I don't
understand. Why 'OnStart' event is not working?

I just want to see how is working. I'm looking to 'Cleandirs' code and
comparing with my simple application events. Everythings looking same.

Did you used before lazdaemon? Anybody?



Thanks


procedure TDaemon1.DataModuleStart(Sender: TCustomDaemon; var OK: Boolean);
var
  F : text;
begin
  AssignFile (F, 'Test.txt');
  rewrite (F);
  writeln (F, 'This doesnt go to standard output !');
  closeFile (F);
end;





-- 
Best Regards
M.Ali VARDAR
___
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus