From fb5b48c71aa0be7eea14a25ced25c7e4d32aed9d Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 4 May 2009 09:44:26 -0500 Subject: [PATCH] Fix some test failures --- basis/compiler/codegen/codegen.factor | 2 +- basis/ui/gadgets/glass/glass-tests.factor | 12 +- basis/ui/gadgets/worlds/worlds-tests.factor | 4 +- basis/ui/gadgets/worlds/worlds.factor | 3 +- basis/vocabs/files/files-tests.factor | 9 ++ basis/vocabs/hierarchy/hierarchy-tests.factor | 10 -- basis/vocabs/refresh/refresh-tests.factor | 9 ++ core/alien/strings/strings-tests.factor | 2 +- core/bootstrap/primitives.factor | 2 +- core/vocabs/loader/loader-tests.factor | 9 +- vm/ffi_test.h | 110 +++++++++--------- 11 files changed, 92 insertions(+), 80 deletions(-) create mode 100644 basis/vocabs/files/files-tests.factor create mode 100644 basis/vocabs/refresh/refresh-tests.factor diff --git a/basis/compiler/codegen/codegen.factor b/basis/compiler/codegen/codegen.factor index c19707a694..826fa87b73 100755 --- a/basis/compiler/codegen/codegen.factor +++ b/basis/compiler/codegen/codegen.factor @@ -3,7 +3,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.structs -alien.strings alien.arrays alien.complex sets libc alien.libraries +alien.strings alien.arrays alien.complex alien.libraries sets libc continuations.private fry cpu.architecture source-files.errors compiler.errors diff --git a/basis/ui/gadgets/glass/glass-tests.factor b/basis/ui/gadgets/glass/glass-tests.factor index d4e4306656..e95803d336 100644 --- a/basis/ui/gadgets/glass/glass-tests.factor +++ b/basis/ui/gadgets/glass/glass-tests.factor @@ -1,10 +1,14 @@ IN: ui.gadgets.glass.tests USING: tools.test ui.gadgets.glass ui.gadgets.worlds ui.gadgets -math.rectangles namespaces accessors models sequences ; +math.rectangles namespaces accessors models sequences arrays ; - "" f -{ 1000 1000 } >>dim -"w" set +[ ] [ + + 1array >>gadgets + + { 1000 1000 } >>dim + "w" set +] unit-test [ ] [ "g" set ] unit-test diff --git a/basis/ui/gadgets/worlds/worlds-tests.factor b/basis/ui/gadgets/worlds/worlds-tests.factor index f738a8cff4..515a0b3aa8 100644 --- a/basis/ui/gadgets/worlds/worlds-tests.factor +++ b/basis/ui/gadgets/worlds/worlds-tests.factor @@ -1,12 +1,12 @@ USING: ui.gadgets ui.gadgets.packs ui.gadgets.worlds tools.test -namespaces models kernel accessors ; +namespaces models kernel accessors arrays ; IN: ui.gadgets.worlds.tests ! Test focus behavior "g1" set : ( gadget -- world ) - "Hi" f ; + "Hi" >>title swap 1array >>gadgets ; [ ] [ "g1" get "w" set diff --git a/basis/ui/gadgets/worlds/worlds.factor b/basis/ui/gadgets/worlds/worlds.factor index 31b5a137a3..3568559eac 100755 --- a/basis/ui/gadgets/worlds/worlds.factor +++ b/basis/ui/gadgets/worlds/worlds.factor @@ -25,7 +25,8 @@ TUPLE: world-attributes gadgets { pixel-format-attributes initial: $ default-world-pixel-format-attributes } ; -C: world-attributes +: ( -- world-attributes ) + world-attributes new ; inline : find-world ( gadget -- world/f ) [ world? ] find-parent ; diff --git a/basis/vocabs/files/files-tests.factor b/basis/vocabs/files/files-tests.factor new file mode 100644 index 0000000000..d53b8c52af --- /dev/null +++ b/basis/vocabs/files/files-tests.factor @@ -0,0 +1,9 @@ +IN: vocabs.files.tests +USING: tools.test vocabs.files vocabs arrays sets ; + +[ t ] [ + "kernel" vocab-files + "kernel" vocab vocab-files + "kernel" vocab-files + 3array all-equal? +] unit-test \ No newline at end of file diff --git a/basis/vocabs/hierarchy/hierarchy-tests.factor b/basis/vocabs/hierarchy/hierarchy-tests.factor index acbae804d2..97fa59a342 100644 --- a/basis/vocabs/hierarchy/hierarchy-tests.factor +++ b/basis/vocabs/hierarchy/hierarchy-tests.factor @@ -1,12 +1,2 @@ IN: vocabs.hierarchy.tests USING: continuations namespaces tools.test vocabs.hierarchy vocabs.hierarchy.private ; - -[ ] [ - changed-vocabs get-global - f changed-vocabs set-global - [ t ] [ "kernel" changed-vocab? ] unit-test - [ "kernel" changed-vocab ] [ changed-vocabs set-global ] [ ] cleanup -] unit-test - -[ t ] [ "some-vocab" valid-vocab-dirname ] unit-test -[ f ] [ ".git" valid-vocab-dirname ] unit-test diff --git a/basis/vocabs/refresh/refresh-tests.factor b/basis/vocabs/refresh/refresh-tests.factor new file mode 100644 index 0000000000..fa9a66ae8e --- /dev/null +++ b/basis/vocabs/refresh/refresh-tests.factor @@ -0,0 +1,9 @@ +IN: vocabs.refresh.tests +USING: vocabs.refresh tools.test namespaces ; + +[ ] [ + changed-vocabs get-global + f changed-vocabs set-global + [ t ] [ "kernel" changed-vocab? ] unit-test + [ "kernel" changed-vocab ] [ changed-vocabs set-global ] [ ] cleanup +] unit-test diff --git a/core/alien/strings/strings-tests.factor b/core/alien/strings/strings-tests.factor index 263453ba1c..6a0a42253b 100644 --- a/core/alien/strings/strings-tests.factor +++ b/core/alien/strings/strings-tests.factor @@ -1,4 +1,4 @@ -USING: alien.strings tools.test kernel libc +USING: alien.strings alien.c-types tools.test kernel libc io.encodings.8-bit io.encodings.utf8 io.encodings.utf16 io.encodings.utf16n io.encodings.ascii alien io.encodings.string ; IN: alien.strings.tests diff --git a/core/bootstrap/primitives.factor b/core/bootstrap/primitives.factor index 75a6c3179a..e5a6bbe5fa 100644 --- a/core/bootstrap/primitives.factor +++ b/core/bootstrap/primitives.factor @@ -498,7 +498,7 @@ tuple { "set-innermost-frame-quot" "kernel.private" (( n callstack -- )) } { "call-clear" "kernel" (( quot -- )) } { "resize-byte-array" "byte-arrays" (( n byte-array -- newbyte-array )) } - { "dll-valid?" "alien" (( dll -- ? )) } + { "dll-valid?" "alien.libraries" (( dll -- ? )) } { "unimplemented" "kernel.private" (( -- * )) } { "gc-reset" "memory" (( -- )) } { "jit-compile" "quotations" (( quot -- )) } diff --git a/core/vocabs/loader/loader-tests.factor b/core/vocabs/loader/loader-tests.factor index 88a37cb450..09f28541e0 100644 --- a/core/vocabs/loader/loader-tests.factor +++ b/core/vocabs/loader/loader-tests.factor @@ -2,7 +2,7 @@ USING: vocabs.loader tools.test continuations vocabs math kernel arrays sequences namespaces io.streams.string parser source-files words assocs classes.tuple definitions debugger compiler.units accessors eval -combinators vocabs.parser grouping ; +combinators vocabs.parser grouping vocabs.files vocabs.refresh ; IN: vocabs.loader.tests ! This vocab should not exist, but just in case... @@ -18,13 +18,6 @@ IN: vocabs.loader.tests [ t ] [ "kernel" >vocab-link "kernel" vocab = ] unit-test -[ t ] [ - "kernel" vocab-files - "kernel" vocab vocab-files - "kernel" vocab-files - 3array all-equal? -] unit-test - IN: vocabs.loader.test.2 : hello ( -- ) ; diff --git a/vm/ffi_test.h b/vm/ffi_test.h index f16e52e091..835f9e942f 100755 --- a/vm/ffi_test.h +++ b/vm/ffi_test.h @@ -1,98 +1,104 @@ -#if defined(FACTOR_X86) +#if defined(i386) || defined(__i386) || defined(__i386__) || defined(WIN32) #define F_STDCALL __attribute__((stdcall)) #else #define F_STDCALL #endif -#define DLLEXPORT +#if defined(__APPLE__) + #define F_EXPORT __attribute__((visibility("default"))) +#elif defined(WINDOWS) + #define F_EXPORT __declspec(dllexport) +#else + #define F_EXPORT +#endif -DLLEXPORT void ffi_test_0(void); -DLLEXPORT int ffi_test_1(void); -DLLEXPORT int ffi_test_2(int x, int y); -DLLEXPORT int ffi_test_3(int x, int y, int z, int t); -DLLEXPORT float ffi_test_4(void); -DLLEXPORT double ffi_test_5(void); -DLLEXPORT double ffi_test_6(float x, float y); -DLLEXPORT double ffi_test_7(double x, double y); -DLLEXPORT double ffi_test_8(double x, float y, double z, float t, int w); -DLLEXPORT int ffi_test_9(int a, int b, int c, int d, int e, int f, int g); -DLLEXPORT int ffi_test_10(int a, int b, double c, int d, float e, int f, int g, int h); +F_EXPORT void ffi_test_0(void); +F_EXPORT int ffi_test_1(void); +F_EXPORT int ffi_test_2(int x, int y); +F_EXPORT int ffi_test_3(int x, int y, int z, int t); +F_EXPORT float ffi_test_4(void); +F_EXPORT double ffi_test_5(void); +F_EXPORT double ffi_test_6(float x, float y); +F_EXPORT double ffi_test_7(double x, double y); +F_EXPORT double ffi_test_8(double x, float y, double z, float t, int w); +F_EXPORT int ffi_test_9(int a, int b, int c, int d, int e, int f, int g); +F_EXPORT int ffi_test_10(int a, int b, double c, int d, float e, int f, int g, int h); struct foo { int x, y; }; -DLLEXPORT int ffi_test_11(int a, struct foo b, int c); +F_EXPORT int ffi_test_11(int a, struct foo b, int c); struct rect { float x, y, w, h; }; -DLLEXPORT int ffi_test_12(int a, int b, struct rect c, int d, int e, int f); -DLLEXPORT int ffi_test_13(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k); -DLLEXPORT struct foo ffi_test_14(int x, int y); -DLLEXPORT char *ffi_test_15(char *x, char *y); +F_EXPORT int ffi_test_12(int a, int b, struct rect c, int d, int e, int f); +F_EXPORT int ffi_test_13(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k); +F_EXPORT struct foo ffi_test_14(int x, int y); +F_EXPORT char *ffi_test_15(char *x, char *y); struct bar { long x, y, z; }; -DLLEXPORT struct bar ffi_test_16(long x, long y, long z); +F_EXPORT struct bar ffi_test_16(long x, long y, long z); struct tiny { int x; }; -DLLEXPORT struct tiny ffi_test_17(int x); -DLLEXPORT F_STDCALL int ffi_test_18(int x, int y, int z, int t); -DLLEXPORT F_STDCALL struct bar ffi_test_19(long x, long y, long z); -DLLEXPORT void ffi_test_20(double x1, double x2, double x3, +F_EXPORT struct tiny ffi_test_17(int x); +F_EXPORT F_STDCALL int ffi_test_18(int x, int y, int z, int t); +F_EXPORT F_STDCALL struct bar ffi_test_19(long x, long y, long z); +F_EXPORT void ffi_test_20(double x1, double x2, double x3, double y1, double y2, double y3, double z1, double z2, double z3); -DLLEXPORT long long ffi_test_21(long x, long y); -DLLEXPORT long ffi_test_22(long x, long long y, long long z); -DLLEXPORT float ffi_test_23(float x[3], float y[3]); +F_EXPORT long long ffi_test_21(long x, long y); +F_EXPORT long ffi_test_22(long x, long long y, long long z); +F_EXPORT float ffi_test_23(float x[3], float y[3]); struct test_struct_1 { char x; }; -DLLEXPORT struct test_struct_1 ffi_test_24(void); +F_EXPORT struct test_struct_1 ffi_test_24(void); struct test_struct_2 { char x, y; }; -DLLEXPORT struct test_struct_2 ffi_test_25(void); +F_EXPORT struct test_struct_2 ffi_test_25(void); struct test_struct_3 { char x, y, z; }; -DLLEXPORT struct test_struct_3 ffi_test_26(void); +F_EXPORT struct test_struct_3 ffi_test_26(void); struct test_struct_4 { char x, y, z, a; }; -DLLEXPORT struct test_struct_4 ffi_test_27(void); +F_EXPORT struct test_struct_4 ffi_test_27(void); struct test_struct_5 { char x, y, z, a, b; }; -DLLEXPORT struct test_struct_5 ffi_test_28(void); +F_EXPORT struct test_struct_5 ffi_test_28(void); struct test_struct_6 { char x, y, z, a, b, c; }; -DLLEXPORT struct test_struct_6 ffi_test_29(void); +F_EXPORT struct test_struct_6 ffi_test_29(void); struct test_struct_7 { char x, y, z, a, b, c, d; }; -DLLEXPORT struct test_struct_7 ffi_test_30(void); -DLLEXPORT int ffi_test_31(int x0, int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8, int x9, int x10, int x11, int x12, int x13, int x14, int x15, int x16, int x17, int x18, int x19, int x20, int x21, int x22, int x23, int x24, int x25, int x26, int x27, int x28, int x29, int x30, int x31, int x32, int x33, int x34, int x35, int x36, int x37, int x38, int x39, int x40, int x41); -DLLEXPORT float ffi_test_31_point_5(float x0, float x1, float x2, float x3, float x4, float x5, float x6, float x7, float x8, float x9, float x10, float x11, float x12, float x13, float x14, float x15, float x16, float x17, float x18, float x19, float x20, float x21, float x22, float x23, float x24, float x25, float x26, float x27, float x28, float x29, float x30, float x31, float x32, float x33, float x34, float x35, float x36, float x37, float x38, float x39, float x40, float x41); +F_EXPORT struct test_struct_7 ffi_test_30(void); +F_EXPORT int ffi_test_31(int x0, int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8, int x9, int x10, int x11, int x12, int x13, int x14, int x15, int x16, int x17, int x18, int x19, int x20, int x21, int x22, int x23, int x24, int x25, int x26, int x27, int x28, int x29, int x30, int x31, int x32, int x33, int x34, int x35, int x36, int x37, int x38, int x39, int x40, int x41); +F_EXPORT float ffi_test_31_point_5(float x0, float x1, float x2, float x3, float x4, float x5, float x6, float x7, float x8, float x9, float x10, float x11, float x12, float x13, float x14, float x15, float x16, float x17, float x18, float x19, float x20, float x21, float x22, float x23, float x24, float x25, float x26, float x27, float x28, float x29, float x30, float x31, float x32, float x33, float x34, float x35, float x36, float x37, float x38, float x39, float x40, float x41); struct test_struct_8 { double x; double y; }; -DLLEXPORT double ffi_test_32(struct test_struct_8 x, int y); +F_EXPORT double ffi_test_32(struct test_struct_8 x, int y); struct test_struct_9 { float x; float y; }; -DLLEXPORT double ffi_test_33(struct test_struct_9 x, int y); +F_EXPORT double ffi_test_33(struct test_struct_9 x, int y); struct test_struct_10 { float x; int y; }; -DLLEXPORT double ffi_test_34(struct test_struct_10 x, int y); +F_EXPORT double ffi_test_34(struct test_struct_10 x, int y); struct test_struct_11 { int x; int y; }; -DLLEXPORT double ffi_test_35(struct test_struct_11 x, int y); +F_EXPORT double ffi_test_35(struct test_struct_11 x, int y); struct test_struct_12 { int a; double x; }; -DLLEXPORT double ffi_test_36(struct test_struct_12 x); +F_EXPORT double ffi_test_36(struct test_struct_12 x); -DLLEXPORT void ffi_test_36_point_5(void); +F_EXPORT void ffi_test_36_point_5(void); -DLLEXPORT int ffi_test_37(int (*f)(int, int, int)); +F_EXPORT int ffi_test_37(int (*f)(int, int, int)); -DLLEXPORT unsigned long long ffi_test_38(unsigned long long x, unsigned long long y); +F_EXPORT unsigned long long ffi_test_38(unsigned long long x, unsigned long long y); struct test_struct_13 { float x1, x2, x3, x4, x5, x6; }; -DLLEXPORT int ffi_test_39(long a, long b, struct test_struct_13 s); +F_EXPORT int ffi_test_39(long a, long b, struct test_struct_13 s); struct test_struct_14 { double x1, x2; }; -DLLEXPORT struct test_struct_14 ffi_test_40(double x1, double x2); +F_EXPORT struct test_struct_14 ffi_test_40(double x1, double x2); -DLLEXPORT struct test_struct_12 ffi_test_41(int a, double x); +F_EXPORT struct test_struct_12 ffi_test_41(int a, double x); struct test_struct_15 { float x, y; }; -DLLEXPORT struct test_struct_15 ffi_test_42(float x, float y); +F_EXPORT struct test_struct_15 ffi_test_42(float x, float y); struct test_struct_16 { float x; int a; }; -DLLEXPORT struct test_struct_16 ffi_test_43(float x, int a); +F_EXPORT struct test_struct_16 ffi_test_43(float x, int a); -DLLEXPORT struct test_struct_14 ffi_test_44(); +F_EXPORT struct test_struct_14 ffi_test_44(); -DLLEXPORT _Complex float ffi_test_45(int x); +F_EXPORT _Complex float ffi_test_45(int x); -DLLEXPORT _Complex double ffi_test_46(int x); +F_EXPORT _Complex double ffi_test_46(int x); -DLLEXPORT _Complex float ffi_test_47(_Complex float x, _Complex double y); +F_EXPORT _Complex float ffi_test_47(_Complex float x, _Complex double y);