Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2003-02

FPC Error! :(

9 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Lee, John

This isn't enought info! A bit more info needed eg what version/flavour of fpc, date, what source are you compiling...Regards John

Earlier message 14 lines
-----Original Message----- From: James Mills Sent: Thursday, February 13, 2003 17:21 To: Subject: [fpc-pascal]FPC Error! :( Hi, What on earth does: schanserv.pas(715) Fatal: Internal error 55665566 mean ? cheers James

Reply by email

James Mills
to Lee, John
John wrote
This isn't enought info! A bit more info needed eg what version/flavour of fpc, date, what source are you compiling...Regards John

Better yet, I've found out what the problem is...

unit dataChannels;
interface
uses
   sysUtils, Functions, tokenizerClass, channelClass;
var
   channels:   PChannel;
   nChannels:  Integer;

Portion of dataChannels.pas

unit channelClass;
interface
uses
   sysUtils, Functions, tokenizerClass;
type
   TNicks = class(TObject)
      constructor init(tmpNick: String);
      destructor done;
      private
         nick:       String;
         modes:      String;
         lastMsg:    longInt;
      public
         procedure setNick(tmpNick: String);
         procedure addMode(tmpModes: String);
         procedure delMode(tmpModes: String);
         procedure update(cTime: longInt);
         function getNick: String;
         function getModes: String;
         function getLastMsg: longInt;
   end;
   PNicks = ^TNicks;
type
   TChannel = class(TObject)
      constructor init(channel: String);
      destructor done;
      private
         name:       String;
         topic:      String;
         nServices:  Integer;
         services:   PNicks;
         nNicks:     Integer;
         nicks:      PNicks;
         modes:      String;
      public
         function getName: String;
         procedure setTopic(s: String);
         procedure addMode(tmpModes: String);
         procedure delMode(tmpModes: String);
         function getModes: String;
         function getTopic: String;
         procedure addService(nick: String);
         procedure delService(nick: String);
         function getService(index: Integer): TNicks;
         function numServices: Integer;
         procedure addNick(nick: String);
         procedure delNick(nick: String);
         function getNick(index: Integer): TNicks;
         function numNicks: Integer;
   end;
   PChannel = ^TChannel;
implementation

Portion of channelclass.pas

unit sChanServ;
interface

uses
Services, ircCommands, Data, Functions, sysUtils, tokenizerClass, Modules, Time, dbNicks, dataNicks, dbChannels, stringsClass, nickClass,

   Config, dataChannels, channelClass;

.
.
.

procedure TChanServ.doLIST(source: String; data: String);
var
   tokens:  TTokenizer;
   channel: String;
   what: String;
   index:   Integer;
   I:       Integer;
begin
   tokens := TTokenizer.init(data);
   channel := tokens.nextToken;
   what := tokens.nextToken;
   tokens.done;
   index := getChannel(channel);
   if upperCase(what) = 'NICKS' then
      begin
         tellUser(self, source, #2 + '***' + #2 + ' List of nicks on ' +
channel + #32 + #2 + '***' + #2);
         for I := 0 to (channels[index].numNicks - 1) do
            begin
               tellUser(self, source, intToStr((I + 1)) + ' :' +
channels[index].getNick(I).getNick);
            end;
         tellUser(self, source, #2 + '***' + #2 + ' End of List ' + #2 +
'***' + #2);
      end
   else
      begin
         tellUser(self, source, 'Invalid listing type.');
      end;
end;

Portion of sChanServ.pas

tellUser(self, source, intToStr((I + 1)) + ' :' + channels[index].getNick(I).getNick);

This line of code access the dataChannels module, of the variable, channels of type PChannels (declared in channelclass.pas). Yet it is also accessing a class inside channelclass.pas,

uses
Services, ircCommands, Data, Functions, sysUtils, tokenizerClass, Modules, Time, dbNicks, dataNicks, dbChannels, stringsClass, nickClass,

   Config, dataChannels, channelClass;

What causes the internal problem is when the compiler cannot find the procedure/function of the inner class, if channelClass is left out of the uses delcaration, that internal error will come up. Which is undocumented.

channelClass is only needed so that the compiler knows what .getNick is after channels[index].getNick(I)

The compiler should probably say, '<sourceFile>(x,x) Error: Identifier not found <symbol>

??

hope this helps.

cheers
James

Show quoted text 23 lines
-----Original Message----- From: James Mills Sent: Thursday, February 13, 2003 17:21 To: Subject: [fpc-pascal]FPC Error! :( Hi, What on earth does: schanserv.pas(715) Fatal: Internal error 55665566 mean ? cheers James _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Matt D. Emson

James,

This is not a personal attack, just some comments about style and some shortcomings of the code you present.

//You should alter this a bit. It's a very strange mix between
TurboPascal and Delphi syntax....
TNicks = class(TObject) //Delphi style syntax
Public // the default is visibility is 'Published'
constructor init(tmpNick: String); //TP Stlyle syntax
Constructor Create(tmpNick: String); virtual; //always a good move
destructor done; //TP Stlyle syntax.. Very bad. FreeInstance
will
                         //not be called unless 'inherited Destroy' is
called
                         //from this routine
Destructor Destroy; override; //otherwise the memory manager will not
deallocate the class properly
private

...

end; PNicks = ^TNicks; //overkill

You do not need this!! A class instance is already a reference (read 'typed' 'pointer') to an object. For example.. Declare a Tlist, add a Tobject to it.. You need not typecast. It *is* a pointer. There are no stack objects in Delphi style syntax. The classes are just automagically dereferenced.

...

Show quoted text 8 lines
procedure TChanServ.doLIST(source: String; data: String); var tokens: TTokenizer; channel: String; what: String; index: Integer; I: Integer; begin
     tokens := Ttokenizer.Create(data);
     try
channel := tokens.nextToken; what := tokens.nextToken;
     finally
       tokens.free;
     end;

Try ... Finally is your friend. Embrase it. Learn to protect your resourses! ;-)

...

You'll get horrible memory leaks if you don't be carefull using classes with the object syntax as you have.

NB. If I have missed something about the FPC non delphi/ObjFPC implementation of the class (as opposed to the object) I rightly point out that either the Delphi syntax or the TP syntax is correct, by definition. Both are distinct, and advocating the mixture of the two is very bad. I think I've said this before. Sorry for repeating myself. IIRC we discussesd this along with the merits of the extended object pascal spec (the one our friend Amto Tichwa recently also mentioned), but I forget what the answer was then.

Matt

Reply by email

Peter Vreman
to James Mills: Better yet, I've found out what the problem is... unit dataChannels; interface uses…
Show quoted text 15 lines
On Thu, Feb 13, 2003 at 06:04:07PM -0000, Lee, John wrote: > This isn't enought info! A bit more info needed eg what version/flavour > of > fpc, date, what source are you compiling...Regards John Better yet, I've found out what the problem is... What causes the internal problem is when the compiler cannot find the procedure/function of the inner class, if channelClass is left out of the uses delcaration, that internal error will come up. Which is undocumented. channelClass is only needed so that the compiler knows what .getNick is after channels[index].getNick(I)

Can you send me the sources that are failing. Then i can debug the problem. There is also a test in the testsuite that fails with this error, maybe it's the same problem.

Peter

Reply by email

James Mills
to Peter Vreman
Peter Vreman wrote 19 lines
> On Thu, Feb 13, 2003 at 06:04:07PM -0000, Lee, John wrote: >> This isn't enought info! A bit more info needed eg what version/flavour >> of >> fpc, date, what source are you compiling...Regards John > > Better yet, I've found out what the problem is... > > What causes the internal problem is when the compiler cannot find the > procedure/function of the inner class, if channelClass is left out of > the uses delcaration, that internal error will come up. Which is > undocumented. > > channelClass is only needed so that the compiler knows what .getNick is > after channels[index].getNick(I) > Can you send me the sources that are failing. Then i can debug the problem. There is also a test in the testsuite that fails with this error, maybe it's the same problem.

I know the exact cause of the error. Sending the sources won't help much, there are too many. Tell me what you need, I'll help fix this bug.

cheers
James

Show quoted text 7 lines
Peter _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Peter Vreman
to James Mills
Show quoted text 26 lines
On Fri, Feb 14, 2003 at 12:54:25PM +0100, Peter Vreman wrote: > > On Thu, Feb 13, 2003 at 06:04:07PM -0000, Lee, John wrote: > >> This isn't enought info! A bit more info needed eg what > version/flavour > >> of > >> fpc, date, what source are you compiling...Regards John > > > > Better yet, I've found out what the problem is... > > > > What causes the internal problem is when the compiler cannot find the > > procedure/function of the inner class, if channelClass is left out of > > the uses delcaration, that internal error will come up. Which is > > undocumented. > > > > channelClass is only needed so that the compiler knows what .getNick > is > > after channels[index].getNick(I) > > > > Can you send me the sources that are failing. Then i can debug the > problem. There is also a test in the testsuite that fails with this > error, > maybe it's the same problem. I know the exact cause of the error. Sending the sources won't help much, there are too many. Tell me what you need, I'll help fix this bug.

I need sources that i can compile and debug the compiler. i know what the error means but i need to run the compiler on the sources to debug why it fails.

Reply by email

James Mills
to Peter Vreman
Peter Vreman wrote 30 lines
> On Fri, Feb 14, 2003 at 12:54:25PM +0100, Peter Vreman wrote: >> > On Thu, Feb 13, 2003 at 06:04:07PM -0000, Lee, John wrote: >> >> This isn't enought info! A bit more info needed eg what >> version/flavour >> >> of >> >> fpc, date, what source are you compiling...Regards John >> > >> > Better yet, I've found out what the problem is... >> > >> > What causes the internal problem is when the compiler cannot find the >> > procedure/function of the inner class, if channelClass is left out of >> > the uses delcaration, that internal error will come up. Which is >> > undocumented. >> > >> > channelClass is only needed so that the compiler knows what .getNick >> is >> > after channels[index].getNick(I) >> > >> >> Can you send me the sources that are failing. Then i can debug the >> problem. There is also a test in the testsuite that fails with this >> error, >> maybe it's the same problem. > > I know the exact cause of the error. Sending the sources won't help > much, there are too many. Tell me what you need, I'll help fix this bug. I need sources that i can compile and debug the compiler. i know what the error means but i need to run the compiler on the sources to debug why it fails.

Alright, can I tar up the sources that caused the error and send to your email address ?

cheers
James

Show quoted text 5 lines
_______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Peter Vreman
to James Mills
Show quoted text 18 lines
> >> Can you send me the sources that are failing. Then i can debug the > >> problem. There is also a test in the testsuite that fails with this > >> error, > >> maybe it's the same problem. > > > > I know the exact cause of the error. Sending the sources won't help > > much, there are too many. Tell me what you need, I'll help fix this > bug. > > I need sources that i can compile and debug the compiler. i know what > the > error means but i need to run the compiler on the sources to debug why > it > fails. Alright, can I tar up the sources that caused the error and send to your email address ?

Yes, please.

FYI: I won't have time before Wednesday.

Reply by email