├── .gitignore ├── KEYS ├── changelog.md ├── license.txt ├── pom.xml ├── readme.md └── src └── main ├── java └── org │ └── fusesource │ └── jansi │ └── internal │ ├── CLibrary.java │ ├── Kernel32.java │ └── WindowsSupport.java └── native-package ├── license.txt ├── m4 └── custom.m4 ├── src ├── jansi.h ├── jansi_isatty.c ├── jansi_ttyname.c └── windows │ ├── Makefile │ ├── crtdll.c │ ├── jansi.rc │ ├── msvcrt.def │ └── readme.txt └── vs2010.vcxproj /.gitignore: -------------------------------------------------------------------------------- 1 | .classpath 2 | .project 3 | .settings 4 | docs/out 5 | docs/webgen.cache 6 | target 7 | *.i?? 8 | .idea 9 | -------------------------------------------------------------------------------- /KEYS: -------------------------------------------------------------------------------- 1 | pub 1024D/F5BA7E4F 2006-02-10 2 | uid Hiram Chirino 3 | sig 3 F5BA7E4F 2006-02-10 Hiram Chirino 4 | sub 1024g/6733C080 2006-02-10 5 | sig F5BA7E4F 2006-02-10 Hiram Chirino 6 | 7 | -----BEGIN PGP PUBLIC KEY BLOCK----- 8 | Version: GnuPG v1.4.1 (Darwin) 9 | 10 | mQGiBEPspSsRBADdguKAxMQbA32vTQrCyONR6Zs/YGdvau2Zrr3SSSSR0Ge4FMjZ 11 | 4tzwpf6+32m4Bsf7YIwdLl0H5hI1CgT5gDl9kXvfaFUehFnwR+FDyiBRiyHjUpGF 12 | 4dgkQfWy9diYeWGtsvszsvWHXtED4SXb322StX4MfJj+YesA1iEdTiXK6wCg1QDa 13 | RucfjC+kx4zPsJwkJOgYpyMEAMTiXtNwQcke6nIFb/lb5374NjwwVAuuMTrRWLyq 14 | 5HodugEIHaw3EitQWtnFfXNkXTJZzS6t2HAGv29UTfhiBzKdkydgCkOk2MLWISOV 15 | fqcg0tNIp5ZJCmUHg3s+OFNSH4oUi65u+FyDseUid3OKtPI+ZhIk8N+DjOIg2Kvo 16 | /UALA/9q+WfBd7re+W3iUtU7TutUcwbKsjP+jpaJeUHg2ChOBxVfQKt4YlPHVdrR 17 | iCrfNi90Z8qbsZ0iAXuqexrfMq20pAPmpHRpe54mmP1CMT5m+Gq71eKIfkUrb3LC 18 | /zv08dLG2vm9oghd242wbcifaX+t7AhNAIpe/WTvQsB0gpdO4LQmSGlyYW0gQ2hp 19 | cmlubyA8aGlyYW1AaGlyYW1jaGlyaW5vLmNvbT6IWwQTEQIAGwUCQ+ylKwYLCQgH 20 | AwIDFQIDAxYCAQIeAQIXgAAKCRCf8lmA9bp+T/G/AKDM1QDs7il/CJhTycgDvE3c 21 | EOgUBwCfelsVK4sgBCooZptoaCCDgVtt71G5AQ0EQ+ylLhAEAJD25AWgwcNgBFKY 22 | svExQaGIojIGJyn4Cf/5U30cui/K7fIU7JtyNhKcfZdCrh2hKx+x3H/dTF6e0SrR 23 | hzKV7Dx0j76yhHHB1Ak25kjRxoU4Jk+CG0m+bRNTF9xz9k1ALSm3Y+A5RqNU10K6 24 | e/5KsPuXMGSGoQgJ1H6g/i80Wf8PAAMFA/9mIxu7lMaqE1OE7EeAsHgLslNbi0h9 25 | pjDUVNv8bc1Os2gBPaJD8B89EeheTHw6NMNIe75HVOpKk4UA0gvOBrxJqCr18yFJ 26 | BM5sIlaEmuJwZOW4dDGOR1oS5qgE9NzpmyKhE+fu/S1wmy0coL667+1xZcnrPbUF 27 | D4i7/aD1r8qJhohGBBgRAgAGBQJD7KUuAAoJEJ/yWYD1un5Pth0An0QEUs5cxpl8 28 | zL5kZCj7c8MN8YZDAKDR9LTb6woveul50+uGtUl2fIH1uA== 29 | =RBPl 30 | -----END PGP PUBLIC KEY BLOCK----- -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | ![Jansi][logo] Native 2 | =========== 3 | [logo]: http://fusesource.github.io/jansi/images/project-logo.png "Jansi" 4 | 5 | ## [Jansi Native 1.8][1_8], released 2018-02-02 6 | [1_8]: https://repo.maven.apache.org/maven2/org/fusesource/jansi/jansi-native/1.8 7 | 8 | * [`e0bd25d`](https://github.com/fusesource/hawtjni/commit/e0bd25db8c7bd2b59332a06fb8deb0fd92d60fc0) Upgrade to hawtjni 1.16 9 | * [`52d4840`](https://github.com/fusesource/hawtjni/commit/52d4840b2e7a65ef973c4542cedb42d118dba983) Improve isatty() Windows implementation with Cygwin/Mingw pseudo terminals, fixes [#11](https://github.com/fusesource/jansi-native/issues/11) 10 | * [`6728bc6`](https://github.com/fusesource/hawtjni/commit/6728bc6b8e472cc3b50a007f61203764a9c2429f) Fix indentation 11 | * [`e266e32`](https://github.com/fusesource/hawtjni/commit/e266e327fb4d7aa8230c18d96f7233591ee7ae30) Add support for other console events 12 | * [`f2686cf`](https://github.com/fusesource/hawtjni/commit/f2686cf240fafec88d454ddda118ef27c301ec47) Add a way to read console input with a timeout 13 | * [`e1a6d4f`](https://github.com/fusesource/hawtjni/commit/e1a6d4f3909a0f6e39e5792968597f6a0c1fd777) Update hawtjni maven plugin artifactId 14 | * [`844f627`](https://github.com/fusesource/hawtjni/commit/844f627a692ee44a20ac887d32cd33f7cf5304f9) improved javadoc 15 | * [`5560ba7`](https://github.com/fusesource/hawtjni/commit/5560ba70e9de14ecb6071c7de9d8f146400c975d) use latest hawtjni-runtime to get documented annotations in javadoc 16 | * [`da27164`](https://github.com/fusesource/hawtjni/commit/da27164da4a4a16d66947068643df342f120897c) reworked building section 17 | * [`9461d6b`](https://github.com/fusesource/hawtjni/commit/9461d6b6ddc090f652823b5bc7ecd5bbcc015032) improved intro 18 | * [`ddcc121`](https://github.com/fusesource/hawtjni/commit/ddcc121d8012f1a702d3eff86fc1afb38fea269a) fixed m-javadoc-p configuration 19 | * [`0c0dccf`](https://github.com/fusesource/hawtjni/commit/0c0dccff5e711a7adff10d0dd31b5e3a8568f543) added icons for artifacts in Maven Central 20 | * [`e77fbcf`](https://github.com/fusesource/hawtjni/commit/e77fbcfad9b4249d4f18c71c8af6c500d33837a7) updated pom to match migration to GitHub 21 | 22 | ## [Jansi Native 1.7][1_7], released 2017-05-04 23 | [1_7]: https://repo.maven.apache.org/maven2/org/fusesource/jansi/jansi-native/1.7 24 | 25 | * [`177381b`](https://github.com/fusesource/hawtjni/commit/177381b1f2af52a7491b91f59bd6076ba3b6ce64) Upgrade to hawtjni 1.15 26 | * [`be608f1`](https://github.com/fusesource/hawtjni/commit/be608f140068f67dcaf1b203b8503a66299e2ad5) Update changelog 27 | * [`a8cc48a`](https://github.com/fusesource/hawtjni/commit/a8cc48ad81b792b0df1208e7c4baac5525a8bcc8) Add a copy() method on SMALL_RECT for ease of use 28 | * [`29b9213`](https://github.com/fusesource/hawtjni/commit/29b92130dbb43b6ba11afee544cb7ab2a81201b1) Fix changelog 29 | * [`e2f6efb`](https://github.com/fusesource/hawtjni/commit/e2f6efbdadcb95889ecb110c14eb491a8365efaf) Fix copyrights 30 | * [`36a03b7`](https://github.com/fusesource/hawtjni/commit/36a03b70607110c4c208f8a4f9fac29e394d5c86) Fix build when openpty is in libutil 31 | * [`915a7c6`](https://github.com/fusesource/hawtjni/commit/915a7c6dcaf987290c3def2f811a4ff861f1b362) Fix wrong conditions and constants 32 | * [`5beb0c2`](https://github.com/fusesource/hawtjni/commit/5beb0c29c5effa80891e6b9b3509674abd25c572) Ignore idea files 33 | * [`8a83cbb`](https://github.com/fusesource/hawtjni/commit/8a83cbbb88e76e44cb6b279777ff417c02e28a53) Fix number of control chars in the Termios structure 34 | * [`84b9ce1`](https://github.com/fusesource/hawtjni/commit/84b9ce1f091420622a8b172f42255d7f73eb85e9) Update some plugins versions 35 | * [`674f287`](https://github.com/fusesource/hawtjni/commit/674f2871a6e9e9f5a47f59a57e415958a6ed5990) Add oss snapshot repo 36 | * [`41c2f00`](https://github.com/fusesource/hawtjni/commit/41c2f00d4857f292a4bdd80c57ed5aeac3320d2d) Make sure to include winsize and termios structures 37 | * [`9685c51`](https://github.com/fusesource/hawtjni/commit/9685c516d43eda1de4c0bc3d1e44d48cc160133b) Turn on stack protection, fixes [#7](https://github.com/fusesource/jansi-native/issues/7) 38 | * [`a1710c7`](https://github.com/fusesource/hawtjni/commit/a1710c785d5033588f0ed0e6f262959a5b1dd479) Make sure the build work on MVS2017 39 | * [`7a0a951`](https://github.com/fusesource/hawtjni/commit/7a0a951fe58dfb3b36803aa3f5a66db9662d2164) Pass the platform to the hawtjni plugin 40 | * [`d3a5c4a`](https://github.com/fusesource/hawtjni/commit/d3a5c4a2d1f36f18e5a62f061c7944d56a9abaee) Upgrade internal jansi version on windows 41 | * [`7b45d34`](https://github.com/fusesource/hawtjni/commit/7b45d3462ff7a1b20bd1b0f281c9e23277b852e4) Merge pull request [#6](https://github.com/fusesource/jansi-native/issues/6) from Aaron1011/remove-ttyslot 42 | * [`5f76e86`](https://github.com/fusesource/hawtjni/commit/5f76e86c28c80eb8b03e1713e9eb0ea3099b965d) Fix ttyname method which is unusable (SEGV crash), fixes [#8](https://github.com/fusesource/jansi-native/issues/8) 43 | * [`f825e18`](https://github.com/fusesource/hawtjni/commit/f825e1812c09924860d3f5f713340d5c81a8b685) Fix home in readme, fixes [#4](https://github.com/fusesource/jansi-native/issues/4) 44 | * [`216892e`](https://github.com/fusesource/hawtjni/commit/216892efe74cea133993c5afabc154b576357412) Remove unused use of 'ttyslot' 45 | 46 | ## [Jansi Native 1.6][1_6], released 2016-04-27 47 | [1_6]: https://repo.maven.apache.org/maven2/org/fusesource/jansi/jansi-native/1.6 48 | 49 | * [`6160f07`](https://github.com/fusesource/hawtjni/commit/6160f07a0f47aaaf4bcb34d8f04e4534ade8aa2b) More packaging refactoring. 50 | * [`24250c0`](https://github.com/fusesource/hawtjni/commit/24250c0d99262b7e1e965402c474365754132eea) make sure native libs get packaged. 51 | * [`4a95522`](https://github.com/fusesource/hawtjni/commit/4a955226e2e3025738bf11f35f99b2dfb94fbe0c) Lets try to use different artifact ids for the different platform builds to workaround problems with mvn needing all classified artifacts to be part of the same build for SNAPSHOT deployments. 52 | * [`f66eb6b`](https://github.com/fusesource/hawtjni/commit/f66eb6bea90e5d1b3640abf0f3e18280f7ed705a) Bump the hawtjni version. 53 | * [`a18e87f`](https://github.com/fusesource/hawtjni/commit/a18e87f8959e0db56dbe575455f5143e54e47ada) Switch to sonatype mvn repo 54 | * [`1cb12b1`](https://github.com/fusesource/hawtjni/commit/1cb12b167949aa1f545d20d7d522b49abb4c41c8) Update hawtjni version used. 55 | * [`6436a76`](https://github.com/fusesource/hawtjni/commit/6436a76ba22e3ae207a0b37e43e9a4f739682880) Tweaks needed to get the latest changes compiling on linux. 56 | * [`ece5c44`](https://github.com/fusesource/hawtjni/commit/ece5c44b48d4998735384d9fa57727ba8884d660) Fixing function name. No W since there are no (wide) chars in the arg list. 57 | * [`7859ee9`](https://github.com/fusesource/hawtjni/commit/7859ee9b4af8eb44a3f446af2e1d95dcfb02de15) Make constants conditional. 58 | * [`ff3543d`](https://github.com/fusesource/hawtjni/commit/ff3543ddcc90b368650ce256b875076c338f4d0a) Update parent pom version. 59 | * [`a597537`](https://github.com/fusesource/hawtjni/commit/a5975374d7050ebad9d0bad8b05777a8a5900bb5) Add ScrollConsoleScreenBuffer to Kernel32 60 | * [`144f13d`](https://github.com/fusesource/hawtjni/commit/144f13dba2e627fb1212b2b3d546ccdfa41fe482) Improve JNI arg passing for Kernel32 library 61 | * [`ae71626`](https://github.com/fusesource/hawtjni/commit/ae716267fcb8955e63ebfbce8e637bd27c0f4514) Fix some javadoc warnings 62 | * [`fbaa6fa`](https://github.com/fusesource/hawtjni/commit/fbaa6fa650db39baa402796f4ee29143ed88b0d7) Add FilleConsoleOutputAttributeW native method for windows 63 | * [`a7c99e8`](https://github.com/fusesource/hawtjni/commit/a7c99e80fb64723221ec081352840d5b2362b473) Add needed functions for stty support 64 | * [`aebb7f4`](https://github.com/fusesource/hawtjni/commit/aebb7f4b37719722375f00e33c1926720c3e8406) Upgrade hawtjni version to fix [Missing barriers in cache initialization](https://github.com/fusesource/hawtjni/issues/7) 65 | 66 | ## [Jansi Native 1.5][1_5], released 2013-03-25 67 | [1_5]: https://repo.maven.apache.org/maven2/org/fusesource/jansi/jansi-native/1.5 68 | 69 | * [`d5e1606`](https://github.com/fusesource/hawtjni/commit/d5e1606ab05db5092010ab3e54d9cb079f212ded) Add windows nmake Makefile 70 | * [`01cfbdd`](https://github.com/fusesource/hawtjni/commit/01cfbdd0095f981b24224df70bf9c9c1aa790a2a) Add .rc file to the msbuild project 71 | * [`803ae7f`](https://github.com/fusesource/hawtjni/commit/803ae7f9d3663c477ed13ef6843ecfe1d0faac0b) Add the public repo 72 | * [`7dbe4f5`](https://github.com/fusesource/hawtjni/commit/7dbe4f50b3fa9384d4d131d76d05b2adc6cdad1e) Switch to new release of hawtjni that allows us to force the use of msbuild on windows. 73 | * [`d891301`](https://github.com/fusesource/hawtjni/commit/d8913015ee92284ee42356ad5c1553eefae7145b) Modify owner 74 | * [`9b30bc1`](https://github.com/fusesource/hawtjni/commit/9b30bc1d4579dfc5842640358d6e31a857422665) Add .rc file 75 | * [`5392bef`](https://github.com/fusesource/hawtjni/commit/5392bef3ce52616dd359236d74f21eac04d6aa3b) Ensure we have standard file attributes 76 | 77 | ## [Jansi Native 1.4][1_4], released 2012-02-15 78 | [1_4]: https://repo.maven.apache.org/maven2/org/fusesource/jansi/jansi-native/1.4 79 | 80 | * [`981fb32`](https://github.com/fusesource/hawtjni/commit/981fb328b6821579e0860140fa646aa429397a4d) Merge pull request [#2](https://github.com/fusesource/jansi-native/issues/2) from mihnita/master 81 | * [`d2c93b8`](https://github.com/fusesource/hawtjni/commit/d2c93b856ca94ba5154b0f7c90ec87deebcd6ce6) Generating msvcrt.lib at build time (from msvcrt.def) 82 | * [`46e933f`](https://github.com/fusesource/hawtjni/commit/46e933fa3addad25d69f94e1dda8bf28e8b67ee2) - Added License header (ASL 2.0 like everything else) - Added readme.txt to the windows directory with info of how .lib files were created 83 | * [`5b092a8`](https://github.com/fusesource/hawtjni/commit/5b092a85860ba4ad453a0f5eec2335b780e684ce) - Added support for isatty - Fixed values and conditions for STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO - Bumped version to 1.8 to stay in sync with jansi - Cleaned a few warnings at C compile time - Link against the system msvcrt.dll (so no need for VC redistributables) 84 | 85 | ## [Jansi Native 1.3][1_3], released 2011-09-21 86 | [1_3]: https://repo.maven.apache.org/maven2/org/fusesource/jansi/jansi-native/1.3 87 | 88 | * [`7626ec6`](https://github.com/fusesource/hawtjni/commit/7626ec6283f3bd7c1ddd214906989d974aa17cf6) use released hawtjni. 89 | * [`29b8037`](https://github.com/fusesource/hawtjni/commit/29b80375b669849328a5ba3a445008b01d09b3c0) Update hawtjni version. 90 | * [`61dbf94`](https://github.com/fusesource/hawtjni/commit/61dbf94b12ed5eb597f2b5a916e7d0366480cbc6) Merge pull request [#1](https://github.com/fusesource/jansi-native/issues/1) from huynhjl/jansi-unicode-pull-request 91 | * [`44eb7aa`](https://github.com/fusesource/hawtjni/commit/44eb7aa2f968818d5d3d1f89089b7bfc1c4350ad) Adding support for PeekConsoleInputW, FlushConsoleInputBuffer so that CTRL-C can be handled by jline. Discarding mouse events on readConsoleInput. 92 | * [`b72fb73`](https://github.com/fusesource/hawtjni/commit/b72fb73e1ae1eb1bc375873143b31466348a25e5) Using PointerMath when copying INPUT_RECORD. 93 | * [`e649485`](https://github.com/fusesource/hawtjni/commit/e6494857ed59dbfbb8c1918b39a9e99b1b201f00) Updated support for reading multiple INPUT_RECORD through ReadConsoleW (may need to check pointer arithmetic). Added support for GetNumberOfConsoleInputEvents and WriteConsoleW. 94 | 95 | ## [Jansi Native 1.2][1_2], released 2011-06-19 96 | [1_2]: https://repo.maven.apache.org/maven2/org/fusesource/jansi/jansi-native/1.2 97 | 98 | * `892c45e` Adding support for reading keyboard events through ReadConsoleInputW Win32 call. Does not handle non keyboard events (they are discarded). 99 | * `658d8bc` Upgrade the hawtjni version being used. 100 | 101 | ## [Jansi Native 1.1][1_1], released 2010-11-04 102 | [1_1]: https://repo.maven.apache.org/maven2/org/fusesource/jansi/jansi-native/1.1 103 | 104 | * `14cf4c9` Update to use fusesource parent pom and pickup new hawtjni release. 105 | * `e29d0fa` adding SetConsoleTitle method to support setting the window title on Windows 106 | * `71a95c0` updating to next hawtjni snapshot version to pick up Win SKD 7.1 fix 107 | * `29fb658` allow hawtjni version to be configurable 108 | * `6ced024` adding build doco for windows 109 | 110 | ## Jansi Native 1.0, released 2010-07-14 111 | 112 | * Initial release 113 | * Native bits extracted out of the core jansi library 114 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 4.0.0 20 | 21 | org.fusesource 22 | fusesource-pom 23 | 1.11 24 | 25 | 26 | org.fusesource.jansi 27 | jansi-${platform} 28 | 1.9-SNAPSHOT 29 | 30 | ${project.artifactId} 31 | Jansi Native implements the JNI Libraries used by the Jansi project. 32 | 33 | 34 | jansi-native 35 | 36 | UTF-8 37 | 1.5 38 | 1.16 39 | native 40 | 41 | 42 | http://fusesource.github.io/${forge-project-id} 43 | 2009 44 | 45 | 46 | GitHub 47 | https://github.com/fusesource/${forge-project-id}/issues 48 | 49 | 50 | 51 | 52 | The Apache Software License, Version 2.0 53 | http://www.apache.org/licenses/LICENSE-2.0.txt 54 | repo 55 | 56 | 57 | 58 | 59 | scm:git:https://github.com/fusesource/${forge-project-id}.git 60 | scm:git:https://github.com/fusesource/${forge-project-id}.git 61 | https://github.com/fusesource/${forge-project-id}/tree/${project.scm.tag} 62 | master 63 | 64 | 65 | 66 | 67 | sonatype-nexus-staging 68 | Sonatype Staging Repository 69 | https://oss.sonatype.org/service/local/staging/deploy/maven2 70 | 71 | 72 | sonatype-nexus-snapshots 73 | Sonatype Snapshot Repository 74 | https://oss.sonatype.org/content/repositories/snapshots 75 | 76 | 77 | 78 | 79 | 80 | chirino 81 | Hiram Chirino 82 | hiram@hiramchirino.com 83 | http://hiramchirino.com 84 | GMT-5 85 | 86 | 87 | 88 | 89 | 90 | org.fusesource.hawtjni 91 | hawtjni-runtime 92 | ${hawtjni-version} 93 | 94 | 95 | 96 | junit 97 | junit 98 | 4.13.1 99 | test 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | org.apache.maven.plugins 108 | maven-javadoc-plugin 109 | 2.10.4 110 | 111 | true 112 | 113 | http://fusesource.github.io/hawtjni/documentation/api 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | org.apache.maven.plugins 122 | maven-jar-plugin 123 | 124 | 125 | 126 | org.fusesource.jansi.${platform} 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | org.apache.maven.plugins 135 | maven-clean-plugin 136 | 3.0.0 137 | 138 | 139 | 140 | 141 | 142 | org.apache.maven.plugins 143 | maven-surefire-plugin 144 | 2.20 145 | 146 | true 147 | once 148 | -ea 149 | false 150 | ${project.build.directory} 151 | 152 | **/Abstract*.java 153 | **/Test*.java 154 | 155 | 156 | **/*Test.java 157 | 158 | 159 | 160 | 161 | org.apache.maven.plugins 162 | maven-compiler-plugin 163 | 3.6.1 164 | 165 | ${maven.compiler.source} 166 | ${maven.compiler.source} 167 | 168 | 169 | 170 | 171 | org.apache.felix 172 | maven-bundle-plugin 173 | 2.0.1 174 | 175 | 176 | bundle-manifest 177 | process-classes 178 | 179 | manifest 180 | 181 | 182 | 183 | !org.fusesource.jansi*,!org.fusesource.hawtjni*,sun.reflect;resolution:=optional,* 184 | 185 | 186 | 187 | 188 | 189 | 190 | maven-jar-plugin 191 | 3.0.2 192 | 193 | 194 | ${project.build.outputDirectory}/META-INF/MANIFEST.MF 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | sonatype-nexus-snapshots 205 | Sonatype Snapshot Repository 206 | https://oss.sonatype.org/content/repositories/snapshots 207 | 208 | true 209 | 210 | 211 | 212 | 213 | 214 | sonatype-nexus-snapshots 215 | Sonatype Snapshot Repository 216 | https://oss.sonatype.org/content/repositories/snapshots 217 | 218 | true 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | org.apache.maven.plugins 227 | maven-jxr-plugin 228 | 2.5 229 | 230 | 231 | org.apache.maven.plugins 232 | maven-javadoc-plugin 233 | 234 | 235 | org.apache.maven.plugins 236 | maven-project-info-reports-plugin 237 | 2.9 238 | 239 | 240 | 241 | index 242 | summary 243 | plugins 244 | dependencies 245 | mailing-list 246 | issue-tracking 247 | license 248 | scm 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | platform 260 | 261 | 262 | platform 263 | 264 | 265 | 266 | 267 | 268 | 269 | org.fusesource.hawtjni 270 | hawtjni-maven-plugin 271 | ${hawtjni-version} 272 | 273 | 274 | 275 | generate 276 | build 277 | package-jar 278 | package-source 279 | 280 | 281 | ${platform} 282 | jansi 283 | false 284 | false 285 | msbuild 286 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | org.apache.maven.plugins 310 | maven-jar-plugin 311 | 3.0.2 312 | 313 | ${basedir}/target/generated-sources/hawtjni/lib 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | mac 325 | 326 | mac 327 | 328 | 329 | 330 | 331 | org.fusesource.hawtjni 332 | maven-hawtjni-plugin 333 | 334 | 335 | osname=MacOS;processor=x86-64 336 | osname=MacOS;processor=x86 337 | osname=MacOS;processor=PowerPC 338 | * 339 | 340 | 341 | --with-universal 342 | 343 | osx 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | java-9 352 | 353 | [1.9,) 354 | 355 | 356 | 1.6 357 | 358 | 359 | 360 | 361 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | DEPRECATION 2 | =========== 3 | 4 | The Jansi Native library is deprecated and is now embedded inside [Jansi 2.x](https://github.com/fusesource/jansi). 5 | 6 | Jansi Native 7 | ============ 8 | 9 | Description 10 | ----------- 11 | 12 | Jansi Native implements the JNI libraries used by the 13 | [Jansi project](http://fusesource.github.io/jansi/): 14 | - [Kernel32](http://fusesource.github.io/jansi/documentation/native-api/org/fusesource/jansi/internal/Kernel32.html) and [WindowsSupport](http://fusesource.github.io/jansi/documentation/native-api/org/fusesource/jansi/internal/WindowsSupport.html) for ANSI support on Windows 15 | - [CLibrary](http://fusesource.github.io/jansi/documentation/native-api/org/fusesource/jansi/internal/CLibrary.html) for POSIX tty functions on Unix and Windows 16 | 17 | [![Apache License, Version 2.0, January 2004](https://img.shields.io/github/license/fusesource/jansi-native.svg?label=License)](http://www.apache.org/licenses/) 18 | 19 | * `jansi-native` [Java API](http://fusesource.github.io/jansi/documentation/native-api): 20 | [![Maven Central](https://img.shields.io/maven-central/v/org.fusesource.jansi/jansi-native.svg?label=Maven%20Central)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.fusesource.jansi%22%20AND%20a%3A%22jansi-native%22) 21 | * `jansi-${platform}` builds: 22 | * [![windows32](https://img.shields.io/maven-central/v/org.fusesource.jansi/jansi-windows32.svg?label=windows32)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.fusesource.jansi%22%20AND%20a%3A%22jansi-windows32%22) 23 | [![windows64](https://img.shields.io/maven-central/v/org.fusesource.jansi/jansi-windows64.svg?label=windows64)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.fusesource.jansi%22%20AND%20a%3A%22jansi-windows64%22) 24 | * [![osx](https://img.shields.io/maven-central/v/org.fusesource.jansi/jansi-osx.svg?label=osx)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.fusesource.jansi%22%20AND%20a%3A%22jansi-osx%22) 25 | * [![linux32](https://img.shields.io/maven-central/v/org.fusesource.jansi/jansi-linux32.svg?label=linux32)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.fusesource.jansi%22%20AND%20a%3A%22jansi-linux32%22) 26 | [![linux32](https://img.shields.io/maven-central/v/org.fusesource.jansi/jansi-linux64.svg?label=linux64)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.fusesource.jansi%22%20AND%20a%3A%22jansi-linux64%22) 27 | * [![freebsd32](https://img.shields.io/maven-central/v/org.fusesource.jansi/jansi-freebsd32.svg?label=freebsd32)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.fusesource.jansi%22%20AND%20a%3A%22jansi-freebsd32%22) 28 | [![freebsd64](https://img.shields.io/maven-central/v/org.fusesource.jansi/jansi-freebsd64.svg?label=freebsd64)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.fusesource.jansi%22%20AND%20a%3A%22jansi-freebsd64%22) 29 | 30 | 31 | Project Links 32 | ------------- 33 | 34 | * [Project Home](http://fusesource.github.io/jansi/) 35 | * [Jansi-native API](http://fusesource.github.io/jansi/documentation/native-api/index.html) 36 | 37 | Building 38 | -------- 39 | 40 | To build, just run `mvn -Dplatform=${platform} package` where `${platform}` may be `windows32`, `windows64`, 41 | `osx`, `linux32`, `linux64`, `freebsd32`, `freebsd64` or any other platform of your choice. 42 | 43 | Jansi native uses [HawtJNI](http://fusesource.github.io/hawtjni/) to ease JNI management. 44 | See [Platform Build Tools Requirements](http://fusesource.github.io/hawtjni/documentation/developer-guide.html#Platform_Build_Tools_Requirements) 45 | for details on platform requirements. 46 | -------------------------------------------------------------------------------- /src/main/java/org/fusesource/jansi/internal/CLibrary.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009-2017 the original author(s). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.fusesource.jansi.internal; 17 | 18 | import static org.fusesource.hawtjni.runtime.FieldFlag.CONSTANT; 19 | import static org.fusesource.hawtjni.runtime.MethodFlag.CONSTANT_INITIALIZER; 20 | 21 | import static org.fusesource.hawtjni.runtime.ArgFlag.*; 22 | 23 | import org.fusesource.hawtjni.runtime.ArgFlag; 24 | import org.fusesource.hawtjni.runtime.ClassFlag; 25 | import org.fusesource.hawtjni.runtime.JniArg; 26 | import org.fusesource.hawtjni.runtime.JniClass; 27 | import org.fusesource.hawtjni.runtime.JniField; 28 | import org.fusesource.hawtjni.runtime.JniMethod; 29 | import org.fusesource.hawtjni.runtime.Library; 30 | 31 | /** 32 | * Interface to access some low level POSIX functions, loaded by 33 | * HawtJNI Runtime 34 | * as jansi library. 35 | * 36 | * @author Hiram Chirino 37 | * @see Library 38 | */ 39 | @JniClass() 40 | public class CLibrary { 41 | 42 | private static final Library LIBRARY = new Library("jansi", CLibrary.class); 43 | static { 44 | LIBRARY.load(); 45 | init(); 46 | } 47 | 48 | @JniMethod(flags={CONSTANT_INITIALIZER}) 49 | private static native void init(); 50 | 51 | @JniField(flags={CONSTANT}, conditional="defined(STDIN_FILENO)") 52 | public static int STDIN_FILENO; 53 | @JniField(flags={CONSTANT}, conditional="defined(STDOUT_FILENO)") 54 | public static int STDOUT_FILENO; 55 | @JniField(flags={CONSTANT}, conditional="defined(STDERR_FILENO)") 56 | public static int STDERR_FILENO; 57 | 58 | @JniField(flags={CONSTANT}, accessor="1", conditional="defined(HAVE_ISATTY)") 59 | public static boolean HAVE_ISATTY; 60 | 61 | @JniField(flags={CONSTANT}, accessor="1", conditional="defined(HAVE_TTYNAME)") 62 | public static boolean HAVE_TTYNAME; 63 | 64 | /** 65 | * test whether a file descriptor refers to a terminal 66 | * 67 | * @param fd file descriptor 68 | * @return isatty() returns 1 if fd is an open file descriptor referring to a 69 | * terminal; otherwise 0 is returned, and errno is set to indicate the 70 | * error 71 | * @see ISATTY(3) man-page 72 | * @see ISATTY(3P) man-page 73 | */ 74 | @JniMethod(conditional="FALSE") 75 | public static native int isatty( 76 | @JniArg int fd); 77 | 78 | @JniMethod(conditional="FALSE") 79 | public static native String ttyname( 80 | @JniArg int filedes); 81 | 82 | /** 83 | * The openpty() function finds an available pseudoterminal and returns 84 | * file descriptors for the master and slave in amaster and aslave. 85 | * @param amaster master return value 86 | * @param aslave slave return value 87 | * @param name filename return value 88 | * @param termios 89 | * @param winsize 90 | * @return 0 on success 91 | * @see OPENPTY(3) man-page 92 | */ 93 | @JniMethod(conditional="defined(HAVE_OPENPTY)") 94 | public static native int openpty( 95 | @JniArg(cast="int *", flags={NO_IN}) int[] amaster, 96 | @JniArg(cast="int *", flags={NO_IN}) int[] aslave, 97 | @JniArg(cast="char *", flags={NO_IN}) byte[] name, 98 | @JniArg(cast="struct termios *", flags={NO_OUT}) Termios termios, 99 | @JniArg(cast="struct winsize *", flags={NO_OUT}) WinSize winsize); 100 | 101 | @JniMethod(conditional="defined(HAVE_TCGETATTR)") 102 | public static native int tcgetattr( 103 | @JniArg int filedes, 104 | @JniArg(cast="struct termios *", flags={NO_IN}) Termios termios); 105 | 106 | @JniMethod(conditional="defined(HAVE_TCSETATTR)") 107 | public static native int tcsetattr( 108 | @JniArg int filedes, 109 | @JniArg int optional_actions, 110 | @JniArg(cast="struct termios *", flags={NO_OUT}) Termios termios); 111 | 112 | /* 113 | * Commands passed to tcsetattr() for setting the termios structure. 114 | */ 115 | @JniField(flags={CONSTANT}, conditional="defined(TCSANOW)") 116 | public static int TCSANOW; /* make change immediate */ 117 | @JniField(flags={CONSTANT}, conditional="defined(TCSADRAIN)") 118 | public static int TCSADRAIN; /* drain output, then change */ 119 | @JniField(flags={CONSTANT}, conditional="defined(TCSAFLUSH)") 120 | public static int TCSAFLUSH; /* drain output, flush input */ 121 | 122 | @JniField(flags={CONSTANT}, conditional="defined(TIOCGETA)") 123 | public static long TIOCGETA; 124 | @JniField(flags={CONSTANT}, conditional="defined(TIOCSETA)") 125 | public static long TIOCSETA; 126 | @JniField(flags={CONSTANT}, conditional="defined(TIOCGETD)") 127 | public static long TIOCGETD; 128 | @JniField(flags={CONSTANT}, conditional="defined(TIOCSETD)") 129 | public static long TIOCSETD; 130 | /** 131 | * ioctl command: Get window size. 132 | */ 133 | @JniField(flags={CONSTANT}, conditional="defined(TIOCGWINSZ)") 134 | public static long TIOCGWINSZ; 135 | /** 136 | * ioctl command: Set window size. 137 | */ 138 | @JniField(flags={CONSTANT}, conditional="defined(TIOCSWINSZ)") 139 | public static long TIOCSWINSZ; 140 | 141 | /** 142 | * Control a STREAMS device. 143 | * 144 | * @param filedes 145 | * @param request 146 | * @param params 147 | * @return 148 | * @see IOCTL(3P) man-page 149 | */ 150 | @JniMethod(conditional="defined(HAVE_IOCTL)") 151 | public static native int ioctl( 152 | @JniArg int filedes, 153 | @JniArg long request, 154 | @JniArg int[] params); 155 | 156 | @JniMethod(conditional="defined(HAVE_IOCTL)") 157 | public static native int ioctl( 158 | @JniArg int filedes, 159 | @JniArg long request, 160 | @JniArg(flags = ArgFlag.POINTER_ARG) WinSize params); 161 | 162 | /** 163 | * Window sizes. 164 | * @see IOCTL_TTY(2) man-page 165 | */ 166 | @JniClass(flags={ClassFlag.STRUCT}, name="winsize", conditional="defined(HAVE_IOCTL)") 167 | public static class WinSize { 168 | 169 | static { 170 | LIBRARY.load(); 171 | init(); 172 | } 173 | 174 | @JniMethod(flags={CONSTANT_INITIALIZER}) 175 | private static native void init(); 176 | @JniField(flags={CONSTANT}, accessor="sizeof(struct winsize)") 177 | public static int SIZEOF; 178 | 179 | @JniField(accessor="ws_row") 180 | public short ws_row; 181 | @JniField(accessor="ws_col") 182 | public short ws_col; 183 | @JniField(accessor="ws_xpixel") 184 | public short ws_xpixel; 185 | @JniField(accessor="ws_ypixel") 186 | public short ws_ypixel; 187 | 188 | public WinSize() { 189 | } 190 | 191 | public WinSize(short ws_row, short ws_col) { 192 | this.ws_row = ws_row; 193 | this.ws_col = ws_col; 194 | } 195 | } 196 | 197 | /** 198 | * termios structure for termios functions, describing a general terminal interface that is 199 | * provided to control asynchronous communications ports 200 | * 201 | * @see TERMIOS(3) man-page 202 | */ 203 | @JniClass(flags={ClassFlag.STRUCT}, name="termios", conditional = "defined(HAVE_IOCTL)") 204 | public static class Termios { 205 | 206 | static { 207 | LIBRARY.load(); 208 | init(); 209 | } 210 | 211 | @JniMethod(flags={CONSTANT_INITIALIZER}) 212 | private static native void init(); 213 | @JniField(flags={CONSTANT}, accessor="sizeof(struct termios)") 214 | public static int SIZEOF; 215 | 216 | @JniField(accessor="c_iflag") 217 | public long c_iflag; 218 | @JniField(accessor="c_oflag") 219 | public long c_oflag; 220 | @JniField(accessor="c_cflag") 221 | public long c_cflag; 222 | @JniField(accessor="c_lflag") 223 | public long c_lflag; 224 | @JniField(accessor="c_cc") 225 | public byte[] c_cc = new byte[32]; 226 | @JniField(accessor="c_ispeed") 227 | public long c_ispeed; 228 | @JniField(accessor="c_ospeed") 229 | public long c_ospeed; 230 | } 231 | 232 | } 233 | -------------------------------------------------------------------------------- /src/main/java/org/fusesource/jansi/internal/Kernel32.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009-2017 the original author(s). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.fusesource.jansi.internal; 17 | 18 | import org.fusesource.hawtjni.runtime.*; 19 | 20 | import java.io.IOException; 21 | 22 | import static org.fusesource.hawtjni.runtime.ArgFlag.*; 23 | import static org.fusesource.hawtjni.runtime.ClassFlag.*; 24 | import static org.fusesource.hawtjni.runtime.FieldFlag.*; 25 | import static org.fusesource.hawtjni.runtime.MethodFlag.*; 26 | 27 | /** 28 | * Interface to access Win32 base APIs, loaded by 29 | * HawtJNI Runtime 30 | * as jansi library. 31 | * 32 | * @author Hiram Chirino 33 | * @see Library 34 | */ 35 | @JniClass(conditional="defined(_WIN32) || defined(_WIN64)") 36 | public class Kernel32 { 37 | 38 | private static final Library LIBRARY = new Library("jansi", Kernel32.class); 39 | static { 40 | LIBRARY.load(); 41 | init(); 42 | } 43 | 44 | @JniMethod(flags={CONSTANT_INITIALIZER}) 45 | private static final native void init(); 46 | 47 | @JniField(flags={CONSTANT}) 48 | public static short FOREGROUND_BLUE; 49 | @JniField(flags={CONSTANT}) 50 | public static short FOREGROUND_GREEN; 51 | @JniField(flags={CONSTANT}) 52 | public static short FOREGROUND_RED; 53 | @JniField(flags={CONSTANT}) 54 | public static short FOREGROUND_INTENSITY; 55 | @JniField(flags={CONSTANT}) 56 | public static short BACKGROUND_BLUE; 57 | @JniField(flags={CONSTANT}) 58 | public static short BACKGROUND_GREEN; 59 | @JniField(flags={CONSTANT}) 60 | public static short BACKGROUND_RED; 61 | @JniField(flags={CONSTANT}) 62 | public static short BACKGROUND_INTENSITY; 63 | @JniField(flags={CONSTANT}) 64 | public static short COMMON_LVB_LEADING_BYTE; 65 | @JniField(flags={CONSTANT}) 66 | public static short COMMON_LVB_TRAILING_BYTE; 67 | @JniField(flags={CONSTANT}) 68 | public static short COMMON_LVB_GRID_HORIZONTAL; 69 | @JniField(flags={CONSTANT}) 70 | public static short COMMON_LVB_GRID_LVERTICAL; 71 | @JniField(flags={CONSTANT}) 72 | public static short COMMON_LVB_GRID_RVERTICAL; 73 | @JniField(flags={CONSTANT}) 74 | public static short COMMON_LVB_REVERSE_VIDEO; 75 | @JniField(flags={CONSTANT}) 76 | public static short COMMON_LVB_UNDERSCORE; 77 | @JniField(flags={CONSTANT}) 78 | public static int FORMAT_MESSAGE_FROM_SYSTEM; 79 | @JniField(flags={CONSTANT}) 80 | public static int STD_INPUT_HANDLE; 81 | @JniField(flags={CONSTANT}) 82 | public static int STD_OUTPUT_HANDLE; 83 | @JniField(flags={CONSTANT}) 84 | public static int STD_ERROR_HANDLE; 85 | @JniField(flags={CONSTANT}) 86 | public static int INVALID_HANDLE_VALUE; 87 | 88 | 89 | @JniMethod(cast="void *") 90 | public static final native long malloc( 91 | @JniArg(cast="size_t") long size); 92 | 93 | public static final native void free( 94 | @JniArg(cast="void *") long ptr); 95 | 96 | // public static final native void memmove ( 97 | // @JniArg(cast="void *") long dest, 98 | // @JniArg(cast="const void *") long src, 99 | // @JniArg(cast="size_t") long size); 100 | // 101 | // public static final native void memmove ( 102 | // @JniArg(cast="void *") long dest, 103 | // @JniArg(cast="const void *", flags={NO_OUT, CRITICAL}) byte[] src, 104 | // @JniArg(cast="size_t") long size); 105 | // 106 | // public static final native void memmove ( 107 | // @JniArg(cast="void *") long dest, 108 | // @JniArg(cast="const void *", flags={NO_OUT, CRITICAL}) char[] src, 109 | // @JniArg(cast="size_t") long size); 110 | // 111 | // public static final native void memmove ( 112 | // @JniArg(cast="void *") long dest, 113 | // @JniArg(cast="const void *", flags={NO_OUT, CRITICAL}) short[] src, 114 | // @JniArg(cast="size_t") long size); 115 | // 116 | // public static final native void memmove ( 117 | // @JniArg(cast="void *") long dest, 118 | // @JniArg(cast="const void *", flags={NO_OUT, CRITICAL}) int[] src, 119 | // @JniArg(cast="size_t") long size); 120 | // 121 | // public static final native void memmove ( 122 | // @JniArg(cast="void *") long dest, 123 | // @JniArg(cast="const void *", flags={NO_OUT, CRITICAL}, pointer=FALSE) long[] src, 124 | // @JniArg(cast="size_t") long size); 125 | // 126 | // public static final native void memmove ( 127 | // @JniArg(cast="void *") long dest, 128 | // @JniArg(cast="const void *", flags={NO_OUT, CRITICAL}) float[] src, 129 | // @JniArg(cast="size_t") long size); 130 | // 131 | // public static final native void memmove ( 132 | // @JniArg(cast="void *") long dest, 133 | // @JniArg(cast="const void *", flags={NO_OUT, CRITICAL}) double[] src, 134 | // @JniArg(cast="size_t") long size); 135 | // 136 | // 137 | // 138 | // public static final native void memmove ( 139 | // @JniArg(cast="void *", flags={NO_IN, CRITICAL}) byte[] dest, 140 | // @JniArg(cast="const void *") long src, 141 | // @JniArg(cast="size_t") long size); 142 | // 143 | // public static final native void memmove ( 144 | // @JniArg(cast="void *", flags={NO_IN, CRITICAL}) char[] dest, 145 | // @JniArg(cast="const void *") long src, 146 | // @JniArg(cast="size_t") long size); 147 | // 148 | // public static final native void memmove ( 149 | // @JniArg(cast="void *", flags={NO_IN, CRITICAL}) short[] dest, 150 | // @JniArg(cast="const void *") long src, 151 | // @JniArg(cast="size_t") long size); 152 | // 153 | // public static final native void memmove ( 154 | // @JniArg(cast="void *", flags={NO_IN, CRITICAL}) int[] dest, 155 | // @JniArg(cast="const void *") long src, 156 | // @JniArg(cast="size_t") long size); 157 | // 158 | // public static final native void memmove ( 159 | // @JniArg(cast="void *", flags={NO_IN, CRITICAL}, pointer=FALSE) long[] dest, 160 | // @JniArg(cast="const void *") long src, 161 | // @JniArg(cast="size_t") long size); 162 | // 163 | // public static final native void memmove ( 164 | // @JniArg(cast="void *", flags={NO_IN, CRITICAL}) float[] dest, 165 | // @JniArg(cast="const void *") long src, 166 | // @JniArg(cast="size_t") long size); 167 | // 168 | // public static final native void memmove ( 169 | // @JniArg(cast="void *", flags={NO_IN, CRITICAL}) double[] dest, 170 | // @JniArg(cast="const void *") long src, 171 | // @JniArg(cast="size_t") long size); 172 | // 173 | // public static final native void memmove ( 174 | // @JniArg(cast="void *", flags={NO_IN, CRITICAL}) byte[] dest, 175 | // @JniArg(cast="const void *", flags={NO_OUT, CRITICAL}) char[] src, 176 | // @JniArg(cast="size_t") long size); 177 | // 178 | // public static final native void memmove ( 179 | // @JniArg(cast="void *", flags={NO_IN, CRITICAL}) int[] dest, 180 | // @JniArg(cast="const void *", flags={NO_OUT, CRITICAL}) byte[] src, 181 | // @JniArg(cast="size_t") long size); 182 | // 183 | // @JniMethod(cast="void *") 184 | // public static final native long memset ( 185 | // @JniArg(cast="void *") long buffer, 186 | // int c, 187 | // @JniArg(cast="size_t") long num); 188 | // 189 | // public static final native int strlen( 190 | // @JniArg(cast="char *")long s); 191 | // 192 | // public static final native void memmove ( 193 | // @JniArg(cast="void *") long dest, 194 | // @JniArg(cast="const void *", flags={NO_OUT, CRITICAL}) foo src, 195 | // @JniArg(cast="size_t") long size); 196 | // 197 | // public static final native void memmove ( 198 | // @JniArg(cast="void *", flags={NO_IN, CRITICAL}) foo dest, 199 | // @JniArg(cast="const void *") long src, 200 | // @JniArg(cast="size_t") long size); 201 | 202 | /** 203 | * http://msdn.microsoft.com/en-us/library/ms686311%28VS.85%29.aspx 204 | */ 205 | @JniClass(flags={STRUCT,TYPEDEF}, conditional="defined(_WIN32) || defined(_WIN64)") 206 | static public class SMALL_RECT { 207 | static { 208 | LIBRARY.load(); 209 | init(); 210 | } 211 | 212 | @JniMethod(flags={CONSTANT_INITIALIZER}) 213 | private static final native void init(); 214 | @JniField(flags={CONSTANT}, accessor="sizeof(SMALL_RECT)") 215 | public static int SIZEOF; 216 | 217 | @JniField(accessor="Left") 218 | public short left; 219 | @JniField(accessor="Top") 220 | public short top; 221 | @JniField(accessor="Right") 222 | public short right; 223 | @JniField(accessor="Bottom") 224 | public short bottom; 225 | 226 | public short width() { 227 | return (short) (right-left); 228 | } 229 | public short height() { 230 | return (short) (bottom-top); 231 | } 232 | public SMALL_RECT copy() { 233 | SMALL_RECT rc = new SMALL_RECT(); 234 | rc.left = left; 235 | rc.top = top; 236 | rc.right = right; 237 | rc.bottom = bottom; 238 | return rc; 239 | } 240 | } 241 | 242 | /** 243 | * see http://msdn.microsoft.com/en-us/library/ms686047%28VS.85%29.aspx 244 | * @param consoleOutput 245 | * @param attributes 246 | * @return 247 | */ 248 | public static final native int SetConsoleTextAttribute( 249 | @JniArg(cast="HANDLE")long consoleOutput, 250 | short attributes); 251 | 252 | @JniClass(flags={ClassFlag.STRUCT,TYPEDEF}, conditional="defined(_WIN32) || defined(_WIN64)") 253 | public static class COORD { 254 | 255 | static { 256 | LIBRARY.load(); 257 | init(); 258 | } 259 | 260 | @JniMethod(flags={CONSTANT_INITIALIZER}) 261 | private static final native void init(); 262 | @JniField(flags={CONSTANT}, accessor="sizeof(COORD)") 263 | public static int SIZEOF; 264 | 265 | @JniField(accessor="X") 266 | public short x; 267 | @JniField(accessor="Y") 268 | public short y; 269 | 270 | public COORD copy() { 271 | COORD rc = new COORD(); 272 | rc.x = x; 273 | rc.y = y; 274 | return rc; 275 | } 276 | } 277 | 278 | /** 279 | * http://msdn.microsoft.com/en-us/library/ms682093%28VS.85%29.aspx 280 | */ 281 | @JniClass(flags={ClassFlag.STRUCT,TYPEDEF}, conditional="defined(_WIN32) || defined(_WIN64)") 282 | public static class CONSOLE_SCREEN_BUFFER_INFO { 283 | 284 | static { 285 | LIBRARY.load(); 286 | init(); 287 | } 288 | 289 | @JniMethod(flags={CONSTANT_INITIALIZER}) 290 | private static final native void init(); 291 | @JniField(flags={CONSTANT}, accessor="sizeof(CONSOLE_SCREEN_BUFFER_INFO)") 292 | public static int SIZEOF; 293 | 294 | @JniField(accessor="dwSize") 295 | public COORD size = new COORD(); 296 | @JniField(accessor="dwCursorPosition") 297 | public COORD cursorPosition = new COORD(); 298 | @JniField(accessor="wAttributes") 299 | public short attributes; 300 | @JniField(accessor="srWindow") 301 | public SMALL_RECT window = new SMALL_RECT(); 302 | @JniField(accessor="dwMaximumWindowSize") 303 | public COORD maximumWindowSize = new COORD(); 304 | 305 | public int windowWidth() { 306 | return window.width() + 1; 307 | } 308 | 309 | public int windowHeight() { 310 | return window.height() + 1; 311 | } 312 | } 313 | 314 | 315 | // DWORD WINAPI WaitForSingleObject( 316 | // _In_ HANDLE hHandle, 317 | // _In_ DWORD dwMilliseconds 318 | // ); 319 | public static final native int WaitForSingleObject(@JniArg(cast="HANDLE")long hHandle, int dwMilliseconds); 320 | 321 | /** 322 | * see: http://msdn.microsoft.com/en-us/library/ms724211%28VS.85%29.aspx 323 | * 324 | * @param handle 325 | * @return 326 | */ 327 | public static final native int CloseHandle(@JniArg(cast="HANDLE")long handle); 328 | 329 | 330 | /** 331 | * see: http://msdn.microsoft.com/en-us/library/ms679360(VS.85).aspx 332 | * 333 | * @return 334 | */ 335 | public static final native int GetLastError(); 336 | 337 | /** 338 | * 339 | * @param flags 340 | * @param source 341 | * @param messageId 342 | * @param languageId 343 | * @param buffer 344 | * @param size 345 | * @param args 346 | * @return 347 | */ 348 | public static final native int FormatMessageW( 349 | int flags, 350 | @JniArg(cast="void *")long source, 351 | int messageId, 352 | int languageId, 353 | @JniArg(cast="void *", flags={NO_IN, CRITICAL})byte[] buffer, 354 | int size, 355 | @JniArg(cast="void *", flags={NO_IN, CRITICAL, SENTINEL})long[] args 356 | ); 357 | 358 | 359 | /** 360 | * See: http://msdn.microsoft.com/en-us/library/ms683171%28VS.85%29.aspx 361 | * @param consoleOutput 362 | * @param consoleScreenBufferInfo 363 | * @return 364 | */ 365 | public static final native int GetConsoleScreenBufferInfo( 366 | @JniArg(cast="HANDLE", flags={POINTER_ARG})long consoleOutput, 367 | @JniArg(flags={NO_IN}) CONSOLE_SCREEN_BUFFER_INFO consoleScreenBufferInfo); 368 | 369 | /** 370 | * see: http://msdn.microsoft.com/en-us/library/ms683231%28VS.85%29.aspx 371 | * @param stdHandle 372 | * @return 373 | */ 374 | @JniMethod(cast="HANDLE", flags={POINTER_RETURN}) 375 | public static final native long GetStdHandle(int stdHandle); 376 | 377 | /** 378 | * http://msdn.microsoft.com/en-us/library/ms686025%28VS.85%29.aspx 379 | * @param consoleOutput 380 | * @param cursorPosition 381 | * @return 382 | */ 383 | public static final native int SetConsoleCursorPosition( 384 | @JniArg(cast="HANDLE", flags={POINTER_ARG})long consoleOutput, 385 | @JniArg(flags={BY_VALUE,NO_OUT}) COORD cursorPosition); 386 | 387 | /** 388 | * see: http://msdn.microsoft.com/en-us/library/ms682663%28VS.85%29.aspx 389 | * 390 | * @param consoleOutput 391 | * @param character 392 | * @param length 393 | * @param writeCoord 394 | * @param numberOfCharsWritten 395 | * @return 396 | */ 397 | public static final native int FillConsoleOutputCharacterW( 398 | @JniArg(cast="HANDLE", flags={POINTER_ARG}) long consoleOutput, 399 | char character, 400 | int length, 401 | @JniArg(flags={BY_VALUE,NO_OUT}) COORD writeCoord, 402 | @JniArg(flags={NO_IN}) int[] numberOfCharsWritten); 403 | 404 | /** 405 | * see: https://msdn.microsoft.com/en-us/library/ms682662%28VS.85%29.aspx 406 | * 407 | * @param consoleOutput 408 | * @param attribute 409 | * @param length 410 | * @param writeCoord 411 | * @param numberOfAttrsWritten 412 | * @return 413 | */ 414 | public static final native int FillConsoleOutputAttribute( 415 | @JniArg(cast="HANDLE", flags={POINTER_ARG}) long consoleOutput, 416 | short attribute, 417 | int length, 418 | @JniArg(flags={BY_VALUE,NO_OUT}) COORD writeCoord, 419 | @JniArg(flags={NO_IN}) int[] numberOfAttrsWritten); 420 | 421 | /** 422 | * see: http://msdn.microsoft.com/en-us/library/ms687401(v=VS.85).aspx 423 | * 424 | * @param consoleOutput 425 | * @param buffer 426 | * @param numberOfCharsToWrite 427 | * @param numberOfCharsWritten 428 | * @param reserved must be null 429 | * @return 430 | */ 431 | public static final native int WriteConsoleW( 432 | @JniArg(cast="HANDLE", flags={POINTER_ARG}) long consoleOutput, 433 | @JniArg(flags={NO_OUT}) char[] buffer, 434 | int numberOfCharsToWrite, 435 | @JniArg(flags={NO_IN}) int[] numberOfCharsWritten, 436 | @JniArg(cast="LPVOID", flags={POINTER_ARG})long reserved); 437 | 438 | /** 439 | * see: http://msdn.microsoft.com/en-us/library/ms683167%28VS.85%29.aspx 440 | * @param handle 441 | * @param mode 442 | * @return 443 | */ 444 | public static final native int GetConsoleMode( 445 | @JniArg(cast="HANDLE", flags={POINTER_ARG}) long handle, 446 | @JniArg(flags={NO_IN}) int[] mode); 447 | 448 | /** 449 | * see: http://msdn.microsoft.com/en-us/library/ms686033%28VS.85%29.aspx 450 | * @param handle 451 | * @param mode 452 | * @return 453 | */ 454 | public static final native int SetConsoleMode( 455 | @JniArg(cast="HANDLE", flags={POINTER_ARG}) long handle, 456 | int mode); 457 | 458 | /** 459 | * see: http://msdn.microsoft.com/en-us/library/078sfkak(VS.80).aspx 460 | * @return 461 | */ 462 | public static final native int _getch(); 463 | 464 | 465 | /** 466 | * see: http://msdn.microsoft.com/en-us/library/ms686050%28VS.85%29.aspx 467 | * @param title 468 | * @return 0 if title was set successfully 469 | */ 470 | public static final native int SetConsoleTitle( 471 | @JniArg(flags={UNICODE}) String title); 472 | 473 | 474 | /** 475 | * see: http://msdn.microsoft.com/en-us/library/ms683169(v=VS.85).aspx 476 | * @return the current output code page 477 | */ 478 | public static final native int GetConsoleOutputCP(); 479 | 480 | /** 481 | * see: http://msdn.microsoft.com/en-us/library/ms686036(v=VS.85).aspx 482 | * @param codePageID 483 | * @return non 0 if code page was set 484 | */ 485 | public static final native int SetConsoleOutputCP(int codePageID); 486 | 487 | /** 488 | * see: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682013(v=vs.85).aspx 489 | */ 490 | @JniClass(flags={ClassFlag.STRUCT,TYPEDEF}, conditional = "defined(_WIN32) || defined(_WIN64)") 491 | public static class CHAR_INFO { 492 | 493 | static { 494 | LIBRARY.load(); 495 | init(); 496 | } 497 | 498 | @JniMethod(flags={CONSTANT_INITIALIZER}) 499 | private static final native void init(); 500 | @JniField(flags={CONSTANT}, accessor="sizeof(CHAR_INFO)") 501 | public static int SIZEOF; 502 | 503 | @JniField(accessor = "Attributes") 504 | public short attributes; 505 | @JniField(accessor="Char.UnicodeChar") 506 | public char unicodeChar; 507 | } 508 | 509 | /** 510 | * see: https://msdn.microsoft.com/en-us/library/windows/desktop/ms685107(v=vs.85).aspx 511 | */ 512 | public static final native int ScrollConsoleScreenBuffer( 513 | @JniArg(cast="HANDLE", flags={POINTER_ARG})long consoleOutput, 514 | @JniArg(flags={NO_OUT}) SMALL_RECT scrollRectangle, 515 | @JniArg(flags={NO_OUT}) SMALL_RECT clipRectangle, 516 | @JniArg(flags={BY_VALUE, NO_OUT}) COORD destinationOrigin, 517 | @JniArg(flags={NO_OUT}) CHAR_INFO fill); 518 | 519 | /** 520 | * see: http://msdn.microsoft.com/en-us/library/ms684166(v=VS.85).aspx 521 | */ 522 | @JniClass(flags={ClassFlag.STRUCT,TYPEDEF}, conditional="defined(_WIN32) || defined(_WIN64)") 523 | public static class KEY_EVENT_RECORD { 524 | 525 | static { 526 | LIBRARY.load(); 527 | init(); 528 | } 529 | 530 | @JniMethod(flags={CONSTANT_INITIALIZER}) 531 | private static final native void init(); 532 | @JniField(flags={CONSTANT}, accessor="sizeof(KEY_EVENT_RECORD)") 533 | public static int SIZEOF; 534 | @JniField(flags={CONSTANT}, accessor="CAPSLOCK_ON") 535 | public static int CAPSLOCK_ON; 536 | @JniField(flags={CONSTANT}, accessor="NUMLOCK_ON") 537 | public static int NUMLOCK_ON; 538 | @JniField(flags={CONSTANT}, accessor="SCROLLLOCK_ON") 539 | public static int SCROLLLOCK_ON; 540 | @JniField(flags={CONSTANT}, accessor="ENHANCED_KEY") 541 | public static int ENHANCED_KEY; 542 | @JniField(flags={CONSTANT}, accessor="LEFT_ALT_PRESSED") 543 | public static int LEFT_ALT_PRESSED; 544 | @JniField(flags={CONSTANT}, accessor="LEFT_CTRL_PRESSED") 545 | public static int LEFT_CTRL_PRESSED; 546 | @JniField(flags={CONSTANT}, accessor="RIGHT_ALT_PRESSED") 547 | public static int RIGHT_ALT_PRESSED; 548 | @JniField(flags={CONSTANT}, accessor="RIGHT_CTRL_PRESSED") 549 | public static int RIGHT_CTRL_PRESSED; 550 | @JniField(flags={CONSTANT}, accessor="SHIFT_PRESSED") 551 | public static int SHIFT_PRESSED; 552 | 553 | @JniField(accessor="bKeyDown") 554 | public boolean keyDown; 555 | @JniField(accessor="wRepeatCount") 556 | public short repeatCount; 557 | @JniField(accessor="wVirtualKeyCode") 558 | public short keyCode; 559 | @JniField(accessor="wVirtualScanCode") 560 | public short scanCode; 561 | @JniField(accessor="uChar.UnicodeChar") 562 | public char uchar; 563 | @JniField(accessor="dwControlKeyState") 564 | public int controlKeyState; 565 | 566 | public String toString() { 567 | return "KEY_EVENT_RECORD{" + 568 | "keyDown=" + keyDown + 569 | ", repeatCount=" + repeatCount + 570 | ", keyCode=" + keyCode + 571 | ", scanCode=" + scanCode + 572 | ", uchar=" + uchar + 573 | ", controlKeyState=" + controlKeyState + 574 | '}'; 575 | } 576 | } 577 | 578 | /** 579 | * see: http://msdn.microsoft.com/en-us/library/ms684239(v=VS.85).aspx 580 | */ 581 | @JniClass(flags={ClassFlag.STRUCT,TYPEDEF}, conditional="defined(_WIN32) || defined(_WIN64)") 582 | public static class MOUSE_EVENT_RECORD { 583 | 584 | static { 585 | LIBRARY.load(); 586 | init(); 587 | } 588 | 589 | @JniMethod(flags={CONSTANT_INITIALIZER}) 590 | private static final native void init(); 591 | @JniField(flags={CONSTANT}, accessor="sizeof(MOUSE_EVENT_RECORD)") 592 | public static int SIZEOF; 593 | @JniField(flags={CONSTANT}, accessor="FROM_LEFT_1ST_BUTTON_PRESSED") 594 | public static int FROM_LEFT_1ST_BUTTON_PRESSED; 595 | @JniField(flags={CONSTANT}, accessor="FROM_LEFT_2ND_BUTTON_PRESSED") 596 | public static int FROM_LEFT_2ND_BUTTON_PRESSED; 597 | @JniField(flags={CONSTANT}, accessor="FROM_LEFT_3RD_BUTTON_PRESSED") 598 | public static int FROM_LEFT_3RD_BUTTON_PRESSED; 599 | @JniField(flags={CONSTANT}, accessor="FROM_LEFT_4TH_BUTTON_PRESSED") 600 | public static int FROM_LEFT_4TH_BUTTON_PRESSED; 601 | @JniField(flags={CONSTANT}, accessor="RIGHTMOST_BUTTON_PRESSED") 602 | public static int RIGHTMOST_BUTTON_PRESSED; 603 | 604 | @JniField(flags={CONSTANT}, accessor="CAPSLOCK_ON") 605 | public static int CAPSLOCK_ON; 606 | @JniField(flags={CONSTANT}, accessor="NUMLOCK_ON") 607 | public static int NUMLOCK_ON; 608 | @JniField(flags={CONSTANT}, accessor="SCROLLLOCK_ON") 609 | public static int SCROLLLOCK_ON; 610 | @JniField(flags={CONSTANT}, accessor="ENHANCED_KEY") 611 | public static int ENHANCED_KEY; 612 | @JniField(flags={CONSTANT}, accessor="LEFT_ALT_PRESSED") 613 | public static int LEFT_ALT_PRESSED; 614 | @JniField(flags={CONSTANT}, accessor="LEFT_CTRL_PRESSED") 615 | public static int LEFT_CTRL_PRESSED; 616 | @JniField(flags={CONSTANT}, accessor="RIGHT_ALT_PRESSED") 617 | public static int RIGHT_ALT_PRESSED; 618 | @JniField(flags={CONSTANT}, accessor="RIGHT_CTRL_PRESSED") 619 | public static int RIGHT_CTRL_PRESSED; 620 | @JniField(flags={CONSTANT}, accessor="SHIFT_PRESSED") 621 | public static int SHIFT_PRESSED; 622 | 623 | @JniField(flags={CONSTANT}, accessor="DOUBLE_CLICK") 624 | public static int DOUBLE_CLICK; 625 | @JniField(flags={CONSTANT}, accessor="MOUSE_HWHEELED") 626 | public static int MOUSE_HWHEELED; 627 | @JniField(flags={CONSTANT}, accessor="MOUSE_MOVED") 628 | public static int MOUSE_MOVED; 629 | @JniField(flags={CONSTANT}, accessor="MOUSE_WHEELED") 630 | public static int MOUSE_WHEELED; 631 | 632 | @JniField(accessor="dwMousePosition") 633 | public COORD mousePosition = new COORD(); 634 | @JniField(accessor="dwButtonState") 635 | public int buttonState; 636 | @JniField(accessor="dwControlKeyState") 637 | public int controlKeyState; 638 | @JniField(accessor="dwEventFlags") 639 | public int eventFlags; 640 | 641 | public String toString() { 642 | return "MOUSE_EVENT_RECORD{" + 643 | "mousePosition=" + mousePosition + 644 | ", buttonState=" + buttonState + 645 | ", controlKeyState=" + controlKeyState + 646 | ", eventFlags=" + eventFlags + 647 | '}'; 648 | } 649 | } 650 | 651 | /** 652 | * see: http://msdn.microsoft.com/en-us/library/ms687093(v=VS.85).aspx 653 | */ 654 | @JniClass(flags={ClassFlag.STRUCT,TYPEDEF}, conditional="defined(_WIN32) || defined(_WIN64)") 655 | public static class WINDOW_BUFFER_SIZE_RECORD { 656 | 657 | static { 658 | LIBRARY.load(); 659 | init(); 660 | } 661 | 662 | @JniMethod(flags={CONSTANT_INITIALIZER}) 663 | private static final native void init(); 664 | @JniField(flags={CONSTANT}, accessor="sizeof(WINDOW_BUFFER_SIZE_RECORD)") 665 | public static int SIZEOF; 666 | 667 | @JniField(accessor="dwSize") 668 | public COORD size = new COORD(); 669 | 670 | public String toString() { 671 | return "WINDOW_BUFFER_SIZE_RECORD{size=" + size + '}'; 672 | } 673 | } 674 | 675 | /** 676 | * see: http://msdn.microsoft.com/en-us/library/ms683149(v=VS.85).aspx 677 | */ 678 | @JniClass(flags={ClassFlag.STRUCT,TYPEDEF}, conditional="defined(_WIN32) || defined(_WIN64)") 679 | public static class FOCUS_EVENT_RECORD { 680 | static { 681 | LIBRARY.load(); 682 | init(); 683 | } 684 | @JniMethod(flags={CONSTANT_INITIALIZER}) 685 | private static final native void init(); 686 | @JniField(flags={CONSTANT}, accessor="sizeof(WINDOW_BUFFER_SIZE_RECORD)") 687 | public static int SIZEOF; 688 | @JniField(accessor="bSetFocus") 689 | public boolean setFocus; 690 | } 691 | 692 | /** 693 | * see: http://msdn.microsoft.com/en-us/library/ms684213(v=VS.85).aspx 694 | */ 695 | @JniClass(flags={ClassFlag.STRUCT,TYPEDEF}, conditional="defined(_WIN32) || defined(_WIN64)") 696 | public static class MENU_EVENT_RECORD { 697 | static { 698 | LIBRARY.load(); 699 | init(); 700 | } 701 | @JniMethod(flags={CONSTANT_INITIALIZER}) 702 | private static final native void init(); 703 | @JniField(flags={CONSTANT}, accessor="sizeof(MENU_EVENT_RECORD)") 704 | public static int SIZEOF; 705 | @JniField(accessor="dwCommandId") 706 | public int commandId; 707 | } 708 | 709 | /** 710 | * see: http://msdn.microsoft.com/en-us/library/ms683499(v=VS.85).aspx 711 | */ 712 | @JniClass(flags={ClassFlag.STRUCT,TYPEDEF}, conditional="defined(_WIN32) || defined(_WIN64)") 713 | public static class INPUT_RECORD { 714 | 715 | static { 716 | LIBRARY.load(); 717 | init(); 718 | } 719 | 720 | @JniMethod(flags={CONSTANT_INITIALIZER}) 721 | private static final native void init(); 722 | @JniField(flags={CONSTANT}, accessor="sizeof(INPUT_RECORD)") 723 | public static int SIZEOF; 724 | @JniField(flags={CONSTANT}, accessor="KEY_EVENT") 725 | public static short KEY_EVENT; 726 | @JniField(flags={CONSTANT}, accessor="MOUSE_EVENT") 727 | public static short MOUSE_EVENT; 728 | @JniField(flags={CONSTANT}, accessor="WINDOW_BUFFER_SIZE_EVENT") 729 | public static short WINDOW_BUFFER_SIZE_EVENT; 730 | @JniField(flags={CONSTANT}, accessor="FOCUS_EVENT") 731 | public static short FOCUS_EVENT; 732 | @JniField(flags={CONSTANT}, accessor="MENU_EVENT") 733 | public static short MENU_EVENT; 734 | @JniField(accessor="EventType") 735 | public short eventType; 736 | @JniField(accessor="Event.KeyEvent") 737 | public KEY_EVENT_RECORD keyEvent = new KEY_EVENT_RECORD(); 738 | @JniField(accessor="Event.MouseEvent") 739 | public MOUSE_EVENT_RECORD mouseEvent = new MOUSE_EVENT_RECORD(); 740 | @JniField(accessor="Event.WindowBufferSizeEvent") 741 | public WINDOW_BUFFER_SIZE_RECORD windowBufferSizeEvent = new WINDOW_BUFFER_SIZE_RECORD(); 742 | @JniField(accessor="Event.MenuEvent") 743 | public MENU_EVENT_RECORD menuEvent = new MENU_EVENT_RECORD(); 744 | @JniField(accessor="Event.FocusEvent") 745 | public FOCUS_EVENT_RECORD focusEvent = new FOCUS_EVENT_RECORD(); 746 | 747 | public static final native void memmove ( 748 | @JniArg(cast="void *", flags={NO_IN, CRITICAL}) INPUT_RECORD dest, 749 | @JniArg(cast="const void *", flags={NO_OUT, CRITICAL}) long src, 750 | @JniArg(cast="size_t") long size); 751 | 752 | } 753 | 754 | /** 755 | * see: http://msdn.microsoft.com/en-us/library/ms684961(v=VS.85).aspx 756 | * @param handle 757 | * @param length 758 | * @param eventsCount 759 | * @return 760 | */ 761 | private static final native int ReadConsoleInputW( 762 | @JniArg(cast="HANDLE", flags={POINTER_ARG}) long handle, 763 | @JniArg(cast="PINPUT_RECORD", flags={POINTER_ARG}) long inputRecord, 764 | int length, 765 | @JniArg(flags={NO_IN}) int[] eventsCount); 766 | 767 | /** 768 | * see: http://msdn.microsoft.com/en-us/library/ms684344(v=VS.85).aspx 769 | * @param handle 770 | * @param length 771 | * @param eventsCount 772 | * @return 773 | */ 774 | private static final native int PeekConsoleInputW( 775 | @JniArg(cast="HANDLE", flags={POINTER_ARG}) long handle, 776 | @JniArg(cast="PINPUT_RECORD", flags={POINTER_ARG}) long inputRecord, 777 | int length, 778 | @JniArg(flags={NO_IN}) int[] eventsCount); 779 | 780 | /** 781 | * see: http://msdn.microsoft.com/en-us/library/ms683207(v=VS.85).aspx 782 | * @param handle 783 | * @param numberOfEvents number of unread input records in the console's input buffer 784 | * @return 785 | */ 786 | public static final native int GetNumberOfConsoleInputEvents( 787 | @JniArg(cast="HANDLE", flags={POINTER_ARG}) long handle, 788 | @JniArg(flags={NO_IN}) int[] numberOfEvents); 789 | 790 | /** 791 | * see: http://msdn.microsoft.com/en-us/library/ms683147(v=VS.85).aspx 792 | * @param handle 793 | * @return 794 | */ 795 | public static final native int FlushConsoleInputBuffer( 796 | @JniArg(cast="HANDLE", flags={POINTER_ARG}) long handle); 797 | 798 | /** 799 | * Return console input events. 800 | * 801 | * @param handle 802 | * @param count requested number of events 803 | * @return null on read errors 804 | */ 805 | public static INPUT_RECORD[] readConsoleInputHelper( 806 | long handle, int count, boolean peek) throws IOException { 807 | int[] length = new int[1]; 808 | int res; 809 | long inputRecordPtr = 0; 810 | try { 811 | inputRecordPtr = malloc(INPUT_RECORD.SIZEOF * count); 812 | if (inputRecordPtr == 0) { 813 | throw new IOException("cannot allocate memory with JNI"); 814 | } 815 | res = peek ? 816 | PeekConsoleInputW(handle, inputRecordPtr, count, length) 817 | : ReadConsoleInputW(handle, inputRecordPtr, count, length); 818 | if (res == 0) { 819 | throw new IOException("ReadConsoleInputW failed"); 820 | } 821 | if (length[0] <= 0) { 822 | return new INPUT_RECORD[0]; 823 | } 824 | INPUT_RECORD[] records = new INPUT_RECORD[length[0]]; 825 | for (int i = 0; i < records.length; i++) { 826 | records[i] = new INPUT_RECORD(); 827 | INPUT_RECORD.memmove(records[i], PointerMath.add(inputRecordPtr, i*INPUT_RECORD.SIZEOF), INPUT_RECORD.SIZEOF); 828 | } 829 | return records; 830 | } finally { 831 | if (inputRecordPtr != 0) { 832 | free(inputRecordPtr); 833 | } 834 | } 835 | } 836 | 837 | /** 838 | * Return console input key events (discard other events). 839 | * 840 | * @param count requested number of events 841 | * @return array possibly of size smaller then count 842 | */ 843 | public static INPUT_RECORD[] readConsoleKeyInput(long handle, int count, boolean peek) 844 | throws IOException { 845 | while (true) { 846 | // read events until we have keyboard events, the queue could be full 847 | // of mouse events. 848 | INPUT_RECORD[] evts = readConsoleInputHelper(handle, count, peek); 849 | int keyEvtCount = 0; 850 | for (INPUT_RECORD evt : evts) { 851 | if (evt.eventType == INPUT_RECORD.KEY_EVENT) keyEvtCount++; 852 | } 853 | if (keyEvtCount > 0) { 854 | INPUT_RECORD[] res = new INPUT_RECORD[keyEvtCount]; 855 | int i = 0; 856 | for (INPUT_RECORD evt : evts) { 857 | if (evt.eventType == INPUT_RECORD.KEY_EVENT) { 858 | res[i++] = evt; 859 | } 860 | } 861 | return res; 862 | } 863 | } 864 | } 865 | 866 | 867 | } 868 | -------------------------------------------------------------------------------- /src/main/java/org/fusesource/jansi/internal/WindowsSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009-2017 the original author(s). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.fusesource.jansi.internal; 17 | 18 | import static org.fusesource.jansi.internal.Kernel32.*; 19 | 20 | import org.fusesource.jansi.internal.Kernel32.CONSOLE_SCREEN_BUFFER_INFO; 21 | 22 | import java.io.IOException; 23 | 24 | /** 25 | * Windows helper to ease Kernel32 usage. 26 | * 27 | * @author Hiram Chirino 28 | */ 29 | public class WindowsSupport { 30 | 31 | public static String getLastErrorMessage() { 32 | int errorCode = GetLastError(); 33 | int bufferSize = 160; 34 | byte data[] = new byte[bufferSize]; 35 | FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, 0, errorCode, 0, data, bufferSize, null); 36 | return new String(data); 37 | } 38 | 39 | ////////////////////////////////////////////////////////////////////////// 00 40 | // 41 | // The following helper methods are for jline 42 | // 43 | ////////////////////////////////////////////////////////////////////////// 44 | 45 | public static int readByte() { 46 | return _getch(); 47 | } 48 | 49 | public static int getConsoleMode() { 50 | long hConsole = GetStdHandle (STD_INPUT_HANDLE); 51 | if (hConsole == INVALID_HANDLE_VALUE) 52 | return -1; 53 | int mode[] = new int[1]; 54 | if (GetConsoleMode (hConsole, mode)==0) 55 | return -1; 56 | return mode[0]; 57 | } 58 | 59 | public static void setConsoleMode(int mode) { 60 | long hConsole = GetStdHandle (STD_INPUT_HANDLE); 61 | if (hConsole == INVALID_HANDLE_VALUE) 62 | return; 63 | SetConsoleMode (hConsole, mode); 64 | } 65 | 66 | public static int getWindowsTerminalWidth() { 67 | long outputHandle = GetStdHandle (STD_OUTPUT_HANDLE); 68 | CONSOLE_SCREEN_BUFFER_INFO info = new CONSOLE_SCREEN_BUFFER_INFO(); 69 | GetConsoleScreenBufferInfo (outputHandle, info); 70 | return info.windowWidth(); 71 | } 72 | 73 | public static int getWindowsTerminalHeight() { 74 | long outputHandle = GetStdHandle (STD_OUTPUT_HANDLE); 75 | CONSOLE_SCREEN_BUFFER_INFO info = new CONSOLE_SCREEN_BUFFER_INFO(); 76 | GetConsoleScreenBufferInfo (outputHandle, info); 77 | return info.windowHeight(); 78 | } 79 | 80 | public static int writeConsole(String msg) { 81 | long hConsole = GetStdHandle (STD_OUTPUT_HANDLE); 82 | if (hConsole == INVALID_HANDLE_VALUE) 83 | return 0; 84 | char[] chars = msg.toCharArray(); 85 | int[] written = new int[1]; 86 | if (WriteConsoleW(hConsole, chars, chars.length, written, 0) != 0) { 87 | return written[0]; 88 | } else { 89 | return 0; 90 | } 91 | } 92 | 93 | public static INPUT_RECORD[] readConsoleInput(int count, int dwMilliseconds) throws IOException { 94 | long hConsole = GetStdHandle (STD_INPUT_HANDLE); 95 | if (hConsole == INVALID_HANDLE_VALUE) 96 | return null; 97 | if (WaitForSingleObject(hConsole, dwMilliseconds) != 0) 98 | return null; 99 | return readConsoleInputHelper(hConsole, count, false); 100 | } 101 | 102 | public static INPUT_RECORD[] readConsoleInput(int count) throws IOException { 103 | long hConsole = GetStdHandle (STD_INPUT_HANDLE); 104 | if (hConsole == INVALID_HANDLE_VALUE) 105 | return null; 106 | return readConsoleInputHelper(hConsole, count, false); 107 | } 108 | 109 | public static INPUT_RECORD[] peekConsoleInput(int count, int dwMilliseconds) throws IOException { 110 | long hConsole = GetStdHandle (STD_INPUT_HANDLE); 111 | if (hConsole == INVALID_HANDLE_VALUE) 112 | return null; 113 | if (WaitForSingleObject(hConsole, dwMilliseconds) != 0) 114 | return null; 115 | return readConsoleInputHelper(hConsole, count, true); 116 | } 117 | 118 | public static INPUT_RECORD[] peekConsoleInput(int count) throws IOException { 119 | long hConsole = GetStdHandle (STD_INPUT_HANDLE); 120 | if (hConsole == INVALID_HANDLE_VALUE) 121 | return null; 122 | return readConsoleInputHelper(hConsole, count, true); 123 | } 124 | 125 | public static void flushConsoleInputBuffer() { 126 | long hConsole = GetStdHandle (STD_INPUT_HANDLE); 127 | if (hConsole == INVALID_HANDLE_VALUE) 128 | return; 129 | FlushConsoleInputBuffer(hConsole); 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /src/main/native-package/license.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /src/main/native-package/m4/custom.m4: -------------------------------------------------------------------------------- 1 | dnl --------------------------------------------------------------------------- 2 | dnl Copyright (C) 2009-2017 the original author(s). 3 | dnl 4 | dnl Licensed under the Apache License, Version 2.0 (the "License"); 5 | dnl you may not use this file except in compliance with the License. 6 | dnl You may obtain a copy of the License at 7 | dnl 8 | dnl http://www.apache.org/licenses/LICENSE-2.0 9 | dnl 10 | dnl Unless required by applicable law or agreed to in writing, software 11 | dnl distributed under the License is distributed on an "AS IS" BASIS, 12 | dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | dnl See the License for the specific language governing permissions and 14 | dnl limitations under the License. 15 | dnl --------------------------------------------------------------------------- 16 | 17 | AC_DEFUN([CUSTOM_M4_SETUP], 18 | [ 19 | AC_CHECK_LIB([c], [isatty],[AC_DEFINE([HAVE_ISATTY], [1], [Define to 1 if you have the isatty function.])]) 20 | AC_CHECK_LIB([c], [ttyname],[AC_DEFINE([HAVE_TTYNAME], [1], [Define to 1 if you have the ttyname function.])]) 21 | AC_CHECK_LIB([c], [tcgetattr],[AC_DEFINE([HAVE_TCGETATTR], [1], [Define to 1 if you have the tcgetattr function.])]) 22 | AC_CHECK_LIB([c], [tcsetattr],[AC_DEFINE([HAVE_TCSETATTR], [1], [Define to 1 if you have the tcsetattr function.])]) 23 | AC_CHECK_LIB([c], [ioctl],[AC_DEFINE([HAVE_IOCTL], [1], [Define to 1 if you have the ioctl function.])]) 24 | AC_SEARCH_LIBS([openpty], [util], [AC_DEFINE([HAVE_OPENPTY], [1], [Define to 1 if you have the openpty function.])]) 25 | AC_CHECK_HEADER([pty.h], [AC_DEFINE([HAVE_PTY_H], 1, [Header pty.h])]) 26 | AC_CHECK_HEADER([term.h], [AC_DEFINE([HAVE_JANSI_TERM_H], 1, [Header term.h])]) 27 | AC_CHECK_HEADER([termios.h], [AC_DEFINE([HAVE_TERMIOS_H], 1, [Header termios.h])]) 28 | AC_CHECK_HEADER([sys/ioctl.h], [AC_DEFINE([HAVE_IOCTL_H], 1, [Header sys/ioctl.h])]) 29 | AC_CHECK_HEADER([libutil.h], [AC_DEFINE([HAVE_JANSI_LIBUTIL_H], [1], [Header libutil.h])]) 30 | AC_CHECK_HEADER([util.h], [AC_DEFINE([HAVE_JANSI_UTIL_H], [1], [Header util.h])]) 31 | 32 | ssp_cc=yes 33 | if test "X$CC" != "X"; then 34 | AC_MSG_CHECKING([whether ${CC} accepts -fstack-protector]) 35 | ssp_old_cflags="$CFLAGS" 36 | CFLAGS="$CFLAGS -fstack-protector" 37 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [], [], [ssp_cc=no]) 38 | AC_MSG_RESULT([$ssp_cc]) 39 | if test "X$ssp_cc" = "Xno"; then 40 | CFLAGS="$ssp_old_cflags" 41 | else 42 | AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.]) 43 | fi 44 | fi 45 | ]) -------------------------------------------------------------------------------- /src/main/native-package/src/jansi.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2009-2017 the original author(s). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | #ifndef JANSI_H 17 | #define JANSI_H 18 | 19 | #ifdef HAVE_CONFIG_H 20 | /* configure based build.. we will use what it discovered about the platform */ 21 | #include "config.h" 22 | #else 23 | #if defined(_WIN32) || defined(_WIN64) 24 | /* Windows based build */ 25 | #define HAVE_STDLIB_H 1 26 | #define HAVE_STRINGS_H 1 27 | 28 | #define STDIN_FILENO 0 29 | #define STDOUT_FILENO 1 30 | #define STDERR_FILENO 2 31 | #define HAVE_ISATTY 32 | 33 | #include 34 | #include 35 | #include 36 | 37 | #define isatty _isatty 38 | #define getch _getch 39 | 40 | #endif 41 | #endif 42 | 43 | #ifdef HAVE_UNISTD_H 44 | #include 45 | #endif 46 | 47 | #ifdef HAVE_STDLIB_H 48 | #include 49 | #endif 50 | 51 | #ifdef HAVE_STRINGS_H 52 | #include 53 | #endif 54 | 55 | #ifdef HAVE_JANSI_TERM_H 56 | #include 57 | #endif 58 | 59 | #ifdef HAVE_JANSI_LIBUTIL_H 60 | #include 61 | #endif 62 | 63 | #ifdef HAVE_JANSI_UTIL_H 64 | #include 65 | #endif 66 | 67 | #ifdef HAVE_TERMIOS_H 68 | #include 69 | #endif 70 | 71 | #ifdef HAVE_IOCTL_H 72 | #include 73 | #endif 74 | 75 | #ifdef HAVE_PTY_H 76 | #include 77 | #endif 78 | 79 | 80 | #endif /* JANSI_H */ 81 | -------------------------------------------------------------------------------- /src/main/native-package/src/jansi_isatty.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2017, the original author(s). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | #include "jansi.h" 17 | #include "hawtjni.h" 18 | #include "jansi_structs.h" 19 | #include "jansi_stats.h" 20 | 21 | #define CLibrary_NATIVE(func) Java_org_fusesource_jansi_internal_CLibrary_##func 22 | 23 | #if defined(_WIN32) || defined(_WIN64) 24 | 25 | typedef struct _FILE_NAME_INFORMATION { 26 | uint16_t FileNameLength; 27 | WCHAR FileName[1]; 28 | } FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION; 29 | 30 | 31 | typedef enum { 32 | ObjectBasicInformation, 33 | ObjectNameInformation, 34 | ObjectTypeInformation, 35 | ObjectAllInformation, 36 | ObjectDataInformation 37 | } OBJECT_INFORMATION_CLASS; 38 | 39 | typedef NTSTATUS (NTAPI *TFNNtQueryObject)(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG, PULONG); 40 | TFNNtQueryObject NtQueryObject = 0; 41 | 42 | HANDLE hModuleNtDll = 0; 43 | 44 | JNIEXPORT jint JNICALL CLibrary_NATIVE(isatty) 45 | (JNIEnv *env, jclass that, jint arg0) 46 | { 47 | jint rc; 48 | 49 | ULONG result; 50 | BYTE buffer[1024]; 51 | PFILE_NAME_INFORMATION nameinfo = (PFILE_NAME_INFORMATION) buffer; 52 | PWSTR name; 53 | 54 | CLibrary_NATIVE_ENTER(env, that, CLibrary_isatty_FUNC); 55 | /* check if fd is a pipe */ 56 | HANDLE h = (HANDLE) _get_osfhandle(arg0); 57 | DWORD t = GetFileType(h); 58 | if (t == FILE_TYPE_CHAR) { 59 | rc = 1; 60 | } 61 | else if (t != FILE_TYPE_PIPE) { 62 | rc = 0; 63 | } 64 | else { 65 | if (hModuleNtDll == 0) { 66 | hModuleNtDll = LoadLibraryW(L"ntdll.dll"); 67 | } 68 | if (hModuleNtDll == 0) { 69 | rc = 0; 70 | } 71 | else { 72 | if (NtQueryObject == 0) { 73 | NtQueryObject = (TFNNtQueryObject) GetProcAddress(hModuleNtDll, "NtQueryObject"); 74 | } 75 | if (NtQueryObject == 0) { 76 | rc = 0; 77 | } 78 | /* get pipe name */ 79 | else if (NtQueryObject(h, ObjectNameInformation, buffer, sizeof(buffer) - 2, &result) != 0) { 80 | rc = 0; 81 | } 82 | else { 83 | 84 | name = nameinfo->FileName; 85 | name[nameinfo->FileNameLength / sizeof(*name)] = 0; 86 | 87 | /* 88 | * Check if this could be a MSYS2 pty pipe ('msys-XXXX-ptyN-XX') 89 | * or a cygwin pty pipe ('cygwin-XXXX-ptyN-XX') 90 | */ 91 | if ((!wcsstr(name, L"msys-") && !wcsstr(name, L"cygwin-")) 92 | || !wcsstr(name, L"-pty")) { 93 | rc = 1; 94 | } else { 95 | rc = 0; 96 | } 97 | } 98 | } 99 | } 100 | 101 | CLibrary_NATIVE_EXIT(env, that, CLibrary_isatty_FUNC); 102 | return rc; 103 | } 104 | 105 | #else 106 | #if defined(HAVE_ISATTY) 107 | 108 | JNIEXPORT jint JNICALL CLibrary_NATIVE(isatty) 109 | (JNIEnv *env, jclass that, jint arg0) 110 | { 111 | jint rc = 0; 112 | CLibrary_NATIVE_ENTER(env, that, CLibrary_isatty_FUNC); 113 | rc = (jint)isatty(arg0); 114 | CLibrary_NATIVE_EXIT(env, that, CLibrary_isatty_FUNC); 115 | return rc; 116 | } 117 | 118 | #endif 119 | #endif 120 | -------------------------------------------------------------------------------- /src/main/native-package/src/jansi_ttyname.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2017, the original author(s). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | #include "jansi.h" 17 | #include "hawtjni.h" 18 | #include "jansi_structs.h" 19 | #include "jansi_stats.h" 20 | 21 | #define CLibrary_NATIVE(func) Java_org_fusesource_jansi_internal_CLibrary_##func 22 | 23 | #if defined(HAVE_TTYNAME) 24 | JNIEXPORT jstring JNICALL CLibrary_NATIVE(ttyname) 25 | (JNIEnv *env, jclass that, jint arg0) 26 | { 27 | jstring rc = 0; 28 | char s[256] = { 0 }; 29 | int r = 0; 30 | CLibrary_NATIVE_ENTER(env, that, CLibrary_ttyname_FUNC); 31 | r = ttyname_r(arg0, s, 256); 32 | if (!r) rc = (*env)->NewStringUTF(env,s); 33 | CLibrary_NATIVE_EXIT(env, that, CLibrary_ttyname_FUNC); 34 | return rc; 35 | } 36 | #endif 37 | -------------------------------------------------------------------------------- /src/main/native-package/src/windows/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2013-2017 the original author(s). 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # @author Mladen Turk 16 | # 17 | # 18 | # ==================================================================== 19 | # 20 | # Common params: 21 | # CPU Compile for specified CPU. Supported CPUs are: 22 | # X86 (Common x86 architecture) 23 | # X64 (AMD64/EMT64 architecture) 24 | # I64 (Intel IA64 architecture) 25 | # If not specified it will default to the 26 | # BUILD_CPU environment variable, failing that 27 | # It will default to the 28 | # PROCESSOR_ARCHITECTURE/ARCHITEW6432 environment variables 29 | # or failing that it will default to X86. 30 | # WINVER Compile for specified Windows version 31 | # WINNT for Windows 2000 and up(default) 32 | # WINXP for Windows XP and up 33 | # WIN2003 for Windows 2003 and up 34 | # VSITA for Windows Vista and up 35 | # Deprecated targets (may not even compile): 36 | # NT4 for Windows NT4 and up 37 | # WIN9X for Windows 95, 98 and Me 38 | # BUILD Build version 39 | # RETAIL or RELEASE (default) 40 | # DEBUG 41 | # UNICODE Build unicode version 42 | # If definded and not empty -D_UNICODE is added 43 | # to CFLAGS; -D_MBCS is added otherwise 44 | # Environment variables used: 45 | # EXTRA_CFLAGS Added to the common CFLAGS 46 | # EXTRA_CXXFLAGS Added to the common CXXFLAGS 47 | # EXTRA_LIBS Added to the common LIBS 48 | # EXTRA_LFLAGS Added to the common LFLAGS 49 | # EXTRA_RCFLAGS Added to the common RCFLAGS 50 | # 51 | # Compiler tools environment variables: 52 | # CC C compiler (defaults to cl.exe) 53 | # LINK Linker (defaults to link.exe) 54 | # RC Resource compiler (defaults to rc.exe) 55 | # MT Manifest toolkit (defaults to mt.exe) 56 | # 57 | # Originally contributed by Mladen Turk 58 | # 59 | # ==================================================================== 60 | # 61 | 62 | # C/C++ compiler 63 | !IF !DEFINED(CC) || "$(CC)" == "" 64 | CC = cl.exe 65 | !ENDIF 66 | # Linker 67 | !IF !DEFINED(LINK) || "$(LINK)" == "" 68 | LINK = link.exe 69 | !ENDIF 70 | # Resource Compiler 71 | !IF !DEFINED(RC) || "$(RC)" == "" 72 | RC = rc.exe 73 | !ENDIF 74 | # Manifest toolkit 75 | !IF !DEFINED(MT) || "$(MT)" == "" 76 | MT = mt.exe 77 | !ENDIF 78 | 79 | # Project Target 80 | TARGET = DLL 81 | UNICODE = 1 82 | PROJECT = jansi 83 | 84 | # If CPU is not defined, apply defaults 85 | !IF !DEFINED(CPU) || "$(CPU)" == "" 86 | # Set BUILD_CPU if it is not yet set 87 | !IF !DEFINED(BUILD_CPU) || "$(BUILD_CPU)" == "" 88 | !IF "$(PROCESSOR_ARCHITECTURE)" == "" 89 | !IF "$(PROCESSOR_ARCHITEW6432)" == "" 90 | # Default to x86, will be upcased later 91 | BUILD_CPU=x86 92 | !ELSE 93 | BUILD_CPU=$(PROCESSOR_ARCHITEW6432) 94 | !ENDIF 95 | !ELSE 96 | BUILD_CPU=$(PROCESSOR_ARCHITECTURE) 97 | !ENDIF 98 | !ENDIF 99 | # Check BUILD_CPU and reset value if necessary 100 | !IF "$(BUILD_CPU)" == "i386" || "$(BUILD_CPU)" == "x86" || "$(BUILD_CPU)" == "i686" 101 | CPU=X86 102 | !ENDIF 103 | !IF "$(BUILD_CPU)" == "amd64" || "$(BUILD_CPU)" == "x86_64" || "$(BUILD_CPU)" == "x64" 104 | CPU=X64 105 | !ENDIF 106 | !IF "$(BUILD_CPU)" == "ia64" || "$(BUILD_CPU)" == "i64" 107 | CPU=I64 108 | !ENDIF 109 | # did we manage to set CPU? 110 | !IF !DEFINED(CPU) || "$(CPU)" == "" 111 | !ERROR Unexpected value of BUILD_CPU: $(BUILD_CPU) or PROCESSOR_ARCHITECTURE=$(PROCESSOR_ARCHITECTURE) or PROCESSOR_ARCHITEW6432=$(PROCESSOR_ARCHITEW6432). 112 | !ENDIF 113 | !ENDIF 114 | 115 | !IF "$(CPU)" != "X86" 116 | !IF "$(CPU)" != "X64" 117 | !IF "$(CPU)" != "I64" 118 | !ERROR Must specify CPU environment variable (X86, X64, I64) $(CPU) 119 | !ENDIF 120 | !ENDIF 121 | !ENDIF 122 | 123 | !IF !DEFINED(WINVER) || "$(WINVER)" == "" 124 | WINVER=WINXP 125 | !ENDIF 126 | 127 | 128 | !IF "$(WINVER)" != "WINNT" 129 | !IF "$(WINVER)" != "WINXP" 130 | !IF "$(WINVER)" != "WIN2003" 131 | !IF "$(WINVER)" != "VISTA" 132 | !IF "$(WINVER)" != "WIN7" 133 | !IF "$(WINVER)" != "WIN8" 134 | !ERROR Must specify WINVER environment variable (WINNT, WINXP, WIN2003, VISTA, WIN7, WIN8) 135 | !ENDIF 136 | !ENDIF 137 | !ENDIF 138 | !ENDIF 139 | !ENDIF 140 | !ENDIF 141 | 142 | !IF "$(WINVER)" == "WINNT" 143 | NMAKE_WINVER = 0x0500 144 | _WIN32_IE = 0x0500 145 | !ELSEIF "$(WINVER)" == "WINXP" 146 | NMAKE_WINVER = 0x0501 147 | _WIN32_IE = 0x0600 148 | !ELSEIF "$(WINVER)" == "WIN2003" 149 | NMAKE_WINVER = 0x0502 150 | _WIN32_IE = 0x0600 151 | !ELSEIF "$(WINVER)" == "VISTA" 152 | NMAKE_WINVER = 0x0600 153 | _WIN32_IE = 0x0700 154 | !ELSEIF "$(WINVER)" == "WIN7" 155 | NMAKE_WINVER = 0x0700 156 | _WIN32_IE = 0x0800 157 | !ELSEIF "$(WINVER)" == "WIN8" 158 | NMAKE_WINVER = 0x0800 159 | _WIN32_IE = 0x0900 160 | !ELSE 161 | !ERROR Must specify WINVER environment variable (WINNT, WINXP, WIN2003, VISTA, WIN7, WIN8) 162 | !ENDIF 163 | 164 | NMAKE_WINNT = -D_WINNT -D_WIN32_WINNT=$(NMAKE_WINVER) -DWINVER=$(NMAKE_WINVER) -D_WIN32_IE=$(_WIN32_IE) 165 | 166 | !IF !DEFINED(BUILD) || "$(BUILD)" == "" 167 | BUILD=RELEASE 168 | !ENDIF 169 | !IFDEF RELEASE 170 | BUILD=RELEASE 171 | !ENDIF 172 | !IFDEF DEBUG 173 | BUILD=DEBUG 174 | !ENDIF 175 | !IFDEF NODEBUG 176 | BUILD=RELEASE 177 | !ENDIF 178 | 179 | !IF "$(BUILD)" != "RELEASE" 180 | !IF "$(BUILD)" != "DEBUG" 181 | !ERROR Must specify BUILD environment variable (RELEASE, DEBUG) 182 | !ENDIF 183 | !ENDIF 184 | 185 | # Common flags for all platforms 186 | CMN_CFLAGS = -c -nologo -DWIN32 -D_WIN32 -D_WINDOWS $(NMAKE_WINNT) -W3 187 | !IF "$(TARGET)" == "EXE" 188 | CMN_CFLAGS = $(CMN_CFLAGS) -D_CONSOLE 189 | !ENDIF 190 | # Mark that extern C newer throws C++ exception 191 | CMN_CFLAGS = $(CMN_CFLAGS) -EHsc 192 | 193 | !IF !DEFINED(UNICODE) || "$(UNICODE)" == "" 194 | CMN_CFLAGS = $(CMN_CFLAGS) -D_MBCS -DMBCS 195 | !ELSE 196 | CMN_CFLAGS = $(CMN_CFLAGS) -D_UNICODE -DUNICODE 197 | !ENDIF 198 | 199 | !IF "$(CPU)" == "X86" 200 | CPU_CFLAGS = -D_X86_=1 201 | MACHINE=X86 202 | MACHINE_LC=i386 203 | !ELSEIF "$(CPU)" == "X64" 204 | CPU_CFLAGS = -D_AMD64_=1 -DWIN64 -D_WIN64 205 | MACHINE=AMD64 206 | MACHINE_LC=amd64 207 | !ELSEIF "$(CPU)" == "I64" 208 | CPU_CFLAGS = -D_IA64_=1 -DWIN64 -D_WIN64 209 | MACHINE=IA64 210 | MACHINE_LC=ia64 211 | !ENDIF 212 | 213 | !IF "$(BUILD)" == "RELEASE" 214 | !IF "$(CPU)" == "X86" 215 | OPT_CFLAGS = -O2 -Ob2 -Oy- -Zi -DNDEBUG 216 | !ELSE 217 | OPT_CFLAGS = -O2 -Ob2 -Zi -DNDEBUG 218 | !ENDIF 219 | !ELSE 220 | OPT_CFLAGS = -Od -Zi -DDEBUG -D_DEBUG 221 | !ENDIF 222 | 223 | !IF DEFINED(STATIC_CRT) 224 | CRT_CFLAGS = -D_MT -MT 225 | !ELSE 226 | CRT_CFLAGS = -D_MT -MD 227 | !ENDIF 228 | 229 | !IF "$(BUILD)" == "DEBUG" 230 | CRT_CFLAGS = $(CRT_CFLAGS)d 231 | !ENDIF 232 | 233 | CFLAGS = $(CMN_CFLAGS) $(CPU_CFLAGS) $(OPT_CFLAGS) $(CRT_CFLAGS) 234 | 235 | !IF DEFINED(EXTRA_CFLAGS) 236 | CFLAGS = $(CFLAGS) $(EXTRA_CFLAGS) 237 | !ENDIF 238 | 239 | # Cleanup CXXFLAGS 240 | CXXFLAGS = 241 | !IF DEFINED(EXTRA_CXXFLAGS) 242 | CXXFLAGS = $(EXTRA_CXXFLAGS) 243 | !ENDIF 244 | 245 | # Linker section 246 | LIBS = kernel32.lib 247 | # Extra libs from command line or env 248 | !IF DEFINED(EXTRA_LIBS) 249 | LIBS = $(LIBS) $(EXTRA_LIBS) 250 | !ENDIF 251 | 252 | # Run-Time Error Checks 253 | !IF "$(BUILD)" == "DEBUG" 254 | !IF DEFINED(RTC_CHECK) 255 | LIBS = $(LIBS) RunTmChk.lib 256 | CFLAGS = $(CFLAGS) -RTC1 257 | !ENDIF 258 | !ENDIF 259 | 260 | # Always add debugging to the linker 261 | OPT_LFLAGS = /INCREMENTAL:NO /DEBUG 262 | !IF "$(BUILD)" == "RELEASE" 263 | OPT_LFLAGS = /OPT:REF 264 | !ENDIF 265 | 266 | LFLAGS = /NOLOGO /DLL /SUBSYSTEM:WINDOWS /MACHINE:$(MACHINE) 267 | 268 | !IF DEFINED(EXTRA_LFLAGS) 269 | LFLAGS = $(LFLAGS) $(EXTRA_LFLAGS) 270 | !ENDIF 271 | 272 | !IF "$(TARGET)" != "LIB" 273 | LFLAGS = $(LFLAGS) $(OPT_LFLAGS) 274 | !ENDIF 275 | 276 | # Resource compiler flags 277 | 278 | RCFLAGS=/l 0x409 279 | !IF "$(BUILD)" == "RELEASE" 280 | RCFLAGS = $(RCFLAGS) /d "NDEBUG" 281 | !ELSE 282 | RCFLAGS = $(RCFLAGS) /d "_DEBUG" /d "DEBUG" 283 | !ENDIF 284 | RCFLAGS = $(RCFLAGS) 285 | !IF DEFINED(EXTRA_RCFLAGS) 286 | RCFLAGS = $(RCFLAGS) $(EXTRA_RCFLAGS) 287 | !ENDIF 288 | 289 | 290 | # Build Target dir e.g. WINNT_I386_RELEASE_DLL 291 | !IF !DEFINED(WORKDIR) || "$(WORKDIR)" == "" 292 | !IF !DEFINED(WORKDIR_EXT) || "$(WORKDIR_EXT)" == "" 293 | WORKDIR = $(WINVER)_$(CPU)_$(TARGET)_$(BUILD) 294 | WORKDIR_DLL = $(WINVER)_$(CPU)_DLL_$(BUILD) 295 | !ELSE 296 | WORKDIR = $(WINVER)_$(CPU)_$(BUILDIR_EXT)_$(BUILD) 297 | !ENDIF 298 | !ENDIF 299 | 300 | CLEANTARGET=if exist "$(WORKDIR)\$(NULL)" rd /s /q $(WORKDIR) 301 | MAKEWORKDIR=if not exist "$(WORKDIR)\$(NULL)" mkdir $(WORKDIR) 302 | MAKEINSTALL=if not exist "$(INSTALLLOC)\$(NULL)" mkdir $(INSTALLLOC) 303 | 304 | !IF DEFINED(JAVA_HOME) && "$(JAVA_HOME)" != "" 305 | JAVA_INCLUDES=-I "$(JAVA_HOME)\include" -I "$(JAVA_HOME)\include\win32" 306 | !ENDIF 307 | 308 | !IF !DEFINED(SRCDIR) || "$(SRCDIR)" == "" 309 | SRCDIR = .\..\.. 310 | !ENDIF 311 | !IF !DEFINED(PREFIX) || "$(PREFIX)" == "" 312 | PREFIX = .\..\..\target 313 | !ENDIF 314 | 315 | # 316 | # ==================================================================== 317 | # 318 | 319 | INCLUDES = -I$(SRCDIR)\src\windows -I$(SRCDIR)\src $(JAVA_INCLUDES) 320 | 321 | PDBFLAGS = -Fo$(WORKDIR)\ -Fd$(WORKDIR)\$(PROJECT)-src 322 | OBJECTS = \ 323 | $(WORKDIR)\hawtjni.obj \ 324 | $(WORKDIR)\jansi.obj \ 325 | $(WORKDIR)\jansi_isatty.obj \ 326 | $(WORKDIR)\jansi_ttyname.obj \ 327 | $(WORKDIR)\jansi_stats.obj \ 328 | $(WORKDIR)\jansi_structs.obj 329 | 330 | BUILDDLL = $(WORKDIR)\$(PROJECT).dll 331 | !IF "$(CPU)" == "X64" 332 | BUILDLOC = $(PREFIX)\x64 333 | !ELSEIF "$(CPU)" == "I64" 334 | BUILDLOC = $(PREFIX)\i64 335 | !ELSE 336 | BUILDLOC = $(PREFIX)\x86 337 | !ENDIF 338 | BUILDPDB = $(WORKDIR)\$(PROJECT).pdb 339 | BUILDRES = $(WORKDIR)\$(PROJECT).res 340 | BUILDMAN = $(BUILDDLL).manifest 341 | 342 | all : $(WORKDIR) $(BUILDDLL) 343 | 344 | $(BUILDLOC) : 345 | @if not exist "$(BUILDLOC)\$(NULL)" mkdir "$(BUILDLOC)" 346 | 347 | $(WORKDIR) : 348 | @$(MAKEWORKDIR) 349 | 350 | {$(SRCDIR)\src}.c{$(WORKDIR)}.obj: 351 | $(CC) $(CFLAGS) $(INCLUDES) $(PDBFLAGS) $< 352 | 353 | $(BUILDRES): $(SRCDIR)/src/windows/jansi.rc 354 | $(RC) $(RCFLAGS) /i "$(SRCDIR)\src" /i "$(SRCDIR)\src\windows" /fo $(BUILDRES) $(SRCDIR)/src/windows/jansi.rc 355 | 356 | $(BUILDDLL): $(WORKDIR) $(OBJECTS) $(BUILDRES) 357 | $(LINK) $(LFLAGS) $(OBJECTS) $(BUILDRES) $(LIBS) $(LDIRS) /pdb:$(BUILDPDB) /out:$(BUILDDLL) 358 | IF EXIST $(BUILDMAN) \ 359 | $(MT) -nologo -manifest $(BUILDMAN) -outputresource:$(BUILDDLL);2 360 | 361 | clean: 362 | @$(CLEANTARGET) 363 | 364 | install: $(BUILDLOC) $(WORKDIR) $(BUILDDLL) 365 | @xcopy "$(WORKDIR)\*.dll" "$(BUILDLOC)" /Y /Q 366 | -------------------------------------------------------------------------------- /src/main/native-package/src/windows/crtdll.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2009-2017 the original author(s). 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | 17 | #if defined(_WIN32) || defined(_WIN64) 18 | #include 19 | 20 | void __cdecl __security_init_cookie(void); 21 | 22 | BOOL WINAPI _DllMainCRTStartup(HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) 23 | { 24 | if (dwReason == DLL_PROCESS_ATTACH) 25 | __security_init_cookie(); 26 | 27 | return TRUE; 28 | } 29 | 30 | #endif /* defined(_WIN32) || defined(_WIN64) */ 31 | -------------------------------------------------------------------------------- /src/main/native-package/src/windows/jansi.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fusesource/jansi-native/8c923f2b59a7fbf599f3d4922e6fceca645e4610/src/main/native-package/src/windows/jansi.rc -------------------------------------------------------------------------------- /src/main/native-package/src/windows/msvcrt.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | 3 | ___lc_codepage_func 4 | ___lc_collate_cp_func 5 | ___lc_handle_func 6 | ___mb_cur_max_func 7 | ___setlc_active_func 8 | ___unguarded_readlc_active_add_func 9 | __argc 10 | __argv 11 | __badioinfo 12 | __CppXcptFilter 13 | __crtCompareStringA 14 | __crtCompareStringW 15 | __crtGetLocaleInfoW 16 | __crtGetStringTypeW 17 | __crtLCMapStringA 18 | __crtLCMapStringW 19 | __CxxFrameHandler 20 | __CxxFrameHandler2 21 | __CxxFrameHandler3 22 | __daylight 23 | __DestructExceptionObject 24 | __dllonexit 25 | __doserrno 26 | __dstbias 27 | __fpecode 28 | __getmainargs 29 | __initenv 30 | __iob_func 31 | __isascii 32 | __iscsym 33 | __iscsymf 34 | __lc_codepage 35 | __lc_collate_cp 36 | __lc_handle 37 | __lconv_init 38 | __mb_cur_max 39 | __pctype_func 40 | __pioinfo 41 | __pwctype_func 42 | __pxcptinfoptrs 43 | __RTCastToVoid 44 | __RTDynamicCast 45 | __RTtypeid 46 | __set_app_type 47 | __setlc_active 48 | __setusermatherr 49 | __STRINGTOLD 50 | __strncnt 51 | __threadhandle 52 | __threadid 53 | __toascii 54 | __uncaught_exception 55 | __unDName 56 | __unDNameEx 57 | __unguarded_readlc_active 58 | __wargv 59 | __wcserror 60 | __wcserror_s 61 | __wcsncnt 62 | __wgetmainargs 63 | __winitenv 64 | _abs64 65 | _access 66 | _access_s 67 | _acmdln 68 | _aexit_rtn 69 | _aligned_free 70 | _aligned_free_dbg 71 | _aligned_malloc 72 | _aligned_malloc_dbg 73 | _aligned_offset_malloc 74 | _aligned_offset_malloc_dbg 75 | _aligned_offset_realloc 76 | _aligned_offset_realloc_dbg 77 | _aligned_realloc 78 | _aligned_realloc_dbg 79 | _amsg_exit 80 | _assert 81 | _atodbl 82 | _atodbl_l 83 | _atof_l 84 | _atoflt_l 85 | _atoi_l 86 | _atoi64 87 | _atoi64_l 88 | _atol_l 89 | _atoldbl 90 | _atoldbl_l 91 | _beep 92 | _beginthread 93 | _beginthreadex 94 | _c_exit 95 | _cabs 96 | _callnewh 97 | _calloc_dbg 98 | _cexit 99 | _cgets 100 | _cgets_s 101 | _cgetws 102 | _cgetws_s 103 | _chdir 104 | _chdrive 105 | _chgsign 106 | _chmod 107 | _chsize 108 | _chsize_s 109 | _chvalidator 110 | _chvalidator_l 111 | _clearfp 112 | _close 113 | _commit 114 | _commode 115 | _control87 116 | _controlfp 117 | _controlfp_s 118 | _copysign 119 | _cprintf 120 | _cprintf_l 121 | _cprintf_p 122 | _cprintf_p_l 123 | _cprintf_s 124 | _cprintf_s_l 125 | _cputs 126 | _cputws 127 | _creat 128 | _crtAssertBusy 129 | _crtBreakAlloc 130 | _CrtCheckMemory 131 | _CrtDbgBreak 132 | _crtDbgFlag 133 | _CrtDbgReport 134 | _CrtDbgReportV 135 | _CrtDbgReportW 136 | _CrtDbgReportWV 137 | _CrtDoForAllClientObjects 138 | _CrtDumpMemoryLeaks 139 | _CrtIsMemoryBlock 140 | _CrtIsValidHeapPointer 141 | _CrtIsValidPointer 142 | _CrtMemCheckpoint 143 | _CrtMemDifference 144 | _CrtMemDumpAllObjectsSince 145 | _CrtMemDumpStatistics 146 | _CrtReportBlockType 147 | _CrtSetAllocHook 148 | _CrtSetBreakAlloc 149 | _CrtSetDbgBlockType 150 | _CrtSetDbgFlag 151 | _CrtSetDumpClient 152 | _CrtSetReportFile 153 | _CrtSetReportHook 154 | _CrtSetReportHook2 155 | _CrtSetReportMode 156 | _cscanf 157 | _cscanf_l 158 | _cscanf_s 159 | _cscanf_s_l 160 | _ctime32 161 | _ctime32_s 162 | _ctime64 163 | _ctime64_s 164 | _ctype 165 | _cwait 166 | _cwprintf 167 | _cwprintf_l 168 | _cwprintf_p 169 | _cwprintf_p_l 170 | _cwprintf_s 171 | _cwprintf_s_l 172 | _cwscanf 173 | _cwscanf_l 174 | _cwscanf_s 175 | _cwscanf_s_l 176 | _CxxThrowException 177 | _daylight 178 | _difftime32 179 | _difftime64 180 | _dstbias 181 | _dup 182 | _dup2 183 | _ecvt 184 | _ecvt_s 185 | _endthread 186 | _endthreadex 187 | _environ 188 | _eof 189 | _errno 190 | _execl 191 | _execle 192 | _execlp 193 | _execlpe 194 | _execv 195 | _execve 196 | _execvp 197 | _execvpe 198 | _exit 199 | _expand 200 | _expand_dbg 201 | _fcloseall 202 | _fcvt 203 | _fcvt_s 204 | _fdopen 205 | _fgetchar 206 | _fgetwchar 207 | _filbuf 208 | _fileinfo 209 | _filelength 210 | _filelengthi64 211 | _fileno 212 | _findclose 213 | _findfirst 214 | _findfirst64 215 | _findfirsti64 216 | _findnext 217 | _findnext64 218 | _findnexti64 219 | _finite 220 | _flsbuf 221 | _flushall 222 | _fmode 223 | _fpclass 224 | _fpreset 225 | _fprintf_l 226 | _fprintf_p 227 | _fprintf_p_l 228 | _fprintf_s_l 229 | _fputchar 230 | _fputwchar 231 | _free_dbg 232 | _freea 233 | _freea_s 234 | _fscanf_l 235 | _fscanf_s_l 236 | _fseeki64 237 | _fsopen 238 | _fstat 239 | _fstat64 240 | _fstati64 241 | _ftime 242 | _ftime32 243 | _ftime32_s 244 | _ftime64 245 | _ftime64_s 246 | _fullpath 247 | _fullpath_dbg 248 | _futime 249 | _futime32 250 | _futime64 251 | _fwprintf_l 252 | _fwprintf_p 253 | _fwprintf_p_l 254 | _fwprintf_s_l 255 | _fwscanf_l 256 | _fwscanf_s_l 257 | _gcvt 258 | _gcvt_s 259 | _get_doserrno 260 | _get_environ 261 | _get_errno 262 | _get_fileinfo 263 | _get_fmode 264 | _get_heap_handle 265 | _get_osfhandle 266 | _get_osplatform 267 | _get_osver 268 | _get_output_format 269 | _get_pgmptr 270 | _get_sbh_threshold 271 | _get_wenviron 272 | _get_winmajor 273 | _get_winminor 274 | _get_winver 275 | _get_wpgmptr 276 | _getch 277 | _getche 278 | _getcwd 279 | _Getdays 280 | _getdcwd 281 | _getdiskfree 282 | _getdrive 283 | _getdrives 284 | _getmaxstdio 285 | _getmbcp 286 | _Getmonths 287 | _getpid 288 | _getsystime 289 | _Gettnames 290 | _getw 291 | _getwch 292 | _getwche 293 | _getws 294 | _gmtime32 295 | _gmtime32_s 296 | _gmtime64 297 | _gmtime64_s 298 | _heapchk 299 | _heapmin 300 | _heapset 301 | _heapwalk 302 | _HUGE 303 | _hypot 304 | _i64toa 305 | _i64toa_s 306 | _i64tow 307 | _i64tow_s 308 | _initterm 309 | _initterm_e 310 | _invalid_parameter 311 | _iob 312 | _isalnum_l 313 | _isalpha_l 314 | _isatty 315 | _iscntrl_l 316 | _isctype 317 | _isctype_l 318 | _isdigit_l 319 | _isgraph_l 320 | _isleadbyte_l 321 | _islower_l 322 | _ismbbalnum 323 | _ismbbalnum_l 324 | _ismbbalpha 325 | _ismbbalpha_l 326 | _ismbbgraph 327 | _ismbbgraph_l 328 | _ismbbkalnum 329 | _ismbbkalnum_l 330 | _ismbbkana 331 | _ismbbkana_l 332 | _ismbbkprint 333 | _ismbbkprint_l 334 | _ismbbkpunct 335 | _ismbbkpunct_l 336 | _ismbblead 337 | _ismbblead_l 338 | _ismbbprint 339 | _ismbbprint_l 340 | _ismbbpunct 341 | _ismbbpunct_l 342 | _ismbbtrail 343 | _ismbbtrail_l 344 | _ismbcalnum 345 | _ismbcalnum_l 346 | _ismbcalpha 347 | _ismbcalpha_l 348 | _ismbcdigit 349 | _ismbcdigit_l 350 | _ismbcgraph 351 | _ismbcgraph_l 352 | _ismbchira 353 | _ismbchira_l 354 | _ismbckata 355 | _ismbckata_l 356 | _ismbcl0 357 | _ismbcl0_l 358 | _ismbcl1 359 | _ismbcl1_l 360 | _ismbcl2 361 | _ismbcl2_l 362 | _ismbclegal 363 | _ismbclegal_l 364 | _ismbclower 365 | _ismbclower_l 366 | _ismbcprint 367 | _ismbcprint_l 368 | _ismbcpunct 369 | _ismbcpunct_l 370 | _ismbcspace 371 | _ismbcspace_l 372 | _ismbcsymbol 373 | _ismbcsymbol_l 374 | _ismbcupper 375 | _ismbcupper_l 376 | _ismbslead 377 | _ismbslead_l 378 | _ismbstrail 379 | _ismbstrail_l 380 | _isnan 381 | _isprint_l 382 | _isspace_l 383 | _isupper_l 384 | _iswalnum_l 385 | _iswalpha_l 386 | _iswcntrl_l 387 | _iswctype_l 388 | _iswdigit_l 389 | _iswgraph_l 390 | _iswlower_l 391 | _iswprint_l 392 | _iswpunct_l 393 | _iswspace_l 394 | _iswupper_l 395 | _iswxdigit_l 396 | _isxdigit_l 397 | _itoa 398 | _itoa_s 399 | _itow 400 | _itow_s 401 | _j0 402 | _j1 403 | _jn 404 | _kbhit 405 | _lfind 406 | _lfind_s 407 | _localtime32 408 | _localtime32_s 409 | _localtime64 410 | _localtime64_s 411 | _lock 412 | _locking 413 | _logb 414 | _lrotl 415 | _lrotr 416 | _lsearch 417 | _lsearch_s 418 | _lseek 419 | _lseeki64 420 | _ltoa 421 | _ltoa_s 422 | _ltow 423 | _ltow_s 424 | _makepath 425 | _makepath_s 426 | _malloc_dbg 427 | _mbbtombc 428 | _mbbtombc_l 429 | _mbbtype 430 | _mbcasemap 431 | _mbccpy 432 | _mbccpy_l 433 | _mbccpy_s 434 | _mbccpy_s_l 435 | _mbcjistojms 436 | _mbcjistojms_l 437 | _mbcjmstojis 438 | _mbcjmstojis_l 439 | _mbclen 440 | _mbclen_l 441 | _mbctohira 442 | _mbctohira_l 443 | _mbctokata 444 | _mbctokata_l 445 | _mbctolower 446 | _mbctolower_l 447 | _mbctombb 448 | _mbctombb_l 449 | _mbctoupper 450 | _mbctoupper_l 451 | _mbctype 452 | _mblen_l 453 | _mbsbtype 454 | _mbsbtype_l 455 | _mbscat 456 | _mbscat_s 457 | _mbscat_s_l 458 | _mbschr 459 | _mbschr_l 460 | _mbscmp 461 | _mbscmp_l 462 | _mbscoll 463 | _mbscoll_l 464 | _mbscpy 465 | _mbscpy_s 466 | _mbscpy_s_l 467 | _mbscspn 468 | _mbscspn_l 469 | _mbsdec 470 | _mbsdec_l 471 | _mbsdup 472 | _mbsicmp 473 | _mbsicmp_l 474 | _mbsicoll 475 | _mbsicoll_l 476 | _mbsinc 477 | _mbsinc_l 478 | _mbslen 479 | _mbslen_l 480 | _mbslwr 481 | _mbslwr_l 482 | _mbslwr_s 483 | _mbslwr_s_l 484 | _mbsnbcat 485 | _mbsnbcat_l 486 | _mbsnbcat_s 487 | _mbsnbcat_s_l 488 | _mbsnbcmp 489 | _mbsnbcmp_l 490 | _mbsnbcnt 491 | _mbsnbcnt_l 492 | _mbsnbcoll 493 | _mbsnbcoll_l 494 | _mbsnbcpy 495 | _mbsnbcpy_l 496 | _mbsnbcpy_s 497 | _mbsnbcpy_s_l 498 | _mbsnbicmp 499 | _mbsnbicmp_l 500 | _mbsnbicoll 501 | _mbsnbicoll_l 502 | _mbsnbset 503 | _mbsnbset_l 504 | _mbsnbset_s 505 | _mbsnbset_s_l 506 | _mbsncat 507 | _mbsncat_l 508 | _mbsncat_s 509 | _mbsncat_s_l 510 | _mbsnccnt 511 | _mbsnccnt_l 512 | _mbsncmp 513 | _mbsncmp_l 514 | _mbsncoll 515 | _mbsncoll_l 516 | _mbsncpy 517 | _mbsncpy_l 518 | _mbsncpy_s 519 | _mbsncpy_s_l 520 | _mbsnextc 521 | _mbsnextc_l 522 | _mbsnicmp 523 | _mbsnicmp_l 524 | _mbsnicoll 525 | _mbsnicoll_l 526 | _mbsninc 527 | _mbsninc_l 528 | _mbsnlen 529 | _mbsnlen_l 530 | _mbsnset 531 | _mbsnset_l 532 | _mbsnset_s 533 | _mbsnset_s_l 534 | _mbspbrk 535 | _mbspbrk_l 536 | _mbsrchr 537 | _mbsrchr_l 538 | _mbsrev 539 | _mbsrev_l 540 | _mbsset 541 | _mbsset_l 542 | _mbsset_s 543 | _mbsset_s_l 544 | _mbsspn 545 | _mbsspn_l 546 | _mbsspnp 547 | _mbsspnp_l 548 | _mbsstr 549 | _mbsstr_l 550 | _mbstok 551 | _mbstok_l 552 | _mbstok_s 553 | _mbstok_s_l 554 | _mbstowcs_l 555 | _mbstowcs_s_l 556 | _mbstrlen 557 | _mbstrlen_l 558 | _mbstrnlen 559 | _mbstrnlen_l 560 | _mbsupr 561 | _mbsupr_l 562 | _mbsupr_s 563 | _mbsupr_s_l 564 | _mbtowc_l 565 | _memccpy 566 | _memicmp 567 | _memicmp_l 568 | _mkdir 569 | _mkgmtime 570 | _mkgmtime32 571 | _mkgmtime64 572 | _mktemp 573 | _mktemp_s 574 | _mktime32 575 | _mktime64 576 | _msize 577 | _nextafter 578 | _onexit 579 | _open 580 | _open_osfhandle 581 | _osplatform 582 | _osver 583 | _pclose 584 | _pctype 585 | _pgmptr 586 | _pipe 587 | _popen 588 | _printf_l 589 | _printf_p 590 | _printf_p_l 591 | _printf_s_l 592 | _purecall 593 | _putch 594 | _putenv 595 | _putenv_s 596 | _putw 597 | _putwch 598 | _putws 599 | _pwctype 600 | _read 601 | _realloc_dbg 602 | _resetstkoflw 603 | _rmdir 604 | _rmtmp 605 | _rotl 606 | _rotl64 607 | _rotr 608 | _rotr64 609 | _scalb 610 | _scanf_l 611 | _scanf_s_l 612 | _scprintf 613 | _scprintf_l 614 | _scprintf_p_l 615 | _scwprintf 616 | _scwprintf_l 617 | _scwprintf_p_l 618 | _searchenv 619 | _searchenv_s 620 | _set_controlfp 621 | _set_doserrno 622 | _set_errno 623 | _set_error_mode 624 | _set_fileinfo 625 | _set_fmode 626 | _set_output_format 627 | _set_sbh_threshold 628 | _seterrormode 629 | _setjmp 630 | _setmaxstdio 631 | _setmbcp 632 | _setmode 633 | _setsystime 634 | _sleep 635 | _snprintf 636 | _snprintf_c 637 | _snprintf_c_l 638 | _snprintf_l 639 | _snprintf_s 640 | _snprintf_s_l 641 | _snscanf 642 | _snscanf_l 643 | _snscanf_s 644 | _snscanf_s_l 645 | _snwprintf 646 | _snwprintf_l 647 | _snwprintf_s 648 | _snwprintf_s_l 649 | _snwscanf 650 | _snwscanf_l 651 | _snwscanf_s 652 | _snwscanf_s_l 653 | _sopen 654 | _sopen_s 655 | _spawnl 656 | _spawnle 657 | _spawnlp 658 | _spawnlpe 659 | _spawnv 660 | _spawnve 661 | _spawnvp 662 | _spawnvpe 663 | _splitpath 664 | _splitpath_s 665 | _sprintf_l 666 | _sprintf_p_l 667 | _sprintf_s_l 668 | _sscanf_l 669 | _sscanf_s_l 670 | _stat 671 | _stat64 672 | _stati64 673 | _statusfp 674 | _strcmpi 675 | _strcoll_l 676 | _strdate 677 | _strdate_s 678 | _strdup 679 | _strdup_dbg 680 | _strerror 681 | _strerror_s 682 | _Strftime 683 | _stricmp 684 | _stricmp_l 685 | _stricoll 686 | _stricoll_l 687 | _strlwr 688 | _strlwr_l 689 | _strlwr_s 690 | _strlwr_s_l 691 | _strncoll 692 | _strncoll_l 693 | _strnicmp 694 | _strnicmp_l 695 | _strnicoll 696 | _strnicoll_l 697 | _strnset 698 | _strnset_s 699 | _strrev 700 | _strset 701 | _strset_s 702 | _strtime 703 | _strtime_s 704 | _strtod_l 705 | _strtoi64 706 | _strtoi64_l 707 | _strtol_l 708 | _strtoui64 709 | _strtoui64_l 710 | _strtoul_l 711 | _strupr 712 | _strupr_l 713 | _strupr_s 714 | _strupr_s_l 715 | _strxfrm_l 716 | _swab 717 | _swprintf 718 | _swprintf_c 719 | _swprintf_c_l 720 | _swprintf_p_l 721 | _swprintf_s_l 722 | _swscanf_l 723 | _swscanf_s_l 724 | _sys_errlist 725 | _sys_nerr 726 | _tell 727 | _telli64 728 | _tempnam 729 | _tempnam_dbg 730 | _time32 731 | _time64 732 | _timezone 733 | _tolower 734 | _tolower_l 735 | _toupper 736 | _toupper_l 737 | _towlower_l 738 | _towupper_l 739 | _tzname 740 | _tzset 741 | _ui64toa 742 | _ui64toa_s 743 | _ui64tow 744 | _ui64tow_s 745 | _ultoa 746 | _ultoa_s 747 | _ultow 748 | _ultow_s 749 | _umask 750 | _umask_s 751 | _ungetch 752 | _ungetwch 753 | _unlink 754 | _unlock 755 | _utime 756 | _utime32 757 | _utime64 758 | _vcprintf 759 | _vcprintf_l 760 | _vcprintf_p 761 | _vcprintf_p_l 762 | _vcprintf_s 763 | _vcprintf_s_l 764 | _vcwprintf 765 | _vcwprintf_l 766 | _vcwprintf_p 767 | _vcwprintf_p_l 768 | _vcwprintf_s 769 | _vcwprintf_s_l 770 | _vfprintf_l 771 | _vfprintf_p 772 | _vfprintf_p_l 773 | _vfprintf_s_l 774 | _vfwprintf_l 775 | _vfwprintf_p 776 | _vfwprintf_p_l 777 | _vfwprintf_s_l 778 | _vprintf_l 779 | _vprintf_p 780 | _vprintf_p_l 781 | _vprintf_s_l 782 | _vscprintf 783 | _vscprintf_l 784 | _vscprintf_p_l 785 | _vscwprintf 786 | _vscwprintf_l 787 | _vscwprintf_p_l 788 | _vsnprintf 789 | _vsnprintf_c 790 | _vsnprintf_c_l 791 | _vsnprintf_l 792 | _vsnprintf_s 793 | _vsnprintf_s_l 794 | _vsnwprintf 795 | _vsnwprintf_l 796 | _vsnwprintf_s 797 | _vsnwprintf_s_l 798 | _vsprintf_l 799 | _vsprintf_p 800 | _vsprintf_p_l 801 | _vsprintf_s_l 802 | _vswprintf 803 | _vswprintf_c 804 | _vswprintf_c_l 805 | _vswprintf_l 806 | _vswprintf_p_l 807 | _vswprintf_s_l 808 | _vwprintf_l 809 | _vwprintf_p 810 | _vwprintf_p_l 811 | _vwprintf_s_l 812 | _waccess 813 | _waccess_s 814 | _wasctime 815 | _wasctime_s 816 | _wassert 817 | _wchdir 818 | _wchmod 819 | _wcmdln 820 | _wcreat 821 | _wcscoll_l 822 | _wcsdup 823 | _wcsdup_dbg 824 | _wcserror 825 | _wcserror_s 826 | _wcsftime_l 827 | _wcsicmp 828 | _wcsicmp_l 829 | _wcsicoll 830 | _wcsicoll_l 831 | _wcslwr 832 | _wcslwr_l 833 | _wcslwr_s 834 | _wcslwr_s_l 835 | _wcsncoll 836 | _wcsncoll_l 837 | _wcsnicmp 838 | _wcsnicmp_l 839 | _wcsnicoll 840 | _wcsnicoll_l 841 | _wcsnset 842 | _wcsnset_s 843 | _wcsrev 844 | _wcsset 845 | _wcsset_s 846 | _wcstoi64 847 | _wcstoi64_l 848 | _wcstol_l 849 | _wcstombs_l 850 | _wcstombs_s_l 851 | _wcstoui64 852 | _wcstoui64_l 853 | _wcstoul_l 854 | _wcsupr 855 | _wcsupr_l 856 | _wcsupr_s 857 | _wcsupr_s_l 858 | _wcsxfrm_l 859 | _wctime 860 | _wctime32 861 | _wctime32_s 862 | _wctime64 863 | _wctime64_s 864 | _wctomb_l 865 | _wctomb_s_l 866 | _wctype 867 | _wenviron 868 | _wexecl 869 | _wexecle 870 | _wexeclp 871 | _wexeclpe 872 | _wexecv 873 | _wexecve 874 | _wexecvp 875 | _wexecvpe 876 | _wfdopen 877 | _wfindfirst 878 | _wfindfirst64 879 | _wfindfirsti64 880 | _wfindnext 881 | _wfindnext64 882 | _wfindnexti64 883 | _wfopen 884 | _wfopen_s 885 | _wfreopen 886 | _wfreopen_s 887 | _wfsopen 888 | _wfullpath 889 | _wfullpath_dbg 890 | _wgetcwd 891 | _wgetdcwd 892 | _wgetenv 893 | _wgetenv_s 894 | _winmajor 895 | _winminor 896 | _winput_s 897 | _winver 898 | _wmakepath 899 | _wmakepath_s 900 | _wmkdir 901 | _wmktemp 902 | _wmktemp_s 903 | _wopen 904 | _woutput_s 905 | _wperror 906 | _wpgmptr 907 | _wpopen 908 | _wprintf_l 909 | _wprintf_p 910 | _wprintf_p_l 911 | _wprintf_s_l 912 | _wputenv 913 | _wputenv_s 914 | _wremove 915 | _wrename 916 | _write 917 | _wrmdir 918 | _wscanf_l 919 | _wscanf_s_l 920 | _wsearchenv 921 | _wsearchenv_s 922 | _wsetlocale 923 | _wsopen 924 | _wsopen_s 925 | _wspawnl 926 | _wspawnle 927 | _wspawnlp 928 | _wspawnlpe 929 | _wspawnv 930 | _wspawnve 931 | _wspawnvp 932 | _wspawnvpe 933 | _wsplitpath 934 | _wsplitpath_s 935 | _wstat 936 | _wstat64 937 | _wstati64 938 | _wstrdate 939 | _wstrdate_s 940 | _wstrtime 941 | _wstrtime_s 942 | _wsystem 943 | _wtempnam 944 | _wtempnam_dbg 945 | _wtmpnam 946 | _wtmpnam_s 947 | _wtof 948 | _wtof_l 949 | _wtoi 950 | _wtoi_l 951 | _wtoi64 952 | _wtoi64_l 953 | _wtol 954 | _wtol_l 955 | _wunlink 956 | _wutime 957 | _wutime32 958 | _wutime64 959 | _XcptFilter 960 | _y0 961 | _y1 962 | _yn 963 | abort 964 | abs 965 | acos 966 | asctime 967 | asctime_s 968 | asin 969 | atan 970 | atan2 971 | atexit 972 | atof 973 | atoi 974 | atol 975 | bsearch 976 | bsearch_s 977 | btowc 978 | calloc 979 | ceil 980 | clearerr 981 | clearerr_s 982 | clock 983 | cos 984 | cosh 985 | ctime 986 | difftime 987 | div 988 | exit 989 | exp 990 | fabs 991 | fclose 992 | feof 993 | ferror 994 | fflush 995 | fgetc 996 | fgetpos 997 | fgets 998 | fgetwc 999 | fgetws 1000 | floor 1001 | fmod 1002 | fopen 1003 | fopen_s 1004 | fprintf 1005 | fprintf_s 1006 | fputc 1007 | fputs 1008 | fputwc 1009 | fputws 1010 | fread 1011 | free 1012 | freopen 1013 | freopen_s 1014 | frexp 1015 | fscanf 1016 | fscanf_s 1017 | fseek 1018 | fsetpos 1019 | ftell 1020 | fwprintf 1021 | fwprintf_s 1022 | fwrite 1023 | fwscanf 1024 | fwscanf_s 1025 | getc 1026 | getchar 1027 | getenv 1028 | getenv_s 1029 | gets 1030 | getwc 1031 | getwchar 1032 | gmtime 1033 | is_wctype 1034 | isalnum 1035 | isalpha 1036 | iscntrl 1037 | isdigit 1038 | isgraph 1039 | isleadbyte 1040 | islower 1041 | isprint 1042 | ispunct 1043 | isspace 1044 | isupper 1045 | iswalnum 1046 | iswalpha 1047 | iswascii 1048 | iswcntrl 1049 | iswctype 1050 | iswdigit 1051 | iswgraph 1052 | iswlower 1053 | iswprint 1054 | iswpunct 1055 | iswspace 1056 | iswupper 1057 | iswxdigit 1058 | isxdigit 1059 | labs 1060 | ldexp 1061 | ldiv 1062 | localeconv 1063 | localtime 1064 | log 1065 | log10 1066 | longjmp 1067 | malloc 1068 | mblen 1069 | mbrlen 1070 | mbrtowc 1071 | mbsdup_dbg 1072 | mbsrtowcs 1073 | mbsrtowcs_s 1074 | mbstowcs 1075 | mbstowcs_s 1076 | mbtowc 1077 | memchr 1078 | memcmp 1079 | memcpy 1080 | memcpy_s 1081 | memmove 1082 | memmove_s 1083 | memset 1084 | mktime 1085 | modf 1086 | perror 1087 | pow 1088 | printf 1089 | printf_s 1090 | putc 1091 | putchar 1092 | puts 1093 | putwc 1094 | putwchar 1095 | qsort 1096 | qsort_s 1097 | raise 1098 | rand 1099 | rand_s 1100 | realloc 1101 | remove 1102 | rename 1103 | rewind 1104 | scanf 1105 | scanf_s 1106 | setbuf 1107 | setlocale 1108 | setvbuf 1109 | signal 1110 | sin 1111 | sinh 1112 | sprintf 1113 | sprintf_s 1114 | sqrt 1115 | srand 1116 | sscanf 1117 | sscanf_s 1118 | strcat 1119 | strcat_s 1120 | strchr 1121 | strcmp 1122 | strcoll 1123 | strcpy 1124 | strcpy_s 1125 | strcspn 1126 | strerror 1127 | strerror_s 1128 | strftime 1129 | strlen 1130 | strncat 1131 | strncat_s 1132 | strncmp 1133 | strncpy 1134 | strncpy_s 1135 | strnlen 1136 | strpbrk 1137 | strrchr 1138 | strspn 1139 | strstr 1140 | strtod 1141 | strtok 1142 | strtok_s 1143 | strtol 1144 | strtoul 1145 | strxfrm 1146 | swprintf 1147 | swprintf_s 1148 | swscanf 1149 | swscanf_s 1150 | system 1151 | tan 1152 | tanh 1153 | time 1154 | tmpfile 1155 | tmpfile_s 1156 | tmpnam 1157 | tmpnam_s 1158 | tolower 1159 | toupper 1160 | towlower 1161 | towupper 1162 | ungetc 1163 | ungetwc 1164 | utime 1165 | vfprintf 1166 | vfprintf_s 1167 | vfwprintf 1168 | vfwprintf_s 1169 | vprintf 1170 | vprintf_s 1171 | vsnprintf 1172 | vsprintf 1173 | vsprintf_s 1174 | vswprintf 1175 | vswprintf_s 1176 | vwprintf 1177 | vwprintf_s 1178 | wcrtomb 1179 | wcrtomb_s 1180 | wcscat 1181 | wcscat_s 1182 | wcschr 1183 | wcscmp 1184 | wcscoll 1185 | wcscpy 1186 | wcscpy_s 1187 | wcscspn 1188 | wcsftime 1189 | wcslen 1190 | wcsncat 1191 | wcsncat_s 1192 | wcsncmp 1193 | wcsncpy 1194 | wcsncpy_s 1195 | wcsnlen 1196 | wcspbrk 1197 | wcsrchr 1198 | wcsrtombs 1199 | wcsrtombs_s 1200 | wcsspn 1201 | wcsstr 1202 | wcstod 1203 | wcstok 1204 | wcstok_s 1205 | wcstol 1206 | wcstombs 1207 | wcstombs_s 1208 | wcstoul 1209 | wcsxfrm 1210 | wctob 1211 | wctomb 1212 | wctomb_s 1213 | wprintf 1214 | wprintf_s 1215 | wscanf 1216 | wscanf_s 1217 | -------------------------------------------------------------------------------- /src/main/native-package/src/windows/readme.txt: -------------------------------------------------------------------------------- 1 | Using the Windows msvcrt.dll 2 | ============================ 3 | 4 | See message thread for history: 5 | http://groups.google.com/group/jansi-dev/browse_thread/thread/e7867408d43660e1 6 | 7 | Benefits 8 | -------- 9 | No need for the VS redistributables. 10 | 11 | crtdll.c 12 | -------- 13 | 14 | A minimal entry point (_DllMainCRTStartup) 15 | The "official" _DllMainCRTStartup is way more complicated (and has more dependencies), 16 | but most of it is not needed if the thing is small, and plain C 17 | (so no exceptions and other fancy C++ stuff) 18 | 19 | msvcrt.lib 20 | ---------- 21 | The msvcrt.lib files (32/64 bit) are generated from the Win7 msvcrt.dll. 22 | The msvcrt.def file is generated once "by hand" and submited as part of the project 23 | The msvcrt.lib file is generated ad build time from msvcrt.def 24 | 25 | - dumpbin.exe /exports msvcrt.dll > msvcrt.dump 26 | - Created msvcrt.def from msvcrt.dump (just removed a bunch of extra info) 27 | - The msvcrt.def file in this project is an intersection of the 32/64 bit versions 28 | No problem, the excluded functions are really-really obscure. 29 | In fact, it is enough to list in msvcrt.def the few functions we use, and add more by hand as needed 30 | - Added as a custom build step lib /machine:X32 /def:msvcrt.def /out:msvcrt.lib 31 | (or /machine:X64, of course) 32 | 33 | vs2010.vcxproj 34 | -------------- 35 | - Sources: added crtdll.c 36 | - Sources: added msvcrt.def, with a custom build step that generates the .lib 37 | - Linker - General: added $(IntDir) as "Additional Library Directory" (for msvcrt.lib) 38 | - Linker - Input: "Ignore All Default Libraries" (/NODEFAULTLIB) 39 | - Linker - Input: removed user32.lib; ... ;odbccp32.lib, and added msvcrt.lib;RunTmChk.lib instead 40 | (RunTmChk.lib is in the VS lib folder, and needed for security_check_cookie) 41 | -------------------------------------------------------------------------------- /src/main/native-package/vs2010.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | debug 7 | Win32 8 | 9 | 10 | debug 11 | x64 12 | 13 | 14 | release 15 | Win32 16 | 17 | 18 | release 19 | x64 20 | 21 | 22 | 23 | jansi 24 | jansi 25 | $(ProjectDir)\target\$(Platform)-$(Configuration)\lib\ 26 | $(ProjectDir)\target\$(Platform)-$(Configuration)\obj\ 27 | false 28 | v140 29 | 30 | 31 | 32 | DynamicLibrary 33 | Unicode 34 | 35 | 36 | DynamicLibrary 37 | Unicode 38 | true 39 | 40 | 41 | DynamicLibrary 42 | Unicode 43 | 44 | 45 | DynamicLibrary 46 | Unicode 47 | true 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | <_ProjectFileVersion>10.0.30319.1 67 | $(ProjectDir)/target/$(Platform)-$(Configuration)/lib\ 68 | $(ProjectDir)/target/$(Platform)-$(Configuration)/obj\ 69 | false 70 | $(ProjectDir)/target/$(Platform)-$(Configuration)/lib\ 71 | $(ProjectDir)/target/$(Platform)-$(Configuration)/obj\ 72 | false 73 | $(ProjectDir)/target/$(Platform)-$(Configuration)/lib\ 74 | $(ProjectDir)/target/$(Platform)-$(Configuration)/obj\ 75 | true 76 | $(ProjectDir)/target/$(Platform)-$(Configuration)/lib\ 77 | $(ProjectDir)/target/$(Platform)-$(Configuration)/obj\ 78 | true 79 | 80 | 81 | 82 | $(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\src\windows;%(AdditionalIncludeDirectories) 83 | MaxSpeed 84 | true 85 | Speed 86 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 87 | 88 | 89 | MultiThreadedDLL 90 | true 91 | false 92 | 93 | 94 | Level3 95 | ProgramDatabase 96 | StdCall 97 | CompileAsC 98 | 99 | 100 | true 101 | Windows 102 | true 103 | true 104 | MachineX86 105 | $(IntDir) 106 | true 107 | kernel32.lib;msvcrt.lib;bufferoverflowU.lib;libcmt.lib 108 | 109 | 110 | 111 | 112 | $(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\src\windows;%(AdditionalIncludeDirectories) 113 | MaxSpeed 114 | true 115 | Speed 116 | WIN64;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 117 | 118 | 119 | MultiThreadedDLL 120 | true 121 | false 122 | 123 | 124 | Level3 125 | ProgramDatabase 126 | StdCall 127 | CompileAsC 128 | 129 | 130 | true 131 | Windows 132 | true 133 | true 134 | MachineX64 135 | $(IntDir) 136 | true 137 | kernel32.lib;msvcrt.lib;bufferoverflowU.lib;libcmt.lib 138 | 139 | 140 | 141 | 142 | $(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\src\windows;%(AdditionalIncludeDirectories) 143 | Disabled 144 | Speed 145 | WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) 146 | true 147 | 148 | 149 | EnableFastChecks 150 | MultiThreadedDebugDLL 151 | false 152 | 153 | 154 | Level3 155 | EditAndContinue 156 | StdCall 157 | CompileAsC 158 | 159 | 160 | true 161 | Windows 162 | MachineX86 163 | 164 | 165 | 166 | 167 | $(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\src\windows;%(AdditionalIncludeDirectories) 168 | Disabled 169 | Speed 170 | WIN64;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) 171 | true 172 | 173 | 174 | EnableFastChecks 175 | MultiThreadedDebugDLL 176 | false 177 | 178 | 179 | Level3 180 | EditAndContinue 181 | StdCall 182 | CompileAsC 183 | 184 | 185 | true 186 | Windows 187 | MachineX64 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | lib /nologo /machine:$(Platform) /def:%(FullPath) /out:$(IntDir)%(Filename).lib 202 | $(IntDir)%(Filename).lib;$(IntDir)%(Filename).exp 203 | true 204 | lib /nologo /machine:$(Platform) /def:%(FullPath) /out:$(IntDir)%(Filename).lib 205 | $(IntDir)%(Filename).lib;$(IntDir)%(Filename).exp 206 | true 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | --------------------------------------------------------------------------------