1 #include "stream._nitni.h"
2 #include "stream_nit.h"
3 /* out/indirect function for stream::FDStream::native_close */
4 val_t
FDStream_native_close___out( val_t recv
, val_t i
)
8 orig_return
= stream_FDStream_FDStream_native_close_1( NULL
, UNTAG_Int(i
) );
9 trans_return
= TAG_Int(orig_return
);
10 nitni_local_ref_clean( );
13 /* out/indirect function for stream::FDStream::native_read_char */
14 val_t
FDStream_native_read_char___out( val_t recv
, val_t i
)
18 orig_return
= stream_FDStream_FDStream_native_read_char_1( NULL
, UNTAG_Int(i
) );
19 trans_return
= TAG_Int(orig_return
);
20 nitni_local_ref_clean( );
23 /* out/indirect function for stream::FDStream::native_read */
24 val_t
FDStream_native_read___out( val_t recv
, val_t i
, val_t buf
, val_t len
)
29 trans___buf
= UNBOX_NativeString(buf
);
30 orig_return
= stream_FDStream_FDStream_native_read_3( NULL
, UNTAG_Int(i
), trans___buf
, UNTAG_Int(len
) );
31 trans_return
= TAG_Int(orig_return
);
32 nitni_local_ref_clean( );
35 /* out/indirect function for stream::FDStream::native_write */
36 val_t
FDStream_native_write___out( val_t recv
, val_t i
, val_t buf
, val_t len
)
41 trans___buf
= UNBOX_NativeString(buf
);
42 orig_return
= stream_FDStream_FDStream_native_write_3( NULL
, UNTAG_Int(i
), trans___buf
, UNTAG_Int(len
) );
43 trans_return
= TAG_Int(orig_return
);
44 nitni_local_ref_clean( );
47 /* out/indirect function for stream::FDStream::native_write_char */
48 val_t
FDStream_native_write_char___out( val_t recv
, val_t i
, val_t c
)
52 orig_return
= stream_FDStream_FDStream_native_write_char_2( NULL
, UNTAG_Int(i
), UNTAG_Char(c
) );
53 trans_return
= TAG_Int(orig_return
);
54 nitni_local_ref_clean( );
57 /* out/indirect function for stream::Object::intern_poll */
58 val_t
Object_intern_poll___out( val_t recv
, val_t in_fds
, val_t out_fds
)
62 Array trans___out_fds
;
63 nullable_Int orig_return
;
65 trans_recv
= malloc( sizeof( struct s_Object
) );
66 trans_recv
->ref
.val
= NIT_NULL
;
67 trans_recv
->ref
.count
= 0;
68 nitni_local_ref_add( (struct nitni_ref
*)trans_recv
);
69 trans_recv
->ref
.val
= recv
;
70 trans___in_fds
= malloc( sizeof( struct s_Array
) );
71 trans___in_fds
->ref
.val
= NIT_NULL
;
72 trans___in_fds
->ref
.count
= 0;
73 nitni_local_ref_add( (struct nitni_ref
*)trans___in_fds
);
74 trans___in_fds
->ref
.val
= in_fds
;
75 trans___out_fds
= malloc( sizeof( struct s_Array
) );
76 trans___out_fds
->ref
.val
= NIT_NULL
;
77 trans___out_fds
->ref
.count
= 0;
78 nitni_local_ref_add( (struct nitni_ref
*)trans___out_fds
);
79 trans___out_fds
->ref
.val
= out_fds
;
80 orig_return
= malloc( sizeof( struct s_nullable_Int
) );
81 orig_return
->ref
.val
= NIT_NULL
;
82 orig_return
->ref
.count
= 0;
83 orig_return
= Object_intern_poll___impl( trans_recv
, trans___in_fds
, trans___out_fds
);
84 trans_return
= orig_return
->ref
.val
;
85 nitni_local_ref_clean( );
88 nullable_Int
stream_null_Int()
91 n
= malloc( sizeof( struct s_nullable_Int
) );
92 n
->ref
.val
= NIT_NULL
;
94 nitni_local_ref_add( (struct nitni_ref
*)n
);
97 nullable_Object
stream_null_Object()
100 n
= malloc( sizeof( struct s_nullable_Object
) );
101 n
->ref
.val
= NIT_NULL
;
103 nitni_local_ref_add( (struct nitni_ref
*)n
);
106 /* friendly for array::AbstractArrayRead::(abstract_collection::Collection::length) */
107 bigint
stream_Array_length( Array recv
)
112 trans_recv
= recv
->ref
.val
;
113 orig_return
= CALL_standard___collection___abstract_collection___Collection___length( trans_recv
)( trans_recv
);
114 trans_return
= UNTAG_Int(orig_return
);
117 /* friendly for array::Array::(abstract_collection::SequenceRead::[]) */
118 nullable_Object
stream_Array__index( Array recv
, bigint index
)
122 nullable_Object trans_return
;
123 trans_recv
= recv
->ref
.val
;
124 trans_return
= malloc( sizeof( struct s_nullable_Object
) );
125 trans_return
->ref
.val
= NIT_NULL
;
126 trans_return
->ref
.count
= 0;
127 nitni_local_ref_add( (struct nitni_ref
*)trans_return
);
128 orig_return
= CALL_standard___collection___abstract_collection___SequenceRead_____bra( trans_recv
)( trans_recv
, TAG_Int(index
) );
129 trans_return
->ref
.val
= orig_return
;
132 int stream_nullable_Object_is_a_Int( nullable_Object value
)
135 temp
= value
->ref
.val
;
136 if ( ISNULL(temp
) ) return 0;
137 if ( ! ( ISOBJ( temp
) ?
ISNULL( temp
) || OBJISA( temp
, standard___kernel___Int
): VALISA( temp
, standard___kernel___Int
) ) ) return 0;
140 bigint
stream_nullable_Object_as_Int( nullable_Object value
)
144 temp
= value
->ref
.val
;
145 if ( ISNULL(temp
) ){ fprintf( stderr
, "Casting from nullable Object to Int failed because value is null." );
147 }if ( ! ( ISOBJ( temp
) ?
ISNULL( temp
) || OBJISA( temp
, standard___kernel___Int
): VALISA( temp
, standard___kernel___Int
) ) ){
148 fprintf( stderr
, "Casting to Int failed because value is not a Int." );
151 out
= UNTAG_Int(temp
);
154 nullable_Int
stream_Int_as_nullable( bigint value
)
158 out
= malloc( sizeof( struct s_nullable_Int
) );
159 out
->ref
.val
= NIT_NULL
;
161 nitni_local_ref_add( (struct nitni_ref
*)out
);
162 temp
= TAG_Int(value
);