Merge: tests: `grep` in skip os is now silent
[nit.git] / tests / sav / fixme / nitpretty_args21.res
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 import end
16 intrude import standard::kernel
17 private import standard::string
18
19 `{`}
20
21 `{
22 #ifdef truc
23         #undef truc
24 #endif
25 `}
26
27 in "C headers" `{
28         #include <errno.h>
29 `}
30
31 fun err: Int is extern `{ return 1; `}
32
33 fun errno: Int is extern `{
34         return errno;
35 `}
36
37 fun errnoooooooooooooooooooooooooooooooooooooooooooooooooooooooooo: Int is extern `{
38          return errno;
39 `}
40
41 private class A
42         var my_attr = 1234
43
44         fun baz(msg: String) import String.length, String.to_cstring, my_attr, my_attr= `{
45                 char *c_msg;
46                 int msg_len;
47
48                 /* String_to_cstring isa a allback to msg.to_cstring */
49                 c_msg = String_to_cstring( msg );
50
51                 /* String_length is a callback to msg.length */
52                 msg_len = String_length( msg );
53
54                 printf( "received msg: %s, of length = %d\n", c_msg, msg_len );
55
56                 /* A_my_attr is a callback to the getter of self.my_attr */
57                 printf( "old attr %d\n", A_my_attr(recv) );
58
59                 if(chose)
60                         truc;
61                 else
62                         chose;
63
64                 /* A_my_attr is a callback to the setter of self.my_attr= */
65                 A_my_attr__assign( recv, msg_len );
66         `}
67 end
68
69 extern class TimeT `{time_t`}
70         new `{ return time(NULL); `}
71         new from_i(i: Int) `{ return i; `}
72         fun update `{ time(&recv); `}
73
74         fun ctime: String import NativeString.to_s_with_copy `{
75                 return NativeString_to_s_with_copy( ctime(&recv) );
76         `}
77
78         # Difference in secondes from start (self if the end time)
79         fun difftime(start: TimeT): Float `{ return difftime(recv, start); `}
80
81         private fun intern_poll(in_fds: Array[Int], out_fds: Array[Int]): nullable Int is import
82                 Array[Int].length, Array[Int].[], Int.as(nullable Int) `{`}
83 end
84
85 fun address_is_null: Bool is extern "address_is_null"
86
87 fun free `{ free(recv); `}