]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'master' of git://factorcode.org/git/factor
authorJoe Groff <arcata@gmail.com>
Mon, 28 Sep 2009 03:21:42 +0000 (22:21 -0500)
committerJoe Groff <arcata@gmail.com>
Mon, 28 Sep 2009 03:21:42 +0000 (22:21 -0500)
54 files changed:
basis/alien/c-types/c-types-docs.factor
basis/alien/c-types/c-types-tests.factor
basis/alien/c-types/c-types.factor
basis/alien/parser/parser.factor
basis/alien/syntax/syntax-docs.factor
basis/alien/syntax/syntax.factor
basis/core-foundation/dictionaries/dictionaries.factor
basis/core-foundation/file-descriptors/file-descriptors.factor
basis/db/postgresql/ffi/ffi.factor
basis/math/floats/env/ppc/ppc.factor
basis/openssl/libcrypto/libcrypto.factor
basis/openssl/libssl/libssl.factor
basis/pango/cairo/cairo.factor
basis/pango/fonts/fonts.factor
basis/pango/layouts/layouts.factor
basis/pango/pango.factor
basis/unix/getfsstat/freebsd/freebsd.factor
basis/unix/getfsstat/netbsd/netbsd.factor
basis/unix/getfsstat/openbsd/openbsd.factor
basis/unix/kqueue/freebsd/freebsd.factor
basis/unix/kqueue/netbsd/netbsd.factor
basis/unix/kqueue/openbsd/openbsd.factor
basis/unix/linux/linux.factor
basis/unix/solaris/solaris.factor
basis/unix/stat/freebsd/freebsd.factor
basis/unix/stat/linux/32/32.factor
basis/unix/stat/linux/64/64.factor
basis/unix/stat/netbsd/32/32.factor
basis/unix/stat/netbsd/64/64.factor
basis/unix/stat/openbsd/openbsd.factor
basis/unix/statfs/freebsd/freebsd.factor
basis/unix/statfs/linux/linux.factor
basis/unix/statfs/macosx/macosx.factor
basis/unix/statfs/openbsd/openbsd.factor
basis/unix/statvfs/freebsd/freebsd.factor
basis/unix/statvfs/linux/linux.factor
basis/unix/statvfs/netbsd/netbsd.factor
basis/unix/statvfs/openbsd/openbsd.factor
basis/unix/types/types.factor
basis/unix/unix.factor
basis/vm/vm.factor
basis/windows/com/com.factor
basis/windows/usp10/usp10.factor
basis/windows/winsock/winsock.factor
basis/x11/xlib/xlib.factor
extra/curses/ffi/ffi.factor
extra/freetype/freetype.factor
extra/opengl/glu/glu.factor
extra/tokyo/alien/tchdb/tchdb.factor
extra/tokyo/alien/tcrdb/tcrdb.factor
extra/tokyo/alien/tctdb/tctdb.factor
extra/tokyo/alien/tcutil/tcutil.factor
misc/vim/syntax/factor.vim
unmaintained/odbc/odbc.factor

index 4f7083673726f6b5e824a5ca7731378d6a1a52d2..eb4be08764c767bffe9c9e9e01ecd2debbc097c8 100755 (executable)
@@ -88,16 +88,24 @@ HELP: uint
 { $description "This C type represents a four-byte unsigned integer type. Input values will be converted to " { $link math:integer } "s and truncated to 32 bits; output values will be returned as " { $link math:integer } "s." } ;
 HELP: long
 { $description "This C type represents a four- or eight-byte signed integer type. On Windows and on 32-bit Unix platforms, it will be four bytes. On 64-bit Unix platforms, it will be eight bytes. Input values will be converted to " { $link math:integer } "s and truncated to 32 or 64 bits; output values will be returned as " { $link math:integer } "s." } ;
+HELP: intptr_t
+{ $description "This C type represents a signed integer type large enough to hold any pointer value; that is, on 32-bit platforms, it will be four bytes, and on 64-bit platforms, it will be eight bytes. Input values will be converted to " { $link math:integer } "s and truncated to 32 or 64 bits; output values will be returned as " { $link math:integer } "s." } ;
 HELP: ulong
 { $description "This C type represents a four- or eight-byte unsigned integer type. On Windows and on 32-bit Unix platforms, it will be four bytes. On 64-bit Unix platforms, it will be eight bytes. Input values will be converted to " { $link math:integer } "s and truncated to 32 or 64 bits; output values will be returned as " { $link math:integer } "s." } ;
+HELP: uintptr_t
+{ $description "This C type represents an unsigned integer type large enough to hold any pointer value; that is, on 32-bit platforms, it will be four bytes, and on 64-bit platforms, it will be eight bytes. Input values will be converted to " { $link math:integer } "s and truncated to 32 or 64 bits; output values will be returned as " { $link math:integer } "s." } ;
+HELP: ptrdiff_t
+{ $description "This C type represents a signed integer type large enough to hold the distance between two pointer values; that is, on 32-bit platforms, it will be four bytes, and on 64-bit platforms, it will be eight bytes. Input values will be converted to " { $link math:integer } "s and truncated to 32 or 64 bits; output values will be returned as " { $link math:integer } "s." } ;
+HELP: size_t
+{ $description "This C type represents unsigned size values of the size expected by the platform's standard C library (usually four bytes on a 32-bit platform, and eight on a 64-bit platform). Input values will be converted to " { $link math:integer } "s and truncated to the appropriate size; output values will be returned as " { $link math:integer } "s." } ;
 HELP: longlong
 { $description "This C type represents an eight-byte signed integer type. Input values will be converted to " { $link math:integer } "s and truncated to 64 bits; output values will be returned as " { $link math:integer } "s." } ;
 HELP: ulonglong
 { $description "This C type represents an eight-byte unsigned integer type. Input values will be converted to " { $link math:integer } "s and truncated to 64 bits; output values will be returned as " { $link math:integer } "s." } ;
 HELP: void
