1 /* This file is part of NIT ( http://www.nitlanguage.org ).
3 * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
5 * This file is free software, which comes along with NIT. This software is
6 * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
7 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
8 * PARTICULAR PURPOSE. You can modify it is you want, provided this header
9 * is kept unaltered, and a notification of the changes is added.
10 * You are allowed to redistribute it and sell it, alone or is a part of
14 #include "test_ni_super.nit.h"
17 C implementation of super::B::(super::A::id)
19 Imported methods signatures:
20 void new_String_from_cstring( char * str ) for string::String::from_cstring
21 char * String_to_cstring( String recv ) for string::String::to_cstring
22 String B_id___super( B recv ) to call super
24 String
B_id___impl( B recv
)
27 char *prefix
= "B special ";
28 char *super_name
= String_to_cstring( B_id___super( recv
) );
30 new_name
= calloc( strlen( prefix
)+strlen( super_name
)+1, sizeof(char) );
31 strcpy( new_name
, prefix
);
32 strcpy( new_name
+strlen( prefix
), super_name
);
33 new_name
[ strlen( prefix
)+strlen( super_name
) ] = '\0';
35 return new_String_from_cstring( new_name
);