Comparar commits

..

216 Commits

Autor SHA1 Mensagem Data
Timothy Wall 3b72073367 create tag
git-svn-id: https://svn.java.net/svn/jna~svn/tags/3.0@447 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2008-01-14 18:35:20 +00:00
Timothy Wall ff12099078 update jars
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@446 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2008-01-14 18:25:46 +00:00
Timothy Wall 4068c6da1a Fix bug in nested struct array read/write
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@445 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2008-01-14 17:56:16 +00:00
Timothy Wall 2f839a41c0 update jars
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@444 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2008-01-14 17:27:22 +00:00
Timothy Wall d9c13aefe3 update javadoc
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@443 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2008-01-14 17:26:28 +00:00
Timothy Wall 7bfa1c27bf improve javadoc
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@442 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2008-01-14 17:25:03 +00:00
Timothy Wall f6986352ee improve javadoc
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@441 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2008-01-14 17:20:33 +00:00
Timothy Wall 2eb51bbb13 Improve error messages when illegal argument/return types are used
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@440 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2008-01-14 16:59:37 +00:00
Timothy Wall 77ef1e75c8 Fix bug in callback proxy.equals (wolfgang.roekelein)
Clean up some javadoc

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@439 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2008-01-04 13:48:42 +00:00
Timothy Wall ae11a9d77c Fix JNLP class loader method lookup
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@438 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2008-01-04 05:01:30 +00:00
Timothy Wall 30648be2ed fix FFIType.size_t ctor signatore
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@437 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2008-01-03 19:00:57 +00:00
Timothy Wall e5958a2a15 Fix bug in stdcall function mapping when using struct by value
Defer size_t/off_t definition, for now

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@436 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2008-01-03 18:37:38 +00:00
Timothy Wall 8d3b41ea4d Consolidate Structure.ByReference reads
Cache native library options as well as alignments/type mappers
Ensure library options are passed to callbacks
Add protection around remaining Pointer read/write calls
Consolidate wide character reads/writes
Avoid stack overflow reading self-referential structures or loops
More prettification of Structure.toString
Add size_t/off_t standard types

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@435 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-27 15:53:49 +00:00
Timothy Wall 2d7f82af75 Fix NPE when sizing struct with a struct array field
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@434 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-21 15:25:05 +00:00
Timothy Wall 9c93a94834 Update linux-amd64 native
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@433 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-21 02:25:15 +00:00
Timothy Wall 13a9861d18 Avoid NPE in toString
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@432 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-20 21:16:27 +00:00
Timothy Wall f7d1a91aad Allow array of struct by reference as argument
Pretty-print structure info in toString

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@431 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-20 21:08:14 +00:00
Timothy Wall 121b8e0a64 Fix VM crash running test under linux-amd64
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@430 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-20 14:44:25 +00:00
Timothy Wall 36ebf4a034 Properly handle default boolean mapping (int) in Structure read/write
Provide Pointer.share(offset) (allow omission of 'size')

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@429 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-19 17:02:45 +00:00
Timothy Wall 0a752616b7 Fix arg/result handling for callback values in callbacks
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@428 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-18 15:51:53 +00:00
Timothy Wall edd21a959b update javadoc
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@427 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-18 04:02:41 +00:00
Timothy Wall dfe9779401 update jars
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@426 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-18 04:02:11 +00:00
Timothy Wall d64bc68562 Move w32 JAWT load into native code
Fix Structure.ByValue for callback arg/return
Perform better type checking on callback arg/return types
Propagate library/symbol lookup error messages
Enable loading of libraries with non-ascii names
Tighten type checking in native code

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@425 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-18 03:30:35 +00:00
Timothy Wall f29a57ceb2 update with w32 JAWT workaround
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@424 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-16 12:01:42 +00:00
Timothy Wall 529c8e36f2 reinstate w32 JAWT workaround; tests work without it, but demo code doesn't
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@423 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-16 12:00:57 +00:00
Timothy Wall 108abcdec4 update jars
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@422 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-16 11:48:10 +00:00
Timothy Wall 1ae7d8373f Consolidate structure ffi type info initialization and avoid premature GC
Enable union by-value by using largest field's type info
Explicitly throw IllegalArgument on bad type info
Throw IllegalState on missing type info
Explicitly write version/md5 info into Makefile from ant (to avoid platform-specific variances in sed)
Make Structure.ByValue/ByReference public to allow client code comparisons
Consolidate Structure field get/set operations
Avoid extra Pointer peer lookup from native code (wmeissner)

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@421 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-16 11:04:12 +00:00
Timothy Wall 8eb4860ec6 Add explicit test for JNA load under headless environment
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@420 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-12 21:46:18 +00:00
Timothy Wall 7ae188c42b update w32 jar and universal jar (defer toolkit load)
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@419 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-12 21:29:48 +00:00
Timothy Wall 125a65ee8a defer AWT toolkit initialization until actual JAWT use
Make w32 dynamically load JAWT to avoid forcing toolkit init on JNA load

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@418 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-12 21:26:37 +00:00
Timothy Wall 98c3353a07 update jars
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@417 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-12 16:26:16 +00:00
Timothy Wall 683ba59fae update javadoc
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@416 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-12 16:17:58 +00:00
Timothy Wall 38abd739d3 update jars
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@415 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-12 16:15:47 +00:00
Timothy Wall df58c84b5a Embed version and checksum into native library
Print version information for 'java -jar jna.jar'

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@414 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-12 15:59:28 +00:00
Timothy Wall 513bb215db Close JAWT library if it's been opened
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@413 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-12 15:35:57 +00:00
Timothy Wall 77be329ed0 Avoid error loading JAWT when running headless
Use primary colors in window shape test (Dan)

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@412 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-12 15:30:27 +00:00
Timothy Wall 1f223fbe13 Auto-include web start lib path if jnidispatch is a <nativelib>
Invalidate platform jars when native API changes

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@411 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-10 15:28:26 +00:00
Timothy Wall c6a21ab661 update jar, doc, src
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@410 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-09 17:42:55 +00:00
Timothy Wall 6d59f0bd3f provide memory alignment to Memory if requested
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@409 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-09 17:32:57 +00:00
Timothy Wall 74972e267a fix typos
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@408 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-09 16:36:35 +00:00
Timothy Wall 6c2134ba0e clean up typos
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@407 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-09 16:05:25 +00:00
Timothy Wall 7bf53b0588 update docs
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@406 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-09 15:46:41 +00:00
Timothy Wall eaff635df5 clean up JavaDoc
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@405 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-09 15:41:59 +00:00
Timothy Wall 88ad275b44 Provide for tweaking of invocation handling between interface and native
Add test for annotation preservation in proxy methods
Add explicit global variable lookup
Add utility method to determine Web Start native library location

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@404 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-09 04:33:00 +00:00
Timothy Wall fe6143ca49 Fix Memory ctor signature
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@403 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-08 14:58:07 +00:00
Timothy Wall 724432aa02 fix broken anchor
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@402 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-04 15:23:43 +00:00
Wayne Meissner 9686a4b1bd Add a hack for OpenJDK (Soylatte) on macosx - System.mapLibraryName() returns a .dylib extension now, not .jnilib.
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@401 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-03 23:45:10 +00:00
Timothy Wall 7f8fab8ec0 update dist files
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@400 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-03 07:15:14 +00:00
Timothy Wall 5a985a143b update
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@399 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-02 15:39:55 +00:00
Timothy Wall f9154f8c2e update javadoc
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@398 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-01 06:44:10 +00:00
Timothy Wall 287879a7f5 add struct by value notes
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@397 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-01 06:18:30 +00:00
Timothy Wall 3c82302545 make color-checking on OSX more robust
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@396 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-01 06:09:02 +00:00
Timothy Wall b331783c01 implement struct by value
add missing Pointer char function

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@395 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-12-01 05:45:36 +00:00
Timothy Wall 1882210db4 Remove obsolete target
Canonicalize x86 ARCH settings
FreeBSD no longer needs pthread linkage

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@394 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-29 13:50:28 +00:00
Timothy Wall 12bd185a9b Fix clover target
Omit embedded timestamp from javadoc
Set ARCH flag for amd64 build (Dan/bha)

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@393 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-29 13:49:13 +00:00
Timothy Wall 3dbaa7984f Use simpler workaround for loading AWT/JAWT on X11-based platforms
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@392 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-28 19:48:14 +00:00
Timothy Wall 40f00b1dcb Fix bug checking IntegerType limits
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@391 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-28 17:27:42 +00:00
Timothy Wall 98bb38cb03 clean up kernel32 handling
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@390 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-28 02:38:48 +00:00
Timothy Wall e1b4c8d616 update main page
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@389 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-27 17:05:54 +00:00
Timothy Wall 5d7c015348 fix non-universal builds on darwin
keep warning flags for mingw32 builds

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@388 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-27 14:25:23 +00:00
Timothy Wall a90e7c82b3 synch libffi with http://gcc.gnu.org/svn/gcc/trunk/libffi@130462 (adds mingw32ce support)
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@387 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-27 07:17:11 +00:00
Timothy Wall 6c0c9e7d7c ensure JNA library can be unloaded
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@384 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-26 20:26:51 +00:00
Timothy Wall 461b35f6ef update platform jars
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@383 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-15 06:51:35 +00:00
Timothy Wall 81ca040918 fix indexOf return value
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@382 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-15 06:25:36 +00:00
Timothy Wall 5dc6bfb195 use long offsets and sizes for pointer arithmetic
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@381 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-15 04:51:16 +00:00
Timothy Wall b0d3657e56 clean up new libffi files
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@380 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-15 04:47:49 +00:00
Timothy Wall 822913c85f remove obsolete native files
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@379 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-15 04:45:20 +00:00
Timothy Wall ce0ac250e1 update ignored files
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@378 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-15 04:43:58 +00:00
Timothy Wall 22e98986e5 set mime type
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@377 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-13 18:16:07 +00:00
Timothy Wall 3f7fc39362 Add expect test for stdcall closures
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@376 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-08 23:08:48 +00:00
Timothy Wall 024c845d06 update examples jar
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@375 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-08 19:35:19 +00:00
Timothy Wall 4bb1e29cf3 Add w32 keyboard hook to contrib
Add more w32 API (user32)

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@374 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-08 19:34:06 +00:00
Timothy Wall fa7bdc4fcd Add explicit check for correct stdcall stack pointer
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@373 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-08 19:00:18 +00:00
Timothy Wall ab0708340c update w32 native bits
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@372 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-08 18:41:22 +00:00
Timothy Wall 34723a2e17 update change log
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@371 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-08 18:40:00 +00:00
Timothy Wall d4c4d2bb13 Fix stdcall callbacks
catch all exceptions when invoking callback

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@370 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-08 18:38:24 +00:00
Timothy Wall 80090df8e4 Fix NPE on non-windows platforms
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@369 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-07 01:15:30 +00:00
Timothy Wall 05dc68db7b fix obsolete import
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@368 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-06 04:49:12 +00:00
Timothy Wall 1bcde2cbf2 Allow constant pointer definition
Add multiple watches to file monitor test

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@367 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-05 17:19:28 +00:00
Timothy Wall 9a5f5851ba Perform additionl null pointer checks
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@366 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-05 15:39:52 +00:00
Timothy Wall 8c7152bb9f enable crash protection on freebsd
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@365 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-01 20:35:07 +00:00
Timothy Wall 5580e39447 update Structure.toArray usage
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@364 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-01 13:40:22 +00:00
Timothy Wall f29d58c0f0 Update toArray usage
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@363 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-01 13:39:00 +00:00
Timothy Wall d69e62363e remove jnlp files
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@362 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-01 13:32:16 +00:00
Timothy Wall 0e0af9dcaa dev.java.net won't serve jar files properly
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@361 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-01 13:29:35 +00:00
Timothy Wall 85fee142b3 Fix jnlp links
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@360 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-01 13:26:08 +00:00
Timothy Wall a1b5a934f4 Use proper server link
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@359 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-01 13:06:41 +00:00
Timothy Wall 996b533634 Fix demo server link
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@358 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-11-01 13:06:08 +00:00
Timothy Wall 11fab2e58e update demos
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@357 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-30 19:12:28 +00:00
Timothy Wall 437df3b6d4 fix projects list
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@356 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-30 15:15:05 +00:00
Timothy Wall 663c2fdbac update javadoc
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@355 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-30 14:59:05 +00:00
Timothy Wall 4eb0e9f8aa more javadoc tweaks
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@354 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-30 14:57:53 +00:00
Timothy Wall 00a17b60f8 update javadoc
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@353 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-30 14:48:30 +00:00
Timothy Wall fb5f00db61 update docs
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@352 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-30 14:38:43 +00:00
Timothy Wall 0105055c3e Don't keep a strong reference to the library proxy
Keep a mapping for the proxy on calls to loadLibrary
Don't fail if no alpha on shaped window demo
Clean up a few comments

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@351 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-30 14:32:31 +00:00
Timothy Wall efe147b731 update structure/union notes
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@350 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-30 14:28:51 +00:00
Timothy Wall 9585302dc5 clean up symmetry on ToNative/FromNative contexts
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@349 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-29 15:11:01 +00:00
Timothy Wall 7432c0775b Clean up ant build script targets
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@348 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-29 14:35:02 +00:00
Timothy Wall 8666ac7b85 Clean up temp files on w32
Avoid empty paths in search list
Add canonical 'out-of-date' jar
Clean up ant build script targets

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@347 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-29 14:34:10 +00:00
Timothy Wall 827cbfd03c disable out-of-date native bits
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@346 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-29 13:25:44 +00:00
Timothy Wall 64a5e8f236 Don't need new specs under mingw; was due to faulty installation
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@345 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-29 13:23:28 +00:00
Timothy Wall 6a60315011 build with glibc 2.3.5 (from Red Hat FC4)
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@344 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-28 21:30:01 +00:00
Timothy Wall a234334f69 Fix javadoc error
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@343 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-27 22:24:04 +00:00
Timothy Wall d71acbd909 update jnlp files
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@342 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-27 22:20:07 +00:00
Timothy Wall 33e672d135 add platform notes
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@341 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-27 16:35:57 +00:00
Timothy Wall a26a696e34 Allow ByReference types in callbacks
Clean up some Structure field error messages

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@340 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-26 14:51:24 +00:00
Wayne Meissner c63827d5a0 Updated i386-freebsd build
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@339 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-20 12:09:38 +00:00
Timothy Wall 998f9f6ad0 add notes for loadLibrary options map
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@338 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-19 01:51:03 +00:00
Timothy Wall 0e188d3bff Show drop shadow on OSX BalloonManager
Fix NPE on OSX BalloonManager

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@337 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-17 13:27:37 +00:00
Timothy Wall 4a0867c5f2 add comments on library loading
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@336 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-17 12:41:16 +00:00
Timothy Wall 4fb1955303 Attempt load using System.loadLibrary before extracting
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@335 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-17 12:40:32 +00:00
Timothy Wall ef202cd8b8 update w32 files
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@334 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-16 14:28:50 +00:00
Timothy Wall 3648b4539b fix failure messages in demo
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@333 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-16 14:28:18 +00:00
Timothy Wall b78ac9355a Allocate executable memory for callbacks on w32
Synchronize on java callback allocation methods to avoid more complex native synchronization

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@332 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-16 14:28:00 +00:00
Timothy Wall f023994074 library suffix required on w32
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@331 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-16 14:20:31 +00:00
Timothy Wall a47e77bdf9 skip trash test if system has no apparent trash
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@330 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-16 13:12:35 +00:00
Timothy Wall 13773c267d update linux-i386 components (glibc 2.3.6)
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@329 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-16 13:09:41 +00:00
Timothy Wall deccbf6d9a extract integer type with platform-specific size
remove temporary file suffix altogether

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@328 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-16 12:57:11 +00:00
Timothy Wall ec1f92c16a update test to proper native signature
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@327 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-15 21:25:48 +00:00
Timothy Wall 5436e605b0 Fix wchar_t* return when null
Allow Pointer[] as function argument
Fix window utils test on osx to avoid os-cast shadows

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@326 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-11 22:42:14 +00:00
Timothy Wall 949ae6a7aa add missing files
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@325 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-11 19:27:43 +00:00
Timothy Wall b957c563c6 update javadoc
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@324 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-11 19:24:43 +00:00
Timothy Wall 36c73e1d64 make memory share public
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@323 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-05 20:28:30 +00:00
Timothy Wall d8f0925466 auto-copy native library into eclipse build area
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@322 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-04 17:15:58 +00:00
Timothy Wall 77d1b2f648 Remove unused code
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@321 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-04 14:37:57 +00:00
Timothy Wall 7a82dd3baf Fix X11 keyboard test (XQueryKeymap result is not documented)
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@320 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-04 14:35:31 +00:00
Timothy Wall 7c5573199f Add explicit license file
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@319 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-03 19:18:03 +00:00
Timothy Wall 55146b70bd name license by specific version
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@318 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-03 19:17:37 +00:00
Timothy Wall c2a26458e8 Fix test failure if default encoding doesn't support extended ASCII (fall back to testing just ASCII)
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@317 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-02 13:42:38 +00:00
Timothy Wall 6be895f83c change contact address for contributions
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@316 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-10-01 00:55:02 +00:00
Timothy Wall fcae79eb9a Show proper mapping for w32 function which accepts either integer or pointer types in a given argument
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@315 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-30 00:32:13 +00:00
Timothy Wall 9a342d979f Allow lookup of OSX framework libraries by name
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@314 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-30 00:29:38 +00:00
Timothy Wall a48a7c321d Throw UnsupportedOperationException when alpha not available and explain why, if possible
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@313 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-30 00:28:01 +00:00
Timothy Wall fd167bc19f Fix swing threading violation in test
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@312 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-30 00:13:55 +00:00
Timothy Wall 11f794c9df Clean up Structure.toArray usage
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@311 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-30 00:12:56 +00:00
Timothy Wall 30b353fabe Make test build target fail if any tests fail
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@310 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-26 12:50:46 +00:00
Timothy Wall 61590a115c Remove unused locals
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@309 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-26 00:02:26 +00:00
Timothy Wall 982dfbdd61 Use specific structure type in toArray
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@308 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-25 23:59:31 +00:00
Timothy Wall 9a5605f5de update main page
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@307 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-23 02:12:12 +00:00
Timothy Wall 5d62055838 Fix compilation error in file monitor example
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@306 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-20 19:51:49 +00:00
Timothy Wall 3e886a8a5b Provide optional library synchronization
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@305 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-20 19:27:57 +00:00
Timothy Wall eb1d4736b0 clean up w32 libs to use HANDLE instead of Pointer
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@304 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-19 02:00:59 +00:00
Timothy Wall affcdf49f9 Fix crash in service stop, fix callback signature
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@303 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-18 09:32:30 +00:00
Timothy Wall 06a4a3f8af Fix failing argument marshal test
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@302 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-16 06:23:20 +00:00
Timothy Wall eb58d23656 update darwin components
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@301 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-15 18:26:52 +00:00
Timothy Wall ed2ee11af8 update w32 jars
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@300 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-15 18:13:39 +00:00
Timothy Wall 6ed833bf28 Fix GetLastError bug
Make ByReference derive from Memory

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@299 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-15 18:12:05 +00:00
Timothy Wall 196e8af786 File missed in last patch
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@298 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-14 18:52:00 +00:00
Timothy Wall 17aafbc595 Allow Pointer[] as field in Structure
Clean up error messages when Structure size calculation fails

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@297 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-14 15:48:28 +00:00
Timothy Wall 1dcf8cf36c update ntservice README
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@296 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-13 20:35:08 +00:00
Timothy Wall 3fc6bc7e53 Don't wrap null pointers in PointerType
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@295 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-13 00:40:44 +00:00
Timothy Wall fce337b823 Fix 1.4 compile error
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@294 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-13 00:39:42 +00:00
Timothy Wall 6e3c4a856c Add NT service implementation from boerkel
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@293 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-12 15:51:31 +00:00
Timothy Wall 05f44f3c62 Ensure TCHAR*[] gets encoded properly on w32, wchar_t*[] on others
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@292 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-12 15:13:13 +00:00
Timothy Wall d609eed733 include build.xml in source zip
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@291 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-11 01:49:27 +00:00
Timothy Wall 65c4e6ad94 fix stdcall stack sizing for NativeMapped
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@290 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-11 01:49:14 +00:00
Timothy Wall 6fc11568c0 Add docs/src zips
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@289 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-10 18:10:41 +00:00
Timothy Wall 494aa6e090 Fix html formatting
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@288 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-10 15:23:43 +00:00
Timothy Wall abab91748c Add projects list
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@287 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-10 15:22:24 +00:00
Timothy Wall f86ef41980 update jars for darwin, linux, w32
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@286 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-10 14:56:20 +00:00
Timothy Wall a22191c1fb clean up type mapping table
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@285 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-10 14:39:31 +00:00
Timothy Wall db2a6b239e clarify contributions on web page
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@284 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-10 14:25:02 +00:00
Timothy Wall 25726a3df9 Enable callback return values (e.g. sig_t signal(int sig, sig_t f))
Move native function proxy wrapping to CallbackReference from Structure

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@283 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-07 23:49:44 +00:00
Timothy Wall a95c4d673d Fix string decoding bug, add tests
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@282 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-07 20:10:34 +00:00
Wayne Meissner b6b53d7b83 Fix solaris build
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@281 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-07 01:43:59 +00:00
Timothy Wall 573a5c6a53 update javadoc
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@280 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-06 18:07:54 +00:00
Timothy Wall 7db8868043 Enable VM crash protection on w32, linux
Move native library init from Pointer to Native
Fix Pointer.setNativeLong bug
Make library initialization explicit in Pointer/NativeLibrary
Javadoc cleanup

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@279 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-06 17:36:33 +00:00
Timothy Wall 7ee89a6e1d Remove ^Z from keyboard test, since it may suspend the test
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@278 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-06 15:48:53 +00:00
Timothy Wall 5e22b1cd27 Remove check for Library interface in Library.Handler
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@277 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-05 14:21:36 +00:00
Wayne Meissner 2e5eee5092 Native.loadLibrary() no longer requires interface classes to extend Library.
If this breaks anything, blame Charles Nutter :-)


