]> gitweb.factorcode.org Git - factor.git/commitdiff
alien.c-types: Add s8/u8/s16/u16/s32/u32/s64/u64/isize/usize/f32/f64
authorDoug Coleman <doug.coleman@gmail.com>
Wed, 29 Dec 2021 01:53:20 +0000 (19:53 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 30 Dec 2021 04:05:44 +0000 (22:05 -0600)
basis/alien/c-types/c-types.factor

index 74f4e5d1bc5c389231211c34e2c498134b98707b..2da79a801ebece3c8c76cf07028d53f63c522dbe 100644 (file)
@@ -1,9 +1,9 @@
 ! Copyright (C) 2004, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien alien.accessors arrays classes
-combinators compiler.units cpu.architecture delegate kernel
-layouts math math.order math.parser quotations sequences summary
-system words words.symbol ;
+USING: accessors alien alien.accessors alien.syntax arrays
+classes combinators compiler.units cpu.architecture delegate
+kernel layouts math math.order math.parser quotations sequences
+summary system words words.symbol ;
 IN: alien.c-types
 
 SYMBOLS:
@@ -177,6 +177,11 @@ SYMBOLS:
     c-string int8_t uint8_t int16_t uint16_t
     int32_t uint32_t int64_t uint64_t ;
 
+SYMBOLS:
+    isize usize
+    s8 u8 s16 u16 s32 u32 s64 u64
+    f32 f64 ;
+
 CONSTANT: primitive-types
     {
         char uchar
@@ -388,6 +393,9 @@ M: pointer lookup-c-type
 
         \ ulonglong lookup-c-type \ uintptr_t typedef
         \ ulonglong lookup-c-type \ size_t typedef
+
+        \ longlong lookup-c-type \ isize typedef
+        \ ulonglong lookup-c-type \ usize typedef
     ] [
         ! 32bit-vm int
         <c-type>
@@ -453,6 +461,9 @@ M: pointer lookup-c-type
 
         \ uint lookup-c-type \ uintptr_t typedef
         \ uint lookup-c-type \ size_t typedef
+
+        \ int lookup-c-type \ isize typedef
+        \ uint lookup-c-type \ usize typedef
     ] if
 
     \ uchar lookup-c-type clone
@@ -471,6 +482,18 @@ M: pointer lookup-c-type
     \ uint lookup-c-type uint32_t typedef
     \ ulonglong lookup-c-type uint64_t typedef
 
+    \ char lookup-c-type s8 typedef
+    \ short lookup-c-type s16 typedef
+    \ int lookup-c-type s32 typedef
+    \ longlong lookup-c-type s64 typedef
+
+    \ uchar lookup-c-type u8 typedef
+    \ ushort lookup-c-type u16 typedef
+    \ uint lookup-c-type u32 typedef
+    \ ulonglong lookup-c-type u64 typedef
+
+    \ float lookup-c-type f32 typedef
+    \ double lookup-c-type f64 typedef
 ] with-compilation-unit
 
 M: char-16-rep rep-component-type drop char ;