You've already forked lazarus-ccr
fixes pascal header comments messup
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@724 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1521,6 +1521,7 @@ begin
|
|||||||
v._Type := ctype;
|
v._Type := ctype;
|
||||||
v._Name := _name;
|
v._Name := _name;
|
||||||
owner.Items.add(v);
|
owner.Items.add(v);
|
||||||
|
AParser.Index := AParser.TokenPos;
|
||||||
end;
|
end;
|
||||||
AParser.FindNextToken(s, tt);
|
AParser.FindNextToken(s, tt);
|
||||||
Result := (tt = tt_Symbol) and (s = ';');
|
Result := (tt = tt_Symbol) and (s = ';');
|
||||||
|
@ -829,7 +829,7 @@ begin
|
|||||||
else Result := prefix + postfix;
|
else Result := prefix + postfix;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure WriteOutVariableToHeader(v: TVariable; const SpacePrefix: String; Vars: TStringList);
|
procedure WriteOutVariableToHeader(v: TVariable; const SpacePrefix: String; Vars: TStrings);
|
||||||
var
|
var
|
||||||
tp : TTypeDef;
|
tp : TTypeDef;
|
||||||
s : AnsiString;
|
s : AnsiString;
|
||||||
@ -864,7 +864,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure WriteOutFunctionToHeader(f: TFunctionDef; st: TStringList);
|
procedure WriteOutFunctionToHeader(f: TFunctionDef; st: TStrings);
|
||||||
var
|
var
|
||||||
restype : AnsiString;
|
restype : AnsiString;
|
||||||
fntype : AnsiString;
|
fntype : AnsiString;
|
||||||
@ -1142,19 +1142,29 @@ procedure WriteOutHeaderSection(hdr: TObjCHeader; st: TStrings);
|
|||||||
var
|
var
|
||||||
i : Integer;
|
i : Integer;
|
||||||
subs : TStringList;
|
subs : TStringList;
|
||||||
// s : AnsiString;
|
|
||||||
consts : TStringList;
|
consts : TStringList;
|
||||||
vars : TStringList;
|
cmt : TStringList;
|
||||||
functs : TStringList;
|
|
||||||
|
PasSection : String;
|
||||||
|
|
||||||
|
procedure StartSection(NewSection: String);
|
||||||
|
begin
|
||||||
|
if NewSection = PasSection then Exit;
|
||||||
|
st.Add('');
|
||||||
|
if NewSection <> '' then st.Add(NewSection);
|
||||||
|
PasSection := NewSection;
|
||||||
|
end;
|
||||||
|
|
||||||
const
|
const
|
||||||
SpacePrefix = ' ';
|
SpacePrefix = ' ';
|
||||||
begin
|
begin
|
||||||
|
PasSection := '';
|
||||||
|
|
||||||
BeginSection('HEADER', st);
|
BeginSection('HEADER', st);
|
||||||
BeginExcludeSection( GetIfDefFileName(hdr._FileName, 'H'), st);
|
BeginExcludeSection( GetIfDefFileName(hdr._FileName, 'H'), st);
|
||||||
subs := TStringList.Create;
|
subs := TStringList.Create;
|
||||||
consts := TStringList.Create;
|
consts := TStringList.Create;
|
||||||
vars := TStringList.Create;
|
cmt := TStringList.Create;
|
||||||
functs := TStringList.Create;
|
|
||||||
try
|
try
|
||||||
for i := 0 to hdr.Items.Count - 1 do
|
for i := 0 to hdr.Items.Count - 1 do
|
||||||
if Assigned(hdr.Items[i]) then
|
if Assigned(hdr.Items[i]) then
|
||||||
@ -1172,41 +1182,36 @@ begin
|
|||||||
|
|
||||||
for i := 0 to hdr.Items.Count - 1 do
|
for i := 0 to hdr.Items.Count - 1 do
|
||||||
if Assigned(hdr.Items[i]) then begin
|
if Assigned(hdr.Items[i]) then begin
|
||||||
if (TObject(hdr.Items[i]) is TEnumTypeDef) then
|
|
||||||
WriteOutEnumToHeader(TEnumTypeDef(hdr.Items[i]), subs)
|
if (TObject(hdr.Items[i]) is TEnumTypeDef) then begin
|
||||||
else if (TObject(hdr.Items[i]) is TPrecompiler) then
|
WriteOutEnumToHeader(TEnumTypeDef(hdr.Items[i]), st);
|
||||||
|
PasSection := 'const';
|
||||||
|
end else if (TObject(hdr.Items[i]) is TPrecompiler) then begin
|
||||||
WriteOutIfDefPrecompiler(TPrecompiler(hdr.Items[i]), SpacePrefix, st)
|
WriteOutIfDefPrecompiler(TPrecompiler(hdr.Items[i]), SpacePrefix, st)
|
||||||
else if (TObject(hdr.Items[i]) is TTypeNameDef) then
|
end else if (TObject(hdr.Items[i]) is TTypeNameDef) then begin
|
||||||
WriteOutTypeDefToHeader(TTypeNameDef(hdr.Items[i]), SpacePrefix, subs)
|
WriteOutTypeDefToHeader(TTypeNameDef(hdr.Items[i]), SpacePrefix, st);
|
||||||
else if (TObject(hdr.Items[i]) is TSkip) then
|
//hack. MUST CHANGE CODE
|
||||||
subs.Add('//'+ TSkip(hdr.Items[i])._Skip)
|
PasSection := 'type';
|
||||||
else if (TObject(hdr.Items[i]) is TComment) then
|
end else if (TObject(hdr.Items[i]) is TSkip) then
|
||||||
|
st.Add('//'+ TSkip(hdr.Items[i])._Skip)
|
||||||
|
else if (TObject(hdr.Items[i]) is TComment) then begin
|
||||||
//WriteOutIfComment(hdr.Items, i, SpacePrefix, subs);
|
//WriteOutIfComment(hdr.Items, i, SpacePrefix, subs);
|
||||||
WriteOutCommentStr( TComment(hdr.Items[i])._Comment, SpacePrefix, Subs)
|
WriteOutCommentStr( TComment(hdr.Items[i])._Comment, SpacePrefix, st);
|
||||||
else if (TObject(hdr.Items[i]) is TVariable) then
|
end else if (TObject(hdr.Items[i]) is TVariable) then begin
|
||||||
WriteOutVariableToHeader(TVariable(hdr.Items[i]), SpacePrefix, Vars)
|
StartSection('var');
|
||||||
else if (TObject(hdr.Items[i]) is TFunctionDef) then
|
WriteOutVariableToHeader(TVariable(hdr.Items[i]), SpacePrefix, st)
|
||||||
WriteOutFunctionToHeader(TFunctionDef(hdr.Items[i]), Functs);
|
end else if (TObject(hdr.Items[i]) is TFunctionDef) then begin
|
||||||
|
StartSection('');
|
||||||
|
WriteOutFunctionToHeader(TFunctionDef(hdr.Items[i]), st);
|
||||||
|
end;
|
||||||
end; {of if}
|
end; {of if}
|
||||||
|
|
||||||
st.add('');
|
st.add('');
|
||||||
if subs.Count > 0 then begin
|
{ if subs.Count > 0 then begin
|
||||||
//if subs[0] <> 'const' then st.Add('type');
|
//if subs[0] <> 'const' then st.Add('type');
|
||||||
st.AddStrings(subs);
|
st.AddStrings(subs);
|
||||||
subs.Clear;
|
subs.Clear;
|
||||||
end;
|
end;}
|
||||||
|
|
||||||
if vars.Count > 0 then begin
|
|
||||||
st.Add('');
|
|
||||||
st.Add('var');
|
|
||||||
st.AddStrings(vars);
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
if functs.Count > 0 then begin
|
|
||||||
st.Add('');
|
|
||||||
st.AddStrings(functs);
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
finally
|
finally
|
||||||
@ -1215,8 +1220,7 @@ begin
|
|||||||
subs.Add('');
|
subs.Add('');
|
||||||
subs.Free;
|
subs.Free;
|
||||||
consts.Free;
|
consts.Free;
|
||||||
vars.Free;
|
cmt.Free;
|
||||||
functs.Free;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user