Re: [fpc-pascal] System.Write broken?

2005-07-14 Thread Tomas Hajny
On Thu, July 14, 2005 3:55, John Coppens said:
> On Wed, 13 Jul 2005 19:55:33 -0500
> Elio Cuevas Gómez <[EMAIL PROTECTED]> wrote:
>
>
>> I tried your version, but didn't make much diference. Looks like Write
>> is indeed broken, i'll report it as a bug. Thanks for all your help :).
>
> I tried it here - works fine for me (See code tested below). A doubt: did
> you correctly set the for loops... 0..MAX_MAPY is actually one more that
> you might expect! As I cannot see the definition of MAX_MAPY, I don't
> know if they're correct.
 .
 .

If your problem appears with version 2.0.0, then it's most probably a bug
already reported and fixed in the meantime (in SVN/snapshots). The problem
only appears if the last line containing your data isn't finished with
line end.

Regards

Tomas


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Calling unassigned procedure gives no stack trace with -gl

2005-07-14 Thread Peter Vreman
> On Thu, Jul 14, 2005 at 01:12:23AM +0200, Marcel Martin wrote:
>> Tom Verhoeff a écrit :
>> >begin
>> >  VMyClass := TMyClass.Create;
>> >  //VMyClass.FP := VMyClass.P;  { with this assignment, it works }
>> >  VMyClass.FP;  { this causes an Access Violation }
>>
>> Of course, at this point FP = nil since you didn't set it.
>
> Just in case, I was not understood:
>
> The point is that there is no stack trace with line numbers on the
> (obviously correct) exception, in spite of the option -gl (even when
> explicitly using SysUtils).

The problem is that the framepointer register EBP is 0 in the sigcontext.
We can't solve this.

(gdb) bt
#0  CATCHUNHANDLEDEXCEPTION (OBJ=0x40060054, ADDR=0x0, FRAMECOUNT=0,
FRAMES=0x0) at sysutils.inc:206
#1  0x0805275c in DOUNHANDLEDEXCEPTION () at except.inc:168
#2  0x08052bae in fpc_reraise () at except.inc:278
#3  0x080869af in RUNERRORTOEXCEPT (ERRNO=216, ADDRESS=0x0, FRAME=0x0) at
sysutils.inc:225
#4  0x0805515e in HANDLEERRORADDRFRAME (ERRNO=216, ADDR=0x0, FRAME=0x0) at
system.inc:677
#5  0x0805d50d in SIGNALTORUNERROR (SIG=11, SIGINFO=0xb598,
SIGCONTEXT=0xb618) at sighnd.inc:73
#6  
#7  0x in ?? ()
#8  0x08048117 in main () at p.pp:24
(gdb) dir ~/fpc/rtl/linux/i386
Source directories searched: /home/pvreman/fpc/rtl/linux/i386:$cdir:$cwd
(gdb) l
24VMyClass.FP;  { this causes an Access Violation }
25  end.
(gdb) fr 5
#5  0x0805d50d in SIGNALTORUNERROR (SIG=11, SIGINFO=0xb598,
SIGCONTEXT=0xb618) at sighnd.inc:73
73 
HandleErrorAddrFrame(res,pointer(SigContext^.eip),pointer(SigContext^.ebp));
(gdb) p sigcontext
$1 = (PSIGCONTEXT) 0xb618
(gdb) p sigcontext^
$2 = {GS = 0, __GSH = 0, FS = 0, __FSH = 0, ES = 0, __ESH = 0, DS = 2,
__DSH = 0, EDI = 0, ESI = 0, EBP = 0, ESP = 123, EBX = 123,
  EDX = 134932428, ECX = 0, EAX = 3221223688, TRAPNO = 3221223684, ERR =
67584, EIP = 0, CS = 63724, __CSH = 49151, EFLAGS = 0,
  ESP_AT_SIGNAL = 14, SS = 4, __SSH = 0, FPSTATE = 0x0, OLDMASK = 115, CR2
= 2163270}



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] cMem, cThreads

2005-07-14 Thread Paul Davidson

Does cThreads require cMem in program uses clause?

i.e.
uses
  cMem,
  cThreads,
  etc.

It appears that removing cMem causes memory corruption in Darwin.

Thanks

P Davidson
Corax Networks Inc.
http://CoraxNetworks.com


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Calling unassigned procedure gives no stack trace with -gl

2005-07-14 Thread Tom Verhoeff
On Thu, Jul 14, 2005 at 10:27:01AM +0200, Peter Vreman wrote:
> > Tom Verhoeff a écrit :
> >
> > The point is that there is no stack trace with line numbers on the
> > (obviously correct) exception, in spite of the option -gl (even when
> > explicitly using SysUtils).
> 
> The problem is that the framepointer register EBP is 0 in the sigcontext.
> We can't solve this.

