{ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA } unit Files; interface procedure LoadSource(fn: string); implementation uses Defin; procedure AddEntry(tA, ttO, tL: word); var i: integer; begin i := 1; while (i <= NrLAdr) and (SrcTbl[i].A <> tA) do inc(i); if i <= NrLAdr then exit; inc(NrLAdr); with SrcTbl[NrLAdr] do begin A := tA; O := ttO; L := tL; end; end; procedure LoadSource(fn: string); var F: text; NrL, A, O: word; Err, I: integer; Line: string; begin for I := 1 to NrLSrc do freemem(Src[I], length(Src[I]^)+1); NrLSrc := 0; NrLAdr := 0; assign(F, fn); reset(F); while not eof(F) do begin readln(F, Line); if length(Line) >= 25 then begin val(copy(Line, 21, 5), NrL, Err); if Err = 0 then begin inc(NrLSrc); getmem(Src[NrLSrc], length(Line)-26+1); Src[NrLSrc]^ := copy(Line, 27, length(Line)-26); val('$' + copy(Line, 1, 4), A, Err); if Err = 0 then begin val('$' + copy(Line, 6, 4), O, Err); if Err = 0 then begin { Aplausos... Codigo valido } AddEntry(A, O, NrLSrc); end; end; end; end; end; close(F); end; begin end.