Hi,
What on earth does: schanserv.pas(715) Fatal: Internal error 55665566 mean ?
cheers
James

Mailing lists / fpc-pascal / 2003-02
9 messages · 4 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hi,
What on earth does: schanserv.pas(715) Fatal: Internal error 55665566 mean ?
cheers
James
This isn't enought info! A bit more info needed eg what version/flavour of fpc, date, what source are you compiling...Regards John
John wroteThis 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;
implementationPortion of channelclass.pas
unit sChanServ;
interfaceuses
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
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 movedestructor 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 properlyprivate
...
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.
...
tokens := Ttokenizer.Create(data);
trychannel := 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
Better yet, I've found out what the problem is... unit dataChannels; interface uses…
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
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
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
Yes, please.
FYI: I won't have time before Wednesday.