mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-01 02:59:33 +01:00
* handle postfix type declations in typedefs properly
* small indention fixes * omit empty lines after TypeName git-svn-id: trunk@13822 -
This commit is contained in:
parent
48e259876b
commit
e17d6c1624
@ -1970,7 +1970,9 @@ begin
|
|||||||
writeln(outfile);
|
writeln(outfile);
|
||||||
writeln(outfile,aktspace,'type');
|
writeln(outfile,aktspace,'type');
|
||||||
block_type:=bt_type;
|
block_type:=bt_type;
|
||||||
end;
|
end
|
||||||
|
else
|
||||||
|
writeln(outfile);
|
||||||
no_pop:=assigned(yyv[yysp-2]) and (yyv[yysp-2]^.str='no_pop');
|
no_pop:=assigned(yyv[yysp-2]) and (yyv[yysp-2]^.str='no_pop');
|
||||||
shift(3);
|
shift(3);
|
||||||
(* Get the name to write the type definition for, try
|
(* Get the name to write the type definition for, try
|
||||||
@ -1987,7 +1989,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
(* write type definition *)
|
(* write type definition *)
|
||||||
is_procvar:=false;
|
is_procvar:=false;
|
||||||
writeln(outfile);
|
|
||||||
TN:=TypeName(ph^.p);
|
TN:=TypeName(ph^.p);
|
||||||
PN:=PointerName(ph^.p);
|
PN:=PointerName(ph^.p);
|
||||||
if UsePPointers and (Uppercase(tn)<>Uppercase(pn)) and
|
if UsePPointers and (Uppercase(tn)<>Uppercase(pn)) and
|
||||||
@ -1996,7 +1997,7 @@ begin
|
|||||||
(* write new type name *)
|
(* write new type name *)
|
||||||
write(outfile,aktspace,TN,' = ');
|
write(outfile,aktspace,TN,' = ');
|
||||||
shift(2);
|
shift(2);
|
||||||
write_type_specifier(outfile,yyv[yysp-3]);
|
write_p_a_def(outfile,yyv[yysp-1]^.p1^.p1,yyv[yysp-3]);
|
||||||
popshift;
|
popshift;
|
||||||
(* if no_pop it is normal fpc calling convention *)
|
(* if no_pop it is normal fpc calling convention *)
|
||||||
if is_procvar and
|
if is_procvar and
|
||||||
@ -2047,10 +2048,11 @@ begin
|
|||||||
writeln(outfile);
|
writeln(outfile);
|
||||||
writeln(outfile,aktspace,'type');
|
writeln(outfile,aktspace,'type');
|
||||||
block_type:=bt_type;
|
block_type:=bt_type;
|
||||||
end;
|
end
|
||||||
|
else
|
||||||
|
writeln(outfile);
|
||||||
shift(3);
|
shift(3);
|
||||||
(* write as pointer *)
|
(* write as pointer *)
|
||||||
writeln(outfile);
|
|
||||||
writeln(outfile,'(* generic typedef *)');
|
writeln(outfile,'(* generic typedef *)');
|
||||||
writeln(outfile,aktspace,yyv[yysp-1]^.p,' = pointer;');
|
writeln(outfile,aktspace,yyv[yysp-1]^.p,' = pointer;');
|
||||||
flush(outfile);
|
flush(outfile);
|
||||||
|
|||||||
@ -1772,42 +1772,42 @@ declaration :
|
|||||||
shift(3);
|
shift(3);
|
||||||
if ( yyv[yysp-1]^.p2 <> nil ) then
|
if ( yyv[yysp-1]^.p2 <> nil ) then
|
||||||
begin
|
begin
|
||||||
(* write new type name *)
|
(* write new type name *)
|
||||||
TN:=TypeName($1^.p2^.p);
|
TN:=TypeName($1^.p2^.p);
|
||||||
PN:=PointerName($1^.p2^.p);
|
PN:=PointerName($1^.p2^.p);
|
||||||
(* define a Pointer type also for structs *)
|
(* define a Pointer type also for structs *)
|
||||||
if UsePPointers and (Uppercase(tn)<>Uppercase(pn)) and
|
if UsePPointers and (Uppercase(tn)<>Uppercase(pn)) and
|
||||||
assigned($1) and ($1^.typ in [t_uniondef,t_structdef]) then
|
assigned($1) and ($1^.typ in [t_uniondef,t_structdef]) then
|
||||||
writeln(outfile,aktspace,PN,' = ^',TN,';');
|
writeln(outfile,aktspace,PN,' = ^',TN,';');
|
||||||
write(outfile,aktspace,TN,' = ');
|
write(outfile,aktspace,TN,' = ');
|
||||||
shift(2);
|
shift(2);
|
||||||
hp:=$1;
|
hp:=$1;
|
||||||
write_type_specifier(outfile,hp);
|
write_type_specifier(outfile,hp);
|
||||||
popshift;
|
popshift;
|
||||||
(* enum_to_const can make a switch to const *)
|
(* enum_to_const can make a switch to const *)
|
||||||
if block_type=bt_type then
|
if block_type=bt_type then
|
||||||
writeln(outfile,';');
|
writeln(outfile,';');
|
||||||
writeln(outfile);
|
writeln(outfile);
|
||||||
flush(outfile);
|
flush(outfile);
|
||||||
popshift;
|
popshift;
|
||||||
if must_write_packed_field then
|
if must_write_packed_field then
|
||||||
write_packed_fields_info(outfile,hp,TN);
|
write_packed_fields_info(outfile,hp,TN);
|
||||||
if assigned(hp) then
|
if assigned(hp) then
|
||||||
dispose(hp,done)
|
dispose(hp,done)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
TN:=TypeName(yyv[yysp-1]^.str);
|
TN:=TypeName(yyv[yysp-1]^.str);
|
||||||
PN:=PointerName(yyv[yysp-1]^.str);
|
PN:=PointerName(yyv[yysp-1]^.str);
|
||||||
if UsePPointers then writeln(outfile,aktspace,PN,' = ^',TN,';');
|
if UsePPointers then writeln(outfile,aktspace,PN,' = ^',TN,';');
|
||||||
if PackRecords then
|
if PackRecords then
|
||||||
writeln(outfile, aktspace, TN, ' = packed record')
|
writeln(outfile, aktspace, TN, ' = packed record')
|
||||||
else
|
else
|
||||||
writeln(outfile, aktspace, TN, ' = record');
|
writeln(outfile, aktspace, TN, ' = record');
|
||||||
writeln(outfile, aktspace, ' {undefined structure}');
|
writeln(outfile, aktspace, ' {undefined structure}');
|
||||||
writeln(outfile, aktspace, ' end;');
|
writeln(outfile, aktspace, ' end;');
|
||||||
writeln(outfile);
|
writeln(outfile);
|
||||||
popshift;
|
popshift;
|
||||||
end;
|
end;
|
||||||
} |
|
} |
|
||||||
TYPEDEF STRUCT dname dname SEMICOLON
|
TYPEDEF STRUCT dname dname SEMICOLON
|
||||||
@ -1887,7 +1887,9 @@ declaration :
|
|||||||
writeln(outfile);
|
writeln(outfile);
|
||||||
writeln(outfile,aktspace,'type');
|
writeln(outfile,aktspace,'type');
|
||||||
block_type:=bt_type;
|
block_type:=bt_type;
|
||||||
end;
|
end
|
||||||
|
else
|
||||||
|
writeln(outfile);
|
||||||
no_pop:=assigned($3) and ($3^.str='no_pop');
|
no_pop:=assigned($3) and ($3^.str='no_pop');
|
||||||
shift(3);
|
shift(3);
|
||||||
(* Get the name to write the type definition for, try
|
(* Get the name to write the type definition for, try
|
||||||
@ -1904,7 +1906,6 @@ declaration :
|
|||||||
end;
|
end;
|
||||||
(* write type definition *)
|
(* write type definition *)
|
||||||
is_procvar:=false;
|
is_procvar:=false;
|
||||||
writeln(outfile);
|
|
||||||
TN:=TypeName(ph^.p);
|
TN:=TypeName(ph^.p);
|
||||||
PN:=PointerName(ph^.p);
|
PN:=PointerName(ph^.p);
|
||||||
if UsePPointers and (Uppercase(tn)<>Uppercase(pn)) and
|
if UsePPointers and (Uppercase(tn)<>Uppercase(pn)) and
|
||||||
@ -1913,7 +1914,7 @@ declaration :
|
|||||||
(* write new type name *)
|
(* write new type name *)
|
||||||
write(outfile,aktspace,TN,' = ');
|
write(outfile,aktspace,TN,' = ');
|
||||||
shift(2);
|
shift(2);
|
||||||
write_type_specifier(outfile,$2);
|
write_p_a_def(outfile,$4^.p1^.p1,$2);
|
||||||
popshift;
|
popshift;
|
||||||
(* if no_pop it is normal fpc calling convention *)
|
(* if no_pop it is normal fpc calling convention *)
|
||||||
if is_procvar and
|
if is_procvar and
|
||||||
@ -1963,10 +1964,11 @@ declaration :
|
|||||||
writeln(outfile);
|
writeln(outfile);
|
||||||
writeln(outfile,aktspace,'type');
|
writeln(outfile,aktspace,'type');
|
||||||
block_type:=bt_type;
|
block_type:=bt_type;
|
||||||
end;
|
end
|
||||||
|
else
|
||||||
|
writeln(outfile);
|
||||||
shift(3);
|
shift(3);
|
||||||
(* write as pointer *)
|
(* write as pointer *)
|
||||||
writeln(outfile);
|
|
||||||
writeln(outfile,'(* generic typedef *)');
|
writeln(outfile,'(* generic typedef *)');
|
||||||
writeln(outfile,aktspace,$2^.p,' = pointer;');
|
writeln(outfile,aktspace,$2^.p,' = pointer;');
|
||||||
flush(outfile);
|
flush(outfile);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user