-{ $description "This symbol is not a valid C type, but it can be used as the return type for a " { $link POSTPONE: FUNCTION: } " or " { $link POSTPONE: CALLBACK: } " definitionor an " { $link alien-invoke } " or " { $link alien-callback } " call." } ;
+{ $description "This symbol is not a valid C type, but it can be used as the return type for a " { $link POSTPONE: FUNCTION: } " or " { $link POSTPONE: CALLBACK: } " definition or for an " { $link alien-invoke } " or " { $link alien-callback } " call." } ;
 HELP: void*
-{ $description "This C type represents a pointer to C memory. " { $link byte-array } " and " { $link alien } " values can be passed as inputs, but see " { $link "byte-arrays-gc" } " for notes about passing byte arrays into C functions. Output values are returned as " { $link alien } "s." } ;
+{ $description "This C type represents a pointer to C memory. " { $link byte-array } " and " { $link alien } " values can be passed as " { $snippet "void*" } " function inputs, but see " { $link "byte-arrays-gc" } " for notes about passing byte arrays into C functions. " { $snippet "void*" } " output values are returned as " { $link alien } "s." } ;
 HELP: char*
 { $description "This C type represents a pointer to a C string. See " { $link "c-strings" } " for details about using strings with the FFI." } ;
 HELP: float
index f48ed50a34c6f7fbb4476e22ac81191822dba658..d134d571896c9f79c8c068320fafb61db890daaa 100755 (executable)
@@ -1,6 +1,6 @@
 USING: alien alien.syntax alien.c-types alien.parser
-kernel tools.test sequences system libc alien.strings
-io.encodings.utf8 math.constants classes.struct ;
+eval kernel tools.test sequences system libc alien.strings
+io.encodings.utf8 math.constants classes.struct classes ;
 IN: alien.c-types.tests
 
 CONSTANT: xyz 123
@@ -15,28 +15,28 @@ UNION-STRUCT: foo
     { a int }
     { b int } ;
 
-[ f ] [ "char*"  parse-c-type c-type void* c-type eq? ] unit-test
-[ t ] [ "char**" parse-c-type c-type void* c-type eq? ] unit-test
+[ f ] [ char  resolve-pointer-type c-type void* c-type eq? ] unit-test
+[ t ] [ char* resolve-pointer-type c-type void* c-type eq? ] unit-test
 
 [ t ] [ foo heap-size int heap-size = ] unit-test
 
 TYPEDEF: int MyInt
 
-[ t ] [ int c-type MyInt c-type eq? ] unit-test
-[ t ] [ void* c-type "MyInt*" parse-c-type c-type eq? ] unit-test
+[ t ] [ int   c-type MyInt                      c-type eq? ] unit-test
+[ t ] [ void* c-type MyInt resolve-pointer-type c-type eq? ] unit-test
 
 TYPEDEF: char MyChar
 
-[ t ] [ char c-type MyChar c-type eq? ] unit-test
-[ f ] [  void*               c-type "MyChar*" parse-c-type c-type eq? ] unit-test
-[ t ] [ "char*" parse-c-type c-type "MyChar*" parse-c-type c-type eq? ] unit-test
+[ t ] [ char  c-type MyChar                      c-type eq? ] unit-test
+[ f ] [ void* c-type MyChar resolve-pointer-type c-type eq? ] unit-test
+[ t ] [ char* c-type MyChar resolve-pointer-type c-type eq? ] unit-test
 
 [ 32 ] [ { int 8 } heap-size ] unit-test
 
 TYPEDEF: char* MyString
 
-[ t ] [ char* c-type  MyString                c-type eq? ] unit-test
-[ t ] [ void* c-type "MyString*" parse-c-type c-type eq? ] unit-test
+[ t ] [ char* c-type MyString                      c-type eq? ] unit-test
+[ t ] [ void* c-type MyString resolve-pointer-type c-type eq? ] unit-test
 
 TYPEDEF: int* MyIntArray
 
@@ -59,3 +59,44 @@ os windows? cpu x86.64? and [
 [ -10 ] [ -10 char c-type-clamp ] unit-test
 [ 127 ] [ 230 char c-type-clamp ] unit-test
 [ t ] [ pi dup float c-type-clamp = ] unit-test
+
+C-TYPE: opaque
+
+[ t ] [ void* c-type opaque resolve-pointer-type c-type eq? ] unit-test
+[ opaque c-type ] [ no-c-type? ] must-fail-with
+
+[ """
+    USING: alien.syntax ;
+    IN: alien.c-types.tests
+    FUNCTION: opaque return_opaque ( ) ;
+""" eval( -- ) ] [ no-c-type? ] must-fail-with
+
+C-TYPE: forward
+STRUCT: backward { x forward* } ;
+STRUCT: forward { x backward* } ;
+
+[ t ] [ forward c-type struct-c-type? ] unit-test
+[ t ] [ backward c-type struct-c-type? ] unit-test
+
+DEFER: struct-redefined
+
+[ f ]
+[
+
+    """
+    USING: alien.c-types classes.struct ;
+    IN: alien.c-types.tests
+
+    STRUCT: struct-redefined { x int } ;
+    """ eval( -- )
+
+    """
+    USING: alien.syntax ;
+    IN: alien.c-types.tests
+
+    C-TYPE: struct-redefined
+    """ eval( -- )
+
+    \ struct-redefined class?
+] unit-test
+
index ab1c9df77e14b6c0859c7aba9ce243b85728e79a..dec7f92501459779cfaacc8ca716ceca59c4b907 100755 (executable)
@@ -53,7 +53,7 @@ ERROR: no-c-type name ;
 PREDICATE: c-type-word < word
     "c-type" word-prop ;
 
-UNION: c-type-name string word ;
+UNION: c-type-name string c-type-word ;
 
 ! C type protocol
 GENERIC: c-type ( name -- c-type ) foldable
@@ -62,6 +62,9 @@ GENERIC: resolve-pointer-type ( name -- c-type )
 
 << \ void \ void* "pointer-c-type" set-word-prop >>
 
+: void? ( c-type -- ? )
+    { void "void" } member? ;
+
 M: word resolve-pointer-type
     dup "pointer-c-type" word-prop
     [ ] [ drop void* ] ?if ;
@@ -75,6 +78,7 @@ M: string resolve-pointer-type
     ] if ;
 
 : resolve-typedef ( name -- c-type )
