some bugs fixed

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@403 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
skalogryz
2008-04-02 14:23:02 +00:00
parent 691c3853d5
commit 4d797f023b

View File

@ -111,13 +111,67 @@ begin
end; end;
WriteOutIncludeFile(hdr, outdata); WriteOutIncludeFile(hdr, outdata);
finally finally
hdr.Free;
parser.TokenTable.Free; parser.TokenTable.Free;
parser.Free; parser.Free;
prec.Free; prec.Free;
//FreeEntity(hdr);
end; end;
end; end;
procedure ParseAll;
var
ch : char;
srch : TSearchRec;
res : Integer;
i : Integer;
pth : AnsiString;
incs : AnsiString;
st : TStringList;
f : Text;
begin
writeln('would you like to parse of local files .h to inc?');
readln(ch);
if (ch <> 'Y') and (ch <> 'y') then begin
writeln('as you wish, bye!');
Exit;
end;
pth := IncludeTrailingPathDelimiter( GetCurrentDir);
writeln('looking for .h files in ', pth);
res := FindFirst(pth + '*.h', -1, srch);
if res = 0 then begin
st := TStringList.Create;
try
repeat
write('found: ', srch.Name);
write(' parsing...');
//writeln('parsing: ', pth+srch.Name);
ReadAndParseFile(pth+srch.Name, st);
write(' parsed ');
incs := pth + Copy(srch.Name,1, length(srch.Name) - length(ExtractFileExt(srch.Name)));
incs := incs + '.inc';
//writeln(incs);
assignfile(f, incs); rewrite(f);
try
for i := 0 to st.Count - 1 do
writeln(f, st[i]);
finally
closefile(f);
end;
st.Clear;
writeln(' converted!');
until FindNext(srch) <> 0;
finally
FindClose(srch);
st.Free;
end;
end;
end;
var var
inpf : AnsiString; inpf : AnsiString;
st : TStrings; st : TStrings;
@ -126,6 +180,7 @@ begin
try try
inpf := ParamStr(1); inpf := ParamStr(1);
if not FileExists(inpf) then begin if not FileExists(inpf) then begin
//ParseAll;
Exit; Exit;
end; end;