Merge branch 'master' of git://factorcode.org/git/factor
						commit
						8c5c973116
					
				| 
						 | 
				
			
			@ -8,10 +8,6 @@ sequences system libc alien.strings io.encodings.utf8 ;
 | 
			
		|||
 | 
			
		||||
[ { "blah" 123 } ] [ { "blah" xyz } expand-constants ] unit-test
 | 
			
		||||
 | 
			
		||||
: foo ( -- n ) &: fdafd [ 123 ] unless* ;
 | 
			
		||||
 | 
			
		||||
[ 123 ] [ foo ] unit-test
 | 
			
		||||
 | 
			
		||||
[ -1 ] [ -1 <char> *char ] unit-test
 | 
			
		||||
[ -1 ] [ -1 <short> *short ] unit-test
 | 
			
		||||
[ -1 ] [ -1 <int> *int ] unit-test
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,7 +4,7 @@ USING: accessors arrays alien alien.c-types alien.structs
 | 
			
		|||
alien.arrays alien.strings kernel math namespaces parser
 | 
			
		||||
sequences words quotations math.parser splitting grouping
 | 
			
		||||
effects assocs combinators lexer strings.parser alien.parser 
 | 
			
		||||
fry vocabs.parser ;
 | 
			
		||||
fry vocabs.parser words.constant ;
 | 
			
		||||
IN: alien.syntax
 | 
			
		||||
 | 
			
		||||
: DLL" lexer get skip-blank parse-string dlopen parsed ; parsing
 | 
			
		||||
| 
						 | 
				
			
			@ -31,10 +31,11 @@ IN: alien.syntax
 | 
			
		|||
 | 
			
		||||
: C-ENUM:
 | 
			
		||||
    ";" parse-tokens
 | 
			
		||||
    dup length
 | 
			
		||||
    [ [ create-in ] dip 1quotation define ] 2each ;
 | 
			
		||||
    [ [ create-in ] dip define-constant ] each-index ;
 | 
			
		||||
    parsing
 | 
			
		||||
 | 
			
		||||
: address-of ( name library -- value )
 | 
			
		||||
    load-library dlsym [ "No such symbol" throw ] unless* ;
 | 
			
		||||
 | 
			
		||||
: &:
 | 
			
		||||
    scan "c-library" get
 | 
			
		||||
    '[ _ _ load-library dlsym ] over push-all ; parsing
 | 
			
		||||
    scan "c-library" get '[ _ _ address-of ] over push-all ; parsing
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,10 +32,8 @@ IN: heaps.tests
 | 
			
		|||
 | 
			
		||||
: random-alist ( n -- alist )
 | 
			
		||||
    [
 | 
			
		||||
        [
 | 
			
		||||
            32 random-bits dup number>string swap set
 | 
			
		||||
        ] times
 | 
			
		||||
    ] H{ } make-assoc ;
 | 
			
		||||
        drop 32 random-bits dup number>string
 | 
			
		||||
    ] H{ } map>assoc ;
 | 
			
		||||
 | 
			
		||||
: test-heap-sort ( n -- ? )
 | 
			
		||||
    random-alist dup >alist sort-keys swap heap-sort = ;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,9 +1,9 @@
 | 
			
		|||
! Copyright (C) 2005, 2008 Slava Pestov.
 | 
			
		||||
! Copyright (C) 2005, 2009 Slava Pestov.
 | 
			
		||||
! See http://factorcode.org/license.txt for BSD license.
 | 
			
		||||
USING: arrays byte-arrays kernel kernel.private math namespaces
 | 
			
		||||
make sequences strings words effects generic generic.standard
 | 
			
		||||
classes classes.algebra slots.private combinators accessors
 | 
			
		||||
words sequences.private assocs alien quotations ;
 | 
			
		||||
words sequences.private assocs alien quotations hashtables ;
 | 
			
		||||
IN: slots
 | 
			
		||||
 | 
			
		||||
TUPLE: slot-spec name offset class initial read-only ;
 | 
			
		||||
| 
						 | 
				
			
			@ -86,7 +86,7 @@ ERROR: bad-slot-value value class ;
 | 
			
		|||
    ] [ ] make ;
 | 
			
		||||
 | 
			
		||||
: writer-props ( slot-spec -- assoc )
 | 
			
		||||
    [ "writing" set ] H{ } make-assoc ;
 | 
			
		||||
    "writing" associate ;
 | 
			
		||||
 | 
			
		||||
: define-writer ( class slot-spec -- )
 | 
			
		||||
    [ name>> writer-word ] [ writer-quot ] [ writer-props ] tri
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue