Comparar commits
663 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 4373e66b1e | |||
| 2e67b0ad9f | |||
| a4cbe0635f | |||
| 8563419280 | |||
| 0974bd4a90 | |||
| e1d47adc99 | |||
| e5e171d913 | |||
| 1e313227b8 | |||
| 8d45a9e0cd | |||
| 95568d76d3 | |||
| d4a3442468 | |||
| e262de22ea | |||
| 49243f1891 | |||
| 1a099ba549 | |||
| 2367133b4f | |||
| c648a1933d | |||
| 598acf08da | |||
| 208a8dee90 | |||
| e9fb299565 | |||
| 17a514ecd0 | |||
| 38ac62cedd | |||
| ce280731af | |||
| 751fb57f71 | |||
| be7d90abbf | |||
| d59585dd4f | |||
| 7a695707a2 | |||
| 4e590c9450 | |||
| b069d1c9e9 | |||
| 9fa1f7b981 | |||
| 4a68e4cd9d | |||
| 8320b6fd7c | |||
| e40cf0a1c4 | |||
| 19106985d7 | |||
| 3d817c54da | |||
| ca31877107 | |||
| f5f9afefb0 | |||
| d42863603e | |||
| 2c19cf3e31 | |||
| e7dc918c6a | |||
| 64c9e8212a | |||
| 499c39f13d | |||
| bccdae735b | |||
| 58120730a5 | |||
| 5b8db8a680 | |||
| 0acfd583c8 | |||
| 402b7ef67e | |||
| 6944871c42 | |||
| b60da35689 | |||
| 5204feddb1 | |||
| 68156df66b | |||
| a9e8b27285 | |||
| b8f470ddbd | |||
| 9d075dd1d1 | |||
| 4b802c6f60 | |||
| 8ce9344dd0 | |||
| cb2b386791 | |||
| 7ee4681c10 | |||
| 82c0ea9df2 | |||
| 9070d80880 | |||
| 45c53caf94 | |||
| c4947618c1 | |||
| 941ed59c37 | |||
| d76bbec1ab | |||
| f5a1d98cf9 | |||
| b0e6d837f0 | |||
| b1cfb1b733 | |||
| 26a1212546 | |||
| 03b05aaae9 | |||
| f41c87d7c9 | |||
| b74deb5e35 | |||
| 240e2db637 | |||
| 441947b6a4 | |||
| 194bdaffcd | |||
| db6e9ff4c6 | |||
| 57261a1164 | |||
| 0b116bb409 | |||
| a5ad2e5de2 | |||
| b6928ff6c0 | |||
| 4b03dd321c | |||
| f7eefbd3d7 | |||
| b23f7f9b27 | |||
| b95bc7e4c4 | |||
| 1593c0c347 | |||
| c154663455 | |||
| 13bc1901dc | |||
| 4f28322ac2 | |||
| 756e2ced8b | |||
| 1dc78b5209 | |||
| 3464093273 | |||
| 4487214494 | |||
| 6d7e222946 | |||
| d12a6a3178 | |||
| ed9d609c35 | |||
| b86f359d93 | |||
| 02080dfcf8 | |||
| 2768d25884 | |||
| 7bdf9896d2 | |||
| 3b4f84ded8 | |||
| 69abc52731 | |||
| 1671b1fb8b | |||
| 8735f4ef5c | |||
| 86967b5786 | |||
| ca8ceeb130 | |||
| 41d6f8eeea | |||
| 27b7805608 | |||
| fef39f7013 | |||
| b414b54c6b | |||
| ccdbb20ad0 | |||
| eb7e47bf29 | |||
| 53988c7184 | |||
| 9092b2bdc5 | |||
| 068353aa5b | |||
| 95a17ddbf0 | |||
| 6c8c455f5b | |||
| 282032e178 | |||
| af63e6a80d | |||
| a46ba0da29 | |||
| f7738bf65b | |||
| bb11d1fe37 | |||
| d02a2deb52 | |||
| 46105d849d | |||
| f16b6c3482 | |||
| a9cb497045 | |||
| d529a34ecb | |||
| 5394029dc5 | |||
| 28247737ca | |||
| 6448c2d8fb | |||
| 4460ccc8ec | |||
| 2b02a3c533 | |||
| 6705513b86 | |||
| 4bd8d12481 | |||
| ccaf3c283b | |||
| ce4276a0cb | |||
| 709e316e56 | |||
| e46635d6ab | |||
| 0af8677ba4 | |||
| 9ab13daf09 | |||
| 17977fbabc | |||
| 83854047b7 | |||
| 28e56fd587 | |||
| 29fc6308b8 | |||
| 14a7df128d | |||
| dd4ef89d0a | |||
| 830ec91cbf | |||
| aee2d55fab | |||
| 89ed7982e7 | |||
| 9f702c89ab | |||
| 2f76efd0f6 | |||
| fae18c72c3 | |||
| 1586f6ee2b | |||
| 4ce6214526 | |||
| e370e4b65e | |||
| 944de2d3f5 | |||
| f32146368d | |||
| 8d45e9b016 | |||
| 70227861ff | |||
| 20e542516b | |||
| 73ad21df73 | |||
| a67fe7e43d | |||
| a15ddd9f88 | |||
| b27f9bf930 | |||
| d5c28f98f1 | |||
| 16b283ed00 | |||
| 97b43889a1 | |||
| 05efa12411 | |||
| 3e60495232 | |||
| 45522b0710 | |||
| d67d25eb7b | |||
| 2538690fb4 | |||
| 4c23b2518e | |||
| 9daade9816 | |||
| 5f925f0070 | |||
| 38b0cd7780 | |||
| e46391042b | |||
| 553a03b05f | |||
| 24c1cc4efe | |||
| f6eabe7b58 | |||
| de2de1fdc7 | |||
| 8184ac8843 | |||
| a57d82d4cd | |||
| a266ef7337 | |||
| b30ca23180 | |||
| db5c8f00fc | |||
| d1bbacb06e | |||
| bff4e3b0fd | |||
| 14248ddbd9 | |||
| 391f39d291 | |||
| b4354efa8b | |||
| 686588a6e5 | |||
| 294267a605 | |||
| 7b53b9108b | |||
| 15be9ab501 | |||
| 7cfcd2daef | |||
| 6070429eec | |||
| b5f41ef6c7 | |||
| 716588a8fb | |||
| 95bc92f005 | |||
| 23425abe9d | |||
| 3bab5e1e78 | |||
| 79ed7e81b1 | |||
| a59e58cc94 | |||
| 72bd12e394 | |||
| 2c667ca016 | |||
| 209c4d724f | |||
| 95cf641f50 | |||
| 85750fd065 | |||
| 402b5c7f81 | |||
| be6f52b796 | |||
| f4e6c6ad94 | |||
| 99fe59cee9 | |||
| 0e80ba8b91 | |||
| 8965efdce1 | |||
| 1393a94804 | |||
| 52e558d877 | |||
| d9948105f1 | |||
| 87c91c1c04 | |||
| f15e471371 | |||
| fc0a83933d | |||
| f1cf2fe218 | |||
| 7a5679cb65 | |||
| 571b4604db | |||
| 29e15a40db | |||
| 6fb2286fa4 | |||
| ab2f78c7b4 | |||
| f9b918a05b | |||
| a46cde174a | |||
| 6eee0f8741 | |||
| 28d31bb9f6 | |||
| 23128be17f | |||
| 130885fda7 | |||
| c4fc42f8f4 | |||
| 21e73c5fb9 | |||
| b635bf5591 | |||
| be594bb1f6 | |||
| 543e3fca98 | |||
| b385d76dc6 | |||
| 2adc88fec3 | |||
| 2a9e2ceb61 | |||
| 47fa804469 | |||
| f70c01eee7 | |||
| eb4ea07a2d | |||
| 55cd72baaa | |||
| 940076d101 | |||
| 93ebb9f7a9 | |||
| 1a17ea52d8 | |||
| 68bc0c0c7c | |||
| 0e7dd6b350 | |||
| b3b0bf3845 | |||
| ddc32f1e43 | |||
| c9de508a2c | |||
| fac68bca4e | |||
| eaf250c3c6 | |||
| 8b99772d29 | |||
| 862a32e97e | |||
| 6cfb84d6ee | |||
| 2fda7ca6f6 | |||
| f2aecb53bc | |||
| 05fdc2f17a | |||
| b9868b993c | |||
| 573d8eefd1 | |||
| 51d64f29e6 | |||
| a39ab60ae5 | |||
| ba9671fae5 | |||
| a9340f354d | |||
| f9d6b069f7 | |||
| c363d5790d | |||
| 15a50d2a26 | |||
| bffc188151 | |||
| e78205430c | |||
| 4ef76d4f85 | |||
| 967da46793 | |||
| 46899503bd | |||
| 2dcf0f774c | |||
| d669db0cab | |||
| f8aabcc50a | |||
| 4bb3ece8dc | |||
| 495a7765d2 | |||
| 225296f253 | |||
| 52e6900e7a | |||
| 557bff1465 | |||
| add32ac107 | |||
| f7699b98fb | |||
| 05a8ec1fec | |||
| 004e63c433 | |||
| 898f41b95a | |||
| 859a6a75aa | |||
| b90dae6448 | |||
| dc1ddf4cff | |||
| 46ef5d86c3 | |||
| ac63a6b125 | |||
| 72778c97df | |||
| b4b86081f9 | |||
| e4a47a4ca5 | |||
| 79c60f6d4e | |||
| 4c4d55e0dc | |||
| 9504416beb | |||
| 99586d9b3f | |||
| 65b19cbbd3 | |||
| 7b64f4443d | |||
| abb2e857be | |||
| df10745963 | |||
| 3d729595d1 | |||
| 96a38d1895 | |||
| b4c1390af8 | |||
| e9604ac212 | |||
| ea3a4b34ea | |||
| 79a0d92161 | |||
| b10c40260c | |||
| 9e056d2097 | |||
| 8a250c5994 | |||
| e311ac3269 | |||
| 28078a2d0c | |||
| 7def8c1bbf | |||
| 24ca11387e | |||
| bccc9583c1 | |||
| 9643747b17 | |||
| c695848092 | |||
| 5011613e4c | |||
| 6cc7f69a59 | |||
| db6678637b | |||
| 93892e12a2 | |||
| c196aab89d | |||
| 54a7718b88 | |||
| cec6e6175a | |||
| bc5036bd34 | |||
| 021826eb1b | |||
| facd071967 | |||
| 486e81ad77 | |||
| 872cd3d7c0 | |||
| ca9851b311 | |||
| 2fa0940d45 | |||
| 3485338386 | |||
| 786a821f3f | |||
| da1c9c5ea5 | |||
| 93d8cce7ac | |||
| 5086ba2a3b | |||
| 4cf8611dcd | |||
| 101e9d705a | |||
| 7d8bfa1b62 | |||
| 5dcf9e2f41 | |||
| cdf18b6c4d | |||
| 609ce3b6e0 | |||
| 3ba8be2e21 | |||
| 6b13a97ce4 | |||
| 130e40957e | |||
| a7b28317d7 | |||
| 29fcd0fdcf | |||
| 9d5f63e543 | |||
| 208c28ead2 | |||
| 447d5ee94b | |||
| bb443add17 | |||
| cb954773ed | |||
| 89749c7eb1 | |||
| 30146f8744 | |||
| a623f374b1 | |||
| b41584feb3 | |||
| 77d5bbb767 | |||
| 171d428d3a | |||
| 61254c6cc4 | |||
| 44b3a8952e | |||
| 0fc8c5e7e9 | |||
| 6d969eb92f | |||
| 26ea0f81ca | |||
| dc45e38f11 | |||
| 9d5db40d3f | |||
| 9e25d52679 | |||
| 1f98d4f6ff | |||
| b73883ce1d | |||
| 7af42da5d2 | |||
| cf75057b67 | |||
| e5b1841030 | |||
| 57325a22a5 | |||
| c640166cf8 | |||
| 4b4c362c03 | |||
| c71bfb1602 | |||
| 022e6349c1 | |||
| 917671ac9a | |||
| a108975d78 | |||
| 62d31c5902 | |||
| 5d28314ee3 | |||
| 1b22109f95 | |||
| e5c05bfd66 | |||
| 62e97858d7 | |||
| b9da9b977e | |||
| f121b6c039 | |||
| c48b13bc0a | |||
| 26abb9beb9 | |||
| 02cc7d53b7 | |||
| 67136b5986 | |||
| 58d5175fde | |||
| c511c4063e | |||
| 6429611b3c | |||
| 3cea53ddca | |||
| d661e58fc3 | |||
| e140b6e4e2 | |||
| e1025d9337 | |||
| f1acc483c3 | |||
| 0e25e979a2 | |||
| 0c129ff02e | |||
| 05234082a9 | |||
| bdc44962a1 | |||
| e96a59965e | |||
| 507f3fc74b | |||
| 22d997fcd9 | |||
| 89a98ca51b | |||
| 9834abe3ab | |||
| 54ffc2c138 | |||
| 4785c4f11e | |||
| 9d5b0deb61 | |||
| 9c0b540ddc | |||
| c124a9f2b8 | |||
| 8b0e08f9df | |||
| 9ee115d1a0 | |||
| a7ebf431a8 | |||
| d85330d54a | |||
| f8f93c7351 | |||
| ee1fd4944f | |||
| 5117fa06b8 | |||
| 2ac1552bf7 | |||
| 94c2647d25 | |||
| 6b2f067435 | |||
| 3e2471d0a0 | |||
| f0b1d33398 | |||
| bae955f7c5 | |||
| b747e71583 | |||
| 48160da4b7 | |||
| d17df6a9db | |||
| df7a9ec977 | |||
| f2157420f2 | |||
| ae9c56416f | |||
| 1dec6a541a | |||
| c75157ffd8 | |||
| fa77d03fea | |||
| 618f4c533c | |||
| 9b77631dd5 | |||
| 7aa22df1e2 | |||
| ee0ff79820 | |||
| ca772e8a9c | |||
| 8af05c14be | |||
| 20f230e910 | |||
| 8af51875b6 | |||
| a4ead757f6 | |||
| 0cc6bc9e2e | |||
| 00a551d2b1 | |||
| b6f1652aab | |||
| b304555389 | |||
| 456af457bb | |||
| e9cb67844d | |||
| ff12099078 | |||
| 4068c6da1a | |||
| 2f839a41c0 | |||
| d9c13aefe3 | |||
| 7bfa1c27bf | |||
| f6986352ee | |||
| 2eb51bbb13 | |||
| 77ef1e75c8 | |||
| ae11a9d77c | |||
| 30648be2ed | |||
| e5958a2a15 | |||
| 8d3b41ea4d | |||
| 2d7f82af75 | |||
| 9c93a94834 | |||
| 13a9861d18 | |||
| f7d1a91aad | |||
| 121b8e0a64 | |||
| 36ebf4a034 | |||
| 0a752616b7 | |||
| edd21a959b | |||
| dfe9779401 | |||
| d64bc68562 | |||
| f29a57ceb2 | |||
| 529c8e36f2 | |||
| 108abcdec4 | |||
| 1ae7d8373f | |||
| 8eb4860ec6 | |||
| 7ae188c42b | |||
| 125a65ee8a | |||
| 98c3353a07 | |||
| 683ba59fae | |||
| 38abd739d3 | |||
| df58c84b5a | |||
| 513bb215db | |||
| 77be329ed0 | |||
| 1f223fbe13 | |||
| c6a21ab661 | |||
| 6d59f0bd3f | |||
| 74972e267a | |||
| 6c2134ba0e | |||
| 7bf53b0588 | |||
| eaff635df5 | |||
| 88ad275b44 | |||
| fe6143ca49 | |||
| 724432aa02 | |||
| 9686a4b1bd | |||
| 7f8fab8ec0 | |||
| 5a985a143b | |||
| f9154f8c2e | |||
| 287879a7f5 | |||
| 3c82302545 | |||
| b331783c01 | |||
| 1882210db4 | |||
| 12bd185a9b | |||
| 3dbaa7984f | |||
| 40f00b1dcb | |||
| 98bb38cb03 | |||
| e1b4c8d616 | |||
| 5d7c015348 | |||
| a90e7c82b3 | |||
| 6c0c9e7d7c | |||
| 461b35f6ef | |||
| 81ca040918 | |||
| 5dc6bfb195 | |||
| b0d3657e56 | |||
| 822913c85f | |||
| ce0ac250e1 | |||
| 22e98986e5 | |||
| 3f7fc39362 | |||
| 024c845d06 | |||
| 4bb1e29cf3 | |||
| fa7bdc4fcd | |||
| ab0708340c | |||
| 34723a2e17 | |||
| d4c4d2bb13 | |||
| 80090df8e4 | |||
| 05dc68db7b | |||
| 1bcde2cbf2 | |||
| 9a5f5851ba | |||
| 8c7152bb9f | |||
| 5580e39447 | |||
| f29d58c0f0 | |||
| d69e62363e | |||
| 0e0af9dcaa | |||
| 85fee142b3 | |||
| a1b5a934f4 | |||
| 996b533634 | |||
| 11fab2e58e | |||
| 437df3b6d4 | |||
| 663c2fdbac | |||
| 4eb0e9f8aa | |||
| 00a17b60f8 | |||
| fb5f00db61 | |||
| 0105055c3e | |||
| efe147b731 | |||
| 9585302dc5 | |||
| 7432c0775b | |||
| 8666ac7b85 | |||
| 827cbfd03c | |||
| 64a5e8f236 | |||
| 6a60315011 | |||
| a234334f69 | |||
| d71acbd909 | |||
| 33e672d135 | |||
| a26a696e34 | |||
| c63827d5a0 | |||
| 998f9f6ad0 | |||
| 0e188d3bff | |||
| 4a0867c5f2 | |||
| 4fb1955303 | |||
| ef202cd8b8 | |||
| 3648b4539b | |||
| b78ac9355a | |||
| f023994074 | |||
| a47e77bdf9 | |||
| 13773c267d | |||
| deccbf6d9a | |||
| ec1f92c16a | |||
| 5436e605b0 | |||
| 949ae6a7aa | |||
| b957c563c6 | |||
| 36c73e1d64 | |||
| d8f0925466 | |||
| 77d1b2f648 | |||
| 7a82dd3baf | |||
| 7c5573199f | |||
| 55146b70bd | |||
| c2a26458e8 | |||
| 6be895f83c | |||
| fcae79eb9a | |||
| 9a342d979f | |||
| a48a7c321d | |||
| fd167bc19f | |||
| 11f794c9df | |||
| 30b353fabe | |||
| 61590a115c | |||
| 982dfbdd61 | |||
| 9a5605f5de | |||
| 5d62055838 | |||
| 3e886a8a5b | |||
| eb1d4736b0 | |||
| affcdf49f9 | |||
| 06a4a3f8af | |||
| eb58d23656 | |||
| ed2ee11af8 | |||
| 6ed833bf28 | |||
| 196e8af786 | |||
| 17aafbc595 | |||
| 1dcf8cf36c | |||
| 3fc6bc7e53 | |||
| fce337b823 | |||
| 6e3c4a856c | |||
| 05f44f3c62 | |||
| d609eed733 | |||
| 65c4e6ad94 | |||
| 6fc11568c0 | |||
| 494aa6e090 | |||
| abab91748c | |||
| f86ef41980 | |||
| a22191c1fb | |||
| db2a6b239e | |||
| 25726a3df9 | |||
| a95c4d673d | |||
| b6b53d7b83 | |||
| 573a5c6a53 | |||
| 7db8868043 | |||
| 7ee89a6e1d | |||
| 5e22b1cd27 | |||
| 2e5eee5092 | |||
| b341608130 | |||
| e6e8ffb1c3 | |||
| 60c851972e | |||
| dcfc552254 | |||
| 8bb92f5c19 | |||
| 0ca338ade0 | |||
| 272424d379 | |||
| 6d72f33da7 | |||
| c0fab06356 | |||
| 1423a7ce91 | |||
| 053a432804 | |||
| f50129baa3 | |||
| 9150e8f188 | |||
| b637ab3ceb | |||
| 32d38dd876 | |||
| a04f4bd4b2 | |||
| ad68219568 | |||
| af117d810d | |||
| 5d764abdc6 | |||
| a9e9c69265 | |||
| 461e86eb82 | |||
| 7e87ffa0fd | |||
| 7bfa698796 | |||
| 285f64ed62 | |||
| b13b1d7b70 | |||
| 212e0cd812 | |||
| 589a8e101d | |||
| b8b4169b1a | |||
| e8aac64083 | |||
| 8e3ae9bb85 | |||
| 14a549928f | |||
| 83e1fb715e | |||
| aeeac8e343 | |||
| 5fc6d50486 | |||
| edc7c111cb | |||
| 05a754bc92 | |||
| dff58c56fb | |||
| 58709a1d32 | |||
| 554567fa82 | |||
| 3ad51db9c2 | |||
| 007d74ee23 | |||
| cd15214d77 | |||
| 32eca24468 | |||
| a96e25ef5d | |||
| 5087fb1904 | |||
| 2c4af20cb0 |
+1
-1
@@ -2,7 +2,7 @@
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" output="build.eclipse/test-classes" path="test"/>
|
||||
<classpathentry kind="lib" path="lib/junit.jar" sourcepath="/DEV/junit/src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
|
||||
<classpathentry kind="output" path="build.eclipse/classes"/>
|
||||
</classpath>
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
#Wed Aug 29 20:43:29 EDT 2007
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
|
||||
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.nullReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedImport=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
||||
@@ -0,0 +1,3 @@
|
||||
#Tue Mar 27 21:18:08 EDT 2007
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
|
||||
Arquivo executável
+504
@@ -0,0 +1,504 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
Arquivo executável
+33
@@ -0,0 +1,33 @@
|
||||
* RELATED and/or SIMILAR PROJECTS:
|
||||
* Feel free to add notes and/or descriptions here (this should probably go
|
||||
* on a wiki somewhere).
|
||||
----
|
||||
* nlink.dev.java.net:
|
||||
pros: simple definitions (same as jna)
|
||||
cons: w32 only
|
||||
* sf.net/projects/jnative:
|
||||
cons: boilerplate, manual code generation by calling setup methods
|
||||
pros: callbacks, byref args?
|
||||
* JNIWrapper: kinda like jnative (commercial), includes platform "packs"
|
||||
* coroutine for Java, like jnative (commercial)
|
||||
* jnieasy: c++ mappings (http://www.innowhere.com:8080/webapp/jsp/products/jnieasy/index.jsp?_page=products.jnieasy)
|
||||
* j2native (www.smardec.com)
|
||||
* j-interop.sf.net
|
||||
* jawinproject.sf.net (COM DLL access)
|
||||
* jacob-project.sf.net (COM DLL access)
|
||||
* nativecall.sf.net (minimal)
|
||||
* cxxwrap.sf.net
|
||||
* J/Direct (defunct)
|
||||
* NoodleGlue
|
||||
* SWIG
|
||||
* ctypes4j.sf.net
|
||||
* ctypes-java (out of date)
|
||||
* jnbridge
|
||||
* xFunction (http://excelsior-usa.com/xfunction.html, commercial, osx)
|
||||
* JACE c++ mappings
|
||||
* JAW Java API wrapper http://www.aplu.ch/home/apluhome.jsp?site=5
|
||||
|
||||
# OTHER REFERENCES
|
||||
# JNI options: http://staff.develop.com/halloway/JavaWin32.html
|
||||
# List of JNI alternatives: http://weblog.janek.org/Archive/2005/07/28/AlternativestoJavaNativeI.html
|
||||
|
||||
+181
-93
@@ -1,60 +1,80 @@
|
||||
# DESIGN GOALS/REQUIREMENTS
|
||||
o no permanent references to java objects in native code (hard to get rid of)
|
||||
this means no java object arguments to callbacks; use some sort of integer
|
||||
key instead (hashcode?) callbacks can hold local data anyway...
|
||||
o make simplest Java usage map to most common C usage
|
||||
- additional constructs provided for less-common cases
|
||||
(WString,Structure.ByValue/ByReference)
|
||||
o structure is treated as a pointer, except within a struct
|
||||
o primitive types are passed directly
|
||||
o arrays are treated as pointers, except within a struct
|
||||
- in structure (inline; otherwise pointer-to-X should be used)
|
||||
- as function argument (auto-convert to pointer via Memory)
|
||||
o pointer to type in struct should use Pointer or ByReference
|
||||
o "free" should be invisible wherever possible
|
||||
|
||||
# FUTURE DEMOS:
|
||||
* test keyboard keys' state (needs OSX)
|
||||
* get system process information, basic process control
|
||||
* additional file utilities (meta info, free space, etc)
|
||||
* enforce window minimum/maximum size (workaround java bug)
|
||||
|
||||
# TODO:
|
||||
# TODO
|
||||
|
||||
* review/use ByteBuffer everywhere
|
||||
* change/augment getWindowHandle0 to provide any heavyweight component window
|
||||
* use jna.encoding property to affect string encoding instead of just using
|
||||
the system default encoding.
|
||||
* fix setFieldOrder to *always* apply if used
|
||||
* cache structure information
|
||||
|
||||
* design:
|
||||
* make direct calls call back *once* to Java where conversion is required,
|
||||
and process all arguments from there (instead of potentially swapping back
|
||||
and forth multipel times). This also makes it easer to perform conversions
|
||||
(no native changes required).
|
||||
|
||||
o no permanent references to java objects in native code (hard to get rid of)
|
||||
this means no java object arguments to callbacks; use some sort of integer
|
||||
key instead (hashcode?) callbacks can hold local data anyway...
|
||||
o make simplest Java usage map to most common C usage
|
||||
- additional constructs provided for esoteric cases (WString)
|
||||
o structure is treated as a pointer, except within a struct
|
||||
o primitive types are passed directly
|
||||
o arrays are treated as pointers, except within a struct
|
||||
- in structure (inline; otherwise pointer-to-X should be used)
|
||||
- as function argument (auto-convert to pointer via Memory)
|
||||
- pointer to type in struct should be handled with Pointer
|
||||
- how to do pointer to struct in struct? (Pointer to start with)
|
||||
o "free" should be invisible wherever possible
|
||||
* use libffi from gcc to handle calls and callbacks?
|
||||
or move callback asm templates into dispatch_<arch>.c
|
||||
* direct/raw non-primitive array arguments (String[], Pointer[], NativeMapped[])
|
||||
|
||||
* ppc64 direct/raw failures (multiple)
|
||||
|
||||
* direct calls on ppc to varargs (callbacks) with FP args fail; avoid them for
|
||||
now
|
||||
|
||||
* combine direct and interface mapping calling code where possible
|
||||
|
||||
* make native dll extraction from jar public, to use with user dlls packaged
|
||||
in a jar
|
||||
|
||||
* Callback.PostCallWrite.write() cf PostCallRead
|
||||
|
||||
* GetPrimitiveArrayCritical: use this if flagged (by annotation? method name?)
|
||||
|
||||
* MethodArgument/ReturnMapper: per method mapping of arguments/return type.
|
||||
Can use annotations as shorthand to initialize a map, but basically set up a
|
||||
per-NativeLibrary (or per-Function?) map of methods to mappers.
|
||||
|
||||
Requires separate compilation of annotation handling.
|
||||
|
||||
* ditch type conversion context (?)
|
||||
|
||||
* packaging: 'types', 'convert/marshal' subpackages?
|
||||
note: marshal/unmarshal vs to/fromnative: to/fromnative is more
|
||||
explicit, since marshal/unmarshal doesn't indicate src/dst.
|
||||
o moving conversion contexts to subpackage cleans up top level
|
||||
substantially, but we probably don't want to move things like Structure and
|
||||
Pointer into a types subpackage (which would leave just a few top-level
|
||||
classes). Javadoc is cluttered by example classes anyway.
|
||||
|
||||
* support annotations of parameters and return values w/o breaking
|
||||
1.4 compatibility (retroweaver?), e.g.
|
||||
-- retroweaver (requires retroweaver runtime classes to provide annotation
|
||||
features) not yet worth doing
|
||||
|
||||
void my_function(@MarshalAs(off_t)long arg);
|
||||
|
||||
trading off cruft in the interface def to avoid cruft in the usage:
|
||||
|
||||
my_function(0) versus my_function(new off_t(0))
|
||||
|
||||
this only really applies to NativeLong/IntegerType types that want to use a
|
||||
primitive value instead of creating an object instance.
|
||||
|
||||
* provide library load/unload hooks (Runnables in options?). Examples:
|
||||
o GetLastError in kernel32
|
||||
o WSAInit?
|
||||
* determine X11 display name from current java program (if any); null is ok
|
||||
since it uses getenv(DISPLAY), which is what java would do
|
||||
note: DISPLAY may be available in GraphicsDevice->getIDstring
|
||||
* universal OSX build w/cross-compile (hard to do with libffi)
|
||||
* universal GCC build w/cross-compile
|
||||
* catch native crash/exception/faults and re-throw as java exception
|
||||
this is mostly for debugging a new mapping to avoid crashing the VM
|
||||
could do setjmp/longjmp on *nix and catch C++ exception on w32
|
||||
* return Pointer.SIZE/LONG_SIZE/WCHAR_SIZE in bits (for consistency with 1.5)
|
||||
Long.SIZE, Integer.SIZE, et al.
|
||||
* interface "lvalue", which can provide a pointer to itself (reference() or
|
||||
addressOf())?
|
||||
* how to do direct struct argument (vs struct pointer) (uncommon)?
|
||||
* how to do struct return (vs struct pointer) (uncommon)?
|
||||
* more tests for argument types (2 args, all permutations of basic data types)
|
||||
ensures native stack handling is done properly
|
||||
* make Pointer free-able (system allocates memory, client frees it); actually,
|
||||
this should probably be automatic so the user doesn't have to think about it.
|
||||
Maybe a custom type representing "function-allocated-pointer" or
|
||||
"pointer-requiring-free" (which is just Memory). For now, leave it up to
|
||||
the user to manage the pointer, since they have to define the free method
|
||||
anyway.
|
||||
* flag string(/wstring)-returning methods which need to free their result
|
||||
to avoid leaking memory whan auto-creating strings from the result
|
||||
(since normally we don't take explicit ownership of any returned pointers)
|
||||
@@ -65,27 +85,94 @@
|
||||
Maybe make function return "Memory", which can then be converted to a
|
||||
Structure or some other type. Then memory will free itself when no longer
|
||||
referenced.
|
||||
* unions (copy-on-call is problematic: which member is active?) must require
|
||||
explicit write, either per member or whole object before export
|
||||
* verify get/set methods vs read/write is for performance (Pointer)?
|
||||
* make Pointer free-able (system allocates memory, client frees it); actually,
|
||||
this should probably be automatic so the user doesn't have to think about it.
|
||||
Maybe a custom type representing "function-allocated-pointer" or
|
||||
"pointer-requiring-free" (which is just Memory). For now, leave it up to
|
||||
the user to manage the pointer, since they have to define the free method
|
||||
anyway. use could always put a finalizer on a PointerType-derived type.
|
||||
* universal GCC build w/cross-compile (needs cross compilers...)
|
||||
* return Pointer.SIZE/LONG_SIZE/WCHAR_SIZE in bits (for consistency with 1.5)
|
||||
Long.SIZE, Integer.SIZE, et al.
|
||||
* interface "lvalue", which can provide a pointer to itself (reference() or
|
||||
addressOf())?
|
||||
* bitfields for structs (how?)
|
||||
|
||||
|
||||
# DONE
|
||||
* check Structure "final" fields; should never write back to native memory
|
||||
* OSX ObjC access (see rococoa)
|
||||
* do Structure.write for any callback args
|
||||
* pointer.setValue(), to handle NativeMapped types and move read/writeValue
|
||||
methods out of Structure, to be used by Function w/NativeMapped[] parameter
|
||||
|
||||
* if method has "GetLastErrorException/ErrnoException" in its signature, use
|
||||
result codes + GetLastError/errno/errstr to auto-generate
|
||||
runtime exceptions? (cf P/Invoke; also useful for X11 return types)
|
||||
provide annotation/custom invocation handler/hook to examine return value and
|
||||
throw an exception if the return value indicates an error
|
||||
|
||||
o are error return values consistent (if so, a single handler works)?
|
||||
if null -> call GetLastError
|
||||
if nonzero ?
|
||||
o otherwise, need an ExceptionOnZero, ExceptionOnNonZero runtime, from which
|
||||
derive GetLastError/ErrnoExceptionOnZero/NZ
|
||||
* verify get/set methods vs read/write for performance (Pointer)?
|
||||
(see RawTest for performance comparisons)
|
||||
* Allow Buffer in Structures (and callbacks) (auto-wrap in direct byte buffer)?
|
||||
o this gets tricky when reading structs from native memory; we don't know if
|
||||
the value is already mapped to a buffer (cf CallbackReference)
|
||||
* standard types for various platforms: posix/types.h, w32 (DWORD, HANDLE)
|
||||
|
||||
* embed version in DLL ('depends'-done)/so (symlink?)
|
||||
* use libffi closure allocation/deallocation
|
||||
|
||||
* ensure Library options are passed to NativeFunctionHandler
|
||||
(needs getLibraryOptions(Class cls))
|
||||
|
||||
* handle array of Structure.ByReference as parameter/return value (cf Pointer[])
|
||||
* test performance of setByte/getByte and pass pointer field directly if it
|
||||
makes sense to do so (done, halves access time to use pointer field directly,
|
||||
slight variations on 1.4/1.5/1.6).
|
||||
* test callback arg/return value for callback type
|
||||
* structure by value in callback
|
||||
|
||||
* call native to fix up FFIType on creation (avoid multithreading problems)
|
||||
properly handle union by value (or punt; must pass union field instead)
|
||||
|
||||
* hash javah-generated headers; when changed, invalidate platform-specific
|
||||
|
||||
* add main class which spits out version information
|
||||
|
||||
* docs: split pages: FAQ
|
||||
FAQ: J2ME, new platform builds, stdcall
|
||||
|
||||
* struct by reference within structure
|
||||
* struct by value
|
||||
(how to do struct value return (vs struct pointer) (uncommon)?)
|
||||
(how to do struct value argument (vs struct pointer) (uncommon)?)
|
||||
* use appropriate size_t and off_t sizes (use long offsets everywhere in
|
||||
Pointer)
|
||||
* Callback/function pointer as return value (e.g. signal())
|
||||
* type safety between returned and passed in pointers (w32 API); advantage of
|
||||
deriving from Pointer is that type mapping can be made automatic, without an
|
||||
explicit type mapping defined.
|
||||
* bitfields et al. for structs
|
||||
* use annotations + result codes + GetLastError/errno/errstr to auto-generate
|
||||
runtime exceptions? (cf P/Invoke; also useful for X11 return types)
|
||||
provide annotation/custom invocation handler/hook to examine return value and
|
||||
throw and exception if the return value indicates an error
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# DONE
|
||||
* Union
|
||||
* catch native crash/exception/faults and re-throw as java exception
|
||||
this is mostly for debugging a new mapping to avoid crashing the VM
|
||||
could do setjmp/longjmp on *nix and catch C++ exception on w32
|
||||
* NativeMapped: provide interface to automatically convert custom Java
|
||||
type to/from native types.
|
||||
* update X11 libs for 64-bit
|
||||
* use libffi from gcc to handle calls and callbacks?
|
||||
or move callback asm templates into dispatch_<arch>.c
|
||||
* more tests for argument types (2 args, all permutations of basic data types)
|
||||
ensures native stack handling is done properly (handled by libffi)
|
||||
* universal OSX build w/cross-compile (hard to do with libffi)
|
||||
* use jna.encoding property to affect string encoding instead of just using
|
||||
the system default encoding.
|
||||
* change/augment getWindowHandle0 to provide any heavyweight component window
|
||||
* unions (copy-on-call is problematic: which member is active?) must require
|
||||
explicit write, either per member or whole object before export
|
||||
* rename Argument/Result Converter to be fromNative/toNative
|
||||
* split unit tests
|
||||
* auto-convert struct pointers in callback args to Java Structure
|
||||
@@ -156,34 +243,35 @@ transient callbacks, and require callback+dispose for most callbacks?
|
||||
void setWindowMask(Window w, Shape clip);
|
||||
// needs:
|
||||
int findNativeWindow(Window w);
|
||||
|
||||
#MAYBE NOT
|
||||
* should structure offsets be 64-bit? technically yes, but in practice I don't
|
||||
think a structure that big actually works.
|
||||
* (maybe) move all native functions into Native (limit header files, easier
|
||||
management)
|
||||
* Does it make sense to define Int16/UInt16, Int32/UInt32, etc? Probably not
|
||||
the signed versions, but maybe the unsigned ones, to facilitate generating
|
||||
unsigned values (maybe just provide utilities to pack an unsigned int into a
|
||||
signed int). What about size_t, off_t, et al.? Would either need a
|
||||
bunch of native lookup functions (more accurate) or java-side conditionals
|
||||
(less robust but easier to change).
|
||||
o bounds checking is handled by IntegerType (pass in a long, get an
|
||||
exception if the value is out of bounds).
|
||||
o when used as struct fields, could allow detection of field order by order
|
||||
of initialization (requires all-or-nothing usage, though)
|
||||
* Make a separate jar file for all OS-specific headers
|
||||
Maybe make interfaces per-header file (winbase, winnt, stdlib, etc),
|
||||
aggregated per-library (interface CLibrary extends stdlib, stdio, etc)
|
||||
(how useful would it really be, or is this just sorting legos?)
|
||||
o same for windowutils, fileutils, etc. (not useful)
|
||||
* StringBuffer/StringBuilder as mutable char*/wchar_t* argument
|
||||
NOTE: byte[]/char[] is probably better; it's trivial to convert to String
|
||||
and native code can't change the size anyway
|
||||
* provide library load/unload hooks (Runnables in options?). Examples:
|
||||
o GetLastError (no longer needed)
|
||||
o WSAInit?
|
||||
* determine X11 display name from current java program (if any); null is ok
|
||||
since it uses getenv(DISPLAY), which is what java would do
|
||||
note: DISPLAY may be available in GraphicsDevice->getIDstring
|
||||
|
||||
# SIMILAR PROJECTS:
|
||||
# nlink.dev.java.net:
|
||||
# pros: simple definitions (same as jna)
|
||||
# cons: w32 only
|
||||
# sf.net/projects/jnative:
|
||||
# cons: boilerplate, manual code generation by calling setup methods
|
||||
# pros: callbacks, byref args?
|
||||
# JNIWrapper: kinda like jnative (commercial), includes platform "packs"
|
||||
# coroutine for Java, like jnative (commercial)
|
||||
# jnieasy: c++ mappings (http://www.innowhere.com:8080/webapp/jsp/products/jnieasy/index.jsp?_page=products.jnieasy)
|
||||
# j2native (www.smardec.com)
|
||||
# j-interop.sf.net
|
||||
# jawinproject.sf.net (COM DLL access)
|
||||
# jacob-project.sf.net (COM DLL access)
|
||||
# nativecall.sf.net (minimal)
|
||||
# cxxwrap.sf.net
|
||||
# xFunction (osx)
|
||||
# J/Direct (defunct)
|
||||
# NoodleGlue
|
||||
# SWIG
|
||||
# ctypes4j.sf.net
|
||||
# ctypes-java (out of date)
|
||||
# jnbridge
|
||||
# xFunction (http://excelsior-usa.com/xfunction.html, commercial)
|
||||
# libffi (now part of GCC) (this might be useful as the dispatch layer)
|
||||
# JACE c++ mappings
|
||||
# JNI options: http://staff.develop.com/halloway/JavaWin32.html
|
||||
# JAW Java API wrapper http://www.aplu.ch/home/apluhome.jsp?site=5
|
||||
# List of JNI alternatives: http://weblog.janek.org/Archive/2005/07/28/AlternativestoJavaNativeI.html
|
||||
|
||||
|
||||
+369
-121
@@ -12,53 +12,125 @@
|
||||
-->
|
||||
|
||||
<!-- global properties -->
|
||||
<!-- (all build-related props should go in dynamic-properties) -->
|
||||
<!-- (all build-related props should go in -dynamic-properties) -->
|
||||
<property name="name" value="jna"/>
|
||||
<property name="jar" value="${name}.jar"/>
|
||||
<property name="testjar" value="${name}-test.jar"/>
|
||||
<property name="debug" value="true"/>
|
||||
<property name="debug.native" value="false"/>
|
||||
<property name="cflags_extra.native" value=""/>
|
||||
<property name="dynlink.native" value="false"/>
|
||||
<property name="native" location="native"/>
|
||||
<property name="src" location="src"/>
|
||||
<property name="dist" location="dist"/>
|
||||
<property name="test.src" location="test"/>
|
||||
<property name="doc" location="doc"/>
|
||||
<property name="stylesheet" location="${doc}/api/doc/css/javadoc.css"/>
|
||||
<property name="company" value="Technomage"/>
|
||||
<property name="company.full" value="Timothy Wall"/>
|
||||
<property name="javadoc" location="${doc}/javadoc"/>
|
||||
<property name="stylesheet" location="${javadoc}/doc/css/javadoc.css"/>
|
||||
<property name="vendor" value="JNA Development Team"/>
|
||||
<property name="copyright"
|
||||
value="Copyright &copy; 2007 ${company.full}. All Rights Reserved."/>
|
||||
value="Copyright &copy; 2007-2009 Timothy Wall. All Rights Reserved."/>
|
||||
<buildnumber/>
|
||||
<!-- JNA library release version -->
|
||||
<property name="jna.major" value="3"/>
|
||||
<property name="jna.minor" value="2"/>
|
||||
<property name="jna.revision" value="3"/>
|
||||
<property name="jna.build" value="${build.number}"/>
|
||||
<property name="jna.version" value="${jna.major}.${jna.minor}.${jna.revision}"/>
|
||||
<!-- jnidispatch library release version -->
|
||||
<property name="jni.major" value="3"/>
|
||||
<property name="jni.minor" value="2"/>
|
||||
<property name="jni.revision" value="1"/>
|
||||
<property name="jni.build" value="${build.number}"/>
|
||||
<property name="jni.version" value="${jni.major}.${jni.minor}.${jni.revision}"/>
|
||||
<property name="jni.md5" value="c870290c36c8d3fdf85db7c782febc3f"/>
|
||||
<property name="spec.title" value="Java Native Access (JNA)"/>
|
||||
<property name="spec.vendor" value="${vendor}"/>
|
||||
<property name="spec.version" value="${jna.major}"/>
|
||||
<property name="impl.title" value="com.sun.jna"/>
|
||||
<property name="impl.vendor" value="${spec.vendor}"/>
|
||||
<property name="impl.version" value="${jna.version} (b${jna.build})"/>
|
||||
|
||||
<!-- Software release version -->
|
||||
<property name="version" value="2.5"/>
|
||||
<property name="jdk" value="1.4"/>
|
||||
<property name="compatibility" value="1.4"/>
|
||||
<property name="test.compatibility" value="1.5"/>
|
||||
|
||||
<!-- Miscellaneous -->
|
||||
<property name="build.compiler.emacs" value="true"/>
|
||||
|
||||
<target name="default" depends="test" description="Build and Test."/>
|
||||
|
||||
<target name="dynamic-properties">
|
||||
<echo>Java version: ${java.version}, compatibility: ${jdk}</echo>
|
||||
<echo>Build ${version}</echo>
|
||||
<property name="build" location="build"/>
|
||||
<import file="nbproject/profiler-build-impl.xml"/>
|
||||
<target name="init" depends="-setup"/>
|
||||
<target name="compile-test-single" depends="compile-tests"/>
|
||||
<target name="compile-single" depends="compile"/>
|
||||
|
||||
<target name="-dynamic-properties">
|
||||
<echo>Java version ${java.version}, compatibility: ${compatibility}</echo>
|
||||
<echo>JNA version ${jna.version}, native ${jni.version}</echo>
|
||||
<echo>${java.vm.name} (${java.vm.vendor}, ${java.vm.version})</echo>
|
||||
<echo>java.home=${java.home}</echo>
|
||||
<echo>java.library.path=${java.library.path}</echo>
|
||||
|
||||
<replaceregexp match="(<version>).*(</version>)"
|
||||
replace="\1${jna.version}\2"
|
||||
file="pom.xml"/>
|
||||
<replaceregexp match='VERSION = ".*";'
|
||||
replace='VERSION = "${jna.version}";'
|
||||
file="src/com/sun/jna/Native.java"/>
|
||||
|
||||
<condition property="jar.omitted" value="**/*jnidispatch*" else="jnilib-included">
|
||||
<isset property="omit-jnilib"/>
|
||||
</condition>
|
||||
<condition property="vm.arch" value="-d64" else="">
|
||||
<or>
|
||||
<equals arg1="${sun.arch.data.model}" arg2="64" trim="true"/>
|
||||
<equals arg1="${com.ibm.vm.bitmode}" arg2="64" trim="true"/>
|
||||
<os arch="x86_64"/>
|
||||
<os arch="ppc64"/>
|
||||
<os arch="sparcv9"/>
|
||||
<os arch="amd64"/>
|
||||
</or>
|
||||
</condition>
|
||||
<condition property="ld.preload" value="LD_PRELOAD_64" else="LD_PRELOAD">
|
||||
<and>
|
||||
<os name="SunOS"/>
|
||||
<equals arg1="${vm.arch}" arg2="-d64"/>
|
||||
</and>
|
||||
</condition>
|
||||
<property name="build" value="build${vm.arch}"/>
|
||||
<property name="classes" location="${build}/classes"/>
|
||||
<property name="eclipse.classes" location="build.eclipse/classes"/>
|
||||
<property name="test.classes" location="${build}/test-classes"/>
|
||||
<property name="reports" value="${build}/reports"/>
|
||||
|
||||
<!-- Add other supported platforms here -->
|
||||
<condition property="jre.arch" value="i386">
|
||||
<equals arg1="x86" arg2="${os.arch}"/>
|
||||
</condition>
|
||||
<condition property="jre.arch" value="amd64">
|
||||
<equals arg1="x86_64" arg2="${os.arch}"/>
|
||||
</condition>
|
||||
<property name="jre.arch" value="${os.arch}"/>
|
||||
<condition property="os.prefix" value="linux-${jre.arch}">
|
||||
<os name="Linux"/>
|
||||
</condition>
|
||||
<condition property="os.prefix" value="win32-${os.arch}">
|
||||
<os family="windows"/>
|
||||
</condition>
|
||||
<condition property="os.prefix" value="linux-${os.arch}">
|
||||
<os name="Linux"/>
|
||||
</condition>
|
||||
<condition property="os.prefix" value="darwin-${os.arch}">
|
||||
<!-- Darwin builds are universal, no arch required -->
|
||||
<condition property="os.prefix" value="darwin">
|
||||
<os family="mac"/>
|
||||
</condition>
|
||||
<condition property="os.prefix" value="sunos-${os.arch}">
|
||||
<os family="unix" arch="sparc"/>
|
||||
<os name="SunOS"/>
|
||||
</condition>
|
||||
<fail unless="os.prefix" message="OS/arch not supported (${os.name}/${os.arch})"/>
|
||||
<condition property="os.prefix" value="freebsd-${os.arch}">
|
||||
<os name="FreeBSD"/>
|
||||
</condition>
|
||||
<condition property="os.prefix" value="openbsd-${os.arch}">
|
||||
<os name="OpenBSD"/>
|
||||
</condition>
|
||||
<fail unless="os.prefix" message="OS/arch not supported (${os.name}/${os.arch}), edit build.xml and native/Makefile to add it."/>
|
||||
<condition property="jdk.home" value="${java.home}">
|
||||
<available file="${java.home}/include"/>
|
||||
</condition>
|
||||
@@ -66,9 +138,13 @@
|
||||
<available file="${java.home}/../include"/>
|
||||
</condition>
|
||||
<fail unless="jdk.home" message="JAVA_HOME/java.home must be a JDK, not JRE"/>
|
||||
|
||||
<condition property="libjsig"
|
||||
value="${java.home}/lib/${jre.arch}/libjsig.so" else="">
|
||||
<available file="${java.home}/lib/${jre.arch}/libjsig.so"/>
|
||||
</condition>
|
||||
<property name="native.jar" value="${os.prefix}.jar"/>
|
||||
<property name="build.native" location="${build}/native"/>
|
||||
<property name="md5.file" location="${build.native}/sig"/>
|
||||
|
||||
<mkdir dir="${build}"/>
|
||||
<mkdir dir="${build.native}"/>
|
||||
@@ -79,7 +155,7 @@
|
||||
|
||||
</target>
|
||||
|
||||
<target name="setup" depends="dynamic-properties">
|
||||
<target name="-setup" depends="-dynamic-properties">
|
||||
<path id="compile-test.path">
|
||||
<pathelement path="${test.src}"/>
|
||||
<path id="test.libs">
|
||||
@@ -99,15 +175,16 @@
|
||||
<pathelement path="${build}/${jar}"/>
|
||||
<pathelement path="${build}/examples.jar"/>
|
||||
<pathelement path="${test.classes}"/>
|
||||
<pathelement path="${ant.home}/lib/clover.jar"/>
|
||||
<pathelement path="lib/clover.jar"/>
|
||||
<path refid="test.libs"/>
|
||||
</path>
|
||||
</target>
|
||||
|
||||
<target name="compile" depends="setup"
|
||||
<target name="compile" depends="-setup"
|
||||
description="Compile all Java source">
|
||||
<javac classpathref="compile.path"
|
||||
source="${jdk}"
|
||||
target="${jdk}"
|
||||
source="${compatibility}"
|
||||
target="${compatibility}"
|
||||
destdir="${classes}"
|
||||
deprecation="on" debug="${debug}">
|
||||
<src path="${src}"/>
|
||||
@@ -126,19 +203,26 @@
|
||||
</srcfiles>
|
||||
</uptodate>
|
||||
</target>
|
||||
<target name="jar" depends="setup,compile-tests,native,:jar" unless="-jar"
|
||||
<target name="jar" depends="-setup,native,:jar" unless="-jar"
|
||||
description="Build primary jar">
|
||||
<jar jarfile="${build}/${jar}">
|
||||
<manifest>
|
||||
<attribute name="Implementation-Vendor" value="${company.full}"/>
|
||||
<attribute name="Implementation-Version" value="${version}"/>
|
||||
<attribute name="Specification-Vendor" value="${company.full}"/>
|
||||
<attribute name="Specification-Version" value="${version}"/>
|
||||
<attribute name="Main-Class" value="com.sun.jna.Native"/>
|
||||
<section name="com/sun/jna/">
|
||||
<attribute name="Implementation-Title" value="${impl.title}"/>
|
||||
<attribute name="Implementation-Vendor" value="${vendor}"/>
|
||||
<attribute name="Implementation-Version" value="${impl.version}"/>
|
||||
<attribute name="Specification-Title" value="${spec.title}"/>
|
||||
<attribute name="Specification-Vendor" value="${spec.vendor}"/>
|
||||
<attribute name="Specification-Version" value="${spec.version}"/>
|
||||
</section>
|
||||
</manifest>
|
||||
<fileset dir="${classes}"><patternset refid="jar-compiled"/></fileset>
|
||||
<fileset dir="${classes}" excludes="${jar.omitted}">
|
||||
<patternset refid="jar-compiled"/>
|
||||
</fileset>
|
||||
</jar>
|
||||
</target>
|
||||
<target name="examples-jar" depends="jar,native-jar">
|
||||
<target name="examples" depends="jar,native">
|
||||
<jar jarfile="${build}/examples.jar">
|
||||
<manifest>
|
||||
<attribute name="Class-Path" value="jna.jar"/>
|
||||
@@ -149,14 +233,6 @@
|
||||
<fileset dir="${classes}" includes="jnidispatch.dll"/>
|
||||
</jar>
|
||||
</target>
|
||||
<target name="native-jar" depends="native,jar"
|
||||
description="Build native jar">
|
||||
<!-- For web start, native libraries need to be in a separate jar file -->
|
||||
<!-- at the root -->
|
||||
<jar jarfile="${build}/${native.jar}">
|
||||
<fileset dir="${build.native}" includes="jnidispatch.dll,libjnidispatch.*"/>
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
<target name="javah" depends="compile">
|
||||
<javah classpath="${classes}" destdir="${build.native}" force="yes">
|
||||
@@ -165,11 +241,91 @@
|
||||
<class name="com.sun.jna.Memory"/>
|
||||
<class name="com.sun.jna.Native"/>
|
||||
<class name="com.sun.jna.NativeLibrary"/>
|
||||
<class name="com.sun.jna.CallbackReference"/>
|
||||
</javah>
|
||||
<condition property="grep" value="/usr/sfw/bin/ggrep">
|
||||
<os name="SunOS"/>
|
||||
</condition>
|
||||
<condition property="grep" value="ggrep">
|
||||
<os name="OpenBSD"/>
|
||||
</condition>
|
||||
<property name="grep" value="grep"/>
|
||||
<apply dir="${build.native}" executable="${grep}" parallel="true"
|
||||
failonerror="true" relative="true" output="${md5.file}">
|
||||
<arg value="-A"/>
|
||||
<arg value="1"/>
|
||||
<arg value="JNIEXPORT"/>
|
||||
<fileset dir="${build.native}" includes="*.h"/>
|
||||
</apply>
|
||||
<fixcrlf srcdir="${build.native}" includes="sig" eol="unix"/>
|
||||
<checksum property="md5" file="${md5.file}" />
|
||||
<condition property="jni.valid" value="true">
|
||||
<or>
|
||||
<equals arg1="${jni.md5}" arg2="${md5}" trim="true"/>
|
||||
<equals arg1="${jni.md5}" arg2=""/>
|
||||
</or>
|
||||
</condition>
|
||||
</target>
|
||||
|
||||
<target name="native" depends="setup,javah"
|
||||
description="Build native libraries. Use 'ant -DCC=gcc' to build using gcc on w32">
|
||||
<!-- Invalidate native libraries when native API changes -->
|
||||
<target name="-native-api-check" depends="javah" unless="jni.valid">
|
||||
<echo>Invalidating native code, new checksum is ${md5}</echo>
|
||||
<copy file="${dist}/out-of-date.jar" tofile="${dist}/darwin.jar" overwrite="true"/>
|
||||
<copy file="${dist}/out-of-date.jar" tofile="${dist}/win32-x86.jar" overwrite="true"/>
|
||||
<copy file="${dist}/out-of-date.jar" tofile="${dist}/win32-amd64.jar" overwrite="true"/>
|
||||
<copy file="${dist}/out-of-date.jar" tofile="${dist}/linux-i386.jar" overwrite="true"/>
|
||||
<copy file="${dist}/out-of-date.jar" tofile="${dist}/linux-amd64.jar" overwrite="true"/>
|
||||
<copy file="${dist}/out-of-date.jar" tofile="${dist}/freebsd-i386.jar" overwrite="true"/>
|
||||
<copy file="${dist}/out-of-date.jar" tofile="${dist}/freebsd-amd64.jar" overwrite="true"/>
|
||||
<copy file="${dist}/out-of-date.jar" tofile="${dist}/openbsd-i386.jar" overwrite="true"/>
|
||||
<copy file="${dist}/out-of-date.jar" tofile="${dist}/sunos-x86.jar" overwrite="true"/>
|
||||
<copy file="${dist}/out-of-date.jar" tofile="${dist}/sunos-amd64.jar" overwrite="true"/>
|
||||
<copy file="${dist}/out-of-date.jar" tofile="${dist}/sunos-sparc.jar" overwrite="true"/>
|
||||
<copy file="${dist}/out-of-date.jar" tofile="${dist}/sunos-sparcv9.jar" overwrite="true"/>
|
||||
<delete failOnError="false" includeEmptyDirs="true">
|
||||
<fileset dir="${build.native}" includes="*.o,*jnidispatch*"/>
|
||||
</delete>
|
||||
<fail>API for native code has changed. Re-run this build after updating jni.version and jni.md5 in build.xml</fail>
|
||||
</target>
|
||||
|
||||
<target name=":rsrc">
|
||||
<condition property="-rsrc">
|
||||
<not><os family="windows"/></not>
|
||||
</condition>
|
||||
</target>
|
||||
<target name="rsrc" depends="-setup,:rsrc" unless="-rsrc"
|
||||
description="Generate w32 DLL version resource information">
|
||||
<property name="rsrc" location="${build.native}/jnidispatch.rc"/>
|
||||
<copy todir="${build.native}" file="${native}/jnidispatch.rc"/>
|
||||
<replaceregexp match="FILEVERSION.*"
|
||||
replace="FILEVERSION ${jni.major},${jni.minor},${jni.revision},${jni.build}"
|
||||
file="${rsrc}" byline="true"/>
|
||||
<replaceregexp match="PRODUCTVERSION.*"
|
||||
replace="PRODUCTVERSION ${jna.major},${jna.minor},${jna.revision},${jna.build}"
|
||||
file="${rsrc}" byline="true"/>
|
||||
<replaceregexp match="FileVersion.*"
|
||||
replace="FileVersion","${jni.version}""
|
||||
file="${rsrc}" byline="true"/>
|
||||
<replaceregexp match="Full Version.*"
|
||||
replace="Full Version","${jni.version} b${jni.build}""
|
||||
file="${rsrc}" byline="true"/>
|
||||
<replaceregexp match="ProductVersion.*"
|
||||
replace="ProductVersion","${spec.version}""
|
||||
file="${rsrc}" byline="true"/>
|
||||
</target>
|
||||
|
||||
<target name="native" depends="-setup,javah,-native-api-check,rsrc"
|
||||
description="Build native libraries. Use 'ant -DCC=xxx' to build using a compiler other than gcc">
|
||||
<property name="comment" value="# auto-generated by ant"/>
|
||||
<replaceregexp match="^VERSION=.*"
|
||||
replace="VERSION=${jni.version} ${comment}"
|
||||
file="native/Makefile" byline="true"/>
|
||||
<replaceregexp match="^CHECKSUM=.*"
|
||||
replace="CHECKSUM=${jni.md5} ${comment}"
|
||||
file="native/Makefile" byline="true"/>
|
||||
<!-- ensure ARCH is set properly for 64-bit capable platforms -->
|
||||
<!-- use ANT_OPTS=-d64 to build 64-bit if not the platform default -->
|
||||
<property name="ARCH" value="${os.arch}"/>
|
||||
<condition property="make.CC" value="CC=${CC}" else="IGNORE=">
|
||||
<isset property="CC"/>
|
||||
</condition>
|
||||
@@ -179,69 +335,144 @@
|
||||
<condition property="make.SDKROOT" value="SDKROOT=${SDKROOT}">
|
||||
<isset property="SDKROOT"/>
|
||||
</condition>
|
||||
<condition property="make.SDKROOT" value="SDKROOT=/Developer/SDKs/MacOSX10.4u.sdk" else="IGNORE=">
|
||||
<condition property="make.SDKROOT"
|
||||
value="SDKROOT=/Developer/SDKs/MacOSX10.5.sdk">
|
||||
<available file="/Developer/SDKs/MacOSX10.5.sdk"/>
|
||||
</condition>
|
||||
<condition property="make.SDKROOT"
|
||||
value="SDKROOT=/Developer/SDKs/MacOSX10.4u.sdk" else="IGNORE=">
|
||||
<available file="/Developer/SDKs/MacOSX10.4u.sdk"/>
|
||||
</condition>
|
||||
<!-- Windows' drive letters in absolute paths wreak havoc on make -->
|
||||
<condition property="make.BUILD" value="BUILD=../build/native" else="BUILD=${build.native}">
|
||||
<!-- Windows' drive letters and spaces in absolute paths wreak havoc on
|
||||
make -->
|
||||
<condition property="make.BUILD" value="BUILD=../${build}/native" else="BUILD=${build.native}">
|
||||
<os family="windows"/>
|
||||
</condition>
|
||||
<exec executable="make" dir="${native}" failonerror="true">
|
||||
<condition property="make.PATH" value="PATH=/usr/sfw/bin:/usr/bin:/usr/ccs/bin" else="IGNORE=">
|
||||
<os name="SunOS"/>
|
||||
</condition>
|
||||
<condition property="make" value="/usr/sfw/bin/gmake">
|
||||
<os name="SunOS"/>
|
||||
</condition>
|
||||
<condition property="make" value="gmake">
|
||||
<or>
|
||||
<os name="FreeBSD"/>
|
||||
<os name="OpenBSD"/>
|
||||
</or>
|
||||
</condition>
|
||||
<!-- Default make program -->
|
||||
<property name="make" value="make"/>
|
||||
|
||||
<exec executable="${make}" dir="${native}" failonerror="true">
|
||||
<arg value="JAVA_HOME=${jdk.home}"/>
|
||||
<arg value="JAVAH=${build.native}"/>
|
||||
<arg value="DEBUG=${debug.native}"/>
|
||||
<arg value="CFLAGS_EXTRA=${cflags_extra.native}"/>
|
||||
<arg value="DYNAMIC_LIBFFI=${dynlink.native}"/>
|
||||
<arg value="${make.CC}"/>
|
||||
<arg value="${make.BUILD}"/>
|
||||
<arg value="${make.SDKROOT}"/>
|
||||
<arg value="${make.ARCH}"/>
|
||||
<arg value="${make.PATH}"/>
|
||||
<arg value="VERSION=${jni.version}"/>
|
||||
<arg value="CHECKSUM=${jni.md5}"/>
|
||||
</exec>
|
||||
<mkdir dir="${classes}/com/sun/jna/${os.prefix}"/>
|
||||
<copy todir="${classes}/com/sun/jna/${os.prefix}">
|
||||
<fileset dir="${build.native}"
|
||||
<fileset dir="${build.native}"
|
||||
includes="jnidispatch.dll,libjnidispatch.*"/>
|
||||
</copy>
|
||||
<mkdir dir="${eclipse.classes}/com/sun/jna/${os.prefix}"/>
|
||||
<copy todir="${eclipse.classes}/com/sun/jna/${os.prefix}"
|
||||
failonerror="false">
|
||||
<fileset dir="${build.native}"
|
||||
includes="jnidispatch.dll,libjnidispatch.*"/>
|
||||
</copy>
|
||||
<!-- For web start, native libraries may be provided in the root of -->
|
||||
<!-- an included jar file -->
|
||||
<jar jarfile="${build}/${native.jar}">
|
||||
<fileset dir="${build.native}" includes="jnidispatch.dll,libjnidispatch.*"/>
|
||||
<manifest>
|
||||
<attribute name="Implementation-Version" value="${jni.version} b${jni.build}"/>
|
||||
<attribute name="Specification-Version" value="${jni.version}"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
<target name="compile-tests" depends="compile"
|
||||
<target name="compile-tests" depends="compile,native,jar"
|
||||
description="Compile all test code">
|
||||
<javac classpathref="compile-test.path"
|
||||
source="${jdk}"
|
||||
target="${jdk}"
|
||||
source="${test.compatibility}"
|
||||
target="${test.compatibility}"
|
||||
destdir="${test.classes}"
|
||||
deprecation="on" debug="${debug}">
|
||||
<src path="${test.src}"/>
|
||||
</javac>
|
||||
<jar jarfile="${build}/${testjar}">
|
||||
<fileset dir="${test.classes}">
|
||||
<patternset refid="jar-compiled"/>
|
||||
</fileset>
|
||||
</jar>
|
||||
<mkdir dir="${build}/jws"/>
|
||||
<copy todir="${build}/jws" file="${build}/${jar}"/>
|
||||
<copy todir="${build}/jws" file="${build}/${testjar}"/>
|
||||
<copy todir="${build}/jws" file="lib/junit.jar"/>
|
||||
<copy todir="${build}/jws" file="lib/clover.jar"/>
|
||||
<jar jarfile="${build}/jws/jnidispatch.jar">
|
||||
<fileset dir="${build.native}" includes="*jnidispatch.*"/>
|
||||
</jar>
|
||||
<signjar alias="jna" keystore="jna.keystore" storepass="jnadev" lazy="true">
|
||||
<fileset dir="${build}/jws" includes="jna.jar,jna-test.jar,junit.jar,jnidispatch.jar,clover.jar"/>
|
||||
</signjar>
|
||||
</target>
|
||||
|
||||
<!-- When running tests from an IDE, be sure to set jna.library.path -->
|
||||
<!-- to where the test library (testlib) is found -->
|
||||
<target name="test" depends="jar,examples-jar,compile-tests"
|
||||
<!-- to where the test library (testlib) is found. -->
|
||||
<target name="test" depends="jar,examples,compile-tests"
|
||||
description="Run all unit tests">
|
||||
<property name="test.fork" value="yes"/>
|
||||
<property name="reports.junit" location="${reports}/junit"/>
|
||||
<property name="results.junit" location="${build}/junit-results"/>
|
||||
<mkdir dir="${results.junit}"/>
|
||||
<echo>Saving test results in ${results.junit}</echo>
|
||||
<condition property="tests.w32" value="**/win32/*Test.java">
|
||||
<property name="tests.stdcall" value="**/win32/*StdCallTest.java"/>
|
||||
<condition property="tests.platform" value="**/win32/*Test.java">
|
||||
<os family="windows"/>
|
||||
</condition>
|
||||
<condition property="tests.unix" value="**/unix/*Test.java">
|
||||
<condition property="tests.exclude" value="**/win32/*StdCallTest.java">
|
||||
<and><os family="windows"/><not><os arch="x86"/></not></and>
|
||||
</condition>
|
||||
<condition property="tests.platform" value="**/unix/*Test.java">
|
||||
<and>
|
||||
<os family="unix"/>
|
||||
<not><os family="mac"/></not>
|
||||
</and>
|
||||
</condition>
|
||||
<junit printsummary="yes" fork="${test.fork}">
|
||||
<!--<jvmarg value="-verbose:jni"/>-->
|
||||
<condition property="vmopt.arch" value="-d64" else="-Dignore">
|
||||
<and>
|
||||
<!-- Sun 64-bit VM for windows doesn't support the -d64 switch -->
|
||||
<not><os family="windows"/></not>
|
||||
<equals arg1="${vm.arch}" arg2="-d64" trim="true"/>
|
||||
</and>
|
||||
</condition>
|
||||
<property name="tests.platform" value=""/>
|
||||
<property name="tests.exclude" value=""/>
|
||||
<junit printsummary="yes" fork="${test.fork}" failureproperty="testfailure">
|
||||
<!-- avoid VM conflicts with JNA protected mode -->
|
||||
<env key="${ld.preload}" file="${libjsig}"/>
|
||||
<jvmarg value="-Djna.library.path=${build.native}"/>
|
||||
<!-- Avoid VM crashes, if possible -->
|
||||
<jvmarg value="-Djna.protected=true"/>
|
||||
<jvmarg value="-Djna.builddir=${build}"/>
|
||||
<jvmarg value="${vmopt.arch}"/>
|
||||
<classpath><path refid="test.runpath"/></classpath>
|
||||
<formatter type="xml"/>
|
||||
<batchtest todir="${results.junit}">
|
||||
<fileset dir="${test.src}">
|
||||
<include name="com/sun/jna/*Test.java"/>
|
||||
<include name="com/sun/jna/examples/*Test.java"/>
|
||||
<include name="${tests.w32}"/>
|
||||
<include name="${tests.unix}"/>
|
||||
<include name="${tests.platform}"/>
|
||||
<exclude name="${tests.exclude}"/>
|
||||
</fileset>
|
||||
</batchtest>
|
||||
</junit>
|
||||
@@ -252,15 +483,14 @@
|
||||
<report todir="${reports.junit}"/>
|
||||
</junitreport>
|
||||
<echo>View test report in file://${reports.junit}/index.html</echo>
|
||||
<fail if="testfailure" unless="clover">One or more tests failed</fail>
|
||||
</target>
|
||||
|
||||
<target name="with.clover" description="Enable code coverage for tests">
|
||||
<taskdef resource="clovertasks"/>
|
||||
<taskdef resource="cloverlib.xml" classpath="lib/clover.jar"/>
|
||||
<property name="clover" value="true"/>
|
||||
<property name="build" value="build.clover"/>
|
||||
<property name="clover.include" value="**/*.java"/>
|
||||
<clover-setup initString="${build}/coverage.db">
|
||||
<fileset dir="${src}" includes="${clover.include}"/>
|
||||
</clover-setup>
|
||||
<clover-setup/>
|
||||
</target>
|
||||
|
||||
<target name="clover" depends="with.clover,test"
|
||||
@@ -269,27 +499,29 @@
|
||||
<mkdir dir="${reports.clover}"/>
|
||||
<clover-report>
|
||||
<current outfile="${reports.clover}" title="clover">
|
||||
<fileset dir="." includes="**/*.java" excludes="**/examples/**/*.java"/>
|
||||
<testresults dir="${results.junit}" includes="TEST-*.xml"/>
|
||||
<format type="html"/>
|
||||
</current>
|
||||
</clover-report>
|
||||
<echo>Reports generated in ${reports.clover}</echo>
|
||||
</target>
|
||||
|
||||
<target name="javadoc" depends="setup">
|
||||
<target name="javadoc" depends="-setup">
|
||||
<property name="header"
|
||||
value="<b>JNA API</><font size="-1"> ${version}</font>"/>
|
||||
value="<b>JNA API</><font size="-1"> ${jna.version}</font>"/>
|
||||
<property name="footer"
|
||||
value="<center><i>${copyright}</i></center>"/>
|
||||
|
||||
<mkdir dir="${doc}/api"/>
|
||||
<mkdir dir="${javadoc}"/>
|
||||
<javadoc package="true"
|
||||
windowtitle="JNA API"
|
||||
sourcepathref="src.path"
|
||||
classpathref="compile.path"
|
||||
maxmemory="256m"
|
||||
packagenames="com.sun.jna,com.sun.jna.ptr,com.sun.jna.examples,com.sun.jna.examples.win32,com.sun.jna.exmaples.unix"
|
||||
packagenames="com.sun.jna,com.sun.jna.ptr,com.sun.jna.types,com.sun.jna.examples,com.sun.jna.examples.win32,com.sun.jna.exmaples.unix"
|
||||
overview="${src}/com/sun/jna/overview.html"
|
||||
destdir="${doc}/api">
|
||||
destdir="${javadoc}">
|
||||
<!-- stylesheetfile="${stylesheet}" -->
|
||||
<doctitle>JNA API Documentation</doctitle>
|
||||
<header>${header}</header>
|
||||
@@ -302,30 +534,66 @@
|
||||
</patternset>
|
||||
</packageset>
|
||||
|
||||
<group title="Java Native Access" packages="com.sun.jna,com.sun.jna.ptr"/>
|
||||
<group title="Examples" packages="com.sun.jna.examples"/>
|
||||
<group title="Java Native Access" packages="com.sun.jna,com.sun.jna.ptr,com.sun.jna.types,com.sun.jna.win32"/>
|
||||
<group title="Examples" packages="com.sun.jna.examples,com.sun.jna.examples.dnd"/>
|
||||
<group title="Unix Examples" packages="com.sun.jna.examples.unix"/>
|
||||
<group title="Windows Examples" packages="com.sun.jna.examples.win32"/>
|
||||
|
||||
<arg value="-notimestamp"/>
|
||||
</javadoc>
|
||||
</target>
|
||||
|
||||
<target name="dist" depends="jar,native-jar,examples-jar"
|
||||
description="Build examples">
|
||||
<target name="dist" depends="jar,compile-tests,native,examples,javadoc"
|
||||
description="Build distribution files">
|
||||
<jar jarfile="${dist}/jna.jar" duplicate="preserve">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="com.sun.jna.Native"/>
|
||||
<section name="com/sun/jna/">
|
||||
<attribute name="Implementation-Title" value="${impl.title}"/>
|
||||
<attribute name="Implementation-Vendor" value="${vendor}"/>
|
||||
<attribute name="Implementation-Version" value="${impl.version}"/>
|
||||
<attribute name="Specification-Title" value="${spec.title}"/>
|
||||
<attribute name="Specification-Vendor" value="${spec.vendor}"/>
|
||||
<attribute name="Specification-Version" value="${spec.version}"/>
|
||||
</section>
|
||||
</manifest>
|
||||
<zipfileset src="${build}/${jar}"/>
|
||||
<zipfileset src="${dist}/win32-x86.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/win32-x86"/>
|
||||
<zipfileset src="${dist}/darwin-i386.jar"
|
||||
<zipfileset src="${dist}/darwin.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/darwin-i386"/>
|
||||
<zipfileset src="${dist}/darwin-ppc.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/darwin-ppc"/>
|
||||
prefix="com/sun/jna/darwin"/>
|
||||
<zipfileset src="${dist}/linux-i386.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/linux-i386"/>
|
||||
<zipfileset src="${dist}/linux-amd64.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/linux-amd64"/>
|
||||
<zipfileset src="${dist}/sunos-x86.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/sunos-x86"/>
|
||||
<zipfileset src="${dist}/sunos-amd64.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/sunos-amd64"/>
|
||||
<zipfileset src="${dist}/sunos-sparc.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/sunos-sparc"/>
|
||||
<zipfileset src="${dist}/sunos-sparcv9.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/sunos-sparcv9"/>
|
||||
<zipfileset src="${dist}/freebsd-i386.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/freebsd-i386"/>
|
||||
<zipfileset src="${dist}/freebsd-amd64.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/freebsd-amd64"/>
|
||||
<zipfileset src="${dist}/openbsd-i386.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/openbsd-i386"/>
|
||||
<zipfileset src="${dist}/win32-amd64.jar"
|
||||
includes="*jnidispatch*"
|
||||
prefix="com/sun/jna/win32-amd64"/>
|
||||
</jar>
|
||||
<copy todir="${dist}">
|
||||
<fileset dir="${build}">
|
||||
@@ -333,61 +601,41 @@
|
||||
<include name="examples.jar"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<!--
|
||||
<copy todir="${dist}/doc">
|
||||
<fileset dir="${doc}"/>
|
||||
</copy>-->
|
||||
<zip zipfile="${dist}/doc.zip">
|
||||
<zipfileset dir="${javadoc}" prefix="javadoc"/>
|
||||
</zip>
|
||||
<!-- JNA sources only, for use in Linux build from source -->
|
||||
<zip zipfile="${dist}/src.zip">
|
||||
<zipfileset dir="." includes="build.xml,LICENSE.txt"/>
|
||||
<zipfileset dir="${src}" includes="**/*.java" prefix="src"/>
|
||||
<zipfileset dir="${test.src}" includes="**/*.java" prefix="test"/>
|
||||
<zipfileset dir="${native}" excludes="libffi,libffi/**/*" prefix="native"/>
|
||||
</zip>
|
||||
<!-- Full sources required to build and test everything -->
|
||||
<zip zipfile="${dist}/src-full.zip">
|
||||
<zipfileset src="${dist}/src.zip"/>
|
||||
<zipfileset dir="lib" includes="junit.jar" prefix="lib"/>
|
||||
<zipfileset dir="." includes=".classpath,.project"/>
|
||||
<zipfileset dir="nbproject" includes="**/*" prefix="nbproject"/>
|
||||
<zipfileset dir="${native}" includes="libffi,libffi/**/*" prefix="native"/>
|
||||
</zip>
|
||||
<!-- Sources package as required by maven -->
|
||||
<zip zipfile="${dist}/src-mvn.zip">
|
||||
<zipfileset dir="${src}" includes="**/*.java,**/*.html,**/*.png"/>
|
||||
</zip>
|
||||
</target>
|
||||
|
||||
<target name="clean" depends="dynamic-properties">
|
||||
<target name="clean" depends="-dynamic-properties">
|
||||
<delete failOnError="false" includeEmptyDirs="true">
|
||||
<fileset dir="${build}"/>
|
||||
</delete>
|
||||
<delete quiet="true" includeEmptyDirs="true">
|
||||
<fileset dir="${doc}/api"/>
|
||||
<fileset dir=".clover"/>
|
||||
<fileset dir="${javadoc}"/>
|
||||
<fileset dir="." includes="*~,**/*~"/>
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<target name="profile-single" depends="examples-jar" description="Profile Class">
|
||||
<fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
|
||||
<nbprofiledirect>
|
||||
<classpath> <pathelement location="${build}/examples.jar"/> </classpath>
|
||||
</nbprofiledirect>
|
||||
<java classname="${main.class}" fork="true">
|
||||
<jvmarg value="${profiler.info.jvmargs.agent}"/>
|
||||
<jvmarg value="${profiler.info.jvmargs}"/>
|
||||
<jvmarg value="-Djna.library.path=${build.native}"/>
|
||||
<classpath>
|
||||
<pathelement location="${build}/examples.jar"/>
|
||||
</classpath>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<target name="profile-test-single" depends="examples-jar,compile-tests"
|
||||
description="Profile Test Class">
|
||||
<fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
|
||||
<nbprofiledirect>
|
||||
<classpath>
|
||||
<pathelement location="${build}/examples.jar"/>
|
||||
<pathelement location="${test.classes}"/>
|
||||
</classpath>
|
||||
</nbprofiledirect>
|
||||
<junit dir="${build.native}" jvm="${profiler.info.jvm}"
|
||||
failureproperty="tests.failed" errorproperty="tests.failed" fork="true">
|
||||
<jvmarg value="${profiler.info.jvmargs.agent}"/>
|
||||
<jvmarg value="${profiler.info.jvmargs}"/>
|
||||
<jvmarg value="-Djna.library.path=${build.native}"/>
|
||||
<test name="${profile.class}"/>
|
||||
<classpath>
|
||||
<pathelement location="${build}/examples.jar"/>
|
||||
<pathelement location="${test.classes}"/>
|
||||
</classpath>
|
||||
<formatter type="brief" usefile="false"/>
|
||||
<formatter type="xml"/>
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
Copyright (c) 2007 Thomas Boerkel, All Rights Reserved
|
||||
|
||||
Disclaimer:
|
||||
===========
|
||||
This code is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
|
||||
Description:
|
||||
============
|
||||
|
||||
Accounts.java:
|
||||
--------------
|
||||
Static methods for getting information about Win32 accounts (users
|
||||
and groups).
|
||||
- list all domain users
|
||||
- list all domain groups
|
||||
- list all local or domain groups where a user belongs to
|
||||
- get account by SID
|
||||
- get SID of account
|
||||
- get domain controller name
|
||||
- get domain name
|
||||
|
||||
Registry.java:
|
||||
--------------
|
||||
Static methods for reading and manipulating the Windows Registry.
|
||||
Only String and DWORD values supported, but could be easily
|
||||
extended.
|
||||
- create key
|
||||
- delete key
|
||||
- delete value
|
||||
- read value
|
||||
- get all sub keys of a key
|
||||
- get all values of a key
|
||||
- set value
|
||||
- check existence of value
|
||||
|
||||
Win32Service.java:
|
||||
------------------
|
||||
Abstract class to wrap a Win32 service. Derive from this class
|
||||
to build your own service. Supports only one type of service and
|
||||
startup, but could be easily extended.
|
||||
- install service
|
||||
- uninstall service
|
||||
- start service
|
||||
- stop service
|
||||
- callback for service start request (onStart), should spawn a thread
|
||||
- callback for service stop request (onStop)
|
||||
|
||||
TestService.java:
|
||||
-----------------
|
||||
Very simple example of an implementation of Win32Service.java.
|
||||
Does nothing but starting and stopping (no "useful" work).
|
||||
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<project name="JnaContrib" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project JnaContrib.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar-with-manifest: JAR building (if you are using a manifest)
|
||||
-do-jar-without-manifest: JAR building (if you are not using a manifest)
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="JnaContrib-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
||||
Arquivo binário não exibido.
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
||||
@@ -0,0 +1,541 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
*** GENERATED FROM project.xml - DO NOT EDIT ***
|
||||
*** EDIT ../build.xml INSTEAD ***
|
||||
|
||||
For the purpose of easier reading the script
|
||||
is divided into following sections:
|
||||
|
||||
- initialization
|
||||
- compilation
|
||||
- jar
|
||||
- execution
|
||||
- debugging
|
||||
- javadoc
|
||||
- junit compilation
|
||||
- junit execution
|
||||
- junit debugging
|
||||
- applet
|
||||
- cleanup
|
||||
|
||||
-->
|
||||
<project name="JnaContrib-impl" default="default" basedir=".." xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:jaxws="http://www.netbeans.org/ns/jax-ws/1">
|
||||
<target name="default" depends="test,jar,javadoc" description="Build and test whole project."/>
|
||||
<!--
|
||||
======================
|
||||
INITIALIZATION SECTION
|
||||
======================
|
||||
-->
|
||||
<target name="-pre-init">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="-init-private" depends="-pre-init">
|
||||
<property file="nbproject/private/private.properties"/>
|
||||
</target>
|
||||
<target name="-init-user" depends="-pre-init,-init-private">
|
||||
<property file="${user.properties.file}"/>
|
||||
<!-- The two properties below are usually overridden -->
|
||||
<!-- by the active platform. Just a fallback. -->
|
||||
<property name="default.javac.source" value="1.4"/>
|
||||
<property name="default.javac.target" value="1.4"/>
|
||||
</target>
|
||||
<target name="-init-project" depends="-pre-init,-init-private,-init-user">
|
||||
<property file="nbproject/project.properties"/>
|
||||
</target>
|
||||
<target name="-do-init" depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property">
|
||||
<available file="${manifest.file}" property="manifest.available"/>
|
||||
<condition property="manifest.available+main.class">
|
||||
<and>
|
||||
<isset property="manifest.available"/>
|
||||
<isset property="main.class"/>
|
||||
<not>
|
||||
<equals arg1="${main.class}" arg2="" trim="true"/>
|
||||
</not>
|
||||
</and>
|
||||
</condition>
|
||||
<condition property="manifest.available+main.class+mkdist.available">
|
||||
<and>
|
||||
<istrue value="${manifest.available+main.class}"/>
|
||||
<isset property="libs.CopyLibs.classpath"/>
|
||||
</and>
|
||||
</condition>
|
||||
<condition property="have.tests">
|
||||
<or>
|
||||
<available file="${test.src.dir}"/>
|
||||
</or>
|
||||
</condition>
|
||||
<condition property="have.sources">
|
||||
<or>
|
||||
<available file="${src.dir}"/>
|
||||
</or>
|
||||
</condition>
|
||||
<condition property="netbeans.home+have.tests">
|
||||
<and>
|
||||
<isset property="netbeans.home"/>
|
||||
<isset property="have.tests"/>
|
||||
</and>
|
||||
</condition>
|
||||
<condition property="no.javadoc.preview">
|
||||
<isfalse value="${javadoc.preview}"/>
|
||||
</condition>
|
||||
<property name="run.jvmargs" value=""/>
|
||||
<property name="javac.compilerargs" value=""/>
|
||||
<property name="work.dir" value="${basedir}"/>
|
||||
<condition property="no.deps">
|
||||
<and>
|
||||
<istrue value="${no.dependencies}"/>
|
||||
</and>
|
||||
</condition>
|
||||
<property name="javac.debug" value="true"/>
|
||||
<property name="javadoc.preview" value="true"/>
|
||||
</target>
|
||||
<target name="-post-init">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="-init-check" depends="-pre-init,-init-private,-init-user,-init-project,-do-init">
|
||||
<fail unless="src.dir">Must set src.dir</fail>
|
||||
<fail unless="test.src.dir">Must set test.src.dir</fail>
|
||||
<fail unless="build.dir">Must set build.dir</fail>
|
||||
<fail unless="dist.dir">Must set dist.dir</fail>
|
||||
<fail unless="build.classes.dir">Must set build.classes.dir</fail>
|
||||
<fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
|
||||
<fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
|
||||
<fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
|
||||
<fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
|
||||
<fail unless="dist.jar">Must set dist.jar</fail>
|
||||
</target>
|
||||
<target name="-init-macrodef-property">
|
||||
<macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
|
||||
<attribute name="name"/>
|
||||
<attribute name="value"/>
|
||||
<sequential>
|
||||
<property name="@{name}" value="${@{value}}"/>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target name="-init-macrodef-javac">
|
||||
<macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute name="srcdir" default="${src.dir}"/>
|
||||
<attribute name="destdir" default="${build.classes.dir}"/>
|
||||
<attribute name="classpath" default="${javac.classpath}"/>
|
||||
<attribute name="debug" default="${javac.debug}"/>
|
||||
<element name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<javac srcdir="@{srcdir}" destdir="@{destdir}" debug="@{debug}" deprecation="${javac.deprecation}" source="${javac.source}" target="${javac.target}" includeantruntime="false">
|
||||
<classpath>
|
||||
<path path="@{classpath}"/>
|
||||
</classpath>
|
||||
<compilerarg line="${javac.compilerargs}"/>
|
||||
<customize/>
|
||||
</javac>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target name="-init-macrodef-junit">
|
||||
<macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute name="includes" default="**/*Test.java"/>
|
||||
<sequential>
|
||||
<junit showoutput="true" fork="true" dir="${basedir}" failureproperty="tests.failed" errorproperty="tests.failed">
|
||||
<batchtest todir="${build.test.results.dir}">
|
||||
<fileset dir="${test.src.dir}" includes="@{includes}"/>
|
||||
</batchtest>
|
||||
<classpath>
|
||||
<path path="${run.test.classpath}"/>
|
||||
</classpath>
|
||||
<syspropertyset>
|
||||
<propertyref prefix="test-sys-prop."/>
|
||||
<mapper type="glob" from="test-sys-prop.*" to="*"/>
|
||||
</syspropertyset>
|
||||
<formatter type="brief" usefile="false"/>
|
||||
<formatter type="xml"/>
|
||||
<jvmarg line="${run.jvmargs}"/>
|
||||
</junit>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target name="-init-macrodef-nbjpda">
|
||||
<macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
|
||||
<attribute name="name" default="${main.class}"/>
|
||||
<attribute name="classpath" default="${debug.classpath}"/>
|
||||
<attribute name="stopclassname" default=""/>
|
||||
<sequential>
|
||||
<nbjpdastart transport="dt_socket" addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}">
|
||||
<classpath>
|
||||
<path path="@{classpath}"/>
|
||||
</classpath>
|
||||
</nbjpdastart>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
<macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
|
||||
<attribute name="dir" default="${build.classes.dir}"/>
|
||||
<sequential>
|
||||
<nbjpdareload>
|
||||
<fileset includes="${fix.includes}*.class" dir="@{dir}"/>
|
||||
</nbjpdareload>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target name="-init-macrodef-debug">
|
||||
<macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute name="classname" default="${main.class}"/>
|
||||
<attribute name="classpath" default="${debug.classpath}"/>
|
||||
<element name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<java fork="true" classname="@{classname}" dir="${work.dir}">
|
||||
<jvmarg value="-Xdebug"/>
|
||||
<jvmarg value="-Xnoagent"/>
|
||||
<jvmarg value="-Djava.compiler=none"/>
|
||||
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
|
||||
<jvmarg line="${run.jvmargs}"/>
|
||||
<classpath>
|
||||
<path path="@{classpath}"/>
|
||||
</classpath>
|
||||
<syspropertyset>
|
||||
<propertyref prefix="run-sys-prop."/>
|
||||
<mapper type="glob" from="run-sys-prop.*" to="*"/>
|
||||
</syspropertyset>
|
||||
<customize/>
|
||||
</java>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target name="-init-macrodef-java">
|
||||
<macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
|
||||
<attribute name="classname" default="${main.class}"/>
|
||||
<element name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<java fork="true" classname="@{classname}" dir="${work.dir}">
|
||||
<jvmarg line="${run.jvmargs}"/>
|
||||
<classpath>
|
||||
<path path="${run.classpath}"/>
|
||||
</classpath>
|
||||
<syspropertyset>
|
||||
<propertyref prefix="run-sys-prop."/>
|
||||
<mapper type="glob" from="run-sys-prop.*" to="*"/>
|
||||
</syspropertyset>
|
||||
<customize/>
|
||||
</java>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target name="-init-presetdef-jar">
|
||||
<presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
|
||||
<jar jarfile="${dist.jar}" compress="${jar.compress}">
|
||||
<j2seproject1:fileset dir="${build.classes.dir}"/>
|
||||
</jar>
|
||||
</presetdef>
|
||||
</target>
|
||||
<target name="init" depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar"/>
|
||||
<!--
|
||||
===================
|
||||
COMPILATION SECTION
|
||||
===================
|
||||
-->
|
||||
<target name="deps-jar" depends="init" unless="no.deps"/>
|
||||
<target name="-pre-pre-compile" depends="init,deps-jar">
|
||||
<mkdir dir="${build.classes.dir}"/>
|
||||
</target>
|
||||
<target name="-pre-compile">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="-do-compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile" if="have.sources">
|
||||
<j2seproject3:javac/>
|
||||
<copy todir="${build.classes.dir}">
|
||||
<fileset dir="${src.dir}" excludes="${build.classes.excludes}"/>
|
||||
</copy>
|
||||
</target>
|
||||
<target name="-post-compile">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project."/>
|
||||
<target name="-pre-compile-single">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="-do-compile-single" depends="init,deps-jar,-pre-pre-compile">
|
||||
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
|
||||
<j2seproject3:javac>
|
||||
<customize>
|
||||
<patternset includes="${javac.includes}"/>
|
||||
</customize>
|
||||
</j2seproject3:javac>
|
||||
</target>
|
||||
<target name="-post-compile-single">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="compile-single" depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single"/>
|
||||
<!--
|
||||
====================
|
||||
JAR BUILDING SECTION
|
||||
====================
|
||||
-->
|
||||
<target name="-pre-pre-jar" depends="init">
|
||||
<dirname property="dist.jar.dir" file="${dist.jar}"/>
|
||||
<mkdir dir="${dist.jar.dir}"/>
|
||||
</target>
|
||||
<target name="-pre-jar">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="-do-jar-without-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" unless="manifest.available">
|
||||
<j2seproject1:jar/>
|
||||
</target>
|
||||
<target name="-do-jar-with-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" unless="manifest.available+main.class">
|
||||
<j2seproject1:jar manifest="${manifest.file}"/>
|
||||
</target>
|
||||
<target name="-do-jar-with-mainclass" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" unless="manifest.available+main.class+mkdist.available">
|
||||
<j2seproject1:jar manifest="${manifest.file}">
|
||||
<j2seproject1:manifest>
|
||||
<j2seproject1:attribute name="Main-Class" value="${main.class}"/>
|
||||
</j2seproject1:manifest>
|
||||
</j2seproject1:jar>
|
||||
<echo>To run this application from the command line without Ant, try:</echo>
|
||||
<property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
|
||||
<property name="dist.jar.resolved" location="${dist.jar}"/>
|
||||
<pathconvert property="run.classpath.with.dist.jar">
|
||||
<path path="${run.classpath}"/>
|
||||
<map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
|
||||
</pathconvert>
|
||||
<echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
|
||||
</target>
|
||||
<target name="-do-jar-with-libraries" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available">
|
||||
<property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
|
||||
<pathconvert property="run.classpath.without.build.classes.dir">
|
||||
<path path="${run.classpath}"/>
|
||||
<map from="${build.classes.dir.resolved}" to=""/>
|
||||
</pathconvert>
|
||||
<pathconvert property="jar.classpath" pathsep=" ">
|
||||
<path path="${run.classpath.without.build.classes.dir}"/>
|
||||
<chainedmapper>
|
||||
<flattenmapper/>
|
||||
<globmapper from="*" to="lib/*"/>
|
||||
</chainedmapper>
|
||||
</pathconvert>
|
||||
<taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" name="copylibs" classpath="${libs.CopyLibs.classpath}"/>
|
||||
<copylibs manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}" jarfile="${dist.jar}" compress="${jar.compress}">
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="${main.class}"/>
|
||||
<attribute name="Class-Path" value="${jar.classpath}"/>
|
||||
</manifest>
|
||||
</copylibs>
|
||||
<echo>To run this application from the command line without Ant, try:</echo>
|
||||
<property name="dist.jar.resolved" location="${dist.jar}"/>
|
||||
<echo>java -jar "${dist.jar.resolved}"</echo>
|
||||
</target>
|
||||
<target name="-post-jar">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="jar" depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR."/>
|
||||
<!--
|
||||
=================
|
||||
EXECUTION SECTION
|
||||
=================
|
||||
-->
|
||||
<target name="run" depends="init,compile" description="Run a main class.">
|
||||
<j2seproject1:java>
|
||||
<customize>
|
||||
<arg line="${application.args}"/>
|
||||
</customize>
|
||||
</j2seproject1:java>
|
||||
</target>
|
||||
<target name="run-single" depends="init,compile-single">
|
||||
<fail unless="run.class">Must select one file in the IDE or set run.class</fail>
|
||||
<j2seproject1:java classname="${run.class}"/>
|
||||
</target>
|
||||
<!--
|
||||
=================
|
||||
DEBUGGING SECTION
|
||||
=================
|
||||
-->
|
||||
<target name="-debug-start-debugger" if="netbeans.home" depends="init">
|
||||
<j2seproject1:nbjpdastart name="${debug.class}"/>
|
||||
</target>
|
||||
<target name="-debug-start-debuggee" depends="init,compile">
|
||||
<j2seproject3:debug>
|
||||
<customize>
|
||||
<arg line="${application.args}"/>
|
||||
</customize>
|
||||
</j2seproject3:debug>
|
||||
</target>
|
||||
<target name="debug" if="netbeans.home" depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE."/>
|
||||
<target name="-debug-start-debugger-stepinto" if="netbeans.home" depends="init">
|
||||
<j2seproject1:nbjpdastart stopclassname="${main.class}"/>
|
||||
</target>
|
||||
<target name="debug-stepinto" if="netbeans.home" depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee"/>
|
||||
<target name="-debug-start-debuggee-single" if="netbeans.home" depends="init,compile-single">
|
||||
<fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
|
||||
<j2seproject3:debug classname="${debug.class}"/>
|
||||
</target>
|
||||
<target name="debug-single" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single"/>
|
||||
<target name="-pre-debug-fix" depends="init">
|
||||
<fail unless="fix.includes">Must set fix.includes</fail>
|
||||
<property name="javac.includes" value="${fix.includes}.java"/>
|
||||
</target>
|
||||
<target name="-do-debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,compile-single">
|
||||
<j2seproject1:nbjpdareload/>
|
||||
</target>
|
||||
<target name="debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix"/>
|
||||
<!--
|
||||
===============
|
||||
JAVADOC SECTION
|
||||
===============
|
||||
-->
|
||||
<target name="-javadoc-build" depends="init">
|
||||
<mkdir dir="${dist.javadoc.dir}"/>
|
||||
<javadoc destdir="${dist.javadoc.dir}" source="${javac.source}" notree="${javadoc.notree}" use="${javadoc.use}" nonavbar="${javadoc.nonavbar}" noindex="${javadoc.noindex}" splitindex="${javadoc.splitindex}" author="${javadoc.author}" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}" private="${javadoc.private}" additionalparam="${javadoc.additionalparam}" failonerror="true" useexternalfile="true">
|
||||
<classpath>
|
||||
<path path="${javac.classpath}"/>
|
||||
</classpath>
|
||||
<sourcepath>
|
||||
<pathelement location="${src.dir}"/>
|
||||
</sourcepath>
|
||||
<packageset dir="${src.dir}" includes="*/**"/>
|
||||
<fileset dir="${src.dir}" includes="*.java"/>
|
||||
</javadoc>
|
||||
</target>
|
||||
<target name="-javadoc-browse" if="netbeans.home" unless="no.javadoc.preview" depends="init,-javadoc-build">
|
||||
<nbbrowse file="${dist.javadoc.dir}/index.html"/>
|
||||
</target>
|
||||
<target name="javadoc" depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc."/>
|
||||
<!--
|
||||
=========================
|
||||
JUNIT COMPILATION SECTION
|
||||
=========================
|
||||
-->
|
||||
<target name="-pre-pre-compile-test" if="have.tests" depends="init,compile">
|
||||
<mkdir dir="${build.test.classes.dir}"/>
|
||||
</target>
|
||||
<target name="-pre-compile-test">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="-do-compile-test" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test">
|
||||
<j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}"/>
|
||||
<copy todir="${build.test.classes.dir}">
|
||||
<fileset dir="${test.src.dir}" excludes="**/*.java"/>
|
||||
</copy>
|
||||
</target>
|
||||
<target name="-post-compile-test">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="compile-test" depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test"/>
|
||||
<target name="-pre-compile-test-single">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="-do-compile-test-single" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single">
|
||||
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
|
||||
<j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}">
|
||||
<customize>
|
||||
<patternset includes="${javac.includes}"/>
|
||||
</customize>
|
||||
</j2seproject3:javac>
|
||||
<copy todir="${build.test.classes.dir}">
|
||||
<fileset dir="${test.src.dir}" excludes="**/*.java"/>
|
||||
</copy>
|
||||
</target>
|
||||
<target name="-post-compile-test-single">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="compile-test-single" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single"/>
|
||||
<!--
|
||||
=======================
|
||||
JUNIT EXECUTION SECTION
|
||||
=======================
|
||||
-->
|
||||
<target name="-pre-test-run" if="have.tests" depends="init">
|
||||
<mkdir dir="${build.test.results.dir}"/>
|
||||
</target>
|
||||
<target name="-do-test-run" if="have.tests" depends="init,compile-test,-pre-test-run">
|
||||
<j2seproject3:junit/>
|
||||
</target>
|
||||
<target name="-post-test-run" if="have.tests" depends="init,compile-test,-pre-test-run,-do-test-run">
|
||||
<fail if="tests.failed">Some tests failed; see details above.</fail>
|
||||
</target>
|
||||
<target name="test-report" if="have.tests" depends="init"/>
|
||||
<target name="-test-browse" if="netbeans.home+have.tests" depends="init"/>
|
||||
<target name="test" depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests."/>
|
||||
<target name="-pre-test-run-single" if="have.tests" depends="init">
|
||||
<mkdir dir="${build.test.results.dir}"/>
|
||||
</target>
|
||||
<target name="-do-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single">
|
||||
<fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
|
||||
<j2seproject3:junit includes="${test.includes}"/>
|
||||
</target>
|
||||
<target name="-post-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single">
|
||||
<fail if="tests.failed">Some tests failed; see details above.</fail>
|
||||
</target>
|
||||
<target name="test-single" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test."/>
|
||||
<!--
|
||||
=======================
|
||||
JUNIT DEBUGGING SECTION
|
||||
=======================
|
||||
-->
|
||||
<target name="-debug-start-debuggee-test" if="have.tests" depends="init,compile-test">
|
||||
<fail unless="test.class">Must select one file in the IDE or set test.class</fail>
|
||||
<j2seproject3:debug classname="junit.textui.TestRunner" classpath="${debug.test.classpath}">
|
||||
<customize>
|
||||
<arg line="${test.class}"/>
|
||||
</customize>
|
||||
</j2seproject3:debug>
|
||||
</target>
|
||||
<target name="-debug-start-debugger-test" if="netbeans.home+have.tests" depends="init,compile-test">
|
||||
<j2seproject1:nbjpdastart name="${test.class}" classpath="${debug.test.classpath}"/>
|
||||
</target>
|
||||
<target name="debug-test" depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test"/>
|
||||
<target name="-do-debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,compile-test-single">
|
||||
<j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
|
||||
</target>
|
||||
<target name="debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix-test"/>
|
||||
<!--
|
||||
=========================
|
||||
APPLET EXECUTION SECTION
|
||||
=========================
|
||||
-->
|
||||
<target name="run-applet" depends="init,compile-single">
|
||||
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
|
||||
<j2seproject1:java classname="sun.applet.AppletViewer">
|
||||
<customize>
|
||||
<arg value="${applet.url}"/>
|
||||
</customize>
|
||||
</j2seproject1:java>
|
||||
</target>
|
||||
<!--
|
||||
=========================
|
||||
APPLET DEBUGGING SECTION
|
||||
=========================
|
||||
-->
|
||||
<target name="-debug-start-debuggee-applet" if="netbeans.home" depends="init,compile-single">
|
||||
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
|
||||
<j2seproject3:debug classname="sun.applet.AppletViewer">
|
||||
<customize>
|
||||
<arg value="${applet.url}"/>
|
||||
</customize>
|
||||
</j2seproject3:debug>
|
||||
</target>
|
||||
<target name="debug-applet" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet"/>
|
||||
<!--
|
||||
===============
|
||||
CLEANUP SECTION
|
||||
===============
|
||||
-->
|
||||
<target name="deps-clean" depends="init" unless="no.deps"/>
|
||||
<target name="-do-clean" depends="init">
|
||||
<delete dir="${build.dir}"/>
|
||||
<delete dir="${dist.dir}"/>
|
||||
</target>
|
||||
<target name="-post-clean">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target name="clean" depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products."/>
|
||||
</project>
|
||||
@@ -0,0 +1,8 @@
|
||||
build.xml.data.CRC32=94714fd7
|
||||
build.xml.script.CRC32=64128189
|
||||
build.xml.stylesheet.CRC32=240b97a2
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=94714fd7
|
||||
nbproject/build-impl.xml.script.CRC32=9d2a0176
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=65d7ca21
|
||||
@@ -0,0 +1,6 @@
|
||||
application.args=
|
||||
file.reference.jna.jar=D:\\temp\\JnaContrib\\lib\\jna.jar
|
||||
javac.debug=true
|
||||
javadoc.preview=true
|
||||
jaxws.endorsed.dir=D:\\Program Files\\netbeans551\\ide7\\modules\\ext\\jaxws21\\api
|
||||
user.properties.file=C:\\Users\\tb\\.netbeans\\5.5.1\\build.properties
|
||||
@@ -0,0 +1,58 @@
|
||||
application.args=
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/JnaContrib.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
file.reference.jna.jar=lib/jna.jar
|
||||
jar.compress=false
|
||||
javac.classpath=\
|
||||
${file.reference.jna.jar}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.source=1.6
|
||||
javac.target=1.6
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}:\
|
||||
${libs.junit.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
main.class=
|
||||
manifest.file=manifest.mf
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project
|
||||
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
|
||||
# or test-sys-prop.name=value to set system properties for unit tests):
|
||||
run.jvmargs=
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
src.dir=src
|
||||
test.src.dir=test
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.java.j2seproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>JnaContrib</name>
|
||||
<minimum-ant-version>1.6.5</minimum-ant-version>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
<test-roots>
|
||||
<root id="test.src.dir"/>
|
||||
</test-roots>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
||||
@@ -0,0 +1,335 @@
|
||||
/*
|
||||
* Advapi32.java
|
||||
*
|
||||
* Created on 6. August 2007, 11:24
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.jna;
|
||||
|
||||
import com.sun.jna.*;
|
||||
import com.sun.jna.ptr.*;
|
||||
import com.sun.jna.win32.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TB
|
||||
*/
|
||||
public interface Advapi32 extends StdCallLibrary {
|
||||
Advapi32 INSTANCE = (Advapi32) Native.loadLibrary("Advapi32", Advapi32.class, Options.UNICODE_OPTIONS);
|
||||
|
||||
/*
|
||||
BOOL WINAPI LookupAccountName(
|
||||
LPCTSTR lpSystemName,
|
||||
LPCTSTR lpAccountName,
|
||||
PSID Sid,
|
||||
LPDWORD cbSid,
|
||||
LPTSTR ReferencedDomainName,
|
||||
LPDWORD cchReferencedDomainName,
|
||||
PSID_NAME_USE peUse
|
||||
);*/
|
||||
public boolean LookupAccountName(String lpSystemName, String lpAccountName,
|
||||
byte[] Sid, IntByReference cbSid, char[] ReferencedDomainName,
|
||||
IntByReference cchReferencedDomainName, PointerByReference peUse);
|
||||
|
||||
/*
|
||||
BOOL WINAPI LookupAccountSid(
|
||||
LPCTSTR lpSystemName,
|
||||
PSID lpSid,
|
||||
LPTSTR lpName,
|
||||
LPDWORD cchName,
|
||||
LPTSTR lpReferencedDomainName,
|
||||
LPDWORD cchReferencedDomainName,
|
||||
PSID_NAME_USE peUse
|
||||
);*/
|
||||
public boolean LookupAccountSid(String lpSystemName, byte[] Sid,
|
||||
char[] lpName, IntByReference cchName, char[] ReferencedDomainName,
|
||||
IntByReference cchReferencedDomainName, PointerByReference peUse);
|
||||
|
||||
/*
|
||||
BOOL ConvertSidToStringSid(
|
||||
PSID Sid,
|
||||
LPTSTR* StringSid
|
||||
);*/
|
||||
public boolean ConvertSidToStringSid(byte[] Sid, PointerByReference StringSid);
|
||||
|
||||
/*
|
||||
BOOL WINAPI ConvertStringSidToSid(
|
||||
LPCTSTR StringSid,
|
||||
PSID* Sid
|
||||
);*/
|
||||
public boolean ConvertStringSidToSid(String StringSid, PointerByReference Sid);
|
||||
|
||||
/*
|
||||
SC_HANDLE WINAPI OpenSCManager(
|
||||
LPCTSTR lpMachineName,
|
||||
LPCTSTR lpDatabaseName,
|
||||
DWORD dwDesiredAccess
|
||||
);*/
|
||||
public Pointer OpenSCManager(String lpMachineName, WString lpDatabaseName, int dwDesiredAccess);
|
||||
|
||||
/*
|
||||
BOOL WINAPI CloseServiceHandle(
|
||||
SC_HANDLE hSCObject
|
||||
);*/
|
||||
public boolean CloseServiceHandle(Pointer hSCObject);
|
||||
|
||||
/*
|
||||
SC_HANDLE WINAPI OpenService(
|
||||
SC_HANDLE hSCManager,
|
||||
LPCTSTR lpServiceName,
|
||||
DWORD dwDesiredAccess
|
||||
);*/
|
||||
public Pointer OpenService(Pointer hSCManager, String lpServiceName, int dwDesiredAccess);
|
||||
|
||||
/*
|
||||
BOOL WINAPI StartService(
|
||||
SC_HANDLE hService,
|
||||
DWORD dwNumServiceArgs,
|
||||
LPCTSTR* lpServiceArgVectors
|
||||
);*/
|
||||
public boolean StartService(Pointer hService, int dwNumServiceArgs, char[] lpServiceArgVectors);
|
||||
|
||||
/*
|
||||
BOOL WINAPI ControlService(
|
||||
SC_HANDLE hService,
|
||||
DWORD dwControl,
|
||||
LPSERVICE_STATUS lpServiceStatus
|
||||
);*/
|
||||
public boolean ControlService(Pointer hService, int dwControl, SERVICE_STATUS lpServiceStatus);
|
||||
|
||||
/*
|
||||
BOOL WINAPI StartServiceCtrlDispatcher(
|
||||
const SERVICE_TABLE_ENTRY* lpServiceTable
|
||||
);*/
|
||||
public boolean StartServiceCtrlDispatcher(Structure[] lpServiceTable);
|
||||
|
||||
/*
|
||||
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandler(
|
||||
LPCTSTR lpServiceName,
|
||||
LPHANDLER_FUNCTION lpHandlerProc
|
||||
);*/
|
||||
public Pointer RegisterServiceCtrlHandler(String lpServiceName, Handler lpHandlerProc);
|
||||
|
||||
/*
|
||||
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerEx(
|
||||
LPCTSTR lpServiceName,
|
||||
LPHANDLER_FUNCTION_EX lpHandlerProc,
|
||||
LPVOID lpContext
|
||||
);*/
|
||||
public Pointer RegisterServiceCtrlHandlerEx(String lpServiceName, HandlerEx lpHandlerProc, Pointer lpContext);
|
||||
|
||||
/*
|
||||
BOOL WINAPI SetServiceStatus(
|
||||
SERVICE_STATUS_HANDLE hServiceStatus,
|
||||
LPSERVICE_STATUS lpServiceStatus
|
||||
);*/
|
||||
public boolean SetServiceStatus(Pointer hServiceStatus, SERVICE_STATUS lpServiceStatus);
|
||||
|
||||
/*
|
||||
SC_HANDLE WINAPI CreateService(
|
||||
SC_HANDLE hSCManager,
|
||||
LPCTSTR lpServiceName,
|
||||
LPCTSTR lpDisplayName,
|
||||
DWORD dwDesiredAccess,
|
||||
DWORD dwServiceType,
|
||||
DWORD dwStartType,
|
||||
DWORD dwErrorControl,
|
||||
LPCTSTR lpBinaryPathName,
|
||||
LPCTSTR lpLoadOrderGroup,
|
||||
LPDWORD lpdwTagId,
|
||||
LPCTSTR lpDependencies,
|
||||
LPCTSTR lpServiceStartName,
|
||||
LPCTSTR lpPassword
|
||||
);*/
|
||||
public Pointer CreateService(Pointer hSCManager, String lpServiceName, String lpDisplayName,
|
||||
int dwDesiredAccess, int dwServiceType, int dwStartType, int dwErrorControl,
|
||||
String lpBinaryPathName, String lpLoadOrderGroup, IntByReference lpdwTagId,
|
||||
String lpDependencies, String lpServiceStartName, String lpPassword);
|
||||
|
||||
/*
|
||||
BOOL WINAPI DeleteService(
|
||||
SC_HANDLE hService
|
||||
);*/
|
||||
public boolean DeleteService(Pointer hService);
|
||||
|
||||
/*
|
||||
BOOL WINAPI ChangeServiceConfig2(
|
||||
SC_HANDLE hService,
|
||||
DWORD dwInfoLevel,
|
||||
LPVOID lpInfo
|
||||
);*/
|
||||
public boolean ChangeServiceConfig2(Pointer hService, int dwInfoLevel, ChangeServiceConfig2Info lpInfo);
|
||||
|
||||
/*
|
||||
LONG WINAPI RegOpenKeyEx(
|
||||
HKEY hKey,
|
||||
LPCTSTR lpSubKey,
|
||||
DWORD ulOptions,
|
||||
REGSAM samDesired,
|
||||
PHKEY phkResult
|
||||
);*/
|
||||
public int RegOpenKeyEx(int hKey, String lpSubKey, int ulOptions, int samDesired, IntByReference phkResult);
|
||||
|
||||
/*
|
||||
LONG WINAPI RegQueryValueEx(
|
||||
HKEY hKey,
|
||||
LPCTSTR lpValueName,
|
||||
LPDWORD lpReserved,
|
||||
LPDWORD lpType,
|
||||
LPBYTE lpData,
|
||||
LPDWORD lpcbData
|
||||
);*/
|
||||
public int RegQueryValueEx(int hKey, String lpValueName, IntByReference lpReserved, IntByReference lpType, byte[] lpData, IntByReference lpcbData);
|
||||
|
||||
/*
|
||||
LONG WINAPI RegCloseKey(
|
||||
HKEY hKey
|
||||
);*/
|
||||
public int RegCloseKey(int hKey);
|
||||
|
||||
/*
|
||||
LONG WINAPI RegDeleteValue(
|
||||
HKEY hKey,
|
||||
LPCTSTR lpValueName
|
||||
);*/
|
||||
public int RegDeleteValue(int hKey, String lpValueName);
|
||||
|
||||
/*
|
||||
LONG WINAPI RegSetValueEx(
|
||||
HKEY hKey,
|
||||
LPCTSTR lpValueName,
|
||||
DWORD Reserved,
|
||||
DWORD dwType,
|
||||
const BYTE* lpData,
|
||||
DWORD cbData
|
||||
);*/
|
||||
public int RegSetValueEx(int hKey, String lpValueName, int Reserved, int dwType, byte[] lpData, int cbData);
|
||||
|
||||
/*
|
||||
LONG WINAPI RegCreateKeyEx(
|
||||
HKEY hKey,
|
||||
LPCTSTR lpSubKey,
|
||||
DWORD Reserved,
|
||||
LPTSTR lpClass,
|
||||
DWORD dwOptions,
|
||||
REGSAM samDesired,
|
||||
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
||||
PHKEY phkResult,
|
||||
LPDWORD lpdwDisposition
|
||||
);*/
|
||||
public int RegCreateKeyEx(int hKey, String lpSubKey, int Reserved, String lpClass, int dwOptions,
|
||||
int samDesired, WINBASE.SECURITY_ATTRIBUTES lpSecurityAttributes, IntByReference phkResult,
|
||||
IntByReference lpdwDisposition);
|
||||
|
||||
/*
|
||||
LONG WINAPI RegDeleteKey(
|
||||
HKEY hKey,
|
||||
LPCTSTR lpSubKey
|
||||
);*/
|
||||
public int RegDeleteKey(int hKey, String name);
|
||||
|
||||
/*
|
||||
LONG WINAPI RegEnumKeyEx(
|
||||
HKEY hKey,
|
||||
DWORD dwIndex,
|
||||
LPTSTR lpName,
|
||||
LPDWORD lpcName,
|
||||
LPDWORD lpReserved,
|
||||
LPTSTR lpClass,
|
||||
LPDWORD lpcClass,
|
||||
PFILETIME lpftLastWriteTime
|
||||
);*/
|
||||
public int RegEnumKeyEx(int hKey, int dwIndex, char[] lpName, IntByReference lpcName, IntByReference reserved,
|
||||
char[] lpClass, IntByReference lpcClass, WINBASE.FILETIME lpftLastWriteTime);
|
||||
|
||||
/*
|
||||
LONG WINAPI RegEnumValue(
|
||||
HKEY hKey,
|
||||
DWORD dwIndex,
|
||||
LPTSTR lpValueName,
|
||||
LPDWORD lpcchValueName,
|
||||
LPDWORD lpReserved,
|
||||
LPDWORD lpType,
|
||||
LPBYTE lpData,
|
||||
LPDWORD lpcbData
|
||||
);*/
|
||||
public int RegEnumValue(int hKey, int dwIndex, char[] lpValueName, IntByReference lpcchValueName, IntByReference reserved,
|
||||
IntByReference lpType, byte[] lpData, IntByReference lpcbData);
|
||||
|
||||
interface SERVICE_MAIN_FUNCTION extends StdCallCallback {
|
||||
/*
|
||||
VOID WINAPI ServiceMain(
|
||||
DWORD dwArgc,
|
||||
LPTSTR* lpszArgv
|
||||
);*/
|
||||
public void callback(int dwArgc, Pointer lpszArgv);
|
||||
}
|
||||
|
||||
interface Handler extends StdCallCallback {
|
||||
/*
|
||||
VOID WINAPI Handler(
|
||||
DWORD fdwControl
|
||||
);*/
|
||||
public void callback(int fdwControl);
|
||||
}
|
||||
|
||||
interface HandlerEx extends StdCallCallback {
|
||||
/*
|
||||
DWORD WINAPI HandlerEx(
|
||||
DWORD dwControl,
|
||||
DWORD dwEventType,
|
||||
LPVOID lpEventData,
|
||||
LPVOID lpContext
|
||||
);*/
|
||||
public int callback(int dwControl, int dwEventType, Pointer lpEventData, Pointer lpContext);
|
||||
}
|
||||
|
||||
/*
|
||||
typedef struct _SERVICE_STATUS {
|
||||
DWORD dwServiceType;
|
||||
DWORD dwCurrentState;
|
||||
DWORD dwControlsAccepted;
|
||||
DWORD dwWin32ExitCode;
|
||||
DWORD dwServiceSpecificExitCode;
|
||||
DWORD dwCheckPoint;
|
||||
DWORD dwWaitHint;
|
||||
} SERVICE_STATUS,
|
||||
*LPSERVICE_STATUS;*/
|
||||
public static class SERVICE_STATUS extends Structure {
|
||||
public int dwServiceType;
|
||||
public int dwCurrentState;
|
||||
public int dwControlsAccepted;
|
||||
public int dwWin32ExitCode;
|
||||
public int dwServiceSpecificExitCode;
|
||||
public int dwCheckPoint;
|
||||
public int dwWaitHint;
|
||||
}
|
||||
|
||||
/*
|
||||
typedef struct _SERVICE_TABLE_ENTRY {
|
||||
LPTSTR lpServiceName;
|
||||
LPSERVICE_MAIN_FUNCTION lpServiceProc;
|
||||
} SERVICE_TABLE_ENTRY,
|
||||
*LPSERVICE_TABLE_ENTRY;*/
|
||||
public static class SERVICE_TABLE_ENTRY extends Structure {
|
||||
public String lpServiceName;
|
||||
public SERVICE_MAIN_FUNCTION lpServiceProc;
|
||||
}
|
||||
|
||||
public static class ChangeServiceConfig2Info extends Structure {
|
||||
}
|
||||
|
||||
/*
|
||||
typedef struct _SERVICE_DESCRIPTION {
|
||||
LPTSTR lpDescription;
|
||||
} SERVICE_DESCRIPTION,
|
||||
*LPSERVICE_DESCRIPTION;*/
|
||||
public static class SERVICE_DESCRIPTION extends ChangeServiceConfig2Info {
|
||||
public String lpDescription;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Kernel32b.java
|
||||
*
|
||||
* Created on 6. August 2007, 14:43
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.jna;
|
||||
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.win32.StdCallLibrary;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TB
|
||||
*/
|
||||
public interface Kernel32b extends StdCallLibrary {
|
||||
Kernel32b INSTANCE = (Kernel32b) Native.loadLibrary("Kernel32", Kernel32b.class, Options.UNICODE_OPTIONS);
|
||||
|
||||
/*
|
||||
HLOCAL WINAPI LocalFree(
|
||||
HLOCAL hMem
|
||||
);*/
|
||||
public Pointer LocalFree(Pointer hMem);
|
||||
/*
|
||||
|
||||
DWORD WINAPI GetLastError(void);*/
|
||||
public int GetLastError();
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* LMACCESS.java
|
||||
*
|
||||
* Created on 7. August 2007, 12:42
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.jna;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TB
|
||||
*/
|
||||
public interface LMACCESS {
|
||||
public final static int FILTER_NORMAL_ACCOUNT = 2;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* LMCONS.java
|
||||
*
|
||||
* Created on 7. August 2007, 08:46
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.jna;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TB
|
||||
*/
|
||||
public interface LMCONS {
|
||||
public final static int MAX_PREFERRED_LENGTH = -1;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* LMERR.java
|
||||
*
|
||||
* Created on 7. August 2007, 08:22
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.jna;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TB
|
||||
*/
|
||||
public interface LMERR {
|
||||
public final static int NERR_Success = 0;
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
/*
|
||||
* Netapi32.java
|
||||
*
|
||||
* Created on 2. August 2007, 13:12
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.jna;
|
||||
|
||||
import com.sun.jna.*;
|
||||
import com.sun.jna.ptr.*;
|
||||
import com.sun.jna.win32.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TB
|
||||
*/
|
||||
public interface Netapi32 extends StdCallLibrary {
|
||||
Netapi32 INSTANCE = (Netapi32) Native.loadLibrary("Netapi32", Netapi32.class, Options.UNICODE_OPTIONS);
|
||||
/*
|
||||
NET_API_STATUS NetGetDCName(
|
||||
LPCWSTR servername,
|
||||
LPCWSTR domainname,
|
||||
LPBYTE* bufptr
|
||||
);*/
|
||||
public int NetGetDCName(String serverName, String domainName, PointerByReference bufptr);
|
||||
|
||||
/*
|
||||
DWORD DsGetDcName(
|
||||
LPCTSTR ComputerName,
|
||||
LPCTSTR DomainName,
|
||||
GUID* DomainGuid,
|
||||
LPCTSTR SiteName,
|
||||
ULONG Flags,
|
||||
PDOMAIN_CONTROLLER_INFO* DomainControllerInfo
|
||||
);*/
|
||||
public int DsGetDcName(String ComputerName, String DomainName, ByReference DomainGuid,
|
||||
String SiteName, int Flags, PointerByReference DomainControllerInfo);
|
||||
|
||||
/*
|
||||
NET_API_STATUS NetUserGetGroups(
|
||||
LPCWSTR servername,
|
||||
LPCWSTR username,
|
||||
DWORD level,
|
||||
LPBYTE* bufptr,
|
||||
DWORD prefmaxlen,
|
||||
LPDWORD entriesread,
|
||||
LPDWORD totalentries
|
||||
);*/
|
||||
public int NetUserGetGroups(String servername, String username, int level,
|
||||
PointerByReference bufptr, int prefmaxlen,
|
||||
IntByReference entriesread, IntByReference totalentries);
|
||||
|
||||
/*
|
||||
NET_API_STATUS NetUserGetLocalGroups(
|
||||
LPCWSTR servername,
|
||||
LPCWSTR username,
|
||||
DWORD level,
|
||||
DWORD flags,
|
||||
LPBYTE* bufptr,
|
||||
DWORD prefmaxlen,
|
||||
LPDWORD entriesread,
|
||||
LPDWORD totalentries
|
||||
);*/
|
||||
public int NetUserGetLocalGroups(String servername, String username, int level,
|
||||
int flags, PointerByReference bufptr, int prefmaxlen,
|
||||
IntByReference entriesread, IntByReference totalentries);
|
||||
|
||||
/*
|
||||
NET_API_STATUS NetGroupEnum(
|
||||
LPCWSTR servername,
|
||||
DWORD level,
|
||||
LPBYTE* bufptr,
|
||||
DWORD prefmaxlen,
|
||||
LPDWORD entriesread,
|
||||
LPDWORD totalentries,
|
||||
PDWORD_PTR resume_handle
|
||||
);*/
|
||||
public int NetGroupEnum(String servername, int level, PointerByReference bufptr,
|
||||
int prefmaxlen, IntByReference entriesread, IntByReference totalentries,
|
||||
IntByReference resume_handle);
|
||||
|
||||
/*
|
||||
NET_API_STATUS NetUserEnum(
|
||||
LPCWSTR servername,
|
||||
DWORD level,
|
||||
DWORD filter,
|
||||
LPBYTE* bufptr,
|
||||
DWORD prefmaxlen,
|
||||
LPDWORD entriesread,
|
||||
LPDWORD totalentries,
|
||||
LPDWORD resume_handle
|
||||
);*/
|
||||
public int NetUserEnum(String servername, int level, int filter, PointerByReference bufptr,
|
||||
int prefmaxlen, IntByReference entriesread, IntByReference totalentries,
|
||||
IntByReference resume_handle);
|
||||
|
||||
/*
|
||||
NET_API_STATUS NetApiBufferFree(
|
||||
LPVOID Buffer
|
||||
);*/
|
||||
public int NetApiBufferFree(Pointer Buffer);
|
||||
|
||||
/*
|
||||
typedef struct _GUID {
|
||||
DWORD Data1;
|
||||
WORD Data2;
|
||||
WORD Data3;
|
||||
BYTE Data4[8];
|
||||
} GUID;
|
||||
*/
|
||||
public static class GUID extends Structure {
|
||||
public GUID() {
|
||||
super();
|
||||
}
|
||||
|
||||
public GUID(Pointer memory) {
|
||||
useMemory(memory);
|
||||
read();
|
||||
}
|
||||
|
||||
public int Data1;
|
||||
public short Data2;
|
||||
public short Data3;
|
||||
public byte[] Data4 = new byte[8];
|
||||
}
|
||||
|
||||
/*
|
||||
typedef struct _DOMAIN_CONTROLLER_INFO {
|
||||
LPTSTR DomainControllerName;
|
||||
LPTSTR DomainControllerAddress;
|
||||
ULONG DomainControllerAddressType;
|
||||
GUID DomainGuid;
|
||||
LPTSTR DomainName;
|
||||
LPTSTR DnsForestName;
|
||||
ULONG Flags;
|
||||
LPTSTR DcSiteName;
|
||||
LPTSTR ClientSiteName;
|
||||
} DOMAIN_CONTROLLER_INFO,
|
||||
*/
|
||||
public static class DOMAIN_CONTROLLER_INFO extends Structure {
|
||||
public DOMAIN_CONTROLLER_INFO(Pointer memory) {
|
||||
useMemory(memory);
|
||||
read();
|
||||
}
|
||||
|
||||
public String DomainControllerName;
|
||||
public String DomainControllerAddress;
|
||||
public int DomainControllerAddressType;
|
||||
public GUID DomainGuid;
|
||||
public String DomainName;
|
||||
public String DnsForestName;
|
||||
public int Flags;
|
||||
public String DcSiteName;
|
||||
public String ClientSiteName;
|
||||
}
|
||||
|
||||
/*
|
||||
typedef struct _GROUP_USERS_INFO_0 {
|
||||
LPWSTR grui0_name;
|
||||
} GROUP_USERS_INFO_0,
|
||||
*PGROUP_USERS_INFO_0,
|
||||
*LPGROUP_USERS_INFO_0;
|
||||
*/
|
||||
public static class GROUP_USERS_INFO_0 extends Structure {
|
||||
public GROUP_USERS_INFO_0() {
|
||||
super();
|
||||
}
|
||||
|
||||
public GROUP_USERS_INFO_0(Pointer memory) {
|
||||
useMemory(memory);
|
||||
read();
|
||||
}
|
||||
|
||||
public String grui0_name;
|
||||
}
|
||||
|
||||
/*
|
||||
typedef struct _LOCALGROUP_USERS_INFO_0 {
|
||||
LPWSTR lgrui0_name;
|
||||
} LOCALGROUP_USERS_INFO_0,
|
||||
*PLOCALGROUP_USERS_INFO_0,
|
||||
*LPLOCALGROUP_USERS_INFO_0;
|
||||
*/
|
||||
public static class LOCALGROUP_USERS_INFO_0 extends Structure {
|
||||
public LOCALGROUP_USERS_INFO_0() {
|
||||
super();
|
||||
}
|
||||
|
||||
public LOCALGROUP_USERS_INFO_0(Pointer memory) {
|
||||
useMemory(memory);
|
||||
read();
|
||||
}
|
||||
|
||||
public String lgrui0_name;
|
||||
}
|
||||
|
||||
/*
|
||||
typedef struct _GROUP_INFO_0 {
|
||||
LPWSTR grpi0_name;
|
||||
} GROUP_INFO_0,
|
||||
*PGROUP_INFO_0,
|
||||
*LPGROUP_INFO_0;
|
||||
*/
|
||||
public static class GROUP_INFO_0 extends Structure {
|
||||
public GROUP_INFO_0() {
|
||||
super();
|
||||
}
|
||||
|
||||
public GROUP_INFO_0(Pointer memory) {
|
||||
useMemory(memory);
|
||||
read();
|
||||
}
|
||||
|
||||
public String grpi0_name;
|
||||
}
|
||||
|
||||
/*
|
||||
typedef struct _USER_INFO_0 {
|
||||
LPWSTR usri0_name;
|
||||
} USER_INFO_0,
|
||||
*PUSER_INFO_0,
|
||||
*LPUSER_INFO_0;*/
|
||||
public static class USER_INFO_0 extends Structure {
|
||||
public USER_INFO_0() {
|
||||
super();
|
||||
}
|
||||
|
||||
public USER_INFO_0(Pointer memory) {
|
||||
useMemory(memory);
|
||||
read();
|
||||
}
|
||||
|
||||
public String usri0_name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Options.java
|
||||
*
|
||||
* Created on 8. August 2007, 17:07
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.jna;
|
||||
|
||||
import static com.sun.jna.Library.*;
|
||||
import com.sun.jna.TypeMapper;
|
||||
import com.sun.jna.win32.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TB
|
||||
*/
|
||||
public interface Options {
|
||||
Map<String, Object> UNICODE_OPTIONS = new HashMap<String, Object>() {
|
||||
{
|
||||
put(OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE);
|
||||
put(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* WINBASE.java
|
||||
*
|
||||
* Created on 5. September 2007, 11:24
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.jna;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TB
|
||||
*/
|
||||
public interface WINBASE {
|
||||
/*
|
||||
typedef struct _SECURITY_ATTRIBUTES {
|
||||
DWORD nLength;
|
||||
LPVOID lpSecurityDescriptor;
|
||||
BOOL bInheritHandle;
|
||||
} SECURITY_ATTRIBUTES,
|
||||
*PSECURITY_ATTRIBUTES,
|
||||
*LPSECURITY_ATTRIBUTES;*/
|
||||
public static class SECURITY_ATTRIBUTES extends Structure {
|
||||
public int nLength;
|
||||
public Pointer lpSecurityDescriptor;
|
||||
public boolean bInheritHandle;
|
||||
}
|
||||
|
||||
/*
|
||||
typedef struct _FILETIME {
|
||||
DWORD dwLowDateTime;
|
||||
DWORD dwHighDateTime;
|
||||
} FILETIME, *PFILETIME, *LPFILETIME;*/
|
||||
public static class FILETIME extends Structure {
|
||||
public int dwLowDateTime;
|
||||
public int dwHighDateTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* WINERROR.java
|
||||
*
|
||||
* Created on 7. August 2007, 08:09
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.jna;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TB
|
||||
*/
|
||||
public interface WINERROR {
|
||||
public final static int ERROR_SUCCESS = 0;
|
||||
public final static int NO_ERROR = 0;
|
||||
public final static int ERROR_FILE_NOT_FOUND = 2;
|
||||
public final static int ERROR_MORE_DATA = 234;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* WINNT.java
|
||||
*
|
||||
* Created on 8. August 2007, 13:41
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.jna;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TB
|
||||
*/
|
||||
public interface WINNT {
|
||||
public final static int DELETE = 0x00010000;
|
||||
public final static int READ_CONTROL = 0x00020000;
|
||||
public final static int WRITE_DAC = 0x00040000;
|
||||
public final static int WRITE_OWNER = 0x00080000;
|
||||
public final static int SYNCHRONIZE = 0x00100000;
|
||||
|
||||
public final static int STANDARD_RIGHTS_REQUIRED = 0x000F0000;
|
||||
|
||||
public final static int STANDARD_RIGHTS_READ = READ_CONTROL;
|
||||
public final static int STANDARD_RIGHTS_WRITE = READ_CONTROL;
|
||||
public final static int STANDARD_RIGHTS_EXECUTE = READ_CONTROL;
|
||||
|
||||
public final static int STANDARD_RIGHTS_ALL = 0x001F0000;
|
||||
|
||||
public final static int SPECIFIC_RIGHTS_ALL = 0x0000FFFF;
|
||||
|
||||
public final static int GENERIC_EXECUTE = 0x20000000;
|
||||
|
||||
public final static int SERVICE_WIN32_OWN_PROCESS = 0x00000010;
|
||||
|
||||
public final static int KEY_QUERY_VALUE = 0x0001;
|
||||
public final static int KEY_SET_VALUE = 0x0002;
|
||||
public final static int KEY_CREATE_SUB_KEY = 0x0004;
|
||||
public final static int KEY_ENUMERATE_SUB_KEYS = 0x0008;
|
||||
public final static int KEY_NOTIFY = 0x0010;
|
||||
public final static int KEY_CREATE_LINK = 0x0020;
|
||||
|
||||
public final static int KEY_READ = ((STANDARD_RIGHTS_READ | KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY) & (~SYNCHRONIZE));
|
||||
public final static int KEY_WRITE = ((STANDARD_RIGHTS_WRITE | KEY_SET_VALUE | KEY_CREATE_SUB_KEY) & (~SYNCHRONIZE));
|
||||
|
||||
public final static int REG_NONE = 0; // No value type
|
||||
public final static int REG_SZ = 1; // Unicode nul terminated string
|
||||
public final static int REG_EXPAND_SZ = 2; // Unicode nul terminated string
|
||||
// (with environment variable references)
|
||||
public final static int REG_BINARY = 3; // Free form binary
|
||||
public final static int REG_DWORD = 4; // 32-bit number
|
||||
public final static int REG_DWORD_LITTLE_ENDIAN = 4; // 32-bit number (same as REG_DWORD)
|
||||
public final static int REG_DWORD_BIG_ENDIAN = 5; // 32-bit number
|
||||
public final static int REG_LINK = 6; // Symbolic Link (unicode)
|
||||
public final static int REG_MULTI_SZ = 7; // Multiple Unicode strings
|
||||
public final static int REG_RESOURCE_LIST = 8; // Resource list in the resource map
|
||||
public final static int REG_FULL_RESOURCE_DESCRIPTOR = 9; // Resource list in the hardware description
|
||||
public final static int REG_RESOURCE_REQUIREMENTS_LIST = 10;
|
||||
|
||||
public final static int REG_OPTION_RESERVED = 0x00000000; // Parameter is reserved
|
||||
public final static int REG_OPTION_NON_VOLATILE = 0x00000000; // Key is preserved
|
||||
// when system is rebooted
|
||||
public final static int REG_OPTION_VOLATILE = 0x00000001; // Key is not preserved
|
||||
// when system is rebooted
|
||||
public final static int REG_OPTION_CREATE_LINK = 0x00000002; // Created key is a
|
||||
// symbolic link
|
||||
public final static int REG_OPTION_BACKUP_RESTORE = 0x00000004; // open for backup or restore
|
||||
// special access rules
|
||||
// privilege required
|
||||
public final static int REG_OPTION_OPEN_LINK = 0x00000008; // Open symbolic link
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* WINREG.java
|
||||
*
|
||||
* Created on 17. August 2007, 14:32
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.jna;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TB
|
||||
*/
|
||||
public interface WINREG {
|
||||
public final static int HKEY_CLASSES_ROOT = 0x80000000;
|
||||
public final static int HKEY_CURRENT_USER = 0x80000001;
|
||||
public final static int HKEY_LOCAL_MACHINE = 0x80000002;
|
||||
public final static int HKEY_USERS = 0x80000003;
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* WINSVC.java
|
||||
*
|
||||
* Created on 8. August 2007, 15:07
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.jna;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
import com.sun.jna.win32.StdCallLibrary.StdCallCallback;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TB
|
||||
*/
|
||||
public interface WINSVC {
|
||||
public final static int SERVICE_CONTROL_STOP = 0x00000001;
|
||||
public final static int SERVICE_CONTROL_SHUTDOWN = 0x00000005;
|
||||
|
||||
public final static int SERVICE_STOPPED = 0x00000001;
|
||||
public final static int SERVICE_START_PENDING = 0x00000002;
|
||||
public final static int SERVICE_STOP_PENDING = 0x00000003;
|
||||
public final static int SERVICE_RUNNING = 0x00000004;
|
||||
public final static int SERVICE_CONTINUE_PENDING = 0x00000005;
|
||||
public final static int SERVICE_PAUSE_PENDING = 0x00000006;
|
||||
public final static int SERVICE_PAUSED = 0x00000007;
|
||||
|
||||
public final static int SERVICE_ACCEPT_STOP = 0x00000001;
|
||||
public final static int SERVICE_ACCEPT_PAUSE_CONTINUE = 0x00000002;
|
||||
public final static int SERVICE_ACCEPT_SHUTDOWN = 0x00000004;
|
||||
public final static int SERVICE_ACCEPT_PARAMCHANGE = 0x00000008;
|
||||
public final static int SERVICE_ACCEPT_NETBINDCHANGE = 0x00000010;
|
||||
|
||||
public final static int SC_MANAGER_CONNECT = 0x0001;
|
||||
public final static int SC_MANAGER_CREATE_SERVICE = 0x0002;
|
||||
public final static int SC_MANAGER_ENUMERATE_SERVICE = 0x0004;
|
||||
public final static int SC_MANAGER_LOCK = 0x0008;
|
||||
public final static int SC_MANAGER_QUERY_LOCK_STATUS = 0x0010;
|
||||
public final static int SC_MANAGER_MODIFY_BOOT_CONFIG = 0x0020;
|
||||
|
||||
public final static int SC_MANAGER_ALL_ACCESS = WINNT.STANDARD_RIGHTS_REQUIRED |
|
||||
SC_MANAGER_CONNECT |
|
||||
SC_MANAGER_CREATE_SERVICE |
|
||||
SC_MANAGER_ENUMERATE_SERVICE |
|
||||
SC_MANAGER_LOCK |
|
||||
SC_MANAGER_QUERY_LOCK_STATUS |
|
||||
SC_MANAGER_MODIFY_BOOT_CONFIG;
|
||||
|
||||
public final static int SERVICE_QUERY_CONFIG = 0x0001;
|
||||
public final static int SERVICE_CHANGE_CONFIG = 0x0002;
|
||||
public final static int SERVICE_QUERY_STATUS = 0x0004;
|
||||
public final static int SERVICE_ENUMERATE_DEPENDENTS = 0x0008;
|
||||
public final static int SERVICE_START = 0x0010;
|
||||
public final static int SERVICE_STOP = 0x0020;
|
||||
public final static int SERVICE_PAUSE_CONTINUE = 0x0040;
|
||||
public final static int SERVICE_INTERROGATE = 0x0080;
|
||||
public final static int SERVICE_USER_DEFINED_CONTROL = 0x0100;
|
||||
|
||||
public final static int SERVICE_ALL_ACCESS = WINNT.STANDARD_RIGHTS_REQUIRED |
|
||||
SERVICE_QUERY_CONFIG |
|
||||
SERVICE_CHANGE_CONFIG |
|
||||
SERVICE_QUERY_STATUS |
|
||||
SERVICE_ENUMERATE_DEPENDENTS |
|
||||
SERVICE_START |
|
||||
SERVICE_STOP |
|
||||
SERVICE_PAUSE_CONTINUE |
|
||||
SERVICE_INTERROGATE |
|
||||
SERVICE_USER_DEFINED_CONTROL;
|
||||
|
||||
public final static int SERVICE_CONFIG_DESCRIPTION = 1;
|
||||
public final static int SERVICE_CONFIG_FAILURE_ACTIONS = 2;
|
||||
|
||||
public final static int SERVICE_KERNEL_DRIVER = 0x00000001;
|
||||
public final static int SERVICE_FILE_SYSTEM_DRIVER = 0x00000002;
|
||||
public final static int SERVICE_ADAPTER = 0x00000004;
|
||||
public final static int SERVICE_RECOGNIZER_DRIVER = 0x00000008;
|
||||
|
||||
public final static int SERVICE_DRIVER = SERVICE_KERNEL_DRIVER |
|
||||
SERVICE_FILE_SYSTEM_DRIVER |
|
||||
SERVICE_RECOGNIZER_DRIVER;
|
||||
|
||||
public final static int SERVICE_WIN32_OWN_PROCESS = 0x00000010;
|
||||
public final static int SERVICE_WIN32_SHARE_PROCESS = 0x00000020;
|
||||
public final static int SERVICE_WIN32 = SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS;
|
||||
|
||||
public final static int SERVICE_INTERACTIVE_PROCESS = 0x00000100;
|
||||
|
||||
public final static int SERVICE_TYPE_ALL = SERVICE_WIN32 |
|
||||
SERVICE_ADAPTER |
|
||||
SERVICE_DRIVER |
|
||||
SERVICE_INTERACTIVE_PROCESS;
|
||||
|
||||
public final static int SERVICE_BOOT_START = 0x00000000;
|
||||
public final static int SERVICE_SYSTEM_START = 0x00000001;
|
||||
public final static int SERVICE_AUTO_START = 0x00000002;
|
||||
public final static int SERVICE_DEMAND_START = 0x00000003;
|
||||
public final static int SERVICE_DISABLED = 0x00000004;
|
||||
|
||||
public final static int SERVICE_ERROR_IGNORE = 0x00000000;
|
||||
public final static int SERVICE_ERROR_NORMAL = 0x00000001;
|
||||
public final static int SERVICE_ERROR_SEVERE = 0x00000002;
|
||||
public final static int SERVICE_ERROR_CRITICAL = 0x00000003;
|
||||
}
|
||||
@@ -0,0 +1,431 @@
|
||||
/*
|
||||
* Accounts.java
|
||||
*
|
||||
* Created on 7. August 2007, 07:58
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.win32;
|
||||
|
||||
import jnacontrib.jna.*;
|
||||
import com.sun.jna.*;
|
||||
import com.sun.jna.ptr.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TB
|
||||
*/
|
||||
public class Accounts {
|
||||
private static Object userInfoLock = new Object();
|
||||
private static Object groupInfoLock = new Object();
|
||||
|
||||
/** Creates a new instance of Accounts */
|
||||
private Accounts() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Testing.
|
||||
* @param args arguments
|
||||
* @throws java.lang.Exception on error
|
||||
*/
|
||||
public static void main(String[] args) throws Exception {
|
||||
System.out.println("FullDomainName: " + getFullDomainName());
|
||||
System.out.println("DomainControllerName: " + getDomainControllerName());
|
||||
System.out.println("UserDomainGroups: " + getUserDomainGroups("administrator"));
|
||||
System.out.println("UserLocalGroups: " + getUserLocalGroups(null, "administrator"));
|
||||
System.out.println("AllDomainGroups: " + getAllDomainGroups());
|
||||
System.out.println("AllDomainUsers: " + getAllDomainUsers());
|
||||
System.out.println("AccountSidString: " + getAccountSidString("administrator"));
|
||||
System.out.println("AccountNameBySid: " + getAccountName(getAccountSid("administrator")));
|
||||
System.out.println("AccountNameBySidString: " + getAccountName(getAccountSidString("administrator")));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name of the domain.
|
||||
*
|
||||
* @return name
|
||||
*/
|
||||
public static String getFullDomainName() {
|
||||
Netapi32.DOMAIN_CONTROLLER_INFO dci;
|
||||
String domain = null;
|
||||
|
||||
dci = getDomainControllerInfo();
|
||||
|
||||
if(dci != null) {
|
||||
domain = dci.DomainName;
|
||||
}
|
||||
return(domain);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the domain controller.
|
||||
*
|
||||
* @return name
|
||||
*/
|
||||
public static String getDomainControllerName() {
|
||||
Netapi32.DOMAIN_CONTROLLER_INFO dci;
|
||||
String domainController = null;
|
||||
|
||||
dci = getDomainControllerInfo();
|
||||
|
||||
if(dci != null) {
|
||||
domainController = dci.DomainControllerName;
|
||||
}
|
||||
return(domainController);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get info about the domain controller.
|
||||
*
|
||||
* @return info
|
||||
*/
|
||||
private static Netapi32.DOMAIN_CONTROLLER_INFO getDomainControllerInfo() {
|
||||
Netapi32 netapi32;
|
||||
PointerByReference pDci;
|
||||
Netapi32.DOMAIN_CONTROLLER_INFO dci = null;
|
||||
|
||||
netapi32 = Netapi32.INSTANCE;
|
||||
pDci = new PointerByReference();
|
||||
|
||||
if(netapi32.DsGetDcName(null, null, null, null, 0, pDci) == WINERROR.ERROR_SUCCESS) {
|
||||
dci = new Netapi32.DOMAIN_CONTROLLER_INFO(pDci.getValue());
|
||||
netapi32.NetApiBufferFree(pDci.getValue());
|
||||
}
|
||||
return(dci);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the domain groups where a user belongs to.
|
||||
*
|
||||
* @param userName user
|
||||
* @return TreeSet of group names
|
||||
*/
|
||||
public static TreeSet<String> getUserDomainGroups(String userName) {
|
||||
Netapi32 netapi32;
|
||||
PointerByReference buf;
|
||||
IntByReference entriesread;
|
||||
IntByReference totalentries;
|
||||
Netapi32.GROUP_USERS_INFO_0 group;
|
||||
Structure[] groups;
|
||||
TreeSet<String> domainGroups;
|
||||
int i;
|
||||
|
||||
domainGroups = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
|
||||
netapi32 = Netapi32.INSTANCE;
|
||||
|
||||
buf = new PointerByReference();
|
||||
entriesread = new IntByReference();
|
||||
totalentries = new IntByReference();
|
||||
|
||||
if(netapi32.NetUserGetGroups(getDomainControllerName(), // servername
|
||||
userName, // username
|
||||
0, // level of user info in buffer
|
||||
buf, // user info buffer
|
||||
LMCONS.MAX_PREFERRED_LENGTH,
|
||||
entriesread, // read ( out )
|
||||
totalentries // total ( out )
|
||||
) == LMERR.NERR_Success) {
|
||||
group = new Netapi32.GROUP_USERS_INFO_0(buf.getValue());
|
||||
groups = group.toArray(entriesread.getValue());
|
||||
|
||||
for(i = 0; i < entriesread.getValue(); i++) {
|
||||
group = (Netapi32.GROUP_USERS_INFO_0)groups[i];
|
||||
domainGroups.add(group.grui0_name);
|
||||
}
|
||||
|
||||
if(entriesread.getValue() > 0) {
|
||||
netapi32.NetApiBufferFree(buf.getValue());
|
||||
}
|
||||
}
|
||||
return(domainGroups);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the local groups a user belongs to.
|
||||
*
|
||||
* @param serverName server name
|
||||
* @param userName user
|
||||
* @return TreeSetof group names
|
||||
*/
|
||||
public static TreeSet<String> getUserLocalGroups(String serverName, String userName) {
|
||||
Netapi32 netapi32;
|
||||
PointerByReference lbuf;
|
||||
IntByReference lentriesread;
|
||||
IntByReference ltotalentries;
|
||||
Netapi32.LOCALGROUP_USERS_INFO_0 lgroup;
|
||||
Structure[] lgroups;
|
||||
TreeSet<String> localGroups;
|
||||
int i;
|
||||
|
||||
localGroups = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
|
||||
netapi32 = Netapi32.INSTANCE;
|
||||
|
||||
lbuf = new PointerByReference();
|
||||
lentriesread = new IntByReference();
|
||||
ltotalentries = new IntByReference();
|
||||
if(netapi32.NetUserGetLocalGroups(null, // servername
|
||||
userName, // username
|
||||
0, // level of user info in buffer
|
||||
0, // flags
|
||||
lbuf, // user info buffer
|
||||
LMCONS.MAX_PREFERRED_LENGTH,
|
||||
lentriesread, // read ( out )
|
||||
ltotalentries // total ( out )
|
||||
) == LMERR.NERR_Success) {
|
||||
lgroup = new Netapi32.LOCALGROUP_USERS_INFO_0(lbuf.getValue());
|
||||
lgroups = lgroup.toArray(lentriesread.getValue());
|
||||
|
||||
for(i = 0; i < lentriesread.getValue(); i++) {
|
||||
lgroup = (Netapi32.LOCALGROUP_USERS_INFO_0)lgroups[i];
|
||||
localGroups.add(lgroup.lgrui0_name);
|
||||
}
|
||||
|
||||
if(lentriesread.getValue() > 0) {
|
||||
netapi32.NetApiBufferFree(lbuf.getValue());
|
||||
}
|
||||
}
|
||||
return(localGroups);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all domain groups.
|
||||
*
|
||||
* @return TreeSet of group names
|
||||
*/
|
||||
public static TreeSet<String> getAllDomainGroups() {
|
||||
Netapi32 netapi32;
|
||||
PointerByReference gbuf;
|
||||
IntByReference gentriesread;
|
||||
IntByReference gtotalentries;
|
||||
Netapi32.GROUP_INFO_0 ggroup;
|
||||
Structure[] ggroups;
|
||||
TreeSet<String> domainGroups;
|
||||
int i;
|
||||
|
||||
netapi32 = Netapi32.INSTANCE;
|
||||
domainGroups = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
|
||||
gbuf = new PointerByReference();
|
||||
gentriesread = new IntByReference();
|
||||
gtotalentries = new IntByReference();
|
||||
|
||||
if(netapi32.NetGroupEnum(getDomainControllerName(), // servername
|
||||
0, // level of user info in buffer
|
||||
gbuf, // user info buffer
|
||||
LMCONS.MAX_PREFERRED_LENGTH,
|
||||
gentriesread, // read ( out )
|
||||
gtotalentries, // total ( out )
|
||||
null // resume_handle
|
||||
) == LMERR.NERR_Success) {
|
||||
ggroup = new Netapi32.GROUP_INFO_0(gbuf.getValue());
|
||||
ggroups = ggroup.toArray(gentriesread.getValue());
|
||||
|
||||
for(i = 0; i < gentriesread.getValue(); i++) {
|
||||
ggroup = (Netapi32.GROUP_INFO_0)ggroups[i];
|
||||
domainGroups.add(ggroup.grpi0_name);
|
||||
}
|
||||
|
||||
if(gentriesread.getValue() > 0) {
|
||||
netapi32.NetApiBufferFree(gbuf.getValue());
|
||||
}
|
||||
}
|
||||
return(domainGroups);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all domain users.
|
||||
*
|
||||
* @return TreeSet of user names
|
||||
*/
|
||||
public static TreeSet<String> getAllDomainUsers() {
|
||||
Netapi32 netapi32;
|
||||
PointerByReference ubuf;
|
||||
IntByReference uentriesread;
|
||||
IntByReference utotalentries;
|
||||
Netapi32.USER_INFO_0 user;
|
||||
Structure[] users;
|
||||
TreeSet<String> domainUsers;
|
||||
int i;
|
||||
|
||||
netapi32 = Netapi32.INSTANCE;
|
||||
domainUsers = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
|
||||
ubuf = new PointerByReference();
|
||||
uentriesread = new IntByReference();
|
||||
utotalentries = new IntByReference();
|
||||
|
||||
if(netapi32.NetUserEnum(getDomainControllerName(), // servername
|
||||
0, // level of user info in buffer
|
||||
LMACCESS.FILTER_NORMAL_ACCOUNT, // filter
|
||||
ubuf, // user info buffer
|
||||
LMCONS.MAX_PREFERRED_LENGTH,
|
||||
uentriesread, // read ( out )
|
||||
utotalentries, // total ( out )
|
||||
null // resume_handle
|
||||
) == LMERR.NERR_Success) {
|
||||
user = new Netapi32.USER_INFO_0(ubuf.getValue());
|
||||
users = user.toArray(uentriesread.getValue());
|
||||
|
||||
for(i = 0; i < uentriesread.getValue(); i++) {
|
||||
user = (Netapi32.USER_INFO_0)users[i];
|
||||
domainUsers.add(user.usri0_name);
|
||||
}
|
||||
|
||||
if(uentriesread.getValue() > 0) {
|
||||
netapi32.NetApiBufferFree(ubuf.getValue());
|
||||
}
|
||||
}
|
||||
return(domainUsers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SID of account.
|
||||
*
|
||||
* @param account account name
|
||||
* @return SID
|
||||
*/
|
||||
public static byte[] getAccountSid(String account) {
|
||||
Advapi32 advapi32;
|
||||
IntByReference cbSid;
|
||||
IntByReference cchReferencedDomainName;
|
||||
PointerByReference peUse;
|
||||
String sidString = null;
|
||||
byte[] sid;
|
||||
char[] referencedDomainName;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
|
||||
cbSid = new IntByReference(0);
|
||||
cchReferencedDomainName = new IntByReference(0);
|
||||
peUse = new PointerByReference();
|
||||
advapi32.LookupAccountName(null, account, null, cbSid,
|
||||
null, cchReferencedDomainName, peUse);
|
||||
sid = new byte[cbSid.getValue()];
|
||||
referencedDomainName = new char[cchReferencedDomainName.getValue()];
|
||||
|
||||
if(! advapi32.LookupAccountName(null, account, sid, cbSid,
|
||||
referencedDomainName, cchReferencedDomainName, peUse)) {
|
||||
sid = null;
|
||||
}
|
||||
return(sid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get account name of SID.
|
||||
*
|
||||
* @param sid SID
|
||||
* @return account name
|
||||
*/
|
||||
public static String getAccountName(byte[] sid) {
|
||||
Advapi32 advapi32;
|
||||
IntByReference cchName;
|
||||
IntByReference cchReferencedDomainName;
|
||||
PointerByReference peUse;
|
||||
String sidString = null;
|
||||
char[] lpName;
|
||||
char[] referencedDomainName;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
|
||||
cchName = new IntByReference(0);
|
||||
cchReferencedDomainName = new IntByReference(0);
|
||||
peUse = new PointerByReference();
|
||||
advapi32.LookupAccountSid(null, sid, null, cchName,
|
||||
null, cchReferencedDomainName, peUse);
|
||||
lpName = new char[cchName.getValue()];
|
||||
referencedDomainName = new char[cchReferencedDomainName.getValue()];
|
||||
|
||||
if(! advapi32.LookupAccountSid(null, sid, lpName, cchName,
|
||||
referencedDomainName, cchReferencedDomainName, peUse)) {
|
||||
lpName = null;
|
||||
}
|
||||
|
||||
if(lpName != null) {
|
||||
return(Native.toString(lpName));
|
||||
|
||||
} else {
|
||||
return(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SID of account as String.
|
||||
*
|
||||
* @param account account name
|
||||
* @return SID
|
||||
*/
|
||||
public static String getAccountSidString(String account) {
|
||||
String sidString = null;
|
||||
byte[] sid;
|
||||
|
||||
sid = getAccountSid(account);
|
||||
|
||||
if(sid != null) {
|
||||
sidString = convertSidToString(sid);
|
||||
}
|
||||
return(sidString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get account of SID String.
|
||||
*
|
||||
* @param sidString SID
|
||||
* @return account name
|
||||
*/
|
||||
public static String getAccountName(String sidString) {
|
||||
String name = null;
|
||||
byte[] sid;
|
||||
|
||||
sid = convertStringToSid(sidString);
|
||||
|
||||
if(sid != null) {
|
||||
name = getAccountName(sid);
|
||||
}
|
||||
return(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a SID to String.
|
||||
*
|
||||
* @param sid SID
|
||||
* @return SID String
|
||||
*/
|
||||
public static String convertSidToString(byte[] sid) {
|
||||
Advapi32 advapi32;
|
||||
PointerByReference stringSid;
|
||||
String sidString = null;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
|
||||
stringSid = new PointerByReference();
|
||||
|
||||
if(advapi32.ConvertSidToStringSid(sid, stringSid)) {
|
||||
sidString = stringSid.getValue().getString(0, true);
|
||||
Kernel32b.INSTANCE.LocalFree(stringSid.getValue());
|
||||
}
|
||||
return(sidString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a SID String to SID.
|
||||
*
|
||||
* @param sidString SID String
|
||||
* @return SID
|
||||
*/
|
||||
public static byte[] convertStringToSid(String sidString) {
|
||||
Advapi32 advapi32;
|
||||
PointerByReference pSid;
|
||||
byte[] sid = null;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
|
||||
pSid = new PointerByReference();
|
||||
|
||||
if(advapi32.ConvertStringSidToSid(sidString, pSid)) {
|
||||
sid = pSid.getValue().getByteArray(0, 100);
|
||||
Kernel32b.INSTANCE.LocalFree(pSid.getValue());
|
||||
}
|
||||
return(sid);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,464 @@
|
||||
/*
|
||||
* Registry.java
|
||||
*
|
||||
* Created on 17. August 2007, 15:07
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.win32;
|
||||
|
||||
import jnacontrib.jna.*;
|
||||
import com.sun.jna.ptr.ByteByReference;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
|
||||
/**
|
||||
* Methods for accessing the Windows Registry. Only String and DWORD values supported at the moment.
|
||||
*/
|
||||
public class Registry {
|
||||
public static enum REGISTRY_ROOT_KEY{CLASSES_ROOT, CURRENT_USER, LOCAL_MACHINE, USERS};
|
||||
private final static HashMap<REGISTRY_ROOT_KEY, Integer> rootKeyMap = new HashMap<REGISTRY_ROOT_KEY, Integer>();
|
||||
|
||||
static {
|
||||
rootKeyMap.put(REGISTRY_ROOT_KEY.CLASSES_ROOT, WINREG.HKEY_CLASSES_ROOT);
|
||||
rootKeyMap.put(REGISTRY_ROOT_KEY.CURRENT_USER, WINREG.HKEY_CURRENT_USER);
|
||||
rootKeyMap.put(REGISTRY_ROOT_KEY.LOCAL_MACHINE, WINREG.HKEY_LOCAL_MACHINE);
|
||||
rootKeyMap.put(REGISTRY_ROOT_KEY.USERS, WINREG.HKEY_USERS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Testing.
|
||||
*
|
||||
* @param args arguments
|
||||
* @throws java.lang.Exception on error
|
||||
*/
|
||||
public static void main(String[] args) throws Exception {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets one of the root keys.
|
||||
*
|
||||
* @param key key type
|
||||
* @return root key
|
||||
*/
|
||||
private static int getRegistryRootKey(REGISTRY_ROOT_KEY key) {
|
||||
Advapi32 advapi32;
|
||||
IntByReference pHandle;
|
||||
int handle = 0;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
pHandle = new IntByReference();
|
||||
|
||||
if(advapi32.RegOpenKeyEx(rootKeyMap.get(key), null, 0, 0, pHandle) == WINERROR.ERROR_SUCCESS) {
|
||||
handle = pHandle.getValue();
|
||||
}
|
||||
return(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a key.
|
||||
*
|
||||
* @param rootKey root key
|
||||
* @param subKeyName name of the key
|
||||
* @param access access mode
|
||||
* @return handle to the key or 0
|
||||
*/
|
||||
private static int openKey(REGISTRY_ROOT_KEY rootKey, String subKeyName, int access) {
|
||||
Advapi32 advapi32;
|
||||
IntByReference pHandle;
|
||||
int rootKeyHandle;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
rootKeyHandle = getRegistryRootKey(rootKey);
|
||||
pHandle = new IntByReference();
|
||||
|
||||
if(advapi32.RegOpenKeyEx(rootKeyHandle, subKeyName, 0, access, pHandle) == WINERROR.ERROR_SUCCESS) {
|
||||
return(pHandle.getValue());
|
||||
|
||||
} else {
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a Windows buffer to a Java String.
|
||||
*
|
||||
* @param buf buffer
|
||||
* @throws java.io.UnsupportedEncodingException on error
|
||||
* @return String
|
||||
*/
|
||||
private static String convertBufferToString(byte[] buf) throws UnsupportedEncodingException {
|
||||
return(new String(buf, 0, buf.length - 2, "UTF-16LE"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a Windows buffer to an int.
|
||||
*
|
||||
* @param buf buffer
|
||||
* @return int
|
||||
*/
|
||||
private static int convertBufferToInt(byte[] buf) {
|
||||
return(((int)(buf[0] & 0xff)) + (((int)(buf[1] & 0xff)) << 8) + (((int)(buf[2] & 0xff)) << 16) + (((int)(buf[3] & 0xff)) << 24));
|
||||
}
|
||||
|
||||
/**
|
||||
* Read a String value.
|
||||
*
|
||||
* @param rootKey root key
|
||||
* @param subKeyName key name
|
||||
* @param name value name
|
||||
* @throws java.io.UnsupportedEncodingException on error
|
||||
* @return String or null
|
||||
*/
|
||||
public static String getStringValue(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name) throws UnsupportedEncodingException {
|
||||
Advapi32 advapi32;
|
||||
IntByReference pType, lpcbData;
|
||||
byte[] lpData = new byte[1];
|
||||
int handle = 0;
|
||||
String ret = null;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
pType = new IntByReference();
|
||||
lpcbData = new IntByReference();
|
||||
handle = openKey(rootKey, subKeyName, WINNT.KEY_READ);
|
||||
|
||||
if(handle != 0) {
|
||||
|
||||
if(advapi32.RegQueryValueEx(handle, name, null, pType, lpData, lpcbData) == WINERROR.ERROR_MORE_DATA) {
|
||||
lpData = new byte[lpcbData.getValue()];
|
||||
|
||||
if(advapi32.RegQueryValueEx(handle, name, null, pType, lpData, lpcbData) == WINERROR.ERROR_SUCCESS) {
|
||||
ret = convertBufferToString(lpData);
|
||||
}
|
||||
}
|
||||
advapi32.RegCloseKey(handle);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read an int value.
|
||||
*
|
||||
*
|
||||
* @return int or 0
|
||||
* @param rootKey root key
|
||||
* @param subKeyName key name
|
||||
* @param name value name
|
||||
*/
|
||||
public static int getIntValue(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name) {
|
||||
Advapi32 advapi32;
|
||||
IntByReference pType, lpcbData;
|
||||
byte[] lpData = new byte[1];
|
||||
int handle = 0;
|
||||
int ret = 0;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
pType = new IntByReference();
|
||||
lpcbData = new IntByReference();
|
||||
handle = openKey(rootKey, subKeyName, WINNT.KEY_READ);
|
||||
|
||||
if(handle != 0) {
|
||||
|
||||
if(advapi32.RegQueryValueEx(handle, name, null, pType, lpData, lpcbData) == WINERROR.ERROR_MORE_DATA) {
|
||||
lpData = new byte[lpcbData.getValue()];
|
||||
|
||||
if(advapi32.RegQueryValueEx(handle, name, null, pType, lpData, lpcbData) == WINERROR.ERROR_SUCCESS) {
|
||||
ret = convertBufferToInt(lpData);
|
||||
}
|
||||
}
|
||||
advapi32.RegCloseKey(handle);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a value.
|
||||
*
|
||||
* @param rootKey root key
|
||||
* @param subKeyName key name
|
||||
* @param name value name
|
||||
* @return true on success
|
||||
*/
|
||||
public static boolean deleteValue(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name) {
|
||||
Advapi32 advapi32;
|
||||
int handle;
|
||||
boolean ret = true;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
|
||||
handle = openKey(rootKey, subKeyName, WINNT.KEY_READ | WINNT.KEY_WRITE);
|
||||
|
||||
if(handle != 0) {
|
||||
if(advapi32.RegDeleteValue(handle, name) == WINERROR.ERROR_SUCCESS) {
|
||||
ret = true;
|
||||
}
|
||||
advapi32.RegCloseKey(handle);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a String value.
|
||||
*
|
||||
* @param rootKey root key
|
||||
* @param subKeyName key name
|
||||
* @param name value name
|
||||
* @param value value
|
||||
* @throws java.io.UnsupportedEncodingException on error
|
||||
* @return true on success
|
||||
*/
|
||||
public static boolean setStringValue(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name, String value) throws UnsupportedEncodingException {
|
||||
Advapi32 advapi32;
|
||||
int handle;
|
||||
byte[] data;
|
||||
boolean ret = false;
|
||||
|
||||
data = Arrays.copyOf(value.getBytes("UTF-16LE"), value.length() * 2 + 2);
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
handle = openKey(rootKey, subKeyName, WINNT.KEY_READ | WINNT.KEY_WRITE);
|
||||
|
||||
if(handle != 0) {
|
||||
if(advapi32.RegSetValueEx(handle, name, 0, WINNT.REG_SZ, data, data.length) == WINERROR.ERROR_SUCCESS) {
|
||||
ret = true;
|
||||
}
|
||||
advapi32.RegCloseKey(handle);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes an int value.
|
||||
*
|
||||
*
|
||||
* @return true on success
|
||||
* @param rootKey root key
|
||||
* @param subKeyName key name
|
||||
* @param name value name
|
||||
* @param value value
|
||||
*/
|
||||
public static boolean setIntValue(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name, int value) {
|
||||
Advapi32 advapi32;
|
||||
int handle;
|
||||
byte[] data;
|
||||
boolean ret = false;
|
||||
|
||||
data = new byte[4];
|
||||
data[0] = (byte)(value & 0xff);
|
||||
data[1] = (byte)((value >> 8) & 0xff);
|
||||
data[2] = (byte)((value >> 16) & 0xff);
|
||||
data[3] = (byte)((value >> 24) & 0xff);
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
handle = openKey(rootKey, subKeyName, WINNT.KEY_READ | WINNT.KEY_WRITE);
|
||||
|
||||
if(handle != 0) {
|
||||
|
||||
if(advapi32.RegSetValueEx(handle, name, 0, WINNT.REG_DWORD, data, data.length) == WINERROR.ERROR_SUCCESS) {
|
||||
ret = true;
|
||||
}
|
||||
advapi32.RegCloseKey(handle);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for existence of a value.
|
||||
*
|
||||
* @param rootKey root key
|
||||
* @param subKeyName key name
|
||||
* @param name value name
|
||||
* @return true if exists
|
||||
*/
|
||||
public static boolean valueExists(REGISTRY_ROOT_KEY rootKey, String subKeyName, String name) {
|
||||
Advapi32 advapi32;
|
||||
IntByReference pType, lpcbData;
|
||||
byte[] lpData = new byte[1];
|
||||
int handle = 0;
|
||||
boolean ret = false;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
pType = new IntByReference();
|
||||
lpcbData = new IntByReference();
|
||||
handle = openKey(rootKey, subKeyName, WINNT.KEY_READ);
|
||||
|
||||
if(handle != 0) {
|
||||
|
||||
if(advapi32.RegQueryValueEx(handle, name, null, pType, lpData, lpcbData) != WINERROR.ERROR_FILE_NOT_FOUND) {
|
||||
ret = true;
|
||||
|
||||
} else {
|
||||
ret = false;
|
||||
}
|
||||
advapi32.RegCloseKey(handle);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new key.
|
||||
*
|
||||
* @param rootKey root key
|
||||
* @param parent name of parent key
|
||||
* @param name key name
|
||||
* @return true on success
|
||||
*/
|
||||
public static boolean createKey(REGISTRY_ROOT_KEY rootKey, String parent, String name) {
|
||||
Advapi32 advapi32;
|
||||
IntByReference hkResult, dwDisposition;
|
||||
int handle = 0;
|
||||
boolean ret = false;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
hkResult = new IntByReference();
|
||||
dwDisposition = new IntByReference();
|
||||
handle = openKey(rootKey, parent, WINNT.KEY_READ);
|
||||
|
||||
if(handle != 0) {
|
||||
|
||||
if(advapi32.RegCreateKeyEx(handle, name, 0, null, WINNT.REG_OPTION_NON_VOLATILE, WINNT.KEY_READ, null,
|
||||
hkResult, dwDisposition) == WINERROR.ERROR_SUCCESS) {
|
||||
ret = true;
|
||||
advapi32.RegCloseKey(hkResult.getValue());
|
||||
|
||||
} else {
|
||||
ret = false;
|
||||
}
|
||||
advapi32.RegCloseKey(handle);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a key.
|
||||
*
|
||||
* @param rootKey root key
|
||||
* @param parent name of parent key
|
||||
* @param name key name
|
||||
* @return true on success
|
||||
*/
|
||||
public static boolean deleteKey(REGISTRY_ROOT_KEY rootKey, String parent, String name) {
|
||||
Advapi32 advapi32;
|
||||
int handle = 0;
|
||||
boolean ret = false;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
handle = openKey(rootKey, parent, WINNT.KEY_READ);
|
||||
|
||||
if(handle != 0) {
|
||||
|
||||
if(advapi32.RegDeleteKey(handle, name) == WINERROR.ERROR_SUCCESS) {
|
||||
ret = true;
|
||||
|
||||
} else {
|
||||
ret = false;
|
||||
}
|
||||
advapi32.RegCloseKey(handle);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all sub keys of a key.
|
||||
*
|
||||
* @param rootKey root key
|
||||
* @param parent key name
|
||||
* @return array with all sub key names
|
||||
*/
|
||||
public static String[] getSubKeys(REGISTRY_ROOT_KEY rootKey, String parent) {
|
||||
Advapi32 advapi32;
|
||||
int handle = 0, dwIndex;
|
||||
char[] lpName;
|
||||
IntByReference lpcName;
|
||||
WINBASE.FILETIME lpftLastWriteTime;
|
||||
TreeSet<String> subKeys = new TreeSet<String>();
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
handle = openKey(rootKey, parent, WINNT.KEY_READ);
|
||||
lpName = new char[256];
|
||||
lpcName = new IntByReference(256);
|
||||
lpftLastWriteTime = new WINBASE.FILETIME();
|
||||
|
||||
if(handle != 0) {
|
||||
dwIndex = 0;
|
||||
|
||||
while(advapi32.RegEnumKeyEx(handle, dwIndex, lpName, lpcName, null,
|
||||
null, null, lpftLastWriteTime) == WINERROR.ERROR_SUCCESS) {
|
||||
subKeys.add(new String(lpName, 0, lpcName.getValue()));
|
||||
lpcName.setValue(256);
|
||||
dwIndex++;
|
||||
}
|
||||
advapi32.RegCloseKey(handle);
|
||||
}
|
||||
|
||||
return(subKeys.toArray(new String[]{}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all values under a key.
|
||||
*
|
||||
* @param rootKey root key
|
||||
* @param key jey name
|
||||
* @throws java.io.UnsupportedEncodingException on error
|
||||
* @return TreeMap with name and value pairs
|
||||
*/
|
||||
public static TreeMap<String, Object> getValues(REGISTRY_ROOT_KEY rootKey, String key) throws UnsupportedEncodingException {
|
||||
Advapi32 advapi32;
|
||||
int handle = 0, dwIndex, result = 0;
|
||||
char[] lpValueName;
|
||||
byte[] lpData;
|
||||
IntByReference lpcchValueName, lpType, lpcbData;
|
||||
String name;
|
||||
TreeMap<String, Object> values = new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
handle = openKey(rootKey, key, WINNT.KEY_READ);
|
||||
lpValueName = new char[16384];
|
||||
lpcchValueName = new IntByReference(16384);
|
||||
lpType = new IntByReference();
|
||||
lpData = new byte[1];
|
||||
lpcbData = new IntByReference();
|
||||
|
||||
if(handle != 0) {
|
||||
dwIndex = 0;
|
||||
|
||||
do {
|
||||
lpcbData.setValue(0);
|
||||
result = advapi32.RegEnumValue(handle, dwIndex, lpValueName, lpcchValueName, null,
|
||||
lpType, lpData, lpcbData);
|
||||
|
||||
if(result == WINERROR.ERROR_MORE_DATA) {
|
||||
lpData = new byte[lpcbData.getValue()];
|
||||
lpcchValueName = new IntByReference(16384);
|
||||
result = advapi32.RegEnumValue(handle, dwIndex, lpValueName, lpcchValueName, null,
|
||||
lpType, lpData, lpcbData);
|
||||
|
||||
if(result == WINERROR.ERROR_SUCCESS) {
|
||||
name = new String(lpValueName, 0, lpcchValueName.getValue());
|
||||
|
||||
switch(lpType.getValue()) {
|
||||
case WINNT.REG_SZ:
|
||||
values.put(name, convertBufferToString(lpData));
|
||||
break;
|
||||
case WINNT.REG_DWORD:
|
||||
values.put(name, convertBufferToInt(lpData));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
dwIndex++;
|
||||
} while(result == WINERROR.ERROR_SUCCESS);
|
||||
|
||||
advapi32.RegCloseKey(handle);
|
||||
}
|
||||
return(values);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* TestService.java
|
||||
*
|
||||
* Created on 12. September 2007, 12:49
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.win32;
|
||||
|
||||
/**
|
||||
* TestService.
|
||||
*/
|
||||
public class TestService extends Win32Service {
|
||||
|
||||
/**
|
||||
* main.
|
||||
* @param args arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
TestService service = new TestService();
|
||||
|
||||
if(args.length == 1) {
|
||||
|
||||
if(args[0].equalsIgnoreCase("install")) {
|
||||
System.out.println(service.install("TestService DisplayName", "TestService Description",
|
||||
null, null, null));
|
||||
|
||||
} else if(args[0].equalsIgnoreCase("uninstall")) {
|
||||
System.out.println(service.uninstall());
|
||||
|
||||
} else {
|
||||
System.out.println("Arguments:");
|
||||
System.out.println("install = install service");
|
||||
System.out.println("uninstall = uninstall service");
|
||||
System.out.println("<none> = run service");
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
} else {
|
||||
service.init();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of TestService.
|
||||
*/
|
||||
public TestService() {
|
||||
super("TestService");
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called on start.
|
||||
*/
|
||||
public void onStart() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called on stop.
|
||||
*/
|
||||
public void onStop() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,311 @@
|
||||
/*
|
||||
* Win32Service.java
|
||||
*
|
||||
* Created on 12. September 2007, 12:05
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package jnacontrib.win32;
|
||||
|
||||
import jnacontrib.jna.*;
|
||||
import com.sun.jna.Pointer;
|
||||
|
||||
/**
|
||||
* Baseclass for a Win32 service.
|
||||
*/
|
||||
public abstract class Win32Service {
|
||||
protected String serviceName;
|
||||
private ServiceMain serviceMain;
|
||||
private ServiceControl serviceControl;
|
||||
private Pointer serviceStatusHandle;
|
||||
private Object waitObject = new Object();
|
||||
|
||||
/**
|
||||
* Creates a new instance of Win32Service.
|
||||
*
|
||||
* @param serviceName internal name of the service
|
||||
*/
|
||||
public Win32Service(String serviceName) {
|
||||
this.serviceName = serviceName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Install the service.
|
||||
*
|
||||
* @param displayName visible name
|
||||
* @param description description
|
||||
* @param dependencies array of other services to depend on or null
|
||||
* @param account service account or null for LocalSystem
|
||||
* @param password password for service account or null
|
||||
* @throws java.lang.Exception
|
||||
* @return true on success
|
||||
*/
|
||||
public boolean install(String displayName, String description, String[] dependencies, String account, String password) {
|
||||
return(install(displayName, description, dependencies, account, password, "java.exe -cp \"" +
|
||||
System.getProperty("java.class.path") + "\" -Xrs " + this.getClass().getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Install the service.
|
||||
*
|
||||
* @return true on success
|
||||
* @param displayName visible name
|
||||
* @param description description
|
||||
* @param dependencies array of other services to depend on or null
|
||||
* @param account service account or null for LocalSystem
|
||||
* @param password password for service account or null
|
||||
* @param command command line to start the service
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
public boolean install(String displayName, String description, String[] dependencies, String account, String password, String command) {
|
||||
Advapi32 advapi32;
|
||||
Advapi32.SERVICE_DESCRIPTION desc;
|
||||
Pointer serviceManager, service;
|
||||
boolean success = false;
|
||||
String dep = "";
|
||||
|
||||
if(dependencies != null) {
|
||||
for(String s : dependencies) {
|
||||
dep += s + "\0";
|
||||
}
|
||||
}
|
||||
dep += "\0";
|
||||
|
||||
desc = new Advapi32.SERVICE_DESCRIPTION();
|
||||
desc.lpDescription = description;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
serviceManager = openServiceControlManager(null, WINSVC.SC_MANAGER_ALL_ACCESS);
|
||||
|
||||
if(serviceManager != null) {
|
||||
service = advapi32.CreateService(serviceManager, serviceName, displayName,
|
||||
WINSVC.SERVICE_ALL_ACCESS, WINSVC.SERVICE_WIN32_OWN_PROCESS, WINSVC.SERVICE_DEMAND_START,
|
||||
WINSVC.SERVICE_ERROR_NORMAL,
|
||||
command,
|
||||
null, null, dep, account, password);
|
||||
|
||||
if(service != null) {
|
||||
success = advapi32.ChangeServiceConfig2(service, WINSVC.SERVICE_CONFIG_DESCRIPTION, desc);
|
||||
advapi32.CloseServiceHandle(service);
|
||||
}
|
||||
advapi32.CloseServiceHandle(serviceManager);
|
||||
}
|
||||
return(success);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstall the service.
|
||||
*
|
||||
* @throws java.lang.Exception
|
||||
* @return true on success
|
||||
*/
|
||||
public boolean uninstall() {
|
||||
Advapi32 advapi32;
|
||||
Pointer serviceManager, service;
|
||||
boolean success = false;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
serviceManager = openServiceControlManager(null, WINSVC.SC_MANAGER_ALL_ACCESS);
|
||||
|
||||
if(serviceManager != null) {
|
||||
service = advapi32.OpenService(serviceManager, serviceName, WINSVC.SERVICE_ALL_ACCESS);
|
||||
|
||||
if(service != null) {
|
||||
success = advapi32.DeleteService(service);
|
||||
advapi32.CloseServiceHandle(service);
|
||||
}
|
||||
advapi32.CloseServiceHandle(serviceManager);
|
||||
}
|
||||
return(success);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ask the ServiceControlManager to start the service.
|
||||
* @return true on success
|
||||
*/
|
||||
public boolean start() {
|
||||
Advapi32 advapi32;
|
||||
Pointer serviceManager, service;
|
||||
boolean success = false;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
|
||||
serviceManager = openServiceControlManager(null, WINNT.GENERIC_EXECUTE);
|
||||
|
||||
if(serviceManager != null) {
|
||||
service = advapi32.OpenService(serviceManager, serviceName, WINNT.GENERIC_EXECUTE);
|
||||
|
||||
if(service != null) {
|
||||
success = advapi32.StartService(service, 0, null);
|
||||
advapi32.CloseServiceHandle(service);
|
||||
}
|
||||
advapi32.CloseServiceHandle(serviceManager);
|
||||
}
|
||||
|
||||
return(success);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ask the ServiceControlManager to stop the service.
|
||||
* @return true on success
|
||||
*/
|
||||
public boolean stop() throws Exception {
|
||||
Advapi32 advapi32;
|
||||
Pointer serviceManager, service;
|
||||
Advapi32.SERVICE_STATUS serviceStatus;
|
||||
boolean success = false;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
|
||||
serviceManager = openServiceControlManager(null, WINNT.GENERIC_EXECUTE);
|
||||
|
||||
if(serviceManager != null) {
|
||||
service = advapi32.OpenService(serviceManager, serviceName, WINNT.GENERIC_EXECUTE);
|
||||
|
||||
if(service != null) {
|
||||
serviceStatus = new Advapi32.SERVICE_STATUS();
|
||||
success = advapi32.ControlService(service, WINSVC.SERVICE_CONTROL_STOP, serviceStatus);
|
||||
advapi32.CloseServiceHandle(service);
|
||||
}
|
||||
advapi32.CloseServiceHandle(serviceManager);
|
||||
}
|
||||
|
||||
return(success);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the service, connect to the ServiceControlManager.
|
||||
*/
|
||||
public void init() {
|
||||
Advapi32 advapi32;
|
||||
Advapi32.SERVICE_TABLE_ENTRY[] entries = new Advapi32.SERVICE_TABLE_ENTRY[2];
|
||||
Advapi32.SERVICE_TABLE_ENTRY entry;
|
||||
|
||||
serviceMain = new ServiceMain();
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
entry = new Advapi32.SERVICE_TABLE_ENTRY();
|
||||
entry.lpServiceName = serviceName;
|
||||
entry.lpServiceProc = serviceMain;
|
||||
|
||||
advapi32.StartServiceCtrlDispatcher(entry.toArray(2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a handle to the ServiceControlManager.
|
||||
*
|
||||
* @param machine name of the machine or null for localhost
|
||||
* @param access access flags
|
||||
* @return handle to ServiceControlManager or null when failed
|
||||
*/
|
||||
private Pointer openServiceControlManager(String machine, int access) {
|
||||
Pointer handle = null;
|
||||
Advapi32 advapi32;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
handle = advapi32.OpenSCManager(machine, null, access);
|
||||
return(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Report service status to the ServiceControlManager.
|
||||
*
|
||||
* @param status status
|
||||
* @param win32ExitCode exit code
|
||||
* @param waitHint time to wait
|
||||
*/
|
||||
private void reportStatus(int status, int win32ExitCode, int waitHint) {
|
||||
Advapi32 advapi32;
|
||||
Advapi32.SERVICE_STATUS serviceStatus;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
serviceStatus = new Advapi32.SERVICE_STATUS();
|
||||
serviceStatus.dwServiceType = WINNT.SERVICE_WIN32_OWN_PROCESS;
|
||||
serviceStatus.dwControlsAccepted = WINSVC.SERVICE_ACCEPT_STOP | WINSVC.SERVICE_ACCEPT_SHUTDOWN;
|
||||
serviceStatus.dwWin32ExitCode = win32ExitCode;
|
||||
serviceStatus.dwWaitHint = waitHint;
|
||||
serviceStatus.dwCurrentState = status;
|
||||
|
||||
advapi32.SetServiceStatus(serviceStatusHandle, serviceStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when service is starting.
|
||||
*/
|
||||
public abstract void onStart();
|
||||
|
||||
/*
|
||||
* Called when service should stop.
|
||||
*/
|
||||
public abstract void onStop();
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of the service main function.
|
||||
*/
|
||||
private class ServiceMain implements Advapi32.SERVICE_MAIN_FUNCTION {
|
||||
|
||||
/**
|
||||
* Called when the service is starting.
|
||||
*
|
||||
* @param dwArgc number of arguments
|
||||
* @param lpszArgv pointer to arguments
|
||||
*/
|
||||
public void callback(int dwArgc, Pointer lpszArgv) {
|
||||
Advapi32 advapi32;
|
||||
|
||||
advapi32 = Advapi32.INSTANCE;
|
||||
|
||||
serviceControl = new ServiceControl();
|
||||
serviceStatusHandle = advapi32.RegisterServiceCtrlHandlerEx(serviceName, serviceControl, null);
|
||||
|
||||
reportStatus(WINSVC.SERVICE_START_PENDING, WINERROR.NO_ERROR, 3000);
|
||||
reportStatus(WINSVC.SERVICE_RUNNING, WINERROR.NO_ERROR, 0);
|
||||
|
||||
onStart();
|
||||
|
||||
try {
|
||||
synchronized(waitObject) {
|
||||
waitObject.wait();
|
||||
}
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
reportStatus(WINSVC.SERVICE_STOPPED, WINERROR.NO_ERROR, 0);
|
||||
|
||||
// Avoid returning from ServiceMain, which will cause a crash
|
||||
// See http://support.microsoft.com/kb/201349, which recommends
|
||||
// having init() wait for this thread.
|
||||
// Waiting on this thread in init() won't fix the crash, though.
|
||||
//System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of the service control function.
|
||||
*/
|
||||
private class ServiceControl implements Advapi32.HandlerEx {
|
||||
|
||||
/**
|
||||
* Called when the service get a control code.
|
||||
*
|
||||
* @param dwControl
|
||||
* @param dwEventType
|
||||
* @param lpEventData
|
||||
* @param lpContext
|
||||
*/
|
||||
public int callback(int dwControl, int dwEventType, Pointer lpEventData, Pointer lpContext) {
|
||||
switch(dwControl) {
|
||||
case WINSVC.SERVICE_CONTROL_STOP:
|
||||
case WINSVC.SERVICE_CONTROL_SHUTDOWN:
|
||||
reportStatus(WINSVC.SERVICE_STOP_PENDING, WINERROR.NO_ERROR, 5000);
|
||||
onStop();
|
||||
synchronized(waitObject) {
|
||||
waitObject.notifyAll();
|
||||
}
|
||||
}
|
||||
return WINERROR.NO_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package w32keyhook;
|
||||
|
||||
import com.sun.jna.*;
|
||||
import com.sun.jna.win32.*;
|
||||
import com.sun.jna.examples.win32.*;
|
||||
import com.sun.jna.examples.win32.User32.MSG;
|
||||
import com.sun.jna.examples.win32.User32.LowLevelKeyboardProc;
|
||||
import com.sun.jna.examples.win32.User32.KBDLLHOOKSTRUCT;
|
||||
import com.sun.jna.examples.win32.W32API.LRESULT;
|
||||
import com.sun.jna.examples.win32.W32API.WPARAM;
|
||||
import com.sun.jna.examples.win32.W32API.HMODULE;
|
||||
import com.sun.jna.examples.win32.User32.HHOOK;
|
||||
|
||||
/** Sample implementation of a low-level keyboard hook on W32. */
|
||||
public class KeyHook {
|
||||
private static volatile boolean quit;
|
||||
private static HHOOK hhk;
|
||||
private static LowLevelKeyboardProc keyboardHook;
|
||||
|
||||
public static void main(String[] args) {
|
||||
final User32 lib = User32.INSTANCE;
|
||||
HMODULE hMod = Kernel32.INSTANCE.GetModuleHandle(null);
|
||||
keyboardHook = new LowLevelKeyboardProc() {
|
||||
public LRESULT callback(int nCode, WPARAM wParam, KBDLLHOOKSTRUCT info) {
|
||||
if (nCode >= 0) {
|
||||
switch(wParam.intValue()) {
|
||||
case User32.WM_KEYUP:
|
||||
case User32.WM_KEYDOWN:
|
||||
case User32.WM_SYSKEYUP:
|
||||
case User32.WM_SYSKEYDOWN:
|
||||
System.err.println("in callback, key=" + info.vkCode);
|
||||
if (info.vkCode == 81) {
|
||||
quit = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return lib.CallNextHookEx(hhk, nCode, wParam, info.getPointer());
|
||||
}
|
||||
};
|
||||
hhk = lib.SetWindowsHookEx(User32.WH_KEYBOARD_LL, keyboardHook, hMod, 0);
|
||||
System.out.println("Keyboard hook installed, type anywhere, 'q' to quit");
|
||||
new Thread() {
|
||||
public void run() {
|
||||
while (!quit) {
|
||||
try { Thread.sleep(10); } catch(Exception e) { }
|
||||
}
|
||||
System.err.println("unhook and exit");
|
||||
lib.UnhookWindowsHookEx(hhk);
|
||||
System.exit(0);
|
||||
}
|
||||
}.start();
|
||||
|
||||
// This bit never returns from GetMessage
|
||||
int result;
|
||||
MSG msg = new MSG();
|
||||
while ((result = lib.GetMessage(msg, null, 0, 0)) != 0) {
|
||||
if (result == -1) {
|
||||
System.err.println("error in get message");
|
||||
break;
|
||||
}
|
||||
else {
|
||||
System.err.println("got message");
|
||||
lib.TranslateMessage(msg);
|
||||
lib.DispatchMessage(msg);
|
||||
}
|
||||
}
|
||||
lib.UnhookWindowsHookEx(hhk);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
Copyright (c) 2008 Stefan Endrullis, All Rights Reserved
|
||||
|
||||
Disclaimer:
|
||||
===========
|
||||
This code is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
|
||||
Description:
|
||||
============
|
||||
|
||||
The intension of this contribution is to provide an object oriented
|
||||
interface to X11. It doesn't not cover all available X11 functions, but
|
||||
it supports major functions to manage the X11 desktop, windows and keys.
|
||||
|
||||
If you want to help to extend this API, you're welcome!
|
||||
|
||||
|
||||
Project structure:
|
||||
==================
|
||||
|
||||
The project has been divided into two parts:
|
||||
- jnacontrib.x11.api
|
||||
- jnacontrib.c11.demos
|
||||
|
||||
The first part contains the API files. The main class is the class X.
|
||||
The second part contains some demos showing you how you can use the API.
|
||||
|
||||
X.java:
|
||||
-------
|
||||
Object oriented interface to X11. It mainly contains methods related
|
||||
to window management but also some functions for keys.
|
||||
Static methods for getting information about Win32 accounts (users
|
||||
and groups).
|
||||
- list all domain users
|
||||
- list all domain groups
|
||||
- list all local or domain groups where a user belongs to
|
||||
- get account by SID
|
||||
- get SID of account
|
||||
- get domain controller name
|
||||
- get domain name
|
||||
|
||||
X11KeySymDef.java
|
||||
-----------------
|
||||
Class X11KeySymDef is a Java translation of keysymdef.h and contains all
|
||||
KeySym definitions of the X server.
|
||||
|
||||
XDesktopDemo.java
|
||||
-----------------
|
||||
Class XDesktopDemo is a small demonstration of the window management
|
||||
capabilities of X. It's a GUI which allows you to move windows to other
|
||||
desktops, switch to other desktops, hide all windows etc.
|
||||
|
||||
XTestDemo.java
|
||||
--------------
|
||||
This class demonstrates how you can use the "Test extension" of the X
|
||||
server, which allows you to simulate key and mouse events. Be careful
|
||||
when running the program, because it simulates keystrokes and "types"
|
||||
the words "hello world" in the active window.
|
||||
@@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="jnacontrib.x11" default="jar" basedir=".">
|
||||
<description>Builds, tests, and runs the project jnacontrib.x11.</description>
|
||||
<!-- Locations -->
|
||||
<property name="src" location="src"/>
|
||||
<property name="build" location="build"/>
|
||||
<property name="jna-src" location="../../src"/>
|
||||
<property name="jna-dist" location="../../dist"/>
|
||||
|
||||
<property name="buildClasses" location="${build}/classes"/>
|
||||
<property name="buildJar" location="${build}/jnacontrib-x11.jar"/>
|
||||
|
||||
<path id="classpath">
|
||||
<fileset dir="../../dist">
|
||||
<include name="jna.jar"/>
|
||||
</fileset>
|
||||
</path>
|
||||
|
||||
<!-- Run XDesktopDemo. -->
|
||||
<target name="runXDesktopDemo" depends="compile">
|
||||
<java classname="jnacontrib.x11.demos.XDesktopDemo" fork="true">
|
||||
<classpath>
|
||||
<pathelement location="${buildClasses}" />
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<!-- Run XTestDemo. -->
|
||||
<target name="runXTestDemo" depends="compile">
|
||||
<java classname="jnacontrib.x11.demos.XTestDemo" fork="true">
|
||||
<classpath>
|
||||
<pathelement location="${buildClasses}" />
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<!-- Delete class and jar files. -->
|
||||
<target name="clean">
|
||||
<delete dir="${buildClasses}"/>
|
||||
<delete file="${buildJar}"/>
|
||||
<delete dir="${build}"/>
|
||||
</target>
|
||||
|
||||
<!-- Compile all classes. -->
|
||||
<target name="compile">
|
||||
<mkdir dir="${buildClasses}"/>
|
||||
|
||||
<!-- Compile the project. -->
|
||||
<javac srcdir="${src}" destdir="${buildClasses}" target="1.5" source="1.5" encoding="UTF-8" debug="on">
|
||||
<classpath>
|
||||
<path refid="classpath"/>
|
||||
</classpath>
|
||||
<src>
|
||||
<dirset dir="${src}"/>
|
||||
<dirset dir="${jna-src}/com/sun/jna/examples/unix"/>
|
||||
</src>
|
||||
</javac>
|
||||
|
||||
<!-- Copy all non-java files to classes. -->
|
||||
<copy todir="${buildClasses}">
|
||||
<fileset dir="src">
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<!-- Create jar-file. -->
|
||||
<target name="jar" depends="compile">
|
||||
<jar jarfile="${buildJar}" basedir="${buildClasses}">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="jnacontrib.x11.demos.XDesktopDemo"/>
|
||||
<attribute name="Class-Path" value="${jna-dist}/jna.jar"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
</target>
|
||||
</project>
|
||||
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -0,0 +1,365 @@
|
||||
/* Copyright (c) 2008 Stefan Endrullis, All Rights Reserved
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* <p/>
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*/
|
||||
package jnacontrib.x11.demos;
|
||||
|
||||
import jnacontrib.x11.api.X;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.TableModelListener;
|
||||
import javax.swing.table.TableModel;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Demonstrates some possibilities on your X Window System.
|
||||
*
|
||||
* @author Stefan Endrullis
|
||||
*/
|
||||
public class XDesktopDemo extends JFrame {
|
||||
public static void main(String[] args) throws X.X11Exception {
|
||||
new XDesktopDemo();
|
||||
}
|
||||
|
||||
private X.Display display = new X.Display();
|
||||
private JList desktopList;
|
||||
private JTable windowTable;
|
||||
private JButton refreshButton;
|
||||
private JButton moveWindowToDesktopButton;
|
||||
private JButton goToDesktopButton;
|
||||
private JButton moveWindowAndGoToDesktopButton;
|
||||
private JButton closeWindowButton;
|
||||
private JButton goToWindowButton;
|
||||
private JButton showDesktop;
|
||||
|
||||
public XDesktopDemo() throws X.X11Exception {
|
||||
super("XDesktopDemo");
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
initGui();
|
||||
|
||||
refreshDesktopsAndWindows();
|
||||
|
||||
pack();
|
||||
addListeners();
|
||||
setVisible(true);
|
||||
|
||||
printWmInfo();
|
||||
}
|
||||
|
||||
private void printWmInfo() throws X.X11Exception {
|
||||
X.Window wm = display.getWindowManagerInfo();
|
||||
System.out.println("wm.getTitle() = " + wm.getTitle());
|
||||
System.out.println("wm.getWindowClass() = " + wm.getWindowClass());
|
||||
System.out.println("wm.getPID() = " + wm.getPID());
|
||||
}
|
||||
|
||||
private void addListeners() {
|
||||
refreshButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
try {
|
||||
refreshDesktopsAndWindows();
|
||||
} catch (X.X11Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
goToDesktopButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
int desktopNr = desktopList.getSelectedIndex();
|
||||
if (desktopNr >= 0) {
|
||||
try {
|
||||
display.switchDesktop(desktopNr);
|
||||
display.flush();
|
||||
} catch (X.X11Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
goToWindowButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
X.Window window = getSelectedWindow();
|
||||
try {
|
||||
window.activate();
|
||||
display.flush();
|
||||
} catch (X.X11Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
showDesktop.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
try {
|
||||
display.showingDesktop(true);
|
||||
display.flush();
|
||||
} catch (X.X11Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
moveWindowToDesktopButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
X.Window window = getSelectedWindow();
|
||||
try {
|
||||
window.moveToDesktop(desktopList.getSelectedIndex());
|
||||
display.flush();
|
||||
} catch (X.X11Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
moveWindowAndGoToDesktopButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
X.Window window = getSelectedWindow();
|
||||
try {
|
||||
window.moveToDesktop(desktopList.getSelectedIndex());
|
||||
window.activate();
|
||||
display.flush();
|
||||
} catch (X.X11Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
closeWindowButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
X.Window window = getSelectedWindow();
|
||||
try {
|
||||
window.close();
|
||||
display.flush();
|
||||
} catch (X.X11Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private X.Window getSelectedWindow() {
|
||||
WindowTableModel tableModel = (WindowTableModel) windowTable.getModel();
|
||||
return tableModel.getWindow(windowTable.getSelectedRow());
|
||||
}
|
||||
|
||||
private void refreshDesktopsAndWindows() throws X.X11Exception {
|
||||
// update desktop list
|
||||
X.Desktop[] desktops = display.getDesktops();
|
||||
ArrayList list = new ArrayList(desktops.length);
|
||||
for (int i = 0; i < desktops.length; i++) {
|
||||
list.add(desktops[i].name);
|
||||
}
|
||||
desktopList.clearSelection();
|
||||
desktopList.setModel(new SimpleListModel(list));
|
||||
|
||||
// select active desktop
|
||||
int activeDesktop = display.getActiveDesktopNumber();
|
||||
desktopList.setSelectedIndex(activeDesktop);
|
||||
|
||||
// update window list
|
||||
int activeWindowId = display.getActiveWindow().getID();
|
||||
int activeWindowNumber = -1;
|
||||
X.Window[] windows = display.getWindows();
|
||||
String[] head = new String[]{
|
||||
"ID", "Desktop", "Title",
|
||||
"X", "Y", "Width", "Height"
|
||||
};
|
||||
String[][] data = new String[windows.length][head.length];
|
||||
for (int i = 0; i < windows.length; i++) {
|
||||
X.Window window = windows[i];
|
||||
X.Window.Geometry geo = window.getGeometry();
|
||||
int windowId = window.getID();
|
||||
data[i][0] = String.format("0x%08X", new Object[]{new Integer(windowId)});
|
||||
data[i][1] = "" + window.getDesktop();
|
||||
data[i][2] = window.getTitle();
|
||||
data[i][3] = "" + geo.x;
|
||||
data[i][4] = "" + geo.y;
|
||||
data[i][5] = "" + geo.width;
|
||||
data[i][6] = "" + geo.height;
|
||||
if (windowId == activeWindowId) {
|
||||
activeWindowNumber = i;
|
||||
}
|
||||
}
|
||||
windowTable.setModel(new WindowTableModel(head, data, windows));
|
||||
if (activeWindowNumber >= 0) {
|
||||
windowTable.getSelectionModel().setSelectionInterval(activeWindowNumber, activeWindowNumber);
|
||||
}
|
||||
}
|
||||
|
||||
private void initGui() {
|
||||
JPanel mainPanel = new JPanel();
|
||||
mainPanel.setLayout(new GridBagLayout());
|
||||
final JPanel panel1 = new JPanel();
|
||||
panel1.setLayout(new GridBagLayout());
|
||||
GridBagConstraints gbc;
|
||||
gbc = new GridBagConstraints();
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy = 0;
|
||||
gbc.weightx = 0.8;
|
||||
gbc.weighty = 1.0;
|
||||
gbc.fill = GridBagConstraints.BOTH;
|
||||
mainPanel.add(panel1, gbc);
|
||||
panel1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLoweredBevelBorder(), "Desktops"));
|
||||
desktopList = new JList();
|
||||
gbc = new GridBagConstraints();
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy = 0;
|
||||
gbc.weightx = 1.0;
|
||||
gbc.weighty = 1.0;
|
||||
gbc.fill = GridBagConstraints.BOTH;
|
||||
panel1.add(desktopList, gbc);
|
||||
final JPanel panel2 = new JPanel();
|
||||
panel2.setLayout(new GridBagLayout());
|
||||
gbc = new GridBagConstraints();
|
||||
gbc.gridx = 1;
|
||||
gbc.gridy = 0;
|
||||
gbc.weightx = 1.0;
|
||||
gbc.weighty = 1.0;
|
||||
gbc.fill = GridBagConstraints.BOTH;
|
||||
mainPanel.add(panel2, gbc);
|
||||
panel2.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLoweredBevelBorder(), "Windows"));
|
||||
final JScrollPane scrollPane1 = new JScrollPane();
|
||||
gbc = new GridBagConstraints();
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy = 0;
|
||||
gbc.weightx = 1.0;
|
||||
gbc.weighty = 1.0;
|
||||
gbc.fill = GridBagConstraints.BOTH;
|
||||
panel2.add(scrollPane1, gbc);
|
||||
windowTable = new JTable();
|
||||
windowTable.setEnabled(true);
|
||||
scrollPane1.setViewportView(windowTable);
|
||||
final JPanel panel3 = new JPanel();
|
||||
panel3.setLayout(new GridBagLayout());
|
||||
gbc = new GridBagConstraints();
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy = 1;
|
||||
gbc.gridwidth = 2;
|
||||
gbc.weightx = 1.0;
|
||||
gbc.weighty = 1.0;
|
||||
gbc.fill = GridBagConstraints.BOTH;
|
||||
mainPanel.add(panel3, gbc);
|
||||
panel3.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLoweredBevelBorder(), "Actions"));
|
||||
goToDesktopButton = new JButton();
|
||||
goToDesktopButton.setText("go to desktop");
|
||||
gbc = new GridBagConstraints();
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy = 1;
|
||||
gbc.gridwidth = 1;
|
||||
gbc.fill = GridBagConstraints.HORIZONTAL;
|
||||
panel3.add(goToDesktopButton, gbc);
|
||||
refreshButton = new JButton();
|
||||
refreshButton.setText("refresh");
|
||||
gbc = new GridBagConstraints();
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy = 0;
|
||||
gbc.fill = GridBagConstraints.HORIZONTAL;
|
||||
panel3.add(refreshButton, gbc);
|
||||
goToWindowButton = new JButton();
|
||||
goToWindowButton.setText("go to window");
|
||||
gbc = new GridBagConstraints();
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy = 2;
|
||||
gbc.fill = GridBagConstraints.HORIZONTAL;
|
||||
panel3.add(goToWindowButton, gbc);
|
||||
moveWindowAndGoToDesktopButton = new JButton();
|
||||
moveWindowAndGoToDesktopButton.setText("move window and go to desktop");
|
||||
gbc = new GridBagConstraints();
|
||||
gbc.gridx = 1;
|
||||
gbc.gridy = 2;
|
||||
gbc.fill = GridBagConstraints.HORIZONTAL;
|
||||
panel3.add(moveWindowAndGoToDesktopButton, gbc);
|
||||
closeWindowButton = new JButton();
|
||||
closeWindowButton.setText("close window");
|
||||
gbc = new GridBagConstraints();
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy = 3;
|
||||
gbc.fill = GridBagConstraints.HORIZONTAL;
|
||||
panel3.add(closeWindowButton, gbc);
|
||||
moveWindowToDesktopButton = new JButton();
|
||||
moveWindowToDesktopButton.setText("move window to desktop");
|
||||
gbc = new GridBagConstraints();
|
||||
gbc.gridx = 1;
|
||||
gbc.gridy = 1;
|
||||
gbc.fill = GridBagConstraints.HORIZONTAL;
|
||||
panel3.add(moveWindowToDesktopButton, gbc);
|
||||
showDesktop = new JButton();
|
||||
showDesktop.setText("show desktop");
|
||||
gbc = new GridBagConstraints();
|
||||
gbc.gridx = 1;
|
||||
gbc.gridy = 0;
|
||||
gbc.fill = GridBagConstraints.HORIZONTAL;
|
||||
panel3.add(showDesktop, gbc);
|
||||
|
||||
// more attributes
|
||||
desktopList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
windowTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
|
||||
setContentPane(mainPanel);
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple ListModel managing a list of objects.
|
||||
*/
|
||||
public static class SimpleListModel extends AbstractListModel {
|
||||
private ArrayList list;
|
||||
|
||||
public SimpleListModel(ArrayList list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public int getSize() { return list.size(); }
|
||||
public Object getElementAt(int i) { return list.get(i); }
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple TableModel managing an array of Strings.
|
||||
*/
|
||||
public static class WindowTableModel implements TableModel {
|
||||
private String[] head;
|
||||
private String[][] data;
|
||||
private X.Window[] windows;
|
||||
|
||||
public WindowTableModel(String[] head, String[][] data, X.Window[] windows) {
|
||||
this.head = head;
|
||||
this.data = data;
|
||||
this.windows = windows;
|
||||
}
|
||||
|
||||
public int getRowCount() {
|
||||
return data.length;
|
||||
}
|
||||
public int getColumnCount() {
|
||||
return head.length;
|
||||
}
|
||||
public String getColumnName(int columnIndex) {
|
||||
return head[columnIndex];
|
||||
}
|
||||
public Class getColumnClass(int columnIndex) {
|
||||
return String.class;
|
||||
}
|
||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
||||
return false;
|
||||
}
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
return data[rowIndex][columnIndex];
|
||||
}
|
||||
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
|
||||
}
|
||||
public void addTableModelListener(TableModelListener l) {
|
||||
}
|
||||
public void removeTableModelListener(TableModelListener l) {
|
||||
}
|
||||
|
||||
public X.Window getWindow(int rowIndex) {
|
||||
return windows[rowIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/* Copyright (c) 2008 Stefan Endrullis, All Rights Reserved
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* <p/>
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*/
|
||||
package jnacontrib.x11.demos;
|
||||
|
||||
import jnacontrib.x11.api.X;
|
||||
import com.sun.jna.examples.unix.X11;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.sun.jna.NativeLong;
|
||||
|
||||
/**
|
||||
* Demonstration of the X extension XTest.
|
||||
*/
|
||||
public class XTestDemo {
|
||||
private static final long DELAY = 20;
|
||||
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
new XTestDemo();
|
||||
}
|
||||
|
||||
private X.Display display = new X.Display();
|
||||
|
||||
public XTestDemo() throws InterruptedException {
|
||||
IntByReference event_basep = new IntByReference();
|
||||
IntByReference error_basep = new IntByReference();
|
||||
IntByReference majorp = new IntByReference();
|
||||
IntByReference minorp = new IntByReference();
|
||||
|
||||
if (X11.XTest.INSTANCE.XTestQueryExtension(
|
||||
display.getX11Display(),
|
||||
event_basep,
|
||||
error_basep,
|
||||
majorp,
|
||||
minorp)) {
|
||||
|
||||
System.out.println("event_basep.getValue() = " + event_basep.getValue());
|
||||
System.out.println("error_basep.getValue() = " + error_basep.getValue());
|
||||
System.out.println("majorp.getValue() = " + majorp.getValue());
|
||||
System.out.println("minorp.getValue() = " + minorp.getValue());
|
||||
}
|
||||
|
||||
Thread.sleep(1000);
|
||||
|
||||
type("hello world");
|
||||
// typeKey("Return");
|
||||
// type("it works!");
|
||||
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
|
||||
private void type(String text) {
|
||||
for (int i = 0; i < text.length(); i++) {
|
||||
char myChar = text.charAt(i);
|
||||
|
||||
// get keycode from character
|
||||
switch (myChar) {
|
||||
case ' ': typeKey(65); break;
|
||||
default: typeKey("" + myChar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void typeKey(String keyName) {
|
||||
X11.KeySym keysym = X11.INSTANCE.XStringToKeysym(keyName);
|
||||
typeKey(X11.INSTANCE.XKeysymToKeycode(display.getX11Display(), keysym));
|
||||
}
|
||||
|
||||
private void typeKey(int keyCode) {
|
||||
if (keyCode == -1) return;
|
||||
|
||||
// press key
|
||||
X11.XTest.INSTANCE.XTestFakeKeyEvent(display.getX11Display(), keyCode, true, new NativeLong(DELAY));
|
||||
X11.INSTANCE.XFlush(display.getX11Display());
|
||||
// release key
|
||||
X11.XTest.INSTANCE.XTestFakeKeyEvent(display.getX11Display(), keyCode, false, new NativeLong(DELAY));
|
||||
X11.INSTANCE.XFlush(display.getX11Display());
|
||||
}
|
||||
}
|
||||
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
BIN
Arquivo binário não exibido.
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
externo
BIN
Arquivo binário não exibido.
BIN
Arquivo binário não exibido.
BIN
Arquivo binário não exibido.
Arquivo binário não exibido.
Arquivo binário não exibido.
@@ -0,0 +1,5 @@
|
||||
qRNQnmsMoNMDGXUenVfHVPuFPrNBGUUdBvfgtIdgVQWSbAa
|
||||
mj2KW7Oo9ud83ZbEKfK2xx922L04T>gYjDdLjGld4Wa6MPW
|
||||
NrqPtxROppqOmmqROMPSTnMmRqNOMnMnoPVSXswPsVXQwXV
|
||||
SPVVUtUNQmnmqmUUnopmqsvommmmmUUnopmqsvommmmmUUg
|
||||
kXkabskgXsXkkbqUUnmm
|
||||
+210
-102
@@ -1,167 +1,275 @@
|
||||
#
|
||||
# JNA JNI dispatch and test library
|
||||
# Makefile for JNA native bits
|
||||
# Copyright (c) 2007 Timothy Wall All Rights Reserved
|
||||
#
|
||||
# You may need to run 'ant javah' at the root before performing a build from
|
||||
# this directory.
|
||||
#
|
||||
# To build the JNI headers, do 'ant javah' from the root
|
||||
# To build the windows DLL using gcc, do
|
||||
# make CC=gcc
|
||||
# If you have the OSX 10.4 universal SDK installed,
|
||||
# to target ppc on OSX/i386, do
|
||||
# make ARCH=ppc
|
||||
# to target i386 on OSX/PPC, do
|
||||
# make ARCH=i386
|
||||
OS=$(shell uname | sed -e 's/CYGWIN.*/win32/g' \
|
||||
-e 's/SunOS.*/sparc/g' \
|
||||
# To build with debug information, use 'make DEBUG=true'
|
||||
#
|
||||
# Supported platforms (built and tested):
|
||||
#
|
||||
# Windows 2000/XP/2003/Vista (x86)
|
||||
# Darwin/OS X (i386/x86_64/ppc)
|
||||
# Linux (i386/amd64)
|
||||
# Solaris (i386/amd64/sparc/sparcv9)
|
||||
# FreeBSD (i386/amd64)
|
||||
#
|
||||
|
||||
# Systems which support POSIX signals may be able to support VM crash
|
||||
# protection simply by defining HAVE_PROTECTION. This has been enabled
|
||||
# only for those platforms on which it has been tested successfully.
|
||||
|
||||
OS=$(shell uname | sed -e 's/\(CYGWIN\|MINGW32\).*/win32/g' \
|
||||
-e 's/SunOS.*/solaris/g' \
|
||||
-e 's/FreeBSD.*/freebsd/g' \
|
||||
-e 's/OpenBSD.*/openbsd/g' \
|
||||
-e 's/Darwin.*/darwin/g' \
|
||||
-e 's/Linux.*/linux/g')
|
||||
|
||||
VERSION=3.2.1 # auto-generated by ant
|
||||
CHECKSUM=c870290c36c8d3fdf85db7c782febc3f # auto-generated by ant
|
||||
|
||||
JAVA_INCLUDES=-I"$(JAVA_HOME)/include" \
|
||||
-I"$(JAVA_HOME)/include/$(OS)"
|
||||
|
||||
BUILD=../build/native
|
||||
JAVAH=$(BUILD)
|
||||
INSTALLDIR=../build/$(OS)
|
||||
ASMDISPATCH_OBJS=$(BUILD)/dispatch_$(ARCH).o
|
||||
JNIDISPATCH_OBJS=$(BUILD)/dispatch.o \
|
||||
$(BUILD)/callback.o \
|
||||
$(ASMDISPATCH_OBJS)
|
||||
JNIDISPATCH_OBJS=$(BUILD)/dispatch.o $(BUILD)/callback.o $(EXTRAOBJS)
|
||||
RSRC=$(BUILD)/rsrc.o
|
||||
ifneq ($(DYNAMIC_LIBFFI),true)
|
||||
FFI_SRC=$(shell pwd)/libffi
|
||||
FFI_BUILD=$(BUILD)/libffi
|
||||
FFI_LIB=$(FFI_BUILD)/.libs/libffi$(ARSFX)
|
||||
FFI_ENV=CC="$(CC)" CFLAGS="$(COPT) $(CDEBUG)" CPPFLAGS="$(CDEFINES)"
|
||||
FFI_CONFIG=--enable-static --disable-shared --with-pic=yes
|
||||
endif
|
||||
LIBRARY=$(BUILD)/$(LIBPFX)jnidispatch$(JNISFX)
|
||||
TESTLIB=$(BUILD)/$(LIBPFX)testlib$(LIBSFX)
|
||||
TESTLIB2=$(BUILD)/$(LIBPFX)testlib2$(LIBSFX)
|
||||
|
||||
# Reasonable defaults based on GCC
|
||||
LIBPFX=lib
|
||||
LIBSFX=.so
|
||||
ARSFX=.a
|
||||
JNISFX=$(LIBSFX)
|
||||
CC=gcc
|
||||
LD=gcc
|
||||
LIBS=
|
||||
# Default to Sun recommendations for JNI compilation
|
||||
# Optimization causes errors in FP callback return values on linux/x86,
|
||||
# crashes osx/x86, and other errors on ppc
|
||||
# Turning it off eliminates those failures
|
||||
#COPT=-O2 -fomit-frame-pointer
|
||||
COPT=-fno-omit-frame-pointer -fno-strict-aliasing
|
||||
COPT=-O2 -fno-omit-frame-pointer -fno-strict-aliasing
|
||||
CASM=-S
|
||||
ifeq ($(DEBUG),true)
|
||||
CDEBUG=-g
|
||||
endif
|
||||
CFLAGS_EXTRA=
|
||||
COUT=-o $@
|
||||
CINCLUDES=$(JAVA_INCLUDES) -I"$(JAVAH)"
|
||||
CINCLUDES=$(JAVA_INCLUDES) -I"$(JAVAH)" -I$(FFI_BUILD)/include
|
||||
CDEFINES=-D_REENTRANT
|
||||
PCFLAGS=-W -Wall -Wno-unused -Wno-parentheses -Werror
|
||||
CFLAGS=$(PCFLAGS) $(COPT) $(CDEBUG) $(CDEFINES) $(CINCLUDES)
|
||||
PCFLAGS=-W -Wall -Wno-unused -Wno-parentheses
|
||||
CFLAGS=$(PCFLAGS) $(CFLAGS_EXTRA) $(COPT) $(CDEBUG) $(CDEFINES) $(CINCLUDES) \
|
||||
-DVERSION='"$(VERSION)"' -DCHECKSUM='"$(CHECKSUM)"'
|
||||
LDFLAGS=-o $@ -shared
|
||||
ifeq ($(DYNAMIC_LIBFFI),true)
|
||||
CFLAGS += $(shell pkg-config --cflags libffi 2>/dev/null || echo)
|
||||
LIBS += $(shell pkg-config --libs libffi 2>/dev/null || echo -lffi)
|
||||
else
|
||||
# -static-libgcc avoids gcc library incompatibilities across linux systems
|
||||
LDFLAGS=-o $@ -shared -Wl,-soname,$@ -static-libgcc
|
||||
LIBDIR=$(JAVA_HOME)/jre/lib/$(ARCH)
|
||||
LIBS=-L"$(LIBDIR)" -ljawt
|
||||
LDFLAGS += -static-libgcc
|
||||
endif
|
||||
# Avoid bug in X11-based 1.5/1.6 VMs; dynamically load instead of linking
|
||||
# See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6539705
|
||||
#LIBS=-L"$(LIBDIR)" -ljawt
|
||||
STRIP=strip -x
|
||||
# end defaults
|
||||
|
||||
ifeq ($(OS),win32)
|
||||
# Uncomment this line to use MSVC
|
||||
#CC=cl
|
||||
ARCH=i386
|
||||
|
||||
ifeq ($(CC),cl)
|
||||
LD=link
|
||||
COPT=-O1 -Op
|
||||
ifeq ($(DEBUG),true)
|
||||
COPT=-Od
|
||||
DBG=d
|
||||
CDEBUG=-D_DEBUG -GZ -Zi
|
||||
endif
|
||||
COUT=-Fo$@
|
||||
CDEFINES=-DWIN32 -D_WINDOWS -D_MBCS -D_USRDLL -DNATIVE_EXPORTS
|
||||
PCFLAGS=-nologo -MD$(DBG) -W3 -WX -GX -YX -Fd$(@D)/$* -Fp$(@D)/$*
|
||||
CASM=-FAs
|
||||
|
||||
LDFLAGS=/pdb:$(subst .dll,,$@).pdb /implib:$(subst .dll,,$@).lib /debug /machine:i386 /pdbtype:sept /dll /nologo /opt:REF /incremental:no /out:$@
|
||||
LIBDIR=/libpath:"$(JAVA_HOME)/lib"
|
||||
LIBS=$(LIBDIR) jawt.lib
|
||||
ARCH=$(shell uname -m | sed 's/i.86/i386/g')
|
||||
CDEFINES=-DHAVE_PROTECTION -DPSAPI_VERSION=1
|
||||
LIBS=-lpsapi
|
||||
WINDRES=windres
|
||||
EXTRAOBJS=$(RSRC)
|
||||
STRIP=@echo
|
||||
else
|
||||
CDEFINES=-D__int64="long long" -D_JNI_IMPLEMENTATION
|
||||
PCFLAGS=-mno-cygwin
|
||||
# NOTE: have to recreate specs or dllcrt2.o isn't found
|
||||
SPECS=$(BUILD)/specs.new
|
||||
LDFLAGS+=-mno-cygwin -Wl,--add-stdcall-alias -specs $(SPECS) -L /lib/mingw
|
||||
LIBDIR="$(JAVA_HOME)/lib"
|
||||
LIBS=$(LIBDIR)/jawt.lib
|
||||
endif
|
||||
|
||||
LIBPFX=
|
||||
LIBSFX=.dll
|
||||
|
||||
ifeq ($(CC),gcc)
|
||||
CC += -mno-cygwin
|
||||
LD += -mno-cygwin -Wl,--add-stdcall-alias
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),amd64)
|
||||
|
||||
WINDRES=/usr/local/mingw64-cross/bin/x86_64-pc-mingw32-windres
|
||||
|
||||
# Uncomment to enable MINGW64 cross compiler
|
||||
# Should build properly as of 090601, but lacks SEH, so MSVC build is preferred
|
||||
#MINGW = x86_64-pc-mingw32-gcc
|
||||
ifneq ($(MINGW),)
|
||||
CC = $(MINGW) -m64 -mno-cygwin
|
||||
LD = $(CC)
|
||||
LDFLAGS=-o $@ -shared
|
||||
LIBS= -lmingwex -lpsapi -lkernel32 -lmsvcrt
|
||||
FFI_CONFIG += --host=x86_64-pc-mingw32
|
||||
else
|
||||
# MSVC (wrapper scripts)
|
||||
CC=$(FFI_SRC)/../cc.sh -m64
|
||||
LD=$(FFI_SRC)/../ld.sh -m64
|
||||
COPT=
|
||||
LIBS=psapi.lib
|
||||
ARSFX=.lib
|
||||
FFI_CONFIG += --host=x86_64-pc-mingw32 && rm -f include/ffitarget.h && cp $(FFI_SRC)/include/*.h $(FFI_SRC)/src/x86/ffitarget.h include
|
||||
FFI_ENV += LD="$(LD)" CPP=cpp
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS),linux)
|
||||
ARCH=i386
|
||||
ARCH=$(shell uname -m | sed 's/i.86/i386/g')
|
||||
PCFLAGS+=-fPIC
|
||||
# Avoid 1.5/1.6 bug caused by linking directly to -ljawt
|
||||
CDEFINES+=-DNEED_JAWT_HACK
|
||||
LIBS=
|
||||
CDEFINES+=-DHAVE_PROTECTION
|
||||
LDFLAGS+=-Wl,-soname,$@
|
||||
endif
|
||||
|
||||
# FIXME untested
|
||||
ifeq ($(OS),sparc)
|
||||
ARCH=sparc
|
||||
ifeq ($(OS),freebsd)
|
||||
ARCH=$(shell uname -m | sed 's/i.86/i386/g')
|
||||
PCFLAGS+=-fPIC
|
||||
# Avoid 1.5/1.6 bug caused by linking directly to -ljawt
|
||||
CDEFINES+=-DNEED_JAWT_HACK
|
||||
LIBS=
|
||||
CINCLUDES+=-I/usr/X11R6/include
|
||||
LDFLAGS=-o $@ -shared
|
||||
CDEFINES+=-DHAVE_PROTECTION -DFFI_MMAP_EXEC_WRIT
|
||||
endif
|
||||
|
||||
ifeq ($(OS),openbsd)
|
||||
ARCH=$(shell uname -m | sed 's/i.86/i386/g')
|
||||
PCFLAGS+=-fPIC
|
||||
CINCLUDES+=-I/usr/X11R6/include
|
||||
LDFLAGS=-o $@ -shared
|
||||
CDEFINES+=-DHAVE_PROTECTION -DFFI_MMAP_EXEC_WRIT
|
||||
endif
|
||||
|
||||
ifeq ($(OS),solaris)
|
||||
ifeq ($(ARCH),)
|
||||
ARCH=$(shell uname -p)
|
||||
endif
|
||||
PCFLAGS+=-fPIC
|
||||
CDEFINES+=-DHAVE_PROTECTION -DFFI_MMAP_EXEC_WRIT
|
||||
ifeq ($(ARCH), sparcv9)
|
||||
# alter CC instead of PCFLAGS, since we need to pass it down to libffi
|
||||
# configure and some of the other settings in PCFLAGS might make the build
|
||||
# choke
|
||||
CC += -m64
|
||||
LD += -m64
|
||||
endif
|
||||
endif
|
||||
|
||||
# Enable 64-bit builds if the arch demands it
|
||||
ifeq ($(CC),gcc)
|
||||
ifeq ($(ARCH),amd64)
|
||||
CC += -m64
|
||||
LD += -m64
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS),darwin)
|
||||
ARCH=$(shell arch)
|
||||
ifeq ($(ARCH),ppc)
|
||||
ALT_ARCHS=i386
|
||||
else
|
||||
ALT_ARCHS=ppc
|
||||
endif
|
||||
LIBSFX=.dylib
|
||||
JNISFX=.jnilib
|
||||
# Use universal binary when updated to work with gcc 4
|
||||
ifneq ($(SDKROOT),)
|
||||
ifneq ($(UNIVERSAL),)
|
||||
ARCHFLAGS=-arch ppc -arch i386 -isysroot $(SDKROOT)
|
||||
ASMDISPATCH_OBJS=$(BUILD)/dispatch_i386.o $(BUILD)/dispatch_ppc.o
|
||||
SYSLIBROOT=-Wl,-syslibroot,$(SDKROOT)
|
||||
ISYSROOT=-isysroot $(SDKROOT)
|
||||
ARCHFLAGS=-arch ppc -arch i386
|
||||
ifneq ($(findstring 10.5,$(SDKROOT)),)
|
||||
ALT_ARCHS+=x86_64
|
||||
ARCHFLAGS+=-arch x86_64
|
||||
endif
|
||||
endif
|
||||
PCFLAGS+=$(ISYSROOT) -x objective-c
|
||||
CDEFINES+=-DTARGET_RT_MAC_CFM=0 -DFFI_MMAP_EXEC_WRIT
|
||||
LDFLAGS=$(ARCHFLAGS) -dynamiclib -o $@ -framework JavaVM \
|
||||
-compatibility_version $(shell echo ${VERSION}|sed 's/^\([0-9][0-9]*\).*/\1/g') \
|
||||
-current_version $(VERSION) \
|
||||
-mmacosx-version-min=10.3 \
|
||||
-install_name ${@F} \
|
||||
$(SYSLIBROOT)
|
||||
# JAWT linkage handled by -framework JavaVM
|
||||
LIBS=
|
||||
endif
|
||||
|
||||
# Unfortunately, we have to use different libffi include files depending on
|
||||
# the target, so we can't do a simple universal build on darwin. Do
|
||||
# separate builds, then merge the results.
|
||||
$(BUILD)/%.o : %.c dispatch.h $(FFI_LIB)
|
||||
@mkdir -p $(BUILD)
|
||||
ifneq ($(SDKROOT),)
|
||||
$(CC) -arch $(ARCH) $(CFLAGS) -c $< -o $@.$(ARCH)
|
||||
for arch in $(ALT_ARCHS); do \
|
||||
$(CC) -arch $$arch -I$(BUILD)/libffi.$$arch/include $(CFLAGS) -c $< -o $@.$$arch; \
|
||||
done
|
||||
lipo -create -output $@ $@.*
|
||||
else
|
||||
ARCHFLAGS=-arch $(ARCH) -isysroot $(SDKROOT)
|
||||
endif
|
||||
endif
|
||||
PCFLAGS+=$(ARCHFLAGS)
|
||||
CDEFINES=-DTARGET_RT_MAC_CFM=0
|
||||
LDFLAGS=$(ARCHFLAGS) -dynamiclib -o $@ -framework JavaVM
|
||||
LIBDIR=$(SDKROOT)/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Libraries
|
||||
endif
|
||||
|
||||
$(BUILD)/%.o : %.c
|
||||
@mkdir -p $(BUILD)
|
||||
$(CC) $(CFLAGS) -c $< $(COUT)
|
||||
endif
|
||||
|
||||
$(BUILD)/%.o: %.s
|
||||
@mkdir -p $(BUILD)
|
||||
$(AS) $(ASFLAGS) $< -o $@
|
||||
|
||||
# Generate assembly listing
|
||||
$(BUILD)/%.asm: %.c
|
||||
@mkdir -p $(BUILD)
|
||||
$(CC) $(CFLAGS) $(CASM) -c $<
|
||||
@if [ -f $*.asm ]; then mv $*.asm $@; fi
|
||||
@rm -f $*.obj ${@D}/$*.o
|
||||
|
||||
all: $(LIBRARY) $(TESTLIB)
|
||||
all: $(LIBRARY) $(TESTLIB) $(TESTLIB2)
|
||||
|
||||
install:
|
||||
mkdir $(INSTALLDIR)
|
||||
cp $(LIBRARY) $(INSTALLDIR)
|
||||
|
||||
$(BUILD)/test_dispatch: test_dispatch.c $(BUILD)/dispatch.o $(BUILD)/dispatch_$(ARCH).o $(BUILD)/callback.o
|
||||
$(CC) $(CFLAGS) $< $(BUILD)/dispatch.o $(BUILD)/dispatch_$(ARCH).o $(BUILD)/callback.o $(COUT)
|
||||
$(RSRC): $(BUILD)/jnidispatch.rc
|
||||
$(WINDRES) -i $< -o $@ \
|
||||
|| (echo > $@.c && $(CC) $(CFLAGS) -c $@.c $(COUT))
|
||||
|
||||
$(BUILD)/specs.new:
|
||||
gcc -dumpspecs | sed s%dllcrt2%/lib/mingw/dllcrt2%g > $@
|
||||
$(LIBRARY): $(JNIDISPATCH_OBJS) $(FFI_LIB)
|
||||
$(LD) $(LDFLAGS) $(JNIDISPATCH_OBJS) $(FFI_LIB) $(LIBS)
|
||||
|
||||
$(LIBRARY): $(JNIDISPATCH_OBJS) $(SPECS)
|
||||
$(LD) $(LDFLAGS) $(JNIDISPATCH_OBJS) $(LIBS)
|
||||
$(TESTLIB): $(BUILD)/testlib.o
|
||||
$(LD) $(LDFLAGS) $<
|
||||
|
||||
$(TESTLIB): $(BUILD)/testlib.o $(SPECS)
|
||||
$(LD) $(LDFLAGS) $< $(TESTDEF)
|
||||
ifeq ($(ARSFX),.lib)
|
||||
TESTDEP=$(TESTLIB:.dll=.lib)
|
||||
else
|
||||
TESTDEP=$(TESTLIB)
|
||||
endif
|
||||
$(TESTLIB2): $(BUILD)/testlib2.o
|
||||
$(LD) $(LDFLAGS) $< $(TESTDEP)
|
||||
|
||||
ifneq ($(DYNAMIC_LIBFFI),true)
|
||||
$(FFI_LIB):
|
||||
@mkdir -p $(FFI_BUILD)
|
||||
@if [ ! -f $(FFI_BUILD)/Makefile ]; then \
|
||||
echo "Configuring libffi ($(ARCH))"; \
|
||||
(cd $(FFI_BUILD) \
|
||||
&& $(FFI_ENV) $(FFI_SRC)/configure $(FFI_CONFIG)); \
|
||||
fi
|
||||
$(MAKE) -C $(FFI_BUILD)
|
||||
ifneq ($(SDKROOT),)
|
||||
@for arch in $(ALT_ARCHS); do \
|
||||
mkdir -p $(BUILD)/libffi.$$arch; \
|
||||
if [ ! -f $(BUILD)/libffi.$$arch/Makefile ]; then \
|
||||
echo "Configuring libffi ($$arch)"; \
|
||||
(cd $(BUILD)/libffi.$$arch \
|
||||
&& CC="$(CC)" CFLAGS="-arch $$arch $(ISYSROOT) $(COPT) $(CDEBUG)" CPPFLAGS="$(CDEFINES)" \
|
||||
LDFLAGS="-arch $$arch" \
|
||||
$(FFI_SRC)/configure $(FFI_CONFIG) --host=$$arch-apple-darwin --disable-dependency-tracking); \
|
||||
fi; \
|
||||
$(MAKE) -C $(BUILD)/libffi.$$arch; \
|
||||
done
|
||||
/usr/bin/libtool -static -o $@.tmp $(FFI_BUILD)/.libs/${@F} $(BUILD)/libffi.*/.libs/${@F}
|
||||
mv $@.tmp $@
|
||||
endif
|
||||
endif
|
||||
|
||||
clean:
|
||||
$(RM) -rf $(BUILD)
|
||||
$(RM) -rf $(BUILD)
|
||||
|
||||
version:
|
||||
@echo version=$(VERSION)
|
||||
|
||||
#EOF
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
--- libffi notes ---
|
||||
libffi has been copied from GCC (originally 4.2.0, since updated to match the
|
||||
trunk).
|
||||
libffi last synched: 071126 by twall
|
||||
|
||||
Files required for standalone configure:
|
||||
config-ml.in (from root)
|
||||
config.guess (from root)
|
||||
config.sub (from root)
|
||||
depcomp (from root)
|
||||
install-sh (from root)
|
||||
ltcf-c.sh (from ???)
|
||||
ltconfig (from ???)
|
||||
ltmain.sh (from root)
|
||||
missing (from root)
|
||||
|
||||
Wayne Meissner did the original work to integrate libffi into JNA and to get
|
||||
it working on half a dozen different platforms.
|
||||
|
||||
+383
-351
@@ -1,404 +1,436 @@
|
||||
/* Copyright (c) 2007 Timothy Wall, All Rights Reserved
|
||||
* Copyright (c) 2007 Wayne Meissner, All Rights Reserved
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* <p/>
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <jni.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#else
|
||||
# include <sys/types.h>
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
#include "dispatch.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#define NO_UNDERSCORE
|
||||
#endif
|
||||
static void callback_dispatch(ffi_cif*, void*, void**, void*);
|
||||
|
||||
static type_t get_type(char type);
|
||||
static void callback_dispatch(JavaVM*, callback*, char*);
|
||||
|
||||
/* Template glue to translate native callback invocations into
|
||||
* callback_dispatch which can perform the java invocation.
|
||||
*/
|
||||
#define ARG_JVM 0x11111111
|
||||
#define ARG_CB 0x22222222
|
||||
#define ARG_DISPATCH 0xdeadbeef
|
||||
#define CALLEE_SIZE 0x99999999
|
||||
|
||||
#ifdef _MSC_VER
|
||||
static void
|
||||
callback_asm_template() {
|
||||
|
||||
/* Windows/MSVC -O1 */
|
||||
// push ebp
|
||||
// mov ebp,esp
|
||||
__asm {
|
||||
lea eax,[ebp+8]
|
||||
push eax
|
||||
push ARG_CB
|
||||
push ARG_JVM
|
||||
lea eax,callback_dispatch
|
||||
call eax
|
||||
add esp,12
|
||||
// if callback is stdcall, caller expects us to clean up stack
|
||||
mov ecx,CALLEE_SIZE
|
||||
cmp ecx,0
|
||||
je not_stdcall
|
||||
pop ebp
|
||||
pop ecx
|
||||
add esp,CALLEE_SIZE
|
||||
push ecx
|
||||
push ebp
|
||||
not_stdcall:
|
||||
}
|
||||
// pop ebp
|
||||
// ret
|
||||
}
|
||||
static void __template_end__() { }
|
||||
#define TEMPLATE_SIZE \
|
||||
((char*)__template_end__ - (char*)callback_asm_template)
|
||||
|
||||
#define RETURN_INT32(I) __asm mov eax,I
|
||||
#define RETURN_INT64(L) { \
|
||||
unsigned long _upper = (unsigned long)((L)>>32); \
|
||||
unsigned long _lower = (unsigned long)(L); \
|
||||
__asm mov eax,_lower __asm mov edx,_upper }
|
||||
#define RETURN_FP32(F) __asm fld F
|
||||
#define RETURN_FP64(D) __asm fld D
|
||||
#define RETURN_PTR(P) { \
|
||||
unsigned long _lower = (unsigned long)(P); \
|
||||
__asm mov eax,_lower }
|
||||
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
void __template_dummy__() {
|
||||
|
||||
#ifdef NO_UNDERSCORE
|
||||
asm(".globl callback_asm_template");
|
||||
asm("\ncallback_asm_template:");
|
||||
#else
|
||||
asm(".globl _callback_asm_template");
|
||||
asm("\n_callback_asm_template:");
|
||||
#endif
|
||||
|
||||
#ifdef __i386__
|
||||
|
||||
asm("push %ebp");
|
||||
asm("mov %esp,%ebp");
|
||||
asm("lea 8(%ebp),%eax");
|
||||
asm("pushl %eax");
|
||||
asm("pushl %0" :: "i" (ARG_CB));
|
||||
asm("pushl %0" :: "i" (ARG_JVM));
|
||||
asm("movl %0,%%eax" :: "i" (ARG_DISPATCH));
|
||||
asm("call *%eax");
|
||||
asm("addl $12, %esp");
|
||||
#ifdef _WIN32
|
||||
// if callback is stdcall, caller expects us to clean up stack
|
||||
asm("movl %0,%%ecx" :: "i" (CALLEE_SIZE));
|
||||
asm("cmpl $0,%ecx");
|
||||
asm("je not_stdcall");
|
||||
asm("popl %ebp");
|
||||
asm("popl %ecx");
|
||||
asm("add %0,%%esp" :: "i" (CALLEE_SIZE));
|
||||
asm("pushl %ecx");
|
||||
asm("pushl %ebp");
|
||||
asm("\nnot_stdcall:");
|
||||
#endif
|
||||
asm("popl %ebp");
|
||||
asm("ret");
|
||||
|
||||
#define RETURN_INT32(I) asm("movl %0,%%eax" :: "g" (I))
|
||||
#define RETURN_VOID RETURN_INT32(0)
|
||||
#define RETURN_INT64(L) \
|
||||
asm("movl %0,%%edx\n\tmovl %1,%%eax" :: \
|
||||
"g" (*((unsigned long*)&(L)+1)), \
|
||||
"g" (*(unsigned long*)&(L)) : "%eax","%edx")
|
||||
#define RETURN_FP32(F) asm("flds %0" :: "m" (F))
|
||||
#define RETURN_FP64(D) asm("fldl %0" :: "m" (D))
|
||||
#define RETURN_PTR(P) RETURN_INT32(((unsigned long)(P))&0xFFFFFFFF)
|
||||
|
||||
#elif __ppc__
|
||||
|
||||
#define LINKAGE 24
|
||||
#define PARAMS (32*4) // callee params unknown, use max
|
||||
#define REGS (0*4)
|
||||
#define SPACE (LINKAGE+PARAMS+REGS)
|
||||
#define ALIGN ((SPACE + 15) & -16)
|
||||
#define ARGS (ALIGN+24)
|
||||
#define ARG(N) (ARGS+((N)*4))
|
||||
asm("mflr r0");
|
||||
asm("stw r0,8(r1)");
|
||||
asm("stwu r1,%0(r1)" :: "i" (-ALIGN));
|
||||
asm("li r2,0");
|
||||
asm("\n.set CS_OFFSET,.-_callback_asm_template");
|
||||
asm("ori r2,r2,0");
|
||||
|
||||
#define STORE(GR,COUNT) \
|
||||
asm("cmpwi r2,%0" :: "i" (COUNT)); \
|
||||
asm("blt args_done"); \
|
||||
asm("stw " GR ",%0(r1)" :: "i" (ARG(COUNT-1)))
|
||||
|
||||
// ensure any used registers are copied to the stack
|
||||
// callback_dispatch doesn't use any fp regs, so don't need to save any
|
||||
STORE("r3",1);
|
||||
STORE("r4",2);
|
||||
STORE("r5",3);
|
||||
STORE("r6",4);
|
||||
STORE("r7",5);
|
||||
STORE("r8",6);
|
||||
STORE("r9",7);
|
||||
STORE("r10",8);
|
||||
asm("\nargs_done:");
|
||||
asm("li r3,0");
|
||||
asm("\n.set VM_OFFSET,.-_callback_asm_template");
|
||||
asm("ori r3,r3,0");
|
||||
asm("oris r3,r3,0");
|
||||
asm("li r4,0");
|
||||
asm("\n.set CB_OFFSET,.-_callback_asm_template");
|
||||
asm("ori r4,r4,0");
|
||||
asm("oris r4,r4,0");
|
||||
asm("addi r5,r1,%0" :: "i" (ARGS));
|
||||
asm("li r12,0");
|
||||
asm("\n.set B_OFFSET,.-_callback_asm_template");
|
||||
asm("ori r12,r12,0");
|
||||
asm("oris r12,r12,0");
|
||||
asm("mtctr r12");
|
||||
asm("bctrl");
|
||||
|
||||
asm("addi r1,r1,%0" :: "i" (ALIGN));
|
||||
asm("lwz r0,8(r1)");
|
||||
asm("mtlr r0");
|
||||
asm("blr");
|
||||
|
||||
#define RETURN_INT32(I) asm("lwz r3,%0" :: "m" (I))
|
||||
#define RETURN_INT64(L) \
|
||||
asm("mr r4,%0\n\tmr r3,%1" :: \
|
||||
"g" ((unsigned long)((L)&0xFFFFFFFF)), \
|
||||
"g" ((unsigned long)((L)>>32)) : "%r4","%r3")
|
||||
#define RETURN_FP32(F) asm("lfs f1,%0" :: "m" (F) : "%f1")
|
||||
#define RETURN_FP64(D) asm("lfd f1,%0" :: "m" (D) : "%f1")
|
||||
#define RETURN_PTR(P) asm("lwz r3,%0" :: "m" ((unsigned long)(P)) : "%r3")
|
||||
|
||||
#endif /* __<arch>__ */
|
||||
|
||||
#ifdef NO_UNDERSCORE
|
||||
asm(".globl asm_template_end");
|
||||
asm("\nasm_template_end:");
|
||||
#else
|
||||
asm(".globl _asm_template_end");
|
||||
asm("\n_asm_template_end:");
|
||||
#endif
|
||||
}
|
||||
extern void callback_asm_template();
|
||||
extern void asm_template_end();
|
||||
#define TEMPLATE_SIZE (asm_template_end-callback_asm_template)
|
||||
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#ifndef RETURN_INT32
|
||||
#define RETURN_INT32(I) return
|
||||
#define RETURN_INT64(L) return
|
||||
#define RETURN_FP32(F) return
|
||||
#define RETURN_FP64(D) return
|
||||
#define RETURN_PTR(P) return
|
||||
#undef TEMPLATE_SIZE
|
||||
#define TEMPLATE_SIZE (0)
|
||||
#endif
|
||||
static jclass classObject;
|
||||
|
||||
callback*
|
||||
create_callback(JNIEnv* env, jobject obj, jobject method,
|
||||
jobjectArray param_types, callconv_t call_conv) {
|
||||
jobjectArray param_types, jclass return_type,
|
||||
callconv_t calling_convention, jboolean direct) {
|
||||
callback* cb;
|
||||
unsigned long* insns;
|
||||
int args_size = 0;
|
||||
ffi_abi abi = FFI_DEFAULT_ABI;
|
||||
ffi_abi java_abi = FFI_DEFAULT_ABI;
|
||||
ffi_type* ffi_rtype;
|
||||
ffi_status status;
|
||||
jsize argc;
|
||||
JavaVM* vm;
|
||||
int len = TEMPLATE_SIZE;
|
||||
int rtype;
|
||||
char msg[64];
|
||||
int i;
|
||||
|
||||
if (TEMPLATE_SIZE == 0) {
|
||||
throwByName(env, "java/lang/UnsupportedOperationException",
|
||||
"Callbacks not supported on this platform");
|
||||
return NULL;
|
||||
}
|
||||
int cvt = 0;
|
||||
const char* throw_type = NULL;
|
||||
const char* throw_msg = NULL;
|
||||
|
||||
if ((*env)->GetJavaVM(env, &vm) != JNI_OK) {
|
||||
throwByName(env, "java/lang/UnsatisfiedLinkError",
|
||||
"Can't get Java VM");
|
||||
throwByName(env, EUnsatisfiedLink, "Can't get Java VM");
|
||||
return NULL;
|
||||
}
|
||||
argc = (*env)->GetArrayLength(env, param_types);
|
||||
|
||||
cb = (callback *)malloc(sizeof(callback));
|
||||
insns = (unsigned long*)malloc(len);
|
||||
cb->insns = insns;
|
||||
cb->closure = ffi_closure_alloc(sizeof(ffi_closure), &cb->x_closure);
|
||||
cb->object = (*env)->NewWeakGlobalRef(env, obj);
|
||||
cb->methodID = (*env)->FromReflectedMethod(env, method);
|
||||
cb->param_count = argc;
|
||||
cb->vm = vm;
|
||||
cb->arg_types = (ffi_type**)malloc(sizeof(ffi_type*) * argc);
|
||||
cb->java_arg_types = (ffi_type**)malloc(sizeof(ffi_type*) * (argc + 3));
|
||||
cb->arg_jtypes = (char*)malloc(sizeof(char) * argc);
|
||||
cb->flags = (int *)malloc(sizeof(int) * argc);
|
||||
cb->rflag = CVT_DEFAULT;
|
||||
cb->arg_classes = (jobject*)malloc(sizeof(jobject) * argc);
|
||||
|
||||
cb->direct = direct;
|
||||
cb->java_arg_types[0] = cb->java_arg_types[1] = cb->java_arg_types[2] = &ffi_type_pointer;
|
||||
|
||||
for (i=0;i < argc;i++) {
|
||||
int jtype;
|
||||
jclass cls = (*env)->GetObjectArrayElement(env, param_types, i);
|
||||
char jtype = get_jtype(env, cls);
|
||||
type_t type = get_type(jtype);
|
||||
cb->param_jtypes[i] = jtype;
|
||||
if (type == TYPE_INT64 || type == TYPE_FP64
|
||||
|| (type == TYPE_PTR && sizeof(void*) == 8)) {
|
||||
args_size += 8;
|
||||
if ((cb->flags[i] = get_conversion_flag(env, cls)) != CVT_DEFAULT) {
|
||||
cb->arg_classes[i] = (*env)->NewWeakGlobalRef(env, cls);
|
||||
cvt = 1;
|
||||
}
|
||||
|
||||
jtype = get_jtype(env, cls);
|
||||
if (jtype == -1) {
|
||||
snprintf(msg, sizeof(msg), "Unsupported argument at index %d", i);
|
||||
throw_type = EIllegalArgument;
|
||||
throw_msg = msg;
|
||||
goto failure_cleanup;
|
||||
}
|
||||
cb->arg_jtypes[i] = (char)jtype;
|
||||
cb->java_arg_types[i+3] = cb->arg_types[i] = get_ffi_type(env, cls, cb->arg_jtypes[i]);
|
||||
if (cb->flags[i] == CVT_NATIVE_MAPPED
|
||||
|| cb->flags[i] == CVT_POINTER_TYPE
|
||||
|| cb->flags[i] == CVT_INTEGER_TYPE) {
|
||||
jclass ncls;
|
||||
ncls = getNativeType(env, cls);
|
||||
jtype = get_jtype(env, ncls);
|
||||
if (jtype == -1) {
|
||||
snprintf(msg, sizeof(msg), "Unsupported NativeMapped argument native type at argument %d", i);
|
||||
throw_type = EIllegalArgument;
|
||||
throw_msg = msg;
|
||||
goto failure_cleanup;
|
||||
}
|
||||
cb->arg_jtypes[i] = (char)jtype;
|
||||
cb->java_arg_types[i+3] = &ffi_type_pointer;
|
||||
cb->arg_types[i] = get_ffi_type(env, ncls, cb->arg_jtypes[i]);
|
||||
}
|
||||
|
||||
if (cb->arg_types[i]->type == FFI_TYPE_FLOAT) {
|
||||
// Java method is varargs, so promote floats to double
|
||||
cb->java_arg_types[i+3] = &ffi_type_double;
|
||||
cb->flags[i] = CVT_FLOAT;
|
||||
cvt = 1;
|
||||
}
|
||||
else if (cb->java_arg_types[i+3]->type == FFI_TYPE_STRUCT) {
|
||||
// All callback structure arguments are passed as a jobject
|
||||
cb->java_arg_types[i+3] = &ffi_type_pointer;
|
||||
}
|
||||
}
|
||||
if (!direct || !cvt) {
|
||||
free(cb->flags);
|
||||
cb->flags = NULL;
|
||||
free(cb->arg_classes);
|
||||
cb->arg_classes = NULL;
|
||||
}
|
||||
if (direct) {
|
||||
cb->rflag = get_conversion_flag(env, return_type);
|
||||
if (cb->rflag == CVT_NATIVE_MAPPED
|
||||
|| cb->rflag == CVT_INTEGER_TYPE
|
||||
|| cb->rflag == CVT_POINTER_TYPE) {
|
||||
return_type = getNativeType(env, return_type);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
if (calling_convention == CALLCONV_STDCALL) {
|
||||
abi = FFI_STDCALL;
|
||||
}
|
||||
java_abi = FFI_STDCALL;
|
||||
#endif // _WIN32
|
||||
|
||||
rtype = get_jtype(env, return_type);
|
||||
if (rtype == -1) {
|
||||
throw_type = EIllegalArgument;
|
||||
throw_msg = "Unsupported return type";
|
||||
goto failure_cleanup;
|
||||
}
|
||||
ffi_rtype = get_ffi_rtype(env, return_type, (char)rtype);
|
||||
if (!ffi_rtype) {
|
||||
throw_type = EIllegalArgument;
|
||||
throw_msg = "Error in return type";
|
||||
goto failure_cleanup;
|
||||
}
|
||||
status = ffi_prep_cif(&cb->cif, abi, argc, ffi_rtype, cb->arg_types);
|
||||
if (!ffi_error(env, "callback setup", status)) {
|
||||
ffi_type* java_ffi_rtype = ffi_rtype;
|
||||
|
||||
if (cb->rflag == CVT_STRUCTURE_BYVAL
|
||||
|| cb->rflag == CVT_NATIVE_MAPPED
|
||||
|| cb->rflag == CVT_POINTER_TYPE
|
||||
|| cb->rflag == CVT_INTEGER_TYPE) {
|
||||
// Java method returns a jobject, not a struct
|
||||
java_ffi_rtype = &ffi_type_pointer;
|
||||
rtype = '*';
|
||||
}
|
||||
switch(rtype) {
|
||||
case 'V': cb->fptr = (*env)->CallVoidMethod; break;
|
||||
case 'Z': cb->fptr = (*env)->CallBooleanMethod; break;
|
||||
case 'B': cb->fptr = (*env)->CallByteMethod; break;
|
||||
case 'S': cb->fptr = (*env)->CallShortMethod; break;
|
||||
case 'C': cb->fptr = (*env)->CallCharMethod; break;
|
||||
case 'I': cb->fptr = (*env)->CallIntMethod; break;
|
||||
case 'J': cb->fptr = (*env)->CallLongMethod; break;
|
||||
case 'F': cb->fptr = (*env)->CallFloatMethod; break;
|
||||
case 'D': cb->fptr = (*env)->CallDoubleMethod; break;
|
||||
default: cb->fptr = (*env)->CallObjectMethod; break;
|
||||
}
|
||||
status = ffi_prep_cif(&cb->java_cif, java_abi, argc+3, java_ffi_rtype, cb->java_arg_types);
|
||||
if (!ffi_error(env, "callback setup (2)", status)) {
|
||||
ffi_prep_closure_loc(cb->closure, &cb->cif, callback_dispatch, cb,
|
||||
cb->x_closure);
|
||||
return cb;
|
||||
}
|
||||
}
|
||||
|
||||
failure_cleanup:
|
||||
free_callback(env, cb);
|
||||
if (throw_type) {
|
||||
throwByName(env, throw_type, msg);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
void
|
||||
free_callback(JNIEnv* env, callback *cb) {
|
||||
(*env)->DeleteWeakGlobalRef(env, cb->object);
|
||||
ffi_closure_free(cb->closure);
|
||||
free(cb->arg_types);
|
||||
if (cb->arg_classes) {
|
||||
unsigned i;
|
||||
for (i=0;i < cb->cif.nargs;i++) {
|
||||
(*env)->DeleteWeakGlobalRef(env, cb->arg_classes[i]);
|
||||
}
|
||||
free(cb->arg_classes);
|
||||
}
|
||||
free(cb->java_arg_types);
|
||||
if (cb->flags)
|
||||
free(cb->flags);
|
||||
free(cb->arg_jtypes);
|
||||
free(cb);
|
||||
}
|
||||
|
||||
static int
|
||||
handle_exception(JNIEnv* env, jobject cb, jthrowable throwable) {
|
||||
#define HANDLER_TYPE "com/sun/jna/Callback$UncaughtExceptionHandler"
|
||||
#define HANDLER_SIG "Lcom/sun/jna/Callback$UncaughtExceptionHandler;"
|
||||
jclass classHandler = (*env)->FindClass(env, HANDLER_TYPE);
|
||||
if (classHandler) {
|
||||
jclass classNative = (*env)->FindClass(env, "com/sun/jna/Native");
|
||||
if (classNative) {
|
||||
jfieldID fid = (*env)->GetStaticFieldID(env, classNative, "callbackExceptionHandler", HANDLER_SIG);
|
||||
if (fid) {
|
||||
jobject handler = (*env)->GetStaticObjectField(env, classNative, fid);
|
||||
if (handler) {
|
||||
jmethodID mid = (*env)->GetMethodID(env, classHandler, "uncaughtException", "(Lcom/sun/jna/Callback;Ljava/lang/Throwable;)V");
|
||||
if (mid) {
|
||||
if (!(*env)->IsSameObject(env, handler, NULL)) {
|
||||
(*env)->CallVoidMethod(env, handler, mid, cb, throwable);
|
||||
}
|
||||
if ((*env)->ExceptionCheck(env) == 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
(*env)->ExceptionDescribe(env);
|
||||
(*env)->ExceptionClear(env);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
callback_invoke(JNIEnv* env, callback *cb, ffi_cif* cif, void *resp, void **cbargs) {
|
||||
jobject self;
|
||||
void *oldresp = resp;
|
||||
|
||||
self = (*env)->NewLocalRef(env, cb->object);
|
||||
// Avoid calling back to a GC'd object
|
||||
if ((*env)->IsSameObject(env, self, NULL)) {
|
||||
fprintf(stderr, "JNA: callback object has been garbage collected\n");
|
||||
if (cif->rtype->type != FFI_TYPE_VOID)
|
||||
memset(resp, 0, cif->rtype->size);
|
||||
}
|
||||
else if (cb->direct) {
|
||||
unsigned int i;
|
||||
void **args = alloca((cif->nargs + 3) * sizeof(void *));
|
||||
args[0] = (void *)&env;
|
||||
args[1] = &self;
|
||||
args[2] = &cb->methodID;
|
||||
memcpy(&args[3], cbargs, cif->nargs * sizeof(void *));
|
||||
|
||||
if (cb->flags) {
|
||||
for (i=0;i < cif->nargs;i++) {
|
||||
switch(cb->flags[i]) {
|
||||
case CVT_INTEGER_TYPE:
|
||||
case CVT_POINTER_TYPE:
|
||||
case CVT_NATIVE_MAPPED:
|
||||
*((void **)args[i+3]) = fromNative(env, cb->arg_classes[i], cif->arg_types[i], args[i+3], JNI_FALSE);
|
||||
break;
|
||||
case CVT_POINTER:
|
||||
*((void **)args[i+3]) = newJavaPointer(env, *(void **)args[i+3]);
|
||||
break;
|
||||
case CVT_STRING:
|
||||
*((void **)args[i+3]) = newJavaString(env, *(void **)args[i+3], JNI_FALSE);
|
||||
break;
|
||||
case CVT_WSTRING:
|
||||
*((void **)args[i+3]) = newJavaWString(env, *(void **)args[i+3]);
|
||||
break;
|
||||
case CVT_STRUCTURE:
|
||||
*((void **)args[i+3]) = newJavaStructure(env, *(void **)args[i+3], cb->arg_classes[i], JNI_FALSE);
|
||||
break;
|
||||
case CVT_STRUCTURE_BYVAL:
|
||||
{
|
||||
void *ptr = args[i+3];
|
||||
args[i+3] = alloca(sizeof(void *));
|
||||
*((void **)args[i+3]) = newJavaStructure(env, ptr, cb->arg_classes[i], JNI_TRUE);
|
||||
}
|
||||
break;
|
||||
case CVT_CALLBACK:
|
||||
*((void **)args[i+3]) = newJavaCallback(env, *(void **)args[i+3], cb->arg_classes[i]);
|
||||
break;
|
||||
case CVT_FLOAT:
|
||||
{
|
||||
void *ptr = alloca(sizeof(double));
|
||||
*(double *)ptr = *(float*)args[i+3];
|
||||
args[i+3] = ptr;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cb->rflag == CVT_STRUCTURE_BYVAL) {
|
||||
resp = alloca(sizeof(jobject));
|
||||
}
|
||||
else if (cb->cif.rtype->size > cif->rtype->size) {
|
||||
resp = alloca(cb->cif.rtype->size);
|
||||
}
|
||||
ffi_call(&cb->java_cif, FFI_FN(cb->fptr), resp, args);
|
||||
if ((*env)->ExceptionCheck(env)) {
|
||||
jthrowable throwable = (*env)->ExceptionOccurred(env);
|
||||
(*env)->ExceptionClear(env);
|
||||
if (!handle_exception(env, self, throwable)) {
|
||||
fprintf(stderr, "JNA: error handling callback exception, continuing\n");
|
||||
}
|
||||
if (cif->rtype->type != FFI_TYPE_VOID)
|
||||
memset(oldresp, 0, cif->rtype->size);
|
||||
}
|
||||
else switch(cb->rflag) {
|
||||
case CVT_INTEGER_TYPE:
|
||||
if (cb->cif.rtype->size > sizeof(ffi_arg)) {
|
||||
*(jlong *)oldresp = getIntegerTypeValue(env, *(void **)resp);
|
||||
}
|
||||
else {
|
||||
*(ffi_arg *)oldresp = (ffi_arg)getIntegerTypeValue(env, *(void **)resp);
|
||||
}
|
||||
break;
|
||||
case CVT_POINTER_TYPE:
|
||||
*(void **)resp = getPointerTypeAddress(env, *(void **)resp);
|
||||
break;
|
||||
case CVT_NATIVE_MAPPED:
|
||||
toNative(env, *(void **)resp, oldresp, cb->cif.rtype->size, JNI_TRUE);
|
||||
break;
|
||||
case CVT_POINTER:
|
||||
*(void **)resp = getNativeAddress(env, *(void **)resp);
|
||||
break;
|
||||
case CVT_STRING:
|
||||
*(void **)resp = getNativeString(env, *(void **)resp, JNI_FALSE);
|
||||
break;
|
||||
case CVT_WSTRING:
|
||||
*(void **)resp = getNativeString(env, *(void **)resp, JNI_TRUE);
|
||||
break;
|
||||
case CVT_STRUCTURE:
|
||||
writeStructure(env, *(void **)resp);
|
||||
*(void **)resp = getStructureAddress(env, *(void **)resp);
|
||||
break;
|
||||
case CVT_STRUCTURE_BYVAL:
|
||||
writeStructure(env, *(void **)resp);
|
||||
memcpy(oldresp, getStructureAddress(env, *(void **)resp), cb->cif.rtype->size);
|
||||
break;
|
||||
case CVT_CALLBACK:
|
||||
*(void **)resp = getCallbackAddress(env, *(void **)resp);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
if (cb->flags) {
|
||||
for (i=0;i < cif->nargs;i++) {
|
||||
if (cb->flags[i] == CVT_STRUCTURE) {
|
||||
writeStructure(env, *(void **)args[i+3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
jobject result;
|
||||
jobjectArray array =
|
||||
(*env)->NewObjectArray(env, cif->nargs, classObject, NULL);
|
||||
unsigned int i;
|
||||
|
||||
for (i=0;i < cif->nargs;i++) {
|
||||
jobject arg = new_object(env, cb->arg_jtypes[i], cbargs[i], JNI_FALSE);
|
||||
(*env)->SetObjectArrayElement(env, array, i, arg);
|
||||
}
|
||||
result = (*env)->CallObjectMethod(env, self, cb->methodID, array);
|
||||
if ((*env)->ExceptionCheck(env)) {
|
||||
jthrowable throwable = (*env)->ExceptionOccurred(env);
|
||||
(*env)->ExceptionClear(env);
|
||||
if (!handle_exception(env, self, throwable)) {
|
||||
fprintf(stderr, "JNA: error handling callback exception, continuing\n");
|
||||
}
|
||||
if (cif->rtype->type != FFI_TYPE_VOID)
|
||||
memset(resp, 0, cif->rtype->size);
|
||||
}
|
||||
else {
|
||||
args_size += 4;
|
||||
extract_value(env, result, resp, cif->rtype->size, JNI_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
// initialize and customize the callback template
|
||||
memcpy((void*)insns, (void*)callback_asm_template, len);
|
||||
|
||||
#ifdef __ppc__
|
||||
{
|
||||
// PPC can only load values 16 bits at a time, so it's easier
|
||||
// to track the offsets and insert values directly
|
||||
int vm_offset, cb_offset, cs_offset, b_offset;
|
||||
unsigned long* insn;
|
||||
|
||||
asm("li %0,VM_OFFSET" : "=r" (vm_offset));
|
||||
asm("li %0,CB_OFFSET" : "=r" (cb_offset));
|
||||
asm("li %0,CS_OFFSET" : "=r" (cs_offset));
|
||||
asm("li %0,B_OFFSET" : "=r" (b_offset));
|
||||
|
||||
insn = (unsigned long*)((char*)insns + cs_offset);
|
||||
*insn = (*insn & ~0xFFFF) | (args_size/sizeof(void*));
|
||||
|
||||
insn = (unsigned long*)((char *)insns + cb_offset);
|
||||
*insn = (*insn & ~0xFFFF) | (((unsigned long)cb) & 0xFFFF);
|
||||
*(insn+1) = (*(insn+1) & ~0xFFFF) | (((unsigned long)cb) >> 16);
|
||||
|
||||
insn = (unsigned long*)((char *)insns + vm_offset);
|
||||
*insn = (*insn & ~0xFFFF) | (((unsigned long)vm) & 0xFFFF);
|
||||
*(insn+1) = (*(insn+1) & ~0xFFFF) | (((unsigned long)vm) >> 16);
|
||||
|
||||
insn = (unsigned long*)((char *)insns + b_offset);
|
||||
*insn = (*insn & ~0xFFFF) | (((unsigned long)callback_dispatch) & 0xFFFF);
|
||||
*(insn+1) = (*(insn+1) & ~0xFFFF) | (((unsigned long)callback_dispatch) >> 16);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(_WIN32)
|
||||
// lazy way to insert custom arguments, just look for our magic values
|
||||
// and replace them, knowing that they are not re-orged in the asm.
|
||||
for (i=0;i < len-3;i++) {
|
||||
unsigned long* addr = (unsigned long *)((char *)insns + i);
|
||||
unsigned long value = *addr;
|
||||
if (value == ARG_CB) {
|
||||
*addr = (unsigned long)cb;
|
||||
i += 3;
|
||||
}
|
||||
else if (value == ARG_JVM) {
|
||||
*addr = (unsigned long)vm;
|
||||
i += 3;
|
||||
}
|
||||
else if (value == ARG_DISPATCH) {
|
||||
*addr = (unsigned long)callback_dispatch;
|
||||
i += 3;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
else if (value == CALLEE_SIZE) {
|
||||
*addr = (call_conv == CALLCONV_STDCALL) ? args_size : 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
return cb;
|
||||
}
|
||||
|
||||
static type_t
|
||||
get_type(char type) {
|
||||
switch(type) {
|
||||
case 'V':
|
||||
case 'Z':
|
||||
case 'B':
|
||||
case 'C':
|
||||
case 'S':
|
||||
case 'I':
|
||||
return TYPE_INT32;
|
||||
case 'J':
|
||||
return TYPE_INT64;
|
||||
case 'F':
|
||||
return TYPE_FP32;
|
||||
case 'D':
|
||||
return TYPE_FP64;
|
||||
case 'L':
|
||||
default:
|
||||
return TYPE_PTR;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
callback_dispatch(JavaVM* jvm, callback* cb, char* ap) {
|
||||
jobject obj;
|
||||
jmethodID mid;
|
||||
jvalue result;
|
||||
type_t return_type;
|
||||
static void
|
||||
callback_dispatch(ffi_cif* cif, void* resp, void** cbargs, void* user_data) {
|
||||
JavaVM* jvm = ((callback *)user_data)->vm;
|
||||
JNIEnv* env;
|
||||
int attached;
|
||||
jobjectArray args;
|
||||
int i;
|
||||
|
||||
|
||||
attached = (*jvm)->GetEnv(jvm, (void *)&env, JNI_VERSION_1_4) == JNI_OK;
|
||||
|
||||
if (!attached) {
|
||||
if ((*jvm)->AttachCurrentThread(jvm, (void *)&env, NULL) != JNI_OK) {
|
||||
fprintf(stderr, "Can't attach to current thread\n");
|
||||
fprintf(stderr, "JNA: Can't attach to current thread\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
obj = (*env)->NewLocalRef(env, cb->object);
|
||||
mid = cb->methodID;
|
||||
args = (*env)->NewObjectArray(env, cb->param_count,
|
||||
(*env)->FindClass(env, "java/lang/Object"),
|
||||
NULL);
|
||||
|
||||
// Convert primitive types into objects so we can properly stuff
|
||||
// an array of Object for the callback proxy argument list
|
||||
// NOTE: some targets may require different alignment of stack items...
|
||||
for (i=0;i < cb->param_count;i++) {
|
||||
int size;
|
||||
jobject arg = new_object(env, cb->param_jtypes[i], (void*)ap, &size);
|
||||
ap += size;
|
||||
(*env)->SetObjectArrayElement(env, args, i, arg);
|
||||
}
|
||||
|
||||
// Avoid calling back to a GC'd object
|
||||
if ((*env)->IsSameObject(env, obj, NULL)) {
|
||||
fprintf(stderr, "Warning: attempt to call GC'd callback\n");
|
||||
result.j = 0;
|
||||
return_type = TYPE_VOID;
|
||||
|
||||
// Give the callback its own local frame to ensure all local references
|
||||
// are properly disposed
|
||||
if ((*env)->PushLocalFrame(env, 16) < 0) {
|
||||
fprintf(stderr, "JNA: Out of memory: Can't allocate local frame");
|
||||
}
|
||||
else {
|
||||
jobject value = (*env)->CallObjectMethod(env, obj, mid, args);
|
||||
result = extract_value(env, value, &return_type);
|
||||
callback_invoke(env, (callback *)user_data, cif, resp, cbargs);
|
||||
(*env)->PopLocalFrame(env, NULL);
|
||||
}
|
||||
|
||||
|
||||
if (!attached) {
|
||||
(*jvm)->DetachCurrentThread(jvm);
|
||||
}
|
||||
}
|
||||
|
||||
const char*
|
||||
jnidispatch_callback_init(JNIEnv* env) {
|
||||
|
||||
if (!LOAD_CREF(env, Object, "java/lang/Object")) return "java.lang.Object";
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch(return_type) {
|
||||
case TYPE_PTR:
|
||||
RETURN_PTR(result.l);
|
||||
return;
|
||||
case TYPE_INT32:
|
||||
RETURN_INT32(result.i);
|
||||
return;
|
||||
case TYPE_INT64:
|
||||
RETURN_INT64(result.j);
|
||||
return;
|
||||
case TYPE_FP32:
|
||||
RETURN_FP32(result.f);
|
||||
return;
|
||||
case TYPE_FP64:
|
||||
RETURN_FP64(result.d);
|
||||
return;
|
||||
void
|
||||
jnidispatch_callback_dispose(JNIEnv* env) {
|
||||
if (classObject) {
|
||||
(*env)->DeleteWeakGlobalRef(env, classObject);
|
||||
classObject = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Arquivo executável
+147
@@ -0,0 +1,147 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# GCC-compatible wrapper for cl.exe
|
||||
#
|
||||
MSVC="/c/Program Files (x86)/Microsoft Visual Studio 9.0/vc/bin"
|
||||
nowarn="/wd4127 /wd4820 /wd4706 /wd4100 /wd4255 /wd4668"
|
||||
args="/nologo /EHac /W3 /LD $nowarn" # /WX
|
||||
# FIXME is this equivalent to --static-libgcc? links to msvcrt.lib
|
||||
# I've forgotten why it was originally added
|
||||
# /MD causes link problems
|
||||
#md=/MD
|
||||
cl="$MSVC/cl"
|
||||
ml="$MSVC/ml"
|
||||
output=
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
case $1
|
||||
in
|
||||
-fexceptions)
|
||||
shift 1
|
||||
;;
|
||||
-fno-omit-frame-pointer)
|
||||
# TODO: does this have an equivalent?
|
||||
shift 1
|
||||
;;
|
||||
-fno-strict-aliasing)
|
||||
# TODO: does this have an equivalent?
|
||||
shift 1
|
||||
;;
|
||||
-mno-cygwin)
|
||||
shift 1
|
||||
;;
|
||||
-m32)
|
||||
cl="$MSVC/cl"
|
||||
ml="$MSVC/ml"
|
||||
shift 1
|
||||
;;
|
||||
-m64)
|
||||
cl="$MSVC/x86_amd64/cl"
|
||||
ml="$MSVC/x86_amd64/ml64"
|
||||
shift 1
|
||||
;;
|
||||
-O*)
|
||||
args="$args $i"
|
||||
shift 1
|
||||
;;
|
||||
-g)
|
||||
# using /RTC1 instead of /GZ
|
||||
args="$args /Od /D_DEBUG /RTC1 /Zi"
|
||||
md=/MDd
|
||||
shift 1
|
||||
;;
|
||||
-c)
|
||||
args="$args /c"
|
||||
args="$(echo $args | sed 's%/Fe%/Fo%g')"
|
||||
single="/c"
|
||||
shift 1
|
||||
;;
|
||||
-D*=*)
|
||||
name="$(echo $1|sed 's/-D\([^=][^=]*\)=.*/\1/g')"
|
||||
value="$(echo $1|sed 's/-D[^=][^=]*=//g')"
|
||||
args="$args -D${name}='$value'"
|
||||
defines="$defines -D${name}='$value'"
|
||||
shift 1
|
||||
;;
|
||||
-D*)
|
||||
args="$args $1"
|
||||
defines="$defines $1"
|
||||
shift 1
|
||||
;;
|
||||
-I)
|
||||
args="$args /I\"$2\""
|
||||
includes="$includes /I\"$2\""
|
||||
shift 2
|
||||
;;
|
||||
-I*)
|
||||
args="$args /I\"$(echo $1|sed -e 's/-I//g')\""
|
||||
includes="$includes /I\"$(echo $1|sed -e 's/-I//g')\""
|
||||
shift 1
|
||||
;;
|
||||
-W|-Wextra)
|
||||
# TODO map extra warnings
|
||||
shift 1
|
||||
;;
|
||||
-Wall)
|
||||
args="$args /Wall"
|
||||
shift 1
|
||||
;;
|
||||
-Werror)
|
||||
args="$args /WX"
|
||||
shift 1
|
||||
;;
|
||||
-W*)
|
||||
# TODO map specific warnings
|
||||
shift 1
|
||||
;;
|
||||
-S)
|
||||
args="$args /FAs"
|
||||
shift 1
|
||||
;;
|
||||
-o)
|
||||
outdir="$(dirname $2)"
|
||||
base="$(basename $2|sed 's/\.[^.]*//g')"
|
||||
if [ -n "$single" ]; then
|
||||
output="/Fo$2"
|
||||
else
|
||||
output="/Fe$2"
|
||||
fi
|
||||
if [ -n "$assembly" ]; then
|
||||
args="$args $output"
|
||||
else
|
||||
args="$args $output /Fd$outdir/$base /Fp$outdir/$base /Fa$outdir/$base"
|
||||
fi
|
||||
shift 2
|
||||
;;
|
||||
*.S)
|
||||
src="$(echo $1|sed -e 's/.S$/.asm/g' -e 's%\\%/%g')"
|
||||
echo "$cl /EP $includes $defines $1 > $src"
|
||||
"$cl" /nologo /EP $includes $defines $1 > $src || exit $?
|
||||
md=""
|
||||
cl="$ml"
|
||||
output="$(echo $output | sed 's%/F[dpa][^ ]*%%g')"
|
||||
args="/nologo $single $src $output"
|
||||
assembly="true"
|
||||
shift 1
|
||||
;;
|
||||
*.c)
|
||||
args="$args $(echo $1|sed -e 's%\\%/%g')"
|
||||
shift 1
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported argument '$1'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
args="$md $args"
|
||||
echo "$cl $args"
|
||||
eval "\"$cl\" $args"
|
||||
result=$?
|
||||
# @#!%@!# ml64 broken output
|
||||
if [ -n "$assembly" ]; then
|
||||
mv $src $outdir
|
||||
mv *.obj $outdir
|
||||
fi
|
||||
exit $result
|
||||
+2354
-810
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+131
-45
@@ -1,96 +1,182 @@
|
||||
/* Copyright (c) 2007 Timothy Wall, All Rights Reserved
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* <p/>
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*/
|
||||
#ifndef DISPATCH_H
|
||||
#define DISPATCH_H
|
||||
|
||||
#include "ffi.h"
|
||||
#include "com_sun_jna_Function.h"
|
||||
#include "com_sun_jna_Native.h"
|
||||
#ifdef sun
|
||||
# include <alloca.h>
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
#ifdef _MSC_VER
|
||||
#define alloca _alloca
|
||||
#pragma warning( disable : 4152 ) /* function/data conversion */
|
||||
#pragma warning( disable : 4054 ) /* cast function pointer to data pointer */
|
||||
#pragma warning( disable : 4055 ) /* cast data pointer to function pointer */
|
||||
#pragma warning( disable : 4204 ) /* structure initializer */
|
||||
#pragma warning( disable : 4710 ) /* swprintf not inlined */
|
||||
#else
|
||||
#include <malloc.h>
|
||||
#endif /* _MSC_VER */
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* C variable types for arguments and return values. */
|
||||
typedef enum _vartype {
|
||||
/* pointer */
|
||||
TYPE_PTR = 0,
|
||||
/* 32-bit or smaller integer */
|
||||
TYPE_INT32,
|
||||
TYPE_VOID = TYPE_INT32,
|
||||
/* 32-bit floating point */
|
||||
TYPE_FP32,
|
||||
/* 64-bit floating point */
|
||||
TYPE_FP64,
|
||||
/* 64-bit integer */
|
||||
TYPE_INT64,
|
||||
} type_t;
|
||||
|
||||
#include "com_sun_jna_Function.h"
|
||||
/* These are the calling conventions an invocation can handle. */
|
||||
typedef enum _callconv {
|
||||
CALLCONV_C = com_sun_jna_Function_C_CONVENTION,
|
||||
#if defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
CALLCONV_STDCALL = com_sun_jna_Function_ALT_CONVENTION,
|
||||
#endif
|
||||
} callconv_t;
|
||||
|
||||
/* Represents a machine word (one stack element). */
|
||||
typedef union _word {
|
||||
jint i;
|
||||
jfloat f;
|
||||
void *p;
|
||||
} word_t;
|
||||
/* Maximum number of allowed arguments in libffi. */
|
||||
#define MAX_NARGS com_sun_jna_Function_MAX_NARGS
|
||||
|
||||
/* Maximum number of allowed arguments. */
|
||||
#define MAX_NARGS 32
|
||||
enum {
|
||||
CVT_DEFAULT = com_sun_jna_Native_CVT_DEFAULT,
|
||||
CVT_POINTER = com_sun_jna_Native_CVT_POINTER,
|
||||
CVT_STRING = com_sun_jna_Native_CVT_STRING,
|
||||
CVT_STRUCTURE = com_sun_jna_Native_CVT_STRUCTURE,
|
||||
CVT_STRUCTURE_BYVAL = com_sun_jna_Native_CVT_STRUCTURE_BYVAL,
|
||||
CVT_BUFFER = com_sun_jna_Native_CVT_BUFFER,
|
||||
CVT_ARRAY_BYTE = com_sun_jna_Native_CVT_ARRAY_BYTE,
|
||||
CVT_ARRAY_SHORT = com_sun_jna_Native_CVT_ARRAY_SHORT,
|
||||
CVT_ARRAY_CHAR = com_sun_jna_Native_CVT_ARRAY_CHAR,
|
||||
CVT_ARRAY_INT = com_sun_jna_Native_CVT_ARRAY_INT,
|
||||
CVT_ARRAY_LONG = com_sun_jna_Native_CVT_ARRAY_LONG,
|
||||
CVT_ARRAY_FLOAT = com_sun_jna_Native_CVT_ARRAY_FLOAT,
|
||||
CVT_ARRAY_DOUBLE = com_sun_jna_Native_CVT_ARRAY_DOUBLE,
|
||||
CVT_ARRAY_BOOLEAN = com_sun_jna_Native_CVT_ARRAY_BOOLEAN,
|
||||
CVT_BOOLEAN = com_sun_jna_Native_CVT_BOOLEAN,
|
||||
CVT_CALLBACK = com_sun_jna_Native_CVT_CALLBACK,
|
||||
CVT_FLOAT = com_sun_jna_Native_CVT_FLOAT,
|
||||
CVT_NATIVE_MAPPED = com_sun_jna_Native_CVT_NATIVE_MAPPED,
|
||||
CVT_WSTRING = com_sun_jna_Native_CVT_WSTRING,
|
||||
CVT_INTEGER_TYPE = com_sun_jna_Native_CVT_INTEGER_TYPE,
|
||||
CVT_POINTER_TYPE = com_sun_jna_Native_CVT_POINTER_TYPE,
|
||||
CVT_TYPE_MAPPER = com_sun_jna_Native_CVT_TYPE_MAPPER,
|
||||
};
|
||||
|
||||
typedef struct _callback {
|
||||
void *insns;
|
||||
// Location of this field must agree with CallbackReference.getTrampoline()
|
||||
void* x_closure;
|
||||
ffi_closure* closure;
|
||||
ffi_cif cif;
|
||||
ffi_cif java_cif;
|
||||
ffi_type** arg_types;
|
||||
ffi_type** java_arg_types;
|
||||
jobject* arg_classes;
|
||||
int* flags;
|
||||
int rflag;
|
||||
JavaVM* vm;
|
||||
jobject object;
|
||||
jmethodID methodID;
|
||||
jsize param_count;
|
||||
char param_jtypes[MAX_NARGS];
|
||||
char* arg_jtypes;
|
||||
jboolean direct;
|
||||
void* fptr;
|
||||
} callback;
|
||||
|
||||
#if defined(SOLARIS2) || defined(__GNUC__)
|
||||
#if defined(_WIN64)
|
||||
#define L2A(X) ((void *)(long long)(X))
|
||||
#define A2L(X) ((jlong)(long long)(X))
|
||||
#else
|
||||
#define L2A(X) ((void *)(unsigned long)(X))
|
||||
#define A2L(X) ((jlong)(unsigned long)(X))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define L2A(X) ((void *)(X))
|
||||
#define A2L(X) ((jlong)(X))
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _MSC_VER
|
||||
#define alloca _alloca
|
||||
#endif
|
||||
#else
|
||||
#include <alloca.h>
|
||||
#define snprintf sprintf_s
|
||||
#endif
|
||||
|
||||
/* Convenience macros */
|
||||
#define LOAD_REF(ENV,VAR) \
|
||||
#define LOAD_WEAKREF(ENV,VAR) \
|
||||
((VAR == 0) \
|
||||
? 0 : ((VAR = (*ENV)->NewGlobalRef(ENV, VAR)) == 0 ? 0 : VAR))
|
||||
? 0 : ((VAR = (*ENV)->NewWeakGlobalRef(ENV, VAR)) == 0 ? 0 : VAR))
|
||||
#define FIND_CLASS(ENV,SIMPLE,NAME) \
|
||||
(class ## SIMPLE = (*ENV)->FindClass(ENV, NAME))
|
||||
#define FIND_PRIMITIVE_CLASS(ENV,SIMPLE) \
|
||||
(classPrimitive ## SIMPLE = (*ENV)->GetStaticObjectField(ENV,class ## SIMPLE,(*ENV)->GetStaticFieldID(ENV,class ## SIMPLE,"TYPE","Ljava/lang/Class;")))
|
||||
#define LOAD_CREF(ENV,SIMPLE,NAME) \
|
||||
(FIND_CLASS(ENV,SIMPLE,NAME) && LOAD_REF(ENV,class ## SIMPLE))
|
||||
(FIND_CLASS(ENV,SIMPLE,NAME) && LOAD_WEAKREF(ENV,class ## SIMPLE))
|
||||
#define LOAD_PCREF(ENV,SIMPLE,NAME) \
|
||||
(LOAD_CREF(ENV,SIMPLE,NAME) \
|
||||
&& FIND_PRIMITIVE_CLASS(ENV,SIMPLE) \
|
||||
&& LOAD_REF(ENV,classPrimitive ## SIMPLE))
|
||||
&& LOAD_WEAKREF(ENV,classPrimitive ## SIMPLE))
|
||||
#define LOAD_MID(ENV,VAR,CLASS,NAME,SIG) \
|
||||
((VAR = (*ENV)->GetMethodID(ENV, CLASS, NAME, SIG)) ? VAR : 0)
|
||||
#define LOAD_FID(ENV,VAR,CLASS,NAME,SIG) \
|
||||
((VAR = (*ENV)->GetFieldID(ENV, CLASS, NAME, SIG)) ? VAR : 0)
|
||||
|
||||
// Avoid typos in class names
|
||||
#define EIllegalArgument "java/lang/IllegalArgumentException"
|
||||
#define EOutOfMemory "java/lang/OutOfMemoryError"
|
||||
#define EUnsatisfiedLink "java/lang/UnsatisfiedLinkError"
|
||||
#define EIllegalState "java/lang/IllegalStateException"
|
||||
#define EUnsupportedOperation "java/lang/UnsupportedOperationException"
|
||||
#define ERuntime "java/lang/RuntimeException"
|
||||
#define EError "java/lang/Error"
|
||||
#define ELastError "com/sun/jna/LastErrorException"
|
||||
|
||||
extern void throwByName(JNIEnv *env, const char *name, const char *msg);
|
||||
extern jobject newJavaPointer(JNIEnv *, void *);
|
||||
extern char get_jtype(JNIEnv*, jclass);
|
||||
extern int get_jtype(JNIEnv*, jclass);
|
||||
extern ffi_type* get_ffi_type(JNIEnv*, jclass, char);
|
||||
extern ffi_type* get_ffi_rtype(JNIEnv*, jclass, char);
|
||||
extern const char* jnidispatch_callback_init(JNIEnv*);
|
||||
extern void jnidispatch_callback_dispose(JNIEnv*);
|
||||
extern callback* create_callback(JNIEnv*, jobject, jobject,
|
||||
jobjectArray, callconv_t);
|
||||
extern jvalue extract_value(JNIEnv*, jobject, type_t*);
|
||||
extern jobject new_object(JNIEnv*, char, void*, int*);
|
||||
jobjectArray, jclass,
|
||||
callconv_t, jboolean);
|
||||
extern void free_callback(JNIEnv*, callback*);
|
||||
extern void extract_value(JNIEnv*, jobject, void*, size_t, jboolean);
|
||||
extern jobject new_object(JNIEnv*, char, void*, jboolean);
|
||||
extern jboolean is_protected();
|
||||
extern int get_conversion_flag(JNIEnv*, jclass);
|
||||
extern jboolean ffi_error(JNIEnv*,const char*,ffi_status);
|
||||
|
||||
extern jobject newJavaPointer(JNIEnv*, void*);
|
||||
extern jstring newJavaString(JNIEnv*, const char*, jboolean);
|
||||
extern jobject newJavaWString(JNIEnv*, const wchar_t*);
|
||||
extern jobject newJavaStructure(JNIEnv*, void*, jclass, jboolean);
|
||||
extern jobject newJavaCallback(JNIEnv*, void*, jclass);
|
||||
extern void* getNativeString(JNIEnv*, jstring, jboolean);
|
||||
extern void* getNativeAddress(JNIEnv*, jobject);
|
||||
extern void* getStructureAddress(JNIEnv*, jobject);
|
||||
extern void* getCallbackAddress(JNIEnv*, jobject);
|
||||
extern jlong getIntegerTypeValue(JNIEnv*, jobject);
|
||||
extern void* getPointerTypeAddress(JNIEnv*, jobject);
|
||||
extern void writeStructure(JNIEnv*, jobject);
|
||||
extern jclass getNativeType(JNIEnv*, jclass);
|
||||
extern void toNative(JNIEnv*, jobject, void*, size_t, jboolean);
|
||||
extern jclass fromNative(JNIEnv*, jclass, ffi_type*, void*, jboolean);
|
||||
|
||||
/* Native memory fault protection */
|
||||
#ifdef HAVE_PROTECTION
|
||||
#define PROTECT is_protected()
|
||||
#endif
|
||||
#include "protect.h"
|
||||
#define ON_ERROR() throwByName(env, EError, "Invalid memory access")
|
||||
#define PSTART() PROTECTED_START()
|
||||
#define PEND() PROTECTED_END(ON_ERROR())
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,151 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1998 Sun Microsystems. All Rights Reserved.
|
||||
* Copyright (c) 2007 Timothy Wall. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include <jni.h>
|
||||
#include "dispatch.h"
|
||||
|
||||
#if defined(__i386__) || defined(_MSC_VER)
|
||||
/*
|
||||
* Copies the arguments from the given array to C stack, invoke the
|
||||
* target function, and copy the result back.
|
||||
*/
|
||||
void
|
||||
asm_dispatch(void (*func)(), int nwords, word_t *c_args,
|
||||
type_t rtype, jvalue *resP, int* cdecl_flag) {
|
||||
/* linux/x86 */
|
||||
#ifdef __GNUC__
|
||||
#ifdef __x86_64__
|
||||
#error No 64-bit support yet
|
||||
#endif
|
||||
|
||||
asm("movl %0, %%esi" : : "g" (c_args) : "%esi");
|
||||
asm("movl %0, %%edx" : : "g" (nwords*sizeof(word_t)) : "%edx");
|
||||
|
||||
asm("subl $4, %edx");
|
||||
asm("jc args_done");
|
||||
|
||||
/* Push the last argument first. */
|
||||
asm("\nargs_loop:");
|
||||
asm("movl (%esi,%edx), %eax");
|
||||
asm("pushl %eax");
|
||||
asm("subl $4, %edx");
|
||||
asm("jge args_loop");
|
||||
|
||||
asm("\nargs_done:");
|
||||
asm("call *%0" : : "g" (func) : "%eax", "%edx");
|
||||
|
||||
asm("movl %0, %%esi" : : "g" (resP) : "%esi");
|
||||
asm("cmpl %1, %0" : : "g" (rtype), "i" (TYPE_PTR));
|
||||
asm("jne not_ptr");
|
||||
|
||||
/* ptr */
|
||||
asm("movl %eax, (%esi)");
|
||||
asm("movl %edx, 4(%esi)");
|
||||
asm("jmp done");
|
||||
|
||||
asm("\nnot_ptr:");
|
||||
asm("cmpl %1, %0" : : "g" (rtype), "i" (TYPE_INT32));
|
||||
asm("jne not_i32");
|
||||
|
||||
/* i32 */
|
||||
asm("movl %eax, (%esi)");
|
||||
asm("jmp done");
|
||||
|
||||
asm("\nnot_i32:");
|
||||
asm("cmpl %1, %0" : : "g" (rtype), "i" (TYPE_FP32));
|
||||
asm("jne not_f32");
|
||||
|
||||
/* f32 */
|
||||
asm("fstps (%esi)");
|
||||
asm("jmp done");
|
||||
|
||||
asm("\nnot_f32:");
|
||||
asm("cmpl %1, %0" :: "g" (rtype), "i" (TYPE_FP64));
|
||||
asm("jne not_f64");
|
||||
|
||||
/* f64 */
|
||||
asm("fstpl (%esi)");
|
||||
asm("jmp done");
|
||||
|
||||
asm("\nnot_f64:");
|
||||
asm("movl %eax, (%esi)");
|
||||
asm("movl %edx, 4(%esi)");
|
||||
|
||||
asm("\ndone:");
|
||||
// pop callee arguments if cdecl; do nothing if stdcall
|
||||
asm("cmpl $0,%0" :: "g" (cdecl_flag));
|
||||
asm("je no_cleanup");
|
||||
asm("addl %0, %%esp" : : "g" (nwords*sizeof(word_t)) : "%esp");
|
||||
asm("\nno_cleanup:");
|
||||
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
/* Windows/MSVC */
|
||||
__asm {
|
||||
|
||||
mov esi, c_args
|
||||
mov edx, nwords
|
||||
// word address -> byte address
|
||||
shl edx, 2
|
||||
|
||||
sub edx, 4
|
||||
jc args_done
|
||||
|
||||
// Push the last argument first.
|
||||
args_loop:
|
||||
mov eax, DWORD PTR [esi+edx]
|
||||
push eax
|
||||
sub edx, 4
|
||||
jge SHORT args_loop
|
||||
|
||||
args_done:
|
||||
call func
|
||||
|
||||
mov esi, resP
|
||||
cmp rtype, TYPE_PTR
|
||||
jne not_ptr
|
||||
// ptr
|
||||
mov [esi], eax
|
||||
mov [esi+4], edx
|
||||
jmp done
|
||||
|
||||
not_ptr:
|
||||
cmp rtype, TYPE_INT32
|
||||
jne not_i32
|
||||
// i32
|
||||
mov [esi], eax
|
||||
jmp done
|
||||
|
||||
not_i32:
|
||||
cmp rtype, TYPE_FP32
|
||||
jne not_f32
|
||||
// f32
|
||||
fstp DWORD PTR [esi]
|
||||
jmp done
|
||||
|
||||
not_f32:
|
||||
cmp rtype, TYPE_FP64
|
||||
jne not_f64
|
||||
// f64
|
||||
fstp QWORD PTR [esi]
|
||||
jmp done
|
||||
|
||||
not_f64:
|
||||
// i64
|
||||
mov [esi], eax
|
||||
mov [esi+4], edx
|
||||
|
||||
done:
|
||||
// pop callee arguments if cdecl; do nothing if stdcall
|
||||
cmp cdecl_flag,0
|
||||
je no_cleanup
|
||||
mov edx, nwords
|
||||
shl edx, 2
|
||||
add esp, edx
|
||||
no_cleanup:
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif // __i386__ || _MSC_VER
|
||||
@@ -1,173 +0,0 @@
|
||||
/*
|
||||
* Copies the arguments from the given array to C stack, invoke the
|
||||
* target function, and copy the result back.
|
||||
* Written for 32-bit PPC, tested on OSX 10.4
|
||||
* twall@users.sf.net
|
||||
*/
|
||||
|
||||
#include <jni.h>
|
||||
#include "dispatch.h"
|
||||
|
||||
extern void
|
||||
asm_dispatch(void (*func)(), // r3
|
||||
int nwords, // r4
|
||||
word_t *c_args, // r5
|
||||
type_t rt, // r6
|
||||
jvalue *result, // r7
|
||||
int* arg_types); // r8
|
||||
#ifdef __ppc__
|
||||
void __asm_dispatch_dummy__() {
|
||||
asm(".globl _asm_dispatch\n_asm_dispatch:");
|
||||
// GPR3-10 and FPR1-13 available for arguments
|
||||
#define LINKAGE 24
|
||||
#define PARAMS (32*16)
|
||||
#define REGS (6*4)
|
||||
#define SPACE (LINKAGE+PARAMS+REGS)
|
||||
#define ALIGN ((SPACE + 15) & -16)
|
||||
asm("mflr r0");
|
||||
asm("stmw r26,%0(r1)" :: "i" (-REGS));
|
||||
asm("mr r12,r3");
|
||||
asm("mr r2,r5");
|
||||
asm("stw r0,8(r1)");
|
||||
asm("stwu r1,%0(r1)" :: "i" (-ALIGN));
|
||||
|
||||
#define ARGS (ALIGN+24)
|
||||
#define FUNC (ARGS)
|
||||
#define NWORDS (ARGS+4)
|
||||
#define C_ARGS (ARGS+8)
|
||||
#define RT (ARGS+12)
|
||||
#define RESULT (ARGS+16)
|
||||
#define ARG_TYPES (ARGS+20)
|
||||
|
||||
asm("stw r4,%0(r1)" :: "i" (NWORDS));
|
||||
asm("stw r5,%0(r1)" :: "i" (C_ARGS));
|
||||
asm("stw r6,%0(r1)" :: "i" (RT));
|
||||
asm("stw r7,%0(r1)" :: "i" (RESULT));
|
||||
asm("stw r8,%0(r1)" :: "i" (ARG_TYPES));
|
||||
|
||||
// register arguments (0-7)
|
||||
// callee parameters start at 24(r1)
|
||||
asm("\npush_arguments:");
|
||||
asm("mr r0,r4");
|
||||
asm("cmpwi r0, 0");
|
||||
asm("beq do_call");
|
||||
asm("lwz r3,0(r2)");
|
||||
asm("lwz r4,4(r2)");
|
||||
asm("lwz r5,8(r2)");
|
||||
asm("lwz r6,12(r2)");
|
||||
asm("lwz r7,16(r2)");
|
||||
asm("lwz r8,20(r2)");
|
||||
asm("lwz r9,24(r2)");
|
||||
asm("lwz r10,28(r2)");
|
||||
|
||||
// push any additional arguments (beyond what fits in registers)
|
||||
// to the stack
|
||||
asm("addi r28,r2,32"); // dst: callee param area after first 8 regs
|
||||
asm("addi r29,r1,56"); // src: original stack arguments after regs space
|
||||
asm("mr r2,r0"); // total word count
|
||||
asm("cmpwi r2,8");
|
||||
asm("ble push_fp");
|
||||
asm("addi r2,r2,-8");
|
||||
asm("\nstack_loop:");
|
||||
asm("lwz r0,0(r28)");
|
||||
asm("stw r0,0(r29)");
|
||||
asm("addi r28,r28,4");
|
||||
asm("addi r29,r29,4");
|
||||
asm("addi r2,r2,-1");
|
||||
asm("cmpwi r2,0");
|
||||
asm("bne stack_loop");
|
||||
|
||||
#define PUSHFP(FR) \
|
||||
asm("\nloop_" FR ":");\
|
||||
asm("lwz r29,%0(r1)" :: "i" (NWORDS));\
|
||||
asm("cmpw r26,r29");\
|
||||
asm("beq do_call");\
|
||||
asm("lwz r29,0(r28)");\
|
||||
asm("addi r26,r26,1");\
|
||||
asm("addi r28,r28,4");\
|
||||
asm("cmpwi r29,%0" :: "i" (TYPE_FP64));\
|
||||
asm("beq assign_" FR "d");\
|
||||
asm("cmpwi r29,%0" :: "i" (TYPE_FP32));\
|
||||
asm("beq assign_" FR "s");\
|
||||
asm("addi r27,r27,4");\
|
||||
asm("cmpwi r29,%0" :: "i" (TYPE_INT64));\
|
||||
asm("bne loop_" FR);\
|
||||
asm("addi r26,r26,1");\
|
||||
asm("addi r27,r27,4");\
|
||||
asm("b loop_" FR);\
|
||||
asm("\nassign_" FR "d:");\
|
||||
asm("lfd " FR ",0(r27)");\
|
||||
asm("addi r26,r26,1");\
|
||||
asm("addi r27,r27,8");\
|
||||
asm("b end_" FR);\
|
||||
asm("\nassign_" FR "s:");\
|
||||
asm("lfs " FR ",0(r27)");\
|
||||
asm("addi r27,r27,4");\
|
||||
asm("\nend_" FR ":")
|
||||
|
||||
// now push FP arguments (if any)
|
||||
asm("\npush_fp:");
|
||||
asm("li r26,0"); // index into c_args
|
||||
asm("lwz r27,%0(r1)" :: "i" (C_ARGS)); // callee parameters
|
||||
asm("lwz r28,%0(r1)" :: "i" (ARG_TYPES)); // parameter types
|
||||
|
||||
PUSHFP("f1");
|
||||
PUSHFP("f2");
|
||||
PUSHFP("f3");
|
||||
PUSHFP("f4");
|
||||
PUSHFP("f5");
|
||||
PUSHFP("f6");
|
||||
PUSHFP("f7");
|
||||
PUSHFP("f8");
|
||||
PUSHFP("f9");
|
||||
PUSHFP("f10");
|
||||
PUSHFP("f11");
|
||||
PUSHFP("f12");
|
||||
PUSHFP("f13");
|
||||
|
||||
asm("\ndo_call:");
|
||||
asm("mtctr r12");
|
||||
asm("bctrl");
|
||||
|
||||
/* Restore result pointer and return type from stack */
|
||||
asm("lwz r6,%0(r1)" :: "i" (RT));
|
||||
asm("lwz r7,%0(r1)" :: "i" (RESULT));
|
||||
asm("cmpwi r6,%0" :: "i" (TYPE_PTR));
|
||||
asm("bne not_ptr");
|
||||
asm("stw r3,4(r7)");
|
||||
asm("li r4,0");
|
||||
asm("ori r4,r4,0");
|
||||
asm("stw r4,0(r7)");
|
||||
asm("b cleanup");
|
||||
asm("\nnot_ptr:");
|
||||
asm("cmpwi r6,%0" :: "i" (TYPE_INT32));
|
||||
asm("bne not_i32");
|
||||
asm("stw r3,0(r7)");
|
||||
asm("b cleanup");
|
||||
asm("\nnot_i32:");
|
||||
asm("cmpwi r6,%0" :: "i" (TYPE_INT64));
|
||||
asm("bne not_i64");
|
||||
asm("stw r3,0(r7)");
|
||||
asm("stw r4,4(r7)");
|
||||
asm("b cleanup");
|
||||
asm("\nnot_i64:");
|
||||
asm("cmpwi r6,%0" :: "i" (TYPE_FP32));
|
||||
asm("bne not_f32");
|
||||
asm("stfs f1,0(r7)");
|
||||
asm("b cleanup");
|
||||
asm("nop");
|
||||
asm("nop");
|
||||
asm("\nnot_f32:");
|
||||
asm("stfd f1,0(r7)");
|
||||
asm("nop");
|
||||
asm("nop");
|
||||
asm("nop");
|
||||
|
||||
asm("\ncleanup:");
|
||||
asm("addi r1, r1, %0" :: "i" (ALIGN));
|
||||
asm("lwz r0,8(r1)");
|
||||
asm("lmw r26,%0(r1)" :: "i" (-REGS));
|
||||
asm("mtlr r0");
|
||||
asm("blr");
|
||||
}
|
||||
#endif // __ppc__
|
||||
@@ -1,133 +0,0 @@
|
||||
/*
|
||||
* @(#)dispatch_sparc.s 1.4 98/03/22
|
||||
*
|
||||
* Copyright (c) 1998 Sun Microsystems, Inc. All Rights Reserved.
|
||||
*
|
||||
* See also the LICENSE file in this distribution.
|
||||
*/
|
||||
|
||||
.section ".text",#alloc,#execinstr
|
||||
.file "dispatch_sparc.s"
|
||||
|
||||
.section ".text",#alloc,#execinstr
|
||||
.align 4
|
||||
|
||||
.global asm_dispatch
|
||||
|
||||
!
|
||||
! Copies the arguments from the given array to C stack, invoke the
|
||||
! target function, and copy the result back.
|
||||
!
|
||||
! Arguments:
|
||||
!
|
||||
! i0 function
|
||||
! i1 # of words in arguments
|
||||
! i2 arguments
|
||||
! i3 return type
|
||||
! i4 address to store return value
|
||||
!
|
||||
|
||||
asm_dispatch:
|
||||
|
||||
! Set up a big enough stack frame (and make sure it's 8-byte aligned):
|
||||
|
||||
subcc %o1,6,%g1 ! We can freely use %g1.
|
||||
bpos more_than_6_args
|
||||
nop
|
||||
mov %g0,%g1
|
||||
|
||||
more_than_6_args:
|
||||
add %g1,1,%g1
|
||||
sra %g1,1,%g1
|
||||
sll %g1,3,%g1
|
||||
sub %g0,%g1,%g1 ! negate %g1
|
||||
sub %g1,96,%g1
|
||||
save %sp,%g1,%sp
|
||||
|
||||
! transferring arguments
|
||||
!
|
||||
! first 6 in register
|
||||
|
||||
ld [%i2],%o0
|
||||
deccc %i1
|
||||
ble args_done ! this handles #args == 0 case too.
|
||||
add %i2,4,%i2
|
||||
|
||||
ld [%i2],%o1
|
||||
deccc %i1
|
||||
be args_done
|
||||
add %i2,4,%i2
|
||||
|
||||
ld [%i2],%o2
|
||||
deccc %i1
|
||||
be args_done
|
||||
add %i2,4,%i2
|
||||
|
||||
ld [%i2],%o3
|
||||
deccc %i1
|
||||
be args_done
|
||||
add %i2,4,%i2
|
||||
|
||||
ld [%i2],%o4
|
||||
deccc %i1
|
||||
be args_done
|
||||
add %i2,4,%i2
|
||||
|
||||
ld [%i2],%o5
|
||||
deccc %i1
|
||||
be args_done
|
||||
add %i2,4,%i2
|
||||
|
||||
! push the remaining arguments onto the stack
|
||||
|
||||
add %sp,92,%l0
|
||||
args_loop:
|
||||
ld [%i2],%l3
|
||||
deccc %i1
|
||||
st %l3,[%l0]
|
||||
add %l0,4,%l0
|
||||
bne args_loop
|
||||
add %i2,4,%i2
|
||||
|
||||
args_done:
|
||||
|
||||
jmpl %i0,%o7
|
||||
nop
|
||||
|
||||
set ret_jumps, %l1
|
||||
sll %i3,2,%i3
|
||||
|
||||
ld [%l1 + %i3],%g1 ! thread the return address to the
|
||||
jmp %g1 ! proper code for our return type
|
||||
nop
|
||||
|
||||
ret_f64:
|
||||
st %f0,[%i4]
|
||||
st %f1,[%i4+4]
|
||||
ret
|
||||
restore %g0,%g0,%o0
|
||||
|
||||
ret_f32:
|
||||
st %f0,[%i4]
|
||||
ret
|
||||
restore %g0,%g0,%o0
|
||||
|
||||
ret_i32:
|
||||
st %o0,[%i4]
|
||||
ret
|
||||
restore %g0,%g0,%o0
|
||||
|
||||
ret_p64:
|
||||
st %g0,[%i4]
|
||||
st %o0,[%i4+4]
|
||||
ret
|
||||
restore %g0,%g0,%o0
|
||||
|
||||
ret_jumps:
|
||||
.word ret_p64
|
||||
.word ret_i32
|
||||
.word ret_f32
|
||||
.word ret_f64
|
||||
|
||||
.type asm_dispatch,2
|
||||
.size asm_dispatch,(.-asm_dispatch)
|
||||
@@ -0,0 +1,34 @@
|
||||
// Resource file to generate version information for jnidispatch.dll
|
||||
// Copyright (c) 2008 Timothy Wall
|
||||
// Type: version
|
||||
|
||||
// Name: 1
|
||||
LANGUAGE 0, 0
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION 3,0,0,0
|
||||
PRODUCTVERSION 3,0,1,0
|
||||
FILEFLAGSMASK 0x3f
|
||||
FILEOS 0x4
|
||||
FILETYPE 0x2
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "000004b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Java(TM) Native Access (JNA)"
|
||||
VALUE "FileDescription", "JNA native library"
|
||||
VALUE "FileVersion","3.0.0"
|
||||
VALUE "Full Version","3.0.0 b0"
|
||||
VALUE "InternalName", "jnidispatch"
|
||||
VALUE "LegalCopyright", "Copyright \251 2008 Timothy Wall"
|
||||
VALUE "OriginalFilename", "jnidispatch.dll"
|
||||
VALUE "ProductName", "Java(TM) Native Access"
|
||||
VALUE "ProductVersion","3"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0, 1200
|
||||
END
|
||||
END
|
||||
Arquivo executável
+56
@@ -0,0 +1,56 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# ld-compatible wrapper for link.exe
|
||||
#
|
||||
#args="/pdbtype:sept"
|
||||
MSVC="/c/Program Files (x86)/Microsoft Visual Studio 9.0/vc/bin"
|
||||
args="/nologo /opt:REF /incremental:no /subsystem:console /nodefaultlib:msvcrtd"
|
||||
link="$MSVC/link"
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
case $1
|
||||
in
|
||||
-m32)
|
||||
link="$MSVC/link"
|
||||
args="$args /machine:X86"
|
||||
shift 1
|
||||
;;
|
||||
-m64)
|
||||
link="$MSVC/x86_amd64/link"
|
||||
args="$args /machine:X64"
|
||||
shift 1
|
||||
;;
|
||||
-g)
|
||||
args="$args /debug"
|
||||
shift 1
|
||||
;;
|
||||
-o)
|
||||
dir="$(dirname $2)"
|
||||
base="$(basename $2|sed 's/\.[^.]*//g')"
|
||||
args="$args /out:\"$2\" /pdb:$dir/$base.pdb /implib:$dir/$base.lib"
|
||||
shift 2
|
||||
;;
|
||||
-shared)
|
||||
args="$args /DLL"
|
||||
shift 1
|
||||
;;
|
||||
-static-libgcc)
|
||||
shift 1
|
||||
;;
|
||||
*.dll)
|
||||
args="$args $(echo $1|sed -e 's/.dll/.lib/g')"
|
||||
shift 1
|
||||
;;
|
||||
*.o|*.lib|*.a)
|
||||
args="$args $(echo $1|sed -e 's%\\%/%g')"
|
||||
shift 1
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported argument '$1'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo "\"$link\" $args"
|
||||
eval "\"$link\" $args"
|
||||
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -0,0 +1,524 @@
|
||||
2009-05-12 Timothy Wall <twall@users.sf.net>
|
||||
|
||||
* Makefile.am,
|
||||
configure.ac,
|
||||
include/ffi.h.in,
|
||||
include/ffi_common.h,
|
||||
src/closures.c,
|
||||
src/dlmalloc.c,
|
||||
src/x86/ffi.c,
|
||||
src/x86/ffitarget.h,
|
||||
src/x86/win64.S (new),
|
||||
README: Added win64 support (mingw or MSVC)
|
||||
* Makefile.in,
|
||||
include/Makefile.in,
|
||||
man/Makefile.in,
|
||||
testsuite/Makefile.in,
|
||||
configure,
|
||||
aclocal.m4: Regenerated
|
||||
* ltcf-c.sh: properly escape cygwin/w32 path
|
||||
* man/ffi_call.3: Clarify size requirements for return value.
|
||||
* src/x86/ffi64.c: Fix filename in comment.
|
||||
* src/x86/win32.S: Remove global reference which causes undefined
|
||||
symbol warning.
|
||||
* testsuite/libffi.call/closure_fn0.c,
|
||||
testsuite/libffi.call/closure_fn1.c,
|
||||
testsuite/libffi.call/closure_fn2.c,
|
||||
testsuite/libffi.call/closure_fn3.c,
|
||||
testsuite/libffi.call/closure_fn4.c,
|
||||
testsuite/libffi.call/closure_fn5.c,
|
||||
testsuite/libffi.call/closure_fn6.c,
|
||||
testsuite/libffi.call/closure_stdcall.c,
|
||||
testsuite/libffi.call/cls_12byte.c,
|
||||
testsuite/libffi.call/cls_16byte.c,
|
||||
testsuite/libffi.call/cls_18byte.c,
|
||||
testsuite/libffi.call/cls_19byte.c,
|
||||
testsuite/libffi.call/cls_1_1byte.c,
|
||||
testsuite/libffi.call/cls_20byte.c,
|
||||
testsuite/libffi.call/cls_20byte1.c,
|
||||
testsuite/libffi.call/cls_24byte.c,
|
||||
testsuite/libffi.call/cls_2byte.c,
|
||||
testsuite/libffi.call/cls_3_1byte.c,
|
||||
testsuite/libffi.call/cls_3byte1.c,
|
||||
testsuite/libffi.call/cls_3byte2.c,
|
||||
testsuite/libffi.call/cls_4_1byte.c,
|
||||
testsuite/libffi.call/cls_4byte.c,
|
||||
testsuite/libffi.call/cls_5_1_byte.c,
|
||||
testsuite/libffi.call/cls_5byte.c,
|
||||
testsuite/libffi.call/cls_64byte.c,
|
||||
testsuite/libffi.call/cls_6_1_byte.c,
|
||||
testsuite/libffi.call/cls_6byte.c,
|
||||
testsuite/libffi.call/cls_7_1_byte.c,
|
||||
testsuite/libffi.call/cls_7byte.c,
|
||||
testsuite/libffi.call/cls_8byte.c,
|
||||
testsuite/libffi.call/cls_9byte1.c,
|
||||
testsuite/libffi.call/cls_9byte2.c,
|
||||
testsuite/libffi.call/cls_align_double.c,
|
||||
testsuite/libffi.call/cls_align_float.c,
|
||||
testsuite/libffi.call/cls_align_longdouble.c,
|
||||
testsuite/libffi.call/cls_align_longdouble_split.c,
|
||||
testsuite/libffi.call/cls_align_longdouble_split2.c,
|
||||
testsuite/libffi.call/cls_align_pointer.c,
|
||||
testsuite/libffi.call/cls_align_sint16.c,
|
||||
testsuite/libffi.call/cls_align_sint32.c,
|
||||
testsuite/libffi.call/cls_align_sint64.c,
|
||||
testsuite/libffi.call/cls_align_uint16.c,
|
||||
testsuite/libffi.call/cls_align_uint32.c,
|
||||
testsuite/libffi.call/cls_align_uint64.c,
|
||||
testsuite/libffi.call/cls_dbls_struct.c,
|
||||
testsuite/libffi.call/cls_double.c,
|
||||
testsuite/libffi.call/cls_double_va.c,
|
||||
testsuite/libffi.call/cls_float.c,
|
||||
testsuite/libffi.call/cls_longdouble.c,
|
||||
testsuite/libffi.call/cls_longdouble_va.c,
|
||||
testsuite/libffi.call/cls_multi_schar.c,
|
||||
testsuite/libffi.call/cls_multi_sshort.c,
|
||||
testsuite/libffi.call/cls_multi_sshortchar.c,
|
||||
testsuite/libffi.call/cls_multi_uchar.c,
|
||||
testsuite/libffi.call/cls_multi_ushort.c,
|
||||
testsuite/libffi.call/cls_multi_ushortchar.c,
|
||||
testsuite/libffi.call/cls_pointer.c,
|
||||
testsuite/libffi.call/cls_pointer_stack.c,
|
||||
testsuite/libffi.call/cls_schar.c,
|
||||
testsuite/libffi.call/cls_sint.c,
|
||||
testsuite/libffi.call/cls_sshort.c,
|
||||
testsuite/libffi.call/cls_uchar.c,
|
||||
testsuite/libffi.call/cls_uint.c,
|
||||
testsuite/libffi.call/cls_ulonglong.c,
|
||||
testsuite/libffi.call/cls_ushort.c,
|
||||
testsuite/libffi.call/err_bad_abi.c,
|
||||
testsuite/libffi.call/err_bad_typedef.c,
|
||||
testsuite/libffi.call/float2.c,
|
||||
testsuite/libffi.call/huge_struct.c,
|
||||
testsuite/libffi.call/nested_struct.c,
|
||||
testsuite/libffi.call/nested_struct1.c,
|
||||
testsuite/libffi.call/nested_struct10.c,
|
||||
testsuite/libffi.call/nested_struct2.c,
|
||||
testsuite/libffi.call/nested_struct3.c,
|
||||
testsuite/libffi.call/nested_struct4.c,
|
||||
testsuite/libffi.call/nested_struct5.c,
|
||||
testsuite/libffi.call/nested_struct6.c,
|
||||
testsuite/libffi.call/nested_struct7.c,
|
||||
testsuite/libffi.call/nested_struct8.c,
|
||||
testsuite/libffi.call/nested_struct9.c,
|
||||
testsuite/libffi.call/problem1.c,
|
||||
testsuite/libffi.call/return_ldl.c,
|
||||
testsuite/libffi.call/return_ll1.c,
|
||||
testsuite/libffi.call/stret_large.c,
|
||||
testsuite/libffi.call/stret_large2.c,
|
||||
testsuite/libffi.call/stret_medium.c,
|
||||
testsuite/libffi.call/stret_medium2.c,
|
||||
testsuite/libffi.special/unwindtest.cc: use ffi_closure_alloc instead
|
||||
of checking for MMAP. Use intptr_t instead of long casts.
|
||||
|
||||
2008-12-26 Timothy Wall <twall@users.sf.net>
|
||||
|
||||
* testsuite/libffi.call/cls_longdouble.c,
|
||||
testsuite/libffi.call/cls_longdouble_va.c,
|
||||
testsuite/libffi.call/cls_align_longdouble.c,
|
||||
testsuite/libffi.call/cls_align_longdouble_split.c,
|
||||
testsuite/libffi.call/cls_align_longdouble_split2.c: mark expected
|
||||
failures on x86_64 cygwin/mingw.
|
||||
|
||||
2008-12-22 Timothy Wall <twall@users.sf.net>
|
||||
|
||||
* testsuite/libffi.call/closure_fn0.c,
|
||||
testsuite/libffi.call/closure_fn1.c,
|
||||
testsuite/libffi.call/closure_fn2.c,
|
||||
testsuite/libffi.call/closure_fn3.c,
|
||||
testsuite/libffi.call/closure_fn4.c,
|
||||
testsuite/libffi.call/closure_fn5.c,
|
||||
testsuite/libffi.call/closure_fn6.c,
|
||||
testsuite/libffi.call/closure_loc_fn0.c,
|
||||
testsuite/libffi.call/closure_stdcall.c,
|
||||
testsuite/libffi.call/cls_align_pointer.c,
|
||||
testsuite/libffi.call/cls_pointer.c,
|
||||
testsuite/libffi.call/cls_pointer_stack.c: use portable cast from
|
||||
pointer to integer (intptr_t).
|
||||
* testsuite/libffi.call/cls_longdouble.c: disable for win64.
|
||||
|
||||
2008-12-19 Anthony Green <green@redhat.com>
|
||||
|
||||
* configure.ac: Bump version to 3.0.8.
|
||||
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
|
||||
* libtool-version: Increment revision.
|
||||
* README: Update for new release.
|
||||
|
||||
2008-11-11 Anthony Green <green@redhat.com>
|
||||
|
||||
* configure.ac: Bump version to 3.0.7.
|
||||
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
|
||||
* libtool-version: Increment revision.
|
||||
* README: Update for new release.
|
||||
|
||||
2008-08-25 Andreas Tobler <a.tobler@schweiz.org>
|
||||
|
||||
* src/powerpc/ffitarget.h (ffi_abi): Add FFI_LINUX and
|
||||
FFI_LINUX_SOFT_FLOAT to the POWERPC_FREEBSD enum.
|
||||
Add note about flag bits used for FFI_SYSV_TYPE_SMALL_STRUCT.
|
||||
Adjust copyright notice.
|
||||
* src/powerpc/ffi.c: Add two new flags to indicate if we have one
|
||||
register or two register to use for FFI_SYSV structs.
|
||||
(ffi_prep_cif_machdep): Pass the right register flag introduced above.
|
||||
(ffi_closure_helper_SYSV): Fix the return type for
|
||||
FFI_SYSV_TYPE_SMALL_STRUCT. Comment.
|
||||
Adjust copyright notice.
|
||||
|
||||
2008-07-24 Anthony Green <green@redhat.com>
|
||||
|
||||
* testsuite/libffi.call/cls_dbls_struct.c,
|
||||
testsuite/libffi.call/cls_double_va.c,
|
||||
testsuite/libffi.call/cls_longdouble.c,
|
||||
testsuite/libffi.call/cls_longdouble_va.c,
|
||||
testsuite/libffi.call/cls_pointer.c,
|
||||
testsuite/libffi.call/cls_pointer_stack.c,
|
||||
testsuite/libffi.call/err_bad_abi.c: Clean up failures from
|
||||
compiler warnings.
|
||||
|
||||
2008-07-17 Anthony Green <green@redhat.com>
|
||||
|
||||
* configure.ac: Bump version to 3.0.6.
|
||||
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
|
||||
* libtool-version: Increment revision. Add documentation.
|
||||
* README: Update for new release.
|
||||
|
||||
2008-07-16 Kaz Kojima <kkojima@gcc.gnu.org>
|
||||
|
||||
* src/sh/ffi.c (ffi_prep_closure_loc): Turn INSN into an unsigned
|
||||
int.
|
||||
|
||||
2008-07-16 Kaz Kojima <kkojima@gcc.gnu.org>
|
||||
|
||||
* src/sh/sysv.S: Add .note.GNU-stack on Linux.
|
||||
* src/sh64/sysv.S: Likewise.
|
||||
|
||||
2008-04-03 Anthony Green <green@redhat.com>
|
||||
|
||||
* libffi.pc.in (Libs): Add -L${libdir}.
|
||||
* configure.ac: Bump version to 3.0.5.
|
||||
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
|
||||
* libtool-version: Increment revision.
|
||||
* README: Update for new release.
|
||||
|
||||
2008-04-03 Anthony Green <green@redhat.com>
|
||||
Xerces Ranby <xerxes@zafena.se>
|
||||
|
||||
* include/ffi.h.in: Wrap definition of target architecture to
|
||||
protect from double definitions.
|
||||
|
||||
2008-03-22 Moriyoshi Koizumi <moriyoshi@gmail.com>
|
||||
|
||||
* src/x86/ffi.c (ffi_prep_closure_loc): Fix for bug revealed in
|
||||
closure_loc_fn0.c.
|
||||
* testsuite/libffi.call/closure_loc_fn0.c (closure_loc_test_fn0):
|
||||
New test.
|
||||
|
||||
2008-03-04 Anthony Green <green@redhat.com>
|
||||
Blake Chaffin
|
||||
hos@tamanegi.org
|
||||
|
||||
* testsuite/libffi.call/cls_align_longdouble_split2.c
|
||||
testsuite/libffi.call/cls_align_longdouble_split.c
|
||||
testsuite/libffi.call/cls_dbls_struct.c
|
||||
testsuite/libffi.call/cls_double_va.c
|
||||
testsuite/libffi.call/cls_longdouble.c
|
||||
testsuite/libffi.call/cls_longdouble_va.c
|
||||
testsuite/libffi.call/cls_pointer.c
|
||||
testsuite/libffi.call/cls_pointer_stack.c
|
||||
testsuite/libffi.call/err_bad_abi.c
|
||||
testsuite/libffi.call/err_bad_typedef.c
|
||||
testsuite/libffi.call/huge_struct.c
|
||||
testsuite/libffi.call/stret_large2.c
|
||||
testsuite/libffi.call/stret_large.c
|
||||
testsuite/libffi.call/stret_medium2.c
|
||||
testsuite/libffi.call/stret_medium.c: New tests from Apple.
|
||||
|
||||
2008-02-26 Jakub Jelinek <jakub@redhat.com>
|
||||
Anthony Green <green@redhat.com>
|
||||
|
||||
* src/alpha/osf.S: Add .note.GNU-stack on Linux.
|
||||
* src/s390/sysv.S: Likewise.
|
||||
* src/powerpc/linux64.S: Likewise.
|
||||
* src/powerpc/linux64_closure.S: Likewise.
|
||||
* src/powerpc/ppc_closure.S: Likewise.
|
||||
* src/powerpc/sysv.S: Likewise.
|
||||
* src/x86/unix64.S: Likewise.
|
||||
* src/x86/sysv.S: Likewise.
|
||||
* src/sparc/v8.S: Likewise.
|
||||
* src/sparc/v9.S: Likewise.
|
||||
* src/m68k/sysv.S: Likewise.
|
||||
* src/ia64/unix.S: Likewise.
|
||||
* src/arm/sysv.S: Likewise.
|
||||
|
||||
2008-02-26 Anthony Green <green@redhat.com>
|
||||
Thomas Heller <theller@ctypes.org>
|
||||
|
||||
* src/x86/ffi.c (ffi_closure_SYSV_inner): Change C++ comment to C
|
||||
comment.
|
||||
|
||||
2008-02-26 Anthony Green <green@redhat.org>
|
||||
Thomas Heller <theller@ctypes.org>
|
||||
|
||||
* include/ffi.h.in: Change void (*)() to void (*)(void).
|
||||
|
||||
2008-02-26 Anthony Green <green@redhat.org>
|
||||
Thomas Heller <theller@ctypes.org>
|
||||
|
||||
* src/alpha/ffi.c: Change void (*)() to void (*)(void).
|
||||
src/alpha/osf.S, src/arm/ffi.c, src/frv/ffi.c, src/ia64/ffi.c,
|
||||
src/ia64/unix.S, src/java_raw_api.c, src/m32r/ffi.c,
|
||||
src/mips/ffi.c, src/pa/ffi.c, src/pa/hpux32.S, src/pa/linux.S,
|
||||
src/powerpc/ffi.c, src/powerpc/ffi_darwin.c, src/raw_api.c,
|
||||
src/s390/ffi.c, src/sh/ffi.c, src/sh64/ffi.c, src/sparc/ffi.c,
|
||||
src/x86/ffi.c, src/x86/unix64.S, src/x86/darwin64.S,
|
||||
src/x86/ffi64.c: Ditto.
|
||||
|
||||
2008-02-24 Anthony Green <green@redhat.org>
|
||||
|
||||
* configure.ac: Accept openbsd*, not just openbsd.
|
||||
Bump version to 3.0.4.
|
||||
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
|
||||
* libtool-version: Increment revision.
|
||||
* README: Update for new release.
|
||||
|
||||
2008-02-22 Anthony Green <green@redhat.com>
|
||||
|
||||
* README: Clean up list of tested platforms.
|
||||
|
||||
2008-02-22 Anthony Green <green@redhat.com>
|
||||
|
||||
* configure.ac: Bump version to 3.0.3.
|
||||
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
|
||||
* libtool-version: Increment revision.
|
||||
* README: Update for new release. Clean up test docs.
|
||||
|
||||
2008-02-22 Bjoern Koenig <bkoenig@alpha-tierchen.de>
|
||||
Andreas Tobler <a.tobler@schweiz.org>
|
||||
|
||||
* configure.ac: Add amd64-*-freebsd* target.
|
||||
* configure: Regenerate.
|
||||
|
||||
2008-02-22 Thomas Heller <theller@ctypes.org>
|
||||
|
||||
* configure.ac: Add x86 OpenBSD support.
|
||||
* configure: Rebuilt.
|
||||
|
||||
2008-02-21 Thomas Heller <theller@ctypes.org>
|
||||
|
||||
* README: Change "make test" to "make check".
|
||||
|
||||
2008-02-21 Anthony Green <green@redhat.com>
|
||||
|
||||
* configure.ac: Bump version to 3.0.2.
|
||||
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
|
||||
* libtool-version: Increment revision.
|
||||
* README: Update for new release.
|
||||
|
||||
2008-02-21 Björn König <bkoenig@alpha-tierchen.de>
|
||||
|
||||
* src/x86/freebsd.S: New file.
|
||||
* configure.ac: Add x86 FreeBSD support.
|
||||
* Makefile.am: Ditto.
|
||||
|
||||
2008-02-15 Anthony Green <green@redhat.com>
|
||||
|
||||
* configure.ac: Bump version to 3.0.1.
|
||||
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
|
||||
* libtool-version: Increment revision.
|
||||
* README: Update for new release.
|
||||
|
||||
2008-02-15 David Daney <ddaney@avtrex.com>
|
||||
|
||||
* src/mips/ffi.c: Remove extra '>' from include directive.
|
||||
(ffi_prep_closure_loc): Use clear_location instead of tramp.
|
||||
|
||||
2008-02-15 Anthony Green <green@redhat.com>
|
||||
|
||||
* configure.ac: Bump version to 3.0.0.
|
||||
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
|
||||
|
||||
2008-02-15 David Daney <ddaney@avtrex.com>
|
||||
|
||||
* src/mips/ffi.c (USE__BUILTIN___CLEAR_CACHE):
|
||||
Define (conditionally), and use it to include cachectl.h.
|
||||
(ffi_prep_closure_loc): Fix cache flushing.
|
||||
* src/mips/ffitarget.h (_ABIN32, _ABI64, _ABIO32): Define.
|
||||
|
||||
2008-02-15 Anthony Green <green@redhat.com>
|
||||
|
||||
* man/ffi_call.3, man/ffi_prep_cif.3, man/ffi.3:
|
||||
Update dates and remove all references to ffi_prep_closure.
|
||||
* configure.ac: Bump version to 2.99.9.
|
||||
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
|
||||
|
||||
2008-02-15 Anthony Green <green@redhat.com>
|
||||
|
||||
* man/ffi_prep_closure.3: Delete.
|
||||
* man/Makefile.am (EXTRA_DIST): Remove ffi_prep_closure.3.
|
||||
(man_MANS): Ditto.
|
||||
* man/Makefile.in: Rebuilt.
|
||||
* configure.ac: Bump version to 2.99.8.
|
||||
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
|
||||
|
||||
2008-02-14 Anthony Green <green@redhat.com>
|
||||
|
||||
* configure.ac: Bump version to 2.99.7.
|
||||
* configure, doc/stamp-vti, doc/version.texi: Rebuilt.
|
||||
* include/ffi.h.in LICENSE src/debug.c src/closures.c
|
||||
src/ffitest.c src/s390/sysv.S src/s390/ffitarget.h
|
||||
src/types.c src/m68k/ffitarget.h src/raw_api.c src/frv/ffi.c
|
||||
src/frv/ffitarget.h src/sh/ffi.c src/sh/sysv.S
|
||||
src/sh/ffitarget.h src/powerpc/ffitarget.h src/pa/ffi.c
|
||||
src/pa/ffitarget.h src/pa/linux.S src/java_raw_api.c
|
||||
src/cris/ffitarget.h src/x86/ffi.c src/x86/sysv.S
|
||||
src/x86/unix64.S src/x86/win32.S src/x86/ffitarget.h
|
||||
src/x86/ffi64.c src/x86/darwin.S src/ia64/ffi.c
|
||||
src/ia64/ffitarget.h src/ia64/ia64_flags.h src/ia64/unix.S
|
||||
src/sparc/ffi.c src/sparc/v9.S src/sparc/ffitarget.h
|
||||
src/sparc/v8.S src/alpha/ffi.c src/alpha/ffitarget.h
|
||||
src/alpha/osf.S src/sh64/ffi.c src/sh64/sysv.S
|
||||
src/sh64/ffitarget.h src/mips/ffi.c src/mips/ffitarget.h
|
||||
src/mips/n32.S src/mips/o32.S src/arm/ffi.c src/arm/sysv.S
|
||||
src/arm/ffitarget.h src/prep_cif.c: Update license text.
|
||||
|
||||
2008-02-14 Anthony Green <green@redhat.com>
|
||||
|
||||
* README: Update tested platforms.
|
||||
* configure.ac: Bump version to 2.99.6.
|
||||
* configure: Rebuilt.
|
||||
|
||||
2008-02-14 Anthony Green <green@redhat.com>
|
||||
|
||||
* configure.ac: Bump version to 2.99.5.
|
||||
* configure: Rebuilt.
|
||||
* Makefile.am (EXTRA_DIST): Add darwin64.S
|
||||
* Makefile.in: Rebuilt.
|
||||
* testsuite/lib/libffi-dg.exp: Remove libstdc++ bits from GCC tree.
|
||||
* LICENSE: Update WARRANTY.
|
||||
|
||||
2008-02-14 Anthony Green <green@redhat.com>
|
||||
|
||||
* libffi.pc.in (libdir): Fix libdir definition.
|
||||
* configure.ac: Bump version to 2.99.4.
|
||||
* configure: Rebuilt.
|
||||
|
||||
2008-02-14 Anthony Green <green@redhat.com>
|
||||
|
||||
* README: Update.
|
||||
* libffi.info: New file.
|
||||
* doc/stamp-vti: New file.
|
||||
* configure.ac: Bump version to 2.99.3.
|
||||
* configure: Rebuilt.
|
||||
|
||||
2008-02-14 Anthony Green <green@redhat.com>
|
||||
|
||||
* Makefile.am (SUBDIRS): Add man dir.
|
||||
* Makefile.in: Rebuilt.
|
||||
* configure.ac: Create Makefile.
|
||||
* configure: Rebuilt.
|
||||
* man/ffi_call.3 man/ffi_prep_cif.3 man/ffi_prep_closure.3
|
||||
man/Makefile.am man/Makefile.in: New files.
|
||||
|
||||
2008-02-14 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* aclocal.m4, Makefile.in, configure, fficonfig.h.in: Rebuilt.
|
||||
* mdate-sh, texinfo.tex: New files.
|
||||
* Makefile.am (info_TEXINFOS): New variable.
|
||||
* doc/libffi.texi: New file.
|
||||
* doc/version.texi: Likewise.
|
||||
|
||||
2008-02-14 Anthony Green <green@redhat.com>
|
||||
|
||||
* Makefile.am (AM_CFLAGS): Don't compile with -D$(TARGET).
|
||||
(lib_LTLIBRARIES): Define.
|
||||
(toolexeclib_LIBRARIES): Undefine.
|
||||
* Makefile.in: Rebuilt.
|
||||
* configure.ac: Reset version to 2.99.1.
|
||||
* configure.in: Rebuilt.
|
||||
|
||||
2008-02-14 Anthony Green <green@redhat.com>
|
||||
|
||||
* libffi.pc.in: Use @PACKAGE_NAME@ and @PACKAGE_VERSION@.
|
||||
* configure.ac: Reset version to 2.99.1.
|
||||
* configure.in: Rebuilt.
|
||||
* Makefile.am (EXTRA_DIST): Add ChangeLog.libffi.
|
||||
* Makefile.in: Rebuilt.
|
||||
* LICENSE: Update copyright notice.
|
||||
|
||||
2008-02-14 Anthony Green <green@redhat.com>
|
||||
|
||||
* include/Makefile.am (nodist_includes_HEADERS): Define. Don't
|
||||
distribute ffitarget.h or ffi.h from the build include dir.
|
||||
* Makefile.in: Rebuilt.
|
||||
|
||||
2008-02-14 Anthony Green <green@redhat.com>
|
||||
|
||||
* include/Makefile.am (includesdir): Install headers under libdir.
|
||||
(pkgconfigdir): Define. Install libffi.pc.
|
||||
* include/Makefile.in: Rebuilt.
|
||||
* libffi.pc.in: Create.
|
||||
* libtool-version: Increment CURRENT
|
||||
* configure.ac: Add libffi.pc.in
|
||||
* configure: Rebuilt.
|
||||
|
||||
2008-02-03 Anthony Green <green@redhat.com>
|
||||
|
||||
* include/Makefile.am (includesdir): Fix header install with
|
||||
DESTDIR.
|
||||
* include/Makefile.in: Rebuilt.
|
||||
|
||||
2008-02-03 Timothy Wall <twall@users.sf.net>
|
||||
|
||||
* src/x86/ffi.c (FFI_INIT_TRAMPOLINE_STDCALL): Calculate jump return
|
||||
offset based on code pointer, not data pointer.
|
||||
|
||||
2008-02-01 Anthony Green <green@redhat.com>
|
||||
|
||||
* include/Makefile.am: Fix header installs.
|
||||
* Makefile.am: Ditto.
|
||||
* include/Makefile.in: Rebuilt.
|
||||
* Makefile.in: Ditto.
|
||||
|
||||
2008-02-01 Anthony Green <green@redhat.com>
|
||||
|
||||
* src/x86/ffi.c (FFI_INIT_TRAMPOLINE_STDCALL,
|
||||
FFI_INIT_TRAMPOLINE): Revert my broken changes to twall's last
|
||||
patch.
|
||||
|
||||
2008-01-31 Anthony Green <green@redhat.com>
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Add missing files.
|
||||
* testsuite/Makefile.am: Ditto.
|
||||
* Makefile.in, testsuite/Makefile.in: Rebuilt.
|
||||
|
||||
2008-01-31 Timothy Wall <twall@users.sf.net>
|
||||
|
||||
* testsuite/libffi.call/closure_stdcall.c: Add test for stdcall
|
||||
closures.
|
||||
* src/x86/ffitarget.h: Increase size of trampoline for stdcall
|
||||
closures.
|
||||
* src/x86/win32.S: Add assembly for stdcall closure.
|
||||
* src/x86/ffi.c: Initialize stdcall closure trampoline.
|
||||
|
||||
2008-01-30 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR libffi/34612
|
||||
* src/x86/sysv.S (ffi_closure_SYSV): Pop 4 byte from stack when
|
||||
returning struct.
|
||||
|
||||
* testsuite/libffi.call/call.exp: Add "-O2 -fomit-frame-pointer"
|
||||
tests.
|
||||
|
||||
2008-01-30 Anthony Green <green@redhat.com>
|
||||
|
||||
* Makefile.am, include/Makefile.am: Move headers to
|
||||
libffi_la_SOURCES for new automake.
|
||||
* Makefile.in, include/Makefile.in: Rebuilt.
|
||||
|
||||
* testsuite/lib/wrapper.exp: Copied from gcc tree to allow for
|
||||
execution outside of gcc tree.
|
||||
* testsuite/lib/target-libpath.exp: Ditto.
|
||||
|
||||
* testsuite/lib/libffi-dg.exp: Many changes to allow for execution
|
||||
outside of gcc tree.
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
2004-01-14 Kelley Cook <kcook@gcc.gnu.org>
|
||||
|
||||
* configure.in: Add in AC_PREREQ(2.13)
|
||||
|
||||
2003-02-20 Alexandre Oliva <aoliva@redhat.com>
|
||||
|
||||
* configure.in: Propagate ORIGINAL_LD_FOR_MULTILIBS to
|
||||
config.status.
|
||||
* configure: Rebuilt.
|
||||
|
||||
2002-01-27 Alexandre Oliva <aoliva@redhat.com>
|
||||
|
||||
* configure.in (toolexecdir, toolexeclibdir): Set and AC_SUBST.
|
||||
Remove USE_LIBDIR conditional.
|
||||
* Makefile.am (toolexecdir, toolexeclibdir): Don't override.
|
||||
* Makefile.in, configure: Rebuilt.
|
||||
|
||||
Mon Aug 9 18:33:38 1999 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
|
||||
|
||||
* include/Makefile.in: Rebuilt.
|
||||
* Makefile.in: Rebuilt
|
||||
* Makefile.am (toolexeclibdir): Add $(MULTISUBDIR) even for native
|
||||
builds.
|
||||
Use USE_LIBDIR.
|
||||
|
||||
* configure: Rebuilt.
|
||||
* configure.in (USE_LIBDIR): Define for native builds.
|
||||
Use lowercase in configure --help explanations.
|
||||
|
||||
1999-08-08 Anthony Green <green@cygnus.com>
|
||||
|
||||
* include/ffi.h.in (FFI_FN): Remove `...'.
|
||||
|
||||
1999-08-08 Anthony Green <green@cygnus.com>
|
||||
|
||||
* Makefile.in: Rebuilt.
|
||||
* Makefile.am (AM_CFLAGS): Compile with -fexceptions.
|
||||
|
||||
* src/x86/sysv.S: Add exception handling metadata.
|
||||
|
||||
@@ -0,0 +1,764 @@
|
||||
The libffi version 1 ChangeLog archive.
|
||||
|
||||
Version 1 of libffi had per-directory ChangeLogs. Current and future
|
||||
versions have a single ChangeLog file in the root directory. The
|
||||
version 1 ChangeLogs have all been concatonated into this file for
|
||||
future reference only.
|
||||
|
||||
--- libffi ----------------------------------------------------------------
|
||||
|
||||
Mon Oct 5 02:17:50 1998 Anthony Green <green@cygnus.com>
|
||||
|
||||
* configure.in: Boosted rev.
|
||||
* configure, Makefile.in, aclocal.m4: Rebuilt.
|
||||
* README: Boosted rev and updated release notes.
|
||||
|
||||
Mon Oct 5 01:03:03 1998 Anthony Green <green@cygnus.com>
|
||||
|
||||
* configure.in: Boosted rev.
|
||||
* configure, Makefile.in, aclocal.m4: Rebuilt.
|
||||
* README: Boosted rev and updated release notes.
|
||||
|
||||
1998-07-25 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* m68k/ffi.c (ffi_prep_cif_machdep): Use bitmask for cif->flags.
|
||||
Correctly handle small structures.
|
||||
(ffi_prep_args): Also handle small structures.
|
||||
(ffi_call): Pass size of return type to ffi_call_SYSV.
|
||||
* m68k/sysv.S: Adjust for above changes. Correctly align small
|
||||
structures in the return value.
|
||||
|
||||
* types.c (uint64, sint64) [M68K]: Change alignment to 4.
|
||||
|
||||
Fri Apr 17 17:26:58 1998 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* configure.in: Boosted rev.
|
||||
* configure,Makefile.in,aclocal.m4: Rebuilt.
|
||||
* README: Boosted rev and added release notes.
|
||||
|
||||
Sun Feb 22 00:50:41 1998 Geoff Keating <geoffk@ozemail.com.au>
|
||||
|
||||
* configure.in: Add PowerPC config bits.
|
||||
|
||||
1998-02-14 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* configure.in: Add m68k config bits. Change AC_CANONICAL_SYSTEM
|
||||
to AC_CANONICAL_HOST, this is not a compiler. Use $host instead
|
||||
of $target. Remove AC_CHECK_SIZEOF(char), we already know the
|
||||
result. Fix argument of AC_ARG_ENABLE.
|
||||
* configure, fficonfig.h.in: Rebuilt.
|
||||
|
||||
Tue Feb 10 20:53:40 1998 Richard Henderson <rth@cygnus.com>
|
||||
|
||||
* configure.in: Add Alpha config bits.
|
||||
|
||||
Tue May 13 13:39:20 1997 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* README: Updated dates and reworded Irix comments.
|
||||
|
||||
* configure.in: Removed AC_PROG_RANLIB.
|
||||
|
||||
* Makefile.in, aclocal.m4, config.guess, config.sub, configure,
|
||||
ltmain.sh, */Makefile.in: libtoolized again and rebuilt with
|
||||
automake and autoconf.
|
||||
|
||||
Sat May 10 18:44:50 1997 Tom Tromey <tromey@cygnus.com>
|
||||
|
||||
* configure, aclocal.m4: Rebuilt.
|
||||
* configure.in: Don't compute EXTRADIST; now handled in
|
||||
src/Makefile.in. Removed macros implied by AM_INIT_AUTOMAKE.
|
||||
Don't run AM_MAINTAINER_MODE.
|
||||
|
||||
Thu May 8 14:34:05 1997 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* missing, ltmain.sh, ltconfig.sh: Created. These are new files
|
||||
required by automake and libtool.
|
||||
|
||||
* README: Boosted rev to 1.14. Added notes.
|
||||
|
||||
* acconfig.h: Moved PACKAGE and VERSION for new automake.
|
||||
|
||||
* configure.in: Changes for libtool.
|
||||
|
||||
* Makefile.am (check): make test now make check. Uses libtool now.
|
||||
|
||||
* Makefile.in, configure.in, aclocal.h, fficonfig.h.in: Rebuilt.
|
||||
|
||||
Thu May 1 16:27:07 1997 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* missing: Added file required by new automake.
|
||||
|
||||
Tue Nov 26 14:10:42 1996 Anthony Green <green@csk3.cygnus.com>
|
||||
|
||||
* acconfig.h: Added USING_PURIFY flag. This is defined when
|
||||
--enable-purify-safety was used at configure time.
|
||||
|
||||
* configure.in (allsources): Added --enable-purify-safety switch.
|
||||
(VERSION): Boosted rev to 1.13.
|
||||
* configure: Rebuilt.
|
||||
|
||||
Fri Nov 22 06:46:12 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* configure.in (VERSION): Boosted rev to 1.12.
|
||||
Removed special CFLAGS hack for gcc.
|
||||
* configure: Rebuilt.
|
||||
|
||||
* README: Boosted rev to 1.12. Added notes.
|
||||
|
||||
* Many files: Cygnus Support changed to Cygnus Solutions.
|
||||
|
||||
Wed Oct 30 11:15:25 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* configure.in (VERSION): Boosted rev to 1.11.
|
||||
* configure: Rebuilt.
|
||||
|
||||
* README: Boosted rev to 1.11. Added notes about GNU make.
|
||||
|
||||
Tue Oct 29 12:25:12 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* configure.in: Fixed -Wall trick.
|
||||
(VERSION): Boosted rev.
|
||||
* configure: Rebuilt
|
||||
|
||||
* acconfig.h: Needed for --enable-debug configure switch.
|
||||
|
||||
* README: Boosted rev to 1.09. Added more notes on building
|
||||
libffi, and LCLint.
|
||||
|
||||
* configure.in: Added --enable-debug switch. Boosted rev to
|
||||
1.09.
|
||||
* configure: Rebuilt
|
||||
|
||||
Tue Oct 15 13:11:28 1996 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* configure.in (VERSION): Boosted rev to 1.08
|
||||
* configure: Rebuilt.
|
||||
|
||||
* README: Added n32 bug fix notes.
|
||||
|
||||
* Makefile.am: Added "make lint" production.
|
||||
* Makefile.in: Rebuilt.
|
||||
|
||||
Mon Oct 14 10:54:46 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* README: Added web page reference.
|
||||
|
||||
* configure.in, README: Boosted rev to 1.05
|
||||
* configure: Rebuilt.
|
||||
|
||||
* README: Fixed n32 sample code.
|
||||
|
||||
Fri Oct 11 17:09:28 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* README: Added sparc notes.
|
||||
|
||||
* configure.in, README: Boosted rev to 1.04.
|
||||
* configure: Rebuilt.
|
||||
|
||||
Thu Oct 10 10:31:03 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* configure.in, README: Boosted rev to 1.03.
|
||||
* configure: Rebuilt.
|
||||
|
||||
* README: Added struct notes.
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Added LICENSE to distribution.
|
||||
* Makefile.in: Rebuilt.
|
||||
|
||||
* README: Removed Linux section. No special notes now
|
||||
because aggregates arg/return types work.
|
||||
|
||||
Wed Oct 9 16:16:42 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* README, configure.in (VERSION): Boosted rev to 1.02
|
||||
* configure: Rebuilt.
|
||||
|
||||
Tue Oct 8 11:56:33 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* README (NOTE): Added n32 notes.
|
||||
|
||||
* Makefile.am: Added test production.
|
||||
* Makefile: Rebuilt
|
||||
|
||||
* README: spell checked!
|
||||
|
||||
* configure.in (VERSION): Boosted rev to 1.01
|
||||
* configure: Rebuilt.
|
||||
|
||||
Mon Oct 7 15:50:22 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* configure.in: Added nasty bit to support SGI tools.
|
||||
* configure: Rebuilt.
|
||||
|
||||
* README: Added SGI notes. Added note about automake bug.
|
||||
|
||||
Mon Oct 7 11:00:28 1996 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* README: Rewrote intro, and fixed examples.
|
||||
|
||||
Fri Oct 4 10:19:55 1996 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* configure.in: -D$TARGET is no longer used as a compiler switch.
|
||||
It is now inserted into ffi.h at configure time.
|
||||
* configure: Rebuilt.
|
||||
|
||||
* FFI_ABI and FFI_STATUS are now ffi_abi and ffi_status.
|
||||
|
||||
Thu Oct 3 13:47:34 1996 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* README, LICENSE: Created. Wrote some docs.
|
||||
|
||||
* configure.in: Don't barf on i586-unknown-linuxaout.
|
||||
Added EXTRADIST code for "make dist".
|
||||
* configure: Rebuilt.
|
||||
|
||||
* */Makefile.in: Rebuilt with patched automake.
|
||||
|
||||
Tue Oct 1 17:12:25 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* Makefile.am, aclocal.m4, config.guess, config.sub,
|
||||
configure.in, fficonfig.h.in, install-sh, mkinstalldirs,
|
||||
stamp-h.in: Created
|
||||
* Makefile.in, configure: Generated
|
||||
|
||||
--- libffi/include --------------------------------------------------------
|
||||
|
||||
Tue Feb 24 13:09:36 1998 Anthony Green <green@gerbil.cygnus.com>
|
||||
|
||||
* ffi_mips.h: Updated FFI_TYPE_STRUCT_* values based on
|
||||
ffi.h.in changes. This is a work-around for SGI's "simple"
|
||||
assembler.
|
||||
|
||||
Sun Feb 22 00:51:55 1998 Geoff Keating <geoffk@ozemail.com.au>
|
||||
|
||||
* ffi.h.in: PowerPC support.
|
||||
|
||||
1998-02-14 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* ffi.h.in: Add m68k support.
|
||||
(FFI_TYPE_LONGDOUBLE): Make it a separate value.
|
||||
|
||||
Tue Feb 10 20:55:16 1998 Richard Henderson <rth@cygnus.com>
|
||||
|
||||
* ffi.h.in (SIZEOF_ARG): Use a pointer type by default.
|
||||
|
||||
* ffi.h.in: Alpha support.
|
||||
|
||||
Fri Nov 22 06:48:45 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* ffi.h.in, ffi_common.h: Cygnus Support -> Cygnus Solutions.
|
||||
|
||||
Wed Nov 20 22:31:01 1996 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* ffi.h.in: Added ffi_type_void definition.
|
||||
|
||||
Tue Oct 29 12:22:40 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* Makefile.am (hack_DATA): Always install ffi_mips.h.
|
||||
|
||||
* ffi.h.in: Removed FFI_DEBUG. It's now in the correct
|
||||
place (acconfig.h).
|
||||
Added #include <stddef.h> for size_t definition.
|
||||
|
||||
Tue Oct 15 17:23:35 1996 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* ffi.h.in, ffi_common.h, ffi_mips.h: More clean up.
|
||||
Commented out #define of FFI_DEBUG.
|
||||
|
||||
Tue Oct 15 13:01:06 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* ffi_common.h: Added bool definition.
|
||||
|
||||
* ffi.h.in, ffi_common.h: Clean up based on LCLint output.
|
||||
Added funny /*@...@*/ comments to annotate source.
|
||||
|
||||
Mon Oct 14 12:29:23 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* ffi.h.in: Interface changes based on feedback from Jim
|
||||
Blandy.
|
||||
|
||||
Fri Oct 11 16:49:35 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* ffi.h.in: Small change for sparc support.
|
||||
|
||||
Thu Oct 10 14:53:37 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* ffi_mips.h: Added FFI_TYPE_STRUCT_* definitions for
|
||||
special structure return types.
|
||||
|
||||
Wed Oct 9 13:55:57 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* ffi.h.in: Added SIZEOF_ARG definition for X86
|
||||
|
||||
Tue Oct 8 11:40:36 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* ffi.h.in (FFI_FN): Added macro for eliminating compiler warnings.
|
||||
Use it to case your function pointers to the proper type.
|
||||
|
||||
* ffi_mips.h (SIZEOF_ARG): Added magic to fix type promotion bug.
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Added ffi_mips.h to EXTRA_DIST.
|
||||
* Makefile: Rebuilt.
|
||||
|
||||
* ffi_mips.h: Created. Moved all common mips definitions here.
|
||||
|
||||
Mon Oct 7 10:58:12 1996 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* ffi.h.in: The SGI assember is very picky about parens. Redefined
|
||||
some macros to avoid problems.
|
||||
|
||||
* ffi.h.in: Added FFI_DEFAULT_ABI definitions. Also added
|
||||
externs for pointer, and 64bit integral ffi_types.
|
||||
|
||||
Fri Oct 4 09:51:37 1996 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* ffi.h.in: Added FFI_ABI member to ffi_cif and changed
|
||||
function prototypes accordingly.
|
||||
Added #define @TARGET@. Now programs including ffi.h don't
|
||||
have to specify this themselves.
|
||||
|
||||
Thu Oct 3 15:36:44 1996 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* ffi.h.in: Changed ffi_prep_cif's values from void* to void**
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Added EXTRA_DIST for "make dist"
|
||||
to work.
|
||||
* Makefile.in: Regenerated.
|
||||
|
||||
Wed Oct 2 10:16:59 1996 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* Makefile.am: Created
|
||||
* Makefile.in: Generated
|
||||
|
||||
* ffi_common.h: Added rcsid comment
|
||||
|
||||
Tue Oct 1 17:13:51 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* ffi.h.in, ffi_common.h: Created
|
||||
|
||||
--- libffi/src ------------------------------------------------------------
|
||||
|
||||
Mon Oct 5 02:17:50 1998 Anthony Green <green@cygnus.com>
|
||||
|
||||
* arm/ffi.c, arm/sysv.S: Created.
|
||||
|
||||
* Makefile.am: Added arm files.
|
||||
* Makefile.in: Rebuilt.
|
||||
|
||||
Mon Oct 5 01:41:38 1998 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* Makefile.am (libffi_la_LDFLAGS): Incremented revision.
|
||||
|
||||
Sun Oct 4 16:27:17 1998 Anthony Green <green@cygnus.com>
|
||||
|
||||
* alpha/osf.S (ffi_call_osf): Patch for DU assembler.
|
||||
|
||||
* ffitest.c (main): long long and long double return values work
|
||||
for x86.
|
||||
|
||||
Fri Apr 17 11:50:58 1998 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* Makefile.in: Rebuilt.
|
||||
|
||||
* ffitest.c (main): Floating point tests not executed for systems
|
||||
with broken lond double (SunOS 4 w/ GCC).
|
||||
|
||||
* types.c: Fixed x86 alignment info for long long types.
|
||||
|
||||
Thu Apr 16 07:15:28 1998 Anthony Green <green@ada.cygnus.com>
|
||||
|
||||
* ffitest.c: Added more notes about GCC bugs under Irix 6.
|
||||
|
||||
Wed Apr 15 08:42:22 1998 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* ffitest.c (struct5): New test function.
|
||||
(main): New test with struct5.
|
||||
|
||||
Thu Mar 5 10:48:11 1998 Anthony Green <green@tootie.to.cygnus.com>
|
||||
|
||||
* prep_cif.c (initialize_aggregate): Fix assertion for
|
||||
nested structures.
|
||||
|
||||
Tue Feb 24 16:33:41 1998 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* prep_cif.c (ffi_prep_cif): Added long double support for sparc.
|
||||
|
||||
Sun Feb 22 00:52:18 1998 Geoff Keating <geoffk@ozemail.com.au>
|
||||
|
||||
* powerpc/asm.h: New file.
|
||||
* powerpc/ffi.c: New file.
|
||||
* powerpc/sysv.S: New file.
|
||||
* Makefile.am: PowerPC port.
|
||||
* ffitest.c (main): Allow all tests to run even in presence of gcc
|
||||
bug on PowerPC.
|
||||
|
||||
1998-02-17 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* mips/ffi.c: Fixed comment typo.
|
||||
|
||||
* x86/ffi.c (ffi_prep_cif_machdep), x86/sysv.S (retfloat):
|
||||
Fixed x86 long double return handling.
|
||||
|
||||
* types.c: Fixed x86 long double alignment info.
|
||||
|
||||
1998-02-14 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* types.c: Add m68k support.
|
||||
|
||||
* ffitest.c (floating): Add long double parameter.
|
||||
(return_ll, ldblit): New functions to test long long and long
|
||||
double return value.
|
||||
(main): Fix type error in assignment of ts[1-4]_type.elements.
|
||||
Add tests for long long and long double arguments and return
|
||||
values.
|
||||
|
||||
* prep_cif.c (ffi_prep_cif) [M68K]: Don't allocate argument for
|
||||
struct value pointer.
|
||||
|
||||
* m68k/ffi.c, m68k/sysv.S: New files.
|
||||
* Makefile.am: Add bits for m68k port. Add kludge to work around
|
||||
automake deficiency.
|
||||
(test): Don't require "." in $PATH.
|
||||
* Makefile.in: Rebuilt.
|
||||
|
||||
Wed Feb 11 07:36:50 1998 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* Makefile.in: Rebuilt.
|
||||
|
||||
Tue Feb 10 20:56:00 1998 Richard Henderson <rth@cygnus.com>
|
||||
|
||||
* alpha/ffi.c, alpha/osf.S: New files.
|
||||
* Makefile.am: Alpha port.
|
||||
|
||||
Tue Nov 18 14:12:07 1997 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* mips/ffi.c (ffi_prep_cif_machdep): Initialize rstruct_flag
|
||||
for n32.
|
||||
|
||||
Tue Jun 3 17:18:20 1997 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* ffitest.c (main): Added hack to get structure tests working
|
||||
correctly.
|
||||
|
||||
Sat May 10 19:06:42 1997 Tom Tromey <tromey@cygnus.com>
|
||||
|
||||
* Makefile.in: Rebuilt.
|
||||
* Makefile.am (EXTRA_DIST): Explicitly list all distributable
|
||||
files in subdirs.
|
||||
(VERSION, CC): Removed.
|
||||
|
||||
Thu May 8 17:19:01 1997 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* Makefile.am: Many changes for new automake and libtool.
|
||||
* Makefile.in: Rebuilt.
|
||||
|
||||
Fri Nov 22 06:57:56 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* ffitest.c (main): Fixed test case for non mips machines.
|
||||
|
||||
Wed Nov 20 22:31:59 1996 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* types.c: Added ffi_type_void declaration.
|
||||
|
||||
Tue Oct 29 13:07:19 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* ffitest.c (main): Fixed character constants.
|
||||
(main): Emit warning for structure test 3 failure on Sun.
|
||||
|
||||
* Makefile.am (VPATH): Fixed VPATH def'n so automake won't
|
||||
strip it out.
|
||||
Moved distdir hack from libffi to automake.
|
||||
(ffitest): Added missing -c for $(COMPILE) (change in automake).
|
||||
* Makefile.in: Rebuilt.
|
||||
|
||||
Tue Oct 15 13:08:20 1996 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* Makefile.am: Added "make lint" production.
|
||||
* Makefile.in: Rebuilt.
|
||||
|
||||
* prep_cif.c (STACK_ARG_SIZE): Improved STACK_ARG_SIZE macro.
|
||||
Clean up based on LCLint output. Added funny /*@...@*/ comments to
|
||||
annotate source.
|
||||
|
||||
* ffitest.c, debug.c: Cleaned up code.
|
||||
|
||||
Mon Oct 14 12:26:56 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* ffitest.c: Changes based on interface changes.
|
||||
|
||||
* prep_cif.c (ffi_prep_cif): Cleaned up interface based on
|
||||
feedback from Jim Blandy.
|
||||
|
||||
Fri Oct 11 15:53:18 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* ffitest.c: Reordered tests while porting to sparc.
|
||||
Made changes to handle lame structure passing for sparc.
|
||||
Removed calls to fflush().
|
||||
|
||||
* prep_cif.c (ffi_prep_cif): Added special case for sparc
|
||||
aggregate type arguments.
|
||||
|
||||
Thu Oct 10 09:56:51 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* ffitest.c (main): Added structure passing/returning tests.
|
||||
|
||||
* prep_cif.c (ffi_prep_cif): Perform proper initialization
|
||||
of structure return types if needed.
|
||||
(initialize_aggregate): Bug fix
|
||||
|
||||
Wed Oct 9 16:04:20 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* types.c: Added special definitions for x86 (double doesn't
|
||||
need double word alignment).
|
||||
|
||||
* ffitest.c: Added many tests
|
||||
|
||||
Tue Oct 8 09:19:22 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* prep_cif.c (ffi_prep_cif): Fixed assertion.
|
||||
|
||||
* debug.c (ffi_assert): Must return a non void now.
|
||||
|
||||
* Makefile.am: Added test production.
|
||||
* Makefile: Rebuilt.
|
||||
|
||||
* ffitest.c (main): Created.
|
||||
|
||||
* types.c: Created. Stripped common code out of */ffi.c.
|
||||
|
||||
* prep_cif.c: Added missing stdlib.h include.
|
||||
|
||||
* debug.c (ffi_type_test): Used "a" to eliminate compiler
|
||||
warnings in non-debug builds. Included ffi_common.h.
|
||||
|
||||
Mon Oct 7 15:36:42 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* Makefile.am: Added a rule for .s -> .o
|
||||
This is required by the SGI compiler.
|
||||
* Makefile: Rebuilt.
|
||||
|
||||
Fri Oct 4 09:51:08 1996 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* prep_cif.c (initialize_aggregate): Moved abi specification
|
||||
to ffi_prep_cif().
|
||||
|
||||
Thu Oct 3 15:37:37 1996 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* prep_cif.c (ffi_prep_cif): Changed values from void* to void**.
|
||||
(initialize_aggregate): Fixed aggregate type initialization.
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Added support code for "make dist".
|
||||
* Makefile.in: Regenerated.
|
||||
|
||||
Wed Oct 2 11:41:57 1996 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* debug.c, prep_cif: Created.
|
||||
|
||||
* Makefile.am: Added debug.o and prep_cif.o to OBJ.
|
||||
* Makefile.in: Regenerated.
|
||||
|
||||
* Makefile.am (INCLUDES): Added missing -I../include
|
||||
* Makefile.in: Regenerated.
|
||||
|
||||
Tue Oct 1 17:11:51 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* error.c, Makefile.am: Created.
|
||||
* Makefile.in: Generated.
|
||||
|
||||
--- libffi/src/x86 --------------------------------------------------------
|
||||
|
||||
Sun Oct 4 16:27:17 1998 Anthony Green <green@cygnus.com>
|
||||
|
||||
* sysv.S (retlongdouble): Fixed long long return value support.
|
||||
* ffi.c (ffi_prep_cif_machdep): Ditto.
|
||||
|
||||
Wed May 13 04:30:33 1998 Anthony Green <green@raft.ppp.tsoft.net>
|
||||
|
||||
* ffi.c (ffi_prep_cif_machdep): Fixed long double return value
|
||||
support.
|
||||
|
||||
Wed Apr 15 08:43:20 1998 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* ffi.c (ffi_prep_args): small struct support was missing.
|
||||
|
||||
Thu May 8 16:53:58 1997 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* objects.mak: Removed.
|
||||
|
||||
Mon Dec 2 15:12:58 1996 Tom Tromey <tromey@cygnus.com>
|
||||
|
||||
* sysv.S: Use .balign, for a.out Linux boxes.
|
||||
|
||||
Tue Oct 15 13:06:50 1996 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* ffi.c: Clean up based on LCLint output.
|
||||
Added funny /*@...@*/ comments to annotate source.
|
||||
|
||||
Fri Oct 11 16:43:38 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* ffi.c (ffi_call): Added assertion for bad ABIs.
|
||||
|
||||
Wed Oct 9 13:57:27 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* sysv.S (retdouble): Fixed double return problems.
|
||||
|
||||
* ffi.c (ffi_call): Corrected fn arg definition.
|
||||
(ffi_prep_cif_machdep): Fixed double return problems
|
||||
|
||||
Tue Oct 8 12:12:49 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* ffi.c: Moved ffi_type definitions to types.c.
|
||||
(ffi_prep_args): Fixed type promotion bug.
|
||||
|
||||
Mon Oct 7 15:53:06 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* ffi.c (FFI_*_TYPEDEF): Removed redundant ';'
|
||||
|
||||
Fri Oct 4 09:54:53 1996 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* ffi.c (ffi_call): Removed FFI_ABI arg, and swapped
|
||||
remaining args.
|
||||
|
||||
Wed Oct 2 10:07:05 1996 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* ffi.c, sysv.S, objects.mak: Created.
|
||||
(ffi_prep_cif): cif->rvalue no longer initialized to NULL.
|
||||
(ffi_prep_cif_machdep): Moved machine independent cif processing
|
||||
to src/prep_cif.c. Introduced ffi_prep_cif_machdep().
|
||||
|
||||
--- libffi/src/mips -------------------------------------------------------
|
||||
|
||||
Tue Feb 17 17:18:07 1998 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* o32.S: Fixed typo in comment.
|
||||
|
||||
* ffi.c (ffi_prep_cif_machdep): Fixed argument processing.
|
||||
|
||||
Thu May 8 16:53:58 1997 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* o32.s, n32.s: Wrappers for SGI tool support.
|
||||
|
||||
* objects.mak: Removed.
|
||||
|
||||
Tue Oct 29 14:37:45 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* ffi.c (ffi_prep_args): Changed int z to size_t z.
|
||||
|
||||
Tue Oct 15 13:17:25 1996 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* n32.S: Fixed bad stack munging.
|
||||
|
||||
* ffi.c: Moved prototypes for ffi_call_?32() to here from
|
||||
ffi_mips.h because extended_cif is not defined in ffi_mips.h.
|
||||
|
||||
Mon Oct 14 12:42:02 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* ffi.c: Interface changes based on feedback from Jim Blandy.
|
||||
|
||||
Thu Oct 10 11:22:16 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* n32.S, ffi.c: Lots of changes to support passing and
|
||||
returning structures with the n32 calling convention.
|
||||
|
||||
* n32.S: Fixed fn pointer bug.
|
||||
|
||||
* ffi.c (ffi_prep_cif_machdep): Fix for o32 structure
|
||||
return values.
|
||||
(ffi_prep_args): Fixed n32 structure passing when structures
|
||||
partially fit in registers.
|
||||
|
||||
Wed Oct 9 13:49:25 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* objects.mak: Added n32.o.
|
||||
|
||||
* n32.S: Created.
|
||||
|
||||
* ffi.c (ffi_prep_args): Added magic to support proper
|
||||
n32 processing.
|
||||
|
||||
Tue Oct 8 10:37:35 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* ffi.c: Moved ffi_type definitions to types.c.
|
||||
(ffi_prep_args): Fixed type promotion bug.
|
||||
|
||||
* o32.S: This code is only built for o32 compiles.
|
||||
A lot of the #define cruft has moved to ffi_mips.h.
|
||||
|
||||
* ffi.c (ffi_prep_cif_machdep): Fixed arg flags. Second arg
|
||||
is only processed if the first is either a float or double.
|
||||
|
||||
Mon Oct 7 15:33:59 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* o32.S: Modified to compile under each of o32, n32 and n64.
|
||||
|
||||
* ffi.c (FFI_*_TYPEDEF): Removed redundant ';'
|
||||
|
||||
Fri Oct 4 09:53:25 1996 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* ffi.c (ffi_call): Removed FFI_ABI arg, and swapped
|
||||
remaining args.
|
||||
|
||||
Wed Oct 2 17:41:22 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* o32.S: Removed crufty definitions.
|
||||
|
||||
Wed Oct 2 12:53:42 1996 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* ffi.c (ffi_prep_cif): cif->rvalue no longer initialized to NULL.
|
||||
(ffi_prep_cif_machdep): Moved all machine independent cif processing
|
||||
to src/prep_cif.c. Introduced ffi_prep_cif_machdep. Return types
|
||||
of FFI_TYPE_STRUCT are no different than FFI_TYPE_INT.
|
||||
|
||||
Tue Oct 1 17:11:02 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* ffi.c, o32.S, object.mak: Created
|
||||
|
||||
--- libffi/src/sparc ------------------------------------------------------
|
||||
|
||||
Tue Feb 24 16:33:18 1998 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* ffi.c (ffi_prep_args): Added long double support.
|
||||
|
||||
Thu May 8 16:53:58 1997 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* objects.mak: Removed.
|
||||
|
||||
Thu May 1 16:07:56 1997 Anthony Green <green@hoser.cygnus.com>
|
||||
|
||||
* v8.S: Fixed minor portability problem reported by
|
||||
Russ McManus <mcmanr@eq.gs.com>.
|
||||
|
||||
Tue Nov 26 14:12:43 1996 Anthony Green <green@csk3.cygnus.com>
|
||||
|
||||
* v8.S: Used STACKFRAME define elsewhere.
|
||||
|
||||
* ffi.c (ffi_prep_args): Zero out space when USING_PURIFY
|
||||
is set.
|
||||
(ffi_prep_cif_machdep): Allocate the correct stack frame
|
||||
space for functions with < 6 args.
|
||||
|
||||
Tue Oct 29 15:08:55 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* ffi.c (ffi_prep_args): int z is now size_t z.
|
||||
|
||||
Mon Oct 14 13:31:24 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* v8.S (ffi_call_V8): Gordon rewrites this again. It looks
|
||||
great now.
|
||||
|
||||
* ffi.c (ffi_call): The comment about hijacked registers
|
||||
is no longer valid after gordoni hacked v8.S.
|
||||
|
||||
* v8.S (ffi_call_V8): Rewrote with gordoni. Much simpler.
|
||||
|
||||
* v8.S, ffi.c: ffi_call() had changed to accept more than
|
||||
two args, so v8.S had to change (because it hijacks incoming
|
||||
arg registers).
|
||||
|
||||
* ffi.c: Interface changes based on feedback from Jim Blandy.
|
||||
|
||||
Thu Oct 10 17:48:16 1996 Anthony Green <green@rtl.cygnus.com>
|
||||
|
||||
* ffi.c, v8.S, objects.mak: Created.
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
libffi - Copyright (c) 1996-2008 Red Hat, Inc and others.
|
||||
See source files for details.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
``Software''), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,180 @@
|
||||
## Process this with automake to create Makefile.in
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign subdir-objects
|
||||
|
||||
SUBDIRS = include testsuite man
|
||||
|
||||
EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \
|
||||
src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \
|
||||
src/arm/ffi.c src/arm/sysv.S src/arm/ffitarget.h \
|
||||
src/cris/ffi.c src/cris/sysv.S src/cris/ffitarget.h \
|
||||
src/ia64/ffi.c src/ia64/ffitarget.h src/ia64/ia64_flags.h \
|
||||
src/ia64/unix.S \
|
||||
src/mips/ffi.c src/mips/n32.S src/mips/o32.S \
|
||||
src/mips/ffitarget.h \
|
||||
src/m32r/ffi.c src/m32r/sysv.S src/m32r/ffitarget.h \
|
||||
src/m68k/ffi.c src/m68k/sysv.S src/m68k/ffitarget.h \
|
||||
src/powerpc/ffi.c src/powerpc/sysv.S \
|
||||
src/powerpc/linux64.S src/powerpc/linux64_closure.S \
|
||||
src/powerpc/ppc_closure.S src/powerpc/asm.h \
|
||||
src/powerpc/aix.S src/powerpc/darwin.S \
|
||||
src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \
|
||||
src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \
|
||||
src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \
|
||||
src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h \
|
||||
src/sh64/ffi.c src/sh64/sysv.S src/sh64/ffitarget.h \
|
||||
src/sparc/v8.S src/sparc/v9.S src/sparc/ffitarget.h \
|
||||
src/sparc/ffi.c src/x86/darwin64.S \
|
||||
src/x86/ffi.c src/x86/sysv.S src/x86/win32.S src/x86/win64.S \
|
||||
src/x86/darwin.S src/x86/freebsd.S \
|
||||
src/x86/ffi64.c src/x86/unix64.S src/x86/ffitarget.h \
|
||||
src/pa/ffitarget.h src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S \
|
||||
src/frv/ffi.c src/frv/eabi.S src/frv/ffitarget.h src/dlmalloc.c \
|
||||
libtool-version ChangeLog.libffi
|
||||
|
||||
info_TEXINFOS = doc/libffi.texi
|
||||
|
||||
## ################################################################
|
||||
|
||||
##
|
||||
## This section is for make and multilib madness.
|
||||
##
|
||||
|
||||
# Work around what appears to be a GNU make bug handling MAKEFLAGS
|
||||
# values defined in terms of make variables, as is the case for CC and
|
||||
# friends when we are called from the top level Makefile.
|
||||
AM_MAKEFLAGS = \
|
||||
"AR_FLAGS=$(AR_FLAGS)" \
|
||||
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
|
||||
"CFLAGS=$(CFLAGS)" \
|
||||
"CXXFLAGS=$(CXXFLAGS)" \
|
||||
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
|
||||
"CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
|
||||
"INSTALL=$(INSTALL)" \
|
||||
"INSTALL_DATA=$(INSTALL_DATA)" \
|
||||
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
|
||||
"INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
|
||||
"JC1FLAGS=$(JC1FLAGS)" \
|
||||
"LDFLAGS=$(LDFLAGS)" \
|
||||
"LIBCFLAGS=$(LIBCFLAGS)" \
|
||||
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
|
||||
"MAKE=$(MAKE)" \
|
||||
"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
|
||||
"PICFLAG=$(PICFLAG)" \
|
||||
"PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
|
||||
"RUNTESTFLAGS=$(RUNTESTFLAGS)" \
|
||||
"SHELL=$(SHELL)" \
|
||||
"exec_prefix=$(exec_prefix)" \
|
||||
"infodir=$(infodir)" \
|
||||
"libdir=$(libdir)" \
|
||||
"prefix=$(prefix)" \
|
||||
"AR=$(AR)" \
|
||||
"AS=$(AS)" \
|
||||
"CC=$(CC)" \
|
||||
"CXX=$(CXX)" \
|
||||
"LD=$(LD)" \
|
||||
"NM=$(NM)" \
|
||||
"RANLIB=$(RANLIB)" \
|
||||
"DESTDIR=$(DESTDIR)"
|
||||
|
||||
MAKEOVERRIDES=
|
||||
|
||||
lib_LTLIBRARIES = libffi.la
|
||||
noinst_LTLIBRARIES = libffi_convenience.la
|
||||
|
||||
libffi_la_SOURCES = src/debug.c src/prep_cif.c src/types.c \
|
||||
src/raw_api.c src/java_raw_api.c src/closures.c
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libffi.pc
|
||||
|
||||
nodist_libffi_la_SOURCES =
|
||||
|
||||
if MIPS
|
||||
nodist_libffi_la_SOURCES += src/mips/ffi.c src/mips/o32.S src/mips/n32.S
|
||||
endif
|
||||
if X86
|
||||
nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/sysv.S
|
||||
endif
|
||||
if X86_FREEBSD
|
||||
nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/freebsd.S
|
||||
endif
|
||||
if X86_WIN32
|
||||
nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/win32.S
|
||||
endif
|
||||
if X86_WIN64
|
||||
nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/win64.S
|
||||
endif
|
||||
if X86_DARWIN
|
||||
nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/darwin.S src/x86/ffi64.c src/x86/darwin64.S
|
||||
endif
|
||||
if SPARC
|
||||
nodist_libffi_la_SOURCES += src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S
|
||||
endif
|
||||
if ALPHA
|
||||
nodist_libffi_la_SOURCES += src/alpha/ffi.c src/alpha/osf.S
|
||||
endif
|
||||
if IA64
|
||||
nodist_libffi_la_SOURCES += src/ia64/ffi.c src/ia64/unix.S
|
||||
endif
|
||||
if M32R
|
||||
nodist_libffi_la_SOURCES += src/m32r/sysv.S src/m32r/ffi.c
|
||||
endif
|
||||
if M68K
|
||||
nodist_libffi_la_SOURCES += src/m68k/ffi.c src/m68k/sysv.S
|
||||
endif
|
||||
if POWERPC
|
||||
nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S
|
||||
endif
|
||||
if POWERPC_AIX
|
||||
nodist_libffi_la_SOURCES += src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S
|
||||
endif
|
||||
if POWERPC_DARWIN
|
||||
nodist_libffi_la_SOURCES += src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S
|
||||
endif
|
||||
if POWERPC_FREEBSD
|
||||
nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S
|
||||
endif
|
||||
if ARM
|
||||
nodist_libffi_la_SOURCES += src/arm/sysv.S src/arm/ffi.c
|
||||
endif
|
||||
if LIBFFI_CRIS
|
||||
nodist_libffi_la_SOURCES += src/cris/sysv.S src/cris/ffi.c
|
||||
endif
|
||||
if FRV
|
||||
nodist_libffi_la_SOURCES += src/frv/eabi.S src/frv/ffi.c
|
||||
endif
|
||||
if S390
|
||||
nodist_libffi_la_SOURCES += src/s390/sysv.S src/s390/ffi.c
|
||||
endif
|
||||
if X86_64
|
||||
nodist_libffi_la_SOURCES += src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S
|
||||
endif
|
||||
if SH
|
||||
nodist_libffi_la_SOURCES += src/sh/sysv.S src/sh/ffi.c
|
||||
endif
|
||||
if SH64
|
||||
nodist_libffi_la_SOURCES += src/sh64/sysv.S src/sh64/ffi.c
|
||||
endif
|
||||
if PA_LINUX
|
||||
nodist_libffi_la_SOURCES += src/pa/linux.S src/pa/ffi.c
|
||||
endif
|
||||
if PA_HPUX
|
||||
nodist_libffi_la_SOURCES += src/pa/hpux32.S src/pa/ffi.c
|
||||
endif
|
||||
|
||||
libffi_convenience_la_SOURCES = $(libffi_la_SOURCES)
|
||||
nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES)
|
||||
|
||||
AM_CFLAGS = -Wall -g -fexceptions
|
||||
|
||||
libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version`
|
||||
|
||||
AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
|
||||
AM_CCASFLAGS = $(AM_CPPFLAGS)
|
||||
|
||||
# No install-html or install-pdf support in automake yet
|
||||
.PHONY: install-html install-pdf
|
||||
install-html:
|
||||
install-pdf:
|
||||
|
||||
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -0,0 +1,337 @@
|
||||
Status
|
||||
======
|
||||
|
||||
libffi-3.0.8 was released on December 19, 2008. Check the libffi web
|
||||
page for updates: <URL:http://sourceware.org/libffi/>.
|
||||
|
||||
|
||||
What is libffi?
|
||||
===============
|
||||
|
||||
Compilers for high level languages generate code that follow certain
|
||||
conventions. These conventions are necessary, in part, for separate
|
||||
compilation to work. One such convention is the "calling convention".
|
||||
The "calling convention" is a set of assumptions made by the compiler
|
||||
about where function arguments will be found on entry to a function.
|
||||
A "calling convention" also specifies where the return value for a
|
||||
function is found.
|
||||
|
||||
Some programs may not know at the time of compilation what arguments
|
||||
are to be passed to a function. For instance, an interpreter may be
|
||||
told at run-time about the number and types of arguments used to call
|
||||
a given function. Libffi can be used in such programs to provide a
|
||||
bridge from the interpreter program to compiled code.
|
||||
|
||||
The libffi library provides a portable, high level programming
|
||||
interface to various calling conventions. This allows a programmer to
|
||||
call any function specified by a call interface description at run
|
||||
time.
|
||||
|
||||
FFI stands for Foreign Function Interface. A foreign function
|
||||
interface is the popular name for the interface that allows code
|
||||
written in one language to call code written in another language. The
|
||||
libffi library really only provides the lowest, machine dependent
|
||||
layer of a fully featured foreign function interface. A layer must
|
||||
exist above libffi that handles type conversions for values passed
|
||||
between the two languages.
|
||||
|
||||
|
||||
Supported Platforms
|
||||
===================
|
||||
|
||||
Libffi has been ported to many different platforms, although this
|
||||
release was only tested on:
|
||||
|
||||
arm oabi linux
|
||||
arm eabi linux
|
||||
hppa linux
|
||||
mips o32 linux (little endian)
|
||||
powerpc darwin
|
||||
powerpc freebsd
|
||||
powerpc64 linux
|
||||
sparc solaris
|
||||
sparc64 freebsd
|
||||
sparc64 solaris
|
||||
x86 cygwin
|
||||
x86 darwin
|
||||
x86 freebsd
|
||||
x86 linux
|
||||
x86 openbsd
|
||||
x86 solaris
|
||||
x86-64 mingw
|
||||
x86-64 darwin
|
||||
x86-64 linux
|
||||
x86-64 OS X
|
||||
x86-64 freebsd
|
||||
x86-64 solaris
|
||||
|
||||
Please send additional platform test results to
|
||||
libffi-discuss@sourceware.org.
|
||||
|
||||
Installing libffi
|
||||
=================
|
||||
|
||||
[Note: before actually performing any of these installation steps,
|
||||
you may wish to read the "Platform Specific Notes" below.]
|
||||
|
||||
First you must configure the distribution for your particular
|
||||
system. Go to the directory you wish to build libffi in and run the
|
||||
"configure" program found in the root directory of the libffi source
|
||||
distribution.
|
||||
|
||||
You may want to tell configure where to install the libffi library and
|
||||
header files. To do that, use the --prefix configure switch. Libffi
|
||||
will install under /usr/local by default.
|
||||
|
||||
If you want to enable extra run-time debugging checks use the the
|
||||
--enable-debug configure switch. This is useful when your program dies
|
||||
mysteriously while using libffi.
|
||||
|
||||
Another useful configure switch is --enable-purify-safety. Using this
|
||||
will add some extra code which will suppress certain warnings when you
|
||||
are using Purify with libffi. Only use this switch when using
|
||||
Purify, as it will slow down the library.
|
||||
|
||||
Configure has many other options. Use "configure --help" to see them all.
|
||||
|
||||
Once configure has finished, type "make". Note that you must be using
|
||||
GNU make. You can ftp GNU make from prep.ai.mit.edu:/pub/gnu.
|
||||
|
||||
To ensure that libffi is working as advertised, type "make check".
|
||||
This will require that you have DejaGNU installed.
|
||||
|
||||
To install the library and header files, type "make install".
|
||||
|
||||
|
||||
Platform Specific Notes
|
||||
=======================
|
||||
|
||||
MIPS - Irix 5.3 & 6.x
|
||||
---------------------
|
||||
|
||||
Irix 6.2 and better supports three different calling conventions: o32,
|
||||
n32 and n64. Currently, libffi only supports both o32 and n32 under
|
||||
Irix 6.x, but only o32 under Irix 5.3. Libffi will automatically be
|
||||
configured for whichever calling convention it was built for.
|
||||
|
||||
By default, the configure script will try to build libffi with the GNU
|
||||
development tools. To build libffi with the SGI development tools, set
|
||||
the environment variable CC to either "cc -32" or "cc -n32" before
|
||||
running configure under Irix 6.x (depending on whether you want an o32
|
||||
or n32 library), or just "cc" for Irix 5.3.
|
||||
|
||||
With the n32 calling convention, when returning structures smaller
|
||||
than 16 bytes, be sure to provide an RVALUE that is 8 byte aligned.
|
||||
Here's one way of forcing this:
|
||||
|
||||
double struct_storage[2];
|
||||
my_small_struct *s = (my_small_struct *) struct_storage;
|
||||
/* Use s for RVALUE */
|
||||
|
||||
If you don't do this you are liable to get spurious bus errors.
|
||||
|
||||
"long long" values are not supported yet.
|
||||
|
||||
You must use GNU Make to build libffi on SGI platforms.
|
||||
|
||||
|
||||
PowerPC System V ABI
|
||||
--------------------
|
||||
|
||||
There are two `System V ABI's which libffi implements for PowerPC.
|
||||
They differ only in how small structures are returned from functions.
|
||||
|
||||
In the FFI_SYSV version, structures that are 8 bytes or smaller are
|
||||
returned in registers. This is what GCC does when it is configured
|
||||
for solaris, and is what the System V ABI I have (dated September
|
||||
1995) says.
|
||||
|
||||
In the FFI_GCC_SYSV version, all structures are returned the same way:
|
||||
by passing a pointer as the first argument to the function. This is
|
||||
what GCC does when it is configured for linux or a generic sysv
|
||||
target.
|
||||
|
||||
EGCS 1.0.1 (and probably other versions of EGCS/GCC) also has a
|
||||
inconsistency with the SysV ABI: When a procedure is called with many
|
||||
floating-point arguments, some of them get put on the stack. They are
|
||||
all supposed to be stored in double-precision format, even if they are
|
||||
only single-precision, but EGCS stores single-precision arguments as
|
||||
single-precision anyway. This causes one test to fail (the `many
|
||||
arguments' test).
|
||||
|
||||
|
||||
History
|
||||
=======
|
||||
|
||||
3.0.7 Nov-11-08
|
||||
Fix for ppc FreeBSD.
|
||||
(thanks to Andreas Tobler)
|
||||
|
||||
3.0.6 Jul-17-08
|
||||
Fix for closures on sh.
|
||||
Mark the sh/sh64 stack as non-executable.
|
||||
(both thanks to Kaz Kojima)
|
||||
|
||||
3.0.5 Apr-3-08
|
||||
Fix libffi.pc file.
|
||||
Fix #define ARM for IcedTea users.
|
||||
Fix x86 closure bug.
|
||||
|
||||
3.0.4 Feb-24-08
|
||||
Fix x86 OpenBSD configury.
|
||||
|
||||
3.0.3 Feb-22-08
|
||||
Enable x86 OpenBSD thanks to Thomas Heller, and
|
||||
x86-64 FreeBSD thanks to Björn König and Andreas Tobler.
|
||||
Clean up test instruction in README.
|
||||
|
||||
3.0.2 Feb-21-08
|
||||
Improved x86 FreeBSD support.
|
||||
Thanks to Björn König.
|
||||
|
||||
3.0.1 Feb-15-08
|
||||
Fix instruction cache flushing bug on MIPS.
|
||||
Thanks to David Daney.
|
||||
|
||||
3.0.0 Feb-15-08
|
||||
Many changes, mostly thanks to the GCC project.
|
||||
Cygnus Solutions is now Red Hat.
|
||||
|
||||
[10 years go by...]
|
||||
|
||||
1.20 Oct-5-98
|
||||
Raffaele Sena produces ARM port.
|
||||
|
||||
1.19 Oct-5-98
|
||||
Fixed x86 long double and long long return support.
|
||||
m68k bug fixes from Andreas Schwab.
|
||||
Patch for DU assembler compatibility for the Alpha from Richard
|
||||
Henderson.
|
||||
|
||||
1.18 Apr-17-98
|
||||
Bug fixes and MIPS configuration changes.
|
||||
|
||||
1.17 Feb-24-98
|
||||
Bug fixes and m68k port from Andreas Schwab. PowerPC port from
|
||||
Geoffrey Keating. Various bug x86, Sparc and MIPS bug fixes.
|
||||
|
||||
1.16 Feb-11-98
|
||||
Richard Henderson produces Alpha port.
|
||||
|
||||
1.15 Dec-4-97
|
||||
Fixed an n32 ABI bug. New libtool, auto* support.
|
||||
|
||||
1.14 May-13-97
|
||||
libtool is now used to generate shared and static libraries.
|
||||
Fixed a minor portability problem reported by Russ McManus
|
||||
<mcmanr@eq.gs.com>.
|
||||
|
||||
1.13 Dec-2-96
|
||||
Added --enable-purify-safety to keep Purify from complaining
|
||||
about certain low level code.
|
||||
Sparc fix for calling functions with < 6 args.
|
||||
Linux x86 a.out fix.
|
||||
|
||||
1.12 Nov-22-96
|
||||
Added missing ffi_type_void, needed for supporting void return
|
||||
types. Fixed test case for non MIPS machines. Cygnus Support
|
||||
is now Cygnus Solutions.
|
||||
|
||||
1.11 Oct-30-96
|
||||
Added notes about GNU make.
|
||||
|
||||
1.10 Oct-29-96
|
||||
Added configuration fix for non GNU compilers.
|
||||
|
||||
1.09 Oct-29-96
|
||||
Added --enable-debug configure switch. Clean-ups based on LCLint
|
||||
feedback. ffi_mips.h is always installed. Many configuration
|
||||
fixes. Fixed ffitest.c for sparc builds.
|
||||
|
||||
1.08 Oct-15-96
|
||||
Fixed n32 problem. Many clean-ups.
|
||||
|
||||
1.07 Oct-14-96
|
||||
Gordon Irlam rewrites v8.S again. Bug fixes.
|
||||
|
||||
1.06 Oct-14-96
|
||||
Gordon Irlam improved the sparc port.
|
||||
|
||||
1.05 Oct-14-96
|
||||
Interface changes based on feedback.
|
||||
|
||||
1.04 Oct-11-96
|
||||
Sparc port complete (modulo struct passing bug).
|
||||
|
||||
1.03 Oct-10-96
|
||||
Passing struct args, and returning struct values works for
|
||||
all architectures/calling conventions. Expanded tests.
|
||||
|
||||
1.02 Oct-9-96
|
||||
Added SGI n32 support. Fixed bugs in both o32 and Linux support.
|
||||
Added "make test".
|
||||
|
||||
1.01 Oct-8-96
|
||||
Fixed float passing bug in mips version. Restructured some
|
||||
of the code. Builds cleanly with SGI tools.
|
||||
|
||||
1.00 Oct-7-96
|
||||
First release. No public announcement.
|
||||
|
||||
|
||||
Authors & Credits
|
||||
=================
|
||||
|
||||
libffi was originally written by Anthony Green <green@redhat.com>.
|
||||
|
||||
The developers of the GNU Compiler Collection project have made
|
||||
innumerable valuable contributions. See the ChangeLog file for
|
||||
details.
|
||||
|
||||
Some of the ideas behind libffi were inspired by Gianni Mariani's free
|
||||
gencall library for Silicon Graphics machines.
|
||||
|
||||
The closure mechanism was designed and implemented by Kresten Krab
|
||||
Thorup.
|
||||
|
||||
Major processor architecture ports were contributed by the following
|
||||
developers:
|
||||
|
||||
alpha Richard Henderson
|
||||
arm Raffaele Sena
|
||||
cris Simon Posnjak, Hans-Peter Nilsson
|
||||
frv Anthony Green
|
||||
ia64 Hans Boehm
|
||||
m32r Kazuhiro Inaoka
|
||||
m68k Andreas Schwab
|
||||
mips Anthony Green, Casey Marshall
|
||||
mips64 David Daney
|
||||
pa Randolph Chung, Dave Anglin, Andreas Tobler
|
||||
powerpc Geoffrey Keating, Andreas Tobler,
|
||||
David Edelsohn, John Hornkvist
|
||||
powerpc64 Jakub Jelinek
|
||||
s390 Gerhard Tonn, Ulrich Weigand
|
||||
sh Kaz Kojima
|
||||
sh64 Kaz Kojima
|
||||
sparc Anthony Green, Gordon Irlam
|
||||
x86 Anthony Green, Jon Beniston
|
||||
x86-64 Bo Thorsen
|
||||
|
||||
Jesper Skov and Andrew Haley both did more than their fair share of
|
||||
stepping through the code and tracking down bugs.
|
||||
|
||||
Thanks also to Tom Tromey for bug fixes, documentation and
|
||||
configuration help.
|
||||
|
||||
Thanks to Jim Blandy, who provided some useful feedback on the libffi
|
||||
interface.
|
||||
|
||||
Andreas Tobler has done a tremendous amount of work on the testsuite.
|
||||
|
||||
Alex Oliva solved the executable page problem for SElinux.
|
||||
|
||||
The list above is almost certainly incomplete and inaccurate. I'm
|
||||
happy to make corrections or additions upon request.
|
||||
|
||||
If you have a problem, or have found a bug, please send a note to
|
||||
green@redhat.com.
|
||||
Arquivo executável
+3
@@ -0,0 +1,3 @@
|
||||
To run the testsuite on win64, make your mingw compiler available in the path
|
||||
as "gcc". This could probably be avoided via additional dejagnu configuration,
|
||||
but I haven't figured out how.
|
||||
@@ -0,0 +1,92 @@
|
||||
# mmap(2) blacklisting. Some platforms provide the mmap library routine
|
||||
# but don't support all of the features we need from it.
|
||||
AC_DEFUN([AC_FUNC_MMAP_BLACKLIST],
|
||||
[
|
||||
AC_CHECK_HEADER([sys/mman.h],
|
||||
[libffi_header_sys_mman_h=yes], [libffi_header_sys_mman_h=no])
|
||||
AC_CHECK_FUNC([mmap], [libffi_func_mmap=yes], [libffi_func_mmap=no])
|
||||
if test "$libffi_header_sys_mman_h" != yes \
|
||||
|| test "$libffi_func_mmap" != yes; then
|
||||
ac_cv_func_mmap_file=no
|
||||
ac_cv_func_mmap_dev_zero=no
|
||||
ac_cv_func_mmap_anon=no
|
||||
else
|
||||
AC_CACHE_CHECK([whether read-only mmap of a plain file works],
|
||||
ac_cv_func_mmap_file,
|
||||
[# Add a system to this blacklist if
|
||||
# mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a
|
||||
# memory area containing the same data that you'd get if you applied
|
||||
# read() to the same fd. The only system known to have a problem here
|
||||
# is VMS, where text files have record structure.
|
||||
case "$host_os" in
|
||||
vms* | ultrix*)
|
||||
ac_cv_func_mmap_file=no ;;
|
||||
*)
|
||||
ac_cv_func_mmap_file=yes;;
|
||||
esac])
|
||||
AC_CACHE_CHECK([whether mmap from /dev/zero works],
|
||||
ac_cv_func_mmap_dev_zero,
|
||||
[# Add a system to this blacklist if it has mmap() but /dev/zero
|
||||
# does not exist, or if mmapping /dev/zero does not give anonymous
|
||||
# zeroed pages with both the following properties:
|
||||
# 1. If you map N consecutive pages in with one call, and then
|
||||
# unmap any subset of those pages, the pages that were not
|
||||
# explicitly unmapped remain accessible.
|
||||
# 2. If you map two adjacent blocks of memory and then unmap them
|
||||
# both at once, they must both go away.
|
||||
# Systems known to be in this category are Windows (all variants),
|
||||
# VMS, and Darwin.
|
||||
case "$host_os" in
|
||||
vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00)
|
||||
ac_cv_func_mmap_dev_zero=no ;;
|
||||
*)
|
||||
ac_cv_func_mmap_dev_zero=yes;;
|
||||
esac])
|
||||
|
||||
# Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for.
|
||||
AC_CACHE_CHECK([for MAP_ANON(YMOUS)], ac_cv_decl_map_anon,
|
||||
[AC_TRY_COMPILE(
|
||||
[#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef MAP_ANONYMOUS
|
||||
#define MAP_ANONYMOUS MAP_ANON
|
||||
#endif
|
||||
],
|
||||
[int n = MAP_ANONYMOUS;],
|
||||
ac_cv_decl_map_anon=yes,
|
||||
ac_cv_decl_map_anon=no)])
|
||||
|
||||
if test $ac_cv_decl_map_anon = no; then
|
||||
ac_cv_func_mmap_anon=no
|
||||
else
|
||||
AC_CACHE_CHECK([whether mmap with MAP_ANON(YMOUS) works],
|
||||
ac_cv_func_mmap_anon,
|
||||
[# Add a system to this blacklist if it has mmap() and MAP_ANON or
|
||||
# MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
|
||||
# doesn't give anonymous zeroed pages with the same properties listed
|
||||
# above for use of /dev/zero.
|
||||
# Systems known to be in this category are Windows, VMS, and SCO Unix.
|
||||
case "$host_os" in
|
||||
vms* | cygwin* | pe | mingw* | sco* | udk* )
|
||||
ac_cv_func_mmap_anon=no ;;
|
||||
*)
|
||||
ac_cv_func_mmap_anon=yes;;
|
||||
esac])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $ac_cv_func_mmap_file = yes; then
|
||||
AC_DEFINE(HAVE_MMAP_FILE, 1,
|
||||
[Define if read-only mmap of a plain file works.])
|
||||
fi
|
||||
if test $ac_cv_func_mmap_dev_zero = yes; then
|
||||
AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1,
|
||||
[Define if mmap of /dev/zero works.])
|
||||
fi
|
||||
if test $ac_cv_func_mmap_anon = yes; then
|
||||
AC_DEFINE(HAVE_MMAP_ANON, 1,
|
||||
[Define if mmap with MAP_ANON(YMOUS) works.])
|
||||
fi
|
||||
])
|
||||
externo
+7582
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
Arquivo executável
+142
@@ -0,0 +1,142 @@
|
||||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand `-c -o'.
|
||||
|
||||
scriptversion=2005-05-14.22
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand `-c -o'.
|
||||
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file `INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
eat=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as `compile cc -o foo foo.c'.
|
||||
# So we strip `-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no `-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# `.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use `[/.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
||||
@@ -0,0 +1,911 @@
|
||||
# Configure fragment invoked in the post-target section for subdirs
|
||||
# wanting multilib support.
|
||||
#
|
||||
# Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
#
|
||||
# Please report bugs to <gcc-bugs@gnu.org>
|
||||
# and send patches to <gcc-patches@gnu.org>.
|
||||
|
||||
# It is advisable to support a few --enable/--disable options to let the
|
||||
# user select which libraries s/he really wants.
|
||||
#
|
||||
# Subdirectories wishing to use multilib should put the following lines
|
||||
# in the "post-target" section of configure.in.
|
||||
#
|
||||
# if [ "${srcdir}" = "." ] ; then
|
||||
# if [ "${with_target_subdir}" != "." ] ; then
|
||||
# . ${with_multisrctop}../../config-ml.in
|
||||
# else
|
||||
# . ${with_multisrctop}../config-ml.in
|
||||
# fi
|
||||
# else
|
||||
# . ${srcdir}/../config-ml.in
|
||||
# fi
|
||||
#
|
||||
#
|
||||
# Things are complicated because 6 separate cases must be handled:
|
||||
# 2 (native, cross) x 3 (absolute-path, relative-not-dot, dot) = 6.
|
||||
#
|
||||
# srcdir=. is special. It must handle make programs that don't handle VPATH.
|
||||
# To implement this, a symlink tree is built for each library and for each
|
||||
# multilib subdir.
|
||||
#
|
||||
# The build tree is layed out as
|
||||
#
|
||||
# ./
|
||||
# newlib
|
||||
# m68020/
|
||||
# newlib
|
||||
# m68881/
|
||||
# newlib
|
||||
#
|
||||
# The nice feature about this arrangement is that inter-library references
|
||||
# in the build tree work without having to care where you are. Note that
|
||||
# inter-library references also work in the source tree because symlink trees
|
||||
# are built when srcdir=.
|
||||
#
|
||||
# Unfortunately, trying to access the libraries in the build tree requires
|
||||
# the user to manually choose which library to use as GCC won't be able to
|
||||
# find the right one. This is viewed as the lesser of two evils.
|
||||
#
|
||||
# Configure variables:
|
||||
# ${with_target_subdir} = "." for native, or ${target_alias} for cross.
|
||||
# Set by top level Makefile.
|
||||
# ${with_multisrctop} = how many levels of multilibs there are in the source
|
||||
# tree. It exists to handle the case of configuring in the source tree:
|
||||
# ${srcdir} is not constant.
|
||||
# ${with_multisubdir} = name of multilib subdirectory (eg: m68020/m68881).
|
||||
#
|
||||
# Makefile variables:
|
||||
# MULTISRCTOP = number of multilib levels in source tree (+1 if cross)
|
||||
# (FIXME: note that this is different than ${with_multisrctop}. Check out.).
|
||||
# MULTIBUILDTOP = number of multilib levels in build tree
|
||||
# MULTIDIRS = list of multilib subdirs (eg: m68000 m68020 ...)
|
||||
# (only defined in each library's main Makefile).
|
||||
# MULTISUBDIR = installed subdirectory name with leading '/' (eg: /m68000)
|
||||
# (only defined in each multilib subdir).
|
||||
|
||||
# FIXME: Multilib is currently disabled by default for everything other than
|
||||
# newlib. It is up to each target to turn on multilib support for the other
|
||||
# libraries as desired.
|
||||
|
||||
# Autoconf incoming variables:
|
||||
# srcdir, host, ac_configure_args
|
||||
#
|
||||
# We *could* figure srcdir and host out, but we'd have to do work that
|
||||
# our caller has already done to figure them out and requiring these two
|
||||
# seems reasonable.
|
||||
# Note that `host' in this case is GCC's `target'. Target libraries are
|
||||
# configured for a particular host.
|
||||
|
||||
Makefile=${ac_file-Makefile}
|
||||
ml_config_shell=${CONFIG_SHELL-/bin/sh}
|
||||
ml_realsrcdir=${srcdir}
|
||||
|
||||
# Scan all the arguments and set all the ones we need.
|
||||
|
||||
ml_verbose=--verbose
|
||||
for option in ${ac_configure_args}
|
||||
do
|
||||
# strip single quotes surrounding individual options
|
||||
case $option in
|
||||
\'*\') eval option=$option ;;
|
||||
esac
|
||||
|
||||
case $option in
|
||||
--*) ;;
|
||||
-*) option=-$option ;;
|
||||
esac
|
||||
|
||||
case $option in
|
||||
--*=*)
|
||||
optarg=`echo $option | sed -e 's/^[^=]*=//'`
|
||||
;;
|
||||
esac
|
||||
|
||||
case $option in
|
||||
--disable-*)
|
||||
enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
|
||||
eval $enableopt=no
|
||||
;;
|
||||
--enable-*)
|
||||
case "$option" in
|
||||
*=*) ;;
|
||||
*) optarg=yes ;;
|
||||
esac
|
||||
enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
|
||||
eval $enableopt="$optarg"
|
||||
;;
|
||||
--norecursion | --no-recursion)
|
||||
ml_norecursion=yes
|
||||
;;
|
||||
--silent | --sil* | --quiet | --q*)
|
||||
ml_verbose=--silent
|
||||
;;
|
||||
--verbose | --v | --verb*)
|
||||
ml_verbose=--verbose
|
||||
;;
|
||||
--with-*)
|
||||
case "$option" in
|
||||
*=*) ;;
|
||||
*) optarg=yes ;;
|
||||
esac
|
||||
withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
|
||||
eval $withopt="$optarg"
|
||||
;;
|
||||
--without-*)
|
||||
withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
|
||||
eval $withopt=no
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Only do this if --enable-multilib.
|
||||
if [ "${enable_multilib}" = yes ]; then
|
||||
|
||||
# Compute whether this is the library's top level directory
|
||||
# (ie: not a multilib subdirectory, and not a subdirectory like newlib/src).
|
||||
# ${with_multisubdir} tells us we're in the right branch, but we could be
|
||||
# in a subdir of that.
|
||||
# ??? The previous version could void this test by separating the process into
|
||||
# two files: one that only the library's toplevel configure.in ran (to
|
||||
# configure the multilib subdirs), and another that all configure.in's ran to
|
||||
# update the Makefile. It seemed reasonable to collapse all multilib support
|
||||
# into one file, but it does leave us with having to perform this test.
|
||||
ml_toplevel_p=no
|
||||
if [ -z "${with_multisubdir}" ]; then
|
||||
if [ "${srcdir}" = "." ]; then
|
||||
# Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}.
|
||||
# ${with_target_subdir} = "." for native, otherwise target alias.
|
||||
if [ "${with_target_subdir}" = "." ]; then
|
||||
if [ -f ${ml_realsrcdir}/../config-ml.in ]; then
|
||||
ml_toplevel_p=yes
|
||||
fi
|
||||
else
|
||||
if [ -f ${ml_realsrcdir}/../../config-ml.in ]; then
|
||||
ml_toplevel_p=yes
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}.
|
||||
if [ -f ${ml_realsrcdir}/../config-ml.in ]; then
|
||||
ml_toplevel_p=yes
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# If this is the library's top level directory, set multidirs to the
|
||||
# multilib subdirs to support. This lives at the top because we need
|
||||
# `multidirs' set right away.
|
||||
|
||||
if [ "${ml_toplevel_p}" = yes ]; then
|
||||
|
||||
multidirs=
|
||||
for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do
|
||||
dir=`echo $i | sed -e 's/;.*$//'`
|
||||
if [ "${dir}" = "." ]; then
|
||||
true
|
||||
else
|
||||
if [ -z "${multidirs}" ]; then
|
||||
multidirs="${dir}"
|
||||
else
|
||||
multidirs="${multidirs} ${dir}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Target libraries are configured for the host they run on, so we check
|
||||
# $host here, not $target.
|
||||
|
||||
case "${host}" in
|
||||
arc-*-elf*)
|
||||
if [ x$enable_biendian != xyes ]
|
||||
then
|
||||
old_multidirs=${multidirs}
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "${x}" in
|
||||
*be*) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
;;
|
||||
arm-*-*)
|
||||
if [ x"$enable_fpu" = xno ]
|
||||
then
|
||||
old_multidirs=${multidirs}
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "${x}" in
|
||||
*fpu*) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x"$enable_26bit" = xno ]
|
||||
then
|
||||
old_multidirs=${multidirs}
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "${x}" in
|
||||
*26bit*) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x"$enable_underscore" = xno ]
|
||||
then
|
||||
old_multidirs=${multidirs}
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "${x}" in
|
||||
*under*) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x"$enable_interwork" = xno ]
|
||||
then
|
||||
old_multidirs=${multidirs}
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "${x}" in
|
||||
*interwork*) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_biendian = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*le* ) : ;;
|
||||
*be* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x"$enable_nofmult" = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*nofmult* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
;;
|
||||
m68*-*-*)
|
||||
if [ x$enable_softfloat = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*soft-float* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_m68881 = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*m68881* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_m68000 = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*m68000* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_m68020 = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*m68020* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
;;
|
||||
mips*-*-*)
|
||||
if [ x$enable_single_float = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*single* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_biendian = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*el* ) : ;;
|
||||
*eb* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_softfloat = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*soft-float* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
case " $multidirs " in
|
||||
*" mabi=64 "*)
|
||||
# We will not be able to create libraries with -mabi=64 if
|
||||
# we cannot even link a trivial program. It usually
|
||||
# indicates the 64bit libraries are missing.
|
||||
if echo 'main() {}' > conftest.c &&
|
||||
${CC-gcc} -mabi=64 conftest.c -o conftest; then
|
||||
:
|
||||
else
|
||||
echo Could not link program with -mabi=64, disabling it.
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*mabi=64* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
rm -f conftest.c conftest
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
powerpc*-*-* | rs6000*-*-*)
|
||||
if [ x$enable_aix64 = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*ppc64* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_pthread = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*pthread* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_softfloat = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*soft-float* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_powercpu = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
power | */power | */power/* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_powerpccpu = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*powerpc* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_powerpcos = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*mcall-linux* | *mcall-solaris* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_biendian = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*mlittle* | *mbig* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ x$enable_sysv = xno ]
|
||||
then
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*mcall-sysv* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
;;
|
||||
sparc*-*-*)
|
||||
case " $multidirs " in
|
||||
*" m64 "*)
|
||||
# We will not be able to create libraries with -m64 if
|
||||
# we cannot even link a trivial program. It usually
|
||||
# indicates the 64bit libraries are missing.
|
||||
if echo 'main() {}' > conftest.c &&
|
||||
${CC-gcc} -m64 conftest.c -o conftest; then
|
||||
:
|
||||
else
|
||||
echo Could not link program with -m64, disabling it.
|
||||
old_multidirs="${multidirs}"
|
||||
multidirs=""
|
||||
for x in ${old_multidirs}; do
|
||||
case "$x" in
|
||||
*m64* ) : ;;
|
||||
*) multidirs="${multidirs} ${x}" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
rm -f conftest.c conftest
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
# Remove extraneous blanks from multidirs.
|
||||
# Tests like `if [ -n "$multidirs" ]' require it.
|
||||
multidirs=`echo "$multidirs" | sed -e 's/^[ ][ ]*//' -e 's/[ ][ ]*$//' -e 's/[ ][ ]*/ /g'`
|
||||
|
||||
# Add code to library's top level makefile to handle building the multilib
|
||||
# subdirs.
|
||||
|
||||
cat > Multi.tem <<\EOF
|
||||
|
||||
PWD_COMMAND=$${PWDCMD-pwd}
|
||||
|
||||
# FIXME: There should be an @-sign in front of the `if'.
|
||||
# Leave out until this is tested a bit more.
|
||||
multi-do:
|
||||
if [ -z "$(MULTIDIRS)" ]; then \
|
||||
true; \
|
||||
else \
|
||||
rootpre=`${PWD_COMMAND}`/; export rootpre; \
|
||||
srcrootpre=`cd $(srcdir); ${PWD_COMMAND}`/; export srcrootpre; \
|
||||
lib=`echo $${rootpre} | sed -e 's,^.*/\([^/][^/]*\)/$$,\1,'`; \
|
||||
compiler="$(CC)"; \
|
||||
for i in `$${compiler} --print-multi-lib 2>/dev/null`; do \
|
||||
dir=`echo $$i | sed -e 's/;.*$$//'`; \
|
||||
if [ "$${dir}" = "." ]; then \
|
||||
true; \
|
||||
else \
|
||||
if [ -d ../$${dir}/$${lib} ]; then \
|
||||
flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
|
||||
if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) \
|
||||
CFLAGS="$(CFLAGS) $${flags}" \
|
||||
FCFLAGS="$(FCFLAGS) $${flags}" \
|
||||
FFLAGS="$(FFLAGS) $${flags}" \
|
||||
ADAFLAGS="$(ADAFLAGS) $${flags}" \
|
||||
prefix="$(prefix)" \
|
||||
exec_prefix="$(exec_prefix)" \
|
||||
GCJFLAGS="$(GCJFLAGS) $${flags}" \
|
||||
CXXFLAGS="$(CXXFLAGS) $${flags}" \
|
||||
LIBCFLAGS="$(LIBCFLAGS) $${flags}" \
|
||||
LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \
|
||||
LDFLAGS="$(LDFLAGS) $${flags}" \
|
||||
MULTIFLAGS="$${flags}" \
|
||||
DESTDIR="$(DESTDIR)" \
|
||||
INSTALL="$(INSTALL)" \
|
||||
INSTALL_DATA="$(INSTALL_DATA)" \
|
||||
INSTALL_PROGRAM="$(INSTALL_PROGRAM)" \
|
||||
INSTALL_SCRIPT="$(INSTALL_SCRIPT)" \
|
||||
$(DO)); then \
|
||||
true; \
|
||||
else \
|
||||
exit 1; \
|
||||
fi; \
|
||||
else true; \
|
||||
fi; \
|
||||
fi; \
|
||||
done; \
|
||||
fi
|
||||
|
||||
# FIXME: There should be an @-sign in front of the `if'.
|
||||
# Leave out until this is tested a bit more.
|
||||
multi-clean:
|
||||
if [ -z "$(MULTIDIRS)" ]; then \
|
||||
true; \
|
||||
else \
|
||||
lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
|
||||
for dir in Makefile $(MULTIDIRS); do \
|
||||
if [ -f ../$${dir}/$${lib}/Makefile ]; then \
|
||||
if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) $(DO)); \
|
||||
then true; \
|
||||
else exit 1; \
|
||||
fi; \
|
||||
else true; \
|
||||
fi; \
|
||||
done; \
|
||||
fi
|
||||
EOF
|
||||
|
||||
cat ${Makefile} Multi.tem > Makefile.tem
|
||||
rm -f ${Makefile} Multi.tem
|
||||
mv Makefile.tem ${Makefile}
|
||||
|
||||
fi # ${ml_toplevel_p} = yes
|
||||
|
||||
if [ "${ml_verbose}" = --verbose ]; then
|
||||
echo "Adding multilib support to Makefile in ${ml_realsrcdir}"
|
||||
if [ "${ml_toplevel_p}" = yes ]; then
|
||||
echo "multidirs=${multidirs}"
|
||||
fi
|
||||
echo "with_multisubdir=${with_multisubdir}"
|
||||
fi
|
||||
|
||||
if [ "${srcdir}" = "." ]; then
|
||||
if [ "${with_target_subdir}" != "." ]; then
|
||||
ml_srcdotdot="../"
|
||||
else
|
||||
ml_srcdotdot=""
|
||||
fi
|
||||
else
|
||||
ml_srcdotdot=""
|
||||
fi
|
||||
|
||||
if [ -z "${with_multisubdir}" ]; then
|
||||
ml_subdir=
|
||||
ml_builddotdot=
|
||||
: # ml_srcdotdot= # already set
|
||||
else
|
||||
ml_subdir="/${with_multisubdir}"
|
||||
# The '[^/][^/]*' appears that way to work around a SunOS sed bug.
|
||||
ml_builddotdot=`echo ${with_multisubdir} | sed -e 's:[^/][^/]*:..:g'`/
|
||||
if [ "$srcdir" = "." ]; then
|
||||
ml_srcdotdot=${ml_srcdotdot}${ml_builddotdot}
|
||||
else
|
||||
: # ml_srcdotdot= # already set
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${ml_toplevel_p}" = yes ]; then
|
||||
ml_do='$(MAKE)'
|
||||
ml_clean='$(MAKE)'
|
||||
else
|
||||
ml_do=true
|
||||
ml_clean=true
|
||||
fi
|
||||
|
||||
# TOP is used by newlib and should not be used elsewhere for this purpose.
|
||||
# MULTI{SRC,BUILD}TOP are the proper ones to use. MULTISRCTOP is empty
|
||||
# when srcdir != builddir. MULTIBUILDTOP is always some number of ../'s.
|
||||
# FIXME: newlib needs to be updated to use MULTI{SRC,BUILD}TOP so we can
|
||||
# delete TOP. Newlib may wish to continue to use TOP for its own purposes
|
||||
# of course.
|
||||
# MULTIDIRS is non-empty for the cpu top level Makefile (eg: newlib/Makefile)
|
||||
# and lists the subdirectories to recurse into.
|
||||
# MULTISUBDIR is non-empty in each cpu subdirectory's Makefile
|
||||
# (eg: newlib/h8300h/Makefile) and is the installed subdirectory name with
|
||||
# a leading '/'.
|
||||
# MULTIDO is used for targets like all, install, and check where
|
||||
# $(FLAGS_TO_PASS) augmented with the subdir's compiler option is needed.
|
||||
# MULTICLEAN is used for the *clean targets.
|
||||
#
|
||||
# ??? It is possible to merge MULTIDO and MULTICLEAN into one. They are
|
||||
# currently kept separate because we don't want the *clean targets to require
|
||||
# the existence of the compiler (which MULTIDO currently requires) and
|
||||
# therefore we'd have to record the directory options as well as names
|
||||
# (currently we just record the names and use --print-multi-lib to get the
|
||||
# options).
|
||||
|
||||
sed -e "s:^TOP[ ]*=[ ]*\([./]*\)[ ]*$:TOP = ${ml_builddotdot}\1:" \
|
||||
-e "s:^MULTISRCTOP[ ]*=.*$:MULTISRCTOP = ${ml_srcdotdot}:" \
|
||||
-e "s:^MULTIBUILDTOP[ ]*=.*$:MULTIBUILDTOP = ${ml_builddotdot}:" \
|
||||
-e "s:^MULTIDIRS[ ]*=.*$:MULTIDIRS = ${multidirs}:" \
|
||||
-e "s:^MULTISUBDIR[ ]*=.*$:MULTISUBDIR = ${ml_subdir}:" \
|
||||
-e "s:^MULTIDO[ ]*=.*$:MULTIDO = $ml_do:" \
|
||||
-e "s:^MULTICLEAN[ ]*=.*$:MULTICLEAN = $ml_clean:" \
|
||||
${Makefile} > Makefile.tem
|
||||
rm -f ${Makefile}
|
||||
mv Makefile.tem ${Makefile}
|
||||
|
||||
# If this is the library's top level, configure each multilib subdir.
|
||||
# This is done at the end because this is the loop that runs configure
|
||||
# in each multilib subdir and it seemed reasonable to finish updating the
|
||||
# Makefile before going on to configure the subdirs.
|
||||
|
||||
if [ "${ml_toplevel_p}" = yes ]; then
|
||||
|
||||
# We must freshly configure each subdirectory. This bit of code is
|
||||
# actually partially stolen from the main configure script. FIXME.
|
||||
|
||||
if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then
|
||||
|
||||
if [ "${ml_verbose}" = --verbose ]; then
|
||||
echo "Running configure in multilib subdirs ${multidirs}"
|
||||
echo "pwd: `${PWDCMD-pwd}`"
|
||||
fi
|
||||
|
||||
ml_origdir=`${PWDCMD-pwd}`
|
||||
ml_libdir=`echo $ml_origdir | sed -e 's,^.*/,,'`
|
||||
# cd to top-level-build-dir/${with_target_subdir}
|
||||
cd ..
|
||||
|
||||
for ml_dir in ${multidirs}; do
|
||||
|
||||
if [ "${ml_verbose}" = --verbose ]; then
|
||||
echo "Running configure in multilib subdir ${ml_dir}"
|
||||
echo "pwd: `${PWDCMD-pwd}`"
|
||||
fi
|
||||
|
||||
if [ -d ${ml_dir} ]; then true; else
|
||||
# ``mkdir -p ${ml_dir}'' See also mkinstalldirs.
|
||||
pathcomp=""
|
||||
for d in `echo ":${ml_dir}" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`; do
|
||||
pathcomp="$pathcomp$d"
|
||||
case "$pathcomp" in
|
||||
-* ) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp" 1>&2
|
||||
mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$?
|
||||
fi
|
||||
if test ! -d "$pathcomp"; then
|
||||
exit $lasterr
|
||||
fi
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
fi
|
||||
if [ -d ${ml_dir}/${ml_libdir} ]; then true; else mkdir ${ml_dir}/${ml_libdir}; fi
|
||||
|
||||
# Eg: if ${ml_dir} = m68000/m68881, dotdot = ../../
|
||||
dotdot=../`echo ${ml_dir} | sed -e 's|[^/]||g' -e 's|/|../|g'`
|
||||
|
||||
case ${srcdir} in
|
||||
".")
|
||||
echo Building symlink tree in `${PWDCMD-pwd}`/${ml_dir}/${ml_libdir}
|
||||
if [ "${with_target_subdir}" != "." ]; then
|
||||
ml_unsubdir="../"
|
||||
else
|
||||
ml_unsubdir=""
|
||||
fi
|
||||
(cd ${ml_dir}/${ml_libdir};
|
||||
../${dotdot}${ml_unsubdir}symlink-tree ../${dotdot}${ml_unsubdir}${ml_libdir} "")
|
||||
if [ -f ${ml_dir}/${ml_libdir}/Makefile ]; then
|
||||
if [ x"${MAKE}" = x ]; then
|
||||
(cd ${ml_dir}/${ml_libdir}; make distclean)
|
||||
else
|
||||
(cd ${ml_dir}/${ml_libdir}; ${MAKE} distclean)
|
||||
fi
|
||||
fi
|
||||
ml_newsrcdir="."
|
||||
ml_srcdiroption=
|
||||
multisrctop=${dotdot}
|
||||
;;
|
||||
*)
|
||||
case "${srcdir}" in
|
||||
/* | [A-Za-z]:[\\/]* ) # absolute path
|
||||
ml_newsrcdir=${srcdir}
|
||||
;;
|
||||
*) # otherwise relative
|
||||
ml_newsrcdir=${dotdot}${srcdir}
|
||||
;;
|
||||
esac
|
||||
ml_srcdiroption="-srcdir=${ml_newsrcdir}"
|
||||
multisrctop=
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${progname}" in
|
||||
/* | [A-Za-z]:[\\/]* ) ml_recprog=${progname} ;;
|
||||
*) ml_recprog=${dotdot}${progname} ;;
|
||||
esac
|
||||
|
||||
# FIXME: POPDIR=${PWD=`pwd`} doesn't work here.
|
||||
ML_POPDIR=`${PWDCMD-pwd}`
|
||||
cd ${ml_dir}/${ml_libdir}
|
||||
|
||||
if [ -f ${ml_newsrcdir}/configure ]; then
|
||||
ml_recprog="${ml_newsrcdir}/configure"
|
||||
fi
|
||||
|
||||
# find compiler flag corresponding to ${ml_dir}
|
||||
for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do
|
||||
dir=`echo $i | sed -e 's/;.*$//'`
|
||||
if [ "${dir}" = "${ml_dir}" ]; then
|
||||
flags=`echo $i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`
|
||||
break
|
||||
fi
|
||||
done
|
||||
ml_config_env='CC="${CC_}$flags" CXX="${CXX_}$flags" F77="${F77_}$flags" GCJ="${GCJ_}$flags" GFORTRAN="${GFORTRAN_}$flags"'
|
||||
|
||||
if [ "${with_target_subdir}" = "." ]; then
|
||||
CC_=$CC' '
|
||||
CXX_=$CXX' '
|
||||
F77_=$F77' '
|
||||
GCJ_=$GCJ' '
|
||||
GFORTRAN_=$GFORTRAN' '
|
||||
else
|
||||
# Create a regular expression that matches any string as long
|
||||
# as ML_POPDIR.
|
||||
popdir_rx=`echo ${ML_POPDIR} | sed 's,.,.,g'`
|
||||
CC_=
|
||||
for arg in ${CC}; do
|
||||
case $arg in
|
||||
-[BIL]"${ML_POPDIR}"/*)
|
||||
CC_="${CC_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\1/p"`' ' ;;
|
||||
"${ML_POPDIR}"/*)
|
||||
CC_="${CC_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
|
||||
*)
|
||||
CC_="${CC_}${arg} " ;;
|
||||
esac
|
||||
done
|
||||
|
||||
CXX_=
|
||||
for arg in ${CXX}; do
|
||||
case $arg in
|
||||
-[BIL]"${ML_POPDIR}"/*)
|
||||
CXX_="${CXX_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
|
||||
"${ML_POPDIR}"/*)
|
||||
CXX_="${CXX_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
|
||||
*)
|
||||
CXX_="${CXX_}${arg} " ;;
|
||||
esac
|
||||
done
|
||||
|
||||
F77_=
|
||||
for arg in ${F77}; do
|
||||
case $arg in
|
||||
-[BIL]"${ML_POPDIR}"/*)
|
||||
F77_="${F77_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
|
||||
"${ML_POPDIR}"/*)
|
||||
F77_="${F77_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
|
||||
*)
|
||||
F77_="${F77_}${arg} " ;;
|
||||
esac
|
||||
done
|
||||
|
||||
GCJ_=
|
||||
for arg in ${GCJ}; do
|
||||
case $arg in
|
||||
-[BIL]"${ML_POPDIR}"/*)
|
||||
GCJ_="${GCJ_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
|
||||
"${ML_POPDIR}"/*)
|
||||
GCJ_="${GCJ_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
|
||||
*)
|
||||
GCJ_="${GCJ_}${arg} " ;;
|
||||
esac
|
||||
done
|
||||
|
||||
GFORTRAN_=
|
||||
for arg in ${GFORTRAN}; do
|
||||
case $arg in
|
||||
-[BIL]"${ML_POPDIR}"/*)
|
||||
GFORTRAN_="${GFORTRAN_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
|
||||
"${ML_POPDIR}"/*)
|
||||
GFORTRAN_="${GFORTRAN_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
|
||||
*)
|
||||
GFORTRAN_="${GFORTRAN_}${arg} " ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test "x${LD_LIBRARY_PATH+set}" = xset; then
|
||||
LD_LIBRARY_PATH_=
|
||||
for arg in `echo "$LD_LIBRARY_PATH" | tr ':' ' '`; do
|
||||
case "$arg" in
|
||||
"${ML_POPDIR}"/*)
|
||||
arg=`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`
|
||||
;;
|
||||
esac
|
||||
if test "x$LD_LIBRARY_PATH_" != x; then
|
||||
LD_LIBRARY_PATH_=$LD_LIBRARY_PATH_:$arg
|
||||
else
|
||||
LD_LIBRARY_PATH_=$arg
|
||||
fi
|
||||
done
|
||||
ml_config_env="$ml_config_env LD_LIBRARY_PATH=$LD_LIBRARY_PATH_"
|
||||
fi
|
||||
|
||||
if test "x${SHLIB_PATH+set}" = xset; then
|
||||
SHLIB_PATH_=
|
||||
for arg in `echo "$SHLIB_PATH" | tr ':' ' '`; do
|
||||
case "$arg" in
|
||||
"${ML_POPDIR}"/*)
|
||||
arg=`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`
|
||||
;;
|
||||
esac
|
||||
if test "x$SHLIB_PATH_" != x; then
|
||||
SHLIB_PATH_=$SHLIB_PATH_:$arg
|
||||
else
|
||||
SHLIB_PATH_=$arg
|
||||
fi
|
||||
done
|
||||
ml_config_env="$ml_config_env SHLIB_PATH=$SHLIB_PATH_"
|
||||
fi
|
||||
fi
|
||||
|
||||
if eval ${ml_config_env} ${ml_config_shell} ${ml_recprog} \
|
||||
--with-multisubdir=${ml_dir} --with-multisrctop=${multisrctop} \
|
||||
${ac_configure_args} ${ml_srcdiroption} ; then
|
||||
true
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd ${ML_POPDIR}
|
||||
|
||||
done
|
||||
|
||||
cd ${ml_origdir}
|
||||
fi
|
||||
|
||||
fi # ${ml_toplevel_p} = yes
|
||||
fi # ${enable_multilib} = yes
|
||||
+1516
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+1626
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+25104
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -0,0 +1,382 @@
|
||||
dnl Process this with autoconf to create configure
|
||||
|
||||
AC_PREREQ(2.59)
|
||||
|
||||
AC_INIT([libffi], [3.0.8], [http://gcc.gnu.org/bugs.html])
|
||||
AC_CONFIG_HEADERS([fficonfig.h])
|
||||
|
||||
AC_CANONICAL_SYSTEM
|
||||
target_alias=${target_alias-$host_alias}
|
||||
|
||||
. ${srcdir}/configure.host
|
||||
|
||||
AM_INIT_AUTOMAKE
|
||||
|
||||
# The same as in boehm-gc and libstdc++. Have to borrow it from there.
|
||||
# We must force CC to /not/ be precious variables; otherwise
|
||||
# the wrong, non-multilib-adjusted value will be used in multilibs.
|
||||
# As a side effect, we have to subst CFLAGS ourselves.
|
||||
|
||||
m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
|
||||
m4_define([_AC_ARG_VAR_PRECIOUS],[])
|
||||
AC_PROG_CC
|
||||
m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
|
||||
|
||||
AC_SUBST(CFLAGS)
|
||||
|
||||
AM_PROG_AS
|
||||
AM_PROG_CC_C_O
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
AC_CHECK_HEADERS(sys/mman.h)
|
||||
AC_CHECK_FUNCS(mmap)
|
||||
AC_FUNC_MMAP_BLACKLIST
|
||||
|
||||
dnl The -no-testsuite modules omit the test subdir.
|
||||
AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite)
|
||||
|
||||
TARGETDIR="unknown"
|
||||
case "$host" in
|
||||
alpha*-*-*)
|
||||
TARGET=ALPHA; TARGETDIR=alpha;
|
||||
# Support 128-bit long double, changable via command-line switch.
|
||||
HAVE_LONG_DOUBLE='defined(__LONG_DOUBLE_128__)'
|
||||
;;
|
||||
|
||||
arm*-*-*)
|
||||
TARGET=ARM; TARGETDIR=arm
|
||||
;;
|
||||
|
||||
amd64-*-freebsd*)
|
||||
TARGET=X86_64; TARGETDIR=x86
|
||||
;;
|
||||
|
||||
cris-*-*)
|
||||
TARGET=LIBFFI_CRIS; TARGETDIR=cris
|
||||
;;
|
||||
|
||||
frv-*-*)
|
||||
TARGET=FRV; TARGETDIR=frv
|
||||
;;
|
||||
|
||||
hppa*-*-linux* | parisc*-*-linux*)
|
||||
TARGET=PA_LINUX; TARGETDIR=pa
|
||||
;;
|
||||
hppa*64-*-hpux*)
|
||||
TARGET=PA64_HPUX; TARGETDIR=pa
|
||||
;;
|
||||
hppa*-*-hpux*)
|
||||
TARGET=PA_HPUX; TARGETDIR=pa
|
||||
;;
|
||||
|
||||
i386-*-freebsd* | i386-*-openbsd*)
|
||||
TARGET=X86_FREEBSD; TARGETDIR=x86
|
||||
;;
|
||||
i?86-win32* | i?86-*-cygwin* | i?86-*-mingw*)
|
||||
TARGET=X86_WIN32; TARGETDIR=x86
|
||||
;;
|
||||
i?86-*-darwin*)
|
||||
TARGET=X86_DARWIN; TARGETDIR=x86
|
||||
;;
|
||||
i?86-*-solaris2.1[[0-9]]*)
|
||||
TARGET=X86_64; TARGETDIR=x86
|
||||
;;
|
||||
i?86-*-*)
|
||||
TARGET=X86; TARGETDIR=x86
|
||||
;;
|
||||
|
||||
ia64*-*-*)
|
||||
TARGET=IA64; TARGETDIR=ia64
|
||||
;;
|
||||
|
||||
m32r*-*-*)
|
||||
TARGET=M32R; TARGETDIR=m32r
|
||||
;;
|
||||
|
||||
m68k-*-*)
|
||||
TARGET=M68K; TARGETDIR=m68k
|
||||
;;
|
||||
|
||||
mips-sgi-irix5.* | mips-sgi-irix6.*)
|
||||
TARGET=MIPS; TARGETDIR=mips
|
||||
;;
|
||||
mips*-*-linux*)
|
||||
TARGET=MIPS; TARGETDIR=mips
|
||||
;;
|
||||
|
||||
powerpc*-*-linux* | powerpc-*-sysv*)
|
||||
TARGET=POWERPC; TARGETDIR=powerpc
|
||||
;;
|
||||
powerpc-*-beos*)
|
||||
TARGET=POWERPC; TARGETDIR=powerpc
|
||||
;;
|
||||
powerpc-*-darwin*)
|
||||
TARGET=POWERPC_DARWIN; TARGETDIR=powerpc
|
||||
;;
|
||||
powerpc-*-aix* | rs6000-*-aix*)
|
||||
TARGET=POWERPC_AIX; TARGETDIR=powerpc
|
||||
;;
|
||||
powerpc-*-freebsd*)
|
||||
TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
|
||||
;;
|
||||
powerpc*-*-rtems*)
|
||||
TARGET=POWERPC; TARGETDIR=powerpc
|
||||
;;
|
||||
|
||||
s390-*-* | s390x-*-*)
|
||||
TARGET=S390; TARGETDIR=s390
|
||||
;;
|
||||
|
||||
sh-*-* | sh[[34]]*-*-*)
|
||||
TARGET=SH; TARGETDIR=sh
|
||||
;;
|
||||
sh64-*-* | sh5*-*-*)
|
||||
TARGET=SH64; TARGETDIR=sh64
|
||||
;;
|
||||
|
||||
sparc*-*-*)
|
||||
TARGET=SPARC; TARGETDIR=sparc
|
||||
;;
|
||||
|
||||
x86_64-*-darwin*)
|
||||
TARGET=X86_DARWIN; TARGETDIR=x86
|
||||
;;
|
||||
x86_64-*-cygwin* | x86_64-*-mingw*)
|
||||
TARGET=X86_WIN64; TARGETDIR=x86
|
||||
;;
|
||||
x86_64-*-*)
|
||||
TARGET=X86_64; TARGETDIR=x86
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(AM_RUNTESTFLAGS)
|
||||
|
||||
if test $TARGETDIR = unknown; then
|
||||
AC_MSG_ERROR(["libffi has not been ported to $host."])
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS)
|
||||
AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
|
||||
AM_CONDITIONAL(X86, test x$TARGET = xX86)
|
||||
AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD)
|
||||
AM_CONDITIONAL(X86_WIN32, test x$TARGET = xX86_WIN32)
|
||||
AM_CONDITIONAL(X86_WIN64, test x$TARGET = xX86_WIN64)
|
||||
AM_CONDITIONAL(X86_DARWIN, test x$TARGET = xX86_DARWIN)
|
||||
AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
|
||||
AM_CONDITIONAL(IA64, test x$TARGET = xIA64)
|
||||
AM_CONDITIONAL(M32R, test x$TARGET = xM32R)
|
||||
AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
|
||||
AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
|
||||
AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX)
|
||||
AM_CONDITIONAL(POWERPC_DARWIN, test x$TARGET = xPOWERPC_DARWIN)
|
||||
AM_CONDITIONAL(POWERPC_FREEBSD, test x$TARGET = xPOWERPC_FREEBSD)
|
||||
AM_CONDITIONAL(ARM, test x$TARGET = xARM)
|
||||
AM_CONDITIONAL(LIBFFI_CRIS, test x$TARGET = xLIBFFI_CRIS)
|
||||
AM_CONDITIONAL(FRV, test x$TARGET = xFRV)
|
||||
AM_CONDITIONAL(S390, test x$TARGET = xS390)
|
||||
AM_CONDITIONAL(X86_64, test x$TARGET = xX86_64)
|
||||
AM_CONDITIONAL(SH, test x$TARGET = xSH)
|
||||
AM_CONDITIONAL(SH64, test x$TARGET = xSH64)
|
||||
AM_CONDITIONAL(PA_LINUX, test x$TARGET = xPA_LINUX)
|
||||
AM_CONDITIONAL(PA_HPUX, test x$TARGET = xPA_HPUX)
|
||||
AM_CONDITIONAL(PA64_HPUX, test x$TARGET = xPA64_HPUX)
|
||||
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_FUNCS(memcpy)
|
||||
AC_FUNC_ALLOCA
|
||||
|
||||
AC_CHECK_SIZEOF(double)
|
||||
AC_CHECK_SIZEOF(long double)
|
||||
|
||||
# Also AC_SUBST this variable for ffi.h.
|
||||
if test -z "$HAVE_LONG_DOUBLE"; then
|
||||
HAVE_LONG_DOUBLE=0
|
||||
if test $ac_cv_sizeof_double != $ac_cv_sizeof_long_double; then
|
||||
if test $ac_cv_sizeof_long_double != 0; then
|
||||
HAVE_LONG_DOUBLE=1
|
||||
AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the long double type and it is bigger than a double])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(HAVE_LONG_DOUBLE)
|
||||
|
||||
AC_C_BIGENDIAN
|
||||
|
||||
AC_CACHE_CHECK([assembler .cfi pseudo-op support],
|
||||
libffi_cv_as_cfi_pseudo_op, [
|
||||
libffi_cv_as_cfi_pseudo_op=unknown
|
||||
AC_TRY_COMPILE([asm (".cfi_startproc\n\t.cfi_endproc");],,
|
||||
[libffi_cv_as_cfi_pseudo_op=yes],
|
||||
[libffi_cv_as_cfi_pseudo_op=no])
|
||||
])
|
||||
if test "x$libffi_cv_as_cfi_pseudo_op" = xyes; then
|
||||
AC_DEFINE(HAVE_AS_CFI_PSEUDO_OP, 1,
|
||||
[Define if your assembler supports .cfi_* directives.])
|
||||
fi
|
||||
|
||||
if test x$TARGET = xSPARC; then
|
||||
AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs],
|
||||
libffi_cv_as_sparc_ua_pcrel, [
|
||||
save_CFLAGS="$CFLAGS"
|
||||
save_LDFLAGS="$LDFLAGS"
|
||||
CFLAGS="$CFLAGS -fpic"
|
||||
LDFLAGS="$LDFLAGS -shared"
|
||||
AC_TRY_LINK([asm (".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo); .text");],,
|
||||
[libffi_cv_as_sparc_ua_pcrel=yes],
|
||||
[libffi_cv_as_sparc_ua_pcrel=no])
|
||||
CFLAGS="$save_CFLAGS"
|
||||
LDFLAGS="$save_LDFLAGS"])
|
||||
if test "x$libffi_cv_as_sparc_ua_pcrel" = xyes; then
|
||||
AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1,
|
||||
[Define if your assembler and linker support unaligned PC relative relocs.])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([assembler .register pseudo-op support],
|
||||
libffi_cv_as_register_pseudo_op, [
|
||||
libffi_cv_as_register_pseudo_op=unknown
|
||||
# Check if we have .register
|
||||
AC_TRY_COMPILE([asm (".register %g2, #scratch");],,
|
||||
[libffi_cv_as_register_pseudo_op=yes],
|
||||
[libffi_cv_as_register_pseudo_op=no])
|
||||
])
|
||||
if test "x$libffi_cv_as_register_pseudo_op" = xyes; then
|
||||
AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1,
|
||||
[Define if your assembler supports .register.])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x$TARGET = xX86 || test x$TARGET = xX86_64; then
|
||||
AC_CACHE_CHECK([assembler supports pc related relocs],
|
||||
libffi_cv_as_x86_pcrel, [
|
||||
libffi_cv_as_x86_pcrel=yes
|
||||
echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s
|
||||
if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then
|
||||
libffi_cv_as_x86_pcrel=no
|
||||
fi
|
||||
])
|
||||
if test "x$libffi_cv_as_x86_pcrel" = xyes; then
|
||||
AC_DEFINE(HAVE_AS_X86_PCREL, 1,
|
||||
[Define if your assembler supports PC relative relocs.])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([whether .eh_frame section should be read-only],
|
||||
libffi_cv_ro_eh_frame, [
|
||||
libffi_cv_ro_eh_frame=no
|
||||
echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c
|
||||
if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then
|
||||
if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then
|
||||
libffi_cv_ro_eh_frame=yes
|
||||
elif grep '.section.*eh_frame.*#alloc' conftest.c \
|
||||
| grep -v '#write' > /dev/null; then
|
||||
libffi_cv_ro_eh_frame=yes
|
||||
fi
|
||||
fi
|
||||
rm -f conftest.*
|
||||
])
|
||||
if test "x$libffi_cv_ro_eh_frame" = xyes; then
|
||||
AC_DEFINE(HAVE_RO_EH_FRAME, 1,
|
||||
[Define if .eh_frame sections should be read-only.])
|
||||
AC_DEFINE(EH_FRAME_FLAGS, "a",
|
||||
[Define to the flags needed for the .section .eh_frame directive.])
|
||||
else
|
||||
AC_DEFINE(EH_FRAME_FLAGS, "aw",
|
||||
[Define to the flags needed for the .section .eh_frame directive.])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for __attribute__((visibility("hidden")))],
|
||||
libffi_cv_hidden_visibility_attribute, [
|
||||
echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1; }' > conftest.c
|
||||
libffi_cv_hidden_visibility_attribute=no
|
||||
if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
|
||||
if grep '\.hidden.*foo' conftest.s >/dev/null; then
|
||||
libffi_cv_hidden_visibility_attribute=yes
|
||||
fi
|
||||
fi
|
||||
rm -f conftest.*
|
||||
])
|
||||
if test $libffi_cv_hidden_visibility_attribute = yes; then
|
||||
AC_DEFINE(HAVE_HIDDEN_VISIBILITY_ATTRIBUTE, 1,
|
||||
[Define if __attribute__((visibility("hidden"))) is supported.])
|
||||
fi
|
||||
|
||||
AH_BOTTOM([
|
||||
#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
|
||||
#ifdef LIBFFI_ASM
|
||||
#define FFI_HIDDEN(name) .hidden name
|
||||
#else
|
||||
#define FFI_HIDDEN __attribute__ ((visibility ("hidden")))
|
||||
#endif
|
||||
#else
|
||||
#ifdef LIBFFI_ASM
|
||||
#define FFI_HIDDEN(name)
|
||||
#else
|
||||
#define FFI_HIDDEN
|
||||
#endif
|
||||
#endif
|
||||
])
|
||||
|
||||
AC_SUBST(TARGET)
|
||||
AC_SUBST(TARGETDIR)
|
||||
|
||||
AC_SUBST(SHELL)
|
||||
|
||||
AC_ARG_ENABLE(debug,
|
||||
[ --enable-debug debugging mode],
|
||||
if test "$enable_debug" = "yes"; then
|
||||
AC_DEFINE(FFI_DEBUG, 1, [Define this if you want extra debugging.])
|
||||
fi)
|
||||
|
||||
AC_ARG_ENABLE(structs,
|
||||
[ --disable-structs omit code for struct support],
|
||||
if test "$enable_structs" = "no"; then
|
||||
AC_DEFINE(FFI_NO_STRUCTS, 1, [Define this is you do not want support for aggregate types.])
|
||||
fi)
|
||||
|
||||
AC_ARG_ENABLE(raw-api,
|
||||
[ --disable-raw-api make the raw api unavailable],
|
||||
if test "$enable_raw_api" = "no"; then
|
||||
AC_DEFINE(FFI_NO_RAW_API, 1, [Define this is you do not want support for the raw API.])
|
||||
fi)
|
||||
|
||||
AC_ARG_ENABLE(purify-safety,
|
||||
[ --enable-purify-safety purify-safe mode],
|
||||
if test "$enable_purify_safety" = "yes"; then
|
||||
AC_DEFINE(USING_PURIFY, 1, [Define this if you are using Purify and want to suppress spurious messages.])
|
||||
fi)
|
||||
|
||||
if test -n "$with_cross_host" &&
|
||||
test x"$with_cross_host" != x"no"; then
|
||||
toolexecdir='$(exec_prefix)/$(target_alias)'
|
||||
toolexeclibdir='$(toolexecdir)/lib'
|
||||
else
|
||||
toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
|
||||
toolexeclibdir='$(libdir)'
|
||||
fi
|
||||
multi_os_directory=`$CC -print-multi-os-directory`
|
||||
case $multi_os_directory in
|
||||
.) ;; # Avoid trailing /.
|
||||
*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
|
||||
esac
|
||||
AC_SUBST(toolexecdir)
|
||||
AC_SUBST(toolexeclibdir)
|
||||
|
||||
if test "${multilib}" = "yes"; then
|
||||
multilib_arg="--enable-multilib"
|
||||
else
|
||||
multilib_arg=
|
||||
fi
|
||||
|
||||
AC_CONFIG_COMMANDS(include, [test -d include || mkdir include])
|
||||
AC_CONFIG_COMMANDS(src, [
|
||||
test -d src || mkdir src
|
||||
test -d src/$TARGETDIR || mkdir src/$TARGETDIR
|
||||
], [TARGETDIR="$TARGETDIR"])
|
||||
|
||||
AC_CONFIG_LINKS(include/ffitarget.h:src/$TARGETDIR/ffitarget.h)
|
||||
|
||||
AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc)
|
||||
|
||||
AC_OUTPUT
|
||||
@@ -0,0 +1,11 @@
|
||||
# configure.host
|
||||
#
|
||||
# This shell script handles all host based configuration for libffi.
|
||||
#
|
||||
|
||||
# THIS TABLE IS SORTED. KEEP IT THAT WAY.
|
||||
case "${host}" in
|
||||
frv*-elf)
|
||||
LDFLAGS=`echo $LDFLAGS | sed "s/\-B[^ ]*libgloss\/frv\///"`\ -B`pwd`/../libgloss/frv/
|
||||
;;
|
||||
esac
|
||||
Arquivo executável
+584
@@ -0,0 +1,584 @@
|
||||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2006-10-15.18
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
|
||||
# Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by `PROGRAMS ARGS'.
|
||||
object Object file output by `PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputing dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the `deleted header file' problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the `:'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like `#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr '
|
||||
' ' ' >> $depfile
|
||||
echo >> $depfile
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> $depfile
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts `$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
|
||||
tmpdepfile="$stripped.u"
|
||||
if test "$libtool" = yes; then
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
|
||||
if test -f "$tmpdepfile"; then :
|
||||
else
|
||||
stripped=`echo "$stripped" | sed 's,^.*/,,'`
|
||||
tmpdepfile="$stripped.u"
|
||||
fi
|
||||
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
if test -f "$tmpdepfile"; then
|
||||
outname="$stripped.o"
|
||||
# Each line is of the form `foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler understands `-MD -MF file'. However on
|
||||
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want:
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using \ :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
||||
sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add `dependent.h:' lines.
|
||||
sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in `foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# With Tru64 cc, shared objects can also be used to make a
|
||||
# static library. This mechanism is used in libtool 1.4 series to
|
||||
# handle both shared and static libraries in a single compilation.
|
||||
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
|
||||
#
|
||||
# With libtool 1.5 this exception was removed, and libtool now
|
||||
# generates 2 separate objects for the 2 libraries. These two
|
||||
# compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
|
||||
tmpdepfile2=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
|
||||
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.o.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
tmpdepfile4=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for `:'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no
|
||||
for arg in "$@"; do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix="`echo $object | sed 's/^.*\././'`"
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||
' | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E |
|
||||
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o,
|
||||
# because we must use -o when running libtool.
|
||||
"$@" || exit $?
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||
echo " " >> "$depfile"
|
||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
||||
@@ -0,0 +1,533 @@
|
||||
This is doc/libffi.info, produced by makeinfo version 4.12 from
|
||||
./doc/libffi.texi.
|
||||
|
||||
This manual is for Libffi, a portable foreign-function interface
|
||||
library.
|
||||
|
||||
Copyright (C) 2008 Red Hat, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2, or
|
||||
(at your option) any later version. A copy of the license is
|
||||
included in the section entitled "GNU General Public License".
|
||||
|
||||
|
||||
INFO-DIR-SECTION
|
||||
START-INFO-DIR-ENTRY
|
||||
* libffi: (libffi). Portable foreign-function interface library.
|
||||
END-INFO-DIR-ENTRY
|
||||
|
||||
|
||||
File: libffi.info, Node: Top, Next: Introduction, Up: (dir)
|
||||
|
||||
libffi
|
||||
******
|
||||
|
||||
This manual is for Libffi, a portable foreign-function interface
|
||||
library.
|
||||
|
||||
Copyright (C) 2008 Red Hat, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2, or
|
||||
(at your option) any later version. A copy of the license is
|
||||
included in the section entitled "GNU General Public License".
|
||||
|
||||
|
||||
* Menu:
|
||||
|
||||
* Introduction:: What is libffi?
|
||||
* Using libffi:: How to use libffi.
|
||||
* Missing Features:: Things libffi can't do.
|
||||
* Index:: Index.
|
||||
|
||||
|
||||
File: libffi.info, Node: Introduction, Next: Using libffi, Prev: Top, Up: Top
|
||||
|
||||
1 What is libffi?
|
||||
*****************
|
||||
|
||||
Compilers for high level languages generate code that follow certain
|
||||
conventions. These conventions are necessary, in part, for separate
|
||||
compilation to work. One such convention is the "calling convention".
|
||||
The calling convention is a set of assumptions made by the compiler
|
||||
about where function arguments will be found on entry to a function. A
|
||||
calling convention also specifies where the return value for a function
|
||||
is found. The calling convention is also sometimes called the "ABI" or
|
||||
"Application Binary Interface".
|
||||
|
||||
Some programs may not know at the time of compilation what arguments
|
||||
are to be passed to a function. For instance, an interpreter may be
|
||||
told at run-time about the number and types of arguments used to call a
|
||||
given function. `Libffi' can be used in such programs to provide a
|
||||
bridge from the interpreter program to compiled code.
|
||||
|
||||
The `libffi' library provides a portable, high level programming
|
||||
interface to various calling conventions. This allows a programmer to
|
||||
call any function specified by a call interface description at run time.
|
||||
|
||||
FFI stands for Foreign Function Interface. A foreign function
|
||||
interface is the popular name for the interface that allows code
|
||||
written in one language to call code written in another language. The
|
||||
`libffi' library really only provides the lowest, machine dependent
|
||||
layer of a fully featured foreign function interface. A layer must
|
||||
exist above `libffi' that handles type conversions for values passed
|
||||
between the two languages.
|
||||
|
||||
|
||||
File: libffi.info, Node: Using libffi, Next: Missing Features, Prev: Introduction, Up: Top
|
||||
|
||||
2 Using libffi
|
||||
**************
|
||||
|
||||
* Menu:
|
||||
|
||||
* The Basics:: The basic libffi API.
|
||||
* Simple Example:: A simple example.
|
||||
* Types:: libffi type descriptions.
|
||||
* Multiple ABIs:: Different passing styles on one platform.
|
||||
* The Closure API:: Writing a generic function.
|
||||
|
||||
|
||||
File: libffi.info, Node: The Basics, Next: Simple Example, Up: Using libffi
|
||||
|
||||
2.1 The Basics
|
||||
==============
|
||||
|
||||
`Libffi' assumes that you have a pointer to the function you wish to
|
||||
call and that you know the number and types of arguments to pass it, as
|
||||
well as the return type of the function.
|
||||
|
||||
The first thing you must do is create an `ffi_cif' object that
|
||||
matches the signature of the function you wish to call. This is a
|
||||
separate step because it is common to make multiple calls using a
|
||||
single `ffi_cif'. The "cif" in `ffi_cif' stands for Call InterFace.
|
||||
To prepare a call interface object, use the function `ffi_prep_cif'.
|
||||
|
||||
-- Function: ffi_status ffi_prep_cif (ffi_cif *CIF, ffi_abi ABI,
|
||||
unsigned int NARGS, ffi_type *RTYPE, ffi_type **ARGTYPES)
|
||||
This initializes CIF according to the given parameters.
|
||||
|
||||
ABI is the ABI to use; normally `FFI_DEFAULT_ABI' is what you
|
||||
want. *note Multiple ABIs:: for more information.
|
||||
|
||||
NARGS is the number of arguments that this function accepts.
|
||||
`libffi' does not yet handle varargs functions; see *note Missing
|
||||
Features:: for more information.
|
||||
|
||||
RTYPE is a pointer to an `ffi_type' structure that describes the
|
||||
return type of the function. *Note Types::.
|
||||
|
||||
ARGTYPES is a vector of `ffi_type' pointers. ARGTYPES must have
|
||||
NARGS elements. If NARGS is 0, this argument is ignored.
|
||||
|
||||
`ffi_prep_cif' returns a `libffi' status code, of type
|
||||
`ffi_status'. This will be either `FFI_OK' if everything worked
|
||||
properly; `FFI_BAD_TYPEDEF' if one of the `ffi_type' objects is
|
||||
incorrect; or `FFI_BAD_ABI' if the ABI parameter is invalid.
|
||||
|
||||
To call a function using an initialized `ffi_cif', use the
|
||||
`ffi_call' function:
|
||||
|
||||
-- Function: void ffi_call (ffi_cif *CIF, void *FN, void *RVALUE, void
|
||||
**AVALUES)
|
||||
This calls the function FN according to the description given in
|
||||
CIF. CIF must have already been prepared using `ffi_prep_cif'.
|
||||
|
||||
RVALUE is a pointer to a chunk of memory that will hold the result
|
||||
of the function call. This must be large enough to hold the
|
||||
result and must be suitably aligned; it is the caller's
|
||||
responsibility to ensure this. If CIF declares that the function
|
||||
returns `void' (using `ffi_type_void'), then RVALUE is ignored.
|
||||
If RVALUE is `NULL', then the return value is discarded.
|
||||
|
||||
AVALUES is a vector of `void *' pointers that point to the memory
|
||||
locations holding the argument values for a call. If CIF declares
|
||||
that the function has no arguments (i.e., NARGS was 0), then
|
||||
AVALUES is ignored.
|
||||
|
||||
|
||||
File: libffi.info, Node: Simple Example, Next: Types, Prev: The Basics, Up: Using libffi
|
||||
|
||||
2.2 Simple Example
|
||||
==================
|
||||
|
||||
Here is a trivial example that calls `puts' a few times.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ffi.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
ffi_cif cif;
|
||||
ffi_type *args[1];
|
||||
void *values[1];
|
||||
char *s;
|
||||
int rc;
|
||||
|
||||
/* Initialize the argument info vectors */
|
||||
args[0] = &ffi_type_pointer;
|
||||
values[0] = &s;
|
||||
|
||||
/* Initialize the cif */
|
||||
if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
|
||||
&ffi_type_uint, args) == FFI_OK)
|
||||
{
|
||||
s = "Hello World!";
|
||||
ffi_call(&cif, puts, &rc, values);
|
||||
/* rc now holds the result of the call to puts */
|
||||
|
||||
/* values holds a pointer to the function's arg, so to
|
||||
call puts() again all we need to do is change the
|
||||
value of s */
|
||||
s = "This is cool!";
|
||||
ffi_call(&cif, puts, &rc, values);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
File: libffi.info, Node: Types, Next: Multiple ABIs, Prev: Simple Example, Up: Using libffi
|
||||
|
||||
2.3 Types
|
||||
=========
|
||||
|
||||
* Menu:
|
||||
|
||||
* Primitive Types:: Built-in types.
|
||||
* Structures:: Structure types.
|
||||
* Type Example:: Structure type example.
|
||||
|
||||
|
||||
File: libffi.info, Node: Primitive Types, Next: Structures, Up: Types
|
||||
|
||||
2.3.1 Primitive Types
|
||||
---------------------
|
||||
|
||||
`Libffi' provides a number of built-in type descriptors that can be
|
||||
used to describe argument and return types:
|
||||
|
||||
`ffi_type_void'
|
||||
The type `void'. This cannot be used for argument types, only for
|
||||
return values.
|
||||
|
||||
`ffi_type_uint8'
|
||||
An unsigned, 8-bit integer type.
|
||||
|
||||
`ffi_type_sint8'
|
||||
A signed, 8-bit integer type.
|
||||
|
||||
`ffi_type_uint16'
|
||||
An unsigned, 16-bit integer type.
|
||||
|
||||
`ffi_type_sint16'
|
||||
A signed, 16-bit integer type.
|
||||
|
||||
`ffi_type_uint32'
|
||||
An unsigned, 32-bit integer type.
|
||||
|
||||
`ffi_type_sint32'
|
||||
A signed, 32-bit integer type.
|
||||
|
||||
`ffi_type_uint64'
|
||||
An unsigned, 64-bit integer type.
|
||||
|
||||
`ffi_type_sint64'
|
||||
A signed, 64-bit integer type.
|
||||
|
||||
`ffi_type_float'
|
||||
The C `float' type.
|
||||
|
||||
`ffi_type_double'
|
||||
The C `double' type.
|
||||
|
||||
`ffi_type_uchar'
|
||||
The C `unsigned char' type.
|
||||
|
||||
`ffi_type_schar'
|
||||
The C `signed char' type. (Note that there is not an exact
|
||||
equivalent to the C `char' type in `libffi'; ordinarily you should
|
||||
either use `ffi_type_schar' or `ffi_type_uchar' depending on
|
||||
whether `char' is signed.)
|
||||
|
||||
`ffi_type_ushort'
|
||||
The C `unsigned short' type.
|
||||
|
||||
`ffi_type_sshort'
|
||||
The C `short' type.
|
||||
|
||||
`ffi_type_uint'
|
||||
The C `unsigned int' type.
|
||||
|
||||
`ffi_type_sint'
|
||||
The C `int' type.
|
||||
|
||||
`ffi_type_ulong'
|
||||
The C `unsigned long' type.
|
||||
|
||||
`ffi_type_slong'
|
||||
The C `long' type.
|
||||
|
||||
`ffi_type_longdouble'
|
||||
On platforms that have a C `long double' type, this is defined.
|
||||
On other platforms, it is not.
|
||||
|
||||
`ffi_type_pointer'
|
||||
A generic `void *' pointer. You should use this for all pointers,
|
||||
regardless of their real type.
|
||||
|
||||
Each of these is of type `ffi_type', so you must take the address
|
||||
when passing to `ffi_prep_cif'.
|
||||
|
||||
|
||||
File: libffi.info, Node: Structures, Next: Type Example, Prev: Primitive Types, Up: Types
|
||||
|
||||
2.3.2 Structures
|
||||
----------------
|
||||
|
||||
Although `libffi' has no special support for unions or bit-fields, it
|
||||
is perfectly happy passing structures back and forth. You must first
|
||||
describe the structure to `libffi' by creating a new `ffi_type' object
|
||||
for it.
|
||||
|
||||
-- ffi_type:
|
||||
The `ffi_type' has the following members:
|
||||
`size_t size'
|
||||
This is set by `libffi'; you should initialize it to zero.
|
||||
|
||||
`unsigned short alignment'
|
||||
This is set by `libffi'; you should initialize it to zero.
|
||||
|
||||
`unsigned short type'
|
||||
For a structure, this should be set to `FFI_TYPE_STRUCT'.
|
||||
|
||||
`ffi_type **elements'
|
||||
This is a `NULL'-terminated array of pointers to `ffi_type'
|
||||
objects. There is one element per field of the struct.
|
||||
|
||||
|
||||
File: libffi.info, Node: Type Example, Prev: Structures, Up: Types
|
||||
|
||||
2.3.3 Type Example
|
||||
------------------
|
||||
|
||||
The following example initializes a `ffi_type' object representing the
|
||||
`tm' struct from Linux's `time.h'.
|
||||
|
||||
Here is how the struct is defined:
|
||||
|
||||
struct tm {
|
||||
int tm_sec;
|
||||
int tm_min;
|
||||
int tm_hour;
|
||||
int tm_mday;
|
||||
int tm_mon;
|
||||
int tm_year;
|
||||
int tm_wday;
|
||||
int tm_yday;
|
||||
int tm_isdst;
|
||||
/* Those are for future use. */
|
||||
long int __tm_gmtoff__;
|
||||
__const char *__tm_zone__;
|
||||
};
|
||||
|
||||
Here is the corresponding code to describe this struct to `libffi':
|
||||
|
||||
{
|
||||
ffi_type tm_type;
|
||||
ffi_type *tm_type_elements[12];
|
||||
int i;
|
||||
|
||||
tm_type.size = tm_type.alignment = 0;
|
||||
tm_type.elements = &tm_type_elements;
|
||||
|
||||
for (i = 0; i < 9; i++)
|
||||
tm_type_elements[i] = &ffi_type_sint;
|
||||
|
||||
tm_type_elements[9] = &ffi_type_slong;
|
||||
tm_type_elements[10] = &ffi_type_pointer;
|
||||
tm_type_elements[11] = NULL;
|
||||
|
||||
/* tm_type can now be used to represent tm argument types and
|
||||
return types for ffi_prep_cif() */
|
||||
}
|
||||
|
||||
|
||||
File: libffi.info, Node: Multiple ABIs, Next: The Closure API, Prev: Types, Up: Using libffi
|
||||
|
||||
2.4 Multiple ABIs
|
||||
=================
|
||||
|
||||
A given platform may provide multiple different ABIs at once. For
|
||||
instance, the x86 platform has both `stdcall' and `fastcall' functions.
|
||||
|
||||
`libffi' provides some support for this. However, this is
|
||||
necessarily platform-specific.
|
||||
|
||||
|
||||
File: libffi.info, Node: The Closure API, Prev: Multiple ABIs, Up: Using libffi
|
||||
|
||||
2.5 The Closure API
|
||||
===================
|
||||
|
||||
`libffi' also provides a way to write a generic function - a function
|
||||
that can accept and decode any combination of arguments. This can be
|
||||
useful when writing an interpreter, or to provide wrappers for
|
||||
arbitrary functions.
|
||||
|
||||
This facility is called the "closure API". Closures are not
|
||||
supported on all platforms; you can check the `FFI_CLOSURES' define to
|
||||
determine whether they are supported on the current platform.
|
||||
|
||||
Because closures work by assembling a tiny function at runtime, they
|
||||
require special allocation on platforms that have a non-executable
|
||||
heap. Memory management for closures is handled by a pair of functions:
|
||||
|
||||
-- Function: void *ffi_closure_alloc (size_t SIZE, void **CODE)
|
||||
Allocate a chunk of memory holding SIZE bytes. This returns a
|
||||
pointer to the writable address, and sets *CODE to the
|
||||
corresponding executable address.
|
||||
|
||||
SIZE should be sufficient to hold a `ffi_closure' object.
|
||||
|
||||
-- Function: void ffi_closure_free (void *WRITABLE)
|
||||
Free memory allocated using `ffi_closure_alloc'. The argument is
|
||||
the writable address that was returned.
|
||||
|
||||
Once you have allocated the memory for a closure, you must construct
|
||||
a `ffi_cif' describing the function call. Finally you can prepare the
|
||||
closure function:
|
||||
|
||||
-- Function: ffi_status ffi_prep_closure_loc (ffi_closure *CLOSURE,
|
||||
ffi_cif *CIF, void (*FUN) (ffi_cif *CIF, void *RET, void
|
||||
**ARGS, void *USER_DATA), void *USER_DATA, void *CODELOC)
|
||||
Prepare a closure function.
|
||||
|
||||
CLOSURE is the address of a `ffi_closure' object; this is the
|
||||
writable address returned by `ffi_closure_alloc'.
|
||||
|
||||
CIF is the `ffi_cif' describing the function parameters.
|
||||
|
||||
USER_DATA is an arbitrary datum that is passed, uninterpreted, to
|
||||
your closure function.
|
||||
|
||||
CODELOC is the executable address returned by `ffi_closure_alloc'.
|
||||
|
||||
FUN is the function which will be called when the closure is
|
||||
invoked. It is called with the arguments:
|
||||
CIF
|
||||
The `ffi_cif' passed to `ffi_prep_closure_loc'.
|
||||
|
||||
RET
|
||||
A pointer to the memory used for the function's return value.
|
||||
FUN must fill this, unless the function is declared as
|
||||
returning `void'.
|
||||
|
||||
ARGS
|
||||
A vector of pointers to memory holding the arguments to the
|
||||
function.
|
||||
|
||||
USER_DATA
|
||||
The same USER_DATA that was passed to `ffi_prep_closure_loc'.
|
||||
|
||||
`ffi_prep_closure_loc' will return `FFI_OK' if everything went ok,
|
||||
and something else on error.
|
||||
|
||||
After calling `ffi_prep_closure_loc', you can cast CODELOC to the
|
||||
appropriate pointer-to-function type.
|
||||
|
||||
You may see old code referring to `ffi_prep_closure'. This function
|
||||
is deprecated, as it cannot handle the need for separate writable and
|
||||
executable addresses.
|
||||
|
||||
|
||||
File: libffi.info, Node: Missing Features, Next: Index, Prev: Using libffi, Up: Top
|
||||
|
||||
3 Missing Features
|
||||
******************
|
||||
|
||||
`libffi' is missing a few features. We welcome patches to add support
|
||||
for these.
|
||||
|
||||
* There is no support for calling varargs functions. This may work
|
||||
on some platforms, depending on how the ABI is defined, but it is
|
||||
not reliable.
|
||||
|
||||
* There is no support for bit fields in structures.
|
||||
|
||||
* The closure API is
|
||||
|
||||
* The "raw" API is undocumented.
|
||||
|
||||
|
||||
File: libffi.info, Node: Index, Prev: Missing Features, Up: Top
|
||||
|
||||
Index
|
||||
*****
|
||||
|
||||
| ||||