LRE
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
List overview
Download
Olena-patches
----- 2025 -----
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
olena-patches@lrde.epita.fr
9625 discussions
Start a n
N
ew thread
scool r101: Minor bugfix : use lists to store parameters
by Maxime van Noppen
URL:
https://svn.lrde.epita.fr/svn/scool/branches/scool-ng
ChangeLog: 2008-09-24 Maxime van Noppen <yabo(a)lrde.epita.fr> Minor bugfix : use lists to store parameters * scoolt/Declaration.str: Use lists to store parameters. Declaration.str | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: branches/scool-ng/src/scoolt/Declaration.str =================================================================== --- branches/scool-ng/src/scoolt/Declaration.str (revision 100) +++ branches/scool-ng/src/scoolt/Declaration.str (revision 101) @@ -66,7 +66,7 @@ DeclarationToCxx: ClassDefinition(None, idf, wclause, ClassBlock(body)) -> CxxClassDecl(cxx_params, cxx_idf, [], cxx_body) where - !(CxxType("typename"), "T") => cxx_params + ![(CxxType("typename"), "T")] => cxx_params ; <IdentifierToCxx> idf => cxx_idf ; <?None> wclause ; <ClassBodyToCxx> body => cxx_body -- \__/ \__/ (00) Maxime `yabo` van Noppen (00) ___) \ Epita 2009 / (___ (_____/ \_____)
16Â years, 3Â months
1
0
0
0
scool r100: Add reference files for classes
by Maxime van Noppen
URL:
https://svn.lrde.epita.fr/svn/scool/branches/scool-ng
ChangeLog: 2008-09-24 Maxime van Noppen <yabo(a)lrde.epita.fr> Add reference files for classes * class/c++_ast/empty.aterm, * class/c++_ast/empty_accessblocks.aterm, * class/c++_ast/empty_private.aterm, * class/c++_ast/empty_protected.aterm, * class/c++_ast/empty_public.aterm, * class/c++_ast/member_001.aterm, * class/c++_ast/member_002.aterm, * class/c++_ast/method_001.aterm, * class/c++_ast/method_002.aterm, * class/c++_ast/method_003.aterm, * class/c++_ast/method_004.aterm, * class/c++_ast/method_005.aterm: Use a list to store parameters. * class/c++_src/empty.cc: New. * class/c++_src/empty_accessblocks.cc: New. * class/c++_src/empty_private.cc: New. * class/c++_src/empty_protected.cc: New. * class/c++_src/empty_public.cc: New. * class/c++_src/member_001.cc: New. * class/c++_src/member_002.cc: New. * class/c++_src/method_001.cc: New. * class/c++_src/method_002.cc: New. * class/c++_src/method_003.cc: New. * class/c++_src/method_004.cc: New. * class/c++_src/method_005.cc: New. c++_ast/empty.aterm | 2 +- c++_ast/empty_accessblocks.aterm | 2 +- c++_ast/empty_private.aterm | 2 +- c++_ast/empty_protected.aterm | 2 +- c++_ast/empty_public.aterm | 2 +- c++_ast/member_001.aterm | 2 +- c++_ast/member_002.aterm | 2 +- c++_ast/method_001.aterm | 2 +- c++_ast/method_002.aterm | 2 +- c++_ast/method_003.aterm | 2 +- c++_ast/method_004.aterm | 2 +- c++_ast/method_005.aterm | 2 +- c++_src/empty.cc | 4 ++++ c++_src/empty_accessblocks.cc | 7 +++++++ c++_src/empty_private.cc | 5 +++++ c++_src/empty_protected.cc | 5 +++++ c++_src/empty_public.cc | 5 +++++ c++_src/member_001.cc | 6 ++++++ c++_src/member_002.cc | 7 +++++++ c++_src/method_001.cc | 9 +++++++++ c++_src/method_002.cc | 9 +++++++++ c++_src/method_003.cc | 13 +++++++++++++ c++_src/method_004.cc | 13 +++++++++++++ c++_src/method_005.cc | 14 ++++++++++++++ 24 files changed, 109 insertions(+), 12 deletions(-) Index: branches/scool-ng/tests/class/c++_ast/empty_private.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/empty_private.aterm (revision 99) +++ branches/scool-ng/tests/class/c++_ast/empty_private.aterm (revision 100) @@ -1 +1 @@ -CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Foo"),[],[CxxPrivate([])])]) +CxxProgram([CxxClassDecl([(CxxType("typename"),"T")],CxxId("Foo"),[],[CxxPrivate([])])]) Index: branches/scool-ng/tests/class/c++_ast/member_002.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/member_002.aterm (revision 99) +++ branches/scool-ng/tests/class/c++_ast/member_002.aterm (revision 100) @@ -1 +1 @@ -CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Point2d"),[],[CxxPublic([CxxDecl(CxxType("int"),CxxId("x")),CxxDecl(CxxType("int"),CxxId("y"))])])]) +CxxProgram([CxxClassDecl([(CxxType("typename"),"T")],CxxId("Point2d"),[],[CxxPublic([CxxDecl(CxxType("int"),CxxId("x")),CxxDecl(CxxType("int"),CxxId("y"))])])]) Index: branches/scool-ng/tests/class/c++_ast/empty_public.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/empty_public.aterm (revision 99) +++ branches/scool-ng/tests/class/c++_ast/empty_public.aterm (revision 100) @@ -1 +1 @@ -CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Foo"),[],[CxxPublic([])])]) +CxxProgram([CxxClassDecl([(CxxType("typename"),"T")],CxxId("Foo"),[],[CxxPublic([])])]) Index: branches/scool-ng/tests/class/c++_ast/empty_accessblocks.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/empty_accessblocks.aterm (revision 99) +++ branches/scool-ng/tests/class/c++_ast/empty_accessblocks.aterm (revision 100) @@ -1 +1 @@ -CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Foo"),[],[CxxPublic([]),CxxProtected([]),CxxPrivate([])])]) +CxxProgram([CxxClassDecl([(CxxType("typename"),"T")],CxxId("Foo"),[],[CxxPublic([]),CxxProtected([]),CxxPrivate([])])]) Index: branches/scool-ng/tests/class/c++_ast/empty.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/empty.aterm (revision 99) +++ branches/scool-ng/tests/class/c++_ast/empty.aterm (revision 100) @@ -1 +1 @@ -CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Foo"),[],[])]) +CxxProgram([CxxClassDecl([(CxxType("typename"),"T")],CxxId("Foo"),[],[])]) Index: branches/scool-ng/tests/class/c++_ast/method_001.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/method_001.aterm (revision 99) +++ branches/scool-ng/tests/class/c++_ast/method_001.aterm (revision 100) @@ -1 +1 @@ -CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Foo"),[],[CxxPublic([CxxFun([],CxxType("int"),CxxId("test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("42")))])])])]) +CxxProgram([CxxClassDecl([(CxxType("typename"),"T")],CxxId("Foo"),[],[CxxPublic([CxxFun([],CxxType("int"),CxxId("test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("42")))])])])]) Index: branches/scool-ng/tests/class/c++_ast/method_002.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/method_002.aterm (revision 99) +++ branches/scool-ng/tests/class/c++_ast/method_002.aterm (revision 100) @@ -1 +1 @@ -CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Foo"),[],[CxxPublic([CxxFun([],CxxType("int"),CxxId("test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("42")))])])])]) +CxxProgram([CxxClassDecl([(CxxType("typename"),"T")],CxxId("Foo"),[],[CxxPublic([CxxFun([],CxxType("int"),CxxId("test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("42")))])])])]) Index: branches/scool-ng/tests/class/c++_ast/method_003.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/method_003.aterm (revision 99) +++ branches/scool-ng/tests/class/c++_ast/method_003.aterm (revision 100) @@ -1 +1 @@ -CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Foo"),[],[CxxPublic([CxxFun([],CxxType("int"),CxxId("test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("42")))]),CxxFun([],CxxType("int"),CxxId("another_test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("51")))])])])]) +CxxProgram([CxxClassDecl([(CxxType("typename"),"T")],CxxId("Foo"),[],[CxxPublic([CxxFun([],CxxType("int"),CxxId("test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("42")))]),CxxFun([],CxxType("int"),CxxId("another_test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("51")))])])])]) Index: branches/scool-ng/tests/class/c++_ast/method_004.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/method_004.aterm (revision 99) +++ branches/scool-ng/tests/class/c++_ast/method_004.aterm (revision 100) @@ -1 +1 @@ -CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Foo"),[],[CxxPublic([CxxFun([],CxxType("int"),CxxId("test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("42")))]),CxxFun([],CxxType("int"),CxxId("another_test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("51")))])])])]) +CxxProgram([CxxClassDecl([(CxxType("typename"),"T")],CxxId("Foo"),[],[CxxPublic([CxxFun([],CxxType("int"),CxxId("test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("42")))]),CxxFun([],CxxType("int"),CxxId("another_test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("51")))])])])]) Index: branches/scool-ng/tests/class/c++_ast/method_005.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/method_005.aterm (revision 99) +++ branches/scool-ng/tests/class/c++_ast/method_005.aterm (revision 100) @@ -1 +1 @@ -CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Foo"),[],[CxxPublic([CxxFun([],CxxType("int"),CxxId("test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("42")))])]),CxxPrivate([CxxFun([],CxxType("int"),CxxId("another_test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("51")))])])])]) +CxxProgram([CxxClassDecl([(CxxType("typename"),"T")],CxxId("Foo"),[],[CxxPublic([CxxFun([],CxxType("int"),CxxId("test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("42")))])]),CxxPrivate([CxxFun([],CxxType("int"),CxxId("another_test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("51")))])])])]) Index: branches/scool-ng/tests/class/c++_ast/empty_protected.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/empty_protected.aterm (revision 99) +++ branches/scool-ng/tests/class/c++_ast/empty_protected.aterm (revision 100) @@ -1 +1 @@ -CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Foo"),[],[CxxProtected([])])]) +CxxProgram([CxxClassDecl([(CxxType("typename"),"T")],CxxId("Foo"),[],[CxxProtected([])])]) Index: branches/scool-ng/tests/class/c++_ast/member_001.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/member_001.aterm (revision 99) +++ branches/scool-ng/tests/class/c++_ast/member_001.aterm (revision 100) @@ -1 +1 @@ -CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Point1d"),[],[CxxPublic([CxxDecl(CxxType("int"),CxxId("x"))])])]) +CxxProgram([CxxClassDecl([(CxxType("typename"),"T")],CxxId("Point1d"),[],[CxxPublic([CxxDecl(CxxType("int"),CxxId("x"))])])]) Index: branches/scool-ng/tests/class/c++_src/empty_public.cc =================================================================== --- branches/scool-ng/tests/class/c++_src/empty_public.cc (revision 0) +++ branches/scool-ng/tests/class/c++_src/empty_public.cc (revision 100) @@ -0,0 +1,5 @@ +template < typename T > +class Foo +{ + public: +}; Index: branches/scool-ng/tests/class/c++_src/empty_accessblocks.cc =================================================================== --- branches/scool-ng/tests/class/c++_src/empty_accessblocks.cc (revision 0) +++ branches/scool-ng/tests/class/c++_src/empty_accessblocks.cc (revision 100) @@ -0,0 +1,7 @@ +template < typename T > +class Foo +{ + public: + protected: + private: +}; Index: branches/scool-ng/tests/class/c++_src/empty.cc =================================================================== --- branches/scool-ng/tests/class/c++_src/empty.cc (revision 0) +++ branches/scool-ng/tests/class/c++_src/empty.cc (revision 100) @@ -0,0 +1,4 @@ +template < typename T > +class Foo +{ +}; Index: branches/scool-ng/tests/class/c++_src/method_001.cc =================================================================== --- branches/scool-ng/tests/class/c++_src/method_001.cc (revision 0) +++ branches/scool-ng/tests/class/c++_src/method_001.cc (revision 100) @@ -0,0 +1,9 @@ +template < typename T > +class Foo +{ + public: + int test() + { + return 42; + } +}; Index: branches/scool-ng/tests/class/c++_src/method_002.cc =================================================================== --- branches/scool-ng/tests/class/c++_src/method_002.cc (revision 0) +++ branches/scool-ng/tests/class/c++_src/method_002.cc (revision 100) @@ -0,0 +1,9 @@ +template < typename T > +class Foo +{ + public: + int test() + { + return 42; + } +}; Index: branches/scool-ng/tests/class/c++_src/method_003.cc =================================================================== --- branches/scool-ng/tests/class/c++_src/method_003.cc (revision 0) +++ branches/scool-ng/tests/class/c++_src/method_003.cc (revision 100) @@ -0,0 +1,13 @@ +template < typename T > +class Foo +{ + public: + int test() + { + return 42; + } + int another_test() + { + return 51; + } +}; Index: branches/scool-ng/tests/class/c++_src/method_004.cc =================================================================== --- branches/scool-ng/tests/class/c++_src/method_004.cc (revision 0) +++ branches/scool-ng/tests/class/c++_src/method_004.cc (revision 100) @@ -0,0 +1,13 @@ +template < typename T > +class Foo +{ + public: + int test() + { + return 42; + } + int another_test() + { + return 51; + } +}; Index: branches/scool-ng/tests/class/c++_src/method_005.cc =================================================================== --- branches/scool-ng/tests/class/c++_src/method_005.cc (revision 0) +++ branches/scool-ng/tests/class/c++_src/method_005.cc (revision 100) @@ -0,0 +1,14 @@ +template < typename T > +class Foo +{ + public: + int test() + { + return 42; + } + private: + int another_test() + { + return 51; + } +}; Index: branches/scool-ng/tests/class/c++_src/empty_protected.cc =================================================================== --- branches/scool-ng/tests/class/c++_src/empty_protected.cc (revision 0) +++ branches/scool-ng/tests/class/c++_src/empty_protected.cc (revision 100) @@ -0,0 +1,5 @@ +template < typename T > +class Foo +{ + protected: +}; Index: branches/scool-ng/tests/class/c++_src/member_001.cc =================================================================== --- branches/scool-ng/tests/class/c++_src/member_001.cc (revision 0) +++ branches/scool-ng/tests/class/c++_src/member_001.cc (revision 100) @@ -0,0 +1,6 @@ +template < typename T > +class Point1d +{ + public: + int x; +}; Index: branches/scool-ng/tests/class/c++_src/empty_private.cc =================================================================== --- branches/scool-ng/tests/class/c++_src/empty_private.cc (revision 0) +++ branches/scool-ng/tests/class/c++_src/empty_private.cc (revision 100) @@ -0,0 +1,5 @@ +template < typename T > +class Foo +{ + private: +}; Index: branches/scool-ng/tests/class/c++_src/member_002.cc =================================================================== --- branches/scool-ng/tests/class/c++_src/member_002.cc (revision 0) +++ branches/scool-ng/tests/class/c++_src/member_002.cc (revision 100) @@ -0,0 +1,7 @@ +template < typename T > +class Point2d +{ + public: + int x; + int y; +}; -- \__/ \__/ (00) Maxime `yabo` van Noppen (00) ___) \ Epita 2009 / (___ (_____/ \_____)
16Â years, 3Â months
1
0
0
0
scool r99: Work on classes
by Maxime van Noppen
URL:
https://svn.lrde.epita.fr/svn/scool/branches/scool-ng
ChangeLog: 2008-09-24 Maxime van Noppen <yabo(a)lrde.epita.fr> Work on classes * concrete-syn/concrete-syn.sdf: Add concrete syntax for classes. * scl-syn/Class.sdf: Fix typo in grammar * scoolt/Declaration.str: Handle the ClassDefinition constructor. * scoolt/Function.str: Cleanup and document code. concrete-syn/concrete-syn.sdf | 1 + scl-syn/Class.sdf | 2 +- scoolt/Declaration.str | 20 ++++++++++++++++---- scoolt/Function.str | 16 +++++++++++++--- 4 files changed, 31 insertions(+), 8 deletions(-) Index: branches/scool-ng/src/scoolt/Declaration.str =================================================================== --- branches/scool-ng/src/scoolt/Declaration.str (revision 98) +++ branches/scool-ng/src/scoolt/Declaration.str (revision 99) @@ -1,6 +1,6 @@ module Declaration -imports libstratego-lib Cxx Scool Type Expression Function +imports libstratego-lib Cxx Scool Type Expression Function Class rules @@ -56,6 +56,18 @@ ; <TypeToCxx> <GetReturnType> fun_type => cxx_ret_type ; <ParametersToCxx> <GetParameters> fun_type => cxx_params ; <ArgumentsToCxx> <GetArguments> fun_type => cxx_args - // body can either be a list of declarations and/or function statements, - // or be a single expression (because of the one-line function sugar) - ; <map (DeclarationToCxx <+ FunctionStatementToCxx) <+ FunctionStatementToCxx> body => cxx_body + ; <FunctionBodyToCxx> body => cxx_body + + + //////////////////////////////////////////////////////////////////////////////// + // Class // + //////////////////////////////////////////////////////////////////////////////// + + DeclarationToCxx: + ClassDefinition(None, idf, wclause, ClassBlock(body)) -> CxxClassDecl(cxx_params, cxx_idf, [], cxx_body) + where + !(CxxType("typename"), "T") => cxx_params + ; <IdentifierToCxx> idf => cxx_idf + ; <?None> wclause + ; <ClassBodyToCxx> body => cxx_body + Index: branches/scool-ng/src/scoolt/Function.str =================================================================== --- branches/scool-ng/src/scoolt/Function.str (revision 98) +++ branches/scool-ng/src/scoolt/Function.str (revision 99) @@ -21,7 +21,7 @@ - // Convert parameters (templates) + // Translate parameters (templates) // Parameters in function declarations ParametersToCxx: @@ -46,7 +46,7 @@ - // Convert arguments + // Translate arguments // Arguments in function declarations ArgumentsToCxx: @@ -64,8 +64,17 @@ Arguments(args) -> <map (ExpressionToCxx)> args + // Translate function body + + FunctionBodyToCxx: + body -> cxx_body + where + // body can either be a list of declarations and/or function statements, + // or be a single expression (because of the one-line function sugar) + <map (DeclarationToCxx <+ FunctionStatementToCxx) <+ FunctionStatementToCxx> body => cxx_body - // Convert function statements + + // Translate function statements FunctionStatementToCxx: ReturnStatement(exp) -> CxxExpStm(CxxKeyword("return", cxx_exp)) @@ -81,3 +90,4 @@ exp -> [CxxExpStm(CxxKeyword("return", cxx_exp))] where <ExpressionToCxx> exp => cxx_exp + Index: branches/scool-ng/src/scl-syn/Class.sdf =================================================================== --- branches/scool-ng/src/scl-syn/Class.sdf (revision 98) +++ branches/scool-ng/src/scl-syn/Class.sdf (revision 99) @@ -9,7 +9,7 @@ context-free syntax "{" AccessBlock* "}" -> ClassBlock {cons("ClassBlock")} - AccessModifier "{" Declaration* "}" -> AccessBlock {cons("Accessblock")} + AccessModifier "{" Declaration* "}" -> AccessBlock {cons("AccessBlock")} "public" -> AccessModifier {cons("Public")} "protected" -> AccessModifier {cons("Protected")} Index: branches/scool-ng/src/concrete-syn/concrete-syn.sdf =================================================================== --- branches/scool-ng/src/concrete-syn/concrete-syn.sdf (revision 98) +++ branches/scool-ng/src/concrete-syn/concrete-syn.sdf (revision 99) @@ -15,6 +15,7 @@ "~" StrategoTerm -> SimpleType {cons("FromTerm"), prefer} "~ftype:" StrategoTerm -> FunctionType {cons("FromTerm"), prefer} "~fbody:" StrategoTerm -> FunctionStatement* {cons("FromTerm"), prefer} + "~cbody:" StrategoTerm -> AccessStatement* {cons("FromTerm"), prefer} "~exp:" StrategoTerm -> Expression {cons("FromTerm"), prefer} -- \__/ \__/ (00) Maxime `yabo` van Noppen (00) ___) \ Epita 2009 / (___ (_____/ \_____)
16Â years, 3Â months
1
0
0
0
scool r98: Cleanup tests for classes
by Maxime van Noppen
URL:
https://svn.lrde.epita.fr/svn/scool/branches/scool-ng
ChangeLog: 2008-09-24 Maxime van Noppen <yabo(a)lrde.epita.fr> Cleanup tests for classes * class/c++_ast/empty.aterm: New. * class/c++_ast/empty_accessblocks.aterm: New. * class/c++_ast/empty_private.aterm: New. * class/c++_ast/empty_protected.aterm: New. * class/c++_ast/empty_public.aterm: New. * class/c++_ast/member_001.aterm: New. * class/c++_ast/member_002.aterm: New. * class/c++_ast/method_001.aterm: New. * class/c++_ast/method_002.aterm: New. * class/c++_ast/method_003.aterm: New. * class/c++_ast/method_004.aterm: New. * class/c++_ast/method_005.aterm: New. * class/scool_ast/class_attributes_decl_001.aterm: Remove. * class/scool_ast/class_attributes_decl_002.aterm: Remove. * class/scool_ast/class_decl_inh.aterm: Remove. * class/scool_ast/class_decl_inh_fin.aterm: Remove. * class/scool_ast/class_empty_accessblocks_001.aterm: Remove. * class/scool_ast/class_empty_accessblocks_002.aterm: Remove. * class/scool_ast/class_empty_accessblocks_003.aterm: Remove. * class/scool_ast/class_empty_accessblocks_004.aterm: Remove. * class/scool_ast/class_empty_decl_001.aterm: Remove. * class/scool_ast/class_empty_decl_002.aterm: Remove. * class/scool_ast/class_members_1.aterm: Remove. * class/scool_ast/class_method_decl_001.aterm: Remove. * class/scool_ast/class_method_decl_002.aterm: Remove. * class/scool_ast/class_method_decl_003.aterm: Remove. * class/scool_ast/class_method_decl_004.aterm: Remove. * class/scool_ast/class_method_decl_005.aterm: Remove. * class/scool_ast/class_predecl.aterm: Remove. * class/scool_ast/class_template_1.aterm: Remove. * class/scool_ast/class_template_2.aterm: Remove. * class/scool_ast/class_template_3.aterm: Remove. * class/scool_ast/declaration_001.aterm: New. * class/scool_ast/empty.aterm: New. * class/scool_ast/empty_accessblocks.aterm: New. * class/scool_ast/empty_private.aterm: New. * class/scool_ast/empty_protected.aterm: New. * class/scool_ast/empty_public.aterm: New. * class/scool_ast/final_001.aterm: New. * class/scool_ast/inheritance_001.aterm: New. * class/scool_ast/inheritance_002.aterm: New. * class/scool_ast/member_001.aterm: New. * class/scool_ast/member_002.aterm: New. * class/scool_ast/method_001.aterm: New. * class/scool_ast/method_002.aterm: New. * class/scool_ast/method_003.aterm: New. * class/scool_ast/method_004.aterm: New. * class/scool_ast/method_005.aterm: New. * class/scool_ast/static_function_001.aterm: New. * class/scool_ast/static_function_002.aterm: New. * class/scool_ast/static_function_003.aterm: New. * class/scool_src/class_attributes_decl_001.scl: Remove. * class/scool_src/class_attributes_decl_002.scl: Remove. * class/scool_src/class_decl_inh.scl: Remove. * class/scool_src/class_decl_inh_abst.scl: Remove. * class/scool_src/class_decl_inh_fin.scl: Remove. * class/scool_src/class_empty_accessblocks_001.scl: Remove. * class/scool_src/class_empty_accessblocks_002.scl: Remove. * class/scool_src/class_empty_accessblocks_003.scl: Remove. * class/scool_src/class_empty_accessblocks_004.scl: Remove. * class/scool_src/class_empty_decl_001.scl: Remove. * class/scool_src/class_empty_decl_002.scl: Remove. * class/scool_src/class_members_1.scl: Remove. * class/scool_src/class_method_decl_001.scl: Remove. * class/scool_src/class_method_decl_002.scl: Remove. * class/scool_src/class_method_decl_003.scl: Remove. * class/scool_src/class_method_decl_004.scl: Remove. * class/scool_src/class_method_decl_005.scl: Remove. * class/scool_src/class_predecl.scl: Remove. * class/scool_src/class_predecl_inh.scl: Remove. * class/scool_src/class_template_1.scl: Remove. * class/scool_src/class_template_2.scl: Remove. * class/scool_src/class_template_3.scl: Remove. * class/scool_src/declaration_001.scl: New. * class/scool_src/declaration_002.scl: New. * class/scool_src/empty.scl: New. * class/scool_src/empty_accessblocks.scl: New. * class/scool_src/empty_private.scl: New. * class/scool_src/empty_protected.scl: New. * class/scool_src/empty_public.scl: New. * class/scool_src/final_001.scl: New. * class/scool_src/inheritance_001.scl: New. * class/scool_src/inheritance_002.scl: New. * class/scool_src/inheritance_003.scl: New. * class/scool_src/member_001.scl: New. * class/scool_src/member_002.scl: New. * class/scool_src/method_001.scl: New. * class/scool_src/method_002.scl: New. * class/scool_src/method_003.scl: New. * class/scool_src/method_004.scl: New. * class/scool_src/method_005.scl: New. * class/scool_src/static_function_001.scl: New. * class/scool_src/static_function_002.scl: New. * class/scool_src/static_function_003.scl: New. c++_ast/empty.aterm | 1 + c++_ast/empty_accessblocks.aterm | 1 + c++_ast/empty_private.aterm | 1 + c++_ast/empty_protected.aterm | 1 + c++_ast/empty_public.aterm | 1 + c++_ast/member_001.aterm | 1 + c++_ast/member_002.aterm | 1 + c++_ast/method_001.aterm | 1 + c++_ast/method_002.aterm | 1 + c++_ast/method_003.aterm | 1 + c++_ast/method_004.aterm | 1 + c++_ast/method_005.aterm | 1 + scool_ast/declaration_001.aterm | 1 + scool_ast/empty.aterm | 1 + scool_ast/empty_accessblocks.aterm | 1 + scool_ast/empty_private.aterm | 1 + scool_ast/empty_protected.aterm | 1 + scool_ast/empty_public.aterm | 1 + scool_ast/final_001.aterm | 1 + scool_ast/inheritance_001.aterm | 1 + scool_ast/inheritance_002.aterm | 1 + scool_ast/member_001.aterm | 1 + scool_ast/member_002.aterm | 1 + scool_ast/method_001.aterm | 1 + scool_ast/method_002.aterm | 1 + scool_ast/method_003.aterm | 1 + scool_ast/method_004.aterm | 1 + scool_ast/method_005.aterm | 1 + scool_ast/static_function_001.aterm | 1 + scool_ast/static_function_002.aterm | 1 + scool_ast/static_function_003.aterm | 1 + scool_src/declaration_001.scl | 1 + scool_src/declaration_002.scl | 1 + scool_src/empty.scl | 3 +++ scool_src/empty_accessblocks.scl | 12 ++++++++++++ scool_src/empty_private.scl | 6 ++++++ scool_src/empty_protected.scl | 6 ++++++ scool_src/empty_public.scl | 6 ++++++ scool_src/final_001.scl | 3 +++ scool_src/inheritance_001.scl | 9 +++++++++ scool_src/inheritance_002.scl | 14 ++++++++++++++ scool_src/inheritance_003.scl | 9 +++++++++ scool_src/member_001.scl | 7 +++++++ scool_src/member_002.scl | 8 ++++++++ scool_src/method_001.scl | 10 ++++++++++ scool_src/method_002.scl | 7 +++++++ scool_src/method_003.scl | 8 ++++++++ scool_src/method_004.scl | 15 +++++++++++++++ scool_src/method_005.scl | 17 +++++++++++++++++ scool_src/static_function_001.scl | 3 +++ scool_src/static_function_002.scl | 3 +++ scool_src/static_function_003.scl | 3 +++ 52 files changed, 182 insertions(+) Index: branches/scool-ng/tests/class/c++_ast/empty_private.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/empty_private.aterm (revision 0) +++ branches/scool-ng/tests/class/c++_ast/empty_private.aterm (revision 98) @@ -0,0 +1 @@ +CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Foo"),[],[CxxPrivate([])])]) Index: branches/scool-ng/tests/class/c++_ast/member_002.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/member_002.aterm (revision 0) +++ branches/scool-ng/tests/class/c++_ast/member_002.aterm (revision 98) @@ -0,0 +1 @@ +CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Point2d"),[],[CxxPublic([CxxDecl(CxxType("int"),CxxId("x")),CxxDecl(CxxType("int"),CxxId("y"))])])]) Index: branches/scool-ng/tests/class/c++_ast/empty_public.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/empty_public.aterm (revision 0) +++ branches/scool-ng/tests/class/c++_ast/empty_public.aterm (revision 98) @@ -0,0 +1 @@ +CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Foo"),[],[CxxPublic([])])]) Index: branches/scool-ng/tests/class/c++_ast/empty_accessblocks.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/empty_accessblocks.aterm (revision 0) +++ branches/scool-ng/tests/class/c++_ast/empty_accessblocks.aterm (revision 98) @@ -0,0 +1 @@ +CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Foo"),[],[CxxPublic([]),CxxProtected([]),CxxPrivate([])])]) Index: branches/scool-ng/tests/class/c++_ast/empty.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/empty.aterm (revision 0) +++ branches/scool-ng/tests/class/c++_ast/empty.aterm (revision 98) @@ -0,0 +1 @@ +CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Foo"),[],[])]) Index: branches/scool-ng/tests/class/c++_ast/method_001.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/method_001.aterm (revision 0) +++ branches/scool-ng/tests/class/c++_ast/method_001.aterm (revision 98) @@ -0,0 +1 @@ +CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Foo"),[],[CxxPublic([CxxFun([],CxxType("int"),CxxId("test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("42")))])])])]) Index: branches/scool-ng/tests/class/c++_ast/method_002.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/method_002.aterm (revision 0) +++ branches/scool-ng/tests/class/c++_ast/method_002.aterm (revision 98) @@ -0,0 +1 @@ +CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Foo"),[],[CxxPublic([CxxFun([],CxxType("int"),CxxId("test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("42")))])])])]) Index: branches/scool-ng/tests/class/c++_ast/method_003.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/method_003.aterm (revision 0) +++ branches/scool-ng/tests/class/c++_ast/method_003.aterm (revision 98) @@ -0,0 +1 @@ +CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Foo"),[],[CxxPublic([CxxFun([],CxxType("int"),CxxId("test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("42")))]),CxxFun([],CxxType("int"),CxxId("another_test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("51")))])])])]) Index: branches/scool-ng/tests/class/c++_ast/method_004.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/method_004.aterm (revision 0) +++ branches/scool-ng/tests/class/c++_ast/method_004.aterm (revision 98) @@ -0,0 +1 @@ +CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Foo"),[],[CxxPublic([CxxFun([],CxxType("int"),CxxId("test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("42")))]),CxxFun([],CxxType("int"),CxxId("another_test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("51")))])])])]) Index: branches/scool-ng/tests/class/c++_ast/method_005.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/method_005.aterm (revision 0) +++ branches/scool-ng/tests/class/c++_ast/method_005.aterm (revision 98) @@ -0,0 +1 @@ +CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Foo"),[],[CxxPublic([CxxFun([],CxxType("int"),CxxId("test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("42")))])]),CxxPrivate([CxxFun([],CxxType("int"),CxxId("another_test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("51")))])])])]) Index: branches/scool-ng/tests/class/c++_ast/empty_protected.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/empty_protected.aterm (revision 0) +++ branches/scool-ng/tests/class/c++_ast/empty_protected.aterm (revision 98) @@ -0,0 +1 @@ +CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Foo"),[],[CxxProtected([])])]) Index: branches/scool-ng/tests/class/c++_ast/member_001.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/member_001.aterm (revision 0) +++ branches/scool-ng/tests/class/c++_ast/member_001.aterm (revision 98) @@ -0,0 +1 @@ +CxxProgram([CxxClassDecl((CxxType("typename"),"T"),CxxId("Point1d"),[],[CxxPublic([CxxDecl(CxxType("int"),CxxId("x"))])])]) Index: branches/scool-ng/tests/class/scool_ast/class_method_decl_001.aterm (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_ast/class_method_decl_002.aterm (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_ast/class_method_decl_003.aterm (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_ast/class_method_decl_004.aterm (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_ast/class_method_decl_005.aterm (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_ast/class_template_1.aterm (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_ast/class_template_2.aterm (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_ast/class_empty_accessblocks_001.aterm (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_ast/class_attributes_decl_001.aterm (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_ast/class_template_3.aterm (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_ast/class_empty_accessblocks_002.aterm (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_ast/class_attributes_decl_002.aterm (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_ast/class_empty_accessblocks_003.aterm (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_ast/class_empty_accessblocks_004.aterm (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_ast/class_decl_inh_fin.aterm (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_ast/class_empty_decl_001.aterm (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_ast/class_decl_inh.aterm (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_ast/class_empty_decl_002.aterm (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_ast/class_members_1.aterm (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_ast/class_predecl.aterm (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_ast/inheritance_001.aterm =================================================================== --- branches/scool-ng/tests/class/scool_ast/inheritance_001.aterm (revision 0) +++ branches/scool-ng/tests/class/scool_ast/inheritance_001.aterm (revision 98) @@ -0,0 +1 @@ +Program([ClassDefinition(None,Identifier("Bar"),None,ClassBlock([])),ClassDefinition(None,Identifier("Foo"),Some(ClassWhereClause([Inherits("Foo","Bar")])),ClassBlock([]))]) Index: branches/scool-ng/tests/class/scool_ast/final_001.aterm =================================================================== --- branches/scool-ng/tests/class/scool_ast/final_001.aterm (revision 0) +++ branches/scool-ng/tests/class/scool_ast/final_001.aterm (revision 98) @@ -0,0 +1 @@ +Program([ClassDefinition(Some("final"),Identifier("Student"),None,ClassBlock([]))]) Index: branches/scool-ng/tests/class/scool_ast/inheritance_002.aterm =================================================================== --- branches/scool-ng/tests/class/scool_ast/inheritance_002.aterm (revision 0) +++ branches/scool-ng/tests/class/scool_ast/inheritance_002.aterm (revision 98) @@ -0,0 +1 @@ +Program([ClassDefinition(None,Identifier("Animal"),None,ClassBlock([])),ClassDefinition(None,Identifier("Mammal"),Some(ClassWhereClause([Inherits("Mammal","Animal")])),ClassBlock([])),ClassDefinition(Some("final"),Identifier("Monkey"),Some(ClassWhereClause([Inherits("Monkey","Mammal")])),ClassBlock([]))]) Index: branches/scool-ng/tests/class/scool_ast/static_function_001.aterm =================================================================== --- branches/scool-ng/tests/class/scool_ast/static_function_001.aterm (revision 0) +++ branches/scool-ng/tests/class/scool_ast/static_function_001.aterm (revision 98) @@ -0,0 +1 @@ +Program([StaticClassFunction(None,Identifier("A"),ParametersDeclaration([TypedId(Identifier("T"),"type")]),StaticClassBlock([]))]) Index: branches/scool-ng/tests/class/scool_ast/empty_accessblocks.aterm =================================================================== --- branches/scool-ng/tests/class/scool_ast/empty_accessblocks.aterm (revision 0) +++ branches/scool-ng/tests/class/scool_ast/empty_accessblocks.aterm (revision 98) @@ -0,0 +1 @@ +Program([ClassDefinition(None,Identifier("Foo"),None,ClassBlock([AccessBlock(Public,[]),AccessBlock(Protected,[]),AccessBlock(Private,[])]))]) Index: branches/scool-ng/tests/class/scool_ast/static_function_002.aterm =================================================================== --- branches/scool-ng/tests/class/scool_ast/static_function_002.aterm (revision 0) +++ branches/scool-ng/tests/class/scool_ast/static_function_002.aterm (revision 98) @@ -0,0 +1 @@ +Program([StaticClassFunction(None,Identifier("A"),ParametersDeclaration([TypedId(Identifier("T"),"type"),TypedId(Identifier("B"),SimpleType("bool"))]),StaticClassBlock([]))]) Index: branches/scool-ng/tests/class/scool_ast/static_function_003.aterm =================================================================== --- branches/scool-ng/tests/class/scool_ast/static_function_003.aterm (revision 0) +++ branches/scool-ng/tests/class/scool_ast/static_function_003.aterm (revision 98) @@ -0,0 +1 @@ +Program([StaticClassFunction(None,Identifier("A"),ParametersDeclaration([SimpleType("int")]),StaticClassBlock([]))]) Index: branches/scool-ng/tests/class/scool_ast/member_001.aterm =================================================================== --- branches/scool-ng/tests/class/scool_ast/member_001.aterm (revision 0) +++ branches/scool-ng/tests/class/scool_ast/member_001.aterm (revision 98) @@ -0,0 +1 @@ +Program([ClassDefinition(None,Identifier("Point1d"),None,ClassBlock([AccessBlock(Public,[SimpleDeclaration(Some("var"),Identifier("x"),SimpleType("int"),None)])]))]) Index: branches/scool-ng/tests/class/scool_ast/member_002.aterm =================================================================== --- branches/scool-ng/tests/class/scool_ast/member_002.aterm (revision 0) +++ branches/scool-ng/tests/class/scool_ast/member_002.aterm (revision 98) @@ -0,0 +1 @@ +Program([ClassDefinition(None,Identifier("Point2d"),None,ClassBlock([AccessBlock(Public,[SimpleDeclaration(Some("var"),Identifier("x"),SimpleType("int"),None),SimpleDeclaration(Some("var"),Identifier("y"),SimpleType("int"),None)])]))]) Index: branches/scool-ng/tests/class/scool_ast/empty_private.aterm =================================================================== --- branches/scool-ng/tests/class/scool_ast/empty_private.aterm (revision 0) +++ branches/scool-ng/tests/class/scool_ast/empty_private.aterm (revision 98) @@ -0,0 +1 @@ +Program([ClassDefinition(None,Identifier("Foo"),None,ClassBlock([AccessBlock(Private,[])]))]) Index: branches/scool-ng/tests/class/scool_ast/empty_public.aterm =================================================================== --- branches/scool-ng/tests/class/scool_ast/empty_public.aterm (revision 0) +++ branches/scool-ng/tests/class/scool_ast/empty_public.aterm (revision 98) @@ -0,0 +1 @@ +Program([ClassDefinition(None,Identifier("Foo"),None,ClassBlock([AccessBlock(Public,[])]))]) Index: branches/scool-ng/tests/class/scool_ast/empty.aterm =================================================================== --- branches/scool-ng/tests/class/scool_ast/empty.aterm (revision 0) +++ branches/scool-ng/tests/class/scool_ast/empty.aterm (revision 98) @@ -0,0 +1 @@ +Program([ClassDefinition(None,Identifier("Foo"),None,ClassBlock([]))]) Index: branches/scool-ng/tests/class/scool_ast/method_001.aterm =================================================================== --- branches/scool-ng/tests/class/scool_ast/method_001.aterm (revision 0) +++ branches/scool-ng/tests/class/scool_ast/method_001.aterm (revision 98) @@ -0,0 +1 @@ +Program([ClassDefinition(None,Identifier("Foo"),None,ClassBlock([AccessBlock(Public,[FunctionDefinition(None,Identifier("test"),FunctionType(None,ArgumentsDeclaration([]),SimpleType("int")),FunctionBlock([ReturnStatement(Integer("42"))]))])]))]) Index: branches/scool-ng/tests/class/scool_ast/method_002.aterm =================================================================== --- branches/scool-ng/tests/class/scool_ast/method_002.aterm (revision 0) +++ branches/scool-ng/tests/class/scool_ast/method_002.aterm (revision 98) @@ -0,0 +1 @@ +Program([ClassDefinition(None,Identifier("Foo"),None,ClassBlock([AccessBlock(Public,[FunctionDefinition(None,Identifier("test"),FunctionType(None,ArgumentsDeclaration([]),SimpleType("int")),FunctionBlock(Integer("42")))])]))]) Index: branches/scool-ng/tests/class/scool_ast/method_003.aterm =================================================================== --- branches/scool-ng/tests/class/scool_ast/method_003.aterm (revision 0) +++ branches/scool-ng/tests/class/scool_ast/method_003.aterm (revision 98) @@ -0,0 +1 @@ +Program([ClassDefinition(None,Identifier("Foo"),None,ClassBlock([AccessBlock(Public,[FunctionDefinition(None,Identifier("test"),FunctionType(None,ArgumentsDeclaration([]),SimpleType("int")),FunctionBlock(Integer("42"))),FunctionDefinition(None,Identifier("another_test"),FunctionType(None,ArgumentsDeclaration([]),SimpleType("int")),FunctionBlock(Integer("51")))])]))]) Index: branches/scool-ng/tests/class/scool_ast/method_004.aterm =================================================================== --- branches/scool-ng/tests/class/scool_ast/method_004.aterm (revision 0) +++ branches/scool-ng/tests/class/scool_ast/method_004.aterm (revision 98) @@ -0,0 +1 @@ +Program([ClassDefinition(None,Identifier("Foo"),None,ClassBlock([AccessBlock(Public,[FunctionDefinition(None,Identifier("test"),FunctionType(None,ArgumentsDeclaration([]),SimpleType("int")),FunctionBlock([ReturnStatement(Integer("42"))])),FunctionDefinition(None,Identifier("another_test"),FunctionType(None,ArgumentsDeclaration([]),SimpleType("int")),FunctionBlock([ReturnStatement(Integer("51"))]))])]))]) Index: branches/scool-ng/tests/class/scool_ast/method_005.aterm =================================================================== --- branches/scool-ng/tests/class/scool_ast/method_005.aterm (revision 0) +++ branches/scool-ng/tests/class/scool_ast/method_005.aterm (revision 98) @@ -0,0 +1 @@ +Program([ClassDefinition(None,Identifier("Foo"),None,ClassBlock([AccessBlock(Public,[FunctionDefinition(None,Identifier("test"),FunctionType(None,ArgumentsDeclaration([]),SimpleType("int")),FunctionBlock([ReturnStatement(Integer("42"))]))]),AccessBlock(Private,[FunctionDefinition(None,Identifier("another_test"),FunctionType(None,ArgumentsDeclaration([]),SimpleType("int")),FunctionBlock([ReturnStatement(Integer("51"))]))])]))]) Index: branches/scool-ng/tests/class/scool_ast/declaration_001.aterm =================================================================== --- branches/scool-ng/tests/class/scool_ast/declaration_001.aterm (revision 0) +++ branches/scool-ng/tests/class/scool_ast/declaration_001.aterm (revision 98) @@ -0,0 +1 @@ +Program([ClassDeclaration(None,Identifier("Foo"))]) Index: branches/scool-ng/tests/class/scool_ast/empty_protected.aterm =================================================================== --- branches/scool-ng/tests/class/scool_ast/empty_protected.aterm (revision 0) +++ branches/scool-ng/tests/class/scool_ast/empty_protected.aterm (revision 98) @@ -0,0 +1 @@ +Program([ClassDefinition(None,Identifier("Foo"),None,ClassBlock([AccessBlock(Protected,[])]))]) Index: branches/scool-ng/tests/class/scool_src/class_members_1.scl (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_src/class_predecl_inh.scl (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_src/class_decl_inh_abst.scl (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_src/class_predecl.scl (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_src/class_method_decl_001.scl (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_src/class_method_decl_002.scl (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_src/class_method_decl_003.scl (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_src/class_method_decl_004.scl (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_src/class_method_decl_005.scl (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_src/class_template_1.scl (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_src/class_template_2.scl (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_src/class_empty_accessblocks_001.scl (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_src/class_attributes_decl_001.scl (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_src/class_template_3.scl (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_src/class_empty_accessblocks_002.scl (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_src/class_attributes_decl_002.scl (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_src/class_empty_accessblocks_003.scl (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_src/class_empty_accessblocks_004.scl (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_src/class_decl_inh_fin.scl (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_src/class_empty_decl_001.scl (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_src/class_decl_inh.scl (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_src/class_empty_decl_002.scl (deleted) =================================================================== Index: branches/scool-ng/tests/class/scool_src/method_001.scl =================================================================== --- branches/scool-ng/tests/class/scool_src/method_001.scl (revision 0) +++ branches/scool-ng/tests/class/scool_src/method_001.scl (revision 98) @@ -0,0 +1,10 @@ +Foo : class = +{ + public + { + test : () -> int = + { + -> 42; + } + } +} Index: branches/scool-ng/tests/class/scool_src/method_002.scl =================================================================== --- branches/scool-ng/tests/class/scool_src/method_002.scl (revision 0) +++ branches/scool-ng/tests/class/scool_src/method_002.scl (revision 98) @@ -0,0 +1,7 @@ +Foo : class = +{ + public + { + test : () -> int = 42; + } +} Index: branches/scool-ng/tests/class/scool_src/method_003.scl =================================================================== --- branches/scool-ng/tests/class/scool_src/method_003.scl (revision 0) +++ branches/scool-ng/tests/class/scool_src/method_003.scl (revision 98) @@ -0,0 +1,8 @@ +Foo : class = +{ + public + { + test : () -> int = 42; + another_test : () -> int = 51; + } +} Index: branches/scool-ng/tests/class/scool_src/method_004.scl =================================================================== --- branches/scool-ng/tests/class/scool_src/method_004.scl (revision 0) +++ branches/scool-ng/tests/class/scool_src/method_004.scl (revision 98) @@ -0,0 +1,15 @@ +Foo : class = +{ + public + { + test : () -> int = + { + -> 42; + } + + another_test : () -> int = + { + -> 51; + } + } +} Index: branches/scool-ng/tests/class/scool_src/method_005.scl =================================================================== --- branches/scool-ng/tests/class/scool_src/method_005.scl (revision 0) +++ branches/scool-ng/tests/class/scool_src/method_005.scl (revision 98) @@ -0,0 +1,17 @@ +Foo : class = +{ + public + { + test : () -> int = + { + -> 42; + } + } + private + { + another_test : () -> int = + { + -> 51; + } + } +} Index: branches/scool-ng/tests/class/scool_src/declaration_001.scl =================================================================== --- branches/scool-ng/tests/class/scool_src/declaration_001.scl (revision 0) +++ branches/scool-ng/tests/class/scool_src/declaration_001.scl (revision 98) @@ -0,0 +1 @@ +Foo : class; Index: branches/scool-ng/tests/class/scool_src/declaration_002.scl =================================================================== --- branches/scool-ng/tests/class/scool_src/declaration_002.scl (revision 0) +++ branches/scool-ng/tests/class/scool_src/declaration_002.scl (revision 98) @@ -0,0 +1 @@ +Foo : class where Foo -> Bar; Index: branches/scool-ng/tests/class/scool_src/empty_protected.scl =================================================================== --- branches/scool-ng/tests/class/scool_src/empty_protected.scl (revision 0) +++ branches/scool-ng/tests/class/scool_src/empty_protected.scl (revision 98) @@ -0,0 +1,6 @@ +Foo : class = +{ + protected + { + } +} Index: branches/scool-ng/tests/class/scool_src/inheritance_001.scl =================================================================== --- branches/scool-ng/tests/class/scool_src/inheritance_001.scl (revision 0) +++ branches/scool-ng/tests/class/scool_src/inheritance_001.scl (revision 98) @@ -0,0 +1,9 @@ +Bar: class = +{ + +} + +Foo : class where Foo -> Bar = +{ + +} Index: branches/scool-ng/tests/class/scool_src/final_001.scl =================================================================== --- branches/scool-ng/tests/class/scool_src/final_001.scl (revision 0) +++ branches/scool-ng/tests/class/scool_src/final_001.scl (revision 98) @@ -0,0 +1,3 @@ +final Student : class = +{ +} Index: branches/scool-ng/tests/class/scool_src/inheritance_002.scl =================================================================== --- branches/scool-ng/tests/class/scool_src/inheritance_002.scl (revision 0) +++ branches/scool-ng/tests/class/scool_src/inheritance_002.scl (revision 98) @@ -0,0 +1,14 @@ +Animal: class = +{ + +} + +Mammal : class where Mammal -> Animal = +{ + +} + +final Monkey : class where Monkey -> Mammal = +{ + +} Index: branches/scool-ng/tests/class/scool_src/inheritance_003.scl =================================================================== --- branches/scool-ng/tests/class/scool_src/inheritance_003.scl (revision 0) +++ branches/scool-ng/tests/class/scool_src/inheritance_003.scl (revision 98) @@ -0,0 +1,9 @@ +abstract Animal: class = +{ + +} + +Mammal : class where Mamman -> Animal = +{ + +} Index: branches/scool-ng/tests/class/scool_src/static_function_001.scl =================================================================== --- branches/scool-ng/tests/class/scool_src/static_function_001.scl (revision 0) +++ branches/scool-ng/tests/class/scool_src/static_function_001.scl (revision 98) @@ -0,0 +1,3 @@ +A : [T : type] -> class = +{ +} Index: branches/scool-ng/tests/class/scool_src/empty_accessblocks.scl =================================================================== --- branches/scool-ng/tests/class/scool_src/empty_accessblocks.scl (revision 0) +++ branches/scool-ng/tests/class/scool_src/empty_accessblocks.scl (revision 98) @@ -0,0 +1,12 @@ +Foo : class = +{ + public + { + } + protected + { + } + private + { + } +} Index: branches/scool-ng/tests/class/scool_src/static_function_002.scl =================================================================== --- branches/scool-ng/tests/class/scool_src/static_function_002.scl (revision 0) +++ branches/scool-ng/tests/class/scool_src/static_function_002.scl (revision 98) @@ -0,0 +1,3 @@ +A : [T : type, B : bool] -> class = +{ +} Index: branches/scool-ng/tests/class/scool_src/static_function_003.scl =================================================================== --- branches/scool-ng/tests/class/scool_src/static_function_003.scl (revision 0) +++ branches/scool-ng/tests/class/scool_src/static_function_003.scl (revision 98) @@ -0,0 +1,3 @@ +A : [int] -> class = +{ +} Index: branches/scool-ng/tests/class/scool_src/member_001.scl =================================================================== --- branches/scool-ng/tests/class/scool_src/member_001.scl (revision 0) +++ branches/scool-ng/tests/class/scool_src/member_001.scl (revision 98) @@ -0,0 +1,7 @@ +Point1d : class = +{ + public + { + var x : int; + } +} Index: branches/scool-ng/tests/class/scool_src/member_002.scl =================================================================== --- branches/scool-ng/tests/class/scool_src/member_002.scl (revision 0) +++ branches/scool-ng/tests/class/scool_src/member_002.scl (revision 98) @@ -0,0 +1,8 @@ +Point2d : class = +{ + public + { + var x : int; + var y : int; + } +} Index: branches/scool-ng/tests/class/scool_src/empty_private.scl =================================================================== --- branches/scool-ng/tests/class/scool_src/empty_private.scl (revision 0) +++ branches/scool-ng/tests/class/scool_src/empty_private.scl (revision 98) @@ -0,0 +1,6 @@ +Foo : class = +{ + private + { + } +} Index: branches/scool-ng/tests/class/scool_src/empty_public.scl =================================================================== --- branches/scool-ng/tests/class/scool_src/empty_public.scl (revision 0) +++ branches/scool-ng/tests/class/scool_src/empty_public.scl (revision 98) @@ -0,0 +1,6 @@ +Foo : class = +{ + public + { + } +} Index: branches/scool-ng/tests/class/scool_src/empty.scl =================================================================== --- branches/scool-ng/tests/class/scool_src/empty.scl (revision 0) +++ branches/scool-ng/tests/class/scool_src/empty.scl (revision 98) @@ -0,0 +1,3 @@ +Foo : class = +{ +} -- \__/ \__/ (00) Maxime `yabo` van Noppen (00) ___) \ Epita 2009 / (___ (_____/ \_____)
16Â years, 3Â months
1
0
0
0
cleanup-2008 2389: Make w_window tests pass with from_to instead of to_w_window.
by Thierry Geraud
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog from Thierry Geraud <thierry.geraud(a)lrde.epita.fr> Make w_window tests pass with from_to instead of to_w_window. * mln/core/w_window.hh (win): Update sig. (clear): New. (from_to): New overload. * mln/core/internal/site_relative_iterator_base.hh: Update. * mln/core/neighb.hh: Update. * mln/core/concept/proxy.hh (from_to): New overload. * mln/core/concept/weighted_window.hh (sym): Update. * mln/core/concept/gpoint.hh (from_to): New overload. * mln/convert/to.hh: Decouple from convert::from_to so... (include from_to.hh): Replace by... (include from_to.hxx): ...this. Update includes. * mln/convert/to_image.hh: Fix temporary; O can be *-able. * mln/geom/bbox.hh: Likewise. * mln/convert/to_w_window.hh: Remove; obsolete because replaced by from_to. * mln/convert/from_to.hh: Fix ambiguities in multiple guards; keep only one. * mln/convert/all.hh, * tests/core/alias/w_window1d_int.cc, * tests/core/alias/w_window2d_int.cc, * tests/core/alias/w_window3d_int.cc: Update. * mln/convert/from_to.hxx: New. mln/convert/all.hh | 1 mln/convert/from_to.hh | 32 ---- mln/convert/from_to.hxx | 151 +++++++++++++++++++++++ mln/convert/to.hh | 7 - mln/convert/to_image.hh | 3 mln/core/concept/gpoint.hh | 34 +++++ mln/core/concept/proxy.hh | 30 ++++ mln/core/concept/weighted_window.hh | 4 mln/core/internal/site_relative_iterator_base.hh | 2 mln/core/neighb.hh | 1 mln/core/w_window.hh | 64 ++++++++- mln/geom/bbox.hh | 3 tests/core/alias/w_window1d_int.cc | 8 - tests/core/alias/w_window2d_int.cc | 8 - tests/core/alias/w_window3d_int.cc | 5 15 files changed, 302 insertions(+), 51 deletions(-) Index: tests/core/alias/w_window1d_int.cc --- tests/core/alias/w_window1d_int.cc (revision 2388) +++ tests/core/alias/w_window1d_int.cc (working copy) @@ -30,11 +30,12 @@ #include <mln/core/alias/w_window1d_int.hh> #include <mln/win/segment1d.hh> +#include <mln/convert/to.hh> +#include <mln/convert/to.hh> +#include <mln/convert/to_fun.hh> #include <mln/convert/to_image.hh> -#include <mln/convert/to_w_window.hh> -#include <mln/convert/to_fun.hh> #include <mln/estim/sum.hh> @@ -53,7 +54,8 @@ w_window1d_int w_win = make::w_window1d(ws); image1d<int> ima = convert::to_image(w_win); - w_window1d_int w_win_2 = mln::convert::to<w_window1d_int>(ima); + + w_window1d_int w_win_2 = convert::to<w_window1d_int>(ima); mln_assertion(w_win_2 == w_win); } Index: tests/core/alias/w_window2d_int.cc --- tests/core/alias/w_window2d_int.cc (revision 2388) +++ tests/core/alias/w_window2d_int.cc (working copy) @@ -1,4 +1,4 @@ -// Copyright (C) 2007 EPITA Research and Development Laboratory +// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -33,10 +33,10 @@ #include <mln/core/alias/w_window2d_int.hh> #include <mln/win/rectangle2d.hh> +#include <mln/convert/to.hh> #include <mln/convert/to_image.hh> -#include <mln/convert/to_w_window.hh> - #include <mln/convert/to_fun.hh> + #include <mln/estim/sum.hh> @@ -57,7 +57,7 @@ w_window2d_int w_win = make::w_window2d(ws); image2d<int> ima = convert::to_image(w_win); - w_window2d_int w_win_2 = convert::to_w_window(ima); + w_window2d_int w_win_2 = convert::to<w_window2d_int>(ima); mln_assertion(w_win_2 == w_win); } Index: tests/core/alias/w_window3d_int.cc --- tests/core/alias/w_window3d_int.cc (revision 2388) +++ tests/core/alias/w_window3d_int.cc (working copy) @@ -33,9 +33,8 @@ #include <mln/core/alias/w_window3d_int.hh> #include <mln/win/cube3d.hh> +#include <mln/convert/to.hh> #include <mln/convert/to_image.hh> -#include <mln/convert/to_w_window.hh> - #include <mln/convert/to_fun.hh> #include <mln/estim/sum.hh> @@ -67,7 +66,7 @@ image3d<int> ima = convert::to_image(w_win); debug::println(ima); std::cout << std::endl; - w_window3d_int w_win_2 = convert::to_w_window(ima); + w_window3d_int w_win_2 = convert::to<w_window3d_int>(ima); mln_assertion(w_win_2 == w_win); } Index: mln/core/w_window.hh --- mln/core/w_window.hh (revision 2388) +++ mln/core/w_window.hh (working copy) @@ -1,4 +1,4 @@ -// Copyright (C) 2007 EPITA Research and Development Laboratory +// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -35,11 +35,17 @@ # include <map> -# include <mln/core/window.hh> # include <mln/core/concept/weighted_window.hh> +# include <mln/core/concept/image.hh> +# include <mln/core/window.hh> # include <mln/core/dpsites_piter.hh> + # include <mln/value/ops.hh> # include <mln/util/ord.hh> +# include <mln/metal/converts_to.hh> +# include <mln/literal/zero.hh> +# include <mln/convert/to.hh> + namespace mln { @@ -109,8 +115,11 @@ const mln::window<D>& win() const; - /// Apply a central symmetry to the target window. - w_window<D,W>& sym(); + /// Apply a central symmetry to the window. + void sym(); + + /// Clear this window. + void clear(); protected: @@ -119,6 +128,17 @@ }; + namespace convert + { + + template <typename I, typename D, typename W> + inline + void + from_to(const Image<I>& from, w_window<D,W>& to); + + } // end of namespace mln::convert + + /* \brief Print a weighted window \p w_win into an output stream \p ostr. * \relates mln::w_window */ @@ -268,16 +288,48 @@ template <typename D, typename W> inline - w_window<D,W>& + void w_window<D,W>::sym() { w_window<D,W> tmp; for (unsigned i = 0; i < this->size(); ++i) tmp.insert(this->w(i), - this->dp(i)); *this = tmp; - return *this; } + template <typename D, typename W> + inline + void + w_window<D,W>::clear() + { + win_.clear(); + wei_.clear(); + } + + + // convert::from_to + + namespace convert + { + + template <typename I, typename D, typename W> + inline + void + from_to(const Image<I>& from_, w_window<D,W>& to) + { + mlc_converts_to(mln_deduce(I, psite, delta), D)::check(); + mlc_converts_to(mln_value(I), W)::check(); + const I& ima = exact(from_); + to.clear(); + mln_piter(I) p(ima.domain()); + for_all(p) + if (ima(p) != literal::zero) + to.insert(ima(p), convert::to<D>(p)); + } + + } // end of namespace mln::convert + + // operators template <typename D, typename W> Index: mln/core/internal/site_relative_iterator_base.hh --- mln/core/internal/site_relative_iterator_base.hh (revision 2388) +++ mln/core/internal/site_relative_iterator_base.hh (working copy) @@ -139,6 +139,8 @@ site_relative_iterator_base<S,E>::center_at(const P& c) { internal::get_adr(c_, c); + mln_precondition(c_ != 0); + // c_ == 0 means that the center c does not have the expected type. this->invalidate(); } Index: mln/core/neighb.hh --- mln/core/neighb.hh (revision 2388) +++ mln/core/neighb.hh (working copy) @@ -42,7 +42,6 @@ # include <mln/core/concept/window.hh> # include <mln/core/internal/neighborhood_base.hh> # include <mln/core/internal/site_relative_iterator_base.hh> -# include <mln/convert/from_to.hh> Index: mln/core/concept/proxy.hh --- mln/core/concept/proxy.hh (revision 2388) +++ mln/core/concept/proxy.hh (working copy) @@ -41,6 +41,7 @@ # include <mln/core/concept/object.hh> # include <mln/value/ops.hh> // So that we can handle builtins, scalars, and objects. +# include <mln/convert/from_to.hxx> # include <mln/core/concept/proxy.hxx> @@ -200,6 +201,19 @@ }; + // convert::from_to + + namespace convert + { + + template <typename P, typename T> + void + from_to(const Proxy<P>& from, T& to); + + } // end of namespace mln::convert + + + // subject template <typename T> @@ -273,6 +287,22 @@ } + + // convert::from_to + + namespace convert + { + + template <typename P, typename T> + void + from_to(const Proxy<P>& from, T& to) + { + from_to(exact(from).unproxy_(), to); + } + + } // end of namespace mln::convert + + // unproxy_rec template <typename T> Index: mln/core/concept/weighted_window.hh --- mln/core/concept/weighted_window.hh (revision 2388) +++ mln/core/concept/weighted_window.hh (working copy) @@ -1,4 +1,4 @@ -// Copyright (C) 2007 EPITA Research and Development Laboratory +// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -122,7 +122,7 @@ typedef mln_fwd_qiter(W) fwd_qiter; typedef mln_bkd_qiter(W) bkd_qiter; - W& (W::*m1)() = & W::sym; + void (W::*m1)() = & W::sym; m1 = 0; const window& (W::*m2)() const = & W::win; Index: mln/core/concept/gpoint.hh --- mln/core/concept/gpoint.hh (revision 2388) +++ mln/core/concept/gpoint.hh (working copy) @@ -113,6 +113,16 @@ }; + namespace convert + { + + template <typename P> + void + from_to(const Gpoint<P>& from, mln_delta(P)& to); + + } // end of namespace::convert + + /*! \brief Equality comparison between a couple of grid point \p lhs * and \p rhs. @@ -252,6 +262,7 @@ # ifndef MLN_INCLUDE_ONLY + // Gpoint template <typename E> @@ -265,6 +276,29 @@ m = 0; } + + // convert::from_to + + namespace convert + { + + template <typename P> + inline + void + from_to(const Gpoint<P>& p_, mln_delta(P)& dp) + { + // Instead of "dp.to_vec() = exact(p).to_vec();" that + // does not compile (cause to_vec returns const), we + // have: + enum { n = P::dim }; + const P& p = exact(p_); + for (unsigned i = 0; i < n; ++i) + dp[i] = p[i]; + } + + } // end of namespace::convert + + // Operators. template <typename L, typename R> Index: mln/convert/to.hh --- mln/convert/to.hh (revision 2388) +++ mln/convert/to.hh (working copy) @@ -35,7 +35,10 @@ * \todo Prefer a static check that fails in the "unknown" case. */ -# include <mln/convert/from_to.hh> +# include <mln/core/routine/exact.hh> +# include <mln/metal/equal.hh> +# include <mln/trace/all.hh> +# include <mln/convert/from_to.hxx> namespace mln @@ -47,7 +50,6 @@ /// Conversion of the object \p from towards an object with type \c T. template <typename T, typename O> - inline T to(const O& from); @@ -57,7 +59,6 @@ # ifndef MLN_INCLUDE_ONLY - template <typename T, typename O> inline T Index: mln/convert/to_image.hh --- mln/convert/to_image.hh (revision 2388) +++ mln/convert/to_image.hh (working copy) @@ -156,7 +156,8 @@ box<P> b = geom::bbox(win); mln_image_from(W, bool) ima(b); level::fill(ima, false); - mln_qiter(W) q(win, P::origin); + P O = P::origin; + mln_qiter(W) q(win, O); for_all(q) ima(q) = true; return ima; Index: mln/convert/from_to.hh --- mln/convert/from_to.hh (revision 2388) +++ mln/convert/from_to.hh (working copy) @@ -59,20 +59,11 @@ { - /// Guards. - template <typename F, typename T> - void - from_to(const F& from, Object<T>& to); - + /// Guard. template <typename F, typename T> void from_to(const Object<F>& from, Object<T>& to); - template <typename F, typename T> - void - from_to(const Object<F>& from, T& to); - /// end of Guards. - template <typename T> void @@ -87,29 +78,18 @@ # ifndef MLN_INCLUDE_ONLY - /// Guards. - template <typename F, typename T> - void - from_to(const F&, Object<T>&) - { - mlc_abort(F)::check(); - } - + // Guard. template <typename F, typename T> void from_to(const Object<F>&, Object<T>&) { + // This particular from-to is not defined! + // + // Either this conversion is meaningless or an overload is + // missing. mlc_abort(F)::check(); } - template <typename F, typename T> - void - from_to(const Object<F>&, T&) - { - mlc_abort(F)::check(); - } - /// end of Guards. - // Image -> Site_Set. template <typename I, typename S> Index: mln/convert/all.hh --- mln/convert/all.hh (revision 2388) +++ mln/convert/all.hh (working copy) @@ -50,6 +50,5 @@ # include <mln/convert/to_tiles.hh> # include <mln/convert/to_p_array.hh> # include <mln/convert/to_window.hh> -# include <mln/convert/to_w_window.hh> #endif // ! MLN_CONVERT_ALL_HH Index: mln/convert/from_to.hxx --- mln/convert/from_to.hxx (revision 0) +++ mln/convert/from_to.hxx (revision 0) @@ -0,0 +1,151 @@ +// Copyright (C) 2008 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_CONVERT_FROM_TO_HXX +# define MLN_CONVERT_FROM_TO_HXX + +/// \internal \file mln/convert/from_to.hxx + +// All overloaded "convert::from_to" routines have to be declared in +// the present file. It allows for *deferred* use of these routines. + + +namespace mln +{ + + + // Forward declarations. + + template <typename E> struct Object; + template <typename E> struct Proxy; + template <typename E> struct Image; + template <typename E> struct Site_Set; + template <typename E> struct Weighted_Window; + template <typename E> struct Gpoint; + template <typename E> struct Value; + + template <typename D, typename W> class w_window; + template <typename D> class neighb; + template <typename D> class window; + + namespace algebra { + template <unsigned n, typename T> class vec; + template <unsigned d, typename C> class h_vec; + } + + namespace value { + template <unsigned n> struct rgb; + } + + // end of Forward declarations. + + + + // convert::to + + namespace convert + { + + template <typename T, typename O> + T + to(const O& from); + + } // end of namespace mln::convert + + + + // convert::from_to + + namespace convert + { + + // Guard. + template <typename F, typename T> + void + from_to(const Object<F>&, Object<T>&); + + // Image -> Site_Set. + template <typename I, typename S> + void + from_to(const Image<I>& from, Site_Set<S>& to); + + // algebra::vec -> Gpoint. + template <unsigned n, typename T, typename P> + void + from_to(const algebra::vec<n,T>& from, Gpoint<P>& to_); + + // algebra::vec -> rgb. + template <typename T, unsigned m> + void + from_to(const algebra::vec<3,T>& from, value::rgb<m>& to); + + // Value -> Value + template <typename F, typename T> + void + from_to(const Value<F>& from, Value<T>& to); + + // float -> Object + template <typename T> + void + from_to(const float& from, Object<T>& to); + + // int -> Object + template <typename T> + void + from_to(const int& from, Object<T>& to); + + // Proxy -> T + template <typename P, typename T> + void + from_to(const Proxy<P>& from, T& to); + + // Gpoint -> delta + template <typename P> + void + from_to(const Gpoint<P>& from, mln_delta(P)& to); + + // Image -> w_window + template <typename I, typename D, typename W> + void + from_to(const Image<I>& from, w_window<D,W>& to); + + // neighb<W> -> W + template <typename W> + void + from_to(const mln::neighb<W>& from, W& to); + + // W -> neighb<W> + template <typename W> + void + from_to(const W& from, mln::neighb<W>& to); + + } // end of namespace mln::convert + +} // end of namespace mln + + +#endif // ! MLN_CONVERT_FROM_TO_HXX Index: mln/geom/bbox.hh --- mln/geom/bbox.hh (revision 2388) +++ mln/geom/bbox.hh (working copy) @@ -145,7 +145,8 @@ { typedef mln_psite(W) P; accu::bbox<P> b; - mln_qiter(W) q(exact(win), literal::origin); + P O = literal::origin; + mln_qiter(W) q(exact(win), O); for_all(q) b.take(q); return b;
16Â years, 3Â months
1
0
0
0
scool r97: Handle static function calls
by Maxime van Noppen
URL:
https://svn.lrde.epita.fr/svn/scool/branches/scool-ng
ChangeLog: 2008-09-24 Maxime van Noppen <yabo(a)lrde.epita.fr> Handle static function calls * cxx-syn/CxxType.sdf: Allow litteral expressions as template * parameters. * scoolt/Declaration.str: Consider types as being static expressions * rather than just simple types. * scoolt/Expression.str: Handle the StaticFunctionCall constructor. * scoolt/Function.str: Handle the case where the parameters are not * optional and therefore not in a Some() construct. cxx-syn/CxxType.sdf | 3 +++ scoolt/Declaration.str | 16 ++++++++-------- scoolt/Expression.str | 6 ++++++ scoolt/Function.str | 5 ++++- 4 files changed, 21 insertions(+), 9 deletions(-) Index: branches/scool-ng/src/scoolt/Expression.str =================================================================== --- branches/scool-ng/src/scoolt/Expression.str (revision 96) +++ branches/scool-ng/src/scoolt/Expression.str (revision 97) @@ -49,3 +49,9 @@ StaticExpressionToCxx: SimpleType(type) -> CxxType(type) + + StaticExpressionToCxx: + StaticFunctionCall(idf, params) -> CxxType(cxx_idf, cxx_params) + where + <IdentifierToCxx> idf => cxx_idf + ; <ParametersToCxx> params => cxx_params Index: branches/scool-ng/src/scoolt/Declaration.str =================================================================== --- branches/scool-ng/src/scoolt/Declaration.str (revision 96) +++ branches/scool-ng/src/scoolt/Declaration.str (revision 97) @@ -11,29 +11,29 @@ DeclarationToCxx: |[ ~idf : ~type; ]| -> ![ const ~cxx_type ~cxx_idf; ]! where - <TypeToCxx> type => cxx_type - ; <IdentifierToCxx> idf => cxx_idf + <IdentifierToCxx> idf => cxx_idf + ; <StaticExpressionToCxx> type => cxx_type DeclarationToCxx: // |[ var ~i : ~t; ]| -> ![ ~cxx_t ~cxx_i; ]! SimpleDeclaration(Some("var"), idf, type, None()) -> ![ ~cxx_type ~cxx_idf; ]! where - <TypeToCxx> type => cxx_type - ; <IdentifierToCxx> idf => cxx_idf + <IdentifierToCxx> idf => cxx_idf + ; <StaticExpressionToCxx> type => cxx_type DeclarationToCxx: |[ ~idf : ~type = ~exp:exp; ]| -> ![ const ~cxx_type ~cxx_idf = ~exp:cxx_exp; ]! where - <TypeToCxx> type => cxx_type - ; <IdentifierToCxx> idf => cxx_idf + <IdentifierToCxx> idf => cxx_idf + ; <StaticExpressionToCxx> type => cxx_type ; <ExpressionToCxx> exp => cxx_exp DeclarationToCxx: // |[ var ~i : ~t = ~exp:exp; ]| -> ![ ~cxx_t ~cxx_i = ~exp:cxx_exp; ]! SimpleDeclaration(Some("var"), idf, type, Some(Initialiser(exp))) -> ![ ~cxx_type ~cxx_idf = ~exp:cxx_exp; ]! where - <TypeToCxx> type => cxx_type - ; <IdentifierToCxx> idf => cxx_idf + <IdentifierToCxx> idf => cxx_idf + ; <StaticExpressionToCxx> type => cxx_type ; <ExpressionToCxx> exp => cxx_exp Index: branches/scool-ng/src/scoolt/Function.str =================================================================== --- branches/scool-ng/src/scoolt/Function.str (revision 96) +++ branches/scool-ng/src/scoolt/Function.str (revision 97) @@ -38,7 +38,10 @@ // Parameters in function calls ParametersToCxx: - Some(Parameters(params)) -> <map (StaticExpressionToCxx)> params + Some(params) -> <ParametersToCxx> params + + ParametersToCxx: + Parameters(params) -> <map (StaticExpressionToCxx)> params Index: branches/scool-ng/src/cxx-syn/CxxType.sdf =================================================================== --- branches/scool-ng/src/cxx-syn/CxxType.sdf (revision 96) +++ branches/scool-ng/src/cxx-syn/CxxType.sdf (revision 97) @@ -8,7 +8,10 @@ context-free syntax CxxId -> CxxType {cons("CxxType")} + CxxId "<" {CxxType ","}* ">" -> CxxType {cons("CxxType")} + CxxId "<" {CxxExp ","}* ">" -> CxxType {cons("CxxType")} + "const" CxxType -> CxxType {cons("CxxConstType")} CxxType "&" -> CxxType {cons("CxxRefType")} -- \__/ \__/ (00) Maxime `yabo` van Noppen (00) ___) \ Epita 2009 / (___ (_____/ \_____)
16Â years, 3Â months
1
0
0
0
scool r96: Add reference files for tests on static function calls
by Maxime van Noppen
URL:
https://svn.lrde.epita.fr/svn/scool/branches/scool-ng
ChangeLog: 2008-09-24 Maxime van Noppen <yabo(a)lrde.epita.fr> Add reference files for tests on static function calls * variable/c++_ast/declaration_005.aterm: New. * variable/c++_src/declaration_005.cc: New. * variable/c++_src/declaration_008.cc: New. * variable/c++_src/mixed_declarations_001.cc: New. c++_ast/declaration_005.aterm | 1 + c++_src/declaration_005.cc | 1 + c++_src/declaration_008.cc | 1 + c++_src/mixed_declarations_001.cc | 3 +++ 4 files changed, 6 insertions(+) Index: branches/scool-ng/tests/variable/c++_ast/declaration_005.aterm =================================================================== --- branches/scool-ng/tests/variable/c++_ast/declaration_005.aterm (revision 0) +++ branches/scool-ng/tests/variable/c++_ast/declaration_005.aterm (revision 96) @@ -0,0 +1 @@ +CxxProgram([CxxDecl(CxxType(CxxId("list"),[CxxType("int")]),CxxId("l"))]) Index: branches/scool-ng/tests/variable/c++_src/declaration_008.cc =================================================================== --- branches/scool-ng/tests/variable/c++_src/declaration_008.cc (revision 0) +++ branches/scool-ng/tests/variable/c++_src/declaration_008.cc (revision 96) @@ -0,0 +1 @@ +int i = j; Index: branches/scool-ng/tests/variable/c++_src/mixed_declarations_001.cc =================================================================== --- branches/scool-ng/tests/variable/c++_src/mixed_declarations_001.cc (revision 0) +++ branches/scool-ng/tests/variable/c++_src/mixed_declarations_001.cc (revision 96) @@ -0,0 +1,3 @@ +const int answer = 42; +int i; +int j = i; Index: branches/scool-ng/tests/variable/c++_src/declaration_005.cc =================================================================== --- branches/scool-ng/tests/variable/c++_src/declaration_005.cc (revision 0) +++ branches/scool-ng/tests/variable/c++_src/declaration_005.cc (revision 96) @@ -0,0 +1 @@ +list<int> l; -- \__/ \__/ (00) Maxime `yabo` van Noppen (00) ___) \ Epita 2009 / (___ (_____/ \_____)
16Â years, 3Â months
1
0
0
0
cleanup-2008 2388: Add dispatch for morpho erosion.
by Thierry Geraud
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog from Thierry Geraud <thierry.geraud(a)lrde.epita.fr> Add dispatch for morpho erosion. * tests/morpho/temp.erosion.cc: New. * mln/morpho/erosion.spe.hh: Add dispatch. mln/morpho/erosion.spe.hh | 159 +++++++++++++++++++++++++++++++++++++------ tests/morpho/temp.erosion.cc | 116 +++++++++++++++++++++++++++++++ 2 files changed, 253 insertions(+), 22 deletions(-) Index: tests/morpho/temp.erosion.cc --- tests/morpho/temp.erosion.cc (revision 0) +++ tests/morpho/temp.erosion.cc (revision 0) @@ -0,0 +1,116 @@ +// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +/*! \file tests/morpho/erosion.cc + * + * \brief Test on mln::morpho::erosion. + */ + +#include <mln/core/image/image2d.hh> +#include <mln/win/rectangle2d.hh> +#include <mln/win/octagon2d.hh> +#include <mln/win/diag2d.hh> +#include <mln/win/backdiag2d.hh> +#include <mln/core/alias/window2d.hh> + +#include <mln/io/pgm/load.hh> +#include <mln/io/pgm/save.hh> + +#include <mln/value/int_u8.hh> +#include <mln/level/fill.hh> +#include <mln/morpho/erosion.hh> + +#include <mln/pw/value.hh> +#include <mln/pw/cst.hh> +#include <mln/fun/ops.hh> + +#include <mln/convert/to_p_array.hh> +#include <mln/convert/to_window.hh> + + +int main() +{ + using namespace mln; + using value::int_u8; + + unsigned + l_oct = 11, L_oct = 6 * l_oct + 1, + l_rec = 29, L_rec = 2 * l_rec + 1; + + // l_ + // oct rec err + // 0 0 3 + // 0 1 5 + // 1 2 15 + // 1 3 9 + // 2 5 11 + // 3 8 9 + // 5 13 15 + // 8 21 11 + // 11 29 1 + // 25 66 15 + + image2d<int_u8> lena; + io::pgm::load(lena, "./tiny.pgm"); + + trace::quiet = false; + + { + win::rectangle2d rec(L_rec, L_rec); + io::pgm::save(morpho::erosion(lena, rec), + "out1.pgm"); + } + +// { +// win::octagon2d oct(L_oct); +// io::pgm::save(morpho::erosion(lena, oct), +// "out2.pgm"); +// } + +// { +// p_array<point2d> vec = convert::to_p_array(rec, point2d::zero); +// window2d win = convert::to_window(vec); + +// image2d<int_u8> out(lena.domain()); +// level::ero(lena, win, out); +// morpho::erosion(lena, win, out); +// io::pgm::save(out, "out.pgm"); +// } + +// { +// image2d<bool> bin(lena.domain()), out(lena.domain()); +// level::fill(bin, pw::value(lena) > pw::cst(127)); +// morpho::erosion(bin, rec, out); + +// image2d<int_u8> test(lena.domain()); +// image2d<int_u8>::fwd_piter p(lena.domain()); +// for_all(p) +// test(p) = out(p) ? 255 : 0; +// io::pgm::save(test, "test.pgm"); +// } + +} Index: mln/morpho/erosion.spe.hh --- mln/morpho/erosion.spe.hh (revision 2387) +++ mln/morpho/erosion.spe.hh (working copy) @@ -267,7 +267,7 @@ erosion_arbitrary_2d_fastest_functor(const I& input, const W& win) : input(input), win(win), - min(input.values()), + min(), win_left(set::diff(geom::shift(win, left), win)), win_right(set::diff(win, geom::shift(win, left))), win_bot(set::diff(win, geom::shift(win, up))), @@ -328,8 +328,7 @@ trace::entering("morpho::impl:erosion_arbitrary_2d_fastest"); typedef erosion_arbitrary_2d_fastest_functor<I, W> F; - mlc_equal(W, win::octagon2d)::check(); - F f(input, win); + F f(exact(input), exact(win)); canvas::browsing::snake_fwd(f); trace::exiting("morpho::impl:erosion_arbitrary_2d_fastest"); @@ -363,7 +362,7 @@ erosion_arbitrary_2d_functor(const I& input, const W& win) : input(input), win(win), - min(input.values()), + min(), win_left(set::diff(geom::shift(win, left), win)), win_right(set::diff(win, geom::shift(win, left))), win_bot(set::diff(win, geom::shift(win, up))), @@ -424,8 +423,7 @@ trace::entering("morpho::impl:erosion_arbitrary_2d"); typedef erosion_arbitrary_2d_functor<I, W> F; - mlc_equal(W, win::octagon2d)::check(); - F f(input, win); + F f(exact(input), exact(win)); canvas::browsing::snake_fwd(f); trace::exiting("morpho::impl:erosion_arbitrary_2d"); @@ -438,30 +436,147 @@ namespace internal { + + // dispatch for the generic version + template <typename I, typename W> mln_concrete(I) - erosion_dispatch(const Image<I>& input, const Window<W>& win) + erosion_dispatch_for_generic(trait::image::kind::logic, // On sets. + trait::image::speed::fastest, + const I& input, const W& win) { - if (mlc_equal(mln_trait_image_kind(I)(), - trait::image::kind::logic)::value == true) -/* FIXME: Temporarily disabled, since this dynamic dispatch triggers - errors when class I has no pixter associated type(s). */ -#if 0 - if (mlc_equal(mln_trait_image_speed(I)(), - trait::image::speed::fastest)::value == true) + if (win.is_centered()) + return impl::erosion_on_set_centered_fastest(input, win); + else return impl::erosion_on_set_fastest(input, win); + } + + template <typename I, typename W> + mln_concrete(I) + erosion_dispatch_for_generic(trait::image::kind::any, // On functions. + trait::image::speed::fastest, + const I& input, const W& win) + { + return impl::erosion_on_function_fastest(input, win); + } + + template <typename I, typename W> + mln_concrete(I) + erosion_dispatch_for_generic(trait::image::kind::logic, // On sets. + trait::image::speed::any, + const I& input, const W& win) + { + if (win.is_centered()) + return erosion_on_set_centered(input, win); else -#endif return impl::generic::erosion_on_set(input, win); + } + + template <typename I, typename W> + mln_concrete(I) + erosion_dispatch_for_generic(trait::image::kind::any, // On functions. + trait::image::speed::any, + const I& input, const W& win) + { + return impl::generic::erosion_on_function(input, win); + } + + template <typename I, typename W> + mln_concrete(I) + erosion_dispatch_for_generic(const I& input, const W& win) // Entry point. + { + return erosion_dispatch_for_generic(mln_trait_image_kind(I)(), + mln_trait_image_speed(I)(), + input, win); + } + + + // dispatch for arbitrary elements + + template <typename I, typename W> + bool + erosion_chooses_arbitrary(const I& input, const W& win) + { + return + win.size() >= 25 // size is not too small + && + // 2d case only + mlc_equal(mln_trait_image_dimension(I), + trait::image::dimension::two_d)::value + && + // on a grid + mlc_is_a(mln_site(I), + Gpoint)::value + && + // continuous data + mlc_not_equal(mln_trait_image_value_storage(I), + trait::image::value_storage::disrupted)::value; + } + + template <typename I, typename W> + mln_concrete(I) + erosion_dispatch_for_arbitrary(trait::image::speed::fastest, + const I& input, const W& win) + { + return impl::erosion_arbitrary_2d_fastest(input, win); + } + + template <typename I, typename W> + mln_concrete(I) + erosion_dispatch_for_arbitrary(trait::image::speed::any, + const I& input, const W& win) + { + return impl::erosion_arbitrary_2d(input, win); + } + + template <typename I, typename W> + mln_concrete(I) + erosion_dispatch_for_arbitrary(const I& input, const W& win) + { + return erosion_dispatch_for_arbitrary(mln_trait_image_speed(I)(), + input, win); + } + + // dispatch w.r.t. win + + template <typename I, typename W> + mln_concrete(I) + erosion_dispatch_wrt_win(const I& input, const W& win) + { + if (erosion_chooses_arbitrary(input, win)) + return erosion_dispatch_for_arbitrary(input, win); else -// FIXME: Likewise. -#if 0 - if (mlc_equal(mln_trait_image_speed(I)(), - trait::image::speed::fastest)::value == true) - return impl::erosion_on_function_fastest(input, win); + return erosion_dispatch_for_generic(input, win); + } + + template <typename I> + mln_concrete(I) + erosion_dispatch_wrt_win(const I& input, const win::rectangle2d& win) + { + if (win.size() <= 9) // FIXME: Hard-coded! + return erosion_dispatch_for_generic(input, win); else -#endif - return impl::generic::erosion_on_function(input, win); + return impl::erosion_rectangle2d(input, win); + } + + template <typename I> + mln_concrete(I) + erosion_dispatch_wrt_win(const I& input, const win::octagon2d& win) + { + if (win.size() <= 9) // FIXME: Hard-coded! + return erosion_dispatch_for_generic(input, win); + else + return impl::erosion_octagon2d(input, win); + } + + + // The dispatch entry point. + + template <typename I, typename W> + mln_concrete(I) + erosion_dispatch(const Image<I>& input, const Window<W>& win) + { + return erosion_dispatch_wrt_win(exact(input), exact(win)); } } // end of namespace mln::morpho::internal
16Â years, 3Â months
1
0
0
0
cleanup-2008 2387: Fix/Update interpolated image.
by Ugo Jardonnet
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog from Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr> Fix/Update interpolated image. * mln/core/image/interpolated.hh: Fix/Update traits and accessors. interpolated.hh | 83 ++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 51 insertions(+), 32 deletions(-) Index: mln/core/image/interpolated.hh --- mln/core/image/interpolated.hh (revision 2386) +++ mln/core/image/interpolated.hh (working copy) @@ -32,6 +32,8 @@ * * \brief Definition of a morpher that makes an image become readable * with floating coordinates. + * + * \todo think having has(algebra::vec v) as a method */ # include <cmath> @@ -44,32 +46,47 @@ { // Fwd decl. - template <typename I> struct interpolated; + template <typename I, template <class> class F> struct interpolated; namespace internal { /// Data structure for \c mln::interpolated<I>. - template <typename I> - struct data< interpolated<I> > + template <typename I, template <class> class F> + struct data< interpolated<I,F> > { data(I& ima); - I ima_; + I& ima_; }; } // end of namespace mln::internal + + namespace trait + { + + template <typename I, template <class> class F> + struct image_< interpolated<I,F> > + : public image_<I> // Same as I except... + { + // ...these changes. + typedef trait::image::value_io::read_only value_io; + }; + + } // end of namespace mln::trait + + /*! \brief Morpher that makes underlaying image being accessed with floating coordinate. * */ - template <typename I> + template <typename I, template <class> class F> struct interpolated : - public mln::internal::image_identity< I, mln_pset(I), interpolated<I> > + public mln::internal::image_identity< I, mln_pset(I), interpolated<I,F> > { typedef mln::internal::image_identity< I, mln_pset(I), - interpolated<I> > super_; + interpolated<I,F> > super_; /// Point_Site associated type. typedef mln_psite(I) psite; @@ -84,7 +101,7 @@ typedef mln_rvalue(I) rvalue; /// Skeleton. - typedef interpolated< tag::image_<I> > skeleton; + typedef interpolated< tag::image_<I>, F > skeleton; /// Constructors. @@ -102,15 +119,15 @@ using super_::has; /// Test if a pixel value is accessible at \p v. - bool has(const mln::algebra::vec<I::point::dim, float>& v) const; + bool has(const mln::algebra::vec<I::psite::dim, float>& v) const; /// Read-only access of pixel value at point site \p p. /// Mutable access is only OK for reading (not writing). using super_::operator(); - mln_value(I) operator()(const mln::algebra::vec<I::point::dim, float>& v) const; - + mln_value(I) operator()(const mln::algebra::vec<I::psite::dim, float>& v) const; + const F<I> fun_; }; @@ -122,66 +139,68 @@ // internal::data< interpolated<I,S> > - template <typename I> + template <typename I, template <class> class F> inline - data< interpolated<I> >::data(I& ima) + data< interpolated<I,F> >::data(I& ima) : ima_(ima) { } } // end of namespace mln::internal - template <typename I> + template <typename I, template <class> class F> inline - interpolated<I>::interpolated(I& ima) + interpolated<I,F>::interpolated(I& ima) + : fun_(ima) { mln_precondition(ima.has_data()); init_(ima); } - template <typename I> + template <typename I, template <class> class F> inline - interpolated<I>::interpolated() + interpolated<I,F>::interpolated() { } - template <typename I> + template <typename I, template <class> class F> inline void - interpolated<I>::init_(I& ima) + interpolated<I, F >::init_(I& ima) { mln_precondition(ima.has_data()); - this->data_ = new internal::data< interpolated<I> >(ima); + this->data_ = new internal::data< interpolated<I,F> >(ima); } - template <typename I> + template <typename I, template <class> class F> inline - bool interpolated<I>::has_data() const + bool interpolated<I,F>::has_data() const { mln_invariant(this->data_->ima_.has_data()); return true; } - template <typename I> + template <typename I, template <class> class F> inline - bool interpolated<I>::has(const mln::algebra::vec<I::point::dim, float>& v) const + bool interpolated<I,F>::has(const mln::algebra::vec<I::psite::dim, float>& v) const { mln_psite(I) p; - for (unsigned i = 0; i < I::point::dim; ++i) + for (unsigned i = 0; i < I::psite::dim; ++i) p[i] = static_cast<int>(round(v[i])); return this->data_->ima_.has(p); } - template <typename I> + template <typename I, template <class> class F> inline mln_value(I) - interpolated<I>::operator()(const mln::algebra::vec<I::point::dim, float>& v) const + interpolated<I,F>::operator()(const mln::algebra::vec<I::psite::dim, float>& v) const { - mln_psite(I) p; - for (unsigned i = 0; i < I::point::dim; ++i) - p[i] = static_cast<int>(round(v[i])); - mln_assertion(this->data_->ima_.has(p)); - return this->data_->ima_(p); + // mln_psite(I) p; + // for (unsigned i = 0; i < I::point::dim; ++i) + // p[i] = static_cast<int>(round(v[i])); + // mln_assertion(this->data_->ima_.has(p)); + // return this->data_->ima_(p); + return fun_(v); } # endif // ! MLN_INCLUDE_ONLY
16Â years, 3Â months
1
0
0
0
cleanup-2008 2386: Sandbox: Make use of interpolated image.
by Ugo Jardonnet
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena/sandbox
Index: ChangeLog from Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr> Sandbox: Make use of interpolated image. * jardonnet/virtual/access.hh (bilinear): Fix rounding error. * jardonnet/virtual/access.cc (test2): Add, make use of interpolated. * jardonnet/virtual/bilinear.ppm: Fixed result. access.cc | 29 +++++++++++++++++++++++++++-- access.hh | 50 +++++++++++++++++++++++++++++++++----------------- 2 files changed, 60 insertions(+), 19 deletions(-) Index: jardonnet/virtual/access.hh --- jardonnet/virtual/access.hh (revision 2385) +++ jardonnet/virtual/access.hh (working copy) @@ -74,11 +74,12 @@ const I& ima; }; + template < typename I > struct bilinear : public fun::internal::selector_<const algebra::vec<3,float>, // 3,float is a dummy parameter (real is n,T) - mln_value(I), linear<I> >::ret + mln_value(I), bilinear<I> >::ret { typedef mln_value(I) result; @@ -100,44 +101,59 @@ double x = v[0]; double y = v[1]; - double x1 = mln_psite(I)::coord(v[0]); - double x2 = mln_psite(I)::coord(v[0]+ 1); - double y1 = mln_psite(I)::coord(v[1]); - double y2 = mln_psite(I)::coord(v[1]+ 1); + double x1 = std::floor(v[0]); + double x2 = std::floor(v[0]) + 1; + double y1 = std::floor(v[1]); + double y2 = std::floor(v[1]) + 1; + //if (not ima.has(point2d(x1, y1))) return mln_value(I)(); vsum q11 = ima(point2d(x1, y1)); vsum q12 = ima(point2d(x1, y2)); vsum q21 = ima(point2d(x2, y1)); vsum q22 = ima(point2d(x2, y2)); - //if (x2 - x1 == 0) - //std::cout << x2 <<" - " << x1 << std::endl; - double x2_x1 = (x2 - x1) ? x2 - x1 : 0.000001; - double y2_y1 = (y2 - y1) ? y2 - y1 : 0.000001; + double x2_x1 = x2 - x1; + double y2_y1 = y2 - y1; // linear interpolation #1 vsum img_r1 = q11 * (x2 - x) / (x2_x1) + q21 * (x - x1) / (x2_x1); - //std::cout << "l1 : "<< img_r1 << std::endl; // linear interpolation #2 - vsum img_r2 = q12 * (x2 - x) / (x2_x1) + - q22 * (x - x1) / (x2_x1); - //std::cout << "l2 : "<< img_r2 << std::endl; + vsum img_r2 = q12 * (x2 - x) / (x2_x1) + q22 * (x - x1) / (x2_x1); // interpolating in y direction - // FIXME : Sometime try to cast neg value to rgb component vsum res = (img_r1 * (y2 - y) / (y2_y1) + img_r2 * (y - y1) /(y2_y1)); - res[0] = (res[0] < 0) ? 0 : res[0]; - res[1] = (res[1] < 0) ? 0 : res[1]; - res[2] = (res[2] < 0) ? 0 : res[2]; return convert::to<mln_value(I)>(res); } const I& ima; }; + + template < typename I > + struct bicubic + : public fun::internal::selector_<const algebra::vec<3,float>, + // 3,float is a dummy parameter (real is n,T) + mln_value(I), bicubic<I> >::ret + { + typedef mln_value(I) result; + + bicubic(const I& ima) : ima(ima) {} + + template <unsigned n, typename T> + mln_value(I) + operator()(const algebra::vec<n,T>& v) const + { + typedef mln_sum(mln_value(I)) vsum; + + + //return convert::to<mln_value(I)>(res); + } + + const I& ima; + }; } namespace access Index: jardonnet/virtual/bilinear.ppm Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: jardonnet/virtual/access.cc --- jardonnet/virtual/access.cc (revision 2385) +++ jardonnet/virtual/access.cc (working copy) @@ -10,6 +10,7 @@ #include <mln/border/adjust.hh> #include <mln/border/fill.hh> #include <mln/literal/all.hh> +#include <mln/core/image/interpolated.hh> template < template <class> class N, typename I, typename T> @@ -30,6 +31,23 @@ } +template <typename I, typename O, typename T> +void +test2(const I& interp, O& output, + const mln::Function_x2x<T>& t_) +{ + T t = exact(t_); + + mln_piter(I) p(output.domain()); + for_all(p) + { + mln::algebra::vec<2,float> v = mln::point2d(p); + mln::algebra::vec<2,float> tip = t.inv()(v); + output(p) = interp(tip); + } +} + + int main() { using namespace mln; @@ -39,13 +57,20 @@ io::ppm::load(input, "./lena.ppm"); image2d< value::rgb<8> > output(input.domain()); - border::adjust(input, 512); - border::fill(input, literal::black); + // adjust border + border::adjust(input, 100); + //border::fill(input, literal::black); + + interpolated< image2d< value::rgb<8> >, interpolation::bilinear> + interp(input); + + //border::adjust(interp, 20); //transformation fun::x2x::translation<2,float> t(make::vec(20,20)); fun::x2x::rotation<2,float> r(0.12, make::vec(0,1)); test1<interpolation::bilinear>(input, output, compose(r,t)); + //test2(interp, output, compose(r,t)); mln::io::ppm::save(output,"./out.ppm"); }
16Â years, 3Â months
1
0
0
0
← Newer
1
...
712
713
714
715
716
717
718
...
963
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
Results per page:
10
25
50
100
200