--- /dev/null
+r rw
+r rw set from native
+rw set from native
+set from native
--- /dev/null
+foo
+bar
+baz
--- /dev/null
+0
+1
+5
+144
+0
+1
+5
+144
--- /dev/null
+100==100
+33==33
--- /dev/null
+nity
+nity
+nity1 3
+nity2 7 13
--- /dev/null
+a
+a
+allo from 1234
+allo from 2345
+allo from 3456
+allo from 1234
+allo from 1234
--- /dev/null
+true -? true
+false -? false
+false -? false
+true -? true
+false -? false
+is null, ok
+something
--- /dev/null
+11
+9
+22
+3
+false
+false
+false
+false
+true
+3
+4096
+true
+false
+false
+false
+false
+true
+true
+true
+false
+false
+true
+true
+52
+456
--- /dev/null
+1
+2
+3
+3
+hello world
--- /dev/null
+false
+true
+k
+2234
+12345.0
+hello world
--- /dev/null
+a from nit
+A
+a from extern
+A
+a from nit
+B
+a from extern
+B
--- /dev/null
+0
+1
+2
+1234
--- /dev/null
+A
+A from native
+B
+B from native
+B
+B from native
--- /dev/null
+hello world...
+hello world?
+hello world!
+something
+9
--- /dev/null
+A
+B special A
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class A
+ readable var _r : String = "r"
+ writable var _w : String = "w"
+ readable writable var _rw : String = "rw"
+
+ fun print_all is extern import String::to_cstring, r, rw
+ fun modify is extern import String::from_cstring, w=, rw=
+end
+
+class B
+ fun print_and_modify( a : A ) is extern import A::rw, A::rw=, String::to_cstring, String::from_cstring
+end
+
+var a = new A
+a.print_all
+a.modify
+a.print_all
+
+var b = new B
+b.print_and_modify( a )
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#include "test_ni_accessor.nit.h"
+
+/*
+C implementation of test_ni_accessor::A::print_all
+
+Imported methods signatures:
+ char * String_to_cstring( String recv ) for string::String::to_cstring
+ String A_r( A recv ) for test_ni_accessor::A::r
+ String A_rw( A recv ) for test_ni_accessor::A::rw
+*/
+void A_print_all___impl( A recv )
+{
+ printf( "%s %s\n",
+ String_to_cstring( A_r( recv ) ),
+ String_to_cstring( A_rw( recv ) ) );
+}
+
+/*
+C implementation of test_ni_accessor::A::modify
+
+Imported methods signatures:
+ String new_String_from_cstring( char * str ) for string::String::from_cstring
+ void A_w__eq( A recv, String w ) for test_ni_accessor::A::w=
+ void A_rw__eq( A recv, String rw ) for test_ni_accessor::A::rw=
+*/
+void A_modify___impl( A recv )
+{
+ A_w__assign( recv, new_String_from_cstring( "w set from native" ) );
+ A_rw__assign( recv, new_String_from_cstring( "rw set from native" ) );
+}
+
+/*
+C implementation of test_ni_accessor::B::print_and_modify
+
+Imported methods signatures:
+ String A_rw( A recv ) for test_ni_accessor::A::rw
+ void A_rw__assign( A recv, String value ) for test_ni_accessor::A::rw=
+ char * String_to_cstring( String recv ) for string::String::to_cstring
+ String new_String_from_cstring( char * str ) for string::String::from_cstring
+*/
+void B_print_and_modify___impl( B recv, A a )
+{
+ printf( "%s\n", String_to_cstring( A_rw( a ) ) );
+ A_rw__assign( a, new_String_from_cstring( "set from native" ) );
+ printf( "%s\n", String_to_cstring( A_rw( a ) ) );
+}
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#ifndef test_ni_accessor_IMPL_NIT_H
+#define test_ni_accessor_IMPL_NIT_H
+
+#include <test_ni_accessor._nitni.h>
+
+void A_print_all___impl( A recv );
+void A_modify___impl( A recv );
+void B_print_and_modify___impl( B recv, A a );
+
+#endif
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class A
+ fun isa_b : Bool is extern import A as(B)
+ fun as_b : nullable B is extern import A as(B), A as(nullable B)
+end
+
+class B
+end
+
+class C
+special A
+ fun isa_a : Bool is extern import C as(A)
+end
+
+class D # triangle
+special A
+special B
+ init do end
+ fun as_a : A is extern import D as(A)
+end
+
+# isa
+var a = new A
+var c = new C
+var d = new D
+
+print "a isa b {a.isa_b} (expected: false)"
+print "c isa a {c.isa_a} (expected: true)"
+print "d isa b {d.isa_b} (expected: true)"
+
+var da = d.as_a
+var db = d.as_b
+var ab = a.as_b
+
+print "da is null? {da==null} (expected: false)"
+print "db is null? {db==null} (expected: false)"
+print "ab is null? {ab==null} (expected: true)"
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#include "test_ni_cast_extra.nit.h"
+
+/*
+C implementation of test_ni_cast_extra::A::isa_b
+
+Imported methods signatures:
+ int A_is_a_B( A value ) to check if a A is a B
+ B A_as_B( A value ) to cast from A to B
+*/
+int A_isa_b___impl( A recv )
+{
+ return A_is_a_B( recv );
+}
+
+/*
+C implementation of test_ni_cast_extra::A::as_b
+
+Imported methods signatures:
+ int A_is_a_B( A value ) to check if a A is a B
+ B A_as_B( A value ) to cast from A to B
+ int A_is_a_nullable_B( A value ) to check if a A is a nullable B
+ nullable_B A_as_nullable_B( A value ) to cast from A to nullable B
+*/
+nullable_B A_as_b___impl( A recv )
+{
+ if ( A_is_a_nullable_B( recv ) )
+ return A_as_nullable_B( recv );
+ else
+ return null_B();
+}
+
+/*
+C implementation of test_ni_cast_extra::C::isa_a
+
+Imported methods signatures:
+ int C_is_a_A( C value ) to check if a C is a A
+ A C_as_A( C value ) to cast from C to A
+*/
+int C_isa_a___impl( C recv )
+{
+ return C_is_a_A( recv );
+}
+
+/*
+C implementation of test_ni_cast_extra::D::as_a
+
+Imported methods signatures:
+ int D_is_a_A( D value ) to check if a D is a A
+ A D_as_A( D value ) to cast from D to A
+*/
+A D_as_a___impl( D recv )
+{
+ return D_as_A( recv );
+}
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#ifndef test_ni_cast_extra_IMPL_NIT_H
+#define test_ni_cast_extra_IMPL_NIT_H
+
+#include <test_ni_cast_extra._nitni.h>
+
+int A_isa_b___impl( A recv );
+nullable_B A_as_b___impl( A recv );
+int C_isa_a___impl( C recv );
+A D_as_a___impl( D recv );
+
+#endif
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+fun s_to_o( s : String ) : Object is extern import String as ( Object )
+
+fun n_to_nn( s : String ) : nullable String is extern import String as nullable
+fun nn_to_n( s : nullable String ) : String is extern import nullable String as not nullable
+
+var o = s_to_o( "foo" )
+var nn = n_to_nn( "bar" )
+var n = nn_to_n( "baz" )
+
+print o
+
+if nn == null
+then
+ print "null (not good)"
+else
+ print nn
+end
+
+print n
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#include "test_ni_cast_simple.nit.h"
+
+/*
+C implementation of test_ni_cast_simple::Object::s_to_o
+
+Imported methods signatures:
+ int String_is_a_Object( String value ) to check if a String is a Object
+ Object String_as_Object( String value ) to cast from String to Object
+*/
+Object Object_s_to_o___impl( Object recv, String s )
+{
+ return String_as_Object( s );
+}
+
+/*
+C implementation of test_ni_cast_simple::Object::n_to_nn
+
+Imported methods signatures:
+ nullable_String String_as_nullable( String value ) to cast from String to nullable String
+*/
+nullable_String Object_n_to_nn___impl( Object recv, String s )
+{
+ return String_as_nullable( s );
+}
+
+/*
+C implementation of test_ni_cast_simple::Object::nn_to_n
+
+Imported methods signatures:
+ int String_is_null( nullable_String value ) to check if a nullable String is a String
+ String nullable_String_as_not_null( nullable_String value ) to cast from nullable String to String
+*/
+String Object_nn_to_n___impl( Object recv, nullable_String s )
+{
+ return String_as_not_null( s );
+}
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#ifndef test_ni_cast_simple_IMPL_NIT_H
+#define test_ni_cast_simple_IMPL_NIT_H
+
+#include <test_ni_cast_simple._nitni.h>
+
+Object Object_s_to_o___impl( Object recv, String s );
+nullable_String Object_n_to_nn___impl( Object recv, String s );
+String Object_nn_to_n___impl( Object recv, nullable_String s );
+
+#endif
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#include "test_ni_casts.nit.h"
+
+/*
+C implementation of test_ni_casts::Object::a
+
+Imported methods signatures:
+ int String_is_a_Object( String value ) to check if a String is a Object
+ Object String_as_Object( String value ) to cast from String to Object
+*/
+Object Object_a___impl( Object recv, String s )
+{
+ return String_as_Object( s );
+}
+
+/*
+C implementation of test_ni_casts::Object::b
+
+Imported methods signatures:
+ nullable_String String_as_nullable( String value ) to cast from String to nullable String
+*/
+nullable_String Object_b___impl( Object recv, String s )
+{
+ return String_as_nullable( s );
+}
+
+/*
+C implementation of test_ni_casts::Object::c
+
+Imported methods signatures:
+ int nullable_String_is_null( nullable_String value ) to check if a nullable String is a String
+ String nullable_String_as_not_null( nullable_String value ) to cast from nullable String to String
+*/
+String Object_c___impl( Object recv, nullable_String s )
+{
+ return nullable_String_as_not_null( s );
+}
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#ifndef test_ni_casts_IMPL_NIT_H
+#define test_ni_casts_IMPL_NIT_H
+
+#include <test_ni_casts._nitni.h>
+
+Object Object_a___impl( Object recv, String s );
+nullable_String Object_b___impl( Object recv, String s );
+String Object_c___impl( Object recv, nullable_String s );
+
+#endif
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+extern A
+ fun f is extern
+end
+
+extern B
+ super A
+
+ redef fun f is extern
+end
+
+extern C
+ super B
+
+ redef fun f is extern
+end
+
+extern D
+ super A
+ super B
+
+ redef fun f is extern
+end
+
+extern E
+ super B
+ super D
+
+ redef fun f is extern
+end
+
+extern F
+end
+
+extern G
+ super B
+ super F
+
+ redef fun f is extern
+end
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#include "test_ni_extern_inheritance.nit.h"
+
+/*
+C implementation of test_ni_extern_inheritance::A::f
+*/
+void A_f___impl( void* recv ) {}
+
+/*
+C implementation of test_ni_extern_inheritance::B::(test_ni_extern_inheritance::A::f)
+*/
+void B_f___impl( void* recv ) {}
+
+/*
+C implementation of test_ni_extern_inheritance::C::(test_ni_extern_inheritance::A::f)
+*/
+void C_f___impl( void* recv ) {}
+
+/*
+C implementation of test_ni_extern_inheritance::D::(test_ni_extern_inheritance::A::f)
+*/
+void D_f___impl( void* recv ) {}
+
+/*
+C implementation of test_ni_extern_inheritance::E::(test_ni_extern_inheritance::A::f)
+*/
+void E_f___impl( void* recv ) {}
+
+/*
+C implementation of test_ni_extern_inheritance::G::(test_ni_extern_inheritance::A::f)
+*/
+void G_f___impl( void* recv ) {}
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#ifndef TEST_NI_EXTERN_INHERITANCE_NIT_H
+#define TEST_NI_EXTERN_INHERITANCE_NIT_H
+
+#include <test_ni_extern_inheritance._nitni.h>
+
+void A_f___impl( void* recv );
+void B_f___impl( void* recv );
+void C_f___impl( void* recv );
+void D_f___impl( void* recv );
+void E_f___impl( void* recv );
+void G_f___impl( void* recv );
+#endif
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class FibonacciEngine
+ fun fibonacci( n : Int ) : Int is extern import fibonacci
+end
+
+redef class Int
+ fun fibonacci : Int is extern import fibonacci
+end
+
+var engine = new FibonacciEngine
+print engine.fibonacci( 0 )
+print engine.fibonacci( 1 )
+print engine.fibonacci( 5 )
+print engine.fibonacci( 12 )
+# print engine.fibonacci( 123 )
+
+print 0.fibonacci
+print 1.fibonacci
+print 5.fibonacci
+print 12.fibonacci
+# print 123.fibonacci
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#include "test_ni_fibonacci.nit.h"
+
+
+/*
+C implementation of fibonacci::FibonacciEngine::fibonacci
+
+Imported methods signatures:
+ bigint FibonacciEngine_fibonacci( FibonacciEngine recv, bigint n ) for fibonacci::FibonacciEngine::fibonacci
+*/
+bigint FibonacciEngine_fibonacci___impl( FibonacciEngine recv, bigint n )
+{
+ if ( n == 0 )
+ return 0;
+ if ( n == 1 )
+ return 1;
+ else
+ return FibonacciEngine_fibonacci( recv, n-1 ) + FibonacciEngine_fibonacci( recv, n-2 );
+}
+
+/*
+C implementation of fibonacci::Int::fibonacci
+
+Imported methods signatures:
+ bigint Int_fibonacci( bigint recv ) for fibonacci::Int::fibonacci
+*/
+bigint Int_fibonacci___impl( bigint recv )
+{
+ if ( recv == 0 )
+ return 0;
+ else if ( recv == 1 )
+ return 1;
+ else
+ return Int_fibonacci( recv-1 ) + Int_fibonacci( recv-2 );
+}
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#ifndef fibonacci_NIT_H
+#define fibonacci_NIT_H
+
+#include <test_ni_fibonacci._nitni.h>
+
+bigint FibonacciEngine_fibonacci___impl( FibonacciEngine recv, bigint n );
+bigint Int_fibonacci___impl( bigint recv );
+
+#endif
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class B
+ var _i : Int = 0
+
+ init do end
+
+ init from( i : Int )
+ do
+ _i = i
+ end
+
+ fun i : Int do return _i end
+end
+
+class A
+ fun ex_sees_b_attr( b : B ) : Int is extern import B::i
+
+ fun ex_sees_b_init( i : Int ) : B is extern import B, B::from
+end
+
+var a = new A
+var b100 = new B.from( 100 )
+
+print "100=={a.ex_sees_b_attr( b100 )}"
+print "33=={a.ex_sees_b_init( 33 ).i}"
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#include "test_ni_import_init.nit.h"
+
+/*
+C implementation of acces::A::ex_sees_b_attr
+
+Imported methods signatures:
+ bigint B_i( B recv ) for acces::B::i
+*/
+bigint A_ex_sees_b_attr___impl( A recv, B b )
+{
+ return B_i( b );
+}
+
+/*
+C implementation of acces::A::ex_sees_b_init
+
+Imported methods signatures:
+ void new_B( ) for acces::B::init
+ void new_B_from( bigint i ) for acces::B::from
+*/
+B A_ex_sees_b_init___impl( A recv, bigint i )
+{
+ return new_B_from( i );
+}
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#ifndef acces_NIT_H
+#define acces_NIT_H
+
+#include <test_ni_import_init._nitni.h>
+
+bigint A_ex_sees_b_attr___impl( A recv, B b );
+B A_ex_sees_b_init___impl( A recv, bigint i );
+
+#endif
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class A
+ fun nity do print "nity"
+ fun nity1 ( x : Int ) do print "nity1 {x}"
+ fun nity2 ( x : Int, y : Int ) do print "nity2 {x} {y}"
+
+ fun ex_sees_nity is extern import nity
+
+ fun ex_sees_nities is extern import nity1, nity2
+end
+
+var a = new A
+a.ex_sees_nity
+a.ex_sees_nities
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#include "test_ni_import_meth.nit.h"
+
+/*
+C implementation of simple::A::ex_sees_nity
+
+Imported methods signatures:
+ void A_nity( A recv ) for simple::A::nity
+*/
+void A_ex_sees_nity___impl( A recv )
+{
+ A_nity( recv );
+}
+
+/*
+C implementation of simple::A::ex_sees_nities
+
+Imported methods signatures:
+ void A_nity1( A recv, bigint x ) for simple::A::nity1
+ void A_nity2( A recv, bigint x, bigint y ) for simple::A::nity2
+*/
+void A_ex_sees_nities___impl( A recv )
+{
+ A_nity( recv );
+ A_nity1( recv, 3 );
+ A_nity2( recv, 7, 13 );
+}
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#ifndef simple_NIT_H
+#define simple_NIT_H
+
+#include <test_ni_import_meth._nitni.h>
+
+void A_ex_sees_nity___impl( A recv );
+void A_ex_sees_nities___impl( A recv );
+
+#endif
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#include "test_ni_inits.nit.h"
+
+/*
+C implementation of test_ni_inits::A::with_b
+*/
+A new_A_with_b___impl( )
+{
+ A a = malloc( sizeof(char) );
+ *a = 'b';
+ return a;
+}
+
+/*
+C implementation of test_ni_inits::A::alloc
+*/
+A new_A_alloc___impl( )
+{
+ A a = malloc( sizeof(char) );
+ return a;
+}
+
+/*
+C implementation of test_ni_inits::A::set
+*/
+void A_set___impl( A recv, char v )
+{
+ *recv = 'v';
+}
+
+/*
+C implementation of test_ni_inits::A::(string::Object::to_s)
+
+Imported methods signatures:
+ String new_String_from_cstring( char * str ) for string::String::from_cstring
+*/
+String A_to_s___impl( A recv )
+{
+ char *str = malloc( 2 * sizeof(char) );
+ str[0] = *recv;
+ str[1] = 0;
+
+ return new_String_from_cstring( str );
+}
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#ifndef test_ni_inits_IMPL_NIT_H
+#define test_ni_inits_IMPL_NIT_H
+
+#define A char*
+
+#include <test_ni_inits._nitni.h>
+
+A new_A_with_b___impl( );
+A new_A_alloc___impl( );
+void A_set___impl( A recv, char v );
+String A_to_s___impl( A recv );
+
+#endif
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+extern A special Pointer
+ new is extern import p
+ new with_args( x : Int, a : A ) is extern
+
+ fun a do print "a"
+ fun p is extern
+ fun d : A is extern import d, A
+end
+
+class B
+ init do end
+end
+
+var a = new A
+var b = new A.with_args( 2345, a )
+a.a
+b.a
+
+a.p # 1234
+b.p # 2345
+new A.with_args( 3456, b ).p # 3456
+
+a.d.p #
+b.d.p #
+
+var c = new B
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#include "test_ni_new.nit.h"
+
+#include <stdlib.h>
+
+
+/*
+C implementation of extern_new::A::init
+
+Imported methods signatures:
+ void A_p( A recv ) for extern_new::A::p
+*/
+int dv = 1234;
+A new_A___impl( )
+{
+ return &dv;
+}
+
+/*
+C implementation of extern_new::A::with_args
+*/
+A new_A_with_args___impl( bigint x, A a )
+{
+ int* v = (int*)malloc( sizeof(int) );
+ (*v) = (int)x;
+ return v;
+}
+
+/*
+C implementation of extern_new::A::p
+*/
+void A_p___impl( A recv )
+{
+ printf( "allo from %i\n", *recv );
+}
+
+/*
+C implementation of extern_new::A::d
+
+Imported methods signatures:
+ A A_d( A recv ) for extern_new::A::d
+ A new_A( ) for extern_new::A::init
+*/
+A A_d___impl( A recv )
+{
+ return new_A();
+}
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#ifndef test_ni_new_IMPL_NIT_H
+#define test_ni_new_IMPL_NIT_H
+
+#define A int*
+
+#include <nit_common.h>
+
+#include <test_ni_new._nitni.h>
+
+A new_A___impl( );
+A new_A_with_args___impl( bigint x, A a );
+void A_p___impl( A recv );
+A A_d___impl( A recv );
+
+#endif
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class A
+ fun is_int_null( ni : nullable Int ) : Bool is extern import Int as not nullable
+ fun is_a_null( na : nullable A ) : Bool is extern import A as not nullable
+
+ fun get_nullable_string( get_nulled : Bool ) : nullable String is extern import String::from_cstring, String as nullable
+end
+
+var a = new A
+
+print "true -? {a.is_int_null( null )}"
+print "false -? {a.is_int_null( 0 )}"
+print "false -? {a.is_int_null( 1234 )}"
+
+print "true -? {a.is_a_null( null )}"
+print "false -? {a.is_a_null( a )}"
+
+var nstr = a.get_nullable_string( true )
+if nstr == null then print "is null, ok" else print nstr # expects "is null"
+
+nstr = a.get_nullable_string( false )
+if nstr == null then print "is null, error" else print nstr # expects "something"
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#include "test_ni_null.nit.h"
+
+/*
+C implementation of test_ni_null::A::is_int_null
+
+Imported methods signatures:
+ int Int_is_null( nullable_Int value ) to check if a nullable Int is a Int
+ bigint bigint_as_not_null( nullable_Int value ) to cast from nullable Int to Int
+*/
+int A_is_int_null___impl( A recv, nullable_Int ni )
+{
+ return Int_is_null( ni );
+}
+
+/*
+C implementation of test_ni_null::A::is_a_null
+
+Imported methods signatures:
+ int A_is_null( nullable_A value ) to check if a nullable A is a A
+ A A_as_not_null( nullable_A value ) to cast from nullable A to A
+*/
+int A_is_a_null___impl( A recv, nullable_A na )
+{
+ return A_is_null( na );
+}
+
+/*
+C implementation of test_ni_null::A::get_nullable_string
+
+Imported methods signatures:
+ String new_String_from_cstring( char * str ) for string::String::from_cstring
+ nullable_String String_as_nullable( String value ) to cast from String to nullable String
+*/
+nullable_String A_get_nullable_string___impl( A recv, int get_nulled )
+{
+ if ( get_nulled )
+ {
+ return null_String();
+ }
+ else
+ {
+ return String_as_nullable( new_String_from_cstring( "something" ) );
+ }
+}
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#ifndef test_ni_null_IMPL_NIT_H
+#define test_ni_null_IMPL_NIT_H
+
+#include <test_ni_null._nitni.h>
+
+int A_is_int_null___impl( A recv, nullable_Int ni );
+int A_is_a_null___impl( A recv, nullable_A na );
+nullable_String A_get_nullable_string___impl( A recv, int get_nulled );
+
+#endif
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+class A
+ var value : Int
+
+ init ( value : Int ) do self.value = value
+
+ fun +( other : A ) : A is extern import value, A
+
+ fun -( other : A ) : A is extern import value, A
+
+ fun *( by : Int ) : A is extern import value, A
+
+ fun /( by : Int ) : A is extern import value, A
+
+ redef fun ==( other ) is extern import value, nullable Object as(A)
+
+ fun %( other : A ) : A is extern import value, A
+
+# fun +=( other : A ) : A is extern import value, value=, A `{
+# int new_val = A_value( recv ) + A_value( other );
+# A_value__assign( recv, new_val );
+# return new_A( new_val );
+# `}
+
+# fun -=( other : A ) : A is extern import +=, A, value `{
+# A inv_other = new_A( -1*A_value( other ) );
+# return A__plus_equal( recv, int_other );
+# `}
+
+ fun <=>( other : A ) : A is extern import value, A
+
+# fun @( other : A ) : A is extern import value, A `{
+# return new_A( A_value( recv )* 1000 );
+# `}
+
+ fun >( other : A ) : Bool is extern import value
+
+ fun <( other : A ) : Bool is extern import value
+
+ fun >=( other : A ) : Bool is extern import value
+
+ fun <=( other : A ) : Bool is extern import value
+
+ fun >>( other : A ) is extern import value, value=, A
+
+ fun <<( other : A ) is extern import value, A
+
+ fun []( index : Int ) : A is extern import A
+
+ fun []=( index : Int, value : A ) : A is extern import A
+
+ redef fun to_s do return value.to_s
+end
+
+print new A( 1 ) + new A( 10 ) # 11
+print new A( 10 ) - new A( 1 ) # 9
+
+print new A( 2 ) * 11 # 22
+print new A( 33 ) / 11 # 3
+
+print new A( 44 ) == null # false
+print new A( 55 ) == 55 # false
+print new A( 33 ) == new A( 11 ) # false
+print new A( 22 ) == new A( 77 ) # false
+print new A( 11 ) == new A( 11 ) # true
+
+print new A( 147 ) % new A( 12 ) # 3
+print new A( 4 ) <=> new A( 123 ) # 4096
+
+print new A( 1 ) < new A( 100 ) # true
+print new A( 100 ) < new A( 100 ) # false
+print new A( 100 ) < new A( 1 ) # false
+
+print new A( 1 ) > new A( 100 ) # false
+print new A( 100 ) > new A( 100 ) # false
+print new A( 100 ) > new A( 1 ) # true
+
+print new A( 1 ) <= new A( 100 ) # true
+print new A( 100 ) <= new A( 100 ) # true
+print new A( 100 ) <= new A( 1 ) # false
+
+print new A( 1 ) >= new A( 100 ) # false
+print new A( 100 ) >= new A( 100 ) # true
+print new A( 100 ) >= new A( 1 ) # true
+
+#var x = new A( 1 )
+#x << new A( 5 )
+#print x # 16
+
+#var y = new A( 32 )
+#y >> new A( 2 )
+#print y # 8
+
+var a = new A( 456 )
+print a[ 52 ] # 52
+
+a[ 74 ] = new A( 96 )
+print a # 96
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#include "test_ni_operators.nit.h"
+
+/*
+C implementation of test_ni_operators::A::+
+
+Imported methods signatures:
+ bigint A_value( A recv ) for test_ni_operators::A::value
+ A new_A( bigint value ) for test_ni_operators::A::init
+*/
+A A__plus___impl( A recv, A other )
+{
+
+ int s = A_value( recv );
+ int o = A_value( other );
+
+ return new_A( s + o );
+
+}
+
+/*
+C implementation of test_ni_operators::A::-
+
+Imported methods signatures:
+ bigint A_value( A recv ) for test_ni_operators::A::value
+ A new_A( bigint value ) for test_ni_operators::A::init
+*/
+A A__minus___impl( A recv, A other )
+{
+
+ int s = A_value( recv );
+ int o = A_value( other );
+
+ return new_A( s - o );
+
+}
+
+/*
+C implementation of test_ni_operators::A::*
+
+Imported methods signatures:
+ bigint A_value( A recv ) for test_ni_operators::A::value
+ A new_A( bigint value ) for test_ni_operators::A::init
+*/
+A A__star___impl( A recv, bigint by )
+{
+
+ int s = A_value( recv );
+
+ return new_A( s * by );
+
+}
+
+/*
+C implementation of test_ni_operators::A::/
+
+Imported methods signatures:
+ bigint A_value( A recv ) for test_ni_operators::A::value
+ A new_A( bigint value ) for test_ni_operators::A::init
+*/
+A A__slash___impl( A recv, bigint by )
+{
+
+ int s = A_value( recv );
+
+ return new_A( s / by );
+
+}
+
+/*
+C implementation of test_ni_operators::A::(kernel::Object::==)
+
+Imported methods signatures:
+ bigint A_value( A recv ) for test_ni_operators::A::value
+ int nullable_Object_is_a_A( nullable_Object value ) to check if a nullable Object is a A
+ A nullable_Object_as_A( nullable_Object value ) to cast from nullable Object to A
+*/
+int A__equal___impl( A recv, nullable_Object other )
+{
+
+ if ( nullable_Object_is_a_A( other ) &&
+ A_value( nullable_Object_as_A(other) ) == A_value( recv ) )
+ return 1;
+ else
+ return 0;
+
+}
+
+/*
+C implementation of test_ni_operators::A::%
+
+Imported methods signatures:
+ bigint A_value( A recv ) for test_ni_operators::A::value
+ A new_A( bigint value ) for test_ni_operators::A::init
+*/
+A A__percent___impl( A recv, A other )
+{
+
+ return new_A( A_value( recv ) % A_value( other ) );
+
+}
+
+/*
+C implementation of test_ni_operators::A::<=>
+
+Imported methods signatures:
+ bigint A_value( A recv ) for test_ni_operators::A::value
+ A new_A( bigint value ) for test_ni_operators::A::init
+*/
+A A__starship___impl( A recv, A other )
+{
+
+ return new_A( A_value( recv )* 1024 );
+
+}
+
+/*
+C implementation of test_ni_operators::A::>
+
+Imported methods signatures:
+ bigint A_value( A recv ) for test_ni_operators::A::value
+*/
+int A__greater___impl( A recv, A other )
+{
+
+ return A_value( recv ) > A_value( other );
+
+}
+
+/*
+C implementation of test_ni_operators::A::<
+
+Imported methods signatures:
+ bigint A_value( A recv ) for test_ni_operators::A::value
+*/
+int A__less___impl( A recv, A other )
+{
+
+ return A_value( recv ) < A_value( other );
+
+}
+
+/*
+C implementation of test_ni_operators::A::>=
+
+Imported methods signatures:
+ bigint A_value( A recv ) for test_ni_operators::A::value
+*/
+int A__ge___impl( A recv, A other )
+{
+
+ return A_value( recv ) >= A_value( other );
+
+}
+
+/*
+C implementation of test_ni_operators::A::<=
+
+Imported methods signatures:
+ bigint A_value( A recv ) for test_ni_operators::A::value
+*/
+int A__less_or_equal___impl( A recv, A other )
+{
+
+ return A_value( recv ) <= A_value( other );
+
+}
+
+/*
+C implementation of test_ni_operators::A::>>
+
+Imported methods signatures:
+ bigint A_value( A recv ) for test_ni_operators::A::value
+ void A_value__assign( A recv, bigint value ) for test_ni_operators::A::value=
+ A new_A( bigint value ) for test_ni_operators::A::init
+*/
+void A__right___impl( A recv, A other )
+{
+
+ int new_val = A_value( recv ) >> A_value( other );
+ A_value__assign( recv, new_val );
+
+}
+
+/*
+C implementation of test_ni_operators::A::<<
+
+Imported methods signatures:
+ bigint A_value( A recv ) for test_ni_operators::A::value
+ A new_A( bigint value ) for test_ni_operators::A::init
+*/
+void A__left___impl( A recv, A other )
+{
+
+ int new_val = A_value( recv ) << A_value( other );
+ A_value__assign( recv, new_val );
+
+}
+
+/*
+C implementation of test_ni_operators::A::[]
+
+Imported methods signatures:
+ A new_A( bigint value ) for test_ni_operators::A::init
+*/
+A A__index___impl( A recv, bigint index )
+{
+
+ return new_A( index );
+
+}
+
+/*
+C implementation of test_ni_operators::A::[]=
+
+Imported methods signatures:
+ A new_A( bigint value ) for test_ni_operators::A::init
+*/
+A A__index_assign___impl( A recv, bigint index, A value )
+{
+
+ return new_A( index + A_value( value ) );
+
+}
\ No newline at end of file
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#ifndef test_ni_operators_IMPL_NIT_H
+#define test_ni_operators_IMPL_NIT_H
+
+#include <test_ni_operators._nitni.h>
+
+A A__plus___impl( A recv, A other );
+A A__minus___impl( A recv, A other );
+A A__star___impl( A recv, bigint by );
+A A__slash___impl( A recv, bigint by );
+int A__equal___impl( A recv, nullable_Object other );
+A A__percent___impl( A recv, A other );
+A A__starship___impl( A recv, A other );
+int A__greater___impl( A recv, A other );
+int A__less___impl( A recv, A other );
+int A__ge___impl( A recv, A other );
+int A__less_or_equal___impl( A recv, A other );
+void A__right___impl( A recv, A other );
+void A__left___impl( A recv, A other );
+A A__index___impl( A recv, bigint index );
+A A__index_assign___impl( A recv, bigint index, A value );
+
+#endif
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class A
+ init do end
+
+ fun is_not_extern do end
+
+ fun proc is extern
+ fun function : Int is extern
+
+ fun one( x : Int ) : Int is extern
+ fun two( x : Int, y : Int ) : Int is extern
+ fun three( x : Int, y : Int, z : Int ) : Int is extern
+end
+
+fun in_object( o : Object ) : Object is extern
+
+var a = new A
+print a.function
+print a.one( 2 )
+print a.two( 1, 2 )
+print a.three( 2, 4, 3 )
+print in_object( "hello world" )
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#include "test_ni_out.nit.h"
+
+/*
+C implementation of simple::A::proc
+*/
+void A_proc___impl( A recv )
+{
+ printf( "proc\n" );
+}
+
+/*
+C implementation of simple::A::function
+*/
+bigint A_function___impl( A recv )
+{
+ return 1;
+}
+
+/*
+C implementation of simple::A::one
+*/
+bigint A_one___impl( A recv, bigint x )
+{
+ return x;
+}
+
+/*
+C implementation of simple::A::two
+*/
+bigint A_two___impl( A recv, bigint x, bigint y )
+{
+ return x + y;
+}
+
+/*
+C implementation of simple::A::three
+*/
+bigint A_three___impl( A recv, bigint x, bigint y, bigint z )
+{
+ return x + y - z;
+}
+
+/*
+C implementation of simple::Object::in_object
+*/
+Object Object_in_object___impl( Object recv, Object o )
+{
+ return o;
+}
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#ifndef simple_NIT_H
+#define simple_NIT_H
+
+#include <test_ni_out._nitni.h>
+
+void A_proc___impl( A recv );
+bigint A_function___impl( A recv );
+bigint A_one___impl( A recv, bigint x );
+bigint A_two___impl( A recv, bigint x, bigint y );
+bigint A_three___impl( A recv, bigint x, bigint y, bigint z );
+Object Object_in_object___impl( Object recv, Object o );
+
+#endif
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+extern A
+special Pointer
+ new is extern
+
+ redef fun to_s : String is extern import String::from_cstring
+end
+
+var a = new A
+print a
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#include "test_ni_pointer.nit.h"
+
+/*
+C implementation of test_ni_pointer::A::init
+*/
+A new_A___impl( )
+{
+ int* v = (int*)malloc( sizeof(int) );
+ (*v) = 123;
+ return (A)v;
+}
+
+/*
+C implementation of test_ni_pointer::A::(string::Object::to_s)
+
+Imported methods signatures:
+ String new_String_from_cstring( char * str ) for string::String::from_cstring
+*/
+String A_to_s___impl( A recv )
+{
+ char* s = calloc( 256, sizeof(char) );
+ sprintf( s, "%d", *((int*)recv) );
+ return new_String_from_cstring( s );
+}
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#ifndef test_ni_pointer_IMPL_NIT_H
+#define test_ni_pointer_IMPL_NIT_H
+
+#define A void*
+
+#include <nit_common.h>
+
+#include <test_ni_pointer._nitni.h>
+
+A new_A___impl( );
+void A_native_init___impl( A recv );
+String A_to_s___impl( A recv );
+
+#endif
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+fun opposite( v : Bool ) : Bool is extern
+fun plus_10( v : Char ) : Char is extern
+fun plus_1000( v : Int ) : Int is extern
+fun multiply_by_100( v : Float ) : Float is extern
+fun print_ns( s : NativeString ) is extern
+
+print opposite( true )
+print opposite( false )
+
+print plus_10( 'a' )
+
+print plus_1000( 1234 )
+
+print multiply_by_100( 123.45 )
+
+print_ns( "hello world".to_cstring )
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#include "test_ni_primitives.nit.h"
+
+#include <stdlib.h>
+
+/*
+C implementation of test_ni_primitives::Object::opposite
+*/
+int Object_opposite___impl( Object recv, int v )
+{
+ return v == 0;
+}
+
+/*
+C implementation of test_ni_primitives::Object::plus_10
+*/
+char Object_plus_10___impl( Object recv, char v )
+{
+ return v + 10;
+}
+
+/*
+C implementation of test_ni_primitives::Object::plus_1000
+*/
+bigint Object_plus_1000___impl( Object recv, bigint v )
+{
+ return v + 1000;
+}
+
+/*
+C implementation of test_ni_primitives::Object::multiply_by_100
+*/
+float Object_multiply_by_100___impl( Object recv, float v )
+{
+ return v * 100;
+}
+
+/*
+C implementation of test_ni_primitives::Object::print_ns
+*/
+void Object_print_ns___impl( Object recv, char * s )
+{
+ printf( "%s\n", s );
+}
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#ifndef test_ni_primitives_IMPL_NIT_H
+#define test_ni_primitives_IMPL_NIT_H
+
+#include <nit_common.h>
+
+#include <test_ni_primitives._nitni.h>
+
+int Object_opposite___impl( Object recv, int v );
+char Object_plus_10___impl( Object recv, char v );
+bigint Object_plus_1000___impl( Object recv, bigint v );
+float Object_multiply_by_100___impl( Object recv, float v );
+void Object_print_ns___impl( Object recv, char * s );
+
+#endif
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class A
+ fun work is extern
+ fun call is extern import work
+end
+
+class B
+special A
+ redef fun work is extern
+end
+
+var a = new A
+var b = new B
+
+a.call
+b.call
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#include "test_ni_special_all_native.nit.h"
+
+/*
+C implementation of test_ni_special_all_native::A::work
+*/
+void A_work___impl( A recv )
+{
+ printf( "A\n" );
+}
+
+/*
+C implementation of test_ni_special_all_native::A::call
+
+Imported methods signatures:
+ void A_work( A recv ) for test_ni_special_all_native::A::work
+*/
+void A_call___impl( A recv )
+{
+ A_work( recv );
+}
+
+/*
+C implementation of test_ni_special_all_native::B::(test_ni_special_all_native::A::work)
+*/
+void B_work___impl( B recv )
+{
+ printf( "B\n" );
+}
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#ifndef test_ni_special_all_native_IMPL_NIT_H
+#define test_ni_special_all_native_IMPL_NIT_H
+
+#include <nit_common.h>
+
+#include <test_ni_special_all_native._nitni.h>
+
+void A_work___impl( A recv );
+void A_call___impl( A recv );
+void B_work___impl( B recv );
+
+#endif
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class A
+ fun nity do print "A"
+ fun exy is extern import nity
+end
+
+class B
+special A
+ redef fun nity do print "B"
+end
+
+var a = new A
+print "a from nit"
+a.nity
+print "a from extern"
+a.exy
+
+var b = new B
+print "a from nit"
+b.nity
+print "a from extern"
+b.exy
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#include "test_ni_special_from_native.nit.h"
+
+/*
+C implementation of test_ni_special_from_native::A::exy
+
+Imported methods signatures:
+ void A_nity( A recv ) for test_ni_special_from_native::A::nity
+*/
+void A_exy___impl( A recv )
+{
+ A_nity( recv );
+}
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#ifndef test_ni_special_from_native_IMPL_NIT_H
+#define test_ni_special_from_native_IMPL_NIT_H
+
+#include <nit_common.h>
+
+#include <test_ni_special_from_native._nitni.h>
+
+void A_exy___impl( A recv );
+
+#endif
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+extern ExternInt special Pointer
+ new as_0 is extern
+ new as_1 is extern
+ new as_2 is extern
+
+ redef fun to_s : String is extern import String::from_cstring
+ fun to_i : Int is extern
+end
+
+redef class Int
+ fun to_extern_int : ExternInt is extern
+end
+
+var i = new ExternInt.as_0
+print i.to_i
+
+i = new ExternInt.as_1
+print i.to_i
+
+i = new ExternInt.as_2
+print i.to_i
+
+i = 1234 .to_extern_int
+print i.to_i
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#include "test_ni_special_pointer.nit.h"
+
+/*
+C implementation of test_ni_special_pointer::ExternInt::as_0
+*/
+ExternInt new_ExternInt_as_0___impl( )
+{
+ ExternInt i0 = (int*)malloc( sizeof(int) );
+ (*i0) = 0;
+ return i0;
+}
+
+/*
+C implementation of test_ni_special_pointer::ExternInt::as_1
+*/
+ExternInt new_ExternInt_as_1___impl( )
+{
+ ExternInt i0 = (int*)malloc( sizeof(int) );
+ (*i0) = 1;
+ return i0;
+}
+
+/*
+C implementation of test_ni_special_pointer::ExternInt::as_2
+*/
+ExternInt new_ExternInt_as_2___impl( )
+{
+ ExternInt i0 = (int*)malloc( sizeof(int) );
+ (*i0) = 2;
+ return i0;
+}
+
+/*
+C implementation of test_ni_special_pointer::ExternInt::(string::Object::to_s)
+
+Imported methods signatures:
+ String new_String_from_cstring( char * str ) for string::String::from_cstring
+*/
+String ExternInt_to_s___impl( ExternInt recv )
+{
+ int v = *recv;
+ char *vs = (char*)calloc( 256, sizeof(char) );
+
+ sprintf( vs, "%i", v );
+ return new_String_from_cstring( vs );
+}
+
+/*
+C implementation of test_ni_special_pointer::ExternInt::to_i
+*/
+bigint ExternInt_to_i___impl( ExternInt recv )
+{
+ return *recv;
+}
+
+/*
+C implementation of test_ni_special_pointer::Int::to_extern_int
+*/
+ExternInt Int_to_extern_int___impl( bigint recv )
+{
+ ExternInt i = malloc( sizeof(int) );
+ (*i) = recv;
+ return i;
+}
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#ifndef test_ni_special_pointer_IMPL_NIT_H
+#define test_ni_special_pointer_IMPL_NIT_H
+
+#define ExternInt int*
+
+#include <nit_common.h>
+
+#include <test_ni_special_pointer._nitni.h>
+
+ExternInt new_ExternInt_as_0___impl( );
+ExternInt new_ExternInt_as_1___impl( );
+ExternInt new_ExternInt_as_2___impl( );
+String ExternInt_to_s___impl( ExternInt recv );
+bigint ExternInt_to_i___impl( ExternInt recv );
+ExternInt Int_to_extern_int___impl( bigint recv );
+
+#endif
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class A
+ fun extern_echo is extern
+ fun echo do print "A"
+end
+
+class B
+special A
+ redef fun extern_echo is extern
+ redef fun echo do print "B"
+end
+
+var a = new A
+a.echo
+a.extern_echo
+
+var b = new B
+b.echo
+b.extern_echo
+
+# explicit casts
+b.as(A).echo
+b.as(A).extern_echo
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#include "test_ni_special_to_native.nit.h"
+
+#include <stdlib.h>
+
+/*
+C implementation of test_ni_special_to_native::A::extern_echo
+*/
+void A_extern_echo___impl( A recv )
+{
+ printf( "A from native\n" );
+}
+
+/*
+C implementation of test_ni_special_to_native::B::(test_ni_special_to_native::A::extern_echo)
+*/
+void B_extern_echo___impl( B recv )
+{
+ printf( "B from native\n" );
+}
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#ifndef test_ni_special_to_native_IMPL_NIT_H
+#define test_ni_special_to_native_IMPL_NIT_H
+
+#include <nit_common.h>
+
+#include <test_ni_special_to_native._nitni.h>
+
+void A_extern_echo___impl( A recv );
+void B_extern_echo___impl( B recv );
+
+#endif
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class A
+ fun get_str_from_nstr( nstr : NativeString ) : String is extern import String::from_cstring
+ fun get_str_from_nstr_with_len( nstr : NativeString ) : String is extern import String::with_native, NativeString::cstring_length
+
+ fun get_nstr_from_str( str : String ) : NativeString is extern import String::to_cstring
+
+ fun get_something() : String is extern import String::from_cstring
+end
+
+var a = new A
+print a.get_str_from_nstr( "hello world...".to_cstring )
+print a.get_str_from_nstr_with_len( "hello world?".to_cstring )
+print new String.from_cstring( a.get_nstr_from_str( "hello world!" ) )
+
+
+var something = a.get_something() # expects "something"
+print something
+print something.length
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#include "test_ni_strings.nit.h"
+
+
+/*
+C implementation of test_ni_strings::A::get_str_from_nstr
+
+Imported methods signatures:
+ String new_String_from_cstring( char * str ) for string::String::from_cstring
+*/
+String A_get_str_from_nstr___impl( A recv, char * nstr )
+{
+ return new_String_from_cstring( nstr );
+}
+
+/*
+C implementation of test_ni_strings::A::get_str_from_nstr_with_len
+
+Imported methods signatures:
+ String new_String_with_native( char * nat, bigint size ) for string::String::with_native
+ bigint NativeString_cstring_length( char * recv ) for string::NativeString::cstring_length
+*/
+String A_get_str_from_nstr_with_len___impl( A recv, char * nstr )
+{
+ return new_String_with_native( nstr, NativeString_cstring_length( nstr ) );
+}
+
+/*
+C implementation of test_ni_strings::A::get_nstr_from_str
+
+Imported methods signatures:
+ char * String_to_cstring( String recv ) for string::String::to_cstring
+*/
+char * A_get_nstr_from_str___impl( A recv, String str )
+{
+ return String_to_cstring( str );
+}
+
+
+/*
+C implementation of test_ni_strings::A::get_something
+
+Imported methods signatures:
+ String new_String_from_cstring( char * str ) for string::String::from_cstring
+*/
+String A_get_something___impl( A recv )
+{
+ return new_String_from_cstring( "something" );
+}
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#ifndef test_ni_strings_IMPL_NIT_H
+#define test_ni_strings_IMPL_NIT_H
+
+#include <nit_common.h>
+
+#include <test_ni_strings._nitni.h>
+
+String A_get_str_from_nstr___impl( A recv, char * nstr );
+String A_get_str_from_nstr_with_len___impl( A recv, char * nstr );
+char * A_get_nstr_from_str___impl( A recv, String str );
+String A_get_something___impl( A recv );
+
+#endif
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class A
+ fun id : String do return "A"
+end
+
+class B
+special A
+ redef fun id : String is extern import super, String::from_cstring, String::to_cstring
+end
+
+var a = new A
+print a.id
+
+var b = new B
+print b.id
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#include "test_ni_super.nit.h"
+
+/*
+C implementation of super::B::(super::A::id)
+
+Imported methods signatures:
+ void new_String_from_cstring( char * str ) for string::String::from_cstring
+ char * String_to_cstring( String recv ) for string::String::to_cstring
+ String B_id___super( B recv ) to call super
+*/
+String B_id___impl( B recv )
+{
+ char *new_name;
+ char *prefix = "B special ";
+ char *super_name = String_to_cstring( B_id___super( recv ) );
+
+ new_name = calloc( strlen( prefix )+strlen( super_name )+1, sizeof(char) );
+ strcpy( new_name, prefix );
+ strcpy( new_name+strlen( prefix ), super_name );
+ new_name[ strlen( prefix )+strlen( super_name ) ] = '\0';
+
+ return new_String_from_cstring( new_name );
+}
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#ifndef super_NIT_H
+#define super_NIT_H
+
+#include <test_ni_super._nitni.h>
+
+String B_id___impl( B recv );
+
+#endif
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+class A
+ type E : Object
+end
+
+class B
+ super A
+ redef type E : Int
+ fun f : E is extern
+end
+
+class C
+ super A
+ redef type E : String
+ fun f( v : E ) is extern
+end
+
+class D
+ super B
+ redef fun f is extern
+end
+
+var b = new B
+print b.f
+
+var d = new D
+print d.f
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#include "test_ni_virtypes.nit.h"
+
+/*
+C implementation of test_ni_virtypes::B::f
+*/
+bigint B_f___impl( B recv ) {
+ return 1;
+}
+
+/*
+C implementation of test_ni_virtypes::C::f
+*/
+void C_f___impl( C recv, String v ) {}
+
+/*
+C implementation of test_ni_virtypes::D::(test_ni_virtypes::B::f)
+*/
+bigint D_f___impl( D recv ) {
+ return 2;
+}
--- /dev/null
+/* This file is part of NIT ( http://www.nitlanguage.org ).
+ *
+ * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
+ *
+ * This file is free software, which comes along with NIT. This software 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. You can modify it is you want, provided this header
+ * is kept unaltered, and a notification of the changes is added.
+ * You are allowed to redistribute it and sell it, alone or is a part of
+ * another product.
+ */
+
+#ifndef TEST_NI_VIRTYPES_NIT_H
+#define TEST_NI_VIRTYPES_NIT_H
+
+#include <test_ni_virtypes._nitni.h>
+
+bigint B_f___impl( B recv );
+void C_f___impl( C recv, String v );
+bigint D_f___impl( D recv );
+#endif