├── .gitignore ├── LICENSE ├── README.LZO ├── README.md ├── SConscript ├── doc └── image │ └── minilzo.png ├── lzoconf.h ├── lzodefs.h ├── minilzo.c ├── minilzo.h └── minilzo_sample.c /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Object files 5 | *.o 6 | *.ko 7 | *.obj 8 | *.elf 9 | 10 | # Linker output 11 | *.ilk 12 | *.map 13 | *.exp 14 | 15 | # Precompiled Headers 16 | *.gch 17 | *.pch 18 | 19 | # Libraries 20 | *.lib 21 | *.a 22 | *.la 23 | *.lo 24 | 25 | # Shared objects (inc. Windows DLLs) 26 | *.dll 27 | *.so 28 | *.so.* 29 | *.dylib 30 | 31 | # Executables 32 | *.exe 33 | *.out 34 | *.app 35 | *.i*86 36 | *.x86_64 37 | *.hex 38 | 39 | # Debug files 40 | *.dSYM/ 41 | *.su 42 | *.idb 43 | *.pdb 44 | 45 | # Kernel Module Compile Results 46 | *.mod* 47 | *.cmd 48 | .tmp_versions/ 49 | modules.order 50 | Module.symvers 51 | Mkfile.old 52 | dkms.conf 53 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.LZO: -------------------------------------------------------------------------------- 1 | 2 | ============================================================================ 3 | miniLZO -- mini subset of the LZO real-time data compression library 4 | ============================================================================ 5 | 6 | Author : Markus Franz Xaver Johannes Oberhumer 7 | 8 | http://www.oberhumer.com/opensource/lzo/ 9 | Version : 2.06 10 | Date : 12 Aug 2011 11 | 12 | I've created miniLZO for projects where it is inconvenient to 13 | include (or require) the full LZO source code just because you 14 | want to add a little bit of data compression to your application. 15 | 16 | miniLZO implements the LZO1X-1 compressor and both the standard and 17 | safe LZO1X decompressor. Apart from fast compression it also useful 18 | for situations where you want to use pre-compressed data files (which 19 | must have been compressed with LZO1X-999). 20 | 21 | miniLZO consists of one C source file and three header files: 22 | minilzo.c 23 | minilzo.h, lzoconf.h, lzodefs.h 24 | 25 | To use miniLZO just copy these files into your source directory, add 26 | minilzo.c to your Makefile and #include minilzo.h from your program. 27 | Note: you also must distribute this file ('README.LZO') with your project. 28 | 29 | minilzo.o compiles to about 6 KiB (using gcc or Visual C on an i386), and 30 | the sources are about 30 KiB when packed with zip - so there's no more 31 | excuse that your application doesn't support data compression :-) 32 | 33 | For more information, documentation, example programs and other support 34 | files (like Makefiles and build scripts) please download the full LZO 35 | package from 36 | http://www.oberhumer.com/opensource/lzo/ 37 | 38 | Have fun, 39 | Markus 40 | 41 | 42 | P.S. minilzo.c is generated automatically from the LZO sources and 43 | therefore functionality is completely identical 44 | 45 | 46 | Appendix A: building miniLZO 47 | ---------------------------- 48 | miniLZO is written such a way that it should compile and run 49 | out-of-the-box on most machines. 50 | 51 | If you are running on a very unusual architecture and lzo_init() fails then 52 | you should first recompile with '-DLZO_DEBUG' to see what causes the failure. 53 | The most probable case is something like 'sizeof(void *) != sizeof(size_t)'. 54 | After identifying the problem you can compile by adding some defines 55 | like '-DSIZEOF_VOID_P=8' to your Makefile. 56 | 57 | The best solution is (of course) using Autoconf - if your project uses 58 | Autoconf anyway just add '-DMINILZO_HAVE_CONFIG_H' to your compiler 59 | flags when compiling minilzo.c. See the LZO distribution for an example 60 | how to set up configure.ac. 61 | 62 | 63 | Appendix B: list of public functions available in miniLZO 64 | --------------------------------------------------------- 65 | Library initialization 66 | lzo_init() 67 | 68 | Compression 69 | lzo1x_1_compress() 70 | 71 | Decompression 72 | lzo1x_decompress() 73 | lzo1x_decompress_safe() 74 | 75 | Checksum functions 76 | lzo_adler32() 77 | 78 | Version functions 79 | lzo_version() 80 | lzo_version_string() 81 | lzo_version_date() 82 | 83 | Portable (but slow) string functions 84 | lzo_memcmp() 85 | lzo_memcpy() 86 | lzo_memmove() 87 | lzo_memset() 88 | 89 | 90 | Appendix C: suggested macros for 'configure.ac' when using Autoconf 91 | ------------------------------------------------------------------- 92 | Checks for typedefs and structures 93 | AC_CHECK_TYPE(ptrdiff_t,long) 94 | AC_TYPE_SIZE_T 95 | AC_CHECK_SIZEOF(short) 96 | AC_CHECK_SIZEOF(int) 97 | AC_CHECK_SIZEOF(long) 98 | AC_CHECK_SIZEOF(long long) 99 | AC_CHECK_SIZEOF(__int64) 100 | AC_CHECK_SIZEOF(void *) 101 | AC_CHECK_SIZEOF(size_t) 102 | AC_CHECK_SIZEOF(ptrdiff_t) 103 | 104 | Checks for compiler characteristics 105 | AC_C_CONST 106 | 107 | Checks for library functions 108 | AC_CHECK_FUNCS(memcmp memcpy memmove memset) 109 | 110 | 111 | Appendix D: Copyright 112 | --------------------- 113 | LZO and miniLZO are Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 114 | 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 115 | Markus Franz Xaver Oberhumer . 116 | 117 | LZO and miniLZO are distributed under the terms of the GNU General 118 | Public License (GPL). See the file COPYING. 119 | 120 | Special licenses for commercial and other applications which 121 | are not willing to accept the GNU General Public License 122 | are available by contacting the author. 123 | 124 | 125 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # miniLZO 2 | 3 | ## 1、介绍 4 | 5 | LZO 是一个实时数据压缩库, miniLZO 是 LZO 压缩库的精简版本。 他能够提供非常快速的压缩和解压功能, 解压并不需要内存的支持。 这个 [miniLZO](https://github.com/RT-Thread-packages/miniLZO) 库是 RT-thread 针对官方 [miniLZO](http://www.oberhumer.com/opensource/lzo/) 的C库的移植, 有关 miniLZO 的更多信息,请参阅 [http://www.oberhumer.com/opensource/lzo/](http://www.oberhumer.com/opensource/lzo/) 。 6 | 7 | ## 2、获取方式 8 | 9 | - 使用 menuconfig 10 | ``` 11 | RT-Thread online packages ---> 12 | miscellaneous packages ---> 13 | [*] miniLZO: A mini subset of the LZO real-time data compression library 14 | ``` 15 | 16 | ## 3、示例介绍 17 | 18 | ### 3.1 获取示例 19 | 20 | - 配置使能示例选项 `Enable using miniLZO sample` 21 | - 配置包版本选为最新版 `latest_version` 22 | 23 | ![](./doc/image/minilzo.png) 24 | 25 | ### 3.2 运行示例 26 | 该示例为一个简单的文件压缩和解压的例程,需要依赖文件系统,用到的命令有两个` -c` 和 `-d`, `-c` 命令压缩一个文件到另一个文件,`-d` 命令解压一个文件到另一个文件。 27 | 使用方式: 28 | msh cmd 压缩: `minilzo_test -c /file.bin /file.cmprs.bin` 29 | msh cmd 解压: `minilzo_test -d /file.cmprs.bin /file_dcmprs.bin` 30 | 31 | msh />minilzo_test -c /file.bin /file.cmprs.bin 32 | [minilzo]compress start : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 33 | [minilzo]compressed 469848 bytes into 363495 bytes , compression ratio is 77%! 34 | msh /> 35 | msh />minilzo_test -d /file.cmprs.bin /file_dcmprs.bin 36 | [minilzo]decompress start : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 37 | [minilzo]decompressed 363495 bytes into 469848 bytes ! 38 | 39 | ## 4、注意事项 40 | 41 | ### 4.1 与官方源码差异 42 | 43 | miniLZO 源码中定义了一个 `LZO1X_1_MEM_COMPRESS` 大小的压缩内存,占用内存 65536 字节,资源占用高,修改为最小 `8192L * lzo_sizeof_dict_t` 字节,占用内存 32768 字节。 44 | 45 | 对源码 `minilzo.h` 进行如下变动,移植官方代码的时候需要注意: 46 | 47 | 1. 修改 LZO1X_1_MEM_COMPRESS 大小 48 | ```C 49 | #define LZO1X_1_MEM_COMPRESS ((lzo_uint32_t) (16384L * lzo_sizeof_dict_t)) 50 | ``` 51 | 替换为 52 | ```C 53 | #define LZO1X_1_MEM_COMPRESS ((lzo_uint32_t) (8192L * lzo_sizeof_dict_t)) 54 | ``` 55 | 56 | ## 5、参考资料 57 | 58 | - miniLZO 官方网站:[http://www.oberhumer.com](http://www.oberhumer.com) 59 | -------------------------------------------------------------------------------- /SConscript: -------------------------------------------------------------------------------- 1 | from building import * 2 | 3 | cwd = GetCurrentDir() 4 | src = Split(''' 5 | minilzo.c 6 | ''') 7 | CPPPATH = [cwd] 8 | 9 | if GetDepend('MINILZO_USING_SAMPLE'): 10 | src += Glob('minilzo_sample.c') 11 | 12 | group = DefineGroup('minilzo', src, depend = ['PKG_USING_MINILZO'], CPPPATH = CPPPATH) 13 | 14 | Return('group') 15 | -------------------------------------------------------------------------------- /doc/image/minilzo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RT-Thread-packages/miniLZO/fda5726fdd99737996c43a2b91d2807b502358ae/doc/image/minilzo.png -------------------------------------------------------------------------------- /lzoconf.h: -------------------------------------------------------------------------------- 1 | /* lzoconf.h -- configuration of the LZO data compression library 2 | 3 | This file is part of the LZO real-time data compression library. 4 | 5 | Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer 6 | All Rights Reserved. 7 | 8 | The LZO library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU General Public License as 10 | published by the Free Software Foundation; either version 2 of 11 | the License, or (at your option) any later version. 12 | 13 | The LZO library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with the LZO library; see the file COPYING. 20 | If not, write to the Free Software Foundation, Inc., 21 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 22 | 23 | Markus F.X.J. Oberhumer 24 | 25 | http://www.oberhumer.com/opensource/lzo/ 26 | */ 27 | 28 | 29 | #ifndef __LZOCONF_H_INCLUDED 30 | #define __LZOCONF_H_INCLUDED 1 31 | 32 | #define LZO_VERSION 0x20a0 /* 2.10 */ 33 | #define LZO_VERSION_STRING "2.10" 34 | #define LZO_VERSION_DATE "Mar 01 2017" 35 | 36 | /* internal Autoconf configuration file - only used when building LZO */ 37 | #if defined(LZO_HAVE_CONFIG_H) 38 | # include 39 | #endif 40 | #include 41 | #include 42 | 43 | 44 | /*********************************************************************** 45 | // LZO requires a conforming 46 | ************************************************************************/ 47 | 48 | #if !defined(CHAR_BIT) || (CHAR_BIT != 8) 49 | # error "invalid CHAR_BIT" 50 | #endif 51 | #if !defined(UCHAR_MAX) || !defined(USHRT_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX) 52 | # error "check your compiler installation" 53 | #endif 54 | #if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1) 55 | # error "your limits.h macros are broken" 56 | #endif 57 | 58 | /* get OS and architecture defines */ 59 | #ifndef __LZODEFS_H_INCLUDED 60 | #include 61 | #endif 62 | 63 | 64 | #ifdef __cplusplus 65 | extern "C" { 66 | #endif 67 | 68 | 69 | /*********************************************************************** 70 | // some core defines 71 | ************************************************************************/ 72 | 73 | /* memory checkers */ 74 | #if !defined(__LZO_CHECKER) 75 | # if defined(__BOUNDS_CHECKING_ON) 76 | # define __LZO_CHECKER 1 77 | # elif defined(__CHECKER__) 78 | # define __LZO_CHECKER 1 79 | # elif defined(__INSURE__) 80 | # define __LZO_CHECKER 1 81 | # elif defined(__PURIFY__) 82 | # define __LZO_CHECKER 1 83 | # endif 84 | #endif 85 | 86 | 87 | /*********************************************************************** 88 | // integral and pointer types 89 | ************************************************************************/ 90 | 91 | /* lzo_uint must match size_t */ 92 | #if !defined(LZO_UINT_MAX) 93 | # if (LZO_ABI_LLP64) 94 | # if (LZO_OS_WIN64) 95 | typedef unsigned __int64 lzo_uint; 96 | typedef __int64 lzo_int; 97 | # define LZO_TYPEOF_LZO_INT LZO_TYPEOF___INT64 98 | # else 99 | typedef lzo_ullong_t lzo_uint; 100 | typedef lzo_llong_t lzo_int; 101 | # define LZO_TYPEOF_LZO_INT LZO_TYPEOF_LONG_LONG 102 | # endif 103 | # define LZO_SIZEOF_LZO_INT 8 104 | # define LZO_UINT_MAX 0xffffffffffffffffull 105 | # define LZO_INT_MAX 9223372036854775807LL 106 | # define LZO_INT_MIN (-1LL - LZO_INT_MAX) 107 | # elif (LZO_ABI_IP32L64) /* MIPS R5900 */ 108 | typedef unsigned int lzo_uint; 109 | typedef int lzo_int; 110 | # define LZO_SIZEOF_LZO_INT LZO_SIZEOF_INT 111 | # define LZO_TYPEOF_LZO_INT LZO_TYPEOF_INT 112 | # define LZO_UINT_MAX UINT_MAX 113 | # define LZO_INT_MAX INT_MAX 114 | # define LZO_INT_MIN INT_MIN 115 | # elif (ULONG_MAX >= LZO_0xffffffffL) 116 | typedef unsigned long lzo_uint; 117 | typedef long lzo_int; 118 | # define LZO_SIZEOF_LZO_INT LZO_SIZEOF_LONG 119 | # define LZO_TYPEOF_LZO_INT LZO_TYPEOF_LONG 120 | # define LZO_UINT_MAX ULONG_MAX 121 | # define LZO_INT_MAX LONG_MAX 122 | # define LZO_INT_MIN LONG_MIN 123 | # else 124 | # error "lzo_uint" 125 | # endif 126 | #endif 127 | 128 | /* The larger type of lzo_uint and lzo_uint32_t. */ 129 | #if (LZO_SIZEOF_LZO_INT >= 4) 130 | # define lzo_xint lzo_uint 131 | #else 132 | # define lzo_xint lzo_uint32_t 133 | #endif 134 | 135 | typedef int lzo_bool; 136 | 137 | /* sanity checks */ 138 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int) == LZO_SIZEOF_LZO_INT) 139 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == LZO_SIZEOF_LZO_INT) 140 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_xint) >= sizeof(lzo_uint)) 141 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_xint) >= sizeof(lzo_uint32_t)) 142 | 143 | #ifndef __LZO_MMODEL 144 | #define __LZO_MMODEL /*empty*/ 145 | #endif 146 | 147 | /* no typedef here because of const-pointer issues */ 148 | #define lzo_bytep unsigned char __LZO_MMODEL * 149 | #define lzo_charp char __LZO_MMODEL * 150 | #define lzo_voidp void __LZO_MMODEL * 151 | #define lzo_shortp short __LZO_MMODEL * 152 | #define lzo_ushortp unsigned short __LZO_MMODEL * 153 | #define lzo_intp lzo_int __LZO_MMODEL * 154 | #define lzo_uintp lzo_uint __LZO_MMODEL * 155 | #define lzo_xintp lzo_xint __LZO_MMODEL * 156 | #define lzo_voidpp lzo_voidp __LZO_MMODEL * 157 | #define lzo_bytepp lzo_bytep __LZO_MMODEL * 158 | 159 | #define lzo_int8_tp lzo_int8_t __LZO_MMODEL * 160 | #define lzo_uint8_tp lzo_uint8_t __LZO_MMODEL * 161 | #define lzo_int16_tp lzo_int16_t __LZO_MMODEL * 162 | #define lzo_uint16_tp lzo_uint16_t __LZO_MMODEL * 163 | #define lzo_int32_tp lzo_int32_t __LZO_MMODEL * 164 | #define lzo_uint32_tp lzo_uint32_t __LZO_MMODEL * 165 | #if defined(lzo_int64_t) 166 | #define lzo_int64_tp lzo_int64_t __LZO_MMODEL * 167 | #define lzo_uint64_tp lzo_uint64_t __LZO_MMODEL * 168 | #endif 169 | 170 | /* Older LZO versions used to support ancient systems and memory models 171 | * such as 16-bit MSDOS with __huge pointers or Cray PVP, but these 172 | * obsolete configurations are not supported any longer. 173 | */ 174 | #if defined(__LZO_MMODEL_HUGE) 175 | #error "__LZO_MMODEL_HUGE memory model is unsupported" 176 | #endif 177 | #if (LZO_MM_PVP) 178 | #error "LZO_MM_PVP memory model is unsupported" 179 | #endif 180 | #if (LZO_SIZEOF_INT < 4) 181 | #error "LZO_SIZEOF_INT < 4 is unsupported" 182 | #endif 183 | #if (__LZO_UINTPTR_T_IS_POINTER) 184 | #error "__LZO_UINTPTR_T_IS_POINTER is unsupported" 185 | #endif 186 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(int) >= 4) 187 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) >= 4) 188 | /* Strange configurations where sizeof(lzo_uint) != sizeof(size_t) should 189 | * work but have not received much testing lately, so be strict here. 190 | */ 191 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(size_t)) 192 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(ptrdiff_t)) 193 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(lzo_uintptr_t)) 194 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(void *) == sizeof(lzo_uintptr_t)) 195 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(char *) == sizeof(lzo_uintptr_t)) 196 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long *) == sizeof(lzo_uintptr_t)) 197 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(void *) == sizeof(lzo_voidp)) 198 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(char *) == sizeof(lzo_bytep)) 199 | 200 | 201 | /*********************************************************************** 202 | // function types 203 | ************************************************************************/ 204 | 205 | /* name mangling */ 206 | #if !defined(__LZO_EXTERN_C) 207 | # ifdef __cplusplus 208 | # define __LZO_EXTERN_C extern "C" 209 | # else 210 | # define __LZO_EXTERN_C extern 211 | # endif 212 | #endif 213 | 214 | /* calling convention */ 215 | #if !defined(__LZO_CDECL) 216 | # define __LZO_CDECL __lzo_cdecl 217 | #endif 218 | 219 | /* DLL export information */ 220 | #if !defined(__LZO_EXPORT1) 221 | # define __LZO_EXPORT1 /*empty*/ 222 | #endif 223 | #if !defined(__LZO_EXPORT2) 224 | # define __LZO_EXPORT2 /*empty*/ 225 | #endif 226 | 227 | /* __cdecl calling convention for public C and assembly functions */ 228 | #if !defined(LZO_PUBLIC) 229 | # define LZO_PUBLIC(r) __LZO_EXPORT1 r __LZO_EXPORT2 __LZO_CDECL 230 | #endif 231 | #if !defined(LZO_EXTERN) 232 | # define LZO_EXTERN(r) __LZO_EXTERN_C LZO_PUBLIC(r) 233 | #endif 234 | #if !defined(LZO_PRIVATE) 235 | # define LZO_PRIVATE(r) static r __LZO_CDECL 236 | #endif 237 | 238 | /* function types */ 239 | typedef int 240 | (__LZO_CDECL *lzo_compress_t) ( const lzo_bytep src, lzo_uint src_len, 241 | lzo_bytep dst, lzo_uintp dst_len, 242 | lzo_voidp wrkmem ); 243 | 244 | typedef int 245 | (__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint src_len, 246 | lzo_bytep dst, lzo_uintp dst_len, 247 | lzo_voidp wrkmem ); 248 | 249 | typedef int 250 | (__LZO_CDECL *lzo_optimize_t) ( lzo_bytep src, lzo_uint src_len, 251 | lzo_bytep dst, lzo_uintp dst_len, 252 | lzo_voidp wrkmem ); 253 | 254 | typedef int 255 | (__LZO_CDECL *lzo_compress_dict_t)(const lzo_bytep src, lzo_uint src_len, 256 | lzo_bytep dst, lzo_uintp dst_len, 257 | lzo_voidp wrkmem, 258 | const lzo_bytep dict, lzo_uint dict_len ); 259 | 260 | typedef int 261 | (__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint src_len, 262 | lzo_bytep dst, lzo_uintp dst_len, 263 | lzo_voidp wrkmem, 264 | const lzo_bytep dict, lzo_uint dict_len ); 265 | 266 | 267 | /* Callback interface. Currently only the progress indicator ("nprogress") 268 | * is used, but this may change in a future release. */ 269 | 270 | struct lzo_callback_t; 271 | typedef struct lzo_callback_t lzo_callback_t; 272 | #define lzo_callback_p lzo_callback_t __LZO_MMODEL * 273 | 274 | /* malloc & free function types */ 275 | typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t) 276 | (lzo_callback_p self, lzo_uint items, lzo_uint size); 277 | typedef void (__LZO_CDECL *lzo_free_func_t) 278 | (lzo_callback_p self, lzo_voidp ptr); 279 | 280 | /* a progress indicator callback function */ 281 | typedef void (__LZO_CDECL *lzo_progress_func_t) 282 | (lzo_callback_p, lzo_uint, lzo_uint, int); 283 | 284 | struct lzo_callback_t 285 | { 286 | /* custom allocators (set to 0 to disable) */ 287 | lzo_alloc_func_t nalloc; /* [not used right now] */ 288 | lzo_free_func_t nfree; /* [not used right now] */ 289 | 290 | /* a progress indicator callback function (set to 0 to disable) */ 291 | lzo_progress_func_t nprogress; 292 | 293 | /* INFO: the first parameter "self" of the nalloc/nfree/nprogress 294 | * callbacks points back to this struct, so you are free to store 295 | * some extra info in the following variables. */ 296 | lzo_voidp user1; 297 | lzo_xint user2; 298 | lzo_xint user3; 299 | }; 300 | 301 | 302 | /*********************************************************************** 303 | // error codes and prototypes 304 | ************************************************************************/ 305 | 306 | /* Error codes for the compression/decompression functions. Negative 307 | * values are errors, positive values will be used for special but 308 | * normal events. 309 | */ 310 | #define LZO_E_OK 0 311 | #define LZO_E_ERROR (-1) 312 | #define LZO_E_OUT_OF_MEMORY (-2) /* [lzo_alloc_func_t failure] */ 313 | #define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */ 314 | #define LZO_E_INPUT_OVERRUN (-4) 315 | #define LZO_E_OUTPUT_OVERRUN (-5) 316 | #define LZO_E_LOOKBEHIND_OVERRUN (-6) 317 | #define LZO_E_EOF_NOT_FOUND (-7) 318 | #define LZO_E_INPUT_NOT_CONSUMED (-8) 319 | #define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */ 320 | #define LZO_E_INVALID_ARGUMENT (-10) 321 | #define LZO_E_INVALID_ALIGNMENT (-11) /* pointer argument is not properly aligned */ 322 | #define LZO_E_OUTPUT_NOT_CONSUMED (-12) 323 | #define LZO_E_INTERNAL_ERROR (-99) 324 | 325 | 326 | #ifndef lzo_sizeof_dict_t 327 | # define lzo_sizeof_dict_t ((unsigned)sizeof(lzo_bytep)) 328 | #endif 329 | 330 | /* lzo_init() should be the first function you call. 331 | * Check the return code ! 332 | * 333 | * lzo_init() is a macro to allow checking that the library and the 334 | * compiler's view of various types are consistent. 335 | */ 336 | #define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\ 337 | (int)sizeof(long),(int)sizeof(lzo_uint32_t),(int)sizeof(lzo_uint),\ 338 | (int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\ 339 | (int)sizeof(lzo_callback_t)) 340 | LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int); 341 | 342 | /* version functions (useful for shared libraries) */ 343 | LZO_EXTERN(unsigned) lzo_version(void); 344 | LZO_EXTERN(const char *) lzo_version_string(void); 345 | LZO_EXTERN(const char *) lzo_version_date(void); 346 | LZO_EXTERN(const lzo_charp) _lzo_version_string(void); 347 | LZO_EXTERN(const lzo_charp) _lzo_version_date(void); 348 | 349 | /* string functions */ 350 | LZO_EXTERN(int) 351 | lzo_memcmp(const lzo_voidp a, const lzo_voidp b, lzo_uint len); 352 | LZO_EXTERN(lzo_voidp) 353 | lzo_memcpy(lzo_voidp dst, const lzo_voidp src, lzo_uint len); 354 | LZO_EXTERN(lzo_voidp) 355 | lzo_memmove(lzo_voidp dst, const lzo_voidp src, lzo_uint len); 356 | LZO_EXTERN(lzo_voidp) 357 | lzo_memset(lzo_voidp buf, int c, lzo_uint len); 358 | 359 | /* checksum functions */ 360 | LZO_EXTERN(lzo_uint32_t) 361 | lzo_adler32(lzo_uint32_t c, const lzo_bytep buf, lzo_uint len); 362 | LZO_EXTERN(lzo_uint32_t) 363 | lzo_crc32(lzo_uint32_t c, const lzo_bytep buf, lzo_uint len); 364 | LZO_EXTERN(const lzo_uint32_tp) 365 | lzo_get_crc32_table(void); 366 | 367 | /* misc. */ 368 | LZO_EXTERN(int) _lzo_config_check(void); 369 | typedef union { 370 | lzo_voidp a00; lzo_bytep a01; lzo_uint a02; lzo_xint a03; lzo_uintptr_t a04; 371 | void *a05; unsigned char *a06; unsigned long a07; size_t a08; ptrdiff_t a09; 372 | #if defined(lzo_int64_t) 373 | lzo_uint64_t a10; 374 | #endif 375 | } lzo_align_t; 376 | 377 | /* align a char pointer on a boundary that is a multiple of 'size' */ 378 | LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp p, lzo_uint size); 379 | #define LZO_PTR_ALIGN_UP(p,size) \ 380 | ((p) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(p),(lzo_uint)(size))) 381 | 382 | 383 | /*********************************************************************** 384 | // deprecated macros - only for backward compatibility 385 | ************************************************************************/ 386 | 387 | /* deprecated - use 'lzo_bytep' instead of 'lzo_byte *' */ 388 | #define lzo_byte unsigned char 389 | /* deprecated type names */ 390 | #define lzo_int32 lzo_int32_t 391 | #define lzo_uint32 lzo_uint32_t 392 | #define lzo_int32p lzo_int32_t __LZO_MMODEL * 393 | #define lzo_uint32p lzo_uint32_t __LZO_MMODEL * 394 | #define LZO_INT32_MAX LZO_INT32_C(2147483647) 395 | #define LZO_UINT32_MAX LZO_UINT32_C(4294967295) 396 | #if defined(lzo_int64_t) 397 | #define lzo_int64 lzo_int64_t 398 | #define lzo_uint64 lzo_uint64_t 399 | #define lzo_int64p lzo_int64_t __LZO_MMODEL * 400 | #define lzo_uint64p lzo_uint64_t __LZO_MMODEL * 401 | #define LZO_INT64_MAX LZO_INT64_C(9223372036854775807) 402 | #define LZO_UINT64_MAX LZO_UINT64_C(18446744073709551615) 403 | #endif 404 | /* deprecated types */ 405 | typedef union { lzo_bytep a; lzo_uint b; } __lzo_pu_u; 406 | typedef union { lzo_bytep a; lzo_uint32_t b; } __lzo_pu32_u; 407 | /* deprecated defines */ 408 | #if !defined(LZO_SIZEOF_LZO_UINT) 409 | # define LZO_SIZEOF_LZO_UINT LZO_SIZEOF_LZO_INT 410 | #endif 411 | 412 | #if defined(LZO_CFG_COMPAT) 413 | 414 | #define __LZOCONF_H 1 415 | 416 | #if defined(LZO_ARCH_I086) 417 | # define __LZO_i386 1 418 | #elif defined(LZO_ARCH_I386) 419 | # define __LZO_i386 1 420 | #endif 421 | 422 | #if defined(LZO_OS_DOS16) 423 | # define __LZO_DOS 1 424 | # define __LZO_DOS16 1 425 | #elif defined(LZO_OS_DOS32) 426 | # define __LZO_DOS 1 427 | #elif defined(LZO_OS_WIN16) 428 | # define __LZO_WIN 1 429 | # define __LZO_WIN16 1 430 | #elif defined(LZO_OS_WIN32) 431 | # define __LZO_WIN 1 432 | #endif 433 | 434 | #define __LZO_CMODEL /*empty*/ 435 | #define __LZO_DMODEL /*empty*/ 436 | #define __LZO_ENTRY __LZO_CDECL 437 | #define LZO_EXTERN_CDECL LZO_EXTERN 438 | #define LZO_ALIGN LZO_PTR_ALIGN_UP 439 | 440 | #define lzo_compress_asm_t lzo_compress_t 441 | #define lzo_decompress_asm_t lzo_decompress_t 442 | 443 | #endif /* LZO_CFG_COMPAT */ 444 | 445 | 446 | #ifdef __cplusplus 447 | } /* extern "C" */ 448 | #endif 449 | 450 | #endif /* already included */ 451 | 452 | 453 | /* vim:set ts=4 sw=4 et: */ 454 | -------------------------------------------------------------------------------- /lzodefs.h: -------------------------------------------------------------------------------- 1 | /* lzodefs.h -- architecture, OS and compiler specific defines 2 | 3 | This file is part of the LZO real-time data compression library. 4 | 5 | Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer 6 | All Rights Reserved. 7 | 8 | The LZO library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU General Public License as 10 | published by the Free Software Foundation; either version 2 of 11 | the License, or (at your option) any later version. 12 | 13 | The LZO library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with the LZO library; see the file COPYING. 20 | If not, write to the Free Software Foundation, Inc., 21 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 22 | 23 | Markus F.X.J. Oberhumer 24 | 25 | http://www.oberhumer.com/opensource/lzo/ 26 | */ 27 | 28 | 29 | #ifndef __LZODEFS_H_INCLUDED 30 | #define __LZODEFS_H_INCLUDED 1 31 | 32 | #if defined(__CYGWIN32__) && !defined(__CYGWIN__) 33 | # define __CYGWIN__ __CYGWIN32__ 34 | #endif 35 | #if 1 && defined(__INTERIX) && defined(__GNUC__) && !defined(_ALL_SOURCE) 36 | # define _ALL_SOURCE 1 37 | #endif 38 | #if defined(__mips__) && defined(__R5900__) 39 | # if !defined(__LONG_MAX__) 40 | # define __LONG_MAX__ 9223372036854775807L 41 | # endif 42 | #endif 43 | #if 0 44 | #elif !defined(__LZO_LANG_OVERRIDE) 45 | #if (defined(__clang__) || defined(__GNUC__)) && defined(__ASSEMBLER__) 46 | # if (__ASSEMBLER__+0) <= 0 47 | # error "__ASSEMBLER__" 48 | # else 49 | # define LZO_LANG_ASSEMBLER 1 50 | # endif 51 | #elif defined(__cplusplus) 52 | # if (__cplusplus+0) <= 0 53 | # error "__cplusplus" 54 | # elif (__cplusplus < 199711L) 55 | # define LZO_LANG_CXX 1 56 | # elif defined(_MSC_VER) && defined(_MSVC_LANG) && (_MSVC_LANG+0 >= 201402L) && 1 57 | # define LZO_LANG_CXX _MSVC_LANG 58 | # else 59 | # define LZO_LANG_CXX __cplusplus 60 | # endif 61 | # define LZO_LANG_CPLUSPLUS LZO_LANG_CXX 62 | #else 63 | # if defined(__STDC_VERSION__) && (__STDC_VERSION__+0 >= 199409L) 64 | # define LZO_LANG_C __STDC_VERSION__ 65 | # else 66 | # define LZO_LANG_C 1 67 | # endif 68 | #endif 69 | #endif 70 | #if !defined(LZO_CFG_NO_DISABLE_WUNDEF) 71 | #if defined(__ARMCC_VERSION) 72 | # pragma diag_suppress 193 73 | #elif defined(__clang__) && defined(__clang_minor__) 74 | # pragma clang diagnostic ignored "-Wundef" 75 | #elif defined(__INTEL_COMPILER) 76 | # pragma warning(disable: 193) 77 | #elif defined(__KEIL__) && defined(__C166__) 78 | # pragma warning disable = 322 79 | #elif defined(__GNUC__) && defined(__GNUC_MINOR__) && !defined(__PATHSCALE__) 80 | # if ((__GNUC__-0) >= 5 || ((__GNUC__-0) == 4 && (__GNUC_MINOR__-0) >= 2)) 81 | # pragma GCC diagnostic ignored "-Wundef" 82 | # endif 83 | #elif defined(_MSC_VER) && !defined(__clang__) && !defined(__INTEL_COMPILER) && !defined(__MWERKS__) 84 | # if ((_MSC_VER-0) >= 1300) 85 | # pragma warning(disable: 4668) 86 | # endif 87 | #endif 88 | #endif 89 | #if 0 && defined(__POCC__) && defined(_WIN32) 90 | # if (__POCC__ >= 400) 91 | # pragma warn(disable: 2216) 92 | # endif 93 | #endif 94 | #if 0 && defined(__WATCOMC__) 95 | # if (__WATCOMC__ >= 1050) && (__WATCOMC__ < 1060) 96 | # pragma warning 203 9 97 | # endif 98 | #endif 99 | #if defined(__BORLANDC__) && defined(__MSDOS__) && !defined(__FLAT__) 100 | # pragma option -h 101 | #endif 102 | #if !(LZO_CFG_NO_DISABLE_WCRTNONSTDC) 103 | #ifndef _CRT_NONSTDC_NO_DEPRECATE 104 | #define _CRT_NONSTDC_NO_DEPRECATE 1 105 | #endif 106 | #ifndef _CRT_NONSTDC_NO_WARNINGS 107 | #define _CRT_NONSTDC_NO_WARNINGS 1 108 | #endif 109 | #ifndef _CRT_SECURE_NO_DEPRECATE 110 | #define _CRT_SECURE_NO_DEPRECATE 1 111 | #endif 112 | #ifndef _CRT_SECURE_NO_WARNINGS 113 | #define _CRT_SECURE_NO_WARNINGS 1 114 | #endif 115 | #endif 116 | #if 0 117 | #define LZO_0xffffUL 0xfffful 118 | #define LZO_0xffffffffUL 0xfffffffful 119 | #else 120 | #define LZO_0xffffUL 65535ul 121 | #define LZO_0xffffffffUL 4294967295ul 122 | #endif 123 | #define LZO_0xffffL LZO_0xffffUL 124 | #define LZO_0xffffffffL LZO_0xffffffffUL 125 | #if (LZO_0xffffL == LZO_0xffffffffL) 126 | # error "your preprocessor is broken 1" 127 | #endif 128 | #if (16ul * 16384ul != 262144ul) 129 | # error "your preprocessor is broken 2" 130 | #endif 131 | #if 0 132 | #if (32767 >= 4294967295ul) 133 | # error "your preprocessor is broken 3" 134 | #endif 135 | #if (65535u >= 4294967295ul) 136 | # error "your preprocessor is broken 4" 137 | #endif 138 | #endif 139 | #if defined(__COUNTER__) 140 | # ifndef LZO_CFG_USE_COUNTER 141 | # define LZO_CFG_USE_COUNTER 1 142 | # endif 143 | #else 144 | # undef LZO_CFG_USE_COUNTER 145 | #endif 146 | #if (UINT_MAX == LZO_0xffffL) 147 | #if defined(__ZTC__) && defined(__I86__) && !defined(__OS2__) 148 | # if !defined(MSDOS) 149 | # define MSDOS 1 150 | # endif 151 | # if !defined(_MSDOS) 152 | # define _MSDOS 1 153 | # endif 154 | #elif 0 && defined(__VERSION) && defined(MB_LEN_MAX) 155 | # if (__VERSION == 520) && (MB_LEN_MAX == 1) 156 | # if !defined(__AZTEC_C__) 157 | # define __AZTEC_C__ __VERSION 158 | # endif 159 | # if !defined(__DOS__) 160 | # define __DOS__ 1 161 | # endif 162 | # endif 163 | #endif 164 | #endif 165 | #if (UINT_MAX == LZO_0xffffL) 166 | #if defined(_MSC_VER) && defined(M_I86HM) 167 | # define ptrdiff_t long 168 | # define _PTRDIFF_T_DEFINED 1 169 | #endif 170 | #endif 171 | #if (UINT_MAX == LZO_0xffffL) 172 | # undef __LZO_RENAME_A 173 | # undef __LZO_RENAME_B 174 | # if defined(__AZTEC_C__) && defined(__DOS__) 175 | # define __LZO_RENAME_A 1 176 | # elif defined(_MSC_VER) && defined(MSDOS) 177 | # if (_MSC_VER < 600) 178 | # define __LZO_RENAME_A 1 179 | # elif (_MSC_VER < 700) 180 | # define __LZO_RENAME_B 1 181 | # endif 182 | # elif defined(__TSC__) && defined(__OS2__) 183 | # define __LZO_RENAME_A 1 184 | # elif defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0410) 185 | # define __LZO_RENAME_A 1 186 | # elif defined(__PACIFIC__) && defined(DOS) 187 | # if !defined(__far) 188 | # define __far far 189 | # endif 190 | # if !defined(__near) 191 | # define __near near 192 | # endif 193 | # endif 194 | # if defined(__LZO_RENAME_A) 195 | # if !defined(__cdecl) 196 | # define __cdecl cdecl 197 | # endif 198 | # if !defined(__far) 199 | # define __far far 200 | # endif 201 | # if !defined(__huge) 202 | # define __huge huge 203 | # endif 204 | # if !defined(__near) 205 | # define __near near 206 | # endif 207 | # if !defined(__pascal) 208 | # define __pascal pascal 209 | # endif 210 | # if !defined(__huge) 211 | # define __huge huge 212 | # endif 213 | # elif defined(__LZO_RENAME_B) 214 | # if !defined(__cdecl) 215 | # define __cdecl _cdecl 216 | # endif 217 | # if !defined(__far) 218 | # define __far _far 219 | # endif 220 | # if !defined(__huge) 221 | # define __huge _huge 222 | # endif 223 | # if !defined(__near) 224 | # define __near _near 225 | # endif 226 | # if !defined(__pascal) 227 | # define __pascal _pascal 228 | # endif 229 | # elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) 230 | # if !defined(__cdecl) 231 | # define __cdecl cdecl 232 | # endif 233 | # if !defined(__pascal) 234 | # define __pascal pascal 235 | # endif 236 | # endif 237 | # undef __LZO_RENAME_A 238 | # undef __LZO_RENAME_B 239 | #endif 240 | #if (UINT_MAX == LZO_0xffffL) 241 | #if defined(__AZTEC_C__) && defined(__DOS__) 242 | # define LZO_BROKEN_CDECL_ALT_SYNTAX 1 243 | #elif defined(_MSC_VER) && defined(MSDOS) 244 | # if (_MSC_VER < 600) 245 | # define LZO_BROKEN_INTEGRAL_CONSTANTS 1 246 | # endif 247 | # if (_MSC_VER < 700) 248 | # define LZO_BROKEN_INTEGRAL_PROMOTION 1 249 | # define LZO_BROKEN_SIZEOF 1 250 | # endif 251 | #elif defined(__PACIFIC__) && defined(DOS) 252 | # define LZO_BROKEN_INTEGRAL_CONSTANTS 1 253 | #elif defined(__TURBOC__) && defined(__MSDOS__) 254 | # if (__TURBOC__ < 0x0150) 255 | # define LZO_BROKEN_CDECL_ALT_SYNTAX 1 256 | # define LZO_BROKEN_INTEGRAL_CONSTANTS 1 257 | # define LZO_BROKEN_INTEGRAL_PROMOTION 1 258 | # endif 259 | # if (__TURBOC__ < 0x0200) 260 | # define LZO_BROKEN_SIZEOF 1 261 | # endif 262 | # if (__TURBOC__ < 0x0400) && defined(__cplusplus) 263 | # define LZO_BROKEN_CDECL_ALT_SYNTAX 1 264 | # endif 265 | #elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) 266 | # define LZO_BROKEN_CDECL_ALT_SYNTAX 1 267 | # define LZO_BROKEN_SIZEOF 1 268 | #endif 269 | #endif 270 | #if defined(__WATCOMC__) && (__WATCOMC__ < 900) 271 | # define LZO_BROKEN_INTEGRAL_CONSTANTS 1 272 | #endif 273 | #if defined(_CRAY) && defined(_CRAY1) 274 | # define LZO_BROKEN_SIGNED_RIGHT_SHIFT 1 275 | #endif 276 | #define LZO_PP_STRINGIZE(x) #x 277 | #define LZO_PP_MACRO_EXPAND(x) LZO_PP_STRINGIZE(x) 278 | #define LZO_PP_CONCAT0() /*empty*/ 279 | #define LZO_PP_CONCAT1(a) a 280 | #define LZO_PP_CONCAT2(a,b) a ## b 281 | #define LZO_PP_CONCAT3(a,b,c) a ## b ## c 282 | #define LZO_PP_CONCAT4(a,b,c,d) a ## b ## c ## d 283 | #define LZO_PP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e 284 | #define LZO_PP_CONCAT6(a,b,c,d,e,f) a ## b ## c ## d ## e ## f 285 | #define LZO_PP_CONCAT7(a,b,c,d,e,f,g) a ## b ## c ## d ## e ## f ## g 286 | #define LZO_PP_ECONCAT0() LZO_PP_CONCAT0() 287 | #define LZO_PP_ECONCAT1(a) LZO_PP_CONCAT1(a) 288 | #define LZO_PP_ECONCAT2(a,b) LZO_PP_CONCAT2(a,b) 289 | #define LZO_PP_ECONCAT3(a,b,c) LZO_PP_CONCAT3(a,b,c) 290 | #define LZO_PP_ECONCAT4(a,b,c,d) LZO_PP_CONCAT4(a,b,c,d) 291 | #define LZO_PP_ECONCAT5(a,b,c,d,e) LZO_PP_CONCAT5(a,b,c,d,e) 292 | #define LZO_PP_ECONCAT6(a,b,c,d,e,f) LZO_PP_CONCAT6(a,b,c,d,e,f) 293 | #define LZO_PP_ECONCAT7(a,b,c,d,e,f,g) LZO_PP_CONCAT7(a,b,c,d,e,f,g) 294 | #define LZO_PP_EMPTY /*empty*/ 295 | #define LZO_PP_EMPTY0() /*empty*/ 296 | #define LZO_PP_EMPTY1(a) /*empty*/ 297 | #define LZO_PP_EMPTY2(a,b) /*empty*/ 298 | #define LZO_PP_EMPTY3(a,b,c) /*empty*/ 299 | #define LZO_PP_EMPTY4(a,b,c,d) /*empty*/ 300 | #define LZO_PP_EMPTY5(a,b,c,d,e) /*empty*/ 301 | #define LZO_PP_EMPTY6(a,b,c,d,e,f) /*empty*/ 302 | #define LZO_PP_EMPTY7(a,b,c,d,e,f,g) /*empty*/ 303 | #if 1 304 | #define LZO_CPP_STRINGIZE(x) #x 305 | #define LZO_CPP_MACRO_EXPAND(x) LZO_CPP_STRINGIZE(x) 306 | #define LZO_CPP_CONCAT2(a,b) a ## b 307 | #define LZO_CPP_CONCAT3(a,b,c) a ## b ## c 308 | #define LZO_CPP_CONCAT4(a,b,c,d) a ## b ## c ## d 309 | #define LZO_CPP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e 310 | #define LZO_CPP_CONCAT6(a,b,c,d,e,f) a ## b ## c ## d ## e ## f 311 | #define LZO_CPP_CONCAT7(a,b,c,d,e,f,g) a ## b ## c ## d ## e ## f ## g 312 | #define LZO_CPP_ECONCAT2(a,b) LZO_CPP_CONCAT2(a,b) 313 | #define LZO_CPP_ECONCAT3(a,b,c) LZO_CPP_CONCAT3(a,b,c) 314 | #define LZO_CPP_ECONCAT4(a,b,c,d) LZO_CPP_CONCAT4(a,b,c,d) 315 | #define LZO_CPP_ECONCAT5(a,b,c,d,e) LZO_CPP_CONCAT5(a,b,c,d,e) 316 | #define LZO_CPP_ECONCAT6(a,b,c,d,e,f) LZO_CPP_CONCAT6(a,b,c,d,e,f) 317 | #define LZO_CPP_ECONCAT7(a,b,c,d,e,f,g) LZO_CPP_CONCAT7(a,b,c,d,e,f,g) 318 | #endif 319 | #define __LZO_MASK_GEN(o,b) (((((o) << ((b)-((b)!=0))) - (o)) << 1) + (o)*((b)!=0)) 320 | #if 1 && defined(__cplusplus) 321 | # if !defined(__STDC_CONSTANT_MACROS) 322 | # define __STDC_CONSTANT_MACROS 1 323 | # endif 324 | # if !defined(__STDC_LIMIT_MACROS) 325 | # define __STDC_LIMIT_MACROS 1 326 | # endif 327 | #endif 328 | #if defined(__cplusplus) 329 | # define LZO_EXTERN_C extern "C" 330 | # define LZO_EXTERN_C_BEGIN extern "C" { 331 | # define LZO_EXTERN_C_END } 332 | #else 333 | # define LZO_EXTERN_C extern 334 | # define LZO_EXTERN_C_BEGIN /*empty*/ 335 | # define LZO_EXTERN_C_END /*empty*/ 336 | #endif 337 | #if !defined(__LZO_OS_OVERRIDE) 338 | #if (LZO_OS_FREESTANDING) 339 | # define LZO_INFO_OS "freestanding" 340 | #elif (LZO_OS_EMBEDDED) 341 | # define LZO_INFO_OS "embedded" 342 | #elif 1 && defined(__IAR_SYSTEMS_ICC__) 343 | # define LZO_OS_EMBEDDED 1 344 | # define LZO_INFO_OS "embedded" 345 | #elif defined(__CYGWIN__) && defined(__GNUC__) 346 | # define LZO_OS_CYGWIN 1 347 | # define LZO_INFO_OS "cygwin" 348 | #elif defined(__EMX__) && defined(__GNUC__) 349 | # define LZO_OS_EMX 1 350 | # define LZO_INFO_OS "emx" 351 | #elif defined(__BEOS__) 352 | # define LZO_OS_BEOS 1 353 | # define LZO_INFO_OS "beos" 354 | #elif defined(__Lynx__) 355 | # define LZO_OS_LYNXOS 1 356 | # define LZO_INFO_OS "lynxos" 357 | #elif defined(__OS400__) 358 | # define LZO_OS_OS400 1 359 | # define LZO_INFO_OS "os400" 360 | #elif defined(__QNX__) 361 | # define LZO_OS_QNX 1 362 | # define LZO_INFO_OS "qnx" 363 | #elif defined(__BORLANDC__) && defined(__DPMI32__) && (__BORLANDC__ >= 0x0460) 364 | # define LZO_OS_DOS32 1 365 | # define LZO_INFO_OS "dos32" 366 | #elif defined(__BORLANDC__) && defined(__DPMI16__) 367 | # define LZO_OS_DOS16 1 368 | # define LZO_INFO_OS "dos16" 369 | #elif defined(__ZTC__) && defined(DOS386) 370 | # define LZO_OS_DOS32 1 371 | # define LZO_INFO_OS "dos32" 372 | #elif defined(__OS2__) || defined(__OS2V2__) 373 | # if (UINT_MAX == LZO_0xffffL) 374 | # define LZO_OS_OS216 1 375 | # define LZO_INFO_OS "os216" 376 | # elif (UINT_MAX == LZO_0xffffffffL) 377 | # define LZO_OS_OS2 1 378 | # define LZO_INFO_OS "os2" 379 | # else 380 | # error "check your limits.h header" 381 | # endif 382 | #elif defined(__WIN64__) || defined(_WIN64) || defined(WIN64) 383 | # define LZO_OS_WIN64 1 384 | # define LZO_INFO_OS "win64" 385 | #elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WINDOWS_386__) 386 | # define LZO_OS_WIN32 1 387 | # define LZO_INFO_OS "win32" 388 | #elif defined(__MWERKS__) && defined(__INTEL__) 389 | # define LZO_OS_WIN32 1 390 | # define LZO_INFO_OS "win32" 391 | #elif defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows) 392 | # if (UINT_MAX == LZO_0xffffL) 393 | # define LZO_OS_WIN16 1 394 | # define LZO_INFO_OS "win16" 395 | # elif (UINT_MAX == LZO_0xffffffffL) 396 | # define LZO_OS_WIN32 1 397 | # define LZO_INFO_OS "win32" 398 | # else 399 | # error "check your limits.h header" 400 | # endif 401 | #elif defined(__DOS__) || defined(__MSDOS__) || defined(_MSDOS) || defined(MSDOS) || (defined(__PACIFIC__) && defined(DOS)) 402 | # if (UINT_MAX == LZO_0xffffL) 403 | # define LZO_OS_DOS16 1 404 | # define LZO_INFO_OS "dos16" 405 | # elif (UINT_MAX == LZO_0xffffffffL) 406 | # define LZO_OS_DOS32 1 407 | # define LZO_INFO_OS "dos32" 408 | # else 409 | # error "check your limits.h header" 410 | # endif 411 | #elif defined(__WATCOMC__) 412 | # if defined(__NT__) && (UINT_MAX == LZO_0xffffL) 413 | # define LZO_OS_DOS16 1 414 | # define LZO_INFO_OS "dos16" 415 | # elif defined(__NT__) && (__WATCOMC__ < 1100) 416 | # define LZO_OS_WIN32 1 417 | # define LZO_INFO_OS "win32" 418 | # elif defined(__linux__) || defined(__LINUX__) 419 | # define LZO_OS_POSIX 1 420 | # define LZO_INFO_OS "posix" 421 | # else 422 | # error "please specify a target using the -bt compiler option" 423 | # endif 424 | #elif defined(__palmos__) 425 | # define LZO_OS_PALMOS 1 426 | # define LZO_INFO_OS "palmos" 427 | #elif defined(__TOS__) || defined(__atarist__) 428 | # define LZO_OS_TOS 1 429 | # define LZO_INFO_OS "tos" 430 | #elif defined(macintosh) && !defined(__arm__) && !defined(__i386__) && !defined(__ppc__) && !defined(__x64_64__) 431 | # define LZO_OS_MACCLASSIC 1 432 | # define LZO_INFO_OS "macclassic" 433 | #elif defined(__VMS) 434 | # define LZO_OS_VMS 1 435 | # define LZO_INFO_OS "vms" 436 | #elif (defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__) 437 | # define LZO_OS_CONSOLE 1 438 | # define LZO_OS_CONSOLE_PS2 1 439 | # define LZO_INFO_OS "console" 440 | # define LZO_INFO_OS_CONSOLE "ps2" 441 | #elif defined(__mips__) && defined(__psp__) 442 | # define LZO_OS_CONSOLE 1 443 | # define LZO_OS_CONSOLE_PSP 1 444 | # define LZO_INFO_OS "console" 445 | # define LZO_INFO_OS_CONSOLE "psp" 446 | #else 447 | # define LZO_OS_POSIX 1 448 | # define LZO_INFO_OS "posix" 449 | #endif 450 | #if (LZO_OS_POSIX) 451 | # if defined(_AIX) || defined(__AIX__) || defined(__aix__) 452 | # define LZO_OS_POSIX_AIX 1 453 | # define LZO_INFO_OS_POSIX "aix" 454 | # elif defined(__FreeBSD__) 455 | # define LZO_OS_POSIX_FREEBSD 1 456 | # define LZO_INFO_OS_POSIX "freebsd" 457 | # elif defined(__hpux__) || defined(__hpux) 458 | # define LZO_OS_POSIX_HPUX 1 459 | # define LZO_INFO_OS_POSIX "hpux" 460 | # elif defined(__INTERIX) 461 | # define LZO_OS_POSIX_INTERIX 1 462 | # define LZO_INFO_OS_POSIX "interix" 463 | # elif defined(__IRIX__) || defined(__irix__) 464 | # define LZO_OS_POSIX_IRIX 1 465 | # define LZO_INFO_OS_POSIX "irix" 466 | # elif defined(__linux__) || defined(__linux) || defined(__LINUX__) 467 | # define LZO_OS_POSIX_LINUX 1 468 | # define LZO_INFO_OS_POSIX "linux" 469 | # elif defined(__APPLE__) && defined(__MACH__) 470 | # if ((__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__-0) >= 20000) 471 | # define LZO_OS_POSIX_DARWIN 1040 472 | # define LZO_INFO_OS_POSIX "darwin_iphone" 473 | # elif ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0) >= 1040) 474 | # define LZO_OS_POSIX_DARWIN __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ 475 | # define LZO_INFO_OS_POSIX "darwin" 476 | # else 477 | # define LZO_OS_POSIX_DARWIN 1 478 | # define LZO_INFO_OS_POSIX "darwin" 479 | # endif 480 | # define LZO_OS_POSIX_MACOSX LZO_OS_POSIX_DARWIN 481 | # elif defined(__minix__) || defined(__minix) 482 | # define LZO_OS_POSIX_MINIX 1 483 | # define LZO_INFO_OS_POSIX "minix" 484 | # elif defined(__NetBSD__) 485 | # define LZO_OS_POSIX_NETBSD 1 486 | # define LZO_INFO_OS_POSIX "netbsd" 487 | # elif defined(__OpenBSD__) 488 | # define LZO_OS_POSIX_OPENBSD 1 489 | # define LZO_INFO_OS_POSIX "openbsd" 490 | # elif defined(__osf__) 491 | # define LZO_OS_POSIX_OSF 1 492 | # define LZO_INFO_OS_POSIX "osf" 493 | # elif defined(__solaris__) || defined(__sun) 494 | # if defined(__SVR4) || defined(__svr4__) 495 | # define LZO_OS_POSIX_SOLARIS 1 496 | # define LZO_INFO_OS_POSIX "solaris" 497 | # else 498 | # define LZO_OS_POSIX_SUNOS 1 499 | # define LZO_INFO_OS_POSIX "sunos" 500 | # endif 501 | # elif defined(__ultrix__) || defined(__ultrix) 502 | # define LZO_OS_POSIX_ULTRIX 1 503 | # define LZO_INFO_OS_POSIX "ultrix" 504 | # elif defined(_UNICOS) 505 | # define LZO_OS_POSIX_UNICOS 1 506 | # define LZO_INFO_OS_POSIX "unicos" 507 | # else 508 | # define LZO_OS_POSIX_UNKNOWN 1 509 | # define LZO_INFO_OS_POSIX "unknown" 510 | # endif 511 | #endif 512 | #endif 513 | #if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) 514 | # if (UINT_MAX != LZO_0xffffL) 515 | # error "unexpected configuration - check your compiler defines" 516 | # endif 517 | # if (ULONG_MAX != LZO_0xffffffffL) 518 | # error "unexpected configuration - check your compiler defines" 519 | # endif 520 | #endif 521 | #if (LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_WIN32 || LZO_OS_WIN64) 522 | # if (UINT_MAX != LZO_0xffffffffL) 523 | # error "unexpected configuration - check your compiler defines" 524 | # endif 525 | # if (ULONG_MAX != LZO_0xffffffffL) 526 | # error "unexpected configuration - check your compiler defines" 527 | # endif 528 | #endif 529 | #if defined(CIL) && defined(_GNUCC) && defined(__GNUC__) 530 | # define LZO_CC_CILLY 1 531 | # define LZO_INFO_CC "Cilly" 532 | # if defined(__CILLY__) 533 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__CILLY__) 534 | # else 535 | # define LZO_INFO_CCVER "unknown" 536 | # endif 537 | #elif 0 && defined(SDCC) && defined(__VERSION__) && !defined(__GNUC__) 538 | # define LZO_CC_SDCC 1 539 | # define LZO_INFO_CC "sdcc" 540 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(SDCC) 541 | #elif defined(__PATHSCALE__) && defined(__PATHCC_PATCHLEVEL__) 542 | # define LZO_CC_PATHSCALE (__PATHCC__ * 0x10000L + (__PATHCC_MINOR__-0) * 0x100 + (__PATHCC_PATCHLEVEL__-0)) 543 | # define LZO_INFO_CC "Pathscale C" 544 | # define LZO_INFO_CCVER __PATHSCALE__ 545 | # if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) 546 | # define LZO_CC_PATHSCALE_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) 547 | # endif 548 | #elif defined(__INTEL_COMPILER) && ((__INTEL_COMPILER-0) > 0) 549 | # define LZO_CC_INTELC __INTEL_COMPILER 550 | # define LZO_INFO_CC "Intel C" 551 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__INTEL_COMPILER) 552 | # if defined(_MSC_VER) && ((_MSC_VER-0) > 0) 553 | # define LZO_CC_INTELC_MSC _MSC_VER 554 | # elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) 555 | # define LZO_CC_INTELC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) 556 | # endif 557 | #elif defined(__POCC__) && defined(_WIN32) 558 | # define LZO_CC_PELLESC 1 559 | # define LZO_INFO_CC "Pelles C" 560 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__POCC__) 561 | #elif defined(__ARMCC_VERSION) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) 562 | # if defined(__GNUC_PATCHLEVEL__) 563 | # define LZO_CC_ARMCC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) 564 | # else 565 | # define LZO_CC_ARMCC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100) 566 | # endif 567 | # define LZO_CC_ARMCC __ARMCC_VERSION 568 | # define LZO_INFO_CC "ARM C Compiler" 569 | # define LZO_INFO_CCVER __VERSION__ 570 | #elif defined(__clang__) && defined(__c2__) && defined(__c2_version__) && defined(_MSC_VER) 571 | # define LZO_CC_CLANG (__clang_major__ * 0x10000L + (__clang_minor__-0) * 0x100 + (__clang_patchlevel__-0)) 572 | # define LZO_CC_CLANG_C2 _MSC_VER 573 | # define LZO_CC_CLANG_VENDOR_MICROSOFT 1 574 | # define LZO_INFO_CC "clang/c2" 575 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__c2_version__) 576 | #elif defined(__clang__) && defined(__llvm__) && defined(__VERSION__) 577 | # if defined(__clang_major__) && defined(__clang_minor__) && defined(__clang_patchlevel__) 578 | # define LZO_CC_CLANG (__clang_major__ * 0x10000L + (__clang_minor__-0) * 0x100 + (__clang_patchlevel__-0)) 579 | # else 580 | # define LZO_CC_CLANG 0x010000L 581 | # endif 582 | # if defined(_MSC_VER) && ((_MSC_VER-0) > 0) 583 | # define LZO_CC_CLANG_MSC _MSC_VER 584 | # elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) 585 | # define LZO_CC_CLANG_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) 586 | # endif 587 | # if defined(__APPLE_CC__) 588 | # define LZO_CC_CLANG_VENDOR_APPLE 1 589 | # define LZO_INFO_CC "clang/apple" 590 | # else 591 | # define LZO_CC_CLANG_VENDOR_LLVM 1 592 | # define LZO_INFO_CC "clang" 593 | # endif 594 | # if defined(__clang_version__) 595 | # define LZO_INFO_CCVER __clang_version__ 596 | # else 597 | # define LZO_INFO_CCVER __VERSION__ 598 | # endif 599 | #elif defined(__llvm__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) 600 | # if defined(__GNUC_PATCHLEVEL__) 601 | # define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) 602 | # else 603 | # define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100) 604 | # endif 605 | # define LZO_CC_LLVM LZO_CC_LLVM_GNUC 606 | # define LZO_INFO_CC "llvm-gcc" 607 | # define LZO_INFO_CCVER __VERSION__ 608 | #elif defined(__ACK__) && defined(_ACK) 609 | # define LZO_CC_ACK 1 610 | # define LZO_INFO_CC "Amsterdam Compiler Kit C" 611 | # define LZO_INFO_CCVER "unknown" 612 | #elif defined(__ARMCC_VERSION) && !defined(__GNUC__) 613 | # define LZO_CC_ARMCC __ARMCC_VERSION 614 | # define LZO_CC_ARMCC_ARMCC __ARMCC_VERSION 615 | # define LZO_INFO_CC "ARM C Compiler" 616 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__ARMCC_VERSION) 617 | #elif defined(__AZTEC_C__) 618 | # define LZO_CC_AZTECC 1 619 | # define LZO_INFO_CC "Aztec C" 620 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__AZTEC_C__) 621 | #elif defined(__CODEGEARC__) 622 | # define LZO_CC_CODEGEARC 1 623 | # define LZO_INFO_CC "CodeGear C" 624 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__CODEGEARC__) 625 | #elif defined(__BORLANDC__) 626 | # define LZO_CC_BORLANDC 1 627 | # define LZO_INFO_CC "Borland C" 628 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__BORLANDC__) 629 | #elif defined(_CRAYC) && defined(_RELEASE) 630 | # define LZO_CC_CRAYC 1 631 | # define LZO_INFO_CC "Cray C" 632 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_RELEASE) 633 | #elif defined(__DMC__) && defined(__SC__) 634 | # define LZO_CC_DMC 1 635 | # define LZO_INFO_CC "Digital Mars C" 636 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DMC__) 637 | #elif defined(__DECC) 638 | # define LZO_CC_DECC 1 639 | # define LZO_INFO_CC "DEC C" 640 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DECC) 641 | #elif (defined(__ghs) || defined(__ghs__)) && defined(__GHS_VERSION_NUMBER) && ((__GHS_VERSION_NUMBER-0) > 0) 642 | # define LZO_CC_GHS 1 643 | # define LZO_INFO_CC "Green Hills C" 644 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__GHS_VERSION_NUMBER) 645 | # if defined(_MSC_VER) && ((_MSC_VER-0) > 0) 646 | # define LZO_CC_GHS_MSC _MSC_VER 647 | # elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) 648 | # define LZO_CC_GHS_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) 649 | # endif 650 | #elif defined(__HIGHC__) 651 | # define LZO_CC_HIGHC 1 652 | # define LZO_INFO_CC "MetaWare High C" 653 | # define LZO_INFO_CCVER "unknown" 654 | #elif defined(__HP_aCC) && ((__HP_aCC-0) > 0) 655 | # define LZO_CC_HPACC __HP_aCC 656 | # define LZO_INFO_CC "HP aCC" 657 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__HP_aCC) 658 | #elif defined(__IAR_SYSTEMS_ICC__) 659 | # define LZO_CC_IARC 1 660 | # define LZO_INFO_CC "IAR C" 661 | # if defined(__VER__) 662 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__VER__) 663 | # else 664 | # define LZO_INFO_CCVER "unknown" 665 | # endif 666 | #elif defined(__IBMC__) && ((__IBMC__-0) > 0) 667 | # define LZO_CC_IBMC __IBMC__ 668 | # define LZO_INFO_CC "IBM C" 669 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__IBMC__) 670 | #elif defined(__IBMCPP__) && ((__IBMCPP__-0) > 0) 671 | # define LZO_CC_IBMC __IBMCPP__ 672 | # define LZO_INFO_CC "IBM C" 673 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__IBMCPP__) 674 | #elif defined(__KEIL__) && defined(__C166__) 675 | # define LZO_CC_KEILC 1 676 | # define LZO_INFO_CC "Keil C" 677 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__C166__) 678 | #elif defined(__LCC__) && defined(_WIN32) && defined(__LCCOPTIMLEVEL) 679 | # define LZO_CC_LCCWIN32 1 680 | # define LZO_INFO_CC "lcc-win32" 681 | # define LZO_INFO_CCVER "unknown" 682 | #elif defined(__LCC__) 683 | # define LZO_CC_LCC 1 684 | # define LZO_INFO_CC "lcc" 685 | # if defined(__LCC_VERSION__) 686 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__LCC_VERSION__) 687 | # else 688 | # define LZO_INFO_CCVER "unknown" 689 | # endif 690 | #elif defined(__MWERKS__) && ((__MWERKS__-0) > 0) 691 | # define LZO_CC_MWERKS __MWERKS__ 692 | # define LZO_INFO_CC "Metrowerks C" 693 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__MWERKS__) 694 | #elif (defined(__NDPC__) || defined(__NDPX__)) && defined(__i386) 695 | # define LZO_CC_NDPC 1 696 | # define LZO_INFO_CC "Microway NDP C" 697 | # define LZO_INFO_CCVER "unknown" 698 | #elif defined(__PACIFIC__) 699 | # define LZO_CC_PACIFICC 1 700 | # define LZO_INFO_CC "Pacific C" 701 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PACIFIC__) 702 | #elif defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) 703 | # if defined(__PGIC_PATCHLEVEL__) 704 | # define LZO_CC_PGI (__PGIC__ * 0x10000L + (__PGIC_MINOR__-0) * 0x100 + (__PGIC_PATCHLEVEL__-0)) 705 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PGIC__) "." LZO_PP_MACRO_EXPAND(__PGIC_MINOR__) "." LZO_PP_MACRO_EXPAND(__PGIC_PATCHLEVEL__) 706 | # else 707 | # define LZO_CC_PGI (__PGIC__ * 0x10000L + (__PGIC_MINOR__-0) * 0x100) 708 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PGIC__) "." LZO_PP_MACRO_EXPAND(__PGIC_MINOR__) ".0" 709 | # endif 710 | # define LZO_INFO_CC "Portland Group PGI C" 711 | #elif defined(__PGI) && (defined(__linux__) || defined(__WIN32__)) 712 | # define LZO_CC_PGI 1 713 | # define LZO_INFO_CC "Portland Group PGI C" 714 | # define LZO_INFO_CCVER "unknown" 715 | #elif defined(__PUREC__) && defined(__TOS__) 716 | # define LZO_CC_PUREC 1 717 | # define LZO_INFO_CC "Pure C" 718 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PUREC__) 719 | #elif defined(__SC__) && defined(__ZTC__) 720 | # define LZO_CC_SYMANTECC 1 721 | # define LZO_INFO_CC "Symantec C" 722 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SC__) 723 | #elif defined(__SUNPRO_C) 724 | # define LZO_INFO_CC "SunPro C" 725 | # if ((__SUNPRO_C-0) > 0) 726 | # define LZO_CC_SUNPROC __SUNPRO_C 727 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_C) 728 | # else 729 | # define LZO_CC_SUNPROC 1 730 | # define LZO_INFO_CCVER "unknown" 731 | # endif 732 | #elif defined(__SUNPRO_CC) 733 | # define LZO_INFO_CC "SunPro C" 734 | # if ((__SUNPRO_CC-0) > 0) 735 | # define LZO_CC_SUNPROC __SUNPRO_CC 736 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_CC) 737 | # else 738 | # define LZO_CC_SUNPROC 1 739 | # define LZO_INFO_CCVER "unknown" 740 | # endif 741 | #elif defined(__TINYC__) 742 | # define LZO_CC_TINYC 1 743 | # define LZO_INFO_CC "Tiny C" 744 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TINYC__) 745 | #elif defined(__TSC__) 746 | # define LZO_CC_TOPSPEEDC 1 747 | # define LZO_INFO_CC "TopSpeed C" 748 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TSC__) 749 | #elif defined(__WATCOMC__) 750 | # define LZO_CC_WATCOMC 1 751 | # define LZO_INFO_CC "Watcom C" 752 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__WATCOMC__) 753 | #elif defined(__TURBOC__) 754 | # define LZO_CC_TURBOC 1 755 | # define LZO_INFO_CC "Turbo C" 756 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TURBOC__) 757 | #elif defined(__ZTC__) 758 | # define LZO_CC_ZORTECHC 1 759 | # define LZO_INFO_CC "Zortech C" 760 | # if ((__ZTC__-0) == 0x310) 761 | # define LZO_INFO_CCVER "0x310" 762 | # else 763 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__ZTC__) 764 | # endif 765 | #elif defined(__GNUC__) && defined(__VERSION__) 766 | # if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) 767 | # define LZO_CC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) 768 | # elif defined(__GNUC_MINOR__) 769 | # define LZO_CC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100) 770 | # else 771 | # define LZO_CC_GNUC (__GNUC__ * 0x10000L) 772 | # endif 773 | # define LZO_INFO_CC "gcc" 774 | # define LZO_INFO_CCVER __VERSION__ 775 | #elif defined(_MSC_VER) && ((_MSC_VER-0) > 0) 776 | # define LZO_CC_MSC _MSC_VER 777 | # define LZO_INFO_CC "Microsoft C" 778 | # if defined(_MSC_FULL_VER) 779 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) "." LZO_PP_MACRO_EXPAND(_MSC_FULL_VER) 780 | # else 781 | # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) 782 | # endif 783 | #else 784 | # define LZO_CC_UNKNOWN 1 785 | # define LZO_INFO_CC "unknown" 786 | # define LZO_INFO_CCVER "unknown" 787 | #endif 788 | #if (LZO_CC_GNUC) && defined(__OPEN64__) 789 | # if defined(__OPENCC__) && defined(__OPENCC_MINOR__) && defined(__OPENCC_PATCHLEVEL__) 790 | # define LZO_CC_OPEN64 (__OPENCC__ * 0x10000L + (__OPENCC_MINOR__-0) * 0x100 + (__OPENCC_PATCHLEVEL__-0)) 791 | # define LZO_CC_OPEN64_GNUC LZO_CC_GNUC 792 | # endif 793 | #endif 794 | #if (LZO_CC_GNUC) && defined(__PCC__) 795 | # if defined(__PCC__) && defined(__PCC_MINOR__) && defined(__PCC_MINORMINOR__) 796 | # define LZO_CC_PCC (__PCC__ * 0x10000L + (__PCC_MINOR__-0) * 0x100 + (__PCC_MINORMINOR__-0)) 797 | # define LZO_CC_PCC_GNUC LZO_CC_GNUC 798 | # endif 799 | #endif 800 | #if 0 && (LZO_CC_MSC && (_MSC_VER >= 1200)) && !defined(_MSC_FULL_VER) 801 | # error "LZO_CC_MSC: _MSC_FULL_VER is not defined" 802 | #endif 803 | #if !defined(__LZO_ARCH_OVERRIDE) && !(LZO_ARCH_GENERIC) && defined(_CRAY) 804 | # if (UINT_MAX > LZO_0xffffffffL) && defined(_CRAY) 805 | # if defined(_CRAYMPP) || defined(_CRAYT3D) || defined(_CRAYT3E) 806 | # define LZO_ARCH_CRAY_MPP 1 807 | # elif defined(_CRAY1) 808 | # define LZO_ARCH_CRAY_PVP 1 809 | # endif 810 | # endif 811 | #endif 812 | #if !defined(__LZO_ARCH_OVERRIDE) 813 | #if (LZO_ARCH_GENERIC) 814 | # define LZO_INFO_ARCH "generic" 815 | #elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) 816 | # define LZO_ARCH_I086 1 817 | # define LZO_INFO_ARCH "i086" 818 | #elif defined(__aarch64__) || defined(_M_ARM64) 819 | # define LZO_ARCH_ARM64 1 820 | # define LZO_INFO_ARCH "arm64" 821 | #elif defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA) 822 | # define LZO_ARCH_ALPHA 1 823 | # define LZO_INFO_ARCH "alpha" 824 | #elif (LZO_ARCH_CRAY_MPP) && (defined(_CRAYT3D) || defined(_CRAYT3E)) 825 | # define LZO_ARCH_ALPHA 1 826 | # define LZO_INFO_ARCH "alpha" 827 | #elif defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64) 828 | # define LZO_ARCH_AMD64 1 829 | # define LZO_INFO_ARCH "amd64" 830 | #elif defined(__arm__) || defined(_M_ARM) 831 | # define LZO_ARCH_ARM 1 832 | # define LZO_INFO_ARCH "arm" 833 | #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCARM__) 834 | # define LZO_ARCH_ARM 1 835 | # define LZO_INFO_ARCH "arm" 836 | #elif (UINT_MAX <= LZO_0xffffL) && defined(__AVR__) 837 | # define LZO_ARCH_AVR 1 838 | # define LZO_INFO_ARCH "avr" 839 | #elif defined(__avr32__) || defined(__AVR32__) 840 | # define LZO_ARCH_AVR32 1 841 | # define LZO_INFO_ARCH "avr32" 842 | #elif defined(__bfin__) 843 | # define LZO_ARCH_BLACKFIN 1 844 | # define LZO_INFO_ARCH "blackfin" 845 | #elif (UINT_MAX == LZO_0xffffL) && defined(__C166__) 846 | # define LZO_ARCH_C166 1 847 | # define LZO_INFO_ARCH "c166" 848 | #elif defined(__cris__) 849 | # define LZO_ARCH_CRIS 1 850 | # define LZO_INFO_ARCH "cris" 851 | #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCEZ80__) 852 | # define LZO_ARCH_EZ80 1 853 | # define LZO_INFO_ARCH "ez80" 854 | #elif defined(__H8300__) || defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) 855 | # define LZO_ARCH_H8300 1 856 | # define LZO_INFO_ARCH "h8300" 857 | #elif defined(__hppa__) || defined(__hppa) 858 | # define LZO_ARCH_HPPA 1 859 | # define LZO_INFO_ARCH "hppa" 860 | #elif defined(__386__) || defined(__i386__) || defined(__i386) || defined(_M_IX86) || defined(_M_I386) 861 | # define LZO_ARCH_I386 1 862 | # define LZO_ARCH_IA32 1 863 | # define LZO_INFO_ARCH "i386" 864 | #elif (LZO_CC_ZORTECHC && defined(__I86__)) 865 | # define LZO_ARCH_I386 1 866 | # define LZO_ARCH_IA32 1 867 | # define LZO_INFO_ARCH "i386" 868 | #elif (LZO_OS_DOS32 && LZO_CC_HIGHC) && defined(_I386) 869 | # define LZO_ARCH_I386 1 870 | # define LZO_ARCH_IA32 1 871 | # define LZO_INFO_ARCH "i386" 872 | #elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64) 873 | # define LZO_ARCH_IA64 1 874 | # define LZO_INFO_ARCH "ia64" 875 | #elif (UINT_MAX == LZO_0xffffL) && defined(__m32c__) 876 | # define LZO_ARCH_M16C 1 877 | # define LZO_INFO_ARCH "m16c" 878 | #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCM16C__) 879 | # define LZO_ARCH_M16C 1 880 | # define LZO_INFO_ARCH "m16c" 881 | #elif defined(__m32r__) 882 | # define LZO_ARCH_M32R 1 883 | # define LZO_INFO_ARCH "m32r" 884 | #elif (LZO_OS_TOS) || defined(__m68k__) || defined(__m68000__) || defined(__mc68000__) || defined(__mc68020__) || defined(_M_M68K) 885 | # define LZO_ARCH_M68K 1 886 | # define LZO_INFO_ARCH "m68k" 887 | #elif (UINT_MAX == LZO_0xffffL) && defined(__C251__) 888 | # define LZO_ARCH_MCS251 1 889 | # define LZO_INFO_ARCH "mcs251" 890 | #elif (UINT_MAX == LZO_0xffffL) && defined(__C51__) 891 | # define LZO_ARCH_MCS51 1 892 | # define LZO_INFO_ARCH "mcs51" 893 | #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC8051__) 894 | # define LZO_ARCH_MCS51 1 895 | # define LZO_INFO_ARCH "mcs51" 896 | #elif defined(__mips__) || defined(__mips) || defined(_MIPS_ARCH) || defined(_M_MRX000) 897 | # define LZO_ARCH_MIPS 1 898 | # define LZO_INFO_ARCH "mips" 899 | #elif (UINT_MAX == LZO_0xffffL) && defined(__MSP430__) 900 | # define LZO_ARCH_MSP430 1 901 | # define LZO_INFO_ARCH "msp430" 902 | #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC430__) 903 | # define LZO_ARCH_MSP430 1 904 | # define LZO_INFO_ARCH "msp430" 905 | #elif defined(__powerpc__) || defined(__powerpc) || defined(__ppc__) || defined(__PPC__) || defined(_M_PPC) || defined(_ARCH_PPC) || defined(_ARCH_PWR) 906 | # define LZO_ARCH_POWERPC 1 907 | # define LZO_INFO_ARCH "powerpc" 908 | #elif defined(__powerpc64__) || defined(__powerpc64) || defined(__ppc64__) || defined(__PPC64__) 909 | # define LZO_ARCH_POWERPC 1 910 | # define LZO_INFO_ARCH "powerpc" 911 | #elif defined(__powerpc64le__) || defined(__powerpc64le) || defined(__ppc64le__) || defined(__PPC64LE__) 912 | # define LZO_ARCH_POWERPC 1 913 | # define LZO_INFO_ARCH "powerpc" 914 | #elif defined(__riscv) 915 | # define LZO_ARCH_RISCV 1 916 | # define LZO_INFO_ARCH "riscv" 917 | #elif defined(__s390__) || defined(__s390) || defined(__s390x__) || defined(__s390x) 918 | # define LZO_ARCH_S390 1 919 | # define LZO_INFO_ARCH "s390" 920 | #elif defined(__sh__) || defined(_M_SH) 921 | # define LZO_ARCH_SH 1 922 | # define LZO_INFO_ARCH "sh" 923 | #elif defined(__sparc__) || defined(__sparc) || defined(__sparcv8) 924 | # define LZO_ARCH_SPARC 1 925 | # define LZO_INFO_ARCH "sparc" 926 | #elif defined(__SPU__) 927 | # define LZO_ARCH_SPU 1 928 | # define LZO_INFO_ARCH "spu" 929 | #elif (UINT_MAX == LZO_0xffffL) && defined(__z80) 930 | # define LZO_ARCH_Z80 1 931 | # define LZO_INFO_ARCH "z80" 932 | #elif (LZO_ARCH_CRAY_PVP) 933 | # if defined(_CRAYSV1) 934 | # define LZO_ARCH_CRAY_SV1 1 935 | # define LZO_INFO_ARCH "cray_sv1" 936 | # elif (_ADDR64) 937 | # define LZO_ARCH_CRAY_T90 1 938 | # define LZO_INFO_ARCH "cray_t90" 939 | # elif (_ADDR32) 940 | # define LZO_ARCH_CRAY_YMP 1 941 | # define LZO_INFO_ARCH "cray_ymp" 942 | # else 943 | # define LZO_ARCH_CRAY_XMP 1 944 | # define LZO_INFO_ARCH "cray_xmp" 945 | # endif 946 | #else 947 | # define LZO_ARCH_UNKNOWN 1 948 | # define LZO_INFO_ARCH "unknown" 949 | #endif 950 | #endif 951 | #if !defined(LZO_ARCH_ARM_THUMB2) 952 | #if (LZO_ARCH_ARM) 953 | # if defined(__thumb__) || defined(__thumb) || defined(_M_THUMB) 954 | # if defined(__thumb2__) 955 | # define LZO_ARCH_ARM_THUMB2 1 956 | # elif 1 && defined(__TARGET_ARCH_THUMB) && ((__TARGET_ARCH_THUMB)+0 >= 4) 957 | # define LZO_ARCH_ARM_THUMB2 1 958 | # elif 1 && defined(_MSC_VER) && defined(_M_THUMB) && ((_M_THUMB)+0 >= 7) 959 | # define LZO_ARCH_ARM_THUMB2 1 960 | # endif 961 | # endif 962 | #endif 963 | #endif 964 | #if (LZO_ARCH_ARM_THUMB2) 965 | # undef LZO_INFO_ARCH 966 | # define LZO_INFO_ARCH "arm_thumb2" 967 | #endif 968 | #if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_DOS32 || LZO_OS_OS2) 969 | # error "FIXME - missing define for CPU architecture" 970 | #endif 971 | #if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN32) 972 | # error "FIXME - missing LZO_OS_WIN32 define for CPU architecture" 973 | #endif 974 | #if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN64) 975 | # error "FIXME - missing LZO_OS_WIN64 define for CPU architecture" 976 | #endif 977 | #if (LZO_OS_OS216 || LZO_OS_WIN16) 978 | # define LZO_ARCH_I086PM 1 979 | #elif 1 && (LZO_OS_DOS16 && defined(BLX286)) 980 | # define LZO_ARCH_I086PM 1 981 | #elif 1 && (LZO_OS_DOS16 && defined(DOSX286)) 982 | # define LZO_ARCH_I086PM 1 983 | #elif 1 && (LZO_OS_DOS16 && LZO_CC_BORLANDC && defined(__DPMI16__)) 984 | # define LZO_ARCH_I086PM 1 985 | #endif 986 | #if (LZO_ARCH_AMD64 && !LZO_ARCH_X64) 987 | # define LZO_ARCH_X64 1 988 | #elif (!LZO_ARCH_AMD64 && LZO_ARCH_X64) && defined(__LZO_ARCH_OVERRIDE) 989 | # define LZO_ARCH_AMD64 1 990 | #endif 991 | #if (LZO_ARCH_ARM64 && !LZO_ARCH_AARCH64) 992 | # define LZO_ARCH_AARCH64 1 993 | #elif (!LZO_ARCH_ARM64 && LZO_ARCH_AARCH64) && defined(__LZO_ARCH_OVERRIDE) 994 | # define LZO_ARCH_ARM64 1 995 | #endif 996 | #if (LZO_ARCH_I386 && !LZO_ARCH_X86) 997 | # define LZO_ARCH_X86 1 998 | #elif (!LZO_ARCH_I386 && LZO_ARCH_X86) && defined(__LZO_ARCH_OVERRIDE) 999 | # define LZO_ARCH_I386 1 1000 | #endif 1001 | #if (LZO_ARCH_AMD64 && !LZO_ARCH_X64) || (!LZO_ARCH_AMD64 && LZO_ARCH_X64) 1002 | # error "unexpected configuration - check your compiler defines" 1003 | #endif 1004 | #if (LZO_ARCH_ARM64 && !LZO_ARCH_AARCH64) || (!LZO_ARCH_ARM64 && LZO_ARCH_AARCH64) 1005 | # error "unexpected configuration - check your compiler defines" 1006 | #endif 1007 | #if (LZO_ARCH_I386 && !LZO_ARCH_X86) || (!LZO_ARCH_I386 && LZO_ARCH_X86) 1008 | # error "unexpected configuration - check your compiler defines" 1009 | #endif 1010 | #if (LZO_ARCH_ARM_THUMB1 && !LZO_ARCH_ARM) 1011 | # error "unexpected configuration - check your compiler defines" 1012 | #endif 1013 | #if (LZO_ARCH_ARM_THUMB2 && !LZO_ARCH_ARM) 1014 | # error "unexpected configuration - check your compiler defines" 1015 | #endif 1016 | #if (LZO_ARCH_ARM_THUMB1 && LZO_ARCH_ARM_THUMB2) 1017 | # error "unexpected configuration - check your compiler defines" 1018 | #endif 1019 | #if (LZO_ARCH_I086PM && !LZO_ARCH_I086) 1020 | # error "unexpected configuration - check your compiler defines" 1021 | #endif 1022 | #if (LZO_ARCH_I086) 1023 | # if (UINT_MAX != LZO_0xffffL) 1024 | # error "unexpected configuration - check your compiler defines" 1025 | # endif 1026 | # if (ULONG_MAX != LZO_0xffffffffL) 1027 | # error "unexpected configuration - check your compiler defines" 1028 | # endif 1029 | #endif 1030 | #if (LZO_ARCH_I386) 1031 | # if (UINT_MAX != LZO_0xffffL) && defined(__i386_int16__) 1032 | # error "unexpected configuration - check your compiler defines" 1033 | # endif 1034 | # if (UINT_MAX != LZO_0xffffffffL) && !defined(__i386_int16__) 1035 | # error "unexpected configuration - check your compiler defines" 1036 | # endif 1037 | # if (ULONG_MAX != LZO_0xffffffffL) 1038 | # error "unexpected configuration - check your compiler defines" 1039 | # endif 1040 | #endif 1041 | #if (LZO_ARCH_AMD64 || LZO_ARCH_I386) 1042 | # if !defined(LZO_TARGET_FEATURE_SSE2) 1043 | # if defined(__SSE2__) 1044 | # define LZO_TARGET_FEATURE_SSE2 1 1045 | # elif defined(_MSC_VER) && (defined(_M_IX86_FP) && ((_M_IX86_FP)+0 >= 2)) 1046 | # define LZO_TARGET_FEATURE_SSE2 1 1047 | # elif (LZO_CC_INTELC_MSC || LZO_CC_MSC) && defined(_M_AMD64) 1048 | # define LZO_TARGET_FEATURE_SSE2 1 1049 | # endif 1050 | # endif 1051 | # if !defined(LZO_TARGET_FEATURE_SSSE3) 1052 | # if (LZO_TARGET_FEATURE_SSE2) 1053 | # if defined(__SSSE3__) 1054 | # define LZO_TARGET_FEATURE_SSSE3 1 1055 | # elif defined(_MSC_VER) && defined(__AVX__) 1056 | # define LZO_TARGET_FEATURE_SSSE3 1 1057 | # endif 1058 | # endif 1059 | # endif 1060 | # if !defined(LZO_TARGET_FEATURE_SSE4_2) 1061 | # if (LZO_TARGET_FEATURE_SSSE3) 1062 | # if defined(__SSE4_2__) 1063 | # define LZO_TARGET_FEATURE_SSE4_2 1 1064 | # endif 1065 | # endif 1066 | # endif 1067 | # if !defined(LZO_TARGET_FEATURE_AVX) 1068 | # if (LZO_TARGET_FEATURE_SSSE3) 1069 | # if defined(__AVX__) 1070 | # define LZO_TARGET_FEATURE_AVX 1 1071 | # endif 1072 | # endif 1073 | # endif 1074 | # if !defined(LZO_TARGET_FEATURE_AVX2) 1075 | # if (LZO_TARGET_FEATURE_AVX) 1076 | # if defined(__AVX2__) 1077 | # define LZO_TARGET_FEATURE_AVX2 1 1078 | # endif 1079 | # endif 1080 | # endif 1081 | #endif 1082 | #if (LZO_TARGET_FEATURE_SSSE3 && !(LZO_TARGET_FEATURE_SSE2)) 1083 | # error "unexpected configuration - check your compiler defines" 1084 | #endif 1085 | #if (LZO_TARGET_FEATURE_SSE4_2 && !(LZO_TARGET_FEATURE_SSSE3)) 1086 | # error "unexpected configuration - check your compiler defines" 1087 | #endif 1088 | #if (LZO_TARGET_FEATURE_AVX && !(LZO_TARGET_FEATURE_SSSE3)) 1089 | # error "unexpected configuration - check your compiler defines" 1090 | #endif 1091 | #if (LZO_TARGET_FEATURE_AVX2 && !(LZO_TARGET_FEATURE_AVX)) 1092 | # error "unexpected configuration - check your compiler defines" 1093 | #endif 1094 | #if (LZO_ARCH_ARM) 1095 | # if !defined(LZO_TARGET_FEATURE_NEON) 1096 | # if defined(__ARM_NEON) && ((__ARM_NEON)+0) 1097 | # define LZO_TARGET_FEATURE_NEON 1 1098 | # elif 1 && defined(__ARM_NEON__) && ((__ARM_NEON__)+0) 1099 | # define LZO_TARGET_FEATURE_NEON 1 1100 | # elif 1 && defined(__TARGET_FEATURE_NEON) && ((__TARGET_FEATURE_NEON)+0) 1101 | # define LZO_TARGET_FEATURE_NEON 1 1102 | # endif 1103 | # endif 1104 | #elif (LZO_ARCH_ARM64) 1105 | # if !defined(LZO_TARGET_FEATURE_NEON) 1106 | # if 1 1107 | # define LZO_TARGET_FEATURE_NEON 1 1108 | # endif 1109 | # endif 1110 | #endif 1111 | #if 0 1112 | #elif !defined(__LZO_MM_OVERRIDE) 1113 | #if (LZO_ARCH_I086) 1114 | #if (UINT_MAX != LZO_0xffffL) 1115 | # error "unexpected configuration - check your compiler defines" 1116 | #endif 1117 | #if defined(__TINY__) || defined(M_I86TM) || defined(_M_I86TM) 1118 | # define LZO_MM_TINY 1 1119 | #elif defined(__HUGE__) || defined(_HUGE_) || defined(M_I86HM) || defined(_M_I86HM) 1120 | # define LZO_MM_HUGE 1 1121 | #elif defined(__SMALL__) || defined(M_I86SM) || defined(_M_I86SM) || defined(SMALL_MODEL) 1122 | # define LZO_MM_SMALL 1 1123 | #elif defined(__MEDIUM__) || defined(M_I86MM) || defined(_M_I86MM) 1124 | # define LZO_MM_MEDIUM 1 1125 | #elif defined(__COMPACT__) || defined(M_I86CM) || defined(_M_I86CM) 1126 | # define LZO_MM_COMPACT 1 1127 | #elif defined(__LARGE__) || defined(M_I86LM) || defined(_M_I86LM) || defined(LARGE_MODEL) 1128 | # define LZO_MM_LARGE 1 1129 | #elif (LZO_CC_AZTECC) 1130 | # if defined(_LARGE_CODE) && defined(_LARGE_DATA) 1131 | # define LZO_MM_LARGE 1 1132 | # elif defined(_LARGE_CODE) 1133 | # define LZO_MM_MEDIUM 1 1134 | # elif defined(_LARGE_DATA) 1135 | # define LZO_MM_COMPACT 1 1136 | # else 1137 | # define LZO_MM_SMALL 1 1138 | # endif 1139 | #elif (LZO_CC_ZORTECHC && defined(__VCM__)) 1140 | # define LZO_MM_LARGE 1 1141 | #else 1142 | # error "unknown LZO_ARCH_I086 memory model" 1143 | #endif 1144 | #if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) 1145 | #define LZO_HAVE_MM_HUGE_PTR 1 1146 | #define LZO_HAVE_MM_HUGE_ARRAY 1 1147 | #if (LZO_MM_TINY) 1148 | # undef LZO_HAVE_MM_HUGE_ARRAY 1149 | #endif 1150 | #if (LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_ZORTECHC) 1151 | # undef LZO_HAVE_MM_HUGE_PTR 1152 | # undef LZO_HAVE_MM_HUGE_ARRAY 1153 | #elif (LZO_CC_DMC || LZO_CC_SYMANTECC) 1154 | # undef LZO_HAVE_MM_HUGE_ARRAY 1155 | #elif (LZO_CC_MSC && defined(_QC)) 1156 | # undef LZO_HAVE_MM_HUGE_ARRAY 1157 | # if (_MSC_VER < 600) 1158 | # undef LZO_HAVE_MM_HUGE_PTR 1159 | # endif 1160 | #elif (LZO_CC_TURBOC && (__TURBOC__ < 0x0295)) 1161 | # undef LZO_HAVE_MM_HUGE_ARRAY 1162 | #endif 1163 | #if (LZO_ARCH_I086PM) && !(LZO_HAVE_MM_HUGE_PTR) 1164 | # if (LZO_OS_DOS16) 1165 | # error "unexpected configuration - check your compiler defines" 1166 | # elif (LZO_CC_ZORTECHC) 1167 | # else 1168 | # error "unexpected configuration - check your compiler defines" 1169 | # endif 1170 | #endif 1171 | #if defined(__cplusplus) 1172 | extern "C" { 1173 | #endif 1174 | #if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0200)) 1175 | extern void __near __cdecl _AHSHIFT(void); 1176 | # define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) 1177 | #elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) 1178 | extern void __near __cdecl _AHSHIFT(void); 1179 | # define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) 1180 | #elif (LZO_CC_MSC || LZO_CC_TOPSPEEDC) 1181 | extern void __near __cdecl _AHSHIFT(void); 1182 | # define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) 1183 | #elif (LZO_CC_TURBOC && (__TURBOC__ >= 0x0295)) 1184 | extern void __near __cdecl _AHSHIFT(void); 1185 | # define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) 1186 | #elif ((LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_TURBOC) && LZO_OS_DOS16) 1187 | # define LZO_MM_AHSHIFT 12 1188 | #elif (LZO_CC_WATCOMC) 1189 | extern unsigned char _HShift; 1190 | # define LZO_MM_AHSHIFT ((unsigned) _HShift) 1191 | #else 1192 | # error "FIXME - implement LZO_MM_AHSHIFT" 1193 | #endif 1194 | #if defined(__cplusplus) 1195 | } 1196 | #endif 1197 | #endif 1198 | #elif (LZO_ARCH_C166) 1199 | #if !defined(__MODEL__) 1200 | # error "FIXME - LZO_ARCH_C166 __MODEL__" 1201 | #elif ((__MODEL__) == 0) 1202 | # define LZO_MM_SMALL 1 1203 | #elif ((__MODEL__) == 1) 1204 | # define LZO_MM_SMALL 1 1205 | #elif ((__MODEL__) == 2) 1206 | # define LZO_MM_LARGE 1 1207 | #elif ((__MODEL__) == 3) 1208 | # define LZO_MM_TINY 1 1209 | #elif ((__MODEL__) == 4) 1210 | # define LZO_MM_XTINY 1 1211 | #elif ((__MODEL__) == 5) 1212 | # define LZO_MM_XSMALL 1 1213 | #else 1214 | # error "FIXME - LZO_ARCH_C166 __MODEL__" 1215 | #endif 1216 | #elif (LZO_ARCH_MCS251) 1217 | #if !defined(__MODEL__) 1218 | # error "FIXME - LZO_ARCH_MCS251 __MODEL__" 1219 | #elif ((__MODEL__) == 0) 1220 | # define LZO_MM_SMALL 1 1221 | #elif ((__MODEL__) == 2) 1222 | # define LZO_MM_LARGE 1 1223 | #elif ((__MODEL__) == 3) 1224 | # define LZO_MM_TINY 1 1225 | #elif ((__MODEL__) == 4) 1226 | # define LZO_MM_XTINY 1 1227 | #elif ((__MODEL__) == 5) 1228 | # define LZO_MM_XSMALL 1 1229 | #else 1230 | # error "FIXME - LZO_ARCH_MCS251 __MODEL__" 1231 | #endif 1232 | #elif (LZO_ARCH_MCS51) 1233 | #if !defined(__MODEL__) 1234 | # error "FIXME - LZO_ARCH_MCS51 __MODEL__" 1235 | #elif ((__MODEL__) == 1) 1236 | # define LZO_MM_SMALL 1 1237 | #elif ((__MODEL__) == 2) 1238 | # define LZO_MM_LARGE 1 1239 | #elif ((__MODEL__) == 3) 1240 | # define LZO_MM_TINY 1 1241 | #elif ((__MODEL__) == 4) 1242 | # define LZO_MM_XTINY 1 1243 | #elif ((__MODEL__) == 5) 1244 | # define LZO_MM_XSMALL 1 1245 | #else 1246 | # error "FIXME - LZO_ARCH_MCS51 __MODEL__" 1247 | #endif 1248 | #elif (LZO_ARCH_CRAY_PVP) 1249 | # define LZO_MM_PVP 1 1250 | #else 1251 | # define LZO_MM_FLAT 1 1252 | #endif 1253 | #if (LZO_MM_COMPACT) 1254 | # define LZO_INFO_MM "compact" 1255 | #elif (LZO_MM_FLAT) 1256 | # define LZO_INFO_MM "flat" 1257 | #elif (LZO_MM_HUGE) 1258 | # define LZO_INFO_MM "huge" 1259 | #elif (LZO_MM_LARGE) 1260 | # define LZO_INFO_MM "large" 1261 | #elif (LZO_MM_MEDIUM) 1262 | # define LZO_INFO_MM "medium" 1263 | #elif (LZO_MM_PVP) 1264 | # define LZO_INFO_MM "pvp" 1265 | #elif (LZO_MM_SMALL) 1266 | # define LZO_INFO_MM "small" 1267 | #elif (LZO_MM_TINY) 1268 | # define LZO_INFO_MM "tiny" 1269 | #else 1270 | # error "unknown memory model" 1271 | #endif 1272 | #endif 1273 | #if !defined(__lzo_gnuc_extension__) 1274 | #if (LZO_CC_GNUC >= 0x020800ul) 1275 | # define __lzo_gnuc_extension__ __extension__ 1276 | #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) 1277 | # define __lzo_gnuc_extension__ __extension__ 1278 | #elif (LZO_CC_IBMC >= 600) 1279 | # define __lzo_gnuc_extension__ __extension__ 1280 | #endif 1281 | #endif 1282 | #if !defined(__lzo_gnuc_extension__) 1283 | # define __lzo_gnuc_extension__ /*empty*/ 1284 | #endif 1285 | #if !defined(lzo_has_builtin) 1286 | #if (LZO_CC_CLANG) && defined(__has_builtin) 1287 | # define lzo_has_builtin __has_builtin 1288 | #endif 1289 | #endif 1290 | #if !defined(lzo_has_builtin) 1291 | # define lzo_has_builtin(x) 0 1292 | #endif 1293 | #if !defined(lzo_has_attribute) 1294 | #if (LZO_CC_CLANG) && defined(__has_attribute) 1295 | # define lzo_has_attribute __has_attribute 1296 | #endif 1297 | #endif 1298 | #if !defined(lzo_has_attribute) 1299 | # define lzo_has_attribute(x) 0 1300 | #endif 1301 | #if !defined(lzo_has_declspec_attribute) 1302 | #if (LZO_CC_CLANG) && defined(__has_declspec_attribute) 1303 | # define lzo_has_declspec_attribute __has_declspec_attribute 1304 | #endif 1305 | #endif 1306 | #if !defined(lzo_has_declspec_attribute) 1307 | # define lzo_has_declspec_attribute(x) 0 1308 | #endif 1309 | #if !defined(lzo_has_feature) 1310 | #if (LZO_CC_CLANG) && defined(__has_feature) 1311 | # define lzo_has_feature __has_feature 1312 | #endif 1313 | #endif 1314 | #if !defined(lzo_has_feature) 1315 | # define lzo_has_feature(x) 0 1316 | #endif 1317 | #if !defined(lzo_has_extension) 1318 | #if (LZO_CC_CLANG) && defined(__has_extension) 1319 | # define lzo_has_extension __has_extension 1320 | #elif (LZO_CC_CLANG) && defined(__has_feature) 1321 | # define lzo_has_extension __has_feature 1322 | #endif 1323 | #endif 1324 | #if !defined(lzo_has_extension) 1325 | # define lzo_has_extension(x) 0 1326 | #endif 1327 | #if !defined(LZO_CFG_USE_NEW_STYLE_CASTS) && defined(__cplusplus) && 0 1328 | # if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul)) 1329 | # define LZO_CFG_USE_NEW_STYLE_CASTS 0 1330 | # elif (LZO_CC_INTELC && (__INTEL_COMPILER < 1200)) 1331 | # define LZO_CFG_USE_NEW_STYLE_CASTS 0 1332 | # else 1333 | # define LZO_CFG_USE_NEW_STYLE_CASTS 1 1334 | # endif 1335 | #endif 1336 | #if !defined(LZO_CFG_USE_NEW_STYLE_CASTS) 1337 | # define LZO_CFG_USE_NEW_STYLE_CASTS 0 1338 | #endif 1339 | #if !defined(__cplusplus) 1340 | # if defined(LZO_CFG_USE_NEW_STYLE_CASTS) 1341 | # undef LZO_CFG_USE_NEW_STYLE_CASTS 1342 | # endif 1343 | # define LZO_CFG_USE_NEW_STYLE_CASTS 0 1344 | #endif 1345 | #if !defined(LZO_REINTERPRET_CAST) 1346 | # if (LZO_CFG_USE_NEW_STYLE_CASTS) 1347 | # define LZO_REINTERPRET_CAST(t,e) (reinterpret_cast (e)) 1348 | # endif 1349 | #endif 1350 | #if !defined(LZO_REINTERPRET_CAST) 1351 | # define LZO_REINTERPRET_CAST(t,e) ((t) (e)) 1352 | #endif 1353 | #if !defined(LZO_STATIC_CAST) 1354 | # if (LZO_CFG_USE_NEW_STYLE_CASTS) 1355 | # define LZO_STATIC_CAST(t,e) (static_cast (e)) 1356 | # endif 1357 | #endif 1358 | #if !defined(LZO_STATIC_CAST) 1359 | # define LZO_STATIC_CAST(t,e) ((t) (e)) 1360 | #endif 1361 | #if !defined(LZO_STATIC_CAST2) 1362 | # define LZO_STATIC_CAST2(t1,t2,e) LZO_STATIC_CAST(t1, LZO_STATIC_CAST(t2, e)) 1363 | #endif 1364 | #if !defined(LZO_UNCONST_CAST) 1365 | # if (LZO_CFG_USE_NEW_STYLE_CASTS) 1366 | # define LZO_UNCONST_CAST(t,e) (const_cast (e)) 1367 | # elif (LZO_HAVE_MM_HUGE_PTR) 1368 | # define LZO_UNCONST_CAST(t,e) ((t) (e)) 1369 | # elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) 1370 | # define LZO_UNCONST_CAST(t,e) ((t) ((void *) ((lzo_uintptr_t) ((const void *) (e))))) 1371 | # endif 1372 | #endif 1373 | #if !defined(LZO_UNCONST_CAST) 1374 | # define LZO_UNCONST_CAST(t,e) ((t) ((void *) ((const void *) (e)))) 1375 | #endif 1376 | #if !defined(LZO_UNCONST_VOLATILE_CAST) 1377 | # if (LZO_CFG_USE_NEW_STYLE_CASTS) 1378 | # define LZO_UNCONST_VOLATILE_CAST(t,e) (const_cast (e)) 1379 | # elif (LZO_HAVE_MM_HUGE_PTR) 1380 | # define LZO_UNCONST_VOLATILE_CAST(t,e) ((t) (e)) 1381 | # elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) 1382 | # define LZO_UNCONST_VOLATILE_CAST(t,e) ((t) ((volatile void *) ((lzo_uintptr_t) ((volatile const void *) (e))))) 1383 | # endif 1384 | #endif 1385 | #if !defined(LZO_UNCONST_VOLATILE_CAST) 1386 | # define LZO_UNCONST_VOLATILE_CAST(t,e) ((t) ((volatile void *) ((volatile const void *) (e)))) 1387 | #endif 1388 | #if !defined(LZO_UNVOLATILE_CAST) 1389 | # if (LZO_CFG_USE_NEW_STYLE_CASTS) 1390 | # define LZO_UNVOLATILE_CAST(t,e) (const_cast (e)) 1391 | # elif (LZO_HAVE_MM_HUGE_PTR) 1392 | # define LZO_UNVOLATILE_CAST(t,e) ((t) (e)) 1393 | # elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) 1394 | # define LZO_UNVOLATILE_CAST(t,e) ((t) ((void *) ((lzo_uintptr_t) ((volatile void *) (e))))) 1395 | # endif 1396 | #endif 1397 | #if !defined(LZO_UNVOLATILE_CAST) 1398 | # define LZO_UNVOLATILE_CAST(t,e) ((t) ((void *) ((volatile void *) (e)))) 1399 | #endif 1400 | #if !defined(LZO_UNVOLATILE_CONST_CAST) 1401 | # if (LZO_CFG_USE_NEW_STYLE_CASTS) 1402 | # define LZO_UNVOLATILE_CONST_CAST(t,e) (const_cast (e)) 1403 | # elif (LZO_HAVE_MM_HUGE_PTR) 1404 | # define LZO_UNVOLATILE_CONST_CAST(t,e) ((t) (e)) 1405 | # elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) 1406 | # define LZO_UNVOLATILE_CONST_CAST(t,e) ((t) ((const void *) ((lzo_uintptr_t) ((volatile const void *) (e))))) 1407 | # endif 1408 | #endif 1409 | #if !defined(LZO_UNVOLATILE_CONST_CAST) 1410 | # define LZO_UNVOLATILE_CONST_CAST(t,e) ((t) ((const void *) ((volatile const void *) (e)))) 1411 | #endif 1412 | #if !defined(LZO_PCAST) 1413 | # if (LZO_HAVE_MM_HUGE_PTR) 1414 | # define LZO_PCAST(t,e) ((t) (e)) 1415 | # endif 1416 | #endif 1417 | #if !defined(LZO_PCAST) 1418 | # define LZO_PCAST(t,e) LZO_STATIC_CAST(t, LZO_STATIC_CAST(void *, e)) 1419 | #endif 1420 | #if !defined(LZO_CCAST) 1421 | # if (LZO_HAVE_MM_HUGE_PTR) 1422 | # define LZO_CCAST(t,e) ((t) (e)) 1423 | # endif 1424 | #endif 1425 | #if !defined(LZO_CCAST) 1426 | # define LZO_CCAST(t,e) LZO_STATIC_CAST(t, LZO_STATIC_CAST(const void *, e)) 1427 | #endif 1428 | #if !defined(LZO_ICONV) 1429 | # define LZO_ICONV(t,e) LZO_STATIC_CAST(t, e) 1430 | #endif 1431 | #if !defined(LZO_ICAST) 1432 | # define LZO_ICAST(t,e) LZO_STATIC_CAST(t, e) 1433 | #endif 1434 | #if !defined(LZO_ITRUNC) 1435 | # define LZO_ITRUNC(t,e) LZO_STATIC_CAST(t, e) 1436 | #endif 1437 | #if !defined(__lzo_cte) 1438 | # if (LZO_CC_MSC || LZO_CC_WATCOMC) 1439 | # define __lzo_cte(e) ((void)0,(e)) 1440 | # elif 1 1441 | # define __lzo_cte(e) ((void)0,(e)) 1442 | # endif 1443 | #endif 1444 | #if !defined(__lzo_cte) 1445 | # define __lzo_cte(e) (e) 1446 | #endif 1447 | #if !defined(LZO_BLOCK_BEGIN) 1448 | # define LZO_BLOCK_BEGIN do { 1449 | # define LZO_BLOCK_END } while __lzo_cte(0) 1450 | #endif 1451 | #if !defined(LZO_UNUSED) 1452 | # if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) 1453 | # define LZO_UNUSED(var) ((void) &var) 1454 | # elif (LZO_CC_BORLANDC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PELLESC || LZO_CC_TURBOC) 1455 | # define LZO_UNUSED(var) if (&var) ; else 1456 | # elif (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x030200ul)) 1457 | # define LZO_UNUSED(var) ((void) &var) 1458 | # elif (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) 1459 | # define LZO_UNUSED(var) ((void) var) 1460 | # elif (LZO_CC_MSC && (_MSC_VER < 900)) 1461 | # define LZO_UNUSED(var) if (&var) ; else 1462 | # elif (LZO_CC_KEILC) 1463 | # define LZO_UNUSED(var) {extern int lzo_unused__[1-2*!(sizeof(var)>0)]; (void)lzo_unused__;} 1464 | # elif (LZO_CC_PACIFICC) 1465 | # define LZO_UNUSED(var) ((void) sizeof(var)) 1466 | # elif (LZO_CC_WATCOMC) && defined(__cplusplus) 1467 | # define LZO_UNUSED(var) ((void) var) 1468 | # else 1469 | # define LZO_UNUSED(var) ((void) &var) 1470 | # endif 1471 | #endif 1472 | #if !defined(LZO_UNUSED_RESULT) 1473 | # define LZO_UNUSED_RESULT(var) LZO_UNUSED(var) 1474 | #endif 1475 | #if !defined(LZO_UNUSED_FUNC) 1476 | # if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) 1477 | # define LZO_UNUSED_FUNC(func) ((void) func) 1478 | # elif (LZO_CC_BORLANDC || LZO_CC_NDPC || LZO_CC_TURBOC) 1479 | # define LZO_UNUSED_FUNC(func) if (func) ; else 1480 | # elif (LZO_CC_CLANG || LZO_CC_LLVM) 1481 | # define LZO_UNUSED_FUNC(func) ((void) &func) 1482 | # elif (LZO_CC_MSC && (_MSC_VER < 900)) 1483 | # define LZO_UNUSED_FUNC(func) if (func) ; else 1484 | # elif (LZO_CC_MSC) 1485 | # define LZO_UNUSED_FUNC(func) ((void) &func) 1486 | # elif (LZO_CC_KEILC || LZO_CC_PELLESC) 1487 | # define LZO_UNUSED_FUNC(func) {extern int lzo_unused__[1-2*!(sizeof((int)func)>0)]; (void)lzo_unused__;} 1488 | # else 1489 | # define LZO_UNUSED_FUNC(func) ((void) func) 1490 | # endif 1491 | #endif 1492 | #if !defined(LZO_UNUSED_LABEL) 1493 | # if (LZO_CC_CLANG >= 0x020800ul) 1494 | # define LZO_UNUSED_LABEL(l) (__lzo_gnuc_extension__ ((void) ((const void *) &&l))) 1495 | # elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_INTELC || LZO_CC_WATCOMC) 1496 | # define LZO_UNUSED_LABEL(l) if __lzo_cte(0) goto l 1497 | # else 1498 | # define LZO_UNUSED_LABEL(l) switch (0) case 1:goto l 1499 | # endif 1500 | #endif 1501 | #if !defined(LZO_DEFINE_UNINITIALIZED_VAR) 1502 | # if 0 1503 | # define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var 1504 | # elif 0 && (LZO_CC_GNUC) 1505 | # define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = var 1506 | # else 1507 | # define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = init 1508 | # endif 1509 | #endif 1510 | #if !defined(__lzo_inline) 1511 | #if (LZO_CC_TURBOC && (__TURBOC__ <= 0x0295)) 1512 | #elif defined(__cplusplus) 1513 | # define __lzo_inline inline 1514 | #elif defined(__STDC_VERSION__) && (__STDC_VERSION__-0 >= 199901L) 1515 | # define __lzo_inline inline 1516 | #elif (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0550)) 1517 | # define __lzo_inline __inline 1518 | #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) 1519 | # define __lzo_inline __inline__ 1520 | #elif (LZO_CC_DMC) 1521 | # define __lzo_inline __inline 1522 | #elif (LZO_CC_GHS) 1523 | # define __lzo_inline __inline__ 1524 | #elif (LZO_CC_IBMC >= 600) 1525 | # define __lzo_inline __inline__ 1526 | #elif (LZO_CC_INTELC) 1527 | # define __lzo_inline __inline 1528 | #elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x2405)) 1529 | # define __lzo_inline __inline 1530 | #elif (LZO_CC_MSC && (_MSC_VER >= 900)) 1531 | # define __lzo_inline __inline 1532 | #elif (LZO_CC_SUNPROC >= 0x5100) 1533 | # define __lzo_inline __inline__ 1534 | #endif 1535 | #endif 1536 | #if defined(__lzo_inline) 1537 | # ifndef __lzo_HAVE_inline 1538 | # define __lzo_HAVE_inline 1 1539 | # endif 1540 | #else 1541 | # define __lzo_inline /*empty*/ 1542 | #endif 1543 | #if !defined(__lzo_forceinline) 1544 | #if (LZO_CC_GNUC >= 0x030200ul) 1545 | # define __lzo_forceinline __inline__ __attribute__((__always_inline__)) 1546 | #elif (LZO_CC_IBMC >= 700) 1547 | # define __lzo_forceinline __inline__ __attribute__((__always_inline__)) 1548 | #elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450)) 1549 | # define __lzo_forceinline __forceinline 1550 | #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) 1551 | # define __lzo_forceinline __inline__ __attribute__((__always_inline__)) 1552 | #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) 1553 | # define __lzo_forceinline __inline__ __attribute__((__always_inline__)) 1554 | #elif (LZO_CC_MSC && (_MSC_VER >= 1200)) 1555 | # define __lzo_forceinline __forceinline 1556 | #elif (LZO_CC_PGI >= 0x0d0a00ul) 1557 | # define __lzo_forceinline __inline__ __attribute__((__always_inline__)) 1558 | #elif (LZO_CC_SUNPROC >= 0x5100) 1559 | # define __lzo_forceinline __inline__ __attribute__((__always_inline__)) 1560 | #endif 1561 | #endif 1562 | #if defined(__lzo_forceinline) 1563 | # ifndef __lzo_HAVE_forceinline 1564 | # define __lzo_HAVE_forceinline 1 1565 | # endif 1566 | #else 1567 | # define __lzo_forceinline __lzo_inline 1568 | #endif 1569 | #if !defined(__lzo_noinline) 1570 | #if 1 && (LZO_ARCH_I386) && (LZO_CC_GNUC >= 0x040000ul) && (LZO_CC_GNUC < 0x040003ul) 1571 | # define __lzo_noinline __attribute__((__noinline__,__used__)) 1572 | #elif (LZO_CC_GNUC >= 0x030200ul) 1573 | # define __lzo_noinline __attribute__((__noinline__)) 1574 | #elif (LZO_CC_IBMC >= 700) 1575 | # define __lzo_noinline __attribute__((__noinline__)) 1576 | #elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 600)) 1577 | # define __lzo_noinline __declspec(noinline) 1578 | #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) 1579 | # define __lzo_noinline __attribute__((__noinline__)) 1580 | #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) 1581 | # define __lzo_noinline __attribute__((__noinline__)) 1582 | #elif (LZO_CC_MSC && (_MSC_VER >= 1300)) 1583 | # define __lzo_noinline __declspec(noinline) 1584 | #elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x3200) && (LZO_OS_WIN32 || LZO_OS_WIN64)) 1585 | # if defined(__cplusplus) 1586 | # else 1587 | # define __lzo_noinline __declspec(noinline) 1588 | # endif 1589 | #elif (LZO_CC_PGI >= 0x0d0a00ul) 1590 | # define __lzo_noinline __attribute__((__noinline__)) 1591 | #elif (LZO_CC_SUNPROC >= 0x5100) 1592 | # define __lzo_noinline __attribute__((__noinline__)) 1593 | #endif 1594 | #endif 1595 | #if defined(__lzo_noinline) 1596 | # ifndef __lzo_HAVE_noinline 1597 | # define __lzo_HAVE_noinline 1 1598 | # endif 1599 | #else 1600 | # define __lzo_noinline /*empty*/ 1601 | #endif 1602 | #if (__lzo_HAVE_forceinline || __lzo_HAVE_noinline) && !(__lzo_HAVE_inline) 1603 | # error "unexpected configuration - check your compiler defines" 1604 | #endif 1605 | #if !defined(__lzo_static_inline) 1606 | #if (LZO_CC_IBMC) 1607 | # define __lzo_static_inline __lzo_gnuc_extension__ static __lzo_inline 1608 | #endif 1609 | #endif 1610 | #if !defined(__lzo_static_inline) 1611 | # define __lzo_static_inline static __lzo_inline 1612 | #endif 1613 | #if !defined(__lzo_static_forceinline) 1614 | #if (LZO_CC_IBMC) 1615 | # define __lzo_static_forceinline __lzo_gnuc_extension__ static __lzo_forceinline 1616 | #endif 1617 | #endif 1618 | #if !defined(__lzo_static_forceinline) 1619 | # define __lzo_static_forceinline static __lzo_forceinline 1620 | #endif 1621 | #if !defined(__lzo_static_noinline) 1622 | #if (LZO_CC_IBMC) 1623 | # define __lzo_static_noinline __lzo_gnuc_extension__ static __lzo_noinline 1624 | #endif 1625 | #endif 1626 | #if !defined(__lzo_static_noinline) 1627 | # define __lzo_static_noinline static __lzo_noinline 1628 | #endif 1629 | #if !defined(__lzo_c99_extern_inline) 1630 | #if defined(__GNUC_GNU_INLINE__) 1631 | # define __lzo_c99_extern_inline __lzo_inline 1632 | #elif defined(__GNUC_STDC_INLINE__) 1633 | # define __lzo_c99_extern_inline extern __lzo_inline 1634 | #elif defined(__STDC_VERSION__) && (__STDC_VERSION__-0 >= 199901L) 1635 | # define __lzo_c99_extern_inline extern __lzo_inline 1636 | #endif 1637 | #if !defined(__lzo_c99_extern_inline) && (__lzo_HAVE_inline) 1638 | # define __lzo_c99_extern_inline __lzo_inline 1639 | #endif 1640 | #endif 1641 | #if defined(__lzo_c99_extern_inline) 1642 | # ifndef __lzo_HAVE_c99_extern_inline 1643 | # define __lzo_HAVE_c99_extern_inline 1 1644 | # endif 1645 | #else 1646 | # define __lzo_c99_extern_inline /*empty*/ 1647 | #endif 1648 | #if !defined(__lzo_may_alias) 1649 | #if (LZO_CC_GNUC >= 0x030400ul) 1650 | # define __lzo_may_alias __attribute__((__may_alias__)) 1651 | #elif (LZO_CC_CLANG >= 0x020900ul) 1652 | # define __lzo_may_alias __attribute__((__may_alias__)) 1653 | #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 1210)) && 0 1654 | # define __lzo_may_alias __attribute__((__may_alias__)) 1655 | #elif (LZO_CC_PGI >= 0x0d0a00ul) && 0 1656 | # define __lzo_may_alias __attribute__((__may_alias__)) 1657 | #endif 1658 | #endif 1659 | #if defined(__lzo_may_alias) 1660 | # ifndef __lzo_HAVE_may_alias 1661 | # define __lzo_HAVE_may_alias 1 1662 | # endif 1663 | #else 1664 | # define __lzo_may_alias /*empty*/ 1665 | #endif 1666 | #if !defined(__lzo_noreturn) 1667 | #if (LZO_CC_GNUC >= 0x020700ul) 1668 | # define __lzo_noreturn __attribute__((__noreturn__)) 1669 | #elif (LZO_CC_IBMC >= 700) 1670 | # define __lzo_noreturn __attribute__((__noreturn__)) 1671 | #elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450)) 1672 | # define __lzo_noreturn __declspec(noreturn) 1673 | #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 600)) 1674 | # define __lzo_noreturn __attribute__((__noreturn__)) 1675 | #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) 1676 | # define __lzo_noreturn __attribute__((__noreturn__)) 1677 | #elif (LZO_CC_MSC && (_MSC_VER >= 1200)) 1678 | # define __lzo_noreturn __declspec(noreturn) 1679 | #elif (LZO_CC_PGI >= 0x0d0a00ul) 1680 | # define __lzo_noreturn __attribute__((__noreturn__)) 1681 | #endif 1682 | #endif 1683 | #if defined(__lzo_noreturn) 1684 | # ifndef __lzo_HAVE_noreturn 1685 | # define __lzo_HAVE_noreturn 1 1686 | # endif 1687 | #else 1688 | # define __lzo_noreturn /*empty*/ 1689 | #endif 1690 | #if !defined(__lzo_nothrow) 1691 | #if (LZO_CC_GNUC >= 0x030300ul) 1692 | # define __lzo_nothrow __attribute__((__nothrow__)) 1693 | #elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450)) && defined(__cplusplus) 1694 | # define __lzo_nothrow __declspec(nothrow) 1695 | #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 900)) 1696 | # define __lzo_nothrow __attribute__((__nothrow__)) 1697 | #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) 1698 | # define __lzo_nothrow __attribute__((__nothrow__)) 1699 | #elif (LZO_CC_MSC && (_MSC_VER >= 1200)) && defined(__cplusplus) 1700 | # define __lzo_nothrow __declspec(nothrow) 1701 | #endif 1702 | #endif 1703 | #if defined(__lzo_nothrow) 1704 | # ifndef __lzo_HAVE_nothrow 1705 | # define __lzo_HAVE_nothrow 1 1706 | # endif 1707 | #else 1708 | # define __lzo_nothrow /*empty*/ 1709 | #endif 1710 | #if !defined(__lzo_restrict) 1711 | #if (LZO_CC_GNUC >= 0x030400ul) 1712 | # define __lzo_restrict __restrict__ 1713 | #elif (LZO_CC_IBMC >= 800) && !defined(__cplusplus) 1714 | # define __lzo_restrict __restrict__ 1715 | #elif (LZO_CC_IBMC >= 1210) 1716 | # define __lzo_restrict __restrict__ 1717 | #elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 600)) 1718 | #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 600)) 1719 | # define __lzo_restrict __restrict__ 1720 | #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM) 1721 | # define __lzo_restrict __restrict__ 1722 | #elif (LZO_CC_MSC && (_MSC_VER >= 1400)) 1723 | # define __lzo_restrict __restrict 1724 | #elif (LZO_CC_PGI >= 0x0d0a00ul) 1725 | # define __lzo_restrict __restrict__ 1726 | #endif 1727 | #endif 1728 | #if defined(__lzo_restrict) 1729 | # ifndef __lzo_HAVE_restrict 1730 | # define __lzo_HAVE_restrict 1 1731 | # endif 1732 | #else 1733 | # define __lzo_restrict /*empty*/ 1734 | #endif 1735 | #if !defined(__lzo_alignof) 1736 | #if (LZO_CC_ARMCC || LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) 1737 | # define __lzo_alignof(e) __alignof__(e) 1738 | #elif (LZO_CC_GHS) && !defined(__cplusplus) 1739 | # define __lzo_alignof(e) __alignof__(e) 1740 | #elif (LZO_CC_IBMC >= 600) 1741 | # define __lzo_alignof(e) (__lzo_gnuc_extension__ __alignof__(e)) 1742 | #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 700)) 1743 | # define __lzo_alignof(e) __alignof__(e) 1744 | #elif (LZO_CC_MSC && (_MSC_VER >= 1300)) 1745 | # define __lzo_alignof(e) __alignof(e) 1746 | #elif (LZO_CC_SUNPROC >= 0x5100) 1747 | # define __lzo_alignof(e) __alignof__(e) 1748 | #endif 1749 | #endif 1750 | #if defined(__lzo_alignof) 1751 | # ifndef __lzo_HAVE_alignof 1752 | # define __lzo_HAVE_alignof 1 1753 | # endif 1754 | #endif 1755 | #if !defined(__lzo_struct_packed) 1756 | #if (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus) 1757 | #elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020700ul)) 1758 | #elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul)) && defined(__cplusplus) 1759 | #elif (LZO_CC_PCC && (LZO_CC_PCC < 0x010100ul)) 1760 | #elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC < 0x5110)) && !defined(__cplusplus) 1761 | #elif (LZO_CC_GNUC >= 0x030400ul) && !(LZO_CC_PCC_GNUC) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) 1762 | # define __lzo_struct_packed(s) struct s { 1763 | # define __lzo_struct_packed_end() } __attribute__((__gcc_struct__,__packed__)); 1764 | # define __lzo_struct_packed_ma_end() } __lzo_may_alias __attribute__((__gcc_struct__,__packed__)); 1765 | #elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || (LZO_CC_PGI >= 0x0d0a00ul) || (LZO_CC_SUNPROC >= 0x5100)) 1766 | # define __lzo_struct_packed(s) struct s { 1767 | # define __lzo_struct_packed_end() } __attribute__((__packed__)); 1768 | # define __lzo_struct_packed_ma_end() } __lzo_may_alias __attribute__((__packed__)); 1769 | #elif (LZO_CC_IBMC >= 700) 1770 | # define __lzo_struct_packed(s) __lzo_gnuc_extension__ struct s { 1771 | # define __lzo_struct_packed_end() } __attribute__((__packed__)); 1772 | # define __lzo_struct_packed_ma_end() } __lzo_may_alias __attribute__((__packed__)); 1773 | #elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300)) 1774 | # define __lzo_struct_packed(s) __pragma(pack(push,1)) struct s { 1775 | # define __lzo_struct_packed_end() } __pragma(pack(pop)); 1776 | #elif (LZO_CC_WATCOMC && (__WATCOMC__ >= 900)) 1777 | # define __lzo_struct_packed(s) _Packed struct s { 1778 | # define __lzo_struct_packed_end() }; 1779 | #endif 1780 | #endif 1781 | #if defined(__lzo_struct_packed) && !defined(__lzo_struct_packed_ma) 1782 | # define __lzo_struct_packed_ma(s) __lzo_struct_packed(s) 1783 | #endif 1784 | #if defined(__lzo_struct_packed_end) && !defined(__lzo_struct_packed_ma_end) 1785 | # define __lzo_struct_packed_ma_end() __lzo_struct_packed_end() 1786 | #endif 1787 | #if !defined(__lzo_byte_struct) 1788 | #if defined(__lzo_struct_packed) 1789 | # define __lzo_byte_struct(s,n) __lzo_struct_packed(s) unsigned char a[n]; __lzo_struct_packed_end() 1790 | # define __lzo_byte_struct_ma(s,n) __lzo_struct_packed_ma(s) unsigned char a[n]; __lzo_struct_packed_ma_end() 1791 | #elif (LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_PGI || (LZO_CC_SUNPROC >= 0x5100)) 1792 | # define __lzo_byte_struct(s,n) struct s { unsigned char a[n]; } __attribute__((__packed__)); 1793 | # define __lzo_byte_struct_ma(s,n) struct s { unsigned char a[n]; } __lzo_may_alias __attribute__((__packed__)); 1794 | #endif 1795 | #endif 1796 | #if defined(__lzo_byte_struct) && !defined(__lzo_byte_struct_ma) 1797 | # define __lzo_byte_struct_ma(s,n) __lzo_byte_struct(s,n) 1798 | #endif 1799 | #if !defined(__lzo_struct_align16) && (__lzo_HAVE_alignof) 1800 | #if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x030000ul)) 1801 | #elif (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus) 1802 | #elif (LZO_CC_CILLY || LZO_CC_PCC) 1803 | #elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300)) 1804 | # define __lzo_struct_align16(s) struct __declspec(align(16)) s { 1805 | # define __lzo_struct_align16_end() }; 1806 | # define __lzo_struct_align32(s) struct __declspec(align(32)) s { 1807 | # define __lzo_struct_align32_end() }; 1808 | # define __lzo_struct_align64(s) struct __declspec(align(64)) s { 1809 | # define __lzo_struct_align64_end() }; 1810 | #elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || (LZO_CC_IBMC >= 700) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) 1811 | # define __lzo_struct_align16(s) struct s { 1812 | # define __lzo_struct_align16_end() } __attribute__((__aligned__(16))); 1813 | # define __lzo_struct_align32(s) struct s { 1814 | # define __lzo_struct_align32_end() } __attribute__((__aligned__(32))); 1815 | # define __lzo_struct_align64(s) struct s { 1816 | # define __lzo_struct_align64_end() } __attribute__((__aligned__(64))); 1817 | #endif 1818 | #endif 1819 | #if !defined(__lzo_union_um) 1820 | #if (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus) 1821 | #elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020700ul)) 1822 | #elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul)) && defined(__cplusplus) 1823 | #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER < 810)) 1824 | #elif (LZO_CC_PCC && (LZO_CC_PCC < 0x010100ul)) 1825 | #elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC < 0x5110)) && !defined(__cplusplus) 1826 | #elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || (LZO_CC_PGI >= 0x0d0a00ul) || (LZO_CC_SUNPROC >= 0x5100)) 1827 | # define __lzo_union_am(s) union s { 1828 | # define __lzo_union_am_end() } __lzo_may_alias; 1829 | # define __lzo_union_um(s) union s { 1830 | # define __lzo_union_um_end() } __lzo_may_alias __attribute__((__packed__)); 1831 | #elif (LZO_CC_IBMC >= 700) 1832 | # define __lzo_union_am(s) __lzo_gnuc_extension__ union s { 1833 | # define __lzo_union_am_end() } __lzo_may_alias; 1834 | # define __lzo_union_um(s) __lzo_gnuc_extension__ union s { 1835 | # define __lzo_union_um_end() } __lzo_may_alias __attribute__((__packed__)); 1836 | #elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300)) 1837 | # define __lzo_union_um(s) __pragma(pack(push,1)) union s { 1838 | # define __lzo_union_um_end() } __pragma(pack(pop)); 1839 | #elif (LZO_CC_WATCOMC && (__WATCOMC__ >= 900)) 1840 | # define __lzo_union_um(s) _Packed union s { 1841 | # define __lzo_union_um_end() }; 1842 | #endif 1843 | #endif 1844 | #if !defined(__lzo_union_am) 1845 | # define __lzo_union_am(s) union s { 1846 | # define __lzo_union_am_end() }; 1847 | #endif 1848 | #if !defined(__lzo_constructor) 1849 | #if (LZO_CC_GNUC >= 0x030400ul) 1850 | # define __lzo_constructor __attribute__((__constructor__,__used__)) 1851 | #elif (LZO_CC_GNUC >= 0x020700ul) 1852 | # define __lzo_constructor __attribute__((__constructor__)) 1853 | #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) 1854 | # define __lzo_constructor __attribute__((__constructor__,__used__)) 1855 | #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) 1856 | # define __lzo_constructor __attribute__((__constructor__)) 1857 | #endif 1858 | #endif 1859 | #if defined(__lzo_constructor) 1860 | # ifndef __lzo_HAVE_constructor 1861 | # define __lzo_HAVE_constructor 1 1862 | # endif 1863 | #endif 1864 | #if !defined(__lzo_destructor) 1865 | #if (LZO_CC_GNUC >= 0x030400ul) 1866 | # define __lzo_destructor __attribute__((__destructor__,__used__)) 1867 | #elif (LZO_CC_GNUC >= 0x020700ul) 1868 | # define __lzo_destructor __attribute__((__destructor__)) 1869 | #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) 1870 | # define __lzo_destructor __attribute__((__destructor__,__used__)) 1871 | #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) 1872 | # define __lzo_destructor __attribute__((__destructor__)) 1873 | #endif 1874 | #endif 1875 | #if defined(__lzo_destructor) 1876 | # ifndef __lzo_HAVE_destructor 1877 | # define __lzo_HAVE_destructor 1 1878 | # endif 1879 | #endif 1880 | #if (__lzo_HAVE_destructor) && !(__lzo_HAVE_constructor) 1881 | # error "unexpected configuration - check your compiler defines" 1882 | #endif 1883 | #if !defined(__lzo_likely) && !defined(__lzo_unlikely) 1884 | #if (LZO_CC_GNUC >= 0x030200ul) 1885 | # define __lzo_likely(e) (__builtin_expect(!!(e),1)) 1886 | # define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) 1887 | #elif (LZO_CC_IBMC >= 1010) 1888 | # define __lzo_likely(e) (__builtin_expect(!!(e),1)) 1889 | # define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) 1890 | #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800)) 1891 | # define __lzo_likely(e) (__builtin_expect(!!(e),1)) 1892 | # define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) 1893 | #elif (LZO_CC_CLANG && LZO_CC_CLANG_C2) 1894 | #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) 1895 | # define __lzo_likely(e) (__builtin_expect(!!(e),1)) 1896 | # define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) 1897 | #endif 1898 | #endif 1899 | #if defined(__lzo_likely) 1900 | # ifndef __lzo_HAVE_likely 1901 | # define __lzo_HAVE_likely 1 1902 | # endif 1903 | #else 1904 | # define __lzo_likely(e) (e) 1905 | #endif 1906 | #if defined(__lzo_very_likely) 1907 | # ifndef __lzo_HAVE_very_likely 1908 | # define __lzo_HAVE_very_likely 1 1909 | # endif 1910 | #else 1911 | # define __lzo_very_likely(e) __lzo_likely(e) 1912 | #endif 1913 | #if defined(__lzo_unlikely) 1914 | # ifndef __lzo_HAVE_unlikely 1915 | # define __lzo_HAVE_unlikely 1 1916 | # endif 1917 | #else 1918 | # define __lzo_unlikely(e) (e) 1919 | #endif 1920 | #if defined(__lzo_very_unlikely) 1921 | # ifndef __lzo_HAVE_very_unlikely 1922 | # define __lzo_HAVE_very_unlikely 1 1923 | # endif 1924 | #else 1925 | # define __lzo_very_unlikely(e) __lzo_unlikely(e) 1926 | #endif 1927 | #if !defined(__lzo_loop_forever) 1928 | # if (LZO_CC_IBMC) 1929 | # define __lzo_loop_forever() LZO_BLOCK_BEGIN for (;;) { ; } LZO_BLOCK_END 1930 | # else 1931 | # define __lzo_loop_forever() do { ; } while __lzo_cte(1) 1932 | # endif 1933 | #endif 1934 | #if !defined(__lzo_unreachable) 1935 | #if (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x020800ul)) && lzo_has_builtin(__builtin_unreachable) 1936 | # define __lzo_unreachable() __builtin_unreachable(); 1937 | #elif (LZO_CC_GNUC >= 0x040500ul) 1938 | # define __lzo_unreachable() __builtin_unreachable(); 1939 | #elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 1300)) && 1 1940 | # define __lzo_unreachable() __builtin_unreachable(); 1941 | #endif 1942 | #endif 1943 | #if defined(__lzo_unreachable) 1944 | # ifndef __lzo_HAVE_unreachable 1945 | # define __lzo_HAVE_unreachable 1 1946 | # endif 1947 | #else 1948 | # if 0 1949 | # define __lzo_unreachable() ((void)0); 1950 | # else 1951 | # define __lzo_unreachable() __lzo_loop_forever(); 1952 | # endif 1953 | #endif 1954 | #if !defined(lzo_unused_funcs_impl) 1955 | # if 1 && (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || (LZO_CC_GNUC >= 0x020700ul) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) 1956 | # define lzo_unused_funcs_impl(r,f) static r __attribute__((__unused__)) f 1957 | # elif 1 && (LZO_CC_BORLANDC || LZO_CC_GNUC) 1958 | # define lzo_unused_funcs_impl(r,f) static r f 1959 | # else 1960 | # define lzo_unused_funcs_impl(r,f) __lzo_static_forceinline r f 1961 | # endif 1962 | #endif 1963 | #ifndef __LZO_CTA_NAME 1964 | #if (LZO_CFG_USE_COUNTER) 1965 | # define __LZO_CTA_NAME(a) LZO_PP_ECONCAT2(a,__COUNTER__) 1966 | #else 1967 | # define __LZO_CTA_NAME(a) LZO_PP_ECONCAT2(a,__LINE__) 1968 | #endif 1969 | #endif 1970 | #if !defined(LZO_COMPILE_TIME_ASSERT_HEADER) 1971 | # if (LZO_CC_AZTECC || LZO_CC_ZORTECHC) 1972 | # define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-!(e)]; LZO_EXTERN_C_END 1973 | # elif (LZO_CC_DMC || LZO_CC_SYMANTECC) 1974 | # define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1u-2*!(e)]; LZO_EXTERN_C_END 1975 | # elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) 1976 | # define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-!(e)]; LZO_EXTERN_C_END 1977 | # elif (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020900ul)) && defined(__cplusplus) 1978 | # define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN int __LZO_CTA_NAME(lzo_cta_f__)(int [1-2*!(e)]); LZO_EXTERN_C_END 1979 | # elif (LZO_CC_GNUC) && defined(__CHECKER__) && defined(__SPARSE_CHECKER__) 1980 | # define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN enum {__LZO_CTA_NAME(lzo_cta_e__)=1/!!(e)} __attribute__((__unused__)); LZO_EXTERN_C_END 1981 | # else 1982 | # define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-2*!(e)]; LZO_EXTERN_C_END 1983 | # endif 1984 | #endif 1985 | #if !defined(LZO_COMPILE_TIME_ASSERT) 1986 | # if (LZO_CC_AZTECC) 1987 | # define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-!(e)];} 1988 | # elif (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x030000ul)) 1989 | # define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)] __attribute__((__unused__));} 1990 | # elif (LZO_CC_DMC || LZO_CC_PACIFICC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) 1991 | # define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; 1992 | # elif (LZO_CC_GNUC) && defined(__CHECKER__) && defined(__SPARSE_CHECKER__) 1993 | # define LZO_COMPILE_TIME_ASSERT(e) {(void) (0/!!(e));} 1994 | # elif (LZO_CC_GNUC >= 0x040700ul) && (LZO_CFG_USE_COUNTER) && defined(__cplusplus) 1995 | # define LZO_COMPILE_TIME_ASSERT(e) {enum {__LZO_CTA_NAME(lzo_cta_e__)=1/!!(e)} __attribute__((__unused__));} 1996 | # elif (LZO_CC_GNUC >= 0x040700ul) 1997 | # define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)] __attribute__((__unused__));} 1998 | # elif (LZO_CC_MSC && (_MSC_VER < 900)) 1999 | # define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; 2000 | # elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) 2001 | # define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; 2002 | # else 2003 | # define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)];} 2004 | # endif 2005 | #endif 2006 | #if (LZO_LANG_ASSEMBLER) 2007 | # undef LZO_COMPILE_TIME_ASSERT_HEADER 2008 | # define LZO_COMPILE_TIME_ASSERT_HEADER(e) /*empty*/ 2009 | #else 2010 | LZO_COMPILE_TIME_ASSERT_HEADER(1 == 1) 2011 | #if defined(__cplusplus) 2012 | extern "C" { LZO_COMPILE_TIME_ASSERT_HEADER(2 == 2) } 2013 | #endif 2014 | LZO_COMPILE_TIME_ASSERT_HEADER(3 == 3) 2015 | #endif 2016 | #if (LZO_ARCH_I086 || LZO_ARCH_I386) && (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64) 2017 | # if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC) 2018 | # elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) 2019 | # define __lzo_cdecl __cdecl 2020 | # define __lzo_cdecl_atexit /*empty*/ 2021 | # define __lzo_cdecl_main __cdecl 2022 | # if (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) 2023 | # define __lzo_cdecl_qsort __pascal 2024 | # elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) 2025 | # define __lzo_cdecl_qsort _stdcall 2026 | # else 2027 | # define __lzo_cdecl_qsort __cdecl 2028 | # endif 2029 | # elif (LZO_CC_WATCOMC) 2030 | # define __lzo_cdecl __cdecl 2031 | # else 2032 | # define __lzo_cdecl __cdecl 2033 | # define __lzo_cdecl_atexit __cdecl 2034 | # define __lzo_cdecl_main __cdecl 2035 | # define __lzo_cdecl_qsort __cdecl 2036 | # endif 2037 | # if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC || LZO_CC_WATCOMC) 2038 | # elif (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) 2039 | # define __lzo_cdecl_sighandler __pascal 2040 | # elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) 2041 | # define __lzo_cdecl_sighandler _stdcall 2042 | # elif (LZO_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE) 2043 | # define __lzo_cdecl_sighandler __clrcall 2044 | # elif (LZO_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700)) 2045 | # if defined(_DLL) 2046 | # define __lzo_cdecl_sighandler _far _cdecl _loadds 2047 | # elif defined(_MT) 2048 | # define __lzo_cdecl_sighandler _far _cdecl 2049 | # else 2050 | # define __lzo_cdecl_sighandler _cdecl 2051 | # endif 2052 | # else 2053 | # define __lzo_cdecl_sighandler __cdecl 2054 | # endif 2055 | #elif (LZO_ARCH_I386) && (LZO_CC_WATCOMC) 2056 | # define __lzo_cdecl __cdecl 2057 | #elif (LZO_ARCH_M68K && LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC)) 2058 | # define __lzo_cdecl cdecl 2059 | #endif 2060 | #if !defined(__lzo_cdecl) 2061 | # define __lzo_cdecl /*empty*/ 2062 | #endif 2063 | #if !defined(__lzo_cdecl_atexit) 2064 | # define __lzo_cdecl_atexit /*empty*/ 2065 | #endif 2066 | #if !defined(__lzo_cdecl_main) 2067 | # define __lzo_cdecl_main /*empty*/ 2068 | #endif 2069 | #if !defined(__lzo_cdecl_qsort) 2070 | # define __lzo_cdecl_qsort /*empty*/ 2071 | #endif 2072 | #if !defined(__lzo_cdecl_sighandler) 2073 | # define __lzo_cdecl_sighandler /*empty*/ 2074 | #endif 2075 | #if !defined(__lzo_cdecl_va) 2076 | # define __lzo_cdecl_va __lzo_cdecl 2077 | #endif 2078 | #if !(LZO_CFG_NO_WINDOWS_H) 2079 | #if !defined(LZO_HAVE_WINDOWS_H) 2080 | #if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64) 2081 | # if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000)) 2082 | # elif ((LZO_OS_WIN32 && defined(__PW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x030000ul))) 2083 | # elif ((LZO_OS_CYGWIN || defined(__MINGW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x025f00ul))) 2084 | # else 2085 | # define LZO_HAVE_WINDOWS_H 1 2086 | # endif 2087 | #endif 2088 | #endif 2089 | #endif 2090 | #define LZO_SIZEOF_CHAR 1 2091 | #ifndef LZO_SIZEOF_SHORT 2092 | #if defined(SIZEOF_SHORT) 2093 | # define LZO_SIZEOF_SHORT (SIZEOF_SHORT) 2094 | #elif defined(__SIZEOF_SHORT__) 2095 | # define LZO_SIZEOF_SHORT (__SIZEOF_SHORT__) 2096 | #endif 2097 | #endif 2098 | #ifndef LZO_SIZEOF_INT 2099 | #if defined(SIZEOF_INT) 2100 | # define LZO_SIZEOF_INT (SIZEOF_INT) 2101 | #elif defined(__SIZEOF_INT__) 2102 | # define LZO_SIZEOF_INT (__SIZEOF_INT__) 2103 | #endif 2104 | #endif 2105 | #ifndef LZO_SIZEOF_LONG 2106 | #if defined(SIZEOF_LONG) 2107 | # define LZO_SIZEOF_LONG (SIZEOF_LONG) 2108 | #elif defined(__SIZEOF_LONG__) 2109 | # define LZO_SIZEOF_LONG (__SIZEOF_LONG__) 2110 | #endif 2111 | #endif 2112 | #ifndef LZO_SIZEOF_LONG_LONG 2113 | #if defined(SIZEOF_LONG_LONG) 2114 | # define LZO_SIZEOF_LONG_LONG (SIZEOF_LONG_LONG) 2115 | #elif defined(__SIZEOF_LONG_LONG__) 2116 | # define LZO_SIZEOF_LONG_LONG (__SIZEOF_LONG_LONG__) 2117 | #endif 2118 | #endif 2119 | #ifndef LZO_SIZEOF___INT16 2120 | #if defined(SIZEOF___INT16) 2121 | # define LZO_SIZEOF___INT16 (SIZEOF___INT16) 2122 | #endif 2123 | #endif 2124 | #ifndef LZO_SIZEOF___INT32 2125 | #if defined(SIZEOF___INT32) 2126 | # define LZO_SIZEOF___INT32 (SIZEOF___INT32) 2127 | #endif 2128 | #endif 2129 | #ifndef LZO_SIZEOF___INT64 2130 | #if defined(SIZEOF___INT64) 2131 | # define LZO_SIZEOF___INT64 (SIZEOF___INT64) 2132 | #endif 2133 | #endif 2134 | #ifndef LZO_SIZEOF_VOID_P 2135 | #if defined(SIZEOF_VOID_P) 2136 | # define LZO_SIZEOF_VOID_P (SIZEOF_VOID_P) 2137 | #elif defined(__SIZEOF_POINTER__) 2138 | # define LZO_SIZEOF_VOID_P (__SIZEOF_POINTER__) 2139 | #endif 2140 | #endif 2141 | #ifndef LZO_SIZEOF_SIZE_T 2142 | #if defined(SIZEOF_SIZE_T) 2143 | # define LZO_SIZEOF_SIZE_T (SIZEOF_SIZE_T) 2144 | #elif defined(__SIZEOF_SIZE_T__) 2145 | # define LZO_SIZEOF_SIZE_T (__SIZEOF_SIZE_T__) 2146 | #endif 2147 | #endif 2148 | #ifndef LZO_SIZEOF_PTRDIFF_T 2149 | #if defined(SIZEOF_PTRDIFF_T) 2150 | # define LZO_SIZEOF_PTRDIFF_T (SIZEOF_PTRDIFF_T) 2151 | #elif defined(__SIZEOF_PTRDIFF_T__) 2152 | # define LZO_SIZEOF_PTRDIFF_T (__SIZEOF_PTRDIFF_T__) 2153 | #endif 2154 | #endif 2155 | #define __LZO_LSR(x,b) (((x)+0ul) >> (b)) 2156 | #if !defined(LZO_SIZEOF_SHORT) 2157 | # if (LZO_ARCH_CRAY_PVP) 2158 | # define LZO_SIZEOF_SHORT 8 2159 | # elif (USHRT_MAX == LZO_0xffffL) 2160 | # define LZO_SIZEOF_SHORT 2 2161 | # elif (__LZO_LSR(USHRT_MAX,7) == 1) 2162 | # define LZO_SIZEOF_SHORT 1 2163 | # elif (__LZO_LSR(USHRT_MAX,15) == 1) 2164 | # define LZO_SIZEOF_SHORT 2 2165 | # elif (__LZO_LSR(USHRT_MAX,31) == 1) 2166 | # define LZO_SIZEOF_SHORT 4 2167 | # elif (__LZO_LSR(USHRT_MAX,63) == 1) 2168 | # define LZO_SIZEOF_SHORT 8 2169 | # elif (__LZO_LSR(USHRT_MAX,127) == 1) 2170 | # define LZO_SIZEOF_SHORT 16 2171 | # else 2172 | # error "LZO_SIZEOF_SHORT" 2173 | # endif 2174 | #endif 2175 | LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_SHORT == sizeof(short)) 2176 | #if !defined(LZO_SIZEOF_INT) 2177 | # if (LZO_ARCH_CRAY_PVP) 2178 | # define LZO_SIZEOF_INT 8 2179 | # elif (UINT_MAX == LZO_0xffffL) 2180 | # define LZO_SIZEOF_INT 2 2181 | # elif (UINT_MAX == LZO_0xffffffffL) 2182 | # define LZO_SIZEOF_INT 4 2183 | # elif (__LZO_LSR(UINT_MAX,7) == 1) 2184 | # define LZO_SIZEOF_INT 1 2185 | # elif (__LZO_LSR(UINT_MAX,15) == 1) 2186 | # define LZO_SIZEOF_INT 2 2187 | # elif (__LZO_LSR(UINT_MAX,31) == 1) 2188 | # define LZO_SIZEOF_INT 4 2189 | # elif (__LZO_LSR(UINT_MAX,63) == 1) 2190 | # define LZO_SIZEOF_INT 8 2191 | # elif (__LZO_LSR(UINT_MAX,127) == 1) 2192 | # define LZO_SIZEOF_INT 16 2193 | # else 2194 | # error "LZO_SIZEOF_INT" 2195 | # endif 2196 | #endif 2197 | LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_INT == sizeof(int)) 2198 | #if !defined(LZO_SIZEOF_LONG) 2199 | # if (ULONG_MAX == LZO_0xffffffffL) 2200 | # define LZO_SIZEOF_LONG 4 2201 | # elif (__LZO_LSR(ULONG_MAX,7) == 1) 2202 | # define LZO_SIZEOF_LONG 1 2203 | # elif (__LZO_LSR(ULONG_MAX,15) == 1) 2204 | # define LZO_SIZEOF_LONG 2 2205 | # elif (__LZO_LSR(ULONG_MAX,31) == 1) 2206 | # define LZO_SIZEOF_LONG 4 2207 | # elif (__LZO_LSR(ULONG_MAX,39) == 1) 2208 | # define LZO_SIZEOF_LONG 5 2209 | # elif (__LZO_LSR(ULONG_MAX,63) == 1) 2210 | # define LZO_SIZEOF_LONG 8 2211 | # elif (__LZO_LSR(ULONG_MAX,127) == 1) 2212 | # define LZO_SIZEOF_LONG 16 2213 | # else 2214 | # error "LZO_SIZEOF_LONG" 2215 | # endif 2216 | #endif 2217 | LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_LONG == sizeof(long)) 2218 | #if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) 2219 | #if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) 2220 | # if defined(__LONG_MAX__) && defined(__LONG_LONG_MAX__) 2221 | # if (LZO_CC_GNUC >= 0x030300ul) 2222 | # if ((__LONG_MAX__-0) == (__LONG_LONG_MAX__-0)) 2223 | # define LZO_SIZEOF_LONG_LONG LZO_SIZEOF_LONG 2224 | # elif (__LZO_LSR(__LONG_LONG_MAX__,30) == 1) 2225 | # define LZO_SIZEOF_LONG_LONG 4 2226 | # endif 2227 | # endif 2228 | # endif 2229 | #endif 2230 | #endif 2231 | #if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) 2232 | #if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) 2233 | #if (LZO_ARCH_I086 && LZO_CC_DMC) 2234 | #elif (LZO_CC_CILLY) && defined(__GNUC__) 2235 | # define LZO_SIZEOF_LONG_LONG 8 2236 | #elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) 2237 | # define LZO_SIZEOF_LONG_LONG 8 2238 | #elif ((LZO_OS_WIN32 || LZO_OS_WIN64 || defined(_WIN32)) && LZO_CC_MSC && (_MSC_VER >= 1400)) 2239 | # define LZO_SIZEOF_LONG_LONG 8 2240 | #elif (LZO_OS_WIN64 || defined(_WIN64)) 2241 | # define LZO_SIZEOF___INT64 8 2242 | #elif (LZO_ARCH_I386 && (LZO_CC_DMC)) 2243 | # define LZO_SIZEOF_LONG_LONG 8 2244 | #elif (LZO_ARCH_I386 && (LZO_CC_SYMANTECC && (__SC__ >= 0x700))) 2245 | # define LZO_SIZEOF_LONG_LONG 8 2246 | #elif (LZO_ARCH_I386 && (LZO_CC_INTELC && defined(__linux__))) 2247 | # define LZO_SIZEOF_LONG_LONG 8 2248 | #elif (LZO_ARCH_I386 && (LZO_CC_MWERKS || LZO_CC_PELLESC || LZO_CC_PGI || LZO_CC_SUNPROC)) 2249 | # define LZO_SIZEOF_LONG_LONG 8 2250 | #elif (LZO_ARCH_I386 && (LZO_CC_INTELC || LZO_CC_MSC)) 2251 | # define LZO_SIZEOF___INT64 8 2252 | #elif ((LZO_OS_WIN32 || defined(_WIN32)) && (LZO_CC_MSC)) 2253 | # define LZO_SIZEOF___INT64 8 2254 | #elif (LZO_ARCH_I386 && (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0520))) 2255 | # define LZO_SIZEOF___INT64 8 2256 | #elif (LZO_ARCH_I386 && (LZO_CC_WATCOMC && (__WATCOMC__ >= 1100))) 2257 | # define LZO_SIZEOF___INT64 8 2258 | #elif (LZO_CC_GHS && defined(__LLONG_BIT) && ((__LLONG_BIT-0) == 64)) 2259 | # define LZO_SIZEOF_LONG_LONG 8 2260 | #elif (LZO_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && ((_INTEGRAL_MAX_BITS-0) == 64)) 2261 | # define LZO_SIZEOF___INT64 8 2262 | #elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) 2263 | # define LZO_SIZEOF_LONG_LONG 8 2264 | #elif (defined(__vms) || defined(__VMS)) && ((__INITIAL_POINTER_SIZE-0) == 64) 2265 | # define LZO_SIZEOF_LONG_LONG 8 2266 | #elif (LZO_CC_SDCC) && (LZO_SIZEOF_INT == 2) 2267 | #elif 1 && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) 2268 | # define LZO_SIZEOF_LONG_LONG 8 2269 | #endif 2270 | #endif 2271 | #endif 2272 | #if defined(__cplusplus) && (LZO_CC_GNUC) 2273 | # if (LZO_CC_GNUC < 0x020800ul) 2274 | # undef LZO_SIZEOF_LONG_LONG 2275 | # endif 2276 | #endif 2277 | #if (LZO_CFG_NO_LONG_LONG) 2278 | # undef LZO_SIZEOF_LONG_LONG 2279 | #elif defined(__NO_LONG_LONG) 2280 | # undef LZO_SIZEOF_LONG_LONG 2281 | #elif defined(_NO_LONGLONG) 2282 | # undef LZO_SIZEOF_LONG_LONG 2283 | #endif 2284 | #if !defined(LZO_WORDSIZE) 2285 | #if (LZO_ARCH_ALPHA) 2286 | # define LZO_WORDSIZE 8 2287 | #elif (LZO_ARCH_AMD64) 2288 | # define LZO_WORDSIZE 8 2289 | #elif (LZO_ARCH_ARM64) 2290 | # define LZO_WORDSIZE 8 2291 | #elif (LZO_ARCH_AVR) 2292 | # define LZO_WORDSIZE 1 2293 | #elif (LZO_ARCH_H8300) 2294 | # if defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) 2295 | # define LZO_WORDSIZE 4 2296 | # else 2297 | # define LZO_WORDSIZE 2 2298 | # endif 2299 | #elif (LZO_ARCH_I086) 2300 | # define LZO_WORDSIZE 2 2301 | #elif (LZO_ARCH_IA64) 2302 | # define LZO_WORDSIZE 8 2303 | #elif (LZO_ARCH_M16C) 2304 | # define LZO_WORDSIZE 2 2305 | #elif (LZO_ARCH_SPU) 2306 | # define LZO_WORDSIZE 4 2307 | #elif (LZO_ARCH_Z80) 2308 | # define LZO_WORDSIZE 1 2309 | #elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) 2310 | # define LZO_WORDSIZE 8 2311 | #elif (LZO_OS_OS400 || defined(__OS400__)) 2312 | # define LZO_WORDSIZE 8 2313 | #elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) 2314 | # define LZO_WORDSIZE 8 2315 | #endif 2316 | #endif 2317 | #if !defined(LZO_SIZEOF_VOID_P) 2318 | #if defined(__ILP32__) || defined(__ILP32) || defined(_ILP32) 2319 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(int) == 4) 2320 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 4) 2321 | # define LZO_SIZEOF_VOID_P 4 2322 | #elif defined(__ILP64__) || defined(__ILP64) || defined(_ILP64) 2323 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(int) == 8) 2324 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 8) 2325 | # define LZO_SIZEOF_VOID_P 8 2326 | #elif defined(__LLP64__) || defined(__LLP64) || defined(_LLP64) || defined(_WIN64) 2327 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 4) 2328 | # define LZO_SIZEOF_VOID_P 8 2329 | #elif defined(__LP64__) || defined(__LP64) || defined(_LP64) 2330 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 8) 2331 | # define LZO_SIZEOF_VOID_P 8 2332 | #elif (LZO_ARCH_AVR) 2333 | # define LZO_SIZEOF_VOID_P 2 2334 | #elif (LZO_ARCH_C166 || LZO_ARCH_MCS51 || LZO_ARCH_MCS251 || LZO_ARCH_MSP430) 2335 | # define LZO_SIZEOF_VOID_P 2 2336 | #elif (LZO_ARCH_H8300) 2337 | # if defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) 2338 | LZO_COMPILE_TIME_ASSERT_HEADER(LZO_WORDSIZE == 4) 2339 | # if defined(__NORMAL_MODE__) 2340 | # define LZO_SIZEOF_VOID_P 2 2341 | # else 2342 | # define LZO_SIZEOF_VOID_P 4 2343 | # endif 2344 | # else 2345 | LZO_COMPILE_TIME_ASSERT_HEADER(LZO_WORDSIZE == 2) 2346 | # define LZO_SIZEOF_VOID_P 2 2347 | # endif 2348 | # if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_SIZEOF_INT == 4) 2349 | # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_INT 2350 | # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_INT 2351 | # endif 2352 | #elif (LZO_ARCH_I086) 2353 | # if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM) 2354 | # define LZO_SIZEOF_VOID_P 2 2355 | # elif (LZO_MM_COMPACT || LZO_MM_LARGE || LZO_MM_HUGE) 2356 | # define LZO_SIZEOF_VOID_P 4 2357 | # else 2358 | # error "invalid LZO_ARCH_I086 memory model" 2359 | # endif 2360 | #elif (LZO_ARCH_M16C) 2361 | # if defined(__m32c_cpu__) || defined(__m32cm_cpu__) 2362 | # define LZO_SIZEOF_VOID_P 4 2363 | # else 2364 | # define LZO_SIZEOF_VOID_P 2 2365 | # endif 2366 | #elif (LZO_ARCH_SPU) 2367 | # define LZO_SIZEOF_VOID_P 4 2368 | #elif (LZO_ARCH_Z80) 2369 | # define LZO_SIZEOF_VOID_P 2 2370 | #elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) 2371 | # define LZO_SIZEOF_VOID_P 4 2372 | #elif (LZO_OS_OS400 || defined(__OS400__)) 2373 | # if defined(__LLP64_IFC__) 2374 | # define LZO_SIZEOF_VOID_P 8 2375 | # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG 2376 | # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG 2377 | # else 2378 | # define LZO_SIZEOF_VOID_P 16 2379 | # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG 2380 | # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG 2381 | # endif 2382 | #elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) 2383 | # define LZO_SIZEOF_VOID_P 8 2384 | # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG 2385 | # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG 2386 | #endif 2387 | #endif 2388 | #if !defined(LZO_SIZEOF_VOID_P) 2389 | # define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG 2390 | #endif 2391 | LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_VOID_P == sizeof(void *)) 2392 | #if !defined(LZO_SIZEOF_SIZE_T) 2393 | #if (LZO_ARCH_I086 || LZO_ARCH_M16C) 2394 | # define LZO_SIZEOF_SIZE_T 2 2395 | #endif 2396 | #endif 2397 | #if !defined(LZO_SIZEOF_SIZE_T) 2398 | # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_VOID_P 2399 | #endif 2400 | #if defined(offsetof) 2401 | LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_SIZE_T == sizeof(size_t)) 2402 | #endif 2403 | #if !defined(LZO_SIZEOF_PTRDIFF_T) 2404 | #if (LZO_ARCH_I086) 2405 | # if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM || LZO_MM_HUGE) 2406 | # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_VOID_P 2407 | # elif (LZO_MM_COMPACT || LZO_MM_LARGE) 2408 | # if (LZO_CC_BORLANDC || LZO_CC_TURBOC) 2409 | # define LZO_SIZEOF_PTRDIFF_T 4 2410 | # else 2411 | # define LZO_SIZEOF_PTRDIFF_T 2 2412 | # endif 2413 | # else 2414 | # error "invalid LZO_ARCH_I086 memory model" 2415 | # endif 2416 | #endif 2417 | #endif 2418 | #if !defined(LZO_SIZEOF_PTRDIFF_T) 2419 | # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_SIZE_T 2420 | #endif 2421 | #if defined(offsetof) 2422 | LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t)) 2423 | #endif 2424 | #if !defined(LZO_WORDSIZE) 2425 | # define LZO_WORDSIZE LZO_SIZEOF_VOID_P 2426 | #endif 2427 | #if (LZO_ABI_NEUTRAL_ENDIAN) 2428 | # undef LZO_ABI_BIG_ENDIAN 2429 | # undef LZO_ABI_LITTLE_ENDIAN 2430 | #elif !(LZO_ABI_BIG_ENDIAN) && !(LZO_ABI_LITTLE_ENDIAN) 2431 | #if (LZO_ARCH_ALPHA) && (LZO_ARCH_CRAY_MPP) 2432 | # define LZO_ABI_BIG_ENDIAN 1 2433 | #elif (LZO_ARCH_IA64) && (LZO_OS_POSIX_LINUX || LZO_OS_WIN64) 2434 | # define LZO_ABI_LITTLE_ENDIAN 1 2435 | #elif (LZO_ARCH_ALPHA || LZO_ARCH_AMD64 || LZO_ARCH_BLACKFIN || LZO_ARCH_CRIS || LZO_ARCH_I086 || LZO_ARCH_I386 || LZO_ARCH_MSP430 || LZO_ARCH_RISCV) 2436 | # define LZO_ABI_LITTLE_ENDIAN 1 2437 | #elif (LZO_ARCH_AVR32 || LZO_ARCH_M68K || LZO_ARCH_S390 || LZO_ARCH_SPU) 2438 | # define LZO_ABI_BIG_ENDIAN 1 2439 | #elif 1 && defined(__IAR_SYSTEMS_ICC__) && defined(__LITTLE_ENDIAN__) 2440 | # if (__LITTLE_ENDIAN__ == 1) 2441 | # define LZO_ABI_LITTLE_ENDIAN 1 2442 | # else 2443 | # define LZO_ABI_BIG_ENDIAN 1 2444 | # endif 2445 | #elif 1 && defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) 2446 | # define LZO_ABI_BIG_ENDIAN 1 2447 | #elif 1 && defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) 2448 | # define LZO_ABI_LITTLE_ENDIAN 1 2449 | #elif 1 && (LZO_ARCH_ARM) && defined(__ARM_BIG_ENDIAN) && ((__ARM_BIG_ENDIAN)+0) 2450 | # define LZO_ABI_BIG_ENDIAN 1 2451 | #elif 1 && (LZO_ARCH_ARM) && defined(__ARMEB__) && !defined(__ARMEL__) 2452 | # define LZO_ABI_BIG_ENDIAN 1 2453 | #elif 1 && (LZO_ARCH_ARM) && defined(__ARMEL__) && !defined(__ARMEB__) 2454 | # define LZO_ABI_LITTLE_ENDIAN 1 2455 | #elif 1 && (LZO_ARCH_ARM) && defined(_MSC_VER) && defined(_WIN32) 2456 | # define LZO_ABI_LITTLE_ENDIAN 1 2457 | #elif 1 && (LZO_ARCH_ARM && LZO_CC_ARMCC_ARMCC) 2458 | # if defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN) 2459 | # error "unexpected configuration - check your compiler defines" 2460 | # elif defined(__BIG_ENDIAN) 2461 | # define LZO_ABI_BIG_ENDIAN 1 2462 | # else 2463 | # define LZO_ABI_LITTLE_ENDIAN 1 2464 | # endif 2465 | # define LZO_ABI_LITTLE_ENDIAN 1 2466 | #elif 1 && (LZO_ARCH_ARM64) && defined(__ARM_BIG_ENDIAN) && ((__ARM_BIG_ENDIAN)+0) 2467 | # define LZO_ABI_BIG_ENDIAN 1 2468 | #elif 1 && (LZO_ARCH_ARM64) && defined(__AARCH64EB__) && !defined(__AARCH64EL__) 2469 | # define LZO_ABI_BIG_ENDIAN 1 2470 | #elif 1 && (LZO_ARCH_ARM64) && defined(__AARCH64EL__) && !defined(__AARCH64EB__) 2471 | # define LZO_ABI_LITTLE_ENDIAN 1 2472 | #elif 1 && (LZO_ARCH_ARM64) && defined(_MSC_VER) && defined(_WIN32) 2473 | # define LZO_ABI_LITTLE_ENDIAN 1 2474 | #elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEB__) && !defined(__MIPSEL__) 2475 | # define LZO_ABI_BIG_ENDIAN 1 2476 | #elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEL__) && !defined(__MIPSEB__) 2477 | # define LZO_ABI_LITTLE_ENDIAN 1 2478 | #endif 2479 | #endif 2480 | #if (LZO_ABI_BIG_ENDIAN) && (LZO_ABI_LITTLE_ENDIAN) 2481 | # error "unexpected configuration - check your compiler defines" 2482 | #endif 2483 | #if (LZO_ABI_BIG_ENDIAN) 2484 | # define LZO_INFO_ABI_ENDIAN "be" 2485 | #elif (LZO_ABI_LITTLE_ENDIAN) 2486 | # define LZO_INFO_ABI_ENDIAN "le" 2487 | #elif (LZO_ABI_NEUTRAL_ENDIAN) 2488 | # define LZO_INFO_ABI_ENDIAN "neutral" 2489 | #endif 2490 | #if (LZO_SIZEOF_INT == 1 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) 2491 | # define LZO_ABI_I8LP16 1 2492 | # define LZO_INFO_ABI_PM "i8lp16" 2493 | #elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) 2494 | # define LZO_ABI_ILP16 1 2495 | # define LZO_INFO_ABI_PM "ilp16" 2496 | #elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4) 2497 | # define LZO_ABI_LP32 1 2498 | # define LZO_INFO_ABI_PM "lp32" 2499 | #elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4) 2500 | # define LZO_ABI_ILP32 1 2501 | # define LZO_INFO_ABI_PM "ilp32" 2502 | #elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 8 && LZO_SIZEOF_SIZE_T == 8) 2503 | # define LZO_ABI_LLP64 1 2504 | # define LZO_INFO_ABI_PM "llp64" 2505 | #elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) 2506 | # define LZO_ABI_LP64 1 2507 | # define LZO_INFO_ABI_PM "lp64" 2508 | #elif (LZO_SIZEOF_INT == 8 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) 2509 | # define LZO_ABI_ILP64 1 2510 | # define LZO_INFO_ABI_PM "ilp64" 2511 | #elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 4) 2512 | # define LZO_ABI_IP32L64 1 2513 | # define LZO_INFO_ABI_PM "ip32l64" 2514 | #endif 2515 | #if (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_VOID_P == 4 && LZO_WORDSIZE == 8) 2516 | # define LZO_ABI_IP32W64 1 2517 | # ifndef LZO_INFO_ABI_PM 2518 | # define LZO_INFO_ABI_PM "ip32w64" 2519 | # endif 2520 | #endif 2521 | #if 0 2522 | #elif !defined(__LZO_LIBC_OVERRIDE) 2523 | #if (LZO_LIBC_NAKED) 2524 | # define LZO_INFO_LIBC "naked" 2525 | #elif (LZO_LIBC_FREESTANDING) 2526 | # define LZO_INFO_LIBC "freestanding" 2527 | #elif (LZO_LIBC_MOSTLY_FREESTANDING) 2528 | # define LZO_INFO_LIBC "mfreestanding" 2529 | #elif (LZO_LIBC_ISOC90) 2530 | # define LZO_INFO_LIBC "isoc90" 2531 | #elif (LZO_LIBC_ISOC99) 2532 | # define LZO_INFO_LIBC "isoc99" 2533 | #elif (LZO_CC_ARMCC_ARMCC) && defined(__ARMCLIB_VERSION) 2534 | # define LZO_LIBC_ISOC90 1 2535 | # define LZO_INFO_LIBC "isoc90" 2536 | #elif defined(__dietlibc__) 2537 | # define LZO_LIBC_DIETLIBC 1 2538 | # define LZO_INFO_LIBC "dietlibc" 2539 | #elif defined(_NEWLIB_VERSION) 2540 | # define LZO_LIBC_NEWLIB 1 2541 | # define LZO_INFO_LIBC "newlib" 2542 | #elif defined(__UCLIBC__) && defined(__UCLIBC_MAJOR__) && defined(__UCLIBC_MINOR__) 2543 | # if defined(__UCLIBC_SUBLEVEL__) 2544 | # define LZO_LIBC_UCLIBC (__UCLIBC_MAJOR__ * 0x10000L + (__UCLIBC_MINOR__-0) * 0x100 + (__UCLIBC_SUBLEVEL__-0)) 2545 | # else 2546 | # define LZO_LIBC_UCLIBC 0x00090bL 2547 | # endif 2548 | # define LZO_INFO_LIBC "uc" "libc" 2549 | #elif defined(__GLIBC__) && defined(__GLIBC_MINOR__) 2550 | # define LZO_LIBC_GLIBC (__GLIBC__ * 0x10000L + (__GLIBC_MINOR__-0) * 0x100) 2551 | # define LZO_INFO_LIBC "glibc" 2552 | #elif (LZO_CC_MWERKS) && defined(__MSL__) 2553 | # define LZO_LIBC_MSL __MSL__ 2554 | # define LZO_INFO_LIBC "msl" 2555 | #elif 1 && defined(__IAR_SYSTEMS_ICC__) 2556 | # define LZO_LIBC_ISOC90 1 2557 | # define LZO_INFO_LIBC "isoc90" 2558 | #else 2559 | # define LZO_LIBC_DEFAULT 1 2560 | # define LZO_INFO_LIBC "default" 2561 | #endif 2562 | #endif 2563 | #if (LZO_ARCH_I386 && (LZO_OS_DOS32 || LZO_OS_WIN32) && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) 2564 | # define LZO_ASM_SYNTAX_MSC 1 2565 | #elif (LZO_OS_WIN64 && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) 2566 | #elif (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC == 0x011f00ul)) 2567 | #elif (LZO_ARCH_I386 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) 2568 | # define LZO_ASM_SYNTAX_GNUC 1 2569 | #elif (LZO_ARCH_AMD64 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) 2570 | # define LZO_ASM_SYNTAX_GNUC 1 2571 | #elif (LZO_CC_GNUC) 2572 | # define LZO_ASM_SYNTAX_GNUC 1 2573 | #endif 2574 | #if (LZO_ASM_SYNTAX_GNUC) 2575 | #if (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC < 0x020000ul)) 2576 | # define __LZO_ASM_CLOBBER "ax" 2577 | # define __LZO_ASM_CLOBBER_LIST_CC /*empty*/ 2578 | # define __LZO_ASM_CLOBBER_LIST_CC_MEMORY /*empty*/ 2579 | # define __LZO_ASM_CLOBBER_LIST_EMPTY /*empty*/ 2580 | #elif (LZO_CC_INTELC && (__INTEL_COMPILER < 1000)) 2581 | # define __LZO_ASM_CLOBBER "memory" 2582 | # define __LZO_ASM_CLOBBER_LIST_CC /*empty*/ 2583 | # define __LZO_ASM_CLOBBER_LIST_CC_MEMORY : "memory" 2584 | # define __LZO_ASM_CLOBBER_LIST_EMPTY /*empty*/ 2585 | #else 2586 | # define __LZO_ASM_CLOBBER "cc", "memory" 2587 | # define __LZO_ASM_CLOBBER_LIST_CC : "cc" 2588 | # define __LZO_ASM_CLOBBER_LIST_CC_MEMORY : "cc", "memory" 2589 | # define __LZO_ASM_CLOBBER_LIST_EMPTY /*empty*/ 2590 | #endif 2591 | #endif 2592 | #if (LZO_ARCH_ALPHA) 2593 | # define LZO_OPT_AVOID_UINT_INDEX 1 2594 | #elif (LZO_ARCH_AMD64) 2595 | # define LZO_OPT_AVOID_INT_INDEX 1 2596 | # define LZO_OPT_AVOID_UINT_INDEX 1 2597 | # ifndef LZO_OPT_UNALIGNED16 2598 | # define LZO_OPT_UNALIGNED16 1 2599 | # endif 2600 | # ifndef LZO_OPT_UNALIGNED32 2601 | # define LZO_OPT_UNALIGNED32 1 2602 | # endif 2603 | # ifndef LZO_OPT_UNALIGNED64 2604 | # define LZO_OPT_UNALIGNED64 1 2605 | # endif 2606 | #elif (LZO_ARCH_ARM) 2607 | # if defined(__ARM_FEATURE_UNALIGNED) 2608 | # if ((__ARM_FEATURE_UNALIGNED)+0) 2609 | # ifndef LZO_OPT_UNALIGNED16 2610 | # define LZO_OPT_UNALIGNED16 1 2611 | # endif 2612 | # ifndef LZO_OPT_UNALIGNED32 2613 | # define LZO_OPT_UNALIGNED32 1 2614 | # endif 2615 | # endif 2616 | # elif 1 && (LZO_ARCH_ARM_THUMB2) 2617 | # ifndef LZO_OPT_UNALIGNED16 2618 | # define LZO_OPT_UNALIGNED16 1 2619 | # endif 2620 | # ifndef LZO_OPT_UNALIGNED32 2621 | # define LZO_OPT_UNALIGNED32 1 2622 | # endif 2623 | # elif 1 && defined(__ARM_ARCH) && ((__ARM_ARCH)+0 >= 7) 2624 | # ifndef LZO_OPT_UNALIGNED16 2625 | # define LZO_OPT_UNALIGNED16 1 2626 | # endif 2627 | # ifndef LZO_OPT_UNALIGNED32 2628 | # define LZO_OPT_UNALIGNED32 1 2629 | # endif 2630 | # elif 1 && defined(__TARGET_ARCH_ARM) && ((__TARGET_ARCH_ARM)+0 >= 7) 2631 | # ifndef LZO_OPT_UNALIGNED16 2632 | # define LZO_OPT_UNALIGNED16 1 2633 | # endif 2634 | # ifndef LZO_OPT_UNALIGNED32 2635 | # define LZO_OPT_UNALIGNED32 1 2636 | # endif 2637 | # elif 1 && defined(__TARGET_ARCH_ARM) && ((__TARGET_ARCH_ARM)+0 >= 6) && (defined(__TARGET_PROFILE_A) || defined(__TARGET_PROFILE_R)) 2638 | # ifndef LZO_OPT_UNALIGNED16 2639 | # define LZO_OPT_UNALIGNED16 1 2640 | # endif 2641 | # ifndef LZO_OPT_UNALIGNED32 2642 | # define LZO_OPT_UNALIGNED32 1 2643 | # endif 2644 | # elif 1 && defined(_MSC_VER) && defined(_M_ARM) && ((_M_ARM)+0 >= 7) 2645 | # ifndef LZO_OPT_UNALIGNED16 2646 | # define LZO_OPT_UNALIGNED16 1 2647 | # endif 2648 | # ifndef LZO_OPT_UNALIGNED32 2649 | # define LZO_OPT_UNALIGNED32 1 2650 | # endif 2651 | # endif 2652 | #elif (LZO_ARCH_ARM64) 2653 | # ifndef LZO_OPT_UNALIGNED16 2654 | # define LZO_OPT_UNALIGNED16 1 2655 | # endif 2656 | # ifndef LZO_OPT_UNALIGNED32 2657 | # define LZO_OPT_UNALIGNED32 1 2658 | # endif 2659 | # ifndef LZO_OPT_UNALIGNED64 2660 | # define LZO_OPT_UNALIGNED64 1 2661 | # endif 2662 | #elif (LZO_ARCH_CRIS) 2663 | # ifndef LZO_OPT_UNALIGNED16 2664 | # define LZO_OPT_UNALIGNED16 1 2665 | # endif 2666 | # ifndef LZO_OPT_UNALIGNED32 2667 | # define LZO_OPT_UNALIGNED32 1 2668 | # endif 2669 | #elif (LZO_ARCH_I386) 2670 | # ifndef LZO_OPT_UNALIGNED16 2671 | # define LZO_OPT_UNALIGNED16 1 2672 | # endif 2673 | # ifndef LZO_OPT_UNALIGNED32 2674 | # define LZO_OPT_UNALIGNED32 1 2675 | # endif 2676 | #elif (LZO_ARCH_IA64) 2677 | # define LZO_OPT_AVOID_INT_INDEX 1 2678 | # define LZO_OPT_AVOID_UINT_INDEX 1 2679 | # define LZO_OPT_PREFER_POSTINC 1 2680 | #elif (LZO_ARCH_M68K) 2681 | # define LZO_OPT_PREFER_POSTINC 1 2682 | # define LZO_OPT_PREFER_PREDEC 1 2683 | # if defined(__mc68020__) && !defined(__mcoldfire__) 2684 | # ifndef LZO_OPT_UNALIGNED16 2685 | # define LZO_OPT_UNALIGNED16 1 2686 | # endif 2687 | # ifndef LZO_OPT_UNALIGNED32 2688 | # define LZO_OPT_UNALIGNED32 1 2689 | # endif 2690 | # endif 2691 | #elif (LZO_ARCH_MIPS) 2692 | # define LZO_OPT_AVOID_UINT_INDEX 1 2693 | #elif (LZO_ARCH_POWERPC) 2694 | # define LZO_OPT_PREFER_PREINC 1 2695 | # define LZO_OPT_PREFER_PREDEC 1 2696 | # if (LZO_ABI_BIG_ENDIAN) || (LZO_WORDSIZE == 8) 2697 | # ifndef LZO_OPT_UNALIGNED16 2698 | # define LZO_OPT_UNALIGNED16 1 2699 | # endif 2700 | # ifndef LZO_OPT_UNALIGNED32 2701 | # define LZO_OPT_UNALIGNED32 1 2702 | # endif 2703 | # if (LZO_WORDSIZE == 8) 2704 | # ifndef LZO_OPT_UNALIGNED64 2705 | # define LZO_OPT_UNALIGNED64 1 2706 | # endif 2707 | # endif 2708 | # endif 2709 | #elif (LZO_ARCH_RISCV) 2710 | # define LZO_OPT_AVOID_UINT_INDEX 1 2711 | # ifndef LZO_OPT_UNALIGNED16 2712 | # define LZO_OPT_UNALIGNED16 1 2713 | # endif 2714 | # ifndef LZO_OPT_UNALIGNED32 2715 | # define LZO_OPT_UNALIGNED32 1 2716 | # endif 2717 | # if (LZO_WORDSIZE == 8) 2718 | # ifndef LZO_OPT_UNALIGNED64 2719 | # define LZO_OPT_UNALIGNED64 1 2720 | # endif 2721 | # endif 2722 | #elif (LZO_ARCH_S390) 2723 | # ifndef LZO_OPT_UNALIGNED16 2724 | # define LZO_OPT_UNALIGNED16 1 2725 | # endif 2726 | # ifndef LZO_OPT_UNALIGNED32 2727 | # define LZO_OPT_UNALIGNED32 1 2728 | # endif 2729 | # if (LZO_WORDSIZE == 8) 2730 | # ifndef LZO_OPT_UNALIGNED64 2731 | # define LZO_OPT_UNALIGNED64 1 2732 | # endif 2733 | # endif 2734 | #elif (LZO_ARCH_SH) 2735 | # define LZO_OPT_PREFER_POSTINC 1 2736 | # define LZO_OPT_PREFER_PREDEC 1 2737 | #endif 2738 | #ifndef LZO_CFG_NO_INLINE_ASM 2739 | #if (LZO_ABI_NEUTRAL_ENDIAN) || (LZO_ARCH_GENERIC) 2740 | # define LZO_CFG_NO_INLINE_ASM 1 2741 | #elif (LZO_CC_LLVM) 2742 | # define LZO_CFG_NO_INLINE_ASM 1 2743 | #endif 2744 | #endif 2745 | #if (LZO_CFG_NO_INLINE_ASM) 2746 | # undef LZO_ASM_SYNTAX_MSC 2747 | # undef LZO_ASM_SYNTAX_GNUC 2748 | # undef __LZO_ASM_CLOBBER 2749 | # undef __LZO_ASM_CLOBBER_LIST_CC 2750 | # undef __LZO_ASM_CLOBBER_LIST_CC_MEMORY 2751 | # undef __LZO_ASM_CLOBBER_LIST_EMPTY 2752 | #endif 2753 | #ifndef LZO_CFG_NO_UNALIGNED 2754 | #if (LZO_ABI_NEUTRAL_ENDIAN) || (LZO_ARCH_GENERIC) 2755 | # define LZO_CFG_NO_UNALIGNED 1 2756 | #endif 2757 | #endif 2758 | #if (LZO_CFG_NO_UNALIGNED) 2759 | # undef LZO_OPT_UNALIGNED16 2760 | # undef LZO_OPT_UNALIGNED32 2761 | # undef LZO_OPT_UNALIGNED64 2762 | #endif 2763 | #if defined(__LZO_INFOSTR_MM) 2764 | #elif (LZO_MM_FLAT) && (defined(__LZO_INFOSTR_PM) || defined(LZO_INFO_ABI_PM)) 2765 | # define __LZO_INFOSTR_MM "" 2766 | #elif defined(LZO_INFO_MM) 2767 | # define __LZO_INFOSTR_MM "." LZO_INFO_MM 2768 | #else 2769 | # define __LZO_INFOSTR_MM "" 2770 | #endif 2771 | #if defined(__LZO_INFOSTR_PM) 2772 | #elif defined(LZO_INFO_ABI_PM) 2773 | # define __LZO_INFOSTR_PM "." LZO_INFO_ABI_PM 2774 | #else 2775 | # define __LZO_INFOSTR_PM "" 2776 | #endif 2777 | #if defined(__LZO_INFOSTR_ENDIAN) 2778 | #elif defined(LZO_INFO_ABI_ENDIAN) 2779 | # define __LZO_INFOSTR_ENDIAN "." LZO_INFO_ABI_ENDIAN 2780 | #else 2781 | # define __LZO_INFOSTR_ENDIAN "" 2782 | #endif 2783 | #if defined(__LZO_INFOSTR_OSNAME) 2784 | #elif defined(LZO_INFO_OS_CONSOLE) 2785 | # define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_CONSOLE 2786 | #elif defined(LZO_INFO_OS_POSIX) 2787 | # define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_POSIX 2788 | #else 2789 | # define __LZO_INFOSTR_OSNAME LZO_INFO_OS 2790 | #endif 2791 | #if defined(__LZO_INFOSTR_LIBC) 2792 | #elif defined(LZO_INFO_LIBC) 2793 | # define __LZO_INFOSTR_LIBC "." LZO_INFO_LIBC 2794 | #else 2795 | # define __LZO_INFOSTR_LIBC "" 2796 | #endif 2797 | #if defined(__LZO_INFOSTR_CCVER) 2798 | #elif defined(LZO_INFO_CCVER) 2799 | # define __LZO_INFOSTR_CCVER " " LZO_INFO_CCVER 2800 | #else 2801 | # define __LZO_INFOSTR_CCVER "" 2802 | #endif 2803 | #define LZO_INFO_STRING \ 2804 | LZO_INFO_ARCH __LZO_INFOSTR_MM __LZO_INFOSTR_PM __LZO_INFOSTR_ENDIAN \ 2805 | " " __LZO_INFOSTR_OSNAME __LZO_INFOSTR_LIBC " " LZO_INFO_CC __LZO_INFOSTR_CCVER 2806 | #if !(LZO_CFG_SKIP_LZO_TYPES) 2807 | #if (!(LZO_SIZEOF_SHORT+0 > 0 && LZO_SIZEOF_INT+0 > 0 && LZO_SIZEOF_LONG+0 > 0)) 2808 | # error "missing defines for sizes" 2809 | #endif 2810 | #if (!(LZO_SIZEOF_PTRDIFF_T+0 > 0 && LZO_SIZEOF_SIZE_T+0 > 0 && LZO_SIZEOF_VOID_P+0 > 0)) 2811 | # error "missing defines for sizes" 2812 | #endif 2813 | #define LZO_TYPEOF_CHAR 1u 2814 | #define LZO_TYPEOF_SHORT 2u 2815 | #define LZO_TYPEOF_INT 3u 2816 | #define LZO_TYPEOF_LONG 4u 2817 | #define LZO_TYPEOF_LONG_LONG 5u 2818 | #define LZO_TYPEOF___INT8 17u 2819 | #define LZO_TYPEOF___INT16 18u 2820 | #define LZO_TYPEOF___INT32 19u 2821 | #define LZO_TYPEOF___INT64 20u 2822 | #define LZO_TYPEOF___INT128 21u 2823 | #define LZO_TYPEOF___INT256 22u 2824 | #define LZO_TYPEOF___MODE_QI 33u 2825 | #define LZO_TYPEOF___MODE_HI 34u 2826 | #define LZO_TYPEOF___MODE_SI 35u 2827 | #define LZO_TYPEOF___MODE_DI 36u 2828 | #define LZO_TYPEOF___MODE_TI 37u 2829 | #define LZO_TYPEOF_CHAR_P 129u 2830 | #if !defined(lzo_llong_t) 2831 | #if (LZO_SIZEOF_LONG_LONG+0 > 0) 2832 | # if !(LZO_LANG_ASSEMBLER) 2833 | __lzo_gnuc_extension__ typedef long long lzo_llong_t__; 2834 | __lzo_gnuc_extension__ typedef unsigned long long lzo_ullong_t__; 2835 | # endif 2836 | # define lzo_llong_t lzo_llong_t__ 2837 | # define lzo_ullong_t lzo_ullong_t__ 2838 | #endif 2839 | #endif 2840 | #if !defined(lzo_int16e_t) 2841 | #if (LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T == LZO_TYPEOF_SHORT) && (LZO_SIZEOF_SHORT != 2) 2842 | # undef LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T 2843 | #endif 2844 | #if (LZO_SIZEOF_LONG == 2) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T == LZO_TYPEOF_SHORT) 2845 | # define lzo_int16e_t long 2846 | # define lzo_uint16e_t unsigned long 2847 | # define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF_LONG 2848 | #elif (LZO_SIZEOF_INT == 2) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T == LZO_TYPEOF_SHORT) 2849 | # define lzo_int16e_t int 2850 | # define lzo_uint16e_t unsigned int 2851 | # define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF_INT 2852 | #elif (LZO_SIZEOF_SHORT == 2) 2853 | # define lzo_int16e_t short int 2854 | # define lzo_uint16e_t unsigned short int 2855 | # define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF_SHORT 2856 | #elif 1 && !(LZO_CFG_TYPE_NO_MODE_HI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM) 2857 | # if !(LZO_LANG_ASSEMBLER) 2858 | typedef int lzo_int16e_hi_t__ __attribute__((__mode__(__HI__))); 2859 | typedef unsigned int lzo_uint16e_hi_t__ __attribute__((__mode__(__HI__))); 2860 | # endif 2861 | # define lzo_int16e_t lzo_int16e_hi_t__ 2862 | # define lzo_uint16e_t lzo_uint16e_hi_t__ 2863 | # define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF___MODE_HI 2864 | #elif (LZO_SIZEOF___INT16 == 2) 2865 | # define lzo_int16e_t __int16 2866 | # define lzo_uint16e_t unsigned __int16 2867 | # define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF___INT16 2868 | #else 2869 | #endif 2870 | #endif 2871 | #if defined(lzo_int16e_t) 2872 | # define LZO_SIZEOF_LZO_INT16E_T 2 2873 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16e_t) == 2) 2874 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16e_t) == LZO_SIZEOF_LZO_INT16E_T) 2875 | #endif 2876 | #if !defined(lzo_int32e_t) 2877 | #if (LZO_CFG_PREFER_TYPEOF_ACC_INT32E_T == LZO_TYPEOF_INT) && (LZO_SIZEOF_INT != 4) 2878 | # undef LZO_CFG_PREFER_TYPEOF_ACC_INT32E_T 2879 | #endif 2880 | #if (LZO_SIZEOF_LONG == 4) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT32E_T == LZO_TYPEOF_INT) 2881 | # define lzo_int32e_t long int 2882 | # define lzo_uint32e_t unsigned long int 2883 | # define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_LONG 2884 | #elif (LZO_SIZEOF_INT == 4) 2885 | # define lzo_int32e_t int 2886 | # define lzo_uint32e_t unsigned int 2887 | # define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_INT 2888 | #elif (LZO_SIZEOF_SHORT == 4) 2889 | # define lzo_int32e_t short int 2890 | # define lzo_uint32e_t unsigned short int 2891 | # define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_SHORT 2892 | #elif (LZO_SIZEOF_LONG_LONG == 4) 2893 | # define lzo_int32e_t lzo_llong_t 2894 | # define lzo_uint32e_t lzo_ullong_t 2895 | # define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_LONG_LONG 2896 | #elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM) && (__INT_MAX__+0 > 2147483647L) 2897 | # if !(LZO_LANG_ASSEMBLER) 2898 | typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__))); 2899 | typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__))); 2900 | # endif 2901 | # define lzo_int32e_t lzo_int32e_si_t__ 2902 | # define lzo_uint32e_t lzo_uint32e_si_t__ 2903 | # define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF___MODE_SI 2904 | #elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_GNUC >= 0x025f00ul) && defined(__AVR__) && (__LONG_MAX__+0 == 32767L) 2905 | # if !(LZO_LANG_ASSEMBLER) 2906 | typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__))); 2907 | typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__))); 2908 | # endif 2909 | # define lzo_int32e_t lzo_int32e_si_t__ 2910 | # define lzo_uint32e_t lzo_uint32e_si_t__ 2911 | # define LZO_INT32_C(c) (c##LL) 2912 | # define LZO_UINT32_C(c) (c##ULL) 2913 | # define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF___MODE_SI 2914 | #elif (LZO_SIZEOF___INT32 == 4) 2915 | # define lzo_int32e_t __int32 2916 | # define lzo_uint32e_t unsigned __int32 2917 | # define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF___INT32 2918 | #else 2919 | #endif 2920 | #endif 2921 | #if defined(lzo_int32e_t) 2922 | # define LZO_SIZEOF_LZO_INT32E_T 4 2923 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32e_t) == 4) 2924 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32e_t) == LZO_SIZEOF_LZO_INT32E_T) 2925 | #endif 2926 | #if !defined(lzo_int64e_t) 2927 | #if (LZO_SIZEOF___INT64 == 8) 2928 | # if (LZO_CC_BORLANDC) && !defined(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T) 2929 | # define LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T LZO_TYPEOF___INT64 2930 | # endif 2931 | #endif 2932 | #if (LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF_LONG_LONG) && (LZO_SIZEOF_LONG_LONG != 8) 2933 | # undef LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T 2934 | #endif 2935 | #if (LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF___INT64) && (LZO_SIZEOF___INT64 != 8) 2936 | # undef LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T 2937 | #endif 2938 | #if (LZO_SIZEOF_INT == 8) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG) 2939 | # define lzo_int64e_t int 2940 | # define lzo_uint64e_t unsigned int 2941 | # define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF_INT 2942 | #elif (LZO_SIZEOF_LONG == 8) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF_LONG_LONG) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF___INT64) 2943 | # define lzo_int64e_t long int 2944 | # define lzo_uint64e_t unsigned long int 2945 | # define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF_LONG 2946 | #elif (LZO_SIZEOF_LONG_LONG == 8) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF___INT64) 2947 | # define lzo_int64e_t lzo_llong_t 2948 | # define lzo_uint64e_t lzo_ullong_t 2949 | # define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF_LONG_LONG 2950 | # if (LZO_CC_BORLANDC) 2951 | # define LZO_INT64_C(c) ((c) + 0ll) 2952 | # define LZO_UINT64_C(c) ((c) + 0ull) 2953 | # elif 0 2954 | # define LZO_INT64_C(c) (__lzo_gnuc_extension__ (c##LL)) 2955 | # define LZO_UINT64_C(c) (__lzo_gnuc_extension__ (c##ULL)) 2956 | # else 2957 | # define LZO_INT64_C(c) (c##LL) 2958 | # define LZO_UINT64_C(c) (c##ULL) 2959 | # endif 2960 | #elif (LZO_SIZEOF___INT64 == 8) 2961 | # define lzo_int64e_t __int64 2962 | # define lzo_uint64e_t unsigned __int64 2963 | # define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF___INT64 2964 | # if (LZO_CC_BORLANDC) 2965 | # define LZO_INT64_C(c) ((c) + 0i64) 2966 | # define LZO_UINT64_C(c) ((c) + 0ui64) 2967 | # else 2968 | # define LZO_INT64_C(c) (c##i64) 2969 | # define LZO_UINT64_C(c) (c##ui64) 2970 | # endif 2971 | #else 2972 | #endif 2973 | #endif 2974 | #if defined(lzo_int64e_t) 2975 | # define LZO_SIZEOF_LZO_INT64E_T 8 2976 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == 8) 2977 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == LZO_SIZEOF_LZO_INT64E_T) 2978 | #endif 2979 | #if !defined(lzo_int32l_t) 2980 | #if defined(lzo_int32e_t) 2981 | # define lzo_int32l_t lzo_int32e_t 2982 | # define lzo_uint32l_t lzo_uint32e_t 2983 | # define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_LZO_INT32E_T 2984 | # define LZO_TYPEOF_LZO_INT32L_T LZO_TYPEOF_LZO_INT32E_T 2985 | #elif (LZO_SIZEOF_INT >= 4) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG) 2986 | # define lzo_int32l_t int 2987 | # define lzo_uint32l_t unsigned int 2988 | # define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_INT 2989 | # define LZO_TYPEOF_LZO_INT32L_T LZO_SIZEOF_INT 2990 | #elif (LZO_SIZEOF_LONG >= 4) 2991 | # define lzo_int32l_t long int 2992 | # define lzo_uint32l_t unsigned long int 2993 | # define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_LONG 2994 | # define LZO_TYPEOF_LZO_INT32L_T LZO_SIZEOF_LONG 2995 | #else 2996 | # error "lzo_int32l_t" 2997 | #endif 2998 | #endif 2999 | #if 1 3000 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32l_t) >= 4) 3001 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32l_t) == LZO_SIZEOF_LZO_INT32L_T) 3002 | #endif 3003 | #if !defined(lzo_int64l_t) 3004 | #if defined(lzo_int64e_t) 3005 | # define lzo_int64l_t lzo_int64e_t 3006 | # define lzo_uint64l_t lzo_uint64e_t 3007 | # define LZO_SIZEOF_LZO_INT64L_T LZO_SIZEOF_LZO_INT64E_T 3008 | # define LZO_TYPEOF_LZO_INT64L_T LZO_TYPEOF_LZO_INT64E_T 3009 | #else 3010 | #endif 3011 | #endif 3012 | #if defined(lzo_int64l_t) 3013 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64l_t) >= 8) 3014 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64l_t) == LZO_SIZEOF_LZO_INT64L_T) 3015 | #endif 3016 | #if !defined(lzo_int32f_t) 3017 | #if (LZO_SIZEOF_SIZE_T >= 8) 3018 | # define lzo_int32f_t lzo_int64l_t 3019 | # define lzo_uint32f_t lzo_uint64l_t 3020 | # define LZO_SIZEOF_LZO_INT32F_T LZO_SIZEOF_LZO_INT64L_T 3021 | # define LZO_TYPEOF_LZO_INT32F_T LZO_TYPEOF_LZO_INT64L_T 3022 | #else 3023 | # define lzo_int32f_t lzo_int32l_t 3024 | # define lzo_uint32f_t lzo_uint32l_t 3025 | # define LZO_SIZEOF_LZO_INT32F_T LZO_SIZEOF_LZO_INT32L_T 3026 | # define LZO_TYPEOF_LZO_INT32F_T LZO_TYPEOF_LZO_INT32L_T 3027 | #endif 3028 | #endif 3029 | #if 1 3030 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32f_t) >= 4) 3031 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32f_t) == LZO_SIZEOF_LZO_INT32F_T) 3032 | #endif 3033 | #if !defined(lzo_int64f_t) 3034 | #if defined(lzo_int64l_t) 3035 | # define lzo_int64f_t lzo_int64l_t 3036 | # define lzo_uint64f_t lzo_uint64l_t 3037 | # define LZO_SIZEOF_LZO_INT64F_T LZO_SIZEOF_LZO_INT64L_T 3038 | # define LZO_TYPEOF_LZO_INT64F_T LZO_TYPEOF_LZO_INT64L_T 3039 | #else 3040 | #endif 3041 | #endif 3042 | #if defined(lzo_int64f_t) 3043 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64f_t) >= 8) 3044 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64f_t) == LZO_SIZEOF_LZO_INT64F_T) 3045 | #endif 3046 | #if !defined(lzo_intptr_t) 3047 | #if 1 && (LZO_OS_OS400 && (LZO_SIZEOF_VOID_P == 16)) 3048 | # define __LZO_INTPTR_T_IS_POINTER 1 3049 | # if !(LZO_LANG_ASSEMBLER) 3050 | typedef char * lzo_intptr_t; 3051 | typedef char * lzo_uintptr_t; 3052 | # endif 3053 | # define lzo_intptr_t lzo_intptr_t 3054 | # define lzo_uintptr_t lzo_uintptr_t 3055 | # define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_VOID_P 3056 | # define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_CHAR_P 3057 | #elif (LZO_CC_MSC && (_MSC_VER >= 1300) && (LZO_SIZEOF_VOID_P == 4) && (LZO_SIZEOF_INT == 4)) 3058 | # if !(LZO_LANG_ASSEMBLER) 3059 | typedef __w64 int lzo_intptr_t; 3060 | typedef __w64 unsigned int lzo_uintptr_t; 3061 | # endif 3062 | # define lzo_intptr_t lzo_intptr_t 3063 | # define lzo_uintptr_t lzo_uintptr_t 3064 | # define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_INT 3065 | # define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_INT 3066 | #elif (LZO_SIZEOF_SHORT == LZO_SIZEOF_VOID_P) && (LZO_SIZEOF_INT > LZO_SIZEOF_VOID_P) 3067 | # define lzo_intptr_t short 3068 | # define lzo_uintptr_t unsigned short 3069 | # define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_SHORT 3070 | # define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_SHORT 3071 | #elif (LZO_SIZEOF_INT >= LZO_SIZEOF_VOID_P) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG) 3072 | # define lzo_intptr_t int 3073 | # define lzo_uintptr_t unsigned int 3074 | # define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_INT 3075 | # define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_INT 3076 | #elif (LZO_SIZEOF_LONG >= LZO_SIZEOF_VOID_P) 3077 | # define lzo_intptr_t long 3078 | # define lzo_uintptr_t unsigned long 3079 | # define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_LONG 3080 | # define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_LONG 3081 | #elif (LZO_SIZEOF_LZO_INT64L_T >= LZO_SIZEOF_VOID_P) 3082 | # define lzo_intptr_t lzo_int64l_t 3083 | # define lzo_uintptr_t lzo_uint64l_t 3084 | # define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_LZO_INT64L_T 3085 | # define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_LZO_INT64L_T 3086 | #else 3087 | # error "lzo_intptr_t" 3088 | #endif 3089 | #endif 3090 | #if 1 3091 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_intptr_t) >= sizeof(void *)) 3092 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_intptr_t) == sizeof(lzo_uintptr_t)) 3093 | #endif 3094 | #if !defined(lzo_word_t) 3095 | #if defined(LZO_WORDSIZE) && (LZO_WORDSIZE+0 > 0) 3096 | #if (LZO_WORDSIZE == LZO_SIZEOF_LZO_INTPTR_T) && !(__LZO_INTPTR_T_IS_POINTER) 3097 | # define lzo_word_t lzo_uintptr_t 3098 | # define lzo_sword_t lzo_intptr_t 3099 | # define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LZO_INTPTR_T 3100 | # define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_LZO_INTPTR_T 3101 | #elif (LZO_WORDSIZE == LZO_SIZEOF_LONG) 3102 | # define lzo_word_t unsigned long 3103 | # define lzo_sword_t long 3104 | # define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LONG 3105 | # define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_LONG 3106 | #elif (LZO_WORDSIZE == LZO_SIZEOF_INT) 3107 | # define lzo_word_t unsigned int 3108 | # define lzo_sword_t int 3109 | # define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_INT 3110 | # define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_INT 3111 | #elif (LZO_WORDSIZE == LZO_SIZEOF_SHORT) 3112 | # define lzo_word_t unsigned short 3113 | # define lzo_sword_t short 3114 | # define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_SHORT 3115 | # define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_SHORT 3116 | #elif (LZO_WORDSIZE == 1) 3117 | # define lzo_word_t unsigned char 3118 | # define lzo_sword_t signed char 3119 | # define LZO_SIZEOF_LZO_WORD_T 1 3120 | # define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_CHAR 3121 | #elif (LZO_WORDSIZE == LZO_SIZEOF_LZO_INT64L_T) 3122 | # define lzo_word_t lzo_uint64l_t 3123 | # define lzo_sword_t lzo_int64l_t 3124 | # define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LZO_INT64L_T 3125 | # define LZO_TYPEOF_LZO_WORD_T LZO_SIZEOF_LZO_INT64L_T 3126 | #elif (LZO_ARCH_SPU) && (LZO_CC_GNUC) 3127 | #if 0 3128 | # if !(LZO_LANG_ASSEMBLER) 3129 | typedef unsigned lzo_word_t __attribute__((__mode__(__V16QI__))); 3130 | typedef int lzo_sword_t __attribute__((__mode__(__V16QI__))); 3131 | # endif 3132 | # define lzo_word_t lzo_word_t 3133 | # define lzo_sword_t lzo_sword_t 3134 | # define LZO_SIZEOF_LZO_WORD_T 16 3135 | # define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF___MODE_V16QI 3136 | #endif 3137 | #else 3138 | # error "lzo_word_t" 3139 | #endif 3140 | #endif 3141 | #endif 3142 | #if 1 && defined(lzo_word_t) 3143 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_word_t) == LZO_WORDSIZE) 3144 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_sword_t) == LZO_WORDSIZE) 3145 | #endif 3146 | #if 1 3147 | #define lzo_int8_t signed char 3148 | #define lzo_uint8_t unsigned char 3149 | #define LZO_SIZEOF_LZO_INT8_T 1 3150 | #define LZO_TYPEOF_LZO_INT8_T LZO_TYPEOF_CHAR 3151 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == 1) 3152 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == sizeof(lzo_uint8_t)) 3153 | #endif 3154 | #if defined(lzo_int16e_t) 3155 | #define lzo_int16_t lzo_int16e_t 3156 | #define lzo_uint16_t lzo_uint16e_t 3157 | #define LZO_SIZEOF_LZO_INT16_T LZO_SIZEOF_LZO_INT16E_T 3158 | #define LZO_TYPEOF_LZO_INT16_T LZO_TYPEOF_LZO_INT16E_T 3159 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == 2) 3160 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == sizeof(lzo_uint16_t)) 3161 | #endif 3162 | #if defined(lzo_int32e_t) 3163 | #define lzo_int32_t lzo_int32e_t 3164 | #define lzo_uint32_t lzo_uint32e_t 3165 | #define LZO_SIZEOF_LZO_INT32_T LZO_SIZEOF_LZO_INT32E_T 3166 | #define LZO_TYPEOF_LZO_INT32_T LZO_TYPEOF_LZO_INT32E_T 3167 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == 4) 3168 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == sizeof(lzo_uint32_t)) 3169 | #endif 3170 | #if defined(lzo_int64e_t) 3171 | #define lzo_int64_t lzo_int64e_t 3172 | #define lzo_uint64_t lzo_uint64e_t 3173 | #define LZO_SIZEOF_LZO_INT64_T LZO_SIZEOF_LZO_INT64E_T 3174 | #define LZO_TYPEOF_LZO_INT64_T LZO_TYPEOF_LZO_INT64E_T 3175 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == 8) 3176 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == sizeof(lzo_uint64_t)) 3177 | #endif 3178 | #if 1 3179 | #define lzo_int_least32_t lzo_int32l_t 3180 | #define lzo_uint_least32_t lzo_uint32l_t 3181 | #define LZO_SIZEOF_LZO_INT_LEAST32_T LZO_SIZEOF_LZO_INT32L_T 3182 | #define LZO_TYPEOF_LZO_INT_LEAST32_T LZO_TYPEOF_LZO_INT32L_T 3183 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least32_t) >= 4) 3184 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least32_t) == sizeof(lzo_uint_least32_t)) 3185 | #endif 3186 | #if defined(lzo_int64l_t) 3187 | #define lzo_int_least64_t lzo_int64l_t 3188 | #define lzo_uint_least64_t lzo_uint64l_t 3189 | #define LZO_SIZEOF_LZO_INT_LEAST64_T LZO_SIZEOF_LZO_INT64L_T 3190 | #define LZO_TYPEOF_LZO_INT_LEAST64_T LZO_TYPEOF_LZO_INT64L_T 3191 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least64_t) >= 8) 3192 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least64_t) == sizeof(lzo_uint_least64_t)) 3193 | #endif 3194 | #if 1 3195 | #define lzo_int_fast32_t lzo_int32f_t 3196 | #define lzo_uint_fast32_t lzo_uint32f_t 3197 | #define LZO_SIZEOF_LZO_INT_FAST32_T LZO_SIZEOF_LZO_INT32F_T 3198 | #define LZO_TYPEOF_LZO_INT_FAST32_T LZO_TYPEOF_LZO_INT32F_T 3199 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast32_t) >= 4) 3200 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast32_t) == sizeof(lzo_uint_fast32_t)) 3201 | #endif 3202 | #if defined(lzo_int64f_t) 3203 | #define lzo_int_fast64_t lzo_int64f_t 3204 | #define lzo_uint_fast64_t lzo_uint64f_t 3205 | #define LZO_SIZEOF_LZO_INT_FAST64_T LZO_SIZEOF_LZO_INT64F_T 3206 | #define LZO_TYPEOF_LZO_INT_FAST64_T LZO_TYPEOF_LZO_INT64F_T 3207 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast64_t) >= 8) 3208 | LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast64_t) == sizeof(lzo_uint_fast64_t)) 3209 | #endif 3210 | #if !defined(LZO_INT16_C) 3211 | # if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 2) 3212 | # define LZO_INT16_C(c) ((c) + 0) 3213 | # define LZO_UINT16_C(c) ((c) + 0U) 3214 | # elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 2) 3215 | # define LZO_INT16_C(c) ((c) + 0L) 3216 | # define LZO_UINT16_C(c) ((c) + 0UL) 3217 | # elif (LZO_SIZEOF_INT >= 2) 3218 | # define LZO_INT16_C(c) (c) 3219 | # define LZO_UINT16_C(c) (c##U) 3220 | # elif (LZO_SIZEOF_LONG >= 2) 3221 | # define LZO_INT16_C(c) (c##L) 3222 | # define LZO_UINT16_C(c) (c##UL) 3223 | # else 3224 | # error "LZO_INT16_C" 3225 | # endif 3226 | #endif 3227 | #if !defined(LZO_INT32_C) 3228 | # if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 4) 3229 | # define LZO_INT32_C(c) ((c) + 0) 3230 | # define LZO_UINT32_C(c) ((c) + 0U) 3231 | # elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 4) 3232 | # define LZO_INT32_C(c) ((c) + 0L) 3233 | # define LZO_UINT32_C(c) ((c) + 0UL) 3234 | # elif (LZO_SIZEOF_INT >= 4) 3235 | # define LZO_INT32_C(c) (c) 3236 | # define LZO_UINT32_C(c) (c##U) 3237 | # elif (LZO_SIZEOF_LONG >= 4) 3238 | # define LZO_INT32_C(c) (c##L) 3239 | # define LZO_UINT32_C(c) (c##UL) 3240 | # elif (LZO_SIZEOF_LONG_LONG >= 4) 3241 | # define LZO_INT32_C(c) (c##LL) 3242 | # define LZO_UINT32_C(c) (c##ULL) 3243 | # else 3244 | # error "LZO_INT32_C" 3245 | # endif 3246 | #endif 3247 | #if !defined(LZO_INT64_C) && defined(lzo_int64l_t) 3248 | # if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 8) 3249 | # define LZO_INT64_C(c) ((c) + 0) 3250 | # define LZO_UINT64_C(c) ((c) + 0U) 3251 | # elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 8) 3252 | # define LZO_INT64_C(c) ((c) + 0L) 3253 | # define LZO_UINT64_C(c) ((c) + 0UL) 3254 | # elif (LZO_SIZEOF_INT >= 8) 3255 | # define LZO_INT64_C(c) (c) 3256 | # define LZO_UINT64_C(c) (c##U) 3257 | # elif (LZO_SIZEOF_LONG >= 8) 3258 | # define LZO_INT64_C(c) (c##L) 3259 | # define LZO_UINT64_C(c) (c##UL) 3260 | # else 3261 | # error "LZO_INT64_C" 3262 | # endif 3263 | #endif 3264 | #endif 3265 | 3266 | #endif /* already included */ 3267 | 3268 | /* vim:set ts=4 sw=4 et: */ 3269 | -------------------------------------------------------------------------------- /minilzo.h: -------------------------------------------------------------------------------- 1 | /* minilzo.h -- mini subset of the LZO real-time data compression library 2 | 3 | This file is part of the LZO real-time data compression library. 4 | 5 | Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer 6 | All Rights Reserved. 7 | 8 | The LZO library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU General Public License as 10 | published by the Free Software Foundation; either version 2 of 11 | the License, or (at your option) any later version. 12 | 13 | The LZO library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with the LZO library; see the file COPYING. 20 | If not, write to the Free Software Foundation, Inc., 21 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 22 | 23 | Markus F.X.J. Oberhumer 24 | 25 | http://www.oberhumer.com/opensource/lzo/ 26 | */ 27 | 28 | /* 29 | * NOTE: 30 | * the full LZO package can be found at 31 | * http://www.oberhumer.com/opensource/lzo/ 32 | */ 33 | 34 | 35 | #ifndef __MINILZO_H_INCLUDED 36 | #define __MINILZO_H_INCLUDED 1 37 | 38 | #define MINILZO_VERSION 0x20a0 /* 2.10 */ 39 | 40 | /* we must provide a little more output space in case that compression is not possible */ 41 | #define MINILZO_BUFFER_PADDING(x) ((x) / 16 + 64 + 3) 42 | 43 | #if defined(__LZOCONF_H_INCLUDED) 44 | # error "you cannot use both LZO and miniLZO" 45 | #endif 46 | 47 | /* internal Autoconf configuration file - only used when building miniLZO */ 48 | #ifdef MINILZO_HAVE_CONFIG_H 49 | # include 50 | #endif 51 | #include 52 | #include 53 | 54 | #ifndef __LZODEFS_H_INCLUDED 55 | #include "lzodefs.h" 56 | #endif 57 | #undef LZO_HAVE_CONFIG_H 58 | #include "lzoconf.h" 59 | 60 | #if !defined(LZO_VERSION) || (LZO_VERSION != MINILZO_VERSION) 61 | # error "version mismatch in header files" 62 | #endif 63 | 64 | 65 | #ifdef __cplusplus 66 | extern "C" { 67 | #endif 68 | 69 | 70 | /*********************************************************************** 71 | // 72 | ************************************************************************/ 73 | 74 | /* Memory required for the wrkmem parameter. 75 | * When the required size is 0, you can also pass a NULL pointer. 76 | */ 77 | 78 | #define LZO1X_MEM_COMPRESS LZO1X_1_MEM_COMPRESS 79 | #define LZO1X_1_MEM_COMPRESS ((lzo_uint32_t) (8192L * lzo_sizeof_dict_t)) 80 | #define LZO1X_MEM_DECOMPRESS (0) 81 | 82 | 83 | /* compression */ 84 | LZO_EXTERN(int) 85 | lzo1x_1_compress ( const lzo_bytep src, lzo_uint src_len, 86 | lzo_bytep dst, lzo_uintp dst_len, 87 | lzo_voidp wrkmem ); 88 | 89 | /* decompression */ 90 | LZO_EXTERN(int) 91 | lzo1x_decompress ( const lzo_bytep src, lzo_uint src_len, 92 | lzo_bytep dst, lzo_uintp dst_len, 93 | lzo_voidp wrkmem /* NOT USED */ ); 94 | 95 | /* safe decompression with overrun testing */ 96 | LZO_EXTERN(int) 97 | lzo1x_decompress_safe ( const lzo_bytep src, lzo_uint src_len, 98 | lzo_bytep dst, lzo_uintp dst_len, 99 | lzo_voidp wrkmem /* NOT USED */ ); 100 | 101 | 102 | #ifdef __cplusplus 103 | } /* extern "C" */ 104 | #endif 105 | 106 | #endif /* already included */ 107 | 108 | 109 | /* vim:set ts=4 sw=4 et: */ 110 | -------------------------------------------------------------------------------- /minilzo_sample.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : minilzo_sample.c 3 | * this example is a very simple test program for the minilzo library, 4 | * using non-stream compress and decompress. If you want to use stream compress, 5 | * you need at least 100K of ROM for history buffer(not recommend), or you can custom 6 | * header to storage the compress block size, and carry out stream compress by non-stream. 7 | * 8 | * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License along 21 | * with this program; if not, write to the Free Software Foundation, Inc., 22 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 23 | * 24 | * Change Logs: 25 | * Date Author Notes 26 | * 2018-02-05 chenyong first version 27 | * 2018-02-11 Murphy Adapted minilzo 28 | */ 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | 38 | #include "minilzo.h" 39 | 40 | #define malloc rt_malloc 41 | #define free rt_free 42 | 43 | #define BLOCK_HEADER_SIZE 4 44 | 45 | /* The output buffer can not be smaller than 66 bytes */ 46 | #define COMPRESS_BUFFER_SIZE 4096 47 | #define DCOMPRESS_BUFFER_SIZE 4096 48 | 49 | /* we must provide a little more output space in case that compression is not possible */ 50 | #define BUFFER_PADDING MINILZO_BUFFER_PADDING(COMPRESS_BUFFER_SIZE) 51 | 52 | static int minilzo_compress_file(int fd_in, int fd_out) 53 | { 54 | /* Start to compress file */ 55 | rt_uint8_t *cmprs_buffer = RT_NULL, *buffer = RT_NULL; 56 | rt_uint8_t buffer_hdr[BLOCK_HEADER_SIZE] = { 0 }; 57 | int cmprs_size = 0, block_size = 0, totle_cmprs_size = 0; 58 | size_t file_size = 0, i = 0; 59 | int ret = 0; 60 | 61 | /* Work-memory needed for compression */ 62 | lzo_voidp wrkmem = (lzo_voidp)malloc(LZO1X_1_MEM_COMPRESS); 63 | memset(wrkmem, 0x00, LZO1X_1_MEM_COMPRESS); 64 | 65 | file_size = lseek(fd_in, 0, SEEK_END); 66 | lseek(fd_in, 0, SEEK_SET); 67 | 68 | cmprs_buffer = (rt_uint8_t *) malloc(COMPRESS_BUFFER_SIZE + BUFFER_PADDING); 69 | buffer = (rt_uint8_t *) malloc(COMPRESS_BUFFER_SIZE); 70 | if (!cmprs_buffer || !buffer) 71 | { 72 | rt_kprintf("[minilzo] No memory for cmprs_buffer or buffer!\n"); 73 | ret = -1; 74 | goto _exit; 75 | } 76 | 77 | rt_kprintf("[minilzo]compress start : "); 78 | for (i = 0; i < file_size; i += COMPRESS_BUFFER_SIZE) 79 | { 80 | if ((file_size - i) < COMPRESS_BUFFER_SIZE) 81 | { 82 | block_size = file_size - i; 83 | } 84 | else 85 | { 86 | block_size = COMPRESS_BUFFER_SIZE; 87 | } 88 | 89 | memset(buffer, 0x00, COMPRESS_BUFFER_SIZE); 90 | memset(cmprs_buffer, 0x00, COMPRESS_BUFFER_SIZE + BUFFER_PADDING); 91 | 92 | read(fd_in, buffer, block_size); 93 | 94 | /* The destination buffer must be at least size + 400 bytes large because incompressible data may increase in size. */ 95 | ret = lzo1x_1_compress(buffer, block_size, cmprs_buffer, &cmprs_size, wrkmem); 96 | if (ret != LZO_E_OK) 97 | { 98 | ret = -1; 99 | goto _exit; 100 | } 101 | 102 | /* Store compress block size to the block header (4 byte). */ 103 | buffer_hdr[3] = cmprs_size % (1 << 8); 104 | buffer_hdr[2] = (cmprs_size % (1 << 16)) / (1 << 8); 105 | buffer_hdr[1] = (cmprs_size % (1 << 24)) / (1 << 16); 106 | buffer_hdr[0] = cmprs_size / (1 << 24); 107 | 108 | write(fd_out, buffer_hdr, BLOCK_HEADER_SIZE); 109 | write(fd_out, cmprs_buffer, cmprs_size); 110 | 111 | totle_cmprs_size += cmprs_size + BLOCK_HEADER_SIZE; 112 | rt_kprintf(">"); 113 | } 114 | 115 | rt_kprintf("\n"); 116 | rt_kprintf("[minilzo]compressed %d bytes into %d bytes , compression ratio is %d%!\n", file_size, totle_cmprs_size, 117 | (totle_cmprs_size * 100) / file_size); 118 | _exit: 119 | if (cmprs_buffer) 120 | { 121 | free(cmprs_buffer); 122 | } 123 | 124 | if (buffer) 125 | { 126 | free(buffer); 127 | } 128 | 129 | if (wrkmem) 130 | { 131 | free(wrkmem); 132 | } 133 | 134 | return ret; 135 | } 136 | 137 | 138 | static int minilzo_decompress_file(int fd_in, int fd_out) 139 | { 140 | /* Start to decompress file */ 141 | rt_uint8_t *dcmprs_buffer = RT_NULL, *buffer = RT_NULL; 142 | rt_uint8_t buffer_hdr[BLOCK_HEADER_SIZE] = { 0 }; 143 | size_t dcmprs_size = 0, block_size = 0, total_dcmprs_size = 0; 144 | size_t file_size = 0, i = 0; 145 | int ret = 0; 146 | 147 | file_size = lseek(fd_in, 0, SEEK_END); 148 | lseek(fd_in, 0, SEEK_SET); 149 | 150 | if (file_size <= BLOCK_HEADER_SIZE) 151 | { 152 | rt_kprintf("[minilzo] decomprssion file size : %d error!\n", file_size); 153 | ret = -1; 154 | goto _dcmprs_exit; 155 | } 156 | 157 | dcmprs_buffer = (rt_uint8_t *) malloc(DCOMPRESS_BUFFER_SIZE); 158 | buffer = (rt_uint8_t *) malloc(DCOMPRESS_BUFFER_SIZE + BUFFER_PADDING); 159 | if (!dcmprs_buffer || !buffer) 160 | { 161 | rt_kprintf("[minilzo] No memory for dcmprs_buffer or buffer!\n"); 162 | ret = -1; 163 | goto _dcmprs_exit; 164 | } 165 | 166 | rt_kprintf("[minilzo]decompress start : "); 167 | for (i = 0; i < file_size; i += BLOCK_HEADER_SIZE + block_size) 168 | { 169 | /* Get the decompress block size from the block header. */ 170 | read(fd_in, buffer_hdr, BLOCK_HEADER_SIZE); 171 | block_size = buffer_hdr[0] * (1 << 24) + buffer_hdr[1] * (1 << 16) + buffer_hdr[2] * (1 << 8) + buffer_hdr[3]; 172 | 173 | memset(buffer, 0x00, COMPRESS_BUFFER_SIZE + BUFFER_PADDING); 174 | memset(dcmprs_buffer, 0x00, DCOMPRESS_BUFFER_SIZE); 175 | 176 | read(fd_in, buffer, block_size); 177 | 178 | ret = lzo1x_decompress(buffer, block_size, dcmprs_buffer, &dcmprs_size, NULL); 179 | if (ret != LZO_E_OK) 180 | { 181 | ret = -1; 182 | goto _dcmprs_exit; 183 | } 184 | 185 | write(fd_out, dcmprs_buffer, dcmprs_size); 186 | 187 | total_dcmprs_size += dcmprs_size; 188 | rt_kprintf(">"); 189 | } 190 | rt_kprintf("\n"); 191 | rt_kprintf("decompressed %d bytes into %d bytes !\n", file_size, total_dcmprs_size); 192 | 193 | _dcmprs_exit: 194 | if (dcmprs_buffer) 195 | { 196 | free(dcmprs_buffer); 197 | } 198 | 199 | if(buffer) 200 | { 201 | free(buffer); 202 | } 203 | 204 | return ret; 205 | } 206 | 207 | int minilzo_test(int argc, char ** argv) 208 | { 209 | int fd_in = -1 , fd_out = -1; 210 | int ret = 0; 211 | 212 | if (argc != 4) 213 | { 214 | rt_kprintf("Usage:\n"); 215 | rt_kprintf("minilzo_test -c [file] [cmprs_file] -compress \"file\" to \"cmprs_file\" \n"); 216 | rt_kprintf("minilzo_test -d [cmprs_file] [dcmprs_file] -dcompress \"cmprs_file\" to \"dcmprs_file\" \n"); 217 | 218 | ret = -1; 219 | goto _exit; 220 | } 221 | 222 | rt_kprintf("\nminiLZO real-time data compression library (v%s, %s).\n", 223 | lzo_version_string(), lzo_version_date()); 224 | 225 | /* 226 | * Initialize the LZO library 227 | */ 228 | if (lzo_init() != LZO_E_OK) 229 | { 230 | rt_kprintf("internal error - lzo_init() failed !!!\n"); 231 | return 3; 232 | } 233 | 234 | fd_in = open(argv[2], O_RDONLY, 0); 235 | if (fd_in < 0) 236 | { 237 | rt_kprintf("[minilzo] open the input file : %s error!\n", argv[2]); 238 | ret = -1; 239 | goto _exit; 240 | } 241 | 242 | fd_out = open(argv[3], O_WRONLY | O_CREAT | O_TRUNC, 0); 243 | if (fd_out < 0) 244 | { 245 | rt_kprintf("[minilzo] open the output file : %s error!\n", argv[3]); 246 | ret = -1; 247 | goto _exit; 248 | } 249 | 250 | if(memcmp("-c", argv[1], strlen(argv[1])) == 0) 251 | { 252 | 253 | if(minilzo_compress_file(fd_in, fd_out) < 0) 254 | { 255 | rt_kprintf("[minilzo] minilzo compress file error!\n"); 256 | } 257 | 258 | } 259 | else if(memcmp("-d", argv[1], strlen(argv[1])) == 0) 260 | { 261 | 262 | if(minilzo_decompress_file(fd_in, fd_out) < 0) 263 | { 264 | rt_kprintf("[minilzo] minilzo decompress file error!\n"); 265 | } 266 | } 267 | else 268 | { 269 | rt_kprintf("Usage:\n"); 270 | rt_kprintf("minilzo_test -c [file] [cmprs_file] -compress \"file\" to \"cmprs_file\" \n"); 271 | rt_kprintf("minilzo_test -d [cmprs_file] [dcmprs_file] -dcompress \"cmprs_file\" to \"dcmprs_file\" \n"); 272 | 273 | ret = -1; 274 | goto _exit; 275 | } 276 | 277 | _exit: 278 | if(fd_in >= 0) 279 | { 280 | close(fd_in); 281 | } 282 | 283 | if(fd_out >= 0) 284 | { 285 | close(fd_out); 286 | } 287 | 288 | return ret; 289 | } 290 | 291 | #ifdef RT_USING_FINSH 292 | #ifdef FINSH_USING_MSH 293 | 294 | #include 295 | 296 | MSH_CMD_EXPORT(minilzo_test, minilzo compress and decompress test); 297 | #endif 298 | #endif 299 | --------------------------------------------------------------------------------