836 !CompilerTests2 methodsFor:'tests - FFI'! |
846 !CompilerTests2 methodsFor:'tests - FFI'! |
837 |
847 |
838 test_external_function_call_01a |
848 test_external_function_call_01a |
839 "Test for stx bug for <cdecl> specs like |
849 "Test for stx bug for <cdecl> specs like |
840 |
850 |
841 <cdecl: Cairo::FontFace 'cairo_get_font_face' ( Cairo::GraphicsContext ) > |
851 <cdecl: Cairo::FontFace 'cairo_get_font_face' ( Cairo::GraphicsContext ) > |
842 |
852 |
843 i.e., when custom subclass of ExternalAddress is in namespace." |
853 i.e., when custom subclass of ExternalAddress is in namespace." |
844 |
854 |
845 | malloc free | |
855 | malloc free | |
846 |
856 |
847 malloc := 'malloc: size |
857 malloc := 'malloc: size |
848 |
|
849 <cdecl: const RegressionTests::CompilerTests2ExternalBytes "malloc" ( int ) module: ''librun.so''> |
858 <cdecl: const RegressionTests::CompilerTests2ExternalBytes "malloc" ( int ) module: ''librun.so''> |
850 self primitive failed'. |
859 self primitiveFailed'. |
|
860 |
851 free := 'free: ptr |
861 free := 'free: ptr |
852 |
|
853 <cdecl: const void "free" ( RegressionTests::CompilerTests2ExternalBytes ) module: ''librun.so''> |
862 <cdecl: const void "free" ( RegressionTests::CompilerTests2ExternalBytes ) module: ''librun.so''> |
854 self primitive failed'. |
863 self primitiveFailed'. |
|
864 |
855 #( #bc #stc ) do:[:mode | |
865 #( #bc #stc ) do:[:mode | |
856 | ptr | |
866 | ptr | |
857 |
867 |
858 self compile:malloc mode:mode. |
868 self compile:malloc mode:mode. |
859 self compile:free mode:mode. |
869 self compile:free mode:mode. |
860 ptr := self perform:(mode , '_malloc:') asSymbol with:1. |
870 ptr := self perform:(mode , '_malloc:') asSymbol with:1. |
861 self assert:ptr class == RegressionTests::CompilerTests2ExternalBytes. |
871 self assert:ptr class == RegressionTests::CompilerTests2ExternalBytes. |
862 self perform:(mode , '_free:') asSymbol with:ptr. |
872 self perform:(mode , '_free:') asSymbol with:ptr. |
863 ] |
873 ] |
864 |
874 |
865 "Created: / 06-01-2014 / 11:29:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
875 "Created: / 06-01-2014 / 11:29:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
866 "Modified: / 20-09-2014 / 21:51:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
876 "Modified: / 20-09-2014 / 21:51:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
877 "Modified: / 11-05-2018 / 13:45:11 / stefan" |
867 ! |
878 ! |
868 |
879 |
869 test_external_function_call_01b |
880 test_external_function_call_01b |
870 "Test for stx bug for <cdecl> specs like |
881 "Test for stx bug for <cdecl> specs like |
871 |
882 |
872 <cdecl: Cairo::FontFace 'cairo_get_font_face' ( Cairo::GraphicsContext ) > |
883 <cdecl: Cairo::FontFace 'cairo_get_font_face' ( Cairo::GraphicsContext ) > |
873 |
884 |
874 i.e., when custom subclass of ExternalAddress is in namespace." |
885 i.e., when custom subclass of ExternalAddress is in namespace." |
875 |
886 |
876 | malloc free | |
887 | malloc free | |
877 |
888 |
878 malloc := 'malloc: size |
889 malloc := 'malloc: size |
879 |
|
880 <cdecl: const RegressionTests::CompilerTests2ExternalBytes "malloc" ( int ) module: ''librun''> |
890 <cdecl: const RegressionTests::CompilerTests2ExternalBytes "malloc" ( int ) module: ''librun''> |
881 self primitive failed'. |
891 self primitive failed'. |
|
892 |
882 free := 'free: ptr |
893 free := 'free: ptr |
883 |
|
884 <cdecl: const void "free" ( RegressionTests::CompilerTests2ExternalBytes ) module: ''librun''> |
894 <cdecl: const void "free" ( RegressionTests::CompilerTests2ExternalBytes ) module: ''librun''> |
885 self primitive failed'. |
895 self primitive failed'. |
886 #( #bc #stc ) do:[:mode | |
896 #( #bc #stc ) do:[:mode | |
887 | ptr | |
897 | ptr | |
888 |
898 |
889 self compile:malloc mode:mode. |
899 self compile:malloc mode:mode. |
890 self compile:free mode:mode. |
900 self compile:free mode:mode. |
891 ptr := self perform:(mode , '_malloc:') asSymbol with:1. |
901 ptr := self perform:(mode , '_malloc:') asSymbol with:1. |
892 self assert:ptr class == RegressionTests::CompilerTests2ExternalBytes. |
902 self assert:ptr class == RegressionTests::CompilerTests2ExternalBytes. |
893 self perform:(mode , '_free:') asSymbol with:ptr. |
903 self perform:(mode , '_free:') asSymbol with:ptr. |
894 ] |
904 ] |
895 |
905 |
896 "Created: / 06-01-2014 / 11:29:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
906 "Created: / 06-01-2014 / 11:29:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
897 "Modified: / 20-09-2014 / 21:51:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
907 "Modified: / 20-09-2014 / 21:51:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
908 "Modified: / 11-05-2018 / 13:44:09 / stefan" |
898 ! |
909 ! |
899 |
910 |
900 test_external_function_call_01c |
911 test_external_function_call_01c |
901 "Test for stx bug for <cdecl> specs like |
912 "Test for stx bug for <cdecl> specs like |
902 |
913 |
903 <cdecl: Cairo::FontFace 'cairo_get_font_face' ( Cairo::GraphicsContext ) > |
914 <cdecl: Cairo::FontFace 'cairo_get_font_face' ( Cairo::GraphicsContext ) > |
904 |
915 |
905 i.e., when custom subclass of ExternalAddress is in namespace." |
916 i.e., when custom subclass of ExternalAddress is in namespace." |
906 |
917 |
907 | malloc free | |
918 | malloc free | |
908 |
919 |
909 malloc := 'malloc: size |
920 malloc := 'malloc: size |
910 |
|
911 <cdecl: const RegressionTests::CompilerTests2ExternalBytes "malloc" ( int )> |
921 <cdecl: const RegressionTests::CompilerTests2ExternalBytes "malloc" ( int )> |
912 self primitive failed'. |
922 self primitiveFailed'. |
|
923 |
913 free := 'free: ptr |
924 free := 'free: ptr |
914 |
925 <cdecl: const void "free" ( RegressionTests::CompilerTests2ExternalBytes)> |
915 <cdecl: const void "free" ( RegressionTests::CompilerTests2ExternalBytes )> |
926 self primitiveFailed'. |
916 self primitive failed'. |
927 |
917 #( #bc #stc ) do:[:mode | |
928 #( #bc #stc ) do:[:mode | |
918 | ptr | |
929 | ptr | |
919 |
930 |
920 self compile:malloc mode:mode. |
931 self compile:malloc mode:mode. |
921 self compile:free mode:mode. |
932 self compile:free mode:mode. |
922 ptr := self perform:(mode , '_malloc:') asSymbol with:1. |
933 ptr := self perform:(mode , '_malloc:') asSymbol with:1. |
923 self assert:ptr class == RegressionTests::CompilerTests2ExternalBytes. |
934 self assert:ptr class == RegressionTests::CompilerTests2ExternalBytes. |
924 self perform:(mode , '_free:') asSymbol with:ptr. |
935 self perform:(mode , '_free:') asSymbol with:ptr. |
925 ] |
936 ] |
926 |
937 |
927 "Created: / 06-01-2014 / 11:29:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
938 "Created: / 06-01-2014 / 11:29:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
928 "Modified: / 20-09-2014 / 21:51:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
939 "Modified: / 20-09-2014 / 21:51:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
940 "Modified: / 11-05-2018 / 13:45:47 / stefan" |
929 ! ! |
941 ! ! |
930 |
942 |
931 !CompilerTests2 methodsFor:'tests - arg & var names'! |
943 !CompilerTests2 methodsFor:'tests - arg & var names'! |
932 |
944 |
933 test_argAndVarNames_01 |
945 test_argAndVarNames_01 |