+    dup void? [ no-c-type ] when
     dup c-type-name? [ c-type ] when ;
 
 : parse-array-type ( name -- dims c-type )
@@ -91,10 +95,8 @@ M: string c-type ( name -- c-type )
     ] if ;
 
 M: word c-type
-    "c-type" word-prop resolve-typedef ;
-
-: void? ( c-type -- ? )
-    { void "void" } member? ;
+    dup "c-type" word-prop resolve-typedef
+    [ ] [ no-c-type ] ?if ;
 
 GENERIC: c-struct? ( c-type -- ? )
 
@@ -310,7 +312,7 @@ CONSTANT: primitive-types
     }
 
 SYMBOLS:
-    ptrdiff_t intptr_t size_t
+    ptrdiff_t intptr_t uintptr_t size_t
     char* uchar* ;
 
 [
@@ -471,9 +473,10 @@ SYMBOLS:
         [ >float ] >>unboxer-quot
     \ double define-primitive-type
 
-    \ long \ ptrdiff_t typedef
-    \ long \ intptr_t typedef
-    \ ulong \ size_t typedef
+    \ long c-type \ ptrdiff_t typedef
+    \ long c-type \ intptr_t typedef
+    \ ulong c-type \ uintptr_t typedef
+    \ ulong c-type \ size_t typedef
 ] with-compilation-unit
 
 M: char-16-rep rep-component-type drop char ;
index d58f9a315ce1534bdce2e61afc8ba8afecf5717f..89e83a1d9bf8532a0313e440a0c0e275dcf140c2 100644 (file)
@@ -1,22 +1,22 @@
 ! Copyright (C) 2008, 2009 Slava Pestov, Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien alien.c-types arrays assocs
-combinators combinators.short-circuit effects grouping
-kernel parser sequences splitting words fry locals lexer
-namespaces summary math vocabs.parser ;
+USING: accessors alien alien.c-types arrays assocs classes
+combinators combinators.short-circuit compiler.units effects
+grouping kernel parser sequences splitting words fry locals
+lexer namespaces summary math vocabs.parser ;
 IN: alien.parser
 
-: parse-c-type-name ( name -- word/string )
-    [ search ] keep or ;
+: parse-c-type-name ( name -- word )
+    dup search [ nip ] [ no-word ] if* ;
 
 : parse-c-type ( string -- array )
     {
         { [ dup "void" =            ] [ drop void ] }
         { [ CHAR: ] over member?    ] [ parse-array-type parse-c-type-name prefix ] }
         { [ dup search c-type-word? ] [ parse-c-type-name ] }
-        { [ dup c-types get at      ] [ ] }
+        { [ "**" ?tail              ] [ drop void* ] }
         { [ "*" ?tail               ] [ parse-c-type-name resolve-pointer-type ] }
-        [ no-c-type ]
+        [ parse-c-type-name no-c-type ]
     } cond ;
 
 : scan-c-type ( -- c-type )
@@ -25,10 +25,17 @@ IN: alien.parser
     [ parse-c-type ] if ; 
 
 : reset-c-type ( word -- )
+    dup "struct-size" word-prop
+    [ dup [ forget-class ] [ { "struct-size" } reset-props ] bi ] when
     { "c-type" "pointer-c-type" "callback-effect" "callback-abi" } reset-props ;
 
 : CREATE-C-TYPE ( -- word )
-    scan current-vocab create dup reset-c-type ;
+    scan current-vocab create {
+        [ fake-definition ]
+        [ set-word ]
+        [ reset-c-type ]
+        [ ]
+    } cleave ;
 
 : normalize-c-arg ( type name -- type' name' )
     [ length ]
index e04f6a471de4fb8c8fb723620e20ac5737f3a924..dbfc067bc6284acdc94bc920a688b7d14dff28ac 100644 (file)
@@ -1,5 +1,5 @@
 IN: alien.syntax
-USING: alien alien.c-types alien.parser classes.struct help.markup help.syntax ;
+USING: alien alien.c-types alien.parser classes.struct help.markup help.syntax see ;
 
 HELP: DLL"
 { $syntax "DLL\" path\"" }
@@ -65,6 +65,16 @@ HELP: C-ENUM:
     { $code "CONSTANT: red 0" "CONSTANT: green 1" "CONSTANT: blue 2" }
 } ;
 
+HELP: C-TYPE:
+{ $syntax "C-TYPE: type" }
+{ $values { "type" "a new C type" } }
+{ $description "Defines a new, opaque C type. Since it is opaque, " { $snippet "type" } " will not be directly usable as a parameter or return type of a " { $link POSTPONE: FUNCTION: } " or as a slot of a " { $link POSTPONE: STRUCT: } ". However, it can be used as the type of a pointer (that is, as " { $snippet "type*" } ")." $nl
+{ $snippet "C-TYPE:" } " can also be used to forward-declare C types to enable circular dependencies. For example:"
+{ $code """C-TYPE: forward 
+STRUCT: backward { x forward* } ;
+STRUCT: forward { x backward* } ; """ } }
+{ $notes "Primitive C types are also displayed using " { $snippet "C-TYPE:" } " syntax when they are displayed by " { $link see } "." } ;
+
 HELP: CALLBACK:
 { $syntax "CALLBACK: return type ( parameters ) ;" }
 { $values { "return" "a C return type" } { "type" "a type name" } { "parameters" "a comma-separated sequence of type/name pairs; " { $snippet "type1 arg1, type2 arg2, ..." } } }
