Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 9625 discussions
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 / (___
(_____/ \_____)
1
0
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 / (___
(_____/ \_____)
1
0
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 / (___
(_____/ \_____)
1
0
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 / (___
(_____/ \_____)
1
0
cleanup-2008 2389: Make w_window tests pass with from_to instead of to_w_window.
by Thierry Geraud 24 Sep '08
by Thierry Geraud 24 Sep '08
24 Sep '08
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;
1
0
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 / (___
(_____/ \_____)
1
0
24 Sep '08
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 / (___
(_____/ \_____)
1
0
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Add dispatch for morpho erosion.
* tests/morpho/temp.erosion.cc: New.
* mln/morpho/erosion.spe.hh: Add dispatch.
mln/morpho/erosion.spe.hh | 159 +++++++++++++++++++++++++++++++++++++------
tests/morpho/temp.erosion.cc | 116 +++++++++++++++++++++++++++++++
2 files changed, 253 insertions(+), 22 deletions(-)
Index: tests/morpho/temp.erosion.cc
--- tests/morpho/temp.erosion.cc (revision 0)
+++ tests/morpho/temp.erosion.cc (revision 0)
@@ -0,0 +1,116 @@
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/morpho/erosion.cc
+ *
+ * \brief Test on mln::morpho::erosion.
+ */
+
+#include <mln/core/image/image2d.hh>
+#include <mln/win/rectangle2d.hh>
+#include <mln/win/octagon2d.hh>
+#include <mln/win/diag2d.hh>
+#include <mln/win/backdiag2d.hh>
+#include <mln/core/alias/window2d.hh>
+
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pgm/save.hh>
+
+#include <mln/value/int_u8.hh>
+#include <mln/level/fill.hh>
+#include <mln/morpho/erosion.hh>
+
+#include <mln/pw/value.hh>
+#include <mln/pw/cst.hh>
+#include <mln/fun/ops.hh>
+
+#include <mln/convert/to_p_array.hh>
+#include <mln/convert/to_window.hh>
+
+
+int main()
+{
+ using namespace mln;
+ using value::int_u8;
+
+ unsigned
+ l_oct = 11, L_oct = 6 * l_oct + 1,
+ l_rec = 29, L_rec = 2 * l_rec + 1;
+
+ // l_
+ // oct rec err
+ // 0 0 3
+ // 0 1 5
+ // 1 2 15
+ // 1 3 9
+ // 2 5 11
+ // 3 8 9
+ // 5 13 15
+ // 8 21 11
+ // 11 29 1
+ // 25 66 15
+
+ image2d<int_u8> lena;
+ io::pgm::load(lena, "./tiny.pgm");
+
+ trace::quiet = false;
+
+ {
+ win::rectangle2d rec(L_rec, L_rec);
+ io::pgm::save(morpho::erosion(lena, rec),
+ "out1.pgm");
+ }
+
+// {
+// win::octagon2d oct(L_oct);
+// io::pgm::save(morpho::erosion(lena, oct),
+// "out2.pgm");
+// }
+
+// {
+// p_array<point2d> vec = convert::to_p_array(rec, point2d::zero);
+// window2d win = convert::to_window(vec);
+
+// image2d<int_u8> out(lena.domain());
+// level::ero(lena, win, out);
+// morpho::erosion(lena, win, out);
+// io::pgm::save(out, "out.pgm");
+// }
+
+// {
+// image2d<bool> bin(lena.domain()), out(lena.domain());
+// level::fill(bin, pw::value(lena) > pw::cst(127));
+// morpho::erosion(bin, rec, out);
+
+// image2d<int_u8> test(lena.domain());
+// image2d<int_u8>::fwd_piter p(lena.domain());
+// for_all(p)
+// test(p) = out(p) ? 255 : 0;
+// io::pgm::save(test, "test.pgm");
+// }
+
+}
Index: mln/morpho/erosion.spe.hh
--- mln/morpho/erosion.spe.hh (revision 2387)
+++ mln/morpho/erosion.spe.hh (working copy)
@@ -267,7 +267,7 @@
erosion_arbitrary_2d_fastest_functor(const I& input, const W& win)
: input(input),
win(win),
- min(input.values()),
+ min(),
win_left(set::diff(geom::shift(win, left), win)),
win_right(set::diff(win, geom::shift(win, left))),
win_bot(set::diff(win, geom::shift(win, up))),
@@ -328,8 +328,7 @@
trace::entering("morpho::impl:erosion_arbitrary_2d_fastest");
typedef erosion_arbitrary_2d_fastest_functor<I, W> F;
- mlc_equal(W, win::octagon2d)::check();
- F f(input, win);
+ F f(exact(input), exact(win));
canvas::browsing::snake_fwd(f);
trace::exiting("morpho::impl:erosion_arbitrary_2d_fastest");
@@ -363,7 +362,7 @@
erosion_arbitrary_2d_functor(const I& input, const W& win)
: input(input),
win(win),
- min(input.values()),
+ min(),
win_left(set::diff(geom::shift(win, left), win)),
win_right(set::diff(win, geom::shift(win, left))),
win_bot(set::diff(win, geom::shift(win, up))),
@@ -424,8 +423,7 @@
trace::entering("morpho::impl:erosion_arbitrary_2d");
typedef erosion_arbitrary_2d_functor<I, W> F;
- mlc_equal(W, win::octagon2d)::check();
- F f(input, win);
+ F f(exact(input), exact(win));
canvas::browsing::snake_fwd(f);
trace::exiting("morpho::impl:erosion_arbitrary_2d");
@@ -438,30 +436,147 @@
namespace internal
{
+
+ // dispatch for the generic version
+
template <typename I, typename W>
mln_concrete(I)
- erosion_dispatch(const Image<I>& input, const Window<W>& win)
+ erosion_dispatch_for_generic(trait::image::kind::logic, // On sets.
+ trait::image::speed::fastest,
+ const I& input, const W& win)
{
- if (mlc_equal(mln_trait_image_kind(I)(),
- trait::image::kind::logic)::value == true)
-/* FIXME: Temporarily disabled, since this dynamic dispatch triggers
- errors when class I has no pixter associated type(s). */
-#if 0
- if (mlc_equal(mln_trait_image_speed(I)(),
- trait::image::speed::fastest)::value == true)
+ if (win.is_centered())
+ return impl::erosion_on_set_centered_fastest(input, win);
+ else
return impl::erosion_on_set_fastest(input, win);
+ }
+
+ template <typename I, typename W>
+ mln_concrete(I)
+ erosion_dispatch_for_generic(trait::image::kind::any, // On functions.
+ trait::image::speed::fastest,
+ const I& input, const W& win)
+ {
+ return impl::erosion_on_function_fastest(input, win);
+ }
+
+ template <typename I, typename W>
+ mln_concrete(I)
+ erosion_dispatch_for_generic(trait::image::kind::logic, // On sets.
+ trait::image::speed::any,
+ const I& input, const W& win)
+ {
+ if (win.is_centered())
+ return erosion_on_set_centered(input, win);
else
-#endif
return impl::generic::erosion_on_set(input, win);
+ }
+
+ template <typename I, typename W>
+ mln_concrete(I)
+ erosion_dispatch_for_generic(trait::image::kind::any, // On functions.
+ trait::image::speed::any,
+ const I& input, const W& win)
+ {
+ return impl::generic::erosion_on_function(input, win);
+ }
+
+ template <typename I, typename W>
+ mln_concrete(I)
+ erosion_dispatch_for_generic(const I& input, const W& win) // Entry point.
+ {
+ return erosion_dispatch_for_generic(mln_trait_image_kind(I)(),
+ mln_trait_image_speed(I)(),
+ input, win);
+ }
+
+
+ // dispatch for arbitrary elements
+
+ template <typename I, typename W>
+ bool
+ erosion_chooses_arbitrary(const I& input, const W& win)
+ {
+ return
+ win.size() >= 25 // size is not too small
+ &&
+ // 2d case only
+ mlc_equal(mln_trait_image_dimension(I),
+ trait::image::dimension::two_d)::value
+ &&
+ // on a grid
+ mlc_is_a(mln_site(I),
+ Gpoint)::value
+ &&
+ // continuous data
+ mlc_not_equal(mln_trait_image_value_storage(I),
+ trait::image::value_storage::disrupted)::value;
+ }
+
+ template <typename I, typename W>
+ mln_concrete(I)
+ erosion_dispatch_for_arbitrary(trait::image::speed::fastest,
+ const I& input, const W& win)
+ {
+ return impl::erosion_arbitrary_2d_fastest(input, win);
+ }
+
+ template <typename I, typename W>
+ mln_concrete(I)
+ erosion_dispatch_for_arbitrary(trait::image::speed::any,
+ const I& input, const W& win)
+ {
+ return impl::erosion_arbitrary_2d(input, win);
+ }
+
+ template <typename I, typename W>
+ mln_concrete(I)
+ erosion_dispatch_for_arbitrary(const I& input, const W& win)
+ {
+ return erosion_dispatch_for_arbitrary(mln_trait_image_speed(I)(),
+ input, win);
+ }
+
+ // dispatch w.r.t. win
+
+ template <typename I, typename W>
+ mln_concrete(I)
+ erosion_dispatch_wrt_win(const I& input, const W& win)
+ {
+ if (erosion_chooses_arbitrary(input, win))
+ return erosion_dispatch_for_arbitrary(input, win);
else
-// FIXME: Likewise.
-#if 0
- if (mlc_equal(mln_trait_image_speed(I)(),
- trait::image::speed::fastest)::value == true)
- return impl::erosion_on_function_fastest(input, win);
+ return erosion_dispatch_for_generic(input, win);
+ }
+
+ template <typename I>
+ mln_concrete(I)
+ erosion_dispatch_wrt_win(const I& input, const win::rectangle2d& win)
+ {
+ if (win.size() <= 9) // FIXME: Hard-coded!
+ return erosion_dispatch_for_generic(input, win);
else
-#endif
- return impl::generic::erosion_on_function(input, win);
+ return impl::erosion_rectangle2d(input, win);
+ }
+
+ template <typename I>
+ mln_concrete(I)
+ erosion_dispatch_wrt_win(const I& input, const win::octagon2d& win)
+ {
+ if (win.size() <= 9) // FIXME: Hard-coded!
+ return erosion_dispatch_for_generic(input, win);
+ else
+ return impl::erosion_octagon2d(input, win);
+ }
+
+
+ // The dispatch entry point.
+
+ template <typename I, typename W>
+ mln_concrete(I)
+ erosion_dispatch(const Image<I>& input, const Window<W>& win)
+ {
+ return erosion_dispatch_wrt_win(exact(input), exact(win));
}
} // end of namespace mln::morpho::internal
1
0
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr>
Fix/Update interpolated image.
* mln/core/image/interpolated.hh: Fix/Update traits and accessors.
interpolated.hh | 83 ++++++++++++++++++++++++++++++++++----------------------
1 file changed, 51 insertions(+), 32 deletions(-)
Index: mln/core/image/interpolated.hh
--- mln/core/image/interpolated.hh (revision 2386)
+++ mln/core/image/interpolated.hh (working copy)
@@ -32,6 +32,8 @@
*
* \brief Definition of a morpher that makes an image become readable
* with floating coordinates.
+ *
+ * \todo think having has(algebra::vec v) as a method
*/
# include <cmath>
@@ -44,32 +46,47 @@
{
// Fwd decl.
- template <typename I> struct interpolated;
+ template <typename I, template <class> class F> struct interpolated;
namespace internal
{
/// Data structure for \c mln::interpolated<I>.
- template <typename I>
- struct data< interpolated<I> >
+ template <typename I, template <class> class F>
+ struct data< interpolated<I,F> >
{
data(I& ima);
- I ima_;
+ I& ima_;
};
} // end of namespace mln::internal
+
+ namespace trait
+ {
+
+ template <typename I, template <class> class F>
+ struct image_< interpolated<I,F> >
+ : public image_<I> // Same as I except...
+ {
+ // ...these changes.
+ typedef trait::image::value_io::read_only value_io;
+ };
+
+ } // end of namespace mln::trait
+
+
/*! \brief Morpher that makes underlaying image being accessed with floating coordinate.
*
*/
- template <typename I>
+ template <typename I, template <class> class F>
struct interpolated :
- public mln::internal::image_identity< I, mln_pset(I), interpolated<I> >
+ public mln::internal::image_identity< I, mln_pset(I), interpolated<I,F> >
{
typedef mln::internal::image_identity< I, mln_pset(I),
- interpolated<I> > super_;
+ interpolated<I,F> > super_;
/// Point_Site associated type.
typedef mln_psite(I) psite;
@@ -84,7 +101,7 @@
typedef mln_rvalue(I) rvalue;
/// Skeleton.
- typedef interpolated< tag::image_<I> > skeleton;
+ typedef interpolated< tag::image_<I>, F > skeleton;
/// Constructors.
@@ -102,15 +119,15 @@
using super_::has;
/// Test if a pixel value is accessible at \p v.
- bool has(const mln::algebra::vec<I::point::dim, float>& v) const;
+ bool has(const mln::algebra::vec<I::psite::dim, float>& v) const;
/// Read-only access of pixel value at point site \p p.
/// Mutable access is only OK for reading (not writing).
using super_::operator();
- mln_value(I) operator()(const mln::algebra::vec<I::point::dim, float>& v) const;
-
+ mln_value(I) operator()(const mln::algebra::vec<I::psite::dim, float>& v) const;
+ const F<I> fun_;
};
@@ -122,66 +139,68 @@
// internal::data< interpolated<I,S> >
- template <typename I>
+ template <typename I, template <class> class F>
inline
- data< interpolated<I> >::data(I& ima)
+ data< interpolated<I,F> >::data(I& ima)
: ima_(ima)
{
}
} // end of namespace mln::internal
- template <typename I>
+ template <typename I, template <class> class F>
inline
- interpolated<I>::interpolated(I& ima)
+ interpolated<I,F>::interpolated(I& ima)
+ : fun_(ima)
{
mln_precondition(ima.has_data());
init_(ima);
}
- template <typename I>
+ template <typename I, template <class> class F>
inline
- interpolated<I>::interpolated()
+ interpolated<I,F>::interpolated()
{
}
- template <typename I>
+ template <typename I, template <class> class F>
inline
void
- interpolated<I>::init_(I& ima)
+ interpolated<I, F >::init_(I& ima)
{
mln_precondition(ima.has_data());
- this->data_ = new internal::data< interpolated<I> >(ima);
+ this->data_ = new internal::data< interpolated<I,F> >(ima);
}
- template <typename I>
+ template <typename I, template <class> class F>
inline
- bool interpolated<I>::has_data() const
+ bool interpolated<I,F>::has_data() const
{
mln_invariant(this->data_->ima_.has_data());
return true;
}
- template <typename I>
+ template <typename I, template <class> class F>
inline
- bool interpolated<I>::has(const mln::algebra::vec<I::point::dim, float>& v) const
+ bool interpolated<I,F>::has(const mln::algebra::vec<I::psite::dim, float>& v) const
{
mln_psite(I) p;
- for (unsigned i = 0; i < I::point::dim; ++i)
+ for (unsigned i = 0; i < I::psite::dim; ++i)
p[i] = static_cast<int>(round(v[i]));
return this->data_->ima_.has(p);
}
- template <typename I>
+ template <typename I, template <class> class F>
inline
mln_value(I)
- interpolated<I>::operator()(const mln::algebra::vec<I::point::dim, float>& v) const
+ interpolated<I,F>::operator()(const mln::algebra::vec<I::psite::dim, float>& v) const
{
- mln_psite(I) p;
- for (unsigned i = 0; i < I::point::dim; ++i)
- p[i] = static_cast<int>(round(v[i]));
- mln_assertion(this->data_->ima_.has(p));
- return this->data_->ima_(p);
+ // mln_psite(I) p;
+ // for (unsigned i = 0; i < I::point::dim; ++i)
+ // p[i] = static_cast<int>(round(v[i]));
+ // mln_assertion(this->data_->ima_.has(p));
+ // return this->data_->ima_(p);
+ return fun_(v);
}
# endif // ! MLN_INCLUDE_ONLY
1
0
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena/sandbox
Index: ChangeLog
from Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr>
Sandbox: Make use of interpolated image.
* jardonnet/virtual/access.hh (bilinear): Fix rounding error.
* jardonnet/virtual/access.cc (test2): Add, make use of interpolated.
* jardonnet/virtual/bilinear.ppm: Fixed result.
access.cc | 29 +++++++++++++++++++++++++++--
access.hh | 50 +++++++++++++++++++++++++++++++++-----------------
2 files changed, 60 insertions(+), 19 deletions(-)
Index: jardonnet/virtual/access.hh
--- jardonnet/virtual/access.hh (revision 2385)
+++ jardonnet/virtual/access.hh (working copy)
@@ -74,11 +74,12 @@
const I& ima;
};
+
template < typename I >
struct bilinear
: public fun::internal::selector_<const algebra::vec<3,float>,
// 3,float is a dummy parameter (real is n,T)
- mln_value(I), linear<I> >::ret
+ mln_value(I), bilinear<I> >::ret
{
typedef mln_value(I) result;
@@ -100,44 +101,59 @@
double x = v[0];
double y = v[1];
- double x1 = mln_psite(I)::coord(v[0]);
- double x2 = mln_psite(I)::coord(v[0]+ 1);
- double y1 = mln_psite(I)::coord(v[1]);
- double y2 = mln_psite(I)::coord(v[1]+ 1);
+ double x1 = std::floor(v[0]);
+ double x2 = std::floor(v[0]) + 1;
+ double y1 = std::floor(v[1]);
+ double y2 = std::floor(v[1]) + 1;
+ //if (not ima.has(point2d(x1, y1))) return mln_value(I)();
vsum q11 = ima(point2d(x1, y1));
vsum q12 = ima(point2d(x1, y2));
vsum q21 = ima(point2d(x2, y1));
vsum q22 = ima(point2d(x2, y2));
- //if (x2 - x1 == 0)
- //std::cout << x2 <<" - " << x1 << std::endl;
- double x2_x1 = (x2 - x1) ? x2 - x1 : 0.000001;
- double y2_y1 = (y2 - y1) ? y2 - y1 : 0.000001;
+ double x2_x1 = x2 - x1;
+ double y2_y1 = y2 - y1;
// linear interpolation #1
vsum img_r1 = q11 * (x2 - x) / (x2_x1) +
q21 * (x - x1) / (x2_x1);
- //std::cout << "l1 : "<< img_r1 << std::endl;
// linear interpolation #2
- vsum img_r2 = q12 * (x2 - x) / (x2_x1) +
- q22 * (x - x1) / (x2_x1);
- //std::cout << "l2 : "<< img_r2 << std::endl;
+ vsum img_r2 = q12 * (x2 - x) / (x2_x1) + q22 * (x - x1) / (x2_x1);
// interpolating in y direction
- // FIXME : Sometime try to cast neg value to rgb component
vsum res = (img_r1 * (y2 - y) / (y2_y1)
+ img_r2 * (y - y1) /(y2_y1));
- res[0] = (res[0] < 0) ? 0 : res[0];
- res[1] = (res[1] < 0) ? 0 : res[1];
- res[2] = (res[2] < 0) ? 0 : res[2];
return convert::to<mln_value(I)>(res);
}
const I& ima;
};
+
+ template < typename I >
+ struct bicubic
+ : public fun::internal::selector_<const algebra::vec<3,float>,
+ // 3,float is a dummy parameter (real is n,T)
+ mln_value(I), bicubic<I> >::ret
+ {
+ typedef mln_value(I) result;
+
+ bicubic(const I& ima) : ima(ima) {}
+
+ template <unsigned n, typename T>
+ mln_value(I)
+ operator()(const algebra::vec<n,T>& v) const
+ {
+ typedef mln_sum(mln_value(I)) vsum;
+
+
+ //return convert::to<mln_value(I)>(res);
+ }
+
+ const I& ima;
+ };
}
namespace access
Index: jardonnet/virtual/bilinear.ppm
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: jardonnet/virtual/access.cc
--- jardonnet/virtual/access.cc (revision 2385)
+++ jardonnet/virtual/access.cc (working copy)
@@ -10,6 +10,7 @@
#include <mln/border/adjust.hh>
#include <mln/border/fill.hh>
#include <mln/literal/all.hh>
+#include <mln/core/image/interpolated.hh>
template < template <class> class N,
typename I, typename T>
@@ -30,6 +31,23 @@
}
+template <typename I, typename O, typename T>
+void
+test2(const I& interp, O& output,
+ const mln::Function_x2x<T>& t_)
+{
+ T t = exact(t_);
+
+ mln_piter(I) p(output.domain());
+ for_all(p)
+ {
+ mln::algebra::vec<2,float> v = mln::point2d(p);
+ mln::algebra::vec<2,float> tip = t.inv()(v);
+ output(p) = interp(tip);
+ }
+}
+
+
int main()
{
using namespace mln;
@@ -39,13 +57,20 @@
io::ppm::load(input, "./lena.ppm");
image2d< value::rgb<8> > output(input.domain());
- border::adjust(input, 512);
- border::fill(input, literal::black);
+ // adjust border
+ border::adjust(input, 100);
+ //border::fill(input, literal::black);
+
+ interpolated< image2d< value::rgb<8> >, interpolation::bilinear>
+ interp(input);
+
+ //border::adjust(interp, 20);
//transformation
fun::x2x::translation<2,float> t(make::vec(20,20));
fun::x2x::rotation<2,float> r(0.12, make::vec(0,1));
test1<interpolation::bilinear>(input, output, compose(r,t));
+ //test2(interp, output, compose(r,t));
mln::io::ppm::save(output,"./out.ppm");
}
1
0