So, where should a solution come from?  Where in the software/hardware
chain would a change be needed to make it work properly?

Tom
-- 
E-MAIL: T.Verhoeff @ TUE.NL | Fac. of Math. & Computing Science
PHONE:  +31 40 247 41 25| Eindhoven University of Technology
FAX:+31 40 247 54 04| PO Box 513, NL-5600 MB Eindhoven
http://www.win.tue.nl/~wstomv/  | The Netherlands

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Calling unassigned procedure gives no stack trace with -gl

2005-07-14 Thread Marco van de Voort
> On Thu, Jul 14, 2005 at 10:27:01AM +0200, Peter Vreman wrote:
> > > Tom Verhoeff a ?crit :
> > >
> > > The point is that there is no stack trace with line numbers on the
> > > (obviously correct) exception, in spite of the option -gl (even when
> > > explicitly using SysUtils).
> > 
> > The problem is that the framepointer register EBP is 0 in the sigcontext.
> > We can't solve this.
> 
> So, where should a solution come from?  Where in the software/hardware
> chain would a change be needed to make it work properly?

For *nix: prt/crt0, there is a xorl %ebp,%ebp  But there might be code
that relies on this (main program's parent's frame being nil)

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Calling unassigned procedure gives no stack trace with -gl

2005-07-14 Thread Anton Tichawa

Marco van de Voort wrote:


On Thu, Jul 14, 2005 at 10:27:01AM +0200, Peter Vreman wrote:
   


Tom Verhoeff a ?crit :

The point is that there is no stack trace with line numbers on the
(obviously correct) exception, in spite of the option -gl (even when
explicitly using SysUtils).
   


The problem is that the framepointer register EBP is 0 in the sigcontext.
We can't solve this.
 


So, where should a solution come from?  Where in the software/hardware
chain would a change be needed to make it work properly?
   



For *nix: prt/crt0, there is a xorl %ebp,%ebp  But there might be code
that relies on this (main program's parent's frame being nil)

 


shouldn't this go to fpc-devel?

(sorry, couldn't resist).

Anton.


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] System.Write broken?

2005-07-14 Thread Elio Cuevas Gómez
El Jue 14 Jul 2005 02:33, Tomas Hajny escribió:
>
> If your problem appears with version 2.0.0, then it's most probably a bug
> already reported and fixed in the meantime (in SVN/snapshots). The problem
> only appears if the last line containing your data isn't finished with
> line end.
>
> Regards
>
> Tomas
>
That's why i didn't report it. I added the ending line to the data file and it 
works for now. Thanks a lot!
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Paths on different OS's

2005-07-14 Thread L505
Could someone tell me the way forward and backward slashes are handled easily?

For example this is sort of code bloat below
Is there some way around this:

{$ifdef unix}
path:= ExtractFileDir(paramstr(0)+'/somepath/directory/etc/';

{$ifdef win32}
path:= ExtractFileDir(paramstr(0)+'\somepath\directory\etc\';

Thank you.

 


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


RE: [fpc-pascal] Paths on different OS's

2005-07-14 Thread Michael Preslar
I always do something like this:

{$ifdef UNIX}
const dirsep = '/';
{$else}
const dirsep = '\';
{$endif}

path := ExtractFileDir(paramstr(0) + dirsep + 'somepath' + dirsep +
'directory' + 'etc' + dirsep);

Id imagine that one of fpc's units already has something very similar to
this.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of L505
Sent: Thursday, July 14, 2005 1:33 PM
To: FPC-Pascal users discussions
Subject: [fpc-pascal] Paths on different OS's


Could someone tell me the way forward and backward slashes are handled
easily?

For example this is sort of code bloat below
Is there some way around this:

{$ifdef unix}
path:= ExtractFileDir(paramstr(0)+'/somepath/directory/etc/';

{$ifdef win32}
path:= ExtractFileDir(paramstr(0)+'\somepath\directory\etc\';

Thank you.

 


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Paths on different OS's

2005-07-14 Thread L505


| I always do something like this:
|
| {$ifdef UNIX}
| const dirsep = '/';
| {$else}
| const dirsep = '\';
| {$endif}
|
| path := ExtractFileDir(paramstr(0) + dirsep + 'somepath' + dirsep +
| 'directory' + 'etc' + dirsep);
|
| Id imagine that one of fpc's units already has something very similar to
| this.

That's a good tip.. Yeah, so if anyone knows.. is there something like this
already in a unit somewhere that should be used as a standard directory
separator variable?




___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Paths on different OS's

2005-07-14 Thread A.J. Venter

>
> That's a good tip.. Yeah, so if anyone knows.. is there something like this
> already in a unit somewhere that should be used as a standard directory
> separator variable?
>
Not sure which unit it's from, sysutils I think, but there is a predeclared 
constant PATHDELIM which auto-adjusts for the OS you're compiling to.

A.J.

-- 
A.J. Venter
Lead Developer - Direq International
+27 82 726 5103
Fax: 0866542898
http://direq.org
http://silentcoder.co.za

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Paths on different OS's

2005-07-14 Thread Michael Van Canneyt


On Thu, 14 Jul 2005, L505 wrote:

> Could someone tell me the way forward and backward slashes are handled easily?
> 
> For example this is sort of code bloat below
> Is there some way around this:
> 
> {$ifdef unix}
> path:= ExtractFileDir(paramstr(0)+'/somepath/directory/etc/';

Path:=ExtractFileDir(ParamStr(0)+PathDelim+'SomePath'+PatHDelim+'Directory'+PatHDelim+'etc'+PathDelim;

Is cross platform, or

Path:=ExtractFileDir(SetDirSeparators(paramstr(0)+'\somepath\directory\etc\'));

DoDirSeparators is the same as SetDirSeparators, but operates on a var param.

All these functions are in sysutils, and are documented.

Michael.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Paths on different OS's

2005-07-14 Thread Michael Van Canneyt


On Thu, 14 Jul 2005, L505 wrote:

> 
> 
> | I always do something like this:
> |
> | {$ifdef UNIX}
> | const dirsep = '/';
> | {$else}
> | const dirsep = '\';
> | {$endif}
> |
> | path := ExtractFileDir(paramstr(0) + dirsep + 'somepath' + dirsep +
> | 'directory' + 'etc' + dirsep);
> |
> | Id imagine that one of fpc's units already has something very similar to
> | this.
> 
> That's a good tip.. Yeah, so if anyone knows.. is there something like this
> already in a unit somewhere that should be used as a standard directory
> separator variable?

PathDelim (in sysutils, delphi compatible) 
or 
DirectorySeparator (FPC native, defined in system)

Michael.

> 
> 
> 
> 
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] unsubscribe potatoe [EMAIL PROTECTED]

2005-07-14 Thread Marc Perkel


--
Marc Perkel - [EMAIL PROTECTED]

Spam Filter: http://www.junkemailfilter.com
   My Blog: http://marc.perkel.com


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Paths on different OS's

2005-07-14 Thread L505
|
Path:=ExtractFileDir(ParamStr(0)+PathDelim+'SomePath'+PatHDelim+'Directory'+PatH
Delim+'etc'+PathDelim;
|
| Is cross platform, or
|
|
Path:=ExtractFileDir(SetDirSeparators(paramstr(0)+'\somepath\directory\etc\'));
|
| DoDirSeparators is the same as SetDirSeparators, but operates on a var param.
|
| All these functions are in sysutils, and are documented.
|

Thanks, I remember coming across them in the docs somewhere before!
The second example you mentioned might be easier on the eyes in the source code.
A little extra CPU, but oh well.


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] getprocaddress

2005-07-14 Thread L505
I have a menu plug-in system working for lazarus and just need a tip to get it
running ;-).

What is the syntax to load a library dynamically? In delphi, you go

@MyProcedure := GetProcAddress(MyProcedure, 'MyProcedure');


In objfpc you go:
..
?




___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Paths on different OS's

2005-07-14 Thread Marc Perkel

How do I get removed from this list?

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] getprocaddress

2005-07-14 Thread Michael Van Canneyt


On Thu, 14 Jul 2005, L505 wrote:

> I have a menu plug-in system working for lazarus and just need a tip to get it
> running ;-).
> 
> What is the syntax to load a library dynamically? In delphi, you go
> 
> @MyProcedure := GetProcAddress(MyProcedure, 'MyProcedure');
> 
> 
> In objfpc you go:
> ..
> ?

The same, just add dynlibs to your uses clause.

This is documented.

Michael.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] getprocaddress

2005-07-14 Thread L505

| The same, just add dynlibs to your uses clause.
|
| This is documented.
|
| Michael.

Actually, I have dynlibs in uses, I just need education on the rules of objfpc

I will create an example for the docs though. I don't think it shows an example,
and I love examples.

An example:

var
 myprocedure: procedure;stdcall;

@myprocedure:=

Error: Can't assign values to an address


However I figured something out.. this works:

MyProcedure:=TMyProcedure(GetProcAddress(handle,'MyProcedure'));

So @ doesn't work.. because objfpc assumes assigning to an address is just not
right?


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Paths on different OS's

2005-07-14 Thread Marco van de Voort
> How do I get removed from this list?
> 
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

There is an URL appended to each post? :-)

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal