[fpc-devel] tagSIZE is missing in FPC 3.1.1

2015-11-18 Thread MohsenTi
I try to compile lazarus with fpc 3.1.1 and get tagSIZE missing error.
tagSIZE type using by canvas and in older fpcs are in types unit.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


[fpc-devel] Access violation in fpmake

2015-11-15 Thread MohsenTi
Hi
I checkout fpc trunk and try to build it but fpmake raise access violation
exception
how to solve it ?

./fpmake compile --localunitdir=.. --os=linux --cpu=x86_64 -o -Ur -o -Xs -o
-O2 -o -n -o -Cg -o -dx86_64 -o -dRELEASE
--compiler=/home/mohsen/Applications/Lazarus/fpc-trunk/compiler/ppcx64 -bu
-o -XX -o -CX
The installer encountered the following error:
Access violation
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] adding a new token to compiler cause exception

2015-10-13 Thread MohsenTi
I want to add two overloadable operators “>>” and “<<” to use them as “shr”
and “shl” ,or writing into and reading from streams and the other functions
like those mentioned above.
در تاریخ ۱۳ اکتبر ۲۰۱۵ ۲۲:۲۱، "Sven Barth" 
نوشت:

> Am 13.10.2015 19:59 schrieb "Mohsen" :
> >
> > Hi
> > I need add two token to compiler to implement my ideas.
> > adding first token done but second token cause range check exception in
> lines like this
> >
> > if (idtoken in [_EXPORT,_EXTERNAL,_WEAKEXTERNAL,_PUBLIC,_CVAR]) then
> >
> > ptconst.pas(95,45) Error: range check error in set constructor or
> duplicate set element
> >
> > how to solve it ?
>
> First it would be best if you'd show us what exactly you have changed.
> Otherwise we won't be able to help you...
>
> Regards,
> Sven
>
> ___
> fpc-devel maillist  -  fpc-devel@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
>
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] new features and facilities

2015-10-11 Thread MohsenTi
Hi

I added new keyword to moderate while - else (otherwise)
new codes is

Ex1:
while( I>5 ) do begin Dec(I); write(I); end otherwise write(' otherwise
while ');

Ex2:
if (I<10) then while( I>5 ) do begin Dec(I); write(I); end otherwise
write(' otherwise while ') else write(' IF ELSE ');


I need  help to implement it
I added more info needed by compiler ,but I don't know what is
executionweight in pass_generate_code function of tcgwhilerepeatnode class
I check other classes and functions ;like (if,for,exit) node
pass_generate_code ,but I can't find relation between executionweight and
while.

please define it for me!

Thanks a lot.

On Thu, Oct 8, 2015 at 9:21 PM, MohsenTi <mohsen.ti...@gmail.com> wrote:

> Thank you Sven,
> is there any documentation about freepascal compiler parts ?
>
> On Thu, Oct 8, 2015 at 8:27 PM, Sven Barth <pascaldra...@googlemail.com>
> wrote:
>
>> Am 08.10.2015 17:37 schrieb "MohsenTi" <mohsen.ti...@gmail.com>:
>> >
>> > I know this issue but with changing some of structures, I can implement
>> it and now I only want testing adding features to compiler and don't care
>> about backward compatibility,just testing.
>>
>> I wouldn't integrate it in the compiler, but for playing around with the
>> language and learning the workings of the compiler it's okay. :)
>>
>> > I added some changes to compiler functions and classes like
>> pstatmnt.while_statement and nflw.twhilerepeatnode but need more
>> information about functions and units.
>>
>> At first glance those locations look correct. Anything specific you're
>> looking for now? Cause the compiler is quite large and I can't explain
>> everything to you just now ^^
>>
>> Regards,
>> Sven
>>
>> ___
>> fpc-devel maillist  -  fpc-devel@lists.freepascal.org
>> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>>
>>
>
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


[fpc-devel] Fwd: While - Otherwise Statement

2015-10-11 Thread MohsenTi
Hi everybody

I add new feature to FPC compiler to simplify programming.
this is While - Otherwise working like While - Else in python and has
backwards compatibility.

Examples

Ex1: While (I<5) do begin Writeln(I); Dec(I); end otherwise
writeln('otherwise');

Ex2: While (I<5) do begin Writeln(I); Dec(I); break; end otherwise
writeln('otherwise');

Ex3: if (I<10) then While (I<5) do begin Writeln(I); Dec(I); break; end
otherwise writeln('otherwise') else writeln('else');

I attached a svn diff file to email and I'm going to add For-Otherwise and
more.

please test it and let me know what you think.

mohsen
Index: ncgflw.pas
===
--- ncgflw.pas  (revision 32016)
+++ ncgflw.pas  (working copy)
@@ -132,7 +132,7 @@
 
 procedure tcgwhilerepeatnode.pass_generate_code;
   var
- lcont,lbreak,lloop,
+ lcont,lbreak,lloop,lotherwise,
  oldclabel,oldblabel : tasmlabel;
  truelabel,falselabel : tasmlabel;
  oldflowcontrol : tflowcontrol;
@@ -143,6 +143,7 @@
  current_asmdata.getjumplabel(lloop);
  current_asmdata.getjumplabel(lcont);
  current_asmdata.getjumplabel(lbreak);
+ current_asmdata.getjumplabel(lotherwise);
  { arrange continue and breaklabels: }
  oldflowcontrol:=flowcontrol;
  oldclabel:=current_procinfo.CurrContinueLabel;
@@ -184,17 +185,21 @@
  hlcg.a_label(current_asmdata.CurrAsmList,lcont);
  if lnf_checknegate in loopflags then
begin
- truelabel:=lbreak;
+ truelabel:=lotherwise;
  falselabel:=lloop;
end
  else
begin
  truelabel:=lloop;
- falselabel:=lbreak;
+ falselabel:=lotherwise;
end;
  secondpass(left);
+ 
hlcg.maketojumpboollabels(current_asmdata.CurrAsmList,left,truelabel,falselabel);
+ hlcg.a_label(current_asmdata.CurrAsmList,lotherwise);
+ if (Assigned(t1)) then begin
+   secondpass(t1);
+ end;
 
- 
hlcg.maketojumpboollabels(current_asmdata.CurrAsmList,left,truelabel,falselabel);
  hlcg.a_label(current_asmdata.CurrAsmList,lbreak);
 
  sync_regvars(false);
Index: nflw.pas
===
--- nflw.pas(revision 32016)
+++ nflw.pas(working copy)
@@ -71,8 +71,11 @@
   function docompare(p: tnode): boolean; override;
end;
 
+   { twhilerepeatnode }
+
twhilerepeatnode = class(tloopnode)
   constructor create(l,r:Tnode;tab,cn:boolean);virtual;reintroduce;
+  constructor create(l,r,e:Tnode;tab,cn:boolean);virtual;reintroduce;
   function pass_typecheck:tnode;override;
   function pass_1 : tnode;override;
 {$ifdef state_tracking}
@@ -1046,7 +1049,7 @@
TWHILEREPEATNODE
 *}
 
-constructor Twhilerepeatnode.create(l,r:Tnode;tab,cn:boolean);
+constructor twhilerepeatnode.create(l, r: Tnode; tab, cn: boolean);
   begin
   inherited create(whilerepeatn,l,r,nil,nil);
   if tab then
@@ -1055,6 +1058,15 @@
   include(loopflags,lnf_checknegate);
   end;
 
+constructor twhilerepeatnode.create(l, r, e: Tnode; tab, cn: boolean);
+begin
+inherited create(whilerepeatn,l,r,e,nil);
+  if tab then
+  include(loopflags, lnf_testatbegin);
+  if cn then
+  include(loopflags,lnf_checknegate);
+end;
+
 function twhilerepeatnode.pass_typecheck:tnode;
   var
  t:Tunarynode;
Index: pstatmnt.pas
===
--- pstatmnt.pas(revision 32016)
+++ pstatmnt.pas(working copy)
@@ -328,7 +328,7 @@
 function while_statement : tnode;
 
   var
- p_e,p_a : tnode;
+ p_e,p_a,else_a : tnode;
 
   begin
  consume(_WHILE);
@@ -335,7 +335,11 @@
  p_e:=comp_expr(true,false);
  consume(_DO);
  p_a:=statement;
- result:=cwhilerepeatnode.create(p_e,p_a,true,false);
+ if (try_to_consume(_OTHERWISE)) then
+  else_a := statement
+ else
+  else_a := nil;
+Result := cwhilerepeatnode.Create(p_e, p_a, else_a, True, False);
   end;
 
 { a helper function which is used both by "with" and "for-in loop" nodes }
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Fwd: While - Otherwise Statement

2015-10-11 Thread MohsenTi
I create 2 test files depends on testsuite readme file and make testsuite
with make full command and set TEST_FPC variable to fpc ppcx64 compiler.

for-otherwise and while-otherwise diff file and test files attached to
email.

test result :

Total = 6906 (75:6831)
Total number of compilations = 4264 (60:4204)
Successfully compiled = 3147
Successfully failed = 1057
Compilation failures = 55
Compilation that did not fail while they should = 5
Total number of runs = 2642 (15:2627)
Successful runs = 2627
Failed runs = 15
Number units compiled = 135
Number program that should not be run = 367
Number of skipped tests = 404
Number of skipped graph tests = 10
Number of skipped interactive tests = 31
Number of skipped known bug tests = 6
Number of skipped tests for other versions = 4
Number of skipped tests for other cpus = 190
Number of skipped tests for other targets = 163

I checked failed ones but it seems they are not related to my changes.
What you think?

thanks a lot


On Sun, Oct 11, 2015 at 6:44 PM, Sven Barth <pascaldra...@googlemail.com>
wrote:

> Am 11.10.2015 15:56 schrieb "MohsenTi" <mohsen.ti...@gmail.com>:
> >
> > Hi everybody
> >
> > I add new feature to FPC compiler to simplify programming.
> > this is While - Otherwise working like While - Else in python and has
> backwards compatibility.
>
> Nice idea with the otherwise. I first thought that this would break
> case-statements that use otherwise instead of else, but then I remembered
> that the case-label-blocks can and IMHO should be terminated by ; anyway.
> At least problems can be easily circumvented.
>
> I don't know whether we'll add it to trunk, but I'll at least take a look
> at your code to give you feedback.
>
> Oh, and please provide simple tests for your feature that could be added
> to our testsuite (in tests/test or tests/tbs) in case we decide to
> incorporate it.
> Speaking of which: did you run the testsuite and compared the results to a
> run without modifications?
> (If you need help with running the testsuite or interpreting the results,
> please ask, I have yet to write a wiki page for that...)
>
> Regards,
> Sven
>
> ___
> fpc-devel maillist  -  fpc-devel@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
>
Index: ncgflw.pas
===
--- ncgflw.pas  (revision 32016)
+++ ncgflw.pas  (working copy)
@@ -132,7 +132,7 @@
 
 procedure tcgwhilerepeatnode.pass_generate_code;
   var
- lcont,lbreak,lloop,
+ lcont,lbreak,lloop,lotherwise,
  oldclabel,oldblabel : tasmlabel;
  truelabel,falselabel : tasmlabel;
  oldflowcontrol : tflowcontrol;
@@ -143,6 +143,7 @@
  current_asmdata.getjumplabel(lloop);
  current_asmdata.getjumplabel(lcont);
  current_asmdata.getjumplabel(lbreak);
+ current_asmdata.getjumplabel(lotherwise);
  { arrange continue and breaklabels: }
  oldflowcontrol:=flowcontrol;
  oldclabel:=current_procinfo.CurrContinueLabel;
@@ -184,17 +185,21 @@
  hlcg.a_label(current_asmdata.CurrAsmList,lcont);
  if lnf_checknegate in loopflags then
begin
- truelabel:=lbreak;
+ truelabel:=lotherwise;
  falselabel:=lloop;
