diff --git a/basis/alien/structs/authors.txt b/basis/alien/structs/authors.txt deleted file mode 100644 index 1901f27a24..0000000000 --- a/basis/alien/structs/authors.txt +++ /dev/null @@ -1 +0,0 @@ -Slava Pestov diff --git a/basis/alien/structs/fields/fields.factor b/basis/alien/structs/fields/fields.factor deleted file mode 100644 index 1fa2fe0b0c..0000000000 --- a/basis/alien/structs/fields/fields.factor +++ /dev/null @@ -1,45 +0,0 @@ -! Copyright (C) 2005, 2009 Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -USING: accessors arrays kernel kernel.private math namespaces -make sequences strings words effects combinators alien.c-types ; -IN: alien.structs.fields - -TUPLE: field-spec name offset type reader writer ; - -: reader-word ( class name vocab -- word ) - [ "-" glue ] dip create dup make-deprecated ; - -: writer-word ( class name vocab -- word ) - [ [ swap "set-" % % "-" % % ] "" make ] dip create dup make-deprecated ; - -: ( struct-name vocab type field-name -- spec ) - field-spec new - 0 >>offset - swap >>name - swap >>type - 3dup name>> swap reader-word >>reader - 3dup name>> swap writer-word >>writer - 2nip ; - -: align-offset ( offset type -- offset ) - c-type-align align ; - -: struct-offsets ( specs -- size ) - 0 [ - [ type>> align-offset ] keep - [ (>>offset) ] [ type>> heap-size + ] 2bi - ] reduce ; - -: define-struct-slot-word ( word quot spec effect -- ) - [ offset>> prefix ] dip define-inline ; - -: define-getter ( spec -- ) - [ reader>> ] [ type>> c-type-getter-boxer ] [ ] tri - (( c-ptr -- value )) define-struct-slot-word ; - -: define-setter ( spec -- ) - [ writer>> ] [ type>> c-setter ] [ ] tri - (( value c-ptr -- )) define-struct-slot-word ; - -: define-field ( spec -- ) - [ define-getter ] [ define-setter ] bi ; diff --git a/basis/alien/structs/fields/summary.txt b/basis/alien/structs/fields/summary.txt deleted file mode 100644 index d9370ca575..0000000000 --- a/basis/alien/structs/fields/summary.txt +++ /dev/null @@ -1 +0,0 @@ -Struct field implementation and reflection support diff --git a/basis/alien/structs/structs-docs.factor b/basis/alien/structs/structs-docs.factor deleted file mode 100644 index d0485ae4ba..0000000000 --- a/basis/alien/structs/structs-docs.factor +++ /dev/null @@ -1,33 +0,0 @@ -USING: alien.c-types alien.data strings help.markup help.syntax alien.syntax -sequences io arrays kernel words assocs namespaces ; -IN: alien.structs - -ARTICLE: "c-structs" "C structure types" -"A " { $snippet "struct" } " in C is essentially a block of memory with the value of each structure field stored at a fixed offset from the start of the block. The C library interface provides some utilities to define words which read and write structure fields given a base address." -{ $subsection POSTPONE: C-STRUCT: } -"Great care must be taken when working with C structures since no type or bounds checking is possible." -$nl -"An example:" -{ $code - "C-STRUCT: XVisualInfo" - " { \"Visual*\" \"visual\" }" - " { \"VisualID\" \"visualid\" }" - " { \"int\" \"screen\" }" - " { \"uint\" \"depth\" }" - " { \"int\" \"class\" }" - " { \"ulong\" \"red_mask\" }" - " { \"ulong\" \"green_mask\" }" - " { \"ulong\" \"blue_mask\" }" - " { \"int\" \"colormap_size\" }" - " { \"int\" \"bits_per_rgb\" } ;" -} -"C structure objects can be allocated by calling " { $link } " or " { $link malloc-object } "." -$nl -"Arrays of C structures can be created with the " { $vocab-link "specialized-arrays" } " vocabulary." ; - -ARTICLE: "c-unions" "C unions" -"A " { $snippet "union" } " in C defines a type large enough to hold its largest member. This is usually used to allocate a block of memory which can hold one of several types of values." -{ $subsection POSTPONE: C-UNION: } -"C union objects can be allocated by calling " { $link } " or " { $link malloc-object } "." -$nl -"Arrays of C unions can be created with the " { $vocab-link "specialized-arrays" } " vocabulary." ; diff --git a/basis/alien/structs/structs-tests.factor b/basis/alien/structs/structs-tests.factor deleted file mode 100755 index d22aa5ee45..0000000000 --- a/basis/alien/structs/structs-tests.factor +++ /dev/null @@ -1,59 +0,0 @@ -USING: alien alien.syntax alien.c-types alien.data kernel tools.test -sequences system libc words vocabs namespaces layouts ; -IN: alien.structs.tests - -C-STRUCT: bar - { "int" "x" } - { { "int" 8 } "y" } ; - -[ 36 ] [ "bar" heap-size ] unit-test -[ t ] [ \ "bar" c-type-getter memq? ] unit-test - -C-STRUCT: align-test - { "int" "x" } - { "double" "y" } ; - -os winnt? cpu x86? and [ - [ 16 ] [ "align-test" heap-size ] unit-test - - cell 4 = [ - C-STRUCT: one - { "long" "a" } { "double" "b" } { "int" "c" } ; - - [ 24 ] [ "one" heap-size ] unit-test - ] when -] when - -CONSTANT: MAX_FOOS 30 - -C-STRUCT: foox - { { "int" MAX_FOOS } "x" } ; - -[ 120 ] [ "foox" heap-size ] unit-test - -C-UNION: barx - { "int" MAX_FOOS } - "float" ; - -[ 120 ] [ "barx" heap-size ] unit-test - -"help" vocab [ - "print-topic" "help" lookup "help" set - [ ] [ \ foox-x "help" get execute ] unit-test - [ ] [ \ set-foox-x "help" get execute ] unit-test -] when - -C-STRUCT: nested - { "int" "x" } ; - -C-STRUCT: nested-2 - { "nested" "y" } ; - -[ 4 ] [ - "nested-2" - "nested" - 4 over set-nested-x - over set-nested-2-y - nested-2-y - nested-x -] unit-test diff --git a/basis/alien/structs/structs.factor b/basis/alien/structs/structs.factor deleted file mode 100755 index 9478f98c63..0000000000 --- a/basis/alien/structs/structs.factor +++ /dev/null @@ -1,71 +0,0 @@ -! Copyright (C) 2004, 2009 Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -USING: accessors arrays assocs generic hashtables kernel kernel.private -math namespaces parser sequences strings words libc fry -alien.c-types alien.structs.fields cpu.architecture math.order -quotations byte-arrays ; -IN: alien.structs - -TUPLE: struct-type < abstract-c-type fields return-in-registers? ; - -INSTANCE: struct-type value-type - -M: struct-type c-type ; - -M: struct-type c-type-stack-align? drop f ; - -: if-value-struct ( ctype true false -- ) - [ dup value-struct? ] 2dip '[ drop void* @ ] if ; inline - -M: struct-type unbox-parameter - [ %unbox-large-struct ] [ unbox-parameter ] if-value-struct ; - -M: struct-type box-parameter - [ %box-large-struct ] [ box-parameter ] if-value-struct ; - -: if-small-struct ( c-type true false -- ? ) - [ dup return-struct-in-registers? ] 2dip '[ f swap @ ] if ; inline - -M: struct-type unbox-return - [ %unbox-small-struct ] [ %unbox-large-struct ] if-small-struct ; - -M: struct-type box-return - [ %box-small-struct ] [ %box-large-struct ] if-small-struct ; - -M: struct-type stack-size - [ heap-size ] [ stack-size ] if-value-struct ; - -M: struct-type c-struct? drop t ; - -: (define-struct) ( name size align fields class -- ) - [ [ align ] keep ] 2dip new - byte-array >>class - byte-array >>boxed-class - swap >>fields - swap >>align - swap >>size - swap typedef ; - -: make-fields ( name vocab fields -- fields ) - [ first2 ] with with map ; - -: compute-struct-align ( types -- n ) - [ c-type-align ] [ max ] map-reduce ; - -: define-struct ( name vocab fields -- ) - [ 2drop ] [ make-fields ] 3bi - [ struct-offsets ] keep - [ [ type>> ] map compute-struct-align ] keep - [ struct-type (define-struct) ] keep - [ define-field ] each ; deprecated - -: define-union ( name members -- ) - [ [ heap-size ] [ max ] map-reduce ] keep - compute-struct-align f struct-type (define-struct) ; deprecated - -: offset-of ( field struct -- offset ) - c-types get at fields>> - [ name>> = ] with find nip offset>> ; - -USE: vocabs.loader -"specialized-arrays" require diff --git a/basis/alien/structs/summary.txt b/basis/alien/structs/summary.txt deleted file mode 100644 index 4825c5b781..0000000000 --- a/basis/alien/structs/summary.txt +++ /dev/null @@ -1 +0,0 @@ -C structure support diff --git a/basis/alien/syntax/syntax-docs.factor b/basis/alien/syntax/syntax-docs.factor index 93a74c3b0a..f43769761c 100644 --- a/basis/alien/syntax/syntax-docs.factor +++ b/basis/alien/syntax/syntax-docs.factor @@ -1,6 +1,5 @@ IN: alien.syntax -USING: alien alien.c-types alien.parser alien.structs -classes.struct help.markup help.syntax ; +USING: alien alien.c-types alien.parser classes.struct help.markup help.syntax ; HELP: DLL" { $syntax "DLL\" path\"" } @@ -54,21 +53,6 @@ HELP: TYPEDEF: { $description "Aliases the C type " { $snippet "old" } " under the name " { $snippet "new" } " if ." } { $notes "This word differs from " { $link typedef } " in that it runs at parse time, to ensure correct ordering of operations when loading source files. Words defined in source files are compiled before top-level forms are run, so if a source file defines C binding words and uses " { $link typedef } ", the type alias won't be available at compile time." } ; -HELP: C-STRUCT: -{ $deprecated "New code should use " { $link "classes.struct" } ". See the " { $link POSTPONE: STRUCT: } " word." } -{ $syntax "C-STRUCT: name pairs... ;" } -{ $values { "name" "a new C type name" } { "pairs" "C type / field name string pairs" } } -{ $description "Defines a C struct layout and accessor words." } -{ $notes "C type names are documented in " { $link "c-types-specs" } "." } ; - -HELP: C-UNION: -{ $deprecated "New code should use " { $link "classes.struct" } ". See the " { $link POSTPONE: UNION-STRUCT: } " word." } -{ $syntax "C-UNION: name members... ;" } -{ $values { "name" "a new C type name" } { "members" "a sequence of C types" } } -{ $description "Defines a new C type sized to fit its largest member." } -{ $notes "C type names are documented in " { $link "c-types-specs" } "." } -{ $examples { $code "C-UNION: event \"active-event\" \"keyboard-event\" \"mouse-event\" ;" } } ; - HELP: C-ENUM: { $syntax "C-ENUM: words... ;" } { $values { "words" "a sequence of word names" } } @@ -131,7 +115,7 @@ HELP: typedef HELP: c-struct? { $values { "type" "a string" } { "?" "a boolean" } } -{ $description "Tests if a C type is a structure defined by " { $link POSTPONE: C-STRUCT: } "." } ; +{ $description "Tests if a C type is a structure defined by " { $link POSTPONE: STRUCT: } "." } ; HELP: define-function { $values { "return" "a C return type" } { "library" "a logical library name" } { "function" "a C function name" } { "parameters" "a sequence of C parameter types" } } diff --git a/basis/alien/syntax/syntax.factor b/basis/alien/syntax/syntax.factor index 611133bacb..85b763ba51 100644 --- a/basis/alien/syntax/syntax.factor +++ b/basis/alien/syntax/syntax.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2005, 2009 Slava Pestov, Alex Chapman. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors arrays alien alien.c-types alien.structs +USING: accessors arrays alien alien.c-types alien.arrays alien.strings kernel math namespaces parser sequences words quotations math.parser splitting grouping effects assocs combinators lexer strings.parser alien.parser @@ -27,12 +27,6 @@ SYNTAX: STDCALL-CALLBACK: SYNTAX: TYPEDEF: scan-c-type CREATE-C-TYPE typedef ; -SYNTAX: C-STRUCT: - scan current-vocab parse-definition define-struct ; deprecated - -SYNTAX: C-UNION: - scan parse-definition define-union ; deprecated - SYNTAX: C-ENUM: ";" parse-tokens [ [ create-in ] dip define-constant ] each-index ; diff --git a/basis/compiler/codegen/codegen.factor b/basis/compiler/codegen/codegen.factor index 150e65db3f..5c4a858de3 100755 --- a/basis/compiler/codegen/codegen.factor +++ b/basis/compiler/codegen/codegen.factor @@ -4,7 +4,7 @@ USING: namespaces make math math.order math.parser sequences accessors kernel kernel.private layouts assocs words summary arrays combinators classes.algebra alien alien.c-types alien.strings alien.arrays alien.complex alien.libraries sets libc -continuations.private fry cpu.architecture classes locals +continuations.private fry cpu.architecture classes classes.struct locals source-files.errors slots parser generic.parser compiler.errors compiler.alien @@ -16,8 +16,6 @@ compiler.cfg.registers compiler.cfg.builder compiler.codegen.fixup compiler.utilities ; -QUALIFIED: classes.struct -QUALIFIED: alien.structs IN: compiler.codegen SYMBOL: insn-counts @@ -331,10 +329,7 @@ GENERIC: flatten-value-type ( type -- types ) M: object flatten-value-type 1array ; -M: alien.structs:struct-type flatten-value-type ( type -- types ) - stack-size cell align (flatten-int-type) ; - -M: classes.struct:struct-c-type flatten-value-type ( type -- types ) +M: struct-c-type flatten-value-type ( type -- types ) stack-size cell align (flatten-int-type) ; M: long-long-type flatten-value-type ( type -- types ) diff --git a/basis/cpu/x86/64/unix/unix.factor b/basis/cpu/x86/64/unix/unix.factor index 13e91a87a4..b3d184bc97 100644 --- a/basis/cpu/x86/64/unix/unix.factor +++ b/basis/cpu/x86/64/unix/unix.factor @@ -1,11 +1,9 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays sequences math splitting make assocs kernel -layouts system alien.c-types cpu.architecture +layouts system alien.c-types classes.struct cpu.architecture cpu.x86.assembler cpu.x86.assembler.operands cpu.x86 compiler.codegen compiler.cfg.registers ; -QUALIFIED: alien.structs -QUALIFIED: classes.struct IN: cpu.x86.64.unix M: int-regs param-regs @@ -48,9 +46,7 @@ stack-params \ (stack-value) c-type (>>rep) >> flatten-small-struct ] if ; -M: alien.structs:struct-type flatten-value-type ( type -- seq ) - flatten-struct ; -M: classes.struct:struct-c-type flatten-value-type ( type -- seq ) +M: struct-c-type flatten-value-type ( type -- seq ) flatten-struct ; M: x86.64 return-struct-in-registers? ( c-type -- ? ) diff --git a/extra/alien/cxx/authors.txt b/unmaintained/alien/cxx/authors.txt similarity index 100% rename from extra/alien/cxx/authors.txt rename to unmaintained/alien/cxx/authors.txt diff --git a/extra/alien/cxx/cxx.factor b/unmaintained/alien/cxx/cxx.factor similarity index 100% rename from extra/alien/cxx/cxx.factor rename to unmaintained/alien/cxx/cxx.factor diff --git a/extra/alien/cxx/parser/authors.txt b/unmaintained/alien/cxx/parser/authors.txt similarity index 100% rename from extra/alien/cxx/parser/authors.txt rename to unmaintained/alien/cxx/parser/authors.txt diff --git a/extra/alien/cxx/parser/parser.factor b/unmaintained/alien/cxx/parser/parser.factor similarity index 100% rename from extra/alien/cxx/parser/parser.factor rename to unmaintained/alien/cxx/parser/parser.factor diff --git a/extra/alien/cxx/syntax/authors.txt b/unmaintained/alien/cxx/syntax/authors.txt similarity index 100% rename from extra/alien/cxx/syntax/authors.txt rename to unmaintained/alien/cxx/syntax/authors.txt diff --git a/extra/alien/cxx/syntax/syntax-tests.factor b/unmaintained/alien/cxx/syntax/syntax-tests.factor similarity index 100% rename from extra/alien/cxx/syntax/syntax-tests.factor rename to unmaintained/alien/cxx/syntax/syntax-tests.factor diff --git a/extra/alien/cxx/syntax/syntax.factor b/unmaintained/alien/cxx/syntax/syntax.factor similarity index 100% rename from extra/alien/cxx/syntax/syntax.factor rename to unmaintained/alien/cxx/syntax/syntax.factor diff --git a/extra/alien/inline/authors.txt b/unmaintained/alien/inline/authors.txt similarity index 100% rename from extra/alien/inline/authors.txt rename to unmaintained/alien/inline/authors.txt diff --git a/extra/alien/inline/compiler/authors.txt b/unmaintained/alien/inline/compiler/authors.txt similarity index 100% rename from extra/alien/inline/compiler/authors.txt rename to unmaintained/alien/inline/compiler/authors.txt diff --git a/extra/alien/inline/compiler/compiler-docs.factor b/unmaintained/alien/inline/compiler/compiler-docs.factor similarity index 100% rename from extra/alien/inline/compiler/compiler-docs.factor rename to unmaintained/alien/inline/compiler/compiler-docs.factor diff --git a/extra/alien/inline/compiler/compiler.factor b/unmaintained/alien/inline/compiler/compiler.factor similarity index 100% rename from extra/alien/inline/compiler/compiler.factor rename to unmaintained/alien/inline/compiler/compiler.factor diff --git a/extra/alien/inline/inline-docs.factor b/unmaintained/alien/inline/inline-docs.factor similarity index 100% rename from extra/alien/inline/inline-docs.factor rename to unmaintained/alien/inline/inline-docs.factor diff --git a/extra/alien/inline/inline.factor b/unmaintained/alien/inline/inline.factor similarity index 100% rename from extra/alien/inline/inline.factor rename to unmaintained/alien/inline/inline.factor diff --git a/extra/alien/inline/syntax/authors.txt b/unmaintained/alien/inline/syntax/authors.txt similarity index 100% rename from extra/alien/inline/syntax/authors.txt rename to unmaintained/alien/inline/syntax/authors.txt diff --git a/extra/alien/inline/syntax/syntax-docs.factor b/unmaintained/alien/inline/syntax/syntax-docs.factor similarity index 100% rename from extra/alien/inline/syntax/syntax-docs.factor rename to unmaintained/alien/inline/syntax/syntax-docs.factor diff --git a/extra/alien/inline/syntax/syntax-tests.factor b/unmaintained/alien/inline/syntax/syntax-tests.factor similarity index 100% rename from extra/alien/inline/syntax/syntax-tests.factor rename to unmaintained/alien/inline/syntax/syntax-tests.factor diff --git a/extra/alien/inline/syntax/syntax.factor b/unmaintained/alien/inline/syntax/syntax.factor similarity index 100% rename from extra/alien/inline/syntax/syntax.factor rename to unmaintained/alien/inline/syntax/syntax.factor diff --git a/extra/alien/inline/types/authors.txt b/unmaintained/alien/inline/types/authors.txt similarity index 100% rename from extra/alien/inline/types/authors.txt rename to unmaintained/alien/inline/types/authors.txt diff --git a/extra/alien/inline/types/types.factor b/unmaintained/alien/inline/types/types.factor similarity index 100% rename from extra/alien/inline/types/types.factor rename to unmaintained/alien/inline/types/types.factor diff --git a/extra/alien/marshall/authors.txt b/unmaintained/alien/marshall/authors.txt similarity index 100% rename from extra/alien/marshall/authors.txt rename to unmaintained/alien/marshall/authors.txt diff --git a/extra/alien/marshall/marshall-docs.factor b/unmaintained/alien/marshall/marshall-docs.factor similarity index 100% rename from extra/alien/marshall/marshall-docs.factor rename to unmaintained/alien/marshall/marshall-docs.factor diff --git a/extra/alien/marshall/marshall.factor b/unmaintained/alien/marshall/marshall.factor similarity index 100% rename from extra/alien/marshall/marshall.factor rename to unmaintained/alien/marshall/marshall.factor diff --git a/extra/alien/marshall/private/authors.txt b/unmaintained/alien/marshall/private/authors.txt similarity index 100% rename from extra/alien/marshall/private/authors.txt rename to unmaintained/alien/marshall/private/authors.txt diff --git a/extra/alien/marshall/private/private.factor b/unmaintained/alien/marshall/private/private.factor similarity index 100% rename from extra/alien/marshall/private/private.factor rename to unmaintained/alien/marshall/private/private.factor diff --git a/extra/alien/marshall/structs/authors.txt b/unmaintained/alien/marshall/structs/authors.txt similarity index 100% rename from extra/alien/marshall/structs/authors.txt rename to unmaintained/alien/marshall/structs/authors.txt diff --git a/extra/alien/marshall/structs/structs-docs.factor b/unmaintained/alien/marshall/structs/structs-docs.factor similarity index 100% rename from extra/alien/marshall/structs/structs-docs.factor rename to unmaintained/alien/marshall/structs/structs-docs.factor diff --git a/extra/alien/marshall/structs/structs.factor b/unmaintained/alien/marshall/structs/structs.factor similarity index 100% rename from extra/alien/marshall/structs/structs.factor rename to unmaintained/alien/marshall/structs/structs.factor diff --git a/extra/alien/marshall/syntax/authors.txt b/unmaintained/alien/marshall/syntax/authors.txt similarity index 100% rename from extra/alien/marshall/syntax/authors.txt rename to unmaintained/alien/marshall/syntax/authors.txt diff --git a/extra/alien/marshall/syntax/syntax-docs.factor b/unmaintained/alien/marshall/syntax/syntax-docs.factor similarity index 100% rename from extra/alien/marshall/syntax/syntax-docs.factor rename to unmaintained/alien/marshall/syntax/syntax-docs.factor diff --git a/extra/alien/marshall/syntax/syntax-tests.factor b/unmaintained/alien/marshall/syntax/syntax-tests.factor similarity index 100% rename from extra/alien/marshall/syntax/syntax-tests.factor rename to unmaintained/alien/marshall/syntax/syntax-tests.factor diff --git a/extra/alien/marshall/syntax/syntax.factor b/unmaintained/alien/marshall/syntax/syntax.factor similarity index 100% rename from extra/alien/marshall/syntax/syntax.factor rename to unmaintained/alien/marshall/syntax/syntax.factor