]> gitweb.factorcode.org Git - factor.git/commitdiff
alien.syntax: adding INITIALIZE-ALIEN:
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 26 Jan 2022 18:54:23 +0000 (10:54 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 26 Jan 2022 18:54:23 +0000 (10:54 -0800)
basis/alien/syntax/syntax-docs.factor
basis/alien/syntax/syntax.factor

index 5c6e25c7c26ca4c03cad48ef0100987e77b8bc93..522d11a5031a36bcae1b3fe4a8649adee2da1c48 100644 (file)
@@ -125,6 +125,10 @@ HELP: C-GLOBAL:
 { $values { "type" "a C type" } { "name" "a C global variable name" } }
 { $description "Defines a getter " { $snippet "name" } " and setter " { $snippet "set-name" } " for the global value in the current library, set with " { $link POSTPONE: LIBRARY: } "." } ;
 
+HELP: INITIALIZE-ALIEN:
+{ $syntax "INITIALIZE-ALIEN: type ... ;" }
+{ $description "Initializes a " { $snippet "type" } " using the provided definition." } ;
+
 ARTICLE: "alien.enums" "Enumeration types"
 "The " { $vocab-link "alien.enums" } " vocab contains the implementation for " { $link POSTPONE: ENUM: } " C types, and provides words for converting between enum singletons and integers. It is possible to dispatch off of members of an enum."
 $nl
index 86e12601de03bd5109da2fcb2c09e627033e3f23..3354f311056051be29649afd47370d0892d3f46f 100644 (file)
@@ -40,3 +40,6 @@ SYNTAX: C-GLOBAL: scan-c-type scan-new-word define-global ;
 
 SYNTAX: pointer:
     scan-c-type <pointer> suffix! ;
+
+SYNTAX: INITIALIZE-ALIEN:
+    scan-word parse-definition '[ _ _ initialize-alien ] append! ;