Nous essayons d'utiliser Delphi dans un fichier pas généré par Free Pascal. Le lien est à: http://www.markwatson.com/opensource/FastTag_Pascal.zipComment réparer cette erreur EInvalidPointer lors de la traduction de Free Pascal en Delphi?
Lors du test, il invite InValidPointer. Veuillez regarder la ligne d'erreur suivante dans le débogueur.
interface
procedure ReadLexicon;
type sarray = array[1..12] of string;
type big_sarray = array[1..1000] of string; { used for word lists and tags: limit on size of input text }
type psarray = ^sarray;
{function GetTagList(word: string): psarray;}
procedure TagWordList(wordList : big_sarray; var tags : big_sarray);
implementation
uses SysUtils, Classes;
{ Hash Table Support - copied from FreePascal source: benchmork shootout examples }
type
THashEntryPtr = ^THashEntryRec;
THashEntryRec = record
name : string;
number : psarray;
next : THashEntryPtr;
end;
const
TABLE_SIZE = 100000;
...
...
...
function GetTagList(word: string): psarray;
var
ret : psarray;
ok : boolean;
begin
ok := localHash.fetch(word, ret);
if ok then GetTagList := ret else GetTagList := nil;
end;
procedure TagWordList(wordList : big_sarray; var tags : big_sarray);
var i : integer;
x : real;
psa : psarray;
lastThreeChars : string;
lastTwoChars : string;
lastChar : string;
firstTwoChars : string;
tagFirstTwoChars : string;
begin
for i := 0 to length(wordList) do
begin
**psa := GetTagList(wordList[i]);///// EInvalidPointer ERROR**
if psa <> nil then tags[i] := psa^[1] else tags[i] := '???';
end;
...
...
...
Comment pouvons-nous le réparer. Merci beaucoup d'avance.
Cher Marco van de Voort, ça fonctionne maintenant, même si je ne sais toujours pas pourquoi il devrait être remplacé comme vous le conseillez, et il semble très lent à charger ce fichier lexique et à fonctionner. Merci beaucoup. – Dylan