git-svn-id: https://svn.java.net/svn/jna~svn/trunk@276 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-05 06:33:11 +00:00
Wayne Meissner b341608130 Missed during ToNativeConverter modifications
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@275 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-05 03:30:17 +00:00
Wayne Meissner e6e8ffb1c3 Updated build
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@274 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-05 02:37:02 +00:00
Wayne Meissner 60c851972e Start on issue #38. Main thing I wanted to do was get the second parameter to ToNativeConverter.toNative() in there so we don't have future API breakage by adding it later.
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@273 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-05 01:45:18 +00:00
Wayne Meissner dcfc552254 Build on Ubuntu 6.06.1 with glibc-2.3.6
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@272 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-05 00:41:28 +00:00
Timothy Wall 8bb92f5c19 Use type-safe pointers for w32 APIs
Simplify type-safe pointer declarations

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@271 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-04 16:17:10 +00:00
Timothy Wall 0ca338ade0 clarify intro
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@270 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-04 13:44:49 +00:00
Timothy Wall 272424d379 Fix javadoc link (frames don't show up)
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@269 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-04 13:26:38 +00:00
Wayne Meissner 6d72f33da7 Revert r266 - Integer.valueOf() and friends are 1.5+ features, so it
breaks 1.4 support



git-svn-id: https://svn.java.net/svn/jna~svn/trunk@268 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-04 12:45:58 +00:00
Wayne Meissner c0fab06356 Use the full path to /usr/bin/libtool - macports installs GNU libtool in the path before /usr/bin/libtool.
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@267 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-04 06:01:54 +00:00
Wayne Meissner 1423a7ce91 Implement (most of) the fixes from issue #35.
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@266 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-04 04:26:22 +00:00
Wayne Meissner 053a432804 Fixup library searching for 32bit VM on 64bit OS scenarios
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@265 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-03 12:08:50 +00:00
Wayne Meissner f50129baa3 Build for FreeBSD/i386
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@264 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-03 09:17:18 +00:00
Wayne Meissner 9150e8f188 Don't try to use the library extension as the suffix. System.load()
doesn't appear to care what the library you tell it to load is called.

Could be a possible source of why it won't load on multi-byte charsets 
under windows.



git-svn-id: https://svn.java.net/svn/jna~svn/trunk@263 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-03 08:26:29 +00:00
Wayne Meissner b637ab3ceb Pass the Method of the Library subclass that invoked the Function, to the FromNativeConverter.
Also optimized the code in Library.Handler so only one Map lookup per function invoke is needed.

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@262 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-03 08:09:06 +00:00
Wayne Meissner 32d38dd876 Native build for Solaris/sparc
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@261 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-03 08:05:26 +00:00
Wayne Meissner a04f4bd4b2 Unbreak 64bit sparc support
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@260 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-03 07:32:44 +00:00
Wayne Meissner ad68219568 Ensure the NativeLibrary does not get prematurely garbage collected when using something like:
Function f = NativeLibrary.getInstance("c").getFunction("printf");



git-svn-id: https://svn.java.net/svn/jna~svn/trunk@259 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-03 06:25:46 +00:00
Timothy Wall af117d810d Clean up tests
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@258 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-03 03:53:34 +00:00
Timothy Wall 5d764abdc6 Add auto-conversion for custom types
Fix X11 lib for 64-bit use

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@257 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-03 01:20:52 +00:00
Timothy Wall a9e9c69265 Update webpage and javadoc
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@256 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-03 01:15:30 +00:00
Wayne Meissner 461e86eb82 64bit fixes, and add local queue.h for solaris builds
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@255 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-03 00:49:44 +00:00
Wayne Meissner 7e87ffa0fd Fix int32 definition for 64bit arches
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@254 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-02 23:34:14 +00:00
Timothy Wall 7bfa698796 update docs
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@253 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-01 07:34:20 +00:00
Timothy Wall 285f64ed62 update docs
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@252 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-01 07:28:26 +00:00
Timothy Wall b13b1d7b70 update docs
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@251 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-01 07:23:58 +00:00
Timothy Wall 212e0cd812 update docs
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@250 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-09-01 07:23:14 +00:00
Timothy Wall 589a8e101d update main page
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@249 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-08-31 18:52:34 +00:00
Timothy Wall b8b4169b1a update main page
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@248 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-08-31 18:33:06 +00:00
Timothy Wall e8aac64083 update main page
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@247 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-08-31 18:27:50 +00:00
Timothy Wall 8e3ae9bb85 Update TODO
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@246 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-08-31 18:18:19 +00:00
Timothy Wall 14a549928f Fix build on darwin-i386
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@245 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-08-31 18:06:03 +00:00
Timothy Wall 83e1fb715e Fix UnsatisfiedLinkError calling toString on a Library interface
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@244 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-08-31 16:44:43 +00:00
Timothy Wall aeeac8e343 Add callback tests for smaller int types
Copy generic java.nio.Buffer support from v3 branch + tests
Copy missed sparc-isms from v3 branch for building sunos variants
Add stubs for platform-specific jars
Include libffi testsuite
Remove /lib64 references as per v3 branch
Auto-generate os prefix from os.name (as per v3 branch) to automatically handle new targets
Update overview to include Buffer, function pointer info
Include src.zip and doc.zip in dist generation

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@243 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-08-31 14:05:06 +00:00
Timothy Wall 5fc6d50486 Avoid wrapping a native callback proxy with a CallbackReference proxy
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@242 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-08-30 16:17:21 +00:00
Timothy Wall edc7c111cb Clean up varargs
Add per-field Structure read/write
Avoid automatic writes to 'volatile' structure fields
Read/wrap function pointers in Structure fields
Disallow Memory/Function as declared Structure fields

git-svn-id: https://svn.java.net/svn/jna~svn/trunk@241 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-08-30 16:04:01 +00:00
Timothy Wall 05a754bc92 Use libffi instead of custom assembly (tested for darwin (universal), linux-i386, win32-x86
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@240 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-08-29 20:19:39 +00:00
Timothy Wall dff58c56fb Remove superfluous exception checks, enable peer access on OSX
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@239 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-08-28 14:54:07 +00:00
Timothy Wall 58709a1d32 Support mingw32 builds
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@238 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-08-28 13:27:22 +00:00
Timothy Wall 554567fa82 Copy issue #25 fix from v3 branch
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@237 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-08-28 13:22:50 +00:00
Timothy Wall 3ad51db9c2 Copy fix for issue #32 from v3 branch
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@236 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-08-28 13:07:04 +00:00
Timothy Wall 007d74ee23 Fix OSX link option
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@188 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-07-30 23:09:50 +00:00
Timothy Wall cd15214d77 Fix javadoc comments
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@187 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-07-30 20:45:43 +00:00
Timothy Wall 32eca24468 Clean up OSX build options
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@186 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-07-30 20:45:13 +00:00
Timothy Wall a96e25ef5d fix broken link
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@185 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-07-24 18:36:05 +00:00
Timothy Wall 5087fb1904 update doc
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@184 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-07-24 18:26:12 +00:00
Timothy Wall 2c4af20cb0 update javadoc for build 2.5
git-svn-id: https://svn.java.net/svn/jna~svn/trunk@183 2f8a963e-d2e4-e7d0-97bf-ccb7fcea9d80
2007-07-24 18:11:27 +00:00
558 arquivos alterados com 123720 adições e 16281 exclusões
+1 -1
Ver Arquivo
@@ -3,6 +3,6 @@
<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.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JDK 1.5.0"/>
<classpathentry kind="output" path="build.eclipse/classes"/>
</classpath>
+62
Ver Arquivo
@@ -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
Ver Arquivo
@@ -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
Ver Arquivo
@@ -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
+148 -89
Ver Arquivo
@@ -1,18 +1,4 @@
# 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:
* 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.
* design:
# 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...
@@ -26,35 +12,77 @@
- 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
# 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)
* OSX ObjC access
* 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.
# TODO
* should structure offsets be "long"?
* allow return of W/String[] or Pointer[], if NULL-terminated?
* Direct buffers should be used where
hotspot inlining can improve performance.
* use libffi closure allocation/deallocation
* parser (gluegen? others?) to auto-generate JNA interfaces from headers;
ideally get the native library build system to output preprocessed headers,
otherwise CPP crap is a nightmare to get right.
* (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).
* 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.
* 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.
* 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.
* 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)
* 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
* 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 +93,87 @@
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.
* provide library load/unload hooks (Runnables in options?). Examples:
o GetLastError (no longer needed)
o WSAInit?
* 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
* 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 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())?
* verify get/set methods vs read/write for performance (Pointer)?
* bitfields for structs (how?)
# DONE
* 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
@@ -157,33 +245,4 @@ void setWindowMask(Window w, Shape clip);
// needs:
int findNativeWindow(Window w);
# 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
+181 -70
Ver Arquivo
@@ -12,7 +12,7 @@
-->
<!-- 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="debug" value="true"/>
@@ -22,26 +22,37 @@
<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 &amp;copy; 2007 ${company.full}. All Rights Reserved."/>
value="Copyright &amp;copy; 2007 Timothy Wall. All Rights Reserved."/>
<!-- JNA library release version -->
<property name="jna.version" value="3.0"/>
<!-- jnidispatch library release version -->
<property name="jni.version" value="3.0"/>
<property name="jni.md5" value="892beacd437514d23ed9b1cefeb2ead6"/>
<property name="spec.title" value="Java Native Access (JNA)"/>
<property name="spec.vendor" value="${vendor}"/>
<property name="spec.version" value="${jna.version}"/>
<property name="impl.title" value="${spec.title}"/>
<property name="impl.vendor" value="${spec.vendor}"/>
<property name="impl.version" value="${spec.version}"/>
<!-- 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"/>
<target name="-dynamic-properties">
<echo>Java version: ${java.version}, compatibility: ${compatibility}</echo>
<echo>JNA version ${jna.version}, native API version ${jni.version}</echo>
<property name="build" value="build"/>
<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"/>
@@ -52,13 +63,17 @@
<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>
<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>
@@ -69,6 +84,7 @@
<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 +95,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">
@@ -100,14 +116,15 @@
<pathelement path="${build}/examples.jar"/>
<pathelement path="${test.classes}"/>
<pathelement path="${ant.home}/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 +143,22 @@
</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="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}"/>
<attribute name="Main-Class" value="com.sun.jna.Native"/>
</manifest>
<fileset dir="${classes}"><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 +169,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 +177,55 @@
<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>
<apply dir="${build.native}" executable="grep" parallel="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">
<equals arg1="${jni.md5}" arg2="${md5}" trim="true"/>
</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}/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}/sunos-x86.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="native" depends="-setup,javah,-native-api-check"
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 various platforms -->
<!-- ARCH is used in native/Makefile to find the JAWT library -->
<condition property="ARCH" value="${os.arch}">
<or>
<os name="SunOS"/>
<os arch="amd64"/>
</or>
</condition>
<condition property="make.CC" value="CC=${CC}" else="IGNORE=">
<isset property="CC"/>
</condition>
@@ -182,11 +238,24 @@
<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">
<os name="FreeBSD"/>
</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}"/>
@@ -194,19 +263,36 @@
<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}"
includes="jnidispatch.dll,libjnidispatch.*"/>
</copy>
<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}"/>
<attribute name="Specification-Version" value="${jni.version}"/>
</manifest>
</jar>
</target>
<target name="compile-tests" depends="compile"
<target name="compile-tests" depends="compile,native"
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}"/>
@@ -215,24 +301,24 @@
<!-- 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"
<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">
<condition property="tests.platform" value="**/win32/*Test.java">
<os family="windows"/>
</condition>
<condition property="tests.unix" value="**/unix/*Test.java">
<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"/>-->
<property name="tests.platform" value=""/>
<junit printsummary="yes" fork="${test.fork}" failureproperty="testfailure">
<jvmarg value="-Djna.library.path=${build.native}"/>
<classpath><path refid="test.runpath"/></classpath>
<formatter type="xml"/>
@@ -240,8 +326,8 @@
<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,14 +338,21 @@
<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"/>
<property name="clover" value="true"/>
<property name="build" value="build.clover"/>
<property name="clover.include" value="**/*.java"/>
<property name="clover.exclude" value="**/examples/**/*.java"/>
<property name="tests.exclude" value="${clover.exclude}"/>
<clover-setup initString="${build}/coverage.db">
<fileset dir="${src}" includes="${clover.include}"/>
<fileset dir="${src}">
<include name="${clover.include}"/>
<exclude name="${clover.exclude}"/>
</fileset>
</clover-setup>
</target>
@@ -275,21 +368,21 @@
<echo>Reports generated in ${reports.clover}</echo>
</target>
<target name="javadoc" depends="setup">
<target name="javadoc" depends="-setup">
<property name="header"
value="&lt;b&gt;JNA API&lt;/&gt;&lt;font size=&quot;-1&quot;&gt; ${version}&lt;/font&gt;"/>
value="&lt;b&gt;JNA API&lt;/&gt;&lt;font size=&quot;-1&quot;&gt; ${jna.version}&lt;/font&gt;"/>
<property name="footer"
value="&lt;center&gt;&lt;i&gt;${copyright}&lt;/i&gt;&lt;/center&gt;"/>
<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 +395,43 @@
</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"
<target name="dist" depends="jar,compile-tests,native,examples,javadoc"
description="Build examples">
<jar jarfile="${dist}/jna.jar" duplicate="preserve">
<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-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"/>
</jar>
<copy todir="${dist}">
<fileset dir="${build}">
@@ -333,23 +439,28 @@
<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>
<zip zipfile="${dist}/src.zip">
<zipfileset dir="." includes="build.xml"/>
<zipfileset dir="${src}" includes="**/*.java" prefix="src"/>
<zipfileset dir="${test.src}" includes="**/*.java" prefix="test"/>
<zipfileset dir="${native}" prefix="native"/>
</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="${javadoc}"/>
<fileset dir="." includes="*~,**/*~"/>
</delete>
</target>
<target name="profile-single" depends="examples-jar" description="Profile Class">
<target name="profile-single" depends="examples" 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>
@@ -364,7 +475,7 @@
</java>
</target>
<target name="profile-test-single" depends="examples-jar,compile-tests"
<target name="profile-test-single" depends="examples,compile-tests"
description="Profile Test Class">
<fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
<nbprofiledirect>
+60
Ver Arquivo
@@ -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).
+69
Ver Arquivo
@@ -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.
+3
Ver Arquivo
@@ -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;
}
}
}
+69
Ver Arquivo
@@ -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);
}
}
BIN
Ver Arquivo
Arquivo binário não exibido.
BIN
Ver Arquivo
Arquivo binário não exibido.
BIN
Ver Arquivo
Arquivo binário não exibido.
externo Arquivo executável
BIN
Ver Arquivo
Arquivo binário não exibido.
externo Arquivo executável → Arquivo normal
BIN
Ver Arquivo
Arquivo binário não exibido.
Arquivo binário não exibido.
externo Arquivo executável → Arquivo normal
BIN
Ver Arquivo
Arquivo binário não exibido.
BIN
Ver Arquivo
Arquivo binário não exibido.
externo Arquivo executável → Arquivo normal
BIN
Ver Arquivo
Arquivo binário não exibido.
externo Arquivo executável
BIN
Ver Arquivo
Arquivo binário não exibido.
externo Arquivo executável
BIN
Ver Arquivo
Arquivo binário não exibido.
BIN
Ver Arquivo
Arquivo binário não exibido.
Arquivo binário não exibido.
BIN
Ver Arquivo
Arquivo binário não exibido.
externo Arquivo executável → Arquivo normal
BIN
Ver Arquivo
Arquivo binário não exibido.
+127 -74
Ver Arquivo
@@ -1,32 +1,47 @@
#
# 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)
# OS X (i386/ppc)
# Linux (i386, amd64)
# Solaris (i386, sparc, sparcv9)
# FreeBSD (i386)
#
# 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/Darwin.*/darwin/g' \
-e 's/Linux.*/linux/g')
VERSION=3.0 # auto-generated by ant
CHECKSUM=892beacd437514d23ed9b1cefeb2ead6 # auto-generated by ant
JAVA_INCLUDES=-I"$(JAVA_HOME)/include" \
-I"$(JAVA_HOME)/include/$(OS)"
LIBDIR=$(JAVA_HOME)/jre/lib/$(ARCH)
BUILD=../build/native
JAVAH=$(BUILD)
INSTALLDIR=../build/$(OS)
ASMDISPATCH_OBJS=$(BUILD)/dispatch_$(ARCH).o
JNIDISPATCH_OBJS=$(BUILD)/dispatch.o \
$(BUILD)/callback.o \
$(ASMDISPATCH_OBJS)
$(BUILD)/callback.o
FFI_SRC=$(shell pwd)/libffi
FFI_BUILD=$(BUILD)/libffi
FFI_LIB=$(FFI_BUILD)/.libs/libffi_convenience.a
FFI_CONFIG=--disable-static --with-pic=yes
LIBRARY=$(BUILD)/$(LIBPFX)jnidispatch$(JNISFX)
TESTLIB=$(BUILD)/$(LIBPFX)testlib$(LIBSFX)
@@ -37,9 +52,6 @@ JNISFX=$(LIBSFX)
CC=gcc
LD=gcc
# 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
CASM=-S
@@ -47,21 +59,23 @@ ifeq ($(DEBUG),true)
CDEBUG=-g
endif
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) $(COPT) $(CDEBUG) $(CDEFINES) $(CINCLUDES) \
-DVERSION='"$(VERSION)"' -DCHECKSUM='"$(CHECKSUM)"'
# -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
# 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
# Uncomment this line to use MSVC (doesn't yet work with libffi)
#CC=cl
ARCH=i386
ARCH=$(shell uname -m | sed 's/i[456]86/i386/g')
ifeq ($(CC),cl)
LD=link
@@ -72,22 +86,20 @@ DBG=d
CDEBUG=-D_DEBUG -GZ -Zi
endif
COUT=-Fo$@
CDEFINES=-DWIN32 -D_WINDOWS -D_MBCS -D_USRDLL -DNATIVE_EXPORTS
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
#LIBS=$(LIBDIR) jawt.lib
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
CDEFINES=-D__int64="long long" -D_JNI_IMPLEMENTATION -DHAVE_PROTECTION
PCFLAGS+=-mno-cygwin
LDFLAGS+=-mno-cygwin -Wl,--add-stdcall-alias
LIBDIR="$(JAVA_HOME)/lib"
LIBS=$(LIBDIR)/jawt.lib
#LIBS=$(LIBDIR)/jawt.lib
endif
LIBPFX=
@@ -95,55 +107,75 @@ LIBSFX=.dll
endif
ifeq ($(OS),linux)
ARCH=i386
ARCH=$(shell uname -m | sed 's/i[456]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
endif
# FIXME untested
ifeq ($(OS),sparc)
ARCH=sparc
ifeq ($(OS),freebsd)
ARCH=$(shell uname -m | sed 's/i[456]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
endif
ifeq ($(OS),solaris)
ifeq ($(ARCH),)
ARCH=$(shell uname -n)
endif
PCFLAGS+=-fPIC
LDFLAGS=-o $@ -G
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
LDFLAGS += -m64
endif
endif
ifeq ($(OS),darwin)
ARCH=$(shell arch)
ifeq ($(ARCH),ppc)
ALT_ARCH=i386
OSX_FFI_CONFIG=--host=i386-apple-darwin --disable-dependency-tracking
else
ALT_ARCH=ppc
OSX_FFI_CONFIG=--host=powerpc-apple-darwin --disable-dependency-tracking
endif
FFI_ALT_BUILD=$(BUILD)/libffi-$(ALT_ARCH)
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
else
ARCHFLAGS=-arch $(ARCH) -isysroot $(SDKROOT)
SYSLIBROOT=-Wl,-syslibroot,$(SDKROOT)
ISYSROOT=-isysroot $(SDKROOT)
ARCHFLAGS=-arch ppc -arch i386
endif
endif
PCFLAGS+=$(ARCHFLAGS)
PCFLAGS+=$(ISYSROOT) -x objective-c
CDEFINES=-DTARGET_RT_MAC_CFM=0
LDFLAGS=$(ARCHFLAGS) -dynamiclib -o $@ -framework JavaVM
LIBDIR=$(SDKROOT)/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Libraries
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
$(BUILD)/%.o : %.c
# 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 two
# 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)
$(CC) -arch $(ALT_ARCH) -I$(FFI_ALT_BUILD)/include $(CFLAGS) -c $< -o $@.$(ALT_ARCH)
lipo -create -output $@ $@.$(ARCH) $@.$(ALT_ARCH)
else
$(CC) $(CFLAGS) -c $< $(COUT)
$(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
endif
all: $(LIBRARY) $(TESTLIB)
@@ -151,17 +183,38 @@ 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)
$(LIBRARY): $(JNIDISPATCH_OBJS) $(FFI_LIB)
$(LD) $(LDFLAGS) $(JNIDISPATCH_OBJS) $(FFI_LIB) $(LIBS)
$(BUILD)/specs.new:
gcc -dumpspecs | sed s%dllcrt2%/lib/mingw/dllcrt2%g > $@
$(LIBRARY): $(JNIDISPATCH_OBJS) $(SPECS)
$(LD) $(LDFLAGS) $(JNIDISPATCH_OBJS) $(LIBS)
$(TESTLIB): $(BUILD)/testlib.o $(SPECS)
$(TESTLIB): $(BUILD)/testlib.o
$(LD) $(LDFLAGS) $< $(TESTDEF)
$(FFI_LIB):
@mkdir -p $(FFI_BUILD)
@if [ ! -f $(FFI_BUILD)/Makefile ]; then \
echo "Configuring libffi ($(ARCH))"; \
(cd $(FFI_BUILD) \
&& CC="$(CC) $(CDEBUG)" $(FFI_SRC)/configure $(FFI_CONFIG)); \
fi
$(MAKE) -C $(FFI_BUILD)
ifneq ($(SDKROOT),)
@mkdir -p $(FFI_ALT_BUILD)
@if [ ! -f $(FFI_ALT_BUILD)/Makefile ]; then \
echo "Configuring libffi ($(ALT_ARCH))"; \
(cd $(FFI_ALT_BUILD) \
&& CFLAGS="-arch $(ALT_ARCH) $(ISYSROOT) $(COPT) $(CDEBUG) $(CDEFINES)" \
LDFLAGS="-arch $(ALT_ARCH)" \
$(FFI_SRC)/configure $(FFI_CONFIG) $(OSX_FFI_CONFIG)); \
fi
$(MAKE) -C $(FFI_ALT_BUILD)
/usr/bin/libtool -static -o $@.tmp $(FFI_BUILD)/.libs/${@F} $(FFI_ALT_BUILD)/.libs/${@F}
@mv $@.tmp $@
endif
clean:
$(RM) -rf $(BUILD)
$(RM) -rf $(BUILD)
version:
@echo version=$(VERSION)
#EOF
+19
Ver Arquivo
@@ -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.
+224 -344
Ver Arquivo
@@ -1,405 +1,285 @@
/* 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>
# undef SLIST_ENTRY
# define MMAP_CLOSURE
# define roundup(x,y) ((((x) + ((y) - 1)) / (y)) * (y))
# define XM_ALLOC(SIZE) VirtualAlloc(0, SIZE, MEM_COMMIT|MEM_RESERVE, PAGE_EXECUTE_READWRITE)
# define XM_FREE(P,SIZE) VirtualFree(P,SIZE,MEM_RELEASE)
# define PAGE_SIZE w32_page_size()
typedef void* caddr_t;
#else
# include <sys/types.h>
# include <sys/param.h>
# if defined(__linux__)
# include <sys/user.h> /* for PAGE_SIZE */
# endif
# include <sys/mman.h>
# ifdef sun
# include <sys/sysmacros.h>
# endif
# define MMAP_CLOSURE
# define XM_ALLOC(SIZE) mmap(0, SIZE, PROT_EXEC|PROT_READ|PROT_WRITE,MAP_ANON|MAP_PRIVATE,-1,0)
# define XM_FREE(P,SIZE) munmap(P,SIZE)
#endif
#include "dispatch.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __linux__
#define NO_UNDERSCORE
static void callback_dispatch(ffi_cif*, void*, void**, void*);
static ffi_closure* alloc_closure(JNIEnv *env);
static void free_closure(JNIEnv* env, ffi_closure *closure);
#ifdef MMAP_CLOSURE
#include "queue.h"
static LIST_HEAD(closure_list, list_entry) closure_list;
static LIST_HEAD(alloc_list, list_entry) alloc_list;
#endif
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) {
callback* cb;
unsigned long* insns;
ffi_abi abi = FFI_DEFAULT_ABI;
ffi_status status;
int args_size = 0;
jsize argc;
JavaVM* vm;
int len = TEMPLATE_SIZE;
char rtype;
char msg[64];
int i;
if (TEMPLATE_SIZE == 0) {
throwByName(env, "java/lang/UnsupportedOperationException",
"Callbacks not supported on this platform");
return 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->ffi_closure = alloc_closure(env);
cb->object = (*env)->NewWeakGlobalRef(env, obj);
cb->methodID = (*env)->FromReflectedMethod(env, method);
cb->param_count = argc;
cb->vm = vm;
for (i=0;i < argc;i++) {
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;
}
else {
args_size += 4;
cb->param_jtypes[i] = get_jtype(env, cls);
cb->ffi_args[i] = get_ffi_type(env, cls, cb->param_jtypes[i]);
if (!cb->param_jtypes[i]) {
sprintf(msg, "Unsupported type at parameter %d", i);
throwByName(env, EIllegalArgument, msg);
goto failure_cleanup;
}
}
// 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
if (calling_convention == CALLCONV_STDCALL) {
abi = FFI_STDCALL;
}
#endif
#endif // _WIN32
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':
rtype = get_jtype(env, return_type);
if (!rtype) {
throwByName(env, EIllegalArgument, "Unsupported return type");
goto failure_cleanup;
}
status = ffi_prep_cif(&cb->ffi_cif, abi, argc,
get_ffi_rtype(env, return_type, rtype),
&cb->ffi_args[0]);
switch(status) {
case FFI_BAD_ABI:
sprintf(msg, "Invalid calling convention: %d", (int)calling_convention);
throwByName(env, EIllegalArgument, msg);
break;
case FFI_BAD_TYPEDEF:
sprintf(msg, "Invalid structure definition (native typedef error)");
throwByName(env, EIllegalArgument, msg);
break;
case FFI_OK:
ffi_prep_closure(cb->ffi_closure, &cb->ffi_cif, callback_dispatch, cb);
return cb;
default:
return TYPE_PTR;
sprintf(msg, "Native callback setup failure: error code %d", status);
throwByName(env, EIllegalArgument, msg);
break;
}
failure_cleanup:
free_callback(env, cb);
return NULL;
}
void
free_callback(JNIEnv* env, callback *cb) {
(*env)->DeleteWeakGlobalRef(env, cb->object);
free_closure(env, cb->ffi_closure);
free(cb);
}
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) {
callback* cb = (callback *) user_data;
JavaVM* jvm = cb->vm;
jobject self;
JNIEnv* env;
int attached;
jobjectArray args;
int i;
unsigned int i;
jobjectArray array;
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);
}
self = (*env)->NewLocalRef(env, cb->object);
// 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;
if ((*env)->IsSameObject(env, self, NULL)) {
fprintf(stderr, "JNA: callback object has been garbage collected\n");
memset(resp, 0, cif->rtype->size);
}
else {
jobject value = (*env)->CallObjectMethod(env, obj, mid, args);
result = extract_value(env, value, &return_type);
jobject result;
array = (*env)->NewObjectArray(env, cif->nargs, classObject, NULL);
for (i=0;i < cif->nargs;i++) {
jobject arg = new_object(env, cb->param_jtypes[i], cbargs[i]);
(*env)->SetObjectArrayElement(env, array, i, arg);
}
result = (*env)->CallObjectMethod(env, self, cb->methodID, array);
if ((*env)->ExceptionCheck(env)) {
fprintf(stderr, "JNA: uncaught exception in callback, continuing\n");
memset(resp, 0, cif->rtype->size);
}
else {
extract_value(env, result, resp, cif->rtype->size);
}
}
if (!attached) {
(*jvm)->DetachCurrentThread(jvm);
}
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;
}
// Use mmap for closure memory, if available.
// A page of memory is allocated and divided into closure-sized
// chunks managed in a queue. The queue is protected by
// Java synchronization locks to ensure single-threaded access.
#ifdef MMAP_CLOSURE
# ifndef PAGE_SIZE
# if defined(PAGESIZE)
# define PAGE_SIZE PAGESIZE
# elif defined(NBPG)
# define PAGE_SIZE NBPG
# endif
# endif
typedef struct list_entry {
LIST_ENTRY(list_entry) list;
} list_entry;
#endif
#ifdef _WIN32
static int w32_page_size() {
static int page_size = 0;
if (page_size == 0) {
SYSTEM_INFO info;
GetSystemInfo(&info);
page_size = info.dwPageSize;
}
return page_size;
}
#endif
jboolean
jnidispatch_callback_init(JNIEnv* env) {
if (!LOAD_CREF(env, Object, "java/lang/Object")) return JNI_FALSE;
#ifdef MMAP_CLOSURE
LIST_INIT(&closure_list);
LIST_INIT(&alloc_list);
#endif
return JNI_TRUE;
}
void
jnidispatch_callback_dispose(JNIEnv* env) {
if (classObject) {
(*env)->DeleteWeakGlobalRef(env, classObject);
classObject = NULL;
}
#ifdef MMAP_CLOSURE
while (alloc_list.lh_first != NULL) {
list_entry* entry = alloc_list.lh_first;
XM_FREE((caddr_t)entry, PAGE_SIZE);
LIST_REMOVE(entry, list);
}
#endif
}
static ffi_closure*
alloc_closure(JNIEnv* env) {
#ifdef MMAP_CLOSURE
list_entry* entry = NULL;
if (closure_list.lh_first == NULL) {
/*
* Get a new page from the kernel and divvy that up
*/
int clsize = roundup(sizeof(ffi_closure), sizeof(list_entry));
int i;
caddr_t ptr = XM_ALLOC(PAGE_SIZE);
if (ptr == NULL) {
return NULL;
}
LIST_INSERT_HEAD(&alloc_list, (list_entry*)ptr, list);
for (i = 0; i <= (int)(PAGE_SIZE - clsize); i += clsize) {
entry = (list_entry *)(ptr + i);
LIST_INSERT_HEAD(&closure_list, entry, list);
}
}
entry = closure_list.lh_first;
LIST_REMOVE(entry, list);
memset(entry, 0, sizeof(ffi_closure));
return (ffi_closure *)entry;
#else
return (ffi_closure *)calloc(1, sizeof(ffi_closure));
#endif
}
static void
free_closure(JNIEnv* env, ffi_closure *ffi_closure) {
#ifdef MMAP_CLOSURE
LIST_INSERT_HEAD(&closure_list, (list_entry*)ffi_closure, list);
#else
free(closure);
#endif
}
#ifdef __cplusplus
+1312 -745
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+45 -42
Ver Arquivo
@@ -1,26 +1,25 @@
/* 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"
#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,
@@ -29,24 +28,22 @@ typedef enum _callconv {
#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. */
#define MAX_NARGS 32
/* Maximum number of allowed arguments in libffi. */
#define MAX_NARGS com_sun_jna_Function_MAX_NARGS
typedef struct _callback {
void *insns;
ffi_closure* ffi_closure;
ffi_cif ffi_cif;
ffi_type* ffi_args[MAX_NARGS];
JavaVM* vm;
jobject object;
jmethodID methodID;
jsize param_count;
char param_jtypes[MAX_NARGS];
} callback;
// Size of a register
typedef long word_t;
#if defined(SOLARIS2) || defined(__GNUC__)
#define L2A(X) ((void *)(unsigned long)(X))
#define A2L(X) ((jlong)(unsigned long)(X))
@@ -57,40 +54,46 @@ typedef struct _callback {
#define A2L(X) ((jlong)(X))
#endif
#ifdef _WIN32
#ifdef _MSC_VER
#define alloca _alloca
#endif
#else
#include <alloca.h>
#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 EError "java/lang/Error"
extern void throwByName(JNIEnv *env, const char *name, const char *msg);
extern jobject newJavaPointer(JNIEnv *, void *);
extern char get_jtype(JNIEnv*, jclass);
extern ffi_type* get_ffi_type(JNIEnv*, jclass, char);
extern ffi_type* get_ffi_rtype(JNIEnv*, jclass, char);
extern jboolean 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);
extern void free_callback(JNIEnv*, callback*);
extern void extract_value(JNIEnv*, jobject, void*, size_t size);
extern jobject new_object(JNIEnv*, char, void*);
#ifdef __cplusplus
}
#endif
-151
Ver Arquivo
@@ -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
-173
Ver Arquivo
@@ -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__
-133
Ver Arquivo
@@ -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)
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+40
Ver Arquivo
@@ -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.
+764
Ver Arquivo
@@ -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.
+20
Ver Arquivo
@@ -0,0 +1,20 @@
libffi - Copyright (c) 1996-2003 Red Hat, Inc.
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 CYGNUS SOLUTIONS 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.
+175
Ver Arquivo
@@ -0,0 +1,175 @@
## Process this with automake to create Makefile.in
AUTOMAKE_OPTIONS = foreign subdir-objects
ACLOCAL_AMFLAGS = -I .. -I ../config
SUBDIRS = include testsuite
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/ffi.c src/x86/sysv.S src/x86/win32.S src/x86/darwin.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
## ################################################################
##
## 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=
toolexeclib_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
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_WIN32
nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/win32.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:
# Multilib support. Automake should provide these on its own.
all-recursive: all-multi
install-recursive: install-multi
mostlyclean-recursive: mostlyclean-multi
clean-recursive: clean-multi
distclean-recursive: distclean-multi
maintainer-clean-recursive: maintainer-clean-multi
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+491
Ver Arquivo
@@ -0,0 +1,491 @@
This directory contains the libffi package, which is not part of GCC but
shipped with GCC as convenience.
Status
======
libffi-2.00 has not been released yet! This is a development snapshot!
libffi-1.20 was released on October 5, 1998. Check the libffi web
page for updates: <URL:http://sources.redhat.com/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 essentially 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 and Prerequisites
=====================================
Libffi has been ported to:
SunOS 4.1.3 & Solaris 2.x (SPARC-V8, SPARC-V9)
Irix 5.3 & 6.2 (System V/o32 & n32)
Intel x86 - Linux (System V ABI)
Alpha - Linux and OSF/1
m68k - Linux (System V ABI)
PowerPC - Linux (System V ABI, Darwin, AIX)
ARM - Linux (System V ABI)
Libffi has been tested with the egcs 1.0.2 gcc compiler. Chances are
that other versions will work. Libffi has also been built and tested
with the SGI compiler tools.
On PowerPC, the tests failed (see the note below).
You must use GNU make to build libffi. SGI's make will not work.
Sun's probably won't either.
If you port libffi to another platform, please let me know! I assume
that some will be easy (x86 NetBSD), and others will be more difficult
(HP).
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. SGI's make will not work. Sun's probably won't either.
You can ftp GNU make from prep.ai.mit.edu:/pub/gnu.
To ensure that libffi is working as advertised, type "make test".
To install the library and header files, type "make install".
Using libffi
============
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. The cif in ffi_cif
stands for Call InterFace. To prepare a call interface object, use the
following function:
ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi,
unsigned int nargs,
ffi_type *rtype, ffi_type **atypes);
CIF is a pointer to the call interface object you wish
to initialize.
ABI is an enum that specifies the calling convention
to use for the call. FFI_DEFAULT_ABI defaults
to the system's native calling convention. Other
ABI's may be used with care. They are system
specific.
NARGS is the number of arguments this function accepts.
libffi does not yet support vararg functions.
RTYPE is a pointer to an ffi_type structure that represents
the return type of the function. Ffi_type objects
describe the types of values. libffi provides
ffi_type objects for many of the native C types:
signed int, unsigned int, signed char, unsigned char,
etc. There is also a pointer ffi_type object and
a void ffi_type. Use &ffi_type_void for functions that
don't return values.
ATYPES is a vector of ffi_type pointers. ARGS must be NARGS long.
If NARGS is 0, this is ignored.
ffi_prep_cif will return a status code that you are responsible
for checking. It will be one of the following:
FFI_OK - All is good.
FFI_BAD_TYPEDEF - One of the ffi_type objects that ffi_prep_cif
came across is bad.
Before making the call, the VALUES vector should be initialized
with pointers to the appropriate argument values.
To call the the function using the initialized ffi_cif, use the
ffi_call function:
void ffi_call(ffi_cif *cif, void *fn, void *rvalue, void **avalues);
CIF is a pointer to the ffi_cif initialized specifically
for this function.
FN is a pointer to the function you want to call.
RVALUE is a pointer to a chunk of memory that is to hold the
result of the function call. Currently, it must be
at least one word in size (except for the n32 version
under Irix 6.x, which must be a pointer to an 8 byte
aligned value (a long long). It must also be at least
word aligned (depending on the return type, and the
system's alignment requirements). If RTYPE is
&ffi_type_void, this is ignored. If RVALUE is NULL,
the return value is discarded.
AVALUES is a vector of void* that point to the memory locations
holding the argument values for a call.
If NARGS is 0, this is ignored.
If you are expecting a return value from FN it will have been stored
at RVALUE.
An 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;
}
Aggregate Types
---------------
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. Here is the definition of ffi_type:
typedef struct _ffi_type
{
unsigned size;
short alignment;
short type;
struct _ffi_type **elements;
} ffi_type;
All structures must have type set to FFI_TYPE_STRUCT. You may set
size and alignment to 0. These will be calculated and reset to the
appropriate values by ffi_prep_cif().
elements is a NULL terminated array of pointers to ffi_type objects
that describe the type of the structure elements. These may, in turn,
be structure elements.
The following example initializes a ffi_type object representing the
tm struct from Linux's time.h:
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__;
};
{
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() */
}
Platform Specific Notes
=======================
Intel x86
---------
There are no known problems with the x86 port.
Sun SPARC - SunOS 4.1.3 & Solaris 2.x
-------------------------------------
You must use GNU Make to build libffi on Sun platforms.
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.
ARM - System V ABI
------------------
The ARM port was performed on a NetWinder running ARM Linux ELF
(2.0.31) and gcc 2.8.1.
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
=======
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 written by Anthony Green <green@cygnus.com>.
Portions of libffi were derived from Gianni Mariani's free gencall
library for Silicon Graphics machines.
The closure mechanism was designed and implemented by Kresten Krab
Thorup.
The Sparc port was derived from code contributed by the fine folks at
Visible Decisions Inc <http://www.vdi.com>. Further enhancements were
made by Gordon Irlam at Cygnus Solutions <http://www.cygnus.com>.
The Alpha port was written by Richard Henderson at Cygnus Solutions.
Andreas Schwab ported libffi to m68k Linux and provided a number of
bug fixes.
Geoffrey Keating ported libffi to the PowerPC.
Raffaele Sena ported libffi to the ARM.
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 and configuration help.
Thanks to Jim Blandy, who provided some useful feedback on the libffi
interface.
If you have a problem, or have found a bug, please send a note to
green@cygnus.com.
+92
Ver Arquivo
@@ -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
])
+915
Ver Arquivo
@@ -0,0 +1,915 @@
# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION so it can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.9.6])])
# Figure out how to run the assembler. -*- Autoconf -*-
# Copyright (C) 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# AM_PROG_AS
# ----------
AC_DEFUN([AM_PROG_AS],
[# By default we simply use the C compiler to build assembly code.
AC_REQUIRE([AC_PROG_CC])
test "${CCAS+set}" = set || CCAS=$CC
test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
AC_ARG_VAR([CCAS], [assembler compiler command (defaults to CC)])
AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)])
])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and
# therefore $ac_aux_dir as well) can be either absolute or relative,
# depending on how configure is run. This is pretty annoying, since
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
# source directory, any form will work fine, but in subdirectories a
# relative path needs to be adjusted first.
#
# $ac_aux_dir/missing
# fails when called from a subdirectory if $ac_aux_dir is relative
# $top_srcdir/$ac_aux_dir/missing
# fails if $ac_aux_dir is absolute,
# fails when called from a subdirectory in a VPATH build with
# a relative $ac_aux_dir
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually
# harmless because $srcdir is `.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
# and then we would define $MISSING as
# MISSING="\${SHELL} $am_aux_dir/missing"
# This will work as long as MISSING is not called from configure, because
# unfortunately $(top_srcdir) has no meaning in configure.
# However there are other variables, like CC, which are often used in
# configure, and could therefore not use this "fixed" $ac_aux_dir.
#
# Another solution, used here, is to always expand $ac_aux_dir to an
# absolute PATH. The drawback is that using absolute paths prevent a
# configured tree to be moved without reconfiguration.
AC_DEFUN([AM_AUX_DIR_EXPAND],
[dnl Rely on autoconf to set up CDPATH properly.
AC_PREREQ([2.50])dnl
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
])
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 7
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[AC_PREREQ(2.52)dnl
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])
AC_SUBST([$1_FALSE])
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
AC_MSG_ERROR([[conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 8
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
# NAME is "CC", "CXX", "GCJ", or "OBJC".
# We try a few techniques and use that to set a single cache variable.
#
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
# dependency, and given that the user is not expected to run this macro,
# just rely on AC_PROG_CC.
AC_DEFUN([_AM_DEPENDENCIES],
[AC_REQUIRE([AM_SET_DEPDIR])dnl
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
[$1], CXX, [depcc="$CXX" am_compiler_list=],
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
[depcc="$$1" am_compiler_list=])
AC_CACHE_CHECK([dependency style of $depcc],
[am_cv_$1_dependencies_compiler_type],
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named `D' -- because `-MD' means `put the output
# in D'.
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
cp "$am_depcomp" conftest.dir
cd conftest.dir
# We will build objects and dependencies in a subdirectory because
# it helps to detect inapplicable dependency modes. For instance
# both Tru64's cc and ICC support -MD to output dependencies as a
# side effect of compilation, but ICC will put the dependencies in
# the current directory while Tru64 will put them in the object
# directory.
mkdir sub
am_cv_$1_dependencies_compiler_type=none
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
fi
for depmode in $am_compiler_list; do
# Setup a source with many dependencies, because some compilers
# like to wrap large dependency lists on column 80 (with \), and
# we should not choose a depcomp mode which is confused by this.
#
# We need to recreate these files for each test, as the compiler may
# overwrite some of them when testing with obscure command lines.
# This happens at least with the AIX C compiler.
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
# Solaris 8's {/usr,}/bin/sh.
touch sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
case $depmode in
nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested
if test "x$enable_dependency_tracking" = xyes; then
continue
else
break
fi
;;
none) break ;;
esac
# We check with `-c' and `-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle `-M -o', and we need to detect this.
if depmode=$depmode \
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message
# that says an option was ignored or not supported.
# When given -MP, icc 7.0 and 7.1 complain thusly:
# icc: Command line warning: ignoring option '-M'; no argument required
# The diagnosis changed in icc 8.0:
# icc: Command line remark: option '-MP' not supported
if (grep 'ignoring option' conftest.err ||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
am_cv_$1_dependencies_compiler_type=$depmode
break
fi
fi
done
cd ..
rm -rf conftest.dir
else
am_cv_$1_dependencies_compiler_type=none
fi
])
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
AM_CONDITIONAL([am__fastdep$1], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
])
# AM_SET_DEPDIR
# -------------
# Choose a directory name for dependency files.
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
AC_DEFUN([AM_SET_DEPDIR],
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
])
# AM_DEP_TRACK
# ------------
AC_DEFUN([AM_DEP_TRACK],
[AC_ARG_ENABLE(dependency-tracking,
[ --disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors])
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])
])
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#serial 3
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
[for mf in $CONFIG_FILES; do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
# We used to match only the files named `Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# So let's grep whole file.
if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
dirpart=`AS_DIRNAME("$mf")`
else
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running `make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# When using ansi2knr, U may be empty or an underscore; expand it
U=`sed -n 's/^U = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
AS_MKDIR_P([$dirpart/$fdir])
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
done
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
# AM_OUTPUT_DEPENDENCY_COMMANDS
# -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking
# is enabled. FIXME. This creates each `.P' file that we will
# need in order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 12
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
# The call with PACKAGE and VERSION arguments is the old style
# call (pre autoconf-2.50), which is being phased out. PACKAGE
# and VERSION should now be passed to AC_INIT and removed from
# the call to AM_INIT_AUTOMAKE.
# We support both call styles for the transition. After
# the next Automake release, Autoconf can make the AC_INIT
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.58])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
# test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" &&
test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
# test whether we have cygpath
if test -z "$CYGPATH_W"; then
if (cygpath --version) >/dev/null 2>/dev/null; then
CYGPATH_W='cygpath -w'
else
CYGPATH_W=echo
fi
fi
AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
# Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
AM_MISSING_PROG(AUTOCONF, autoconf)
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
AM_MISSING_PROG(AUTOHEADER, autoheader)
AM_MISSING_PROG(MAKEINFO, makeinfo)
AM_PROG_INSTALL_SH
AM_PROG_INSTALL_STRIP
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES(CC)],
[define([AC_PROG_CC],
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES(CXX)],
[define([AC_PROG_CXX],
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
])
])
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated. The stamp files are numbered to have different names.
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
# loop where config.status creates the headers, so we can generate
# our stamp files there.
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
[# Compute $1's index in $config_headers.
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
$1 | $1:* )
break ;;
* )
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
esac
done
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
install_sh=${install_sh-"$am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering
# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
AC_DEFUN([AM_MAINTAINER_MODE],
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode is disabled by default
AC_ARG_ENABLE(maintainer-mode,
[ --enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer],
USE_MAINTAINER_MODE=$enableval,
USE_MAINTAINER_MODE=no)
AC_MSG_RESULT([$USE_MAINTAINER_MODE])
AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
MAINT=$MAINTAINER_MODE_TRUE
AC_SUBST(MAINT)dnl
]
)
AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# AM_MAKE_INCLUDE()
# -----------------
# Check to see how make treats includes.
AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make}
cat > confinc << 'END'
am__doit:
@echo done
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#"
am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# We grep out `Entering directory' and `Leaving directory'
# messages which can occur if `w' ends up in MAKEFLAGS.
# In particular we don't look at `^make:' because GNU make might
# be invoked under some other name (usually "gmake"), in which
# case it prints its new name instead of `make'.
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
am__include=include
am__quote=
_am_result=GNU
fi
# Now try BSD make style include.
if test "$am__include" = "#"; then
echo '.include "confinc"' > confmf
if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
am__include=.include
am__quote="\""
_am_result=BSD
fi
fi
AC_SUBST([am__include])
AC_SUBST([am__quote])
AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
# Copyright (C) 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# AM_PROG_CC_C_O
# --------------
# Like AC_PROG_CC_C_O, but changed for automake.
AC_DEFUN([AM_PROG_CC_C_O],
[AC_REQUIRE([AC_PROG_CC_C_O])dnl
AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
# FIXME: we rely on the cache variable name because
# there is no other way.
set dummy $CC
ac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
# Losing compiler, so override with the script.
# FIXME: It is wrong to rewrite CC.
# But if we don't then we get into trouble of one sort or another.
# A longer-term fix would be to have automake use am__CC in this case,
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
CC="$am_aux_dir/compile $CC"
fi
])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
AC_DEFUN([AM_MISSING_PROG],
[AC_REQUIRE([AM_MISSING_HAS_RUN])
$1=${$1-"${am_missing_run}$2"}
AC_SUBST($1)])
# AM_MISSING_HAS_RUN
# ------------------
# Define MISSING if not defined so far and test if it supports --run.
# If it does, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
else
am_missing_run=
AC_MSG_WARN([`missing' script is too old or missing])
fi
])
# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_MKDIR_P
# ---------------
# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
#
# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
# created by `make install' are always world readable, even if the
# installer happens to have an overly restrictive umask (e.g. 077).
# This was a mistake. There are at least two reasons why we must not
# use `-m 0755':
# - it causes special bits like SGID to be ignored,
# - it may be too restrictive (some setups expect 775 directories).
#
# Do not use -m 0755 and let people choose whatever they expect by
# setting umask.
#
# We cannot accept any implementation of `mkdir' that recognizes `-p'.
# Some implementations (such as Solaris 8's) are not thread-safe: if a
# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
# concurrently, both version can detect that a/ is missing, but only
# one can create it and the other will error out. Consequently we
# restrict ourselves to GNU make (using the --version option ensures
# this.)
AC_DEFUN([AM_PROG_MKDIR_P],
[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
# We used to keeping the `.' as first argument, in order to
# allow $(mkdir_p) to be used without argument. As in
# $(mkdir_p) $(somedir)
# where $(somedir) is conditionally defined. However this is wrong
# for two reasons:
# 1. if the package is installed by a user who cannot write `.'
# make install will fail,
# 2. the above comment should most certainly read
# $(mkdir_p) $(DESTDIR)$(somedir)
# so it does not work when $(somedir) is undefined and
# $(DESTDIR) is not.
# To support the latter case, we have to write
# test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
# so the `.' trick is pointless.
mkdir_p='mkdir -p --'
else
# On NextStep and OpenStep, the `mkdir' command does not
# recognize any option. It will interpret all options as
# directories to create, and then abort because `.' already
# exists.
for d in ./-p ./--version;
do
test -d $d && rmdir $d
done
# $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
if test -f "$ac_aux_dir/mkinstalldirs"; then
mkdir_p='$(mkinstalldirs)'
else
mkdir_p='$(install_sh) -d'
fi
fi
AC_SUBST([mkdir_p])])
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# _AM_MANGLE_OPTION(NAME)
# -----------------------
AC_DEFUN([_AM_MANGLE_OPTION],
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
# _AM_SET_OPTION(NAME)
# ------------------------------
# Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
# _AM_SET_OPTIONS(OPTIONS)
# ----------------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftest.file
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftest.file`
fi
rm -f conftest.file
if test "$[*]" != "X $srcdir/configure conftest.file" \
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "$[2]" = conftest.file
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
AC_MSG_RESULT(yes)])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_STRIP
# ---------------------
# One issue with vendor `install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
# is unlikely to handle the host's binaries.
# Fortunately install-sh will honor a STRIPPROG variable, so we
# always use install-sh in `make install-strip', and initialize
# STRIPPROG with the value of the STRIP variable (set by the user).
AC_DEFUN([AM_PROG_INSTALL_STRIP],
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
# Installed binaries are usually stripped using `strip' when the user
# run `make install-strip'. However `strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the `STRIP' environment variable to overrule this program.
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# _AM_PROG_TAR(FORMAT)
# --------------------
# Check how to create a tarball in format FORMAT.
# FORMAT should be one of `v7', `ustar', or `pax'.
#
# Substitute a variable $(am__tar) that is a command
# writing to stdout a FORMAT-tarball containing the directory
# $tardir.
# tardir=directory && $(am__tar) > result.tar
#
# Substitute a variable $(am__untar) that extract such
# a tarball read from stdin.
# $(am__untar) < result.tar
AC_DEFUN([_AM_PROG_TAR],
[# Always define AMTAR for backward compatibility.
AM_MISSING_PROG([AMTAR], [tar])
m4_if([$1], [v7],
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
[m4_case([$1], [ustar],, [pax],,
[m4_fatal([Unknown tar format])])
AC_MSG_CHECKING([how to create a $1 tar archive])
# Loop over all known methods to create a tar archive until one works.
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
# Do not fold the above two line into one, because Tru64 sh and
# Solaris sh will not grok spaces in the rhs of `-'.
for _am_tool in $_am_tools
do
case $_am_tool in
gnutar)
for _am_tar in tar gnutar gtar;
do
AM_RUN_LOG([$_am_tar --version]) && break
done
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
am__untar="$_am_tar -xf -"
;;
plaintar)
# Must skip GNU tar: if it does not support --format= it doesn't create
# ustar tarball either.
(tar --version) >/dev/null 2>&1 && continue
am__tar='tar chf - "$$tardir"'
am__tar_='tar chf - "$tardir"'
am__untar='tar xf -'
;;
pax)
am__tar='pax -L -x $1 -w "$$tardir"'
am__tar_='pax -L -x $1 -w "$tardir"'
am__untar='pax -r'
;;
cpio)
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
am__untar='cpio -i -H $1 -d'
;;
none)
am__tar=false
am__tar_=false
am__untar=false
;;
esac
# If the value was cached, stop now. We just wanted to have am__tar
# and am__untar set.
test -n "${am_cv_prog_tar_$1}" && break
# tar/untar a dummy directory, and stop if the command works
rm -rf conftest.dir
mkdir conftest.dir
echo GrepMe > conftest.dir/file
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
rm -rf conftest.dir
if test -s conftest.tar; then
AM_RUN_LOG([$am__untar <conftest.tar])
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
fi
done
rm -rf conftest.dir
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([../config/depstand.m4])
m4_include([../config/lead-dot.m4])
m4_include([../config/multi.m4])
m4_include([../libtool.m4])
m4_include([../ltoptions.m4])
m4_include([../ltsugar.m4])
m4_include([../ltversion.m4])
m4_include([acinclude.m4])
+912
Ver Arquivo
@@ -0,0 +1,912 @@
# 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., 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.
#
# 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}" \
CCASFLAGS="$(CCASFLAGS) $${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_config_env} ${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
externo Arquivo executável
+1516
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
externo Arquivo executável
+1626
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
externo Arquivo executável
+15301
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+359
Ver Arquivo
@@ -0,0 +1,359 @@
dnl Process this with autoconf to create configure
AC_PREREQ(2.59)
AC_INIT([libffi], [2.1], [http://gcc.gnu.org/bugs.html])
AC_CONFIG_HEADERS([fficonfig.h])
AM_ENABLE_MULTILIB(, ..)
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
;;
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
;;
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*)
;;
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_WIN32, test x$TARGET = xX86_WIN32)
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
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)
AC_OUTPUT
+11
Ver Arquivo
@@ -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
+553
Ver Arquivo
@@ -0,0 +1,553 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2005-05-16.16
# Copyright (C) 1999, 2000, 2003, 2004, 2005 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.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
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"
;;
ia64hp)
# The "hp" stanza above does not work with 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.
tmpdepfile=`echo "$object" | sed -e 's/\.o$/.d/'`
"$@" +Maked
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# The object file name is correct already.
cat "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${; s/^ //; s/ \\*$//; s/$/:/; p; }' "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
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 mecanism 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 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:
+164
Ver Arquivo
@@ -0,0 +1,164 @@
/* fficonfig.h.in. Generated from configure.ac by autoheader. */
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
#undef CRAY_STACKSEG_END
/* Define to 1 if using `alloca.c'. */
#undef C_ALLOCA
/* Define to the flags needed for the .section .eh_frame directive. */
#undef EH_FRAME_FLAGS
/* Define this if you want extra debugging. */
#undef FFI_DEBUG
/* Define this is you do not want support for the raw API. */
#undef FFI_NO_RAW_API
/* Define this is you do not want support for aggregate types. */
#undef FFI_NO_STRUCTS
/* Define to 1 if you have `alloca', as a function or macro. */
#undef HAVE_ALLOCA
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
*/
#undef HAVE_ALLOCA_H
/* Define if your assembler supports .cfi_* directives. */
#undef HAVE_AS_CFI_PSEUDO_OP
/* Define if your assembler supports .register. */
#undef HAVE_AS_REGISTER_PSEUDO_OP
/* Define if your assembler and linker support unaligned PC relative relocs.
*/
#undef HAVE_AS_SPARC_UA_PCREL
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define if __attribute__((visibility("hidden"))) is supported. */
#undef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define if you have the long double type and it is bigger than a double */
#undef HAVE_LONG_DOUBLE
/* Define to 1 if you have the `memcpy' function. */
#undef HAVE_MEMCPY
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `mmap' function. */
#undef HAVE_MMAP
/* Define if mmap with MAP_ANON(YMOUS) works. */
#undef HAVE_MMAP_ANON
/* Define if mmap of /dev/zero works. */
#undef HAVE_MMAP_DEV_ZERO
/* Define if read-only mmap of a plain file works. */
#undef HAVE_MMAP_FILE
/* Define if .eh_frame sections should be read-only. */
#undef HAVE_RO_EH_FRAME
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/mman.h> header file. */
#undef HAVE_SYS_MMAN_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* The size of a `double', as computed by sizeof. */
#undef SIZEOF_DOUBLE
/* The size of a `long double', as computed by sizeof. */
#undef SIZEOF_LONG_DOUBLE
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
#undef STACK_DIRECTION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define this if you are using Purify and want to suppress spurious messages.
*/
#undef USING_PURIFY
/* Version number of package */
#undef VERSION
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN
#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
+12
Ver Arquivo
@@ -0,0 +1,12 @@
## Process this with automake to create Makefile.in
AUTOMAKE_OPTIONS=foreign
DISTCLEANFILES=ffitarget.h
EXTRA_DIST=ffi.h.in ffi_common.h
# Where generated headers like ffitarget.h get installed.
gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
toollibffidir := $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
toollibffi_HEADERS = ffi.h ffitarget.h
+464
Ver Arquivo
@@ -0,0 +1,464 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = include
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/ffi.h.in $(toollibffi_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/multi.m4 $(top_srcdir)/../libtool.m4 \
$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
$(top_srcdir)/../ltversion.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
CONFIG_HEADER = $(top_builddir)/fficonfig.h
CONFIG_CLEAN_FILES = ffi.h ffitarget.h
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(toollibffidir)"
toollibffiHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(toollibffi_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
ALPHA_FALSE = @ALPHA_FALSE@
ALPHA_TRUE = @ALPHA_TRUE@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AM_RUNTESTFLAGS = @AM_RUNTESTFLAGS@
AR = @AR@
ARM_FALSE = @ARM_FALSE@
ARM_TRUE = @ARM_TRUE@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCAS = @CCAS@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FRV_FALSE = @FRV_FALSE@
FRV_TRUE = @FRV_TRUE@
GREP = @GREP@
HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@
IA64_FALSE = @IA64_FALSE@
IA64_TRUE = @IA64_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LIBFFI_CRIS_FALSE = @LIBFFI_CRIS_FALSE@
LIBFFI_CRIS_TRUE = @LIBFFI_CRIS_TRUE@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M32R_FALSE = @M32R_FALSE@
M32R_TRUE = @M32R_TRUE@
M68K_FALSE = @M68K_FALSE@
M68K_TRUE = @M68K_TRUE@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MIPS_FALSE = @MIPS_FALSE@
MIPS_TRUE = @MIPS_TRUE@
NM = @NM@
OBJEXT = @OBJEXT@
PA64_HPUX_FALSE = @PA64_HPUX_FALSE@
PA64_HPUX_TRUE = @PA64_HPUX_TRUE@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PA_HPUX_FALSE = @PA_HPUX_FALSE@
PA_HPUX_TRUE = @PA_HPUX_TRUE@
PA_LINUX_FALSE = @PA_LINUX_FALSE@
PA_LINUX_TRUE = @PA_LINUX_TRUE@
POWERPC_AIX_FALSE = @POWERPC_AIX_FALSE@
POWERPC_AIX_TRUE = @POWERPC_AIX_TRUE@
POWERPC_DARWIN_FALSE = @POWERPC_DARWIN_FALSE@
POWERPC_DARWIN_TRUE = @POWERPC_DARWIN_TRUE@
POWERPC_FALSE = @POWERPC_FALSE@
POWERPC_FREEBSD_FALSE = @POWERPC_FREEBSD_FALSE@
POWERPC_FREEBSD_TRUE = @POWERPC_FREEBSD_TRUE@
POWERPC_TRUE = @POWERPC_TRUE@
RANLIB = @RANLIB@
S390_FALSE = @S390_FALSE@
S390_TRUE = @S390_TRUE@
SED = @SED@
SET_MAKE = @SET_MAKE@
SH64_FALSE = @SH64_FALSE@
SH64_TRUE = @SH64_TRUE@
SHELL = @SHELL@
SH_FALSE = @SH_FALSE@
SH_TRUE = @SH_TRUE@
SPARC_FALSE = @SPARC_FALSE@
SPARC_TRUE = @SPARC_TRUE@
STRIP = @STRIP@
TARGET = @TARGET@
TARGETDIR = @TARGETDIR@
TESTSUBDIR_FALSE = @TESTSUBDIR_FALSE@
TESTSUBDIR_TRUE = @TESTSUBDIR_TRUE@
VERSION = @VERSION@
X86_64_FALSE = @X86_64_FALSE@
X86_64_TRUE = @X86_64_TRUE@
X86_DARWIN_FALSE = @X86_DARWIN_FALSE@
X86_DARWIN_TRUE = @X86_DARWIN_TRUE@
X86_FALSE = @X86_FALSE@
X86_TRUE = @X86_TRUE@
X86_WIN32_FALSE = @X86_WIN32_FALSE@
X86_WIN32_TRUE = @X86_WIN32_TRUE@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
multi_basedir = @multi_basedir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
toolexecdir = @toolexecdir@
toolexeclibdir = @toolexeclibdir@
AUTOMAKE_OPTIONS = foreign
DISTCLEANFILES = ffitarget.h
EXTRA_DIST = ffi.h.in ffi_common.h
# Where generated headers like ffitarget.h get installed.
gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
toollibffidir := $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
toollibffi_HEADERS = ffi.h ffitarget.h
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign include/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
ffi.h: $(top_builddir)/config.status $(srcdir)/ffi.h.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
install-toollibffiHEADERS: $(toollibffi_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(toollibffidir)" || $(mkdir_p) "$(DESTDIR)$(toollibffidir)"
@list='$(toollibffi_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(toollibffiHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(toollibffidir)/$$f'"; \
$(toollibffiHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(toollibffidir)/$$f"; \
done
uninstall-toollibffiHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(toollibffi_HEADERS)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(toollibffidir)/$$f'"; \
rm -f "$(DESTDIR)$(toollibffidir)/$$f"; \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(toollibffidir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-libtool \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-toollibffiHEADERS
install-exec-am:
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-toollibffiHEADERS
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool ctags distclean distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip \
install-toollibffiHEADERS installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am tags uninstall uninstall-am uninstall-info-am \
uninstall-toollibffiHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
+350
Ver Arquivo
@@ -0,0 +1,350 @@
/* -----------------------------------------------------------------*-C-*-
libffi @VERSION@ - Copyright (c) 1996-2003, 2007 Red Hat, Inc.
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 CYGNUS SOLUTIONS 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.
----------------------------------------------------------------------- */
/* -------------------------------------------------------------------
The basic API is described in the README file.
The raw API is designed to bypass some of the argument packing
and unpacking on architectures for which it can be avoided.
The closure API allows interpreted functions to be packaged up
inside a C function pointer, so that they can be called as C functions,
with no understanding on the client side that they are interpreted.
It can also be used in other cases in which it is necessary to package
up a user specified parameter and a function pointer as a single
function pointer.
The closure API must be implemented in order to get its functionality,
e.g. for use by gij. Routines are provided to emulate the raw API
if the underlying platform doesn't allow faster implementation.
More details on the raw and cloure API can be found in:
http://gcc.gnu.org/ml/java/1999-q3/msg00138.html
and
http://gcc.gnu.org/ml/java/1999-q3/msg00174.html
-------------------------------------------------------------------- */
#ifndef LIBFFI_H
#define LIBFFI_H
#ifdef __cplusplus
extern "C" {
#endif
/* Specify which architecture libffi is configured for. */
#define @TARGET@
/* ---- System configuration information --------------------------------- */
#include <ffitarget.h>
#ifndef LIBFFI_ASM
#include <stddef.h>
#include <limits.h>
/* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example).
But we can find it either under the correct ANSI name, or under GNU
C's internal name. */
#ifdef LONG_LONG_MAX
# define FFI_LONG_LONG_MAX LONG_LONG_MAX
#else
# ifdef LLONG_MAX
# define FFI_LONG_LONG_MAX LLONG_MAX
# else
# ifdef __GNUC__
# define FFI_LONG_LONG_MAX __LONG_LONG_MAX__
# endif
# endif
#endif
/* The closure code assumes that this works on pointers, i.e. a size_t */
/* can hold a pointer. */
typedef struct _ffi_type
{
size_t size;
unsigned short alignment;
unsigned short type;
struct _ffi_type **elements;
} ffi_type;
#ifndef LIBFFI_HIDE_BASIC_TYPES
#if SCHAR_MAX == 127
# define ffi_type_uchar ffi_type_uint8
# define ffi_type_schar ffi_type_sint8
#else
#error "char size not supported"
#endif
#if SHRT_MAX == 32767
# define ffi_type_ushort ffi_type_uint16
# define ffi_type_sshort ffi_type_sint16
#elif SHRT_MAX == 2147483647
# define ffi_type_ushort ffi_type_uint32
# define ffi_type_sshort ffi_type_sint32
#else
#error "short size not supported"
#endif
#if INT_MAX == 32767
# define ffi_type_uint ffi_type_uint16
# define ffi_type_sint ffi_type_sint16
#elif INT_MAX == 2147483647
# define ffi_type_uint ffi_type_uint32
# define ffi_type_sint ffi_type_sint32
#elif INT_MAX == 9223372036854775807
# define ffi_type_uint ffi_type_uint64
# define ffi_type_sint ffi_type_sint64
#else
#error "int size not supported"
#endif
#if LONG_MAX == 2147483647
# if FFI_LONG_LONG_MAX != 9223372036854775807
#error "no 64-bit data type supported"
# endif
#elif LONG_MAX != 9223372036854775807
#error "long size not supported"
#endif
#if LONG_MAX == 2147483647
# define ffi_type_ulong ffi_type_uint32
# define ffi_type_slong ffi_type_sint32
#elif LONG_MAX == 9223372036854775807
# define ffi_type_ulong ffi_type_uint64
# define ffi_type_slong ffi_type_sint64
#else
#error "long size not supported"
#endif
/* These are defined in types.c */
extern ffi_type ffi_type_void;
extern ffi_type ffi_type_uint8;
extern ffi_type ffi_type_sint8;
extern ffi_type ffi_type_uint16;
extern ffi_type ffi_type_sint16;
extern ffi_type ffi_type_uint32;
extern ffi_type ffi_type_sint32;
extern ffi_type ffi_type_uint64;
extern ffi_type ffi_type_sint64;
extern ffi_type ffi_type_float;
extern ffi_type ffi_type_double;
extern ffi_type ffi_type_pointer;
#if @HAVE_LONG_DOUBLE@
extern ffi_type ffi_type_longdouble;
#else
#define ffi_type_longdouble ffi_type_double
#endif
#endif /* LIBFFI_HIDE_BASIC_TYPES */
typedef enum {
FFI_OK = 0,
FFI_BAD_TYPEDEF,
FFI_BAD_ABI
} ffi_status;
typedef unsigned FFI_TYPE;
typedef struct {
ffi_abi abi;
unsigned nargs;
ffi_type **arg_types;
ffi_type *rtype;
unsigned bytes;
unsigned flags;
#ifdef FFI_EXTRA_CIF_FIELDS
FFI_EXTRA_CIF_FIELDS;
#endif
} ffi_cif;
/* ---- Definitions for the raw API -------------------------------------- */
#ifndef FFI_SIZEOF_ARG
# if LONG_MAX == 2147483647
# define FFI_SIZEOF_ARG 4
# elif LONG_MAX == 9223372036854775807
# define FFI_SIZEOF_ARG 8
# endif
#endif
typedef union {
ffi_sarg sint;
ffi_arg uint;
float flt;
char data[FFI_SIZEOF_ARG];
void* ptr;
} ffi_raw;
void ffi_raw_call (ffi_cif *cif,
void (*fn)(),
void *rvalue,
ffi_raw *avalue);
void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw);
void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args);
size_t ffi_raw_size (ffi_cif *cif);
/* This is analogous to the raw API, except it uses Java parameter */
/* packing, even on 64-bit machines. I.e. on 64-bit machines */
/* longs and doubles are followed by an empty 64-bit word. */
void ffi_java_raw_call (ffi_cif *cif,
void (*fn)(),
void *rvalue,
ffi_raw *avalue);
void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw);
void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args);
size_t ffi_java_raw_size (ffi_cif *cif);
/* ---- Definitions for closures ----------------------------------------- */
#if FFI_CLOSURES
typedef struct {
char tramp[FFI_TRAMPOLINE_SIZE];
ffi_cif *cif;
void (*fun)(ffi_cif*,void*,void**,void*);
void *user_data;
} ffi_closure __attribute__((aligned (8)));
void *ffi_closure_alloc (size_t size, void **code);
void ffi_closure_free (void *);
ffi_status
ffi_prep_closure (ffi_closure*,
ffi_cif *,
void (*fun)(ffi_cif*,void*,void**,void*),
void *user_data);
ffi_status
ffi_prep_closure_loc (ffi_closure*,
ffi_cif *,
void (*fun)(ffi_cif*,void*,void**,void*),
void *user_data,
void*codeloc);
typedef struct {
char tramp[FFI_TRAMPOLINE_SIZE];
ffi_cif *cif;
#if !FFI_NATIVE_RAW_API
/* if this is enabled, then a raw closure has the same layout
as a regular closure. We use this to install an intermediate
handler to do the transaltion, void** -> ffi_raw*. */
void (*translate_args)(ffi_cif*,void*,void**,void*);
void *this_closure;
#endif
void (*fun)(ffi_cif*,void*,ffi_raw*,void*);
void *user_data;
} ffi_raw_closure;
ffi_status
ffi_prep_raw_closure (ffi_raw_closure*,
ffi_cif *cif,
void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
void *user_data);
ffi_status
ffi_prep_raw_closure_loc (ffi_raw_closure*,
ffi_cif *cif,
void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
void *user_data,
void *codeloc);
ffi_status
ffi_prep_java_raw_closure (ffi_raw_closure*,
ffi_cif *cif,
void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
void *user_data);
ffi_status
ffi_prep_java_raw_closure_loc (ffi_raw_closure*,
ffi_cif *cif,
void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
void *user_data,
void *codeloc);
#endif /* FFI_CLOSURES */
/* ---- Public interface definition -------------------------------------- */
ffi_status ffi_prep_cif(ffi_cif *cif,
ffi_abi abi,
unsigned int nargs,
ffi_type *rtype,
ffi_type **atypes);
void ffi_call(ffi_cif *cif,
void (*fn)(),
void *rvalue,
void **avalue);
/* Useful for eliminating compiler warnings */
#define FFI_FN(f) ((void (*)())f)
/* ---- Definitions shared with assembly code ---------------------------- */
#endif
/* If these change, update src/mips/ffitarget.h. */
#define FFI_TYPE_VOID 0
#define FFI_TYPE_INT 1
#define FFI_TYPE_FLOAT 2
#define FFI_TYPE_DOUBLE 3
#if @HAVE_LONG_DOUBLE@
#define FFI_TYPE_LONGDOUBLE 4
#else
#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
#endif
#define FFI_TYPE_UINT8 5
#define FFI_TYPE_SINT8 6
#define FFI_TYPE_UINT16 7
#define FFI_TYPE_SINT16 8
#define FFI_TYPE_UINT32 9
#define FFI_TYPE_SINT32 10
#define FFI_TYPE_UINT64 11
#define FFI_TYPE_SINT64 12
#define FFI_TYPE_STRUCT 13
#define FFI_TYPE_POINTER 14
/* This should always refer to the last type code (for sanity checks) */
#define FFI_TYPE_LAST FFI_TYPE_POINTER
#ifdef __cplusplus
}
#endif
#endif
+98
Ver Arquivo
@@ -0,0 +1,98 @@
/* -----------------------------------------------------------------------
ffi_common.h - Copyright (c) 1996 Red Hat, Inc.
Copyright (C) 2007 Free Software Foundation, Inc
Common internal definitions and macros. Only necessary for building
libffi.
----------------------------------------------------------------------- */
#ifndef FFI_COMMON_H
#define FFI_COMMON_H
#ifdef __cplusplus
extern "C" {
#endif
#include <fficonfig.h>
/* Do not move this. Some versions of AIX are very picky about where
this is positioned. */
#ifdef __GNUC__
# define alloca __builtin_alloca
# define MAYBE_UNUSED __attribute__((__unused__))
#else
# define MAYBE_UNUSED
# if HAVE_ALLOCA_H
# include <alloca.h>
# else
# ifdef _AIX
#pragma alloca
# else
# ifndef alloca /* predefined by HP cc +Olibcalls */
char *alloca ();
# endif
# endif
# endif
#endif
/* Check for the existence of memcpy. */
#if STDC_HEADERS
# include <string.h>
#else
# ifndef HAVE_MEMCPY
# define memcpy(d, s, n) bcopy ((s), (d), (n))
# endif
#endif
#if defined(FFI_DEBUG)
#include <stdio.h>
#endif
#ifdef FFI_DEBUG
void ffi_assert(char *expr, char *file, int line);
void ffi_stop_here(void);
void ffi_type_test(ffi_type *a, char *file, int line);
#define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__))
#define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l)))
#define FFI_ASSERT_VALID_TYPE(x) ffi_type_test (x, __FILE__, __LINE__)
#else
#define FFI_ASSERT(x)
#define FFI_ASSERT_AT(x, f, l)
#define FFI_ASSERT_VALID_TYPE(x)
#endif
#define ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1)
#define ALIGN_DOWN(v, a) (((size_t) (v)) & -a)
/* Perform machine dependent cif processing */
ffi_status ffi_prep_cif_machdep(ffi_cif *cif);
/* Extended cif, used in callback from assembly routine */
typedef struct
{
ffi_cif *cif;
void *rvalue;
void **avalue;
} extended_cif;
/* Terse sized type definitions. */
typedef unsigned int UINT8 __attribute__((__mode__(__QI__)));
typedef signed int SINT8 __attribute__((__mode__(__QI__)));
typedef unsigned int UINT16 __attribute__((__mode__(__HI__)));
typedef signed int SINT16 __attribute__((__mode__(__HI__)));
typedef unsigned int UINT32 __attribute__((__mode__(__SI__)));
typedef signed int SINT32 __attribute__((__mode__(__SI__)));
typedef unsigned int UINT64 __attribute__((__mode__(__DI__)));
typedef signed int SINT64 __attribute__((__mode__(__DI__)));
typedef float FLOAT32;
#ifdef __cplusplus
}
#endif
#endif
+323
Ver Arquivo
@@ -0,0 +1,323 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2005-05-14.22
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# 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
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
chmodcmd="$chmodprog 0755"
chowncmd=
chgrpcmd=
stripcmd=
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=
dst=
dir_arg=
dstarg=
no_target_directory=
usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
-c (ignored)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
--help display this help and exit.
--version display version info and exit.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
"
while test -n "$1"; do
case $1 in
-c) shift
continue;;
-d) dir_arg=true
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
--help) echo "$usage"; exit $?;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-s) stripcmd=$stripprog
shift
continue;;
-t) dstarg=$2
shift
shift
continue;;
-T) no_target_directory=true
shift
continue;;
--version) echo "$0 $scriptversion"; exit $?;;
*) # When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
test -n "$dir_arg$dstarg" && break
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dstarg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dstarg"
shift # fnord
fi
shift # arg
dstarg=$arg
done
break;;
esac
done
if test -z "$1"; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src ;;
esac
if test -n "$dir_arg"; then
dst=$src
src=
if test -d "$dst"; then
mkdircmd=:
chmodcmd=
else
mkdircmd=$mkdirprog
fi
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dstarg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dstarg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst ;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dstarg: Is a directory" >&2
exit 1
fi
dst=$dst/`basename "$src"`
fi
fi
# This sed command emulates the dirname command.
dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# Skip lots of stat calls in the usual case.
if test ! -d "$dstdir"; then
defaultIFS='
'
IFS="${IFS-$defaultIFS}"
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
shift
IFS=$oIFS
pathcomp=
while test $# -ne 0 ; do
pathcomp=$pathcomp$1
shift
if test ! -d "$pathcomp"; then
$mkdirprog "$pathcomp"
# mkdir can fail with a `File exist' error in case several
# install-sh are creating the directory concurrently. This
# is OK.
test -d "$pathcomp" || exit
fi
pathcomp=$pathcomp/
done
fi
if test -n "$dir_arg"; then
$doit $mkdircmd "$dst" \
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
else
dstfile=`basename "$dst"`
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
trap '(exit $?); exit' 1 2 13 15
# Copy the file name to the temp name.
$doit $cpprog "$src" "$dsttmp" &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
# Now rename the file to the real destination.
{ $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
|| {
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
if test -f "$dstdir/$dstfile"; then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
|| {
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit 1
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
}
}
fi || { (exit 1); exit 1; }
done
# The final little trick to "correctly" pass the exit status to the exit trap.
{
(exit 0); exit 0
}
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:
+6
Ver Arquivo
@@ -0,0 +1,6 @@
# This file is used to maintain libtool version info for libffi. See
# the libtool manual to understand the meaning of the fields. This is
# a separate file so that version updates don't involve re-running
# automake.
# CURRENT:REVISION:AGE
4:1:0
+862
Ver Arquivo
@@ -0,0 +1,862 @@
#### This script is meant to be sourced by ltconfig.
# ltcf-c.sh - Create a C compiler specific configuration
#
# Copyright (C) 1996-2000, 2001 Free Software Foundation, Inc.
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# 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., 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.
# Source file extension for C test sources.
ac_ext=c
# Object file extension for compiled C test sources.
objext=o
# Code to be used in simple compile tests
lt_simple_compile_test_code="int some_variable = 0;"
# Code to be used in simple link tests
lt_simple_link_test_code='main(){return(0);}'
## Linker Characteristics
case $host_os in
cygwin* | mingw*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
if test "$with_gcc" != yes; then
with_gnu_ld=no
fi
;;
esac
ld_shlibs=yes
if test "$with_gnu_ld" = yes; then
# If archive_cmds runs LD, not CC, wlarc should be empty
wlarc='${wl}'
# See if GNU ld supports shared libraries.
case $host_os in
aix3* | aix4* | aix5*)
# On AIX/PPC, the GNU linker is very broken
if test "$host_cpu" != ia64; then
ld_shlibs=no
cat <<EOF 1>&2
*** Warning: the GNU linker, at least up to release 2.9.1, is reported
*** to be unable to reliably create shared libraries on AIX.
*** Therefore, libtool is disabling shared libraries support. If you
*** really care for shared libraries, you may want to modify your PATH
*** so that a non-GNU linker is found, and then restart.
EOF
fi
;;
amigaos*)
archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
# that the semantics of dynamic libraries on AmigaOS, at least up
# to version 4, is to share data among multiple programs linked
# with the same dynamic library. Since this doesn't match the
# behavior of shared libraries on other platforms, we can use
# them.
ld_shlibs=no
;;
beos*)
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
allow_undefined_flag=unsupported
# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
# support --undefined. This deserves some investigation. FIXME
archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
else
ld_shlibs=no
fi
;;
cygwin* | mingw*)
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
allow_undefined_flag=unsupported
always_export_symbols=yes
extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/impgen.c~
test -f $output_objdir/impgen.exe || (cd $output_objdir && \
if test "x$BUILD_CC" != "x" ; then $BUILD_CC -o impgen impgen.c ; \
else $CC -o impgen impgen.c ; fi)~
$output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
# cygwin and mingw dlls have different entry points and sets of symbols
# to exclude.
# FIXME: what about values for MSVC?
dll_entry=__cygwin_dll_entry@12
dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
case $host_os in
mingw*)
# mingw values
dll_entry=_DllMainCRTStartup@12
dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
;;
esac
# mingw and cygwin differ, and it's simplest to just exclude the union
# of the two symbol sets.
dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
# recent cygwin and mingw systems supply a stub DllMain which the user
# can override, but on older systems we have to supply one (in ltdll.c)
if test "x$lt_cv_need_dllmain" = "xyes"; then
ltdll_obj='$output_objdir/$soname-ltdll.'"$objext "
ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/$soname-ltdll.c~
test -f $output_objdir/$soname-ltdll.$objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
else
ltdll_obj=
ltdll_cmds=
fi
# Extract the symbol export list from an `--export-all' def file,
# then regenerate the def file from the symbol export list, so that
# the compiled dll only exports the symbol export list.
# Be careful not to strip the DATA tag left be newer dlltools.
export_symbols_cmds="$ltdll_cmds"'
$DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols'
# If the export-symbols file already is a .def file (1st line
# is EXPORTS), use it as is.
# If DATA tags from a recent dlltool are present, honour them!
archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
cp $export_symbols $output_objdir/$soname-def;
else
echo EXPORTS > $output_objdir/$soname-def;
_lt_hint=1;
cat $export_symbols | while read symbol; do
set dummy \$symbol;
case \[$]# in
2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
*) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;;
esac;
_lt_hint=`expr 1 + \$_lt_hint`;
done;
fi~
'"$ltdll_cmds"'
$CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
$DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
$CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
$DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~
$CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
;;
netbsd* | knetbsd*-gnu)
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
wlarc=
else
archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
fi
;;
solaris* | sysv5*)
if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
ld_shlibs=no
cat <<EOF 1>&2
*** Warning: The releases 2.8.* of the GNU linker cannot reliably
*** create shared libraries on Solaris systems. Therefore, libtool
*** is disabling shared libraries support. We urge you to upgrade GNU
*** binutils to release 2.9.1 or newer. Another option is to modify
*** your PATH or compiler configuration so that the native linker is
*** used, and then restart.
EOF
elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
else
ld_shlibs=no
fi
;;
sunos4*)
archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
wlarc=
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
tpf*)
ld_shlibs=yes
;;
*)
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
else
ld_shlibs=no
fi
;;
esac
if test "$ld_shlibs" = yes; then
runpath_var=LD_RUN_PATH
hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
export_dynamic_flag_spec='${wl}--export-dynamic'
case $host_os in
cygwin* | mingw*)
# dlltool doesn't understand --whole-archive et. al.
whole_archive_flag_spec=
;;
*)
# ancient GNU ld didn't support --whole-archive et. al.
if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
else
whole_archive_flag_spec=
fi
;;
esac
fi
else
# PORTME fill in a description of your system's linker (not GNU ld)
case $host_os in
aix3*)
allow_undefined_flag=unsupported
always_export_symbols=yes
archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
# Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
hardcode_minus_L=yes
if test "$with_gcc" = yes && test -z "$link_static_flag"; then
# Neither direct hardcoding nor static linking is supported with a
# broken collect2.
hardcode_direct=unsupported
fi
;;
aix4* | aix5*)
hardcode_direct=yes
hardcode_libdir_separator=':'
link_all_deplibs=yes
file_list_spec='${wl}-f,'
# When large executables or shared objects are built, AIX ld can
# have problems creating the table of contents. If linking a library
# or program results in "error TOC overflow" add -mminimal-toc to
# CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
# enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
if test "$with_gcc" = yes; then
case $host_os in aix4.[012]|aix4.[012].*)
# We only want to do this on AIX 4.2 and lower, the check
# below for broken collect2 doesn't work under 4.3+
collect2name=`${CC} -print-prog-name=collect2`
if test -f "$collect2name" && \
strings "$collect2name" | grep resolve_lib_name >/dev/null
then
# We have reworked collect2
hardcode_direct=yes
else
# We have old collect2
hardcode_direct=unsupported
# It fails to find uninstalled libraries when the uninstalled
# path is not listed in the libpath. Setting hardcode_minus_L
# to unsupported forces relinking
hardcode_minus_L=yes
hardcode_libdir_flag_spec='-L$libdir'
hardcode_libdir_separator=
fi
esac
shared_flag='-shared'
else
# not using gcc
if test "$host_cpu" = ia64; then
shared_flag='${wl}-G'
else
shared_flag='${wl}-bM:SRE'
fi
fi
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
aix_use_runtimelinking=no
if test $with_gnu_ld = no; then
exp_sym_flag='-Bexport'
no_entry_flag=""
fi
else
# Test if we are trying to use run time linking, or normal AIX style linking.
# If -brtl is somewhere in LDFLAGS, we need to do run time linking.
aix_use_runtimelinking=no
for ld_flag in $LDFLAGS; do
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then
aix_use_runtimelinking=yes
break
fi
done
exp_sym_flag='-bexport'
no_entry_flag='-bnoentry'
fi
# -bexpall does not export symbols beginning with underscore (_)
always_export_symbols=yes
if test "$aix_use_runtimelinking" = yes; then
# Warning - without using the other run time loading flags (-brtl), -berok will
# link without error, but may produce a broken library.
allow_undefined_flag=' ${wl}-berok'
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
else
if test "$host_cpu" = ia64; then
if test $with_gnu_ld = no; then
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
allow_undefined_flag="-z nodefs"
archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
fi
else
allow_undefined_flag=' ${wl}-berok'
# -bexpall does not export symbols beginning with underscore (_)
always_export_symbols=yes
# Exported symbols can be pulled into shared objects from archives
whole_archive_flag_spec=' '
build_libtool_need_lc=yes
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
# This is similar to how AIX traditionally builds it's shared libraries.
archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
fi
fi
;;
amigaos*)
archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# see comment about different semantics on the GNU ld section
ld_shlibs=no
;;
cygwin* | mingw*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec=' '
allow_undefined_flag=unsupported
# Tell ltmain to make .lib files, not .a files.
libext=lib
# FIXME: Setting linknames here is a bad hack.
archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
# The linker will automatically build a .lib file if we build a DLL.
old_archive_from_new_cmds='true'
# FIXME: Should let the user specify the lib program.
old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
fix_srcfile_path='`cygpath -w "$srcfile"`'
;;
darwin* | rhapsody*)
case "$host_os" in
rhapsody* | darwin1.[[012]])
allow_undefined_flag='-undefined suppress'
;;
*) # Darwin 1.3 on
if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
allow_undefined_flag='-flat_namespace -undefined suppress'
else
case ${MACOSX_DEPLOYMENT_TARGET} in
10.[[012]])
allow_undefined_flag='-flat_namespace -undefined suppress'
;;
10.*)
allow_undefined_flag='-undefined dynamic_lookup'
;;
esac
fi
;;
esac
# Disable shared library build on OS-X older than 10.3.
case $host_os in
darwin[1-6]*)
can_build_shared=no
;;
darwin7*)
can_build_shared=yes
;;
esac
output_verbose_link_cmd='echo'
archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring'
module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
# Don't fix this by using the ld -exported_symbols_list flag,
# it doesn't exist in older darwin ld's
archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
hardcode_direct=no
hardcode_automatic=yes
hardcode_shlibpath_var=unsupported
whole_archive_flag_spec=''
link_all_deplibs=yes
;;
freebsd1*)
ld_shlibs=no
;;
# FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
# support. Future versions do this automatically, but an explicit c++rt0.o
# does not break anything, and helps significantly (at the cost of a little
# extra space).
freebsd2.2*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
freebsd2*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=yes
hardcode_minus_L=yes
hardcode_shlibpath_var=no
;;
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
freebsd* | kfreebsd*-gnu)
archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
hpux9* | hpux10* | hpux11*)
case "$host_cpu" in
ia64*)
hardcode_direct=no
hardcode_shlibpath_var=no
archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
hardcode_libdir_flag_spec='-L$libdir' ;;
*)
if test $with_gcc = yes; then
case "$host_os" in
hpux9*) archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
*) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;;
esac
else
case $host_os in
hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
*) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
esac
fi
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_minus_L=yes # Not in the search PATH, but as the default
# location of the library.
;;
esac
export_dynamic_flag_spec='${wl}-E'
hardcode_direct=yes
;;
irix5* | irix6*)
if test "$with_gcc" = yes; then
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
else
archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
fi
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
link_all_deplibs=yes
;;
netbsd* | knetbsd*-gnu)
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
else
archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
fi
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
newsos6)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
hardcode_direct=yes
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_shlibpath_var=no
;;
openbsd*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
os2*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
allow_undefined_flag=unsupported
archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
;;
osf3*)
if test "$with_gcc" = yes; then
allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
else
allow_undefined_flag=' -expect_unresolved \*'
archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
fi
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
osf4* | osf5*) # as osf3* with the addition of -msym flag
if test "$with_gcc" = yes; then
allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
else
allow_undefined_flag=' -expect_unresolved \*'
archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
# cc supports -rpath directly
hardcode_libdir_flag_spec='-rpath $libdir'
fi
hardcode_libdir_separator=:
;;
sco3.2v5*)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
hardcode_shlibpath_var=no
runpath_var=LD_RUN_PATH
hardcode_runpath_var=yes
;;
solaris*)
no_undefined_flag=' -z defs'
if test "$with_gcc" = yes; then
archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
$CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
else
archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
fi
hardcode_libdir_flag_spec='-R$libdir'
hardcode_shlibpath_var=no
case $host_os in
solaris2.[0-5] | solaris2.[0-5].*) ;;
*) # Supported since Solaris 2.6 (maybe 2.5.1?)
whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
esac
link_all_deplibs=yes
;;
sunos4*)
archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_direct=yes
hardcode_minus_L=yes
hardcode_shlibpath_var=no
;;
sysv4)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
runpath_var='LD_RUN_PATH'
hardcode_shlibpath_var=no
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
;;
sysv4.3*)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
hardcode_shlibpath_var=no
export_dynamic_flag_spec='-Bexport'
;;
sysv5*)
no_undefined_flag=' -z text'
# $CC -shared without GNU ld will not create a library from C++
# object files and a static libstdc++, better avoid it by now
archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
hardcode_libdir_flag_spec=
hardcode_shlibpath_var=no
runpath_var='LD_RUN_PATH'
;;
uts4*)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_shlibpath_var=no
;;
dgux*)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_shlibpath_var=no
;;
sysv4*MP*)
if test -d /usr/nec; then
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
hardcode_shlibpath_var=no
runpath_var=LD_RUN_PATH
hardcode_runpath_var=yes
ld_shlibs=yes
fi
;;
sysv4.2uw2*)
archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=yes
hardcode_minus_L=no
hardcode_shlibpath_var=no
hardcode_runpath_var=yes
runpath_var=LD_RUN_PATH
;;
sysv5uw7* | unixware7*)
no_undefined_flag='${wl}-z ${wl}text'
if test "$GCC" = yes; then
archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
else
archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
fi
runpath_var='LD_RUN_PATH'
hardcode_shlibpath_var=no
;;
*)
ld_shlibs=no
;;
esac
fi
## Compiler Characteristics: PIC flags, static flags, etc
if test "X${ac_cv_prog_cc_pic+set}" = Xset; then
:
else
ac_cv_prog_cc_pic=
ac_cv_prog_cc_shlib=
ac_cv_prog_cc_wl=
ac_cv_prog_cc_static=
ac_cv_prog_cc_no_builtin=
ac_cv_prog_cc_can_build_shared=$can_build_shared
if test "$with_gcc" = yes; then
ac_cv_prog_cc_wl='-Wl,'
ac_cv_prog_cc_static='-static'
case $host_os in
aix*)
# All AIX code is PIC.
if test "$host_cpu" = ia64; then
# AIX 5 now supports IA64 processor
lt_cv_prog_cc_static='-Bstatic'
else
lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
fi
;;
amigaos*)
# FIXME: we need at least 68020 code to build shared libraries, but
# adding the `-m68020' flag to GCC prevents building anything better,
# like `-m68040'.
ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
;;
beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
# PIC is the default for these OSes.
;;
cygwin* | mingw* | os2*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
ac_cv_prog_cc_pic='-DDLL_EXPORT'
;;
darwin* | rhapsody*)
# PIC is the default on this platform
# Common symbols not allowed in MH_DYLIB files
ac_cv_prog_cc_pic='-fno-common'
;;
*djgpp*)
# DJGPP does not support shared libraries at all
ac_cv_prog_cc_pic=
;;
sysv4*MP*)
if test -d /usr/nec; then
ac_cv_prog_cc_pic=-Kconform_pic
fi
;;
*)
ac_cv_prog_cc_pic='-fPIC'
;;
esac
else
# PORTME Check for PIC flags for the system compiler.
case $host_os in
aix*)
# All AIX code is PIC.
ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
;;
hpux9* | hpux10* | hpux11*)
# Is there a better ac_cv_prog_cc_static that works with the bundled CC?
ac_cv_prog_cc_wl='-Wl,'
ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
ac_cv_prog_cc_pic='+Z'
;;
irix5* | irix6*)
ac_cv_prog_cc_wl='-Wl,'
ac_cv_prog_cc_static='-non_shared'
# PIC (with -KPIC) is the default.
;;
cygwin* | mingw* | os2*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
ac_cv_prog_cc_pic='-DDLL_EXPORT'
;;
newsos6)
ac_cv_prog_cc_pic='-KPIC'
ac_cv_prog_cc_static='-Bstatic'
;;
osf3* | osf4* | osf5*)
# All OSF/1 code is PIC.
ac_cv_prog_cc_wl='-Wl,'
ac_cv_prog_cc_static='-non_shared'
;;
sco3.2v5*)
ac_cv_prog_cc_pic='-Kpic'
ac_cv_prog_cc_static='-dn'
ac_cv_prog_cc_shlib='-belf'
;;
solaris*)
ac_cv_prog_cc_pic='-KPIC'
ac_cv_prog_cc_static='-Bstatic'
ac_cv_prog_cc_wl='-Wl,'
;;
sunos4*)
ac_cv_prog_cc_pic='-PIC'
ac_cv_prog_cc_static='-Bstatic'
ac_cv_prog_cc_wl='-Qoption ld '
;;
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
ac_cv_prog_cc_pic='-KPIC'
ac_cv_prog_cc_static='-Bstatic'
ac_cv_prog_cc_wl='-Wl,'
;;
uts4*)
ac_cv_prog_cc_pic='-pic'
ac_cv_prog_cc_static='-Bstatic'
;;
sysv4*MP*)
if test -d /usr/nec ;then
ac_cv_prog_cc_pic='-Kconform_pic'
ac_cv_prog_cc_static='-Bstatic'
fi
;;
*)
ac_cv_prog_cc_can_build_shared=no
;;
esac
fi
case "$host_os" in
# Platforms which do not suport PIC and -DPIC is meaningless
# on them:
*djgpp*)
ac_cv_prog_cc_pic=
;;
*)
ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC"
;;
esac
fi
need_lc=yes
if test "$enable_shared" = yes && test "$with_gcc" = yes; then
case $archive_cmds in
*'~'*)
# FIXME: we may have to deal with multi-command sequences.
;;
'$CC '*)
# Test whether the compiler implicitly links with -lc since on some
# systems, -lgcc has to come before -lc. If gcc already passes -lc
# to ld, don't add -lc before -lgcc.
echo $ac_n "checking whether -lc should be explicitly linked in... $ac_c" 1>&6
if eval "test \"`echo '$''{'ac_cv_archive_cmds_needs_lc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
need_lc=$ac_cv_archive_cmds_needs_lc
else
$rm conftest*
echo "static int dummy;" > conftest.$ac_ext
if { (eval echo ltcf-c.sh:need_lc: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then
# Append any warnings to the config.log.
cat conftest.err 1>&5
soname=conftest
lib=conftest
libobjs=conftest.$objext
deplibs=
wl=$ac_cv_prog_cc_wl
compiler_flags=-v
linker_flags=-v
verstring=
output_objdir=.
libname=conftest
save_allow_undefined_flag=$allow_undefined_flag
allow_undefined_flag=
if { (eval echo ltcf-c.sh:need_lc: \"$archive_cmds\") 1>&5; (eval $archive_cmds) 2>&1 | grep " -lc " 1>&5 ; }; then
need_lc=no
fi
allow_undefined_flag=$save_allow_undefined_flag
else
cat conftest.err 1>&5
fi
fi
$rm conftest*
echo "$ac_t$need_lc" 1>&6
;;
esac
fi
ac_cv_archive_cmds_needs_lc=$need_lc
+2869
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
Arquivo executável
+360
Ver Arquivo
@@ -0,0 +1,360 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2005-06-08.21
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# 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.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case "$1" in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
esac
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program).
case "$1" in
lex|yacc)
# Not GNU programs, they don't have --version.
;;
tar)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
exit 1
fi
;;
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
fi
if [ -f "$file" ]; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
# If the file does not exist, the user really needs makeinfo;
# let's fail without touching anything.
test -f $file || exit 1
touch $file
;;
tar)
shift
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case "$firstarg" in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case "$firstarg" in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:
+283
Ver Arquivo
@@ -0,0 +1,283 @@
/* -----------------------------------------------------------------------
ffi.c - Copyright (c) 1998, 2001, 2007 Red Hat, Inc.
Alpha Foreign Function Interface
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 CYGNUS SOLUTIONS 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.
----------------------------------------------------------------------- */
#include <ffi.h>
#include <ffi_common.h>
#include <stdlib.h>
/* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE;
all further uses in this file will refer to the 128-bit type. */
#if defined(__LONG_DOUBLE_128__)
# if FFI_TYPE_LONGDOUBLE != 4
# error FFI_TYPE_LONGDOUBLE out of date
# endif
#else
# undef FFI_TYPE_LONGDOUBLE
# define FFI_TYPE_LONGDOUBLE 4
#endif
extern void ffi_call_osf(void *, unsigned long, unsigned, void *, void (*)())
FFI_HIDDEN;
extern void ffi_closure_osf(void) FFI_HIDDEN;
ffi_status
ffi_prep_cif_machdep(ffi_cif *cif)
{
/* Adjust cif->bytes to represent a minimum 6 words for the temporary
register argument loading area. */
if (cif->bytes < 6*FFI_SIZEOF_ARG)
cif->bytes = 6*FFI_SIZEOF_ARG;
/* Set the return type flag */
switch (cif->rtype->type)
{
case FFI_TYPE_STRUCT:
case FFI_TYPE_FLOAT:
case FFI_TYPE_DOUBLE:
cif->flags = cif->rtype->type;
break;
case FFI_TYPE_LONGDOUBLE:
/* 128-bit long double is returned in memory, like a struct. */
cif->flags = FFI_TYPE_STRUCT;
break;
default:
cif->flags = FFI_TYPE_INT;
break;
}
return FFI_OK;
}
void
ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue)
{
unsigned long *stack, *argp;
long i, avn;
ffi_type **arg_types;
/* If the return value is a struct and we don't have a return
value address then we need to make one. */
if (rvalue == NULL && cif->flags == FFI_TYPE_STRUCT)
rvalue = alloca(cif->rtype->size);
/* Allocate the space for the arguments, plus 4 words of temp
space for ffi_call_osf. */
argp = stack = alloca(cif->bytes + 4*FFI_SIZEOF_ARG);
if (cif->flags == FFI_TYPE_STRUCT)
*(void **) argp++ = rvalue;
i = 0;
avn = cif->nargs;
arg_types = cif->arg_types;
while (i < avn)
{
size_t size = (*arg_types)->size;
switch ((*arg_types)->type)
{
case FFI_TYPE_SINT8:
*(SINT64 *) argp = *(SINT8 *)(* avalue);
break;
case FFI_TYPE_UINT8:
*(SINT64 *) argp = *(UINT8 *)(* avalue);
break;
case FFI_TYPE_SINT16:
*(SINT64 *) argp = *(SINT16 *)(* avalue);
break;
case FFI_TYPE_UINT16:
*(SINT64 *) argp = *(UINT16 *)(* avalue);
break;
case FFI_TYPE_SINT32:
case FFI_TYPE_UINT32:
/* Note that unsigned 32-bit quantities are sign extended. */
*(SINT64 *) argp = *(SINT32 *)(* avalue);
break;
case FFI_TYPE_SINT64:
case FFI_TYPE_UINT64:
case FFI_TYPE_POINTER:
*(UINT64 *) argp = *(UINT64 *)(* avalue);
break;
case FFI_TYPE_FLOAT:
if (argp - stack < 6)
{
/* Note the conversion -- all the fp regs are loaded as
doubles. The in-register format is the same. */
*(double *) argp = *(float *)(* avalue);
}
else
*(float *) argp = *(float *)(* avalue);
break;
case FFI_TYPE_DOUBLE:
*(double *) argp = *(double *)(* avalue);
break;
case FFI_TYPE_LONGDOUBLE:
/* 128-bit long double is passed by reference. */
*(long double **) argp = (long double *)(* avalue);
size = sizeof (long double *);
break;
case FFI_TYPE_STRUCT:
memcpy(argp, *avalue, (*arg_types)->size);
break;
default:
FFI_ASSERT(0);
}
argp += ALIGN(size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
i++, arg_types++, avalue++;
}
ffi_call_osf(stack, cif->bytes, cif->flags, rvalue, fn);
}
ffi_status
ffi_prep_closure_loc (ffi_closure* closure,
ffi_cif* cif,
void (*fun)(ffi_cif*, void*, void**, void*),
void *user_data,
void *codeloc)
{
unsigned int *tramp;
tramp = (unsigned int *) &closure->tramp[0];
tramp[0] = 0x47fb0401; /* mov $27,$1 */
tramp[1] = 0xa77b0010; /* ldq $27,16($27) */
tramp[2] = 0x6bfb0000; /* jmp $31,($27),0 */
tramp[3] = 0x47ff041f; /* nop */
*(void **) &tramp[4] = ffi_closure_osf;
closure->cif = cif;
closure->fun = fun;
closure->user_data = user_data;
/* Flush the Icache.
Tru64 UNIX as doesn't understand the imb mnemonic, so use call_pal
instead, since both Compaq as and gas can handle it.
0x86 is PAL_imb in Tru64 UNIX <alpha/pal.h>. */
asm volatile ("call_pal 0x86" : : : "memory");
return FFI_OK;
}
long FFI_HIDDEN
ffi_closure_osf_inner(ffi_closure *closure, void *rvalue, unsigned long *argp)
{
ffi_cif *cif;
void **avalue;
ffi_type **arg_types;
long i, avn, argn;
cif = closure->cif;
avalue = alloca(cif->nargs * sizeof(void *));
argn = 0;
/* Copy the caller's structure return address to that the closure
returns the data directly to the caller. */
if (cif->flags == FFI_TYPE_STRUCT)
{
rvalue = (void *) argp[0];
argn = 1;
}
i = 0;
avn = cif->nargs;
arg_types = cif->arg_types;
/* Grab the addresses of the arguments from the stack frame. */
while (i < avn)
{
size_t size = arg_types[i]->size;
switch (arg_types[i]->type)
{
case FFI_TYPE_SINT8:
case FFI_TYPE_UINT8:
case FFI_TYPE_SINT16:
case FFI_TYPE_UINT16:
case FFI_TYPE_SINT32:
case FFI_TYPE_UINT32:
case FFI_TYPE_SINT64:
case FFI_TYPE_UINT64:
case FFI_TYPE_POINTER:
case FFI_TYPE_STRUCT:
avalue[i] = &argp[argn];
break;
case FFI_TYPE_FLOAT:
if (argn < 6)
{
/* Floats coming from registers need conversion from double
back to float format. */
*(float *)&argp[argn - 6] = *(double *)&argp[argn - 6];
avalue[i] = &argp[argn - 6];
}
else
avalue[i] = &argp[argn];
break;
case FFI_TYPE_DOUBLE:
avalue[i] = &argp[argn - (argn < 6 ? 6 : 0)];
break;
case FFI_TYPE_LONGDOUBLE:
/* 128-bit long double is passed by reference. */
avalue[i] = (long double *) argp[argn];
size = sizeof (long double *);
break;
default:
abort ();
}
argn += ALIGN(size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
i++;
}
/* Invoke the closure. */
closure->fun (cif, rvalue, avalue, closure->user_data);
/* Tell ffi_closure_osf how to perform return type promotions. */
return cif->rtype->type;
}
+47
Ver Arquivo
@@ -0,0 +1,47 @@
/* -----------------------------------------------------------------*-C-*-
ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc.
Target configuration macros for Alpha.
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 CYGNUS SOLUTIONS 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.
----------------------------------------------------------------------- */
#ifndef LIBFFI_TARGET_H
#define LIBFFI_TARGET_H
#ifndef LIBFFI_ASM
typedef unsigned long ffi_arg;
typedef signed long ffi_sarg;
typedef enum ffi_abi {
FFI_FIRST_ABI = 0,
FFI_OSF,
FFI_LAST_ABI,
FFI_DEFAULT_ABI = FFI_OSF
} ffi_abi;
#endif
/* ---- Definitions for closures ----------------------------------------- */
#define FFI_CLOSURES 1
#define FFI_TRAMPOLINE_SIZE 24
#define FFI_NATIVE_RAW_API 0
#endif
+361
Ver Arquivo
@@ -0,0 +1,361 @@
/* -----------------------------------------------------------------------
osf.S - Copyright (c) 1998, 2001, 2007 Red Hat
Alpha/OSF Foreign Function Interface
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 CYGNUS SOLUTIONS 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.
----------------------------------------------------------------------- */
#define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h>
.arch ev6
.text
/* ffi_call_osf (void *args, unsigned long bytes, unsigned flags,
void *raddr, void (*fnaddr)());
Bit o trickiness here -- ARGS+BYTES is the base of the stack frame
for this function. This has been allocated by ffi_call. We also
deallocate some of the stack that has been alloca'd. */
.align 3
.globl ffi_call_osf
.ent ffi_call_osf
FFI_HIDDEN(ffi_call_osf)
ffi_call_osf:
.frame $15, 32, $26, 0
.mask 0x4008000, -32
$LFB1:
addq $16,$17,$1
mov $16, $30
stq $26, 0($1)
stq $15, 8($1)
stq $18, 16($1)
mov $1, $15
$LCFI1:
.prologue 0
stq $19, 24($1)
mov $20, $27
# Load up all of the (potential) argument registers.
ldq $16, 0($30)
ldt $f16, 0($30)
ldt $f17, 8($30)
ldq $17, 8($30)
ldt $f18, 16($30)
ldq $18, 16($30)
ldt $f19, 24($30)
ldq $19, 24($30)
ldt $f20, 32($30)
ldq $20, 32($30)
ldt $f21, 40($30)
ldq $21, 40($30)
# Deallocate the register argument area.
lda $30, 48($30)
jsr $26, ($27), 0
ldgp $29, 0($26)
# If the return value pointer is NULL, assume no return value.
ldq $19, 24($15)
ldq $18, 16($15)
ldq $26, 0($15)
$LCFI2:
beq $19, $noretval
# Store the return value out in the proper type.
cmpeq $18, FFI_TYPE_INT, $1
bne $1, $retint
cmpeq $18, FFI_TYPE_FLOAT, $2
bne $2, $retfloat
cmpeq $18, FFI_TYPE_DOUBLE, $3
bne $3, $retdouble
.align 3
$noretval:
ldq $15, 8($15)
ret
.align 4
$retint:
stq $0, 0($19)
nop
ldq $15, 8($15)
ret
.align 4
$retfloat:
sts $f0, 0($19)
nop
ldq $15, 8($15)
ret
.align 4
$retdouble:
stt $f0, 0($19)
nop
ldq $15, 8($15)
ret
$LFE1:
.end ffi_call_osf
/* ffi_closure_osf(...)
Receives the closure argument in $1. */
.align 3
.globl ffi_closure_osf
.ent ffi_closure_osf
FFI_HIDDEN(ffi_closure_osf)
ffi_closure_osf:
.frame $30, 16*8, $26, 0
.mask 0x4000000, -16*8
$LFB2:
ldgp $29, 0($27)
subq $30, 16*8, $30
$LCFI5:
stq $26, 0($30)
$LCFI6:
.prologue 1
# Store all of the potential argument registers in va_list format.
stt $f16, 4*8($30)
stt $f17, 5*8($30)
stt $f18, 6*8($30)
stt $f19, 7*8($30)
stt $f20, 8*8($30)
stt $f21, 9*8($30)
stq $16, 10*8($30)
stq $17, 11*8($30)
stq $18, 12*8($30)
stq $19, 13*8($30)
stq $20, 14*8($30)
stq $21, 15*8($30)
# Call ffi_closure_osf_inner to do the bulk of the work.
mov $1, $16
lda $17, 2*8($30)
lda $18, 10*8($30)
jsr $26, ffi_closure_osf_inner
ldgp $29, 0($26)
ldq $26, 0($30)
# Load up the return value in the proper type.
lda $1, $load_table
s4addq $0, $1, $1
ldl $1, 0($1)
addq $1, $29, $1
jmp $31, ($1), $load_32
.align 4
$load_none:
addq $30, 16*8, $30
ret
.align 4
$load_float:
lds $f0, 16($30)
nop
addq $30, 16*8, $30
ret
.align 4
$load_double:
ldt $f0, 16($30)
nop
addq $30, 16*8, $30
ret
.align 4
$load_u8:
#ifdef __alpha_bwx__
ldbu $0, 16($30)
nop
#else
ldq $0, 16($30)
and $0, 255, $0
#endif
addq $30, 16*8, $30
ret
.align 4
$load_s8:
#ifdef __alpha_bwx__
ldbu $0, 16($30)
sextb $0, $0
#else
ldq $0, 16($30)
sll $0, 56, $0
sra $0, 56, $0
#endif
addq $30, 16*8, $30
ret
.align 4
$load_u16:
#ifdef __alpha_bwx__
ldwu $0, 16($30)
nop
#else
ldq $0, 16($30)
zapnot $0, 3, $0
#endif
addq $30, 16*8, $30
ret
.align 4
$load_s16:
#ifdef __alpha_bwx__
ldwu $0, 16($30)
sextw $0, $0
#else
ldq $0, 16($30)
sll $0, 48, $0
sra $0, 48, $0
#endif
addq $30, 16*8, $30
ret
.align 4
$load_32:
ldl $0, 16($30)
nop
addq $30, 16*8, $30
ret
.align 4
$load_64:
ldq $0, 16($30)
nop
addq $30, 16*8, $30
ret
$LFE2:
.end ffi_closure_osf
#ifdef __ELF__
.section .rodata
#else
.rdata
#endif
$load_table:
.gprel32 $load_none # FFI_TYPE_VOID
.gprel32 $load_32 # FFI_TYPE_INT
.gprel32 $load_float # FFI_TYPE_FLOAT
.gprel32 $load_double # FFI_TYPE_DOUBLE
.gprel32 $load_none # FFI_TYPE_LONGDOUBLE
.gprel32 $load_u8 # FFI_TYPE_UINT8
.gprel32 $load_s8 # FFI_TYPE_SINT8
.gprel32 $load_u16 # FFI_TYPE_UINT16
.gprel32 $load_s16 # FFI_TYPE_SINT16
.gprel32 $load_32 # FFI_TYPE_UINT32
.gprel32 $load_32 # FFI_TYPE_SINT32
.gprel32 $load_64 # FFI_TYPE_UINT64
.gprel32 $load_64 # FFI_TYPE_SINT64
.gprel32 $load_none # FFI_TYPE_STRUCT
.gprel32 $load_64 # FFI_TYPE_POINTER
/* Assert that the table above is in sync with ffi.h. */
#if FFI_TYPE_FLOAT != 2 \
|| FFI_TYPE_DOUBLE != 3 \
|| FFI_TYPE_UINT8 != 5 \
|| FFI_TYPE_SINT8 != 6 \
|| FFI_TYPE_UINT16 != 7 \
|| FFI_TYPE_SINT16 != 8 \
|| FFI_TYPE_UINT32 != 9 \
|| FFI_TYPE_SINT32 != 10 \
|| FFI_TYPE_UINT64 != 11 \
|| FFI_TYPE_SINT64 != 12 \
|| FFI_TYPE_STRUCT != 13 \
|| FFI_TYPE_POINTER != 14 \
|| FFI_TYPE_LAST != 14
#error "osf.S out of sync with ffi.h"
#endif
#ifdef __ELF__
.section .eh_frame,EH_FRAME_FLAGS,@progbits
__FRAME_BEGIN__:
.4byte $LECIE1-$LSCIE1 # Length of Common Information Entry
$LSCIE1:
.4byte 0x0 # CIE Identifier Tag
.byte 0x1 # CIE Version
.ascii "zR\0" # CIE Augmentation
.byte 0x1 # uleb128 0x1; CIE Code Alignment Factor
.byte 0x78 # sleb128 -8; CIE Data Alignment Factor
.byte 26 # CIE RA Column
.byte 0x1 # uleb128 0x1; Augmentation size
.byte 0x1b # FDE Encoding (pcrel sdata4)
.byte 0xc # DW_CFA_def_cfa
.byte 30 # uleb128 column 30
.byte 0 # uleb128 offset 0
.align 3
$LECIE1:
$LSFDE1:
.4byte $LEFDE1-$LASFDE1 # FDE Length
$LASFDE1:
.4byte $LASFDE1-__FRAME_BEGIN__ # FDE CIE offset
.4byte $LFB1-. # FDE initial location
.4byte $LFE1-$LFB1 # FDE address range
.byte 0x0 # uleb128 0x0; Augmentation size
.byte 0x4 # DW_CFA_advance_loc4
.4byte $LCFI1-$LFB1
.byte 0x9a # DW_CFA_offset, column 26
.byte 4 # uleb128 4*-8
.byte 0x8f # DW_CFA_offset, column 15
.byte 0x3 # uleb128 3*-8
.byte 0xc # DW_CFA_def_cfa
.byte 15 # uleb128 column 15
.byte 32 # uleb128 offset 32
.byte 0x4 # DW_CFA_advance_loc4
.4byte $LCFI2-$LCFI1
.byte 0xda # DW_CFA_restore, column 26
.align 3
$LEFDE1:
$LSFDE3:
.4byte $LEFDE3-$LASFDE3 # FDE Length
$LASFDE3:
.4byte $LASFDE3-__FRAME_BEGIN__ # FDE CIE offset
.4byte $LFB2-. # FDE initial location
.4byte $LFE2-$LFB2 # FDE address range
.byte 0x0 # uleb128 0x0; Augmentation size
.byte 0x4 # DW_CFA_advance_loc4
.4byte $LCFI5-$LFB2
.byte 0xe # DW_CFA_def_cfa_offset
.byte 0x80,0x1 # uleb128 128
.byte 0x4 # DW_CFA_advance_loc4
.4byte $LCFI6-$LCFI5
.byte 0x9a # DW_CFA_offset, column 26
.byte 16 # uleb128 offset 16*-8
.align 3
$LEFDE3:
#endif
+308
Ver Arquivo
@@ -0,0 +1,308 @@
/* -----------------------------------------------------------------------
ffi.c - Copyright (c) 1998 Red Hat, Inc.
ARM Foreign Function Interface
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 CYGNUS SOLUTIONS 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.
----------------------------------------------------------------------- */
#include <ffi.h>
#include <ffi_common.h>
#include <stdlib.h>
/* ffi_prep_args is called by the assembly routine once stack space
has been allocated for the function's arguments */
void ffi_prep_args(char *stack, extended_cif *ecif)
{
register unsigned int i;
register void **p_argv;
register char *argp;
register ffi_type **p_arg;
argp = stack;
if ( ecif->cif->flags == FFI_TYPE_STRUCT ) {
*(void **) argp = ecif->rvalue;
argp += 4;
}
p_argv = ecif->avalue;
for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
(i != 0);
i--, p_arg++)
{
size_t z;
/* Align if necessary */
if (((*p_arg)->alignment - 1) & (unsigned) argp) {
argp = (char *) ALIGN(argp, (*p_arg)->alignment);
}
if ((*p_arg)->type == FFI_TYPE_STRUCT)
argp = (char *) ALIGN(argp, 4);
z = (*p_arg)->size;
if (z < sizeof(int))
{
z = sizeof(int);
switch ((*p_arg)->type)
{
case FFI_TYPE_SINT8:
*(signed int *) argp = (signed int)*(SINT8 *)(* p_argv);
break;
case FFI_TYPE_UINT8:
*(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv);
break;
case FFI_TYPE_SINT16:
*(signed int *) argp = (signed int)*(SINT16 *)(* p_argv);
break;
case FFI_TYPE_UINT16:
*(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv);
break;
case FFI_TYPE_STRUCT:
memcpy(argp, *p_argv, (*p_arg)->size);
break;
default:
FFI_ASSERT(0);
}
}
else if (z == sizeof(int))
{
*(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
}
else
{
memcpy(argp, *p_argv, z);
}
p_argv++;
argp += z;
}
return;
}
/* Perform machine dependent cif processing */
ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
{
/* Round the stack up to a multiple of 8 bytes. This isn't needed
everywhere, but it is on some platforms, and it doesn't harm anything
when it isn't needed. */
cif->bytes = (cif->bytes + 7) & ~7;
/* Set the return type flag */
switch (cif->rtype->type)
{
case FFI_TYPE_VOID:
case FFI_TYPE_FLOAT:
case FFI_TYPE_DOUBLE:
cif->flags = (unsigned) cif->rtype->type;
break;
case FFI_TYPE_SINT64:
case FFI_TYPE_UINT64:
cif->flags = (unsigned) FFI_TYPE_SINT64;
break;
case FFI_TYPE_STRUCT:
if (cif->rtype->size <= 4)
/* A Composite Type not larger than 4 bytes is returned in r0. */
cif->flags = (unsigned)FFI_TYPE_INT;
else
/* A Composite Type larger than 4 bytes, or whose size cannot
be determined statically ... is stored in memory at an
address passed [in r0]. */
cif->flags = (unsigned)FFI_TYPE_STRUCT;
break;
default:
cif->flags = FFI_TYPE_INT;
break;
}
return FFI_OK;
}
extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *,
unsigned, unsigned, unsigned *, void (*fn)());
void ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue)
{
extended_cif ecif;
int small_struct = (cif->flags == FFI_TYPE_INT
&& cif->rtype->type == FFI_TYPE_STRUCT);
ecif.cif = cif;
ecif.avalue = avalue;
unsigned int temp;
/* If the return value is a struct and we don't have a return */
/* value address then we need to make one */
if ((rvalue == NULL) &&
(cif->flags == FFI_TYPE_STRUCT))
{
ecif.rvalue = alloca(cif->rtype->size);
}
else if (small_struct)
ecif.rvalue = &temp;
else
ecif.rvalue = rvalue;
switch (cif->abi)
{
case FFI_SYSV:
ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue,
fn);
break;
default:
FFI_ASSERT(0);
break;
}
if (small_struct)
memcpy (rvalue, &temp, cif->rtype->size);
}
/** private members **/
static void ffi_prep_incoming_args_SYSV (char *stack, void **ret,
void** args, ffi_cif* cif);
void ffi_closure_SYSV (ffi_closure *);
/* This function is jumped to by the trampoline */
unsigned int
ffi_closure_SYSV_inner (closure, respp, args)
ffi_closure *closure;
void **respp;
void *args;
{
// our various things...
ffi_cif *cif;
void **arg_area;
cif = closure->cif;
arg_area = (void**) alloca (cif->nargs * sizeof (void*));
/* this call will initialize ARG_AREA, such that each
* element in that array points to the corresponding
* value on the stack; and if the function returns
* a structure, it will re-set RESP to point to the
* structure return address. */
ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif);
(closure->fun) (cif, *respp, arg_area, closure->user_data);
return cif->flags;
}
/*@-exportheader@*/
static void
ffi_prep_incoming_args_SYSV(char *stack, void **rvalue,
void **avalue, ffi_cif *cif)
/*@=exportheader@*/
{
register unsigned int i;
register void **p_argv;
register char *argp;
register ffi_type **p_arg;
argp = stack;
if ( cif->flags == FFI_TYPE_STRUCT ) {
*rvalue = *(void **) argp;
argp += 4;
}
p_argv = avalue;
for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++)
{
size_t z;
size_t alignment = (*p_arg)->alignment;
if (alignment < 4)
alignment = 4;
/* Align if necessary */
if ((alignment - 1) & (unsigned) argp) {
argp = (char *) ALIGN(argp, alignment);
}
z = (*p_arg)->size;
/* because we're little endian, this is what it turns into. */
*p_argv = (void*) argp;
p_argv++;
argp += z;
}
return;
}
/* How to make a trampoline. */
#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \
({ unsigned char *__tramp = (unsigned char*)(TRAMP); \
unsigned int __fun = (unsigned int)(FUN); \
unsigned int __ctx = (unsigned int)(CTX); \
*(unsigned int*) &__tramp[0] = 0xe92d000f; /* stmfd sp!, {r0-r3} */ \
*(unsigned int*) &__tramp[4] = 0xe59f0000; /* ldr r0, [pc] */ \
*(unsigned int*) &__tramp[8] = 0xe59ff000; /* ldr pc, [pc] */ \
*(unsigned int*) &__tramp[12] = __ctx; \
*(unsigned int*) &__tramp[16] = __fun; \
__clear_cache((&__tramp[0]), (&__tramp[19])); \
})
/* the cif must already be prep'ed */
ffi_status
ffi_prep_closure_loc (ffi_closure* closure,
ffi_cif* cif,
void (*fun)(ffi_cif*,void*,void**,void*),
void *user_data,
void *codeloc)
{
FFI_ASSERT (cif->abi == FFI_SYSV);
FFI_INIT_TRAMPOLINE (&closure->tramp[0], \
&ffi_closure_SYSV, \
codeloc);
closure->cif = cif;
closure->user_data = user_data;
closure->fun = fun;
return FFI_OK;
}
+48
Ver Arquivo
@@ -0,0 +1,48 @@
/* -----------------------------------------------------------------*-C-*-
ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc.
Target configuration macros for ARM.
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 CYGNUS SOLUTIONS 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.
----------------------------------------------------------------------- */
#ifndef LIBFFI_TARGET_H
#define LIBFFI_TARGET_H
#ifndef LIBFFI_ASM
typedef unsigned long ffi_arg;
typedef signed long ffi_sarg;
typedef enum ffi_abi {
FFI_FIRST_ABI = 0,
FFI_SYSV,
FFI_DEFAULT_ABI = FFI_SYSV,
FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
} ffi_abi;
#endif
/* ---- Definitions for closures ----------------------------------------- */
#define FFI_CLOSURES 1
#define FFI_TRAMPOLINE_SIZE 20
#define FFI_NATIVE_RAW_API 0
#endif
+295
Ver Arquivo
@@ -0,0 +1,295 @@
/* -----------------------------------------------------------------------
sysv.S - Copyright (c) 1998 Red Hat, Inc.
ARM Foreign Function Interface
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 CYGNUS SOLUTIONS 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.
----------------------------------------------------------------------- */
#define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h>
#ifdef HAVE_MACHINE_ASM_H
#include <machine/asm.h>
#else
#ifdef __USER_LABEL_PREFIX__
#define CONCAT1(a, b) CONCAT2(a, b)
#define CONCAT2(a, b) a ## b
/* Use the right prefix for global labels. */
#define CNAME(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
#else
#define CNAME(x) x
#endif
#define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x):
#endif
#ifdef __ELF__
#define LSYM(x) .x
#else
#define LSYM(x) x
#endif
/* We need a better way of testing for this, but for now, this is all
we can do. */
@ This selects the minimum architecture level required.
#define __ARM_ARCH__ 3
#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)
# undef __ARM_ARCH__
# define __ARM_ARCH__ 4
#endif
#if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \
|| defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \
|| defined(__ARM_ARCH_5TEJ__)
# undef __ARM_ARCH__
# define __ARM_ARCH__ 5
#endif
#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
|| defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \
|| defined(__ARM_ARCH_6ZK__)
# undef __ARM_ARCH__
# define __ARM_ARCH__ 6
#endif
#if __ARM_ARCH__ >= 5
# define call_reg(x) blx x
#elif defined (__ARM_ARCH_4T__)
# define call_reg(x) mov lr, pc ; bx x
# if defined(__thumb__) || defined(__THUMB_INTERWORK__)
# define __INTERWORKING__
# endif
#else
# define call_reg(x) mov lr, pc ; mov pc, x
#endif
/* Conditionally compile unwinder directives. */
#ifdef __ARM_EABI__
#define UNWIND
#else
#define UNWIND @
#endif
#if defined(__thumb__) && !defined(__THUMB_INTERWORK__)
.macro ARM_FUNC_START name
.text
.align 0
.thumb
.thumb_func
ENTRY(\name)
bx pc
nop
.arm
UNWIND .fnstart
/* A hook to tell gdb that we've switched to ARM mode. Also used to call
directly from other local arm routines. */
_L__\name:
.endm
#else
.macro ARM_FUNC_START name
.text
.align 0
.arm
ENTRY(\name)
UNWIND .fnstart
.endm
#endif
.macro RETLDM regs=, cond=, dirn=ia
#if defined (__INTERWORKING__)
.ifc "\regs",""
ldr\cond lr, [sp], #4
.else
ldm\cond\dirn sp!, {\regs, lr}
.endif
bx\cond lr
#else
.ifc "\regs",""
ldr\cond pc, [sp], #4
.else
ldm\cond\dirn sp!, {\regs, pc}
.endif
#endif
.endm
@ r0: ffi_prep_args
@ r1: &ecif
@ r2: cif->bytes
@ r3: fig->flags
@ sp+0: ecif.rvalue
@ sp+4: fn
@ This assumes we are using gas.
ARM_FUNC_START ffi_call_SYSV
@ Save registers
stmfd sp!, {r0-r3, fp, lr}
UNWIND .save {r0-r3, fp, lr}
mov fp, sp
UNWIND .setfp fp, sp
@ Make room for all of the new args.
sub sp, fp, r2
@ Place all of the ffi_prep_args in position
mov ip, r0
mov r0, sp
@ r1 already set
@ Call ffi_prep_args(stack, &ecif)
call_reg(ip)
@ move first 4 parameters in registers
ldmia sp, {r0-r3}
@ and adjust stack
ldr ip, [fp, #8]
cmp ip, #16
movhs ip, #16
add sp, sp, ip
@ call (fn) (...)
ldr ip, [fp, #28]
call_reg(ip)
@ Remove the space we pushed for the args
mov sp, fp
@ Load r2 with the pointer to storage for the return value
ldr r2, [sp, #24]
@ Load r3 with the return type code
ldr r3, [sp, #12]
@ If the return value pointer is NULL, assume no return value.
cmp r2, #0
beq LSYM(Lepilogue)
@ return INT
cmp r3, #FFI_TYPE_INT
#ifdef __SOFTFP__
cmpne r3, #FFI_TYPE_FLOAT
#endif
streq r0, [r2]
beq LSYM(Lepilogue)
@ return INT64
cmp r3, #FFI_TYPE_SINT64
#ifdef __SOFTFP__
cmpne r3, #FFI_TYPE_DOUBLE
#endif
stmeqia r2, {r0, r1}
#ifndef __SOFTFP__
beq LSYM(Lepilogue)
@ return FLOAT
cmp r3, #FFI_TYPE_FLOAT
stfeqs f0, [r2]
beq LSYM(Lepilogue)
@ return DOUBLE or LONGDOUBLE
cmp r3, #FFI_TYPE_DOUBLE
stfeqd f0, [r2]
#endif
LSYM(Lepilogue):
RETLDM "r0-r3,fp"
.ffi_call_SYSV_end:
UNWIND .fnend
.size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV)
/*
unsigned int FFI_HIDDEN
ffi_closure_SYSV_inner (closure, respp, args)
ffi_closure *closure;
void **respp;
void *args;
*/
ARM_FUNC_START ffi_closure_SYSV
UNWIND .pad #16
add ip, sp, #16
stmfd sp!, {ip, lr}
UNWIND .save {r0, lr}
add r2, sp, #8
.pad #16
sub sp, sp, #16
str sp, [sp, #8]
add r1, sp, #8
bl ffi_closure_SYSV_inner
cmp r0, #FFI_TYPE_INT
beq .Lretint
cmp r0, #FFI_TYPE_FLOAT
#ifdef __SOFTFP__
beq .Lretint
#else
beq .Lretfloat
#endif
cmp r0, #FFI_TYPE_DOUBLE
#ifdef __SOFTFP__
beq .Lretlonglong
#else
beq .Lretdouble
#endif
cmp r0, #FFI_TYPE_LONGDOUBLE
#ifdef __SOFTFP__
beq .Lretlonglong
#else
beq .Lretlongdouble
#endif
cmp r0, #FFI_TYPE_SINT64
beq .Lretlonglong
.Lclosure_epilogue:
add sp, sp, #16
ldmfd sp, {sp, pc}
.Lretint:
ldr r0, [sp]
b .Lclosure_epilogue
.Lretlonglong:
ldr r0, [sp]
ldr r1, [sp, #4]
b .Lclosure_epilogue
#ifndef __SOFTFP__
.Lretfloat:
ldfs f0, [sp]
b .Lclosure_epilogue
.Lretdouble:
ldfd f0, [sp]
b .Lclosure_epilogue
.Lretlongdouble:
ldfd f0, [sp]
b .Lclosure_epilogue
#endif
.ffi_closure_SYSV_end:
UNWIND .fnend
.size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV)
+574
Ver Arquivo
@@ -0,0 +1,574 @@
/* -----------------------------------------------------------------------
closures.c - Copyright (c) 2007 Red Hat, Inc.
Copyright (C) 2007 Free Software Foundation, Inc
Code to allocate and deallocate memory for closures.
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 CYGNUS SOLUTIONS 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.
----------------------------------------------------------------------- */
#if defined __linux__ && !defined _GNU_SOURCE
#define _GNU_SOURCE 1
#endif
#include <ffi.h>
#include <ffi_common.h>
#ifndef FFI_MMAP_EXEC_WRIT
# if __gnu_linux__
/* This macro indicates it may be forbidden to map anonymous memory
with both write and execute permission. Code compiled when this
option is defined will attempt to map such pages once, but if it
fails, it falls back to creating a temporary file in a writable and
executable filesystem and mapping pages from it into separate
locations in the virtual memory space, one location writable and
another executable. */
# define FFI_MMAP_EXEC_WRIT 1
# endif
#endif
#if FFI_MMAP_EXEC_WRIT && !defined FFI_MMAP_EXEC_SELINUX
# ifdef __linux__
/* When defined to 1 check for SELinux and if SELinux is active,
don't attempt PROT_EXEC|PROT_WRITE mapping at all, as that
might cause audit messages. */
# define FFI_MMAP_EXEC_SELINUX 1
# endif
#endif
#if FFI_CLOSURES
# if FFI_MMAP_EXEC_WRIT
#define USE_LOCKS 1
#define USE_DL_PREFIX 1
#define USE_BUILTIN_FFS 1
/* We need to use mmap, not sbrk. */
#define HAVE_MORECORE 0
/* We could, in theory, support mremap, but it wouldn't buy us anything. */
#define HAVE_MREMAP 0
/* We have no use for this, so save some code and data. */
#define NO_MALLINFO 1
/* We need all allocations to be in regular segments, otherwise we
lose track of the corresponding code address. */
#define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T
/* Don't allocate more than a page unless needed. */
#define DEFAULT_GRANULARITY ((size_t)malloc_getpagesize)
#if FFI_CLOSURE_TEST
/* Don't release single pages, to avoid a worst-case scenario of
continuously allocating and releasing single pages, but release
pairs of pages, which should do just as well given that allocations
are likely to be small. */
#define DEFAULT_TRIM_THRESHOLD ((size_t)malloc_getpagesize)
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <mntent.h>
#include <sys/param.h>
#include <pthread.h>
/* We don't want sys/mman.h to be included after we redefine mmap and
dlmunmap. */
#include <sys/mman.h>
#define LACKS_SYS_MMAN_H 1
#if FFI_MMAP_EXEC_SELINUX
#include <sys/statfs.h>
#include <stdlib.h>
static int selinux_enabled = -1;
static int
selinux_enabled_check (void)
{
struct statfs sfs;
FILE *f;
char *buf = NULL;
size_t len = 0;
if (statfs ("/selinux", &sfs) >= 0
&& (unsigned int) sfs.f_type == 0xf97cff8cU)
return 1;
f = fopen ("/proc/mounts", "r");
if (f == NULL)
return 0;
while (getline (&buf, &len, f) >= 0)
{
char *p = strchr (buf, ' ');
if (p == NULL)
break;
p = strchr (p + 1, ' ');
if (p == NULL)
break;
if (strncmp (p + 1, "selinuxfs ", 10) != 0)
{
free (buf);
fclose (f);
return 1;
}
}
free (buf);
fclose (f);
return 0;
}
#define is_selinux_enabled() (selinux_enabled >= 0 ? selinux_enabled \
: (selinux_enabled = selinux_enabled_check ()))
#else
#define is_selinux_enabled() 0
#endif
/* Declare all functions defined in dlmalloc.c as static. */
static void *dlmalloc(size_t);
static void dlfree(void*);
static void *dlcalloc(size_t, size_t) MAYBE_UNUSED;
static void *dlrealloc(void *, size_t) MAYBE_UNUSED;
static void *dlmemalign(size_t, size_t) MAYBE_UNUSED;
static void *dlvalloc(size_t) MAYBE_UNUSED;
static int dlmallopt(int, int) MAYBE_UNUSED;
static size_t dlmalloc_footprint(void) MAYBE_UNUSED;
static size_t dlmalloc_max_footprint(void) MAYBE_UNUSED;
static void** dlindependent_calloc(size_t, size_t, void**) MAYBE_UNUSED;
static void** dlindependent_comalloc(size_t, size_t*, void**) MAYBE_UNUSED;
static void *dlpvalloc(size_t) MAYBE_UNUSED;
static int dlmalloc_trim(size_t) MAYBE_UNUSED;
static size_t dlmalloc_usable_size(void*) MAYBE_UNUSED;
static void dlmalloc_stats(void) MAYBE_UNUSED;
/* Use these for mmap and munmap within dlmalloc.c. */
static void *dlmmap(void *, size_t, int, int, int, off_t);
static int dlmunmap(void *, size_t);
#define mmap dlmmap
#define munmap dlmunmap
#include "dlmalloc.c"
#undef mmap
#undef munmap
/* A mutex used to synchronize access to *exec* variables in this file. */
static pthread_mutex_t open_temp_exec_file_mutex = PTHREAD_MUTEX_INITIALIZER;
/* A file descriptor of a temporary file from which we'll map
executable pages. */
static int execfd = -1;
/* The amount of space already allocated from the temporary file. */
static size_t execsize = 0;
/* Open a temporary file name, and immediately unlink it. */
static int
open_temp_exec_file_name (char *name)
{
int fd = mkstemp (name);
if (fd != -1)
unlink (name);
return fd;
}
/* Open a temporary file in the named directory. */
static int
open_temp_exec_file_dir (const char *dir)
{
static const char suffix[] = "/ffiXXXXXX";
int lendir = strlen (dir);
char *tempname = __builtin_alloca (lendir + sizeof (suffix));
if (!tempname)
return -1;
memcpy (tempname, dir, lendir);
memcpy (tempname + lendir, suffix, sizeof (suffix));
return open_temp_exec_file_name (tempname);
}
/* Open a temporary file in the directory in the named environment
variable. */
static int
open_temp_exec_file_env (const char *envvar)
{
const char *value = getenv (envvar);
if (!value)
return -1;
return open_temp_exec_file_dir (value);
}
/* Open a temporary file in an executable and writable mount point
listed in the mounts file. Subsequent calls with the same mounts
keep searching for mount points in the same file. Providing NULL
as the mounts file closes the file. */
static int
open_temp_exec_file_mnt (const char *mounts)
{
static const char *last_mounts;
static FILE *last_mntent;
if (mounts != last_mounts)
{
if (last_mntent)
endmntent (last_mntent);
last_mounts = mounts;
if (mounts)
last_mntent = setmntent (mounts, "r");
else
last_mntent = NULL;
}
if (!last_mntent)
return -1;
for (;;)
{
int fd;
struct mntent mnt;
char buf[MAXPATHLEN * 3];
if (getmntent_r (last_mntent, &mnt, buf, sizeof (buf)))
return -1;
if (hasmntopt (&mnt, "ro")
|| hasmntopt (&mnt, "noexec")
|| access (mnt.mnt_dir, W_OK))
continue;
fd = open_temp_exec_file_dir (mnt.mnt_dir);
if (fd != -1)
return fd;
}
}
/* Instructions to look for a location to hold a temporary file that
can be mapped in for execution. */
static struct
{
int (*func)(const char *);
const char *arg;
int repeat;
} open_temp_exec_file_opts[] = {
{ open_temp_exec_file_env, "TMPDIR", 0 },
{ open_temp_exec_file_dir, "/tmp", 0 },
{ open_temp_exec_file_dir, "/var/tmp", 0 },
{ open_temp_exec_file_dir, "/dev/shm", 0 },
{ open_temp_exec_file_env, "HOME", 0 },
{ open_temp_exec_file_mnt, "/etc/mtab", 1 },
{ open_temp_exec_file_mnt, "/proc/mounts", 1 },
};
/* Current index into open_temp_exec_file_opts. */
static int open_temp_exec_file_opts_idx = 0;
/* Reset a current multi-call func, then advances to the next entry.
If we're at the last, go back to the first and return nonzero,
otherwise return zero. */
static int
open_temp_exec_file_opts_next (void)
{
if (open_temp_exec_file_opts[open_temp_exec_file_opts_idx].repeat)
open_temp_exec_file_opts[open_temp_exec_file_opts_idx].func (NULL);
open_temp_exec_file_opts_idx++;
if (open_temp_exec_file_opts_idx
== (sizeof (open_temp_exec_file_opts)
/ sizeof (*open_temp_exec_file_opts)))
{
open_temp_exec_file_opts_idx = 0;
return 1;
}
return 0;
}
/* Return a file descriptor of a temporary zero-sized file in a
writable and exexutable filesystem. */
static int
open_temp_exec_file (void)
{
int fd;
do
{
fd = open_temp_exec_file_opts[open_temp_exec_file_opts_idx].func
(open_temp_exec_file_opts[open_temp_exec_file_opts_idx].arg);
if (!open_temp_exec_file_opts[open_temp_exec_file_opts_idx].repeat
|| fd == -1)
{
if (open_temp_exec_file_opts_next ())
break;
}
}
while (fd == -1);
return fd;
}
/* Map in a chunk of memory from the temporary exec file into separate
locations in the virtual memory address space, one writable and one
executable. Returns the address of the writable portion, after
storing an offset to the corresponding executable portion at the
last word of the requested chunk. */
static void *
dlmmap_locked (void *start, size_t length, int prot, int flags, off_t offset)
{
void *ptr;
if (execfd == -1)
{
open_temp_exec_file_opts_idx = 0;
retry_open:
execfd = open_temp_exec_file ();
if (execfd == -1)
return MFAIL;
}
offset = execsize;
if (ftruncate (execfd, offset + length))
return MFAIL;
flags &= ~(MAP_PRIVATE | MAP_ANONYMOUS);
flags |= MAP_SHARED;
ptr = mmap (NULL, length, (prot & ~PROT_WRITE) | PROT_EXEC,
flags, execfd, offset);
if (ptr == MFAIL)
{
if (!offset)
{
close (execfd);
goto retry_open;
}
ftruncate (execfd, offset);
return MFAIL;
}
else if (!offset
&& open_temp_exec_file_opts[open_temp_exec_file_opts_idx].repeat)
open_temp_exec_file_opts_next ();
start = mmap (start, length, prot, flags, execfd, offset);
if (start == MFAIL)
{
munmap (ptr, length);
ftruncate (execfd, offset);
return start;
}
mmap_exec_offset ((char *)start, length) = (char*)ptr - (char*)start;
execsize += length;
return start;
}
/* Map in a writable and executable chunk of memory if possible.
Failing that, fall back to dlmmap_locked. */
static void *
dlmmap (void *start, size_t length, int prot,
int flags, int fd, off_t offset)
{
void *ptr;
assert (start == NULL && length % malloc_getpagesize == 0
&& prot == (PROT_READ | PROT_WRITE)
&& flags == (MAP_PRIVATE | MAP_ANONYMOUS)
&& fd == -1 && offset == 0);
#if FFI_CLOSURE_TEST
printf ("mapping in %zi\n", length);
#endif
if (execfd == -1 && !is_selinux_enabled ())
{
ptr = mmap (start, length, prot | PROT_EXEC, flags, fd, offset);
if (ptr != MFAIL || (errno != EPERM && errno != EACCES))
/* Cool, no need to mess with separate segments. */
return ptr;
/* If MREMAP_DUP is ever introduced and implemented, try mmap
with ((prot & ~PROT_WRITE) | PROT_EXEC) and mremap with
MREMAP_DUP and prot at this point. */
}
if (execsize == 0 || execfd == -1)
{
pthread_mutex_lock (&open_temp_exec_file_mutex);
ptr = dlmmap_locked (start, length, prot, flags, offset);
pthread_mutex_unlock (&open_temp_exec_file_mutex);
return ptr;
}
return dlmmap_locked (start, length, prot, flags, offset);
}
/* Release memory at the given address, as well as the corresponding
executable page if it's separate. */
static int
dlmunmap (void *start, size_t length)
{
/* We don't bother decreasing execsize or truncating the file, since
we can't quite tell whether we're unmapping the end of the file.
We don't expect frequent deallocation anyway. If we did, we
could locate pages in the file by writing to the pages being
deallocated and checking that the file contents change.
Yuck. */
msegmentptr seg = segment_holding (gm, start);
void *code;
#if FFI_CLOSURE_TEST
printf ("unmapping %zi\n", length);
#endif
if (seg && (code = add_segment_exec_offset (start, seg)) != start)
{
int ret = munmap (code, length);
if (ret)
return ret;
}
return munmap (start, length);
}
#if FFI_CLOSURE_FREE_CODE
/* Return segment holding given code address. */
static msegmentptr
segment_holding_code (mstate m, char* addr)
{
msegmentptr sp = &m->seg;
for (;;) {
if (addr >= add_segment_exec_offset (sp->base, sp)
&& addr < add_segment_exec_offset (sp->base, sp) + sp->size)
return sp;
if ((sp = sp->next) == 0)
return 0;
}
}
#endif
/* Allocate a chunk of memory with the given size. Returns a pointer
to the writable address, and sets *CODE to the executable
corresponding virtual address. */
void *
ffi_closure_alloc (size_t size, void **code)
{
void *ptr;
if (!code)
return NULL;
ptr = dlmalloc (size);
if (ptr)
{
msegmentptr seg = segment_holding (gm, ptr);
*code = add_segment_exec_offset (ptr, seg);
}
return ptr;
}
/* Release a chunk of memory allocated with ffi_closure_alloc. If
FFI_CLOSURE_FREE_CODE is nonzero, the given address can be the
writable or the executable address given. Otherwise, only the
writable address can be provided here. */
void
ffi_closure_free (void *ptr)
{
#if FFI_CLOSURE_FREE_CODE
msegmentptr seg = segment_holding_code (gm, ptr);
if (seg)
ptr = sub_segment_exec_offset (ptr, seg);
#endif
dlfree (ptr);
}
#if FFI_CLOSURE_TEST
/* Do some internal sanity testing to make sure allocation and
deallocation of pages are working as intended. */
int main ()
{
void *p[3];
#define GET(idx, len) do { p[idx] = dlmalloc (len); printf ("allocated %zi for p[%i]\n", (len), (idx)); } while (0)
#define PUT(idx) do { printf ("freeing p[%i]\n", (idx)); dlfree (p[idx]); } while (0)
GET (0, malloc_getpagesize / 2);
GET (1, 2 * malloc_getpagesize - 64 * sizeof (void*));
PUT (1);
GET (1, 2 * malloc_getpagesize);
GET (2, malloc_getpagesize / 2);
PUT (1);
PUT (0);
PUT (2);
return 0;
}
#endif /* FFI_CLOSURE_TEST */
# else /* ! FFI_MMAP_EXEC_WRIT */
/* On many systems, memory returned by malloc is writable and
executable, so just use it. */
#include <stdlib.h>
void *
ffi_closure_alloc (size_t size, void **code)
{
if (!code)
return NULL;
return *code = malloc (size);
}
void
ffi_closure_free (void *ptr)
{
free (ptr);
}
# endif /* ! FFI_MMAP_EXEC_WRIT */
#endif /* FFI_CLOSURES */
+383
Ver Arquivo
@@ -0,0 +1,383 @@
/* -----------------------------------------------------------------------
ffi.c - Copyright (c) 1998 Cygnus Solutions
Copyright (c) 2004 Simon Posnjak
Copyright (c) 2005 Axis Communications AB
Copyright (C) 2007 Free Software Foundation, Inc.
CRIS Foreign Function Interface
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 SIMON POSNJAK 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.
----------------------------------------------------------------------- */
#include <ffi.h>
#include <ffi_common.h>
#define STACK_ARG_SIZE(x) ALIGN(x, FFI_SIZEOF_ARG)
static ffi_status
initialize_aggregate_packed_struct (ffi_type * arg)
{
ffi_type **ptr;
FFI_ASSERT (arg != NULL);
FFI_ASSERT (arg->elements != NULL);
FFI_ASSERT (arg->size == 0);
FFI_ASSERT (arg->alignment == 0);
ptr = &(arg->elements[0]);
while ((*ptr) != NULL)
{
if (((*ptr)->size == 0)
&& (initialize_aggregate_packed_struct ((*ptr)) != FFI_OK))
return FFI_BAD_TYPEDEF;
FFI_ASSERT (ffi_type_test ((*ptr)));
arg->size += (*ptr)->size;
arg->alignment = (arg->alignment > (*ptr)->alignment) ?
arg->alignment : (*ptr)->alignment;
ptr++;
}
if (arg->size == 0)
return FFI_BAD_TYPEDEF;
else
return FFI_OK;
}
int
ffi_prep_args (char *stack, extended_cif * ecif)
{
unsigned int i;
unsigned int struct_count = 0;
void **p_argv;
char *argp;
ffi_type **p_arg;
argp = stack;
p_argv = ecif->avalue;
for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
(i != 0); i--, p_arg++)
{
size_t z;
switch ((*p_arg)->type)
{
case FFI_TYPE_STRUCT:
{
z = (*p_arg)->size;
if (z <= 4)
{
memcpy (argp, *p_argv, z);
z = 4;
}
else if (z <= 8)
{
memcpy (argp, *p_argv, z);
z = 8;
}
else
{
unsigned int uiLocOnStack;
z = sizeof (void *);
uiLocOnStack = 4 * ecif->cif->nargs + struct_count;
struct_count = struct_count + (*p_arg)->size;
*(unsigned int *) argp =
(unsigned int) (UINT32 *) (stack + uiLocOnStack);
memcpy ((stack + uiLocOnStack), *p_argv, (*p_arg)->size);
}
break;
}
default:
z = (*p_arg)->size;
if (z < sizeof (int))
{
switch ((*p_arg)->type)
{
case FFI_TYPE_SINT8:
*(signed int *) argp = (signed int) *(SINT8 *) (*p_argv);
break;
case FFI_TYPE_UINT8:
*(unsigned int *) argp =
(unsigned int) *(UINT8 *) (*p_argv);
break;
case FFI_TYPE_SINT16:
*(signed int *) argp = (signed int) *(SINT16 *) (*p_argv);
break;
case FFI_TYPE_UINT16:
*(unsigned int *) argp =
(unsigned int) *(UINT16 *) (*p_argv);
break;
default:
FFI_ASSERT (0);
}
z = sizeof (int);
}
else if (z == sizeof (int))
*(unsigned int *) argp = (unsigned int) *(UINT32 *) (*p_argv);
else
memcpy (argp, *p_argv, z);
break;
}
p_argv++;
argp += z;
}
return (struct_count);
}
ffi_status
ffi_prep_cif (ffi_cif * cif,
ffi_abi abi, unsigned int nargs,
ffi_type * rtype, ffi_type ** atypes)
{
unsigned bytes = 0;
unsigned int i;
ffi_type **ptr;
FFI_ASSERT (cif != NULL);
FFI_ASSERT ((abi > FFI_FIRST_ABI) && (abi <= FFI_DEFAULT_ABI));
cif->abi = abi;
cif->arg_types = atypes;
cif->nargs = nargs;
cif->rtype = rtype;
cif->flags = 0;
if ((cif->rtype->size == 0)
&& (initialize_aggregate_packed_struct (cif->rtype) != FFI_OK))
return FFI_BAD_TYPEDEF;
FFI_ASSERT_VALID_TYPE (cif->rtype);
for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++)
{
if (((*ptr)->size == 0)
&& (initialize_aggregate_packed_struct ((*ptr)) != FFI_OK))
return FFI_BAD_TYPEDEF;
FFI_ASSERT_VALID_TYPE (*ptr);
if (((*ptr)->alignment - 1) & bytes)
bytes = ALIGN (bytes, (*ptr)->alignment);
if ((*ptr)->type == FFI_TYPE_STRUCT)
{
if ((*ptr)->size > 8)
{
bytes += (*ptr)->size;
bytes += sizeof (void *);
}
else
{
if ((*ptr)->size > 4)
bytes += 8;
else
bytes += 4;
}
}
else
bytes += STACK_ARG_SIZE ((*ptr)->size);
}
cif->bytes = bytes;
return ffi_prep_cif_machdep (cif);
}
ffi_status
ffi_prep_cif_machdep (ffi_cif * cif)
{
switch (cif->rtype->type)
{
case FFI_TYPE_VOID:
case FFI_TYPE_STRUCT:
case FFI_TYPE_FLOAT:
case FFI_TYPE_DOUBLE:
case FFI_TYPE_SINT64:
case FFI_TYPE_UINT64:
cif->flags = (unsigned) cif->rtype->type;
break;
default:
cif->flags = FFI_TYPE_INT;
break;
}
return FFI_OK;
}
extern void ffi_call_SYSV (int (*)(char *, extended_cif *),
extended_cif *,
unsigned, unsigned, unsigned *, void (*fn) ())
__attribute__ ((__visibility__ ("hidden")));
void
ffi_call (ffi_cif * cif, void (*fn) (), void *rvalue, void **avalue)
{
extended_cif ecif;
ecif.cif = cif;
ecif.avalue = avalue;
if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT))
{
ecif.rvalue = alloca (cif->rtype->size);
}
else
ecif.rvalue = rvalue;
switch (cif->abi)
{
case FFI_SYSV:
ffi_call_SYSV (ffi_prep_args, &ecif, cif->bytes,
cif->flags, ecif.rvalue, fn);
break;
default:
FFI_ASSERT (0);
break;
}
}
/* Because the following variables are not exported outside libffi, we
mark them hidden. */
/* Assembly code for the jump stub. */
extern const char ffi_cris_trampoline_template[]
__attribute__ ((__visibility__ ("hidden")));
/* Offset into ffi_cris_trampoline_template of where to put the
ffi_prep_closure_inner function. */
extern const int ffi_cris_trampoline_fn_offset
__attribute__ ((__visibility__ ("hidden")));
/* Offset into ffi_cris_trampoline_template of where to put the
closure data. */
extern const int ffi_cris_trampoline_closure_offset
__attribute__ ((__visibility__ ("hidden")));
/* This function is sibling-called (jumped to) by the closure
trampoline. We get R10..R13 at PARAMS[0..3] and a copy of [SP] at
PARAMS[4] to simplify handling of a straddling parameter. A copy
of R9 is at PARAMS[5] and SP at PARAMS[6]. These parameters are
put at the appropriate place in CLOSURE which is then executed and
the return value is passed back to the caller. */
static unsigned long long
ffi_prep_closure_inner (void **params, ffi_closure* closure)
{
char *register_args = (char *) params;
void *struct_ret = params[5];
char *stack_args = params[6];
char *ptr = register_args;
ffi_cif *cif = closure->cif;
ffi_type **arg_types = cif->arg_types;
/* Max room needed is number of arguments as 64-bit values. */
void **avalue = alloca (closure->cif->nargs * sizeof(void *));
int i;
int doing_regs;
long long llret = 0;
/* Find the address of each argument. */
for (i = 0, doing_regs = 1; i < cif->nargs; i++)
{
/* Types up to and including 8 bytes go by-value. */
if (arg_types[i]->size <= 4)
{
avalue[i] = ptr;
ptr += 4;
}
else if (arg_types[i]->size <= 8)
{
avalue[i] = ptr;
ptr += 8;
}
else
{
FFI_ASSERT (arg_types[i]->type == FFI_TYPE_STRUCT);
/* Passed by-reference, so copy the pointer. */
avalue[i] = *(void **) ptr;
ptr += 4;
}
/* If we've handled more arguments than fit in registers, start
looking at the those passed on the stack. Step over the
first one if we had a straddling parameter. */
if (doing_regs && ptr >= register_args + 4*4)
{
ptr = stack_args + ((ptr > register_args + 4*4) ? 4 : 0);
doing_regs = 0;
}
}
/* Invoke the closure. */
(closure->fun) (cif,
cif->rtype->type == FFI_TYPE_STRUCT
/* The caller allocated space for the return
structure, and passed a pointer to this space in
R9. */
? struct_ret
/* We take advantage of being able to ignore that
the high part isn't set if the return value is
not in R10:R11, but in R10 only. */
: (void *) &llret,
avalue, closure->user_data);
return llret;
}
/* API function: Prepare the trampoline. */
ffi_status
ffi_prep_closure_loc (ffi_closure* closure,
ffi_cif* cif,
void (*fun)(ffi_cif *, void *, void **, void*),
void *user_data,
void *codeloc)
{
void *innerfn = ffi_prep_closure_inner;
FFI_ASSERT (cif->abi == FFI_SYSV);
closure->cif = cif;
closure->user_data = user_data;
closure->fun = fun;
memcpy (closure->tramp, ffi_cris_trampoline_template,
FFI_CRIS_TRAMPOLINE_CODE_PART_SIZE);
memcpy (closure->tramp + ffi_cris_trampoline_fn_offset,
&innerfn, sizeof (void *));
memcpy (closure->tramp + ffi_cris_trampoline_closure_offset,
&codeloc, sizeof (void *));
return FFI_OK;
}
+50
Ver Arquivo
@@ -0,0 +1,50 @@
/* -----------------------------------------------------------------*-C-*-
ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc.
Target configuration macros for CRIS.
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 CYGNUS SOLUTIONS 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.
----------------------------------------------------------------------- */
#ifndef LIBFFI_TARGET_H
#define LIBFFI_TARGET_H
#ifndef LIBFFI_ASM
typedef unsigned long ffi_arg;
typedef signed long ffi_sarg;
typedef enum ffi_abi {
FFI_FIRST_ABI = 0,
FFI_SYSV,
FFI_DEFAULT_ABI = FFI_SYSV,
FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
} ffi_abi;
#endif
/* ---- Definitions for closures ----------------------------------------- */
#define FFI_CLOSURES 1
#define FFI_CRIS_TRAMPOLINE_CODE_PART_SIZE 36
#define FFI_CRIS_TRAMPOLINE_DATA_PART_SIZE (7*4)
#define FFI_TRAMPOLINE_SIZE \
(FFI_CRIS_TRAMPOLINE_CODE_PART_SIZE + FFI_CRIS_TRAMPOLINE_DATA_PART_SIZE)
#define FFI_NATIVE_RAW_API 0
#endif
+215
Ver Arquivo
@@ -0,0 +1,215 @@
/* -----------------------------------------------------------------------
sysv.S - Copyright (c) 2004 Simon Posnjak
Copyright (c) 2005 Axis Communications AB
CRIS Foreign Function Interface
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 SIMON POSNJAK 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.
----------------------------------------------------------------------- */
#define LIBFFI_ASM
#include <ffi.h>
#define CONCAT(x,y) x ## y
#define XCONCAT(x,y) CONCAT (x, y)
#define L(x) XCONCAT (__USER_LABEL_PREFIX__, x)
.text
;; OK, when we get called we should have this (according to
;; AXIS ETRAX 100LX Programmer's Manual chapter 6.3).
;;
;; R10: ffi_prep_args (func. pointer)
;; R11: &ecif
;; R12: cif->bytes
;; R13: fig->flags
;; sp+0: ecif.rvalue
;; sp+4: fn (function pointer to the function that we need to call)
.globl L(ffi_call_SYSV)
.type L(ffi_call_SYSV),@function
.hidden L(ffi_call_SYSV)
L(ffi_call_SYSV):
;; Save the regs to the stack.
push $srp
;; Used for stack pointer saving.
push $r6
;; Used for function address pointer.
push $r7
;; Used for stack pointer saving.
push $r8
;; We save fig->flags to stack we will need them after we
;; call The Function.
push $r13
;; Saving current stack pointer.
move.d $sp,$r8
move.d $sp,$r6
;; Move address of ffi_prep_args to r13.
move.d $r10,$r13
;; Make room on the stack for the args of fn.
sub.d $r12,$sp
;; Function void ffi_prep_args(char *stack, extended_cif *ecif) parameters are:
;; r10 <-- stack pointer
;; r11 <-- &ecif (already there)
move.d $sp,$r10
;; Call the function.
jsr $r13
;; Save the size of the structures which are passed on stack.
move.d $r10,$r7
;; Move first four args in to r10..r13.
move.d [$sp+0],$r10
move.d [$sp+4],$r11
move.d [$sp+8],$r12
move.d [$sp+12],$r13
;; Adjust the stack and check if any parameters are given on stack.
addq 16,$sp
sub.d $r7,$r6
cmp.d $sp,$r6
bpl go_on
nop
go_on_no_params_on_stack:
move.d $r6,$sp
go_on:
;; Discover if we need to put rval address in to r9.
move.d [$r8+0],$r7
cmpq FFI_TYPE_STRUCT,$r7
bne call_now
nop
;; Move rval address to $r9.
move.d [$r8+20],$r9
call_now:
;; Move address of The Function in to r7.
move.d [$r8+24],$r7
;; Call The Function.
jsr $r7
;; Reset stack.
move.d $r8,$sp
;; Load rval type (fig->flags) in to r13.
pop $r13
;; Detect rval type.
cmpq FFI_TYPE_VOID,$r13
beq epilogue
cmpq FFI_TYPE_STRUCT,$r13
beq epilogue
cmpq FFI_TYPE_DOUBLE,$r13
beq return_double_or_longlong
cmpq FFI_TYPE_UINT64,$r13
beq return_double_or_longlong
cmpq FFI_TYPE_SINT64,$r13
beq return_double_or_longlong
nop
;; Just return the 32 bit value.
ba return
nop
return_double_or_longlong:
;; Load half of the rval to r10 and the other half to r11.
move.d [$sp+16],$r13
move.d $r10,[$r13]
addq 4,$r13
move.d $r11,[$r13]
ba epilogue
nop
return:
;; Load the rval to r10.
move.d [$sp+16],$r13
move.d $r10,[$r13]
epilogue:
pop $r8
pop $r7
pop $r6
Jump [$sp+]
.size ffi_call_SYSV,.-ffi_call_SYSV
/* Save R10..R13 into an array, somewhat like varargs. Copy the next
argument too, to simplify handling of any straddling parameter.
Save R9 and SP after those. Jump to function handling the rest.
Since this is a template, copied and the main function filled in by
the user. */
.globl L(ffi_cris_trampoline_template)
.type L(ffi_cris_trampoline_template),@function
.hidden L(ffi_cris_trampoline_template)
L(ffi_cris_trampoline_template):
0:
/* The value we get for "PC" is right after the prefix instruction,
two bytes from the beginning, i.e. 0b+2. */
move.d $r10,[$pc+2f-(0b+2)]
move.d $pc,$r10
1:
addq 2f-1b+4,$r10
move.d $r11,[$r10+]
move.d $r12,[$r10+]
move.d $r13,[$r10+]
move.d [$sp],$r11
move.d $r11,[$r10+]
move.d $r9,[$r10+]
move.d $sp,[$r10+]
subq FFI_CRIS_TRAMPOLINE_DATA_PART_SIZE,$r10
move.d 0,$r11
3:
jump 0
2:
.size ffi_cris_trampoline_template,.-0b
/* This macro create a constant usable as "extern const int \name" in
C from within libffi, when \name has no prefix decoration. */
.macro const name,value
.globl \name
.type \name,@object
.hidden \name
\name:
.dword \value
.size \name,4
.endm
/* Constants for offsets within the trampoline. We could do this with
just symbols, avoiding memory contents and memory accesses, but the
C usage code would look a bit stranger. */
const L(ffi_cris_trampoline_fn_offset),2b-4-0b
const L(ffi_cris_trampoline_closure_offset),3b-4-0b
+58
Ver Arquivo
@@ -0,0 +1,58 @@
/* -----------------------------------------------------------------------
debug.c - Copyright (c) 1996 Red Hat, Inc.
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 CYGNUS SOLUTIONS 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.
----------------------------------------------------------------------- */
#include <ffi.h>
#include <ffi_common.h>
#include <stdlib.h>
#include <stdio.h>
/* General debugging routines */
void ffi_stop_here(void)
{
/* This function is only useful for debugging purposes.
Place a breakpoint on ffi_stop_here to be notified of
significant events. */
}
/* This function should only be called via the FFI_ASSERT() macro */
void ffi_assert(char *expr, char *file, int line)
{
fprintf(stderr, "ASSERTION FAILURE: %s at %s:%d\n", expr, file, line);
ffi_stop_here();
abort();
}
/* Perform a sanity check on an ffi_type structure */
void ffi_type_test(ffi_type *a, char *file, int line)
{
FFI_ASSERT_AT(a != NULL, file, line);
FFI_ASSERT_AT(a->type <= FFI_TYPE_LAST, file, line);
FFI_ASSERT_AT(a->type == FFI_TYPE_VOID || a->size > 0, file, line);
FFI_ASSERT_AT(a->type == FFI_TYPE_VOID || a->alignment > 0, file, line);
FFI_ASSERT_AT(a->type != FFI_TYPE_STRUCT || a->elements != NULL, file, line);
}
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+128
Ver Arquivo
@@ -0,0 +1,128 @@
/* -----------------------------------------------------------------------
eabi.S - Copyright (c) 2004 Anthony Green
FR-V Assembly glue.
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 AUTHOR 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.
----------------------------------------------------------------------- */
#define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h>
.globl ffi_prep_args_EABI
.text
.p2align 4
.globl ffi_call_EABI
.type ffi_call_EABI, @function
# gr8 : ffi_prep_args
# gr9 : &ecif
# gr10: cif->bytes
# gr11: fig->flags
# gr12: ecif.rvalue
# gr13: fn
ffi_call_EABI:
addi sp, #-80, sp
sti fp, @(sp, #24)
addi sp, #24, fp
movsg lr, gr5
/* Make room for the new arguments. */
/* subi sp, fp, gr10 */
/* Store return address and incoming args on stack. */
sti gr5, @(fp, #8)
sti gr8, @(fp, #-4)
sti gr9, @(fp, #-8)
sti gr10, @(fp, #-12)
sti gr11, @(fp, #-16)
sti gr12, @(fp, #-20)
sti gr13, @(fp, #-24)
sub sp, gr10, sp
/* Call ffi_prep_args. */
ldi @(fp, #-4), gr4
addi sp, #0, gr8
ldi @(fp, #-8), gr9
#ifdef __FRV_FDPIC__
ldd @(gr4, gr0), gr14
calll @(gr14, gr0)
#else
calll @(gr4, gr0)
#endif
/* ffi_prep_args returns the new stack pointer. */
mov gr8, gr4
ldi @(sp, #0), gr8
ldi @(sp, #4), gr9
ldi @(sp, #8), gr10
ldi @(sp, #12), gr11
ldi @(sp, #16), gr12
ldi @(sp, #20), gr13
/* Always copy the return value pointer into the hidden
parameter register. This is only strictly necessary
when we're returning an aggregate type, but it doesn't
hurt to do this all the time, and it saves a branch. */
ldi @(fp, #-20), gr3
/* Use the ffi_prep_args return value for the new sp. */
mov gr4, sp
/* Call the target function. */
ldi @(fp, -24), gr4
#ifdef __FRV_FDPIC__
ldd @(gr4, gr0), gr14
calll @(gr14, gr0)
#else
calll @(gr4, gr0)
#endif
/* Store the result. */
ldi @(fp, #-16), gr10 /* fig->flags */
ldi @(fp, #-20), gr4 /* ecif.rvalue */
/* Is the return value stored in two registers? */
cmpi gr10, #8, icc0
bne icc0, 0, .L2
/* Yes, save them. */
sti gr8, @(gr4, #0)
sti gr9, @(gr4, #4)
bra .L3
.L2:
/* Is the return value a structure? */
cmpi gr10, #-1, icc0
beq icc0, 0, .L3
/* No, save a 4 byte return value. */
sti gr8, @(gr4, #0)
.L3:
/* Restore the stack, and return. */
ldi @(fp, 8), gr5
ld @(fp, gr0), fp
addi sp,#80,sp
jmpl @(gr5,gr0)
.size ffi_call_EABI, .-ffi_call_EABI
+290
Ver Arquivo
@@ -0,0 +1,290 @@
/* -----------------------------------------------------------------------
ffi.c - Copyright (c) 2004 Anthony Green
Copyright (C) 2007 Free Software Foundation, Inc.
FR-V Foreign Function Interface
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 CYGNUS SOLUTIONS 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.
----------------------------------------------------------------------- */
#include <ffi.h>
#include <ffi_common.h>
#include <stdlib.h>
/* ffi_prep_args is called by the assembly routine once stack space
has been allocated for the function's arguments */
void *ffi_prep_args(char *stack, extended_cif *ecif)
{
register unsigned int i;
register void **p_argv;
register char *argp;
register ffi_type **p_arg;
register int count = 0;
p_argv = ecif->avalue;
argp = stack;
for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
(i != 0);
i--, p_arg++)
{
size_t z;
z = (*p_arg)->size;
if ((*p_arg)->type == FFI_TYPE_STRUCT)
{
z = sizeof(void*);
*(void **) argp = *p_argv;
}
/* if ((*p_arg)->type == FFI_TYPE_FLOAT)
{
if (count > 24)
{
// This is going on the stack. Turn it into a double.
*(double *) argp = (double) *(float*)(* p_argv);
z = sizeof(double);
}
else
*(void **) argp = *(void **)(* p_argv);
} */
else if (z < sizeof(int))
{
z = sizeof(int);
switch ((*p_arg)->type)
{
case FFI_TYPE_SINT8:
*(signed int *) argp = (signed int)*(SINT8 *)(* p_argv);
break;
case FFI_TYPE_UINT8:
*(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv);
break;
case FFI_TYPE_SINT16:
*(signed int *) argp = (signed int)*(SINT16 *)(* p_argv);
break;
case FFI_TYPE_UINT16:
*(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv);
break;
default:
FFI_ASSERT(0);
}
}
else if (z == sizeof(int))
{
*(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
}
else
{
memcpy(argp, *p_argv, z);
}
p_argv++;
argp += z;
count += z;
}
return (stack + ((count > 24) ? 24 : ALIGN_DOWN(count, 8)));
}
/* Perform machine dependent cif processing */
ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
{
if (cif->rtype->type == FFI_TYPE_STRUCT)
cif->flags = -1;
else
cif->flags = cif->rtype->size;
cif->bytes = ALIGN (cif->bytes, 8);
return FFI_OK;
}
extern void ffi_call_EABI(void *(*)(char *, extended_cif *),
extended_cif *,
unsigned, unsigned,
unsigned *,
void (*fn)());
void ffi_call(ffi_cif *cif,
void (*fn)(),
void *rvalue,
void **avalue)
{
extended_cif ecif;
ecif.cif = cif;
ecif.avalue = avalue;
/* If the return value is a struct and we don't have a return */
/* value address then we need to make one */
if ((rvalue == NULL) &&
(cif->rtype->type == FFI_TYPE_STRUCT))
{
ecif.rvalue = alloca(cif->rtype->size);
}
else
ecif.rvalue = rvalue;
switch (cif->abi)
{
case FFI_EABI:
ffi_call_EABI(ffi_prep_args, &ecif, cif->bytes,
cif->flags, ecif.rvalue, fn);
break;
default:
FFI_ASSERT(0);
break;
}
}
void ffi_closure_eabi (unsigned arg1, unsigned arg2, unsigned arg3,
unsigned arg4, unsigned arg5, unsigned arg6)
{
/* This function is called by a trampoline. The trampoline stows a
pointer to the ffi_closure object in gr7. We must save this
pointer in a place that will persist while we do our work. */
register ffi_closure *creg __asm__ ("gr7");
ffi_closure *closure = creg;
/* Arguments that don't fit in registers are found on the stack
at a fixed offset above the current frame pointer. */
register char *frame_pointer __asm__ ("fp");
char *stack_args = frame_pointer + 16;
/* Lay the register arguments down in a continuous chunk of memory. */
unsigned register_args[6] =
{ arg1, arg2, arg3, arg4, arg5, arg6 };
ffi_cif *cif = closure->cif;
ffi_type **arg_types = cif->arg_types;
void **avalue = alloca (cif->nargs * sizeof(void *));
char *ptr = (char *) register_args;
int i;
/* Find the address of each argument. */
for (i = 0; i < cif->nargs; i++)
{
switch (arg_types[i]->type)
{
case FFI_TYPE_SINT8:
case FFI_TYPE_UINT8:
avalue[i] = ptr + 3;
break;
case FFI_TYPE_SINT16:
case FFI_TYPE_UINT16:
avalue[i] = ptr + 2;
break;
case FFI_TYPE_SINT32:
case FFI_TYPE_UINT32:
case FFI_TYPE_FLOAT:
avalue[i] = ptr;
break;
case FFI_TYPE_STRUCT:
avalue[i] = *(void**)ptr;
break;
default:
/* This is an 8-byte value. */
avalue[i] = ptr;
ptr += 4;
break;
}
ptr += 4;
/* If we've handled more arguments than fit in registers,
start looking at the those passed on the stack. */
if (ptr == ((char *)register_args + (6*4)))
ptr = stack_args;
}
/* Invoke the closure. */
if (cif->rtype->type == FFI_TYPE_STRUCT)
{
/* The caller allocates space for the return structure, and
passes a pointer to this space in gr3. Use this value directly
as the return value. */
register void *return_struct_ptr __asm__("gr3");
(closure->fun) (cif, return_struct_ptr, avalue, closure->user_data);
}
else
{
/* Allocate space for the return value and call the function. */
long long rvalue;
(closure->fun) (cif, &rvalue, avalue, closure->user_data);
/* Functions return 4-byte or smaller results in gr8. 8-byte
values also use gr9. We fill the both, even for small return
values, just to avoid a branch. */
asm ("ldi @(%0, #0), gr8" : : "r" (&rvalue));
asm ("ldi @(%0, #0), gr9" : : "r" (&((int *) &rvalue)[1]));
}
}
ffi_status
ffi_prep_closure_loc (ffi_closure* closure,
ffi_cif* cif,
void (*fun)(ffi_cif*, void*, void**, void*),
void *user_data,
void *codeloc)
{
unsigned int *tramp = (unsigned int *) &closure->tramp[0];
unsigned long fn = (long) ffi_closure_eabi;
unsigned long cls = (long) codeloc;
#ifdef __FRV_FDPIC__
register void *got __asm__("gr15");
#endif
int i;
fn = (unsigned long) ffi_closure_eabi;
#ifdef __FRV_FDPIC__
tramp[0] = &((unsigned int *)codeloc)[2];
tramp[1] = got;
tramp[2] = 0x8cfc0000 + (fn & 0xffff); /* setlos lo(fn), gr6 */
tramp[3] = 0x8efc0000 + (cls & 0xffff); /* setlos lo(cls), gr7 */
tramp[4] = 0x8cf80000 + (fn >> 16); /* sethi hi(fn), gr6 */
tramp[5] = 0x8ef80000 + (cls >> 16); /* sethi hi(cls), gr7 */
tramp[6] = 0x9cc86000; /* ldi @(gr6, #0), gr14 */
tramp[7] = 0x8030e000; /* jmpl @(gr14, gr0) */
#else
tramp[0] = 0x8cfc0000 + (fn & 0xffff); /* setlos lo(fn), gr6 */
tramp[1] = 0x8efc0000 + (cls & 0xffff); /* setlos lo(cls), gr7 */
tramp[2] = 0x8cf80000 + (fn >> 16); /* sethi hi(fn), gr6 */
tramp[3] = 0x8ef80000 + (cls >> 16); /* sethi hi(cls), gr7 */
tramp[4] = 0x80300006; /* jmpl @(gr0, gr6) */
#endif
closure->cif = cif;
closure->fun = fun;
closure->user_data = user_data;
/* Cache flushing. */
for (i = 0; i < FFI_TRAMPOLINE_SIZE; i++)
__asm__ volatile ("dcf @(%0,%1)\n\tici @(%2,%1)" :: "r" (tramp), "r" (i),
"r" (codeloc));
return FFI_OK;
}
+60
Ver Arquivo
@@ -0,0 +1,60 @@
/* -----------------------------------------------------------------*-C-*-
ffitarget.h - Copyright (c) 1996-2004 Red Hat, Inc.
Target configuration macros for FR-V
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 CYGNUS SOLUTIONS 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.
----------------------------------------------------------------------- */
#ifndef LIBFFI_TARGET_H
#define LIBFFI_TARGET_H
/* ---- System specific configurations ----------------------------------- */
#ifndef LIBFFI_ASM
typedef unsigned long ffi_arg;
typedef signed long ffi_sarg;
typedef enum ffi_abi {
FFI_FIRST_ABI = 0,
#ifdef FRV
FFI_EABI,
FFI_DEFAULT_ABI = FFI_EABI,
#endif
FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
} ffi_abi;
#endif
/* ---- Definitions for closures ----------------------------------------- */
#define FFI_CLOSURES 1
#define FFI_NATIVE_RAW_API 0
#ifdef __FRV_FDPIC__
/* Trampolines are 8 4-byte instructions long. */
#define FFI_TRAMPOLINE_SIZE (8*4)
#else
/* Trampolines are 5 4-byte instructions long. */
#define FFI_TRAMPOLINE_SIZE (5*4)
#endif
#endif
+579
Ver Arquivo
@@ -0,0 +1,579 @@
/* -----------------------------------------------------------------------
ffi.c - Copyright (c) 1998, 2007 Red Hat, Inc.
Copyright (c) 2000 Hewlett Packard Company
IA64 Foreign Function Interface
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 CYGNUS SOLUTIONS 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.
----------------------------------------------------------------------- */
#include <ffi.h>
#include <ffi_common.h>
#include <stdlib.h>
#include <stdbool.h>
#include <float.h>
#include "ia64_flags.h"
/* A 64-bit pointer value. In LP64 mode, this is effectively a plain
pointer. In ILP32 mode, it's a pointer that's been extended to
64 bits by "addp4". */
typedef void *PTR64 __attribute__((mode(DI)));
/* Memory image of fp register contents. This is the implementation
specific format used by ldf.fill/stf.spill. All we care about is
that it wants a 16 byte aligned slot. */
typedef struct
{
UINT64 x[2] __attribute__((aligned(16)));
} fpreg;
/* The stack layout given to ffi_call_unix and ffi_closure_unix_inner. */
struct ia64_args
{
fpreg fp_regs[8]; /* Contents of 8 fp arg registers. */
UINT64 gp_regs[8]; /* Contents of 8 gp arg registers. */
UINT64 other_args[]; /* Arguments passed on stack, variable size. */
};
/* Adjust ADDR, a pointer to an 8 byte slot, to point to the low LEN bytes. */
static inline void *
endian_adjust (void *addr, size_t len)
{
#ifdef __BIG_ENDIAN__
return addr + (8 - len);
#else
return addr;
#endif
}
/* Store VALUE to ADDR in the current cpu implementation's fp spill format.
This is a macro instead of a function, so that it works for all 3 floating
point types without type conversions. Type conversion to long double breaks
the denorm support. */
#define stf_spill(addr, value) \
asm ("stf.spill %0 = %1%P0" : "=m" (*addr) : "f"(value));
/* Load a value from ADDR, which is in the current cpu implementation's
fp spill format. As above, this must also be a macro. */
#define ldf_fill(result, addr) \
asm ("ldf.fill %0 = %1%P1" : "=f"(result) : "m"(*addr));
/* Return the size of the C type associated with with TYPE. Which will
be one of the FFI_IA64_TYPE_HFA_* values. */
static size_t
hfa_type_size (int type)
{
switch (type)
{
case FFI_IA64_TYPE_HFA_FLOAT:
return sizeof(float);
case FFI_IA64_TYPE_HFA_DOUBLE:
return sizeof(double);
case FFI_IA64_TYPE_HFA_LDOUBLE:
return sizeof(__float80);
default:
abort ();
}
}
/* Load from ADDR a value indicated by TYPE. Which will be one of
the FFI_IA64_TYPE_HFA_* values. */
static void
hfa_type_load (fpreg *fpaddr, int type, void *addr)
{
switch (type)
{
case FFI_IA64_TYPE_HFA_FLOAT:
stf_spill (fpaddr, *(float *) addr);
return;
case FFI_IA64_TYPE_HFA_DOUBLE:
stf_spill (fpaddr, *(double *) addr);
return;
case FFI_IA64_TYPE_HFA_LDOUBLE:
stf_spill (fpaddr, *(__float80 *) addr);
return;
default:
abort ();
}
}
/* Load VALUE into ADDR as indicated by TYPE. Which will be one of
the FFI_IA64_TYPE_HFA_* values. */
static void
hfa_type_store (int type, void *addr, fpreg *fpaddr)
{
switch (type)
{
case FFI_IA64_TYPE_HFA_FLOAT:
{
float result;
ldf_fill (result, fpaddr);
*(float *) addr = result;
break;
}
case FFI_IA64_TYPE_HFA_DOUBLE:
{
double result;
ldf_fill (result, fpaddr);
*(double *) addr = result;
break;
}
case FFI_IA64_TYPE_HFA_LDOUBLE:
{
__float80 result;
ldf_fill (result, fpaddr);
*(__float80 *) addr = result;
break;
}
default:
abort ();
}
}
/* Is TYPE a struct containing floats, doubles, or extended doubles,
all of the same fp type? If so, return the element type. Return
FFI_TYPE_VOID if not. */
static int
hfa_element_type (ffi_type *type, int nested)
{
int element = FFI_TYPE_VOID;
switch (type->type)
{
case FFI_TYPE_FLOAT:
/* We want to return VOID for raw floating-point types, but the
synthetic HFA type if we're nested within an aggregate. */
if (nested)
element = FFI_IA64_TYPE_HFA_FLOAT;
break;
case FFI_TYPE_DOUBLE:
/* Similarly. */
if (nested)
element = FFI_IA64_TYPE_HFA_DOUBLE;
break;
case FFI_TYPE_LONGDOUBLE:
/* Similarly, except that that HFA is true for double extended,
but not quad precision. Both have sizeof == 16, so tell the
difference based on the precision. */
if (LDBL_MANT_DIG == 64 && nested)
element = FFI_IA64_TYPE_HFA_LDOUBLE;
break;
case FFI_TYPE_STRUCT:
{
ffi_type **ptr = &type->elements[0];
for (ptr = &type->elements[0]; *ptr ; ptr++)
{
int sub_element = hfa_element_type (*ptr, 1);
if (sub_element == FFI_TYPE_VOID)
return FFI_TYPE_VOID;
if (element == FFI_TYPE_VOID)
element = sub_element;
else if (element != sub_element)
return FFI_TYPE_VOID;
}
}
break;
default:
return FFI_TYPE_VOID;
}
return element;
}
/* Perform machine dependent cif processing. */
ffi_status
ffi_prep_cif_machdep(ffi_cif *cif)
{
int flags;
/* Adjust cif->bytes to include space for the bits of the ia64_args frame
that preceeds the integer register portion. The estimate that the
generic bits did for the argument space required is good enough for the
integer component. */
cif->bytes += offsetof(struct ia64_args, gp_regs[0]);
if (cif->bytes < sizeof(struct ia64_args))
cif->bytes = sizeof(struct ia64_args);
/* Set the return type flag. */
flags = cif->rtype->type;
switch (cif->rtype->type)
{
case FFI_TYPE_LONGDOUBLE:
/* Leave FFI_TYPE_LONGDOUBLE as meaning double extended precision,
and encode quad precision as a two-word integer structure. */
if (LDBL_MANT_DIG != 64)
flags = FFI_IA64_TYPE_SMALL_STRUCT | (16 << 8);
break;
case FFI_TYPE_STRUCT:
{
size_t size = cif->rtype->size;
int hfa_type = hfa_element_type (cif->rtype, 0);
if (hfa_type != FFI_TYPE_VOID)
{
size_t nelts = size / hfa_type_size (hfa_type);
if (nelts <= 8)
flags = hfa_type | (size << 8);
}
else
{
if (size <= 32)
flags = FFI_IA64_TYPE_SMALL_STRUCT | (size << 8);
}
}
break;
default:
break;
}
cif->flags = flags;
return FFI_OK;
}
extern int ffi_call_unix (struct ia64_args *, PTR64, void (*)(), UINT64);
void
ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue)
{
struct ia64_args *stack;
long i, avn, gpcount, fpcount;
ffi_type **p_arg;
FFI_ASSERT (cif->abi == FFI_UNIX);
/* If we have no spot for a return value, make one. */
if (rvalue == NULL && cif->rtype->type != FFI_TYPE_VOID)
rvalue = alloca (cif->rtype->size);
/* Allocate the stack frame. */
stack = alloca (cif->bytes);
gpcount = fpcount = 0;
avn = cif->nargs;
for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++)
{
switch ((*p_arg)->type)
{
case FFI_TYPE_SINT8:
stack->gp_regs[gpcount++] = *(SINT8 *)avalue[i];
break;
case FFI_TYPE_UINT8:
stack->gp_regs[gpcount++] = *(UINT8 *)avalue[i];
break;
case FFI_TYPE_SINT16:
stack->gp_regs[gpcount++] = *(SINT16 *)avalue[i];
break;
case FFI_TYPE_UINT16:
stack->gp_regs[gpcount++] = *(UINT16 *)avalue[i];
break;
case FFI_TYPE_SINT32:
stack->gp_regs[gpcount++] = *(SINT32 *)avalue[i];
break;
case FFI_TYPE_UINT32:
stack->gp_regs[gpcount++] = *(UINT32 *)avalue[i];
break;
case FFI_TYPE_SINT64:
case FFI_TYPE_UINT64:
stack->gp_regs[gpcount++] = *(UINT64 *)avalue[i];
break;
case FFI_TYPE_POINTER:
stack->gp_regs[gpcount++] = (UINT64)(PTR64) *(void **)avalue[i];
break;
case FFI_TYPE_FLOAT:
if (gpcount < 8 && fpcount < 8)
stf_spill (&stack->fp_regs[fpcount++], *(float *)avalue[i]);
stack->gp_regs[gpcount++] = *(UINT32 *)avalue[i];
break;
case FFI_TYPE_DOUBLE:
if (gpcount < 8 && fpcount < 8)
stf_spill (&stack->fp_regs[fpcount++], *(double *)avalue[i]);
stack->gp_regs[gpcount++] = *(UINT64 *)avalue[i];
break;
case FFI_TYPE_LONGDOUBLE:
if (gpcount & 1)
gpcount++;
if (LDBL_MANT_DIG == 64 && gpcount < 8 && fpcount < 8)
stf_spill (&stack->fp_regs[fpcount++], *(__float80 *)avalue[i]);
memcpy (&stack->gp_regs[gpcount], avalue[i], 16);
gpcount += 2;
break;
case FFI_TYPE_STRUCT:
{
size_t size = (*p_arg)->size;
size_t align = (*p_arg)->alignment;
int hfa_type = hfa_element_type (*p_arg, 0);
FFI_ASSERT (align <= 16);
if (align == 16 && (gpcount & 1))
gpcount++;
if (hfa_type != FFI_TYPE_VOID)
{
size_t hfa_size = hfa_type_size (hfa_type);
size_t offset = 0;
size_t gp_offset = gpcount * 8;
while (fpcount < 8
&& offset < size
&& gp_offset < 8 * 8)
{
hfa_type_load (&stack->fp_regs[fpcount], hfa_type,
avalue[i] + offset);
offset += hfa_size;
gp_offset += hfa_size;
fpcount += 1;
}
}
memcpy (&stack->gp_regs[gpcount], avalue[i], size);
gpcount += (size + 7) / 8;
}
break;
default:
abort ();
}
}
ffi_call_unix (stack, rvalue, fn, cif->flags);
}
/* Closures represent a pair consisting of a function pointer, and
some user data. A closure is invoked by reinterpreting the closure
as a function pointer, and branching to it. Thus we can make an
interpreted function callable as a C function: We turn the
interpreter itself, together with a pointer specifying the
interpreted procedure, into a closure.
For IA64, function pointer are already pairs consisting of a code
pointer, and a gp pointer. The latter is needed to access global
variables. Here we set up such a pair as the first two words of
the closure (in the "trampoline" area), but we replace the gp
pointer with a pointer to the closure itself. We also add the real
gp pointer to the closure. This allows the function entry code to
both retrieve the user data, and to restire the correct gp pointer. */
extern void ffi_closure_unix ();
ffi_status
ffi_prep_closure_loc (ffi_closure* closure,
ffi_cif* cif,
void (*fun)(ffi_cif*,void*,void**,void*),
void *user_data,
void *codeloc)
{
/* The layout of a function descriptor. A C function pointer really
points to one of these. */
struct ia64_fd
{
UINT64 code_pointer;
UINT64 gp;
};
struct ffi_ia64_trampoline_struct
{
UINT64 code_pointer; /* Pointer to ffi_closure_unix. */
UINT64 fake_gp; /* Pointer to closure, installed as gp. */
UINT64 real_gp; /* Real gp value. */
};
struct ffi_ia64_trampoline_struct *tramp;
struct ia64_fd *fd;
FFI_ASSERT (cif->abi == FFI_UNIX);
tramp = (struct ffi_ia64_trampoline_struct *)closure->tramp;
fd = (struct ia64_fd *)(void *)ffi_closure_unix;
tramp->code_pointer = fd->code_pointer;
tramp->real_gp = fd->gp;
tramp->fake_gp = (UINT64)(PTR64)codeloc;
closure->cif = cif;
closure->user_data = user_data;
closure->fun = fun;
return FFI_OK;
}
UINT64
ffi_closure_unix_inner (ffi_closure *closure, struct ia64_args *stack,
void *rvalue, void *r8)
{
ffi_cif *cif;
void **avalue;
ffi_type **p_arg;
long i, avn, gpcount, fpcount;
cif = closure->cif;
avn = cif->nargs;
avalue = alloca (avn * sizeof (void *));
/* If the structure return value is passed in memory get that location
from r8 so as to pass the value directly back to the caller. */
if (cif->flags == FFI_TYPE_STRUCT)
rvalue = r8;
gpcount = fpcount = 0;
for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++)
{
switch ((*p_arg)->type)
{
case FFI_TYPE_SINT8:
case FFI_TYPE_UINT8:
avalue[i] = endian_adjust(&stack->gp_regs[gpcount++], 1);
break;
case FFI_TYPE_SINT16:
case FFI_TYPE_UINT16:
avalue[i] = endian_adjust(&stack->gp_regs[gpcount++], 2);
break;
case FFI_TYPE_SINT32:
case FFI_TYPE_UINT32:
avalue[i] = endian_adjust(&stack->gp_regs[gpcount++], 4);
break;
case FFI_TYPE_SINT64:
case FFI_TYPE_UINT64:
avalue[i] = &stack->gp_regs[gpcount++];
break;
case FFI_TYPE_POINTER:
avalue[i] = endian_adjust(&stack->gp_regs[gpcount++], sizeof(void*));
break;
case FFI_TYPE_FLOAT:
if (gpcount < 8 && fpcount < 8)
{
fpreg *addr = &stack->fp_regs[fpcount++];
float result;
avalue[i] = addr;
ldf_fill (result, addr);
*(float *)addr = result;
}
else
avalue[i] = endian_adjust(&stack->gp_regs[gpcount], 4);
gpcount++;
break;
case FFI_TYPE_DOUBLE:
if (gpcount < 8 && fpcount < 8)
{
fpreg *addr = &stack->fp_regs[fpcount++];
double result;
avalue[i] = addr;
ldf_fill (result, addr);
*(double *)addr = result;
}
else
avalue[i] = &stack->gp_regs[gpcount];
gpcount++;
break;
case FFI_TYPE_LONGDOUBLE:
if (gpcount & 1)
gpcount++;
if (LDBL_MANT_DIG == 64 && gpcount < 8 && fpcount < 8)
{
fpreg *addr = &stack->fp_regs[fpcount++];
__float80 result;
avalue[i] = addr;
ldf_fill (result, addr);
*(__float80 *)addr = result;
}
else
avalue[i] = &stack->gp_regs[gpcount];
gpcount += 2;
break;
case FFI_TYPE_STRUCT:
{
size_t size = (*p_arg)->size;
size_t align = (*p_arg)->alignment;
int hfa_type = hfa_element_type (*p_arg, 0);
FFI_ASSERT (align <= 16);
if (align == 16 && (gpcount & 1))
gpcount++;
if (hfa_type != FFI_TYPE_VOID)
{
size_t hfa_size = hfa_type_size (hfa_type);
size_t offset = 0;
size_t gp_offset = gpcount * 8;
void *addr = alloca (size);
avalue[i] = addr;
while (fpcount < 8
&& offset < size
&& gp_offset < 8 * 8)
{
hfa_type_store (hfa_type, addr + offset,
&stack->fp_regs[fpcount]);
offset += hfa_size;
gp_offset += hfa_size;
fpcount += 1;
}
if (offset < size)
memcpy (addr + offset, (char *)stack->gp_regs + gp_offset,
size - offset);
}
else
avalue[i] = &stack->gp_regs[gpcount];
gpcount += (size + 7) / 8;
}
break;
default:
abort ();
}
}
closure->fun (cif, rvalue, avalue, closure->user_data);
return cif->flags;
}
+49
Ver Arquivo
@@ -0,0 +1,49 @@
/* -----------------------------------------------------------------*-C-*-
ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc.
Target configuration macros for IA-64.
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 CYGNUS SOLUTIONS 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.
----------------------------------------------------------------------- */
#ifndef LIBFFI_TARGET_H
#define LIBFFI_TARGET_H
#ifndef LIBFFI_ASM
typedef unsigned long long ffi_arg;
typedef signed long long ffi_sarg;
typedef enum ffi_abi {
FFI_FIRST_ABI = 0,
FFI_UNIX, /* Linux and all Unix variants use the same conventions */
FFI_DEFAULT_ABI = FFI_UNIX,
FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
} ffi_abi;
#endif
/* ---- Definitions for closures ----------------------------------------- */
#define FFI_CLOSURES 1
#define FFI_TRAMPOLINE_SIZE 24 /* Really the following struct, which */
/* can be interpreted as a C function */
/* descriptor: */
#endif

Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais