nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
model: add `MEntity::is_broken`
[nit.git]
/
lib
/
c.nit
diff --git
a/lib/c.nit
b/lib/c.nit
index
a8e0c2f
..
a9b04e1
100644
(file)
--- a/
lib/c.nit
+++ b/
lib/c.nit
@@
-14,10
+14,11
@@
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
-# Utilities and performant structure for the FFI with C
+# Structures and services for compatibility with the C language
module c
module c
-import standard
-intrude import standard::collection::array
+
+import core
+intrude import core::collection::array
# A thin wrapper around a `NativeCArray` adding length information
abstract class CArray[E]
# A thin wrapper around a `NativeCArray` adding length information
abstract class CArray[E]
@@
-92,8
+93,8
@@
class CIntArray
super size
end
super size
end
- # Build from an `Array[Int]`
- new from(array: Array[Int])
+ # Create from an `SequenceRead[Int]`
+ new from(array: SequenceRead[Int])
do
var carray = new CIntArray(array.length)
for i in array.length.times do
do
var carray = new CIntArray(array.length)
for i in array.length.times do
@@
-119,7
+120,7
@@
end
# Wrapper around an array of `unsigned char` in C (`unsigned char*`) with length and destroy state
class CByteArray
# Wrapper around an array of `unsigned char` in C (`unsigned char*`) with length and destroy state
class CByteArray
- super CArray[Int]
+ super CArray[Byte]
redef type NATIVE: NativeCByteArray
# Allocate a new array of `size`
redef type NATIVE: NativeCByteArray
# Allocate a new array of `size`
@@
-128,8
+129,8
@@
class CByteArray
super size
end
super size
end
- # Build from an `Array[Int]`
- new from(array: Array[Int])
+ # Create from a `SequenceRead[Byte]`
+ new from(array: SequenceRead[Byte])
do
var carray = new CByteArray(array.length)
for i in array.length.times do
do
var carray = new CByteArray(array.length)
for i in array.length.times do
@@
-142,7
+143,7
@@
end
# An array of `unsigned char` in C (`unsigned char*`)
extern class NativeCByteArray `{ unsigned char* `}
super NativeCArray
# An array of `unsigned char` in C (`unsigned char*`)
extern class NativeCByteArray `{ unsigned char* `}
super NativeCArray
- redef type E: Int
+ redef type E: Byte
# Allocate a new array of `size`
new(size: Int) `{ return calloc(size, sizeof(unsigned char)); `}
# Allocate a new array of `size`
new(size: Int) `{ return calloc(size, sizeof(unsigned char)); `}
@@
-165,8
+166,8
@@
class CNativeStringArray
super size
end
super size
end
- # Build from an `Array[NativeString]`
- new from(array: Array[NativeString])
+ # Create from an `SequenceRead[NativeString]`
+ new from(array: SequenceRead[NativeString])
do
var carray = new CNativeStringArray(array.length)
for i in array.length.times do
do
var carray = new CNativeStringArray(array.length)
for i in array.length.times do