index 85b763ba51e312aa3443d09437d59a903467de07..e27a5ef122e1664bc03779ab6d39fcb67c51e9cf 100644 (file)
@@ -32,7 +32,7 @@ SYNTAX: C-ENUM:
     [ [ create-in ] dip define-constant ] each-index ;
 
 SYNTAX: C-TYPE:
-    "Primitive C type definition not supported" throw ;
+    void CREATE-C-TYPE typedef ;
 
 ERROR: no-such-symbol name library ;
 
index 04b5aacb39e1e991a1bc4bc94e7f80888c3036f6..fc0e98a2150462aa53de192ed2d8f3fb82076181 100644 (file)
@@ -8,8 +8,8 @@ SPECIALIZED-ARRAY: void*
 
 TYPEDEF: void* CFDictionaryRef
 TYPEDEF: void* CFMutableDictionaryRef
-TYPEDEF: void* CFDictionaryKeyCallBacks*
-TYPEDEF: void* CFDictionaryValueCallBacks*
+C-TYPE: CFDictionaryKeyCallBacks
+C-TYPE: CFDictionaryValueCallBacks
 
 FUNCTION: CFDictionaryRef CFDictionaryCreate (
    CFAllocatorRef allocator,
index 2520f1c3dab2dfcceff792e448da640367128b22..ec5581d4633237cd40d36912344401ae4e90b303 100644 (file)
@@ -6,7 +6,7 @@ IN: core-foundation.file-descriptors
 TYPEDEF: void* CFFileDescriptorRef
 TYPEDEF: int CFFileDescriptorNativeDescriptor
 TYPEDEF: void* CFFileDescriptorCallBack
-TYPEDEF: void* CFFileDescriptorContext*
+C-TYPE: CFFileDescriptorContext
 
 FUNCTION: CFFileDescriptorRef CFFileDescriptorCreate (
     CFAllocatorRef allocator,
index 88618c6212b841b910b6881d2adcc55a1490eff5..f4a55e32807e33358522fdf0e53ab00d6da33129 100644 (file)
@@ -59,18 +59,18 @@ TYPEDEF: int PostgresPollingStatusType
 TYPEDEF: int PGTransactionStatusType 
 TYPEDEF: int PGVerbosity 
 
-TYPEDEF: void* PGconn*
-TYPEDEF: void* PGresult*
-TYPEDEF: void* PGcancel*
+C-TYPE: PGconn
+C-TYPE: PGresult
+C-TYPE: PGcancel
 TYPEDEF: uint Oid
 TYPEDEF: uint* Oid*
 TYPEDEF: char pqbool
-TYPEDEF: void* PQconninfoOption*
-TYPEDEF: void* PGnotify*
-TYPEDEF: void* PQArgBlock*
-TYPEDEF: void* PQprintOpt*
-TYPEDEF: void* SSL*
-TYPEDEF: void* FILE*
+C-TYPE: PQconninfoOption
+C-TYPE: PGnotify
+C-TYPE: PQArgBlock
+C-TYPE: PQprintOpt
+C-TYPE: SSL
+C-TYPE: FILE
 
 LIBRARY: postgresql
 
index d6a6ae6834c74b244a52f84b0f763832e8ccf7d0..f635a2a0f1e2959e3d5157feeb1173d07e9d077b 100644 (file)
@@ -1,6 +1,6 @@
-USING: accessors alien.syntax arrays assocs biassocs
-classes.struct combinators kernel literals math math.bitwise
-math.floats.env math.floats.env.private system ;
+USING: accessors alien.c-types alien.syntax arrays assocs
+biassocs classes.struct combinators kernel literals math
+math.bitwise math.floats.env math.floats.env.private system ;
 IN: math.floats.env.ppc
 
 STRUCT: ppc-fpu-env
index ed280ecd691b1648eac830975021e860f126e550..dbc5b9e43cdf08c839c18cf7f4dcbffa62df952c 100644 (file)
@@ -104,7 +104,7 @@ FUNCTION: void* BIO_f_buffer (  ) ;
 CONSTANT: EVP_MAX_MD_SIZE 64
 
 TYPEDEF: void* EVP_MD*
-TYPEDEF: void* ENGINE*
+C-TYPE: ENGINE
 
 STRUCT: EVP_MD_CTX
     { digest EVP_MD* }
index 9e2b13159a2bf5b0c0eba85288b5e6cdf6a202ed..225d4b3da1b580fbb8a15301215ea0636babf5a8 100644 (file)
@@ -91,7 +91,7 @@ CONSTANT: SSL_ERROR_WANT_ACCEPT      8
 TYPEDEF: void* ssl-method
 TYPEDEF: void* SSL_CTX*
 TYPEDEF: void* SSL_SESSION*
-TYPEDEF: void* SSL*
+C-TYPE: SSL
 
 LIBRARY: libssl
 
@@ -101,7 +101,7 @@ LIBRARY: libssl
 
 TYPEDEF: void* X509_NAME*
 
-TYPEDEF: void* X509*
+C-TYPE: X509
 
 FUNCTION: int X509_NAME_get_text_by_NID ( X509_NAME* name, int nid, void* buf, int len ) ;
 FUNCTION: X509_NAME* X509_get_subject_name ( X509* a ) ;
index 2ad730ee6e32a1cca77fd48d7475746272e49eec..6fd8d57893183c9855b8a62acfed36ea752d2046 100644 (file)
@@ -19,8 +19,8 @@ IN: pango.cairo
 
 LIBRARY: pangocairo
 
-TYPEDEF: void* PangoCairoFontMap*
-TYPEDEF: void* PangoCairoFont*
+C-TYPE: PangoCairoFontMap
+C-TYPE: PangoCairoFont
 
 FUNCTION: PangoFontMap*
 pango_cairo_font_map_new ( ) ;
index eb3e2208b1ce90c9faf7fe0cb2e6fd9312c7f96c..280ddd20d6257881971dc915d05200bbe3ff9d8d 100644 (file)
@@ -15,14 +15,14 @@ PANGO_STYLE_OBLIQUE
 PANGO_STYLE_ITALIC ;
 
 TYPEDEF: int PangoWeight
-TYPEDEF: void* PangoFont*
-TYPEDEF: void* PangoFontFamily*
-TYPEDEF: void* PangoFontFace*
-TYPEDEF: void* PangoFontMap*
-TYPEDEF: void* PangoFontMetrics*
-TYPEDEF: void* PangoFontDescription*
-TYPEDEF: void* PangoGlyphString*
-TYPEDEF: void* PangoLanguage*
+C-TYPE: PangoFont
+C-TYPE: PangoFontFamily
+C-TYPE: PangoFontFace
+C-TYPE: PangoFontMap
+C-TYPE: PangoFontMetrics
+C-TYPE: PangoFontDescription
+C-TYPE: PangoGlyphString
+C-TYPE: PangoLanguage
 
 CONSTANT: PANGO_WEIGHT_THIN 100
 CONSTANT: PANGO_WEIGHT_ULTRALIGHT 200
index a03d26fb6782b8d20c4b45afcff164aef610b963..74b6d0b0c3934d84fbc145a1750a4f4933e98c8d 100644 (file)
@@ -10,9 +10,9 @@ IN: pango.layouts
 
 LIBRARY: pango
 
-TYPEDEF: void* PangoLayout*
-TYPEDEF: void* PangoLayoutIter*
-TYPEDEF: void* PangoLayoutLine*
+C-TYPE: PangoLayout
+C-TYPE: PangoLayoutIter
+C-TYPE: PangoLayoutLine
 
 FUNCTION: PangoLayout*
 pango_layout_new ( PangoContext* context ) ;
index 03134ed7871ac348c23397218dd010afaf0b5487..6dc48e39fe261e4c682ac6fcf5de1998393a7e68 100644 (file)
@@ -23,7 +23,7 @@ CONSTANT: PANGO_SCALE 1024
 : pango>float ( n -- x ) PANGO_SCALE /f ; inline
 : float>pango ( x -- n ) PANGO_SCALE * >integer ; inline
 
-TYPEDEF: void* PangoContext*
+C-TYPE: PangoContext
 
 FUNCTION: PangoContext* pango_context_new ( ) ;
 
index 44d85680a715fd4e35412013f48d2cbbb41877d2..fefd316fdbe3979ec8ad95eeaba9f34f338a9857 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax ;
+USING: alien.c-types alien.syntax unix.statfs.freebsd ;
 IN: unix.getfsstat.freebsd
 
 CONSTANT: MNT_WAIT        1       ! synchronously wait for I/O to complete
index 1eca6d7dc391081e412fba43db800e520168ab6f..cdad20e4b52af74d4522f4e7e91e0fbd4f5d67df 100644 (file)
@@ -1,10 +1,10 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax ;
+USING: alien.c-types alien.syntax unix.statvfs.netbsd ;
 IN: unix.getfsstat.netbsd
 
 CONSTANT: MNT_WAIT   1 ! synchronously wait for I/O to complete
 CONSTANT: MNT_NOWAIT 2 ! start all I/O, but do not wait for it 
 CONSTANT: MNT_LAZY   3 ! push data not written by filesystem syncer 
 
-FUNCTION: int getvfsstat ( statfs* buf, int bufsize, int flags ) ;
+FUNCTION: int getvfsstat ( statvfs* buf, int bufsize, int flags ) ;
index 19465d8040163738e65cb82835e4809d79901f9b..07b45f5df5e2c3c89aaf013aa524c38fe2463dc6 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax ;
+USING: alien.c-types alien.syntax unix.statfs.openbsd ;
 IN: unix.getfsstat.openbsd
 
 CONSTANT: MNT_WAIT   1 ! synchronously wait for I/O to complete
index 4bf5af84820a4460a54e28179c999a67be9e8c21..54f576ffc172d0b17cce1c4a794f5d2c31085bea 100644 (file)
@@ -1,4 +1,4 @@
-USING: alien.syntax classes.struct ;
+USING: alien.c-types alien.syntax classes.struct unix.time ;
 IN: unix.kqueue
 
 STRUCT: kevent
index d9a91169305689cc8b81e221859304956c592bf9..9ba620258538dbf330c43582529f49593f53852c 100644 (file)
@@ -1,4 +1,4 @@
-USING: alien.syntax classes.struct ;
+USING: alien.c-types alien.syntax classes.struct unix.time ;
 IN: unix.kqueue
 
 STRUCT: kevent
index 1d851c8d681d20aa6aa7e508a3d4babc87d311b1..ab680345b627da0f6af3ef86995863c2ff418183 100644 (file)
@@ -1,4 +1,4 @@
-USING: alien.syntax classes.struct ;
+USING: alien.c-types alien.syntax classes.struct unix.time ;
 IN: unix.kqueue
 
 STRUCT: kevent
index 48044c731c2ea3fc21d936c6b9cd8a208e3b38f0..1ff5401116591b45404cc8093a4c8f7f4acf74f1 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2005, 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax alien system classes.struct ;
+USING: alien.c-types alien.syntax alien system classes.struct ;
 IN: unix
 
 ! Linux.
index b7ea3f172ed53ff173a2727543e8cc2fe637a372..1a1a7603f03d0208174cc5aba44837abc92c1e10 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2006 Patrick Mauritz.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax system kernel layouts ;
+USING: alien.c-types alien.syntax system kernel layouts ;
 IN: unix
 
 ! Solaris.
index 0acf2512e800c491f5ee09daec51b79f2a1ca2b7..04f884e496823ec083fcb3c4d493d5b973d2ea59 100644 (file)
@@ -1,4 +1,5 @@
-USING: kernel alien.syntax math classes.struct ;
+USING: kernel alien.c-types alien.syntax math classes.struct
+unix.time unix.types ;
 IN: unix.stat
 
 ! FreeBSD 8.0-CURRENT
index 324237d64557f252c5819c074f65a1b4009bb700..f01140ff4b2b6256ac8f5e46aab2d34c05fa2a19 100644 (file)
@@ -1,4 +1,5 @@
-USING: kernel alien.syntax math classes.struct ;
+USING: kernel alien.c-types alien.syntax math classes.struct
+unix.time unix.types ;
 IN: unix.stat
 
 ! stat64
index cfd6553ca3b96ca268d091c31e45fcac33d6604e..bb16133c76bba3a7b39199cda40739ccef639ab1 100644 (file)
@@ -1,4 +1,5 @@
-USING: kernel alien.syntax math classes.struct ;
+USING: kernel alien.c-types alien.syntax math classes.struct
+unix.time unix.types ;
 IN: unix.stat
 
 ! Ubuntu 7.10 64-bit
index 98403313b8728b5920814cb8aa8d5de11dac2e39..fb0d61b7e9efcbd3e10cd2de48ecd4c428acc517 100644 (file)
@@ -1,4 +1,5 @@
-USING: kernel alien.syntax math classes.struct ;
+USING: kernel alien.c-types alien.syntax math classes.struct
+unix.time unix.types ;
 IN: unix.stat
 
 ! NetBSD 4.0
index c532e7e9ff655484c3465c1c8609bb3070a3752f..47c4e0c129f58d3a8c0cae47b907b5976e3377a2 100644 (file)
@@ -1,4 +1,5 @@
-USING: kernel alien.syntax math classes.struct ;
+USING: kernel alien.c-types alien.syntax math classes.struct
+unix.time unix.types ;
 IN: unix.stat
 
 ! NetBSD 4.0
index 5bf950fd4b93d10f6516b657af8c6fffe17c4e1e..2702e60f6cdd21813ca36da9414304304901578d 100644 (file)
@@ -1,4 +1,5 @@
-USING: kernel alien.syntax math classes.struct ;
+USING: kernel alien.c-types alien.syntax math classes.struct
+unix.time unix.types ;
 IN: unix.stat
 
 ! OpenBSD 4.2
index f8c8257a4e9351d305b3ed02bd981ced537b8ab7..c9271ff00759e1cc1aa5f6890c7eee9188d9ac90 100644 (file)
@@ -27,8 +27,8 @@ STRUCT: statfs
     { f_owner uid_t }
     { f_fsid fsid_t }
     { f_charspare char[80] }
-    { f_fstypename { "char" MFSNAMELEN } }
-    { f_mntfromname { "char" MNAMELEN } }
-    { f_mntonname { "char" MNAMELEN } } ;
+    { f_fstypename { char MFSNAMELEN } }
+    { f_mntfromname { char MNAMELEN } }
+    { f_mntonname { char MNAMELEN } } ;
 
 FUNCTION: int statfs ( char* path, statvfs* buf ) ;
index 42d66ff1baad52095481696b2a2f39008e20e8d1..ab37ab9605970bd76a9cf1e5fff5df7dc30cf626 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax unix.types unix.stat classes.struct ;
+USING: alien.c-types alien.syntax unix.types unix.stat classes.struct ;
 IN: unix.statfs.linux
 
 STRUCT: statfs64
index 38709f64fe8ca4f18fd59b323b269ff807d09a1b..e83d2d40a03844f90b0c08e1353c4444c871e376 100644 (file)
@@ -111,9 +111,9 @@ STRUCT: statfs64
     { f_type uint32_t }
     { f_flags uint32_t }
     { f_fssubtype uint32_t }
-    { f_fstypename { "char" MFSTYPENAMELEN } }
-    { f_mntonname { "char" MAXPATHLEN } }
-    { f_mntfromname { "char" MAXPATHLEN } }
+    { f_fstypename { char MFSTYPENAMELEN } }
+    { f_mntonname { char MAXPATHLEN } }
+    { f_mntfromname { char MAXPATHLEN } }
     { f_reserved uint32_t[8] } ;
 
 FUNCTION: int statfs64 ( char* path, statfs64* buf ) ;
index 590faf82a636a83cf905c1ff7012d07c72a92d3c..cd720d74d41eb3eb6cc865ff9f51a14e9b8322fe 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax unix.types unix.stat classes.struct ;
+USING: alien.c-types alien.syntax unix.types unix.stat classes.struct ;
 IN: unix.statfs.openbsd
 
 CONSTANT: MFSNAMELEN 16
@@ -25,9 +25,9 @@ STRUCT: statfs
     { f_owner uid_t }
     { f_ctime u_int32_t }
     { f_spare u_int32_t[3] }
-    { f_fstypename { "char" MFSNAMELEN } }
-    { f_mntonname { "char" MNAMELEN } }
-    { f_mntfromname { "char" MNAMELEN } }
+    { f_fstypename { char MFSNAMELEN } }
+    { f_mntonname { char MNAMELEN } }
+    { f_mntfromname { char MNAMELEN } }
     { mount_info char[160] } ;
 
 FUNCTION: int statfs ( char* path, statvfs* buf ) ;
index 2fcd0c7372f0385150971916bfadea80b07c68c0..c2834736b7b103b8b35b6b4bbca65225632c031d 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax classes.struct ;
+USING: alien.c-types alien.syntax classes.struct unix.types ;
 IN: unix.statvfs.freebsd
 
 STRUCT: statvfs
index 6e408c8fa45214ae891bd528104e10fbec6d5a93..d7139d84b283a2530dd577e5dc7d2f2c378d8bd5 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax classes.struct ;
+USING: alien.c-types alien.syntax classes.struct unix.types ;
 IN: unix.statvfs.linux
 
 STRUCT: statvfs64
index 25c96dc15d32c8898907ac27a4846e5bb08859bb..c72a1a0e8234243e9bd9fcc89fe7558f2b5983b6 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax classes.struct ;
+USING: alien.c-types alien.syntax classes.struct unix.types ;
 IN: unix.statvfs.netbsd
 
 CONSTANT: _VFS_NAMELEN    32
index f2d12c29cc89c52f685be003424bee1139966bca..d5b2ee30a811a3b9d0caa33255e5bfcfed9fa441 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax classes.struct ;
+USING: alien.c-types alien.syntax classes.struct unix.types ;
 IN: unix.statvfs.openbsd
 
 STRUCT: statvfs
index 6fdaeef8cf477cc8fc8ce68d66e6496718ea1378..7650e9962f64af74f762d0e4b6af93d02e777916 100644 (file)
@@ -37,11 +37,11 @@ TYPEDEF: fsfilcnt_t __fsfilcnt_t
 TYPEDEF: __uint64_t rlim_t
 TYPEDEF: uint32_t id_t
 
-TYPEDEF: void* DIR*
-TYPEDEF: void* FILE*
-TYPEDEF: void* rlimit*
-TYPEDEF: void* rusage*
-TYPEDEF: void* sockaddr*
+C-TYPE: DIR
+C-TYPE: FILE
+C-TYPE: rlimit
+C-TYPE: rusage
+C-TYPE: sockaddr
 
 os {
     { linux   [ "unix.types.linux"   require ] }
index fa61e9041a5260d28d9db673282478b1d71b009f..afe24905d69ba11c18cd227bf64b1d40ee46a90a 100644 (file)
@@ -62,6 +62,8 @@ MACRO:: unix-system-call ( quot -- )
         ]
     ] ;
 
+HOOK: open-file os ( path flags mode -- fd )
+
 <<
 
 {
@@ -155,8 +157,6 @@ FUNCTION: int shutdown ( int fd, int how ) ;
 
 FUNCTION: int open ( char* path, int flags, int prot ) ;
 
-HOOK: open-file os ( path flags mode -- fd )
-
 M: unix open-file [ open ] unix-system-call ;
 
 FUNCTION: DIR* opendir ( char* path ) ;
index 728cbb83d8743c9ba202a517c9c0eff4a26a6141..11d9dabb3d9a812abf9c55f10991c32ce5a2440a 100644 (file)
@@ -4,7 +4,7 @@ USING: classes.struct alien.c-types alien.syntax ;
 IN: vm
 
 TYPEDEF: void* cell
-TYPEDEF: void* context*
+C-TYPE: context
 
 STRUCT: zone
     { start cell }
index 45a74e225008d1a349542ad01ca45d66a2d029dc..9628b890fb2754e630ca083030c54cc073c3069d 100755 (executable)
@@ -10,7 +10,7 @@ COM-INTERFACE: IUnknown f {00000000-0000-0000-C000-000000000046}
     ULONG AddRef ( )
     ULONG Release ( ) ;
 
-TYPEDEF: void* IAdviseSink*
+C-TYPE: IAdviseSink
 
 COM-INTERFACE: IDataObject IUnknown {0000010E-0000-0000-C000-000000000046}
     HRESULT GetData ( FORMATETC* pFormatetc, STGMEDIUM* pmedium )
index f021b552899cfc5843894ba61329ee0002879080..57702d8780f53084f788dc636bb50e298fdf01de 100755 (executable)
@@ -58,7 +58,7 @@ STRUCT: SCRIPT_VISATTR
     { flags WORD } ;
 
 TYPEDEF: void* SCRIPT_CACHE*
-TYPEDEF: void* ABC*
+C-TYPE: ABC
 
 FUNCTION: HRESULT ScriptShape (
     HDC hdc,
index b50fadb5bac578bafe598ad3337d0cb36deefbac..7bd86c8e47e14fb65c4845306a159dba517ec602 100755 (executable)
@@ -105,7 +105,7 @@ CONSTANT: SD_BOTH 2
 
 CONSTANT: SOL_SOCKET HEX: ffff
 
-TYPEDEF: void* sockaddr*
+C-TYPE: sockaddr
 
 STRUCT: sockaddr-in
     { family short }
index 2b90b1bff276fb367b85bcddf45be4b69beaad00..a6097c9dadde2fab2fec0c4ae01eda8ae7500338 100644 (file)
@@ -31,12 +31,12 @@ TYPEDEF: XID KeySym
 TYPEDEF: ulong Atom
 
 TYPEDEF: char* XPointer
-TYPEDEF: void* Screen*
+C-TYPE: Screen
 TYPEDEF: void* GC
-TYPEDEF: void* Visual*
-TYPEDEF: void* XExtData*
-TYPEDEF: void* XFontProp*
-TYPEDEF: void* XComposeStatus*
+C-TYPE: Visual
+C-TYPE: XExtData
+C-TYPE: XFontProp
+C-TYPE: XComposeStatus
 TYPEDEF: void* XIM
 TYPEDEF: void* XIC
 
@@ -47,9 +47,6 @@ TYPEDEF: int Bool
 TYPEDEF: ulong VisualID
 TYPEDEF: ulong Time
 
-TYPEDEF: void* Window**
-TYPEDEF: void* Atom**
-
 ALIAS: <XID> <ulong>
 ALIAS: <Window> <XID>
 ALIAS: <Drawable> <XID>
index 4eb01e913c7bd787beab0510368b9d2529794423..9a5802e73e6b67c4104738f689263c27ac2e84e9 100644 (file)
@@ -10,8 +10,8 @@ IN: curses.ffi
     { [ os unix?  ]  [ "libcurses.so" ] }
 } cond "cdecl" add-library >>
 
-TYPEDEF: void* WINDOW*
-TYPEDEF: void* SCREEN*
+C-TYPE: WINDOW
+C-TYPE: SCREEN
 TYPEDEF: void* va_list
 
 TYPEDEF: uint chtype
index 6105381f86cec6618098b22c5c7349b3302cf02f..23dd62b3401133ff39b76756e522ad541b6852b9 100644 (file)
@@ -38,8 +38,8 @@ TYPEDEF: long FT_F26Dot6
 FUNCTION: FT_Error FT_Init_FreeType ( void* library ) ;
 
 ! circular reference between glyph and face
-TYPEDEF: void* face*
-TYPEDEF: void* glyph*
+C-TYPE: face
+C-TYPE: glyph
 
 STRUCT: glyph
     { library void* }
index a62745cb6aab473cb87b1f219634bbe2b9b7984b..6409a3781b97368fac4b1ad8c87840f66be0d28d 100644 (file)
@@ -17,10 +17,10 @@ os {
 LIBRARY: glu
  
 ! These are defined as structs in glu.h, but we only ever use pointers to them
-TYPEDEF: void* GLUnurbs*
-TYPEDEF: void* GLUquadric*
-TYPEDEF: void* GLUtesselator*
-TYPEDEF: void* GLubyte*
+C-TYPE: GLUnurbs
+C-TYPE: GLUquadric
+C-TYPE: GLUtesselator
+C-TYPE: GLubyte
 TYPEDEF: void* GLUfuncptr
 
 ! StringName
index b9503bdab4a74910dfd2bacc2a529953459885a0..fd0464fcec0ab00d12f007f13d5a0dca58949c31 100755 (executable)
@@ -6,8 +6,8 @@ IN: tokyo.alien.tchdb
 
 LIBRARY: tokyocabinet
 
-TYPEDEF: void* TCXSTR*
-TYPEDEF: void* TCHDB*
+C-TYPE: TCXSTR
+C-TYPE: TCHDB
 
 CONSTANT: HDBFOPEN  1
 CONSTANT: HDBFFATAL 2
index 0450e6522c5e963bb5b45ac48ed3a0e6f6d2e6f0..a6e59dbe032b8cd73324689455e0e1bfa6391751 100755 (executable)
@@ -13,7 +13,7 @@ IN: tokyo.alien.tcrdb
 
 LIBRARY: tokyotyrant
 
-TYPEDEF: void* TCRDB*
+C-TYPE: TCRDB
 ! STRUCT: TCRDB
 !     { mmtx pthread_mutex_t }
 !     { eckey pthread_key_t }
@@ -95,7 +95,7 @@ CONSTANT: RDBITOPT     TDBITOPT
 CONSTANT: RDBITVOID    TDBITVOID
 CONSTANT: RDBITKEEP    TDBITKEEP
 
-TYPEDEF: void* RDBQRY*
+C-TYPE: RDBQRY
 ! STRUCT: RDBQRY
 !     { rdb TCRDB* }
 !     { args TCLIST* } ;
index 8373a6aaaaf5be22e7aeb323cfc53dec5b5df369..9e8071d0dfc81a5d365a19e1eb849b0eaa8fb58a 100755 (executable)
@@ -6,9 +6,9 @@ IN: tokyo.alien.tctdb
 
 LIBRARY: tokyocabinet
 
-TYPEDEF: void* TDBIDX*
-TYPEDEF: void* TCTDB*
-TYPEDEF: void* TCMAP*
+C-TYPE: TDBIDX
+C-TYPE: TCTDB
+C-TYPE: TCMAP
 
 CONSTANT: TDBFOPEN  HDBFOPEN
 CONSTANT: TDBFFATAL HDBFFATAL
@@ -35,8 +35,8 @@ CONSTANT: TDBITOPT  9998
 CONSTANT: TDBITVOID 9999
 CONSTANT: TDBITKEEP 16777216
 
-TYPEDEF: void* TDBCOND*
-TYPEDEF: void* TDBQRY*
+C-TYPE: TDBCOND
+C-TYPE: TDBQRY
 
 C-ENUM:
     TDBQCSTREQ
index ac6e242be219a1db2d5c57f8e06d5b5d8032290f..7cb6c5e09218bf170491e1ba343a00491f445408 100755 (executable)
@@ -21,7 +21,7 @@ C-ENUM:
 ! FIXME: on windows 64bits this isn't correct, because long is 32bits there, and time_t is int64
 TYPEDEF: long tokyo_time_t
 
-TYPEDEF: void* TCLIST*
+C-TYPE: TCLIST
 
 FUNCTION: TCLIST* tclistnew ( ) ;
 FUNCTION: TCLIST* tclistnew2 ( int anum ) ;
index 138e142eae58e39a26a153d458df66a8ec5ccdd3..29755453490fdc1f2c36716230010ae516b90f6a 100644 (file)
@@ -123,8 +123,9 @@ syn cluster factorWordOps       contains=factorConstant,factorAlias,factorSingle
 " LIBRARY:
 "#\ "
 
-syn region factorString start=/"/ skip=/\\"/ end=/"/ oneline
-syn region factorSbuf start=/SBUF" / skip=/\\"/ end=/"/ oneline
+syn region factorString start=/\<"/ skip=/\\"/ end=/"/
+syn region factorTriString start=/\<"""/ skip=/\\"/ end=/"""/
+syn region factorSbuf start=/\<SBUF"\>/ skip=/\\"/ end=/"/
 
 syn region factorMultiString matchgroup=factorMultiStringDelims start=/\<STRING:\s\+\S\+\>/ end=/^;$/ contains=factorMultiStringContents
 syn match factorMultiStringContents /.*/ contained
@@ -201,6 +202,7 @@ if version >= 508 || !exists("did_factor_syn_inits")
     HiLink factorPGenericDelims         Special
     HiLink factorPGenericNDelims        Special
     HiLink factorString                 String
+    HiLink factorTriString              String
     HiLink factorSbuf                   String
     HiLink factorMultiStringContents    String
     HiLink factorMultiStringDelims      Typedef
index 267c7be312d6640e401a269758b3f183927f1614..06d47b8937542bf6c4da3facc7e3081b355b2ce7 100644 (file)
@@ -19,7 +19,7 @@ TYPEDEF: int SQLINTEGER
 TYPEDEF: char SQLCHAR
 TYPEDEF: char* SQLCHAR*
 TYPEDEF: void* SQLHANDLE
-TYPEDEF: void* SQLHANDLE*
+C-TYPE: SQLHANDLE
 TYPEDEF: void* SQLHENV
 TYPEDEF: void* SQLHDBC
 TYPEDEF: void* SQLHSTMT