* pointer add/sub is now as expected and the same results as inc/dec

This commit is contained in:
peter 1999-09-08 16:05:29 +00:00
parent 05f2be0455
commit be49731850
3 changed files with 36 additions and 9 deletions

View File

@ -64,10 +64,10 @@ unit globals;
m_pointer_2_procedure,m_autoderef,m_tp_procvar,m_initfinal]; m_pointer_2_procedure,m_autoderef,m_tp_procvar,m_initfinal];
fpcmodeswitches : tmodeswitches= fpcmodeswitches : tmodeswitches=
[m_fpc,m_all,m_string_pchar,m_nested_comment,m_repeat_forward, [m_fpc,m_all,m_string_pchar,m_nested_comment,m_repeat_forward,
m_cvar_support,m_initfinal]; m_cvar_support,m_initfinal,m_add_pointer];
objfpcmodeswitches : tmodeswitches= objfpcmodeswitches : tmodeswitches=
[m_fpc,m_all,m_class,m_objpas,m_result,m_string_pchar,m_nested_comment, [m_fpc,m_all,m_class,m_objpas,m_result,m_string_pchar,m_nested_comment,
m_repeat_forward,m_cvar_support,m_initfinal]; m_repeat_forward,m_cvar_support,m_initfinal,m_add_pointer];
tpmodeswitches : tmodeswitches= tpmodeswitches : tmodeswitches=
[m_tp,m_all,m_tp_procvar]; [m_tp,m_all,m_tp_procvar];
gpcmodeswitches : tmodeswitches= gpcmodeswitches : tmodeswitches=
@ -249,7 +249,7 @@ unit globals;
uses uses
comphook; comphook;
procedure strdispose(var p : pchar); procedure strdispose(var p : pchar);
begin begin
@ -1253,7 +1253,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.23 1999-09-07 15:11:00 pierre Revision 1.24 1999-09-08 16:05:31 peter
* pointer add/sub is now as expected and the same results as inc/dec
Revision 1.23 1999/09/07 15:11:00 pierre
* use do_internalerror insetead of runerror * use do_internalerror insetead of runerror
Revision 1.22 1999/08/30 10:17:56 peter Revision 1.22 1999/08/30 10:17:56 peter

View File

@ -125,7 +125,8 @@ interface
m_pointer_2_procedure, { allows the assignement of pointers to m_pointer_2_procedure, { allows the assignement of pointers to
procedure variables } procedure variables }
m_autoderef, { does auto dereferencing of struct. vars } m_autoderef, { does auto dereferencing of struct. vars }
m_initfinal { initialization/finalization for units } m_initfinal, { initialization/finalization for units }
m_add_pointer { allow pointer add/sub operations }
); );
tmodeswitches = set of tmodeswitch; tmodeswitches = set of tmodeswitch;
@ -178,7 +179,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.17 1999-08-13 15:44:58 peter Revision 1.18 1999-09-08 16:05:32 peter
* pointer add/sub is now as expected and the same results as inc/dec
Revision 1.17 1999/08/13 15:44:58 peter
* first things to include lineinfo in the executable * first things to include lineinfo in the executable
Revision 1.16 1999/08/11 17:26:33 peter Revision 1.16 1999/08/11 17:26:33 peter

View File

@ -958,8 +958,16 @@ implementation
if p^.treetype=addn then if p^.treetype=addn then
begin begin
if not(cs_extsyntax in aktmoduleswitches) or if not(cs_extsyntax in aktmoduleswitches) or
(not(is_pchar(ld)) and (m_tp in aktmodeswitches)) then (not(is_pchar(ld)) and not(m_add_pointer in aktmodeswitches)) then
CGMessage(type_e_mismatch); CGMessage(type_e_mismatch);
{ Dirty hack, to support multiple firstpasses (PFV) }
if (p^.resulttype=nil) and
(rd^.deftype=pointerdef) and
(ppointerdef(rd)^.definition^.size>1) then
begin
p^.left:=gennode(muln,p^.left,genordinalconstnode(ppointerdef(rd)^.definition^.size,s32bitdef));
firstpass(p^.left);
end;
end end
else else
CGMessage(type_e_mismatch); CGMessage(type_e_mismatch);
@ -983,8 +991,17 @@ implementation
case p^.treetype of case p^.treetype of
addn,subn : begin addn,subn : begin
if not(cs_extsyntax in aktmoduleswitches) or if not(cs_extsyntax in aktmoduleswitches) or
(not(is_pchar(ld)) and (m_tp in aktmodeswitches)) then (not(is_pchar(ld)) and not(m_add_pointer in aktmodeswitches)) then
CGMessage(type_e_mismatch); CGMessage(type_e_mismatch);
{ Dirty hack, to support multiple firstpasses (PFV) }
if (p^.resulttype=nil) and
(ld^.deftype=pointerdef) and
(ppointerdef(ld)^.definition^.size>1) then
begin
p^.right:=gennode(muln,p^.right,
genordinalconstnode(ppointerdef(ld)^.definition^.size,s32bitdef));
firstpass(p^.right);
end;
end; end;
else else
CGMessage(type_e_mismatch); CGMessage(type_e_mismatch);
@ -1118,7 +1135,10 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.44 1999-09-07 07:52:19 peter Revision 1.45 1999-09-08 16:05:29 peter
* pointer add/sub is now as expected and the same results as inc/dec
Revision 1.44 1999/09/07 07:52:19 peter
* > < >= <= support for boolean * > < >= <= support for boolean
* boolean constants are now calculated like integer constants * boolean constants are now calculated like integer constants