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
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
September 2008
----- 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
12 participants
359 discussions
Start a n
N
ew thread
2390: Simplify mln::internal::complex_iter_base_.
by Roland Levillain
* mln/core/internal/complex_iter_base.hh: (mln::internal::complex_iter_base_<F, E>::complex_iter_base_): Remove copy ctor. (mln::internal::complex_iter_base_<F, E>::operator=): Remove assignment operator. (mln::internal::complex_iter_base_<F, E>::set_cplx): New accessor. --- milena/ChangeLog | 12 +++++++++ milena/mln/core/internal/complex_iter_base.hh | 31 +++++++----------------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 32c9a60..005bbdc 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -41,6 +41,18 @@ 2008-09-24 Roland Levillain <roland(a)lrde.epita.fr> + Simplify mln::internal::complex_iter_base_. + + * mln/core/internal/complex_iter_base.hh: + (mln::internal::complex_iter_base_<F, E>::complex_iter_base_): + Remove copy ctor. + (mln::internal::complex_iter_base_<F, E>::operator=): + Remove assignment operator. + (mln::internal::complex_iter_base_<F, E>::set_cplx): + New accessor. + +2008-09-24 Roland Levillain <roland(a)lrde.epita.fr> + * tests/core/image/complex_image.cc: Exercise iterators on p_faces. 2008-09-24 Roland Levillain <roland(a)lrde.epita.fr> diff --git a/milena/mln/core/internal/complex_iter_base.hh b/milena/mln/core/internal/complex_iter_base.hh index a2462ea..e2c747a 100644 --- a/milena/mln/core/internal/complex_iter_base.hh +++ b/milena/mln/core/internal/complex_iter_base.hh @@ -65,12 +65,14 @@ namespace mln milena/tests/complex_image.cc. */ complex_iter_base_(); complex_iter_base_(complex_type& c); - complex_iter_base_(const self_& rhs); - self_& operator= (const self_& rhs); /// \} /// Manipulation. /// \{ + /// Change the target complex. + // FIXME: Same comment as the ctor above. + void set_cplx(complex_type& c); + /// Test if the iterator is valid. bool is_valid() const; /// Invalidate the iterator. @@ -100,15 +102,10 @@ namespace mln std::ostream& operator<<(std::ostream& ostr, const complex_iter_base_<F, E>& p); - } // end of mln::internal - # ifndef MLN_INCLUDE_ONLY - namespace internal - { - template <typename F, typename E> inline complex_iter_base_<F, E>::complex_iter_base_() @@ -133,22 +130,12 @@ namespace mln template <typename F, typename E> inline - complex_iter_base_<F, E>::complex_iter_base_(const complex_iter_base_<F, E>& rhs) - : face_(rhs.face_) - { - // Ensure F and E are compatible. - mlc_equal(F, typename E::face)::check(); - } - - template <typename F, typename E> - inline - complex_iter_base_<F, E>& - complex_iter_base_<F, E>::operator=(const complex_iter_base_<F, E>& rhs) + void + complex_iter_base_<F, E>::set_cplx(complex_type& c) { - if (&rhs == this) - return *this; - face_ = rhs.face_; - return *this; + face_.set_cplx(c); + // Invalidate face_. + invalidate(); } template <typename F, typename E> -- 1.6.0.1
16 years, 3 months
1
0
0
0
scool r103: Handle the 'final' keyword
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 the 'final' keyword * scoolt/Class.str: New. * scoolt/Declaration.str: Don't add the Exact type parameter when the * class is final. Class.str | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ Declaration.str | 4 ++-- 2 files changed, 52 insertions(+), 2 deletions(-) Index: branches/scool-ng/src/scoolt/Class.str =================================================================== --- branches/scool-ng/src/scoolt/Class.str (revision 0) +++ branches/scool-ng/src/scoolt/Class.str (revision 103) @@ -0,0 +1,50 @@ +module Class + +imports libstratego-lib Cxx Scool Declaration + +rules + + // Translate class body + + ClassBodyToCxx: + body -> cxx_body + where + <map (ClassStatementToCxx)> body => cxx_body + + + // Translate class statements + + ClassStatementToCxx: + AccessBlock(Public, body) -> CxxPublic(cxx_body) + where + <ClassStatementToCxx> body => cxx_body + + ClassStatementToCxx: + AccessBlock(Protected, body) -> CxxProtected(cxx_body) + where + <ClassStatementToCxx> body => cxx_body + + ClassStatementToCxx: + AccessBlock(Private, body) -> CxxPrivate(cxx_body) + where + <ClassStatementToCxx> body => cxx_body + + ClassStatementToCxx: + decl -> cxx_decl + where + <map (DeclarationToCxx)> decl => cxx_decl + + + // Add the exact type parameter if the class is not final + AddExactType(|cqualif): + cxx_params -> new_cxx_params + where + <conc> (<ExactType> cqualif, cxx_params) => new_cxx_params + + ExactType: + Some("final") -> [] + + ExactType: + cqualif -> [(CxxType("typename"), "Exact")] + where + <?Some("abstract") <+ ?None()> cqualif Index: branches/scool-ng/src/scoolt/Declaration.str =================================================================== --- branches/scool-ng/src/scoolt/Declaration.str (revision 102) +++ branches/scool-ng/src/scoolt/Declaration.str (revision 103) @@ -64,9 +64,9 @@ //////////////////////////////////////////////////////////////////////////////// DeclarationToCxx: - ClassDefinition(None, idf, wclause, ClassBlock(body)) -> CxxClassDecl(cxx_params, cxx_idf, [], cxx_body) + ClassDefinition(cqualif, idf, wclause, ClassBlock(body)) -> CxxClassDecl(cxx_params, cxx_idf, [], cxx_body) where - ![(CxxType("typename"), "T")] => cxx_params + <AddExactType(|cqualif)> [] => 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 r102: Handle the final keyword
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 the final keyword * class/c++_src/final_001.cc: New. * class/c++_ast/final_001.aterm: New. * 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, * class/c++_src/empty.cc, * class/c++_src/empty_accessblocks.cc, * class/c++_src/empty_private.cc, * class/c++_src/empty_protected.cc, * class/c++_src/empty_public.cc, * class/c++_src/member_001.cc, * class/c++_src/member_002.cc, * class/c++_src/method_001.cc, * class/c++_src/method_002.cc, * class/c++_src/method_003.cc, * class/c++_src/method_004.cc, * class/c++_src/method_005.cc: Rename the 'T' parameter into 'Exact'. 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/final_001.aterm | 1 + 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 | 2 +- c++_src/empty_accessblocks.cc | 2 +- c++_src/empty_private.cc | 2 +- c++_src/empty_protected.cc | 2 +- c++_src/empty_public.cc | 2 +- c++_src/final_001.cc | 3 +++ c++_src/member_001.cc | 2 +- c++_src/member_002.cc | 2 +- c++_src/method_001.cc | 2 +- c++_src/method_002.cc | 2 +- c++_src/method_003.cc | 2 +- c++_src/method_004.cc | 2 +- c++_src/method_005.cc | 2 +- 26 files changed, 28 insertions(+), 24 deletions(-) Index: branches/scool-ng/tests/class/c++_ast/empty_private.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/empty_private.aterm (revision 101) +++ branches/scool-ng/tests/class/c++_ast/empty_private.aterm (revision 102) @@ -1 +1 @@ -CxxProgram([CxxClassDecl([(CxxType("typename"),"T")],CxxId("Foo"),[],[CxxPrivate([])])]) +CxxProgram([CxxClassDecl([(CxxType("typename"),"Exact")],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 101) +++ branches/scool-ng/tests/class/c++_ast/member_002.aterm (revision 102) @@ -1 +1 @@ -CxxProgram([CxxClassDecl([(CxxType("typename"),"T")],CxxId("Point2d"),[],[CxxPublic([CxxDecl(CxxType("int"),CxxId("x")),CxxDecl(CxxType("int"),CxxId("y"))])])]) +CxxProgram([CxxClassDecl([(CxxType("typename"),"Exact")],CxxId("Point2d"),[],[CxxPublic([CxxDecl(CxxType("int"),CxxId("x")),CxxDecl(CxxType("int"),CxxId("y"))])])]) Index: branches/scool-ng/tests/class/c++_ast/final_001.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/final_001.aterm (revision 0) +++ branches/scool-ng/tests/class/c++_ast/final_001.aterm (revision 102) @@ -0,0 +1 @@ +CxxProgram([CxxClassDecl([],CxxId("Student"),[],[])]) Index: branches/scool-ng/tests/class/c++_ast/empty_public.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/empty_public.aterm (revision 101) +++ branches/scool-ng/tests/class/c++_ast/empty_public.aterm (revision 102) @@ -1 +1 @@ -CxxProgram([CxxClassDecl([(CxxType("typename"),"T")],CxxId("Foo"),[],[CxxPublic([])])]) +CxxProgram([CxxClassDecl([(CxxType("typename"),"Exact")],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 101) +++ branches/scool-ng/tests/class/c++_ast/empty_accessblocks.aterm (revision 102) @@ -1 +1 @@ -CxxProgram([CxxClassDecl([(CxxType("typename"),"T")],CxxId("Foo"),[],[CxxPublic([]),CxxProtected([]),CxxPrivate([])])]) +CxxProgram([CxxClassDecl([(CxxType("typename"),"Exact")],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 101) +++ branches/scool-ng/tests/class/c++_ast/empty.aterm (revision 102) @@ -1 +1 @@ -CxxProgram([CxxClassDecl([(CxxType("typename"),"T")],CxxId("Foo"),[],[])]) +CxxProgram([CxxClassDecl([(CxxType("typename"),"Exact")],CxxId("Foo"),[],[])]) Index: branches/scool-ng/tests/class/c++_ast/method_001.aterm =================================================================== --- branches/scool-ng/tests/class/c++_ast/method_001.aterm (revision 101) +++ branches/scool-ng/tests/class/c++_ast/method_001.aterm (revision 102) @@ -1 +1 @@ -CxxProgram([CxxClassDecl([(CxxType("typename"),"T")],CxxId("Foo"),[],[CxxPublic([CxxFun([],CxxType("int"),CxxId("test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("42")))])])])]) +CxxProgram([CxxClassDecl([(CxxType("typename"),"Exact")],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 101) +++ branches/scool-ng/tests/class/c++_ast/method_002.aterm (revision 102) @@ -1 +1 @@ -CxxProgram([CxxClassDecl([(CxxType("typename"),"T")],CxxId("Foo"),[],[CxxPublic([CxxFun([],CxxType("int"),CxxId("test"),[],[CxxExpStm(CxxKeyword("return",CxxInt("42")))])])])]) +CxxProgram([CxxClassDecl([(CxxType("typename"),"Exact")],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 101) +++ branches/scool-ng/tests/class/c++_ast/method_003.aterm (revision 102) @@ -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"),"Exact")],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 101) +++ branches/scool-ng/tests/class/c++_ast/method_004.aterm (revision 102) @@ -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"),"Exact")],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 101) +++ branches/scool-ng/tests/class/c++_ast/method_005.aterm (revision 102) @@ -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"),"Exact")],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 101) +++ branches/scool-ng/tests/class/c++_ast/empty_protected.aterm (revision 102) @@ -1 +1 @@ -CxxProgram([CxxClassDecl([(CxxType("typename"),"T")],CxxId("Foo"),[],[CxxProtected([])])]) +CxxProgram([CxxClassDecl([(CxxType("typename"),"Exact")],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 101) +++ branches/scool-ng/tests/class/c++_ast/member_001.aterm (revision 102) @@ -1 +1 @@ -CxxProgram([CxxClassDecl([(CxxType("typename"),"T")],CxxId("Point1d"),[],[CxxPublic([CxxDecl(CxxType("int"),CxxId("x"))])])]) +CxxProgram([CxxClassDecl([(CxxType("typename"),"Exact")],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 101) +++ branches/scool-ng/tests/class/c++_src/empty_public.cc (revision 102) @@ -1,4 +1,4 @@ -template < typename T > +template < typename Exact > 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 101) +++ branches/scool-ng/tests/class/c++_src/empty_accessblocks.cc (revision 102) @@ -1,4 +1,4 @@ -template < typename T > +template < typename Exact > class Foo { public: Index: branches/scool-ng/tests/class/c++_src/empty.cc =================================================================== --- branches/scool-ng/tests/class/c++_src/empty.cc (revision 101) +++ branches/scool-ng/tests/class/c++_src/empty.cc (revision 102) @@ -1,4 +1,4 @@ -template < typename T > +template < typename Exact > class Foo { }; Index: branches/scool-ng/tests/class/c++_src/method_001.cc =================================================================== --- branches/scool-ng/tests/class/c++_src/method_001.cc (revision 101) +++ branches/scool-ng/tests/class/c++_src/method_001.cc (revision 102) @@ -1,4 +1,4 @@ -template < typename T > +template < typename Exact > class Foo { public: Index: branches/scool-ng/tests/class/c++_src/method_002.cc =================================================================== --- branches/scool-ng/tests/class/c++_src/method_002.cc (revision 101) +++ branches/scool-ng/tests/class/c++_src/method_002.cc (revision 102) @@ -1,4 +1,4 @@ -template < typename T > +template < typename Exact > class Foo { public: Index: branches/scool-ng/tests/class/c++_src/method_003.cc =================================================================== --- branches/scool-ng/tests/class/c++_src/method_003.cc (revision 101) +++ branches/scool-ng/tests/class/c++_src/method_003.cc (revision 102) @@ -1,4 +1,4 @@ -template < typename T > +template < typename Exact > class Foo { public: Index: branches/scool-ng/tests/class/c++_src/method_004.cc =================================================================== --- branches/scool-ng/tests/class/c++_src/method_004.cc (revision 101) +++ branches/scool-ng/tests/class/c++_src/method_004.cc (revision 102) @@ -1,4 +1,4 @@ -template < typename T > +template < typename Exact > class Foo { public: Index: branches/scool-ng/tests/class/c++_src/method_005.cc =================================================================== --- branches/scool-ng/tests/class/c++_src/method_005.cc (revision 101) +++ branches/scool-ng/tests/class/c++_src/method_005.cc (revision 102) @@ -1,4 +1,4 @@ -template < typename T > +template < typename Exact > class Foo { public: Index: branches/scool-ng/tests/class/c++_src/empty_protected.cc =================================================================== --- branches/scool-ng/tests/class/c++_src/empty_protected.cc (revision 101) +++ branches/scool-ng/tests/class/c++_src/empty_protected.cc (revision 102) @@ -1,4 +1,4 @@ -template < typename T > +template < typename Exact > 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 101) +++ branches/scool-ng/tests/class/c++_src/member_001.cc (revision 102) @@ -1,4 +1,4 @@ -template < typename T > +template < typename Exact > class Point1d { public: Index: branches/scool-ng/tests/class/c++_src/empty_private.cc =================================================================== --- branches/scool-ng/tests/class/c++_src/empty_private.cc (revision 101) +++ branches/scool-ng/tests/class/c++_src/empty_private.cc (revision 102) @@ -1,4 +1,4 @@ -template < typename T > +template < typename Exact > 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 101) +++ branches/scool-ng/tests/class/c++_src/member_002.cc (revision 102) @@ -1,4 +1,4 @@ -template < typename T > +template < typename Exact > class Point2d { public: Index: branches/scool-ng/tests/class/c++_src/final_001.cc =================================================================== --- branches/scool-ng/tests/class/c++_src/final_001.cc (revision 0) +++ branches/scool-ng/tests/class/c++_src/final_001.cc (revision 102) @@ -0,0 +1,3 @@ +class Student +{ +}; -- \__/ \__/ (00) Maxime `yabo` van Noppen (00) ___) \ Epita 2009 / (___ (_____/ \_____)
16 years, 3 months
1
0
0
0
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
← Newer
1
...
8
9
10
11
12
13
14
...
36
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
Results per page:
10
25
50
100
200