end
  else
begin
  truelabel:=lloop;
- falselabel:=lbreak;
+ falselabel:=lotherwise;
end;
  secondpass(left);
+ 
hlcg.maketojumpboollabels(current_asmdata.CurrAsmList,left,truelabel,falselabel);
+ hlcg.a_label(current_asmdata.CurrAsmList,lotherwise);
+ if (Assigned(t1)) then begin
+   secondpass(t1);
+ end;
 
- 
hlcg.maketojumpboollabels(current_asmdata.CurrAsmList,left,truelabel,falselabel);
  hlcg.a_label(current_asmdata.CurrAsmList,lbreak);
 
  sync_regvars(false);
@@ -413,7 +418,7 @@
 
 procedure tcgfornode.pass_generate_code;
   var
- l3,oldclabel,oldblabel : tasmlabel;
+ l3,lotherwise,oldclabel,oldblabel : tasmlabel;
  temptovalue : boolean;
  hop : topcg;
  hcond : topcmp;
@@ -430,7 +435,7 @@
  current_asmdata.getjumplabel(current_procinfo.CurrContinueLabel);
  current_asmdata.getjumplabel(current_procinfo.CurrBreakLabel);
  current_asmdata.getjumplabel(l3);
-
+ current_asmdata.getjumplabel(lotherwise);
  { only calculate reference }
  opsize := def_cgsize(left.resultdef);
  count_var_is_signed:=is_signed(left.resultdef);
@@ -794,6 +799,16 @@
tcgint(cmp_const.svalue),left.location,l3);
end;
 
+   hlcg.a_label(current_asmdata.CurrAsmList,lotherwise);
+
+   if (Assigned(e)

Re: [fpc-devel] new features and facilities

2015-10-08 Thread MohsenTi
I know this issue but with changing some of structures, I can implement it
and now I only want testing adding features to compiler and don't care
about backward compatibility,just testing.

I added some changes to compiler functions and classes like
pstatmnt.while_statement and nflw.twhilerepeatnode but need more
information about functions and units.

Mohsen Timar

On Thu, Oct 8, 2015 at 6:28 PM, Michael Van Canneyt 
wrote:

>
>
> On Thu, 8 Oct 2015, Mohsen wrote:
>
> Hi!
>> I wanna add new features and facilities to pascal like while - else, for
>> - else and inline if statement like python.
>>
>> examples
>>
>> ex1:
>>
>> I:=5;
>> while(I>0) do
>>  begin
>> Write(I);
>> I:=I-1;
>> end else Write(' While Else ');
>>
>
> This cannot be implemented without breaking the language.
>
> I:=5:
> If (I<5) then
>  while(I>0) do
>   begin
>  Write(I);
>  I:=I-1;
>  end else
>   Write(' While Else ');
>
> Will not work correctly any more if you want to implement your idea.
>
> So this extension is not possible without breaking backwards compatibility.
>
> Michael.
> ___
> fpc-devel maillist  -  fpc-devel@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] new features and facilities

2015-10-08 Thread MohsenTi
Thank you Sven,
is there any documentation about freepascal compiler parts ?

On Thu, Oct 8, 2015 at 8:27 PM, Sven Barth <pascaldra...@googlemail.com>
wrote:

> Am 08.10.2015 17:37 schrieb "MohsenTi" <mohsen.ti...@gmail.com>:
> >
> > I know this issue but with changing some of structures, I can implement
> it and now I only want testing adding features to compiler and don't care
> about backward compatibility,just testing.
>
> I wouldn't integrate it in the compiler, but for playing around with the
> language and learning the workings of the compiler it's okay. :)
>
> > I added some changes to compiler functions and classes like
> pstatmnt.while_statement and nflw.twhilerepeatnode but need more
> information about functions and units.
>
> At first glance those locations look correct. Anything specific you're
> looking for now? Cause the compiler is quite large and I can't explain
> everything to you just now ^^
>
> Regards,
> Sven
>
> ___
> fpc-devel maillist  -  fpc-devel@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
>
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel